From 6adb2d7df1ec5b4ee51da1845bb4d332754a100a Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Fri, 14 Oct 2005 19:26:06 +0000 Subject: [PATCH] Don't set CustomMin and CustomMax to the Min/Max values of the view: it can be confusing when saving options. Instead, provide buttons in the GUI to set the custom values to Min/Max if so desired. --- Common/Views.cpp | 4 +--- Fltk/Callbacks.cpp | 18 +++++++++++++++++- Fltk/Callbacks.h | 1 + Fltk/GUI.cpp | 15 ++++++++------- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/Common/Views.cpp b/Common/Views.cpp index 4aa08f2216..767e71fbac 100644 --- a/Common/Views.cpp +++ b/Common/Views.cpp @@ -1,4 +1,4 @@ -// $Id: Views.cpp,v 1.176 2005-09-02 16:11:16 geuzaine Exp $ +// $Id: Views.cpp,v 1.177 2005-10-14 19:26:06 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -403,8 +403,6 @@ void EndView(Post_View * v, int add_in_gui, char *file_name, char *name) opt_view_filename(v->Index, GMSH_SET | GMSH_GUI, file_name); opt_view_nb_timestep(v->Index, GMSH_GUI, 0); opt_view_timestep(v->Index, GMSH_SET | GMSH_GUI, v->TimeStep); - opt_view_custom_min(v->Index, GMSH_SET | GMSH_GUI, v->Min); - opt_view_custom_max(v->Index, GMSH_SET | GMSH_GUI, v->Max); if(CTX.post.smooth) v->smooth(); diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 62b43469f8..ff718830a8 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.371 2005-10-09 17:45:37 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.372 2005-10-14 19:26:06 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -207,10 +207,14 @@ void activate_cb(CALLBACK_ARGS) if(WID->view_choice[7]->value() == 2){ WID->view_value[31]->activate(); WID->view_value[32]->activate(); + WID->view_push_butt[1]->activate(); + WID->view_push_butt[2]->activate(); } else { WID->view_value[31]->deactivate(); WID->view_value[32]->deactivate(); + WID->view_push_butt[1]->deactivate(); + WID->view_push_butt[2]->deactivate(); } } else if(!strcmp(str, "general_transform")){ @@ -3631,6 +3635,18 @@ void view_options_timestep_incr_cb(CALLBACK_ARGS) Draw(); } +void view_options_custom_set_cb(CALLBACK_ARGS) +{ + char *str = (char*)data; + + if(!strcmp(str, "Min")){ + WID->view_value[31]->value(opt_view_min(WID->view_number, GMSH_GET, 0)); + } + else if(!strcmp(str, "Max")){ + WID->view_value[32]->value(opt_view_max(WID->view_number, GMSH_GET, 0)); + } +} + void view_options_ok_cb(CALLBACK_ARGS) { int current = (int)(long)data; diff --git a/Fltk/Callbacks.h b/Fltk/Callbacks.h index 14205348d1..aeb0a8eb89 100644 --- a/Fltk/Callbacks.h +++ b/Fltk/Callbacks.h @@ -134,6 +134,7 @@ void view_options_cb(CALLBACK_ARGS); void view_options_timestep_cb(CALLBACK_ARGS); void view_options_timestep_decr_cb(CALLBACK_ARGS); void view_options_timestep_incr_cb(CALLBACK_ARGS); +void view_options_custom_set_cb(CALLBACK_ARGS); void view_options_ok_cb(CALLBACK_ARGS); void view_arrow_param_cb(CALLBACK_ARGS); diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index d7c948368c..044091bc60 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.458 2005-10-09 15:58:40 geuzaine Exp $ +// $Id: GUI.cpp,v 1.459 2005-10-14 19:26:06 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -2887,10 +2887,15 @@ void GUI::create_option_window() view_choice[7]->align(FL_ALIGN_RIGHT); view_choice[7]->callback(activate_cb, (void*)"custom_range"); - view_value[31] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 4 * BH, IW, BH, "Custom minimum"); + int sw = (int)(2.5 * fontsize); + view_push_butt[1] = new Fl_Button(L + 2 * WB, 2 * WB + 4 * BH, sw, BH, "Min"); + view_push_butt[1]->callback(view_options_custom_set_cb, (void*)"Min"); + view_value[31] = new Fl_Value_Input(L + 2 * WB + sw, 2 * WB + 4 * BH, IW - sw, BH, "Custom minimum"); view_value[31]->align(FL_ALIGN_RIGHT); - view_value[32] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 5 * BH, IW, BH, "Custom maximum"); + view_push_butt[2] = new Fl_Button(L + 2 * WB, 2 * WB + 5 * BH, sw, BH, "Max"); + view_push_butt[2]->callback(view_options_custom_set_cb, (void*)"Max"); + view_value[32] = new Fl_Value_Input(L + 2 * WB + sw, 2 * WB + 5 * BH, IW - sw, BH, "Custom maximum"); view_value[32]->align(FL_ALIGN_RIGHT); static Fl_Menu_Item menu_scale[] = { @@ -3257,10 +3262,6 @@ void GUI::update_view_window(int num) opt_view_range_type(num, GMSH_GUI, 0); opt_view_custom_min(num, GMSH_GUI, 0); opt_view_custom_max(num, GMSH_GUI, 0); - for(int i = 31; i <= 32; i++) { - view_value[i]->minimum(v->CustomMin); - view_value[i]->maximum(v->CustomMax); - } opt_view_scale_type(num, GMSH_GUI, 0); opt_view_saturate_values(num, GMSH_GUI, 0); -- GitLab