summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2005-08-15 20:40:16 +0000
committerMatthias Melcher <fltk@matthiasm.com>2005-08-15 20:40:16 +0000
commit41c089f3c13261e4606d43c1682fb4b3501e6670 (patch)
tree1a7e909f2a65009de8b4694edf0eb6b4be408ebc
parentc38c41a0c67211d90c87b92364d593e3362b0467 (diff)
Dottet label selection box and standard widget selection boxes would not always align when snapping was enabled. Also, the dragging indicators would not snap. (STR #964)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4514 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--CHANGES1
-rw-r--r--fluid/Fl_Type.h3
-rw-r--r--fluid/Fl_Window_Type.cxx7
3 files changed, 9 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index 7ca8eaf84..d69d9a34a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -3,6 +3,7 @@ CHANGES IN FLTK 1.1.7
- Documentation fixes (STR #571, STR #648, STR #692, STR
#730, STR #744, STR #745, STR #931, STR #942, STR #960,
STR #969)
+ - FLUID selection boxes now synchronised (STR #964)
- fl_filename_list now recognizes pathnames without trailing
slash as directions (STR #854)
- Fl_Text_Display now auto-scrolls in all
diff --git a/fluid/Fl_Type.h b/fluid/Fl_Type.h
index 4c7d18af5..8220273bb 100644
--- a/fluid/Fl_Type.h
+++ b/fluid/Fl_Type.h
@@ -464,7 +464,8 @@ protected:
friend class Overlay_Window;
int mx,my; // mouse position during dragging
int x1,y1; // initial position of selection box
- int bx,by,br,bt; // bounding box of selection
+ int bx,by,br,bt; // bounding box of selection before snapping
+ int sx,sy,sr,st; // bounding box of selection after snapping to guides
int dx,dy;
int drag; // which parts of bbox are being moved
int numselected; // number of children selected
diff --git a/fluid/Fl_Window_Type.cxx b/fluid/Fl_Window_Type.cxx
index 44c9f61da..9223ae918 100644
--- a/fluid/Fl_Window_Type.cxx
+++ b/fluid/Fl_Window_Type.cxx
@@ -647,6 +647,7 @@ void Fl_Window_Type::draw_overlay() {
if (myo->o->y()+myo->o->h() > bt) bt = myo->o->y()+myo->o->h();
}
recalc = 0;
+ sx = bx; sy = by; sr = br; st = bt;
}
fl_color(FL_RED);
if (drag==BOX && (x1 != mx || y1 != my)) {
@@ -695,7 +696,7 @@ void Fl_Window_Type::draw_overlay() {
// - check for distance to the window edge
// * FLTK suggests 10 pixels from the edge
int d;
- int xsp, ysp;
+ int xsp, ysp, mybx_bak = mybx, myby_bak = myby;
Fl_Widget_Type *mysel = (Fl_Widget_Type *)selection;
@@ -973,7 +974,11 @@ void Fl_Window_Type::draw_overlay() {
}
}
}
+ mysx += mybx-mybx_bak; mysr += mybx-mybx_bak;
+ mysy += myby-myby_bak; myst += myby-myby_bak;
}
+ // align the snapping selection box with the box we draw.
+ sx = mysx; sy = mysy; sr = mysr; st = myst;
// Draw selection box + resize handles...
// draw box including all labels