diff options
| author | Matthias Melcher <github@matthiasm.com> | 2024-09-14 01:10:35 +0200 |
|---|---|---|
| committer | Matthias Melcher <github@matthiasm.com> | 2024-09-14 01:10:41 +0200 |
| commit | e7f1247552fbb9d056d4c68eb51564a504df3161 (patch) | |
| tree | cbaa15d7d58359d0fd59e86711881179ad34e134 /fluid/Fl_Window_Type.cxx | |
| parent | bb917628ffa8ffc6cafc79da80344c8c9c653969 (diff) | |
FLUID: type node placement in scene graph revised
- fixes copy/paste operation that would place pasted types wrong
- improves paste into folded and unfolded groups
- improves duplication of multiple types
- much improved placement of types that don;t fit at the
requested position
- some more testing will follow in the next days
Diffstat (limited to 'fluid/Fl_Window_Type.cxx')
| -rw-r--r-- | fluid/Fl_Window_Type.cxx | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/fluid/Fl_Window_Type.cxx b/fluid/Fl_Window_Type.cxx index 4b4944d8e..55f66e6cf 100644 --- a/fluid/Fl_Window_Type.cxx +++ b/fluid/Fl_Window_Type.cxx @@ -227,8 +227,13 @@ int Overlay_Window::handle(int e) { \return new node */ Fl_Type *Fl_Window_Type::make(Strategy strategy) { - Fl_Type *p = Fl_Type::current; - while (p && (!p->is_code_block() || p->is_a(ID_Widget_Class))) p = p->parent; + Fl_Type *anchor = Fl_Type::current, *p = anchor; + if (p && (strategy == kAddAfterCurrent)) p = p->parent; + while (p && (!p->is_code_block() || p->is_a(ID_Widget_Class))) { + anchor = p; + strategy = kAddAfterCurrent; + p = p->parent; + } if (!p) { fl_message("Please select a function"); return 0; @@ -245,7 +250,7 @@ Fl_Type *Fl_Window_Type::make(Strategy strategy) { w->size_range(10, 10); w->window = myo; myo->o = w; - myo->add(p, strategy); + myo->add(anchor, strategy); myo->modal = 0; myo->non_modal = 0; return myo; @@ -1363,8 +1368,13 @@ Fl_Widget_Class_Type *current_widget_class = 0; \return new node */ Fl_Type *Fl_Widget_Class_Type::make(Strategy strategy) { - Fl_Type *p = Fl_Type::current; - while (p && (!p->is_decl_block() || (p->is_widget() && p->is_class()))) p = p->parent; + Fl_Type *anchor = Fl_Type::current, *p = anchor; + if (p && (strategy == kAddAfterCurrent)) p = p->parent; + while (p && (!p->is_decl_block() || (p->is_widget() && p->is_class()))) { + anchor = p; + strategy = kAddAfterCurrent; + p = p->parent; + } Fl_Widget_Class_Type *myo = new Fl_Widget_Class_Type(); myo->name("UserInterface"); @@ -1379,7 +1389,7 @@ Fl_Type *Fl_Widget_Class_Type::make(Strategy strategy) { w->size_range(10, 10); w->window = myo; myo->o = w; - myo->add(p, strategy); + myo->add(anchor, strategy); myo->modal = 0; myo->non_modal = 0; myo->wc_relative = 0; |
