diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 3baf4112e30b5c6ffbae9dba2201d66c15a9e1aa..a6f2aef38072865375f45e607a64572ab39c78bf 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 85588ed8cc82574842ee784064b96f3f46cadf14..584f9d9c534c24ba8fc1edcc36f28b167783a778 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 084c0807335799395ac4428978fb3bdb9a50b604..c0bd5070eb389aef9ca6b4a1a8eb66f5cad4516b 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 9876487664010f18d624c29b552e98a410c50e74..6a065b738d772ee855f1bf5b474427423e0cfc71 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 6856e02f55b994d097b147430f8e033672cfecdc..252c85f8058c7923a78f233535b09f27fd638e44 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