Author: matt
Date: 2010-10-31 12:35:23 -0700 (Sun, 31 Oct 2010)
New Revision: 7787
Log:
Fixed outside label redraw damage areas (STR #2436)

Modified:
   branches/branch-1.3/CHANGES
   branches/branch-1.3/fluid/fluid.cxx
   branches/branch-1.3/src/Fl.cxx

Modified: branches/branch-1.3/CHANGES
===================================================================
--- branches/branch-1.3/CHANGES 2010-10-31 18:58:58 UTC (rev 7786)
+++ branches/branch-1.3/CHANGES 2010-10-31 19:35:23 UTC (rev 7787)
@@ -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)

Modified: branches/branch-1.3/fluid/fluid.cxx
===================================================================
--- branches/branch-1.3/fluid/fluid.cxx 2010-10-31 18:58:58 UTC (rev 7786)
+++ branches/branch-1.3/fluid/fluid.cxx 2010-10-31 19:35:23 UTC (rev 7787)
@@ -25,7 +25,7 @@
 //     http://www.fltk.org/str.php
 //
 
-#define IDE_SUPPORT
+#undef IDE_SUPPORT
 
 #include <FL/Fl.H>
 #include <FL/Fl_Double_Window.H>

Modified: branches/branch-1.3/src/Fl.cxx
===================================================================
--- branches/branch-1.3/src/Fl.cxx      2010-10-31 18:58:58 UTC (rev 7786)
+++ branches/branch-1.3/src/Fl.cxx      2010-10-31 19:35:23 UTC (rev 7787)
@@ -1414,17 +1414,36 @@
       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...

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to