From cf3b01318dfb6fb74198264518e71e4c88412812 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Wed, 5 Jun 2013 10:43:23 +0000 Subject: [PATCH] only use preset file name the first time a file chooser is used; all later times use the last-visited directory --- CMakeLists.txt | 7 ++++--- Fltk/fileDialogs.cpp | 24 ++++++++++++++++++++++-- Fltk/graphicWindow.cpp | 2 +- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d88ebc6a36..8efd1337ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1505,8 +1505,9 @@ message(STATUS "Run 'ccmake ${CMAKE_CURRENT_SOURCE_DIR}' to fine-tune the config message(STATUS "") mark_as_advanced(GMSH_EXTRA_VERSION - ANN_INC ANN_LIB GMM_INC GMP_INC GMP_LIB MMG3D_INC MMG3D_LIB - TAUCS_INC TAUCS_LIB HDF5_LIB ACIS_LIB MED_LIB OCC_INC OCC_CONFIG_H - CGNS_INC SZ_LIB PETSC_LIBS SLEPC_INC SLEPC_INC2 SLEPC_LIB + ACIS_LIB ANN_INC ANN_LIB CAIRO_LIB CAIRO_INC CGNS_INC GMM_INC + GMP_INC GMP_LIB MMG3D_INC MMG3D_LIB TAUCS_INC TAUCS_LIB HDF5_LIB + MED_LIB OCC_INC OCC_CONFIG_H SZ_LIB + PETSC_LIBS SLEPC_INC SLEPC_INC2 SLEPC_LIB BISON FLEX MAKEINFO TEXI2PDF FLTK_CONFIG_SCRIPT GMSH_EXTERNAL_INCLUDE_DIRS GMSH_EXTERNAL_LIBRARIES) diff --git a/Fltk/fileDialogs.cpp b/Fltk/fileDialogs.cpp index 9d5a29e743..bf17b21b11 100644 --- a/Fltk/fileDialogs.cpp +++ b/Fltk/fileDialogs.cpp @@ -107,7 +107,18 @@ int fileChooser(FILE_CHOOSER_TYPE type, const char *message, fc->title(message); fc->filter(filter); fc->filter_value(thefilterindex); - if(fname) fc->preset_file(fname); + + static bool first = true; + if(fname && first){ + // preset the path and the file only the first time in a given + // session. Afterwards, always reuse the last directory + fc->preset_file(fname); + first = false; + } + else{ + fc->preset_file(0); + } + int ret = 0; switch(fc->show()) { case -1: break; // error @@ -141,7 +152,16 @@ int fileChooser(FILE_CHOOSER_TYPE type, const char *message, fc->label(message); fc->filter(thefilter); fc->filter_value(thefilterindex); - if(fname) fc->value(fname); + static bool first = true; + if(fname && first){ + // preset the path and the file only the first time in a given + // session. Afterwards, always reuse the last directory + fc->value(fname); + first = false; + } + else{ + fc->value(0); + } fc->show(); while(fc->shown()) Fl::wait(); thefilterindex = fc->filter_value(); diff --git a/Fltk/graphicWindow.cpp b/Fltk/graphicWindow.cpp index c551c6bc69..7a76703c13 100644 --- a/Fltk/graphicWindow.cpp +++ b/Fltk/graphicWindow.cpp @@ -120,7 +120,7 @@ static const char *input_formats = "Mesh - PLY2 Surface" TT "*.ply2" NN "Post-processing - Gmsh POS" TT "*.pos" NN #if defined(HAVE_MED) - "Post-processing - MED" TT "*.{rmed}" NN + "Post-processing - MED" TT "*.rmed" NN #endif "Image - BMP" TT "*.bmp" NN #if defined(HAVE_LIBJPEG) -- GitLab