Added support for Fl_Window::size_range() in FLUID. There are no UI elements for increment or aspect ratio.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4515 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
41c089f3c1
commit
78e4274963
1
CHANGES
1
CHANGES
@ -3,6 +3,7 @@ CHANGES IN FLTK 1.1.7
|
||||
- Documentation fixes (STR #571, STR #648, STR #692, STR
|
||||
#730, STR #744, STR #745, STR #931, STR #942, STR #960,
|
||||
STR #969)
|
||||
- FLUID now supports 'size_range()' (STR #851)
|
||||
- FLUID selection boxes now synchronised (STR #964)
|
||||
- fl_filename_list now recognizes pathnames without trailing
|
||||
slash as directions (STR #854)
|
||||
|
@ -485,7 +485,7 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
Fl_Window_Type() { drag = dx = dy = 0; }
|
||||
Fl_Window_Type() { drag = dx = dy = 0; sr_min_w = sr_min_h = sr_max_w = sr_max_h = 0; }
|
||||
uchar modal, non_modal;
|
||||
|
||||
Fl_Type *make();
|
||||
@ -511,6 +511,8 @@ public:
|
||||
Fl_Widget *enter_live_mode(int top=0);
|
||||
void leave_live_mode();
|
||||
void copy_properties();
|
||||
|
||||
int sr_min_w, sr_min_h, sr_max_w, sr_max_h;
|
||||
};
|
||||
|
||||
class Fl_Widget_Class_Type : private Fl_Window_Type {
|
||||
|
@ -1284,8 +1284,94 @@ void textcolor_cb(Fl_Button* i, void* v) {
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Kludges to the panel for subclasses:
|
||||
|
||||
void min_w_cb(Fl_Value_Input* i, void* v) {
|
||||
if (v == LOAD) {
|
||||
if (!current_widget->is_window()) {i->parent()->hide(); return;}
|
||||
i->parent()->show();
|
||||
i->value(((Fl_Window_Type*)current_widget)->sr_min_w);
|
||||
} else {
|
||||
int n = i->value();
|
||||
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
|
||||
if (o->selected && o->is_window()) {
|
||||
((Fl_Window_Type*)current_widget)->sr_min_w = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void min_h_cb(Fl_Value_Input* i, void* v) {
|
||||
if (v == LOAD) {
|
||||
i->value(((Fl_Window_Type*)current_widget)->sr_min_h);
|
||||
} else {
|
||||
int n = i->value();
|
||||
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
|
||||
if (o->selected && o->is_window()) {
|
||||
((Fl_Window_Type*)current_widget)->sr_min_h = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void max_w_cb(Fl_Value_Input* i, void* v) {
|
||||
if (v == LOAD) {
|
||||
i->value(((Fl_Window_Type*)current_widget)->sr_max_w);
|
||||
} else {
|
||||
int n = i->value();
|
||||
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
|
||||
if (o->selected && o->is_window()) {
|
||||
((Fl_Window_Type*)current_widget)->sr_max_w = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void max_h_cb(Fl_Value_Input* i, void* v) {
|
||||
if (v == LOAD) {
|
||||
i->value(((Fl_Window_Type*)current_widget)->sr_max_h);
|
||||
} else {
|
||||
int n = i->value();
|
||||
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
|
||||
if (o->selected && o->is_window()) {
|
||||
((Fl_Window_Type*)current_widget)->sr_max_h = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void set_min_size_cb(Fl_Button*, void* v) {
|
||||
if (v == LOAD) {
|
||||
} else {
|
||||
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
|
||||
if (o->selected && o->is_window()) {
|
||||
Fl_Window_Type *win = (Fl_Window_Type*)current_widget;
|
||||
win->sr_min_w = win->o->w();
|
||||
win->sr_min_h = win->o->h();
|
||||
}
|
||||
}
|
||||
propagate_load(the_panel, LOAD);
|
||||
}
|
||||
}
|
||||
|
||||
void set_max_size_cb(Fl_Button*, void* v) {
|
||||
if (v == LOAD) {
|
||||
} else {
|
||||
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
|
||||
if (o->selected && o->is_window()) {
|
||||
Fl_Window_Type *win = (Fl_Window_Type*)current_widget;
|
||||
win->sr_max_w = win->o->w();
|
||||
win->sr_max_h = win->o->h();
|
||||
}
|
||||
}
|
||||
propagate_load(the_panel, LOAD);
|
||||
}
|
||||
}
|
||||
|
||||
void slider_size_cb(Fl_Value_Input* i, void* v) {
|
||||
if (v == LOAD) {
|
||||
if (current_widget->is_window())
|
||||
i->parent()->hide();
|
||||
else
|
||||
i->parent()->show();
|
||||
if (current_widget->is_valuator()!=2) {i->deactivate(); return;}
|
||||
i->activate();
|
||||
i->value(((Fl_Slider*)(current_widget->o))->slider_size());
|
||||
@ -1523,6 +1609,15 @@ void live_mode_cb(Fl_Button*o,void *v) {
|
||||
live_window->resizable(live_widget);
|
||||
live_window->set_modal(); // block all other UI
|
||||
live_window->callback(leave_live_mode_cb);
|
||||
if (current_widget->is_window()) {
|
||||
Fl_Window_Type *w = (Fl_Window_Type*)current_widget;
|
||||
int mw = w->sr_min_w; if (mw>0) mw += 20;
|
||||
int mh = w->sr_min_h; if (mh>0) mh += 55;
|
||||
int MW = w->sr_max_w; if (MW>0) MW += 20;
|
||||
int MH = w->sr_max_h; if (MH>2) MH += 55;
|
||||
if (mw || mh || MW || MH)
|
||||
live_window->size_range(mw, mh, MW, MH);
|
||||
}
|
||||
live_window->show();
|
||||
} else o->value(0);
|
||||
} else o->value(0);
|
||||
|
@ -1251,6 +1251,11 @@ void Fl_Window_Type::write_code2() {
|
||||
write_cstring(xclass);
|
||||
write_c(");\n");
|
||||
}
|
||||
if (sr_max_w || sr_max_h) {
|
||||
write_c("%so->size_range(%d, %d, %d, %d);\n", indent(), sr_min_w, sr_min_h, sr_max_w, sr_max_h);
|
||||
} else if (sr_min_w || sr_min_h) {
|
||||
write_c("%so->size_range(%d, %d);\n", indent(), sr_min_w, sr_min_h);
|
||||
}
|
||||
write_c("%so->end();\n", indent());
|
||||
if (((Fl_Window*)o)->resizable() == o)
|
||||
write_c("%so->resizable(o);\n", indent());
|
||||
@ -1263,6 +1268,8 @@ void Fl_Window_Type::write_properties() {
|
||||
else if (non_modal) write_string("non_modal");
|
||||
if (!((Fl_Window*)o)->border()) write_string("noborder");
|
||||
if (xclass) {write_string("xclass"); write_word(xclass);}
|
||||
if (sr_min_w || sr_min_h || sr_max_w || sr_max_h)
|
||||
write_string("size_range {%d %d %d %d}", sr_min_w, sr_min_h, sr_max_w, sr_max_h);
|
||||
if (o->visible()) write_string("visible");
|
||||
}
|
||||
|
||||
@ -1279,6 +1286,11 @@ void Fl_Window_Type::read_property(const char *c) {
|
||||
} else if (!strcmp(c,"xclass")) {
|
||||
storestring(read_word(),xclass);
|
||||
((Fl_Window*)o)->xclass(xclass);
|
||||
} else if (!strcmp(c,"size_range")) {
|
||||
int mw, mh, MW, MH;
|
||||
if (sscanf(read_word(),"%d %d %d %d",&mw,&mh,&MW,&MH) == 4) {
|
||||
sr_min_w = mw; sr_min_h = mh; sr_max_w = MW; sr_max_h = MH;
|
||||
}
|
||||
} else if (!strcmp(c,"xywh")) {
|
||||
Fl_Widget_Type::read_property(c);
|
||||
pasteoffset = 0; // make it not apply to contents
|
||||
|
@ -51,12 +51,12 @@ Fl_Double_Window* make_widget_panel() {
|
||||
w = o;
|
||||
o->labelsize(11);
|
||||
w->hotspot(o);
|
||||
{ Fl_Tabs* o = new Fl_Tabs(5, 5, 400, 310);
|
||||
{ Fl_Tabs* o = new Fl_Tabs(3, 5, 402, 310);
|
||||
o->selection_color((Fl_Color)4);
|
||||
o->labelsize(11);
|
||||
o->callback((Fl_Callback*)cb_);
|
||||
o->when(FL_WHEN_NEVER);
|
||||
{ Fl_Group* o = new Fl_Group(5, 25, 400, 290, "GUI");
|
||||
{ Fl_Group* o = new Fl_Group(3, 25, 402, 290, "GUI");
|
||||
o->labelsize(11);
|
||||
o->callback((Fl_Callback*)propagate_load);
|
||||
o->when(FL_WHEN_NEVER);
|
||||
@ -288,6 +288,61 @@ Fl_Double_Window* make_widget_panel() {
|
||||
}
|
||||
o->end();
|
||||
}
|
||||
{ Fl_Group* o = new Fl_Group(90, 180, 300, 20, "Size Range:");
|
||||
o->labelfont(1);
|
||||
o->labelsize(11);
|
||||
o->callback((Fl_Callback*)propagate_load);
|
||||
o->align(FL_ALIGN_LEFT);
|
||||
o->hide();
|
||||
{ Fl_Value_Input* o = new Fl_Value_Input(90, 180, 55, 20, "Minimum Size:");
|
||||
o->tooltip("The size of the slider.");
|
||||
o->labelsize(11);
|
||||
o->maximum(2048);
|
||||
o->step(1);
|
||||
o->textsize(11);
|
||||
o->callback((Fl_Callback*)min_w_cb);
|
||||
o->align(FL_ALIGN_TOP_LEFT);
|
||||
}
|
||||
{ Fl_Value_Input* o = new Fl_Value_Input(150, 180, 55, 20);
|
||||
o->tooltip("The minimum value of the widget.");
|
||||
o->labelsize(11);
|
||||
o->maximum(2048);
|
||||
o->step(1);
|
||||
o->textsize(11);
|
||||
o->callback((Fl_Callback*)min_h_cb);
|
||||
o->align(FL_ALIGN_TOP_LEFT);
|
||||
}
|
||||
{ Fl_Button* o = new Fl_Button(210, 180, 25, 20, "set");
|
||||
o->labelsize(11);
|
||||
o->callback((Fl_Callback*)set_min_size_cb);
|
||||
}
|
||||
{ Fl_Value_Input* o = new Fl_Value_Input(240, 180, 55, 20, "Maximum Size:");
|
||||
o->tooltip("The maximum value of the widget.");
|
||||
o->labelsize(11);
|
||||
o->maximum(2048);
|
||||
o->step(1);
|
||||
o->textsize(11);
|
||||
o->callback((Fl_Callback*)max_w_cb);
|
||||
o->align(FL_ALIGN_TOP_LEFT);
|
||||
}
|
||||
{ Fl_Value_Input* o = new Fl_Value_Input(300, 180, 55, 20);
|
||||
o->tooltip("The resolution of the widget value.");
|
||||
o->labelsize(11);
|
||||
o->maximum(2048);
|
||||
o->step(1);
|
||||
o->textsize(11);
|
||||
o->callback((Fl_Callback*)max_h_cb);
|
||||
o->align(FL_ALIGN_TOP_LEFT);
|
||||
}
|
||||
{ Fl_Button* o = new Fl_Button(360, 180, 25, 20, "set");
|
||||
o->labelsize(11);
|
||||
o->callback((Fl_Callback*)set_max_size_cb);
|
||||
}
|
||||
{ Fl_Box* o = new Fl_Box(390, 180, 0, 20);
|
||||
Fl_Group::current()->resizable(o);
|
||||
}
|
||||
o->end();
|
||||
}
|
||||
{ Shortcut_Button* o = new Shortcut_Button(90, 205, 300, 20, "Shortcut:");
|
||||
o->tooltip("The shortcut key for the widget.");
|
||||
o->box(FL_DOWN_BOX);
|
||||
@ -387,7 +442,7 @@ Fl_Double_Window* make_widget_panel() {
|
||||
o->end();
|
||||
Fl_Group::current()->resizable(o);
|
||||
}
|
||||
{ Fl_Group* o = new Fl_Group(5, 25, 400, 290, "Style");
|
||||
{ Fl_Group* o = new Fl_Group(3, 25, 402, 290, "Style");
|
||||
o->labelsize(11);
|
||||
o->callback((Fl_Callback*)propagate_load);
|
||||
o->when(FL_WHEN_NEVER);
|
||||
|
@ -34,20 +34,20 @@ comment {//
|
||||
Function {make_widget_panel()} {open
|
||||
} {
|
||||
Fl_Window {} {open
|
||||
xywh {353 184 410 355} type Double labelsize 11 hide resizable hotspot
|
||||
code0 {o->size_range(o->w(), o->h());}
|
||||
xywh {353 184 410 355} type Double labelsize 11 resizable hotspot
|
||||
code0 {o->size_range(o->w(), o->h());} visible
|
||||
} {
|
||||
Fl_Tabs {} {
|
||||
callback {propagate_load((Fl_Group *)o,v);} open
|
||||
xywh {5 5 400 310} selection_color 4 labelsize 11 when 0 resizable
|
||||
xywh {3 5 402 310} selection_color 4 labelsize 11 when 0 resizable
|
||||
} {
|
||||
Fl_Group {} {
|
||||
label GUI
|
||||
callback propagate_load
|
||||
xywh {5 25 400 290} labelsize 11 when 0 resizable
|
||||
callback propagate_load open
|
||||
xywh {3 25 402 290} labelsize 11 when 0 resizable
|
||||
} {
|
||||
Fl_Group {} {
|
||||
callback propagate_load
|
||||
callback propagate_load open
|
||||
xywh {3 25 396 285} labelsize 11 resizable
|
||||
} {
|
||||
Fl_Group {} {
|
||||
@ -184,7 +184,7 @@ Function {make_widget_panel()} {open
|
||||
}
|
||||
Fl_Group {} {
|
||||
label {Values:}
|
||||
callback propagate_load
|
||||
callback propagate_load selected
|
||||
xywh {90 180 300 20} labelfont 1 labelsize 11 align 4
|
||||
} {
|
||||
Fl_Value_Input {} {
|
||||
@ -216,6 +216,43 @@ Function {make_widget_panel()} {open
|
||||
xywh {390 180 0 20} resizable
|
||||
}
|
||||
}
|
||||
Fl_Group {} {
|
||||
label {Size Range:}
|
||||
callback propagate_load
|
||||
xywh {90 180 300 20} labelfont 1 labelsize 11 align 4 hide
|
||||
} {
|
||||
Fl_Value_Input {} {
|
||||
label {Minimum Size:}
|
||||
callback min_w_cb
|
||||
tooltip {The size of the slider.} xywh {90 180 55 20} labelsize 11 align 5 maximum 2048 step 1 textsize 11
|
||||
}
|
||||
Fl_Value_Input {} {
|
||||
callback min_h_cb
|
||||
tooltip {The minimum value of the widget.} xywh {150 180 55 20} labelsize 11 align 5 maximum 2048 step 1 textsize 11
|
||||
}
|
||||
Fl_Button {} {
|
||||
label set
|
||||
callback set_min_size_cb
|
||||
xywh {210 180 25 20} labelsize 11
|
||||
}
|
||||
Fl_Value_Input {} {
|
||||
label {Maximum Size:}
|
||||
callback max_w_cb
|
||||
tooltip {The maximum value of the widget.} xywh {240 180 55 20} labelsize 11 align 5 maximum 2048 step 1 textsize 11
|
||||
}
|
||||
Fl_Value_Input {} {
|
||||
callback max_h_cb
|
||||
tooltip {The resolution of the widget value.} xywh {300 180 55 20} labelsize 11 align 5 maximum 2048 step 1 textsize 11
|
||||
}
|
||||
Fl_Button {} {
|
||||
label set
|
||||
callback set_max_size_cb
|
||||
xywh {360 180 25 20} labelsize 11
|
||||
}
|
||||
Fl_Box {} {
|
||||
xywh {390 180 0 20} resizable
|
||||
}
|
||||
}
|
||||
Fl_Button {} {
|
||||
label {Shortcut:}
|
||||
callback shortcut_in_cb
|
||||
@ -290,7 +327,7 @@ Function {make_widget_panel()} {open
|
||||
Fl_Group {} {
|
||||
label Style
|
||||
callback propagate_load
|
||||
xywh {5 25 400 290} labelsize 11 when 0 hide
|
||||
xywh {3 25 402 290} labelsize 11 when 0 hide
|
||||
} {
|
||||
Fl_Group {} {
|
||||
callback propagate_load
|
||||
@ -489,7 +526,7 @@ Function {make_widget_panel()} {open
|
||||
}
|
||||
}
|
||||
}
|
||||
Fl_Group {} {selected
|
||||
Fl_Group {} {
|
||||
xywh {8 321 391 24} labelsize 11
|
||||
} {
|
||||
Fl_Box {} {
|
||||
|
@ -60,6 +60,12 @@ extern void min_cb(Fl_Value_Input*, void*);
|
||||
extern void max_cb(Fl_Value_Input*, void*);
|
||||
extern void step_cb(Fl_Value_Input*, void*);
|
||||
extern void value_cb(Fl_Value_Input*, void*);
|
||||
extern void min_w_cb(Fl_Value_Input*, void*);
|
||||
extern void min_h_cb(Fl_Value_Input*, void*);
|
||||
extern void set_min_size_cb(Fl_Button*, void*);
|
||||
extern void max_w_cb(Fl_Value_Input*, void*);
|
||||
extern void max_h_cb(Fl_Value_Input*, void*);
|
||||
extern void set_max_size_cb(Fl_Button*, void*);
|
||||
#include "Shortcut_Button.h"
|
||||
extern void shortcut_in_cb(Shortcut_Button*, void*);
|
||||
extern void xclass_cb(Fl_Input*, void*);
|
||||
|
Loading…
Reference in New Issue
Block a user