From e416b3911b553fff2f9f7d02d8cff7985750a18d Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Sat, 12 Feb 2005 18:43:11 +0000
Subject: [PATCH] add "Window" menu on Mac OS X

---
 Fltk/Callbacks.cpp         | 33 ++++++++++++++++++++++++++++++++-
 Fltk/Callbacks.h           |  1 +
 Fltk/GUI.cpp               | 19 +++++++++----------
 Makefile                   |  4 ++--
 doc/VERSIONS               |  6 ++++--
 doc/texinfo/shortcuts.texi |  3 +--
 6 files changed, 49 insertions(+), 17 deletions(-)

diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp
index 55bcbb453f..3cacd74eb4 100644
--- a/Fltk/Callbacks.cpp
+++ b/Fltk/Callbacks.cpp
@@ -1,4 +1,4 @@
-// $Id: Callbacks.cpp,v 1.333 2005-02-05 21:49:00 geuzaine Exp $
+// $Id: Callbacks.cpp,v 1.334 2005-02-12 18:43:09 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -135,6 +135,37 @@ void redraw_cb(CALLBACK_ARGS)
   Draw();
 }
 
+void window_cb(CALLBACK_ARGS)
+{
+  switch((long)data){
+  case 0: // minimize
+    WID->g_window->iconize();
+    if(WID->opt_window->shown()) WID->opt_window->iconize();
+    if(WID->vis_window->shown()) WID->vis_window->iconize();
+    if(WID->clip_window->shown()) WID->clip_window->iconize();
+    if(WID->stat_window->shown()) WID->stat_window->iconize();
+    if(WID->msg_window->shown()) WID->msg_window->iconize();
+    WID->m_window->iconize();
+    break;
+  case 1: // maximize
+    WID->g_window->size((int)(0.95*Fl::w()), (int)(0.95*Fl::h())); // bof bof bof
+    WID->g_window->show();
+    WID->m_window->show();
+    break;
+  case 2: // bring all to front (the order is important!)
+    WID->g_window->show();
+    if(WID->opt_window->shown()) WID->opt_window->show();
+    if(WID->vis_window->shown()) WID->vis_window->show();
+    if(WID->clip_window->shown()) WID->clip_window->show();
+    if(WID->stat_window->shown()) WID->stat_window->show();
+    if(WID->msg_window->shown()) WID->msg_window->show();
+    WID->m_window->show();
+    break;
+  default:
+    break;
+  }
+}
+
 // Graphical window 
 
 void status_xyz1p_cb(CALLBACK_ARGS)
diff --git a/Fltk/Callbacks.h b/Fltk/Callbacks.h
index 98e5ee23de..0d274e8baf 100644
--- a/Fltk/Callbacks.h
+++ b/Fltk/Callbacks.h
@@ -33,6 +33,7 @@ void cancel_cb(CALLBACK_ARGS);
 void color_cb(CALLBACK_ARGS);
 void view_color_cb(CALLBACK_ARGS);
 void redraw_cb(CALLBACK_ARGS);
+void window_cb(CALLBACK_ARGS);
 
 // Graphical window
 
diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index eefeefc7ca..d014de0fef 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -1,4 +1,4 @@
-// $Id: GUI.cpp,v 1.417 2005-02-02 18:47:55 geuzaine Exp $
+// $Id: GUI.cpp,v 1.418 2005-02-12 18:43:10 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -147,6 +147,11 @@ Fl_Menu_Item m_sys_menubar_table[] = {
     {"Statistics",      FL_CTRL+'i', (Fl_Callback *)statistics_cb, 0},
     {"Message Console", FL_CTRL+'l', (Fl_Callback *)message_cb, 0},
     {0},
+  {"Window",0,0,0,FL_SUBMENU},
+    {"Minimize",           0, (Fl_Callback *)window_cb, (void*)0},
+    {"Zoom",               0, (Fl_Callback *)window_cb, (void*)1, FL_MENU_DIVIDER},
+    {"Bring All to Front", 0, (Fl_Callback *)window_cb, (void*)2},
+    {0},
   {"Help",0,0,0,FL_SUBMENU},
     {"Online Documentation", 0, (Fl_Callback *)help_online_cb, 0, FL_MENU_DIVIDER},
     {"Mouse Actions",        0, (Fl_Callback *)help_mouse_cb, 0},
@@ -529,14 +534,7 @@ int GUI::global_shortcuts(int event)
     return 0;   // trick: do as if we didn't use it
   }
   else if(Fl::test_shortcut(FL_SHIFT + 'a')) { 
-    // raise all open windows (graphics first, then options, then menu)
-    if(g_window && g_window->shown()) g_window->show();
-    if(opt_window && opt_window->shown()) opt_window->show();
-    if(vis_window && vis_window->shown()) vis_window->show();
-    if(clip_window && clip_window->shown()) clip_window->show();
-    if(stat_window && stat_window->shown()) stat_window->show();
-    if(msg_window && msg_window->shown()) msg_window->show();
-    if(m_window && m_window->shown()) m_window->show();
+    window_cb(0, (void*)2);
     return 1;
   }
   else if(Fl::test_shortcut(FL_SHIFT + 'o')) {
@@ -835,8 +833,9 @@ GUI::GUI(int argc, char **argv)
   g_window->icon((char *)p2);
 #endif
 
-  m_window->show(1, argv);
+  // show menu window last, so it's always in front
   g_window->show(1, argv);
+  m_window->show(1, argv);
 
   create_option_window();
   create_message_window();
diff --git a/Makefile b/Makefile
index 013319ace2..c90bd05b75 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.387 2005-01-18 00:12:34 geuzaine Exp $
+# $Id: Makefile,v 1.388 2005-02-12 18:43:09 geuzaine Exp $
 #
 # Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 #
@@ -23,7 +23,7 @@ include variables
 
 GMSH_MAJOR_VERSION = 1
 GMSH_MINOR_VERSION = 59
-GMSH_PATCH_VERSION = 0
+GMSH_PATCH_VERSION = 1
 GMSH_EXTRA_VERSION = "-cvs"
 
 GMSH_VERSION = ${GMSH_MAJOR_VERSION}.${GMSH_MINOR_VERSION}.${GMSH_PATCH_VERSION}${GMSH_EXTRA_VERSION}
diff --git a/doc/VERSIONS b/doc/VERSIONS
index e0f70b75fd..1854c904f9 100644
--- a/doc/VERSIONS
+++ b/doc/VERSIONS
@@ -1,4 +1,6 @@
-$Id: VERSIONS,v 1.308 2005-02-04 16:06:10 geuzaine Exp $
+$Id: VERSIONS,v 1.309 2005-02-12 18:43:10 geuzaine Exp $
+
+New since 1.59: new Window menu on Mac OS X; fixed small bugs.
 
 New in 1.59: added support for discrete (triangulated) surfaces,
 either in STL format or with the new "Discrete Surface" command; added
@@ -70,7 +72,7 @@ the "Layers" region numbering consistent between lines, surfaces and
 volumes; fixed home directory problem on Win98; new
 Plugin(CutParametric); the default project file is now created in the
 home directory if no current directory is defined (e.g., when
-double-clicking on the icon on Windows/MacOS); fixed the discrepancy
+double-clicking on the icon on Windows/Mac); fixed the discrepancy
 between the orientation of geometrical surfaces and the associated
 surface meshes; added automatic orientation of surfaces in surface
 loops; generalized Plugin(Triangulate) to handle vector and tensor
diff --git a/doc/texinfo/shortcuts.texi b/doc/texinfo/shortcuts.texi
index d8004356d0..a9c027c3d8 100644
--- a/doc/texinfo/shortcuts.texi
+++ b/doc/texinfo/shortcuts.texi
@@ -1,6 +1,5 @@
-Keyboard shortcuts:
-
 @table @kbd
+
 @item Left arrow
 Go to previous time step 
 @item Right arrow
-- 
GitLab