[PD-cvs] externals/miXed/test/toxy kb.wid,1.2,1.3 multiscale-test.pd,1.2,1.3 multiscale.wid,1.2,1.3 setup.wid,1.1,1.2

Krzysztof Czaja krzyszcz at users.sourceforge.net
Tue Mar 16 13:13:56 CET 2004


Update of /cvsroot/pure-data/externals/miXed/test/toxy
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11709/test/toxy

Modified Files:
	kb.wid multiscale-test.pd multiscale.wid setup.wid 
Log Message:
toxy alpha8

Index: multiscale-test.pd
===================================================================
RCS file: /cvsroot/pure-data/externals/miXed/test/toxy/multiscale-test.pd,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** multiscale-test.pd	10 Mar 2004 10:55:56 -0000	1.2
--- multiscale-test.pd	16 Mar 2004 12:13:54 -0000	1.3
***************
*** 1,17 ****
  #N canvas 39 49 800 548 12;
  #X obj 25 84 widget multiscale m1 #n 50 #dx 15 #dy 90;
! #X obj 25 260 widget multiscale m2 #bg red #dy 120;
  #X msg 25 52 #n \$1;
  #X floatatom 25 23 5 0 0 0 - - -;
  #N canvas 0 0 450 300 graph1 0;
  #X array t 50 float 0;
! #X coords 0 1 49 0 400 140 1;
  #X restore 296 206 graph;
! #X obj 265 509 tabwrite t;
! #X obj 27 408 unpack;
! #X floatatom 27 445 5 0 0 0 - - -;
! #X floatatom 100 445 5 0 0 0 - - -;
! #X floatatom 109 196 5 0 0 0 - - -;
! #X obj 589 509 tabread t;
  #X obj 589 477 t 0 0;
  #X obj 589 413 until;
--- 1,17 ----
  #N canvas 39 49 800 548 12;
  #X obj 25 84 widget multiscale m1 #n 50 #dx 15 #dy 90;
! #X obj 25 326 widget multiscale m2 #bg red #dy 120;
  #X msg 25 52 #n \$1;
  #X floatatom 25 23 5 0 0 0 - - -;
  #N canvas 0 0 450 300 graph1 0;
  #X array t 50 float 0;
! #X coords 0 100 49 0 400 140 1;
  #X restore 296 206 graph;
! #X obj 265 511 tabwrite t;
! #X obj 25 474 unpack;
! #X floatatom 25 511 5 0 0 0 - - -;
! #X floatatom 98 511 5 0 0 0 - - -;
! #X floatatom 94 199 5 0 0 0 - - -;
! #X obj 589 511 tabread t;
  #X obj 589 477 t 0 0;
  #X obj 589 413 until;
***************
*** 20,27 ****
  #X obj 589 445 int;
  #X obj 629 445 + 1;
! #X obj 527 510 pack;
  #X msg 265 445 tot pd [concat rcount .#n .`.:];
  #X obj 265 408 t b b;
! #X msg 653 414 0;
  #X obj 127 23 widget button b -command .<.> -bg yellow -width 3 -height
  2;
--- 20,27 ----
  #X obj 589 445 int;
  #X obj 629 445 + 1;
! #X obj 527 511 pack;
  #X msg 265 445 tot pd [concat rcount .#n .`.:];
  #X obj 265 408 t b b;
! #X msg 653 413 0;
  #X obj 127 23 widget button b -command .<.> -bg yellow -width 3 -height
  2;
***************
*** 29,32 ****
--- 29,34 ----
  #X obj 25 228 pack;
  #X floatatom 25 199 5 0 0 0 - - -;
+ #X msg 95 282 #hi \$1;
+ #X floatatom 95 246 5 0 0 0 - - -;
  #X connect 1 0 6 0;
  #X connect 2 0 0 0;
***************
*** 53,54 ****
--- 55,58 ----
  #X connect 23 0 1 0;
  #X connect 24 0 23 0;
+ #X connect 25 0 1 0;
+ #X connect 26 0 25 0;

Index: kb.wid
===================================================================
RCS file: /cvsroot/pure-data/externals/miXed/test/toxy/kb.wid,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** kb.wid	9 Mar 2004 12:41:21 -0000	1.2
--- kb.wid	16 Mar 2004 12:13:54 -0000	1.3
***************
*** 60,63 ****
  ::toxy::kb .- .| . .#oct .#size
  
! # undo the "bind Canvas <1> {+focus %W}" in the setup part above
  bind .- <FocusIn> {focus .^.c}
--- 60,63 ----
  ::toxy::kb .- .| . .#oct .#size
  
! # undo the "bind Canvas <1> {+focus %W}" from the setup.wid
  bind .- <FocusIn> {focus .^.c}

Index: setup.wid
===================================================================
RCS file: /cvsroot/pure-data/externals/miXed/test/toxy/setup.wid,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** setup.wid	9 Mar 2004 12:41:21 -0000	1.1
--- setup.wid	16 Mar 2004 12:13:54 -0000	1.2
***************
*** 12,16 ****
  # if defined, otherwise try setting -variable and -textvariable traces.
  
! proc ::toxy::itemdotrace {target varname ndxname op} {
      if {[catch {set v [set $varname]} res] == 0} {
  	if {$v != [set $varname.last]} {
--- 12,16 ----
  # if defined, otherwise try setting -variable and -textvariable traces.
  
! proc ::toxy::item_dotrace {target varname ndxname op} {
      if {[catch {set v [set $varname]} res] == 0} {
  	if {$v != [set $varname.last]} {
***************
*** 19,30 ****
  	    set $varname.last $v
  	}
!     } else { puts stderr [concat failed ::toxy::itemdotrace: $res] }
  }
  
! proc ::toxy::itembindtrace {varname mastername ndxname op} {
      set $varname [set $mastername]
  }
  
! proc ::toxy::itemsettrace {op path target varname} {
      if {[catch {$path cget $op} res] == 0} {
  	if {$res == ""} {
--- 19,30 ----
  	    set $varname.last $v
  	}
!     } else { puts stderr [concat failed ::toxy::item_dotrace: $res] }
  }
  
! proc ::toxy::item_bindtrace {varname mastername ndxname op} {
      set $varname [set $mastername]
  }
  
! proc ::toxy::item_settrace {op path target varname} {
      if {[catch {$path cget $op} res] == 0} {
  	if {$res == ""} {
***************
*** 34,47 ****
  	} else {
  	    if {[info tclversion] < 8.4} {
! 		trace variable $res w "::toxy::itembindtrace $varname"
  	    } else {
! 		trace add variable $res write "::toxy::itembindtrace $varname"
  	    }
  	}
  	if {![info exists $varname.last]} { set $varname.last "" }
  	if {[info tclversion] < 8.4} {
! 	    trace variable $varname w "::toxy::itemdotrace $target"
  	} else {
! 	    trace add variable $varname write "::toxy::itemdotrace $target"
  	}
  	return
--- 34,47 ----
  	} else {
  	    if {[info tclversion] < 8.4} {
! 		trace variable $res w "::toxy::item_bindtrace $varname"
  	    } else {
! 		trace add variable $res write "::toxy::item_bindtrace $varname"
  	    }
  	}
  	if {![info exists $varname.last]} { set $varname.last "" }
  	if {[info tclversion] < 8.4} {
! 	    trace variable $varname w "::toxy::item_dotrace $target"
  	} else {
! 	    trace add variable $varname write "::toxy::item_dotrace $target"
  	}
  	return
***************
*** 50,54 ****
  
  # LATER revisit -- seems clumsy and fragile
! proc ::toxy::itemremovetrace {op path varname} {
      if {[catch {$path cget $op} res] == 0} {
  	if {$res == $varname} {
--- 50,54 ----
  
  # LATER revisit -- seems clumsy and fragile
! proc ::toxy::item_removetrace {op path varname} {
      if {[catch {$path cget $op} res] == 0} {
  	if {$res == $varname} {
***************
*** 58,65 ****
  	} elseif {$res != ""} {
  	    if {[info tclversion] < 8.4} {
! 		catch { trace vdelete $res w "::toxy::itembindtrace $varname" }
  	    } else {
  		catch { trace remove variable \
! 		    $res write "::toxy::itembindtrace $varname" }
  	    }
  	}
--- 58,65 ----
  	} elseif {$res != ""} {
  	    if {[info tclversion] < 8.4} {
! 		catch { trace vdelete $res w "::toxy::item_bindtrace $varname" }
  	    } else {
  		catch { trace remove variable \
! 		    $res write "::toxy::item_bindtrace $varname" }
  	    }
  	}
***************
*** 67,73 ****
  }
  
! proc ::toxy::itemdestroy {path varname} {
!     ::toxy::itemremovetrace -variable $path $varname.var
!     ::toxy::itemremovetrace -textvariable $path $varname.txt
      if {[info tclversion] < 8.4} {
  	catch { unset $varname.last $varname.var $varname.txt $varname }
--- 67,73 ----
  }
  
! proc ::toxy::item_destroy {path varname} {
!     ::toxy::item_removetrace -variable $path $varname.var
!     ::toxy::item_removetrace -textvariable $path $varname.txt
      if {[info tclversion] < 8.4} {
  	catch { unset $varname.last $varname.var $varname.txt $varname }
***************
*** 78,82 ****
  }
  
! proc ::toxy::itemgetconfig {path target} {
      pd $target.rp _config $target.rp [$path cget -bg] \
  	[winfo reqwidth $path] [winfo reqheight $path] \
--- 78,82 ----
  }
  
! proc ::toxy::item_getconfig {path target} {
      pd $target.rp _config $target.rp [$path cget -bg] \
  	[winfo reqwidth $path] [winfo reqheight $path] \
***************
*** 84,88 ****
  }
  
! proc ::toxy::itemvisconfig {path target name varname cvpath px py} {
      if {[info exists ::toxy::itemoptions]} {
  	set failed [catch {eval $path config $::toxy::itemoptions} res]
--- 84,88 ----
  }
  
! proc ::toxy::item_visconfig {path target name varname cvpath px py} {
      if {[info exists ::toxy::itemoptions]} {
  	set failed [catch {eval $path config $::toxy::itemoptions} res]
***************
*** 99,113 ****
  	set needtraces 0
      } else {
! 	set needtraces 1
      }
  
      if {$needtraces != 0} {
! 	if {[catch {::toxy::itemsettrace -variable \
  		$path $target $varname.var} res1]} {
! 	    error [concat in ::toxy::itemsettrace: $res1]
  	}
! 	if {[catch {::toxy::itemsettrace -textvariable \
  		$path $target $varname.txt} res2]} {
! 	    error [concat in ::toxy::itemsettrace: $res2]
  	}
  #	puts stderr [concat traces: ($res1) ($res2)]
--- 99,114 ----
  	set needtraces 0
      } else {
! #	set needtraces 1
! 	set needtraces 0
      }
  
      if {$needtraces != 0} {
! 	if {[catch {::toxy::item_settrace -variable \
  		$path $target $varname.var} res1]} {
! 	    error [concat in ::toxy::item_settrace: $res1]
  	}
! 	if {[catch {::toxy::item_settrace -textvariable \
  		$path $target $varname.txt} res2]} {
! 	    error [concat in ::toxy::item_settrace: $res2]
  	}
  #	puts stderr [concat traces: ($res1) ($res2)]
***************
*** 133,142 ****
      }
  
!     ::toxy::itemgetconfig $path $target
  
      return
  }
  
! proc ::toxy::itemvis {tkclass path target name varname cvpath px py} {
      if {[winfo exists $path]} {
  #	puts stderr [concat $path exists]
--- 134,143 ----
      }
  
!     ::toxy::item_getconfig $path $target
  
      return
  }
  
! proc ::toxy::item_vis {tkclass path target name varname cvpath px py} {
      if {[winfo exists $path]} {
  #	puts stderr [concat $path exists]
***************
*** 146,150 ****
      }
      if {$::toxy::itemfailure == 0} {
! 	set ::toxy::itemfailure [catch {::toxy::itemvisconfig \
  	    $path $target $name $varname $cvpath $px $py} \
  	    ::toxy::itemerrmess]
--- 147,151 ----
      }
      if {$::toxy::itemfailure == 0} {
! 	set ::toxy::itemfailure [catch {::toxy::item_visconfig \
  	    $path $target $name $varname $cvpath $px $py} \
  	    ::toxy::itemerrmess]
***************
*** 157,166 ****
  }
  
  # FIXME
! proc ::toxy::scalecommand {target sel v} {
      pd [concat $target $sel $v \;]
  }
  
! proc ::toxy::popupcommand {path target remote i text} {
      set [$path cget -textvariable] $text
      pd [concat $target _cb $i \;]
--- 158,213 ----
  }
  
+ # empirically, binding event coords as %X - [winfo rootx $cvpath] works
+ # better, than %x + [winfo x %W], or %x + t->te_xpix, LATER investigate
+ 
+ proc ::toxy::item_click {target cvpath x y b f} {
+     pd $target.rp _click \
+ 	[$cvpath canvasx [expr {$x - [winfo rootx $cvpath]}]] \
+ 	[$cvpath canvasy [expr {$y - [winfo rooty $cvpath]}]] $b $f\;
+ }
+ 
+ proc ::toxy::item_inout {target v} {
+     pd [concat $target.rp _inout $v \;]
+ }
+ 
+ proc ::toxy::master_release {target cvpath x y b} {
+     ::toxy::item_inout $target 3
+ # pdtk_canvas_mouseup is a hack, which we must call anyway
+     pdtk_canvas_mouseup $cvpath \
+ 	[expr {$x - [winfo rootx $cvpath]}] \
+ 	[expr {$y - [winfo rooty $cvpath]}] $b
+ }
+ 
+ proc ::toxy::master_motion {target cvpath x y} {
+     pd $target.rp _motion \
+ 	[$cvpath canvasx [expr {$x - [winfo rootx $cvpath]}]] \
+ 	[$cvpath canvasy [expr {$y - [winfo rooty $cvpath]}]] 0 \;
+ }
+ 
+ proc ::toxy::master {path toppath cvpath target} {
+ # FIXME subitem handling in megawidgets
+     bind $path <ButtonRelease> "::toxy::master_release $target $cvpath %X %Y %b"
+     bind $path <1> "::toxy::item_click $target $cvpath %X %Y %b 0"
+     bind $path <Shift-1> "::toxy::item_click $target $cvpath %X %Y %b 1"
+     bind $path <Control-1> "::toxy::item_click $target $cvpath %X %Y %b 2"
+     bind $path <Control-Shift-1> "::toxy::item_click $target $cvpath %X %Y %b 3"
+     bind $path <Alt-1> "::toxy::item_click $target $cvpath %X %Y %b 4"
+     bind $path <Alt-Shift-1> "::toxy::item_click $target $cvpath %X %Y %b 5"
+     bind $path <Alt-Control-1> "::toxy::item_click $target $cvpath %X %Y %b 6"
+     bind $path <Alt-Control-Shift-1> \
+ 	"::toxy::item_click $target $cvpath %X %Y %b 7"
+     bind $path <3> "::toxy::item_click $target $cvpath %X %Y %b 8"
+ 
+     bind $path <Motion> "::toxy::master_motion $target $cvpath %X %Y"
+     bind $path <Enter> "::toxy::item_inout $target 1"
+     bind $path <Leave> "::toxy::item_inout $target 0"
+ }
+ 
  # FIXME
! proc ::toxy::scale_command {target sel v} {
      pd [concat $target $sel $v \;]
  }
  
! proc ::toxy::popup_command {path target remote i text} {
      set [$path cget -textvariable] $text
      pd [concat $target _cb $i \;]
***************
*** 181,185 ****
  		incr i
  		$path.pop add command -label [lindex $e 0] \
! 		    -command [concat ::toxy::popupcommand \
  			$path $target $remote $i \
  			    [lindex $e [expr {[llength $e] > 1}]]]
--- 228,232 ----
  		incr i
  		$path.pop add command -label [lindex $e 0] \
! 		    -command [concat ::toxy::popup_command \
  			$path $target $remote $i \
  			    [lindex $e [expr {[llength $e] > 1}]]]
***************
*** 189,246 ****
  }
  
- # empirically, binding event coords as %X - [winfo rootx $cvpath] works
- # better, than %x + [winfo x %W], or %x + t->te_xpix, LATER investigate
- 
- proc ::toxy::itemclick {target cvpath x y b f} {
-     pd $target.rp _click \
- 	[$cvpath canvasx [expr {$x - [winfo rootx $cvpath]}]] \
- 	[$cvpath canvasy [expr {$y - [winfo rooty $cvpath]}]] $b $f\;
- }
- 
- proc ::toxy::iteminout {target v} {
-     pd [concat $target.rp _inout $v \;]
- }
- 
- proc ::toxy::masterrelease {target cvpath x y b} {
-     ::toxy::iteminout $target 3
- # pdtk_canvas_mouseup is a hack, which we must call anyway
-     pdtk_canvas_mouseup $cvpath \
- 	[expr {$x - [winfo rootx $cvpath]}] \
- 	[expr {$y - [winfo rooty $cvpath]}] $b
- }
- 
- proc ::toxy::mastermotion {target cvpath x y} {
-     pd $target.rp _motion \
- 	[$cvpath canvasx [expr {$x - [winfo rootx $cvpath]}]] \
- 	[$cvpath canvasy [expr {$y - [winfo rooty $cvpath]}]] 0 \;
- }
- 
- proc ::toxy::masterinit {path target cvpath} {
-     set topitem [expr {[string index $cvpath end-1] == "."}]
- # FIXME subitem handling
-     if {$topitem} {
- 	bind $path <ButtonRelease> \
- 	    "::toxy::masterrelease $target $cvpath %X %Y %b"
-     }
-     bind $path <1> "::toxy::itemclick $target $cvpath %X %Y %b 0"
-     bind $path <Shift-1> "::toxy::itemclick $target $cvpath %X %Y %b 1"
-     bind $path <Control-1> "::toxy::itemclick $target $cvpath %X %Y %b 2"
-     bind $path <Control-Shift-1> "::toxy::itemclick $target $cvpath %X %Y %b 3"
-     bind $path <Alt-1> "::toxy::itemclick $target $cvpath %X %Y %b 4"
-     bind $path <Alt-Shift-1> "::toxy::itemclick $target $cvpath %X %Y %b 5"
-     bind $path <Alt-Control-1> "::toxy::itemclick $target $cvpath %X %Y %b 6"
-     bind $path <Alt-Control-Shift-1> \
- 	"::toxy::itemclick $target $cvpath %X %Y %b 7"
-     bind $path <3> "::toxy::itemclick $target $cvpath %X %Y %b 8"
- 
-     bind $path <Motion> "::toxy::mastermotion $target $cvpath %X %Y"
-     bind $path <Enter> "::toxy::iteminout $target 1"
-     bind $path <Leave> "::toxy::iteminout $target 0"
- }
- 
  # master initializer
  #> master
  
! ::toxy::masterinit .- .| .^.c
  
  # standard widget types
--- 236,243 ----
  }
  
  # master initializer
  #> master
  
! ::toxy::master .- .- .^.c .|
  
  # standard widget types
***************
*** 252,256 ****
  
  #> float scale
! #. -command [concat ::toxy::scalecommand .| _cb]
  #. -bg pink -activebackground red -length 200
  #. @float .- set .#1
--- 249,253 ----
  
  #> float scale
! #. -command [concat ::toxy::scale_command .| _cb]
  #. -bg pink -activebackground red -length 200
  #. @float .- set .#1

Index: multiscale.wid
===================================================================
RCS file: /cvsroot/pure-data/externals/miXed/test/toxy/multiscale.wid,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** multiscale.wid	10 Mar 2004 10:55:56 -0000	1.2
--- multiscale.wid	16 Mar 2004 12:13:54 -0000	1.3
***************
*** 1,3 ****
! proc ::toxy::multiscalecommand {target sel ndx v} {
      pd [concat $target $sel $v $ndx \;]
  }
--- 1,3 ----
! proc ::toxy::multiscale_command {target sel ndx v} {
      pd [concat $target $sel $v $ndx \;]
  }
***************
*** 15,19 ****
  }
  
! proc ::toxy::multiscale {path target remote count dx dy bg} {
      if {[winfo exists $path.s0]} {
  #	puts stderr [concat $path.s0 exists]
--- 15,19 ----
  }
  
! proc ::toxy::multiscale {path cvpath target remote count lo hi res dx dy bg} {
      if {[winfo exists $path.s0]} {
  #	puts stderr [concat $path.s0 exists]
***************
*** 26,32 ****
  	for {set ndx 0} {$ndx < $count} {incr ndx} {
  	    scale $path.s$ndx -width $dx -length $dy \
! 		-from 1 -to 0 -resolution 0.01 \
  		-bg $bg -highlightthickness 0 \
! 		-command [concat ::toxy::multiscalecommand $target _cb $ndx]
  	    if {$dx < 50} {
  		$path.s$ndx config -showvalue 0 -relief flat
--- 26,32 ----
  	for {set ndx 0} {$ndx < $count} {incr ndx} {
  	    scale $path.s$ndx -width $dx -length $dy \
! 		-from $hi -to $lo -resolution $res \
  		-bg $bg -highlightthickness 0 \
! 		-command [concat ::toxy::multiscale_command $target _cb $ndx]
  	    if {$dx < 50} {
  		$path.s$ndx config -showvalue 0 -relief flat
***************
*** 36,40 ****
  	    set id [$path create window $px $py -width $dx -height $dy \
  		-anchor nw -window $path.s$ndx -tags $path.s$ndx]
! 	    ::toxy::masterinit $path.s$ndx $target $path
  	    incr px $dx
  	}
--- 36,40 ----
  	    set id [$path create window $px $py -width $dx -height $dy \
  		-anchor nw -window $path.s$ndx -tags $path.s$ndx]
! 	    ::toxy::master $path.s$ndx $path $cvpath $target
  	    incr px $dx
  	}
***************
*** 43,53 ****
  
  #> multiscale canvas
! #. #n 3 #dx 60 #dy 90
  #. #bg yellow
  #. @float ::toxy::multiscale_float .- .| .#n .#1
  #. @list ::toxy::multiscale_list .- .#n .#2 .#1
  
! ::toxy::multiscale .- .| . .#n .#dx .#dy .#bg
  
! # undo the "bind Canvas <1> {+focus %W}" in the setup part above
  bind .- <FocusIn> {focus .^.c}
--- 43,55 ----
  
  #> multiscale canvas
! # FIXME fractional resolution: scalePtr->value == value fails in TkScaleSetValue
! #. #n 3 #lo 0 #hi 100 #res 1
! #. #dx 60 #dy 90
  #. #bg yellow
  #. @float ::toxy::multiscale_float .- .| .#n .#1
  #. @list ::toxy::multiscale_list .- .#n .#2 .#1
  
! ::toxy::multiscale .- .^.c .| . .#n .#lo .#hi .#res .#dx .#dy .#bg
  
! # undo the "bind Canvas <1> {+focus %W}" from the setup.wid
  bind .- <FocusIn> {focus .^.c}





More information about the Pd-cvs mailing list