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 >
Wrap
Text File
|
1995-10-31
|
4KB
|
164 lines
bool Fbypass,
Fedited,
Ffld_in_range,
Fnoneedited,
Fabort;
void rng_init(void)
{
pad(CONG_DIST,"",3,Right);
pad(SCHOOL_DIST,"",3,Right);
pad(PRECINT,"",10,Right);
pad(PARTY,"",15,Right);
pad(MARK,"",1,Right);
pad(OUTPUT,"",10,Right);
pad(DISKFILE,"",13,Right);
}
void rng_dsp(void)
{
dsp_fld(14,1,CONG_DIST,_Ch,"3X",0,0,_av,rw.wa[1]);
dsp_fld(14,2,SCHOOL_DIST,_Ch,"3X",0,0,_av,rw.wa[1]);
dsp_fld(14,3,PRECINT,_Ch,"10X",0,0,_av,rw.wa[1]);
dsp_fld(14,5,PARTY,_Ch,"15X",0,0,_av,rw.wa[1]);
dsp_fld(14,6,MARK,_Ch,"X",0,0,_av,rw.wa[1]);
dsp_fld(14,8,OUTPUT,_Ch,"10X",0,0,_av,rw.wa[1]);
strcpy(&iodev,strip(_tts,OUTPUT));
dsp_fld(14,9,DISKFILE,_Ch,"13X",0,0,_av,rw.wa[1]);
strcpy(&dsk_file,strip(_tts,DISKFILE));
}
bool skipfield(int fnum)
{
bool tb;
tb = False;
switch (fnum) {
case 0 : break ;
}
return(tb);
}
bool chk_fld(int chknum)
{
string estr;
*estr = '\0';
switch (chknum) {
case 4 : if (!(choice("REPUBLICAN|DEMOCRATIC|LIBERTARIAN |NA|OTHER",PARTY)))
strcpy(estr,(uchar *)choose(_tts,"REPUBLICAN|DEMOCRATIC|LIBERTARIAN |NA|OTHER","",PARTY)); break;
case 6 : if (!(choice("PRN|LPT1|LPT2|DSK|CON",OUTPUT)))
strcpy(estr,(uchar *)choose(_tts,"PRN|LPT1|LPT2|DSK|CON","",OUTPUT)); break;
}
if (*estr != '\0') {
if (strcmp(estr,LSC_BaseError) != 0) {
audible(Error);
message(rw.wa[1],estr);
}
}
return ((bool) (*estr == '\0'));
}
void edt_n_chk(int x,int y,int l,int a,winptr h,strptr fld,char typ,strptr pic,int fldno)
{
if (!skipfield(fldno)) {
do {
if (!Fbypass) {
edt_fld(x, y, fld, typ, pic, (byte)(l), (byte)(a), rw.wa[1]);
Fnoneedited = False;
Fedited = True;
Fabort = False;
if (exitcode == HlpKey) disphelp(h);
if (custom_key(1, 1, &fldnum, &exitcode)) exitcode = QitKey;
}
if ((exitcode != QitKey) && (exitcode != UArr) && (exitcode != HlpKey)) {
Ffld_in_range = chk_fld(fldno);
dsp_fld(x, y, fld, typ, pic, 0, (byte)(l), (byte)(a), rw.wa[1]);
if (!Ffld_in_range) {
fldnum = fldno;
Fbypass = False;
}
}
} while ((!Ffld_in_range) && (exitcode != QitKey) && (exitcode != UArr));
message(NULL,"");
}
}
void openedtmnu(winptr *edtwin)
{
string ts;
int l;
strcpy(ts, _EdtHelp);
l = strlen(ts);
if (openwin(0, (byte)(scrwid-l+1), scrhgt, (byte)(l), 1, 0x4F, 0x4F, 0, "\0┐│┘─└│┌", TopCnt, "")) {
*edtwin = curwin;
writewxy(ts, 0, 1, 1, *edtwin);
hidewin(T_ON, *edtwin);
}
else *edtwin = NULL;
}
void rng_edt(void)
{
int last_fld = 0;
winptr edtwin;
bool finished = 0;
openedtmnu(&edtwin);
attrib = _av;
exitcode = Nul;
Fabort = True;
Fbypass = False;
fldnum = 1;
finished = False;
do {
if (fldnum == 1) Fnoneedited = True;
if (last_fld == fldnum && !Fedited) fldnum++;
last_fld = fldnum;
Fedited = False;
switch (fldnum) {
case 1 : { edt_n_chk(14,1,0,0,NULL,CONG_DIST,_Ch,"3X",1); } break;
case 2 : { edt_n_chk(14,2,0,0,NULL,SCHOOL_DIST,_Ch,"3X",2); } break;
case 3 : { edt_n_chk(14,3,0,0,NULL,PRECINT,_Ch,"10X",3); } break;
case 4 : { edt_n_chk(14,5,0,0,NULL,PARTY,_Ch,"15X",4); } break;
case 5 : { edt_n_chk(14,6,0,0,NULL,MARK,_Ch,"X",5); } break;
case 6 : { edt_n_chk(14,8,0,0,NULL,OUTPUT,_Ch,"10X",6); } break;
case 7 : {
strcpy(&iodev,strip(_tts,OUTPUT));
} break;
case 8 : { edt_n_chk(14,9,0,0,NULL,DISKFILE,_Ch,"13X",8); } break;
case 9 : {
strcpy(&dsk_file,strip(_tts,DISKFILE));
} break;
default : {
if (Fnoneedited) {
finished = True;
if (Fabort) {
exitcode = QitKey;
dberrm(_NoneEdited);
}
}
else if (exitcode == XeptKey) finished = True; else fldnum = 0;
}
}
if (Fbypass || !Fedited)
if (_upward && (fldnum > 1)) fldnum--; else fldnum++;
if (exitcode == XeptKey) Fbypass = True;
if (exitcode == QitKey) finished = True;
if (fldnum > last_fld) _upward = False;
} while (!finished);
if (edtwin != NULL) closewin(&edtwin);
}