summaryrefslogtreecommitdiff
path: root/fluid/Fl_Menu_Type.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2024-12-27 20:56:02 -0500
committerMatthias Melcher <github@matthiasm.com>2024-12-27 20:56:10 -0500
commit050cbabdfe2fdbd1337736f017456012e2437b2d (patch)
tree21efed95ef5368e67a7a6377ab0a3a2f936e4426 /fluid/Fl_Menu_Type.cxx
parent2100655a1b55d1c77932b649b758f2eab1107fcb (diff)
Fluid: Rename Stratgy constants to comply with CMP.
Capitalized constants. Added flag to indicate creation by user or file. Removed global variable 'reading_file'.
Diffstat (limited to 'fluid/Fl_Menu_Type.cxx')
-rw-r--r--fluid/Fl_Menu_Type.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/fluid/Fl_Menu_Type.cxx b/fluid/Fl_Menu_Type.cxx
index 23a7868fb..35670766b 100644
--- a/fluid/Fl_Menu_Type.cxx
+++ b/fluid/Fl_Menu_Type.cxx
@@ -162,10 +162,11 @@ Fl_Type *Fl_Menu_Item_Type::make(Strategy strategy) {
Fl_Type* Fl_Menu_Item_Type::make(int flags, Strategy strategy) {
// Find a good insert position based on the current marked node
Fl_Type *anchor = Fl_Type::current, *p = anchor;
- if (p && (strategy == kAddAfterCurrent)) p = p->parent;
+ if (p && (strategy.placement() == Strategy::AFTER_CURRENT))
+ p = p->parent;
while (p && !(p->is_a(ID_Menu_Manager_) || p->is_a(ID_Submenu))) {
anchor = p;
- strategy = kAddAfterCurrent;
+ strategy.placement(Strategy::AFTER_CURRENT);
p = p->parent;
}
if (!p) {
@@ -186,7 +187,7 @@ Fl_Type* Fl_Menu_Item_Type::make(int flags, Strategy strategy) {
t->o->type(flags);
t->factory = this;
t->add(anchor, strategy);
- if (!reading_file) {
+ if (strategy.source() == Strategy::FROM_USER) {
if (flags==FL_SUBMENU) {
t->label("submenu");
} else {
@@ -209,14 +210,14 @@ void group_selected_menuitems() {
}
undo_checkpoint();
undo_suspend();
- Fl_Widget_Type *n = (Fl_Widget_Type*)(q->make(FL_SUBMENU, kAddAfterCurrent));
+ Fl_Widget_Type *n = (Fl_Widget_Type*)(q->make(FL_SUBMENU, Strategy::AFTER_CURRENT));
for (Fl_Type *t = qq->next; t && (t->level > qq->level);) {
if (t->level != n->level || t == n || !t->selected) {
t = t->next;
continue;
}
Fl_Type *nxt = t->remove();
- t->add(n, kAddAsLastChild);
+ t->add(n, Strategy::AS_LAST_CHILD);
t = nxt;
}
widget_browser->rebuild();