home *** CD-ROM | disk | FTP | other *** search
/ Shareware 1 2 the Maxx / sw_1.zip / sw_1 / BUSI / SHIPPERS.ZIP / PLUS.LZH / BASIC.SCR < prev    next >
Text File  |  1992-10-28  |  3KB  |  149 lines

  1. bool   Fbypass,
  2.        Fedited,
  3.        Ffld_in_range,
  4.        Fnoneedited,
  5.        Fabort;
  6.  
  7. void rng_init(void)
  8. {
  9.  pad(OUTPUT_DEVICE,"CON ",4,Right);
  10.  fstr(LINES_PER_PAGE, valu("66"),3,0);
  11.     
  12. }
  13.  
  14.  
  15. void rng_dsp(void)
  16. {
  17.  dsp_fld(21,2,OUTPUT_DEVICE,_Ch,"4U",0,0,_av,rw.wa[1]);
  18.  dsp_fld(21,4,LINES_PER_PAGE,_Num,"3#",0,0,_av,rw.wa[1]);
  19.  strip(iodev,OUTPUT_DEVICE);
  20.  pagelength=ival(LINES_PER_PAGE);
  21.     
  22. }
  23.  
  24.  
  25. bool skipfield(int fnum)
  26. {
  27.     bool tb;
  28.  
  29.     tb = False;
  30.    switch (fnum) {
  31.    case 0 : break ;
  32.       
  33.    }
  34.     return(tb);
  35. }
  36.  
  37.  
  38. bool chk_fld(int chknum)
  39. {
  40.     string estr;
  41.  
  42.     *estr = '\0';
  43.     switch (chknum) {
  44.   case 1 : if (!(choice("CON |PRN |LPT1|LPT2",OUTPUT_DEVICE)))
  45.   strcpy(estr,(uchar *)choose(_tts, "CON |PRN |LPT1|LPT2|","",OUTPUT_DEVICE)); break;
  46.   case 2 : if (!(( valu(LINES_PER_PAGE) >=6) && ( valu(LINES_PER_PAGE) <=100)))
  47.   strcpy(estr, "Please enter a Page Length of between 6 and 100"); break;
  48.         
  49.     }
  50.     if (*estr != '\0') {
  51.     if (strcmp(estr,LSC_BaseError) != 0) {
  52.       audible(Error);
  53.           message(rw.wa[1],estr);
  54.     }
  55.     }
  56.     return ((bool) (*estr == '\0'));
  57. }
  58.  
  59.  
  60. void edt_n_chk(int x,int y,int l,int a,winptr h,strptr fld,char typ,strptr pic,int fldno)
  61. {
  62.     if (!skipfield(fldno)) {
  63.         do {
  64.             if (!Fbypass) {
  65.                 edt_fld(x, y, fld, typ, pic, (byte)(l), (byte)(a), rw.wa[1]);
  66.                 Fnoneedited = False;
  67.                 Fedited     = True;
  68.                 Fabort      = False;
  69.                 if (exitcode == HlpKey) disphelp(h);
  70.                 if (custom_key(1, 1, &fldnum, &exitcode)) exitcode = QitKey;
  71.             }
  72.             if ((exitcode != QitKey) && (exitcode != UArr) && (exitcode != HlpKey)) {
  73.                 Ffld_in_range = chk_fld(fldno);
  74.                 dsp_fld(x, y, fld, typ, pic, 0, (byte)(l), (byte)(a), rw.wa[1]);
  75.                 if (!Ffld_in_range) {
  76.                     fldnum = fldno;
  77.                     Fbypass = False;
  78.                 }
  79.             }
  80.         } while ((!Ffld_in_range) && (exitcode != QitKey) && (exitcode != UArr));
  81.         message(NULL,"");
  82.     }
  83. }
  84.  
  85.  
  86. void openedtmnu(winptr *edtwin)
  87. {
  88.     string ts;
  89.     int l;
  90.  
  91.     strcpy(ts, _EdtHelp);
  92.     l = strlen(ts);
  93.     if (openwin(0, (byte)(scrwid-l+1), scrhgt, (byte)(l), 1, 0x4F, 0x4F, 0, "\0┐│┘─└│┌", TopCnt, "")) {
  94.         *edtwin = curwin;
  95.         writewxy(ts, 0, 1, 1, *edtwin);
  96.         hidewin(T_ON, *edtwin);
  97.     }
  98.     else *edtwin = NULL;
  99. }
  100.  
  101.  
  102. void rng_edt(void)
  103. {
  104.     int    last_fld;
  105.     winptr edtwin;
  106.     bool   finished;
  107.  
  108.     openedtmnu(&edtwin);
  109.     attrib = _av;
  110.     exitcode = Nul;
  111.     Fabort = True;
  112.     Fbypass = False;
  113.     fldnum = 1;
  114.    finished = False;
  115.     do {
  116.        if (fldnum == 1) Fnoneedited = True;
  117.       if (last_fld == fldnum && !Fedited) fldnum++;
  118.         last_fld = fldnum;
  119.       Fedited = False;
  120.       switch (fldnum) {
  121.     case   1 : edt_n_chk(21,2,0,0,NULL,OUTPUT_DEVICE,_Ch,"4U",1); break;
  122.     case   2 : edt_n_chk(21,4,0,0,NULL,LINES_PER_PAGE,_Num,"3#",2); break;
  123.     case   3 : {
  124.      strip(iodev,OUTPUT_DEVICE);
  125.      } break;
  126.     case   4 : {
  127.      pagelength=ival(LINES_PER_PAGE);
  128.      } break;
  129.      default : {
  130.        if (Fnoneedited) {
  131.          finished = True;
  132.          if (Fabort) {
  133.            exitcode = QitKey;
  134.            dberrm(_NoneEdited);
  135.          }
  136.        }
  137.      else if (exitcode == XeptKey) finished = True; else fldnum = 0;
  138.      }
  139.             
  140.         }
  141.         if (Fbypass || !Fedited)
  142.             if (_upward && (fldnum > 1)) fldnum--; else fldnum++;
  143.         if (exitcode == XeptKey) Fbypass = True;
  144.         if (exitcode == QitKey) finished = True;
  145.         if (fldnum > last_fld) _upward = False;
  146.     } while (!finished);
  147.     if (edtwin != NULL) closewin(&edtwin);
  148. }
  149.