summaryrefslogtreecommitdiff
path: root/fluid/nodes/Group_Node.cxx
diff options
context:
space:
mode:
authormaxim nikonov <maxim.nikonov@hqo.co>2026-02-06 18:12:40 +0500
committermaxim nikonov <maxim.nikonov@hqo.co>2026-02-06 18:12:40 +0500
commitb4995f979d127cea667b4e2b71c91e9db4ab52ef (patch)
treefbebc775e10932bace8d6a7c3481b1ba200c64db /fluid/nodes/Group_Node.cxx
parent9575eb0a1ffa8150f70f88b5f6b55f342c3c0088 (diff)
wip
Diffstat (limited to 'fluid/nodes/Group_Node.cxx')
-rw-r--r--fluid/nodes/Group_Node.cxx39
1 files changed, 25 insertions, 14 deletions
diff --git a/fluid/nodes/Group_Node.cxx b/fluid/nodes/Group_Node.cxx
index 8ff3b9cdf..d4dc93780 100644
--- a/fluid/nodes/Group_Node.cxx
+++ b/fluid/nodes/Group_Node.cxx
@@ -79,7 +79,8 @@ void fix_group_size(Node *tt) {
int Y = t->o->y();
int R = X+t->o->w();
int B = Y+t->o->h();
- for (Node *nn = t->next; nn && nn->level > t->level; nn = nn->next) {
+ Node *nn;
+ for (nn = t->next; nn && nn->level > t->level; nn = nn->next) {
if (nn->is_true_widget()) {
Widget_Node* n = (Widget_Node*)nn;
int x = n->o->x(); if (x < X) X = x;
@@ -122,7 +123,8 @@ void group_cb(Fl_Widget *, void *) {
Group_Node *n = (Group_Node*)(Group_Node::prototype.make(Strategy::AS_LAST_CHILD));
n->move_before(q);
n->o->resize(q->o->x(),q->o->y(),q->o->w(),q->o->h());
- for (Node *t = qq->next; t && (t->level > qq->level);) {
+ Node *t;
+ for (t = qq->next; t && (t->level > qq->level);) {
if (t->level != n->level || t == n || !t->selected) {
t = t->next;
continue;
@@ -166,7 +168,8 @@ void ungroup_cb(Fl_Widget *, void *) {
Fluid.proj.undo.checkpoint();
Fluid.proj.undo.suspend();
Fluid.proj.tree.current = qq;
- for (Node *t = qq->next; t && (t->level > qq->level);) {
+ Node *t;
+ for (t = qq->next; t && (t->level > qq->level);) {
if (t->level != q_level || !t->selected) {
t = t->next;
continue;
@@ -319,7 +322,8 @@ Fl_Widget *Flex_Node::enter_live_mode(int) {
Fl_Flex *d = grp, *s =(Fl_Flex*)o;
int nc = s->children(), nd = d->children();
if (nc>nd) nc = nd;
- for (int i=0; i<nc; i++) {
+ int i;
+ for (i =0; i<nc; i++) {
if (s->fixed(s->child(i))) {
Fl_Widget *dc = d->child(i);
d->fixed(d->child(i), s->horizontal() ? dc->w() : dc->h());
@@ -340,7 +344,8 @@ void Flex_Node::copy_properties()
void Flex_Node::copy_properties_for_children() {
Fl_Flex *d = (Fl_Flex*)live_widget, *s =(Fl_Flex*)o;
- for (int i=0; i<s->children(); i++) {
+ int i;
+ for (i =0; i<s->children(); i++) {
if (s->fixed(s->child(i)) && i<d->children()) {
if (s->horizontal()) {
d->fixed(d->child(i), d->child(i)->w());
@@ -363,12 +368,13 @@ void Flex_Node::write_properties(fld::io::Project_Writer &f)
if (flex->gap())
f.write_string("gap %d", flex->gap());
int nSet = 0;
- for (int i=0; i<flex->children(); i++)
+ int i;
+ for (i =0; i<flex->children(); i++)
if (flex->fixed(flex->child(i)))
nSet++;
if (nSet) {
f.write_string("fixed_size_tuples {%d", nSet);
- for (int i=0; i<flex->children(); i++) {
+ for (i =0; i<flex->children(); i++) {
Fl_Widget *ci = flex->child(i);
if (flex->fixed(ci))
f.write_string(" %d %d", i, flex->horizontal() ? ci->w() : ci->h());
@@ -394,7 +400,8 @@ void Flex_Node::read_property(fld::io::Project_Reader &f, const char *c)
const char *nStr = f.read_word(1); // number of indices in table
fixedSizeTupleSize = atoi(nStr);
fixedSizeTuple = new int[fixedSizeTupleSize*2];
- for (int i=0; i<fixedSizeTupleSize; i++) {
+ int i;
+ for (i =0; i<fixedSizeTupleSize; i++) {
const char *ix = f.read_word(1); // child at that index is fixed in size
fixedSizeTuple[i*2] = atoi(ix);
const char *size = f.read_word(1); // fixed size of that child
@@ -410,7 +417,8 @@ void Flex_Node::postprocess_read()
{
Fl_Flex* flex = (Fl_Flex*)o;
if (fixedSizeTupleSize>0) {
- for (int i=0; i<fixedSizeTupleSize; i++) {
+ int i;
+ for (i =0; i<fixedSizeTupleSize; i++) {
int ix = fixedSizeTuple[2*i];
int size = fixedSizeTuple[2*i+1];
if (ix>=0 && ix<flex->children()) {
@@ -434,7 +442,8 @@ void Flex_Node::write_code2(fld::io::Code_Writer& f) {
f.write_c("%s%s->margin(%d, %d, %d, %d);\n", f.indent(), var, lm, tm, rm, bm);
if (flex->gap())
f.write_c("%s%s->gap(%d);\n", f.indent(), var, flex->gap());
- for (int i=0; i<flex->children(); ++i) {
+ int i;
+ for (i =0; i<flex->children(); ++i) {
Fl_Widget *ci = flex->child(i);
if (flex->fixed(ci))
f.write_c("%s%s->fixed(%s->child(%d), %d);\n", f.indent(), var, var, i,
@@ -489,15 +498,16 @@ void Flex_Node::change_subtype_to(int n) {
int fh = f->h()-dh-tm-bm-(nc*gap);
if (fh<=nc) fh = nc; // avoid division by zero
+ int i;
if (f->type()==Fl_Flex::HORIZONTAL && n==Fl_Flex::VERTICAL) {
float scl = (float)fh/(float)fw;
- for (int i=0; i<nc; i++) {
+ for (i =0; i<nc; i++) {
Fl_Widget* c = f->child(i);
c->size(f->w(), (int)(c->w()*scl));
}
} else if (f->type()==Fl_Flex::VERTICAL && n==Fl_Flex::HORIZONTAL) {
float scl = (float)fw/(float)fh;
- for (int i=0; i<nc; i++) {
+ for (i =0; i<nc; i++) {
Fl_Widget* c = f->child(i);
c->size((int)(c->h()*scl), f->h());
}
@@ -658,8 +668,9 @@ public:
Fl_Table_Proxy(int x, int y, int w, int h, const char *l=0)
: Fl_Table(x, y, w, h, l) {
end();
- for ( int r=0; r<MAX_ROWS; r++ )
- for ( int c=0; c<MAX_COLS; c++ )
+ int r, c;
+ for (r =0; r<MAX_ROWS; r++ )
+ for (c =0; c<MAX_COLS; c++ )
data[r][c] = 1000+(r*1000)+c;
// Rows
rows(MAX_ROWS); // how many rows