/* enlarge_file_selector: * Enlarges the dialog for Large Mode. -L */ DIALOG *enlarge_file_selector(int width, int height) { bool show_extlist = file_selector[FS_TYPES].proc != fs_dummy_proc; stretch_dialog(file_selector, width, height, 1); DIALOG *newd = resizeDialog(file_selector, 1.5); jwin_center_dialog(newd); if(is_large()) { int bottom = #ifndef HAVE_DIR_LIST newd[FS_OK].y; #else newd[FS_WIN].y+ newd[FS_WIN].h-8; #endif newd[FS_FILES].dp2=NULL; newd[FS_TYPES].y = bottom- newd[FS_TYPES].h-5; newd[FS_FILES].h=show_extlist ? 152 : 168; newd[FS_FILES].y = (show_extlist ? newd[FS_TYPES].y:bottom)-(newd[FS_FILES].h+5); newd[FS_EDIT].y = newd[FS_FILES].y-26; ((ListData *)newd[FS_FILES].dp)->font = &lfont_l; newd[FS_TYPES].dp2=NULL; newd[FS_TYPES].h=20; ((ListData *)newd[FS_TYPES].dp)->font = &lfont_l; #ifdef HAVE_DIR_LIST newd[FS_DISKS].dp2=NULL; newd[FS_DISKS].h=20; ((ListData *)newd[FS_DISKS].dp)->font = &lfont_l; #endif } return newd; }
/* enlarge_file_selector: * Enlarges the dialog for Large Mode. -L */ void enlarge_file_selector(int width, int height) { if(file_selector[0].d1==0) { stretch_dialog(file_selector, width, height, 1); } jwin_center_dialog(file_selector); bool show_extlist = file_selector[FS_TYPES].proc != fs_dummy_proc; if(is_large) { large_dialog(file_selector); int bottom = #ifndef HAVE_DIR_LIST file_selector[FS_OK].y; #else file_selector[FS_WIN].y+file_selector[FS_WIN].h-8; #endif file_selector[FS_FILES].dp2=NULL; file_selector[FS_TYPES].y = bottom-file_selector[FS_TYPES].h-5; file_selector[FS_FILES].h=show_extlist ? 152 : 168; file_selector[FS_FILES].y = (show_extlist ? file_selector[FS_TYPES].y:bottom)-(file_selector[FS_FILES].h+5); file_selector[FS_EDIT].y = file_selector[FS_FILES].y-26; ((ListData *)file_selector[FS_FILES].dp)->font = &lfont_l; file_selector[FS_TYPES].dp2=NULL; file_selector[FS_TYPES].h=20; ((ListData *)file_selector[FS_TYPES].dp)->font = &lfont_l; #ifdef HAVE_DIR_LIST file_selector[FS_DISKS].dp2=NULL; file_selector[FS_DISKS].h=20; ((ListData *)file_selector[FS_DISKS].dp)->font = &lfont_l; #endif } }
int raine_file_select_ex( char *message, char *path, char *ext, int size,int width, int height) { char buf[512]; int ret; char *p; if (width == -1) width = 305; #ifdef HAVE_DIR_LIST if (height == -1) height = 161; #else if (height == -1) height = 189; #endif /* for fs_dlist_proc() */ ASSERT(size >= 4 * uwidth_max(U_CURRENT)); ustrcpy(updir, empty_string); file_selector[FS_MESSAGE].dp = (char *)message; file_selector[FS_EDIT].d1 = size/uwidth_max(U_CURRENT) - 1; file_selector[FS_EDIT].dp = path; file_selector[FS_OK].dp = (void*)raine_get_config_text("OK"); file_selector[FS_CANCEL].dp = (void*)raine_get_config_text("Cancel"); fext = ext; if (!ugetc(path)) { if (!getcwd(buf, sizeof(buf))) buf[0]=0; do_uconvert(buf, U_ASCII, path, U_CURRENT, size); fix_filename_case(path); fix_filename_slashes(path); put_backslash(path); } clear_keybuf(); do { } while (gui_mouse_b()); stretch_dialog(file_selector, width, height); centre_dialog(file_selector); // Stupid correction of the allegro colors... file_selector[FS_FILES].fg = CGUI_COL_TEXT_1; file_selector[FS_FILES].bg = CGUI_BOX_COL_MIDDLE; #ifdef HAVE_DIR_LIST /* not all platforms need a directory list */ file_selector[FS_DISKS].fg = CGUI_COL_TEXT_1; file_selector[FS_DISKS].bg = CGUI_BOX_COL_MIDDLE; #endif ret = do_dialog(file_selector, FS_EDIT); if (ret == FS_CANCEL) return FALSE; p = get_extension(path); if ((!ugetc(p)) && (ext) && (!ustrpbrk(ext, uconvert_ascii(" ,;", NULL)))) { p += usetc(p, '.'); ustrcpy(p, ext); } return TRUE; }