Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27302
Modified Files: Tag: desiredata desire.tk Log Message: find_last_error (part 2 of 2)
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.600.2.103 retrieving revision 1.1.2.600.2.104 diff -C2 -d -r1.1.2.600.2.103 -r1.1.2.600.2.104 *** desire.tk 19 Dec 2006 00:31:56 -0000 1.1.2.600.2.103 --- desire.tk 19 Dec 2006 01:07:53 -0000 1.1.2.600.2.104 *************** *** 139,142 **** --- 139,156 ---- }
+ # intervals + proc inside {x x0 x1} {return [expr $x>=$x0 && $x<=$x1]} + proc overlap {y0 y1 x0 x1} {return [expr [inside $y0 $x0 $x1] || [inside $y1 $x0 $x1]]} + + proc distance {point1 point2} { + set off [l- $point1 $point2] + return [expr sqrt([lsum [lzip * $off $off]])] + } + + proc rect_centre {rect} { + mset {x1 y1 x2 y2} $rect + return [list [expr {($x1+$x2)/2}] [expr {($y1+$y2)/2}]] + } + # will be a wrapper for [catch {}]. # to be continued... *************** *** 2500,2508 **** }
- proc distance {point1 point2} { - set off [l- $point1 $point2] - return [expr sqrt([lsum [lzip * $off $off]])] - } - def View position= {xy1} {mset [list @x1 @y1] $xy1; $self changed x1 y1}
--- 2514,2517 ---- *************** *** 2699,2703 **** } if {[$self look tooltip]} { ! if {[expr [distance $::tooltip(curpos) [list $x $y]] > 10]} {$self hide_tooltip} } } --- 2708,2712 ---- } if {[$self look tooltip]} { ! if {!$::tooltip(stay) && [expr [distance $::tooltip(curpos) [list $x $y]] > 10]} {$self hide_tooltip} } } *************** *** 3534,3541 **** def Canvas key_nav_left_shift {} {$self key_nav +1 +1 1}
- # intervals - proc inside {x x0 x1} {return [expr $x>=$x0 && $x<=$x1]} - proc overlap {y0 y1 x0 x1} {return [expr [inside $y0 $x0 $x1] || [inside $y1 $x0 $x1]]} - def Canvas key_nav {du dv shift} { if {$@keynav_shift && !$shift} {puts "keynav_shift but not shift"} --- 3543,3546 ---- *************** *** 4146,4149 **** --- 4151,4162 ---- def Box popup_help {} {netsend [list .$@canvas object_help $self]}
+ def Box show_error {text} { + regsub "\n" $text "" text + mset {x1 y1 x2 y2} [$self bbox] + [$self get_canvas] show_tooltip [expr $x2+4] [expr ($y1+$y2)/2] $text object 1 + #mset {x1 y1 x2 y2} [$self bbox] + #[$self get_canvas] show_tooltip ... [expr ($y1+$y2)/2] $text object 1 + } + #-----------------------------------------------------------------------------------# class_new Wire {View} *************** *** 5629,5648 **** set tooltip(visible) 0 set tooltip(text) ""
! def Canvas show_tooltip {x y text type} { global tooltip if {$tooltip(visible) && [string compare $text $tooltip(text)]==0} {return} $self hide_tooltip ! set border 4 ! set x [expr $x+$border+4] ;# huh, why add border twice? set c [$self widget] mset {x y} [lmap * [list $x $y] $@zoom] switch $type { i {set y [expr $y - 20]} o {set y [expr $y + 20]} } ! $c create text $x $y -text $text -anchor w -tags tooltip_fg ! mset {x1 y1 x2 y2} [$c bbox tooltip_fg] ! $c create rectangle \ ! [expr $x1-$border] [expr $y1-$border] \ ! [expr $x2+$border] [expr $y2+$border] \ ! -fill "#ffffcc" -outline "#000000" -tags tooltip_bg $c lower tooltip_bg tooltip_fg set tooltip(curpos) $@curpos --- 5642,5664 ---- set tooltip(visible) 0 set tooltip(text) "" + set tooltip(stay) 0
! def Canvas show_tooltip {x y text type {stay 0}} { global tooltip if {$tooltip(visible) && [string compare $text $tooltip(text)]==0} {return} $self hide_tooltip ! set x [expr $x+4] set c [$self widget] mset {x y} [lmap * [list $x $y] $@zoom] + # it's wrong to hardcode "20" here switch $type { i {set y [expr $y - 20]} o {set y [expr $y + 20]} } ! if {$stay} { ! set fg "#ffffff"; set bg "#dd0000" ! } else { ! set fg "#000000"; set bg "#ffffcc" ! } ! $c create text $x $y -fill $fg -text $text -anchor w -tags tooltip_fg ! mset {x1 y1 x2 y2} [l+ [$c bbox tooltip_fg] [list -4 -4 +4 +4]] ! $c create rectangle $x1 $y1 $x2 $y2 -fill $bg -outline $fg -tags tooltip_bg $c lower tooltip_bg tooltip_fg set tooltip(curpos) $@curpos *************** *** 5650,5653 **** --- 5666,5670 ---- set tooltip(visible) 1 set tooltip(text) $text + set tooltip(stay) $stay }