Revision: 9724 http://pure-data.svn.sourceforge.net/pure-data/?rev=9724&view=rev Author: eighthave Date: 2008-04-25 12:41:16 -0700 (Fri, 25 Apr 2008)
Log Message: ----------- - implemented hack to make Cmd-M minimize on Mac OS X
- removed Edit->"Raise Pd Window" and merged that into Window->"Pd Window"
- tried to add missing standard elements to the Pd window's "Window" menu, but they didn't show up. I am guessing that Tk treats the Window menu as something special, and it autmoatically handles the list of windows, but somehow that is turned off...
Modified Paths: -------------- branches/pd-extended/v0-40/pd/src/u_main.tk
Modified: branches/pd-extended/v0-40/pd/src/u_main.tk =================================================================== --- branches/pd-extended/v0-40/pd/src/u_main.tk 2008-04-25 11:25:23 UTC (rev 9723) +++ branches/pd-extended/v0-40/pd/src/u_main.tk 2008-04-25 19:41:16 UTC (rev 9724) @@ -448,7 +448,7 @@ pack .sendpanel.entry -side bottom -fill both -ipadx 100 .sendpanel.entry select from 0 .sendpanel.entry select adjust end - if{$pd_nt == 2} { + if {$pd_nt == 2} { bind .sendpanel <Mod1-Key-w> {destroy .sendpanel} } else { bind .sendpanel <Control-Key-w> {destroy .sendpanel} @@ -460,11 +460,23 @@ focus .sendpanel.entry }
+ +################## menu commands for Mac OS X ######################### + +proc menu_minimize {window} { + if {$window eq ""} { #Pd Window + wm iconify [winfo toplevel .printout] + } else { + wm iconify [winfo toplevel $window] + } +} + ################## menu commands for console #########################
proc menu_raise_console {} { - set pd_window [winfo toplevel .printout] + set pd_window . set top_window [lindex [wm stackorder $pd_window] end] + puts stderr "if $pd_window eq $top_window" if {$pd_window eq $top_window} { lower $pd_window } else { @@ -481,9 +493,6 @@
proc menu_quit {} {pd {pd verifyquit;}}
-######### the "Pd" menu command, which puts the Pd window on top ######## -proc menu_pop_pd {} {raise .} - ######### the "audio" menu command ############### proc menu_audio {flag} {pd [concat pd dsp $flag ;]}
@@ -543,10 +552,10 @@ set top_window [lindex [wm stackorder .] end] set window_title [wm title $top_window] set helpfile [regsub {(.*)-help.*} $window_title {\1}] - if {[string compare $helpfile $window_title]} { + if {$helpfile eq $window_title} { + menu_openhtml "http://wiki.puredata.info/" + } else { menu_openhtml "http://wiki.puredata.info/en/$helpfile" - } else { - menu_openhtml "http://wiki.puredata.info/" } }
@@ -734,15 +743,18 @@ .mbar.file add command -label Open -command {menu_open} \ -accelerator [accel_munge "Ctrl+o"] .mbar.file add separator -.mbar.file add command -label Message -command {menu_send} \ - -accelerator [accel_munge "Ctrl+m"] -# On MacOS X, these are in the standard HIG locations -# i.e. the Preferences menu under "Pd" if {$pd_nt != 2} { + .mbar.file add command -label Message -command {menu_send} \ + -accelerator [accel_munge "Ctrl+m"] + # On MacOS X, follow the standard Human Interface Guidelines + # i.e. the Preferences menu under "Pd" .mbar.file add command -label Path... \ -command {pd pd start-path-dialog ;} .mbar.file add command -label Startup... \ -command {pd pd start-startup-dialog ;} +} else { # Mac OS X + # Cmd-m is minimize window on Mac OS X, so remove binding + .mbar.file add command -label Message -command {menu_send} } .mbar.file add separator .mbar.file add command -label Close -accelerator [accel_munge "Ctrl+w"] \ @@ -787,10 +799,8 @@ } .mbar.edit add command -label Font -state disabled .mbar.edit add command -label {Tidy Up} -state disabled -.mbar.edit add command -label "Raise Pd window" -accelerator [accel_munge "Ctrl+r"]\ - -command menu_raise_console -.mbar.edit add command -label "Toggle console" -accelerator [accel_munge "Shift+Ctrl+r"]\ - -command menu_toggle_console +.mbar.edit add command -label "Toggle console" \ + -accelerator [accel_munge "Shift+Ctrl+r"] -command menu_toggle_console .mbar.edit add command -label "Clear console" \ -accelerator [accel_munge "Shift+Ctrl+l"] -command menu_clear_console .mbar.edit add separator @@ -813,6 +823,16 @@ -state disabled .mbar.find add command -label {Find last error} -command {menu_finderror}
+#################### the "Window" menu for the Pd window ############## + +# this does not show up on the Window menu, probably because it is a special +# menu that is supposed to be automatically managed by Tcl/Tk +#.mbar.find add command -label {parent window} -state disabled +#.mbar.windows add command -label {Pd window} -command menu_raise_console \ +# -accelerator [accel_munge "Ctrl+r"] +#.mbar.windows add separator + + ########### functions for menu functions on document windows ########
proc menu_save {name} { @@ -1151,18 +1171,20 @@ -accelerator [accel_munge "Ctrl+o"]
$name.m.file add separator - $name.m.file add command -label Message -command {menu_send} \ - -accelerator [accel_munge "Ctrl+m"]
# arrange menus according to Apple HIG - # these are now part of Preferences... if {$pd_nt != 2 } { + $name.m.file add command -label Message -command {menu_send} \ + -accelerator [accel_munge "Ctrl+m"] + # these are now part of Preferences... on Mac OS X $name.m.file add command -label Path... \ -command {pd pd start-path-dialog ;} - $name.m.file add command -label Startup... \ -command {pd pd start-startup-dialog ;} - } + } else { + # Cmd-m is minimize window on Mac OS X + $name.m.file add command -label Message -command {menu_send} + }
$name.m.file add separator $name.m.file add command -label Close \ @@ -1230,10 +1252,6 @@ $name.m.edit add command -label {Tidy Up} \ -command [concat menu_tidyup $name]
- $name.m.edit add command -label "Raise Pd window" \ - -accelerator [accel_munge "Ctrl+r"] \ - -command [concat menu_raise_console] - $name.m.edit add command -label "Toggle console" \ -accelerator [accel_munge "Shift+Ctrl+r"] \ -command [concat .controls.switches.console invoke] @@ -1371,7 +1389,8 @@
$name.m.windows add command -label {parent window}\ -command [concat menu_windowparent $name] - $name.m.windows add command -label {Pd window} -command menu_pop_pd + $name.m.windows add command -label {Pd window} -command menu_raise_console \ + -accelerator [accel_munge "Ctrl+r"] $name.m.windows add separator
# the audio menu @@ -1928,7 +1947,6 @@ if {$key == "b" || $key == "B"} {menu_doc_browser} if {$key == "n" || $key == "N"} {menu_new} if {$key == "o" || $key == "O"} {menu_open} - if {$key == "m" || $key == "M"} {menu_send} if {$key == "w" || $key == "W"} {menu_close $topname} if {$key == "p" || $key == "P"} {menu_print $topname} if {$key == "r" || $key == "R"} {menu_raise_console} @@ -1937,10 +1955,14 @@ if {$key == "v" || $key == "V"} {menu_paste $topname} if {$key == "d" || $key == "D"} {menu_duplicate $topname} if {$key == "a" || $key == "A"} {menu_selectall $topname} - if {$pd_nt == 2} { # by default, Cmd-T opens the font panel on Mac OS X + if {$pd_nt == 2} { + # by default, Cmd-T opens the font panel on Mac OS X if {$key == "t" || $key == "T"} {menu_font $topname} + if {$key == "m" || $key == "M"} {menu_minimize $topname} } else { if {$key == "t" || $key == "T"} {menu_texteditor $topname} + # minimize window on Mac OS X + if {$key == "m" || $key == "M"} {menu_send} } if {$key == "f" || $key == "F"} {menu_findobject $topname} if {$key == "g" || $key == "G"} {menu_findagain $topname} @@ -3619,9 +3641,14 @@ # .dummy itemconfig goo -text [concat ---> control-key event $key]; if {$key == "n" || $key == "N"} {menu_new} if {$key == "o" || $key == "O"} {menu_open} - if {$key == "m" || $key == "M"} {menu_send} + if {$pd_nt != 2} { + # Cmd-m is minimize window on Mac OS X + if {$key == "m" || $key == "M"} {menu_send} + } else { + if {$key == "m" || $key == "M"} {menu_minimize} + } if {$key == "q" || $key == "Q"} { - if {$shift == 1} {menu_really_quit} else {menu_quit} + if {$shift == 1} {menu_really_quit} else {menu_quit} } if {$key == "slash"} {menu_audio 1} if {$key == "period"} {menu_audio 0}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.