From c4d5c13ffccbbf2cee5cf7bb0b62754829f05a47 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Thu, 5 Sep 2013 17:31:11 +0000
Subject: [PATCH] allow multiple view selection in option window + changed
 "link" logic to make it much easier to modify options for several views at
 once

---
 Common/DefaultOptions.h     |  4 ++--
 Common/Options.cpp          |  4 +---
 Fltk/optionWindow.cpp       | 42 +++++++++++++++++--------------------
 Fltk/optionWindow.h         |  7 ++++---
 doc/texinfo/opt_fields.texi |  8 +++++++
 doc/texinfo/opt_mesh.texi   |  5 +++++
 doc/texinfo/opt_plugin.texi |  4 +++-
 doc/texinfo/opt_post.texi   |  2 +-
 doc/texinfo/opt_solver.texi |  2 +-
 9 files changed, 44 insertions(+), 34 deletions(-)

diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h
index 2d03cca6fe..80bdfe212f 100644
--- a/Common/DefaultOptions.h
+++ b/Common/DefaultOptions.h
@@ -1227,8 +1227,8 @@ StringXNumber PostProcessingOptions_Number[] = {
     "Display value scales horizontally" },
 
   { F|O, "Link" , opt_post_link , 0. ,
-    "Link post-processing views (0=none, 1/2=changes in visible/all, "
-    "3/4=everything in visible/all)" },
+    "Post-processing view links (0=apply next option changes to selected views, "
+    "1=force same options for all selected views)" },
 
   { F,   "NbViews" , opt_post_nb_views , 0. ,
     "Current number of views merged (read-only)" },
diff --git a/Common/Options.cpp b/Common/Options.cpp
index b656f991f5..289e85c1ed 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -6182,13 +6182,11 @@ double opt_post_link(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET){
     CTX::instance()->post.link = (int)val;
-    if(CTX::instance()->post.link < 0 || CTX::instance()->post.link > 4)
-      CTX::instance()->post.link = 0;
   }
 #if defined(HAVE_FLTK)
   if(FlGui::available() && (action & GMSH_GUI)) {
     FlGui::instance()->options->post.choice[0]->value
-      (CTX::instance()->post.link);
+      (CTX::instance()->post.link ? 1 : 0);
   }
 #endif
   return CTX::instance()->post.link;
diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp
index 17686e7df5..d58e0dc82d 100644
--- a/Fltk/optionWindow.cpp
+++ b/Fltk/optionWindow.cpp
@@ -161,7 +161,6 @@ static void view_color_cb(Fl_Widget *w, void *data)
   drawContext::global()->draw();
 }
 
-
 void general_gmpdcf_cb(Fl_Widget *w, void *data)
 {
   FlGui::instance()->options->gmpdoption = new gamepadWindow;
@@ -175,7 +174,9 @@ void options_cb(Fl_Widget *w, void *data)
 
 static void options_browser_cb(Fl_Widget *w, void *data)
 {
-  FlGui::instance()->options->showGroup(FlGui::instance()->options->browser->value());
+  // allows multiple selections with the mouse
+  FlGui::instance()->options->showGroup(FlGui::instance()->options->browser->value(),
+                                        true, true);
 }
 
 static void options_show_file_cb(Fl_Widget *w, void *data)
@@ -629,11 +630,9 @@ void view_options_cb(Fl_Widget *w, void *data)
 static void view_options_timestep_cb(Fl_Widget *w, void *data)
 {
   std::string str((const char*)data);
-  int links = (int)opt_post_link(0, GMSH_GET, 0);
   for(int i = 0; i < (int)PView::list.size(); i++) {
-    if((links == 2 || links == 4) ||
-       ((links == 1 || links == 3) && opt_view_visible(i, GMSH_GET, 0)) ||
-       (links == 0 && i == FlGui::instance()->options->view.index)) {
+    if(i == FlGui::instance()->options->view.index ||
+       FlGui::instance()->options->browser->selected(i + 6)) {
       if(str == "=")
         opt_view_timestep(i, GMSH_SET, ((Fl_Value_Input *) w)->value());
       else if(str == "-")
@@ -675,7 +674,7 @@ static void view_options_ok_cb(Fl_Widget *w, void *data)
     }
   }
 
-  int force = 0, links = (int)opt_post_link(0, GMSH_GET, 0);
+  int force = (int)opt_post_link(0, GMSH_GET, 0);
 
   // get the old values for the current view
   double scale_type = opt_view_scale_type(current, GMSH_GET, 0);
@@ -793,13 +792,7 @@ static void view_options_ok_cb(Fl_Widget *w, void *data)
 
   // modify only the views that need to be updated
   for(int i = 0; i < (int)PView::list.size(); i++) {
-    if((links == 2 || links == 4) ||
-       ((links == 1 || links == 3) && opt_view_visible(i, GMSH_GET, 0)) ||
-       (links == 0 && i == current)) {
-
-      if(links == 3 || links == 4)
-        force = 1;
-
+    if(i == current || FlGui::instance()->options->browser->selected(i + 6)) {
       double val;
 
       // view_choice
@@ -1331,7 +1324,7 @@ optionWindow::optionWindow(int deltaFontSize)
   win->label("Options - General");
 
   // Selection browser
-  browser = new Fl_Hold_Browser(0, 0, L, height);
+  browser = new Fl_Multi_Browser(0, 0, L, height);
   browser->box(GMSH_SIMPLE_RIGHT_BOX);
   browser->has_scrollbar(Fl_Browser_::VERTICAL);
   browser->add("General");
@@ -2714,11 +2707,8 @@ optionWindow::optionWindow(int deltaFontSize)
         (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "General");
 
       static Fl_Menu_Item menu_links[] = {
-        {"None", 0, 0, 0},
-        {"Apply next changes to all visible views", 0, 0, 0},
-        {"Apply next changes to all views", 0, 0, 0},
-        {"Force same options for all visible views", 0, 0, 0},
-        {"Force same options for all views", 0, 0, 0},
+        {"Apply next changes to selected views", 0, 0, 0},
+        {"Force same options for selected views", 0, 0, 0},
         {0}
       };
 
@@ -3499,7 +3489,7 @@ optionWindow::optionWindow(int deltaFontSize)
   FL_NORMAL_SIZE += deltaFontSize;
 }
 
-void optionWindow::showGroup(int num, bool showWindow)
+void optionWindow::showGroup(int num, bool showWindow, bool allowMultipleSelections)
 {
   general.group->hide();
   geo.group->hide();
@@ -3507,7 +3497,14 @@ void optionWindow::showGroup(int num, bool showWindow)
   solver.group->hide();
   post.group->hide();
   view.group->hide();
-  browser->value(num);
+
+  if(num > 5 && allowMultipleSelections){
+    for(int i = 1; i <= 5; i++) browser->select(i, 0);
+  }
+  else{
+    browser->deselect();
+  }
+  browser->select(num, 1);
   switch(num){
   case 0: case 1: win->label("Options - General"); general.group->show(); break;
   case 2: win->label("Options - Geometry"); geo.group->show(); break;
@@ -3542,7 +3539,6 @@ void optionWindow::resetBrowser()
     browser->add(str);
   }
   int num = (select <= browser->size()) ? select : browser->size();
-  browser->value(num);
   showGroup(num, false);
 }
 
diff --git a/Fltk/optionWindow.h b/Fltk/optionWindow.h
index bec9bb6c4d..ed061565f2 100644
--- a/Fltk/optionWindow.h
+++ b/Fltk/optionWindow.h
@@ -8,7 +8,7 @@
 
 #include <FL/Fl_Window.H>
 #include <FL/Fl_Value_Slider.H>
-#include <FL/Fl_Hold_Browser.H>
+#include <FL/Fl_Multi_Browser.H>
 #include <FL/Fl_Button.H>
 #include <FL/Fl_Return_Button.H>
 #include <FL/Fl_Check_Button.H>
@@ -28,7 +28,7 @@ extern Fl_Menu_Item menu_font_names[];
 class optionWindow{
  public:
   Fl_Window *win;
-  Fl_Hold_Browser *browser;
+  Fl_Multi_Browser *browser;
   Fl_Return_Button *redraw;
 
   struct{
@@ -89,7 +89,8 @@ class optionWindow{
  public:
   optionWindow(int deltaFontSize=0);
   gamepadWindow* gmpdoption ;
-  void showGroup(int num, bool showWindow=true);
+  void showGroup(int num, bool showWindow=true,
+                 bool allowMultipleSelections=false);
   void resetBrowser();
   void resetExternalViewList();
   void updateViewGroup(int index);
diff --git a/doc/texinfo/opt_fields.texi b/doc/texinfo/opt_fields.texi
index 364ff628fe..44e86d2a4d 100644
--- a/doc/texinfo/opt_fields.texi
+++ b/doc/texinfo/opt_fields.texi
@@ -606,6 +606,14 @@ Options:@*
 Name of the input file@*
 type: path@*
 default value: @code{""}
+@item OutsideValue
+Value of the field outside the grid (only used if the "SetOutsideValue" option is true).@*
+type: float@*
+default value: @code{0}
+@item SetOutsideValue
+True to use the "OutsideValue" option. If False, the last values of the grid are used.@*
+type: boolean@*
+default value: @code{0}
 @item TextFormat
 True for ASCII input files, false for binary files (4 bite signed integers for n, double precision floating points for v, D and O)@*
 type: boolean@*
diff --git a/doc/texinfo/opt_mesh.texi b/doc/texinfo/opt_mesh.texi
index 22e8bc40f8..0f4048e95e 100644
--- a/doc/texinfo/opt_mesh.texi
+++ b/doc/texinfo/opt_mesh.texi
@@ -204,6 +204,11 @@ Element shrinking factor (between 0 and 1)@*
 Default value: @code{1}@*
 Saved in: @code{General.OptionsFileName}
 
+@item Mesh.FlexibleTransfinite
+Allow transfinite contraints to be modified for Blossom or by global mesh size factor@*
+Default value: @code{0}@*
+Saved in: @code{General.OptionsFileName}
+
 @item Mesh.Format
 Mesh output format (1=msh, 2=unv, 10=automatic, 19=vrml, 27=stl, 30=mesh, 31=bdf, 32=cgns, 33=med, 40=ply2)@*
 Default value: @code{10}@*
diff --git a/doc/texinfo/opt_plugin.texi b/doc/texinfo/opt_plugin.texi
index 6070654671..49975f1dbc 100644
--- a/doc/texinfo/opt_plugin.texi
+++ b/doc/texinfo/opt_plugin.texi
@@ -93,13 +93,15 @@ Default value: @code{0}
 @end table
 
 @item Plugin(Crack)
-Plugin(Crack) creates a crack around the physical group `PhysicalGroup' of dimension `Dimension' (1 or 2). The plugin duplicates the vertices and the elements on the crack and stores them in a new discrete curve (Dimension = 1) or surface (Dimension = 2). The elements touching the crack on the negative side are modified to use the newly generated vertices.
+Plugin(Crack) creates a crack around the physical group `PhysicalGroup' of dimension `Dimension' (1 or 2). The plugin duplicates the vertices and the elements on the crack and stores them in a new discrete curve (`Dimension' = 1) or surface (`Dimension' = 2). The elements touching the crack on the negative side are modified to use the newly generated vertices.If `OpenBoundaryPhysicalGroup' is given (> 0), its vertices are duplicated and the crack will be left open on that (part of the) boundary. Otherwise, the lips of the crack are sealed, i.e., its vertices are not duplicated.
 Numeric options:
 @table @code
 @item Dimension
 Default value: @code{1}
 @item PhysicalGroup
 Default value: @code{1}
+@item OpenBoundaryPhysicalGroup
+Default value: @code{0}
 @end table
 
 @item Plugin(Curl)
diff --git a/doc/texinfo/opt_post.texi b/doc/texinfo/opt_post.texi
index 4d6ee43a93..0534f4c266 100644
--- a/doc/texinfo/opt_post.texi
+++ b/doc/texinfo/opt_post.texi
@@ -35,7 +35,7 @@ Default value: @code{1}@*
 Saved in: @code{General.OptionsFileName}
 
 @item PostProcessing.Link
-Link post-processing views (0=none, 1/2=changes in visible/all, 3/4=everything in visible/all)@*
+Post-processing view links (0=apply next option changes to selected views, 1=force same options for all selected views)@*
 Default value: @code{0}@*
 Saved in: @code{General.OptionsFileName}
 
diff --git a/doc/texinfo/opt_solver.texi b/doc/texinfo/opt_solver.texi
index c1f771c777..69294e6948 100644
--- a/doc/texinfo/opt_solver.texi
+++ b/doc/texinfo/opt_solver.texi
@@ -155,7 +155,7 @@ Default value: @code{""}@*
 Saved in: @code{General.SessionFileName}
 
 @item Solver.SocketName
-Base name of socket (TCP/IP if it contains the `:' character, UNIX otherwise)@*
+Base name of socket (UNIX socket if the name does not contain a colon, TCP/IP otherwise, in the form 'host:baseport'; the actual name/port is constructed by appending the unique client id)@*
 Default value: @code{".gmshsock"}@*
 Saved in: @code{General.OptionsFileName}
 
-- 
GitLab