summaryrefslogtreecommitdiff
path: root/fluid/fluid.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2024-09-14 01:10:35 +0200
committerMatthias Melcher <github@matthiasm.com>2024-09-14 01:10:41 +0200
commite7f1247552fbb9d056d4c68eb51564a504df3161 (patch)
treecbaa15d7d58359d0fd59e86711881179ad34e134 /fluid/fluid.cxx
parentbb917628ffa8ffc6cafc79da80344c8c9c653969 (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/fluid.cxx')
-rw-r--r--fluid/fluid.cxx18
1 files changed, 6 insertions, 12 deletions
diff --git a/fluid/fluid.cxx b/fluid/fluid.cxx
index ffd2edfee..e690c5f7e 100644
--- a/fluid/fluid.cxx
+++ b/fluid/fluid.cxx
@@ -106,11 +106,6 @@ int G_debug = 0;
char G_external_editor_command[512];
-/// If set, if the `current` node is a group, and a new group is added, it will
-/// be added as sibling to the first group instead of inside the group.
-/// \todo Needs to be verified.
-int force_parent = 0;
-
/// This is set to create different labels when creating new widgets.
/// \todo Details unclear.
int reading_file = 0;
@@ -1411,13 +1406,16 @@ void delete_cb(Fl_Widget *, void *) {
User chose to paste the widgets from the cut buffer.
*/
void paste_cb(Fl_Widget*, void*) {
- //if (ipasteoffset) force_parent = 1;
pasteoffset = ipasteoffset;
undo_checkpoint();
undo_suspend();
Strategy strategy = kAddAfterCurrent;
- if (Fl_Type::current && Fl_Type::current->is_a(ID_Group))
- strategy = kAddAsLastChild;
+ if (Fl_Type::current && Fl_Type::current->is_a(ID_Group)) {
+ Fl_Group_Type *current_group = static_cast<Fl_Group_Type*>(Fl_Type::current);
+ if (current_group->folded_ == 0) {
+ strategy = kAddAsLastChild;
+ }
+ }
if (!read_file(cutfname(), 1, strategy)) {
widget_browser->rebuild();
fl_message("Can't read %s: %s", cutfname(), strerror(errno));
@@ -1427,7 +1425,6 @@ void paste_cb(Fl_Widget*, void*) {
widget_browser->rebuild();
pasteoffset = 0;
ipasteoffset += 10;
- force_parent = 0;
}
/**
@@ -1447,7 +1444,6 @@ void duplicate_cb(Fl_Widget*, void*) {
}
pasteoffset = 0;
- force_parent = 1;
undo_checkpoint();
undo_suspend();
@@ -1458,8 +1454,6 @@ void duplicate_cb(Fl_Widget*, void*) {
widget_browser->display(Fl_Type::current);
widget_browser->rebuild();
undo_resume();
-
- force_parent = 0;
}
/**