mirror of https://github.com/fltk/fltk
FLUID adding hatch pattern to overlapping widgets
This commit is contained in:
parent
71088b7fe2
commit
2e9c1a5097
|
@ -164,6 +164,7 @@ public:
|
|||
int pixmapID() FL_OVERRIDE { return 19; }
|
||||
Fl_Widget *enter_live_mode(int top=0) FL_OVERRIDE;
|
||||
void copy_properties() FL_OVERRIDE;
|
||||
int is_scroll() FL_OVERRIDE const { return 1; }
|
||||
};
|
||||
|
||||
// ---- Fl_Tile_Type --------------------------------------------------- MARK: -
|
||||
|
|
|
@ -161,6 +161,7 @@ public:
|
|||
virtual int is_menu_button() const {return 0;}
|
||||
virtual int is_group() const {return 0;}
|
||||
virtual int is_tabs() const {return 0;}
|
||||
virtual int is_scroll() const {return 0;}
|
||||
virtual int is_flex() const {return 0;}
|
||||
virtual int is_window() const {return 0;}
|
||||
virtual int is_code() const {return 0;}
|
||||
|
|
|
@ -500,6 +500,96 @@ void Fl_Window_Type::newposition(Fl_Widget_Type *myo,int &X,int &Y,int &R,int &T
|
|||
if (T<Y) {int n = Y; Y = T; T = n;}
|
||||
}
|
||||
|
||||
void fd_hatch(int x, int y, int w, int h, int size=6, int offset=0, int pad=3) {
|
||||
x -= pad; y -= pad; w += 2*pad; h += 2*pad;
|
||||
int yp = (x+offset+y*size-1-y)%size;
|
||||
if (w > h) {
|
||||
for (; yp < h; yp+=size)
|
||||
fl_line(x, y+yp, x+yp, y);
|
||||
for (; yp < w; yp+=size)
|
||||
fl_line(x+yp-h, y+h, x+yp, y);
|
||||
for (; yp < w+h; yp+=size)
|
||||
fl_line(x+yp-h, y+h, x+w, y+yp-w);
|
||||
} else {
|
||||
for (; yp < w; yp+=size)
|
||||
fl_line(x, y+yp, x+yp, y);
|
||||
for (; yp < h; yp+=size)
|
||||
fl_line(x, y+yp, x+w, y+yp-w);
|
||||
for (; yp < h+w; yp+=size)
|
||||
fl_line(x+yp-h, y+h, x+w, y+yp-w);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Draw a hatch pattern over all children that overlap the bounds of this box.
|
||||
\param[in] group check all children of this group
|
||||
\param[in] x, y, w, h bounding box of this group
|
||||
*/
|
||||
void Fl_Window_Type::draw_out_of_bounds(Fl_Widget_Type *group, int x, int y, int w, int h) {
|
||||
for (Fl_Type *p = group->next; p && p->level>group->level; p = p->next) {
|
||||
if (p->level == group->level+1 && p->is_widget() && !p->is_menu_item()) {
|
||||
Fl_Widget *o = ((Fl_Widget_Type*)p)->o;
|
||||
if (o->x() < x) fd_hatch(o->x(), o->y(), x-o->x(), o->h());
|
||||
if (o->y() < y) fd_hatch(o->x(), o->y(), o->w(), y-o->y());
|
||||
if (o->x()+o->w() > x+w) fd_hatch(x+w, o->y(), (o->x()+o->w())-(x+w), o->h());
|
||||
if (o->y()+o->h() > y+h) fd_hatch(o->x(), y+h, o->w(), (o->y()+o->h())-(y+h));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Draw a hatch pattern for all groups that have out of bounds children.
|
||||
*/
|
||||
void Fl_Window_Type::draw_out_of_bounds() {
|
||||
// get every group in the hierarchy, then draw any overlap of a direct child with that group
|
||||
fl_color(FL_DARK_RED);
|
||||
draw_out_of_bounds(this, 0, 0, o->w(), o->h());
|
||||
for (Fl_Type *q=next; q && q->level>level; q = q->next) {
|
||||
// don't do this for Fl_Scroll (which we currently can't handle in FLUID anyway)
|
||||
if (q->is_group() && !q->is_scroll()) {
|
||||
Fl_Widget_Type *w = (Fl_Widget_Type*)q;
|
||||
draw_out_of_bounds(w, w->o->x(), w->o->y(), w->o->w(), w->o->h());
|
||||
}
|
||||
}
|
||||
fl_color(FL_RED);
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Compare all children in the same level and hatch overlapping areas.
|
||||
*/
|
||||
void Fl_Window_Type::draw_overlaps() {
|
||||
fl_color(FL_DARK_YELLOW);
|
||||
// loop through all widgets in this window
|
||||
for (Fl_Type *q=next; q && q->level>level; q = q->next) {
|
||||
// is it a valid widget
|
||||
if (q->is_widget() && !q->is_menu_item()) {
|
||||
Fl_Widget_Type *w = (Fl_Widget_Type*)q;
|
||||
// is the widget visible
|
||||
if (w->o->visible()) {
|
||||
int x = w->o->x(), y = w->o->y();
|
||||
int r = x + w->o->w(), b = y + w->o->h();
|
||||
for (Fl_Type *p=q->next; p && p->level>=q->level; p = p->next) {
|
||||
if (p->level==q->level && p->is_widget() && !p->is_menu_item()) {
|
||||
Fl_Widget_Type *wp = (Fl_Widget_Type*)p;
|
||||
if (wp->o->visible()) {
|
||||
int px = fd_max(x, wp->o->x());
|
||||
int py = fd_max(y, wp->o->y());
|
||||
int pr = fd_min(r, wp->o->x() + wp->o->w());
|
||||
int pb = fd_min(b, wp->o->y() + wp->o->h());
|
||||
if (pr > px && pb > py)
|
||||
fd_hatch(px, py, pr-px, pb-py);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int l = q->level;
|
||||
for (; q && q->next && q->next->level>l; q = q->next) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
fl_color(FL_RED);
|
||||
}
|
||||
|
||||
void Fl_Window_Type::draw_overlay() {
|
||||
if (recalc) {
|
||||
bx = o->w(); by = o->h(); br = 0; bt = 0;
|
||||
|
@ -523,6 +613,13 @@ void Fl_Window_Type::draw_overlay() {
|
|||
fl_rect(x,y,r-x,b-y);
|
||||
}
|
||||
if (overlays_invisible && !drag) return;
|
||||
|
||||
if (show_restricted) {
|
||||
draw_out_of_bounds();
|
||||
draw_overlaps();
|
||||
// TODO: for Fl_Tile, find all areas that are not covered by visible children
|
||||
}
|
||||
|
||||
if (selected) fl_rect(0,0,o->w(),o->h());
|
||||
if (!numselected) return;
|
||||
int mybx,myby,mybr,mybt;
|
||||
|
@ -598,6 +695,8 @@ void Fl_Window_Type::draw_overlay() {
|
|||
Fd_Snap_Data data = { dx, dy, sx, sy, sr, st, drag, 4, 4, dx, dy, (Fl_Widget_Type*)selection, this};
|
||||
Fd_Snap_Action::draw_all(data);
|
||||
}
|
||||
|
||||
// TODO: for invisible boxes (NONE, FLAT, etc.) draw a faint outline when dragging
|
||||
}
|
||||
|
||||
extern Fl_Menu_Item Main_Menu[];
|
||||
|
@ -651,17 +750,21 @@ void toggle_overlays(Fl_Widget *,void *) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
\brief User changes settings to show positioning guides in layout editor overlay.
|
||||
This is called from the main menu and from the check button in the Settings
|
||||
dialog.
|
||||
*/
|
||||
void toggle_guides(Fl_Widget *,void *) {
|
||||
show_guides = !show_guides;
|
||||
fluid_prefs.set("show_guides", show_guides);
|
||||
|
||||
if (show_guides) {
|
||||
if (show_guides)
|
||||
guides_item->label("Hide Guides");
|
||||
if (guides_button) guides_button->label("Hide &Guides");
|
||||
} else {
|
||||
else
|
||||
guides_item->label("Show Guides");
|
||||
if (guides_button) guides_button->label("Show &Guides");
|
||||
}
|
||||
if (guides_button)
|
||||
guides_button->value(show_guides);
|
||||
|
||||
for (Fl_Type *o=Fl_Type::first; o; o=o->next) {
|
||||
if (o->is_window()) {
|
||||
|
@ -671,10 +774,46 @@ void toggle_guides(Fl_Widget *,void *) {
|
|||
}
|
||||
}
|
||||
|
||||
void guides_cb(Fl_Button *o, void *v) {
|
||||
/**
|
||||
\brief User changes settings to show positioning guides in layout editor overlay.
|
||||
This is called from the check button in the Settings dialog.
|
||||
*/
|
||||
void toggle_guides_cb(Fl_Check_Button *o, void *v) {
|
||||
toggle_guides(NULL, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
\brief User changes settings to show overlapping and out of bounds widgets.
|
||||
This is called from the main menu and from the check button in the Settings
|
||||
dialog.
|
||||
*/
|
||||
void toggle_restricted(Fl_Widget *,void *) {
|
||||
show_restricted = !show_restricted;
|
||||
fluid_prefs.set("show_restricted", show_restricted);
|
||||
|
||||
if (show_restricted)
|
||||
restricted_item->label("Hide Restricted");
|
||||
else
|
||||
restricted_item->label("Show Restricted");
|
||||
if (restricted_button)
|
||||
restricted_button->value(show_restricted);
|
||||
|
||||
for (Fl_Type *o=Fl_Type::first; o; o=o->next) {
|
||||
if (o->is_window()) {
|
||||
Fl_Widget_Type* w = (Fl_Widget_Type*)o;
|
||||
((Overlay_Window*)(w->o))->redraw_overlay();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
\brief User changes settings to show overlapping and out of bounds widgets.
|
||||
This is called from the check button in the Settings dialog.
|
||||
*/
|
||||
void toggle_restricted_cb(Fl_Check_Button *o, void *v) {
|
||||
toggle_restricted(NULL, NULL);
|
||||
}
|
||||
|
||||
extern void select(Fl_Type *,int);
|
||||
extern void select_only(Fl_Type *);
|
||||
extern void deselect();
|
||||
|
|
|
@ -29,6 +29,7 @@ extern Fl_Menu_Item window_type_menu[];
|
|||
extern Fl_Widget_Class_Type *current_widget_class;
|
||||
void toggle_overlays(Fl_Widget *,void *);
|
||||
void toggle_guides(Fl_Widget *,void *);
|
||||
void toggle_restricted(Fl_Widget *,void *);
|
||||
void show_project_cb(Fl_Widget *, void *);
|
||||
void show_grid_cb(Fl_Widget *, void *);
|
||||
void show_settings_cb(Fl_Widget *, void *);
|
||||
|
@ -55,6 +56,9 @@ protected:
|
|||
int dx,dy;
|
||||
int drag; // which parts of bbox are being moved
|
||||
int numselected; // number of children selected
|
||||
void draw_out_of_bounds(Fl_Widget_Type *group, int x, int y, int w, int h);
|
||||
void draw_out_of_bounds();
|
||||
void draw_overlaps();
|
||||
void draw_overlay();
|
||||
void newdx();
|
||||
void newposition(Fl_Widget_Type *,int &x,int &y,int &w,int &h);
|
||||
|
|
|
@ -200,6 +200,10 @@ static void cb_editor_command_input(Fl_Input*, void*) {
|
|||
redraw_browser();
|
||||
}
|
||||
|
||||
Fl_Check_Button *guides_button=(Fl_Check_Button *)0;
|
||||
|
||||
Fl_Check_Button *restricted_button=(Fl_Check_Button *)0;
|
||||
|
||||
Fl_Group *w_settings_project_tab=(Fl_Group *)0;
|
||||
|
||||
static void cb_w_settings_project_tab(Fl_Group* o, void* v) {
|
||||
|
@ -1016,7 +1020,7 @@ Fl_Double_Window* make_settings_window() {
|
|||
o->labelsize(11);
|
||||
o->align(Fl_Align(FL_ALIGN_LEFT));
|
||||
} // Fl_Box* o
|
||||
{ tooltips_button = new Fl_Check_Button(120, 115, 180, 20, "Show Tooltips");
|
||||
{ tooltips_button = new Fl_Check_Button(120, 115, 200, 20, "Show Tooltips");
|
||||
tooltips_button->down_box(FL_DOWN_BOX);
|
||||
tooltips_button->labelsize(11);
|
||||
tooltips_button->callback((Fl_Callback*)cb_tooltips_button);
|
||||
|
@ -1025,7 +1029,7 @@ Fl_Double_Window* make_settings_window() {
|
|||
tooltips_button->value(b);
|
||||
Fl_Tooltip::enable(b);
|
||||
} // Fl_Check_Button* tooltips_button
|
||||
{ completion_button = new Fl_Check_Button(120, 135, 180, 20, "Show Completion Dialogs");
|
||||
{ completion_button = new Fl_Check_Button(120, 135, 200, 20, "Show Completion Dialogs");
|
||||
completion_button->down_box(FL_DOWN_BOX);
|
||||
completion_button->labelsize(11);
|
||||
completion_button->callback((Fl_Callback*)cb_completion_button);
|
||||
|
@ -1033,7 +1037,7 @@ Fl_Double_Window* make_settings_window() {
|
|||
fluid_prefs.get("show_completion_dialogs", b, 1);
|
||||
completion_button->value(b);
|
||||
} // Fl_Check_Button* completion_button
|
||||
{ openlast_button = new Fl_Check_Button(120, 155, 180, 20, "Open Previous File on Startup");
|
||||
{ openlast_button = new Fl_Check_Button(120, 155, 200, 20, "Open Previous File on Startup");
|
||||
openlast_button->down_box(FL_DOWN_BOX);
|
||||
openlast_button->labelsize(11);
|
||||
openlast_button->callback((Fl_Callback*)cb_openlast_button);
|
||||
|
@ -1041,7 +1045,7 @@ Fl_Double_Window* make_settings_window() {
|
|||
fluid_prefs.get("open_previous_file", b, 0);
|
||||
openlast_button->value(b);
|
||||
} // Fl_Check_Button* openlast_button
|
||||
{ prevpos_button = new Fl_Check_Button(120, 175, 180, 20, "Remember Window Positions");
|
||||
{ prevpos_button = new Fl_Check_Button(120, 175, 200, 20, "Remember Window Positions");
|
||||
prevpos_button->down_box(FL_DOWN_BOX);
|
||||
prevpos_button->labelsize(11);
|
||||
prevpos_button->callback((Fl_Callback*)cb_prevpos_button);
|
||||
|
@ -1049,7 +1053,7 @@ Fl_Double_Window* make_settings_window() {
|
|||
fluid_prefs.get("prev_window_pos", b, 1);
|
||||
prevpos_button->value(b);
|
||||
} // Fl_Check_Button* prevpos_button
|
||||
{ show_comments_button = new Fl_Check_Button(120, 195, 180, 20, "Show Comments in Browser");
|
||||
{ show_comments_button = new Fl_Check_Button(120, 195, 200, 20, "Show Comments in Browser");
|
||||
show_comments_button->down_box(FL_DOWN_BOX);
|
||||
show_comments_button->labelsize(11);
|
||||
show_comments_button->callback((Fl_Callback*)cb_show_comments_button);
|
||||
|
@ -1088,6 +1092,26 @@ f\n gedit\n emacs");
|
|||
fluid_prefs.get("external_editor_command", G_external_editor_command, "", sizeof(G_external_editor_command)-1);
|
||||
editor_command_input->value(G_external_editor_command);
|
||||
} // Fl_Input* editor_command_input
|
||||
{ Fl_Box* o = new Fl_Box(120, 300, 0, 20, "Overlays: ");
|
||||
o->labelfont(1);
|
||||
o->labelsize(11);
|
||||
o->align(Fl_Align(FL_ALIGN_LEFT));
|
||||
} // Fl_Box* o
|
||||
{ Fl_Check_Button* o = guides_button = new Fl_Check_Button(120, 300, 200, 20, "Show Positioning Guides");
|
||||
guides_button->tooltip("show guides that help to position and resize widgets and enable snapping");
|
||||
guides_button->down_box(FL_DOWN_BOX);
|
||||
guides_button->labelsize(11);
|
||||
guides_button->callback((Fl_Callback*)toggle_guides_cb);
|
||||
o->value(show_guides);
|
||||
} // Fl_Check_Button* guides_button
|
||||
{ Fl_Check_Button* o = restricted_button = new Fl_Check_Button(120, 320, 200, 20, "Show Restricted Areas");
|
||||
restricted_button->tooltip("show overlapping and out of bounds areas, show unfilled areas in Fl_Pack grou\
|
||||
ps");
|
||||
restricted_button->down_box(FL_DOWN_BOX);
|
||||
restricted_button->labelsize(11);
|
||||
restricted_button->callback((Fl_Callback*)toggle_restricted_cb);
|
||||
o->value(show_restricted);
|
||||
} // Fl_Check_Button* restricted_button
|
||||
o->image()->scale(36, 24);
|
||||
o->end();
|
||||
} // Fl_Group* o
|
||||
|
@ -1416,11 +1440,11 @@ ped using octal notation `\\0123`. If this option is checked, Fluid will write\
|
|||
o->callback((Fl_Callback*)cb_3);
|
||||
o->align(Fl_Align(FL_ALIGN_TOP_LEFT));
|
||||
} // Fl_Value_Input* o
|
||||
{ Fl_Group* o = new Fl_Group(85, 465, 200, 20, "Label Font:");
|
||||
{ Fl_Group* o = new Fl_Group(85, 464, 201, 21, "Label Font:");
|
||||
o->labelsize(11);
|
||||
o->callback((Fl_Callback*)propagate_load);
|
||||
o->align(Fl_Align(FL_ALIGN_LEFT));
|
||||
{ Fl_Choice* o = new Fl_Choice(85, 465, 152, 20);
|
||||
{ Fl_Choice* o = new Fl_Choice(85, 465, 150, 20);
|
||||
o->tooltip("The style of the label text.");
|
||||
o->box(FL_THIN_UP_BOX);
|
||||
o->down_box(FL_BORDER_BOX);
|
||||
|
@ -1431,7 +1455,7 @@ ped using octal notation `\\0123`. If this option is checked, Fluid will write\
|
|||
Fl_Group::current()->resizable(o);
|
||||
o->menu(fontmenu);
|
||||
} // Fl_Choice* o
|
||||
{ Fl_Value_Input* o = new Fl_Value_Input(236, 465, 49, 20);
|
||||
{ Fl_Value_Input* o = new Fl_Value_Input(235, 465, 50, 20);
|
||||
o->tooltip("The size of the label text.");
|
||||
o->labelsize(11);
|
||||
o->maximum(100);
|
||||
|
@ -1442,7 +1466,7 @@ ped using octal notation `\\0123`. If this option is checked, Fluid will write\
|
|||
} // Fl_Value_Input* o
|
||||
o->end();
|
||||
} // Fl_Group* o
|
||||
{ Fl_Choice* o = new Fl_Choice(85, 490, 152, 20);
|
||||
{ Fl_Choice* o = new Fl_Choice(85, 490, 150, 20);
|
||||
o->tooltip("The value text style.");
|
||||
o->box(FL_DOWN_BOX);
|
||||
o->down_box(FL_BORDER_BOX);
|
||||
|
@ -1452,7 +1476,7 @@ ped using octal notation `\\0123`. If this option is checked, Fluid will write\
|
|||
o->callback((Fl_Callback*)cb_6);
|
||||
o->menu(fontmenu);
|
||||
} // Fl_Choice* o
|
||||
{ Fl_Value_Input* o = new Fl_Value_Input(236, 490, 49, 20);
|
||||
{ Fl_Value_Input* o = new Fl_Value_Input(235, 490, 50, 20);
|
||||
o->tooltip("The value text size.");
|
||||
o->labelsize(11);
|
||||
o->maximum(100);
|
||||
|
@ -1592,10 +1616,10 @@ nalize labels and tooltips, usually \"gettext_noop\" or \"N_\"");
|
|||
o->labelsize(11);
|
||||
o->callback((Fl_Callback*)cb_Close);
|
||||
} // Fl_Button* o
|
||||
o->size_range(o->w(), o->h());
|
||||
settings_window->set_non_modal();
|
||||
settings_window->end();
|
||||
settings_window->resizable(settings_window);
|
||||
o->size_range(o->w(), o->h());
|
||||
settings_window->end();
|
||||
} // Fl_Double_Window* settings_window
|
||||
w_settings_tabs->do_callback(w_settings_tabs, LOAD);
|
||||
return settings_window;
|
||||
|
|
|
@ -107,8 +107,8 @@ decl {void scheme_cb(Fl_Scheme_Choice *, void *);} {public local
|
|||
Function {make_settings_window()} {open
|
||||
} {
|
||||
Fl_Window settings_window {
|
||||
label {GUI Settings} open selected
|
||||
xywh {617 332 340 580} type Double align 80 resizable
|
||||
label {GUI Settings} open
|
||||
xywh {617 331 340 580} type Double align 80 resizable
|
||||
code0 {o->size_range(o->w(), o->h());} non_modal visible
|
||||
} {
|
||||
Fl_Tabs w_settings_tabs {
|
||||
|
@ -116,7 +116,7 @@ Function {make_settings_window()} {open
|
|||
xywh {10 10 320 530} selection_color 12 labelsize 11 labelcolor 255
|
||||
} {
|
||||
Fl_Group {} {
|
||||
label General open
|
||||
label General open selected
|
||||
image {icons/general_64.png} compress_image 1 xywh {10 60 320 480} labelsize 11
|
||||
code0 {o->image()->scale(36, 24);}
|
||||
} {
|
||||
|
@ -135,7 +135,7 @@ Function {make_settings_window()} {open
|
|||
label {Show Tooltips}
|
||||
callback {Fl_Tooltip::enable(tooltips_button->value());
|
||||
fluid_prefs.set("show_tooltips", tooltips_button->value());}
|
||||
xywh {120 115 180 20} down_box DOWN_BOX labelsize 11
|
||||
xywh {120 115 200 20} down_box DOWN_BOX labelsize 11
|
||||
code0 {int b;}
|
||||
code1 {fluid_prefs.get("show_tooltips", b, 1);}
|
||||
code2 {tooltips_button->value(b);}
|
||||
|
@ -144,7 +144,7 @@ fluid_prefs.set("show_tooltips", tooltips_button->value());}
|
|||
Fl_Check_Button completion_button {
|
||||
label {Show Completion Dialogs}
|
||||
callback {fluid_prefs.set("show_completion_dialogs", completion_button->value());}
|
||||
xywh {120 135 180 20} down_box DOWN_BOX labelsize 11
|
||||
xywh {120 135 200 20} down_box DOWN_BOX labelsize 11
|
||||
code0 {int b;}
|
||||
code1 {fluid_prefs.get("show_completion_dialogs", b, 1);}
|
||||
code2 {completion_button->value(b);}
|
||||
|
@ -152,7 +152,7 @@ fluid_prefs.set("show_tooltips", tooltips_button->value());}
|
|||
Fl_Check_Button openlast_button {
|
||||
label {Open Previous File on Startup}
|
||||
callback {fluid_prefs.set("open_previous_file", openlast_button->value());}
|
||||
xywh {120 155 180 20} down_box DOWN_BOX labelsize 11
|
||||
xywh {120 155 200 20} down_box DOWN_BOX labelsize 11
|
||||
code0 {int b;}
|
||||
code1 {fluid_prefs.get("open_previous_file", b, 0);}
|
||||
code2 {openlast_button->value(b);}
|
||||
|
@ -160,7 +160,7 @@ fluid_prefs.set("show_tooltips", tooltips_button->value());}
|
|||
Fl_Check_Button prevpos_button {
|
||||
label {Remember Window Positions}
|
||||
callback {fluid_prefs.set("prev_window_pos", prevpos_button->value());}
|
||||
xywh {120 175 180 20} down_box DOWN_BOX labelsize 11
|
||||
xywh {120 175 200 20} down_box DOWN_BOX labelsize 11
|
||||
code0 {int b;}
|
||||
code1 {fluid_prefs.get("prev_window_pos", b, 1);}
|
||||
code2 {prevpos_button->value(b);}
|
||||
|
@ -170,7 +170,7 @@ fluid_prefs.set("show_tooltips", tooltips_button->value());}
|
|||
callback {show_comments = show_comments_button->value();
|
||||
fluid_prefs.set("show_comments", show_comments);
|
||||
redraw_browser();}
|
||||
xywh {120 195 180 20} down_box DOWN_BOX labelsize 11
|
||||
xywh {120 195 200 20} down_box DOWN_BOX labelsize 11
|
||||
code1 {fluid_prefs.get("show_comments", show_comments, 1);}
|
||||
code2 {show_comments_button->value(show_comments);}
|
||||
}
|
||||
|
@ -208,6 +208,22 @@ Examples:
|
|||
code1 {fluid_prefs.get("external_editor_command", G_external_editor_command, "", sizeof(G_external_editor_command)-1);}
|
||||
code2 {editor_command_input->value(G_external_editor_command);}
|
||||
}
|
||||
Fl_Box {} {
|
||||
label {Overlays: }
|
||||
xywh {120 300 0 20} labelfont 1 labelsize 11 align 4
|
||||
}
|
||||
Fl_Check_Button guides_button {
|
||||
label {Show Positioning Guides}
|
||||
callback toggle_guides_cb
|
||||
tooltip {show guides that help to position and resize widgets and enable snapping} xywh {120 300 200 20} down_box DOWN_BOX labelsize 11
|
||||
code0 {o->value(show_guides);}
|
||||
}
|
||||
Fl_Check_Button restricted_button {
|
||||
label {Show Restricted Areas}
|
||||
callback toggle_restricted_cb
|
||||
tooltip {show overlapping and out of bounds areas, show unfilled areas in Fl_Pack groups} xywh {120 320 200 20} down_box DOWN_BOX labelsize 11
|
||||
code0 {o->value(show_restricted);}
|
||||
}
|
||||
}
|
||||
Fl_Group w_settings_project_tab {
|
||||
label Project
|
||||
|
@ -707,7 +723,7 @@ g_layout_list.update_dialogs();}
|
|||
Fl_Group {} {
|
||||
label {Label Font:}
|
||||
callback propagate_load open
|
||||
xywh {85 465 200 20} labelsize 11 align 4
|
||||
xywh {85 464 201 21} labelsize 11 align 4
|
||||
} {
|
||||
Fl_Choice {} {
|
||||
callback {if (v == LOAD) {
|
||||
|
@ -715,7 +731,7 @@ g_layout_list.update_dialogs();}
|
|||
} else {
|
||||
layout->labelfont = (int)o->value();
|
||||
}} open
|
||||
tooltip {The style of the label text.} xywh {85 465 152 20} box THIN_UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11 resizable
|
||||
tooltip {The style of the label text.} xywh {85 465 150 20} box THIN_UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11 resizable
|
||||
code0 {extern Fl_Menu_Item fontmenu[];}
|
||||
code1 {o->menu(fontmenu);}
|
||||
} {}
|
||||
|
@ -725,7 +741,7 @@ g_layout_list.update_dialogs();}
|
|||
} else {
|
||||
layout->labelsize = (int)o->value();
|
||||
}}
|
||||
tooltip {The size of the label text.} xywh {236 465 49 20} labelsize 11 maximum 100 step 1 value 14 textsize 11
|
||||
tooltip {The size of the label text.} xywh {235 465 50 20} labelsize 11 maximum 100 step 1 value 14 textsize 11
|
||||
}
|
||||
}
|
||||
Fl_Choice {} {
|
||||
|
@ -734,7 +750,7 @@ g_layout_list.update_dialogs();}
|
|||
} else {
|
||||
layout->textfont = (int)o->value();
|
||||
}} open
|
||||
tooltip {The value text style.} xywh {85 490 152 20} box DOWN_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11
|
||||
tooltip {The value text style.} xywh {85 490 150 20} box DOWN_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11
|
||||
code0 {extern Fl_Menu_Item fontmenu[];}
|
||||
code1 {o->menu(fontmenu);}
|
||||
} {}
|
||||
|
@ -744,7 +760,7 @@ g_layout_list.update_dialogs();}
|
|||
} else {
|
||||
layout->textsize = (int)o->value();
|
||||
}}
|
||||
tooltip {The value text size.} xywh {236 490 49 20} labelsize 11 maximum 100 step 1 value 14 textsize 11
|
||||
tooltip {The value text size.} xywh {235 490 50 20} labelsize 11 maximum 100 step 1 value 14 textsize 11
|
||||
}
|
||||
}
|
||||
Fl_Group w_settings_shell_tab {
|
||||
|
|
|
@ -54,6 +54,10 @@ extern Fl_Spinner *recent_spinner;
|
|||
extern Fl_Check_Button *use_external_editor_button;
|
||||
#include <FL/Fl_Input.H>
|
||||
extern Fl_Input *editor_command_input;
|
||||
extern void toggle_guides_cb(Fl_Check_Button*, void*);
|
||||
extern Fl_Check_Button *guides_button;
|
||||
extern void toggle_restricted_cb(Fl_Check_Button*, void*);
|
||||
extern Fl_Check_Button *restricted_button;
|
||||
extern Fl_Group *w_settings_project_tab;
|
||||
extern Fl_Input *header_file_input;
|
||||
extern Fl_Input *code_file_input;
|
||||
|
|
|
@ -77,6 +77,12 @@ Fl_Preferences fluid_prefs(Fl_Preferences::USER_L, "fltk.org", "fluid");
|
|||
/// Show guides in the design window when positioning widgets, saved in app preferences.
|
||||
int show_guides = 1;
|
||||
|
||||
/// Show areas of restricted use in overlay plane.
|
||||
/// Restrited areas are widget that overlap each other, widgets that are outside
|
||||
/// of their parent's bounds (execept children of Scroll groups), and areas
|
||||
/// within an Fl_Tile that are not covered by children.
|
||||
int show_restricted = 1;
|
||||
|
||||
/// Show widget comments in the browser, saved in app preferences.
|
||||
int show_comments = 1;
|
||||
|
||||
|
@ -126,6 +132,9 @@ Fl_Menu_Item *overlay_item = NULL;
|
|||
/// Menuitem to show or hide the editing guides, label will change if overlay visibility changes.
|
||||
Fl_Menu_Item *guides_item = NULL;
|
||||
|
||||
/// Menuitem to show or hide the restricted area overlys, label will change if overlay visibility changes.
|
||||
Fl_Menu_Item *restricted_item = NULL;
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
/// Filename of the current .fl design file
|
||||
|
@ -1438,6 +1447,7 @@ Fl_Menu_Item Main_Menu[] = {
|
|||
{"Ung&roup", FL_F+8, ungroup_cb,0, FL_MENU_DIVIDER},
|
||||
{"Hide O&verlays",FL_COMMAND+FL_SHIFT+'o',toggle_overlays},
|
||||
{"Hide Guides",FL_COMMAND+FL_SHIFT+'g',toggle_guides},
|
||||
{"Hide Restricted",FL_COMMAND+FL_SHIFT+'r',toggle_restricted},
|
||||
{"Show Widget &Bin...",FL_ALT+'b',toggle_widgetbin_cb},
|
||||
{"Show Source Code...",FL_ALT+FL_SHIFT+'s', (Fl_Callback*)toggle_sourceview_cb, 0, FL_MENU_DIVIDER},
|
||||
{"Settings...",FL_ALT+'p',show_settings_cb},
|
||||
|
@ -1624,7 +1634,8 @@ void toggle_sourceview_b_cb(Fl_Button*, void *) {
|
|||
*/
|
||||
void make_main_window() {
|
||||
if (!batch_mode) {
|
||||
fluid_prefs.get("show_guides", show_guides, 0);
|
||||
fluid_prefs.get("show_guides", show_guides, 1);
|
||||
fluid_prefs.get("show_restricted", show_restricted, 1);
|
||||
fluid_prefs.get("show_comments", show_comments, 1);
|
||||
shell_prefs_get();
|
||||
make_shell_window();
|
||||
|
@ -1648,6 +1659,7 @@ void make_main_window() {
|
|||
sourceview_item = (Fl_Menu_Item*)main_menubar->find_item((Fl_Callback*)toggle_sourceview_cb);
|
||||
overlay_item = (Fl_Menu_Item*)main_menubar->find_item((Fl_Callback*)toggle_overlays);
|
||||
guides_item = (Fl_Menu_Item*)main_menubar->find_item((Fl_Callback*)toggle_guides);
|
||||
restricted_item = (Fl_Menu_Item*)main_menubar->find_item((Fl_Callback*)toggle_restricted);
|
||||
main_menubar->global();
|
||||
fill_in_New_Menu();
|
||||
main_window->end();
|
||||
|
|
|
@ -34,6 +34,7 @@ class Fl_Menu_Bar;
|
|||
class Fl_Type;
|
||||
class Fl_Choice;
|
||||
class Fl_Button;
|
||||
class Fl_Check_Button;
|
||||
|
||||
extern int force_parent;
|
||||
|
||||
|
@ -43,6 +44,7 @@ extern Fl_Menu_Bar *main_menubar;
|
|||
extern Fl_Window *main_window;
|
||||
|
||||
extern int show_guides;
|
||||
extern int show_restricted;
|
||||
extern int show_comments;
|
||||
|
||||
extern int G_use_external_editor;
|
||||
|
@ -64,7 +66,8 @@ extern Fl_Menu_Item *sourceview_item;
|
|||
extern Fl_Menu_Item *overlay_item;
|
||||
extern Fl_Button *overlay_button;
|
||||
extern Fl_Menu_Item *guides_item;
|
||||
extern Fl_Button *guides_button;
|
||||
extern Fl_Menu_Item *restricted_item;
|
||||
extern Fl_Check_Button *guides_button;
|
||||
|
||||
extern int modflag;
|
||||
|
||||
|
@ -138,6 +141,7 @@ extern void align_widget_cb(Fl_Widget *, long);
|
|||
extern void toggle_widgetbin_cb(Fl_Widget *, void *);
|
||||
|
||||
inline int fd_min(int a, int b) { return (a < b ? a : b); }
|
||||
inline int fd_max(int a, int b) { return (a > b ? a : b); }
|
||||
inline int fd_min(int a, int b, int c) { return fd_min(a, fd_min(b, c)); }
|
||||
|
||||
#endif // _FLUID_FLUID_H
|
||||
|
|
|
@ -115,8 +115,6 @@ Fl_Button *wLiveMode=(Fl_Button *)0;
|
|||
|
||||
Fl_Button *overlay_button=(Fl_Button *)0;
|
||||
|
||||
Fl_Button *guides_button=(Fl_Button *)0;
|
||||
|
||||
/**
|
||||
Create a panel that can be used with all known widgets
|
||||
*/
|
||||
|
@ -1015,11 +1013,6 @@ avior.");
|
|||
overlay_button->labelsize(11);
|
||||
overlay_button->callback((Fl_Callback*)overlay_cb);
|
||||
} // Fl_Button* overlay_button
|
||||
{ guides_button = new Fl_Button(178, 370, 80, 20, "Hide &Guides");
|
||||
guides_button->tooltip("Hide alignment guides.");
|
||||
guides_button->labelsize(11);
|
||||
guides_button->callback((Fl_Callback*)guides_cb);
|
||||
} // Fl_Button* guides_button
|
||||
{ // Hidden resizable box
|
||||
Fl_Box* o = new Fl_Box(258, 370, 72, 20);
|
||||
o->labelsize(11);
|
||||
|
@ -1032,8 +1025,8 @@ avior.");
|
|||
} // Fl_Return_Button* o
|
||||
o->end();
|
||||
} // Fl_Group* o
|
||||
o->size_range(o->w(), o->h());
|
||||
o->size_range(420, 400);
|
||||
o->size_range(o->w(), o->h());
|
||||
o->end();
|
||||
} // Fl_Double_Window* o
|
||||
return w;
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
version 1.0400
|
||||
header_name {.h}
|
||||
code_name {.cxx}
|
||||
snap {
|
||||
ver 1
|
||||
current_suite {My Test}
|
||||
current_preset 1
|
||||
}
|
||||
comment {//
|
||||
// Widget panel for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
|
@ -30,7 +35,7 @@ Function {make_widget_panel()} {
|
|||
comment {Create a panel that can be used with all known widgets} open
|
||||
} {
|
||||
Fl_Window {} {
|
||||
comment {Use a Double Window to avoid flickering.} open selected
|
||||
comment {Use a Double Window to avoid flickering.} open
|
||||
xywh {566 244 420 400} type Double labelsize 11 align 80 resizable hotspot
|
||||
code0 {o->size_range(o->w(), o->h());} size_range {420 400 0 0} visible
|
||||
} {
|
||||
|
@ -806,7 +811,7 @@ wCallback->do_callback(wCallback, v);} open
|
|||
}
|
||||
}
|
||||
}
|
||||
Fl_Group {} {open
|
||||
Fl_Group {} {open selected
|
||||
xywh {10 370 400 20} labelsize 11
|
||||
} {
|
||||
Fl_Button wLiveMode {
|
||||
|
@ -819,11 +824,6 @@ wCallback->do_callback(wCallback, v);} open
|
|||
callback overlay_cb
|
||||
tooltip {Hide the widget overlay box.} xywh {94 370 80 20} labelsize 11
|
||||
}
|
||||
Fl_Button guides_button {
|
||||
label {Hide &Guides}
|
||||
callback guides_cb
|
||||
tooltip {Hide alignment guides.} xywh {178 370 80 20} labelsize 11
|
||||
}
|
||||
Fl_Box {} {
|
||||
comment {Hidden resizable box}
|
||||
xywh {258 370 72 20} labelsize 11 hide resizable
|
||||
|
|
|
@ -136,8 +136,6 @@ extern void live_mode_cb(Fl_Button*, void*);
|
|||
extern Fl_Button *wLiveMode;
|
||||
extern void overlay_cb(Fl_Button*, void*);
|
||||
extern Fl_Button *overlay_button;
|
||||
extern void guides_cb(Fl_Button*, void*);
|
||||
extern Fl_Button *guides_button;
|
||||
#include <FL/Fl_Return_Button.H>
|
||||
extern void ok_cb(Fl_Return_Button*, void*);
|
||||
Fl_Double_Window* make_widget_panel();
|
||||
|
|
Loading…
Reference in New Issue