BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter ) { BOOL rtn = FALSE; gViewerWindow->mWindow->beforeDialog(); reset(); GtkWindow* picker = buildFilePicker(false, false, "openfile"); if (picker) { gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER(picker), TRUE); gtk_window_set_title(GTK_WINDOW(picker), "Load Files"); gtk_widget_show_all(GTK_WIDGET(picker)); gtk_main(); rtn = !mFiles.empty(); } gViewerWindow->mWindow->afterDialog(); return rtn; }
// <FS:CR Threaded Filepickers> //BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter ) BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter, bool blocking ) // </FS:CR Threaded Filepickers> { BOOL rtn = FALSE; // if local file browsing is turned off, return without opening dialog if ( check_local_file_access_enabled() == false ) { return FALSE; } gViewerWindow->getWindow()->beforeDialog(); reset(); GtkWindow* picker = buildFilePicker(false, false, "openfile"); if (picker) { gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER(picker), TRUE); gtk_window_set_title(GTK_WINDOW(picker), LLTrans::getString("load_files").c_str()); gtk_widget_show_all(GTK_WIDGET(picker)); gtk_main(); rtn = !mFiles.empty(); } gViewerWindow->getWindow()->afterDialog(); return rtn; }
bool LLFilePickerBase::getMultipleLoadFiles(ELoadFilter filter, std::string const& folder) { bool rtn = FALSE; //gViewerWindow->mWindow->beforeDialog(); reset(); GtkWindow* picker = buildFilePicker(false, false, folder); if (picker) { gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER(picker), TRUE); gtk_window_set_title(GTK_WINDOW(picker), LLTrans::getString("load_files").c_str()); gtk_widget_show_all(GTK_WIDGET(picker)); PLS_FLUSH; gtk_main(); rtn = !mFiles.empty(); } //gViewerWindow->mWindow->afterDialog(); return rtn; }
BOOL LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking ) { BOOL rtn = FALSE; // if local file browsing is turned off, return without opening dialog if ( check_local_file_access_enabled() == false ) { return FALSE; } gViewerWindow->getWindow()->beforeDialog(); reset(); GtkWindow* picker = buildFilePicker(false, false, "openfile"); if (picker) { std::string caption = LLTrans::getString("load_file_verb") + " "; std::string filtername = ""; switch (filter) { case FFLOAD_WAV: filtername = add_wav_filter_to_gtkchooser(picker); break; case FFLOAD_ANIM: filtername = add_anim_filter_to_gtkchooser(picker); break; case FFLOAD_COLLADA: filtername = add_collada_filter_to_gtkchooser(picker); break; case FFLOAD_IMAGE: filtername = add_imageload_filter_to_gtkchooser(picker); break; case FFLOAD_SCRIPT: filtername = add_script_filter_to_gtkchooser(picker); break; case FFLOAD_DICTIONARY: filtername = add_dictionary_filter_to_gtkchooser(picker); break; default:; break; } caption += filtername; gtk_window_set_title(GTK_WINDOW(picker), caption.c_str()); gtk_widget_show_all(GTK_WIDGET(picker)); gtk_main(); rtn = (getFileCount() == 1); } gViewerWindow->getWindow()->afterDialog(); return rtn; }
BOOL LLFilePicker::getOpenFile( ELoadFilter filter ) { BOOL rtn = FALSE; gViewerWindow->mWindow->beforeDialog(); reset(); GtkWindow* picker = buildFilePicker(false, false, "openfile"); if (picker) { std::string caption = LLTrans::getString("load_file_verb") + " "; std::string filtername = ""; switch (filter) { case FFLOAD_WAV: filtername = add_wav_filter_to_gtkchooser(picker); break; case FFLOAD_ANIM: filtername = add_bvh_filter_to_gtkchooser(picker); break; case FFLOAD_IMAGE: filtername = add_imageload_filter_to_gtkchooser(picker); break; case FFLOAD_XML: filtername = add_xml_filter_to_gtkchooser(picker); break; case FFLOAD_CSV: filtername = add_csv_filter_to_gtkchooser(picker); break; default:; break; } caption += filtername; gtk_window_set_title(GTK_WINDOW(picker), caption.c_str()); gtk_widget_show_all(GTK_WIDGET(picker)); gtk_main(); rtn = (getFileCount() == 1); } gViewerWindow->mWindow->afterDialog(); return rtn; }
BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename ) { BOOL rtn = FALSE; gViewerWindow->mWindow->beforeDialog(); reset(); GtkWindow* picker = buildFilePicker(true, false, "savefile"); if (picker) { std::string suggest_name = "untitled"; std::string suggest_ext = ""; std::string caption = "Save "; switch (filter) { case FFSAVE_WAV: caption += add_wav_filter_to_gtkchooser(picker); suggest_ext = ".wav"; break; case FFSAVE_TGA: caption += add_simple_pattern_filter_to_gtkchooser (picker, "*.tga", "Targa Images (*.tga)"); suggest_ext = ".tga"; break; case FFSAVE_BMP: caption += add_simple_mime_filter_to_gtkchooser (picker, "image/bmp", "Bitmap Images (*.bmp)"); suggest_ext = ".bmp"; break; case FFSAVE_AVI: caption += add_simple_mime_filter_to_gtkchooser (picker, "video/x-msvideo", "AVI Movie File (*.avi)"); suggest_ext = ".avi"; break; case FFSAVE_ANIM: caption += add_simple_pattern_filter_to_gtkchooser (picker, "*.xaf", "XAF Anim File (*.xaf)"); suggest_ext = ".xaf"; break; case FFSAVE_XML: caption += add_simple_pattern_filter_to_gtkchooser (picker, "*.xml", "XML File (*.xml)"); suggest_ext = ".xml"; break; case FFSAVE_RAW: caption += add_simple_pattern_filter_to_gtkchooser (picker, "*.raw", "RAW File (*.raw)"); suggest_ext = ".raw"; break; case FFSAVE_J2C: caption += add_simple_mime_filter_to_gtkchooser (picker, "images/jp2", "Compressed Images (*.j2c)"); suggest_ext = ".j2c"; break; default:; break; } gtk_window_set_title(GTK_WINDOW(picker), caption.c_str()); if (filename.empty()) { suggest_name += suggest_ext; gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER(picker), suggest_name.c_str()); } else { gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER(picker), filename.c_str()); } gtk_widget_show_all(GTK_WIDGET(picker)); gtk_main(); rtn = (mFiles.size() == 1); } gViewerWindow->mWindow->afterDialog(); return rtn; }
BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename, bool blocking ) { BOOL rtn = FALSE; // if local file browsing is turned off, return without opening dialog if ( check_local_file_access_enabled() == false ) { return FALSE; } gViewerWindow->getWindow()->beforeDialog(); reset(); GtkWindow* picker = buildFilePicker(true, false, "savefile"); if (picker) { std::string suggest_name = "untitled"; std::string suggest_ext = ""; std::string caption = LLTrans::getString("save_file_verb") + " "; switch (filter) { case FFSAVE_WAV: caption += add_wav_filter_to_gtkchooser(picker); suggest_ext = ".wav"; break; case FFSAVE_TGA: caption += add_simple_pattern_filter_to_gtkchooser (picker, "*.tga", LLTrans::getString("targa_image_files") + " (*.tga)"); suggest_ext = ".tga"; break; case FFSAVE_BMP: caption += add_simple_mime_filter_to_gtkchooser (picker, "image/bmp", LLTrans::getString("bitmap_image_files") + " (*.bmp)"); suggest_ext = ".bmp"; break; case FFSAVE_AVI: caption += add_simple_mime_filter_to_gtkchooser (picker, "video/x-msvideo", LLTrans::getString("avi_movie_file") + " (*.avi)"); suggest_ext = ".avi"; break; case FFSAVE_ANIM: caption += add_simple_pattern_filter_to_gtkchooser (picker, "*.xaf", LLTrans::getString("xaf_animation_file") + " (*.xaf)"); suggest_ext = ".xaf"; break; case FFSAVE_XML: caption += add_simple_pattern_filter_to_gtkchooser (picker, "*.xml", LLTrans::getString("xml_file") + " (*.xml)"); suggest_ext = ".xml"; break; case FFSAVE_RAW: caption += add_simple_pattern_filter_to_gtkchooser (picker, "*.raw", LLTrans::getString("raw_file") + " (*.raw)"); suggest_ext = ".raw"; break; case FFSAVE_J2C: caption += add_simple_mime_filter_to_gtkchooser (picker, "images/jp2", LLTrans::getString("compressed_image_files") + " (*.j2c)"); suggest_ext = ".j2c"; break; case FFSAVE_SCRIPT: caption += add_script_filter_to_gtkchooser(picker); suggest_ext = ".lsl"; break; // <FS:CR> Export filter case FFSAVE_EXPORT: caption += add_export_filter_to_gtkchooser(picker); suggest_ext = ".oxp"; break; // </FS:CR> default:; break; } gtk_window_set_title(GTK_WINDOW(picker), caption.c_str()); if (filename.empty()) { suggest_name += suggest_ext; gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER(picker), suggest_name.c_str()); } else { gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER(picker), filename.c_str()); } gtk_widget_show_all(GTK_WIDGET(picker)); gtk_main(); rtn = (getFileCount() == 1); } gViewerWindow->getWindow()->afterDialog(); return rtn; }
bool LLFilePickerBase::getSaveFile(ESaveFilter filter, std::string const& filename, std::string const& folder) { bool rtn = FALSE; //gViewerWindow->mWindow->beforeDialog(); reset(); GtkWindow* picker = buildFilePicker(true, false, folder); if (picker) { std::string suggest_name = "untitled"; std::string suggest_ext = ""; std::string caption = LLTrans::getString("save_file_verb") + " "; switch (filter) { case FFSAVE_WAV: caption += add_wav_filter_to_gtkchooser(picker); suggest_ext = ".wav"; break; case FFSAVE_TGA: caption += add_simple_pattern_filter_to_gtkchooser (picker, "*.tga", LLTrans::getString("targa_image_files") + " (*.tga)"); suggest_ext = ".tga"; break; case FFSAVE_BMP: caption += add_simple_mime_filter_to_gtkchooser (picker, "image/bmp", LLTrans::getString("bitmap_image_files") + " (*.bmp)"); suggest_ext = ".bmp"; break; case FFSAVE_AVI: caption += add_simple_mime_filter_to_gtkchooser (picker, "video/x-msvideo", LLTrans::getString("avi_movie_file") + " (*.avi)"); suggest_ext = ".avi"; break; case FFSAVE_ANIM: caption += add_simple_pattern_filter_to_gtkchooser (picker, "*.xaf", LLTrans::getString("xaf_animation_file") + " (*.xaf)"); suggest_ext = ".xaf"; break; case FFSAVE_XML: caption += add_simple_pattern_filter_to_gtkchooser (picker, "*.xml", LLTrans::getString("xml_file") + " (*.xml)"); suggest_ext = ".xml"; break; case FFSAVE_RAW: caption += add_simple_pattern_filter_to_gtkchooser (picker, "*.raw", LLTrans::getString("raw_file") + " (*.raw)"); suggest_ext = ".raw"; break; case FFSAVE_J2C: caption += add_simple_mime_filter_to_gtkchooser (picker, "images/jp2", LLTrans::getString("compressed_image_files") + " (*.j2c)"); suggest_ext = ".j2c"; break; default:; break; } gtk_window_set_title(GTK_WINDOW(picker), caption.c_str()); if (filename.empty()) { suggest_name += suggest_ext; gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER(picker), suggest_name.c_str()); } else { gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER(picker), filename.c_str()); } gtk_widget_show_all(GTK_WIDGET(picker)); PLS_FLUSH; gtk_main(); rtn = (getFileCount() == 1); } //gViewerWindow->mWindow->afterDialog(); return rtn; }