static void dlginit(void) { menudlg_appends(res_fs, NELEMENTS(res_fs)); menudlg_seticon(DID_PARENT, MICON_FOLDERPARENT); menudlg_settext(DID_FILE, file_getname(filesel.path)); menudlg_settext(DID_FILTER, filesel.filter); file_cutname(filesel.path); file_cutseparator(filesel.path); dlgsetlist(); }
static void setintstr(MENUID id, int val) { OEMCHAR buf[16]; OEMSPRINTF(buf, str_d, val); menudlg_settext(id, buf); }
static void dlgflist(void) { FLIST fl; fl = getflist(menudlg_getval(DID_FLIST)); if ((fl != NULL) && (!fl->isdir)) { menudlg_settext(DID_FILE, fl->name); } }
static int dlgcmd(int msg, MENUID id, long param) { switch(msg) { case DLGMSG_CREATE: dlginit(); break; case DLGMSG_COMMAND: switch(id) { case DID_OK: if (dlgupdate()) { menubase_close(); } break; case DID_CANCEL: menubase_close(); break; case DID_PARENT: file_cutname(filesel.path); file_cutseparator(filesel.path); dlgsetlist(); menudlg_settext(DID_FILE, NULL); break; case DID_FLIST: if (param) { return(dlgcmd(DLGMSG_COMMAND, DID_OK, 0)); } else { dlgflist(); } break; } break; case DLGMSG_CLOSE: menubase_close(); break; case DLGMSG_DESTROY: listarray_destroy(filesel.flist); filesel.flist = NULL; break; } (void)param; return(0); }
static void setbufstr(void) { UINT val; OEMCHAR work[32]; val = menudlg_getval(DID_BUFFER); if (val < 100) { val = 100; } else if (val > 1000) { val = 1000; } OEMSPRINTF(work, str_buffmt, val); menudlg_settext(DID_BUFSTR, work); }
static void setmulstr(void) { UINT multiple; OEMCHAR work[32]; multiple = menudlg_getval(DID_MULTIPLE); if (multiple < 1) { multiple = 1; } else if (multiple > 32) { multiple = 32; } OEMSPRINTF(work, str_mulfmt, multiple); menudlg_settext(DID_MULSTR, work); }
static void dlgsetlist(void) { LISTARRAY flist; FLISTH flh; FLINFO fli; BOOL append; FLIST fl; ITEMEXPRM prm; menudlg_itemreset(DID_FLIST); menudlg_settext(DID_FOLDER, file_getname(filesel.path)); listarray_destroy(filesel.flist); flist = listarray_new(sizeof(_FLIST), 64); filesel.flist = flist; filesel.fbase = NULL; flh = file_list1st(filesel.path, &fli); if (flh != FLISTH_INVALID) { do { append = FALSE; if (fli.attr & 0x10) { append = TRUE; } else if (!(fli.attr & 0x08)) { append = checkext(fli.path, filesel.ext); } if (append) { if (fappend(flist, &fli) != SUCCESS) { break; } } } while(file_listnext(flh, &fli,filesel.path) == SUCCESS); file_listclose(flh); } prm.pos = 0; fl = filesel.fbase; while(fl) { menudlg_itemappend(DID_FLIST, NULL); prm.icon = (fl->isdir)?MICON_FOLDER:MICON_FILE; prm.str = fl->name; menudlg_itemsetex(DID_FLIST, &prm); fl = fl->next; prm.pos++; } }
static BOOL dlgupdate(void) { FLIST fl; fl = getflist(menudlg_getval(DID_FLIST)); if (fl == NULL) { return(FALSE); } file_setseparator(filesel.path, NELEMENTS(filesel.path)); file_catname(filesel.path, fl->name, NELEMENTS(filesel.path)); if (fl->isdir) { dlgsetlist(); menudlg_settext(DID_FILE, NULL); return(FALSE); } else { filesel.result = TRUE; return(TRUE); } }
static void setclockstr(void) { UINT32 clock; UINT multiple; OEMCHAR work[32]; if (menudlg_getval(DID_CLOCK1)) { clock = PCBASECLOCK20 / 100; } else { clock = PCBASECLOCK25 / 100; } multiple = menudlg_getval(DID_MULTIPLE); if (multiple < 1) { multiple = 1; } else if (multiple > 32) { multiple = 32; } clock *= multiple; OEMSPRINTF(work, str_clockfmt, clock / 10000, clock % 10000); menudlg_settext(DID_CLOCKSTR, work); }