diff --git a/Common/Options.cpp b/Common/Options.cpp index f9a0856b5dea6f53383b4deab77c627e23687b59..1ef246898600419597bade74663e9ce7b3cb29df 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -5883,8 +5883,12 @@ double opt_solver_client_server(OPT_ARGS_NUM) #if defined(HAVE_FLTK) if(action & GMSH_SET) SINFO[num].client_server = (int)val; - if(GUI::available() && (action & GMSH_GUI)) - GUI::instance()->solver[num]->butt[2]->value(SINFO[num].client_server); + if(GUI::available() && (action & GMSH_GUI)){ + if(SINFO[num].client_server) + ((Fl_Menu_Item*)GUI::instance()->solver[num]->menu->menu())[0].set(); + else + ((Fl_Menu_Item*)GUI::instance()->solver[num]->menu->menu())[0].clear(); + } return SINFO[num].client_server; #else return 0.; @@ -5921,8 +5925,12 @@ double opt_solver_popup_messages(OPT_ARGS_NUM) #if defined(HAVE_FLTK) if(action & GMSH_SET) SINFO[num].popup_messages = (int)val; - if(GUI::available() && (action & GMSH_GUI)) - GUI::instance()->solver[num]->butt[0]->value(SINFO[num].popup_messages); + if(GUI::available() && (action & GMSH_GUI)){ + if(SINFO[num].popup_messages) + ((Fl_Menu_Item*)GUI::instance()->solver[num]->menu->menu())[1].set(); + else + ((Fl_Menu_Item*)GUI::instance()->solver[num]->menu->menu())[1].clear(); + } return SINFO[num].popup_messages; #else return 1.; @@ -5959,8 +5967,12 @@ double opt_solver_merge_views(OPT_ARGS_NUM) #if defined(HAVE_FLTK) if(action & GMSH_SET) SINFO[num].merge_views = (int)val; - if(GUI::available() && (action & GMSH_GUI)) - GUI::instance()->solver[num]->butt[1]->value(SINFO[num].merge_views); + if(GUI::available() && (action & GMSH_GUI)){ + if(SINFO[num].merge_views) + ((Fl_Menu_Item*)GUI::instance()->solver[num]->menu->menu())[2].set(); + else + ((Fl_Menu_Item*)GUI::instance()->solver[num]->menu->menu())[2].clear(); + } return SINFO[num].merge_views; #else return 1.; diff --git a/Fltk/solverWindow.cpp b/Fltk/solverWindow.cpp index a5ea94fe7049283554fce970fc38eab90684dc0a..562160837a28d6a34268cfccc3d8f03e8c1113da 100644 --- a/Fltk/solverWindow.cpp +++ b/Fltk/solverWindow.cpp @@ -164,17 +164,18 @@ static void solver_kill_cb(Fl_Widget *w, void *data) static void solver_ok_cb(Fl_Widget *w, void *data) { int retry = 0, num = (int)(long)data; + + opt_solver_client_server + (num, GMSH_SET, GUI::instance()->solver[num]->menu->menu()[0].value() ? 1 : 0); opt_solver_popup_messages - (num, GMSH_SET, GUI::instance()->solver[num]->butt[0]->value()); + (num, GMSH_SET, GUI::instance()->solver[num]->menu->menu()[1].value() ? 1 : 0); opt_solver_merge_views - (num, GMSH_SET, GUI::instance()->solver[num]->butt[1]->value()); - opt_solver_client_server - (num, GMSH_SET, GUI::instance()->solver[num]->butt[2]->value()); - if(strcmp(opt_solver_executable(num, GMSH_GET, "").c_str(), - GUI::instance()->solver[num]->input[2]->value())) + (num, GMSH_SET, GUI::instance()->solver[num]->menu->menu()[2].value() ? 1 : 0); + + const char *exe = GUI::instance()->solver[num]->input[2]->value(); + if(strcmp(opt_solver_executable(num, GMSH_GET, "").c_str(), exe)) retry = 1; - opt_solver_executable - (num, GMSH_SET, GUI::instance()->solver[num]->input[2]->value()); + opt_solver_executable(num, GMSH_SET, exe); if(retry) solver_cb(0, data); } @@ -202,10 +203,10 @@ solverWindow::solverWindow(int solverIndex, int deltaFontSize) if(SINFO[solverIndex].option_name[i].size()) SINFO[solverIndex].nboptions = i + 1; - int LL = 2 * IW; - int width = LL + BB + BB / 3 + 4 * WB; - int height = (7 + SINFO[solverIndex].nboptions) * BH + 5 * WB; - int BBS = (width - 8 * WB) / 5; + int width = 32 * FL_NORMAL_SIZE; + int height = (5 + SINFO[solverIndex].nboptions) * BH + 5 * WB; + int BBS = (width - 9 * WB) / 6; + int LL = width - (int)(2.7 * BBS); win = new paletteWindow (width, height, CTX::instance()->nonModalWindows ? true : false, "Solver"); @@ -217,43 +218,34 @@ solverWindow::solverWindow(int solverIndex, int deltaFontSize) Fl_Group *g = new Fl_Group (WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Controls"); - Fl_Button *b2 = new Fl_Button - (2 * WB, 2 * WB + 1 * BH, BB / 2, BH, "Save"); - b2->callback(options_save_cb); + menu = new Fl_Menu_Button + (2 * WB, 2 * WB + 1 * BH, BBS / 2, BH); + menu->add("Client-server", 0, 0, 0, FL_MENU_TOGGLE); + menu->add("Pop-up messages", 0, 0, 0, FL_MENU_TOGGLE); + menu->add("Auto-load results", 0, 0, 0, FL_MENU_TOGGLE); + menu->callback(solver_ok_cb, (void *)solverIndex); + input[2] = new Fl_Input - (2 * WB + BB / 2, 2 * WB + 1 * BH, LL - BB / 2, BH, "Solver"); + (2 * WB + BBS / 2, 2 * WB + 1 * BH, LL - BBS / 2, BH, "Solver"); input[2]->callback(solver_ok_cb, (void *)solverIndex); Fl_Button *b1 = new Fl_Button (width - 2 * WB - BBS, 2 * WB + 1 * BH, BBS, BH, "Choose"); b1->callback(solver_choose_executable_cb, (void *)solverIndex); - int ww = (LL - WB) / 2; - butt[2] = new Fl_Check_Button - (2 * WB, 2 * WB + 2 * BH, ww, BH, "Client/server"); - butt[0] = new Fl_Check_Button - (2 * WB, 2 * WB + 3 * BH, ww, BH, "Pop-up messages"); - butt[1] = new Fl_Check_Button - (3 * WB + ww, 2 * WB + 2 * BH, ww, BH, "Auto-load results"); - - for(int i = 0; i < 3; i++){ - butt[i]->type(FL_TOGGLE_BUTTON); - butt[i]->callback(solver_ok_cb, (void *)solverIndex); - } - Fl_Button *b4 = new Fl_Button - (2 * WB, 2 * WB + 4 * BH, BB / 2, BH, "Edit"); + (2 * WB, 2 * WB + 2 * BH, BBS, BH, "Edit"); b4->callback(solver_file_edit_cb, (void *)solverIndex); input[0] = new Fl_Input - (2 * WB + BB / 2, 2 * WB + 4 * BH, LL - BB / 2, BH, "Input"); + (2 * WB + BBS, 2 * WB + 2 * BH, LL - BBS, BH, "Input file"); Fl_Button *b3 = new Fl_Button - (width - 2 * WB - BBS, 2 * WB + 4 * BH, BBS, BH, "Choose"); + (width - 2 * WB - BBS, 2 * WB + 2 * BH, BBS, BH, "Choose"); b3->callback(solver_file_open_cb, (void *)solverIndex); input[1] = new Fl_Input - (2 * WB, 2 * WB + 5 * BH, LL, BH, "Mesh"); + (2 * WB, 2 * WB + 3 * BH, LL, BH, "Mesh file"); Fl_Button *b5 = new Fl_Button - (width - 2 * WB - BBS, 2 * WB + 5 * BH, BBS, BH, "Choose"); + (width - 2 * WB - BBS, 2 * WB + 3 * BH, BBS, BH, "Choose"); b5->callback(solver_choose_mesh_cb, (void *)solverIndex); for(int i = 0; i < 3; i++) { @@ -262,17 +254,17 @@ solverWindow::solverWindow(int solverIndex, int deltaFontSize) for(int i = 0; i < SINFO[solverIndex].nboptions; i++) { choice[i] = new Fl_Choice - (2 * WB, 2 * WB + (6 + i) * BH, LL, BH, SINFO[solverIndex].option_name[i].c_str()); + (2 * WB, 2 * WB + (4 + i) * BH, LL, BH, SINFO[solverIndex].option_name[i].c_str()); choice[i]->align(FL_ALIGN_RIGHT); } static int arg[MAX_NUM_SOLVERS][5][2]; - for(int i = 0; i < 4; i++) { + for(int i = 0; i < 5; i++) { if(SINFO[solverIndex].button_name[i].size()) { arg[solverIndex][i][0] = solverIndex; arg[solverIndex][i][1] = i; command[i] = new Fl_Button - ((2 + i) * WB + i * BBS, 3 * WB + (6 + SINFO[solverIndex].nboptions) * BH, + ((2 + i) * WB + i * BBS, 3 * WB + (4 + SINFO[solverIndex].nboptions) * BH, BBS, BH, SINFO[solverIndex].button_name[i].c_str()); command[i]->callback (solver_command_cb, (void *)arg[solverIndex][i]); @@ -281,7 +273,7 @@ solverWindow::solverWindow(int solverIndex, int deltaFontSize) { Fl_Button *b = new Fl_Button - (width - 2 * WB - BBS, 3 * WB + (6 + SINFO[solverIndex].nboptions) * BH, + (width - 2 * WB - BBS, 3 * WB + (4 + SINFO[solverIndex].nboptions) * BH, BBS, BH, "Kill"); b->callback(solver_kill_cb, (void *)solverIndex); } diff --git a/Fltk/solverWindow.h b/Fltk/solverWindow.h index 694b010e41b54af91431ca0e9a5d405b9b7be705..d69c7bb4db294642b1fc44fda9a481d24ac8d4e7 100644 --- a/Fltk/solverWindow.h +++ b/Fltk/solverWindow.h @@ -9,7 +9,7 @@ #include <FL/Fl_Window.H> #include <FL/Fl_Input.H> #include <FL/Fl_Choice.H> -#include <FL/Fl_Check_Button.H> +#include <FL/Fl_Menu_Button.H> #include <FL/Fl_Button.H> class solverWindow{ @@ -17,7 +17,7 @@ class solverWindow{ Fl_Window *win; Fl_Input *input[50]; Fl_Choice *choice[10]; - Fl_Check_Button *butt[10]; + Fl_Menu_Button *menu; Fl_Button *command[10]; public: solverWindow(int solverIndex, int deltaFontSize=0); diff --git a/Makefile b/Makefile index d4bba67ea30ea657c46a84f96d1dc33c6feee670..08d94dcdf4b71d1454850937265b964ce31bc532 100644 --- a/Makefile +++ b/Makefile @@ -253,7 +253,8 @@ source-tree: purge source: source-tree cd gmsh-${GMSH_VERSION} && rm -rf ${GMSH_VERSION_FILE}\ - Common/GmshConfig.h contrib/Tetgen/*.{cxx,h} contrib/misc/variables.i* + Common/GmshConfig.h contrib/Tetgen/*.{cxx,h}\ + utils/nightly utils/misc/variables.i* tar zcf gmsh-${GMSH_VERSION}-source.tgz gmsh-${GMSH_VERSION} # Rules to package the binaries diff --git a/utils/embed/GmshEmbedded.cpp b/utils/embed/GmshEmbedded.cpp index 4b9d2c0297058913fb8adcf0ed504a2f3f4388cc..5e0b234d66d8f59d3570a090cb51e8526cb18f85 100644 --- a/utils/embed/GmshEmbedded.cpp +++ b/utils/embed/GmshEmbedded.cpp @@ -6,7 +6,7 @@ #include "GModel.h" #include "GmshEmbedded.h" -Context_T CTX; +CTX *CTX::_instance = 0; int GmshInitialize(int argc, char **argv) { diff --git a/utils/embed/GmshEmbedded.h b/utils/embed/GmshEmbedded.h index 865f3af5a420b6e4acd7ac7180f8ebb2379a04a4..8795aabd45573b14a9ca411e50aac75ad1b97d7c 100644 --- a/utils/embed/GmshEmbedded.h +++ b/utils/embed/GmshEmbedded.h @@ -8,17 +8,10 @@ #include "NumericEmbedded.h" -class Context_T{ -public: - Context_T() - { - lc = 1.; - pickElements = 0; - hideUnselected = 0; - geom.tolerance = 1.e-6; - mesh.reverseAllNormals = 1; - mesh.secondOrderExperimental = 0; - } +class CTX{ + private: + static CTX *_instance; + public: double lc; int pickElements; int hideUnselected; @@ -29,6 +22,21 @@ public: int reverseAllNormals; int secondOrderExperimental; } mesh; + CTX() + { + lc = 1.; + pickElements = 0; + hideUnselected = 0; + geom.tolerance = 1.e-6; + mesh.reverseAllNormals = 1; + mesh.secondOrderExperimental = 0; + } + ~CTX(){} + static CTX *instance() + { + if(!_instance) _instance = new CTX(); + return _instance; + } unsigned int packColor(int,int,int,int){ return 0; } int unpackRed(unsigned int){ return 0; } int unpackGreen(unsigned int){ return 0; }