diff options
Diffstat (limited to 'fluid/nodes/Node.cxx')
| -rw-r--r-- | fluid/nodes/Node.cxx | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/fluid/nodes/Node.cxx b/fluid/nodes/Node.cxx index 8e0041f3c..79bd04b3b 100644 --- a/fluid/nodes/Node.cxx +++ b/fluid/nodes/Node.cxx @@ -133,8 +133,10 @@ Node *in_this_only; // set if menu popped-up in window */ void print_project_tree() { fprintf(stderr, "---- %s --->\n", Fluid.proj.projectfile_name().c_str()); - for (Node *t = Fluid.proj.tree.first; t; t = t->next) { - for (int i = t->level; i > 0; i--) + Node *t; + for (t = Fluid.proj.tree.first; t; t = t->next) { + int i; + for (i = t->level; i > 0; i--) fprintf(stderr, ". "); fprintf(stderr, "%s\n", subclassname(t).c_str()); } @@ -180,7 +182,8 @@ bool validate_project_tree() { bool validate_independent_branch(class Node *root) { // Make sure that `first` and `last` do not point at any node in this branch if (Fluid.proj.tree.first) { - for (Node *t = root; t; t = t->next) { + Node *t; + for (t = root; t; t = t->next) { if (Fluid.proj.tree.first == t) { fprintf(stderr, "ERROR: Branch is not independent, `first` is pointing to branch member!\n"); return false; @@ -188,7 +191,7 @@ bool validate_independent_branch(class Node *root) { } } if (Fluid.proj.tree.last) { - for (Node *t = root; t; t = t->next) { + for (t = root; t; t = t->next) { if (Fluid.proj.tree.last == t) { fprintf(stderr, "ERROR: Branch is not independent, `last` is pointing to branch member!\n"); return false; @@ -216,7 +219,8 @@ bool validate_branch(class Node *root) { return false; } // Check relation between this and next node - for (Node *t = root; t; t = t->next) { + Node *t; + for (t = root; t; t = t->next) { if (t->level < root->level) { fprintf(stderr, "ERROR: Node in tree is above root level!\n"); return false; @@ -241,7 +245,8 @@ bool validate_branch(class Node *root) { } } // Validate the `parent` entry - for (Node *p = t->prev; ; p = p->prev) { + Node *p; + for (p = t->prev; ; p = p->prev) { if (p == 0) { if (t->parent != 0) { fprintf(stderr, "ERROR: `parent` pointer should be 0!\n"); @@ -270,16 +275,17 @@ void select_all_cb(Fl_Widget *,void *) { for (; t && t != in_this_only; t = t->parent) {/*empty*/} if (t != in_this_only) p = in_this_only; } + Node *t; for (;;) { if (p) { int foundany = 0; - for (Node *t = p->next; t && t->level>p->level; t = t->next) { + for (t = p->next; t && t->level>p->level; t = t->next) { if (!t->new_selected) {widget_browser->select(t,1,0); foundany = 1;} } if (foundany) break; p = p->parent; } else { - for (Node *t = Fluid.proj.tree.first; t; t = t->next) + for (t = Fluid.proj.tree.first; t; t = t->next) widget_browser->select(t,1,0); break; } @@ -294,16 +300,17 @@ void select_none_cb(Fl_Widget *,void *) { for (; t && t != in_this_only; t = t->parent) {/*empty*/} if (t != in_this_only) p = in_this_only; } + Node *t; for (;;) { if (p) { int foundany = 0; - for (Node *t = p->next; t && t->level>p->level; t = t->next) { + for (t = p->next; t && t->level>p->level; t = t->next) { if (t->new_selected) {widget_browser->select(t,0,0); foundany = 1;} } if (foundany) break; p = p->parent; } else { - for (Node *t = Fluid.proj.tree.first; t; t = t->next) + for (t = Fluid.proj.tree.first; t; t = t->next) widget_browser->select(t,0,0); break; } @@ -388,7 +395,8 @@ void delete_all(int selected_only) { widget_browser->save_scroll_position(); widget_browser->new_list(); } - for (Node *f = Fluid.proj.tree.first; f;) { + Node *f; + for (f = Fluid.proj.tree.first; f;) { if (f->selected || !selected_only) { delete_children(f); Node *g = f->next; @@ -590,7 +598,8 @@ const char* Node::title() { Window_Node *Node::window() { if (!is_widget()) return 0; - for (Node *t = this; t; t=t->parent) + Node *t; + for (t = this; t; t=t->parent) if (t->is_a(FLD_NODE_TYPE_Window)) return (Window_Node*)t; return 0; @@ -603,7 +612,8 @@ Window_Node *Node::window() { Group_Node *Node::group() { if (!is_widget()) return 0; - for (Node *t = this; t; t=t->parent) + Node *t; + for (t = this; t; t=t->parent) if (t->is_a(FLD_NODE_TYPE_Group)) return (Group_Node*)t; return 0; @@ -677,7 +687,8 @@ void Node::add(Node *anchor, Strategy strategy) { // Walk the tree to update parent pointers and levels int source_level = level; - for (Node *t = this; t; t = t->next) { + Node *t; + for (t = this; t; t = t->next) { t->level += (target_level-source_level); if (t->level == target_level) t->parent = target_parent; @@ -708,7 +719,7 @@ void Node::add(Node *anchor, Strategy strategy) { } // Give the widgets in our tree a chance to update themselves - for (Node *t = this; t && t!=end->next; t = t->next) { + for (t = this; t && t!=end->next; t = t->next) { if (target_parent && (t->level == target_level)) target_parent->add_child(t, 0); update_visibility_flag(t); @@ -744,7 +755,8 @@ void Node::insert(Node *g) { // run the list again to set the future node levels int newlevel = g->level; visible = g->visible; - for (Node *t = this->next; t; t = t->next) t->level += newlevel-level; + Node *t; + for (t = this->next; t; t = t->next) t->level += newlevel-level; level = newlevel; // insert this in the list before g prev = g->prev; @@ -1186,7 +1198,8 @@ void Node::copy_properties() { the parameter types match. */ int Node::user_defined(const char* cbname) const { - for (Node* p = Fluid.proj.tree.first; p ; p = p->next) + Node *p; + for (p = Fluid.proj.tree.first; p ; p = p->next) if (p->is_a(FLD_NODE_TYPE_Function) && p->name() != 0) if (strncmp(p->name(), cbname, strlen(cbname)) == 0) if (p->name()[strlen(cbname)] == '(') |
