From 48f107775d2a1363522aa96e92d07c876a6f759a Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Sun, 31 Oct 2010 19:35:23 +0000 Subject: Fixed outside label redraw damage areas (STR #2436) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7787 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- CHANGES | 1 + fluid/fluid.cxx | 2 +- src/Fl.cxx | 41 ++++++++++++++++++++++++++++++----------- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/CHANGES b/CHANGES index 2710de028..0e341d309 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,6 @@ CHANGES IN FLTK 1.3.0 + - Fixed outside label redraw damage areas (STR #2436) - Added callback when double-clicking file in a file chooser (STR #2346) - Fixed label alignment (STR #2436) diff --git a/fluid/fluid.cxx b/fluid/fluid.cxx index 0ec8c609d..796a93085 100644 --- a/fluid/fluid.cxx +++ b/fluid/fluid.cxx @@ -25,7 +25,7 @@ // http://www.fltk.org/str.php // -#define IDE_SUPPORT +#undef IDE_SUPPORT #include #include diff --git a/src/Fl.cxx b/src/Fl.cxx index ec5750617..9ebf023f6 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -1414,17 +1414,36 @@ void Fl_Widget::redraw_label() { W += 5; // Add a little to the size of the label to cover overflow H += 5; - // FIXME: this does not take all outside label positions into account! - if (align() & FL_ALIGN_BOTTOM) { - window()->damage(FL_DAMAGE_EXPOSE, x(), y() + h(), w(), H); - } else if (align() & FL_ALIGN_TOP) { - window()->damage(FL_DAMAGE_EXPOSE, x(), y() - H, w(), H); - } else if (align() & FL_ALIGN_LEFT) { - window()->damage(FL_DAMAGE_EXPOSE, x() - W, y(), W, h()); - } else if (align() & FL_ALIGN_RIGHT) { - window()->damage(FL_DAMAGE_EXPOSE, x() + w(), y(), W, h()); - } else { - window()->damage(FL_DAMAGE_ALL); + // FIXME: + // This assumes the measure() returns the correct outline, which it does + // not in all possible cases of alignment combinedwith image and symbols. + switch (align() & 0x0f) { + case FL_ALIGN_TOP_LEFT: + window()->damage(FL_DAMAGE_EXPOSE, x(), y()-H, W, H); break; + case FL_ALIGN_TOP: + window()->damage(FL_DAMAGE_EXPOSE, x()+(w()-W)/2, y()-H, W, H); break; + case FL_ALIGN_TOP_RIGHT: + window()->damage(FL_DAMAGE_EXPOSE, x()+w()-W, y()-H, W, H); break; + case FL_ALIGN_LEFT_TOP: + window()->damage(FL_DAMAGE_EXPOSE, x()-W, y(), W, H); break; + case FL_ALIGN_RIGHT_TOP: + window()->damage(FL_DAMAGE_EXPOSE, x()+w(), y(), W, H); break; + case FL_ALIGN_LEFT: + window()->damage(FL_DAMAGE_EXPOSE, x()-W, y()+(h()-H)/2, W, H); break; + case FL_ALIGN_RIGHT: + window()->damage(FL_DAMAGE_EXPOSE, x()+w(), y()+(h()-H)/2, W, H); break; + case FL_ALIGN_LEFT_BOTTOM: + window()->damage(FL_DAMAGE_EXPOSE, x()-W, y()+h()-H, W, H); break; + case FL_ALIGN_RIGHT_BOTTOM: + window()->damage(FL_DAMAGE_EXPOSE, x()+w(), y()+h()-H, W, H); break; + case FL_ALIGN_BOTTOM_LEFT: + window()->damage(FL_DAMAGE_EXPOSE, x(), y()+h(), W, H); break; + case FL_ALIGN_BOTTOM: + window()->damage(FL_DAMAGE_EXPOSE, x()+(w()-W)/2, y()+h(), W, H); break; + case FL_ALIGN_BOTTOM_RIGHT: + window()->damage(FL_DAMAGE_EXPOSE, x()+w()-W, y()+h(), W, H); break; + default: + window()->damage(FL_DAMAGE_ALL); break; } } else { // The label is inside the widget, so just redraw the widget itself... -- cgit v1.2.3