Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21509
Modified Files:
Tag: devel_0_39
desire.tk
Log Message:
some more event mangling...
Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.335
retrieving revision 1.1.2.336
diff -C2 -d -r1.1.2.335 -r1.1.2.336
*** desire.tk 14 Aug 2006 15:45:46 -0000 1.1.2.335
--- desire.tk 14 Aug 2006 16:22:53 -0000 1.1.2.336
***************
*** 994,1003 ****
def View noutlets= {v} {set @noutlets $v}
def View noutlets {} {return $@noutlets}
! def* View click {args} {} ;# being clicked in run mode
! def* View clickedit {args} {} ;# being clicked in edit mode
! def* View unclick {args} {} ;# being unclicked in run mode
! def* View unclickedit {args} {} ;# being unclicked in edit mode
! def View motionedit {args} {} ;# motion in edit mode
! def View motion {args} {} ;# motion in run mode
def View init {} {
--- 994,1003 ----
def View noutlets= {v} {set @noutlets $v}
def View noutlets {} {return $@noutlets}
! def* View click {x y f} {} ;# being clicked in run mode
! def* View clickedit {x y f} {} ;# being clicked in edit mode
! def* View unclick {x y f} {} ;# being unclicked in run mode
! def* View unclickedit {x y f} {} ;# being unclicked in edit mode
! def View motionedit {x y f} {} ;# mouse motion in edit mode
! def View motion {x y f} {} ;# mouse motion in run mode
def View init {} {
***************
*** 1846,1859 ****
}
#!@#$ this method is too long
! def Canvas motion {x y mods} {
global font canvas tooltip
set canvas(current) $self
set c .$self.c
- set b 0
- set f $mods
- set bf [list $b $f]
- set x [expr [$c canvasx $x]/$@scale]
- set y [expr [$c canvasy $y]/$@scale]
if {$tooltip(visible)} {
if {[expr [distance $tooltip(curpos) [list $x $y]] > 10]} {
--- 1846,1860 ----
}
+ # just a transitional filter
+ def* Canvas motion {x y f} {
+ set c .$self.c
+ $self motion2 [expr [$c canvasx $x]/$@scale] [expr [$c canvasy $y]/$@scale] $f
+ }
+
#!@#$ this method is too long
! def Canvas motion2 {x y f} {
global font canvas tooltip
set canvas(current) $self
set c .$self.c
if {$tooltip(visible)} {
if {[expr [distance $tooltip(curpos) [list $x $y]] > 10]} {
***************
*** 1867,1871 ****
set @curpos [list $x $y]
# detects if the focus is not on the canvas itself in run mode, ie. numbox
! if {!$@editmode & [$self focus] != $self & [$self focus] != ""} {[$self focus] motion $x $y $mods}
switch $@action {
move {
--- 1868,1872 ----
set @curpos [list $x $y]
# detects if the focus is not on the canvas itself in run mode, ie. numbox
! if {!$@editmode & [$self focus] != $self & [$self focus] != ""} {[$self focus] motion $x $y $f}
switch $@action {
move {
***************
*** 1889,1897 ****
#default {error "unknown action '$@action'"}
default {
! set target [$self identify_target $x $y $b $f "motion"]
! $@action motion $x $y $mods $target
}
}
! set target [$self identify_target $x $y -1 -1 "move"]
mset {type id detail} $target
switch $type {
--- 1890,1898 ----
#default {error "unknown action '$@action'"}
default {
! set target [$self identify_target $x $y $f "motion"]
! $@action motion $x $y $f $target
}
}
! set target [$self identify_target $x $y -1 "move"]
mset {type id detail} $target
switch $type {
***************
*** 1900,1904 ****
object {
if {$@editmode} {set event motionedit} {set event motion}
! $id $event $x $y $mods
}
wire {}
--- 1901,1905 ----
object {
if {$@editmode} {set event motionedit} {set event motion}
! $id $event $x $y $f
}
wire {}
***************
*** 1913,1917 ****
# wire $id : a wire
# nothing : nothing
! def Canvas identify_target2 {x y b f label} {
set c .$self.c
set cx [expr $x*$@scale]
--- 1914,1918 ----
# wire $id : a wire
# nothing : nothing
! def Canvas identify_target2 {x y f label} {
set c .$self.c
set cx [expr $x*$@scale]
***************
*** 1937,1943 ****
}
! def Canvas identify_target {x y b f label} {
! set r [$self identify_target2 $x $y $b $f $label]
! #puts "\[identify_target $x $y $b $f $label\] returns: $r"
return $r
}
--- 1938,1944 ----
}
! def Canvas identify_target {x y f label} {
! set r [$self identify_target2 $x $y $f $label]
! #puts "\[identify_target $x $y $f $label\] returns: $r"
return $r
}
***************
*** 1988,1992 ****
set tags [$c gettags [lindex [$c find overlapping \
[expr $x-2] [expr $y-2] [expr $x+2] [expr $y+2]] end]]
! foreach {type id} [$@canvas identify_target $x $y -1 -1 "g"] {}
switch $type {
object {
--- 1989,1993 ----
set tags [$c gettags [lindex [$c find overlapping \
[expr $x-2] [expr $y-2] [expr $x+2] [expr $y+2]] end]]
! foreach {type id} [$@canvas identify_target $x $y -1 "status"] {}
switch $type {
object {
***************
*** 2124,2133 ****
}
! proc shift? {bf} {mset {b f} $bf; return [expr $f&1]}
! proc ctrl? {bf} {mset {b f} $bf; return [expr $f&2]}
! proc alt? {bf} {mset {b f} $bf; return [expr $f&4]}
class_new FutureWire {View}
! def FutureWire init {canvas x y bf target} {
super
set @canvas $canvas
--- 2125,2141 ----
}
! proc shift? {f} {return [expr $f&1]}
! proc ctrl? {f} {return [expr $f&2]}
! proc alt? {f} {return [expr $f&4]}
! proc button_of {f} {
! # set f [expr $f>>8]
! # set b 1
! # while {[expr $f&1==0} {set f [expr $f>>1]}
! # return $f
! return [expr $f>>8]
! }
class_new FutureWire {View}
! def FutureWire init {canvas x y f target} {
super
set @canvas $canvas
***************
*** 2140,2144 ****
set @x1 [expr ($x1+$x2)/2]
set @y1 [expr ($y1+$y2)/2]
! $self motion $@x1 $@y1 0 $target
}
def FutureWire motion {x y f target} {
--- 2148,2152 ----
set @x1 [expr ($x1+$x2)/2]
set @y1 [expr ($y1+$y2)/2]
! $self motion $@x1 $@y1 $f $target
}
def FutureWire motion {x y f target} {
***************
*** 2149,2154 ****
$self draw
}
! def FutureWire unclick {x y bf target} {
! $self motion $x $y $bf $target
if {$@to != ""} {
set children [$@canvas children]
--- 2157,2162 ----
$self draw
}
! def FutureWire unclick {x y f target} {
! $self motion $x $y $f $target
if {$@to != ""} {
set children [$@canvas children]
***************
*** 2157,2161 ****
[lsearch $children $@to ] $@inlet]
}
! if {![shift? $bf]} {$@canvas end_action}
}
def FutureWire draw {} {
--- 2165,2169 ----
[lsearch $children $@to ] $@inlet]
}
! if {![shift? $f]} {$@canvas end_action}
}
def FutureWire draw {} {
***************
*** 2206,2213 ****
#!@#$ this method is too long
# this method receives (x,y) in descaled coords
! def* Canvas clickedit {x y b f} {
set c .[$self canvas].c
! set bf [list $b $f] ;# i want to merge b and f together but it's not going to be merged like this
! set target [$self identify_target $x $y $b $f "click"]
mset {type id detail} $target
if {$f&8} {$self popup $id [winfo pointerx $c] [winfo pointery $c]; return}
--- 2214,2220 ----
#!@#$ this method is too long
# this method receives (x,y) in descaled coords
! def* Canvas clickedit {x y f} {
set c .[$self canvas].c
! set target [$self identify_target $x $y $f "click"]
mset {type id detail} $target
if {$f&8} {$self popup $id [winfo pointerx $c] [winfo pointery $c]; return}
***************
*** 2216,2235 ****
switch $type {
! outlet {set @action [FutureWire new $self $x $y $bf $target]; return}
object {
! if {![llength $@selection]} {# if no previous selection, edit the clicked object
! $id clickedit $x $y $b $f $in_selection $@selection
! } else {# otherwise do multiple object selection
! if {[lsearch $@selection $id] < 0} {lappend @selection $id}
! $id selected?= 1; set @action edit
! }
}
! wire {
! switch $f {
! 0 {
! #click on a wire without shift
! if {[lsearch $@selection_wire $id] < 0} {set @selection_wire $id}
! $id selected?= 1
! }
1 {#click on a wire with shift
#if click on the one already selected wire, reconnect it
--- 2223,2234 ----
switch $type {
! outlet {set @action [FutureWire new $self $x $y $f $target]; return}
object {
! $self selection+= $id
! set @action edit
}
! wire {
! switch $f {
! 0 {$self selection_wire+= $id}
1 {#click on a wire with shift
#if click on the one already selected wire, reconnect it
***************
*** 2263,2269 ****
set @action wire
}
- default {
- puts "nothing......."
- }
}
}
--- 2262,2265 ----
***************
*** 2271,2275 ****
$self deselect_all
$self dehilite_io
! set @action [SelRect new $@canvas $x $y $bf $target]
return
}
--- 2267,2271 ----
$self deselect_all
$self dehilite_io
! set @action [SelRect new $@canvas $x $y $f $target]
return
}
***************
*** 2279,2283 ****
--- 2275,2286 ----
}
+ # just a transitional filter
def* Canvas click {x y b f} {
+ set c .$self.c
+ $self click2 [expr [$c canvasx $x]/$@scale] [expr [$c canvasy $y]/$@scale] [expr $b*256+$f]
+ }
+
+ # should be renamed to "click" when the other "click" becomes unneeded.
+ def* Canvas click2 {x y f} {
if {[winfo exists .completion]} {
raise .completion
***************
*** 2287,2348 ****
set c .$self.c
focus $c
- set x [expr [$c canvasx $x]/$@scale]
- set y [expr [$c canvasy $y]/$@scale]
set @click_at [list $x $y]
! #if {$@editmode && !($f&2)} {$self clickedit $x $y $b $f; return}
! if {$@editmode} {$self clickedit $x $y $b $f; return}
! mset {type id} [$self identify_target $x $y $b $f "click"]
if {![llength $id]} {return}
switch $type {
! object {$id click $x $y $b $f}
! wire {$id click $x $y $b $f}
default {error BORK}
}
}
! #!@#$ this method is too long
! def* Canvas unclickedit {x y b f} {
! global look
set c .$self.c
! set bf [list $b $f]
switch $@action {
edit {
- #foreach {type id} [$self identify_target $cx $cy -1 -1 "blah "] {}
- mset {type id} [$self identify_target $x $y [expr $x-1] [expr $y-1] "unclick"]
- #puts "++++++++ type:$type id:$id class:$_($id:class)"
set @obj_in_edit $id
$id edit
}
move {
! foreach obj $@selection {
! #this could be wrong....
! mset {x y} [$obj xy]
! pd .$self object_moveto !$obj $x $y
! puts "new pos:: $x $y orig pos:: $_($obj:orig_x) $_($obj:orig_y)"
! }
set objs $@selection
$@history add [list $self undomove $objs]
}
none {}
- #default {error "unknown action '$@action'"}
default {
! set target [$self identify_target $x $y $b $f "unclick"]
! $@action unclick $x $y $bf $target
}
}
}
! def* Canvas unclickrun {x y b} {
! if {[$self focus] != ""} {[$self focus] unclick $x $y $b}
}
! def* Canvas unclick {x y b f} {
! set c .$self.c
! set x [expr [$c canvasx $x]/$@scale]
! set y [expr [$c canvasy $y]/$@scale]
! if {$@editmode} {$self unclickedit $x $y $b $f} {$self unclickrun $x $y %b}
$self adjust_scrollbars
$self checkgeometry
- set @action none
}
--- 2290,2340 ----
set c .$self.c
focus $c
set @click_at [list $x $y]
! #if {$@editmode && !($f&2)} {$self clickedit $x $y $f; return}
! if {$@editmode} {$self clickedit $x $y $f; return}
! mset {type id} [$self identify_target $x $y $f "click"]
if {![llength $id]} {return}
switch $type {
! object {$id click $x $y $f}
! wire {$id click $x $y $f}
default {error BORK}
}
}
! def* Canvas unclickedit {x y f} {
set c .$self.c
! mset {type id detail} [$self identify_target $x $y $f "unclick"]
switch $@action {
edit {
set @obj_in_edit $id
$id edit
}
move {
! foreach obj $@selection {pd .$self object_moveto !$obj $x $y}
set objs $@selection
$@history add [list $self undomove $objs]
}
none {}
default {
! set target [$self identify_target $x $y $f "unclick"]
! $@action unclick $x $y $f $target
}
}
}
! # just a transitional filter
! def* Canvas unclick {x y b f} {
! set c .$self.c
! $self unclick2 [expr [$c canvasx $x]/$@scale] [expr [$c canvasy $y]/$@scale] [expr $b*256+$f]
}
! def* Canvas unclick2 {x y f} {
! if {$@editmode} {
! $self unclickedit $x $y $f
! } else {
! if {[$self focus] != ""} {[$self focus] unclick $x $y $b}
! }
$self adjust_scrollbars
$self checkgeometry
}
***************
*** 2638,2646 ****
def* Box clickedit {x y butt key in_selection selection} {
! #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 $_($@canvas:selection)]>1} {
--- 2630,2634 ----
def* Box clickedit {x y butt key in_selection selection} {
! if {($key&1) && $selection>0} {puts "add $self to selection...."}
#if clicked obj is part of the $@selection, than....
if {$in_selection && [llength $_($@canvas:selection)]>1} {
***************
*** 3753,3757 ****
}
! def Slider motion {x y mods} {
set focused [$self == [$@canvas focus]]
if {!$focused} {return}
--- 3741,3745 ----
}
! def Slider motion {x y f} {
set focused [$self == [$@canvas focus]]
if {!$focused} {return}