Author: matt
Date: 2011-09-30 03:07:12 -0700 (Fri, 30 Sep 2011)
New Revision: 9091
Log:
Horizontal scrollbar in TextDisplay is not shown if text wrappes at the right 
edge

Modified:
   branches/branch-3.0/src/fltk3/TextDisplay.cxx

Modified: branches/branch-3.0/src/fltk3/TextDisplay.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/TextDisplay.cxx       2011-09-30 09:38:35 UTC 
(rev 9090)
+++ branches/branch-3.0/src/fltk3/TextDisplay.cxx       2011-09-30 10:07:12 UTC 
(rev 9091)
@@ -369,7 +369,8 @@
       }
       
       /*
-       Decide if the horizontal scrollbar needs to be visible.  If there
+       Decide if the horizontal scrollbar needs to be visible. If the text
+       wraps at the right edge, do not draw a horizontal scrollbar. Otherwise, 
if there
        is a vertical scrollbar, a horizontal is always created too.  This
        is because the alternatives are unattractive:
        * Dynamically creating a horizontal scrollbar based on the currently
@@ -392,18 +393,19 @@
       if (scrollbar_align() & (fltk3::ALIGN_TOP|fltk3::ALIGN_BOTTOM) &&
           (mVScrollBar->visible() || longest_vline() > text_area.w))
       {
-        if (!mHScrollBar->visible()) {
+        char wrap_at_bounds = mContinuousWrap && (mWrapMarginPix==0);
+        if (!mHScrollBar->visible() && !wrap_at_bounds) {
           mHScrollBar->set_visible();
           again = 1; // loop again to see if we now need vert. & recalc sizes
         }
         if (scrollbar_align() & fltk3::ALIGN_TOP) {
           text_area.y = Y + scrollbar_width()+TOP_MARGIN;
-          text_area.h = H - scrollbar_width()-TOP_MARGIN-BOTTOM_MARGIN;
+          text_area.h = H - 
(wrap_at_bounds?0:scrollbar_width())-TOP_MARGIN-BOTTOM_MARGIN;
           mHScrollBar->resize(text_area.x-LEFT_MARGIN, Y,
                               text_area.w+LEFT_MARGIN+RIGHT_MARGIN, 
scrollbar_width());
         } else {
           text_area.y = Y+TOP_MARGIN;
-          text_area.h = H - scrollbar_width()-TOP_MARGIN-BOTTOM_MARGIN;
+          text_area.h = H - 
(wrap_at_bounds?0:scrollbar_width())-TOP_MARGIN-BOTTOM_MARGIN;
           mHScrollBar->resize(text_area.x-LEFT_MARGIN, Y+H-scrollbar_width(),
                               text_area.w+LEFT_MARGIN+RIGHT_MARGIN, 
scrollbar_width());
         }

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

Reply via email to