diff options
author | Aaron M. Ucko <ucko@debian.org> | 2007-05-20 00:36:27 +0000 |
---|---|---|
committer | Aaron M. Ucko <ucko@debian.org> | 2007-05-20 00:36:27 +0000 |
commit | 9b5d5801c27165ad47245acb580f30b8ce2d20b4 (patch) | |
tree | e9c2997f9ae1c0867ff889d281cf754c18b5dba3 /src/fl_file_dir.cxx | |
parent | a7324bb0c2a26bb02be3362dff2126dc6c6af3a4 (diff) |
[svn-upgrade] Integrating new upstream version, fltk1.1 (1.1.8~r5840)
Diffstat (limited to 'src/fl_file_dir.cxx')
-rw-r--r-- | src/fl_file_dir.cxx | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/src/fl_file_dir.cxx b/src/fl_file_dir.cxx index a91b0f3..ff23c22 100644 --- a/src/fl_file_dir.cxx +++ b/src/fl_file_dir.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_file_dir.cxx 4288 2005-04-16 00:13:17Z mike $" +// "$Id: fl_file_dir.cxx 5417 2006-09-05 09:57:41Z matt $" // // File chooser widget for the Fast Light Tool Kit (FLTK). // @@ -74,12 +74,19 @@ fl_file_chooser(const char *message, // I - Message in titlebar fc->callback(callback, 0); } else { fc->type(Fl_File_Chooser::CREATE); + // see, if we use the same pattern between calls + char same_pattern = 0; + const char *fcf = fc->filter(); + if ( fcf && pat && strcmp(fcf, pat)==0) + same_pattern = 1; + else if ( (fcf==0L || *fcf==0) && (pat==0L || *pat==0) ) + same_pattern = 1; + // now set the pattern to the new pattern (even if they are the same) fc->filter(pat); fc->label(message); - if (!fname || !*fname) { - if (fc->filter() != pat && (!pat || !fc->filter() || - strcmp(pat, fc->filter())) && fc->value()) { + if (!fname) { // null pointer reuses same filename if pattern didn't change + if (!same_pattern && fc->value()) { // if pattern is different, remove name but leave old directory: strlcpy(retname, fc->value(), sizeof(retname)); @@ -93,13 +100,24 @@ fl_file_chooser(const char *message, // I - Message in titlebar else *p = '\0'; } - // Set the directory... - fc->directory(retname); + fc->value(retname); + } else { + // re-use the previously selected name } + } else if (!*fname) { // empty filename reuses directory with empty name + const char *fcv = fc->value(); + if (fcv) + strlcpy(retname, fc->value(), sizeof(retname)); + else + *retname = 0; + const char *n = fl_filename_name(retname); + if (n) *((char*)n) = 0; + fc->value(""); + fc->directory(retname); + } else { + fc->value(fname); } - else - fc->value(fname); } fc->ok_label(current_label); @@ -156,5 +174,5 @@ fl_dir_chooser(const char *message, // I - Message for titlebar // -// End of "$Id: fl_file_dir.cxx 4288 2005-04-16 00:13:17Z mike $". +// End of "$Id: fl_file_dir.cxx 5417 2006-09-05 09:57:41Z matt $". // |