home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR8 / FRUGALED.ZIP / DEMO.C < prev    next >
C/C++ Source or Header  |  1993-10-13  |  5KB  |  145 lines

  1. //------------//
  2. //   DEMO.C   //
  3. //------------//
  4. // Demonstration Program for [FE] FrugalEdit v1.0 (c) 1993.
  5. // Using SMALL memory model library
  6.  
  7. #include "fe.h"
  8. void Ferror( int fe_error );
  9. char InputString[4096];
  10. int  StringLength = 4096;
  11.  
  12. int main()
  13. {
  14.     int i;
  15.  
  16.     int fe_error = 0; // Fedit() 's return
  17.     char filename[40] = "DEMO";    // default: daily journal 12-31-93
  18.     char helpfilename[40] = "FE.DOC";
  19.  
  20.     int left   = 0;  // 0 = use whole screen
  21.     int top    = 1;  // if left > 0, use specified coordinates
  22.     int right  = 80; // which includes one status line at the bottom
  23.     int bottom = 25; // and borders, if any.
  24.  
  25.     int c1 = FeC1;     // Editing Window Foreground Color
  26.     int c2 = FeC2;     //                Background
  27.     int c3 = FeC3;     // Status Line    Foreground Color
  28.     int c4 = FeC4;     //                Background
  29.     int c5 = FeC5;     // Border         Foreground Color
  30.     int c6 = FeC6;     //                Background
  31.     int c7 = FeC7;     // Block/Help     Foreground Color
  32.     int c8 = FeC8;     //                Background
  33.                        // start with default color settings
  34.  
  35.     int border = 1;   // 0=none, 1=horizontal, 2=vertical, 3=both
  36.     int border_str = 1; // 1=single line┌─┐, 2=double╔═╗, 3=block▄▄▄
  37.     int save_scr = 0; // 0=no, 1=yes
  38.  
  39.     int tab_size = 4;
  40.     int line_no = 1;
  41.     int col_no = 1;
  42.     int no_shell = 1;   // do not allow shelling out to DOS
  43.     int view = 0;
  44.     int sensitive = 0;  // default 0 = no; 1 = yes;
  45.     int wrap = 1;
  46.     int print = 0;       // use default printer initialization
  47.     int no_new_file = 1; // edit given existing file only
  48.     int no_other = 1;    // do not allow opening multiple files
  49.     int no_helpline = 0; // do not show help message on status line
  50.     int silence = 0;     // do not buz (ring bell) on error
  51.     int backup = 1;      // do not leave back up when saving
  52.  
  53.     unsigned text_buf_size = StringLength;
  54.  
  55. strcpy (InputString, "\
  56. Thank you for testing [FE] FrugalEdit v1.0 (c) 1993 S.C.Park, Esq.\n\
  57. \n\
  58.         [FE] is an easy to use full function text editor\n\
  59.         mainly designed to be used as a built-in editor\n\
  60.         in other programs by casual programers.\n\
  61. \n\
  62.         It is another tool for the casual programers much\n\
  63.         like the window/memu module or file management module.\n\
  64. \n\
  65.         It is highly configurable and most of all extremely easy\n\
  66.         to use either as the editor or as the text viewer.\n\
  67. \n\
  68.         To see documentation, press Ctrl-H.\n\
  69.         After experimenting, press Ctrl-Z or F7 to exit.\n\
  70. \n\
  71. Type in something below, please.\n");
  72.  
  73.  
  74.     fe_error = Fedit(filename, helpfilename,
  75.         border, border_str, save_scr,
  76.         left, top, right, bottom,
  77.         c1, c2, c3, c4, c5, c6, c7, c8,
  78.         tab_size, 100, col_no, no_shell,
  79.         view, sensitive, wrap, print,
  80.         no_new_file, no_other, no_helpline, silence, backup,
  81.         InputString, text_buf_size);
  82.  
  83.     if (fe_error) Ferror( fe_error );
  84.  
  85.     fe_error = Fedit("", helpfilename,//"" = no file save when string input
  86.         3, 2, save_scr,
  87.         5, top, right-5, bottom-3,
  88.         c1, c2, c3, c4, c5, c6, c7, c8,
  89.         tab_size, line_no, col_no, no_shell,
  90.         view, sensitive, wrap, print,
  91.         no_new_file, no_other, no_helpline, silence, backup,
  92.         InputString, text_buf_size);
  93.  
  94.     if (fe_error) Ferror( fe_error );
  95.  
  96.     strcpy( InputString, "Just Press F7, Please. " );
  97.     for (i=2; (i<51 && !fe_error); i++)
  98.         fe_error = Fedit("DEMO", helpfilename,
  99.             3, 3, save_scr,
  100.             5+i, 5+i, right-10, bottom-5,
  101.             c1+i, c2, c3+i, c4, c5+i, c6, c7, c8,
  102.             tab_size, line_no, 23, no_shell,
  103.             1, sensitive, wrap, print,
  104.             no_new_file, no_other, no_helpline, silence, backup,
  105.             InputString, text_buf_size);
  106.  
  107.     if (fe_error) {
  108.         strcpy( InputString, FeErr[fe_error] );
  109.         strcat( InputString, "\n\Press EXIT (F7) key." );
  110.         fe_error = Fedit("ERROR", helpfilename,
  111.             3, 2, 1,
  112.             10, 15, 40, 20,
  113.             c2+128, c1, c4, c3, c6, c5, c8, c7,
  114.             tab_size, 2, 21, no_shell,
  115.             1, sensitive, wrap, print,
  116.             no_new_file, no_other, no_helpline, silence, backup,
  117.             InputString, text_buf_size);
  118.     }
  119.  
  120.     fe_error = Fedit("FE.DOC", helpfilename,
  121.         0, 2, 1,
  122.         left, top, right, bottom,
  123.         c1, c2, c3, c4, c5, c6, c7, c8,
  124.         tab_size, line_no, col_no, no_shell,
  125.         1, sensitive, wrap, print,
  126.         1, 1, no_helpline, silence, backup,
  127.         "", 0);
  128.  
  129.     if (fe_error) Ferror( fe_error );
  130.  
  131.     gotoxy( 1, 25 );
  132.     puts( "\n[FE] FrugalEdit v1.0 (c) 1993 S.C.Park, Esq.     [shareware]" );
  133.     puts( "Demonstration finished." );
  134.     return fe_error;
  135. }
  136.  
  137.  
  138. void Ferror( int fe_error )
  139. {
  140.     puts( FeErr[fe_error] );
  141.     puts( "Press any key." );
  142.     getch();
  143.     exit( fe_error );
  144. }
  145.