diff options
| author | Matthias Melcher <github@matthiasm.com> | 2022-12-10 13:11:49 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-10 13:11:49 +0100 |
| commit | fa41211ccae24d75e940721bae68d3abe7f2e1ee (patch) | |
| tree | 406d73ec3b15c01935982300de421393b6a68f0d /fluid/fluid.cxx | |
| parent | 5673072271cdd797de3fa0f3136ca3f1d219484e (diff) | |
FLUID event handling and UI changes (#575)
* Full support o when()
* Making undo suspend nesting
* Finally correct undo handling for Label: input
* Documentation.
* Adding more undo checkpoints for the Widget Panel
* Quick selection of default user_data types
* Pulldown menu for system colors
* Make sure that partially typed text fields are propagated before saving
Diffstat (limited to 'fluid/fluid.cxx')
| -rw-r--r-- | fluid/fluid.cxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fluid/fluid.cxx b/fluid/fluid.cxx index 0ca92ea08..8aaf8f6b1 100644 --- a/fluid/fluid.cxx +++ b/fluid/fluid.cxx @@ -298,6 +298,17 @@ void update_sourceview_timer(void*); // ---- +extern Fl_Window *the_panel; +// make sure that a currently changed text widgets propagates its contents +void flush_text_widgets() { + if (Fl::focus() && (Fl::focus()->top_window() == the_panel)) { + Fl_Widget *old_focus = Fl::focus(); + Fl::focus(NULL); + Fl::focus(old_focus); + } +} +// ---- + /** Change the current working directory to the .fl project directory. @@ -471,6 +482,7 @@ static void external_editor_timer(void*) { \param[in] v if v is not NULL, or no filename is set, open a filechooser. */ void save_cb(Fl_Widget *, void *v) { + flush_text_widgets(); Fl_Native_File_Chooser fnfc; const char *c = filename; if (v || !c || !*c) { @@ -645,6 +657,7 @@ void revert_cb(Fl_Widget *,void *) { If the design was modified, a dialog will ask for confirmation. */ void exit_cb(Fl_Widget *,void *) { + flush_text_widgets(); // Stop any external editor update timers ExternalCodeEditor::stop_update_timer(); @@ -978,6 +991,7 @@ void new_from_template_cb(Fl_Widget *w, void *v) { \return 1 if the operation failed, 0 if it succeeded */ int write_code_files() { + flush_text_widgets(); if (!filename) { save_cb(0,0); if (!filename) return 1; @@ -1030,6 +1044,7 @@ void write_cb(Fl_Widget *, void *) { */ void write_strings_cb(Fl_Widget *, void *) { static const char *exts[] = { ".txt", ".po", ".msg" }; + flush_text_widgets(); if (!filename) { save_cb(0,0); if (!filename) return; @@ -1066,6 +1081,7 @@ void openwidget_cb(Fl_Widget *, void *) { User chose to copy the currently selected widgets. */ void copy_cb(Fl_Widget*, void*) { + flush_text_widgets(); if (!Fl_Type::current) { fl_beep(); return; @@ -1153,6 +1169,8 @@ void duplicate_cb(Fl_Widget*, void*) { return; } + flush_text_widgets(); + if (!write_file(cutfname(1),1)) { fl_message("Can't write %s: %s", cutfname(1), strerror(errno)); return; |
