diff --git a/Common/Options.cpp b/Common/Options.cpp index de59be40af421271cc786496b832f10eaf94fe29..60eb3ad9970e2124a8d29dabbe0397aec168b34d 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -5,6 +5,7 @@ #include <string.h> #include <stdlib.h> +#include <stdio.h> #include "GmshConfig.h" #include "GmshDefines.h" #include "GmshMessage.h" @@ -51,6 +52,7 @@ #endif // General routines for string options +using namespace std; bool StringOption(int action, const char *category, int num, const char *name, std::string &val) @@ -3694,7 +3696,22 @@ double opt_general_stereo_mode(OPT_ARGS_NUM) { if(action & GMSH_SET) CTX::instance()->stereo = (int)val; - + if (CTX::instance()->stereo) CTX::instance()->camera = 1 ; +#if defined(HAVE_FLTK) + if(FlGui::available() && (action & GMSH_GUI)) { + FlGui::instance()->options->general.butt[17]->value + (CTX::instance()->stereo); + if (CTX::instance()->stereo) { + // when stereo mode is active camera mode is obligatory + FlGui::instance()->options->general.butt[18]->value + (CTX::instance()->camera); + FlGui::instance()->options->general.butt[18]->deactivate(); + } + else{ + FlGui::instance()->options->general.butt[18]->activate(); + } + } +#endif return CTX::instance()->stereo ; } @@ -3702,7 +3719,11 @@ double opt_general_camera_mode(OPT_ARGS_NUM) { if(action & GMSH_SET) CTX::instance()->camera = (int)val; - +#if defined(HAVE_FLTK) + if(FlGui::available() && (action & GMSH_GUI)) + FlGui::instance()->options->general.butt[18]->value + (CTX::instance()->camera); +#endif return CTX::instance()->camera ; } diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp index aabaf00e198b906e9687a375471acaf7ae48ec4f..13ca769988e800ed09a1cbff50fa58a59d45d043 100644 --- a/Fltk/optionWindow.cpp +++ b/Fltk/optionWindow.cpp @@ -246,6 +246,19 @@ static void general_options_ok_cb(Fl_Widget *w, void *data) opt_general_double_buffer(0, GMSH_SET, o->general.butt[3]->value()); if(opt_general_antialiasing(0, GMSH_GET, 0) != o->general.butt[12]->value()) opt_general_antialiasing(0, GMSH_SET, o->general.butt[12]->value()); + if(opt_general_stereo_mode(0, GMSH_GET, 0) != o->general.butt[17]->value()) { + opt_general_stereo_mode(0, GMSH_SET, o->general.butt[17]->value()); + // when stereo mode is active camera mode is obligatory so camera button is desactivated + if (CTX::instance()->stereo){ + o->general.butt[18]->value(1); + o->general.butt[18]->deactivate(); + } + else o->general.butt[18]->activate(); + } + if(opt_general_camera_mode(0, GMSH_GET, 0) != o->general.butt[18]->value()) + opt_general_camera_mode(0, GMSH_SET, o->general.butt[18]->value()); + + opt_general_trackball(0, GMSH_SET, o->general.butt[5]->value()); opt_general_terminal(0, GMSH_SET, o->general.butt[7]->value()); double sessionrc = opt_general_session_save(0, GMSH_GET, 0); @@ -1212,7 +1225,7 @@ optionWindow::optionWindow(int deltaFontSize) FL_NORMAL_SIZE -= deltaFontSize; int width = 34 * FL_NORMAL_SIZE + WB; - int height = 12 * BH + 4 * WB; + int height = 13 * BH + 4 * WB; int L = 7 * FL_NORMAL_SIZE; win = new paletteWindow @@ -1309,6 +1322,18 @@ optionWindow::optionWindow(int deltaFontSize) general.value[10]->align(FL_ALIGN_RIGHT); general.value[10]->callback(general_options_ok_cb, (void*)"rotation_center_coord"); + general.butt[17] = new Fl_Check_Button + (L + 2 * WB, 2 * WB + 12 * BH, BW, BH, "Enable stereo"); + general.butt[17]->type(FL_TOGGLE_BUTTON); + general.butt[17]->callback(general_options_ok_cb); + + general.butt[18] = new Fl_Check_Button + (L + 2 * WB, 2 * WB + 11 * BH, BW, BH, "Enable camera"); + general.butt[18]->type(FL_TOGGLE_BUTTON); + general.butt[18]->callback(general_options_ok_cb); + + + o->end(); } {