From 65660024c193f9e95102c21bc1c71561c750f77b Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Tue, 13 Oct 2009 20:02:20 +0000 Subject: [PATCH] little gui for forced view type --- Common/Options.cpp | 12 ++++++++++++ Fltk/optionWindow.cpp | 24 +++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Common/Options.cpp b/Common/Options.cpp index 5864e77895..ada3c62186 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -8158,6 +8158,18 @@ double opt_view_force_num_components(OPT_ARGS_NUM) opt->forceNumComponents = (int)val; if(view) view->setChanged(true); } +#if defined(HAVE_FLTK) + if(_gui_action_valid(action, num)){ + if(opt->forceNumComponents == 1) + FlGui::instance()->options->view.choice[14]->value(1); + else if(opt->forceNumComponents == 3) + FlGui::instance()->options->view.choice[14]->value(2); + else if(opt->forceNumComponents == 9) + FlGui::instance()->options->view.choice[14]->value(3); + else + FlGui::instance()->options->view.choice[14]->value(0); + } +#endif return opt->forceNumComponents; #else return 0.; diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp index 1d65c20f59..2cd4752123 100644 --- a/Fltk/optionWindow.cpp +++ b/Fltk/optionWindow.cpp @@ -568,6 +568,7 @@ static void view_options_ok_cb(Fl_Widget *w, void *data) double external_view = opt_view_external_view(current, GMSH_GET, 0); double gen_raise_view = opt_view_gen_raise_view(current, GMSH_GET, 0); double show_time = opt_view_show_time(current, GMSH_GET, 0); + double force_num_components = opt_view_force_num_components(current, GMSH_GET, 0); double type = opt_view_type(current, GMSH_GET, 0); double saturate_values = opt_view_saturate_values(current, GMSH_GET, 0); @@ -720,11 +721,18 @@ static void view_options_ok_cb(Fl_Widget *w, void *data) val = o->view.choice[12]->value(); if(force || (val != show_time)) opt_view_show_time(i, GMSH_SET, val); - + val = o->view.choice[13]->value() + 1; if(force || (val != type)) opt_view_type(i, GMSH_SET, val); + val = + (o->view.choice[14]->value() == 1) ? 1 : + (o->view.choice[14]->value() == 2) ? 3 : + (o->view.choice[14]->value() == 3) ? 9 : 0; + if(force || (val != force_num_components)) + opt_view_force_num_components(i, GMSH_SET, val); + // view_butts val = o->view.butt[0]->value(); @@ -2735,6 +2743,19 @@ optionWindow::optionWindow(int deltaFontSize) view.menu[0]->menu(menu_view_field_types); view.menu[0]->callback(view_options_ok_cb); + static Fl_Menu_Item menu_force_field_type[] = { + {"None", 0, 0, 0}, + {"Scalar", 0, 0, 0}, + {"Vector", 0, 0, 0}, + {"Tensor", 0, 0, 0}, + {0} + }; + view.choice[14] = new Fl_Choice + (L + 2 * WB, 2 * WB + 10 * BH, IW, BH, "Forced field type"); + view.choice[14]->menu(menu_force_field_type); + view.choice[14]->align(FL_ALIGN_RIGHT); + view.choice[14]->callback(view_options_ok_cb); + o->end(); } { @@ -3254,6 +3275,7 @@ void optionWindow::updateViewGroup(int index) view.value[50]->maximum(data->getNumTimeSteps() - 1); opt_view_timestep(index, GMSH_GUI, 0); opt_view_show_time(index, GMSH_GUI, 0); + opt_view_force_num_components(index, GMSH_GUI, 0); opt_view_point_size(index, GMSH_GUI, 0); opt_view_point_type(index, GMSH_GUI, 0); -- GitLab