summaryrefslogtreecommitdiff
path: root/fluid/file.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2023-11-02 15:18:03 +0100
committerMatthias Melcher <github@matthiasm.com>2023-11-02 15:18:09 +0100
commit9ca4aed1fa13df227ddebe4fed4353d9156ab414 (patch)
tree1dd01a98891b7941126f6ad377b436f21bbf5da9 /fluid/file.cxx
parent040607b59574f39d92d3cc03dd10e347790869d3 (diff)
FLUID: Adds more interactive editing to Fl_Grid
* this commit introduces a few FIXMEs and TODOs that probably can't be solved until we do some major refactoring. They work for now, but adding more layout controlling widgets will be hard.
Diffstat (limited to 'fluid/file.cxx')
-rw-r--r--fluid/file.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/fluid/file.cxx b/fluid/file.cxx
index 96206b39e..9694d5623 100644
--- a/fluid/file.cxx
+++ b/fluid/file.cxx
@@ -25,6 +25,7 @@
#include "factory.h"
#include "Fl_Function_Type.h"
#include "Fl_Widget_Type.h"
+#include "Fl_Grid_Type.h"
#include "Fl_Window_Type.h"
#include "alignment_panel.h"
#include "widget_browser.h"
@@ -391,6 +392,17 @@ Fl_Type *Fd_Project_Reader::read_children(Fl_Type *p, int merge, Strategy strate
}
read_children(t, 0, strategy, skip_options);
t->postprocess_read();
+ // FIXME: this has no business in the file reader!
+ // TODO: this is called whenever something is pasted from the top level into a grid
+ // It makes sense to make this more universal for other widget types too.
+ if (merge && t && t->parent && t->parent->is_a(ID_Grid)) {
+ if (Fl_Window_Type::popupx != 0x7FFFFFFF) {
+ ((Fl_Grid_Type*)t->parent)->insert_child_at(((Fl_Widget_Type*)t)->o, Fl_Window_Type::popupx, Fl_Window_Type::popupy);
+ } else {
+ ((Fl_Grid_Type*)t->parent)->insert_child(((Fl_Widget_Type*)t)->o);
+ }
+ }
+
t->layout_widget();
}
@@ -425,6 +437,7 @@ int Fd_Project_Reader::read_project(const char *filename, int merge, Strategy st
else
g_project.reset();
read_children(Fl_Type::current, merge, strategy);
+ // clear this
Fl_Type::current = 0;
// Force menu items to be rebuilt...
for (o = Fl_Type::first; o; o = o->next) {