[PD-cvs] pd/src desire.tk,1.1.2.232,1.1.2.233
chunlee
chunlee at users.sourceforge.net
Mon Jun 12 21:52:29 CEST 2006
- Previous message: [PD-cvs] pd/src desire.tk,1.1.2.231,1.1.2.232
- Next message: [PD-cvs] externals/hcs passwd.c, NONE, 1.1 passwd-help.pd, NONE, 1.1 uid0x2d0x3eusername.pd, NONE, 1.1 uid0x2d0x3eusername-help.pd, NONE, 1.1 username0x2d0x3euid-help.pd, NONE, 1.1 username0x2d0x3euid.pd, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27255
Modified Files:
Tag: devel_0_39
desire.tk
Log Message:
started working on undo/redo
Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.232
retrieving revision 1.1.2.233
diff -C2 -d -r1.1.2.232 -r1.1.2.233
*** desire.tk 12 Jun 2006 18:50:53 -0000 1.1.2.232
--- desire.tk 12 Jun 2006 19:52:26 -0000 1.1.2.233
***************
*** 180,192 ****
# runs the restore procedure for the last item in the root undo_queue.
! def History undo {} {
set backup $@undo
set @undo $@redo
set @redo {}
! set err [catch {perform [lindex $backup end]}]
if {$err} {set err $errorInfo}
set @redo $@undo
set @undo [lrange $backup 0 end-1]
! if {$err} [error "error during undo: $err"]
}
--- 180,194 ----
# runs the restore procedure for the last item in the root undo_queue.
! def* History undo {} {
! global errorInfo
set backup $@undo
set @undo $@redo
set @redo {}
! set err [catch { $self perform [lindex $backup end]}]
! puts "err --> $err"
if {$err} {set err $errorInfo}
set @redo $@undo
set @undo [lrange $backup 0 end-1]
!
}
***************
*** 199,217 ****
# run all actions in an undo.
! def History perform {actions} {
$self atomically {
! foreach x [lreverse $actions] {eval $actions}
}
}
def* History atomically {code} {
set ubackup @undo; set @undo {}
set rbackup @redo; set @redo {}
! set err [catch {uplevel 1 $code}]
if {$err} {set err $errorInfo}
! lappend backup_undo $@undo_queue
! set @undo_queue $ubackup
! set @redo_queue $rbackup
! if {$err} [error "error during undo: $err"]
}
--- 201,229 ----
# run all actions in an undo.
! #def* History perform {actions} {
! # $self atomically {
! # foreach x [lreverse $actions] {eval $actions}
! # }
! #}
!
! def* History perform {actions} {
! puts "perform level ---- [info level]"
! set poo $actions
$self atomically {
! eval $actions
}
}
def* History atomically {code} {
+ global errorInfo
+ puts "atomically level ---- [info level]"
set ubackup @undo; set @undo {}
set rbackup @redo; set @redo {}
! set err [catch {uplevel 2 $code}]
! set @undo $ubackup
! set @redo $rbackup
! puts "err ----> $err"
if {$err} {set err $errorInfo}
! if {$err} {error "error during undo"}
}
***************
*** 902,906 ****
def View ninlets {} {return $@ninlets}
def View noutlets {} {return $@noutlets}
!
def View init {} {
set @selected? 0
--- 914,918 ----
def View ninlets {} {return $@ninlets}
def View noutlets {} {return $@noutlets}
! def View draw_wires {} {}
def View init {} {
set @selected? 0
***************
*** 1778,1781 ****
--- 1790,1805 ----
.$@canvas.c move $self [expr $u-$x] [expr $v-$y]
}
+
+ def* Canvas undomove {objs} {
+ foreach obj $objs {
+ pd .$self object_moveto !$obj $_($obj:orig_x) $_($obj:orig_y)
+ }
+
+ }
+
+ def* View set_orig_xy {x y} {
+ set @orig_x $x
+ set @orig_y $y
+ }
def Canvas motion {x y mods state} {
***************
*** 1824,1828 ****
edit {
if {[distance [list $x $y] $@click_at] > 5} {
! set @action move
mset {ox oy} $@click_at
}
--- 1848,1853 ----
edit {
if {[distance [list $x $y] $@click_at] > 5} {
! foreach obj $@selection {mset {x y} [$obj xy];$obj set_orig_xy $x $y}
! set @action move
mset {ox oy} $@click_at
}
***************
*** 2289,2299 ****
mset {x y} [$obj xy]
pd .$self object_moveto !$obj $x $y
}
!
! #puts "....select_by:$@select_by"
! #if {$@select_by == "click"} {
! # set @selection {}
! # }
! #puts "selection:$@selection"
}
}
--- 2314,2321 ----
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]
}
}
***************
*** 2463,2467 ****
}
! def Box draw_wires {} {
puts "wires:$@wires"
foreach wire $@wires {$wire draw}
--- 2485,2489 ----
}
! def* Box draw_wires {} {
puts "wires:$@wires"
foreach wire $@wires {$wire draw}
***************
*** 2490,2494 ****
}
#if clicked obj is part of the $@selection, than....
! if {$in_selection && [llength $selection]>1} {
set _($@canvas:action) move
} {
--- 2512,2518 ----
}
#if clicked obj is part of the $@selection, than....
! if {$in_selection && [llength $_($@canvas:selection)]>1} {
! foreach obj $_($@canvas:selection) {mset {x y} [$obj xy];$obj set_orig_xy $x $y}
! puts "begin to move _______ $_($@canvas:selection)"
set _($@canvas:action) move
} {
***************
*** 2553,2557 ****
}
! def Wire draw {} {
global look
#set thick 2
--- 2577,2581 ----
}
! def* Wire draw {} {
global look
#set thick 2
***************
*** 2823,2837 ****
# call the drawing method twice...
$x changed
- #if {$_($canvas(current):duplicating)} {
- # if {$_($x:_class) != "Canvas"} {
- # set test [lsearch $_($canvas(current):children) $x]
- # if {$test <0} {
- # puts "$_($x:_class)"
- # puts "oops..... $x is not in children!!!!!!!!!!!!!!!!!!!"
- # puts "children are $_($canvas(current):children)"
- # }
- # }
- #}
}
--- 2847,2852 ----
# call the drawing method twice...
$x changed
+ #if {[info exists _($x:wires)]} {$x draw_wires;}
}
***************
*** 2951,2955 ****
}
! def* BlueBox motionedit {args} {
#puts "motions in $self in edit mode"
}
--- 2966,2970 ----
}
! def BlueBox motionedit {args} {
#puts "motions in $self in edit mode"
}
- Previous message: [PD-cvs] pd/src desire.tk,1.1.2.231,1.1.2.232
- Next message: [PD-cvs] externals/hcs passwd.c, NONE, 1.1 passwd-help.pd, NONE, 1.1 uid0x2d0x3eusername.pd, NONE, 1.1 uid0x2d0x3eusername-help.pd, NONE, 1.1 username0x2d0x3euid-help.pd, NONE, 1.1 username0x2d0x3euid.pd, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Pd-cvs
mailing list