summaryrefslogtreecommitdiff
path: root/fluid/nodes/Grid_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/Grid_Node.cxx
parent9575eb0a1ffa8150f70f88b5f6b55f342c3c0088 (diff)
wip
Diffstat (limited to 'fluid/nodes/Grid_Node.cxx')
-rw-r--r--fluid/nodes/Grid_Node.cxx43
1 files changed, 27 insertions, 16 deletions
diff --git a/fluid/nodes/Grid_Node.cxx b/fluid/nodes/Grid_Node.cxx
index d38bbd1ca..6759c33f2 100644
--- a/fluid/nodes/Grid_Node.cxx
+++ b/fluid/nodes/Grid_Node.cxx
@@ -225,7 +225,8 @@ void Fl_Grid_Proxy::transient_make_room_(int n) {
\param[in] w remove the transient cell for this widget
*/
void Fl_Grid_Proxy::transient_remove_(Fl_Widget *w) {
- for (int i=0; i<num_transient_; i++) {
+ int i;
+ for (i =0; i<num_transient_; i++) {
if (transient_[i].widget==w) {
if (transient_[i].cell) {
::free(transient_[i].cell);
@@ -254,7 +255,8 @@ Fl_Grid_Proxy::Cell *Fl_Grid_Proxy::any_cell(Fl_Widget *widget) const {
\return the transient cell, or 0 if it was not found.
*/
Fl_Grid_Proxy::Cell *Fl_Grid_Proxy::transient_cell(Fl_Widget *widget) const {
- for (int i=0; i<num_transient_; i++) {
+ int i;
+ for (i =0; i<num_transient_; i++) {
if (transient_[i].widget == widget)
return transient_[i].cell;
}
@@ -316,13 +318,15 @@ void Grid_Node::copy_properties()
s->gap(&rg, &cg);
d->gap(rg, cg);
// copy col widths, heights, and gaps
- for (int c=0; c<s->cols(); c++) {
+ int c;
+ for (c =0; c<s->cols(); c++) {
d->col_width(c, s->col_width(c));
d->col_gap(c, s->col_gap(c));
d->col_weight(c, s->col_weight(c));
}
// copy row widths, heights, and gaps
- for (int r=0; r<s->rows(); r++) {
+ int r;
+ for (r =0; r<s->rows(); r++) {
d->row_height(r, s->row_height(r));
d->row_gap(r, s->row_gap(r));
d->row_weight(r, s->row_weight(r));
@@ -331,7 +335,8 @@ void Grid_Node::copy_properties()
void Grid_Node::copy_properties_for_children() {
Fl_Grid *d = (Fl_Grid*)live_widget, *s =(Fl_Grid*)o;
- for (int i=0; i<s->children(); i++) {
+ int i;
+ for (i =0; i<s->children(); i++) {
Fl_Grid::Cell *cell = s->cell(s->child(i));
if (cell && i<d->children()) {
d->widget(d->child(i),
@@ -411,6 +416,7 @@ void Grid_Node::write_properties(fld::io::Project_Writer &f)
void Grid_Node::read_property(fld::io::Project_Reader &f, const char *c)
{
Fl_Grid* grid = (Fl_Grid*)o;
+ int i;
if (!strcmp(c,"dimensions")) {
int rows = 3, cols = 3;
if (sscanf(f.read_word(),"%d %d", &rows, &cols) == 2)
@@ -426,32 +432,32 @@ void Grid_Node::read_property(fld::io::Project_Reader &f, const char *c)
} else if (!strcmp(c,"rowheights")) {
int rows = grid->rows();
f.read_word(1); // "{"
- for (int i=0; i<rows; i++) grid->row_height(i, f.read_int());
+ for (i =0; i<rows; i++) grid->row_height(i, f.read_int());
f.read_word(1); // "}"
} else if (!strcmp(c,"rowweights")) {
int rows = grid->rows();
f.read_word(1); // "{"
- for (int i=0; i<rows; i++) grid->row_weight(i, f.read_int());
+ for (i =0; i<rows; i++) grid->row_weight(i, f.read_int());
f.read_word(1); // "}"
} else if (!strcmp(c,"rowgaps")) {
int rows = grid->rows();
f.read_word(1); // "{"
- for (int i=0; i<rows; i++) grid->row_gap(i, f.read_int());
+ for (i =0; i<rows; i++) grid->row_gap(i, f.read_int());
f.read_word(1); // "}"
} else if (!strcmp(c,"colwidths")) {
int cols = grid->cols();
f.read_word(1); // "{"
- for (int i=0; i<cols; i++) grid->col_width(i, f.read_int());
+ for (i =0; i<cols; i++) grid->col_width(i, f.read_int());
f.read_word(1); // "}"
} else if (!strcmp(c,"colweights")) {
int cols = grid->cols();
f.read_word(1); // "{"
- for (int i=0; i<cols; i++) grid->col_weight(i, f.read_int());
+ for (i =0; i<cols; i++) grid->col_weight(i, f.read_int());
f.read_word(1); // "}"
} else if (!strcmp(c,"colgaps")) {
int cols = grid->cols();
f.read_word(1); // "{"
- for (int i=0; i<cols; i++) grid->col_gap(i, f.read_int());
+ for (i =0; i<cols; i++) grid->col_gap(i, f.read_int());
f.read_word(1); // "}"
} else {
super::read_property(f, c);
@@ -612,7 +618,8 @@ void Grid_Node::write_code2(fld::io::Code_Writer& f) {
const char *var = name() ? name() : "o";
Fl_Grid* grid = (Fl_Grid*)o;
bool first_cell = true;
- for (int i=0; i<grid->children(); i++) {
+ int i;
+ for (i =0; i<grid->children(); i++) {
Fl_Widget *c = grid->child(i);
Fl_Grid::Cell *cell = grid->cell(c);
if (cell) {
@@ -694,14 +701,16 @@ void Grid_Node::insert_child_at(Fl_Widget *child, int x, int y) {
int x0 = grid->x() + Fl::box_dx(grid->box()) + ml;
int y0 = grid->y() + Fl::box_dy(grid->box()) + mt;
- for (int r = 0; r < grid->rows(); r++) {
+ int r;
+ for (r = 0; r < grid->rows(); r++) {
if (y>y0) row = r;
int gap = grid->row_gap(r)>=0 ? grid->row_gap(r) : grg;
y0 += grid->computed_row_height(r);
y0 += gap;
}
- for (int c = 0; c < grid->cols(); c++) {
+ int c;
+ for (c = 0; c < grid->cols(); c++) {
if (x>x0) col = c;
int gap = grid->col_gap(c)>=0 ? grid->col_gap(c) : gcg;
x0 += grid->computed_col_width(c);
@@ -732,8 +741,10 @@ void Grid_Node::insert_child_at_next_free_cell(Fl_Widget *child) {
// c = current_cell->col();
// }
// }
- for (int r = 0; r < grid->rows(); r++) {
- for (int c = 0; c < grid->cols(); c++) {
+ int r;
+ for (r = 0; r < grid->rows(); r++) {
+ int c;
+ for (c = 0; c < grid->cols(); c++) {
if (!grid->cell(r, c)) {
grid->move_cell(child, r, c);
return;