From f84e474a38347a371d04b618dd428814de77ae3b Mon Sep 17 00:00:00 2001 From: Amaury Johnen <amaury.johnen@uclouvain.be> Date: Fri, 3 Nov 2017 09:44:52 +0100 Subject: [PATCH] new option ENABLE_VISUDEV for additional (but potentially heavy) visualization capabilities that are not intended to be used in production --- CMakeLists.txt | 5 +++++ Common/Context.h | 4 ++++ Common/GmshConfig.h.in | 1 + Common/Options.cpp | 9 +++++++++ Common/Options.h | 1 + Fltk/optionWindow.cpp | 10 ++++++++++ Fltk/optionWindow.h | 4 ++++ 7 files changed, 34 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 106903715e..aa72738f0e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,6 +87,7 @@ opt(SOLVER "Enable built-in finite element solvers (required for compounds)" ${D opt(TAUCS "Enable Taucs linear solver" ${DEFAULT}) opt(TCMALLOC "Enable libtcmalloc, a fast malloc implementation but that does not release memory" OFF) opt(TETGEN "Enable Tetgen 3D initial mesh generator" ${DEFAULT}) +opt(VISUDEV "Enable additional visualization capabilities for development purpose" OFF) opt(VORO3D "Enable Voro3D (for hex meshing, experimental)" ${DEFAULT}) opt(WRAP_JAVA "Enable generation of Java wrappers (experimental)" OFF) opt(WRAP_PYTHON "Enable generation of Python wrappers" OFF) @@ -484,6 +485,10 @@ if(ENABLE_PARSER) set_config_option(HAVE_PARSER "Parser") endif(ENABLE_PARSER) +if(ENABLE_VISUDEV) + set_config_option(HAVE_VISUDEV "VisuDev") +endif(ENABLE_VISUDEV) + if(ENABLE_FLTK) # first, try to use fltk-config for fltk >= 1.3 (FindFLTK is buggy on Unix, # where e.g. xft and xinerama options are not dealt with) diff --git a/Common/Context.h b/Common/Context.h index 11802ececb..0b0dad6c0d 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -235,6 +235,10 @@ class CTX { int mouseSelection, mouseHoverMeshes, pickElements; // disable some warnings for expert users? int expertMode; +#if defined(HAVE_VISUDEV) + // Enable heavy visualization capabilities (for development purpose) + int heavyVisu; +#endif // dynamic: equal to 1 while gmsh is printing int printing; // hide all unselected entities? diff --git a/Common/GmshConfig.h.in b/Common/GmshConfig.h.in index ed5a275832..2b6d92121c 100644 --- a/Common/GmshConfig.h.in +++ b/Common/GmshConfig.h.in @@ -67,6 +67,7 @@ #cmakedefine HAVE_SOLVER #cmakedefine HAVE_TAUCS #cmakedefine HAVE_TETGEN +#cmakedefine HAVE_VISUDEV #cmakedefine HAVE_VORO3D #cmakedefine HAVE_ZIPPER diff --git a/Common/Options.cpp b/Common/Options.cpp index ca8f85104b..bdbc331ead 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -3616,6 +3616,15 @@ double opt_general_expert_mode(OPT_ARGS_NUM) return CTX::instance()->expertMode; } +#if defined(HAVE_VISUDEV) +double opt_general_heavy_visualization(OPT_ARGS_NUM) +{ + if(action & GMSH_SET) + CTX::instance()->heavyVisu = (int)val; + return CTX::instance()->heavyVisu; +} +#endif + double opt_general_stereo_mode(OPT_ARGS_NUM) { if(action & GMSH_SET) diff --git a/Common/Options.h b/Common/Options.h index 7b04adbe7b..b02ddaf782 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -283,6 +283,7 @@ double opt_general_zoom_factor(OPT_ARGS_NUM); double opt_general_expert_mode(OPT_ARGS_NUM); double opt_general_stereo_mode(OPT_ARGS_NUM); double opt_general_camera_mode(OPT_ARGS_NUM); +double opt_general_heavy_visualization(OPT_ARGS_NUM); double opt_general_eye_sep_ratio(OPT_ARGS_NUM); double opt_general_focallength_ratio(OPT_ARGS_NUM); double opt_general_camera_aperture(OPT_ARGS_NUM); diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp index e2358c070d..131751ca85 100644 --- a/Fltk/optionWindow.cpp +++ b/Fltk/optionWindow.cpp @@ -296,6 +296,9 @@ static void general_options_ok_cb(Fl_Widget *w, void *data) (CTX::instance()->homeDir + CTX::instance()->sessionFileName).c_str()); opt_general_options_save(0, GMSH_SET, o->general.butt[9]->value()); opt_general_expert_mode(0, GMSH_SET, o->general.butt[10]->value()); +#if defined(HAVE_VISUDEV) + opt_general_heavy_visualization(0, GMSH_SET, o->general.butt[22]->value()); +#endif if(opt_general_gui_color_scheme(0, GMSH_GET, 0) != o->general.butt[21]->value()){ opt_general_gui_color_scheme(0, GMSH_SET, o->general.butt[21]->value()); @@ -1476,6 +1479,13 @@ optionWindow::optionWindow(int deltaFontSize) general.butt[9]->type(FL_TOGGLE_BUTTON); general.butt[9]->callback(general_options_ok_cb); +#if defined(HAVE_VISUDEV) + general.butt[22] = new Fl_Check_Button + (L + 2 * WB, 2 * WB + 8 * BH, BW/2-WB, BH, "Enable heavy visualization capabilities"); + general.butt[22]->type(FL_TOGGLE_BUTTON); + general.butt[22]->callback(general_options_ok_cb); +#endif + Fl_Button *b1 = new Fl_Button (L + width - 2 * WB - BW/3, 2 * WB + 7 * BH, BW/3, BH, "Show file path"); b1->callback(options_show_file_cb, (void*)"option"); diff --git a/Fltk/optionWindow.h b/Fltk/optionWindow.h index f00cbfada2..9119d8808b 100644 --- a/Fltk/optionWindow.h +++ b/Fltk/optionWindow.h @@ -33,7 +33,11 @@ class optionWindow{ struct{ Fl_Group *group; +#if defined(HAVE_VISUDEV) + Fl_Check_Button *butt[23]; +#else Fl_Check_Button *butt[22]; +#endif Fl_Button *push[20]; Fl_Value_Input *value[50]; Fl_Button *color[50]; -- GitLab