summaryrefslogtreecommitdiff
path: root/fluid/nodes/Node.cxx
diff options
context:
space:
mode:
authormaxim nikonov <maxim.nikonov@hqo.co>2026-02-06 02:33:41 +0500
committermaxim nikonov <maxim.nikonov@hqo.co>2026-02-06 02:33:41 +0500
commit43e0a37906afabb0b3b091b8d3eac9a910cae50c (patch)
treed2a037c2bf0dc395fddb08e32ebfcf2795503b7c /fluid/nodes/Node.cxx
parent4ce4967c33d56e4b56d85d11fe0e0be91e159f5d (diff)
wip
Diffstat (limited to 'fluid/nodes/Node.cxx')
-rw-r--r--fluid/nodes/Node.cxx134
1 files changed, 67 insertions, 67 deletions
diff --git a/fluid/nodes/Node.cxx b/fluid/nodes/Node.cxx
index be54ce3a1..2971bad2d 100644
--- a/fluid/nodes/Node.cxx
+++ b/fluid/nodes/Node.cxx
@@ -151,16 +151,16 @@ void print_project_tree() {
*/
bool validate_project_tree() {
// Validate `first` and `last`
- if (Fluid.proj.tree.first == nullptr) {
- if (Fluid.proj.tree.last == nullptr) {
+ if (Fluid.proj.tree.first == 0) {
+ if (Fluid.proj.tree.last == 0) {
return true;
} else {
- fprintf(stderr, "ERROR: `first` is nullptr, but `last` is not!\n");
+ fprintf(stderr, "ERROR: `first` is 0, but `last` is not!\n");
return false;
}
}
- if (Fluid.proj.tree.last == nullptr) {
- fprintf(stderr, "ERROR: `last` is nullptr, but `first` is not!\n");
+ if (Fluid.proj.tree.last == 0) {
+ fprintf(stderr, "ERROR: `last` is 0, but `first` is not!\n");
return false;
}
// Validate the branch linkage, parent links, etc.
@@ -242,9 +242,9 @@ bool validate_branch(class Node *root) {
}
// Validate the `parent` entry
for (Node *p = t->prev; ; p = p->prev) {
- if (p == nullptr) {
- if (t->parent != nullptr) {
- fprintf(stderr, "ERROR: `parent` pointer should be nullptr!\n");
+ if (p == 0) {
+ if (t->parent != 0) {
+ fprintf(stderr, "ERROR: `parent` pointer should be 0!\n");
return false;
}
break;
@@ -264,7 +264,7 @@ bool validate_branch(class Node *root) {
#endif
void select_all_cb(Fl_Widget *,void *) {
- Node *p = Fluid.proj.tree.current ? Fluid.proj.tree.current->parent : nullptr;
+ Node *p = Fluid.proj.tree.current ? Fluid.proj.tree.current->parent : 0;
if (in_this_only) {
Node *t = p;
for (; t && t != in_this_only; t = t->parent) {/*empty*/}
@@ -288,7 +288,7 @@ void select_all_cb(Fl_Widget *,void *) {
}
void select_none_cb(Fl_Widget *,void *) {
- Node *p = Fluid.proj.tree.current ? Fluid.proj.tree.current->parent : nullptr;
+ Node *p = Fluid.proj.tree.current ? Fluid.proj.tree.current->parent : 0;
if (in_this_only) {
Node *t = p;
for (; t && t != in_this_only; t = t->parent) {/*empty*/}
@@ -409,12 +409,12 @@ void delete_all(int selected_only) {
widget_browser->hposition(0);
widget_browser->vposition(0);
}
- Fluid.layout_list.remove_all(FLD_TOOL_STORE_PROJECT);
- Fluid.layout_list.current_suite(0);
- Fluid.layout_list.current_preset(0);
- Fluid.layout_list.update_dialogs();
+ Fluid.layout_list->remove_all(FLD_TOOL_STORE_PROJECT);
+ Fluid.layout_list->current_suite(0);
+ Fluid.layout_list->current_preset(0);
+ Fluid.layout_list->update_dialogs();
}
- selection_changed(nullptr);
+ selection_changed(0);
if (widget_browser) {
if (selected_only)
widget_browser->restore_scroll_position();
@@ -425,7 +425,7 @@ void delete_all(int selected_only) {
/** Update a string.
Replace a string pointer with new value, strips leading/trailing blanks.
As a side effect, this call also sets the mod flags.
- \param[in] n new string, can be nullptr
+ \param[in] n new string, can be 0
\param[out] p update this pointer, possibly reallocate memory
\param[in] nostrip if set, do not strip leading and trailing spaces and tabs
\return 1 if the string in p changed
@@ -439,13 +439,13 @@ int storestring(const char *n, const char * & p, int nostrip) {
const char *e = n + strlen(n);
if (!nostrip) while (e > n && isspace((int)(unsigned char)*(e-1))) e--;
length = int(e-n);
- if (!length) n = nullptr;
+ if (!length) n = 0;
}
if (n == p) return 0;
if (n && p && !strncmp(n,p,length) && !p[length]) return 0;
if (p) free((void *)p);
if (!n || !*n) {
- p = nullptr;
+ p = 0;
} else {
char *q = (char *)malloc(length+1);
strlcpy(q,n,length+1);
@@ -457,7 +457,7 @@ int storestring(const char *n, const char * & p, int nostrip) {
// C++11 version, still using the original to copy all the side effects.
int storestring(const std::string& n, std::string& p, int nostrip) {
- const char *buffer { nullptr };
+ const char *buffer { 0 };
int ret = storestring(n.c_str(), buffer);
if (buffer) {
p = buffer;
@@ -496,12 +496,12 @@ void update_visibility_flag(Node *p) {
*/
/** \var Node *Node::next
Points to the next node in the doubly linked list.
- If this is nullptr, we are at the end of the list.
+ If this is 0, we are at the end of the list.
Used for simulating a tree structure via a doubly linked list.
*/
/** \var Node *Node::prev
Link to the next node in the tree structure.
- If this is nullptr, we are at the beginning of the list.
+ If this is 0, we are at the beginning of the list.
Used for simulating a tree structure via a doubly linked list.
*/
@@ -509,21 +509,21 @@ void update_visibility_flag(Node *p) {
Constructor and base for any node in the widget tree.
*/
Node::Node() :
- name_(nullptr),
- label_(nullptr),
- callback_(nullptr),
- user_data_(nullptr),
- user_data_type_(nullptr),
- comment_(nullptr),
+ name_(0),
+ label_(0),
+ callback_(0),
+ user_data_(0),
+ user_data_type_(0),
+ comment_(0),
uid_(0),
- parent(nullptr),
+ parent(0),
new_selected(0),
selected(0),
folded_(0),
visible(0),
level(0),
- next(nullptr), prev(nullptr),
- factory(nullptr),
+ next(0), prev(0),
+ factory(0),
code_static_start(-1), code_static_end(-1),
code1_start(-1), code1_end(-1),
code2_start(-1), code2_end(-1),
@@ -549,9 +549,9 @@ Node::~Node() {
if (next) next->prev = prev; // else last = prev;
if (Fluid.proj.tree.last == this) Fluid.proj.tree.last = prev;
if (Fluid.proj.tree.first == this) Fluid.proj.tree.first = next;
- if (Fluid.proj.tree.current == this) Fluid.proj.tree.current = nullptr;
- if (current_widget == this) current_widget = nullptr;
- if (current_node == this) current_node = nullptr;
+ if (Fluid.proj.tree.current == this) Fluid.proj.tree.current = 0;
+ if (current_widget == this) current_widget = 0;
+ if (current_node == this) current_node = 0;
if (parent) parent->remove_child(this);
if (name_) free((void*)name_);
if (label_) free((void*)label_);
@@ -561,30 +561,30 @@ Node::~Node() {
if (comment_) free((void*)comment_);
}
-// Return the previous sibling in the tree structure or nullptr.
+// Return the previous sibling in the tree structure or 0.
Node *Node::prev_sibling() {
Node *n;
for (n = prev; n && n->level > level; n = n->prev) ;
if (n && (n->level == level))
return n;
- return nullptr;
+ return 0;
}
-// Return the next sibling in the tree structure or nullptr.
+// Return the next sibling in the tree structure or 0.
Node *Node::next_sibling() {
Node *n;
for (n = next; n && n->level > level; n = n->next) ;
if (n && (n->level == level))
return n;
- return nullptr;
+ return 0;
}
-// Return the first child or nullptr
+// Return the first child or 0
Node *Node::first_child() {
Node *n = next;
if (n->level > level)
return n;
- return nullptr;
+ return 0;
}
// Generate a descriptive text for this item, to put in browser & window titles
@@ -597,28 +597,28 @@ const char* Node::title() {
/**
Return the window that contains this widget.
- \return nullptr if this is not a widget.
+ \return 0 if this is not a widget.
*/
Window_Node *Node::window() {
if (!is_widget())
- return nullptr;
+ return 0;
for (Node *t = this; t; t=t->parent)
if (t->is_a(FLD_NODE_TYPE_Window))
return (Window_Node*)t;
- return nullptr;
+ return 0;
}
/**
Return the group that contains this widget.
- \return nullptr if this is not a widget.
+ \return 0 if this is not a widget.
*/
Group_Node *Node::group() {
if (!is_widget())
- return nullptr;
+ return 0;
for (Node *t = this; t; t=t->parent)
if (t->is_a(FLD_NODE_TYPE_Group))
return (Group_Node*)t;
- return nullptr;
+ return 0;
}
/**
@@ -643,15 +643,15 @@ void Node::add(Node *anchor, Strategy strategy) {
#endif
#endif
- Node *target = nullptr; // insert self before target node, if nullptr, insert last
- Node *target_parent = nullptr; // this will be the new parent for branch
+ Node *target = 0; // insert self before target node, if 0, insert last
+ Node *target_parent = 0; // this will be the new parent for branch
int target_level = 0; // adjust self to this new level
// Find the node after our insertion position
switch (strategy.placement()) {
case Strategy::AS_FIRST_CHILD:
default:
- if (anchor == nullptr) {
+ if (anchor == 0) {
target = Fluid.proj.tree.first;
} else {
target = anchor->next;
@@ -660,7 +660,7 @@ void Node::add(Node *anchor, Strategy strategy) {
}
break;
case Strategy::AS_LAST_CHILD:
- if (anchor == nullptr) {
+ if (anchor == 0) {
/* empty */
} else {
for (target = anchor->next; target && target->level > anchor->level; target = target->next) {/*empty*/}
@@ -669,7 +669,7 @@ void Node::add(Node *anchor, Strategy strategy) {
}
break;
case Strategy::AFTER_CURRENT:
- if (anchor == nullptr) {
+ if (anchor == 0) {
target = Fluid.proj.tree.first;
} else {
for (target = anchor->next; target && target->level > anchor->level; target = target->next) {/*empty*/}
@@ -695,14 +695,14 @@ void Node::add(Node *anchor, Strategy strategy) {
t->parent = target_parent;
}
- // Now link ourselves and our children before 'target', or last, if 'target' is nullptr
+ // Now link ourselves and our children before 'target', or last, if 'target' is 0
if (target) {
prev = target->prev;
target->prev = end;
end->next = target;
} else {
prev = Fluid.proj.tree.last;
- end->next = nullptr;
+ end->next = 0;
Fluid.proj.tree.last = end;
}
if (prev) {
@@ -716,13 +716,13 @@ void Node::add(Node *anchor, Strategy strategy) {
do {
tp->ensure_unique_uid();
tp = tp->next;
- } while (tp!=end && tp!=nullptr);
+ } while (tp!=end && tp!=0);
}
// Give the widgets in our tree a chance to update themselves
for (Node *t = this; t && t!=end->next; t = t->next) {
if (target_parent && (t->level == target_level))
- target_parent->add_child(t, nullptr);
+ target_parent->add_child(t, 0);
update_visibility_flag(t);
}
@@ -769,7 +769,7 @@ void Node::insert(Node *g) {
do {
tp->ensure_unique_uid();
tp = tp->next;
- } while (tp!=end && tp!=nullptr);
+ } while (tp!=end && tp!=0);
}
// tell parent that it has a new child, so it can update itself
if (parent) parent->add_child(this, g);
@@ -783,7 +783,7 @@ int Node::msgnum() {
for (count = 0, p = this; p;) {
if (p->label()) count ++;
- if (p != this && p->is_widget() && !((Widget_Node *)p)->tooltip().empty()) count ++;
+ if (p != this && p->is_widget() && ((Widget_Node *)p)->tooltip() && ((Widget_Node *)p)->tooltip()[0]) count ++;
if (p->prev) p = p->prev;
else p = p->parent;
@@ -799,7 +799,7 @@ int Node::msgnum() {
the widget_browser, so \c Fluid.proj.tree.first and \c Fluid.proj.tree.last do not apply
to it.
- \return the node that follows this node after the operation; can be nullptr
+ \return the node that follows this node after the operation; can be 0
*/
Node *Node::remove() {
// find the last child of this node
@@ -820,13 +820,13 @@ Node *Node::remove() {
else
Fluid.proj.tree.last = prev;
Node *r = end->next;
- prev = end->next = nullptr;
+ prev = end->next = 0;
// allow the parent to update changes in the UI
if (parent) parent->remove_child(this);
- parent = nullptr;
+ parent = 0;
// tell the widget_browser that we removed some nodes
widget_browser->redraw();
- selection_changed(nullptr);
+ selection_changed(0);
return r;
}
@@ -1130,7 +1130,7 @@ void Node::write_comment_inline_c(fld::io::Code_Writer& f, const char *pre)
{
if (comment() && *comment()) {
const char *s = comment();
- if (strchr(s, '\n')==nullptr) {
+ if (strchr(s, '\n')==0) {
// single line comment
if (pre) f.write_c("%s", pre);
f.write_c("// %s\n", s);
@@ -1173,7 +1173,7 @@ void Node::write_comment_inline_c(fld::io::Code_Writer& f, const char *pre)
\see leave_live_mode()
*/
Fl_Widget *Node::enter_live_mode(int) {
- return nullptr;
+ return 0;
}
/**
@@ -1199,7 +1199,7 @@ void Node::copy_properties() {
*/
int Node::user_defined(const char* cbname) const {
for (Node* p = Fluid.proj.tree.first; p ; p = p->next)
- if (p->is_a(FLD_NODE_TYPE_Function) && p->name() != nullptr)
+ if (p->is_a(FLD_NODE_TYPE_Function) && p->name() != 0)
if (strncmp(p->name(), cbname, strlen(cbname)) == 0)
if (p->name()[strlen(cbname)] == '(')
return 1;
@@ -1222,7 +1222,7 @@ const char *Node::callback_name(fld::io::Code_Writer& f) {
\param need_nest if clear, search up one level to the first enclosing class.
If set, recurse all the way up to the top node.
\return the name of the enclosing class, or names of the enclosing classes
- in a static buffe (don't call free), or nullptr if this Type is not inside a class
+ in a static buffe (don't call free), or 0 if this Type is not inside a class
*/
const char* Node::class_name(const int need_nest) const {
Node* p = parent;
@@ -1230,7 +1230,7 @@ const char* Node::class_name(const int need_nest) const {
if (p->is_class()) {
// see if we are nested in another class, we must fully-qualify name:
// this is lame but works...
- const char* q = nullptr;
+ const char* q = 0;
if(need_nest) q=p->class_name(need_nest);
if (q) {
static char s[256];
@@ -1243,7 +1243,7 @@ const char* Node::class_name(const int need_nest) const {
}
p = p->parent;
}
- return nullptr;
+ return 0;
}
/**
@@ -1297,7 +1297,7 @@ unsigned short Node::set_uid(unsigned short suggested_uid) {
}
}
// we are done if we have not fund the suggested id anywhere else
- if (tp==nullptr) {
+ if (tp==0) {
break;
}
// try again with another random number