Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4419
Modified Files: Tag: devel_0_39 desire.tk Log Message: .
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.131 retrieving revision 1.1.2.132 diff -C2 -d -r1.1.2.131 -r1.1.2.132 *** desire.tk 2 Dec 2005 01:54:00 -0000 1.1.2.131 --- desire.tk 2 Dec 2005 09:47:17 -0000 1.1.2.132 *************** *** 19,22 **** --- 19,24 ---- # some list processing functions
+ proc min {x y} {if {$x<$y} {return $x} {return $y}} + proc max {x y} {if {$x>$y} {return $x} {return $y}} proc mset {vars list} {uplevel 1 "foreach {$vars} {$list} {}"} proc l+ { al bl} {set r {}; foreach a $al b $bl {lappend r [expr $a + $b]}; return $r} *************** *** 357,362 **** frame .controls.switches foreach {w x y z} { ! audiobutton "audio" ctrls_audio_on {pd pd dsp $ctrls_audio_on} ! meterbutton "meters" ctrls_meter_on {pd pd meters $ctrls_meter_on} } { pack [checkbutton .controls.switches.$w -text $x \ --- 359,364 ---- frame .controls.switches foreach {w x y z} { ! audiobutton "audio" ctrls_audio_on {pd pd dsp $ctrls_audio_on} ! meterbutton "meters" ctrls_meter_on {pd pd meters $ctrls_meter_on} } { pack [checkbutton .controls.switches.$w -text $x \ *************** *** 368,377 **** pack .controls.switches -side right
! bind . <Control-Key> {pd_ctrlkey %W %K 0} ! bind . <Control-Shift-Key> {pd_ctrlkey %W %K 1} switch $OS { osx { ! bind . <Mod1-Key> {pd_ctrlkey %W %K 0} ! bind . <Mod1-Shift-Key> {pd_ctrlkey %W %K 1} } } --- 370,379 ---- pack .controls.switches -side right
! bind . <Control-Key> {$main ctrlkey %K 0} ! bind . <Control-Shift-Key> {$main ctrlkey %K 1} switch $OS { osx { ! bind . <Mod1-Key> {$main ctrlkey %K 0} ! bind . <Mod1-Shift-Key> {$main ctrlkey %K 1} } } *************** *** 381,388 **** ############### set up global variables ################################
- set untitled_number 1 - set untitled_directory [pwd] set saveas_client doggy ! set pd_opendir $untitled_directory set pd_undoaction no set pd_redoaction no --- 383,388 ---- ############### set up global variables ################################
set saveas_client doggy ! set pd_opendir [pwd] set pd_undoaction no set pd_redoaction no *************** *** 521,544 **** }
! proc menu_new {} { ! global untitled_number untitled_directory offset_canvas _ pd pd filename Untitled-$untitled_number $untitled_directory ! pd { ! #N canvas; ! #X pop 1; ! } incr untitled_number }
! proc menu_open {} { global pd_opendir set filename [tk_getOpenFile -defaultextension .pd \ -filetypes { {{pd files} {.pd}} {{max files} {.pat}}} \ -initialdir $pd_opendir] ! if {$filename != ""} {open_file $filename} }
! proc open_file {filename} { ! global pd_opendir offset_canvas_file offset_wire_file offset_obj_file _ font set directory [string range $filename 0 [expr [string last / $filename] - 1]] set pd_opendir $directory --- 521,560 ---- }
! # a menuable must be a view ! class_new menuable {} ! def* menuable init {args} { ! eval [concat [list super] $args] ! set @accel {} ! } ! ! #class_new client {menuable view} ! class_new client {menuable} ! ! set untitled_number 1 ! set untitled_directory [pwd] ! ! def client init {} { ! #super ! } ! ! def client new_file {} { ! global untitled_number untitled_directory pd pd filename Untitled-$untitled_number $untitled_directory ! pd {#N canvas; #X pop 1} incr untitled_number }
! set main [client_new] ! ! def client open_file {} { global pd_opendir set filename [tk_getOpenFile -defaultextension .pd \ -filetypes { {{pd files} {.pd}} {{max files} {.pat}}} \ -initialdir $pd_opendir] ! if {$filename != ""} {$self open_file_really $filename} }
! def client open_file_really {filename} { ! global pd_opendir _ font set directory [string range $filename 0 [expr [string last / $filename] - 1]] set pd_opendir $directory *************** *** 549,553 **** }
! proc menu_send {} { toplevel .sendpanel set e .sendpanel.entry --- 565,569 ---- }
! def client send_message {} { toplevel .sendpanel set e .sendpanel.entry *************** *** 564,577 **** proc menu_audio {flag} {pd pd dsp $flag}
- def canvas close {} { - #foreach to_kill [winfo children $name] {destroy $to_kill} - ##destroy $name - pd $name menuclose 0 - $self fix_window_menu - } - #-----------------------------------------------------------------------------------# ! proc populate_menu {menu context list} { ! global accels foreach e $list { if {[llength $e]==0} { --- 580,585 ---- proc menu_audio {flag} {pd pd dsp $flag}
#-----------------------------------------------------------------------------------# ! def menuable populate_menu {menu list} { foreach e $list { if {[llength $e]==0} { *************** *** 581,586 **** if {![llength $cmd]} {set cmd "%W [lindex $e 0]"} set accel [accel_munge [lindex $e 2]] ! regsub -all %W $cmd $context cmd ! if {$accel != ""} {set accels([string tolower $accel]) $cmd} if {[llength $e]==3} { $menu add command -label [lindex $e 0] -command $cmd \ --- 589,594 ---- if {![llength $cmd]} {set cmd "%W [lindex $e 0]"} set accel [accel_munge [lindex $e 2]] ! regsub -all %W $cmd $self cmd ! if {$accel != ""} {dict set @accels $accel $cmd} if {[llength $e]==3} { $menu add command -label [lindex $e 0] -command $cmd \ *************** *** 598,608 **** #################### the "File" menu for the Pd window ##############
! populate_menu .mbar.file {} { ! {"New" {menu_new} "Ctrl+n"} ! {"Open" {menu_open} "Ctrl+o"} {} - {"Class List" {class_browser} ""} {".pdrc Editor" {pdrc_editor_new} ""} ! {"Message" {menu_send} "Ctrl+m"} {"Path..." {pd pd start-path-dialog} ""} {} --- 606,615 ---- #################### the "File" menu for the Pd window ##############
! $main populate_menu .mbar.file { ! {new_file {} "Ctrl+n"} ! {open_file {} "Ctrl+o"} {} {".pdrc Editor" {pdrc_editor_new} ""} ! {send_message {} "Ctrl+m"} {"Path..." {pd pd start-path-dialog} ""} {} *************** *** 610,613 **** --- 617,670 ---- }
+ # switch -- $key { + # n {$self new_file} + # o {$self open_file} + # m {$self send_message} + # q {$self quit} Q {$self really_quit} + # slash {$self audio 1} + # period {$self audio 0} + # } + + # note: uplevel would be nice but with the supercalls we don't know how many levels up + def* menuable eval% {code} { + regsub -all %W $code $self code + eval $code + } + + # switch -- $key { + # Q {$main really_quit} + # s {$self save} S {$self save_as} + # z {$self undo} Z {$self redo} + # } + + # for audio switch on/off + #switch -- $key { + # slash {menu_audio 1} + # period {menu_audio 0} + # e {$self editmodeswitch} + #} + + def* menuable ctrlkey {key shift} { + set key [if {$shift} {string toupper $key} {string tolower $key}] + set key "Ctrl+$key" + if {[dict exists $@accels $key]} { + $self eval% [dict get $@accels $key] + return + } { + puts "ctrlkey: unknown $key" + } + } + + def* menuable altkey {key iso} { + set key [if {$shift} {string toupper $key} {string tolower $key}] + set key "Alt+$key" + if {[dict exists $@accels $key]} { + $self eval% [dict get $@accels $key] + return + } { + puts "altkey: unknown $key" + } + } + #-----------------------------------------------------------------------------------# set font(size) 12 *************** *** 635,640 **** set look(outletfg) #ff0000 set look(extrapix) [switch $OS { ! osx {list 2} ! default {list 1}}] set look(minobjwidth) 21
--- 692,697 ---- set look(outletfg) #ff0000 set look(extrapix) [switch $OS { ! osx {concat 2} ! default {concat 1}}] set look(minobjwidth) 21
*************** *** 716,720 **** #-----------------------------------------------------------------------------------#
! class_new canvas {view}
#def canvas close {} {pd $name menuclose 0} --- 773,777 ---- #-----------------------------------------------------------------------------------#
! class_new canvas {menuable view}
#def canvas close {} {pd $name menuclose 0} *************** *** 727,732 **** }
set canvasmenu(file) { ! {New {menu_new} "Ctrl+n"} {Open... {menu_open} "Ctrl+o"} {} --- 784,795 ---- }
+ def* canvas eval% {code} { + regsub -all %X $code $@current_x code + regsub -all %Y $code $@current_y code + super $code + } + set canvasmenu(file) { ! {New {} "Ctrl+n"} {Open... {menu_open} "Ctrl+o"} {} *************** *** 743,785 ****
set canvasmenu(edit) { ! {Undo {menu_undo} "Ctrl+z"} ! {Redo {menu_redo} "Ctrl+Z"} {} ! {Cut {pd %W cut} "Ctrl+x"} ! {Copy {pd %W copy} "Ctrl+c"} ! {Paste {pd %W paste} "Ctrl+v"} ! {Duplicate {pd %W duplicate} "Ctrl+d"} ! {"Select all" {pd %W selectall} "Ctrl+a"} {} ! {"Text Editor" {pd %W texteditor} "Ctrl+t"} ! {Font {pd %W menufont} {}} ! {"Tidy Up" {pd %W tidy} {}} {} }
set canvasmenu(put) { ! {Object {pd %W obj %X %Y} "Ctrl+1"} ! {Message {pd %W msg %X %Y} "Ctrl+2"} ! {Number {pd %W floatatom %X %Y} "Ctrl+3"} ! {Symbol {pd %W symbolatom %X %Y} "Ctrl+4"} ! {Comment {pd %W text %X %Y} "Ctrl+5"} {} ! {Bang {pd %W bng %X %Y} "Alt+b"} ! {Toggle {pd %W toggle %X %Y} "Alt+t"} ! {Number2 {pd %W numbox %X %Y} "Alt+n"} ! {Vslider {pd %W vslider %X %Y} "Alt+v"} ! {Hslider {pd %W hslider %X %Y} "Alt+h"} ! {Vradio {pd %W vradio %X %Y} "Alt+d"} ! {Hradio {pd %W hradio %X %Y} "Alt+i"} ! {VU {pd %W vumeter %X %Y} "Alt+u"} ! {dropper {pd %W dropper %X %Y} "Alt+x"} ! {Canvas {pd %W mycnv %X %Y} "Alt+c"} {} ! {Graph {pd %W graph } {}} ! {Array {pd %W menuarray} {}} }
set canvasmenu(media) { ! {{audio ON} {menu_audio 1} "Ctrl+/"} {{audio OFF} {menu_audio 0} "Ctrl+."} {} --- 806,848 ----
set canvasmenu(edit) { ! {undo {} "Ctrl+z"} ! {redo {} "Ctrl+Z"} {} ! {cut {} "Ctrl+x"} ! {copy {} "Ctrl+c"} ! {paste {} "Ctrl+v"} ! {duplicate {} "Ctrl+d"} ! {select_all {} "Ctrl+a"} {} ! {text_editor {} "Ctrl+t"} ! {font_bomb {} {}} ! {tidy_up {} {}} {} }
set canvasmenu(put) { ! {Object {pd .%W obj %X %Y} "Ctrl+1"} ! {Message {pd .%W msg %X %Y} "Ctrl+2"} ! {Number {pd .%W floatatom %X %Y} "Ctrl+3"} ! {Symbol {pd .%W symbolatom %X %Y} "Ctrl+4"} ! {Comment {pd .%W text %X %Y} "Ctrl+5"} {} ! {Bang {pd .%W bng %X %Y} "Alt+b"} ! {Toggle {pd .%W toggle %X %Y} "Alt+t"} ! {Number2 {pd .%W numbox %X %Y} "Alt+n"} ! {Vslider {pd .%W vslider %X %Y} "Alt+v"} ! {Hslider {pd .%W hslider %X %Y} "Alt+h"} ! {Vradio {pd .%W vradio %X %Y} "Alt+d"} ! {Hradio {pd .%W hradio %X %Y} "Alt+i"} ! {VU {pd .%W vumeter %X %Y} "Alt+u"} ! {dropper {pd .%W dropper %X %Y} "Alt+x"} ! {Canvas {pd .%W mycnv %X %Y} "Alt+c"} {} ! {Graph {pd .%W graph } {}} ! {Array {pd .%W menuarray} {}} }
set canvasmenu(media) { ! {{audio ON} {menu_audio 1} "Ctrl+/"} {{audio OFF} {menu_audio 0} "Ctrl+."} {} *************** *** 795,806 ****
lappend canvasmenu(media) {} \ ! {"Test Audio and MIDI" {pd menu_doc_open doc/7.stuff/tools testtone.pd} ""} \ ! {"Load Meter" {pd menu_doc_open doc/7.stuff/tools load-meter.pd} ""}
proc menu_addstd {mbar} { ! global pd_apilist pd_midiapilist canvasmenu ! populate_menu $mbar.media {} $canvasmenu(media) set x 0 ! populate_menu $mbar.media {} {{}} foreach a $pd_apilist { $mbar.media add radiobutton -label [lindex $a 0] \ --- 858,869 ----
lappend canvasmenu(media) {} \ ! {"Test Audio and MIDI" {menu_doc_open doc/7.stuff/tools testtone.pd} ""} \ ! {"Load Meter" {menu_doc_open doc/7.stuff/tools load-meter.pd} ""}
proc menu_addstd {mbar} { ! global pd_apilist pd_midiapilist canvasmenu main ! $main populate_menu $mbar.media $canvasmenu(media) set x 0 ! $main populate_menu $mbar.media {{}} foreach a $pd_apilist { $mbar.media add radiobutton -label [lindex $a 0] \ *************** *** 809,813 **** incr x } ! populate_menu $mbar.media {} {{}} foreach a $pd_midiapilist { $mbar.media add radiobutton -label [lindex $a 0] \ --- 872,876 ---- incr x } ! $main populate_menu $mbar.media {{}} foreach a $pd_midiapilist { $mbar.media add radiobutton -label [lindex $a 0] \ *************** *** 816,827 **** incr x } ! populate_menu $mbar.help {} { ! {"About Pd" {pd menu_about} ""} {"Pure Documentation..." {pd menu_documentation} ""} } }
proc menu_audio {flag} {pd pd dsp $flag}
#-----------------------------------------------------------------------------------# # .xc47f00d.c -> .xc47f00d (tk canvas to tk toplevel) --- 879,938 ---- incr x } ! $main populate_menu $mbar.help { ! {about {} ""} {"Pure Documentation..." {pd menu_documentation} ""} + {class_browser {} ""} } }
+ def client about {} { + set dialog [menu_doc_open doc/1.manual 1.introduction.txt] + wm title $dialog "About Pd" + label $dialog.title -text "About Pure Data" -font {helvetica 24} + pack $dialog.title -side top + } + proc menu_audio {flag} {pd pd dsp $flag}
+ set pd_prefix [file dirname [file dirname [exec which pd]]] + set pd_guidir ${pd_prefix}/lib/pd + set doc_number 1 + + proc menu_opentext {filename} { + global doc_number pd_guidir pd_myversion + set w [format ".help%d" $doc_number] + toplevel $w + wm title $w $filename + frame $w.1 + frame $w.2 + pack [text $w.1.text -relief raised -bd 2 -font -*-courier-bold--normal--12-* \ + -yscrollcommand "$w.1.scroll set" -background white] -side left -fill both -expand 1 + pack [scrollbar $w.1.scroll -command "$w.1.text yview"] -side right -fill y + pack [button $w.2.close -text Close -command "destroy $w"] -side right + pack $w.2 -side bottom -fill x -expand 0 + pack $w.1 -side bottom -fill both -expand 1 + set f [open $filename] + while {![eof $f]} { + set bigstring [read $f 1000] + regsub -all PD_BASEDIR $bigstring $pd_guidir bigstring + regsub -all PD_VERSION $bigstring $pd_myversion bigstring + $w.1.text insert end $bigstring + } + $w.1.text configure -state disabled + close $f + incr doc_number + return $w + } + + proc menu_doc_open {subdir basename} { + global pd_guidir + set dirname $pd_guidir/$subdir + if {[string first .txt $basename] >= 0} { + return [menu_opentext $dirname/$basename] + } else { + pd "pd open [pdtk_enquote $basename] [pdtk_enquote $dirname] ;" + } + } + #-----------------------------------------------------------------------------------# # .xc47f00d.c -> .xc47f00d (tk canvas to tk toplevel) *************** *** 851,854 **** --- 962,971 ---- def* canvas getscroll {args} {}
+ def canvas close {} { + pd $name menuclose 0 + $self fix_window_menu + } + + #-----------------------------------------------------------------------------------#
*************** *** 873,880 **** $self new_menubar $editable menu $name.popup -tearoff false ! populate_menu $name.popup $name { ! {"Properties" {popup_properties [c2self %W]} ""} ! {"Open" {popup_open [c2self %W]} ""} ! {"Help" {popup_help [c2self %W]} ""} } wm protocol $name WM_DELETE_WINDOW "$self close" --- 990,997 ---- $self new_menubar $editable menu $name.popup -tearoff false ! $self populate_menu $name.popup { ! {"Properties" {%W popup_properties} ""} ! {"Open" {%W popup_open } ""} ! {"Help" {%W popup_help } ""} } wm protocol $name WM_DELETE_WINDOW "$self close" *************** *** 983,989 **** menu $m foreach x {file put view find media help} {menu $m.$x -tearoff $pd_tearoff} ! populate_menu $m.file $name $canvasmenu(file) menu $m.edit -postcommand "$self fix_edit_menu" -tearoff $pd_tearoff ! populate_menu $m.edit $name $canvasmenu(edit) $m.edit add checkbutton -label "Edit mode" -indicatoron true \ -selectcolor grey85 -command "menu_editmode $name" \ --- 1100,1106 ---- menu $m foreach x {file put view find media help} {menu $m.$x -tearoff $pd_tearoff} ! $self populate_menu $m.file $canvasmenu(file) menu $m.edit -postcommand "$self fix_edit_menu" -tearoff $pd_tearoff ! $self populate_menu $m.edit $canvasmenu(edit) $m.edit add checkbutton -label "Edit mode" -indicatoron true \ -selectcolor grey85 -command "menu_editmode $name" \ *************** *** 992,996 **** if {!$editable} {$m.edit entryconfigure "Edit mode" -indicatoron false}
! populate_menu $m.view $name { {Reload {pd "%W map 0 ; %W map 1"} {}} {Redraw {[c2self %W] redraw} {}} --- 1109,1113 ---- if {!$editable} {$m.edit entryconfigure "Edit mode" -indicatoron false}
! $self populate_menu $m.view { {Reload {pd "%W map 0 ; %W map 1"} {}} {Redraw {[c2self %W] redraw} {}} *************** *** 998,1003 **** # {Crosshair {global crosshair; set crosshair [expr !!$crosshair]} "" toggle}
! populate_menu $m.put $name $canvasmenu(put) ! populate_menu $name.m.find $name { {Find... {foo menu_findobject} "Ctrl+f"} {"Find Again" {foo "pd %W findagain"} "Ctrl+g"} --- 1115,1120 ---- # {Crosshair {global crosshair; set crosshair [expr !!$crosshair]} "" toggle}
! $self populate_menu $m.put $canvasmenu(put) ! $self populate_menu $name.m.find { {Find... {foo menu_findobject} "Ctrl+f"} {"Find Again" {foo "pd %W findagain"} "Ctrl+g"} *************** *** 1005,1009 **** } menu $m.windows -postcommand "foo menu_fixwindowmenu" -tearoff $pd_tearoff ! populate_menu $name.m.windows $name { {"parent window" {foo menu_windowparent} {}} {"Pd window" {foo menu_pop_pd} {}} --- 1122,1126 ---- } menu $m.windows -postcommand "foo menu_fixwindowmenu" -tearoff $pd_tearoff ! $self populate_menu $name.m.windows { {"parent window" {foo menu_windowparent} {}} {"Pd window" {foo menu_pop_pd} {}} *************** *** 1028,1088 **** # LATER also cut/copy/paste def canvas fix_edit_menu {} { set e .$self.m.edit ! if {$name==$@undocanvas && $@undoaction!="no"} { ! $e entryconfigure "Undo*" -state normal -label "Undo $@undoaction" } else { ! $e entryconfigure "Undo*" -state disabled -label "Can't Undo" } ! if {$name==$@undocanvas && $@redoaction!="no"} { ! $e entryconfigure "Redo*" -state normal -label "Redo $@redoaction" } else { ! $e entryconfigure "Redo*" -state disabled -label "Can't Redo" ! } ! } ! ! #-----------------------------------------------------------------------------------# ! def* canvas ctrlkey {key shift} { ! global accels focus ! set top .$self ! set name .$self.c ! set key [string tolower $key] ! # for quit/save/undo ! puts "key: $key ; shift $shift" ! switch -- $key { ! q {if {$shift} {menu_really_quit} {menu_quit}; return} ! s {if {$shift} {menu_saveas $top} {menu_save $top}; return} ! z {if {$shift} {menu_redo $top} {menu_undo $top}; return} ! } ! if {[info exists accels(ctrl+$key)]} { ! #puts "key = $key :: accels = $accels(ctrl+$key) :: top = $top" ! set cmd $accels(ctrl+$key) ! regsub -all %W $cmd $top cmd ! regsub -all %X $cmd $@current_x cmd ! regsub -all %Y $cmd $@current_y cmd ! #puts $cmd ! eval $cmd ! return ! } ! # for audio switch on/off ! switch -- $key { ! slash {menu_audio 1} ! period {menu_audio 0} ! e {$self editmodeswitch} ! } ! } ! ! def canvas altkey {key iso} { ! global accels ! set name .$self.c ! set topname .$self ! set key [string tolower $key] ! if {[info exists accels(alt+$key)]} { ! set cmd $accels(alt+$key) ! regsub -all %W $cmd $topname cmd ! regsub -all %X $cmd $@current_x cmd ! regsub -all %Y $cmd $@current_y cmd ! puts $cmd ! eval $cmd ! return } } --- 1145,1161 ---- # LATER also cut/copy/paste def canvas fix_edit_menu {} { + return ;# hehe set e .$self.m.edit ! set t [say undo] ! if {[llength $@undo]} { ! $e entryconfigure "Undo*" -state normal -label "$t $@undoaction" } else { ! $e entryconfigure "Undo*" -state disabled -label "[say cannot] $t" } ! set t [say redo] ! if {[llength $@redo]} { ! $e entryconfigure "Redo*" -state normal -label "$t $@redoaction" } else { ! $e entryconfigure "Redo*" -state disabled -label "[say cannot] $t" } } *************** *** 1202,1207 **** }
- proc max {x y} {if {$x>$y} {return $x} {return $y}} - def* textbox update_size {} { global font look --- 1275,1278 ---- *************** *** 1898,1917 ****
#-----------------------------------------------------------------------------------# - - ############### event binding procedures for Pd window ################ - - proc pd_ctrlkey {name key shift} { - set key [string tolower $key] - switch -- $key { - n {menu_new} - o {menu_open} - m {menu_send} - q {if {$shift == 1} {menu_really_quit} {menu_quit}} - slash {menu_audio 1} - period {menu_audio 0} - } - } - - #-----------------------------------------------------------------------------------# class_new box {view}
--- 1969,1972 ----