diff options
| author | Matthias Melcher <git@matthiasm.com> | 2021-12-11 19:43:00 +0100 |
|---|---|---|
| committer | Matthias Melcher <github@matthiasm.com> | 2021-12-13 18:17:07 +0100 |
| commit | 160832ce04f932fbb3df199aa01d1c93148bb292 (patch) | |
| tree | d1ce303700666997a8608b7a488a25e633f07804 /fluid/fluid.cxx | |
| parent | a802aaeb170e3c233c5d92ae29d8703a0b9c2768 (diff) | |
STR 3442: copy/paste now inserts widget as expected.
Fluid would add pasted widgets as the last child of the
current group, even if they were cut at the beginning
of the group. This patch adds a 'startegy' to adding
widgets to allow merging closer to the 'current' widget.
Also added d'n'd for the widget bin and some other
UI improvements.
STR 3442: some preparation, variable renaming
STR 3442: unifying functions to add widgets.
Adding widgets interactively is merged into one function,
making undo/redo work as expected and removing
unexpected differences between adding by menu or bin.
STR 3442: adding drag'n'drop for windows from bin.
Just drag the window symbol out of the tree and drop it anywhere
on the desktop.
Visual representation of dragged Window.
STR 3442: insert individual nodes after 'current'
STR 3442: adding new widget at expected positions.
The widget bin can finally do drag'n'drop.
Widgets appear in the tree close to the last selection.
Duplicating now ads right below.
Cut and paste inserts after last selection.
Fluid: replaced #define with strict enum type.
Diffstat (limited to 'fluid/fluid.cxx')
| -rw-r--r-- | fluid/fluid.cxx | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/fluid/fluid.cxx b/fluid/fluid.cxx index 0f049b880..f584e182d 100644 --- a/fluid/fluid.cxx +++ b/fluid/fluid.cxx @@ -99,7 +99,9 @@ int G_debug = 0; char G_external_editor_command[512]; -/// \todo Functionality unclear. +/// 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. @@ -197,10 +199,10 @@ const char* i18n_set = ""; /// \todo document me char i18n_program[FL_PATH_MAX] = ""; -/// \todo document me +/// Offset in pixels when adding widgets from an .fl file. int pasteoffset = 0; -/// \todo document me +/// Paste offset incrementing at every paste command. static int ipasteoffset = 0; @@ -999,11 +1001,16 @@ void delete_cb(Fl_Widget *, void *) { void paste_cb(Fl_Widget*, void*) { //if (ipasteoffset) force_parent = 1; pasteoffset = ipasteoffset; + // TODO: make the paste offset more predictable, if any at all. + // TODO: Don't use the grid if the user switched it off. if (gridx>1) pasteoffset = ((pasteoffset-1)/gridx+1)*gridx; if (gridy>1) pasteoffset = ((pasteoffset-1)/gridy+1)*gridy; undo_checkpoint(); undo_suspend(); - if (!read_file(cutfname(), 1)) { + Strategy strategy = kAddAfterCurrent; + if (Fl_Type::current && Fl_Type::current->is_group()) + strategy = kAddAsLastChild; + if (!read_file(cutfname(), 1, strategy)) { fl_message("Can't read %s: %s", cutfname(), strerror(errno)); } undo_resume(); @@ -1031,7 +1038,7 @@ void duplicate_cb(Fl_Widget*, void*) { undo_checkpoint(); undo_suspend(); - if (!read_file(cutfname(1), 1)) { + if (!read_file(cutfname(1), 1, kAddAfterCurrent)) { fl_message("Can't read %s: %s", cutfname(1), strerror(errno)); } fl_unlink(cutfname(1)); |
