summaryrefslogtreecommitdiff
path: root/fluid/Fl_Window_Type.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/Fl_Window_Type.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/Fl_Window_Type.cxx')
-rw-r--r--fluid/Fl_Window_Type.cxx24
1 files changed, 21 insertions, 3 deletions
diff --git a/fluid/Fl_Window_Type.cxx b/fluid/Fl_Window_Type.cxx
index 93e40c0b8..451f4dbea 100644
--- a/fluid/Fl_Window_Type.cxx
+++ b/fluid/Fl_Window_Type.cxx
@@ -621,6 +621,13 @@ void Fl_Window_Type::draw_overlay() {
Fl_Widget_Type* myo = (Fl_Widget_Type*)q;
int x,y,r,t;
newposition(myo,x,y,r,t);
+ if (show_guides) {
+ // If we are in a drag operation, and the parent is a grid, show the grid overlay
+ if (drag && q->parent && q->parent->is_a(ID_Grid)) {
+ Fl_Grid_Proxy *grid = ((Fl_Grid_Proxy*)((Fl_Grid_Type*)q->parent)->o);
+ grid->draw_overlay();
+ }
+ }
if (!show_guides || !drag || numselected != 1) {
if (Fl_Flex_Type::parent_is_flex(q) && Fl_Flex_Type::is_fixed(q)) {
Fl_Flex *flex = ((Fl_Flex*)((Fl_Flex_Type*)q->parent)->o);
@@ -630,6 +637,9 @@ void Fl_Window_Type::draw_overlay() {
} else {
draw_height(wgt->x()+15, wgt->y(), wgt->y()+wgt->h(), FL_ALIGN_CENTER);
}
+ } else if (q->is_a(ID_Grid)) {
+ Fl_Grid_Proxy *grid = ((Fl_Grid_Proxy*)((Fl_Grid_Type*)q)->o);
+ grid->draw_overlay();
}
fl_rect(x,y,r-x,t-y);
}
@@ -882,11 +892,19 @@ void Fl_Window_Type::moveallchildren(int key)
allow_layout--;
} else if (myo->parent && myo->parent->is_a(ID_Grid)) {
Fl_Grid_Type* gt = (Fl_Grid_Type*)myo->parent;
- if (drag & FD_DRAG) {
- gt->insert_child_at(myo->o, Fl::event_x(), Fl::event_y());
+ Fl_Grid* g = (Fl_Grid*)gt->o;
+ if (key) {
+ gt->keyboard_move_child(myo, key);
} else {
- gt->child_resized(myo);
+ if (drag & FD_DRAG) {
+ gt->insert_child_at(myo->o, Fl::event_x(), Fl::event_y());
+ } else {
+ gt->child_resized(myo);
+ }
}
+ allow_layout++;
+ g->layout();
+ allow_layout--;
} else if (myo->parent && myo->parent->is_a(ID_Group)) {
Fl_Group_Type* gt = (Fl_Group_Type*)myo->parent;
((Fl_Group*)gt->o)->init_sizes();