/* fs_elist_proc: * Dialog procedure for the file selector disk list. */ static int fs_elist_proc(int msg, DIALOG *d, int c) { int ret; int sel = d->d1; char *s, *tok; char tmp[80], ext[80]; static char ext_tokens[] = " ,;"; s = (char *) file_selector[FS_EDIT].dp; if(msg == MSG_START) { d->d2 = 0; } ret = jwin_droplist_proc(msg, d, c); if((sel != d->d1) || (ret & D_CLOSE)) { // change the extension(s) fext = fext_list[d->d1].ext; // if (fext)// && ugetc(fext)) { parse_extension_string(fext); } // check whether the extension on the current file name is still valid if((fext) && (strlen(get_filename(s)))) { strcpy(tmp, fext); strcpy(ext, get_extension(s)); tok = strtok(tmp, ext_tokens); while(tok) { if(stricmp(ext, tok) == 0) break; tok = strtok(NULL, ext_tokens); } // not valid, replace file name if(!tok) replace_filename(s, flist->dir, "", 256); } scare_mouse(); SEND_MESSAGE(file_selector+FS_FILES, MSG_START, 0); SEND_MESSAGE(file_selector+FS_FILES, MSG_DRAW, 0); SEND_MESSAGE(file_selector+FS_EDIT, MSG_START, 0); SEND_MESSAGE(file_selector+FS_EDIT, MSG_DRAW, 0); unscare_mouse(); if(ret & D_CLOSE) return (ret | SEND_MESSAGE(file_selector+FS_EDIT, MSG_KEY, 0)) & ~D_CLOSE; } return ret; }
/* fs_dlist_proc: * Dialog procedure for the file selector disk list. */ int fs_dlist_proc(int msg, DIALOG *d, int c) { DIALOG *parent = (DIALOG *)d->dp3; char *s = (char *)parent[FS_EDIT].dp; int ret, i, temp; if(msg == MSG_START) { d->d1 = d->d2 = 0; temp = utoupper(ugetc(s)); if(((temp >= 'A') && (temp <= 'Z')) && (ugetat(s, 1) == DEVICE_SEPARATOR)) { temp -= 'A'; for(i=0; i<temp; i++) if(_al_drive_exists(i)) d->d1++; } } ret = jwin_droplist_proc(msg, d, c); if(ret & D_CLOSE) { temp = 'A' + get_x_drive(d->d1+1); if((temp < 'A') || (temp > 'Z')) temp = 'C'; s += usetc(s, temp); s += usetc(s, DEVICE_SEPARATOR); s += usetc(s, OTHER_PATH_SEPARATOR); usetc(s, 0); object_message(parent +FS_FILES, MSG_START, 0); object_message(parent +FS_FILES, MSG_DRAW, 0); object_message(parent +FS_EDIT, MSG_START, 0); object_message(parent +FS_EDIT, MSG_DRAW, 0); return ret - D_CLOSE + D_O_K; } return ret; }