Revision: 10462 http://pure-data.svn.sourceforge.net/pure-data/?rev=10462&view=rev Author: eighthave Date: 2008-12-25 07:54:48 +0000 (Thu, 25 Dec 2008)
Log Message: ----------- flushed out the menus and created a menu for each window
Modified Paths: -------------- branches/pd-devel/0.41.4/src/pd.tk
Modified: branches/pd-devel/0.41.4/src/pd.tk =================================================================== --- branches/pd-devel/0.41.4/src/pd.tk 2008-12-25 06:17:02 UTC (rev 10461) +++ branches/pd-devel/0.41.4/src/pd.tk 2008-12-25 07:54:48 UTC (rev 10462) @@ -1,4 +1,8 @@ #!/usr/bin/wish +# For information on usage and redistribution, and for a DISCLAIMER OF ALL +# WARRANTIES, see the file, "LICENSE.txt," in this distribution. +# Copyright (c) 1997-2009 Miller Puckette. +#(c) 2008 WordTech Communications LLC. License: standard Tcl license, http://www.tcl.tk/software/tcltk/license.html
package require Tk #package require tile @@ -115,19 +119,15 @@ $rootmenu add command -label "Print..." -accelerator "$accelerator+P" }
-proc menu_create_edit_aqua {rootmenu} { -} +# the "Edit", "Put", and "Find" menus do not have cross-platform differences
-# the "Put" and "Find" menus do not have cross-platform differences - proc menu_create_media_aqua {rootmenu} { }
proc menu_create_window_aqua {rootmenu} { }
-proc menu_create_help_aqua {rootmenu} { -} +# the "Help" does not have cross-platform differences
# ------------------------------------------------------------------------------ # menu building functions for UNIX/X11 @@ -139,7 +139,7 @@ $rootmenu add separator $rootmenu add command -label "Save" -accelerator "$accelerator+S" $rootmenu add command -label "Save As..." -accelerator "Shift+$accelerator+S" - $rootmenu add command -label "Revert" +# $rootmenu add command -label "Revert" $rootmenu add separator $rootmenu add command -label "Message" -accelerator "$accelerator+M" $rootmenu add command -label "Print..." -accelerator "$accelerator+P" @@ -149,19 +149,15 @@ -command {menu_quit} }
-proc menu_create_edit_x11 {rootmenu} { -} +# the "Edit", "Put", and "Find" menus do not have cross-platform differences
-# the "Put" and "Find" menus do not have cross-platform differences - proc menu_create_media_x11 {rootmenu} { }
proc menu_create_window_x11 {rootmenu} { }
-proc menu_create_help_x11 {rootmenu} { -} +# the "Help" does not have cross-platform differences
# ------------------------------------------------------------------------------ # menu building functions for Windows/Win32 @@ -173,7 +169,7 @@ $rootmenu add separator $rootmenu add command -label "Save" -accelerator "$accelerator+S" $rootmenu add command -label "Save As..." -accelerator "Shift+$accelerator+S" - $rootmenu add command -label "Revert" +# $rootmenu add command -label "Revert" $rootmenu add separator $rootmenu add command -label "Message" -accelerator "$accelerator+M" $rootmenu add command -label "Print..." -accelerator "$accelerator+P" @@ -183,19 +179,15 @@ -command {menu_quit} }
-proc menu_create_edit_win32 {rootmenu} { -} +# the "Edit", "Put", and "Find" menus do not have cross-platform differences
-# the "Put" and "Find" menus do not have cross-platform differences - proc menu_create_media_win32 {rootmenu} { }
proc menu_create_window_win32 {rootmenu} { }
-proc menu_create_help_win32 {rootmenu} { -} +# the "Help" does not have cross-platform differences
# ------------------------------------------------------------------------------ @@ -206,17 +198,51 @@ $rootmenu entryconfigure "Open" -command {menu_open} $rootmenu entryconfigure "Save" -command {menu_save $name} $rootmenu entryconfigure "Save As..." -command {menu_saveas $name} - $rootmenu entryconfigure "Revert*" -command {menu_revert $name} +# $rootmenu entryconfigure "Revert*" -command {menu_revert $name} $rootmenu entryconfigure "Close" -command {menu_close $name} $rootmenu entryconfigure "Message" -command {menu_send} $rootmenu entryconfigure "Print..." -command {menu_print $name} }
proc menu_create_edit {rootmenu name} { -# [format menu_create_edit_%s [tk windowingsystem]] $rootmenu -# $rootmenu entryconfigure "New" -command {menu_new} + global accelerator + $rootmenu add command -label "Undo" -accelerator "$accelerator+Z" \ + -command {menu_undo $name} + $rootmenu add command -label "Redo" -accelerator "Shift+$accelerator+Z" \ + -command {menu_redo $name} + $rootmenu add separator + $rootmenu add command -label "Cut" -accelerator "$accelerator+X" \ + -command {menu_cut $name} + $rootmenu add command -label "Copy" -accelerator "$accelerator+C" \ + -command {menu_copy $name} + $rootmenu add command -label "Paste" -accelerator "$accelerator+V" \ + -command {menu_paste $name} + $rootmenu add command -label "Duplicate" -accelerator "$accelerator+D" \ + -command {menu_duplicate $name} + $rootmenu add command -label "Select All" -accelerator "$accelerator+A" \ + -command {menu_selectall $name} + $rootmenu add separator + $rootmenu add command -label "Text Editor" -accelerator "$accelerator+T" \ + -command {menu_texteditor $name} + $rootmenu add command -label "Font" \ + -command {menu_font $name} + $rootmenu add command -label "Tidy Up" \ + -command {menu_tidyup $name} + $rootmenu add command -label "Toggle Console" -accelerator "Shift+$accelerator+R" \ + -command {.controls.switches.console invoke} + $rootmenu add command -label "Clear Console" -accelerator "Shift+$accelerator+L" \ + -command {menu_clear_console} + $rootmenu add separator + $rootmenu add radiobutton -label "Edit Mode" -accelerator "$accelerator+E" \ + -indicatoron true -selectcolor grey85 \ + -command {menu_editmode $name} \ + +# if { $editable == 0 } { +# $name.m.edit entryconfigure "Edit mode" -indicatoron false +# } }
+ proc menu_create_put {rootmenu name} { global accelerator $rootmenu add command -label "Object" -accelerator "$accelerator+1" \ @@ -253,10 +279,42 @@ $rootmenu add command -label Array -command {menu_array $name} }
+proc menu_create_find {rootmenu name} { + global accelerator + $rootmenu add command -label "Find..." -accelerator "$accelerator+F" \ + -command {menu_findobject $name} + $rootmenu add command -label "Find Again" -accelerator "$accelerator+G" \ + -command {menu_findagain $name} + $rootmenu add command -label "Find last error" \ + -command {menu_finderror} + +} + proc menu_create_media {rootmenu name} { + global accelerator + $rootmenu add radiobutton -label "Compute Audio On" -accelerator "$accelerator+/" \ + -command {menu_audio 1} + $rootmenu add radiobutton -label "Compute Audio Off" -accelerator "$accelerator+." \ + -command {menu_audio 0} -indicatoron true + $rootmenu add separator + $rootmenu add command -label "Test Audio and MIDI" \ + -command {menu_doc_open doc/7.stuff/tools testtone.pd} + $rootmenu add command -label "Load Meter" \ + -command {menu_doc_open doc/7.stuff/tools load-meter.pd} }
proc menu_create_window {rootmenu name} { + global accelerator + if {[tk windowingsystem] eq "aqua"} { + $rootmenu add command -label "Minimize" -command {menu_minimize .} \ + -accelerator "$accelerator+M" + $rootmenu add command -label "Zoom" -command {menu_zoom .} + $rootmenu add separator + } + $rootmenu add command -label "Parent Window" -state disabled + $rootmenu add command -label "Pd window" -command {menu_raise_console} \ + -accelerator "$accelerator+R" -state disabled + $rootmenu add separator }
proc menu_create_help {rootmenu name} { @@ -286,7 +344,8 @@ }
proc menu_create {rootmenu} { - set menulist "file edit put media window help" + menu $rootmenu + set menulist "file edit put find media window help" if { [tk windowingsystem] eq "aqua" } { set menulist "$menulist apple" } @@ -302,34 +361,21 @@ } }
-proc menu_entryconfigure {menuname itemname} { - set itemindex [$menuname ] - $menuname entryconfigure -} - -proc menu_configure {menubar window} { - puts "menu_configure $window" - set file_items_to_disable {"Save" "Save As..." "Revert" "Print..." "Close"} - if {$window eq "."} { - # these are meaningless for the Pd window, so disable them - foreach item $file_items_to_disable { - $menubar.file entryconfigure $item -state disabled - } - for {set i 0} {$i <= [$menubar.put index end]} {incr i} { - # catch errors by trying to disable separators - catch {$menubar.put entryconfigure $i -state disabled } - } - } else { - foreach item $file_items_to_disable { - $menubar.file entryconfigure $item -state normal - } - for {set i 0} {$i <= [$menubar.put index end]} {incr i} { - # catch errors by trying to disable separators - catch {$menubar.put entryconfigure $i -state normal } - } - # TODO re-enable menu items - # TODO configure "parent on Window menu +proc menu_configure_pdwindow {menubar} { + # these are meaningless for the Pd window, so disable them + set file_items_to_disable {"Save" "Save As..." "Print..." "Close"} + foreach item $file_items_to_disable { + $menubar.file entryconfigure $item -state disabled } + set edit_items_to_disable {"Undo" "Redo" "Duplicate" "Tidy Up" "Edit Mode"} + foreach item $edit_items_to_disable { + $menubar.edit entryconfigure $item -state disabled + } + # disable everything on the Put menu + for {set i 0} {$i <= [$menubar.put index end]} {incr i} { + # catch errors by trying to disable separators + catch {$menubar.put entryconfigure $i -state disabled } + } }
# ------------------------------------------------------------------------------ @@ -337,8 +383,9 @@ proc pdtk_canvas_new {canvas_name width height} { if {$width < 300} {set width 300} if {$height < 150} {set height 150} - toplevel $canvas_name -menu .menubar -width $width -height $height - bind $canvas_name <FocusIn> {menu_configure .menubar %W} + toplevel $canvas_name -width $width -height $height + menu_create $canvas_name.menubar + $canvas_name configure -menu $canvas_name.menubar }
# ------------------------------------------------------------------------------ @@ -346,14 +393,12 @@ proc main {} { init
- menu .menubar + wm title . "Pd-devel" + wm protocol . WM_DELETE_WINDOW menu_quit + menu_create .menubar - - wm title . "Pd-devel" - #wm protocol . WM_DELETE_WINDOW menu_quit . configure -menu .menubar -width 400 -height 250 - menu_configure .menubar . - bind . <FocusIn> {menu_configure .menubar %W} + menu_configure_pdwindow .menubar }
main
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.