From bbc57f9be42f7a9bb98e40e01ad875c838703bf1 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Mon, 14 Dec 2009 15:44:41 +0000
Subject: [PATCH] cleanup option save callback

---
 Fltk/menuWindow.cpp    | 19 +++++++++++++------
 Fltk/optionWindow.cpp  |  8 --------
 Fltk/optionWindow.h    |  1 -
 Numeric/fullMatrix.cpp |  3 +--
 doc/texinfo/gmsh.texi  |  3 +++
 5 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/Fltk/menuWindow.cpp b/Fltk/menuWindow.cpp
index 2fc0566ad5..56941c40e5 100644
--- a/Fltk/menuWindow.cpp
+++ b/Fltk/menuWindow.cpp
@@ -365,9 +365,16 @@ static void file_save_as_cb(Fl_Widget *w, void *data)
 
 static void file_options_save_cb(Fl_Widget *w, void *data)
 {
-  std::string fileName = GModel::current()->getFileName() + ".opt";
+  std::string str((const char*)data), fileName;
+  if(str == "file")
+    fileName = GModel::current()->getFileName() + ".opt";
+  else
+    fileName = CTX::instance()->homeDir + CTX::instance()->optionsFileName;
   Msg::StatusBar(2, true, "Writing '%s'", fileName.c_str());
-  PrintOptions(0, GMSH_FULLRC, 1, 0, fileName.c_str());
+  if(str == "file")
+    PrintOptions(0, GMSH_FULLRC, 1, 0, fileName.c_str());
+  else
+    PrintOptions(0, GMSH_OPTIONSRC, 1, 1, fileName.c_str());
   Msg::StatusBar(2, true, "Wrote '%s'", fileName.c_str());
 }
 
@@ -2215,8 +2222,8 @@ static Fl_Menu_Item bar_table[] = {
     {"Save &As...", FL_CTRL+'s', (Fl_Callback *)file_save_as_cb, 0},
     {"Sa&ve Mesh",  FL_CTRL+FL_SHIFT+'s', (Fl_Callback *)mesh_save_cb, 0},
     {"Save Options", 0, 0, 0, FL_SUBMENU | FL_MENU_DIVIDER},
-      {"For Current File", 0, (Fl_Callback *)file_options_save_cb, 0},
-      {"As Default", 0, (Fl_Callback *)options_save_cb, 0},
+      {"For Current File", 0, (Fl_Callback *)file_options_save_cb, (void*)"file"},
+      {"As Default", 0, (Fl_Callback *)file_options_save_cb, (void*)"default"},
       {0},
     {"&Quit",       FL_CTRL+'q', (Fl_Callback *)file_quit_cb, 0},
     {0},
@@ -2267,8 +2274,8 @@ static Fl_Menu_Item sysbar_table[] = {
     {"Save As...", FL_META+'s', (Fl_Callback *)file_save_as_cb, 0},
     {"Save Mesh",  FL_META+FL_SHIFT+'s', (Fl_Callback *)mesh_save_cb, 0},
     {"Save Options", 0, 0, 0, FL_SUBMENU},
-      {"For Current File", 0, (Fl_Callback *)file_options_save_cb, 0},
-      {"As Default", 0, (Fl_Callback *)options_save_cb, 0},
+      {"For Current File", 0, (Fl_Callback *)file_options_save_cb, (void*)"file"},
+      {"As Default", 0, (Fl_Callback *)file_options_save_cb, (void*)"default"},
       {0},
     {0},
   {"Tools", 0, 0, 0, FL_SUBMENU},
diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp
index 07566753ce..89b89070a0 100644
--- a/Fltk/optionWindow.cpp
+++ b/Fltk/optionWindow.cpp
@@ -142,14 +142,6 @@ static void options_browser_cb(Fl_Widget *w, void *data)
   FlGui::instance()->options->showGroup(FlGui::instance()->options->browser->value());
 }
 
-void options_save_cb(Fl_Widget *w, void *data)
-{
-  std::string fileName = CTX::instance()->homeDir + CTX::instance()->optionsFileName;
-  Msg::StatusBar(2, true, "Writing '%s'", fileName.c_str());
-  PrintOptions(0, GMSH_OPTIONSRC, 1, 1, fileName.c_str());
-  Msg::StatusBar(2, true, "Wrote '%s'", fileName.c_str());
-}
-
 static void options_restore_defaults_cb(Fl_Widget *w, void *data)
 {
   // not sure if we have to remove the file...
diff --git a/Fltk/optionWindow.h b/Fltk/optionWindow.h
index 733b871e0f..2fb0a76222 100644
--- a/Fltk/optionWindow.h
+++ b/Fltk/optionWindow.h
@@ -92,7 +92,6 @@ class optionWindow{
 };
 
 void options_cb(Fl_Widget *w, void *data);
-void options_save_cb(Fl_Widget *w, void *data);
 void general_options_cb(Fl_Widget *w, void *data);
 void geometry_options_cb(Fl_Widget *w, void *data);
 void mesh_options_cb(Fl_Widget *w, void *data);
diff --git a/Numeric/fullMatrix.cpp b/Numeric/fullMatrix.cpp
index b7d4c32011..6bb8018385 100644
--- a/Numeric/fullMatrix.cpp
+++ b/Numeric/fullMatrix.cpp
@@ -144,7 +144,7 @@ static void eigSort(int n, double *wr, double *wi, double *VL, double *VR)
 {
   // Sort the eigenvalues/vectors in ascending order according to
   // their real part. Warning: this will screw up the ordering if we
-  // have coplex eigenvalues.
+  // have complex eigenvalues.
   for (int i = 0; i < n - 1; i++){
     int k = i;
     double ek = wr[i];
@@ -289,7 +289,6 @@ bool fullMatrix<double>::svd(fullMatrix<double> &V, fullVector<double> &S)
   return false;
 }
 
-
 #if defined(HAVE_LUA)
 template<> 
 int fullMatrix<double>::gemm(lua_State *L)
diff --git a/doc/texinfo/gmsh.texi b/doc/texinfo/gmsh.texi
index d83b2fdf35..1efa6f9219 100644
--- a/doc/texinfo/gmsh.texi
+++ b/doc/texinfo/gmsh.texi
@@ -1915,6 +1915,9 @@ Deletes all physical groups.
 @item Delete Variables;
 Deletes all the expressions.
 
+@item Delete Options;
+Deletes the current options and revert to the default values.
+
 @item Delete @var{string};
 Deletes the expression @var{string}.
 
-- 
GitLab