Author: greg.ercolano
Date: 2011-12-25 09:51:50 -0800 (Sun, 25 Dec 2011)
New Revision: 9217
Log:
Small fix for vertical connectors between far away items, as noted by 
Christophe.


Modified:
   branches/branch-1.3/src/Fl_Tree_Item.cxx

Modified: branches/branch-1.3/src/Fl_Tree_Item.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Tree_Item.cxx    2011-12-25 01:10:45 UTC (rev 
9216)
+++ branches/branch-1.3/src/Fl_Tree_Item.cxx    2011-12-25 17:51:50 UTC (rev 
9217)
@@ -547,6 +547,8 @@
                        Fl_Tree_Item *itemfocus,
                         const Fl_Tree_Prefs &prefs, int lastchild) {
   if ( ! _visible ) return; 
+  int tree_top = tree->y();
+  int tree_bot = tree_top + tree->h();
   fl_font(_labelfont, _labelsize);
   int H = _labelsize;
   if(usericon() && H < usericon()->h()) H = usericon()->h(); 
@@ -586,7 +588,7 @@
   //    'clipped' is an optimization to prevent drawing anything offscreen.
   //
   char drawthis = ( is_root() && prefs.showroot() == 0 ) ? 0 : 1;
-  char clipped = ((Y+H) < tree->y()) || (Y>(tree->y()+tree->h())) ? 1 : 0;
+  char clipped = ((Y+H) < tree_top) || (Y>tree_bot) ? 1 : 0;
   if ( drawthis ) {
     // Draw connectors
     if ( prefs.connectorstyle() != FL_TREE_CONNECTOR_NONE ) {
@@ -696,6 +698,9 @@
       Y += prefs.openchild_marginbottom();             // offset below open 
child tree
     }
     if ( ! lastchild ) {
+      // Special 'clipped' calculation. (intentional variable shadowing)
+      int clipped = ((child_y_start < tree_top) && (Y < tree_top)) ||
+                    ((child_y_start > tree_bot) && (Y > tree_bot));
       if (!clipped) draw_vertical_connector(hstartx, child_y_start, Y, prefs);
     }
   }

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

Reply via email to