Update of /cvsroot/pure-data/extensions/gui/ix In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14457
Modified Files: mat.wid Log Message: perl: sucks perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = "en", LANG = (unset) are supported and installed on your system. perl: warning: Falling back to the standard locale ("C").
Index: mat.wid =================================================================== RCS file: /cvsroot/pure-data/extensions/gui/ix/mat.wid,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** mat.wid 20 Jun 2005 17:04:34 -0000 1.10 --- mat.wid 21 Jun 2005 19:25:04 -0000 1.11 *************** *** 1,5 **** package require tkpath namespace eval ::ix { ! proc rc {} {return [format "#%06x" [expr "int(floor(rand() * 16))"]]}
proc mat_note {p t item} { --- 1,5 ---- package require tkpath namespace eval ::ix { ! proc rc {} {return [format "#%06x" [expr "int(floor(rand() * 16777216))"]]}
proc mat_note {p t item} { *************** *** 13,17 **** }
! proc mat_scroll {p t a x y} { }
--- 13,25 ---- }
! proc mat_scroll {p t d axis} { ! variable _ ! puts "Scroll0: $_($t:xa) $_($t:xb) $_($t:ya) $_($t:yb)" ! foreach xy $axis { ! set mv [expr ($_($t:${xy}b) - $_($t:${xy}a)) / 4.0] ! foreach ab {a b} {set _($t:${xy}$ab) [expr $_($t:${xy}$ab) $d $mv]}} ! puts "Scroll1: $_($t:xa) $_($t:xb) $_($t:ya) $_($t:yb)" ! mat_redraw $p $t all ! mat_gridlines $p $t }
*************** *** 21,25 **** start { foreach xy {x y} {set _($t:c$xy) [set $xy];set _($t:f$xy) [set $xy]} ! $p.m create path [::tkpath::coords rect $_($t:cx) $_($t:cy) 0 0 -rx 16 -ry 16] -tags sel -fill cyan -fillopacity 0.2 } motion { --- 29,38 ---- start { foreach xy {x y} {set _($t:c$xy) [set $xy];set _($t:f$xy) [set $xy]} ! # $p.m create path [::tkpath::coords rect $_($t:cx) $_($t:cy) 0 0 -rx 12 -ry 12] -tags sel -fill cyan -stroke white -fillopacity 0.2 ! $p.m create path [::tkpath::coords rect $_($t:cx) $_($t:cy) 0 0 -rx 12 -ry 12] -tags sel -stroke [rc] -strokewidth 12 -strokeopacity 0.3 ! ! } ! close { ! $p.m delete sel } motion { *************** *** 28,32 **** set w [expr abs($xb - $xa)] set h [expr abs($yb - $ya)] ! $p.m coords sel [::tkpath::coords rect $xa $ya $w $h -rx 16 -ry 16] } } --- 41,45 ---- set w [expr abs($xb - $xa)] set h [expr abs($yb - $ya)] ! $p.m coords sel [::tkpath::coords rect $xa $ya $w $h -rx 12 -ry 12] } } *************** *** 63,67 **** set _($t:${xy}b) [expr $_($t:${xy}b) + $mvt] } ! foreach item [$p.m find withtag item] { set id [lindex [$p.m itemcget $item -tags] 1] set px [mat_tr $p $t x t [dict get $_($t) $id x]] --- 76,90 ---- set _($t:${xy}b) [expr $_($t:${xy}b) + $mvt] } ! mat_redraw $p $t all ! mat_gridlines $p $t ! } ! ! proc mat_redraw {p t items} { ! variable _ ! switch $items { ! all {set items [$p.m find withtag item]} ! default {} ! } ! foreach item $items { set id [lindex [$p.m itemcget $item -tags] 1] set px [mat_tr $p $t x t [dict get $_($t) $id x]] *************** *** 71,75 **** $p.m coords $item [::tkpath::coords rect $px $py $sx $sy -rx 3 -ry 3] } - mat_gridlines $p $t }
--- 94,97 ---- *************** *** 125,130 **** if {[lindex [$p.m itemcget $item -tags] 0] eq "item"} { set id [lindex [$p.m itemcget $item -tags] 1] ! mat_note $p $t $item ! $p.m create text "[expr [winfo width $p.m] - 8.0 ] [expr [winfo height $p.m] - 8.0 - 16 * $n.0]" -fill "#ff0022" -justify right -anchor se -font {{bitstream vera sans} 12} -tags hover -text [dict get $_($t) $id] incr n } --- 147,152 ---- if {[lindex [$p.m itemcget $item -tags] 0] eq "item"} { set id [lindex [$p.m itemcget $item -tags] 1] ! # mat_note $p $t $item ! $p.m create text "[expr [winfo width $p.m] - 8.0 ] [expr [winfo height $p.m] - 8.0 - 11 * $n.0]" -fill "#ff0022" -justify right -anchor se -font {{bitstream vera sans} 10} -tags hover -text [dict get $_($t) $id] incr n } *************** *** 148,152 **** if {$a eq "draw"} {mat_draw $p $t $action $x $y} elseif {$m eq "double"} { mat_sel start $p $t $x $y ! } else { if {$clicked ne "" && [lindex [$p.m itemcget [lindex $clicked 0] -tags] 0] eq "item"} { mat_mode $p $t move_object --- 170,176 ---- if {$a eq "draw"} {mat_draw $p $t $action $x $y} elseif {$m eq "double"} { mat_sel start $p $t $x $y ! } elseif {[$p.m find withtag sel] ne ""} { ! mat_sel close $p $t $x $y ! } else { if {$clicked ne "" && [lindex [$p.m itemcget [lindex $clicked 0] -tags] 0] eq "item"} { mat_mode $p $t move_object *************** *** 158,163 **** 2 {mat_mode $p $t resize_canvas} 3 {mat_mode $p $t object_trans} - 4 {mat_mode $p $t scroll} - 5 {mat_mode $p $t scroll} } } --- 182,185 ---- *************** *** 213,243 **** }
! proc mat_new {path target w h bg ln xa xb ya yb qx qy} { variable _ set i 0 foreach xy {x y} {foreach ab {a b} {set ${xy}${ab}o [set ${xy}${ab}]}} ! foreach a {i ln xa xb ya yb xao xbo yao ybo qx qy} {set _($target:$a) [set $a]} ! if {[winfo exists $path.m] != 1} { ! canvas $path.m -bg $bg -width $w -height $h ! pack $path.m -side left ! bind $path.m <Key> "::ix::mat_key $path $target %k 1" ! bind $path.m <KeyRelease> "::ix::mat_key $path $target %k 0" ! bind $path.m <Motion> "::ix::mat_hover $path $target %x %y" foreach m {"Control-" "" "Shift-" "Double-"} { ! foreach bn {1 2 3 4 5} { set b [list [concat $bn first] [concat B${bn}-Motion motion] [concat ButtonRelease-$bn release]] foreach ba {0 1 2} { ! bind $path.m <$m[lindex [lindex $b $ba] 0]> "::ix::mat_click [list [string tolower [string trimright $m -1]]] $bn [lindex [lindex $b $ba] 1] $path $target %x %y"}}} ! set bd [expr {[$path cget -bd] * 2}] ! $path configure -bg gray -width [expr [winfo width $path.m] + $bd] -height [expr [winfo height $path.m] + $bd] ! $path.m create text {20 20} -fill blue -justify left -anchor w -font {{bitstream vera sans} 18} -tags mode -text action ! $path.m create text "10 $h" -fill red -justify left -anchor sw -font {{bitstream vera sans} 12 bold} -fill red -tags snap -text "snap (off)" ! $path.m create text {20 32} -fill gray49 -justify left -anchor nw -font {{bitstream vera sans} 12} -tags info ! mat_gridlines $path $target}}
! proc mat_gridlines {path target} { variable _ # puts gridlines ! set w $path.m $w delete gridlines set gh [winfo height $w] --- 235,269 ---- }
! proc mat_new {p t w h bg ln xa xb ya yb qx qy} { variable _ set i 0 foreach xy {x y} {foreach ab {a b} {set ${xy}${ab}o [set ${xy}${ab}]}} ! foreach a {i ln xa xb ya yb xao xbo yao ybo qx qy} {set _($t:$a) [set $a]} ! if {[winfo exists $p.m] != 1} { ! canvas $p.m -bg $bg -width $w -height $h ! pack $p.m -side left ! bind $p.m <Key> "::ix::mat_key $p $t %k 1" ! bind $p.m <KeyRelease> "::ix::mat_key $p $t %k 0" ! bind $p.m <Motion> "::ix::mat_hover $p $t %x %y" ! bind $p.m <4> "::ix::mat_scroll $p $t - x" ! bind $p.m <5> "::ix::mat_scroll $p $t + x" ! bind $p.m <Shift-4> "::ix::mat_scroll $p $t - y" ! bind $p.m <Shift-5> "::ix::mat_scroll $p $t + y" foreach m {"Control-" "" "Shift-" "Double-"} { ! foreach bn {1 2 3} { set b [list [concat $bn first] [concat B${bn}-Motion motion] [concat ButtonRelease-$bn release]] foreach ba {0 1 2} { ! bind $p.m <$m[lindex [lindex $b $ba] 0]> "::ix::mat_click [list [string tolower [string trimright $m -1]]] $bn [lindex [lindex $b $ba] 1] $p $t %x %y"}}} ! set bd [expr {[$p cget -bd] * 2}] ! $p configure -bg gray -width [expr [winfo width $p.m] + $bd] -height [expr [winfo height $p.m] + $bd] ! $p.m create text {20 20} -fill blue -justify left -anchor w -font {{bitstream vera sans} 18} -tags mode -text action ! $p.m create text "10 $h" -fill red -justify left -anchor sw -font {{bitstream vera sans} 12 bold} -fill red -tags snap -text "snap (off)" ! $p.m create text {20 32} -fill gray49 -justify left -anchor nw -font {{bitstream vera sans} 12} -tags info ! mat_gridlines $p $t}}
! proc mat_gridlines {p t} { variable _ # puts gridlines ! set w $p.m $w delete gridlines set gh [winfo height $w] *************** *** 248,258 **** array set tj {x center y left} array set igx {y width x height} ! if {$_($target:${xy}a) > $_($target:${xy}b)} {set oa ">=";set ob "-"} {set oa "<=";set ob "+"} ! for {set x [expr int($_($target:${xy}a) / ($_($target:q${xy}) + 0.0) + 1)*($_($target:q${xy}) + 0.0)]} {[expr $x $oa $_($target:${xy}b)]} {set x [expr $x $ob $_($target:q${xy})]} { ! set og [mat_tr $path $target $xy t $x] set invgeo [winfo $igx($xy) $w] switch $xy {y {set coords [concat M 0 $og L $invgeo $og]} x {set coords [concat M $og 0 L $og $invgeo]}} ! $w lower [$w create path $coords -stroke $_($target:ln) -strokedasharray 2 -tags gridline -strokewidth 1] $w lower [$w create text [lrange $coords 1 2] -font {{Bitstream Vera Sans} 8} \ -fill green -anchor $ta($xy) -text $x -justify $tj($xy) -tags gridline]}}}} --- 274,284 ---- array set tj {x center y left} array set igx {y width x height} ! if {$_($t:${xy}a) > $_($t:${xy}b)} {set oa ">=";set ob "-"} {set oa "<=";set ob "+"} ! for {set x [expr int($_($t:${xy}a) / ($_($t:q${xy}) + 0.0) + 1)*($_($t:q${xy}) + 0.0)]} {[expr $x $oa $_($t:${xy}b)]} {set x [expr $x $ob $_($t:q${xy})]} { ! set og [mat_tr $p $t $xy t $x] set invgeo [winfo $igx($xy) $w] switch $xy {y {set coords [concat M 0 $og L $invgeo $og]} x {set coords [concat M $og 0 L $og $invgeo]}} ! $w lower [$w create path $coords -stroke $_($t:ln) -strokedasharray 2 -tags gridline -strokewidth 1] $w lower [$w create text [lrange $coords 1 2] -font {{Bitstream Vera Sans} 8} \ -fill green -anchor $ta($xy) -text $x -justify $tj($xy) -tags gridline]}}}}