Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21155
Modified Files: Tag: desiredata desire.tk Log Message: adding init_scrollbars, remove_scrollbars for show/hide scrollbars
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.600.2.57 retrieving revision 1.1.2.600.2.58 diff -C2 -d -r1.1.2.600.2.57 -r1.1.2.600.2.58 *** desire.tk 11 Dec 2006 00:23:25 -0000 1.1.2.600.2.57 --- desire.tk 11 Dec 2006 02:18:42 -0000 1.1.2.600.2.58 *************** *** 1612,1621 **** # turn statusbar on/off if {[$self look statusbar]} {pack [$@statusbar widget] -side bottom -fill x} ! pack [scrollbar $win.xscroll -command "$c xview" -orient horizontal] -side bottom -fill x ! pack [scrollbar $win.yscroll -command "$c yview" ] -side right -fill y ! pack [canvas $c -width $@canvasxs -height $@canvasys -background white \ ! -yscrollcommand "$win.yscroll set" \ ! -xscrollcommand "$win.xscroll set" \ ! -scrollregion [list 0 0 $@canvasxs $@canvasys]] -side left -expand 1 -fill both wm minsize $win 1 1 wm geometry $win +$@canvasx1+$@canvasy1 --- 1612,1617 ---- # turn statusbar on/off if {[$self look statusbar]} {pack [$@statusbar widget] -side bottom -fill x} ! pack [canvas $c -width $@canvasxs -height $@canvasys -background white] -side left -expand 1 -fill both ! $self init_scrollbars wm minsize $win 1 1 wm geometry $win +$@canvasx1+$@canvasy1 *************** *** 1633,1636 **** --- 1629,1671 ---- }
+ def Canvas init_scrollbars {} { + set win .$self + set c [$self widget] + set size [$c bbox all] + if {$size != ""} { + mset {x1 y1 x2 y2} $size + if {$x2 > $@canvasxs} {set xregion $x2} else {set xregion $@canvasxs} + if {$y2 > $@canvasys} {set yregion $y2} else {set yregion $@canvasys} + } else {set xregion $@canvasxs; set yregion $@canvasys} + pack [scrollbar $win.yscroll -command "$c yview" ] -side right -fill y -before $c + pack [scrollbar $win.xscroll -command "$c xview" -orient horizontal] -side bottom -fill x -before $c + $c configure -yscrollcommand "$win.yscroll set" -xscrollcommand "$win.xscroll set" \ + -scrollregion [list 0 0 $xregion $yregion] + } + + def Canvas remove_scrollbars {} { + set win .$self + set c [$self widget] + destroy $win.yscroll + destroy $win.xscroll + $c configure -yscrollcommand "" -xscrollcommand "" -scrollregion "" + } + + def Canvas adjust_scrollbars {} { + set c [$self widget] + set size [$c bbox all] + if {$size != ""} { + mset {xmin ymin xmax ymax} {0 0 100 100} + mset {x1 y1 x2 y2} $size + if {$x1 < 0} {set xmin $x1}; if {$x2 > 100} {set xmax $x2} + if {$y1 < 0} {set ymin $y1}; if {$y2 > 100} {set ymax $y2} + set bbox [list $xmin $ymin $xmax $ymax] + if {$@bbox != $bbox} { + $c configure -scrollregion $bbox + set @bbox $bbox + } + } + } + def Canvas delete_window {} { set wl {} *************** *** 3388,3409 **** }
- def Canvas adjust_scrollbars {} { - set c [$self widget] - set size [$c bbox all] - #set size [$c bbox $@children] - #set size [eval [concat [list $c bbox] $@children]] - if {$size != ""} { - mset {xmin ymin xmax ymax} {0 0 100 100} - mset {x1 y1 x2 y2} $size - if {$x1 < 0} {set xmin $x1}; if {$x2 > 100} {set xmax $x2} - if {$y1 < 0} {set ymin $y1}; if {$y2 > 100} {set ymax $y2} - set bbox [list $xmin $ymin $xmax $ymax] - if {$@bbox != $bbox} { - $c configure -scrollregion $bbox - set @bbox $bbox - } - } - } - def Canvas get_bbox {} {return $@bbox}
--- 3423,3426 ----