From f6a26d0f03e57bd2ffecf755a184c083a08ee9f2 Mon Sep 17 00:00:00 2001
From: Jean-Francois Remacle <jean-francois.remacle@uclouvain.be>
Date: Mon, 18 Aug 2008 14:24:42 +0000
Subject: [PATCH] *** empty log message ***

---
 Fltk/Callbacks.cpp |  7 +++++++
 Fltk/Callbacks.h   |  1 +
 Fltk/GUI.cpp       | 12 +++++++++---
 Mesh/Field.cpp     |  9 ++++++++-
 Plugin/GSHHS.cpp   | 15 +++++++++++++--
 5 files changed, 38 insertions(+), 6 deletions(-)

diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp
index 3baf4112e3..a6f2aef380 100644
--- a/Fltk/Callbacks.cpp
+++ b/Fltk/Callbacks.cpp
@@ -4411,6 +4411,13 @@ void view_field_put_on_view_cb(CALLBACK_ARGS)
   Draw();
 }
 
+void view_field_select_file_cb(CALLBACK_ARGS){
+  Fl_Input *input=(Fl_Input*)data;
+  int ret=file_chooser(0,0,"File selection","",input->value());
+  if(ret)
+    input->value(file_chooser_get_name(0).c_str());
+}
+
 void view_field_select_node_cb(CALLBACK_ARGS)
 {
   const char *mode = "select";
diff --git a/Fltk/Callbacks.h b/Fltk/Callbacks.h
index 85588ed8cc..584f9d9c53 100644
--- a/Fltk/Callbacks.h
+++ b/Fltk/Callbacks.h
@@ -128,6 +128,7 @@ void view_field_cancel_cb(CALLBACK_ARGS);
 void view_field_browser_cb(CALLBACK_ARGS);
 void view_field_delete_cb(CALLBACK_ARGS);
 void view_field_set_size_btn_cb(CALLBACK_ARGS);
+void view_field_select_file_cb(CALLBACK_ARGS);
 void view_field_put_on_view_cb(CALLBACK_ARGS);
 void view_field_select_node_cb(CALLBACK_ARGS);
 void view_plugin_cb(CALLBACK_ARGS);
diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index 084c080733..c0bd5070eb 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -3769,7 +3769,6 @@ void FieldDialogBox::save_values()
   std::list<Fl_Widget*>::iterator input=inputs.begin();
   Field *f=current_field;
   std::ostringstream sstream;
-  std::istringstream istream;
   int i;
   char a;
   sstream.precision(16);
@@ -3791,8 +3790,9 @@ void FieldDialogBox::save_values()
       sstream<<(bool)((Fl_Check_Button*)*input)->value();
       break;
     case FIELD_OPTION_LIST:
+    {
       sstream<<"{";
-      istream.str(((Fl_Input*)*input)->value());
+      std::istringstream istream(((Fl_Input*)*input)->value());
       while(istream>>i){
 	sstream<<i;
 	if(istream>>a){
@@ -3802,6 +3802,7 @@ void FieldDialogBox::save_values()
 	}
       }
       sstream<<"}";
+      }
       break;
     }
     if((*input)->changed()){
@@ -3811,7 +3812,6 @@ void FieldDialogBox::save_values()
     input++;
   }
 }
-
 void FieldDialogBox::load_field(Field *f)
 {
   current_field=f;
@@ -3886,6 +3886,12 @@ FieldDialogBox::FieldDialogBox(Field *f, int x, int y, int width, int height,int
 	  input=new Fl_Check_Button(x+WB,yy,BH,BH,it->first.c_str());
 	  break;
 	case FIELD_OPTION_PATH:
+    {
+    Fl_Button *b=new Fl_Button(x+WB,yy,BH,BH,"S");
+	  input=new Fl_Input(x+2*WB+BH,yy,IW-WB-BH,BH,it->first.c_str());
+    b->callback(view_field_select_file_cb, input);
+    }
+    break;
 	case FIELD_OPTION_STRING:
 	  input=new Fl_Input(x+WB,yy,IW,BH,it->first.c_str());
 	  break;
diff --git a/Mesh/Field.cpp b/Mesh/Field.cpp
index 9876487664..6a065b738d 100644
--- a/Mesh/Field.cpp
+++ b/Mesh/Field.cpp
@@ -103,6 +103,13 @@ class FieldOptionString:public FieldOption
     v_str = sstream.str();
   }
 };
+class FieldOptionPath:public FieldOptionString
+{
+ public:
+  virtual FieldOptionType get_type(){ return FIELD_OPTION_PATH; }
+  FieldOptionPath(std::string &_val, bool *_status=0)
+    : FieldOptionString(_val,_status) {}
+};
 
 class FieldOptionBool : public FieldOption
 {
@@ -201,7 +208,7 @@ class StructuredField : public Field
  public:
   StructuredField()
   {
-    options["FileName"] = new FieldOptionString(file_name, &update_needed);
+    options["FileName"] = new FieldOptionPath(file_name, &update_needed);
     text_format = false;
     options["TextFormat"] = new FieldOptionBool(text_format, &update_needed);
     data = 0;
diff --git a/Plugin/GSHHS.cpp b/Plugin/GSHHS.cpp
index 6856e02f55..252c85f805 100644
--- a/Plugin/GSHHS.cpp
+++ b/Plugin/GSHHS.cpp
@@ -284,7 +284,7 @@ class GeoEarthImport
   }
 };
 
-/*      $Id: GSHHS.cpp,v 1.13 2008-07-11 16:56:10 geuzaine Exp $
+/*      $Id: GSHHS.cpp,v 1.14 2008-08-18 14:24:42 remacle Exp $
  *
  * PROGRAM:	gshhs.c
  * AUTHOR:	Paul Wessel (pwessel@hawaii.edu)
@@ -440,7 +440,18 @@ void GMSH_GSHHSPlugin::getInfos(char *author, char *copyright,
 {
   strcpy(author, "J. Lambrechts (jonathanlambrechts@gmail.com)");
   strcpy(copyright, "GPL");
-  strcpy(help_text, "Plugin(GSHHS) import GSHHS data.\n");
+  strcpy(help_text, "Plugin(GSHHS) read differenct kind of contour lines data and write a .geo file.\n"
+  "Valid values for \"Format\" are :\n"
+  " -\"gshhs\" : open GSHHS file\n"
+  " -\"loops2\" : import 2D contour lines in simple text format :\n"
+  "   NB_POINTS_IN_FIRST_LOOP\n"
+  "   COORD1 COORD2\n"
+  "   COORD1 COORD2\n"
+  "   ...    ...\n"
+  "   NB_POINTS_IN_SECOND_LOOP\n"
+  "   ...\n"
+  );
+
 }
 
 int GMSH_GSHHSPlugin::getNbOptions() const
-- 
GitLab