Revision: 10540 http://pure-data.svn.sourceforge.net/pure-data/?rev=10540&view=rev Author: eighthave Date: 2009-01-13 18:42:17 +0000 (Tue, 13 Jan 2009)
Log Message: ----------- reordered functions for readability and added code snippet for console show/hide
Modified Paths: -------------- branches/pd-devel/0.41.4/src/pd_menus.tcl
Modified: branches/pd-devel/0.41.4/src/pd_menus.tcl =================================================================== --- branches/pd-devel/0.41.4/src/pd_menus.tcl 2009-01-13 18:39:26 UTC (rev 10539) +++ branches/pd-devel/0.41.4/src/pd_menus.tcl 2009-01-13 18:42:17 UTC (rev 10540) @@ -75,120 +75,6 @@ }
# ------------------------------------------------------------------------------ -# menu building functions for Mac OS X/aqua - -# for Mac OS X only -proc ::pd_menus::create_apple_menu {mymenu} { - puts stderr BUILD_APPLE_MENU - # TODO this should open a Pd patch called about.pd - menu $mymenu.apple - $mymenu.apple add command -label [say "About Pd"] \ - -command "menu_doc_open doc/1.manual 1.introduction.txt" - $mymenu add cascade -label "Apple" -menu $mymenu.apple - # starting in 8.4.14, this is created automatically - if {[regsub -- {[0-9].[0-9].([0-9][0-9]*)} [info patchlevel] {\1}] < 14} { - $mymenu.apple add separator - $mymenu.apple add command -label [say "Preferences..."] \ - -command "menu_preferences" -accelerator "Cmd+," - } -} - -proc ::pd_menus::build_file_menu_aqua {mymenu} { - variable accelerator - $mymenu add command -label [say "new_file"] -accelerator "$accelerator+N" - $mymenu add command -label [say "Open"] -accelerator "$accelerator+O" - $mymenu add cascade -label [say "Open Recent"] - $mymenu add separator - $mymenu add command -label [say "Close"] -accelerator "$accelerator+W" - $mymenu add command -label [say "Save"] -accelerator "$accelerator+S" - $mymenu add command -label [say "Save As..."] -accelerator "$accelerator+Shift+S" - #$mymenu add command -label [say "Save All"] - $mymenu add command -label [say "Revert to Saved"] - $mymenu add separator - $mymenu add command -label [say "Message"] - $mymenu add separator - $mymenu add command -label [say "Print..."] -accelerator "$accelerator+P" -} - -# the "Edit", "Put", and "Find" menus do not have cross-platform differences - -proc ::pd_menus::build_media_menu_aqua {mymenu} { -} - -proc ::pd_menus::build_window_menu_aqua {mymenu} { -} - -# the "Help" does not have cross-platform differences - -# ------------------------------------------------------------------------------ -# menu building functions for UNIX/X11 - -proc ::pd_menus::build_file_menu_x11 {mymenu} { - variable accelerator - $mymenu add command -label [say "new_file"] -accelerator "$accelerator+N" - $mymenu add command -label [say "Open"] -accelerator "$accelerator+O" - $mymenu add separator - $mymenu add command -label [say "Save"] -accelerator "$accelerator+S" - $mymenu add command -label [say "Save As..."] -accelerator "Shift+$accelerator+S" - # $mymenu add command -label "Revert" - $mymenu add separator - $mymenu add command -label [say "Message"] -accelerator "$accelerator+M" - $mymenu add command -label [say "Print..."] -accelerator "$accelerator+P" - $mymenu add separator - $mymenu add command -label [say "Close"] -accelerator "$accelerator+W" - $mymenu add command -label [say "Quit"] -accelerator "$accelerator+Q" \ - -command "pdsend "pd verifyquit ;"" -} - -# the "Edit", "Put", and "Find" menus do not have cross-platform differences - -proc ::pd_menus::build_media_menu_x11 {mymenu} { -} - -proc ::pd_menus::build_window_menu_x11 {mymenu} { -} - -# the "Help" does not have cross-platform differences - -# ------------------------------------------------------------------------------ -# menu building functions for Windows/Win32 - -# for Windows only -proc ::pd_menus::create_system_menu {mymenu} { - $mymenu add cascade -menu [menu $mymenu.system] - # TODO add Close, Minimize, etc and whatever else is on the little menu - # that is on the top left corner of the window frame -} - -proc ::pd_menus::build_file_menu_win32 {mymenu} { - variable accelerator - $mymenu add command -label [say "new_file"] -accelerator "$accelerator+N" - $mymenu add command -label [say "Open"] -accelerator "$accelerator+O" - $mymenu add separator - $mymenu add command -label [say "Save"] -accelerator "$accelerator+S" - $mymenu add command -label [say "Save As..."] -accelerator "Shift+$accelerator+S" - # $mymenu add command -label "Revert" - $mymenu add separator - $mymenu add command -label [say "Message"] -accelerator "$accelerator+M" - $mymenu add command -label [say "Print..."] -accelerator "$accelerator+P" - $mymenu add separator - $mymenu add command -label [say "Close"] -accelerator "$accelerator+W" - $mymenu add command -label [say "Quit"] -accelerator "$accelerator+Q"\ - -command "pdsend "pd verifyquit ;"" -} - -# the "Edit", "Put", and "Find" menus do not have cross-platform differences - -proc ::pd_menus::build_media_menu_win32 {mymenu} { -} - -proc ::pd_menus::build_window_menu_win32 {mymenu} { -} - -# the "Help" does not have cross-platform differences - - -# ------------------------------------------------------------------------------ # menu building functions proc ::pd_menus::build_file_menu {mymenu mytoplevel} { [format build_file_menu_%s $::windowingsystem] $mymenu @@ -245,6 +131,10 @@ # $mymenu entryconfigure "Edit Mode" -indicatoron false # }
+ #if { ! [catch {console hide}]} { + # TODO set up menu item to show/hide the Tcl/Tk console, if it available + #} + if {$::windowingsystem ne "aqua"} { $mymenu add separator $mymenu add command -label [say "Preferences"] \ @@ -335,3 +225,117 @@ $mymenu add command -label {Browser ...} \ -command "placeholder menu_helpbrowser $help_top_directory" } + +# ------------------------------------------------------------------------------ +# menu building functions for Mac OS X/aqua + +# for Mac OS X only +proc ::pd_menus::create_apple_menu {mymenu} { + puts stderr BUILD_APPLE_MENU + # TODO this should open a Pd patch called about.pd + menu $mymenu.apple + $mymenu.apple add command -label [say "About Pd"] \ + -command "menu_doc_open doc/1.manual 1.introduction.txt" + $mymenu add cascade -label "Apple" -menu $mymenu.apple + # starting in 8.4.14, this is created automatically + if {[regsub -- {[0-9].[0-9].([0-9][0-9]*)} [info patchlevel] {\1}] < 14} { + $mymenu.apple add separator + $mymenu.apple add command -label [say "Preferences..."] \ + -command "menu_preferences" -accelerator "Cmd+," + } +} + +proc ::pd_menus::build_file_menu_aqua {mymenu} { + variable accelerator + $mymenu add command -label [say "new_file"] -accelerator "$accelerator+N" + $mymenu add command -label [say "Open"] -accelerator "$accelerator+O" + $mymenu add cascade -label [say "Open Recent"] + $mymenu add separator + $mymenu add command -label [say "Close"] -accelerator "$accelerator+W" + $mymenu add command -label [say "Save"] -accelerator "$accelerator+S" + $mymenu add command -label [say "Save As..."] -accelerator "$accelerator+Shift+S" + #$mymenu add command -label [say "Save All"] + $mymenu add command -label [say "Revert to Saved"] + $mymenu add separator + $mymenu add command -label [say "Message"] + $mymenu add separator + $mymenu add command -label [say "Print..."] -accelerator "$accelerator+P" +} + +# the "Edit", "Put", and "Find" menus do not have cross-platform differences + +proc ::pd_menus::build_media_menu_aqua {mymenu} { +} + +proc ::pd_menus::build_window_menu_aqua {mymenu} { +} + +# the "Help" does not have cross-platform differences + +# ------------------------------------------------------------------------------ +# menu building functions for UNIX/X11 + +proc ::pd_menus::build_file_menu_x11 {mymenu} { + variable accelerator + $mymenu add command -label [say "new_file"] -accelerator "$accelerator+N" + $mymenu add command -label [say "Open"] -accelerator "$accelerator+O" + $mymenu add separator + $mymenu add command -label [say "Save"] -accelerator "$accelerator+S" + $mymenu add command -label [say "Save As..."] -accelerator "Shift+$accelerator+S" + # $mymenu add command -label "Revert" + $mymenu add separator + $mymenu add command -label [say "Message"] -accelerator "$accelerator+M" + $mymenu add command -label [say "Print..."] -accelerator "$accelerator+P" + $mymenu add separator + $mymenu add command -label [say "Close"] -accelerator "$accelerator+W" + $mymenu add command -label [say "Quit"] -accelerator "$accelerator+Q" \ + -command "pdsend "pd verifyquit ;"" +} + +# the "Edit", "Put", and "Find" menus do not have cross-platform differences + +proc ::pd_menus::build_media_menu_x11 {mymenu} { +} + +proc ::pd_menus::build_window_menu_x11 {mymenu} { +} + +# the "Help" does not have cross-platform differences + +# ------------------------------------------------------------------------------ +# menu building functions for Windows/Win32 + +# for Windows only +proc ::pd_menus::create_system_menu {mymenu} { + $mymenu add cascade -menu [menu $mymenu.system] + # TODO add Close, Minimize, etc and whatever else is on the little menu + # that is on the top left corner of the window frame +} + +proc ::pd_menus::build_file_menu_win32 {mymenu} { + variable accelerator + $mymenu add command -label [say "new_file"] -accelerator "$accelerator+N" + $mymenu add command -label [say "Open"] -accelerator "$accelerator+O" + $mymenu add separator + $mymenu add command -label [say "Save"] -accelerator "$accelerator+S" + $mymenu add command -label [say "Save As..."] -accelerator "Shift+$accelerator+S" + # $mymenu add command -label "Revert" + $mymenu add separator + $mymenu add command -label [say "Message"] -accelerator "$accelerator+M" + $mymenu add command -label [say "Print..."] -accelerator "$accelerator+P" + $mymenu add separator + $mymenu add command -label [say "Close"] -accelerator "$accelerator+W" + $mymenu add command -label [say "Quit"] -accelerator "$accelerator+Q"\ + -command "pdsend "pd verifyquit ;"" +} + +# the "Edit", "Put", and "Find" menus do not have cross-platform differences + +proc ::pd_menus::build_media_menu_win32 {mymenu} { +} + +proc ::pd_menus::build_window_menu_win32 {mymenu} { +} + +# the "Help" does not have cross-platform differences +
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.