From e20facf626f8303f09cc6fa95739cc4d80eaf312 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Wed, 18 Jan 2006 04:33:52 +0000
Subject: [PATCH] add (undocumented) shortcut to disable nouse hovering (speeds
 up drawing while still allowing to select by clicking)

---
 Common/Options.cpp     |  4 ++--
 Fltk/Callbacks.cpp     | 15 ++++++++++-----
 Fltk/GUI.cpp           |  8 ++++----
 Fltk/Opengl_Window.cpp |  4 ++--
 4 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/Common/Options.cpp b/Common/Options.cpp
index 4fdaba9997..52653acec4 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -1,4 +1,4 @@
-// $Id: Options.cpp,v 1.271 2006-01-11 03:51:16 geuzaine Exp $
+// $Id: Options.cpp,v 1.272 2006-01-18 04:33:51 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -158,7 +158,7 @@ void Init_Options(int num)
 #endif
   CTX.solver.listen = 0;
   CTX.forced_bbox = 0;
-  CTX.enable_mouse_selection = 1;
+  CTX.enable_mouse_selection = 2; // hover-to-show-number and click-to-select
 }
 
 void ReInit_Options(int num)
diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp
index c25e51261a..e424e4529e 100644
--- a/Fltk/Callbacks.cpp
+++ b/Fltk/Callbacks.cpp
@@ -1,4 +1,4 @@
-// $Id: Callbacks.cpp,v 1.399 2006-01-16 17:55:43 geuzaine Exp $
+// $Id: Callbacks.cpp,v 1.400 2006-01-18 04:33:51 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -469,14 +469,19 @@ void status_xyz1p_cb(CALLBACK_ARGS)
     WID->create_message_window();
   }
   else if(!strcmp(str, "S")){ // mouse selection
-    if(CTX.enable_mouse_selection){
-      CTX.enable_mouse_selection = 0;
+    if(Fl::event_state(FL_SHIFT)){
+      CTX.enable_mouse_selection = 1; // mouse click only (no hover)
+      Msg(STATUS1N, "Mouse hover OFF");
+      WID->g_status_butt[9]->color(FL_GREEN);
+    }
+    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);
-      WID->g_opengl_window->cursor(FL_CURSOR_DEFAULT, FL_BLACK, FL_WHITE);
+      WID->g_opengl_window->cursor(FL_CURSOR_DEFAULT, FL_BLACK, FL_WHITE);      
     }
     else{
-      CTX.enable_mouse_selection = 1;
+      CTX.enable_mouse_selection = 2; // mouse hover and click (default)
       Msg(STATUS1N, "Mouse selection ON");
       WID->g_status_butt[9]->color(FL_BACKGROUND_COLOR);
     }
diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index 08c6760b1a..772f2a1e88 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -1,4 +1,4 @@
-// $Id: GUI.cpp,v 1.481 2006-01-14 17:13:14 geuzaine Exp $
+// $Id: GUI.cpp,v 1.482 2006-01-18 04:33:51 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -507,8 +507,7 @@ int GUI::global_shortcuts(int event)
   if(event != FL_SHORTCUT)
     return 0;
 
-  if(Fl::test_shortcut(FL_SHIFT + FL_Escape) ||
-     Fl::test_shortcut(FL_CTRL + FL_Escape) ||
+  if(Fl::test_shortcut(FL_CTRL + FL_Escape) ||
      Fl::test_shortcut(FL_META + FL_Escape) ||
      Fl::test_shortcut(FL_ALT + FL_Escape)) {
     return 1;
@@ -576,7 +575,8 @@ int GUI::global_shortcuts(int event)
     quit_selection = 1;
     return 0;   // trick: do as if we didn't use it
   }
-  else if(Fl::test_shortcut(FL_Escape)) {
+  else if(Fl::test_shortcut(FL_Escape) ||
+	  Fl::test_shortcut(FL_SHIFT + FL_Escape)) {
     if(g_opengl_window->LassoMode){
       g_opengl_window->LassoMode = false;
       redraw_opengl();
diff --git a/Fltk/Opengl_Window.cpp b/Fltk/Opengl_Window.cpp
index 6a1ddf231d..ca415cd806 100644
--- a/Fltk/Opengl_Window.cpp
+++ b/Fltk/Opengl_Window.cpp
@@ -1,4 +1,4 @@
-// $Id: Opengl_Window.cpp,v 1.58 2006-01-06 00:34:23 geuzaine Exp $
+// $Id: Opengl_Window.cpp,v 1.59 2006-01-18 04:33:52 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -351,7 +351,7 @@ int Opengl_Window::handle(int event)
       sprintf(str, "%g", point[2]); WID->context_geometry_input[4]->value(str);
       redraw();
     }
-    else if(CTX.enable_mouse_selection){
+    else if(CTX.enable_mouse_selection > 1){
       if(curr.win[0] != prev.win[0] || curr.win[1] != prev.win[1]){
 	WID->make_opengl_current();
 	v[0] = NULL; c[0] = NULL; s[0] = NULL;
-- 
GitLab