summaryrefslogtreecommitdiff
path: root/fluid/nodes
diff options
context:
space:
mode:
authormaxim nikonov <maxim.nikonov@hqo.co>2026-02-05 23:48:25 +0500
committermaxim nikonov <maxim.nikonov@hqo.co>2026-02-05 23:48:25 +0500
commitc53067d2f6cfd6e3c6b476c51ab8c4b931e40a30 (patch)
tree95bfab59b2d9a38a57b6aa05244cab2d0435c7d2 /fluid/nodes
parent57860e277f2298ad6c0830b1492087cfa124c862 (diff)
wip
Diffstat (limited to 'fluid/nodes')
-rw-r--r--fluid/nodes/Button_Node.h24
-rw-r--r--fluid/nodes/Function_Node.cxx10
-rw-r--r--fluid/nodes/Function_Node.h32
-rw-r--r--fluid/nodes/Grid_Node.cxx2
-rw-r--r--fluid/nodes/Grid_Node.h4
-rw-r--r--fluid/nodes/Group_Node.cxx16
-rw-r--r--fluid/nodes/Group_Node.h32
-rw-r--r--fluid/nodes/Menu_Node.cxx62
-rw-r--r--fluid/nodes/Menu_Node.h40
-rw-r--r--fluid/nodes/Node.cxx12
-rw-r--r--fluid/nodes/Node.h50
-rw-r--r--fluid/nodes/Widget_Node.cxx184
-rw-r--r--fluid/nodes/Widget_Node.h4
-rw-r--r--fluid/nodes/Window_Node.cxx46
-rw-r--r--fluid/nodes/Window_Node.h8
-rw-r--r--fluid/nodes/factory.cxx126
16 files changed, 327 insertions, 325 deletions
diff --git a/fluid/nodes/Button_Node.h b/fluid/nodes/Button_Node.h
index ecdc8cc24..53944d6ea 100644
--- a/fluid/nodes/Button_Node.h
+++ b/fluid/nodes/Button_Node.h
@@ -36,8 +36,8 @@ public:
Fl_Widget *widget(int x, int y, int w, int h) override;
Widget_Node *_make() override { return new Button_Node(); }
int is_button() const override { return 1; }
- Type type() const override { return Type::Button; }
- bool is_a(Type inType) const override { return (inType==Type::Button) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Button; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Button) ? true : super::is_a(inType); }
void write_properties(fld::io::Project_Writer &f) override;
void read_property(fld::io::Project_Reader &f, const char *) override;
void copy_properties() override;
@@ -59,8 +59,8 @@ public:
const char *alt_type_name() override { return "fltk::ReturnButton"; }
Fl_Widget *widget(int x, int y, int w, int h) override;
Widget_Node *_make() override { return new Return_Button_Node(); }
- Type type() const override { return Type::Return_Button; }
- bool is_a(Type inType) const override { return (inType==Type::Return_Button) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Return_Button; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Return_Button) ? true : super::is_a(inType); }
};
// ---- Repeat Button ----
@@ -81,8 +81,8 @@ public:
const char *alt_type_name() override { return "fltk::RepeatButton"; }
Fl_Widget *widget(int x, int y, int w, int h) override;
Widget_Node *_make() override { return new Repeat_Button_Node(); }
- Type type() const override { return Type::Repeat_Button; }
- bool is_a(Type inType) const override { return (inType==Type::Repeat_Button) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Repeat_Button; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Repeat_Button) ? true : super::is_a(inType); }
};
// ---- Light Button ----
@@ -101,8 +101,8 @@ public:
const char *alt_type_name() override { return "fltk::LightButton"; }
Fl_Widget *widget(int x, int y, int w, int h) override;
Widget_Node *_make() override { return new Light_Button_Node(); }
- Type type() const override { return Type::Light_Button; }
- bool is_a(Type inType) const override { return (inType==Type::Light_Button) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Light_Button; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Light_Button) ? true : super::is_a(inType); }
};
// ---- Check Button ----
@@ -121,8 +121,8 @@ public:
const char *alt_type_name() override { return "fltk::CheckButton"; }
Fl_Widget *widget(int x, int y, int w, int h) override;
Widget_Node *_make() override { return new Check_Button_Node(); }
- Type type() const override { return Type::Check_Button; }
- bool is_a(Type inType) const override { return (inType==Type::Check_Button) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Check_Button; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Check_Button) ? true : super::is_a(inType); }
};
// ---- Round Button ----
@@ -141,8 +141,8 @@ public:
const char *alt_type_name() override { return "fltk::RadioButton"; }
Fl_Widget *widget(int x, int y, int w, int h) override;
Widget_Node *_make() override { return new Round_Button_Node(); }
- Type type() const override { return Type::Round_Button; }
- bool is_a(Type inType) const override { return (inType==Type::Round_Button) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Round_Button; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Round_Button) ? true : super::is_a(inType); }
};
diff --git a/fluid/nodes/Function_Node.cxx b/fluid/nodes/Function_Node.cxx
index 8404b931e..02f4d75ca 100644
--- a/fluid/nodes/Function_Node.cxx
+++ b/fluid/nodes/Function_Node.cxx
@@ -56,7 +56,7 @@ Class_Node *current_class = nullptr;
int has_toplevel_function(const char *rtype, const char *sig) {
Node *child;
for (child = Fluid.proj.tree.first; child; child = child->next) {
- if (!child->is_in_class() && child->is_a(Type::Function)) {
+ if (!child->is_in_class() && child->is_a(FLD_NODE_TYPE_Function)) {
const Function_Node *fn = (const Function_Node*)child;
if (fn->has_signature(rtype, sig))
return 1;
@@ -451,7 +451,7 @@ void Function_Node::write_code2(fld::io::Code_Writer& f) {
char havechildren = 0;
for (child = next; child && child->level > level; child = child->next) {
havechildren = 1;
- if (child->is_a(Type::Window) && child->name()) var = child->name();
+ if (child->is_a(FLD_NODE_TYPE_Window) && child->name()) var = child->name();
}
if (ismain()) {
@@ -558,9 +558,9 @@ void Code_Node::write_code1(fld::io::Code_Writer& f) {
if ( handle_editor_changes() == 1 ) {
Fluid.main_window->redraw(); // tell fluid to redraw; edits may affect tree's contents
}
- f.tag(Mergeback::Tag::GENERIC, Mergeback::Tag::CODE, 0);
+ f.tag(FLD_MERGEBACK_TAG_GENERIC, FLD_MERGEBACK_TAG_CODE, 0);
f.write_c_indented(name(), 0, '\n');
- f.tag(Mergeback::Tag::CODE, Mergeback::Tag::GENERIC, get_uid());
+ f.tag(FLD_MERGEBACK_TAG_CODE, FLD_MERGEBACK_TAG_GENERIC, get_uid());
}
/**
@@ -1530,7 +1530,7 @@ void Class_Node::write_code2(fld::io::Code_Writer& f) {
int Node::has_function(const char *rtype, const char *sig) const {
Node *child;
for (child = next; child && child->level > level; child = child->next) {
- if (child->level == level+1 && child->is_a(Type::Function)) {
+ if (child->level == level+1 && child->is_a(FLD_NODE_TYPE_Function)) {
const Function_Node *fn = (const Function_Node*)child;
if (fn->has_signature(rtype, sig))
return 1;
diff --git a/fluid/nodes/Function_Node.h b/fluid/nodes/Function_Node.h
index be16e5414..e92f36f80 100644
--- a/fluid/nodes/Function_Node.h
+++ b/fluid/nodes/Function_Node.h
@@ -71,8 +71,8 @@ public:
int can_have_children() const override {return 1;}
int is_code_block() const override {return 1;}
int is_public() const override;
- Type type() const override { return Type::Function; }
- bool is_a(Type inType) const override { return (inType==Type::Function) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Function; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Function) ? true : super::is_a(inType); }
void write_properties(fld::io::Project_Writer &f) override;
void read_property(fld::io::Project_Reader &f, const char *) override;
int has_signature(const char *, const char*) const;
@@ -109,8 +109,8 @@ public:
void open() override;
const char *type_name() override {return "code";}
int is_code_block() const override {return 0;}
- Type type() const override { return Type::Code; }
- bool is_a(Type inType) const override { return (inType==Type::Code) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Code; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Code) ? true : super::is_a(inType); }
int is_public() const override { return -1; }
int is_editing();
int reap_editor();
@@ -146,8 +146,8 @@ public:
int is_code_block() const override {return 1;}
int can_have_children() const override {return 1;}
int is_public() const override { return -1; }
- Type type() const override { return Type::CodeBlock; }
- bool is_a(Type inType) const override { return (inType==Type::CodeBlock) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_CodeBlock; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_CodeBlock) ? true : super::is_a(inType); }
void write_properties(fld::io::Project_Writer &f) override;
void read_property(fld::io::Project_Reader &f, const char *) override;
std::string end_code() const { return end_code_; }
@@ -178,8 +178,8 @@ public:
void write_properties(fld::io::Project_Writer &f) override;
void read_property(fld::io::Project_Reader &f, const char *) override;
int is_public() const override;
- Type type() const override { return Type::Decl; }
- bool is_a(Type inType) const override { return (inType==Type::Decl) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Decl; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Decl) ? true : super::is_a(inType); }
char visibility() { return public_; }
void visibility(char v) { public_ = v; }
char output_file() { return (public_&1)|((static_&1)<<1); }
@@ -209,8 +209,8 @@ public:
const char *type_name() override {return "data";}
void write_properties(fld::io::Project_Writer &f) override;
void read_property(fld::io::Project_Reader &f, const char *) override;
- Type type() const override { return Type::Data; }
- bool is_a(Type inType) const override { return (inType==Type::Data) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Data; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Data) ? true : super::is_a(inType); }
void filename(const std::string& fn) { storestring(fn, filename_); }
std::string filename() const { return filename_; }
int output_format() { return output_format_; }
@@ -251,8 +251,8 @@ public:
int can_have_children() const override {return 1;}
int is_decl_block() const override {return 1;}
int is_public() const override;
- Type type() const override { return Type::DeclBlock; }
- bool is_a(Type inType) const override { return (inType==Type::DeclBlock) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_DeclBlock; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_DeclBlock) ? true : super::is_a(inType); }
std::string end_code() const { return end_code_; }
void end_code(const std::string& p) { storestring(p, end_code_); }
int write_map() { return write_map_; }
@@ -284,8 +284,8 @@ public:
void write_properties(fld::io::Project_Writer &f) override;
void read_property(fld::io::Project_Reader &f, const char *) override;
int is_public() const override { return 1; }
- Type type() const override { return Type::Comment; }
- bool is_a(Type inType) const override { return (inType==Type::Comment) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Comment; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Comment) ? true : super::is_a(inType); }
bool in_h() { return in_h_; }
void in_h(bool v) { in_h_ = v; }
bool in_c() { return in_c_; }
@@ -322,8 +322,8 @@ public:
int is_decl_block() const override {return 1;}
int is_class() const override {return 1;}
int is_public() const override;
- Type type() const override { return Type::Class; }
- bool is_a(Type inType) const override { return (inType==Type::Class) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Class; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Class) ? true : super::is_a(inType); }
void write_properties(fld::io::Project_Writer &f) override;
void read_property(fld::io::Project_Reader &f, const char *) override;
diff --git a/fluid/nodes/Grid_Node.cxx b/fluid/nodes/Grid_Node.cxx
index 06f6d4166..2304a7a10 100644
--- a/fluid/nodes/Grid_Node.cxx
+++ b/fluid/nodes/Grid_Node.cxx
@@ -676,7 +676,7 @@ void Grid_Node::child_resized(Widget_Node *child_type) {
/** Return the currently selected Grid widget if is a Grid Type. */
Fl_Grid *Grid_Node::selected() {
- if (current_widget && current_widget->is_a(Type::Grid))
+ if (current_widget && current_widget->is_a(FLD_NODE_TYPE_Grid))
return ((Fl_Grid*)((Grid_Node*)current_widget)->o);
return nullptr;
}
diff --git a/fluid/nodes/Grid_Node.h b/fluid/nodes/Grid_Node.h
index 4363164ee..706791d98 100644
--- a/fluid/nodes/Grid_Node.h
+++ b/fluid/nodes/Grid_Node.h
@@ -55,8 +55,8 @@ public:
const char *alt_type_name() override {return "fltk::GridGroup";}
Widget_Node *_make() override { return new Grid_Node(); }
Fl_Widget *widget(int X,int Y,int W,int H) override;
- Type type() const override { return Type::Grid; }
- bool is_a(Type inType) const override { return (inType==Type::Grid) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Grid; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Grid) ? true : super::is_a(inType); }
void write_properties(fld::io::Project_Writer &f) override;
void read_property(fld::io::Project_Reader &f, const char *) override;
void write_parent_properties(fld::io::Project_Writer &f, Node *child, bool encapsulate) override;
diff --git a/fluid/nodes/Group_Node.cxx b/fluid/nodes/Group_Node.cxx
index 7565a5552..088e999aa 100644
--- a/fluid/nodes/Group_Node.cxx
+++ b/fluid/nodes/Group_Node.cxx
@@ -73,7 +73,7 @@ void Fl_Group_Proxy::draw() {
\brief Enlarge the group size, so all children fit within.
*/
void fix_group_size(Node *tt) {
- if (!tt || !tt->is_a(Type::Group)) return;
+ if (!tt || !tt->is_a(FLD_NODE_TYPE_Group)) return;
Group_Node* t = (Group_Node*)tt;
int X = t->o->x();
int Y = t->o->y();
@@ -102,14 +102,14 @@ void group_cb(Fl_Widget *, void *) {
fl_message("Only widgets and menu items can be grouped.");
return;
}
- if (Fluid.proj.tree.current->is_a(Type::Menu_Item)) {
+ if (Fluid.proj.tree.current->is_a(FLD_NODE_TYPE_Menu_Item)) {
group_selected_menuitems();
return;
}
// The group will be created in the parent group of the current widget
Node *qq = Fluid.proj.tree.current->parent;
Widget_Node *q = static_cast<Widget_Node*>(Fluid.proj.tree.current);
- while (qq && !qq->is_a(Type::Group)) {
+ while (qq && !qq->is_a(FLD_NODE_TYPE_Group)) {
qq = qq->parent;
}
if (!qq) {
@@ -150,7 +150,7 @@ void ungroup_cb(Fl_Widget *, void *) {
fl_message("Only widgets and menu items can be ungrouped.");
return;
}
- if (Fluid.proj.tree.current->is_a(Type::Menu_Item)) {
+ if (Fluid.proj.tree.current->is_a(FLD_NODE_TYPE_Menu_Item)) {
ungroup_selected_menuitems();
return;
}
@@ -159,7 +159,7 @@ void ungroup_cb(Fl_Widget *, void *) {
int q_level = q->level;
Node *qq = Fluid.proj.tree.current->parent;
while (qq && !qq->is_true_widget()) qq = qq->parent;
- if (!qq || !qq->is_a(Type::Group)) {
+ if (!qq || !qq->is_a(FLD_NODE_TYPE_Group)) {
fl_message("Only menu widgets inside a group can be ungrouped.");
return;
}
@@ -510,7 +510,7 @@ void Flex_Node::change_subtype_to(int n) {
int Flex_Node::parent_is_flex(Node *t) {
return (t->is_widget()
&& t->parent
- && t->parent->is_a(Type::Flex));
+ && t->parent->is_a(FLD_NODE_TYPE_Flex));
}
/**
@@ -576,7 +576,7 @@ void Flex_Node::keyboard_move_child(Widget_Node *child, int key) {
int Flex_Node::size(Node *t, char fixed_only) {
if (!t->is_widget()) return 0;
if (!t->parent) return 0;
- if (!t->parent->is_a(Type::Flex)) return 0;
+ if (!t->parent->is_a(FLD_NODE_TYPE_Flex)) return 0;
Flex_Node* ft = (Flex_Node*)t->parent;
Fl_Flex* f = (Fl_Flex*)ft->o;
Fl_Widget *w = ((Widget_Node*)t)->o;
@@ -587,7 +587,7 @@ int Flex_Node::size(Node *t, char fixed_only) {
int Flex_Node::is_fixed(Node *t) {
if (!t->is_widget()) return 0;
if (!t->parent) return 0;
- if (!t->parent->is_a(Type::Flex)) return 0;
+ if (!t->parent->is_a(FLD_NODE_TYPE_Flex)) return 0;
Flex_Node* ft = (Flex_Node*)t->parent;
Fl_Flex* f = (Fl_Flex*)ft->o;
Fl_Widget *w = ((Widget_Node*)t)->o;
diff --git a/fluid/nodes/Group_Node.h b/fluid/nodes/Group_Node.h
index 1aea39df5..52f31a907 100644
--- a/fluid/nodes/Group_Node.h
+++ b/fluid/nodes/Group_Node.h
@@ -62,8 +62,8 @@ public:
void move_child(Node*, Node*) override;
void remove_child(Node*) override;
int can_have_children() const override {return 1;}
- Type type() const override { return Type::Group; }
- bool is_a(Type inType) const override { return (inType==Type::Group) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Group; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Group) ? true : super::is_a(inType); }
Fl_Widget *enter_live_mode(int top=0) override;
void leave_live_mode() override;
void copy_properties() override;
@@ -85,8 +85,8 @@ public:
const char *type_name() override {return pack_type_name;}
const char *alt_type_name() override {return "fltk::PackedGroup";}
Widget_Node *_make() override {return new Pack_Node();}
- Type type() const override { return Type::Pack; }
- bool is_a(Type inType) const override { return (inType==Type::Pack) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Pack; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Pack) ? true : super::is_a(inType); }
Fl_Widget *enter_live_mode(int top=0) override;
void copy_properties() override;
};
@@ -120,8 +120,8 @@ public:
Widget_Node *_make() override { return new Flex_Node(); }
Fl_Widget *widget(int X,int Y,int W,int H) override {
Fl_Flex *g = new Fl_Flex_Proxy(X,Y,W,H); Fl_Group::current(nullptr); return g;}
- Type type() const override { return Type::Flex; }
- bool is_a(Type inType) const override { return (inType==Type::Flex) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Flex; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Flex) ? true : super::is_a(inType); }
void write_properties(fld::io::Project_Writer &f) override;
void read_property(fld::io::Project_Reader &f, const char *) override;
Fl_Widget *enter_live_mode(int top=0) override;
@@ -154,8 +154,8 @@ public:
const char *alt_type_name() override { return "fltk::TableGroup"; }
Widget_Node *_make() override { return new Table_Node(); }
Fl_Widget *widget(int X, int Y, int W, int H) override;
- Type type() const override { return Type::Table; }
- bool is_a(Type inType) const override { return (inType==Type::Table) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Table; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Table) ? true : super::is_a(inType); }
Fl_Widget *enter_live_mode(int top=0) override;
void add_child(Node*, Node*) override;
void move_child(Node*, Node*) override;
@@ -187,8 +187,8 @@ public:
Node* click_test(int,int) override;
void add_child(Node*, Node*) override;
void remove_child(Node*) override;
- Type type() const override { return Type::Tabs; }
- bool is_a(Type inType) const override { return (inType==Type::Tabs) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Tabs; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Tabs) ? true : super::is_a(inType); }
Fl_Widget *enter_live_mode(int top=0) override;
};
@@ -208,8 +208,8 @@ public:
const char *type_name() override {return scroll_type_name;}
const char *alt_type_name() override {return "fltk::ScrollGroup";}
Widget_Node *_make() override {return new Scroll_Node();}
- Type type() const override { return Type::Scroll; }
- bool is_a(Type inType) const override { return (inType==Type::Scroll) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Scroll; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Scroll) ? true : super::is_a(inType); }
Fl_Widget *enter_live_mode(int top=0) override;
void copy_properties() override;
};
@@ -227,8 +227,8 @@ public:
const char *type_name() override {return tile_type_name;}
const char *alt_type_name() override {return "fltk::TileGroup";}
Widget_Node *_make() override {return new Tile_Node();}
- Type type() const override { return Type::Tile; }
- bool is_a(Type inType) const override { return (inType==Type::Tile) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Tile; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Tile) ? true : super::is_a(inType); }
Fl_Widget *enter_live_mode(int top=0) override;
void leave_live_mode() override;
void copy_properties() override;
@@ -256,8 +256,8 @@ public:
Fl_Widget *widget(int X,int Y,int W,int H) override {
Fl_Wizard_Proxy *g = new Fl_Wizard_Proxy(X,Y,W,H); Fl_Group::current(nullptr); return g;}
Widget_Node *_make() override {return new Wizard_Node();}
- Type type() const override { return Type::Wizard; }
- bool is_a(Type inType) const override { return (inType==Type::Wizard) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Wizard; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Wizard) ? true : super::is_a(inType); }
};
#endif // FLUID_NODES_GROUP_NODE_H
diff --git a/fluid/nodes/Menu_Node.cxx b/fluid/nodes/Menu_Node.cxx
index b29fb8293..e0f1c11ee 100644
--- a/fluid/nodes/Menu_Node.cxx
+++ b/fluid/nodes/Menu_Node.cxx
@@ -135,7 +135,7 @@ void Input_Choice_Node::build_menu() {
if (q->can_have_children()) {lvl++; m->flags |= FL_SUBMENU;}
m++;
int l1 =
- (q->next && q->next->is_a(Type::Menu_Item)) ? q->next->level : level;
+ (q->next && q->next->is_a(FLD_NODE_TYPE_Menu_Item)) ? q->next->level : level;
while (lvl > l1) {m->label(nullptr); m++; lvl--;}
lvl = l1;
}
@@ -163,7 +163,7 @@ Node* Menu_Item_Node::make(int flags, Strategy strategy) {
Node *anchor = Fluid.proj.tree.current, *p = anchor;
if (p && (strategy.placement() == Strategy::AFTER_CURRENT))
p = p->parent;
- while (p && !(p->is_a(Type::Menu_Manager_) || p->is_a(Type::Submenu))) {
+ while (p && !(p->is_a(FLD_NODE_TYPE_Menu_Manager_) || p->is_a(FLD_NODE_TYPE_Submenu))) {
anchor = p;
strategy.placement(Strategy::AFTER_CURRENT);
p = p->parent;
@@ -198,12 +198,12 @@ Node* Menu_Item_Node::make(int flags, Strategy strategy) {
void group_selected_menuitems() {
// The group will be created in the parent group of the current menuitem
- if (!Fluid.proj.tree.current->is_a(Type::Menu_Item)) {
+ if (!Fluid.proj.tree.current->is_a(FLD_NODE_TYPE_Menu_Item)) {
return;
}
Menu_Item_Node *q = static_cast<Menu_Item_Node*>(Fluid.proj.tree.current);
Node *qq = Fluid.proj.tree.current->parent;
- if (!qq || !(qq->is_a(Type::Menu_Manager_) || qq->is_a(Type::Submenu))) {
+ if (!qq || !(qq->is_a(FLD_NODE_TYPE_Menu_Manager_) || qq->is_a(FLD_NODE_TYPE_Submenu))) {
fl_message("Can't create a new submenu here.");
return;
}
@@ -229,7 +229,7 @@ void ungroup_selected_menuitems() {
Node *qq = Fluid.proj.tree.current->parent;
Widget_Node *q = static_cast<Widget_Node*>(Fluid.proj.tree.current);
int q_level = q->level;
- if (!qq || !qq->is_a(Type::Submenu)) {
+ if (!qq || !qq->is_a(FLD_NODE_TYPE_Submenu)) {
fl_message("Only menu items inside a submenu can be ungrouped.");
return;
}
@@ -305,7 +305,7 @@ int isdeclare(const char *c);
const char* Menu_Item_Node::menu_name(fld::io::Code_Writer& f, int& i) {
i = 0;
Node* t = prev;
- while (t && t->is_a(Type::Menu_Item)) {
+ while (t && t->is_a(FLD_NODE_TYPE_Menu_Item)) {
// be sure to count the {0} that ends a submenu:
if (t->level > t->next->level) i += (t->level - t->next->level);
// detect empty submenu:
@@ -352,7 +352,7 @@ void Menu_Item_Node::write_static(fld::io::Code_Writer& f) {
f.write_c(", %s", ut);
if (use_v) f.write_c(" v");
f.write_c(") {\n");
- f.tag(Mergeback::Tag::GENERIC, Mergeback::Tag::MENU_CALLBACK, 0);
+ f.tag(FLD_MERGEBACK_TAG_GENERIC, FLD_MERGEBACK_TAG_MENU_CALLBACK, 0);
f.write_c_indented(callback(), 1, 0);
if (*(d-1) != ';' && *(d-1) != '}') {
const char *p = strrchr(callback(), '\n');
@@ -363,7 +363,7 @@ void Menu_Item_Node::write_static(fld::io::Code_Writer& f) {
if (*p != '#' && *p) f.write_c(";");
}
f.write_c("\n");
- f.tag(Mergeback::Tag::MENU_CALLBACK, Mergeback::Tag::GENERIC, get_uid());
+ f.tag(FLD_MERGEBACK_TAG_MENU_CALLBACK, FLD_MERGEBACK_TAG_GENERIC, get_uid());
f.write_c("}\n");
// If the menu item is part of a Class or Widget Class, FLUID generates
@@ -374,12 +374,12 @@ void Menu_Item_Node::write_static(fld::io::Code_Writer& f) {
// Implement the callback as a static member function
f.write_c("void %s::%s(Fl_Menu_* o, %s v) {\n", k, cn, ut);
// Find the Fl_Menu_ container for this menu item
- Node* t = parent; while (t->is_a(Type::Menu_Item)) t = t->parent;
+ Node* t = parent; while (t->is_a(FLD_NODE_TYPE_Menu_Item)) t = t->parent;
if (t) {
Widget_Node *tw = (t->is_widget()) ? static_cast<Widget_Node*>(t) : nullptr;
Node *q = nullptr;
// Generate code to call the callback
- if (tw->is_a(Type::Menu_Bar) && ((Menu_Bar_Node*)tw)->is_sys_menu_bar()) {
+ if (tw->is_a(FLD_NODE_TYPE_Menu_Bar) && ((Menu_Bar_Node*)tw)->is_sys_menu_bar()) {
// Fl_Sys_Menu_Bar removes itself from any parent on macOS, so we
// wrapped it in a class and remeber the parent class in a new
// class memeber variable.
@@ -393,7 +393,7 @@ void Menu_Item_Node::write_static(fld::io::Code_Writer& f) {
} else {
f.write_c("%s((%s*)(o", f.indent(1), k);
// The class pointer is in the user_data field of the top widget
- if (t && t->is_a(Type::Input_Choice)) {
+ if (t && t->is_a(FLD_NODE_TYPE_Input_Choice)) {
// Go up one more level for Fl_Input_Choice, as these are groups themselves
f.write_c("->parent()");
}
@@ -401,7 +401,7 @@ void Menu_Item_Node::write_static(fld::io::Code_Writer& f) {
for (t = t->parent; t && t->is_widget() && !is_class(); q = t, t = t->parent)
f.write_c("->parent()");
// user_data is cast into a pointer to the
- if (!q || !q->is_a(Type::Widget_Class))
+ if (!q || !q->is_a(FLD_NODE_TYPE_Widget_Class))
f.write_c("->user_data()");
f.write_c("))->%s_i(o,v);\n}\n", cn);
}
@@ -414,7 +414,7 @@ void Menu_Item_Node::write_static(fld::io::Code_Writer& f) {
if (!f.c_contains(image))
image->write_static(f, compress_image_);
}
- if (next && next->is_a(Type::Menu_Item)) return;
+ if (next && next->is_a(FLD_NODE_TYPE_Menu_Item)) return;
// okay, when we hit last item in the menu we have to write the
// entire array out:
const char* k = class_name(1);
@@ -425,20 +425,20 @@ void Menu_Item_Node::write_static(fld::io::Code_Writer& f) {
int i;
f.write_c("\nFl_Menu_Item %s[] = {\n", menu_name(f, i));
}
- Node* t = prev; while (t && t->is_a(Type::Menu_Item)) t = t->prev;
- for (Node* q = t->next; q && q->is_a(Type::Menu_Item); q = q->next) {
+ Node* t = prev; while (t && t->is_a(FLD_NODE_TYPE_Menu_Item)) t = t->prev;
+ for (Node* q = t->next; q && q->is_a(FLD_NODE_TYPE_Menu_Item); q = q->next) {
((Menu_Item_Node*)q)->write_item(f);
int thislevel = q->level; if (q->can_have_children()) thislevel++;
int nextlevel =
- (q->next && q->next->is_a(Type::Menu_Item)) ? q->next->level : t->level+1;
+ (q->next && q->next->is_a(FLD_NODE_TYPE_Menu_Item)) ? q->next->level : t->level+1;
while (thislevel > nextlevel) {f.write_c(" {0,0,0,0,0,0,0,0,0},\n"); thislevel--;}
}
f.write_c(" {0,0,0,0,0,0,0,0,0}\n};\n");
if (k) {
// Write menu item variables...
- t = prev; while (t && t->is_a(Type::Menu_Item)) t = t->prev;
- for (Node* q = t->next; q && q->is_a(Type::Menu_Item); q = q->next) {
+ t = prev; while (t && t->is_a(FLD_NODE_TYPE_Menu_Item)) t = t->prev;
+ for (Node* q = t->next; q && q->is_a(FLD_NODE_TYPE_Menu_Item); q = q->next) {
Menu_Item_Node *m = (Menu_Item_Node*)q;
const char *c = array_name(m);
if (c) {
@@ -487,13 +487,13 @@ void Menu_Item_Node::write_item(fld::io::Code_Writer& f) {
f.write_c(" {");
if (label() && label()[0])
switch (Fluid.proj.i18n.type) {
- case fld::I18n_Type::GNU:
+ case FLD_I18N_TYPE_GNU:
// we will call i18n when the menu is instantiated for the first time
f.write_c("%s(", Fluid.proj.i18n.gnu_static_function.c_str());
f.write_cstring(label());
f.write_c(")");
break;
- case fld::I18n_Type::POSIX:
+ case FLD_I18N_TYPE_POSIX:
// fall through: strings can't be translated before a catalog is chosen
default:
f.write_cstring(label());
@@ -522,10 +522,10 @@ void Menu_Item_Node::write_item(fld::io::Code_Writer& f) {
if (callback()) {
if (callback()[0] == '[') {
f.write_c("\n");
- f.tag(Mergeback::Tag::GENERIC, Mergeback::Tag::WIDGET_CALLBACK, 0);
+ f.tag(FLD_MERGEBACK_TAG_GENERIC, FLD_MERGEBACK_TAG_WIDGET_CALLBACK, 0);
f.write_c_indented(callback(), 1, 0);
f.write_c("\n");
- f.tag(Mergeback::Tag::WIDGET_CALLBACK, Mergeback::Tag::GENERIC, get_uid());
+ f.tag(FLD_MERGEBACK_TAG_WIDGET_CALLBACK, FLD_MERGEBACK_TAG_GENERIC, get_uid());
f.write_c("%s, ", f.indent_plus(1));
} else {
const char* k = is_name(callback()) ? nullptr : class_name(1);
@@ -557,7 +557,7 @@ void start_menu_initialiser(fld::io::Code_Writer& f, int &initialized, const cha
void Menu_Item_Node::write_code1(fld::io::Code_Writer& f) {
int i; const char* mname = menu_name(f, i);
- if (!prev->is_a(Type::Menu_Item)) {
+ if (!prev->is_a(FLD_NODE_TYPE_Menu_Item)) {
// for first menu item, declare the array
if (class_name(1)) {
f.write_h("%sstatic Fl_Menu_Item %s[];\n", f.indent(1), mname);
@@ -601,12 +601,12 @@ void Menu_Item_Node::write_code1(fld::io::Code_Writer& f) {
f.write_c("%sml->labela = (char*)", f.indent());
image->write_inline(f);
f.write_c(";\n");
- if (Fluid.proj.i18n.type==fld::I18n_Type::NONE) {
+ if (Fluid.proj.i18n.type==FLD_I18N_TYPE_NONE) {
f.write_c("%sml->labelb = o->label();\n", f.indent());
- } else if (Fluid.proj.i18n.type==fld::I18n_Type::GNU) {
+ } else if (Fluid.proj.i18n.type==FLD_I18N_TYPE_GNU) {
f.write_c("%sml->labelb = %s(o->label());\n",
f.indent(), Fluid.proj.i18n.gnu_function.c_str());
- } else if (Fluid.proj.i18n.type==fld::I18n_Type::POSIX) {
+ } else if (Fluid.proj.i18n.type==FLD_I18N_TYPE_POSIX) {
f.write_c("%sml->labelb = catgets(%s,%s,i+%d,o->label());\n",
f.indent(),
Fluid.proj.i18n.posix_file.empty() ? "_catalog" : Fluid.proj.i18n.posix_file.c_str(),
@@ -619,17 +619,17 @@ void Menu_Item_Node::write_code1(fld::io::Code_Writer& f) {
image->write_code(f, 0, "o");
}
}
- if ((Fluid.proj.i18n.type != fld::I18n_Type::NONE) && label() && label()[0]) {
+ if ((Fluid.proj.i18n.type != FLD_I18N_TYPE_NONE) && label() && label()[0]) {
Fl_Labeltype t = o->labeltype();
if (image) {
// label was already copied a few lines up
} else if ( t==FL_NORMAL_LABEL || t==FL_SHADOW_LABEL
|| t==FL_ENGRAVED_LABEL || t==FL_EMBOSSED_LABEL) {
start_menu_initialiser(f, menuItemInitialized, mname, i);
- if (Fluid.proj.i18n.type==fld::I18n_Type::GNU) {
+ if (Fluid.proj.i18n.type==FLD_I18N_TYPE_GNU) {
f.write_c("%so->label(%s(o->label()));\n",
f.indent(), Fluid.proj.i18n.gnu_function.c_str());
- } else if (Fluid.proj.i18n.type==fld::I18n_Type::POSIX) {
+ } else if (Fluid.proj.i18n.type==FLD_I18N_TYPE_POSIX) {
f.write_c("%so->label(catgets(%s,%s,i+%d,o->label()));\n",
f.indent(),
Fluid.proj.i18n.posix_file.empty() ? "_catalog" : Fluid.proj.i18n.posix_file.c_str(),
@@ -714,7 +714,7 @@ void Menu_Base_Node::build_menu() {
if (q->can_have_children()) {lvl++; m->flags |= FL_SUBMENU;}
m++;
int l1 =
- (q->next && q->next->is_a(Type::Menu_Item)) ? q->next->level : level;
+ (q->next && q->next->is_a(FLD_NODE_TYPE_Menu_Item)) ? q->next->level : level;
while (lvl > l1) {m->label(nullptr); m++; lvl--;}
lvl = l1;
}
@@ -742,7 +742,7 @@ Node* Menu_Base_Node::click_test(int, int) {
}
void Menu_Manager_Node::write_code2(fld::io::Code_Writer& f) {
- if (next && next->is_a(Type::Menu_Item)) {
+ if (next && next->is_a(FLD_NODE_TYPE_Menu_Item)) {
f.write_c("%s%s->menu(%s);\n", f.indent(), name() ? name() : "o",
f.unique_id(this, "menu", name(), label()));
}
diff --git a/fluid/nodes/Menu_Node.h b/fluid/nodes/Menu_Node.h
index 181ab8243..4bf27ed34 100644
--- a/fluid/nodes/Menu_Node.h
+++ b/fluid/nodes/Menu_Node.h
@@ -67,8 +67,8 @@ public:
void write_code1(fld::io::Code_Writer& f) override;
void write_code2(fld::io::Code_Writer& f) override;
int is_true_widget() const override { return 0; }
- Type type() const override { return Type::Menu_Item; }
- bool is_a(Type inType) const override { return (inType==Type::Menu_Item) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Menu_Item; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Menu_Item) ? true : super::is_a(inType); }
};
/**
@@ -82,8 +82,8 @@ public:
public:
const char* type_name() override {return "RadioMenuItem";}
Node* make(Strategy strategy) override;
- Type type() const override { return Type::Radio_Menu_Item; }
- bool is_a(Type inType) const override { return (inType==Type::Radio_Menu_Item) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Radio_Menu_Item; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Radio_Menu_Item) ? true : super::is_a(inType); }
};
/**
@@ -97,8 +97,8 @@ public:
public:
const char* type_name() override {return "CheckMenuItem";}
Node* make(Strategy strategy) override;
- Type type() const override { return Type::Checkbox_Menu_Item; }
- bool is_a(Type inType) const override { return (inType==Type::Checkbox_Menu_Item) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Checkbox_Menu_Item; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Checkbox_Menu_Item) ? true : super::is_a(inType); }
};
/**
@@ -125,8 +125,8 @@ public:
void add_child(Node*a, Node*b) override {parent->add_child(a,b);}
void move_child(Node*a, Node*b) override {parent->move_child(a,b);}
void remove_child(Node*a) override {parent->remove_child(a);}
- Type type() const override { return Type::Submenu; }
- bool is_a(Type inType) const override { return (inType==Type::Submenu) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Submenu; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Submenu) ? true : super::is_a(inType); }
};
// -----------------------------------------------------------------------------
@@ -156,8 +156,8 @@ public:
Node* click_test(int x, int y) override = 0;
void write_code2(fld::io::Code_Writer& f) override;
void copy_properties() override = 0;
- Type type() const override { return Type::Menu_Manager_; }
- bool is_a(Type inType) const override { return (inType==Type::Menu_Manager_) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Menu_Manager_; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Menu_Manager_) ? true : super::is_a(inType); }
};
/**
@@ -198,8 +198,8 @@ public:
}
Widget_Node *_make() override {return new Input_Choice_Node();}
void build_menu() override;
- Type type() const override { return Type::Input_Choice; }
- bool is_a(Type inType) const override { return (inType==Type::Input_Choice) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Input_Choice; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Input_Choice) ? true : super::is_a(inType); }
void copy_properties() override;
};
@@ -228,8 +228,8 @@ public:
}
Node* click_test(int x, int y) override;
void copy_properties() override;
- Type type() const override { return Type::Menu_; }
- bool is_a(Type inType) const override { return (inType==Type::Menu_) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Menu_; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Menu_) ? true : super::is_a(inType); }
};
extern Fl_Menu_Item button_type_menu[];
@@ -250,8 +250,8 @@ public:
Fl_Widget *widget(int X,int Y,int W,int H) override {
return new Fl_Menu_Button(X,Y,W,H,"menu");}
Widget_Node *_make() override {return new Menu_Button_Node();}
- Type type() const override { return Type::Menu_Button; }
- bool is_a(Type inType) const override { return (inType==Type::Menu_Button) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Menu_Button; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Menu_Button) ? true : super::is_a(inType); }
};
@@ -272,8 +272,8 @@ public:
return myo;
}
Widget_Node *_make() override {return new Choice_Node();}
- Type type() const override { return Type::Choice; }
- bool is_a(Type inType) const override { return (inType==Type::Choice) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Choice; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Choice) ? true : super::is_a(inType); }
};
@@ -297,8 +297,8 @@ public:
void write_static(fld::io::Code_Writer& f) override;
void write_code1(fld::io::Code_Writer& f) override;
// void write_code2(fld::io::Code_Writer& f) override;
- Type type() const override { return Type::Menu_Bar; }
- bool is_a(Type inType) const override { return (inType==Type::Menu_Bar) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Menu_Bar; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Menu_Bar) ? true : super::is_a(inType); }
bool is_sys_menu_bar();
std::string sys_menubar_name() const;
const char *sys_menubar_proxy_name();
diff --git a/fluid/nodes/Node.cxx b/fluid/nodes/Node.cxx
index 61d736f83..be54ce3a1 100644
--- a/fluid/nodes/Node.cxx
+++ b/fluid/nodes/Node.cxx
@@ -401,7 +401,7 @@ void delete_all(int selected_only) {
if(!selected_only) {
// reset the setting for the external shell command
if (g_shell_config) {
- g_shell_config->clear(fld::Tool_Store::PROJECT);
+ g_shell_config->clear(FLD_TOOL_STORE_PROJECT);
g_shell_config->rebuild_shell_menu();
g_shell_config->update_settings_dialog();
}
@@ -409,7 +409,7 @@ 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.remove_all(FLD_TOOL_STORE_PROJECT);
Fluid.layout_list.current_suite(0);
Fluid.layout_list.current_preset(0);
Fluid.layout_list.update_dialogs();
@@ -603,7 +603,7 @@ Window_Node *Node::window() {
if (!is_widget())
return nullptr;
for (Node *t = this; t; t=t->parent)
- if (t->is_a(Type::Window))
+ if (t->is_a(FLD_NODE_TYPE_Window))
return (Window_Node*)t;
return nullptr;
}
@@ -616,7 +616,7 @@ Group_Node *Node::group() {
if (!is_widget())
return nullptr;
for (Node *t = this; t; t=t->parent)
- if (t->is_a(Type::Group))
+ if (t->is_a(FLD_NODE_TYPE_Group))
return (Group_Node*)t;
return nullptr;
}
@@ -831,7 +831,7 @@ Node *Node::remove() {
}
void Node::name(const char *n) {
- int nostrip = is_a(Type::Comment);
+ int nostrip = is_a(FLD_NODE_TYPE_Comment);
if (storestring(n,name_,nostrip)) {
if (visible) widget_browser->redraw();
}
@@ -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(Type::Function) && p->name() != nullptr)
+ if (p->is_a(FLD_NODE_TYPE_Function) && p->name() != nullptr)
if (strncmp(p->name(), cbname, strlen(cbname)) == 0)
if (p->name()[strlen(cbname)] == '(')
return 1;
diff --git a/fluid/nodes/Node.h b/fluid/nodes/Node.h
index 900addc6b..1c94e493d 100644
--- a/fluid/nodes/Node.h
+++ b/fluid/nodes/Node.h
@@ -79,38 +79,40 @@ typedef struct Strategy {
Flags source() { return (Flags)(flags & SOURCE_MASK); }
} Strategy;
-enum class Type {
+typedef int NodeType;
+enum {
// administrative
- Base_, Widget_, Menu_Manager_, Menu_, Browser_, Valuator_,
+ FLD_NODE_TYPE_Base_, FLD_NODE_TYPE_Widget_, FLD_NODE_TYPE_Menu_Manager_, FLD_NODE_TYPE_Menu_, FLD_NODE_TYPE_Browser_, FLD_NODE_TYPE_Valuator_,
// non-widget
- Function, Code, CodeBlock,
- Decl, DeclBlock, Class,
- Widget_Class, Comment, Data,
+ FLD_NODE_TYPE_Function, FLD_NODE_TYPE_Code, FLD_NODE_TYPE_CodeBlock,
+ FLD_NODE_TYPE_Decl, FLD_NODE_TYPE_DeclBlock, FLD_NODE_TYPE_Class,
+ FLD_NODE_TYPE_Widget_Class, FLD_NODE_TYPE_Comment, FLD_NODE_TYPE_Data,
// groups
- Window, Group, Pack,
- Flex, Tabs, Scroll,
- Tile, Wizard, Grid,
+ FLD_NODE_TYPE_Window, FLD_NODE_TYPE_Group, FLD_NODE_TYPE_Pack,
+ FLD_NODE_TYPE_Flex, FLD_NODE_TYPE_Tabs, FLD_NODE_TYPE_Scroll,
+ FLD_NODE_TYPE_Tile, FLD_NODE_TYPE_Wizard, FLD_NODE_TYPE_Grid,
// buttons
- Button, Return_Button, Light_Button,
- Check_Button, Repeat_Button, Round_Button,
+ FLD_NODE_TYPE_Button, FLD_NODE_TYPE_Return_Button, FLD_NODE_TYPE_Light_Button,
+ FLD_NODE_TYPE_Check_Button, FLD_NODE_TYPE_Repeat_Button, FLD_NODE_TYPE_Round_Button,
// valuators
- Slider, Scrollbar, Value_Slider,
- Adjuster, Counter, Spinner,
- Dial, Roller, Value_Input, Value_Output,
+ FLD_NODE_TYPE_Slider, FLD_NODE_TYPE_Scrollbar, FLD_NODE_TYPE_Value_Slider,
+ FLD_NODE_TYPE_Adjuster, FLD_NODE_TYPE_Counter, FLD_NODE_TYPE_Spinner,
+ FLD_NODE_TYPE_Dial, FLD_NODE_TYPE_Roller, FLD_NODE_TYPE_Value_Input, FLD_NODE_TYPE_Value_Output,
// text
- Input, Output, Text_Editor,
- Text_Display, File_Input, Terminal,
+ FLD_NODE_TYPE_Input, FLD_NODE_TYPE_Output, FLD_NODE_TYPE_Text_Editor,
+ FLD_NODE_TYPE_Text_Display, FLD_NODE_TYPE_File_Input, FLD_NODE_TYPE_Terminal,
// menus
- Menu_Bar, Menu_Button, Choice,
- Input_Choice, Submenu, Menu_Item,
- Checkbox_Menu_Item, Radio_Menu_Item,
+ FLD_NODE_TYPE_Menu_Bar, FLD_NODE_TYPE_Menu_Button, FLD_NODE_TYPE_Choice,
+ FLD_NODE_TYPE_Input_Choice, FLD_NODE_TYPE_Submenu, FLD_NODE_TYPE_Menu_Item,
+ FLD_NODE_TYPE_Checkbox_Menu_Item, FLD_NODE_TYPE_Radio_Menu_Item,
// browsers
- Browser, Check_Browser, File_Browser,
- Tree, Help_View, Table,
+ FLD_NODE_TYPE_Browser, FLD_NODE_TYPE_Check_Browser, FLD_NODE_TYPE_File_Browser,
+ FLD_NODE_TYPE_Tree, FLD_NODE_TYPE_Help_View, FLD_NODE_TYPE_Table,
// misc
- Box, Clock, Progress,
- Max_
+ FLD_NODE_TYPE_Box, FLD_NODE_TYPE_Clock, FLD_NODE_TYPE_Progress,
+ FLD_NODE_TYPE_Max_
};
+typedef NodeType Type;
void update_visibility_flag(Node *p);
void delete_all(int selected_only=0);
@@ -300,9 +302,9 @@ public:
/** Return 1 if the type browser shall draw a padlock over the icon. */
virtual int is_public() const {return 1;}
/** Return the type Type for this Type. */
- virtual Type type() const { return Type::Base_; }
+ virtual Type type() const { return FLD_NODE_TYPE_Base_; }
/** Check if this Type is of the give type Type or derived from that type Type. */
- virtual bool is_a(Type inType) const { return (inType==Type::Base_); }
+ virtual bool is_a(Type inType) const { return (inType==FLD_NODE_TYPE_Base_); }
const char* class_name(const int need_nest) const;
bool is_in_class() const;
diff --git a/fluid/nodes/Widget_Node.cxx b/fluid/nodes/Widget_Node.cxx
index b02e53e66..929a88bf9 100644
--- a/fluid/nodes/Widget_Node.cxx
+++ b/fluid/nodes/Widget_Node.cxx
@@ -71,7 +71,7 @@ int Widget_Node::is_public() const {
}
std::string subclassname(Node* l) {
- if (l->is_a(Type::Menu_Bar)) {
+ if (l->is_a(FLD_NODE_TYPE_Menu_Bar)) {
Menu_Bar_Node* mb = static_cast<Menu_Bar_Node*>(l);
if (mb->is_sys_menu_bar())
return mb->sys_menubar_name();
@@ -85,7 +85,7 @@ std::string subclassname(Node* l) {
return "Fl_Group";
if (p->o->type() == FL_DOUBLE_WINDOW)
return "Fl_Double_Window";
- if (p->type() == Type::Input) {
+ if (p->type() == FLD_NODE_TYPE_Input) {
if (p->o->type() == FL_FLOAT_INPUT)
return "Fl_Float_Input";
if (p->o->type() == FL_INT_INPUT)
@@ -111,7 +111,7 @@ Node* Widget_Node::make(Strategy strategy) {
Node* anchor = Fluid.proj.tree.current, *pp = anchor;
if (pp && (strategy.placement() == Strategy::AFTER_CURRENT))
pp = pp->parent;
- while (pp && !pp->is_a(Type::Group)) {
+ while (pp && !pp->is_a(FLD_NODE_TYPE_Group)) {
anchor = pp;
strategy.placement(Strategy::AFTER_CURRENT);
pp = pp->parent;
@@ -132,7 +132,7 @@ Node* Widget_Node::make(Strategy strategy) {
B = 25;
int ULX,ULY; // parent's origin in window
- if (!p->is_a(Type::Window)) { // if it is a group, add corner
+ if (!p->is_a(FLD_NODE_TYPE_Window)) { // if it is a group, add corner
ULX = p->o->x(); ULY = p->o->y();
} else {
ULX = ULY = 0;
@@ -140,7 +140,7 @@ Node* Widget_Node::make(Strategy strategy) {
// Figure out a position and size for the widget
int X,Y,W,H;
- if (is_a(Type::Group)) { // fill the parent with the widget
+ if (is_a(FLD_NODE_TYPE_Group)) { // fill the parent with the widget
X = ULX+B;
W = p->o->w()-B;
Y = ULY+B;
@@ -184,7 +184,7 @@ Node* Widget_Node::make(Strategy strategy) {
}
void Widget_Node::setimage(Image_Asset* i) {
- if (i == image || is_a(Type::Window))
+ if (i == image || is_a(FLD_NODE_TYPE_Window))
return;
if (image)
image->dec_ref();
@@ -206,7 +206,7 @@ void Widget_Node::setimage(Image_Asset* i) {
}
void Widget_Node::setinactive(Image_Asset* i) {
- if (i == inactive || is_a(Type::Window))
+ if (i == inactive || is_a(FLD_NODE_TYPE_Window))
return;
if (inactive)
inactive->dec_ref();
@@ -275,11 +275,11 @@ void Widget_Node::inactive_name(const std::string& name) {
void Widget_Node::redraw() {
Node* t = this;
- if (is_a(Type::Menu_Item)) {
+ if (is_a(FLD_NODE_TYPE_Menu_Item)) {
// find the menu button that parents this menu:
do {
t = t->parent;
- } while (t && t->is_a(Type::Menu_Item));
+ } while (t && t->is_a(FLD_NODE_TYPE_Menu_Item));
// kludge to cause build_menu to be called again:
if (t)
t->add_child(nullptr, nullptr);
@@ -764,7 +764,7 @@ void set_whenmenu(int n) {
uchar Widget_Node::resizable() const {
- if (is_a(Type::Window))
+ if (is_a(FLD_NODE_TYPE_Window))
return ((Fl_Window*)o)->resizable() != nullptr;
Fl_Group* p = (Fl_Group*)o->parent();
if (p)
@@ -777,7 +777,7 @@ void Widget_Node::resizable(uchar v) {
if (v) {
if (resizable())
return;
- if (is_a(Type::Window)) {
+ if (is_a(FLD_NODE_TYPE_Window)) {
((Fl_Window*)o)->resizable(o);
} else {
Fl_Group* p = (Fl_Group*)o->parent();
@@ -786,7 +786,7 @@ void Widget_Node::resizable(uchar v) {
} else {
if (!resizable())
return;
- if (is_a(Type::Window)) {
+ if (is_a(FLD_NODE_TYPE_Window)) {
((Fl_Window*)o)->resizable(nullptr);
} else {
Fl_Group* p = (Fl_Group*)o->parent();
@@ -907,7 +907,7 @@ void color_common(Fl_Color c) {
if (o->selected && o->is_widget()) {
Widget_Node* q = (Widget_Node*)o;
q->o->color(c); q->o->redraw();
- if (q->parent && q->parent->is_a(Type::Tabs)) {
+ if (q->parent && q->parent->is_a(FLD_NODE_TYPE_Tabs)) {
if (q->o->parent()) {
q->o->parent()->redraw();
}
@@ -979,7 +979,7 @@ static Fl_Menu_Item alignmenu[] = {
void align_cb(Fl_Button* i, void* v) {
Fl_Align b = Fl_Align(fl_uintptr_t(i->user_data()));
if (v == LOAD) {
- if (current_widget->is_a(Type::Menu_Item)) {
+ if (current_widget->is_a(FLD_NODE_TYPE_Menu_Item)) {
i->deactivate();
return;
} else {
@@ -1022,7 +1022,7 @@ void align_cb(Fl_Button* i, void* v) {
void align_position_cb(Fl_Choice* i, void* v) {
if (v == LOAD) {
- if (current_widget->is_a(Type::Menu_Item)) {
+ if (current_widget->is_a(FLD_NODE_TYPE_Menu_Item)) {
i->deactivate();
return;
} else {
@@ -1057,7 +1057,7 @@ void align_position_cb(Fl_Choice* i, void* v) {
void align_text_image_cb(Fl_Choice* i, void* v) {
if (v == LOAD) {
- if (current_widget->is_a(Type::Menu_Item)) {
+ if (current_widget->is_a(FLD_NODE_TYPE_Menu_Item)) {
i->deactivate();
return;
} else {
@@ -1136,14 +1136,14 @@ void textcolor_common(Fl_Color c) {
// void (*load_margin)(Fl_Flex*,Fl_Value_Input*),
// int (*update_margin)(Fl_Flex*,int)) {
// if (v == LOAD) {
-// if (current_widget->is_a(Type::Flex)) {
+// if (current_widget->is_a(FLD_NODE_TYPE_Flex)) {
// load_margin((Fl_Flex*)current_widget->o, i);
// }
// } else {
// int mod = 0;
// int new_value = (int)i->value();
// for (Node* o = Fluid.proj.tree.first; o; o = o->next) {
-// if (o->selected && o->is_a(Type::Flex)) {
+// if (o->selected && o->is_a(FLD_NODE_TYPE_Flex)) {
// Flex_Node* q = (Flex_Node*)o;
// Fl_Flex* w = (Fl_Flex*)q->o;
// if (update_margin(w, new_value)) {
@@ -1281,7 +1281,7 @@ void live_mode_cb(Fl_Button* o, void *) {
live_window->resizable(live_widget);
live_window->set_modal(); // block all other UI
live_window->callback(leave_live_mode_cb);
- if (current_widget->is_a(Type::Window)) {
+ if (current_widget->is_a(FLD_NODE_TYPE_Window)) {
Window_Node* w = (Window_Node*)current_widget;
int mw = w->sr_min_w; if (mw>0) mw += 20;
int mh = w->sr_min_h; if (mh>0) mh += 55;
@@ -1315,35 +1315,35 @@ void load_panel() {
numselected = 0;
current_widget = nullptr;
if (Fluid.proj.tree.current) {
- if (Fluid.proj.tree.current->is_a(Type::Data)) {
+ if (Fluid.proj.tree.current->is_a(FLD_NODE_TYPE_Data)) {
current_node = Fluid.proj.tree.current;
tabs_wizard->value(data_tabs);
numselected = 1;
- } else if (Fluid.proj.tree.current->is_a(Type::Comment)) {
+ } else if (Fluid.proj.tree.current->is_a(FLD_NODE_TYPE_Comment)) {
current_node = Fluid.proj.tree.current;
tabs_wizard->value(comment_tabs);
numselected = 1;
- } else if (Fluid.proj.tree.current->is_a(Type::Class)) {
+ } else if (Fluid.proj.tree.current->is_a(FLD_NODE_TYPE_Class)) {
current_node = Fluid.proj.tree.current;
tabs_wizard->value(class_tabs);
numselected = 1;
- } else if (Fluid.proj.tree.current->is_a(Type::DeclBlock)) {
+ } else if (Fluid.proj.tree.current->is_a(FLD_NODE_TYPE_DeclBlock)) {
current_node = Fluid.proj.tree.current;
tabs_wizard->value(declblock_tabs);
numselected = 1;
- } else if (Fluid.proj.tree.current->is_a(Type::Decl)) {
+ } else if (Fluid.proj.tree.current->is_a(FLD_NODE_TYPE_Decl)) {
current_node = Fluid.proj.tree.current;
tabs_wizard->value(decl_tabs);
numselected = 1;
- } else if (Fluid.proj.tree.current->is_a(Type::CodeBlock)) {
+ } else if (Fluid.proj.tree.current->is_a(FLD_NODE_TYPE_CodeBlock)) {
current_node = Fluid.proj.tree.current;
tabs_wizard->value(codeblock_tabs);
numselected = 1;
- } else if (Fluid.proj.tree.current->is_a(Type::Code)) {
+ } else if (Fluid.proj.tree.current->is_a(FLD_NODE_TYPE_Code)) {
current_node = Fluid.proj.tree.current;
tabs_wizard->value(code_tabs);
numselected = 1;
- } else if (Fluid.proj.tree.current->is_a(Type::Function)) {
+ } else if (Fluid.proj.tree.current->is_a(FLD_NODE_TYPE_Function)) {
current_node = Fluid.proj.tree.current;
tabs_wizard->value(func_tabs);
numselected = 1;
@@ -1361,7 +1361,7 @@ void load_panel() {
}
if (current_widget) {
tabs_wizard->value(widget_tabs);
- if (current_widget && current_widget->is_a(Type::Grid)) {
+ if (current_widget && current_widget->is_a(FLD_NODE_TYPE_Grid)) {
if (widget_tab_grid->parent()!=widget_tabs)
widget_tabs->add(widget_tab_grid);
} else {
@@ -1369,7 +1369,7 @@ void load_panel() {
widget_tabs_repo->add(widget_tab_grid);
}
}
- if (current_widget && current_widget->parent && current_widget->parent->is_a(Type::Grid)) {
+ if (current_widget && current_widget->parent && current_widget->parent->is_a(FLD_NODE_TYPE_Grid)) {
if (widget_tab_grid_child->parent()!=widget_tabs)
widget_tabs->add(widget_tab_grid_child);
} else {
@@ -1566,7 +1566,7 @@ void Widget_Node::write_static(fld::io::Code_Writer& f) {
f.write_c(", %s", ut);
if (use_v) f.write_c(" v");
f.write_c(") {\n");
- f.tag(Mergeback::Tag::GENERIC, Mergeback::Tag::WIDGET_CALLBACK, 0);
+ f.tag(FLD_MERGEBACK_TAG_GENERIC, FLD_MERGEBACK_TAG_WIDGET_CALLBACK, 0);
f.write_c_indented(callback(), 1, 0);
if (*(d-1) != ';' && *(d-1) != '}') {
const char* p = strrchr(callback(), '\n');
@@ -1577,7 +1577,7 @@ void Widget_Node::write_static(fld::io::Code_Writer& f) {
if (*p != '#' && *p) f.write_c(";");
}
f.write_c("\n");
- f.tag(Mergeback::Tag::WIDGET_CALLBACK, Mergeback::Tag::GENERIC, get_uid());
+ f.tag(FLD_MERGEBACK_TAG_WIDGET_CALLBACK, FLD_MERGEBACK_TAG_GENERIC, get_uid());
f.write_c("}\n");
if (k) {
f.write_c("void %s::%s(%s* o, %s v) {\n", k, cn, t.c_str(), ut);
@@ -1585,7 +1585,7 @@ void Widget_Node::write_static(fld::io::Code_Writer& f) {
Node* q = nullptr;
for (Node* p = parent; p && p->is_widget(); q = p, p = p->parent)
f.write_c("->parent()");
- if (!q || !q->is_a(Type::Widget_Class))
+ if (!q || !q->is_a(FLD_NODE_TYPE_Widget_Class))
f.write_c("->user_data()");
f.write_c("))->%s_i(o,v);\n}\n", cn);
}
@@ -1617,7 +1617,7 @@ void Widget_Node::write_code1(fld::io::Code_Writer& f) {
f.write_h("%sstatic void %s(%s*, %s);\n", f.indent(1), cn, t.c_str(), ut);
}
// figure out if local variable will be used (prevent compiler warnings):
- int wused = !name() && is_a(Type::Window);
+ int wused = !name() && is_a(FLD_NODE_TYPE_Window);
const char* ptr;
f.varused = wused;
@@ -1679,14 +1679,14 @@ void Widget_Node::write_code1(fld::io::Code_Writer& f) {
write_comment_inline_c(f);
if (f.varused) f.write_c("%s* o = ", t.c_str());
if (name()) f.write_c("%s = ", name());
- if (is_a(Type::Window)) {
+ if (is_a(FLD_NODE_TYPE_Window)) {
// Handle special case where user is faking a Fl_Group type as a window,
// there is no 2-argument constructor in that case:
if (t.find("Window")==t.npos)
f.write_c("new %s(0, 0, %d, %d", t.c_str(), o->w(), o->h());
else
f.write_c("new %s(%d, %d", t.c_str(), o->w(), o->h());
- } else if (is_a(Type::Menu_Bar)
+ } else if (is_a(FLD_NODE_TYPE_Menu_Bar)
&& ((Menu_Bar_Node*)this)->is_sys_menu_bar()
&& is_in_class()) {
f.write_c("(%s*)new %s(%d, %d, %d, %d",
@@ -1698,15 +1698,15 @@ void Widget_Node::write_code1(fld::io::Code_Writer& f) {
if (label() && *label()) {
f.write_c(", ");
switch (Fluid.proj.i18n.type) {
- case fld::I18n_Type::NONE : /* None */
+ case FLD_I18N_TYPE_NONE : /* None */
f.write_cstring(label());
break;
- case fld::I18n_Type::GNU : /* GNU gettext */
+ case FLD_I18N_TYPE_GNU : /* GNU gettext */
f.write_c("%s(", Fluid.proj.i18n.gnu_function.c_str());
f.write_cstring(label());
f.write_c(")");
break;
- case fld::I18n_Type::POSIX : /* POSIX catgets */
+ case FLD_I18N_TYPE_POSIX : /* POSIX catgets */
f.write_c("catgets(%s,%s,%d,",
Fluid.proj.i18n.posix_file.empty() ? "_catalog" : Fluid.proj.i18n.posix_file.c_str(),
Fluid.proj.i18n.posix_set.c_str(), msgnum());
@@ -1772,15 +1772,15 @@ void Widget_Node::write_widget_code(fld::io::Code_Writer& f) {
if (!tooltip().empty()) {
f.write_c("%s%s->tooltip(",f.indent(), var);
switch (Fluid.proj.i18n.type) {
- case fld::I18n_Type::NONE : /* None */
+ case FLD_I18N_TYPE_NONE : /* None */
f.write_cstring(tooltip().c_str());
break;
- case fld::I18n_Type::GNU : /* GNU gettext */
+ case FLD_I18N_TYPE_GNU : /* GNU gettext */
f.write_c("%s(", Fluid.proj.i18n.gnu_function.c_str());
f.write_cstring(tooltip().c_str());
f.write_c(")");
break;
- case fld::I18n_Type::POSIX : /* POSIX catgets */
+ case FLD_I18N_TYPE_POSIX : /* POSIX catgets */
f.write_c("catgets(%s,%s,%d,",
Fluid.proj.i18n.posix_file.empty() ? "_catalog" : Fluid.proj.i18n.posix_file.c_str(),
Fluid.proj.i18n.posix_set.c_str(),
@@ -1792,9 +1792,9 @@ void Widget_Node::write_widget_code(fld::io::Code_Writer& f) {
f.write_c(");\n");
}
- if (is_a(Type::Spinner) && ((Fl_Spinner*)o)->type() != ((Fl_Spinner*)tplate)->type())
+ if (is_a(FLD_NODE_TYPE_Spinner) && ((Fl_Spinner*)o)->type() != ((Fl_Spinner*)tplate)->type())
f.write_c("%s%s->type(%d);\n", f.indent(), var, ((Fl_Spinner*)o)->type());
- else if (o->type() != tplate->type() && !is_a(Type::Window))
+ else if (o->type() != tplate->type() && !is_a(FLD_NODE_TYPE_Window))
f.write_c("%s%s->type(%d);\n", f.indent(), var, o->type());
if (o->box() != tplate->box() || !subclass().empty())
f.write_c("%s%s->box(FL_%s);\n", f.indent(), var, boxname(o->box()));
@@ -1802,9 +1802,9 @@ void Widget_Node::write_widget_code(fld::io::Code_Writer& f) {
// write shortcut command if needed
int shortcut = 0;
if (is_button()) shortcut = ((Fl_Button*)o)->shortcut();
- else if (is_a(Type::Input)) shortcut = ((Fl_Input_*)o)->shortcut();
- else if (is_a(Type::Value_Input)) shortcut = ((Fl_Value_Input*)o)->shortcut();
- else if (is_a(Type::Text_Display)) shortcut = ((Fl_Text_Display*)o)->shortcut();
+ else if (is_a(FLD_NODE_TYPE_Input)) shortcut = ((Fl_Input_*)o)->shortcut();
+ else if (is_a(FLD_NODE_TYPE_Value_Input)) shortcut = ((Fl_Value_Input*)o)->shortcut();
+ else if (is_a(FLD_NODE_TYPE_Text_Display)) shortcut = ((Fl_Text_Display*)o)->shortcut();
if (shortcut) {
int s = shortcut;
f.write_c("%s%s->shortcut(", f.indent(), var);
@@ -1823,17 +1823,17 @@ void Widget_Node::write_widget_code(fld::io::Code_Writer& f) {
f.write_c("0x%x);\n", s);
}
- if (is_a(Type::Button)) {
+ if (is_a(FLD_NODE_TYPE_Button)) {
Fl_Button* b = (Fl_Button*)o;
if (b->down_box()) f.write_c("%s%s->down_box(FL_%s);\n", f.indent(), var,
boxname(b->down_box()));
if (b->value()) f.write_c("%s%s->value(1);\n", f.indent(), var);
if (b->compact()) f.write_c("%s%s->compact(%d);\n", f.indent(), var, b->compact());
- } else if (is_a(Type::Input_Choice)) {
+ } else if (is_a(FLD_NODE_TYPE_Input_Choice)) {
Fl_Input_Choice* b = (Fl_Input_Choice*)o;
if (b->down_box()) f.write_c("%s%s->down_box(FL_%s);\n", f.indent(), var,
boxname(b->down_box()));
- } else if (is_a(Type::Menu_Manager_)) {
+ } else if (is_a(FLD_NODE_TYPE_Menu_Manager_)) {
Fl_Menu_* b = (Fl_Menu_*)o;
if (b->down_box()) f.write_c("%s%s->down_box(FL_%s);\n", f.indent(), var,
boxname(b->down_box()));
@@ -1885,7 +1885,7 @@ void Widget_Node::write_widget_code(fld::io::Code_Writer& f) {
f.write_c("%s%s->vertical_label_margin(%d);\n", f.indent(), var, o->vertical_label_margin());
if (o->label_image_spacing() != tplate->label_image_spacing())
f.write_c("%s%s->label_image_spacing(%d);\n", f.indent(), var, o->label_image_spacing());
- if (is_a(Type::Valuator_)) {
+ if (is_a(FLD_NODE_TYPE_Valuator_)) {
Fl_Valuator* v = (Fl_Valuator*)o;
Fl_Valuator* t = (Fl_Valuator*)(tplate);
if (v->minimum()!=t->minimum())
@@ -1895,19 +1895,19 @@ void Widget_Node::write_widget_code(fld::io::Code_Writer& f) {
if (v->step()!=t->step())
f.write_c("%s%s->step(%g);\n", f.indent(), var, v->step());
if (v->value()) {
- if (is_a(Type::Scrollbar)) { // Fl_Scrollbar::value(double) is not available
+ if (is_a(FLD_NODE_TYPE_Scrollbar)) { // Fl_Scrollbar::value(double) is not available
f.write_c("%s%s->Fl_Slider::value(%g);\n", f.indent(), var, v->value());
} else {
f.write_c("%s%s->value(%g);\n", f.indent(), var, v->value());
}
}
- if (is_a(Type::Slider)) {
+ if (is_a(FLD_NODE_TYPE_Slider)) {
double x = ((Fl_Slider*)v)->slider_size();
double y = ((Fl_Slider*)t)->slider_size();
if (x != y) f.write_c("%s%s->slider_size(%g);\n", f.indent(), var, x);
}
}
- if (is_a(Type::Spinner)) {
+ if (is_a(FLD_NODE_TYPE_Spinner)) {
Fl_Spinner* v = (Fl_Spinner*)o;
Fl_Spinner* t = (Fl_Spinner*)(tplate);
if (v->minimum()!=t->minimum())
@@ -1931,10 +1931,10 @@ void Widget_Node::write_widget_code(fld::io::Code_Writer& f) {
if (callback()) {
if (callback()[0] == '[') {
f.write_c("%s%s->callback(\n", f.indent(), var);
- f.tag(Mergeback::Tag::GENERIC, Mergeback::Tag::WIDGET_CALLBACK, 0);
+ f.tag(FLD_MERGEBACK_TAG_GENERIC, FLD_MERGEBACK_TAG_WIDGET_CALLBACK, 0);
f.write_c_indented(callback(), 1, 0);
f.write_c("\n");
- f.tag(Mergeback::Tag::WIDGET_CALLBACK, Mergeback::Tag::GENERIC, get_uid());
+ f.tag(FLD_MERGEBACK_TAG_WIDGET_CALLBACK, FLD_MERGEBACK_TAG_GENERIC, get_uid());
f.write_c("%s", f.indent_plus(1));
} else {
f.write_c("%s%s->callback((Fl_Callback*)%s", f.indent(), var, callback_name(f));
@@ -1960,12 +1960,12 @@ void Widget_Node::write_widget_code(fld::io::Code_Writer& f) {
f.write_c("%s%s->hide();\n", f.indent(), var);
if (!o->active())
f.write_c("%s%s->deactivate();\n", f.indent(), var);
- if (!is_a(Type::Group) && resizable())
+ if (!is_a(FLD_NODE_TYPE_Group) && resizable())
f.write_c("%sFl_Group::current()->resizable(%s);\n", f.indent(), var);
if (hotspot()) {
if (is_class())
f.write_c("%shotspot(%s);\n", f.indent(), var);
- else if (is_a(Type::Window))
+ else if (is_a(FLD_NODE_TYPE_Window))
f.write_c("%s%s->hotspot(%s);\n", f.indent(), var, var);
else
f.write_c("%s%s->window()->hotspot(%s);\n", f.indent(), var, var);
@@ -2021,38 +2021,38 @@ void Widget_Node::write_properties(fld::io::Project_Writer &f) {
if (bind_deimage_) f.write_string("bind_deimage 1");
f.write_string("xywh {%d %d %d %d}", o->x(), o->y(), o->w(), o->h());
Fl_Widget* tplate = ((Widget_Node*)factory)->o;
- if (is_a(Type::Spinner) && ((Fl_Spinner*)o)->type() != ((Fl_Spinner*)tplate)->type()) {
+ if (is_a(FLD_NODE_TYPE_Spinner) && ((Fl_Spinner*)o)->type() != ((Fl_Spinner*)tplate)->type()) {
f.write_string("type");
f.write_word(item_name(subtypes(), ((Fl_Spinner*)o)->type()));
- } else if (subtypes() && (o->type() != tplate->type() || is_a(Type::Window))) {
+ } else if (subtypes() && (o->type() != tplate->type() || is_a(FLD_NODE_TYPE_Window))) {
f.write_string("type");
f.write_word(item_name(subtypes(), o->type()));
}
if (o->box() != tplate->box()) {
f.write_string("box"); f.write_word(boxname(o->box()));}
- if (is_a(Type::Input)) {
+ if (is_a(FLD_NODE_TYPE_Input)) {
Fl_Input_* b = (Fl_Input_*)o;
if (b->shortcut()) f.write_string("shortcut 0x%x", b->shortcut());
}
- if (is_a(Type::Value_Input)) {
+ if (is_a(FLD_NODE_TYPE_Value_Input)) {
Fl_Value_Input* b = (Fl_Value_Input*)o;
if (b->shortcut()) f.write_string("shortcut 0x%x", b->shortcut());
}
- if (is_a(Type::Text_Display)) {
+ if (is_a(FLD_NODE_TYPE_Text_Display)) {
Fl_Text_Display* b = (Fl_Text_Display*)o;
if (b->shortcut()) f.write_string("shortcut 0x%x", b->shortcut());
}
- if (is_a(Type::Button)) {
+ if (is_a(FLD_NODE_TYPE_Button)) {
Fl_Button* b = (Fl_Button*)o;
if (b->down_box()) {
f.write_string("down_box"); f.write_word(boxname(b->down_box()));}
if (b->shortcut()) f.write_string("shortcut 0x%x", b->shortcut());
if (b->value()) f.write_string("value 1");
- } else if (is_a(Type::Input_Choice)) {
+ } else if (is_a(FLD_NODE_TYPE_Input_Choice)) {
Fl_Input_Choice* b = (Fl_Input_Choice*)o;
if (b->down_box()) {
f.write_string("down_box"); f.write_word(boxname(b->down_box()));}
- } else if (is_a(Type::Menu_)) {
+ } else if (is_a(FLD_NODE_TYPE_Menu_)) {
Fl_Menu_* b = (Fl_Menu_*)o;
if (b->down_box()) {
f.write_string("down_box"); f.write_word(boxname(b->down_box()));}
@@ -2081,20 +2081,20 @@ void Widget_Node::write_properties(fld::io::Project_Writer &f) {
f.write_string("image_spacing %d", o->label_image_spacing());
if (o->when() != tplate->when())
f.write_string("when %d", o->when());
- if (is_a(Type::Valuator_)) {
+ if (is_a(FLD_NODE_TYPE_Valuator_)) {
Fl_Valuator* v = (Fl_Valuator*)o;
Fl_Valuator* t = (Fl_Valuator*)(tplate);
if (v->minimum()!=t->minimum()) f.write_string("minimum %g",v->minimum());
if (v->maximum()!=t->maximum()) f.write_string("maximum %g",v->maximum());
if (v->step()!=t->step()) f.write_string("step %g",v->step());
if (v->value()!=0.0) f.write_string("value %g",v->value());
- if (is_a(Type::Slider)) {
+ if (is_a(FLD_NODE_TYPE_Slider)) {
double x = ((Fl_Slider*)v)->slider_size();
double y = ((Fl_Slider*)t)->slider_size();
if (x != y) f.write_string("slider_size %g", x);
}
}
- if (is_a(Type::Spinner)) {
+ if (is_a(FLD_NODE_TYPE_Spinner)) {
Fl_Spinner* v = (Fl_Spinner*)o;
Fl_Spinner* t = (Fl_Spinner*)(tplate);
if (v->minimum()!=t->minimum()) f.write_string("minimum %g",v->minimum());
@@ -2111,7 +2111,7 @@ void Widget_Node::write_properties(fld::io::Project_Writer &f) {
if (!o->visible() && !override_visible_) f.write_string("hide");
if (!o->active()) f.write_string("deactivate");
if (resizable()) f.write_string("resizable");
- if (hotspot()) f.write_string(is_a(Type::Menu_Item) ? "divider" : "hotspot");
+ if (hotspot()) f.write_string(is_a(FLD_NODE_TYPE_Menu_Item) ? "divider" : "hotspot");
if (menu_headline()) f.write_string("headline");
for (int n=0; n < NUM_EXTRA_CODE; n++) if (!extra_code(n).empty()) {
f.write_indent(level+1);
@@ -2183,7 +2183,7 @@ void Widget_Node::read_property(fld::io::Project_Reader &f, const char* c) {
} else if (!strcmp(c,"compress_deimage")) {
compress_deimage_ = (int)atol(f.read_word());
} else if (!strcmp(c,"type")) {
- if (is_a(Type::Spinner))
+ if (is_a(FLD_NODE_TYPE_Spinner))
((Fl_Spinner*)o)->type(item_number(subtypes(), f.read_word()));
else
o->type(item_number(subtypes(), f.read_word()));
@@ -2193,19 +2193,19 @@ void Widget_Node::read_property(fld::io::Project_Reader &f, const char* c) {
if (x == ZERO_ENTRY) x = 0;
o->box((Fl_Boxtype)x);
} else if (sscanf(value,"%d",&x) == 1) o->box((Fl_Boxtype)x);
- } else if (is_a(Type::Button) && !strcmp(c,"down_box")) {
+ } else if (is_a(FLD_NODE_TYPE_Button) && !strcmp(c,"down_box")) {
const char* value = f.read_word();
if ((x = boxnumber(value))) {
if (x == ZERO_ENTRY) x = 0;
((Fl_Button*)o)->down_box((Fl_Boxtype)x);
}
- } else if (is_a(Type::Input_Choice) && !strcmp(c,"down_box")) {
+ } else if (is_a(FLD_NODE_TYPE_Input_Choice) && !strcmp(c,"down_box")) {
const char* value = f.read_word();
if ((x = boxnumber(value))) {
if (x == ZERO_ENTRY) x = 0;
((Fl_Input_Choice*)o)->down_box((Fl_Boxtype)x);
}
- } else if (is_a(Type::Menu_) && !strcmp(c,"down_box")) {
+ } else if (is_a(FLD_NODE_TYPE_Menu_) && !strcmp(c,"down_box")) {
const char* value = f.read_word();
if ((x = boxnumber(value))) {
if (x == ZERO_ENTRY) x = 0;
@@ -2258,18 +2258,18 @@ void Widget_Node::read_property(fld::io::Project_Reader &f, const char* c) {
} else if (!strcmp(c,"when")) {
if (sscanf(f.read_word(),"%d",&x) == 1) o->when(x);
} else if (!strcmp(c,"minimum")) {
- if (is_a(Type::Valuator_)) ((Fl_Valuator*)o)->minimum(strtod(f.read_word(),nullptr));
- if (is_a(Type::Spinner)) ((Fl_Spinner*)o)->minimum(strtod(f.read_word(),nullptr));
+ if (is_a(FLD_NODE_TYPE_Valuator_)) ((Fl_Valuator*)o)->minimum(strtod(f.read_word(),nullptr));
+ if (is_a(FLD_NODE_TYPE_Spinner)) ((Fl_Spinner*)o)->minimum(strtod(f.read_word(),nullptr));
} else if (!strcmp(c,"maximum")) {
- if (is_a(Type::Valuator_)) ((Fl_Valuator*)o)->maximum(strtod(f.read_word(),nullptr));
- if (is_a(Type::Spinner)) ((Fl_Spinner*)o)->maximum(strtod(f.read_word(),nullptr));
+ if (is_a(FLD_NODE_TYPE_Valuator_)) ((Fl_Valuator*)o)->maximum(strtod(f.read_word(),nullptr));
+ if (is_a(FLD_NODE_TYPE_Spinner)) ((Fl_Spinner*)o)->maximum(strtod(f.read_word(),nullptr));
} else if (!strcmp(c,"step")) {
- if (is_a(Type::Valuator_)) ((Fl_Valuator*)o)->step(strtod(f.read_word(),nullptr));
- if (is_a(Type::Spinner)) ((Fl_Spinner*)o)->step(strtod(f.read_word(),nullptr));
+ if (is_a(FLD_NODE_TYPE_Valuator_)) ((Fl_Valuator*)o)->step(strtod(f.read_word(),nullptr));
+ if (is_a(FLD_NODE_TYPE_Spinner)) ((Fl_Spinner*)o)->step(strtod(f.read_word(),nullptr));
} else if (!strcmp(c,"value")) {
- if (is_a(Type::Valuator_)) ((Fl_Valuator*)o)->value(strtod(f.read_word(),nullptr));
- if (is_a(Type::Spinner)) ((Fl_Spinner*)o)->value(strtod(f.read_word(),nullptr));
- } else if ( (!strcmp(c,"slider_size") || !strcmp(c,"size")) && is_a(Type::Slider)) {
+ if (is_a(FLD_NODE_TYPE_Valuator_)) ((Fl_Valuator*)o)->value(strtod(f.read_word(),nullptr));
+ if (is_a(FLD_NODE_TYPE_Spinner)) ((Fl_Spinner*)o)->value(strtod(f.read_word(),nullptr));
+ } else if ( (!strcmp(c,"slider_size") || !strcmp(c,"size")) && is_a(FLD_NODE_TYPE_Slider)) {
((Fl_Slider*)o)->slider_size(strtod(f.read_word(),nullptr));
} else if (!strcmp(c,"textfont")) {
if (sscanf(f.read_word(),"%d",&x) == 1) {ft=(Fl_Font)x; textstuff(1,ft,s,cc);}
@@ -2292,9 +2292,9 @@ void Widget_Node::read_property(fld::io::Project_Reader &f, const char* c) {
} else if (!strcmp(c,"shortcut")) {
int shortcut = (int)strtol(f.read_word(),nullptr,0);
if (is_button()) ((Fl_Button*)o)->shortcut(shortcut);
- else if (is_a(Type::Input)) ((Fl_Input_*)o)->shortcut(shortcut);
- else if (is_a(Type::Value_Input)) ((Fl_Value_Input*)o)->shortcut(shortcut);
- else if (is_a(Type::Text_Display)) ((Fl_Text_Display*)o)->shortcut(shortcut);
+ else if (is_a(FLD_NODE_TYPE_Input)) ((Fl_Input_*)o)->shortcut(shortcut);
+ else if (is_a(FLD_NODE_TYPE_Value_Input)) ((Fl_Value_Input*)o)->shortcut(shortcut);
+ else if (is_a(FLD_NODE_TYPE_Text_Display)) ((Fl_Text_Display*)o)->shortcut(shortcut);
} else {
if (!strncmp(c,"code",4)) {
int n = atoi(c+4);
@@ -2340,7 +2340,7 @@ int Widget_Node::read_fdesign(const char* propname, const char* value) {
if (sscanf(value,"%f %f %f %f",&x,&y,&w,&h) == 4) {
if (fld::io::fdesign_flip) {
Node* p;
- for (p = parent; p && !p->is_a(Type::Window); p = p->parent) {/*empty*/}
+ for (p = parent; p && !p->is_a(FLD_NODE_TYPE_Window); p = p->parent) {/*empty*/}
if (p && p->is_widget()) y = ((Widget_Node*)p)->o->h()-(y+h);
}
x += Fluid.pasteoffset;
@@ -2496,7 +2496,7 @@ void Widget_Node::copy_properties() {
}
// copy all attributes specific to widgets derived from Fl_Input_
- if (is_a(Type::Input)) {
+ if (is_a(FLD_NODE_TYPE_Input)) {
Fl_Input_* d = (Fl_Input_*)live_widget, *s = (Fl_Input_*)o;
d->shortcut(s->shortcut());
d->textfont(ff);
@@ -2505,7 +2505,7 @@ void Widget_Node::copy_properties() {
}
// copy all attributes specific to widgets derived from Fl_Value_Input
- if (is_a(Type::Value_Input)) {
+ if (is_a(FLD_NODE_TYPE_Value_Input)) {
Fl_Value_Input* d = (Fl_Value_Input*)live_widget, *s = (Fl_Value_Input*)o;
d->shortcut(s->shortcut());
d->textfont(ff);
@@ -2514,7 +2514,7 @@ void Widget_Node::copy_properties() {
}
// copy all attributes specific to widgets derived from Fl_Text_Display
- if (is_a(Type::Text_Display)) {
+ if (is_a(FLD_NODE_TYPE_Text_Display)) {
Fl_Text_Display* d = (Fl_Text_Display*)live_widget, *s = (Fl_Text_Display*)o;
d->shortcut(s->shortcut());
d->textfont(ff);
@@ -2523,20 +2523,20 @@ void Widget_Node::copy_properties() {
}
// copy all attributes specific to Fl_Valuator and derived classes
- if (is_a(Type::Valuator_)) {
+ if (is_a(FLD_NODE_TYPE_Valuator_)) {
Fl_Valuator* d = (Fl_Valuator*)live_widget, *s = (Fl_Valuator*)o;
d->minimum(s->minimum());
d->maximum(s->maximum());
d->step(s->step());
d->value(s->value());
- if (is_a(Type::Slider)) {
+ if (is_a(FLD_NODE_TYPE_Slider)) {
Fl_Slider* d = (Fl_Slider*)live_widget, *s = (Fl_Slider*)o;
d->slider_size(s->slider_size());
}
}
// copy all attributes specific to Fl_Spinner and derived classes
- if (is_a(Type::Spinner)) {
+ if (is_a(FLD_NODE_TYPE_Spinner)) {
Fl_Spinner* d = (Fl_Spinner*)live_widget, *s = (Fl_Spinner*)o;
d->minimum(s->minimum());
d->maximum(s->maximum());
diff --git a/fluid/nodes/Widget_Node.h b/fluid/nodes/Widget_Node.h
index 51623612d..b2afa58a6 100644
--- a/fluid/nodes/Widget_Node.h
+++ b/fluid/nodes/Widget_Node.h
@@ -139,8 +139,8 @@ public:
virtual int textstuff(int what, Fl_Font &, int &, Fl_Color &);
virtual Fl_Menu_Item* subtypes();
- Type type() const override { return Type::Widget_; }
- bool is_a(Type inType) const override { return (inType==Type::Widget_) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Widget_; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Widget_) ? true : super::is_a(inType); }
int is_widget() const override;
int is_true_widget() const override { return 1; }
int is_public() const override;
diff --git a/fluid/nodes/Window_Node.cxx b/fluid/nodes/Window_Node.cxx
index 7e90f8272..965d0e8d6 100644
--- a/fluid/nodes/Window_Node.cxx
+++ b/fluid/nodes/Window_Node.cxx
@@ -85,15 +85,15 @@ void i18n_type_cb(Fl_Choice *c, void *v) {
Fluid.proj.set_modflag(1);
}
switch (Fluid.proj.i18n.type) {
- case fld::I18n_Type::NONE : /* None */
+ case FLD_I18N_TYPE_NONE : /* None */
i18n_gnu_group->hide();
i18n_posix_group->hide();
break;
- case fld::I18n_Type::GNU : /* GNU gettext */
+ case FLD_I18N_TYPE_GNU : /* GNU gettext */
i18n_gnu_group->show();
i18n_posix_group->hide();
break;
- case fld::I18n_Type::POSIX : /* POSIX cat */
+ case FLD_I18N_TYPE_POSIX : /* POSIX cat */
i18n_gnu_group->hide();
i18n_posix_group->show();
break;
@@ -235,7 +235,7 @@ int Overlay_Window::handle(int e) {
Node *Window_Node::make(Strategy strategy) {
Node *anchor = Fluid.proj.tree.current, *p = anchor;
if (p && (strategy.placement() == Strategy::AFTER_CURRENT)) p = p->parent;
- while (p && (!p->is_code_block() || p->is_a(Type::Widget_Class))) {
+ while (p && (!p->is_code_block() || p->is_a(FLD_NODE_TYPE_Widget_Class))) {
anchor = p;
strategy.placement(Strategy::AFTER_CURRENT);
p = p->parent;
@@ -363,7 +363,7 @@ void Overlay_Window::resize(int X,int Y,int W,int H) {
if (X!=x() || Y!=y() || W!=w() || H!=h()) {
// Set a checkpoint on the first resize event, ignore further resizes until
// a different type of checkpoint is triggered.
- if (Fluid.proj.undo.checkpoint(fld::proj::Undo::OnceType::WINDOW_RESIZE))
+ if (Fluid.proj.undo.checkpoint(fld::proj::FLD_UNDO_ONCETYPE_WINDOW_RESIZE))
Fluid.proj.set_modflag(1);
}
@@ -512,7 +512,7 @@ void Window_Node::draw_out_of_bounds() {
draw_out_of_bounds(this, 0, 0, o->w(), o->h());
for (Node *q=next; q && q->level>level; q = q->next) {
// don't do this for Fl_Scroll (which we currently can't handle in FLUID anyway)
- if (q->is_a(Type::Group) && !q->is_a(Type::Scroll)) {
+ if (q->is_a(FLD_NODE_TYPE_Group) && !q->is_a(FLD_NODE_TYPE_Scroll)) {
Widget_Node *w = (Widget_Node*)q;
draw_out_of_bounds(w, w->o->x(), w->o->y(), w->o->w(), w->o->h());
}
@@ -600,7 +600,7 @@ void Window_Node::draw_overlay() {
newposition(myo,x,y,r,t);
if (Fluid.show_guides) {
// If we are in a drag operation, and the parent is a grid, show the grid overlay
- if (drag && q->parent && q->parent->is_a(Type::Grid)) {
+ if (drag && q->parent && q->parent->is_a(FLD_NODE_TYPE_Grid)) {
Fl_Grid_Proxy *grid = ((Fl_Grid_Proxy*)((Grid_Node*)q->parent)->o);
grid->draw_overlay();
}
@@ -614,7 +614,7 @@ void Window_Node::draw_overlay() {
} else {
draw_height(wgt->x()+15, wgt->y(), wgt->y()+wgt->h(), FL_ALIGN_CENTER);
}
- } else if (q->is_a(Type::Grid)) {
+ } else if (q->is_a(FLD_NODE_TYPE_Grid)) {
Fl_Grid_Proxy *grid = ((Fl_Grid_Proxy*)((Grid_Node*)q)->o);
grid->draw_overlay();
}
@@ -675,17 +675,17 @@ void check_redraw_corresponding_parent(Node *s) {
Widget_Node * prev_parent = nullptr;
if( !s || !s->selected || !s->is_widget()) return;
for (Node *i=s; i && i->parent; i=i->parent) {
- if (i->is_a(Type::Group) && prev_parent) {
- if (i->is_a(Type::Tabs)) {
+ if (i->is_a(FLD_NODE_TYPE_Group) && prev_parent) {
+ if (i->is_a(FLD_NODE_TYPE_Tabs)) {
((Fl_Tabs*)((Widget_Node*)i)->o)->value(prev_parent->o);
return;
}
- if (i->is_a(Type::Wizard)) {
+ if (i->is_a(FLD_NODE_TYPE_Wizard)) {
((Fl_Wizard*)((Widget_Node*)i)->o)->value(prev_parent->o);
return;
}
}
- if (i->is_a(Type::Group) && s->is_widget())
+ if (i->is_a(FLD_NODE_TYPE_Group) && s->is_widget())
prev_parent = (Widget_Node*)i;
}
}
@@ -693,7 +693,7 @@ void check_redraw_corresponding_parent(Node *s) {
// do that for every window (when selected set changes):
void redraw_overlays() {
for (Node *o=Fluid.proj.tree.first; o; o=o->next)
- if (o->is_a(Type::Window)) ((Window_Node*)o)->fix_overlay();
+ if (o->is_a(FLD_NODE_TYPE_Window)) ((Window_Node*)o)->fix_overlay();
}
void toggle_overlays(Fl_Widget *,void *) {
@@ -708,7 +708,7 @@ void toggle_overlays(Fl_Widget *,void *) {
}
for (Node *o=Fluid.proj.tree.first; o; o=o->next)
- if (o->is_a(Type::Window)) {
+ if (o->is_a(FLD_NODE_TYPE_Window)) {
Widget_Node* w = (Widget_Node*)o;
((Overlay_Window*)(w->o))->redraw_overlay();
}
@@ -731,7 +731,7 @@ void toggle_guides(Fl_Widget *,void *) {
guides_button->value(Fluid.show_guides);
for (Node *o=Fluid.proj.tree.first; o; o=o->next) {
- if (o->is_a(Type::Window)) {
+ if (o->is_a(FLD_NODE_TYPE_Window)) {
Widget_Node* w = (Widget_Node*)o;
((Overlay_Window*)(w->o))->redraw_overlay();
}
@@ -763,7 +763,7 @@ void toggle_restricted(Fl_Widget *,void *) {
restricted_button->value(Fluid.show_restricted);
for (Node *o=Fluid.proj.tree.first; o; o=o->next) {
- if (o->is_a(Type::Window)) {
+ if (o->is_a(FLD_NODE_TYPE_Window)) {
Widget_Node* w = (Widget_Node*)o;
((Overlay_Window*)(w->o))->redraw_overlay();
}
@@ -777,7 +777,7 @@ void toggle_ghosted_outline_cb(Fl_Check_Button *,void *) {
Fluid.show_ghosted_outline = !Fluid.show_ghosted_outline;
Fluid.preferences.set("Fluid.show_ghosted_outline", Fluid.show_ghosted_outline);
for (Node *o=Fluid.proj.tree.first; o; o=o->next) {
- if (o->is_a(Type::Window)) {
+ if (o->is_a(FLD_NODE_TYPE_Window)) {
Widget_Node* w = (Widget_Node*)o;
((Overlay_Window*)(w->o))->redraw();
}
@@ -825,7 +825,7 @@ void Window_Node::moveallchildren(int key)
Widget_Node* myo = (Widget_Node*)i;
int x,y,r,t,ow=myo->o->w(),oh=myo->o->h();
newposition(myo,x,y,r,t);
- if (myo->is_a(Type::Flex) || myo->is_a(Type::Grid)) {
+ if (myo->is_a(FLD_NODE_TYPE_Flex) || myo->is_a(FLD_NODE_TYPE_Grid)) {
// Flex and Grid need to be able to layout their children.
Fluid.proj.tree.allow_layout++;
myo->o->resize(x,y,r-x,t-y);
@@ -861,7 +861,7 @@ void Window_Node::moveallchildren(int key)
Fluid.proj.tree.allow_layout++;
f->layout();
Fluid.proj.tree.allow_layout--;
- } else if (myo->parent && myo->parent->is_a(Type::Grid)) {
+ } else if (myo->parent && myo->parent->is_a(FLD_NODE_TYPE_Grid)) {
Grid_Node* gt = (Grid_Node*)myo->parent;
Fl_Grid* g = (Fl_Grid*)gt->o;
if (key) {
@@ -877,14 +877,14 @@ void Window_Node::moveallchildren(int key)
g->layout();
Fluid.proj.tree.allow_layout--;
update_widget_panel = true;
- } else if (myo->parent && myo->parent->is_a(Type::Group)) {
+ } else if (myo->parent && myo->parent->is_a(FLD_NODE_TYPE_Group)) {
Group_Node* gt = (Group_Node*)myo->parent;
((Fl_Group*)gt->o)->init_sizes();
}
// move all the children, whether selected or not:
Node* p;
for (p = myo->next; p && p->level>myo->level; p = p->next)
- if (p->is_true_widget() && !myo->is_a(Type::Flex) && !myo->is_a(Type::Grid)) {
+ if (p->is_true_widget() && !myo->is_a(FLD_NODE_TYPE_Flex) && !myo->is_a(FLD_NODE_TYPE_Grid)) {
Widget_Node* myo2 = (Widget_Node*)p;
int X,Y,R,T;
newposition(myo2,X,Y,R,T);
@@ -923,7 +923,7 @@ int Window_Node::handle(int event) {
// find the innermost item clicked on:
selection = this;
for (Node* i=next; i && i->level>level; i=i->next)
- if (i->is_a(Type::Group)) {
+ if (i->is_a(FLD_NODE_TYPE_Group)) {
Widget_Node* myo = (Widget_Node*)i;
if (Fl::event_inside(myo->o) && myo->o->visible_r()) {
selection = myo;
@@ -1075,7 +1075,7 @@ int Window_Node::handle(int event) {
} else {
deselect();
select(t, 1);
- if (t->is_a(Type::Menu_Item)) t->open();
+ if (t->is_a(FLD_NODE_TYPE_Menu_Item)) t->open();
}
selection = t;
drag = 0;
diff --git a/fluid/nodes/Window_Node.h b/fluid/nodes/Window_Node.h
index a6846168b..422326734 100644
--- a/fluid/nodes/Window_Node.h
+++ b/fluid/nodes/Window_Node.h
@@ -76,8 +76,8 @@ protected:
Fl_Widget *widget(int,int,int,int) override {return nullptr;}
int recalc; // set by fix_overlay()
void moveallchildren(int key=0);
- Type type() const override { return Type::Window; }
- bool is_a(Type inType) const override { return (inType==Type::Window) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Window; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Window) ? true : super::is_a(inType); }
void open_();
public:
@@ -152,8 +152,8 @@ public:
void write_code2(fld::io::Code_Writer& f) override;
Node *make(Strategy strategy) override;
const char *type_name() override {return "widget_class";}
- Type type() const override { return Type::Widget_Class; }
- bool is_a(Type inType) const override { return (inType==Type::Widget_Class) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Widget_Class; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Widget_Class) ? true : super::is_a(inType); }
int can_have_children() const override {return 1;}
int is_code_block() const override {return 1;}
int is_decl_block() const override {return 1;}
diff --git a/fluid/nodes/factory.cxx b/fluid/nodes/factory.cxx
index 8c4caa08d..90a1c4687 100644
--- a/fluid/nodes/factory.cxx
+++ b/fluid/nodes/factory.cxx
@@ -131,8 +131,8 @@ public:
return b;
}
Widget_Node *_make() override { return new Browser_Base_Node(); }
- Type type() const override { return Type::Browser_; }
- bool is_a(Type inType) const override { return (inType==Type::Browser_) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Browser_; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Browser_) ? true : super::is_a(inType); }
};
Browser_Base_Node Browser_Base_Node::prototype;
@@ -166,8 +166,8 @@ public:
return b;
}
Widget_Node *_make() override { return new Browser_Node(); }
- Type type() const override { return Type::Browser; }
- bool is_a(Type inType) const override { return (inType==Type::Browser) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Browser; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Browser) ? true : super::is_a(inType); }
};
Browser_Node Browser_Node::prototype;
@@ -201,8 +201,8 @@ public:
return b;
}
Widget_Node *_make() override { return new Check_Browser_Node(); }
- Type type() const override { return Type::Check_Browser; }
- bool is_a(Type inType) const override { return (inType==Type::Check_Browser) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Check_Browser; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Check_Browser) ? true : super::is_a(inType); }
};
Check_Browser_Node Check_Browser_Node::prototype;
@@ -229,8 +229,8 @@ public:
return b;
}
Widget_Node *_make() override { return new File_Browser_Node(); }
- Type type() const override { return Type::File_Browser; }
- bool is_a(Type inType) const override { return (inType==Type::File_Browser) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_File_Browser; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_File_Browser) ? true : super::is_a(inType); }
};
File_Browser_Node File_Browser_Node::prototype;
@@ -274,8 +274,8 @@ public:
return b;
}
Widget_Node *_make() override { return new Tree_Node(); }
- Type type() const override { return Type::Tree; }
- bool is_a(Type inType) const override { return (inType==Type::Tree) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Tree; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Tree) ? true : super::is_a(inType); }
};
Tree_Node Tree_Node::prototype;
@@ -323,8 +323,8 @@ public:
return myo;
}
Widget_Node *_make() override { return new Help_View_Node(); }
- Type type() const override { return Type::Help_View; }
- bool is_a(Type inType) const override { return (inType==Type::Help_View) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Help_View; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Help_View) ? true : super::is_a(inType); }
};
Help_View_Node Help_View_Node::prototype;
@@ -351,8 +351,8 @@ public:
return new Fl_Slider(x, y, w, h, "Valuator");
}
Widget_Node *_make() override { return new Valuator_Node(); }
- Type type() const override { return Type::Valuator_; }
- bool is_a(Type inType) const override { return (inType==Type::Valuator_) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Valuator_; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Valuator_) ? true : super::is_a(inType); }
};
Valuator_Node Valuator_Node::prototype;
@@ -401,8 +401,8 @@ public:
return new Fl_Counter(x, y, w, h, "counter:");
}
Widget_Node *_make() override { return new Counter_Node(); }
- Type type() const override { return Type::Counter; }
- bool is_a(Type inType) const override { return (inType==Type::Counter) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Counter; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Counter) ? true : super::is_a(inType); }
};
Counter_Node Counter_Node::prototype;
@@ -431,8 +431,8 @@ public:
return new Fl_Adjuster(x, y, w, h);
}
Widget_Node *_make() override { return new Adjuster_Node(); }
- Type type() const override { return Type::Adjuster; }
- bool is_a(Type inType) const override { return (inType==Type::Adjuster) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Adjuster; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Adjuster) ? true : super::is_a(inType); }
};
Adjuster_Node Adjuster_Node::prototype;
@@ -468,8 +468,8 @@ public:
return new Fl_Dial(x, y, w, h);
}
Widget_Node *_make() override { return new Dial_Node(); }
- Type type() const override { return Type::Dial; }
- bool is_a(Type inType) const override { return (inType==Type::Dial) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Dial; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Dial) ? true : super::is_a(inType); }
};
Dial_Node Dial_Node::prototype;
@@ -506,8 +506,8 @@ public:
return new Fl_Roller(x, y, w, h);
}
Widget_Node *_make() override { return new Roller_Node(); }
- Type type() const override { return Type::Roller; }
- bool is_a(Type inType) const override { return (inType==Type::Roller) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Roller; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Roller) ? true : super::is_a(inType); }
};
Roller_Node Roller_Node::prototype;
@@ -550,8 +550,8 @@ public:
return new Fl_Slider(x, y, w, h, "slider:");
}
Widget_Node *_make() override { return new Slider_Node(); }
- Type type() const override { return Type::Slider; }
- bool is_a(Type inType) const override { return (inType==Type::Slider) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Slider; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Slider) ? true : super::is_a(inType); }
};
Slider_Node Slider_Node::prototype;
@@ -582,8 +582,8 @@ public:
return new Fl_Scrollbar(x, y, w, h);
}
Widget_Node *_make() override { return new Scrollbar_Node(); }
- Type type() const override { return Type::Scrollbar; }
- bool is_a(Type inType) const override { return (inType==Type::Scrollbar) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Scrollbar; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Scrollbar) ? true : super::is_a(inType); }
};
Scrollbar_Node Scrollbar_Node::prototype;
@@ -618,8 +618,8 @@ public:
return new Fl_Value_Slider(x, y, w, h, "slider:");
}
Widget_Node *_make() override { return new Value_Slider_Node(); }
- Type type() const override { return Type::Value_Slider; }
- bool is_a(Type inType) const override { return (inType==Type::Value_Slider) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Value_Slider; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Value_Slider) ? true : super::is_a(inType); }
};
Value_Slider_Node Value_Slider_Node::prototype;
@@ -661,8 +661,8 @@ public:
return myo;
}
Widget_Node *_make() override { return new Value_Input_Node(); }
- Type type() const override { return Type::Value_Input; }
- bool is_a(Type inType) const override { return (inType==Type::Value_Input) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Value_Input; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Value_Input) ? true : super::is_a(inType); }
};
Value_Input_Node Value_Input_Node::prototype;
@@ -704,8 +704,8 @@ public:
return myo;
}
Widget_Node *_make() override { return new Value_Output_Node(); }
- Type type() const override { return Type::Value_Output; }
- bool is_a(Type inType) const override { return (inType==Type::Value_Output) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Value_Output; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Value_Output) ? true : super::is_a(inType); }
};
Value_Output_Node Value_Output_Node::prototype;
@@ -764,8 +764,8 @@ public:
return myo;
}
Widget_Node *_make() override { return new Input_Node(); }
- Type type() const override { return Type::Input; }
- bool is_a(Type inType) const override { return (inType==Type::Input) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Input; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Input) ? true : super::is_a(inType); }
void copy_properties() override {
Widget_Node::copy_properties();
Fl_Input_ *d = (Fl_Input_*)live_widget, *s = (Fl_Input_*)o;
@@ -806,8 +806,8 @@ public:
return myo;
}
Widget_Node *_make() override { return new File_Input_Node(); }
- Type type() const override { return Type::File_Input; }
- bool is_a(Type inType) const override { return (inType==Type::File_Input) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_File_Input; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_File_Input) ? true : super::is_a(inType); }
};
File_Input_Node File_Input_Node::prototype;
@@ -840,8 +840,8 @@ public:
return myo;
}
Widget_Node *_make() override { return new Output_Node(); }
- Type type() const override { return Type::Output; }
- bool is_a(Type inType) const override { return (inType==Type::Output) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Output; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Output) ? true : super::is_a(inType); }
};
Output_Node Output_Node::prototype;
@@ -894,8 +894,8 @@ public:
return myo;
}
Widget_Node *_make() override { return new Text_Display_Node(); }
- Type type() const override { return Type::Text_Display; }
- bool is_a(Type inType) const override { return (inType==Type::Text_Display) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Text_Display; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Text_Display) ? true : super::is_a(inType); }
};
Text_Display_Node Text_Display_Node::prototype;
@@ -924,8 +924,8 @@ public:
return myo;
}
Widget_Node *_make() override { return new Text_Editor_Node(); }
- Type type() const override { return Type::Text_Editor; }
- bool is_a(Type inType) const override { return (inType==Type::Text_Editor) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Text_Editor; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Text_Editor) ? true : super::is_a(inType); }
};
Text_Editor_Node Text_Editor_Node::prototype;
@@ -1019,8 +1019,8 @@ public:
return 1;
}
Widget_Node *_make() override {return new Terminal_Node();}
- Type type() const override { return Type::Terminal; }
- bool is_a(Type inType) const override { return (inType==Type::Terminal) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Terminal; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Terminal) ? true : super::is_a(inType); }
};
Terminal_Node Terminal_Node::prototype;
@@ -1051,8 +1051,8 @@ public:
return new Fl_Box(x, y, w, h, "label");
}
Widget_Node *_make() override { return new Box_Node(); }
- Type type() const override { return Type::Box; }
- bool is_a(Type inType) const override { return (inType==Type::Box) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Box; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Box) ? true : super::is_a(inType); }
};
Box_Node Box_Node::prototype;
@@ -1080,8 +1080,8 @@ public:
return new Fl_Clock(x, y, w, h);
}
Widget_Node *_make() override { return new Clock_Node(); }
- Type type() const override { return Type::Clock; }
- bool is_a(Type inType) const override { return (inType==Type::Clock) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Clock; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Clock) ? true : super::is_a(inType); }
};
Clock_Node Clock_Node::prototype;
@@ -1114,8 +1114,8 @@ public:
return myo;
}
Widget_Node *_make() override { return new Progress_Node(); }
- Type type() const override { return Type::Progress; }
- bool is_a(Type inType) const override { return (inType==Type::Progress) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Progress; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Progress) ? true : super::is_a(inType); }
};
Progress_Node Progress_Node::prototype;
@@ -1164,8 +1164,8 @@ public:
return new Fl_Spinner(x, y, w, h, "spinner:");
}
Widget_Node *_make() override { return new Spinner_Node(); }
- Type type() const override { return Type::Spinner; }
- bool is_a(Type inType) const override { return (inType==Type::Spinner) ? true : super::is_a(inType); }
+ Type type() const override { return FLD_NODE_TYPE_Spinner; }
+ bool is_a(Type inType) const override { return (inType==FLD_NODE_TYPE_Spinner) ? true : super::is_a(inType); }
};
Spinner_Node Spinner_Node::prototype;
@@ -1285,7 +1285,7 @@ Node *add_new_widget_from_user(Node *inPrototype, Strategy strategy, bool and_op
auto layout = Fluid.proj.layout;
Node *t = ((Node*)inPrototype)->make(strategy);
if (t) {
- if (t->is_widget() && !t->is_a(Type::Window)) {
+ if (t->is_widget() && !t->is_a(FLD_NODE_TYPE_Window)) {
auto layout = Fluid.proj.layout;
Widget_Node *wt = (Widget_Node *)t;
bool changed = false;
@@ -1312,14 +1312,14 @@ Node *add_new_widget_from_user(Node *inPrototype, Strategy strategy, bool and_op
wt->textstuff(2, f, s, c);
}
- if (changed && t->is_a(Type::Menu_Item)) {
+ if (changed && t->is_a(FLD_NODE_TYPE_Menu_Item)) {
Node * tt = t->parent;
- while (tt && !tt->is_a(Type::Menu_Manager_)) tt = tt->parent;
+ while (tt && !tt->is_a(FLD_NODE_TYPE_Menu_Manager_)) tt = tt->parent;
if (tt)
((Menu_Manager_Node*)tt)->build_menu();
}
}
- if (t->is_true_widget() && !t->is_a(Type::Window)) {
+ if (t->is_true_widget() && !t->is_a(FLD_NODE_TYPE_Window)) {
// Resize and/or reposition new widget...
Widget_Node *wt = (Widget_Node *)t;
@@ -1328,13 +1328,13 @@ Node *add_new_widget_from_user(Node *inPrototype, Strategy strategy, bool and_op
int w = 0, h = 0;
wt->ideal_size(w, h);
- if ((t->parent && t->parent->is_a(Type::Flex))) {
+ if ((t->parent && t->parent->is_a(FLD_NODE_TYPE_Flex))) {
if (Window_Node::popupx != 0x7FFFFFFF)
((Flex_Node*)t->parent)->insert_child_at(((Widget_Node*)t)->o, Window_Node::popupx, Window_Node::popupy);
t->parent->layout_widget();
- } else if ( wt->is_a(Type::Group)
+ } else if ( wt->is_a(FLD_NODE_TYPE_Group)
&& wt->parent
- && wt->parent->is_a(Type::Tabs)
+ && wt->parent->is_a(FLD_NODE_TYPE_Tabs)
//&& (Window_Node::popupx == 0x7FFFFFFF)
&& (layout->top_tabs_margin > 0)) {
// If the widget is a group and the parent is tabs and the top tabs
@@ -1343,9 +1343,9 @@ Node *add_new_widget_from_user(Node *inPrototype, Strategy strategy, bool and_op
Fl_Widget *po = ((Tabs_Node*)wt->parent)->o;
wt->o->resize(po->x(), po->y() + layout->top_tabs_margin,
po->w(), po->h() - layout->top_tabs_margin);
- } else if ( wt->is_a(Type::Menu_Bar)
+ } else if ( wt->is_a(FLD_NODE_TYPE_Menu_Bar)
&& wt->parent
- && wt->parent->is_a(Type::Window)
+ && wt->parent->is_a(FLD_NODE_TYPE_Window)
&& (wt->prev == wt->parent)) {
// If this is the first child of a window, make the menu bar as wide as
// the window and drop it at 0, 0. Otherwise just use the suggested size.
@@ -1362,7 +1362,7 @@ Node *add_new_widget_from_user(Node *inPrototype, Strategy strategy, bool and_op
wt->o->size(w, h);
}
}
- if (t->parent && t->parent->is_a(Type::Grid)) {
+ if (t->parent && t->parent->is_a(FLD_NODE_TYPE_Grid)) {
if (Window_Node::popupx != 0x7FFFFFFF) {
((Grid_Node*)t->parent)->insert_child_at(((Widget_Node*)t)->o, Window_Node::popupx, Window_Node::popupy);
} else {
@@ -1370,7 +1370,7 @@ Node *add_new_widget_from_user(Node *inPrototype, Strategy strategy, bool and_op
}
}
}
- if (t->is_a(Type::Window)) {
+ if (t->is_a(FLD_NODE_TYPE_Window)) {
int x = 0, y = 0, w = 480, h = 320;
Window_Node *wt = (Window_Node *)t;
wt->ideal_size(w, h);