From: Jeff H. <je...@ac...> - 2009-07-24 15:29:55
|
Agreed. On 24/07/2009 6:30 AM, Koen Danckaert wrote: > Jeff Hobbs wrote: >> In there, you will see that the node to the top is actually drawn, and >> in the one in sources (with newer BWidget), it isn't. I actually >> prefer the newer lack of top anchor look, and it does have the single >> node case to start. I think this also applies to how the tree is >> used. When it has the classic single root node, it is better without >> the top anchor line displayed, but I could see it as ok with multiple >> root nodes. >> >> In the end, this can simply be made an option, like -showrootanchor or >> something. > > Ok, I already thought that the Windows style you were referring to > always had exactly one top node, which is not the case for BWidget > (where the real "root" node is actually invisible). > > I propose to make the line dependent on whether there are multiple top > nodes. (Harald, the patch for that is below.) It seems we could agree on > that, and I prefer it to an extra option (= extra documentation, which > will probably difficult to understand without trying out.) > > --Koen > > > Index: tree.tcl > =================================================================== > RCS file: /cvsroot/tcllib/bwidget/tree.tcl,v > retrieving revision 1.59 > diff -b -u -r1.59 tree.tcl > --- tree.tcl 30 Jun 2009 16:17:37 -0000 1.59 > +++ tree.tcl 24 Jul 2009 13:26:22 -0000 > @@ -1369,12 +1369,9 @@ > set yp $y1 > set y1 [_draw_node $path $node $x0 [expr {$y1+$deltay}] $deltax > $deltay $padx $showlines] > } > - if { $showlines && [llength $nodes] } { > - if {$y0 < 0} { > - # Adjust the drawing of the line to the first root node > - # to start at the vertical point (not go up). > - incr y0 $deltay > - } > + # Only draw a line to the virtual root node when there are multiple > top nodes. > + set len [llength $nodes] > + if { $showlines && $len && !($y0 < 0 && $len < 2) } { > set id [$path.c create line $x0 $y0 $x0 [expr {$yp+$deltay}] \ > -fill [Widget::getoption $path -linesfill] \ > -stipple [Widget::getoption $path -linestipple] \ > |