Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28345
Modified Files: Tag: devel_0_39 desire.tk Log Message: arrr, my last commit failed due to update error. try again now.
adding spinbox to display zoom at toolbar
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.315 retrieving revision 1.1.2.316 diff -C2 -d -r1.1.2.315 -r1.1.2.316 *** desire.tk 11 Aug 2006 07:57:47 -0000 1.1.2.315 --- desire.tk 11 Aug 2006 13:25:09 -0000 1.1.2.316 *************** *** 543,548 **** set key(key_nav_right_shift) "Ctrl+RIGHT" set key(key_nav_left_shift) "Ctrl+LEFT" ! set key(incr_fontsize) "Ctrl+equal" ! set key(decr_fontsize) "Ctrl+minus" set accels {} foreach k [array names key] { --- 543,548 ---- set key(key_nav_right_shift) "Ctrl+RIGHT" set key(key_nav_left_shift) "Ctrl+LEFT" ! set key(incr_zoom) "Ctrl+equal" ! set key(decr_zoom) "Ctrl+minus" set accels {} foreach k [array names key] { *************** *** 936,939 **** --- 936,942 ---- set look(minobjwidth) 21
+ set scale(canned) [list 50 100 150 200 250 300] + set scale(list) $scale(canned) + set scale(incr) 0.25 #-----------------------------------------------------------------------------------# proc read_ddrc {} { *************** *** 1690,1709 **** }
- def TextBox update_size2 {} { - global font - set scale $_($@canvas:scale) - set font_width [expr $font(width) * $scale] - #set font_padx [expr $font(padx) * $scale] - #set font_pady [expr $font(pady) * $scale] - set font_padx $font(padx) - set font_pady $font(pady) - set font_height [expr $font(height) * $scale] - set textwidth [expr $font_padx+$font_width*([string length $@text]+$@edit)] - set topwidth [expr (2* $@ninlets-1) * [expr [look iowidth]*$scale]] - set bottomwidth [expr (2*$@noutlets-1) * [expr [look iowidth]*$scale]] - set @xs [max [expr [look minobjwidth]*$scale] [max $bottomwidth [max $topwidth $textwidth]]] - set @ys [expr ($font_pady+$font_height)] - } - #-----------------------------------------------------------------------------------
--- 1693,1696 ---- *************** *** 2683,2712 **** }
! def* Canvas incr_fontsize {} {$self zoom "in"} ! def* Canvas decr_fontsize {} {$self zoom "out"} def* Canvas zoom {mode} { ! global font switch $mode { in { ! set @scale [expr $@scale + 0.5] ! #foreach object $@children { ! #mset {x1 y1 x2 y2} [$object bbox] ! #pd .$self object_moveto !$object [expr $x1*$@scale] [expr $y1*$@scale] ! #} ! $self redraw } out { ! ! set @scale [expr $@scale - 0.5] ! #foreach object $@children { ! #mset {x1 y1 x2 y2} [$object bbox] ! #pd .$self object_moveto !$object [expr $x1*$@scale] [expr $y1*$@scale] ! #} ! $self redraw } }
} ! #-----------------------------------------------------------------------------------# set lastcanvasconfigured "" --- 2670,2726 ---- }
! def* Canvas incr_zoom {} {$self zoom "in"} ! def* Canvas decr_zoom {} {$self zoom "out"} def* Canvas zoom {mode} { ! global font scale switch $mode { in { ! set @scale [expr $@scale + $scale(incr)] } out { ! if {$@scale > $scale(incr)} {set @scale [expr $@scale - $scale(incr)]} } } + $self redraw + set val [format %.0f [expr $@scale * 100]] + set val ${val}% + set scale(list) $val + .$self.bbar.scale set $val
} ! def* Canvas spin_zoom {spinbox val direction} { ! global scale ! set val [string trimright $val %] ! switch $direction { ! up { ! for {set i 0} {$i < [llength $scale(canned)]} {incr i} { ! set value [lindex $scale(canned) $i] ! if {[expr $value - $val] > 0} {break} ! } ! set next [lindex $scale(canned) $i] ! if {[expr $i+1] <= [llength $scale(canned)]} { ! $spinbox set ${next}% ! set next_f [format %.6f $next] ! set @scale [expr $next_f/100] ! } ! } ! down { ! for {set i 0} {$i < [llength $scale(canned)]} {incr i} { ! set value [lindex $scale(canned) $i] ! if {[expr $value - $val] >= 0} {break} ! } ! set next [lindex $scale(canned) [expr $i-1]] ! if {[expr $i-1] >= 0} {$spinbox set ${next}% ! set next_f [format %.6f $next] ! set @scale [expr $next_f/100] ! } ! } ! } ! $self redraw ! ! } ! def* Canvas spin_zoom_key {spinbox string string} { ! return 1 ! } #-----------------------------------------------------------------------------------# set lastcanvasconfigured "" *************** *** 4478,4482 ****
def ButtonBar init {canvas} { ! global buttons_loaded butt set @canvas $canvas set bb .$@canvas.bbar --- 4492,4496 ----
def ButtonBar init {canvas} { ! global buttons_loaded butt scale set @canvas $canvas set bb .$@canvas.bbar *************** *** 4490,4494 **** balloon $bb.$name [say $name] } ! pack [entry $bb.name -font {courier 9} -width 10 -border 0] -side right $bb.name insert 0 .$@canvas } --- 4504,4511 ---- balloon $bb.$name [say $name] } ! pack [entry $bb.name -font {courier 10} -width 10 -border 0] -side right ! #pack [spinbox $bb.scale -width 6 -command "$canvas spin_zoom %W %s %d" -validate key -vcmd "$canvas spin_zoom_key %W %s %S"] -side right ! pack [spinbox $bb.scale -width 6 -command "$canvas spin_zoom %W %s %d" -state readonly] -side right ! $bb.scale set "100%" $bb.name insert 0 .$@canvas } *************** *** 5815,5818 **** --- 5832,5837 ---- Português (Portuguese): Nuno Godinho Italiano (Italian): Davide Morelli" + + .$self.text configure -state disabled }