diff options
| author | Matthias Melcher <github@matthiasm.com> | 2023-12-13 17:30:57 +0100 |
|---|---|---|
| committer | Matthias Melcher <github@matthiasm.com> | 2023-12-13 17:31:04 +0100 |
| commit | 6b39bc095fffb8ce92c26893a037b18bcde1be39 (patch) | |
| tree | 88f5caeed6948e7231ffa35a227edd96bb1c5695 /fluid | |
| parent | 41dd84016d5383f2648c25e4c6dd1d6e39418b20 (diff) | |
#862: FLUID "Open FIle..." no longer closes current project...
...when user cancels out of file choose
Diffstat (limited to 'fluid')
| -rw-r--r-- | fluid/fluid.cxx | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/fluid/fluid.cxx b/fluid/fluid.cxx index 42406606c..b8e33f40d 100644 --- a/fluid/fluid.cxx +++ b/fluid/fluid.cxx @@ -876,9 +876,9 @@ void exit_cb(Fl_Widget *,void *) { \return false if the operation was canceled */ -bool new_project() { +bool new_project(bool user_must_confirm = true) { // verify user intention - if (confirm_project_clear() == false) + if ((user_must_confirm) && (confirm_project_clear() == false)) return false; // clear the current project @@ -1090,11 +1090,22 @@ bool merge_project_file(const Fl_String &filename_arg) { \param[in] filename_arg load from this file, or show file chooser if empty \return false if the operation was canceled or failed otherwise */ -bool open_project_file(const Fl_String &new_filename) { +bool open_project_file(const Fl_String &filename_arg) { // verify user intention - if (new_project() == false) + if (confirm_project_clear() == false) return false; + // ask for a filename if none was given + Fl_String new_filename = filename_arg; + if (new_filename.empty()) { + new_filename = open_project_filechooser("Open Project File"); + if (new_filename.empty()) { + return false; + } + } + + // clear the project and merge a file by the given name + new_project(false); return merge_project_file(new_filename); } |
