summaryrefslogtreecommitdiff
path: root/fluid/Fl_Window_Type.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2023-11-02 17:45:30 +0100
committerMatthias Melcher <github@matthiasm.com>2023-11-02 17:45:36 +0100
commit7c6266f67ef12f24e165fcb975b134dd867b2d45 (patch)
tree69109d9737cd62550b2dc9f10074604d62695344 /fluid/Fl_Window_Type.cxx
parent9ca4aed1fa13df227ddebe4fed4353d9156ab414 (diff)
FLUID: Simplifies and improves Ghosted Outlines
Diffstat (limited to 'fluid/Fl_Window_Type.cxx')
-rw-r--r--fluid/Fl_Window_Type.cxx18
1 files changed, 15 insertions, 3 deletions
diff --git a/fluid/Fl_Window_Type.cxx b/fluid/Fl_Window_Type.cxx
index 451f4dbea..b20a3bf7e 100644
--- a/fluid/Fl_Window_Type.cxx
+++ b/fluid/Fl_Window_Type.cxx
@@ -141,6 +141,13 @@ void Overlay_Window::close_cb(Overlay_Window *self, void*) {
self->hide();
}
+// Use this when drawing flat boxes while editing, so users can see the outline,
+// even if the group and its parent have the same color.
+static void fd_flat_box_ghosted(int x, int y, int w, int h, Fl_Color c) {
+ fl_rectf(x, y, w, h, Fl::box_color(c));
+ fl_rect(x, y, w, h, Fl::box_color(fl_color_average(FL_FOREGROUND_COLOR, c, .1f)));
+}
+
void Overlay_Window::draw() {
const int CHECKSIZE = 8;
// see if box is clear or a frame or rounded:
@@ -154,7 +161,14 @@ void Overlay_Window::draw() {
fl_rectf(X,Y,CHECKSIZE,CHECKSIZE);
}
}
- Fl_Overlay_Window::draw();
+ if (show_ghosted_outline) {
+ Fl_Box_Draw_F *old_flat_box = Fl::get_boxtype(FL_FLAT_BOX);
+ Fl::set_boxtype(FL_FLAT_BOX, fd_flat_box_ghosted, 0, 0, 0, 0);
+ Fl_Overlay_Window::draw();
+ Fl::set_boxtype(FL_FLAT_BOX, old_flat_box, 0, 0, 0, 0);
+ } else {
+ Fl_Overlay_Window::draw();
+ }
}
extern Fl_Window *main_window;
@@ -684,8 +698,6 @@ void Fl_Window_Type::draw_overlay() {
Fd_Snap_Data data = { dx, dy, sx, sy, sr, st, drag, 4, 4, dx, dy, (Fl_Widget_Type*)selection, this};
Fd_Snap_Action::draw_all(data);
}
-
- // TODO: for invisible boxes (NONE, FLAT, etc.) draw a faint outline when dragging
}
extern Fl_Menu_Item Main_Menu[];