mirror of
https://github.com/fltk/fltk.git
synced 2026-05-20 04:31:25 +08:00
FLUID mark project change when changing window visibility
This commit is contained in:
@@ -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")) {
|
||||
|
||||
@@ -67,6 +67,7 @@ protected:
|
||||
int recalc; // set by fix_overlay()
|
||||
void moveallchildren();
|
||||
int pixmapID() FL_OVERRIDE { return 1; }
|
||||
void open_();
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
+2
-2
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user