From 5376df5eb6bde5160da377bdcc30e65cc470acb5 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Mon, 18 Dec 2006 20:12:49 +0000
Subject: [PATCH] reverse gui logic for "save_all" (IMHO much easier to
 understand this way)

---
 Common/Options.cpp  |  4 ++--
 Fltk/GUI_Extras.cpp | 26 +++++++++++++-------------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/Common/Options.cpp b/Common/Options.cpp
index b090378df1..3f9ffa83e1 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -1,4 +1,4 @@
-// $Id: Options.cpp,v 1.323 2006-12-16 05:43:20 geuzaine Exp $
+// $Id: Options.cpp,v 1.324 2006-12-18 20:12:49 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -4881,7 +4881,7 @@ double opt_mesh_cut_planed(OPT_ARGS_NUM)
 double opt_mesh_save_all(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET)
-    CTX.mesh.save_all = (int)val;
+    CTX.mesh.save_all = val ? 1 : 0;
   return CTX.mesh.save_all;
 }
 
diff --git a/Fltk/GUI_Extras.cpp b/Fltk/GUI_Extras.cpp
index 023253124c..9d0a6033fe 100644
--- a/Fltk/GUI_Extras.cpp
+++ b/Fltk/GUI_Extras.cpp
@@ -1,4 +1,4 @@
-// $Id: GUI_Extras.cpp,v 1.30 2006-12-18 19:47:37 geuzaine Exp $
+// $Id: GUI_Extras.cpp,v 1.31 2006-12-18 20:12:49 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -613,7 +613,7 @@ int generic_mesh_dialog(char *name, char *title, int format)
     // not a "Dialog_Window" since it is modal 
     dialog->window = new Fl_Double_Window(w, h);
     dialog->window->box(GMSH_WINDOW_BOX);
-    dialog->b = new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Save all (ignore physicals)"); y += BH;
+    dialog->b = new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Save only physical groups"); y += BH;
     dialog->b->type(FL_TOGGLE_BUTTON);
     dialog->ok = new Fl_Return_Button(WB, y + WB, BB, BH, "OK");
     dialog->cancel = new Fl_Button(2 * WB + BB, y + WB, BB, BH, "Cancel");
@@ -623,7 +623,7 @@ int generic_mesh_dialog(char *name, char *title, int format)
   }
   
   dialog->window->label(title);
-  dialog->b->value(CTX.mesh.save_all);
+  dialog->b->value(CTX.mesh.save_all ? 0 : 1);
   dialog->window->show();
 
   while(dialog->window->shown()){
@@ -632,7 +632,7 @@ int generic_mesh_dialog(char *name, char *title, int format)
       Fl_Widget* o = Fl::readqueue();
       if (!o) break;
       if (o == dialog->ok) {
-	opt_mesh_save_all(0, GMSH_SET | GMSH_GUI, dialog->b->value());
+	opt_mesh_save_all(0, GMSH_SET | GMSH_GUI, dialog->b->value() ? 0 : 1);
 	CreateOutputFile(name, format);
 	dialog->window->hide();
 	return 1;
@@ -678,7 +678,7 @@ int msh_dialog(char *name)
     dialog->c = new Fl_Choice(WB, y, BB + BB / 2, BH, "Format"); y += BH;
     dialog->c->menu(formatmenu);
     dialog->c->align(FL_ALIGN_RIGHT);
-    dialog->b = new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Save all (ignore physicals)"); y += BH;
+    dialog->b = new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Save only physical groups"); y += BH;
     dialog->b->type(FL_TOGGLE_BUTTON);
     dialog->ok = new Fl_Return_Button(WB, y + WB, BB, BH, "OK");
     dialog->cancel = new Fl_Button(2 * WB + BB, y + WB, BB, BH, "Cancel");
@@ -689,7 +689,7 @@ int msh_dialog(char *name)
   
   dialog->c->value((CTX.mesh.msh_file_version == 1.0) ? 0 : 
 		   CTX.mesh.msh_binary ? 2 : 1);
-  dialog->b->value(CTX.mesh.save_all);
+  dialog->b->value(CTX.mesh.save_all ? 0 : 1);
   dialog->window->show();
 
   while(dialog->window->shown()){
@@ -702,7 +702,7 @@ int msh_dialog(char *name)
 				  (dialog->c->value() == 0) ? 1. : 2.);
 	opt_mesh_msh_binary(0, GMSH_SET | GMSH_GUI, 
 			    (dialog->c->value() == 2) ? 1 : 0);
-	opt_mesh_save_all(0, GMSH_SET | GMSH_GUI, dialog->b->value());
+	opt_mesh_save_all(0, GMSH_SET | GMSH_GUI, dialog->b->value() ? 0 : 1);
 	CreateOutputFile(name, FORMAT_MSH);
 	dialog->window->hide();
 	return 1;
@@ -748,7 +748,7 @@ int bdf_dialog(char *name)
     dialog->c = new Fl_Choice(WB, y, BB + BB / 2, BH, "Format"); y += BH;
     dialog->c->menu(formatmenu);
     dialog->c->align(FL_ALIGN_RIGHT);
-    dialog->b = new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Save all (ignore physicals)"); y += BH;
+    dialog->b = new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Save only physical groups"); y += BH;
     dialog->b->type(FL_TOGGLE_BUTTON);
     dialog->ok = new Fl_Return_Button(WB, y + WB, BB, BH, "OK");
     dialog->cancel = new Fl_Button(2 * WB + BB, y + WB, BB, BH, "Cancel");
@@ -758,7 +758,7 @@ int bdf_dialog(char *name)
   }
   
   dialog->c->value(CTX.mesh.bdf_field_format);
-  dialog->b->value(CTX.mesh.save_all);
+  dialog->b->value(CTX.mesh.save_all ? 0 : 1);
   dialog->window->show();
 
   while(dialog->window->shown()){
@@ -768,7 +768,7 @@ int bdf_dialog(char *name)
       if (!o) break;
       if (o == dialog->ok) {
 	opt_mesh_bdf_field_format(0, GMSH_SET | GMSH_GUI, dialog->c->value());
-	opt_mesh_save_all(0, GMSH_SET | GMSH_GUI, dialog->b->value());
+	opt_mesh_save_all(0, GMSH_SET | GMSH_GUI, dialog->b->value() ? 0 : 1);
 	CreateOutputFile(name, FORMAT_BDF);
 	dialog->window->hide();
 	return 1;
@@ -813,7 +813,7 @@ int stl_dialog(char *name)
     dialog->c = new Fl_Choice(WB, y, BB + BB / 2, BH, "Format"); y += BH;
     dialog->c->menu(formatmenu);
     dialog->c->align(FL_ALIGN_RIGHT);
-    dialog->b = new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Save all (ignore physicals)"); y += BH;
+    dialog->b = new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Save only physical groups"); y += BH;
     dialog->b->type(FL_TOGGLE_BUTTON);
     dialog->ok = new Fl_Return_Button(WB, y + WB, BB, BH, "OK");
     dialog->cancel = new Fl_Button(2 * WB + BB, y + WB, BB, BH, "Cancel");
@@ -823,7 +823,7 @@ int stl_dialog(char *name)
   }
   
   dialog->c->value(CTX.mesh.stl_binary ? 1 : 0);
-  dialog->b->value(CTX.mesh.save_all);
+  dialog->b->value(CTX.mesh.save_all ? 0 : 1);
   dialog->window->show();
 
   while(dialog->window->shown()){
@@ -833,7 +833,7 @@ int stl_dialog(char *name)
       if (!o) break;
       if (o == dialog->ok) {
 	opt_mesh_stl_binary(0, GMSH_SET | GMSH_GUI, dialog->c->value());
-	opt_mesh_save_all(0, GMSH_SET | GMSH_GUI, dialog->b->value());
+	opt_mesh_save_all(0, GMSH_SET | GMSH_GUI, dialog->b->value() ? 0 : 1);
 	CreateOutputFile(name, FORMAT_STL);
 	dialog->window->hide();
 	return 1;
-- 
GitLab