From 21c068f1916330e90f814bed461fe0821d1665ec Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Sun, 9 Oct 2011 16:36:37 +0000 Subject: checked in pd-0.43-0.src.tar.gz svn path=/trunk/; revision=15557 --- pd/tcl/AppMain.tcl | 9 - pd/tcl/Makefile.am | 16 ++ pd/tcl/apple_events.tcl | 50 +++-- pd/tcl/dialog_array.tcl | 21 +- pd/tcl/dialog_audio.tcl | 251 ++++++++++++---------- pd/tcl/dialog_canvas.tcl | 26 ++- pd/tcl/dialog_data.tcl | 53 +++++ pd/tcl/dialog_find.tcl | 145 +++++++++---- pd/tcl/dialog_font.tcl | 61 +++--- pd/tcl/dialog_gatom.tcl | 26 ++- pd/tcl/dialog_iemgui.tcl | 105 +++++----- pd/tcl/dialog_message.tcl | 85 ++++++++ pd/tcl/dialog_midi.tcl | 15 +- pd/tcl/dialog_path.tcl | 70 +++++++ pd/tcl/dialog_startup.tcl | 96 +++++++++ pd/tcl/helpbrowser.tcl | 272 ++++++++++++++++++++++++ pd/tcl/opt_parser.tcl | 40 ++-- pd/tcl/pd-gui.tcl | 506 +++++++++++++++++++++++++++++++-------------- pd/tcl/pd.ico | Bin 0 -> 25214 bytes pd/tcl/pd_bindings.tcl | 303 ++++++++++++++------------- pd/tcl/pd_connect.tcl | 28 ++- pd/tcl/pd_menucommands.tcl | 217 +++++++++++-------- pd/tcl/pd_menus.tcl | 447 ++++++++++++++++++++++++--------------- pd/tcl/pdtk_canvas.tcl | 333 ++++++++++++++++++++++------- pd/tcl/pdtk_text.tcl | 53 ++++- pd/tcl/pdwindow.tcl | 391 ++++++++++++++++++++++++++++++++--- pd/tcl/pkgIndex.tcl | 7 + pd/tcl/scrollbox.tcl | 191 +++++++++++++++++ pd/tcl/scrollboxwindow.tcl | 94 +++++++++ pd/tcl/wheredoesthisgo.tcl | 119 ++++++----- 30 files changed, 2985 insertions(+), 1045 deletions(-) create mode 100644 pd/tcl/Makefile.am create mode 100644 pd/tcl/dialog_data.tcl create mode 100644 pd/tcl/dialog_message.tcl create mode 100644 pd/tcl/dialog_path.tcl create mode 100644 pd/tcl/dialog_startup.tcl create mode 100644 pd/tcl/helpbrowser.tcl create mode 100755 pd/tcl/pd.ico create mode 100644 pd/tcl/scrollbox.tcl create mode 100644 pd/tcl/scrollboxwindow.tcl (limited to 'pd/tcl') diff --git a/pd/tcl/AppMain.tcl b/pd/tcl/AppMain.tcl index b170c6f5..7c68a9d0 100644 --- a/pd/tcl/AppMain.tcl +++ b/pd/tcl/AppMain.tcl @@ -3,17 +3,8 @@ # other configuration, like when 'pd' launches Wish.app or when 'pd' is using # an X11 wish on Mac OS X. GNU/Linux and Windows will never use this file. - -puts --------------------------AppMain.tcl----------------------------------- -catch {console show} - package require apple_events -puts "AppMain.tcl" -puts "argv0: $argv0" -puts "executable: [info nameofexecutable]" -puts "argc: $argc argv: $argv" - # TODO is there anything useful to do with the psn (Process Serial Number)? if {[string first "-psn" [lindex $argv 0]] == 0} { set argv [lrange $argv 1 end] diff --git a/pd/tcl/Makefile.am b/pd/tcl/Makefile.am new file mode 100644 index 00000000..65780ebf --- /dev/null +++ b/pd/tcl/Makefile.am @@ -0,0 +1,16 @@ +AUTOMAKE_OPTIONS = foreign + +SUFFIXES = .tcl + +# we want these in the dist tarball +#EXTRA_DIST = CHANGELOG.txt notes.txt makefile.mingw + + +bin_SCRIPTS = pd-gui.tcl + +libpdtcldir = $(pkglibdir)/tcl +dist_libpdtcl_SCRIPTS = pd-gui.tcl +dist_libpdtcl_DATA = apple_events.tcl dialog_canvas.tcl dialog_gatom.tcl dialog_path.tcl pd_bindings.tcl pd_menus.tcl pdwindow.tcl scrollboxwindow.tcl AppMain.tcl dialog_data.tcl dialog_iemgui.tcl dialog_startup.tcl pd_connect.tcl pdtk_array.tcl pkgIndex.tcl wheredoesthisgo.tcl dialog_array.tcl dialog_find.tcl dialog_message.tcl helpbrowser.tcl pdtk_canvas.tcl pkg_mkIndex.tcl dialog_audio.tcl dialog_font.tcl dialog_midi.tcl opt_parser.tcl pd_menucommands.tcl pdtk_text.tcl scrollbox.tcl pd.ico + +etags: TAGS + etags --append --language=none --regex="/proc[ \t]+\([^ \t]+\)/\1/" *.tcl diff --git a/pd/tcl/apple_events.tcl b/pd/tcl/apple_events.tcl index cfc92982..0311add7 100644 --- a/pd/tcl/apple_events.tcl +++ b/pd/tcl/apple_events.tcl @@ -1,53 +1,65 @@ package provide apple_events 0.1 +package require pdwindow package require wheredoesthisgo # from http://wiki.tcl.tk/12987 set ::tk::mac::CGAntialiasLimit 0 ;# min line thickness to anti-alias (default: 3) -set ::tk::mac::antialiasedtext 1 ;# enable/disable anti-aliased text +set ::tk::mac::antialiasedtext 1 ;# enable anti-aliased text # kAEOpenDocuments proc ::tk::mac::OpenDocument {args} { - foreach filename $args { - puts "open_file $filename" - open_file $filename + foreach filename $args { + if {$::done_init} { + open_file $filename + } else { + lappend ::filestoopen_list $filename + } } set ::pd_menucommands::menu_open_dir [file dirname $filename] } # kEventAppHidden -proc ::tk::mac::OnHide {} { - # TODO +proc ::tk::mac::OnHide {args} { + ::pdwindow::verbose 1 "::tk::mac::OnHide $args +++++++++++++++++++++" } # kEventAppShown -proc ::tk::mac::OnShow {} { - # TODO +proc ::tk::mac::OnShow {args} { + ::pdwindow::verbose 1 "::tk::mac::OnShow $args +++++++++++++++++++++" +} + +# open About Pd... in Tk/Cocoa +proc tkAboutDialog {} { + menu_aboutpd } # kAEShowPreferences -proc ::tk::mac::ShowPreferences {} { - menu_preferences_dialog +proc ::tk::mac::ShowPreferences {args} { + ::pdwindow::verbose 1 "::tk::mac::ShowPreferences $args ++++++++++++" + pdsend "pd start-path-dialog" } # kAEQuitApplication -#proc ::tk::mac::Quit {} { -# # TODO sort this out... how to quit pd-gui after sending the message -# puts stderr "Custom exit proc" -# pdsend "pd verifyquit" +proc ::tk::mac::Quit {args} { + pdsend "pd verifyquit" +} + +# on Tk/Cocoa, override the Apple Help menu +#proc tk::mac::ShowHelp {args} { #} # these I gleaned by reading the source (tkMacOSXHLEvents.c) proc ::tk::mac::PrintDocument {args} { - # TODO what's $mytoplevel here?. I am guessing args would be the same as - # ::tk::mac::OpenDocument - #menu_print $mytoplevel + menu_print $::focused_window } -proc ::tk::mac::OpenApplication {} { +proc ::tk::mac::OpenApplication {args} { + ::pdwindow::verbose 1 "::tk::mac::OpenApplication $args ++++++++++++" } -proc ::tk::mac::ReopenApplication {} { +proc ::tk::mac::ReopenApplication {args} { + ::pdwindow::verbose 1 "::tk::mac::ReopenApplication $args ++++++++++" } diff --git a/pd/tcl/dialog_array.tcl b/pd/tcl/dialog_array.tcl index 87b2de8c..0f2696d2 100644 --- a/pd/tcl/dialog_array.tcl +++ b/pd/tcl/dialog_array.tcl @@ -239,7 +239,6 @@ proc ::dialog_array::ok {mytoplevel} { } proc ::dialog_array::pdtk_array_dialog {mytoplevel name size flags newone} { -puts "::dialog_array::pdtk_array_dialog {$mytoplevel $name $size $flags $newone}" if {[winfo exists $mytoplevel]} { wm deiconify $mytoplevel raise $mytoplevel @@ -262,7 +261,11 @@ puts "::dialog_array::pdtk_array_dialog {$mytoplevel $name $size $flags $newone} proc ::dialog_array::create_dialog {mytoplevel newone} { toplevel $mytoplevel -class DialogWindow wm title $mytoplevel [_ "Array Properties"] - if {$::windowingsystem eq "aqua"} {$mytoplevel configure -menu .menubar} + wm group $mytoplevel . + wm resizable $mytoplevel 0 0 + wm transient $mytoplevel $::focused_window + $mytoplevel configure -menu $::dialog_menubar + $mytoplevel configure -padx 0 -pady 0 ::pd_bindings::dialog_bindings $mytoplevel "array" frame $mytoplevel.name @@ -315,14 +318,16 @@ proc ::dialog_array::create_dialog {mytoplevel newone} { } # end jsarlo frame $mytoplevel.buttonframe - pack $mytoplevel.buttonframe -side bottom -fill x -pady 2m + pack $mytoplevel.buttonframe -side bottom -expand 1 -fill x -pady 2m button $mytoplevel.buttonframe.cancel -text [_ "Cancel"] \ -command "::dialog_array::cancel $mytoplevel" - if {$newone == 0} {button $mytoplevel.buttonframe.apply -text [_ "Apply"] \ - -command "::dialog_array::apply $mytoplevel"} + pack $mytoplevel.buttonframe.cancel -side left -expand 1 -fill x -padx 10 + if {$newone == 0 && $::windowingsystem ne "aqua"} { + button $mytoplevel.buttonframe.apply -text [_ "Apply"] \ + -command "::dialog_array::apply $mytoplevel" + pack $mytoplevel.buttonframe.apply -side left -expand 1 -fill x -padx 10 + } button $mytoplevel.buttonframe.ok -text [_ "OK"]\ -command "::dialog_array::ok $mytoplevel" - pack $mytoplevel.buttonframe.cancel -side left -expand 1 - if {$newone == 0} {pack $mytoplevel.buttonframe.apply -side left -expand 1} - pack $mytoplevel.buttonframe.ok -side left -expand 1 + pack $mytoplevel.buttonframe.ok -side left -expand 1 -fill x -padx 10 } diff --git a/pd/tcl/dialog_audio.tcl b/pd/tcl/dialog_audio.tcl index 1025f66e..56f18f45 100644 --- a/pd/tcl/dialog_audio.tcl +++ b/pd/tcl/dialog_audio.tcl @@ -4,19 +4,20 @@ namespace eval ::dialog_audio:: { namespace export pdtk_audio_dialog } -# TODO this panel really needs some reworking, it works but the code is -# very unreadable +# TODO this panel really needs some reworking, it works but the code is very +# unreadable. The panel could look a lot better too, like using menubuttons +# instead of regular buttons with tk_popup for pulldown menus. ####################### audio dialog ##################3 -proc ::dialog_audio::apply {id} { +proc ::dialog_audio::apply {mytoplevel} { global audio_indev1 audio_indev2 audio_indev3 audio_indev4 global audio_inchan1 audio_inchan2 audio_inchan3 audio_inchan4 global audio_inenable1 audio_inenable2 audio_inenable3 audio_inenable4 global audio_outdev1 audio_outdev2 audio_outdev3 audio_outdev4 global audio_outchan1 audio_outchan2 audio_outchan3 audio_outchan4 global audio_outenable1 audio_outenable2 audio_outenable3 audio_outenable4 - global audio_sr audio_advance audio_callback + global audio_sr audio_advance audio_callback audio_blocksize pdsend "pd audio-dialog \ $audio_indev1 \ @@ -37,16 +38,17 @@ proc ::dialog_audio::apply {id} { [expr $audio_outchan4 * ( $audio_outenable4 ? 1 : -1 ) ]\ $audio_sr \ $audio_advance \ - $audio_callback" + $audio_callback \ + $audio_blocksize" } -proc ::dialog_audio::cancel {id} { - pdsend "$id cancel" +proc ::dialog_audio::cancel {mytoplevel} { + pdsend "$mytoplevel cancel" } -proc ::dialog_audio::ok {id} { - ::dialog_audio::apply $id - ::dialog_audio::cancel $id +proc ::dialog_audio::ok {mytoplevel} { + ::dialog_audio::apply $mytoplevel + ::dialog_audio::cancel $mytoplevel } # callback from popup menu @@ -78,18 +80,19 @@ proc audio_popup {name buttonname varname devlist} { # opening several devices; if not, we get an extra button to turn longform # on and restart the dialog. -proc ::dialog_audio::pdtk_audio_dialog {id indev1 indev2 indev3 indev4 \ +proc ::dialog_audio::pdtk_audio_dialog {mytoplevel \ + indev1 indev2 indev3 indev4 \ inchan1 inchan2 inchan3 inchan4 \ outdev1 outdev2 outdev3 outdev4 \ outchan1 outchan2 outchan3 outchan4 sr advance multi callback \ - longform} { + longform blocksize} { global audio_indev1 audio_indev2 audio_indev3 audio_indev4 global audio_inchan1 audio_inchan2 audio_inchan3 audio_inchan4 global audio_inenable1 audio_inenable2 audio_inenable3 audio_inenable4 global audio_outdev1 audio_outdev2 audio_outdev3 audio_outdev4 global audio_outchan1 audio_outchan2 audio_outchan3 audio_outchan4 global audio_outenable1 audio_outenable2 audio_outenable3 audio_outenable4 - global audio_sr audio_advance audio_callback + global audio_sr audio_advance audio_callback audio_blocksize global audio_indevlist audio_outdevlist global pd_indev pd_outdev global audio_longform @@ -125,174 +128,196 @@ proc ::dialog_audio::pdtk_audio_dialog {id indev1 indev2 indev3 indev4 \ set audio_sr $sr set audio_advance $advance set audio_callback $callback - - toplevel $id - wm title $id [_ "Audio Settings"] - if {$::windowingsystem eq "aqua"} {$id configure -menu .menubar} - ::pd_bindings::dialog_bindings $id "audio" - - frame $id.buttonframe - pack $id.buttonframe -side bottom -fill x -pady 2m - button $id.buttonframe.cancel -text [_ "Cancel"]\ - -command "::dialog_audio::cancel $id" - button $id.buttonframe.apply -text [_ "Apply"]\ - -command "::dialog_audio::apply $id" - button $id.buttonframe.ok -text [_ "OK"]\ - -command "::dialog_audio::ok $id" - button $id.buttonframe.save -text [_ "Save all settings"]\ - -command "::dialog_audio::apply $id \; pdsend \"pd save-preferences\"" - pack $id.buttonframe.cancel $id.buttonframe.apply $id.buttonframe.ok \ - $id.buttonframe.save -side left -expand 1 + set audio_blocksize $blocksize + + toplevel $mytoplevel -class DialogWindow + wm title $mytoplevel [_ "Audio Settings"] + wm group $mytoplevel . + wm resizable $mytoplevel 0 0 + wm transient $mytoplevel + $mytoplevel configure -menu $::dialog_menubar + $mytoplevel configure -padx 10 -pady 5 + ::pd_bindings::dialog_bindings $mytoplevel "audio" + # not all Tcl/Tk versions or platforms support -topmost, so catch the error + catch {wm attributes $mytoplevel -topmost 1} + + frame $mytoplevel.buttonframe + pack $mytoplevel.buttonframe -side bottom -fill x -pady 2m + button $mytoplevel.buttonframe.cancel -text [_ "Cancel"]\ + -command "::dialog_audio::cancel $mytoplevel" + pack $mytoplevel.buttonframe.cancel -side left -expand 1 -fill x -padx 15 + button $mytoplevel.buttonframe.apply -text [_ "Apply"]\ + -command "::dialog_audio::apply $mytoplevel" + pack $mytoplevel.buttonframe.apply -side left -expand 1 -fill x -padx 15 + button $mytoplevel.buttonframe.ok -text [_ "OK"] \ + -command "::dialog_audio::ok $mytoplevel" + pack $mytoplevel.buttonframe.ok -side left -expand 1 -fill x -padx 15 + + button $mytoplevel.saveall -text [_ "Save All Settings"]\ + -command "::dialog_audio::apply $mytoplevel; pdsend {pd save-preferences}" + pack $mytoplevel.saveall -side bottom -expand 1 -pady 5 # sample rate and advance - frame $id.srf - pack $id.srf -side top + frame $mytoplevel.srf + pack $mytoplevel.srf -side top - label $id.srf.l1 -text [_ "Sample rate:"] - entry $id.srf.x1 -textvariable audio_sr -width 7 - label $id.srf.l2 -text [_ "Delay (msec):"] - entry $id.srf.x2 -textvariable audio_advance -width 4 - pack $id.srf.l1 $id.srf.x1 $id.srf.l2 $id.srf.x2 -side left + label $mytoplevel.srf.l1 -text [_ "Sample rate:"] + entry $mytoplevel.srf.x1 -textvariable audio_sr -width 7 + label $mytoplevel.srf.l2 -text [_ "Delay (msec):"] + entry $mytoplevel.srf.x2 -textvariable audio_advance -width 4 + + label $mytoplevel.srf.l3 -text [_ "Block size:"] + tk_optionMenu $mytoplevel.srf.x3 audio_blocksize 64 128 256 512 1024 2048 + + pack $mytoplevel.srf.l1 $mytoplevel.srf.x1 $mytoplevel.srf.l2 \ + $mytoplevel.srf.x2 $mytoplevel.srf.l3 $mytoplevel.srf.x3 -side left if {$audio_callback >= 0} { - checkbutton $id.srf.x3 -variable audio_callback \ + checkbutton $mytoplevel.srf.x4 -variable audio_callback \ -text [_ "Use callbacks"] -anchor e - pack $id.srf.x3 -side left + pack $mytoplevel.srf.x4 -side left } # input device 1 - frame $id.in1f - pack $id.in1f -side top + frame $mytoplevel.in1f + pack $mytoplevel.in1f -side top - checkbutton $id.in1f.x0 -variable audio_inenable1 \ + checkbutton $mytoplevel.in1f.x0 -variable audio_inenable1 \ -text [_ "Input device 1:"] -anchor e - button $id.in1f.x1 -text [lindex $audio_indevlist $audio_indev1] \ - -command [list audio_popup $id $id.in1f.x1 audio_indev1 $audio_indevlist] - label $id.in1f.l2 -text [_ "Channels:"] - entry $id.in1f.x2 -textvariable audio_inchan1 -width 3 - pack $id.in1f.x0 $id.in1f.x1 $id.in1f.l2 $id.in1f.x2 -side left -fill x + button $mytoplevel.in1f.x1 -text [lindex $audio_indevlist $audio_indev1] \ + -command [list audio_popup $mytoplevel $mytoplevel.in1f.x1 audio_indev1 $audio_indevlist] + label $mytoplevel.in1f.l2 -text [_ "Channels:"] + entry $mytoplevel.in1f.x2 -textvariable audio_inchan1 -width 3 + pack $mytoplevel.in1f.x0 $mytoplevel.in1f.x1 $mytoplevel.in1f.l2 \ + $mytoplevel.in1f.x2 -side left -fill x # input device 2 if {$longform && $multi > 1 && [llength $audio_indevlist] > 1} { - frame $id.in2f - pack $id.in2f -side top + frame $mytoplevel.in2f + pack $mytoplevel.in2f -side top - checkbutton $id.in2f.x0 -variable audio_inenable2 \ + checkbutton $mytoplevel.in2f.x0 -variable audio_inenable2 \ -text [_ "Input device 2:"] -anchor e - button $id.in2f.x1 -text [lindex $audio_indevlist $audio_indev2] \ - -command [list audio_popup $id $id.in2f.x1 audio_indev2 \ + button $mytoplevel.in2f.x1 -text [lindex $audio_indevlist $audio_indev2] \ + -command [list audio_popup $mytoplevel $mytoplevel.in2f.x1 audio_indev2 \ $audio_indevlist] - label $id.in2f.l2 -text [_ "Channels:"] - entry $id.in2f.x2 -textvariable audio_inchan2 -width 3 - pack $id.in2f.x0 $id.in2f.x1 $id.in2f.l2 $id.in2f.x2 -side left -fill x + label $mytoplevel.in2f.l2 -text [_ "Channels:"] + entry $mytoplevel.in2f.x2 -textvariable audio_inchan2 -width 3 + pack $mytoplevel.in2f.x0 $mytoplevel.in2f.x1 $mytoplevel.in2f.l2 \ + $mytoplevel.in2f.x2 -side left -fill x } # input device 3 if {$longform && $multi > 1 && [llength $audio_indevlist] > 2} { - frame $id.in3f - pack $id.in3f -side top + frame $mytoplevel.in3f + pack $mytoplevel.in3f -side top - checkbutton $id.in3f.x0 -variable audio_inenable3 \ + checkbutton $mytoplevel.in3f.x0 -variable audio_inenable3 \ -text [_ "Input device 3:"] -anchor e - button $id.in3f.x1 -text [lindex $audio_indevlist $audio_indev3] \ - -command [list audio_popup $id $id.in3f.x1 audio_indev3 \ + button $mytoplevel.in3f.x1 -text [lindex $audio_indevlist $audio_indev3] \ + -command [list audio_popup $mytoplevel $mytoplevel.in3f.x1 audio_indev3 \ $audio_indevlist] - label $id.in3f.l2 -text [_ "Channels:"] - entry $id.in3f.x2 -textvariable audio_inchan3 -width 3 - pack $id.in3f.x0 $id.in3f.x1 $id.in3f.l2 $id.in3f.x2 -side left + label $mytoplevel.in3f.l2 -text [_ "Channels:"] + entry $mytoplevel.in3f.x2 -textvariable audio_inchan3 -width 3 + pack $mytoplevel.in3f.x0 $mytoplevel.in3f.x1 $mytoplevel.in3f.l2 $mytoplevel.in3f.x2 -side left } # input device 4 if {$longform && $multi > 1 && [llength $audio_indevlist] > 3} { - frame $id.in4f - pack $id.in4f -side top + frame $mytoplevel.in4f + pack $mytoplevel.in4f -side top - checkbutton $id.in4f.x0 -variable audio_inenable4 \ + checkbutton $mytoplevel.in4f.x0 -variable audio_inenable4 \ -text [_ "Input device 4:"] -anchor e - button $id.in4f.x1 -text [lindex $audio_indevlist $audio_indev4] \ - -command [list audio_popup $id $id.in4f.x1 audio_indev4 \ + button $mytoplevel.in4f.x1 -text [lindex $audio_indevlist $audio_indev4] \ + -command [list audio_popup $mytoplevel $mytoplevel.in4f.x1 audio_indev4 \ $audio_indevlist] - label $id.in4f.l2 -text [_ "Channels:"] - entry $id.in4f.x2 -textvariable audio_inchan4 -width 3 - pack $id.in4f.x0 $id.in4f.x1 $id.in4f.l2 $id.in4f.x2 -side left + label $mytoplevel.in4f.l2 -text [_ "Channels:"] + entry $mytoplevel.in4f.x2 -textvariable audio_inchan4 -width 3 + pack $mytoplevel.in4f.x0 $mytoplevel.in4f.x1 $mytoplevel.in4f.l2 \ + $mytoplevel.in4f.x2 -side left } # output device 1 - frame $id.out1f - pack $id.out1f -side top + frame $mytoplevel.out1f + pack $mytoplevel.out1f -side top - checkbutton $id.out1f.x0 -variable audio_outenable1 \ + checkbutton $mytoplevel.out1f.x0 -variable audio_outenable1 \ -text [_ "Output device 1:"] -anchor e if {$multi == 0} { - label $id.out1f.l1 \ + label $mytoplevel.out1f.l1 \ -text [_ "(same as input device) .............. "] } else { - button $id.out1f.x1 -text [lindex $audio_outdevlist $audio_outdev1] \ - -command [list audio_popup $id $id.out1f.x1 audio_outdev1 \ + button $mytoplevel.out1f.x1 -text [lindex $audio_outdevlist $audio_outdev1] \ + -command [list audio_popup $mytoplevel $mytoplevel.out1f.x1 audio_outdev1 \ $audio_outdevlist] } - label $id.out1f.l2 -text [_ "Channels:"] - entry $id.out1f.x2 -textvariable audio_outchan1 -width 3 + label $mytoplevel.out1f.l2 -text [_ "Channels:"] + entry $mytoplevel.out1f.x2 -textvariable audio_outchan1 -width 3 if {$multi == 0} { - pack $id.out1f.x0 $id.out1f.l1 $id.out1f.x2 -side left -fill x + pack $mytoplevel.out1f.x0 $mytoplevel.out1f.l1 $mytoplevel.out1f.x2 -side left -fill x } else { - pack $id.out1f.x0 $id.out1f.x1 $id.out1f.l2 $id.out1f.x2 -side left -fill x + pack $mytoplevel.out1f.x0 $mytoplevel.out1f.x1 $mytoplevel.out1f.l2\ + $mytoplevel.out1f.x2 -side left -fill x } # output device 2 if {$longform && $multi > 1 && [llength $audio_outdevlist] > 1} { - frame $id.out2f - pack $id.out2f -side top + frame $mytoplevel.out2f + pack $mytoplevel.out2f -side top - checkbutton $id.out2f.x0 -variable audio_outenable2 \ + checkbutton $mytoplevel.out2f.x0 -variable audio_outenable2 \ -text [_ "Output device 2:"] -anchor e - button $id.out2f.x1 -text [lindex $audio_outdevlist $audio_outdev2] \ + button $mytoplevel.out2f.x1 -text [lindex $audio_outdevlist $audio_outdev2] \ -command \ - [list audio_popup $id $id.out2f.x1 audio_outdev2 $audio_outdevlist] - label $id.out2f.l2 -text [_ "Channels:"] - entry $id.out2f.x2 -textvariable audio_outchan2 -width 3 - pack $id.out2f.x0 $id.out2f.x1 $id.out2f.l2 $id.out2f.x2 -side left + [list audio_popup $mytoplevel $mytoplevel.out2f.x1 audio_outdev2 $audio_outdevlist] + label $mytoplevel.out2f.l2 -text [_ "Channels:"] + entry $mytoplevel.out2f.x2 -textvariable audio_outchan2 -width 3 + pack $mytoplevel.out2f.x0 $mytoplevel.out2f.x1 $mytoplevel.out2f.l2\ + $mytoplevel.out2f.x2 -side left } # output device 3 if {$longform && $multi > 1 && [llength $audio_outdevlist] > 2} { - frame $id.out3f - pack $id.out3f -side top + frame $mytoplevel.out3f + pack $mytoplevel.out3f -side top - checkbutton $id.out3f.x0 -variable audio_outenable3 \ + checkbutton $mytoplevel.out3f.x0 -variable audio_outenable3 \ -text [_ "Output device 3:"] -anchor e - button $id.out3f.x1 -text [lindex $audio_outdevlist $audio_outdev3] \ + button $mytoplevel.out3f.x1 -text [lindex $audio_outdevlist $audio_outdev3] \ -command \ - [list audio_popup $id $id.out3f.x1 audio_outdev3 $audio_outdevlist] - label $id.out3f.l2 -text [_ "Channels:"] - entry $id.out3f.x2 -textvariable audio_outchan3 -width 3 - pack $id.out3f.x0 $id.out3f.x1 $id.out3f.l2 $id.out3f.x2 -side left + [list audio_popup $mytoplevel $mytoplevel.out3f.x1 audio_outdev3 $audio_outdevlist] + label $mytoplevel.out3f.l2 -text [_ "Channels:"] + entry $mytoplevel.out3f.x2 -textvariable audio_outchan3 -width 3 + pack $mytoplevel.out3f.x0 $mytoplevel.out3f.x1 $mytoplevel.out3f.l2 \ + $mytoplevel.out3f.x2 -side left } # output device 4 if {$longform && $multi > 1 && [llength $audio_outdevlist] > 3} { - frame $id.out4f - pack $id.out4f -side top + frame $mytoplevel.out4f + pack $mytoplevel.out4f -side top - checkbutton $id.out4f.x0 -variable audio_outenable4 \ + checkbutton $mytoplevel.out4f.x0 -variable audio_outenable4 \ -text [_ "Output device 4:"] -anchor e - button $id.out4f.x1 -text [lindex $audio_outdevlist $audio_outdev4] \ + button $mytoplevel.out4f.x1 -text [lindex $audio_outdevlist $audio_outdev4] \ -command \ - [list audio_popup $id $id.out4f.x1 audio_outdev4 $audio_outdevlist] - label $id.out4f.l2 -text [_ "Channels:"] - entry $id.out4f.x2 -textvariable audio_outchan4 -width 3 - pack $id.out4f.x0 $id.out4f.x1 $id.out4f.l2 $id.out4f.x2 -side left + [list audio_popup $mytoplevel $mytoplevel.out4f.x1 audio_outdev4 $audio_outdevlist] + label $mytoplevel.out4f.l2 -text [_ "Channels:"] + entry $mytoplevel.out4f.x2 -textvariable audio_outchan4 -width 3 + pack $mytoplevel.out4f.x0 $mytoplevel.out4f.x1 $mytoplevel.out4f.l2 \ + $mytoplevel.out4f.x2 -side left } # if not the "long form" but if "multi" is 2, make a button to # restart with longform set. if {$longform == 0 && $multi > 1} { - frame $id.longbutton - pack $id.longbutton -side top - button $id.longbutton.b -text [_ "Use multiple devices"] \ + frame $mytoplevel.longbutton + pack $mytoplevel.longbutton -side top + button $mytoplevel.longbutton.b -text [_ "Use multiple devices"] \ -command {pdsend "pd audio-properties 1"} - pack $id.longbutton.b + pack $mytoplevel.longbutton.b } - $id.srf.x1 select from 0 - $id.srf.x1 select adjust end - focus $id.srf.x1 + $mytoplevel.srf.x1 select from 0 + $mytoplevel.srf.x1 select adjust end + focus $mytoplevel.srf.x1 } diff --git a/pd/tcl/dialog_canvas.tcl b/pd/tcl/dialog_canvas.tcl index 06444807..ea3f5d65 100644 --- a/pd/tcl/dialog_canvas.tcl +++ b/pd/tcl/dialog_canvas.tcl @@ -104,7 +104,6 @@ proc ::dialog_canvas::pdtk_canvas_dialog {mytoplevel xscale yscale graphmeflags } else { create_dialog $mytoplevel } - puts "canvas_dialog $mytoplevel" switch -- $graphmeflags { 0 { $mytoplevel.parent.graphme deselect @@ -119,7 +118,7 @@ proc ::dialog_canvas::pdtk_canvas_dialog {mytoplevel xscale yscale graphmeflags $mytoplevel.parent.graphme select $mytoplevel.parent.hidetext select } default { - pdtk_post "Warning: unknown graphme flags received in pdtk_canvas_dialog" + ::pdwindow::error [_ "WARNING: unknown graphme flags received in pdtk_canvas_dialog"] } } @@ -131,8 +130,8 @@ proc ::dialog_canvas::pdtk_canvas_dialog {mytoplevel xscale yscale graphmeflags $mytoplevel.range.y.to_entry insert 0 $yto $mytoplevel.range.x.size_entry insert 0 $xsize $mytoplevel.range.y.size_entry insert 0 $ysize - $mytoplevel.range.x.margin_entry insert 0 $xsize - $mytoplevel.range.y.margin_entry insert 0 $ysize + $mytoplevel.range.x.margin_entry insert 0 $xmargin + $mytoplevel.range.y.margin_entry insert 0 $ymargin ::dialog_canvas::checkcommand $mytoplevel } @@ -140,7 +139,11 @@ proc ::dialog_canvas::pdtk_canvas_dialog {mytoplevel xscale yscale graphmeflags proc ::dialog_canvas::create_dialog {mytoplevel} { toplevel $mytoplevel -class DialogWindow wm title $mytoplevel [_ "Canvas Properties"] - if {$::windowingsystem eq "aqua"} {$mytoplevel configure -menu .menubar} + wm group $mytoplevel . + wm resizable $mytoplevel 0 0 + wm transient $mytoplevel $::focused_window + $mytoplevel configure -menu $::dialog_menubar + $mytoplevel configure -padx 0 -pady 0 ::pd_bindings::dialog_bindings $mytoplevel "canvas" labelframe $mytoplevel.scale -text [_ "Scale"] -borderwidth 1 @@ -201,13 +204,16 @@ proc ::dialog_canvas::create_dialog {mytoplevel} { -side left frame $mytoplevel.buttons - pack $mytoplevel.buttons -side bottom -fill x -pady 2m + pack $mytoplevel.buttons -side bottom -fill x -expand 1 -pady 2m button $mytoplevel.buttons.cancel -text [_ "Cancel"] \ -command "::dialog_canvas::cancel $mytoplevel" - button $mytoplevel.buttons.apply -text [_ "Apply"] \ - -command "::dialog_canvas::apply $mytoplevel" + pack $mytoplevel.buttons.cancel -side left -expand 1 -fill x -padx 10 + if {$::windowingsystem ne "aqua"} { + button $mytoplevel.buttons.apply -text [_ "Apply"] \ + -command "::dialog_canvas::apply $mytoplevel" + pack $mytoplevel.buttons.apply -side left -expand 1 -fill x -padx 10 + } button $mytoplevel.buttons.ok -text [_ "OK"] \ -command "::dialog_canvas::ok $mytoplevel" - pack $mytoplevel.buttons.cancel $mytoplevel.buttons.apply \ - $mytoplevel.buttons.ok -side left -expand 1 + pack $mytoplevel.buttons.ok -side left -expand 1 -fill x -padx 10 } diff --git a/pd/tcl/dialog_data.tcl b/pd/tcl/dialog_data.tcl new file mode 100644 index 00000000..0bc989f5 --- /dev/null +++ b/pd/tcl/dialog_data.tcl @@ -0,0 +1,53 @@ + +package provide dialog_data 0.1 + +namespace eval ::dialog_data:: { + namespace export pdtk_data_dialog +} + +############ pdtk_data_dialog -- run a data dialog ######### + +proc ::dialog_data::send {mytoplevel} { + for {set i 1} {[$mytoplevel.text compare [concat $i.0 + 3 chars] < end]} \ + {incr i 1} { + pdsend "$mytoplevel data [$mytoplevel.text get $i.0 [expr $i + 1].0]" + } + pdsend "$mytoplevel end" +} + +proc ::dialog_data::cancel {mytoplevel} { + pdsend "$mytoplevel cancel" +} + +proc ::dialog_data::ok {mytoplevel} { + ::dialog_data::send $mytoplevel + ::dialog_data::cancel $mytoplevel +} + +proc ::dialog_data::pdtk_data_dialog {mytoplevel stuff} { + toplevel $mytoplevel -class DialogWindow + wm title $mytoplevel [_ "Data Properties"] + wm group $mytoplevel $::focused_window + wm transient $mytoplevel $::focused_window + $mytoplevel configure -menu $::dialog_menubar + $mytoplevel configure -padx 0 -pady 0 + + frame $mytoplevel.buttonframe + pack $mytoplevel.buttonframe -side bottom -fill x -pady 2m + button $mytoplevel.buttonframe.send -text [_ "Send (Ctrl s)"] \ + -command "::dialog_data::send $mytoplevel" + button $mytoplevel.buttonframe.ok -text [_ "OK (Ctrl t)"] \ + -command "::dialog_data::ok $mytoplevel" + pack $mytoplevel.buttonframe.send -side left -expand 1 + pack $mytoplevel.buttonframe.ok -side left -expand 1 + + text $mytoplevel.text -relief raised -bd 2 -height 40 -width 60 \ + -yscrollcommand "$mytoplevel.scroll set" + scrollbar $mytoplevel.scroll -command "$mytoplevel.text yview" + pack $mytoplevel.scroll -side right -fill y + pack $mytoplevel.text -side left -fill both -expand 1 + $mytoplevel.text insert end $stuff + focus $mytoplevel.text + bind $mytoplevel.text "::dialog_data::ok $mytoplevel" + bind $mytoplevel.text "::dialog_data::send $mytoplevel" +} diff --git a/pd/tcl/dialog_find.tcl b/pd/tcl/dialog_find.tcl index c7a708ae..443bec3a 100644 --- a/pd/tcl/dialog_find.tcl +++ b/pd/tcl/dialog_find.tcl @@ -1,117 +1,182 @@ +# the find dialog panel is a bit unusual in that it is created directly by the +# Tcl 'pd-gui'. Most dialog panels are created by sending a message to 'pd', +# which then sends a message to 'pd-gui' to create the panel. package provide dialog_find 0.1 package require pd_bindings namespace eval ::dialog_find:: { + variable find_in_toplevel ".pdwindow" # store the state of the "Match whole word only" check box variable wholeword_button 0 # if the search hasn't changed, then the Find button sends "findagain" variable previous_wholeword_button 0 variable previous_findstring "" + variable find_history {} + variable history_position 0 - namespace export menu_dialog_find + namespace export pdtk_couldnotfind } -# TODO make find panel as small as possible, being topmost means its findable -# TODO (GNOME/Windows) find panel should retain focus after a find -# TODO (Mac OS X) hide panel after success, but stay if the find was unsuccessful +proc ::dialog_find::get_history {direction} { + variable find_history + variable history_position + + incr history_position $direction + if {$history_position < 0} {set history_position 0} + if {$history_position > [llength $find_history]} { + set history_position [llength $find_history] + } + .find.entry delete 0 end + .find.entry insert 0 [lindex $find_history end-[expr $history_position - 1]] +} +# mytoplevel isn't used here, but is kept for compatibility with other dialog ok procs proc ::dialog_find::ok {mytoplevel} { + variable find_in_window variable wholeword_button variable previous_wholeword_button variable previous_findstring - # find will be on top, so use the previous window that was on top - set search_window [lindex [wm stackorder .] end-1] - puts "search_window $search_window" + variable find_history + set findstring [.find.entry get] - if {$findstring eq ""} {return} - if {$search_window eq ".pdwindow"} { - set matches [.pdwindow.text search -all -nocase -- $findstring 0.0] + if {$findstring eq ""} { + if {$::windowingsystem eq "aqua"} {bell} + return + } + if {$find_in_window eq ".pdwindow"} { + if {$::tcl_version < 8.5} { + # TODO implement in 8.4 style, without -all + set matches [.pdwindow.text search -nocase -- $findstring 0.0] + } else { + set matches [.pdwindow.text search -all -nocase -- $findstring 0.0] + } .pdwindow.text tag delete sel - foreach match $matches { - .pdwindow.text tag add sel $match "$match wordend" + if {[llength $matches] > 0} { + foreach match $matches { + .pdwindow.text tag add sel $match "$match wordend" + } + .pdwindow.text see [lindex $matches 0] + lappend find_history $findstring } - .pdwindow.text see [lindex $matches 0] } else { if {$findstring eq $previous_findstring \ && $wholeword_button == $previous_wholeword_button} { - pdsend "$search_window findagain" + pdsend "$find_in_window findagain" } else { - # TODO switch back to this for 0.43: - #pdsend "$search_window find $findstring $wholeword_button" - pdsend "$search_window find $findstring" + pdsend [concat $find_in_window find [pdtk_encodedialog $findstring] \ + $wholeword_button] set previous_findstring $findstring set previous_wholeword_button $wholeword_button + lappend find_history $findstring } } + if {$::windowingsystem eq "aqua"} { + # (Mac OS X) hide panel after success, but keep it if unsuccessful by + # having the couldnotfind proc reopen it + cancel $mytoplevel + } else { + # (GNOME/Windows) find panel should retain focus after a find + # (yes, a bit of a kludge) + after 100 "raise .find; focus .find.entry" + } } +# mytoplevel isn't used here, but is kept for compatibility with other dialog cancel procs proc ::dialog_find::cancel {mytoplevel} { wm withdraw .find } -proc ::dialog_find::set_canvas_to_search {mytoplevel} { - # TODO rewrite using global $::focused_window +proc ::dialog_find::set_window_to_search {mytoplevel} { + variable find_in_window $mytoplevel if {[winfo exists .find.frame.targetlabel]} { - set focusedtoplevel [winfo toplevel [lindex [wm stackorder .] end]] - if {$focusedtoplevel eq ".find"} { - set focusedtoplevel [winfo toplevel [lindex [wm stackorder .] end-1]] + if {$find_in_window eq ".find"} { + set find_in_window [winfo toplevel [lindex [wm stackorder .] end-1]] } - if {$focusedtoplevel eq ".pdwindow"} { - .find.frame.targetlabel configure -text [wm title .pdwindow] - } else { - foreach window $::menu_windowlist { - if {[lindex $window 1] eq $focusedtoplevel} { - .find.frame.targetlabel configure -text [lindex $window 0] - } - } + # this has funny side effects in tcl 8.4 ??? + if {$::tcl_version >= 8.5} { + wm transient .find $find_in_window } + .find.frame.targetlabel configure -text \ + [lookup_windowname $find_in_window] } } +proc ::dialog_find::pdtk_couldnotfind {mytoplevel} { + bell + ::pdwindow::error [format [_ "Couldn't find '%s' in %s"] \ + [.find.entry get] [lookup_windowname $mytoplevel] ] + if {$::windowingsystem eq "aqua"} {open_find_dialog $mytoplevel} +} + # the find panel is opened from the menu and key bindings -proc ::dialog_find::menu_find_dialog {mytoplevel} { +proc ::dialog_find::open_find_dialog {mytoplevel} { if {[winfo exists .find]} { wm deiconify .find raise .find } else { create_dialog $mytoplevel } + .find.entry selection range 0 end } proc ::dialog_find::create_dialog {mytoplevel} { toplevel .find -class DialogWindow wm title .find [_ "Find"] wm geometry .find =475x125+150+150 - .find configure - if {$::windowingsystem eq "aqua"} {$mytoplevel configure -menu .menubar} + wm group .find . + wm resizable .find 0 0 + wm transient .find + .find configure -menu $::dialog_menubar + .find configure -padx 10 -pady 5 ::pd_bindings::dialog_bindings .find "find" + # sending these commands to the Find Dialog Panel should forward them to + # the currently focused patch + bind .find <$::modifier-Key-s> \ + {menu_send $::focused_window menusave; break} + bind .find <$::modifier-Shift-Key-S> \ + {menu_send $::focused_window menusaveas; break} + bind .find <$::modifier-Key-p> \ + {menu_print $::focused_window; break} frame .find.frame pack .find.frame -side top -fill x -pady 1 label .find.frame.searchin -text [_ "Search in"] - label .find.frame.targetlabel -font "TkTextFont 14" + label .find.frame.targetlabel -text [_ "Pd window"] label .find.frame.for -text [_ "for:"] pack .find.frame.searchin .find.frame.targetlabel .find.frame.for -side left entry .find.entry -width 54 -font 18 -relief sunken \ - -highlightthickness 3 -highlightcolor blue - focus .find.entry + -highlightthickness 1 -highlightcolor blue pack .find.entry -side top -padx 10 + + bind .find.entry "::dialog_find::get_history 1" + bind .find.entry "::dialog_find::get_history -1" checkbutton .find.wholeword -variable ::dialog_find::wholeword_button \ -text [_ "Match whole word only"] -anchor w pack .find.wholeword -side top -padx 30 -pady 3 -fill x frame .find.buttonframe -background yellow + pack .find.buttonframe -side right -pady 3 + if {$::windowingsystem eq "win32"} { + button .find.cancel -text [_ "Cancel"] -default normal -width 9 \ + -command "::dialog_find::cancel $mytoplevel" + pack .find.cancel -side right -padx 6 -pady 3 + } button .find.button -text [_ "Find"] -default active -width 9 \ -command "::dialog_find::ok $mytoplevel" + pack .find.button -side right -padx 6 -pady 3 if {$::windowingsystem eq "x11"} { button .find.close -text [_ "Close"] -default normal -width 9 \ -command "::dialog_find::cancel $mytoplevel" - pack .find.buttonframe .find.button .find.close -side right -padx 10 -pady 3 - } else { - pack .find.buttonframe .find.button -side right -padx 10 -pady 3 + pack .find.close -side right -padx 6 -pady 3 } - ::dialog_find::set_canvas_to_search $mytoplevel + # on Mac OS X, the buttons shouldn't get Tab/keyboard focus + if {$::windowingsystem eq "aqua"} { + .find.wholeword configure -takefocus 0 + .find.button configure -takefocus 0 + } + ::dialog_find::set_window_to_search $mytoplevel + focus .find.entry } diff --git a/pd/tcl/dialog_font.tcl b/pd/tcl/dialog_font.tcl index 578d155e..fce16000 100644 --- a/pd/tcl/dialog_font.tcl +++ b/pd/tcl/dialog_font.tcl @@ -7,17 +7,17 @@ namespace eval ::dialog_font:: { variable whichstretch 1 variable canvaswindow variable sizes {8 10 12 16 24 36} - variable gfxstub namespace export pdtk_canvas_dofont } # TODO this should use the pd_font_$size fonts created in pd-gui.tcl +# TODO change pdtk_canvas_dofont to pdtk_font_dialog here and g_editor.c # TODO this should really be changed on the C side so that it doesn't have to # work around gfxstub/x_gui.c. The gfxstub stuff assumes that there are # multiple panels, for properties panels like this, its much easier to use if -# there is a single properties panel that adjusts based on which CanvasWindow +# there is a single properties panel that adjusts based on which PatchWindow # has focus proc ::dialog_font::apply {mytoplevel myfontsize} { @@ -30,44 +30,41 @@ proc ::dialog_font::apply {mytoplevel myfontsize} { } } -proc ::dialog_font::cancel {mygfxstub} { - if {$mygfxstub ne ".pdwindow"} { - pdsend "$mygfxstub cancel" +proc ::dialog_font::cancel {gfxstub} { + if {$gfxstub ne ".pdwindow"} { + pdsend "$gfxstub cancel" } destroy .font } -proc ::dialog_font::ok {mygfxstub} { +proc ::dialog_font::ok {gfxstub} { variable fontsize - ::dialog_font::apply $mygfxstub $fontsize - ::dialog_font::cancel $mygfxstub + apply $gfxstub $fontsize + cancel $gfxstub } proc ::dialog_font::update_font_dialog {mytoplevel} { - set ::dialog_font::canvaswindow $mytoplevel - if {$mytoplevel eq ".pdwindow"} { - set windowname [_ "Pd window"] - } else { - set windowname [lookup_windowname $mytoplevel] - } + variable canvaswindow $mytoplevel if {[winfo exists .font]} { - wm title .font [format [_ "%s Font"] $windowname] + wm title .font [format [_ "%s Font"] [lookup_windowname $mytoplevel]] } } proc ::dialog_font::arrow_fontchange {change} { variable sizes - set position [expr [lsearch $sizes $::dialog_font::fontsize] + $change] + variable fontsize + variable canvaswindow + set position [expr [lsearch $sizes $fontsize] + $change] if {$position < 0} {set position 0} set max [llength $sizes] if {$position >= $max} {set position [expr $max-1]} - set ::dialog_font::fontsize [lindex $sizes $position] - ::dialog_font::apply $::dialog_font::canvaswindow $::dialog_font::fontsize + set fontsize [lindex $sizes $position] + ::dialog_font::apply $canvaswindow $fontsize } # this should be called pdtk_font_dialog like the rest of the panels, but it # is called from the C side, so we'll leave it be -proc ::dialog_font::pdtk_canvas_dofont {mygfxstub initsize} { +proc ::dialog_font::pdtk_canvas_dofont {gfxstub initsize} { variable fontsize $initsize variable whichstretch 1 variable stretchval 100 @@ -77,28 +74,34 @@ proc ::dialog_font::pdtk_canvas_dofont {mygfxstub initsize} { # the gfxstub stuff expects multiple font windows, we only have one, # so kill the new gfxstub requests as the come in. We'll save the # original gfxstub for when the font panel gets closed - pdsend "$mygfxstub cancel" + pdsend "$gfxstub cancel" } else { - create_dialog $mygfxstub + create_dialog $gfxstub } } -proc ::dialog_font::create_dialog {mygfxstub} { - variable gfxstub $mygfxstub +proc ::dialog_font::create_dialog {gfxstub} { toplevel .font -class DialogWindow - if {$::windowingsystem eq "aqua"} {.font configure -menu .menubar} + .font configure -menu $::dialog_menubar + .font configure -padx 10 -pady 5 + wm group .font . + wm resizable .font 0 0 + wm transient .font $::focused_window ::pd_bindings::dialog_bindings .font "font" - # replace standard bindings to work around the gfxstub stuff - bind .font "::dialog_font::cancel $mygfxstub" - bind .font "::dialog_font::ok $mygfxstub" - bind .font <$::pd_bindings::modifier-Key-w> "::dialog_font::cancel $mygfxstub" + # replace standard bindings to work around the gfxstub stuff and use + # break to prevent the close window command from going to other bindings. + # .font won't exist anymore, so it'll cause errors down the line... + bind .font "::dialog_font::ok $gfxstub; break" + bind .font "::dialog_font::cancel $gfxstub; break" + bind .font <$::modifier-Key-w> "::dialog_font::cancel $gfxstub; break" + wm protocol .font WM_DELETE_WINDOW "dialog_font::cancel $gfxstub" bind .font "::dialog_font::arrow_fontchange -1" bind .font "::dialog_font::arrow_fontchange 1" frame .font.buttonframe pack .font.buttonframe -side bottom -fill x -pady 2m button .font.buttonframe.ok -text [_ "OK"] \ - -command "::dialog_font::ok $mygfxstub" + -command "::dialog_font::ok $gfxstub" pack .font.buttonframe.ok -side left -expand 1 labelframe .font.fontsize -text [_ "Font Size"] -padx 5 -pady 4 -borderwidth 1 \ diff --git a/pd/tcl/dialog_gatom.tcl b/pd/tcl/dialog_gatom.tcl index b59751bf..200a631e 100644 --- a/pd/tcl/dialog_gatom.tcl +++ b/pd/tcl/dialog_gatom.tcl @@ -44,8 +44,8 @@ proc ::dialog_gatom::apply {mytoplevel} { [$mytoplevel.limits.upper.entry get] \ [::dialog_gatom::escape [$mytoplevel.gatomlabel.name.entry get]] \ $gatomlabel_radio($mytoplevel) \ - [::dialog_gatom::escape [$mytoplevel.s_r.send.entry get]] \ - [::dialog_gatom::escape [$mytoplevel.s_r.receive.entry get]]" + [::dialog_gatom::escape [$mytoplevel.s_r.receive.entry get]] \ + [::dialog_gatom::escape [$mytoplevel.s_r.send.entry get]]" } proc ::dialog_gatom::cancel {mytoplevel} { @@ -60,7 +60,7 @@ proc ::dialog_gatom::ok {mytoplevel} { # set up the panel with the info from pd proc ::dialog_gatom::pdtk_gatom_dialog {mytoplevel initwidth initlower initupper \ initgatomlabel_radio \ - initgatomlabel initsend initreceive} { + initgatomlabel initreceive initsend} { global gatomlabel_radio set gatomlabel_radio($mytoplevel) $initgatomlabel_radio @@ -91,7 +91,11 @@ proc ::dialog_gatom::create_dialog {mytoplevel} { toplevel $mytoplevel -class DialogWindow wm title $mytoplevel [_ "Atom Box Properties"] - if {$::windowingsystem eq "aqua"} {$mytoplevel configure -menu .menubar} + wm group $mytoplevel . + wm resizable $mytoplevel 0 0 + wm transient $mytoplevel $::focused_window + $mytoplevel configure -menu $::dialog_menubar + $mytoplevel configure -padx 0 -pady 0 ::pd_bindings::dialog_bindings $mytoplevel "gatom" frame $mytoplevel.width -height 7 @@ -149,16 +153,18 @@ proc ::dialog_gatom::create_dialog {mytoplevel} { pack $mytoplevel.s_r.receive.entry $mytoplevel.s_r.receive.label -side right frame $mytoplevel.buttonframe -pady 5 - pack $mytoplevel.buttonframe -side top -fill x -pady 2m + pack $mytoplevel.buttonframe -side top -fill x -expand 1 -pady 2m button $mytoplevel.buttonframe.cancel -text [_ "Cancel"] \ -command "::dialog_gatom::cancel $mytoplevel" - pack $mytoplevel.buttonframe.cancel -side left -expand 1 - button $mytoplevel.buttonframe.apply -text [_ "Apply"] \ - -command "::dialog_gatom::apply $mytoplevel" - pack $mytoplevel.buttonframe.apply -side left -expand 1 + pack $mytoplevel.buttonframe.cancel -side left -expand 1 -fill x -padx 10 + if {$::windowingsystem ne "aqua"} { + button $mytoplevel.buttonframe.apply -text [_ "Apply"] \ + -command "::dialog_gatom::apply $mytoplevel" + pack $mytoplevel.buttonframe.apply -side left -expand 1 -fill x -padx 10 + } button $mytoplevel.buttonframe.ok -text [_ "OK"] \ -command "::dialog_gatom::ok $mytoplevel" - pack $mytoplevel.buttonframe.ok -side left -expand 1 + pack $mytoplevel.buttonframe.ok -side left -expand 1 -fill x -padx 10 $mytoplevel.width.entry select from 0 $mytoplevel.width.entry select adjust end diff --git a/pd/tcl/dialog_iemgui.tcl b/pd/tcl/dialog_iemgui.tcl index 34ed4ccb..ed3a60bf 100644 --- a/pd/tcl/dialog_iemgui.tcl +++ b/pd/tcl/dialog_iemgui.tcl @@ -252,7 +252,7 @@ proc ::dialog_iemgui::toggle_font {mytoplevel gn_f} { 1 { set current_font "Helvetica" } 2 { set current_font "Times" } } - set current_font_spec "{$current_font} 12 $::font_weight" + set current_font_spec "{$current_font} 16 $::font_weight" $mytoplevel.label.fontpopup_label configure -text $current_font \ -font $current_font_spec @@ -362,7 +362,11 @@ proc ::dialog_iemgui::apply {mytoplevel} { set hhhsnd [unspace_text $hhhsnd] set hhhrcv [unspace_text $hhhrcv] set hhhgui_nam [unspace_text $hhhgui_nam] - + +# make sure the offset boxes have a value + if {[eval concat $$var_iemgui_gn_dx] eq ""} {set $var_iemgui_gn_dx 0} + if {[eval concat $$var_iemgui_gn_dy] eq ""} {set $var_iemgui_gn_dy 0} + pdsend [concat $mytoplevel dialog \ [eval concat $$var_iemgui_wdt] \ [eval concat $$var_iemgui_hgt] \ @@ -496,12 +500,16 @@ proc ::dialog_iemgui::pdtk_iemgui_dialog {mytoplevel mainheader dim_header \ toplevel $mytoplevel -class DialogWindow wm title $mytoplevel [format [_ "%s Properties"] $mainheader] - if {$::windowingsystem eq "aqua"} {$mytoplevel configure -menu .menubar} + wm group $mytoplevel . + wm resizable $mytoplevel 0 0 + wm transient $mytoplevel $::focused_window + $mytoplevel configure -menu $::dialog_menubar + $mytoplevel configure -padx 0 -pady 0 ::pd_bindings::dialog_bindings $mytoplevel "iemgui" frame $mytoplevel.dim pack $mytoplevel.dim -side top - label $mytoplevel.dim.head -text $dim_header + label $mytoplevel.dim.head -text [_ $dim_header] label $mytoplevel.dim.w_lab -text [_ $wdt_label] -width 6 entry $mytoplevel.dim.w_ent -textvariable $var_iemgui_wdt -width 5 label $mytoplevel.dim.dummy1 -text " " -width 10 @@ -514,7 +522,7 @@ proc ::dialog_iemgui::pdtk_iemgui_dialog {mytoplevel mainheader dim_header \ frame $mytoplevel.rng pack $mytoplevel.rng -side top - label $mytoplevel.rng.head -text $rng_header + label $mytoplevel.rng.head -text [_ $rng_header] label $mytoplevel.rng.min_lab -text [_ $min_rng_label] -width 6 entry $mytoplevel.rng.min_ent -textvariable $var_iemgui_min_rng -width 9 label $mytoplevel.rng.dummy1 -text " " -width 1 @@ -544,21 +552,19 @@ proc ::dialog_iemgui::pdtk_iemgui_dialog {mytoplevel mainheader dim_header \ -command "::dialog_iemgui::lilo $mytoplevel" } if {[eval concat $$var_iemgui_loadbang] == 0} { button $mytoplevel.para.lb -text [_ "No init"] \ - -width [::msgcat::mcmax "No init"] \ -command "::dialog_iemgui::lb $mytoplevel" } if {[eval concat $$var_iemgui_loadbang] == 1} { button $mytoplevel.para.lb -text [_ "Save"] \ - -width [::msgcat::mcmax "Save"] \ -command "::dialog_iemgui::lb $mytoplevel" } label $mytoplevel.para.num_lab -text [_ $num_label] -width 9 entry $mytoplevel.para.num_ent -textvariable $var_iemgui_num -width 4 if {[eval concat $$var_iemgui_steady] == 0} { button $mytoplevel.para.stdy_jmp -command "::dialog_iemgui::stdy_jmp $mytoplevel" \ - -text [_ "Jump on click"] -width [::msgcat::mcmax "Jump on click"] } + -text [_ "Jump on click"] } if {[eval concat $$var_iemgui_steady] == 1} { button $mytoplevel.para.stdy_jmp -command "::dialog_iemgui::stdy_jmp $mytoplevel" \ - -text [_ "Steady on click"] -width [::msgcat::mcmax "Steady on click"] } + -text [_ "Steady on click"] } if {[eval concat $$var_iemgui_lin0_log1] >= 0} { pack $mytoplevel.para.lilo -side left -expand 1} if {[eval concat $$var_iemgui_loadbang] >= 0} { @@ -574,18 +580,22 @@ proc ::dialog_iemgui::pdtk_iemgui_dialog {mytoplevel mainheader dim_header \ labelframe $mytoplevel.s_r -borderwidth 1 -pady 4 -text [_ "Messages"] pack $mytoplevel.s_r -side top -fill x -ipadx 5 frame $mytoplevel.s_r.send - pack $mytoplevel.s_r.send -side top - label $mytoplevel.s_r.send.lab -text [_ "Send symbol:"] -width 12 -justify right + pack $mytoplevel.s_r.send -side top -padx 4 -fill x -expand 1 + label $mytoplevel.s_r.send.lab -text [_ "Send symbol:"] -justify left entry $mytoplevel.s_r.send.ent -textvariable $var_iemgui_snd -width 22 if { $snd ne "nosndno" } { - pack $mytoplevel.s_r.send.lab $mytoplevel.s_r.send.ent -side left} + pack $mytoplevel.s_r.send.lab $mytoplevel.s_r.send.ent -side left \ + -fill x -expand 1 + } frame $mytoplevel.s_r.receive - pack $mytoplevel.s_r.receive -side top - label $mytoplevel.s_r.receive.lab -text [_ "Receive symbol:"] -width 12 -justify right + pack $mytoplevel.s_r.receive -side top -padx 4 -fill x -expand 1 + label $mytoplevel.s_r.receive.lab -text [_ "Receive symbol:"] -justify left entry $mytoplevel.s_r.receive.ent -textvariable $var_iemgui_rcv -width 22 if { $rcv ne "norcvno" } { - pack $mytoplevel.s_r.receive.lab $mytoplevel.s_r.receive.ent -side left} + pack $mytoplevel.s_r.receive.lab $mytoplevel.s_r.receive.ent -side left \ + -fill x -expand 1 + } # get the current font name from the int given from C-space (gn_f) set current_font $::font_family @@ -599,42 +609,40 @@ proc ::dialog_iemgui::pdtk_iemgui_dialog {mytoplevel mainheader dim_header \ labelframe $mytoplevel.label -borderwidth 1 -text [_ "Label"] -pady 4 pack $mytoplevel.label -side top -fill x - entry $mytoplevel.label.name_entry -textvariable $var_iemgui_gui_nam -width 30 \ - -font [list $current_font 12 $::font_weight] + entry $mytoplevel.label.name_entry -textvariable $var_iemgui_gui_nam \ + -width 30 -font [list $current_font 12 $::font_weight] pack $mytoplevel.label.name_entry -side top -expand yes -fill both -padx 5 frame $mytoplevel.label.xy -padx 27 -pady 1 pack $mytoplevel.label.xy -side top - label $mytoplevel.label.xy.x_lab -text [_ "X offset"] \ - -width [::msgcat::mcmax "X offset"] + label $mytoplevel.label.xy.x_lab -text [_ "X offset"] entry $mytoplevel.label.xy.x_entry -textvariable $var_iemgui_gn_dx -width 5 label $mytoplevel.label.xy.dummy1 -text " " -width 2 - label $mytoplevel.label.xy.y_lab -text [_ "Y offset"] \ - -width [::msgcat::mcmax "Y offset"] + label $mytoplevel.label.xy.y_lab -text [_ "Y offset"] entry $mytoplevel.label.xy.y_entry -textvariable $var_iemgui_gn_dy -width 5 pack $mytoplevel.label.xy.x_lab $mytoplevel.label.xy.x_entry $mytoplevel.label.xy.dummy1 \ $mytoplevel.label.xy.y_lab $mytoplevel.label.xy.y_entry -side left -anchor e - label $mytoplevel.label.fontpopup_label -text $current_font \ - -relief groove -font [list $current_font 12 $::font_weight] -padx 5 - pack $mytoplevel.label.fontpopup_label -side left -anchor w -expand yes -fill x - label $mytoplevel.label.fontsize_label -text [_ "Size:"] \ - -width [::msgcat::mcmax "Size:"] + button $mytoplevel.label.fontpopup_label -text $current_font \ + -font [list $current_font 16 $::font_weight] + pack $mytoplevel.label.fontpopup_label -side left -anchor w \ + -expand 1 -fill x -padx 5 + label $mytoplevel.label.fontsize_label -text [_ "Size:"] entry $mytoplevel.label.fontsize_entry -textvariable $var_iemgui_gn_fs -width 5 pack $mytoplevel.label.fontsize_entry $mytoplevel.label.fontsize_label \ -side right -anchor e -padx 5 -pady 5 menu $mytoplevel.popup $mytoplevel.popup add command \ -label $::font_family \ - -font [format {{%s} 12 %s} $::font_family $::font_weight] \ + -font [format {{%s} 16 %s} $::font_family $::font_weight] \ -command "::dialog_iemgui::toggle_font $mytoplevel 0" $mytoplevel.popup add command \ -label "Helvetica" \ - -font [format {Helvetica 12 %s} $::font_weight] \ + -font [format {Helvetica 16 %s} $::font_weight] \ -command "::dialog_iemgui::toggle_font $mytoplevel 1" $mytoplevel.popup add command \ -label "Times" \ - -font [format {Times 12 %s} $::font_weight] \ + -font [format {Times 16 %s} $::font_weight] \ -command "::dialog_iemgui::toggle_font $mytoplevel 2" bind $mytoplevel.label.fontpopup_label