Tk Library Source Code

Artifact [cf94d4ba59]
Login

Artifact cf94d4ba59af6d60c8f16a96414c185ce6c493c7:

Attachment "tree-widget.patch" to ticket [556077ffff] added by jenglish 2002-06-20 04:52:44.
Index: tree.tcl
===================================================================
RCS file: /cvsroot/tcllib/bwidget/tree.tcl,v
retrieving revision 1.35
diff -c -r1.35 tree.tcl
*** tree.tcl	4 Jun 2002 22:04:36 -0000	1.35
--- tree.tcl	19 Jun 2002 21:50:23 -0000
***************
*** 776,783 ****
      }
      set idn [$path.c find withtag n:$node]
      if { $idn != "" } {
!         Tree::_see $path $idn right
!         Tree::_see $path $idn left
      }
  }
  
--- 776,782 ----
      }
      set idn [$path.c find withtag n:$node]
      if { $idn != "" } {
!         Tree::_see $path $idn
      }
  }
  
***************
*** 829,836 ****
      }
      set idn [$path.c find withtag n:$node]
      if { $idn != "" } {
!         Tree::_see $path $idn right
!         Tree::_see $path $idn left
  
          set oldfg  [$path.c itemcget $idn -fill]
          set sbg    [Widget::getoption $path -selectbackground]
--- 828,834 ----
      }
      set idn [$path.c find withtag n:$node]
      if { $idn != "" } {
!         Tree::_see $path $idn
  
          set oldfg  [$path.c itemcget $idn -fill]
          set sbg    [Widget::getoption $path -selectbackground]
***************
*** 961,967 ****
  # ----------------------------------------------------------------------------
  #  Command Tree::_see
  # ----------------------------------------------------------------------------
! proc Tree::_see { path idn side } {
      set bbox [$path.c bbox $idn]
      set scrl [$path.c cget -scrollregion]
  
--- 959,965 ----
  # ----------------------------------------------------------------------------
  #  Command Tree::_see
  # ----------------------------------------------------------------------------
! proc Tree::_see { path idn } {
      set bbox [$path.c bbox $idn]
      set scrl [$path.c cget -scrollregion]
  
***************
*** 980,1000 ****
      set xmax [lindex $scrl 2]
      set dx   [$path.c cget -xscrollincrement]
      set xv   [$path xview]
!     if { ![string compare $side "right"] } {
!         set xv1 [expr {round([lindex $xv 1]*$xmax/$dx)}]
!         set x1  [expr {int([lindex $bbox 2]/$dx)}]
!         if { $x1 >= $xv1 } {
!             $path.c xview scroll [expr {$x1-$xv1+1}] units
!         }
!     } else {
!         set xv0 [expr {round([lindex $xv 0]*$xmax/$dx)}]
!         set x0  [expr {int([lindex $bbox 0]/$dx)}]
!         if { $x0 < $xv0 } {
!             $path.c xview scroll [expr {$x0-$xv0}] units
!         }
      }
  }
- 
  
  # ----------------------------------------------------------------------------
  #  Command Tree::_recexpand
--- 978,991 ----
      set xmax [lindex $scrl 2]
      set dx   [$path.c cget -xscrollincrement]
      set xv   [$path xview]
! 
!     set x0  [expr {int([lindex $bbox 0]/$dx)}]
!     set xv0 [expr {round([lindex $xv 0]*$xmax/$dx)}]
!     set xv1 [expr {round([lindex $xv 1]*$xmax/$dx)}]
!     if { $x0 >= $xv1 || $x0 < $xv0 } {
! 	$path.c xview scroll [expr {$x0-$xv0}] units
      }
  }
  
  # ----------------------------------------------------------------------------
  #  Command Tree::_recexpand