From abf2f79891a77ca57aa2536a0acce4aae0fa6c2c Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Sun, 27 Sep 2009 18:31:03 +0000 Subject: [PATCH] uniformize dialog names --- Fltk/FlGui.cpp | 4 +- Fltk/extraDialogs.cpp | 20 +++++-- Fltk/extraDialogs.h | 9 ++-- Fltk/fieldWindow.cpp | 4 +- Fltk/fileDialogs.cpp | 108 +++++++++++++++++++------------------- Fltk/fileDialogs.h | 38 +++++++------- Fltk/graphicWindow.cpp | 4 +- Fltk/menuWindow.cpp | 93 ++++++++++++++++---------------- Fltk/messageWindow.cpp | 4 +- Fltk/optionWindow.cpp | 2 +- Fltk/projectionEditor.cpp | 22 ++++---- Fltk/solverWindow.cpp | 28 +++++----- 12 files changed, 174 insertions(+), 162 deletions(-) diff --git a/Fltk/FlGui.cpp b/Fltk/FlGui.cpp index 70d25ad0aa..c19f5988dc 100644 --- a/Fltk/FlGui.cpp +++ b/Fltk/FlGui.cpp @@ -767,8 +767,8 @@ void FlGui::storeCurrentWindowsInfo() CTX::instance()->ctxPosition[1] = meshContext->win->y(); CTX::instance()->solverPosition[0] = solver[0]->win->x(); CTX::instance()->solverPosition[1] = solver[0]->win->y(); - file_chooser_get_position(&CTX::instance()->fileChooserPosition[0], - &CTX::instance()->fileChooserPosition[1]); + fileChooserGetPosition(&CTX::instance()->fileChooserPosition[0], + &CTX::instance()->fileChooserPosition[1]); } void FlGui::callForSolverPlugin(int dim) diff --git a/Fltk/extraDialogs.cpp b/Fltk/extraDialogs.cpp index 7c934f5cfc..4a53342c95 100644 --- a/Fltk/extraDialogs.cpp +++ b/Fltk/extraDialogs.cpp @@ -16,6 +16,7 @@ #include <FL/Fl_Check_Button.H> #include <FL/Fl_Hold_Browser.H> #include <FL/Fl_Box.H> +#include <FL/fl_ask.H> #include "FlGui.h" #include "paletteWindow.h" #include "GmshDefines.h" @@ -28,7 +29,7 @@ // Arrow editor -int arrow_editor(const char *title, double &a, double &b, double &c) +int arrowEditor(const char *title, double &a, double &b, double &c) { struct _editor{ Fl_Window *window; @@ -106,7 +107,7 @@ public: : Fl_Slider(x, y, w, h, l) {} }; -int perspective_editor() +int perspectiveEditor() { struct _editor{ Fl_Menu_Window *window; @@ -155,7 +156,7 @@ static void model_switch_cb(Fl_Widget* w, void *data) drawContext::global()->draw(); } -int model_chooser() +int modelChooser() { struct _menu{ Fl_Menu_Window *window; @@ -193,3 +194,16 @@ int model_chooser() menu->window->show(); return 0; } + +// Connection chooser + +std::string connectionChooser() +{ + const char *exe = fl_input + ("Command:", + //"ssh ace25 /Users/geuzaine/src/gmsh/bin/gmsh"); + "./gmsh ../tutorial/view3.pos"); + + if(exe) return std::string(exe); + return ""; +} diff --git a/Fltk/extraDialogs.h b/Fltk/extraDialogs.h index 7ccb224662..bc3b5e9ec0 100644 --- a/Fltk/extraDialogs.h +++ b/Fltk/extraDialogs.h @@ -6,8 +6,11 @@ #ifndef _EXTRA_DIALOGS_H_ #define _EXTRA_DIALOGS_H_ -int arrow_editor(const char *title, double &a, double &b, double &c); -int perspective_editor(); -int model_chooser(); +#include <string> + +int arrowEditor(const char *title, double &a, double &b, double &c); +int perspectiveEditor(); +int modelChooser(); +std::string connectionChooser(); #endif diff --git a/Fltk/fieldWindow.cpp b/Fltk/fieldWindow.cpp index a3c7a57765..c20975a7db 100644 --- a/Fltk/fieldWindow.cpp +++ b/Fltk/fieldWindow.cpp @@ -81,9 +81,9 @@ static void field_put_on_view_cb(Fl_Widget *w, void *data) static void field_select_file_cb(Fl_Widget *w, void *data) { Fl_Input *input = (Fl_Input*)data; - int ret = file_chooser(0, 0, "File selection", "", input->value()); + int ret = fileChooser(0, 0, "File selection", "", input->value()); if(ret){ - input->value(file_chooser_get_name(0).c_str()); + input->value(fileChooserGetName(0).c_str()); input->set_changed(); } } diff --git a/Fltk/fileDialogs.cpp b/Fltk/fileDialogs.cpp index 99cb0b09e9..6465dd38a3 100644 --- a/Fltk/fileDialogs.cpp +++ b/Fltk/fileDialogs.cpp @@ -75,7 +75,7 @@ static fileChooser *fc = 0; #endif -int file_chooser(int multi, int create, const char *message, +int fileChooser(int multi, int create, const char *message, const char *filter, const char *fname) { static char thefilter[1024] = ""; @@ -139,7 +139,7 @@ int file_chooser(int multi, int create, const char *message, #endif } -std::string file_chooser_get_name(int num) +std::string fileChooserGetName(int num) { if(!fc) return ""; #if defined(HAVE_NATIVE_FILE_CHOOSER) @@ -149,13 +149,13 @@ std::string file_chooser_get_name(int num) #endif } -int file_chooser_get_filter() +int fileChooserGetFilter() { if(!fc) return 0; return fc->filter_value(); } -void file_chooser_get_position(int *x, int *y) +void fileChooserGetPosition(int *x, int *y) { if(!fc) return; #if !defined(HAVE_NATIVE_FILE_CHOOSER) @@ -166,17 +166,17 @@ void file_chooser_get_position(int *x, int *y) // Generic save bitmap dialog -int generic_bitmap_dialog(const char *name, const char *title, int format) +int genericBitmapFileDialog(const char *name, const char *title, int format) { - struct _generic_bitmap_dialog{ + struct _genericBitmapFileDialog{ Fl_Window *window; Fl_Check_Button *b[2]; Fl_Button *ok, *cancel; }; - static _generic_bitmap_dialog *dialog = NULL; + static _genericBitmapFileDialog *dialog = NULL; if(!dialog){ - dialog = new _generic_bitmap_dialog; + dialog = new _genericBitmapFileDialog; int h = 3 * WB + 3 * BH, w = 2 * BB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h); dialog->window->box(GMSH_WINDOW_BOX); @@ -221,17 +221,17 @@ int generic_bitmap_dialog(const char *name, const char *title, int format) // TeX dialog -int latex_dialog(const char *name) +int latexFileDialog(const char *name) { - struct _latex_dialog{ + struct _latexFileDialog{ Fl_Window *window; Fl_Check_Button *b; Fl_Button *ok, *cancel; }; - static _latex_dialog *dialog = NULL; + static _latexFileDialog *dialog = NULL; if(!dialog){ - dialog = new _latex_dialog; + dialog = new _latexFileDialog; int h = 3 * WB + 2 * BH, w = 2 * BB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h, "LaTeX Options"); dialog->window->box(GMSH_WINDOW_BOX); @@ -270,18 +270,18 @@ int latex_dialog(const char *name) // Save jpeg dialog -int jpeg_dialog(const char *name) +int jpegFileDialog(const char *name) { - struct _jpeg_dialog{ + struct _jpegFileDialog{ Fl_Window *window; Fl_Value_Slider *s[2]; Fl_Check_Button *b[2]; Fl_Button *ok, *cancel; }; - static _jpeg_dialog *dialog = NULL; + static _jpegFileDialog *dialog = NULL; if(!dialog){ - dialog = new _jpeg_dialog; + dialog = new _jpegFileDialog; int h = 3 * WB + 5 * BH, w = 2 * BB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h, "JPEG Options"); dialog->window->box(GMSH_WINDOW_BOX); @@ -341,17 +341,17 @@ int jpeg_dialog(const char *name) // Save gif dialog -int gif_dialog(const char *name) +int gifFileDialog(const char *name) { - struct _gif_dialog{ + struct _gifFileDialog{ Fl_Window *window; Fl_Check_Button *b[6]; Fl_Button *ok, *cancel; }; - static _gif_dialog *dialog = NULL; + static _gifFileDialog *dialog = NULL; if(!dialog){ - dialog = new _gif_dialog; + dialog = new _gifFileDialog; int h = 3 * WB + 7 * BH, w = 2 * BB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h, "GIF Options"); dialog->window->box(GMSH_WINDOW_BOX); @@ -448,15 +448,15 @@ static void activate_gl2ps_choices(int format, int quality, Fl_Check_Button *b[5 } } -int gl2ps_dialog(const char *name, const char *title, int format) +int gl2psFileDialog(const char *name, const char *title, int format) { - struct _gl2ps_dialog{ + struct _gl2psFileDialog{ Fl_Window *window; Fl_Check_Button *b[6]; Fl_Choice *c; Fl_Button *ok, *cancel; }; - static _gl2ps_dialog *dialog = NULL; + static _gl2psFileDialog *dialog = NULL; static Fl_Menu_Item sortmenu[] = { {"Raster image", 0, 0, 0}, @@ -467,7 +467,7 @@ int gl2ps_dialog(const char *name, const char *title, int format) }; if(!dialog){ - dialog = new _gl2ps_dialog; + dialog = new _gl2psFileDialog; int h = 3 * WB + 8 * BH, w = 2 * BB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h); dialog->window->box(GMSH_WINDOW_BOX); @@ -541,17 +541,17 @@ int gl2ps_dialog(const char *name, const char *title, int format) // Save options dialog -int options_dialog(const char *name) +int optionsFileDialog(const char *name) { - struct _options_dialog{ + struct _optionsFileDialog{ Fl_Window *window; Fl_Check_Button *b[2]; Fl_Button *ok, *cancel; }; - static _options_dialog *dialog = NULL; + static _optionsFileDialog *dialog = NULL; if(!dialog){ - dialog = new _options_dialog; + dialog = new _optionsFileDialog; int h = 3 * WB + 3 * BH, w = 2 * BB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h, "Options"); dialog->window->box(GMSH_WINDOW_BOX); @@ -595,17 +595,17 @@ int options_dialog(const char *name) // geo dialog -int geo_dialog(const char *name) +int geoFileDialog(const char *name) { - struct _geo_dialog{ + struct _geoFileDialog{ Fl_Window *window; Fl_Check_Button *b; Fl_Button *ok, *cancel; }; - static _geo_dialog *dialog = NULL; + static _geoFileDialog *dialog = NULL; if(!dialog){ - dialog = new _geo_dialog; + dialog = new _geoFileDialog; int h = 3 * WB + 2 * BH, w = 2 * BB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h, "GEO Options"); dialog->window->box(GMSH_WINDOW_BOX); @@ -642,19 +642,19 @@ int geo_dialog(const char *name) return 0; } -int pos_dialog(const char *name) +int posFileDialog(const char *name) { - struct _pos_dialog{ + struct _posFileDialog{ Fl_Window *window; Fl_Check_Button *b[7]; Fl_Button *ok, *cancel; }; - static _pos_dialog *dialog = NULL; + static _posFileDialog *dialog = NULL; int BBB = BB + 9; // labels too long if(!dialog){ - dialog = new _pos_dialog; + dialog = new _posFileDialog; int h = 3 * WB + 8 * BH, w = 2 * BBB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h, "POS Options"); dialog->window->box(GMSH_WINDOW_BOX); @@ -717,16 +717,16 @@ int pos_dialog(const char *name) // Save msh dialog -int msh_dialog(const char *name) +int mshFileDialog(const char *name) { - struct _msh_dialog{ + struct _mshFileDialog{ Fl_Window *window; Fl_Check_Button *b; Fl_Check_Button *p; Fl_Choice *c; Fl_Button *ok, *cancel; }; - static _msh_dialog *dialog = NULL; + static _mshFileDialog *dialog = NULL; static Fl_Menu_Item formatmenu[] = { {"Version 1.0", 0, 0, 0}, @@ -738,7 +738,7 @@ int msh_dialog(const char *name) int BBB = BB + 9; // labels too long if(!dialog){ - dialog = new _msh_dialog; + dialog = new _mshFileDialog; int h = 3 * WB + 4 * BH, w = 2 * BBB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h, "MSH Options"); dialog->window->box(GMSH_WINDOW_BOX); @@ -790,19 +790,19 @@ int msh_dialog(const char *name) // unv mesh dialog -int unv_dialog(const char *name) +int unvFileDialog(const char *name) { - struct _unv_dialog{ + struct _unvFileDialog{ Fl_Window *window; Fl_Check_Button *b[2]; Fl_Button *ok, *cancel; }; - static _unv_dialog *dialog = NULL; + static _unvFileDialog *dialog = NULL; int BBB = BB + 9; // labels too long if(!dialog){ - dialog = new _unv_dialog; + dialog = new _unvFileDialog; int h = 3 * WB + 3 * BH, w = 2 * BBB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h, "UNV Options"); dialog->window->box(GMSH_WINDOW_BOX); @@ -847,15 +847,15 @@ int unv_dialog(const char *name) // Save bdf dialog -int bdf_dialog(const char *name) +int bdfFileDialog(const char *name) { - struct _bdf_dialog{ + struct _bdfFileDialog{ Fl_Window *window; Fl_Choice *c, *d; Fl_Check_Button *b; Fl_Button *ok, *cancel; }; - static _bdf_dialog *dialog = NULL; + static _bdfFileDialog *dialog = NULL; static Fl_Menu_Item formatmenu[] = { {"Free field", 0, 0, 0}, @@ -874,7 +874,7 @@ int bdf_dialog(const char *name) int BBB = BB + 16; // labels too long if(!dialog){ - dialog = new _bdf_dialog; + dialog = new _bdfFileDialog; int h = 3 * WB + 4 * BH, w = 2 * BBB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h, "BDF Options"); dialog->window->box(GMSH_WINDOW_BOX); @@ -925,16 +925,16 @@ int bdf_dialog(const char *name) // Generic mesh dialog -int generic_mesh_dialog(const char *name, const char *title, int format, +int genericMeshFileDialog(const char *name, const char *title, int format, bool binary_support, bool element_tag_support) { - struct _generic_mesh_dialog{ + struct _genericMeshFileDialog{ Fl_Window *window; Fl_Choice *c, *d; Fl_Check_Button *b; Fl_Button *ok, *cancel; }; - static _generic_mesh_dialog *dialog = NULL; + static _genericMeshFileDialog *dialog = NULL; static Fl_Menu_Item formatmenu[] = { {"ASCII", 0, 0, 0}, @@ -952,7 +952,7 @@ int generic_mesh_dialog(const char *name, const char *title, int format, int BBB = BB + 16; // labels too long if(!dialog){ - dialog = new _generic_mesh_dialog; + dialog = new _genericMeshFileDialog; int h = 3 * WB + 4 * BH, w = 2 * BBB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h); dialog->window->box(GMSH_WINDOW_BOX); @@ -1191,7 +1191,7 @@ void cgnsw_cancel_cb(Fl_Widget *widget, void *data) dlg->status = 0; } -int cgns_write_dialog(const char *filename) +int cgnsFileDialog(const char *filename) { static CGNSWriteDialog dlg; dlg.filename = filename; @@ -1426,7 +1426,7 @@ int cgns_write_dialog(const char *filename) #else -int cgns_write_dialog(const char *filename) +int cgnsFileDialog(const char *filename) { CreateOutputFile(filename, FORMAT_CGNS); return 1; diff --git a/Fltk/fileDialogs.h b/Fltk/fileDialogs.h index 3255d72f96..b8ccb0bb42 100644 --- a/Fltk/fileDialogs.h +++ b/Fltk/fileDialogs.h @@ -8,25 +8,25 @@ #include <string> -int file_chooser(int multi, int create, const char *message, - const char *pat, const char *fname=NULL); -std::string file_chooser_get_name(int num); -int file_chooser_get_filter(); -void file_chooser_get_position(int *x, int *y); +int fileChooser(int multi, int create, const char *message, + const char *pat, const char *fname=NULL); +std::string fileChooserGetName(int num); +int fileChooserGetFilter(); +void fileChooserGetPosition(int *x, int *y); -int jpeg_dialog(const char *filename); -int gif_dialog(const char *filename); -int geo_dialog(const char *filename); -int generic_bitmap_dialog(const char *filename, const char *title, int format); -int generic_mesh_dialog(const char *filename, const char *title, int format, - bool binary_support, bool element_tag_support); -int gl2ps_dialog(const char *filename, const char *title, int format); -int options_dialog(const char *filename); -int pos_dialog(const char *filename); -int msh_dialog(const char *filename); -int unv_dialog(const char *filename); -int bdf_dialog(const char *filename); -int latex_dialog(const char *filename); -int cgns_write_dialog(const char *filename); +int jpegFileDialog(const char *filename); +int gifFileDialog(const char *filename); +int geoFileDialog(const char *filename); +int genericBitmapFileDialog(const char *filename, const char *title, int format); +int genericMeshFileDialog(const char *filename, const char *title, int format, + bool binary_support, bool element_tag_support); +int gl2psFileDialog(const char *filename, const char *title, int format); +int optionsFileDialog(const char *filename); +int posFileDialog(const char *filename); +int mshFileDialog(const char *filename); +int unvFileDialog(const char *filename); +int bdfFileDialog(const char *filename); +int latexFileDialog(const char *filename); +int cgnsFileDialog(const char *filename); #endif diff --git a/Fltk/graphicWindow.cpp b/Fltk/graphicWindow.cpp index 182e0d3d44..3b542f48d9 100644 --- a/Fltk/graphicWindow.cpp +++ b/Fltk/graphicWindow.cpp @@ -189,7 +189,7 @@ void status_options_cb(Fl_Widget *w, void *data) { const char *str = (const char*)data; if(!strcmp(str, "model")){ // model selection - model_chooser(); + modelChooser(); } else if(!strcmp(str, "?")){ // display options PrintOptions(0, GMSH_FULLRC, 0, 1, NULL); @@ -201,7 +201,7 @@ void status_options_cb(Fl_Widget *w, void *data) !opt_general_orthographic(0, GMSH_GET, 0)); } else{ - perspective_editor(); + perspectiveEditor(); } drawContext::global()->draw(); } diff --git a/Fltk/menuWindow.cpp b/Fltk/menuWindow.cpp index 3a0e3bbdaf..247724a458 100644 --- a/Fltk/menuWindow.cpp +++ b/Fltk/menuWindow.cpp @@ -7,7 +7,6 @@ #include <stdio.h> #include <time.h> #include <FL/Fl_Box.H> -#include <FL/fl_ask.H> #include "GmshConfig.h" #include "GmshMessage.h" #include "GmshRemote.h" @@ -28,6 +27,7 @@ #include "solverWindow.h" #include "aboutWindow.h" #include "fileDialogs.h" +#include "extraDialogs.h" #include "partitionDialog.h" #include "projectionEditor.h" #include "classificationEditor.h" @@ -52,8 +52,8 @@ static void file_new_cb(Fl_Widget *w, void *data) { test: - if(file_chooser(0, 1, "New", "*")) { - std::string name = file_chooser_get_name(1); + if(fileChooser(0, 1, "New", "*")) { + std::string name = fileChooserGetName(1); if(!StatFile(name)){ if(fl_choice("File '%s' already exists.\n\nDo you want to erase it?", "Cancel", "Erase", 0, name.c_str())) @@ -119,8 +119,8 @@ static const char *input_formats = static void file_open_cb(Fl_Widget *w, void *data) { int n = PView::list.size(); - if(file_chooser(0, 0, "Open", input_formats)) { - OpenProject(file_chooser_get_name(1)); + if(fileChooser(0, 0, "Open", input_formats)) { + OpenProject(fileChooserGetName(1)); drawContext::global()->draw(); } if(n != (int)PView::list.size()) @@ -130,10 +130,10 @@ static void file_open_cb(Fl_Widget *w, void *data) static void file_merge_cb(Fl_Widget *w, void *data) { int n = PView::list.size(); - int f = file_chooser(1, 0, "Merge", input_formats); + int f = fileChooser(1, 0, "Merge", input_formats); if(f) { for(int i = 1; i <= f; i++) - MergeFile(file_chooser_get_name(i)); + MergeFile(fileChooserGetName(i)); drawContext::global()->draw(); } if(n != (int)PView::list.size()) @@ -158,14 +158,9 @@ static void file_remote_cb(Fl_Widget *w, void *data) else{ GmshRemote::get(99)->name = "Remote"; GmshRemote::get(99)->socketSwitch = "-socket %s"; - const char *exe = fl_input - ("Command:", - //"ssh ace25 /Users/geuzaine/src/gmsh/bin/gmsh"); - "./gmsh ../tutorial/view3.pos"); - if(exe){ - GmshRemote::get(99)->executable = exe; + GmshRemote::get(99)->executable = connectionChooser(); + if(GmshRemote::get(99)->executable.size()) GmshRemote::get(99)->run(""); - } } } else if(str == "stop"){ @@ -202,43 +197,43 @@ static void file_window_cb(Fl_Widget *w, void *data) } } -static int _save_msh(const char *name){ return msh_dialog(name); } -static int _save_pos(const char *name){ return pos_dialog(name); } -static int _save_options(const char *name){ return options_dialog(name); } -static int _save_geo(const char *name){ return geo_dialog(name); } -static int _save_cgns(const char *name){ return cgns_write_dialog(name); } -static int _save_unv(const char *name){ return unv_dialog(name); } -static int _save_vtk(const char *name){ return generic_mesh_dialog +static int _save_msh(const char *name){ return mshFileDialog(name); } +static int _save_pos(const char *name){ return posFileDialog(name); } +static int _save_options(const char *name){ return optionsFileDialog(name); } +static int _save_geo(const char *name){ return geoFileDialog(name); } +static int _save_cgns(const char *name){ return cgnsFileDialog(name); } +static int _save_unv(const char *name){ return unvFileDialog(name); } +static int _save_vtk(const char *name){ return genericMeshFileDialog (name, "VTK Options", FORMAT_VTK, true, false); } -static int _save_diff(const char *name){ return generic_mesh_dialog +static int _save_diff(const char *name){ return genericMeshFileDialog (name, "Diffpack Options", FORMAT_DIFF, true, false); } -static int _save_med(const char *name){ return generic_mesh_dialog +static int _save_med(const char *name){ return genericMeshFileDialog (name, "MED Options", FORMAT_MED, false, false); } -static int _save_mesh(const char *name){ return generic_mesh_dialog +static int _save_mesh(const char *name){ return genericMeshFileDialog (name, "MESH Options", FORMAT_MESH, false, true); } -static int _save_bdf(const char *name){ return bdf_dialog(name); } -static int _save_p3d(const char *name){ return generic_mesh_dialog +static int _save_bdf(const char *name){ return bdfFileDialog(name); } +static int _save_p3d(const char *name){ return genericMeshFileDialog (name, "P3D Options", FORMAT_P3D, false, false); } -static int _save_stl(const char *name){ return generic_mesh_dialog +static int _save_stl(const char *name){ return genericMeshFileDialog (name, "STL Options", FORMAT_STL, true, false); } -static int _save_vrml(const char *name){ return generic_mesh_dialog +static int _save_vrml(const char *name){ return genericMeshFileDialog (name, "VRML Options", FORMAT_VRML, false, false); } -static int _save_eps(const char *name){ return gl2ps_dialog +static int _save_eps(const char *name){ return gl2psFileDialog (name, "EPS Options", FORMAT_EPS); } -static int _save_gif(const char *name){ return gif_dialog(name); } -static int _save_jpeg(const char *name){ return jpeg_dialog(name); } -static int _save_tex(const char *name){ return latex_dialog(name); } -static int _save_pdf(const char *name){ return gl2ps_dialog +static int _save_gif(const char *name){ return gifFileDialog(name); } +static int _save_jpeg(const char *name){ return jpegFileDialog(name); } +static int _save_tex(const char *name){ return latexFileDialog(name); } +static int _save_pdf(const char *name){ return gl2psFileDialog (name, "PDF Options", FORMAT_PDF); } -static int _save_png(const char *name){ return generic_bitmap_dialog +static int _save_png(const char *name){ return genericBitmapFileDialog (name, "PNG Options", FORMAT_PNG); } -static int _save_ps(const char *name){ return gl2ps_dialog +static int _save_ps(const char *name){ return gl2psFileDialog (name, "PS Options", FORMAT_PS); } -static int _save_ppm(const char *name){ return generic_bitmap_dialog +static int _save_ppm(const char *name){ return genericBitmapFileDialog (name, "PPM Options", FORMAT_PPM); } -static int _save_svg(const char *name){ return gl2ps_dialog +static int _save_svg(const char *name){ return gl2psFileDialog (name, "SVG Options", FORMAT_SVG); } -static int _save_yuv(const char *name){ return generic_bitmap_dialog +static int _save_yuv(const char *name){ return genericBitmapFileDialog (name, "YUV Options", FORMAT_YUV); } static int _save_auto(const char *name) @@ -328,15 +323,15 @@ static void file_save_as_cb(Fl_Widget *w, void *data) } test: - if(file_chooser(0, 1, "Save As", pat)) { - std::string name = file_chooser_get_name(1); + if(fileChooser(0, 1, "Save As", pat)) { + std::string name = fileChooserGetName(1); if(CTX::instance()->confirmOverwrite) { if(!StatFile(name)) if(!fl_choice("File '%s' already exists.\n\nDo you want to replace it?", "Cancel", "Replace", 0, name.c_str())) goto test; } - int i = file_chooser_get_filter(); + int i = fileChooserGetFilter(); if(i >= 0 && i < nbformats){ if(!formats[i].func(name.c_str())) goto test; } @@ -360,8 +355,8 @@ static void file_options_save_cb(Fl_Widget *w, void *data) static void file_rename_cb(Fl_Widget *w, void *data) { test: - if(file_chooser(0, 1, "Rename", "*", GModel::current()->getFileName().c_str())) { - std::string name = file_chooser_get_name(1); + if(fileChooser(0, 1, "Rename", "*", GModel::current()->getFileName().c_str())) { + std::string name = fileChooserGetName(1); if(CTX::instance()->confirmOverwrite) { if(!StatFile(name)) if(!fl_choice("File '%s' already exists.\n\nDo you want to replace it?", @@ -2048,8 +2043,8 @@ static void view_save_as(int index, const char *title, int format) PView *view = PView::list[index]; test: - if(file_chooser(0, 1, title, "*", view->getData()->getFileName().c_str())){ - std::string name = file_chooser_get_name(1); + if(fileChooser(0, 1, title, "*", view->getData()->getFileName().c_str())){ + std::string name = fileChooserGetName(1); if(CTX::instance()->confirmOverwrite) { if(!StatFile(name)) if(!fl_choice("File '%s' already exists.\n\nDo you want to replace it?", @@ -2185,8 +2180,8 @@ static Fl_Menu_Item bar_table[] = { {"Clear", 0, (Fl_Callback *)file_window_cb, (void*)"split_u"}, {0}, #if defined(TEST_SERVER) - {"Start remote...", 0, (Fl_Callback *)file_remote_cb, (void*)"start"}, - {"Stop remote", 0, (Fl_Callback *)file_remote_cb, (void*)"stop", FL_MENU_DIVIDER}, + {"Start Remote Gmsh...", 0, (Fl_Callback *)file_remote_cb, (void*)"start"}, + {"Stop Remote Gmsh", 0, (Fl_Callback *)file_remote_cb, (void*)"stop", FL_MENU_DIVIDER}, #endif {"&Rename...", FL_CTRL+'r', (Fl_Callback *)file_rename_cb, 0}, {"Save &As...", FL_CTRL+'s', (Fl_Callback *)file_save_as_cb, 0}, @@ -2233,8 +2228,8 @@ static Fl_Menu_Item sysbar_table[] = { {"Clear", 0, (Fl_Callback *)file_window_cb, (void*)"split_u"}, {0}, #if defined(TEST_SERVER) - {"Start remote...", 0, (Fl_Callback *)file_remote_cb, (void*)"start"}, - {"Stop remote", 0, (Fl_Callback *)file_remote_cb, (void*)"stop", FL_MENU_DIVIDER}, + {"Start Remote Gmsh...", 0, (Fl_Callback *)file_remote_cb, (void*)"start"}, + {"Stop Remote Gmsh", 0, (Fl_Callback *)file_remote_cb, (void*)"stop", FL_MENU_DIVIDER}, #endif {"Rename...", FL_META+'r', (Fl_Callback *)file_rename_cb, 0}, {"Save As...", FL_META+'s', (Fl_Callback *)file_save_as_cb, 0}, diff --git a/Fltk/messageWindow.cpp b/Fltk/messageWindow.cpp index 441bfaaf47..9eeaffe035 100644 --- a/Fltk/messageWindow.cpp +++ b/Fltk/messageWindow.cpp @@ -52,8 +52,8 @@ static void message_clear_cb(Fl_Widget *w, void *data) static void message_save_cb(Fl_Widget *w, void *data) { test: - if(file_chooser(0, 1, "Save", "*")) { - std::string name = file_chooser_get_name(1); + if(fileChooser(0, 1, "Save", "*")) { + std::string name = fileChooserGetName(1); if(CTX::instance()->confirmOverwrite) { if(!StatFile(name)) if(!fl_choice("File '%s' already exists.\n\nDo you want to replace it?", diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp index d372f09d25..c2c1519f13 100644 --- a/Fltk/optionWindow.cpp +++ b/Fltk/optionWindow.cpp @@ -318,7 +318,7 @@ static void general_arrow_param_cb(Fl_Widget *w, void *data) double a = opt_general_arrow_head_radius(0, GMSH_GET, 0); double b = opt_general_arrow_stem_length(0, GMSH_GET, 0); double c = opt_general_arrow_stem_radius(0, GMSH_GET, 0); - while(arrow_editor("Arrow Editor", a, b, c)){ + while(arrowEditor("Arrow Editor", a, b, c)){ opt_general_arrow_head_radius(0, GMSH_SET, a); opt_general_arrow_stem_length(0, GMSH_SET, b); opt_general_arrow_stem_radius(0, GMSH_SET, c); diff --git a/Fltk/projectionEditor.cpp b/Fltk/projectionEditor.cpp index aa749105ea..68d3b8b99a 100644 --- a/Fltk/projectionEditor.cpp +++ b/Fltk/projectionEditor.cpp @@ -417,10 +417,10 @@ static void proj_hide_cb(Fl_Widget *w, void *data) static void save_selection_cb(Fl_Widget *w, void *data) { projectionEditor *e = (projectionEditor*)data; - if(file_chooser(0, 1, "Save Selection", "*.{geo,msh}")){ - FILE *fp = fopen(file_chooser_get_name(1).c_str(), "w"); + if(fileChooser(0, 1, "Save Selection", "*.{geo,msh}")){ + FILE *fp = fopen(fileChooserGetName(1).c_str(), "w"); if(!fp){ - Msg::Error("Unable to open file `%s'", file_chooser_get_name(1).c_str()); + Msg::Error("Unable to open file `%s'", fileChooserGetName(1).c_str()); return; } std::vector<GEntity*> &ent(e->getEntities()); @@ -457,10 +457,10 @@ static void save_selection_cb(Fl_Widget *w, void *data) static void load_projection_cb(Fl_Widget *w, void *data) { projectionEditor *e = (projectionEditor*)data; - if(file_chooser(0, 0, "Load Projection", "*.pro")){ - FILE *fp = fopen(file_chooser_get_name(1).c_str(), "r"); + if(fileChooser(0, 0, "Load Projection", "*.pro")){ + FILE *fp = fopen(fileChooserGetName(1).c_str(), "r"); if(!fp){ - Msg::Error("Unable to open file `%s'", file_chooser_get_name(1).c_str()); + Msg::Error("Unable to open file `%s'", fileChooserGetName(1).c_str()); return; } int num; @@ -501,8 +501,8 @@ static void save_projection_cb(Fl_Widget *w, void *data) projection *p = e->getCurrentProjection(); if(p){ FM::ProjectionSurface *ps = (FM::ProjectionSurface*)p->face->getNativePtr(); - if(file_chooser(0, 1, "Save Projection", "*.pro")){ - std::string name = file_chooser_get_name(1); + if(fileChooser(0, 1, "Save Projection", "*.pro")){ + std::string name = fileChooserGetName(1); FILE *fp = fopen(name.c_str(), "w"); if(!fp){ Msg::Error("Unable to open file `%s'", name.c_str()); @@ -687,10 +687,10 @@ static void action_cb(Fl_Widget *w, void *data) delete_fourier(faces[i]); } else{ - if(file_chooser(0, 1, "Save Fourier Model", "*.fm")){ - FILE *fp = fopen(file_chooser_get_name(1).c_str(), "w"); + if(fileChooser(0, 1, "Save Fourier Model", "*.fm")){ + FILE *fp = fopen(fileChooserGetName(1).c_str(), "w"); if(!fp){ - Msg::Error("Unable to open file `%s'", file_chooser_get_name(1).c_str()); + Msg::Error("Unable to open file `%s'", fileChooserGetName(1).c_str()); return; } fprintf(fp, "%d\n", (int)faces.size()); diff --git a/Fltk/solverWindow.cpp b/Fltk/solverWindow.cpp index 257177fe2f..3abdb95bd9 100644 --- a/Fltk/solverWindow.cpp +++ b/Fltk/solverWindow.cpp @@ -144,7 +144,7 @@ void GmshRemote::run(std::string args) Msg::Info("Running '%s'...", name.c_str()); - bool initOption[5] = {true, true, true, true, true}; + bool initOption[5] = {false, false, false, false, false}; while(1) { if(_pid < 0 || (prog.empty() && !CTX::instance()->solver.listen)) @@ -179,9 +179,6 @@ void GmshRemote::run(std::string args) _pid = -1; _server = 0; break; - case GmshSocket::GMSH_PROGRESS: - Msg::StatusBar(2, false, "%s %s", name.c_str(), message); - break; case GmshSocket::GMSH_OPTION_1: case GmshSocket::GMSH_OPTION_2: case GmshSocket::GMSH_OPTION_3: @@ -189,9 +186,9 @@ void GmshRemote::run(std::string args) case GmshSocket::GMSH_OPTION_5: { int i = (int)type - (int)GmshSocket::GMSH_OPTION_1; - if(initOption[i]){ + if(!initOption[i]){ optionValue[i].clear(); - initOption[i] = false; + initOption[i] = true; } optionValue[i].push_back(message); } @@ -209,6 +206,9 @@ void GmshRemote::run(std::string args) ParseString(message); drawContext::global()->draw(); break; + case GmshSocket::GMSH_PROGRESS: + Msg::StatusBar(2, false, "%s %s", name.c_str(), message); + break; case GmshSocket::GMSH_INFO: Msg::Direct("%-8.8s: %s", name.c_str(), message); break; @@ -242,8 +242,8 @@ void GmshRemote::run(std::string args) if(window){ // some options have been changed: refill the menus - if(!initOption[0] || !initOption[1] || !initOption[2] || - !initOption[3] || !initOption[4]){ + if(initOption[0] || initOption[1] || initOption[2] || + initOption[3] || initOption[4]){ for(unsigned int i = 0; i < window->choice.size(); i++) { int old = window->choice[i]->value(); window->choice[i]->clear(); @@ -340,8 +340,8 @@ static void solver_choose_executable_cb(Fl_Widget *w, void *data) pattern += ".exe"; #endif - if(file_chooser(0, 0, "Choose", pattern.c_str())){ - FlGui::instance()->solver[num]->input[2]->value(file_chooser_get_name(1).c_str()); + if(fileChooser(0, 0, "Choose", pattern.c_str())){ + FlGui::instance()->solver[num]->input[2]->value(fileChooserGetName(1).c_str()); solver_ok_cb(w, data); } } @@ -351,8 +351,8 @@ static void solver_file_open_cb(Fl_Widget *w, void *data) int num = (int)(long)data; std::string pattern = "*" + GmshRemote::get(num)->inputFileExtension; - if(file_chooser(0, 0, "Choose", pattern.c_str())) { - FlGui::instance()->solver[num]->input[0]->value(file_chooser_get_name(1).c_str()); + if(fileChooser(0, 0, "Choose", pattern.c_str())) { + FlGui::instance()->solver[num]->input[0]->value(fileChooserGetName(1).c_str()); solver_ok_cb(w, data); } } @@ -368,8 +368,8 @@ static void solver_file_edit_cb(Fl_Widget *w, void *data) static void solver_choose_mesh_cb(Fl_Widget *w, void *data) { int num = (int)(long)data; - if(file_chooser(0, 0, "Choose", "*.msh")){ - FlGui::instance()->solver[num]->input[1]->value(file_chooser_get_name(1).c_str()); + if(fileChooser(0, 0, "Choose", "*.msh")){ + FlGui::instance()->solver[num]->input[1]->value(fileChooserGetName(1).c_str()); solver_ok_cb(w, data); } } -- GitLab