summaryrefslogtreecommitdiff
path: root/fluid
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2022-12-15 16:46:40 +0100
committerGitHub <noreply@github.com>2022-12-15 16:46:40 +0100
commit44a2547394a3b4f8b0177c2f33aa8ed47a2c1051 (patch)
treed0611bedf1be051c9e5b2183314bc7e17648c5ad /fluid
parent2fd1866f492daa4caa7fdad6c05cd34bc79ba913 (diff)
Rename some Fl_Flex methods for FLTK compliance (#594)
Change some method names to comply with FLTK style as discussed in fltk.coredev, thread "Fl_Flex method name question". * Rename Fl_Flex::margins(...) to Fl_Flex::margin(...) (use singular form for all margin related methods) * Remove Fl_Flex::setSize() and isSetSize() "backwards compatibility" methods * Rename Fl_Flex::set_size(...) to fixed(...) Note: the latter affects existing (pre-release) fluid (.fl) files: you may want to edit and replace "set_size_tuples" with "fixed_size_tuples"
Diffstat (limited to 'fluid')
-rw-r--r--fluid/Fl_Group_Type.cxx36
-rw-r--r--fluid/Fl_Widget_Type.cxx28
-rw-r--r--fluid/Fl_Window_Type.cxx4
-rw-r--r--fluid/README_fl.txt2
4 files changed, 35 insertions, 35 deletions
diff --git a/fluid/Fl_Group_Type.cxx b/fluid/Fl_Group_Type.cxx
index 542f29ef8..624f520d8 100644
--- a/fluid/Fl_Group_Type.cxx
+++ b/fluid/Fl_Group_Type.cxx
@@ -189,9 +189,9 @@ Fl_Widget *Fl_Flex_Type::enter_live_mode(int) {
int nc = s->children(), nd = d->children();
if (nc>nd) nc = nd;
for (int i=0; i<nc; i++) {
- if (s->set_size(s->child(i))) {
+ if (s->fixed(s->child(i))) {
Fl_Widget *dc = d->child(i);
- d->set_size(d->child(i), s->horizontal() ? dc->w() : dc->h());
+ d->fixed(d->child(i), s->horizontal() ? dc->w() : dc->h());
}
}
grp->end(); //this also updates the layout
@@ -203,7 +203,7 @@ void Fl_Flex_Type::copy_properties()
Fl_Group_Type::copy_properties();
Fl_Flex *d = (Fl_Flex*)live_widget, *s =(Fl_Flex*)o;
int lm, tm, rm, bm;
- s->margins(&lm, &tm, &rm, &bm);
+ s->margin(&lm, &tm, &rm, &bm);
d->margin(lm, tm, rm, bm);
d->gap( s->gap() );
}
@@ -213,20 +213,20 @@ void Fl_Flex_Type::write_properties()
Fl_Group_Type::write_properties();
Fl_Flex* f = (Fl_Flex*)o;
int lm, tm, rm, bm;
- f->margins(&lm, &tm, &rm, &bm);
+ f->margin(&lm, &tm, &rm, &bm);
if (lm!=0 || tm!=0 || rm!=0 || bm!=0)
- write_string("margins {%d %d %d %d}", lm, tm, rm, bm);
+ write_string("margin {%d %d %d %d}", lm, tm, rm, bm);
if (f->gap())
write_string("gap %d", f->gap());
int nSet = 0;
for (int i=0; i<f->children(); i++)
- if (f->set_size(f->child(i)))
+ if (f->fixed(f->child(i)))
nSet++;
if (nSet) {
- write_string("set_size_tuples {%d", nSet);
+ write_string("fixed_size_tuples {%d", nSet);
for (int i=0; i<f->children(); i++) {
Fl_Widget *ci = f->child(i);
- if (f->set_size(ci))
+ if (f->fixed(ci))
write_string(" %d %d", i, f->horizontal() ? ci->w() : ci->h());
}
write_string("}");
@@ -237,7 +237,7 @@ void Fl_Flex_Type::read_property(const char *c)
{
Fl_Flex* f = (Fl_Flex*)o;
suspend_auto_layout = 1;
- if (!strcmp(c,"margins")) {
+ if (!strcmp(c,"margin")) {
int lm, tm, rm, bm;
if (sscanf(read_word(),"%d %d %d %d",&lm,&tm,&rm,&bm) == 4)
f->margin(lm, tm, rm, bm);
@@ -245,7 +245,7 @@ void Fl_Flex_Type::read_property(const char *c)
int g;
if (sscanf(read_word(),"%d",&g))
f->gap(g);
- } else if (!strcmp(c,"set_size_tuples")) {
+ } else if (!strcmp(c,"fixed_size_tuples")) {
read_word(1); // must be '{'
const char *nStr = read_word(1); // number of indices in table
fixedSizeTupleSize = atoi(nStr);
@@ -271,7 +271,7 @@ void Fl_Flex_Type::postprocess_read()
int size = fixedSizeTuple[2*i+1];
if (ix>=0 && ix<f->children()) {
Fl_Widget *ci = f->child(ix);
- f->set_size(ci, size);
+ f->fixed(ci, size);
}
}
fixedSizeTupleSize = 0;
@@ -285,15 +285,15 @@ void Fl_Flex_Type::write_code2() {
const char *var = name() ? name() : "o";
Fl_Flex* f = (Fl_Flex*)o;
int lm, tm, rm, bm;
- f->margins(&lm, &tm, &rm, &bm);
+ f->margin(&lm, &tm, &rm, &bm);
if (lm!=0 || tm!=0 || rm!=0 || bm!=0)
write_c("%s%s->margin(%d, %d, %d, %d);\n", indent(), var, lm, tm, rm, bm);
if (f->gap())
write_c("%s%s->gap(%d);\n", indent(), var, f->gap());
for (int i=0; i<f->children(); ++i) {
Fl_Widget *ci = f->child(i);
- if (f->set_size(ci))
- write_c("%s%s->set_size(%s->child(%d), %d);\n", indent(), var, var, i,
+ if (f->fixed(ci))
+ write_c("%s%s->fixed(%s->child(%d), %d);\n", indent(), var, var, i,
f->horizontal() ? ci->w() : ci->h());
}
Fl_Group_Type::write_code2();
@@ -313,7 +313,7 @@ void Fl_Flex_Type::move_child(Fl_Type* a, Fl_Type* b) {
void Fl_Flex_Type::remove_child(Fl_Type* a) {
if (a->is_widget())
- ((Fl_Flex*)o)->set_size(((Fl_Widget_Type*)a)->o, 0);
+ ((Fl_Flex*)o)->fixed(((Fl_Widget_Type*)a)->o, 0);
Fl_Group_Type::remove_child(a);
((Fl_Flex*)o)->layout();
}
@@ -331,7 +331,7 @@ void Fl_Flex_Type::change_subtype_to(int n) {
int dw = Fl::box_dw(f->box());
int dh = Fl::box_dh(f->box());
int lm, tm, rm, bm;
- f->margins(&lm, &tm, &rm, &bm);
+ f->margin(&lm, &tm, &rm, &bm);
int gap = f->gap();
int fw = f->w()-dw-lm-rm-(nc*gap);
if (fw<=nc) fw = nc; // avoid division by zero
@@ -369,7 +369,7 @@ int Fl_Flex_Type::size(Fl_Type *t, char fixed_only) {
Fl_Flex_Type* ft = (Fl_Flex_Type*)t->parent;
Fl_Flex* f = (Fl_Flex*)ft->o;
Fl_Widget *w = ((Fl_Widget_Type*)t)->o;
- if (fixed_only && !f->set_size(w)) return 0;
+ if (fixed_only && !f->fixed(w)) return 0;
return f->horizontal() ? w->w() : w->h();
}
@@ -380,7 +380,7 @@ int Fl_Flex_Type::is_fixed(Fl_Type *t) {
Fl_Flex_Type* ft = (Fl_Flex_Type*)t->parent;
Fl_Flex* f = (Fl_Flex*)ft->o;
Fl_Widget *w = ((Fl_Widget_Type*)t)->o;
- return f->set_size(w);
+ return f->fixed(w);
}
////////////////////////////////////////////////////////////////
diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx
index 42f0e21de..eb071a412 100644
--- a/fluid/Fl_Widget_Type.cxx
+++ b/fluid/Fl_Widget_Type.cxx
@@ -2183,14 +2183,14 @@ static void flex_margin_cb(Fl_Value_Input* i, void* v,
static void load_left_margin(Fl_Flex *w, Fl_Value_Input* i)
{
int v;
- w->margins(&v, NULL, NULL, NULL);
+ w->margin(&v, NULL, NULL, NULL);
i->value((double)v);
}
static int update_left_margin(Fl_Flex *w, int new_value)
{
int l, t, r, b;
- w->margins(&l, &t, &r, &b);
+ w->margin(&l, &t, &r, &b);
if (new_value!=l) {
w->margin(new_value, t, r, b);
return 1;
@@ -2206,14 +2206,14 @@ void flex_margin_left_cb(Fl_Value_Input* i, void* v) {
static void load_top_margin(Fl_Flex *w, Fl_Value_Input* i)
{
int v;
- w->margins(NULL, &v, NULL, NULL);
+ w->margin(NULL, &v, NULL, NULL);
i->value((double)v);
}
static int update_top_margin(Fl_Flex *w, int new_value)
{
int l, t, r, b;
- w->margins(&l, &t, &r, &b);
+ w->margin(&l, &t, &r, &b);
if (new_value!=t) {
w->margin(l, new_value, r, b);
return 1;
@@ -2229,14 +2229,14 @@ void flex_margin_top_cb(Fl_Value_Input* i, void* v) {
static void load_right_margin(Fl_Flex *w, Fl_Value_Input* i)
{
int v;
- w->margins(NULL, NULL, &v, NULL);
+ w->margin(NULL, NULL, &v, NULL);
i->value((double)v);
}
static int update_right_margin(Fl_Flex *w, int new_value)
{
int l, t, r, b;
- w->margins(&l, &t, &r, &b);
+ w->margin(&l, &t, &r, &b);
if (new_value!=r) {
w->margin(l, t, new_value, b);
return 1;
@@ -2252,14 +2252,14 @@ void flex_margin_right_cb(Fl_Value_Input* i, void* v) {
static void load_bottom_margin(Fl_Flex *w, Fl_Value_Input* i)
{
int v;
- w->margins(NULL, NULL, NULL, &v);
+ w->margin(NULL, NULL, NULL, &v);
i->value((double)v);
}
static int update_bottom_margin(Fl_Flex *w, int new_value)
{
int l, t, r, b;
- w->margins(&l, &t, &r, &b);
+ w->margin(&l, &t, &r, &b);
if (new_value!=b) {
w->margin(l, t, r, new_value);
return 1;
@@ -2327,10 +2327,10 @@ void flex_size_cb(Fl_Value_Input* i, void* v) {
if (o->selected && o->is_widget() && Fl_Flex_Type::parent_is_flex(o)) {
Fl_Widget* w = (Fl_Widget*)((Fl_Widget_Type*)o)->o;
Fl_Flex* f = (Fl_Flex*)((Fl_Flex_Type*)o->parent)->o;
- int was_fixed = f->set_size(w);
+ int was_fixed = f->fixed(w);
if (new_size==0) {
if (was_fixed) {
- f->set_size(w, 0);
+ f->fixed(w, 0);
f->layout();
widget_flex_fixed->value(0);
mod = 1;
@@ -2338,7 +2338,7 @@ void flex_size_cb(Fl_Value_Input* i, void* v) {
} else {
int old_size = Fl_Flex_Type::size(o);
if (old_size!=new_size || !was_fixed) {
- f->set_size(w, new_size);
+ f->fixed(w, new_size);
f->layout();
widget_flex_fixed->value(1);
mod = 1;
@@ -2362,16 +2362,16 @@ void flex_fixed_cb(Fl_Check_Button* i, void* v) {
if (o->selected && o->is_widget() && Fl_Flex_Type::parent_is_flex(o)) {
Fl_Widget* w = (Fl_Widget*)((Fl_Widget_Type*)o)->o;
Fl_Flex* f = (Fl_Flex*)((Fl_Flex_Type*)o->parent)->o;
- int was_fixed = f->set_size(w);
+ int was_fixed = f->fixed(w);
if (new_fixed==0) {
if (was_fixed) {
- f->set_size(w, 0);
+ f->fixed(w, 0);
f->layout();
mod = 1;
}
} else {
if (!was_fixed) {
- f->set_size(w, Fl_Flex_Type::size(o));
+ f->fixed(w, Fl_Flex_Type::size(o));
f->layout();
mod = 1;
}
diff --git a/fluid/Fl_Window_Type.cxx b/fluid/Fl_Window_Type.cxx
index 61399e1f5..0ac8cf3f5 100644
--- a/fluid/Fl_Window_Type.cxx
+++ b/fluid/Fl_Window_Type.cxx
@@ -1222,12 +1222,12 @@ void Fl_Window_Type::moveallchildren()
Fl_Flex* f = (Fl_Flex*)ft->o;
if (f->horizontal()) {
if (myo->o->w()!=ow) {
- f->set_size(myo->o, myo->o->w());
+ f->fixed(myo->o, myo->o->w());
f->layout();
}
} else {
if (myo->o->h()!=oh) {
- f->set_size(myo->o, myo->o->h());
+ f->fixed(myo->o, myo->o->h());
f->layout();
}
}
diff --git a/fluid/README_fl.txt b/fluid/README_fl.txt
index a4d509f1a..f70c217b2 100644
--- a/fluid/README_fl.txt
+++ b/fluid/README_fl.txt
@@ -427,7 +427,7 @@ Type "Fl_Flex" <word> : C++ variable name
"margins" <word> : this Word is written with printf as "{%d %d %d %d}",
left, top, right, bottom
"gap" <word> : integer
- "set_size_tuples" <word> : this Word is written with printf "{%d", where %d
+ "fixed_size_tuples" <word> : this Word is written with printf "{%d", where %d
encodes the number of tuples to follow, and zero or more " %d %d"
containing the index and size of that child, followed by a '}'.
... : inherits more from Fl_Group