[PD-cvs] pd/src desire.tk,1.1.2.122,1.1.2.123
chunlee
chunlee at users.sourceforge.net
Tue Nov 15 15:35:37 CET 2005
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18219
Modified Files:
Tag: devel_0_39
desire.tk
Log Message:
removed duped code from yesterday. and toggle now also renders
Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.122
retrieving revision 1.1.2.123
diff -C2 -d -r1.1.2.122 -r1.1.2.123
*** desire.tk 15 Nov 2005 03:25:46 -0000 1.1.2.122
--- desire.tk 15 Nov 2005 14:35:34 -0000 1.1.2.123
***************
*** 1141,1163 ****
def textbox noutlets {} {return $@noutlets}
- def* textbox clickedit {x y butt key in_selection selection} {
- global _
- #handles the shift click
- #if {($f&1) && !$already} {post "add to selection?"; return}
- if {($key&1) && $selection>0} {
- puts "add $self to selection...."
- }
- #if clicked obj is part of the $@selection, than....
- if {$in_selection && [llength $selection]>1} {
- set _($@canvas:action) move
- } {
- $@canvas deselect_all
- set _($@canvas:selection) $self
- set _($@canvas:action) edit
- }
-
-
- }
-
def* textbox draw {} {
# TEXT = the text label
--- 1141,1144 ----
***************
*** 1333,1352 ****
#}
- def objectbox draw_wires {} {
- for {set x 0} {$x<$@ninlets} {incr x} {
- set v $self:i:$x
- if {[info exists _($v)]} {foreach wire $_($v) {$wire draw $self}}
- }
- for {set x 0} {$x<$@noutlets} {incr x} {
- set v $self:o:$x
- if {[info exists _($v)]} {foreach wire $_($v) {$wire draw $self}}
- }
- }
-
- def objectbox move {dx dy} {
- super $dx $dy
- $self draw_wires
- }
-
#-----------------------------------------------------------------------------------#
def* canvas window_title {title} {wm title .$self $title}
--- 1314,1317 ----
***************
*** 1406,1427 ****
}
- # type is i or o
- def objectbox hilite_io {type x y} {
- global look
- mset {cx cy} [$self xy]
- set c .$@canvas.c
- set ports 0; catch {switch $type {i {set ports $@ninlets} o {set ports $@noutlets}}}
- if {$ports==0} return
- set port [expr int(($x-$cx)*$ports/$@xs)]
- if {$port >= $ports} {set port [expr $ports-1]}
- set p ${self}${type}${port}
- #if {![llength $@wire_from]} {}
- set outline [switch $type {i {list $look(outletfg)} o {list $look(inletfg)}}]
- $c create rectangle [l+ [$c coords $p] {-4 -4 +4 +4}] -outline $outline -width 1 -tags ${p}b
- switch $type {i {set tip "inlet $port"} o {set tip "outlet $port"}}
- $@canvas show_tooltip $x $y $tip
- return $port
- }
-
def canvas motion {x y mods state} {
global font
--- 1371,1374 ----
***************
*** 1583,1591 ****
}
- def objectbox bbox {} {
- mset {x y} [$self xy]
- list $x $y [expr $x+$@xs] [expr $y+$@ys]
- }
-
#-----------------------------------------------------------------------------------#
def* canvas click_on_wire {x y b f id} {
--- 1530,1533 ----
***************
*** 1950,1953 ****
--- 1892,1901 ----
class_new box {view}
+ def box ninlets= {v} {set @ninlets $v}
+ def box noutlets= {v} {set @noutlets $v}
+ def box ninlets {} {return $@ninlets}
+ def box noutlets {} {return $@noutlets}
+
+
def* box init {args} {
***************
*** 1972,1975 ****
--- 1920,1958 ----
}
+ def box draw_wires {} {
+ for {set x 0} {$x<$@ninlets} {incr x} {
+ set v $self:i:$x
+ if {[info exists _($v)]} {foreach wire $_($v) {$wire draw $self}}
+ }
+ for {set x 0} {$x<$@noutlets} {incr x} {
+ set v $self:o:$x
+ if {[info exists _($v)]} {foreach wire $_($v) {$wire draw $self}}
+ }
+ }
+
+ def box move {dx dy} {
+ super $dx $dy
+ $self draw_wires
+ }
+
+ def* box clickedit {x y butt key in_selection selection} {
+ global _
+ #handles the shift click
+ #if {($f&1) && !$already} {post "add to selection?"; return}
+ if {($key&1) && $selection>0} {
+ puts "add $self to selection...."
+ }
+ #if clicked obj is part of the $@selection, than....
+ if {$in_selection && [llength $selection]>1} {
+ set _($@canvas:action) move
+ } {
+ $@canvas deselect_all
+ set _($@canvas:selection) $self
+ set _($@canvas:action) move
+ }
+
+
+ }
+
# type is i or o
def box hilite_io {type x y} {
***************
*** 2565,2577 ****
}
! def bang ninlets= {v} {set @ninlets $v}
! def bang noutlets= {v} {set @noutlets $v}
! def bang ninlets {} {return $@ninlets}
! def bang noutlets {} {return $@noutlets}
def* bang draw {} {
mset {x1 y1} [$self xy]
- #set @ninlets [expr [string compare $@rcv empty]==0]
- #set @noutlets [expr [string compare $@snd empty]==0]
set colour [parse_color $@bcol]
#super
--- 2548,2558 ----
}
! #def bang ninlets= {v} {set @ninlets $v}
! #def bang noutlets= {v} {set @noutlets $v}
! #def bang ninlets {} {return $@ninlets}
! #def bang noutlets {} {return $@noutlets}
def* bang draw {} {
mset {x1 y1} [$self xy]
set colour [parse_color $@bcol]
#super
***************
*** 2584,2606 ****
}
- def* bang clickedit {x y butt key in_selection selection} {
- global _
- #handles the shift click
- #if {($f&1) && !$already} {post "add to selection?"; return}
- if {($key&1) && $selection>0} {
- puts "add $self to selection...."
- }
- #if clicked obj is part of the $@selection, than....
- if {$in_selection && [llength $selection]>1} {
- set _($@canvas:action) move
- } {
- $@canvas deselect_all
- set _($@canvas:selection) $self
- set _($@canvas:action) move
- }
-
-
- }
-
def bang click {x y b f} {
pd $self click $x $y 0 0 0
--- 2565,2568 ----
***************
*** 2613,2618 ****
}
! class_new toggle {view}
! def toggle draw {} {
mset {x1 y1} [$self xy]
set xs $@w
--- 2575,2590 ----
}
! class_new toggle {bluebox}
!
! def* toggle init {args} {
! puts "!!!!!! args:$args"
! super
! set @on 0
! set @w 15
! set @xs $@w
! set @ys $@w
! }
!
! def* toggle draw {} {
mset {x1 y1} [$self xy]
set xs $@w
***************
*** 2620,2627 ****
set x2 [expr $x1+$xs]
set y2 [expr $y1+$ys]
- set ins [expr [string compare $@rcv empty]==0]
- set outs [expr [string compare $@snd empty]==0]
set colour [parse_color $@bcol]
! super
set w 1
if {$xs >= 30} {set w 2}
--- 2592,2597 ----
set x2 [expr $x1+$xs]
set y2 [expr $y1+$ys]
set colour [parse_color $@bcol]
! #super
set w 1
if {$xs >= 30} {set w 2}
***************
*** 2637,2642 ****
set fill [bluify [parse_color $@bcol]]
}
! $self item X1 line $x3 $y3 [expr $x4+1] [expr $y4+1] -width $w -fill $fill
! $self item X2 line $x3 $y4 [expr $x4+1] [expr $y3-1] -width $w -fill $fill
}
--- 2607,2613 ----
set fill [bluify [parse_color $@bcol]]
}
! $self makebox $x1 $y1 $@w $@w $@ninlets $@noutlets
! $self item X1 line [list $x3 $y3 [expr $x4+1] [expr $y4+1]] -width $w -fill $fill
! $self item X2 line [list $x3 $y4 [expr $x4+1] [expr $y3-1]] -width $w -fill $fill
}
***************
*** 2646,2651 ****
}
! def toggle click {x y b f} {
pd x$self bang
}
--- 2617,2625 ----
}
! def* toggle click {x y b f} {
pd x$self bang
+ if {!$@on} {set @on 1} {set @on 0}
+ puts "toggle state:$@on"
+ $self draw
}
More information about the Pd-cvs
mailing list