diff options
| author | maxim nikonov <maxim.nikonov@hqo.co> | 2026-02-05 23:48:25 +0500 |
|---|---|---|
| committer | maxim nikonov <maxim.nikonov@hqo.co> | 2026-02-05 23:48:25 +0500 |
| commit | c53067d2f6cfd6e3c6b476c51ab8c4b931e40a30 (patch) | |
| tree | 95bfab59b2d9a38a57b6aa05244cab2d0435c7d2 /fluid/nodes/Menu_Node.cxx | |
| parent | 57860e277f2298ad6c0830b1492087cfa124c862 (diff) | |
wip
Diffstat (limited to 'fluid/nodes/Menu_Node.cxx')
| -rw-r--r-- | fluid/nodes/Menu_Node.cxx | 62 |
1 files changed, 31 insertions, 31 deletions
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())); } |
