From 105d48507ef3f12bc68a76c6cf9446a1096602d4 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Sun, 14 May 2006 02:03:59 +0000 Subject: [PATCH] make mouse selection mode a regular option (for Ruth) --- Common/DefaultOptions.h | 2 ++ Common/Options.cpp | 27 +++++++++++++++++++++++++-- Common/Options.h | 1 + Fltk/Callbacks.cpp | 18 +++++++----------- demos/hex.geo | 2 +- doc/TODO | 7 +------ 6 files changed, 37 insertions(+), 20 deletions(-) diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 680b457965..525f525e6e 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -657,6 +657,8 @@ StringXNumber GeneralOptions_Number[] = { "Height (in pixels) of the message window" }, { F|S, "MessageWidth" , opt_general_message_size0 , 450. , "Width (in pixels) of the message window" }, + { F|O, "MouseSelection" , opt_general_mouse_selection , 2. , + "Mouse selection mode (0=none, 1=no hover, 2=full)" }, { F|O, "NoPopup" , opt_general_nopopup , 0. , "Disable interactive dialog windows in scripts (and use default values instead)" }, diff --git a/Common/Options.cpp b/Common/Options.cpp index 721e7663f9..405ea2ec1c 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.279 2006-04-24 00:26:48 geuzaine Exp $ +// $Id: Options.cpp,v 1.280 2006-05-14 02:03:59 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -156,7 +156,6 @@ void Init_Options(int num) CTX.gl_font_enum = -1; #endif CTX.forced_bbox = 0; - CTX.enable_mouse_selection = 2; // hover-to-show-number and click-to-select } void ReInit_Options(int num) @@ -2793,6 +2792,30 @@ double opt_general_orthographic(OPT_ARGS_NUM) return CTX.ortho; } +double opt_general_mouse_selection(OPT_ARGS_NUM) +{ + if(action & GMSH_SET) + CTX.enable_mouse_selection = (int)val; +#if defined(HAVE_FLTK) + if(WID && (action & GMSH_GUI)) { + if(CTX.enable_mouse_selection == 0){ + Msg(STATUS1N, "Mouse selection OFF"); + WID->g_status_butt[9]->color(FL_RED); + } + else if(CTX.enable_mouse_selection == 1){ + Msg(STATUS1N, "Mouse hover OFF"); + WID->g_status_butt[9]->color(FL_GREEN); + } + else{ + Msg(STATUS1N, "Mouse selection ON"); + WID->g_status_butt[9]->color(FL_BACKGROUND_COLOR); + } + WID->g_status_butt[9]->redraw(); + } +#endif + return CTX.enable_mouse_selection; +} + double opt_general_fast_redraw(OPT_ARGS_NUM) { if(action & GMSH_SET) diff --git a/Common/Options.h b/Common/Options.h index af354f7df1..0e373b98b4 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -289,6 +289,7 @@ double opt_general_terminal(OPT_ARGS_NUM); double opt_general_tooltips(OPT_ARGS_NUM); double opt_general_confirm_overwrite(OPT_ARGS_NUM); double opt_general_orthographic(OPT_ARGS_NUM); +double opt_general_mouse_selection(OPT_ARGS_NUM); double opt_general_draw_bounding_box(OPT_ARGS_NUM); double opt_general_fast_redraw(OPT_ARGS_NUM); double opt_general_axes(OPT_ARGS_NUM); diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index fd30a41ef8..546601de7a 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.416 2006-04-18 07:49:18 remacle Exp $ +// $Id: Callbacks.cpp,v 1.417 2006-05-14 02:03:59 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -467,22 +467,18 @@ void status_xyz1p_cb(CALLBACK_ARGS) } else if(!strcmp(str, "S")){ // mouse selection if(Fl::event_state(FL_SHIFT)){ - CTX.enable_mouse_selection = 1; // mouse selection only (no hover) - Msg(STATUS1N, "Mouse hover OFF"); - WID->g_status_butt[9]->color(FL_GREEN); + // mouse selection only (no hover) + opt_general_mouse_selection(0, GMSH_SET | GMSH_GUI, 1); } else if(CTX.enable_mouse_selection){ - CTX.enable_mouse_selection = 0; // mouse does nothing - Msg(STATUS1N, "Mouse selection OFF"); - WID->g_status_butt[9]->color(FL_RED); + // mouse does nothing + opt_general_mouse_selection(0, GMSH_SET | GMSH_GUI, 0); WID->g_opengl_window->cursor(FL_CURSOR_DEFAULT, FL_BLACK, FL_WHITE); } else{ - CTX.enable_mouse_selection = 2; // mouse hover and select (default) - Msg(STATUS1N, "Mouse selection ON"); - WID->g_status_butt[9]->color(FL_BACKGROUND_COLOR); + // mouse hover and select (default) + opt_general_mouse_selection(0, GMSH_SET | GMSH_GUI, 2); } - WID->g_status_butt[9]->redraw(); } WID->update_manip_window(); } diff --git a/demos/hex.geo b/demos/hex.geo index 972256251b..94497c1056 100644 --- a/demos/hex.geo +++ b/demos/hex.geo @@ -63,7 +63,7 @@ Transfinite Line{51:54} = 5; Transfinite Surface{56} = {51,52,53,54}; Recombine Surface{56}; Extrude {0,0,1} { - Surface{56}; Layers{5,1}; Recombine; + Surface{56}; Layers{4,1}; Recombine; } // and the same by using only extrusions diff --git a/doc/TODO b/doc/TODO index d8c241a145..313624fc36 100644 --- a/doc/TODO +++ b/doc/TODO @@ -1,9 +1,4 @@ -$Id: TODO,v 1.9 2006-05-13 22:32:13 geuzaine Exp $ - -******************************************************************** - -change default hovering mouse mode to off (very slow for ruth on -ubuntu) +$Id: TODO,v 1.10 2006-05-14 02:03:59 geuzaine Exp $ ******************************************************************** -- GitLab