diff options
| -rw-r--r-- | fluid/Fl_Window_Type.cxx | 42 | ||||
| -rw-r--r-- | fluid/Fl_Window_Type.h | 1 | ||||
| -rw-r--r-- | fluid/alignment_panel.fl | 4 | ||||
| -rw-r--r-- | fluid/fluid.cxx | 4 |
4 files changed, 42 insertions, 9 deletions
diff --git a/fluid/Fl_Window_Type.cxx b/fluid/Fl_Window_Type.cxx index 82e572d7d..04283d625 100644 --- a/fluid/Fl_Window_Type.cxx +++ b/fluid/Fl_Window_Type.cxx @@ -140,13 +140,29 @@ static int overlays_invisible; class Overlay_Window : public Fl_Overlay_Window { void draw() FL_OVERRIDE; void draw_overlay() FL_OVERRIDE; + static void close_cb(Overlay_Window *self, void*); public: Fl_Window_Type *window; int handle(int) FL_OVERRIDE; - Overlay_Window(int W,int H) : Fl_Overlay_Window(W,H) {Fl_Group::current(0);} + Overlay_Window(int W,int H) : Fl_Overlay_Window(W,H) { + Fl_Group::current(0); + callback((Fl_Callback*)close_cb); + } void resize(int,int,int,int) FL_OVERRIDE; uchar *read_image(int &ww, int &hh); }; + +/** + \brief User closes the window, so we mark the .fl file as changed. + Mark the .fl file a changed, but don;t mark the source files as changed. + \param self pointer to this window + */ +void Overlay_Window::close_cb(Overlay_Window *self, void*) { + if (self->visible()) + set_modflag(1, -2); + self->hide(); +} + void Overlay_Window::draw() { const int CHECKSIZE = 8; // see if box is clear or a frame or rounded: @@ -265,9 +281,11 @@ void Fl_Window_Type::move_child(Fl_Type* cc, Fl_Type* before) { //////////////////////////////////////////////////////////////// -// Double-click on window widget shows the window, or if already shown, -// it shows the control panel. -void Fl_Window_Type::open() { +/** + \brief Show the Window Type editor window without setting the modified flag. + \see Fl_Window_Type::open() + */ +void Fl_Window_Type::open_() { Overlay_Window *w = (Overlay_Window *)o; if (w->shown()) { w->show(); @@ -281,6 +299,20 @@ void Fl_Window_Type::open() { w->image(Fl::scheme_bg_); } +/** + \brief Show the Window Type editor window and set the modified flag if needed. + Double-click on window widget shows the window, or if already shown, it shows + the control panel. + \see Fl_Window_Type::open_() + */ +void Fl_Window_Type::open() { + Overlay_Window *w = (Overlay_Window *)o; + if (!w->visible()) { + set_modflag(1, -2); + } + open_(); +} + // Read an image of the window uchar *Fl_Window_Type::read_image(int &ww, int &hh) { Overlay_Window *w = (Overlay_Window *)o; @@ -1059,7 +1091,7 @@ void Fl_Window_Type::read_property(Fd_Project_Reader &f, const char *c) { } else if (!strcmp(c,"non_modal")) { non_modal = 1; } else if (!strcmp(c, "visible")) { - if (Fl::first_window()) open(); // only if we are using user interface + if (Fl::first_window()) open_(); // only if we are using user interface } else if (!strcmp(c,"noborder")) { ((Fl_Window*)o)->border(0); } else if (!strcmp(c,"xclass")) { diff --git a/fluid/Fl_Window_Type.h b/fluid/Fl_Window_Type.h index 8b6693245..42f17c7a6 100644 --- a/fluid/Fl_Window_Type.h +++ b/fluid/Fl_Window_Type.h @@ -67,6 +67,7 @@ protected: int recalc; // set by fix_overlay() void moveallchildren(); int pixmapID() FL_OVERRIDE { return 1; } + void open_(); public: diff --git a/fluid/alignment_panel.fl b/fluid/alignment_panel.fl index 6bfd966bf..0e99515a5 100644 --- a/fluid/alignment_panel.fl +++ b/fluid/alignment_panel.fl @@ -107,7 +107,7 @@ decl {void scheme_cb(Fl_Scheme_Choice *, void *);} {public local Function {make_settings_window()} {open } { Fl_Window settings_window { - label {GUI Settings} open + label {GUI Settings} open selected xywh {617 332 340 580} type Double align 80 resizable code0 {o->size_range(o->w(), o->h());} non_modal visible } { @@ -198,7 +198,7 @@ redraw_browser();} callback {strncpy(G_external_editor_command, editor_command_input->value(), sizeof(G_external_editor_command)-1); G_external_editor_command[sizeof(G_external_editor_command)-1] = 0; fluid_prefs.set("external_editor_command", G_external_editor_command); -redraw_browser();} selected +redraw_browser();} tooltip {The editor command to open your external text editor. Include any necessary flags to ensure your editor does not background itself. Examples: diff --git a/fluid/fluid.cxx b/fluid/fluid.cxx index 1a6345544..41f4cb6a1 100644 --- a/fluid/fluid.cxx +++ b/fluid/fluid.cxx @@ -1781,7 +1781,7 @@ void set_filename(const char *c) { \param[in] mf 0 to clear the modflag, 1 to mark the design "modified", -1 to ignore this parameter \param[in] mfc default -1 to let \c mf control \c modflag_c, 0 to mark the - code files current, 1 to mark it out of date. + code files current, 1 to mark it out of date. -2 to ignore changes to mf. */ void set_modflag(int mf, int mfc) { const char *basename; @@ -1796,7 +1796,7 @@ void set_modflag(int mf, int mfc) { if (mfc==-1 && mf==1) mfc = mf; } - if (mfc!=-1) { + if (mfc>=0) { modflag_c = mfc; } |
