home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1995 December / SOFM_Dec1995.bin / pc / dos / biz / pbase / labfil.scr < prev    next >
Text File  |  1995-10-31  |  4KB  |  164 lines

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