From efb9d2f4d855aea23949aa245a50151e5a33c617 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Sat, 18 May 2002 23:07:42 +0000
Subject: [PATCH] Introduce some workarounds for the "1 mouse button case" (for
 macs...)

---
 Fltk/Callbacks.cpp       | 135 +++++++++++++++++++++------------------
 Fltk/Colorbar_Window.cpp |   7 +-
 Fltk/GUI.cpp             |  13 +++-
 Fltk/Opengl_Window.cpp   |   6 +-
 4 files changed, 91 insertions(+), 70 deletions(-)

diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp
index 2cb0c66749..a9bb10054e 100644
--- a/Fltk/Callbacks.cpp
+++ b/Fltk/Callbacks.cpp
@@ -1,4 +1,4 @@
-// $Id: Callbacks.cpp,v 1.124 2002-05-18 07:56:47 geuzaine Exp $
+// $Id: Callbacks.cpp,v 1.125 2002-05-18 23:07:42 geuzaine Exp $
 //
 // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle
 //
@@ -792,80 +792,91 @@ void opt_visibility_number_cb(CALLBACK_ARGS){
 
 // Help Menu
 
+#ifdef __APPLE__
+#define XX "Cmd "
+#else
+#define XX "Ctrl"
+#endif
+
 void help_short_cb(CALLBACK_ARGS){
   Msg(DIRECT, "");
   Msg(DIRECT, "Mouse:");
   Msg(DIRECT, "");
-  Msg(DIRECT, "  move          - highlight the elementary geometrical entity");
-  Msg(DIRECT, "                  currently under the mouse pointer and display");
-  Msg(DIRECT, "                  its properties in the status bar");
-  Msg(DIRECT, "                - size a rubber zoom started with Ctrl+mouse1");
-  Msg(DIRECT, "  mouse1        - rotate");
-  Msg(DIRECT, "                - accept a rubber zoom started with Ctrl+mouse1"); 
-  Msg(DIRECT, "  Ctrl+mouse1   start (anisotropic) rubber zoom"); 
-  Msg(DIRECT, "  Shift+mouse1  - zoom (isotropic)");
-  Msg(DIRECT, "                - cancel a rubber zoom");
-  Msg(DIRECT, "  mouse2        same as Shift+mouse1");
-  Msg(DIRECT, "  Ctrl+mouse2   orthogonalize display"); 
-  Msg(DIRECT, "  mouse3        - pan");
-  Msg(DIRECT, "                - cancel a rubber zoom");
-  Msg(DIRECT, "                - pop up menu on post-processing view button");
-  Msg(DIRECT, "  Ctrl+mouse3   reset to default viewpoint");   
+  Msg(DIRECT, "  move            - highlight the elementary geometrical entity");
+  Msg(DIRECT, "                    currently under the mouse pointer and display");
+  Msg(DIRECT, "                    its properties in the status bar");
+  Msg(DIRECT, "                  - size a rubber zoom started with "XX"+mouse1");
+  Msg(DIRECT, "  LeftButt        - rotate");
+  Msg(DIRECT, "                  - accept a rubber zoom started with "XX"+mouse1"); 
+  Msg(DIRECT, "  "XX"+LeftButt   start (anisotropic) rubber zoom"); 
+  Msg(DIRECT, "  MiddleButt      - zoom (isotropic)");
+  Msg(DIRECT, "                  - cancel a rubber zoom");
+  Msg(DIRECT, "  "XX"+MiddleButt orthogonalize display"); 
+  Msg(DIRECT, "  RightButt       - pan");
+  Msg(DIRECT, "                  - cancel a rubber zoom");
+  Msg(DIRECT, "                  - pop up menu on post-processing view button");
+  Msg(DIRECT, "  "XX"+RightButt  reset to default viewpoint");   
+  Msg(DIRECT, "");   
+  Msg(DIRECT, "  For a 2 button mouse, MiddleButt = Shift+LeftButt");
+  Msg(DIRECT, "  For a 1 button mouse, MiddleButt = Shift+LeftButt, RightButt = Alt+LeftButt");
   Msg(DIRECT, "");
   Msg(DIRECT, "Menu bar shortcuts:");
   Msg(DIRECT, "");
-  Msg(DIRECT, "  b             go back to previous context");
-  Msg(DIRECT, "  Ctrl+e        save file by extension");
-  Msg(DIRECT, "  f             go forward to next context");
-  Msg(DIRECT, "  g             go to geometry module");
-  Msg(DIRECT, "  Shift+g       show geometry options");
-  Msg(DIRECT, "  Shift+i       show statistics window"); 
-  Msg(DIRECT, "  m             go to mesh module");
-  Msg(DIRECT, "  Shift+m       show mesh options");
-  Msg(DIRECT, "  Ctrl+m        merge file"); 
-  Msg(DIRECT, "  Shift+o       show general options"); 
-  Msg(DIRECT, "  Ctrl+o        open file"); 
-  Msg(DIRECT, "  p             go to post-processor module");
-  Msg(DIRECT, "  Shift+p       show post-processing general options");
-  Msg(DIRECT, "  Ctrl+q        quit");
-  Msg(DIRECT, "  Ctrl+s        save mesh in default format");
+  Msg(DIRECT, "  b               go back to previous context");
+  Msg(DIRECT, "  "XX"+e          save file by extension");
+  Msg(DIRECT, "  f               go forward to next context");
+  Msg(DIRECT, "  g               go to geometry module");
+  Msg(DIRECT, "  Shift+g         show geometry options");
+  Msg(DIRECT, "  Shift+i         show statistics window"); 
+  Msg(DIRECT, "  m               go to mesh module");
+  Msg(DIRECT, "  Shift+m         show mesh options");
+  Msg(DIRECT, "  "XX"+m          merge file"); 
+  Msg(DIRECT, "  Shift+o         show general options"); 
+  Msg(DIRECT, "  "XX"+o          open file"); 
+  Msg(DIRECT, "  p               go to post-processor module");
+  Msg(DIRECT, "  Shift+p         show post-processing general options");
+  Msg(DIRECT, "  "XX"+q          quit");
+  Msg(DIRECT, "  "XX"+s          save mesh in default format");
   Msg(DIRECT, "");
   Msg(DIRECT, "Other shortcuts");
   Msg(DIRECT, "");
-  Msg(DIRECT, "  0 or Esc      reload geometry input file");
-  Msg(DIRECT, "  1 or F1       mesh curves");
-  Msg(DIRECT, "  2 or F2       mesh surfaces");
-  Msg(DIRECT, "  3 or F3       mesh volumes");
-  Msg(DIRECT, "  Alt+a         hide/show small axes"); 
-  Msg(DIRECT, "  Alt+Shift+a   hide/show big moving axes"); 
-  Msg(DIRECT, "  Alt+b         hide/show all post-processing scales");
-  Msg(DIRECT, "  Alt+c         alternate between predefined color schemes");
-  Msg(DIRECT, "  Alt+d         alternate between mesh wire frame, hidden lines and shading modes");
-  Msg(DIRECT, "  Shift+d       decrease animation delay");
-  Msg(DIRECT, "  Ctrl+Shift+d  increase animation delay");
-  Msg(DIRECT, "  Alt+f         toggle redraw mode (fast/full)"); 
-  Msg(DIRECT, "  Alt+h         hide/show all post-processing views"); 
-  Msg(DIRECT, "  Alt+l         hide/show geometry lines");
-  Msg(DIRECT, "  Alt+Shift+l   hide/show mesh lines");
-  Msg(DIRECT, "  Alt+m         toggle visibility of all mesh entities");
-  Msg(DIRECT, "  Alt+o         change projection mode");
-  Msg(DIRECT, "  Alt+p         hide/show geometry points");
-  Msg(DIRECT, "  Alt+Shift+p   hide/show mesh points");
-  Msg(DIRECT, "  Alt+s         hide/show geometry surfaces");
-  Msg(DIRECT, "  Alt+Shift+s   hide/show mesh surfaces");
-  Msg(DIRECT, "  Alt+t         alternate intervals mode for visible post-processing views"); 
-  Msg(DIRECT, "  Alt+v         hide/show geometry volumes");
-  Msg(DIRECT, "  Alt+Shift+v   hide/show mesh volumes");
-  Msg(DIRECT, "  Alt+x         set X view"); 
-  Msg(DIRECT, "  Alt+y         set Y view"); 
-  Msg(DIRECT, "  Alt+z         set Z view"); 
-  Msg(DIRECT, "  Left arrow    previous time step"); 
-  Msg(DIRECT, "  Right arrow   next time step"); 
-  Msg(DIRECT, "  Up arrow      previous view"); 
-  Msg(DIRECT, "  Down arrow    next view"); 
+  Msg(DIRECT, "  0 or Esc        reload geometry input file");
+  Msg(DIRECT, "  1 or F1         mesh curves");
+  Msg(DIRECT, "  2 or F2         mesh surfaces");
+  Msg(DIRECT, "  3 or F3         mesh volumes");
+  Msg(DIRECT, "  Alt+a           hide/show small axes"); 
+  Msg(DIRECT, "  Alt+Shift+a     hide/show big moving axes"); 
+  Msg(DIRECT, "  Alt+b           hide/show all post-processing scales");
+  Msg(DIRECT, "  Alt+c           alternate between predefined color schemes");
+  Msg(DIRECT, "  Alt+d           alternate between mesh wire frame, hidden lines and shading modes");
+  Msg(DIRECT, "  Shift+d         decrease animation delay");
+  Msg(DIRECT, "  "XX"+Shift+d    increase animation delay");
+  Msg(DIRECT, "  Alt+f           toggle redraw mode (fast/full)"); 
+  Msg(DIRECT, "  Alt+h           hide/show all post-processing views"); 
+  Msg(DIRECT, "  Alt+l           hide/show geometry lines");
+  Msg(DIRECT, "  Alt+Shift+l     hide/show mesh lines");
+  Msg(DIRECT, "  Alt+m           toggle visibility of all mesh entities");
+  Msg(DIRECT, "  Alt+o           change projection mode");
+  Msg(DIRECT, "  Alt+p           hide/show geometry points");
+  Msg(DIRECT, "  Alt+Shift+p     hide/show mesh points");
+  Msg(DIRECT, "  Alt+s           hide/show geometry surfaces");
+  Msg(DIRECT, "  Alt+Shift+s     hide/show mesh surfaces");
+  Msg(DIRECT, "  Alt+t           alternate intervals mode for visible post-processing views"); 
+  Msg(DIRECT, "  Alt+v           hide/show geometry volumes");
+  Msg(DIRECT, "  Alt+Shift+v     hide/show mesh volumes");
+  Msg(DIRECT, "  Alt+x           set X view"); 
+  Msg(DIRECT, "  Alt+y           set Y view"); 
+  Msg(DIRECT, "  Alt+z           set Z view"); 
+  Msg(DIRECT, "  Left arrow      previous time step"); 
+  Msg(DIRECT, "  Right arrow     next time step"); 
+  Msg(DIRECT, "  Up arrow        previous view"); 
+  Msg(DIRECT, "  Down arrow      next view"); 
   Msg(DIRECT, "");
   WID->create_message_window();
 }
+
+#undef XX
+
 void help_command_line_cb(CALLBACK_ARGS){
   Msg(DIRECT, "");
   Print_Usage("gmsh");
diff --git a/Fltk/Colorbar_Window.cpp b/Fltk/Colorbar_Window.cpp
index affa8584ac..30360e7e5e 100644
--- a/Fltk/Colorbar_Window.cpp
+++ b/Fltk/Colorbar_Window.cpp
@@ -1,4 +1,4 @@
-// $Id: Colorbar_Window.cpp,v 1.23 2002-05-18 07:56:47 geuzaine Exp $
+// $Id: Colorbar_Window.cpp,v 1.24 2002-05-18 23:07:42 geuzaine Exp $
 //
 // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle
 //
@@ -521,10 +521,9 @@ int Colorbar_Window::handle(int event){
     // determine which curve to modify
     if (Fl::event_state(FL_CTRL))
       p4 = 1;
-    else if(ibut == 1 && !Fl::event_state(FL_SHIFT))
+    else if(ibut == 1 && !Fl::event_state(FL_SHIFT) && !Fl::event_state(FL_ALT))
       p1 = 1 ;
-    else if(ibut == 2 ||
-	    ibut == 1 && Fl::event_state(FL_SHIFT))
+    else if(ibut == 2 || (ibut == 1 && Fl::event_state(FL_SHIFT)))
       p2 = 1 ;
     else
       p3 = 1 ;
diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index 79d82fb11b..f374b368fa 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -1,4 +1,4 @@
-// $Id: GUI.cpp,v 1.174 2002-05-18 07:56:47 geuzaine Exp $
+// $Id: GUI.cpp,v 1.175 2002-05-18 23:07:42 geuzaine Exp $
 //
 // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle
 //
@@ -35,6 +35,7 @@
 #include "GUI.h"
 #include "Callbacks.h"
 #include "Bitmaps.h"
+#include "Icon.h"
 #include "OpenFile.h"
 #include "GetOptions.h"
 
@@ -738,7 +739,11 @@ void GUI::create_menu_window(int argc, char **argv){
     m_toggle_butt[i] = new Fl_Light_Button(0,y+i*BH,width,BH); 
     m_toggle_butt[i]->callback(view_toggle_cb, (void*)i);
     m_toggle_butt[i]->hide();
+#ifdef __APPLE__ // FIXME: is there a better way??
+    m_popup_butt[i] = new Fl_Menu_Button(0,y+i*BH,width,BH,"&Options");
+#else
     m_popup_butt[i] = new Fl_Menu_Button(0,y+i*BH,width,BH);
+#endif
     m_popup_butt[i]->type(Fl_Menu_Button::POPUP3);
     m_popup_butt[i]->add("Reload/View", 0, 
 			 (Fl_Callback *)view_reload_cb, (void*)i, 0);
@@ -1605,9 +1610,15 @@ void GUI::create_post_options_window(){
 	post_butt[i]->selection_color(RADIO_COLOR);
       }
       Fl_Box *text =  new Fl_Box(FL_NO_BOX, 2*WB, 3*WB+6*BH, width-4*WB, 2*BH,
+#ifdef __APPLE__
+				 "Individual view options are available by "
+				 "pressing 'o' when the mouse is over the view "
+				 "button in the post-processing menu");
+#else
 				 "Individual view options are available "
 				 "by right-clicking on each view button "
 				 "in the post-processing menu");
+#endif
       text->align(FL_ALIGN_LEFT|FL_ALIGN_TOP|FL_ALIGN_INSIDE|FL_ALIGN_WRAP);
       o->end();
     }
diff --git a/Fltk/Opengl_Window.cpp b/Fltk/Opengl_Window.cpp
index 4b3a5b92ab..5623ba68ea 100644
--- a/Fltk/Opengl_Window.cpp
+++ b/Fltk/Opengl_Window.cpp
@@ -1,4 +1,4 @@
-// $Id: Opengl_Window.cpp,v 1.23 2002-05-18 07:56:48 geuzaine Exp $
+// $Id: Opengl_Window.cpp,v 1.24 2002-05-18 23:07:42 geuzaine Exp $
 //
 // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle
 //
@@ -157,7 +157,7 @@ int Opengl_Window::handle(int event) {
     xpos = Fl::event_x();
     ypos = Fl::event_y();
 
-    if(ibut == 1 && !Fl::event_state(FL_SHIFT)){
+    if(ibut == 1 && !Fl::event_state(FL_SHIFT) && !Fl::event_state(FL_ALT)){
       if(!ZoomClick && Fl::event_state(FL_CTRL)){
         ZOOM_X0 = ZOOM_X1 = CTX.vxmin + ((double)xpos/(double)w()) * (CTX.vxmax - CTX.vxmin);
         ZOOM_Y0 = ZOOM_Y1 = CTX.vymax - ((double)ypos/(double)h()) * (CTX.vymax - CTX.vymin);
@@ -240,7 +240,7 @@ int Opengl_Window::handle(int event) {
 	FirstClick=0;
       }
 
-      if(ibut == 1 && !Fl::event_state(FL_SHIFT)){
+      if(ibut == 1 && !Fl::event_state(FL_SHIFT) && !Fl::event_state(FL_ALT)){
 	if(CTX.useTrackball)
 	  CTX.addQuaternion((2.0*xpos - w()) / w(),
 			    (h() - 2.0*ypos) / h(),
-- 
GitLab