Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16792
Modified Files: Tag: desiredata desire.tk Log Message: last commit message was wrong... HistoryDialog was renamed to ListDialog and is now used for both command history (undo/redo) and event history (lower level: keys and mouse)
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.600.2.215 retrieving revision 1.1.2.600.2.216 diff -C2 -d -r1.1.2.600.2.215 -r1.1.2.600.2.216 *** desire.tk 11 Jul 2007 02:44:14 -0000 1.1.2.600.2.215 --- desire.tk 11 Jul 2007 04:59:10 -0000 1.1.2.600.2.216 *************** *** 330,333 **** --- 330,339 ---- set subpatcherize(edit2) "" #-----------------------------------------------------------------------------------# + class_new EventList {Observable Thing} + + def EventList init {} {super; set @list {}} + def EventList add {e} {lappend @list $e; $self changed} + def EventList list {} {lreverse $@list} + set ::event_history [EventList new]
#-----------------------------------------------------------------------------------# *************** *** 424,427 **** --- 430,441 ---- }
+ def CommandHistory list {} { + set r {} + set hist [concat [$self undo_stack] [list "You Are Here"] [lreverse [$self redo_stack]]] + set i 0 + foreach e $hist {lappend r "$i: $e"; incr i} + return $r + } + set command_history [CommandHistory new]
*************** *** 479,488 **** bind all <KeyRelease> {event_record KeyRelease %W %X %Y %K} bind all <ButtonPress> {event_record ButtonPress %W %X %Y %b} ! bind all <ButtonRelease> {event_record ButtonRelease %W %X %Y %B} }
! set ::event_history [list] ! proc event_record {args} { ! lappend ::event_history $args }
--- 493,501 ---- bind all <KeyRelease> {event_record KeyRelease %W %X %Y %K} bind all <ButtonPress> {event_record ButtonPress %W %X %Y %b} ! bind all <ButtonRelease> {event_record ButtonRelease %W %X %Y %b} }
! proc event_record {type W X Y K} { ! $::event_history add [format "%13s %9s %4d %4d %s" $type $K $X $Y $W] }
*************** *** 1392,1398 ****
def Canvas save_as {} { - global patch_filetypes $self checkgeometry ! set filename [tk_getSaveFile -filetypes $patch_filetypes] if {$filename != ""} { set @file [string range $filename [expr [string last / $filename]+1] end] --- 1405,1410 ----
def Canvas save_as {} { $self checkgeometry ! set filename [tk_getSaveFile -filetypes $::patch_filetypes] if {$filename != ""} { set @file [string range $filename [expr [string last / $filename]+1] end] *************** *** 1409,1413 **** def Canvas quit {} {global main; $main quit}
! proc wonder {} {tk_messageBox -message "this would be a cool feature, eh?" -type yesno -icon question}
def Canvas eval% {code} { --- 1421,1425 ---- def Canvas quit {} {global main; $main quit}
! proc wonder {} {tk_messageBox -message [say ask_cool] -type yesno -icon question}
def Canvas eval% {code} { *************** *** 1444,1449 **** def Client audio_off {} {netsend [list pd dsp 0]} def Client clipboard_view {} {ClipboardDialog new $::clipboard} ! def Client command_history_view {} { ListDialog new $::command_history} ! def Client event_history_view {} { ListDialog new $::event_history} def Client do_what_i_mean {} {wonder}
--- 1456,1461 ---- def Client audio_off {} {netsend [list pd dsp 0]} def Client clipboard_view {} {ClipboardDialog new $::clipboard} ! def Client command_history_view {} { ListDialog new $::command_history [say command_history_view]} ! def Client event_history_view {} { [[ListDialog new $::event_history [say event_history_view]] listbox] configure -font {Mono -10}} def Client do_what_i_mean {} {wonder}
*************** *** 7854,7861 **** class_new ListDialog {Dialog}
! def ListDialog init {history} { super close set @history $history ! wm title .$self "CommandHistory" pack [listbox .$self.list -yscrollcommand ".$self.scroll set" -width 72] -side left -fill both -expand yes pack [scrollbar .$self.scroll -command ".$self.list yview"] -side right -fill y --- 7866,7873 ---- class_new ListDialog {Dialog}
! def ListDialog init {history title} { super close set @history $history ! wm title .$self $title pack [listbox .$self.list -yscrollcommand ".$self.scroll set" -width 72] -side left -fill both -expand yes pack [scrollbar .$self.scroll -command ".$self.list yview"] -side right -fill y *************** *** 7864,7876 **** }
def ListDialog notice {args} { .$self.list delete 0 end ! set hist [concat [$@history undo_stack] [list "You Are Here"] [lreverse [$@history redo_stack]]] ! set k [llength [$@history undo_stack]] ! set i 0 ! foreach e $hist { ! .$self.list insert end "$i: $e" ! incr i ! } }
--- 7876,7884 ---- }
+ def ListDialog listbox {} {return .$self.list} + def ListDialog notice {args} { .$self.list delete 0 end ! foreach e [$@history list] {.$self.list insert end $e} }