From 4f51fe6574a7d46ddb95bb85e1053e86c2fb805a Mon Sep 17 00:00:00 2001 From: Miller Puckette Date: Sat, 20 Sep 2008 00:30:48 +0000 Subject: pd 0.42-0 test 05 svn path=/trunk/; revision=10301 --- pd/src/u_main.tk | 109 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 94 insertions(+), 15 deletions(-) (limited to 'pd/src/u_main.tk') diff --git a/pd/src/u_main.tk b/pd/src/u_main.tk index 1ad84f08..9d68b58e 100644 --- a/pd/src/u_main.tk +++ b/pd/src/u_main.tk @@ -194,12 +194,14 @@ pack .controls.inout.out.label .controls.inout.out.level \ button .controls.dio -text "DIO\nerrors" \ -command {pd [concat pd audiostatus \;]} +button .controls.clear -text "clear\nprinout" \ + -command {.printout.text delete 0.0 end} pack .controls.inout.in .controls.inout.out -side left -padx 6 pack .controls.inout -side left -padx 14 -pack .controls.switches -side right -pack .controls.dio -side right -padx 20 - +pack .controls.switches -side left +pack .controls.dio -side left -padx 20 +pack .controls.clear -side right -padx 6 frame .printout text .printout.text -relief raised -bd 2 -font console_font \ @@ -835,16 +837,12 @@ proc menu_fixwindowmenu {name} { set find_canvas nobody set find_string "" set find_count 1 +set find_wholeword 1 proc find_apply {name} { - global find_string - global find_canvas - regsub -all \; $find_string " _semi_ " find_string2 - regsub -all \, $find_string2 " _comma_ " find_string3 -# puts stderr [concat $find_canvas find $find_string3 \ -# \;] - pd [concat $find_canvas find $find_string3 \ - \;] + global find_string find_canvas find_wholeword + pd [concat $find_canvas find [pdtk_encodedialog $find_string] \ + $find_wholeword \;] after 50 destroy $name } @@ -853,9 +851,7 @@ proc find_cancel {name} { } proc menu_findobject {canvas} { - global find_string - global find_canvas - global find_count + global find_string find_canvas find_count find_wholeword set name [format ".find%d" $find_count] set find_count [expr $find_count + 1] @@ -869,6 +865,9 @@ proc menu_findobject {canvas} { entry $name.entry -textvariable find_string pack $name.entry -side top + checkbutton $name.wholeword -variable find_wholeword \ + -text {whole word} -anchor e + pack $name.wholeword -side bottom frame $name.buttonframe pack $name.buttonframe -side bottom -fill x -pady 2m @@ -4233,7 +4232,9 @@ proc path_apply {id} { for {set x 0} {$x < $pd_path_count} {incr x} { global pd_path$x set this_path [set pd_path$x] - if {0==[string match "" $this_path]} {lappend pd_path [pdtk_encodedialog $this_path]} + if {0==[string match "" $this_path]} { + lappend pd_path [pdtk_encodedialog $this_path] + } } pd [concat pd path-dialog $pd_extrapath $pd_verbose $pd_path \;] @@ -4395,3 +4396,81 @@ proc pdtk_startup_dialog {id nort flags} { focus $id.f0 } +########## data-driven dialog -- convert others to this someday? ########## + +proc ddd_apply {id} { + set vid [string trimleft $id .] + set var_count [concat ddd_count_$vid] + global $var_count + set count [eval concat $$var_count] + set values {} + + for {set x 0} {$x < $count} {incr x} { + set varname [concat ddd_var_$vid$x] + global $varname + lappend values [eval concat $$varname] + } + set cmd [concat $id done $values \;] + +# puts stderr $cmd + pd $cmd +} + +proc ddd_cancel {id} { + set cmd [concat $id cancel \;] +# puts stderr $cmd + pd $cmd +} + +proc ddd_ok {id} { + ddd_apply $id + ddd_cancel $id +} + +proc ddd_dialog {id dialogname} { + global ddd_fields + set vid [string trimleft $id .] + set count [llength $ddd_fields] + + set var_count [concat ddd_count_$vid] + global $var_count + set $var_count $count + + toplevel $id + label $id.label -text $dialogname + pack $id.label -side top + wm title $id "Pd dialog" + wm resizable $id 0 0 + wm protocol $id WM_DELETE_WINDOW [concat ddd_cancel $id] + + for {set x 0} {$x < $count} {incr x} { + set varname [concat ddd_var_$vid$x] + global $varname + set fieldname [lindex $ddd_fields $x 0] + set $varname [lindex $ddd_fields $x 1] + frame $id.frame$x + pack $id.frame$x -side top + label $id.frame$x.label -text $fieldname + entry $id.frame$x.entry -textvariable $varname -width 20 + bind $id.frame$x.entry [concat ddd_ok $id] + pdtk_standardkeybindings $id.frame$x.entry + pack $id.frame$x.entry $id.frame$x.label -side right + } + + frame $id.buttonframe -pady 5 + pack $id.buttonframe -side top -fill x -pady 2 + button $id.buttonframe.cancel -text {Cancel}\ + -command "ddd_cancel $id" + button $id.buttonframe.apply -text {Apply}\ + -command "ddd_apply $id" + button $id.buttonframe.ok -text {OK}\ + -command "ddd_ok $id" + pack $id.buttonframe.cancel $id.buttonframe.apply \ + $id.buttonframe.ok -side left -expand 1 + +# $id.params.entry select from 0 +# $id.params.entry select adjust end +# focus $id.params.entry +} + + -- cgit v1.2.1