[PD-cvs] SF.net SVN: pure-data:[10463] branches/pd-devel/0.41.4/src
eighthave at users.sourceforge.net
eighthave at users.sourceforge.net
Thu Dec 25 09:49:55 CET 2008
Revision: 10463
http://pure-data.svn.sourceforge.net/pure-data/?rev=10463&view=rev
Author: eighthave
Date: 2008-12-25 08:49:55 +0000 (Thu, 25 Dec 2008)
Log Message:
-----------
First stab at spliting things into proper Tcl packages, it is pretty easy once
you know the tricks, and I think it'll be useful.
Modified Paths:
--------------
branches/pd-devel/0.41.4/src/pd.tk
Added Paths:
-----------
branches/pd-devel/0.41.4/src/make_pkgIndex.tcl
branches/pd-devel/0.41.4/src/pd_menucommands.tcl
branches/pd-devel/0.41.4/src/pd_menus.tcl
branches/pd-devel/0.41.4/src/pkgIndex.tcl
Added: branches/pd-devel/0.41.4/src/make_pkgIndex.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/make_pkgIndex.tcl (rev 0)
+++ branches/pd-devel/0.41.4/src/make_pkgIndex.tcl 2008-12-25 08:49:55 UTC (rev 10463)
@@ -0,0 +1,5 @@
+#!/usr/bin/tclsh
+
+pkg_mkIndex -verbose [pwd] *.tcl
+
+
Property changes on: branches/pd-devel/0.41.4/src/make_pkgIndex.tcl
___________________________________________________________________
Added: svn:executable
+ *
Modified: branches/pd-devel/0.41.4/src/pd.tk
===================================================================
--- branches/pd-devel/0.41.4/src/pd.tk 2008-12-25 07:54:48 UTC (rev 10462)
+++ branches/pd-devel/0.41.4/src/pd.tk 2008-12-25 08:49:55 UTC (rev 10463)
@@ -2,7 +2,6 @@
# 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
@@ -10,9 +9,11 @@
## replace Tk widgets with Ttk widgets on 8.5
#namespace import -force ttk::*
+# set . as first dir in auto_path
+set auto_path [linsert $auto_path 0 .]
-# TODO switch back to creating a menubar for each window
-# TODO figure out Edit Mode Checkbox menu item on Aqua
+package require pd_menus
+
# TODO figure out Undo/Redo/Cut/Copy/Paste state changes for menus
# TODO figure out parent window/window list for Window menu
@@ -24,31 +25,7 @@
# for key bindings
set modifier "Control"
-# ------------------------------------------------------------------------------
-# PLACEHOLDERS
-proc pd {} {
-}
-
-proc menu_doc_open {docdir doc} {
-# PLACEHOLDER
-}
-
-proc menu_helpbrowser {dir} {
-# PLACEHOLDER
-}
-
-proc menu_new {} {
-# PLACEHOLDER
- pdtk_canvas_new [format .flarg%d [expr round(rand()*1000)]] 30 10
-}
-
-proc menu_quit {} {
-# PLACEHOLDER
- exit
-}
-
-
# ------------------------------------------------------------------------------
# init functions
@@ -57,8 +34,7 @@
"x11" {
}
"aqua" {
- global accelerator modifier
- set accelerator "Meta"
+ global modifier
set modifier "Mod1"
}
"win32" {
@@ -68,323 +44,12 @@
}
# ------------------------------------------------------------------------------
-# Mac OS X specific functions
-
-proc menu_bringalltofront {} {
- #use [winfo children .] here to get windows that are minimized
- foreach item [winfo children .] {
- #get all toplevel windows, exclude menubar windows
- if { [string equal [winfo toplevel $item] $item] && [catch {$item cget -tearoff}]} {
- wm deiconify $item
- }
- }
- #be sure to deiconify ., since the above command only gets the child toplevels
- wm deiconify .
-}
-
-
-# ------------------------------------------------------------------------------
-# functions called from menu items
-
-
-proc menu_minimize {} {
- set windowlist [wm stackorder .]
- if {$windowlist != {}} {
- set topwindow [lindex $windowlist end]
- wm iconify $topwindow
- }
-}
-
-proc menu_maximize {window} {
- wm state $window zoomed
-}
-
-# ------------------------------------------------------------------------------
-# menu building functions for Mac OS X/aqua
-
-proc menu_create_file_aqua {rootmenu} {
- global accelerator
- $rootmenu add command -label "New" -accelerator "$accelerator+N"
- $rootmenu add command -label "Open" -accelerator "$accelerator+O"
- $rootmenu add cascade -label "Open Recent"
- $rootmenu add separator
- $rootmenu add command -label "Close" -accelerator "$accelerator+W"
- $rootmenu add command -label "Save" -accelerator "$accelerator+S"
- $rootmenu add command -label "Save As..." -accelerator "$accelerator+Shift+S"
-# $rootmenu add command -label "Save All"
- $rootmenu add command -label "Revert to Saved"
- $rootmenu add separator
- $rootmenu add command -label "Message"
- $rootmenu add separator
- $rootmenu add command -label "Print..." -accelerator "$accelerator+P"
-}
-
-# the "Edit", "Put", and "Find" menus do not have cross-platform differences
-
-proc menu_create_media_aqua {rootmenu} {
-}
-
-proc menu_create_window_aqua {rootmenu} {
-}
-
-# the "Help" does not have cross-platform differences
-
-# ------------------------------------------------------------------------------
-# menu building functions for UNIX/X11
-
-proc menu_create_file_x11 {rootmenu} {
- global accelerator
- $rootmenu add command -label "New" -accelerator "$accelerator+N"
- $rootmenu add command -label "Open" -accelerator "$accelerator+O"
- $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 separator
- $rootmenu add command -label "Message" -accelerator "$accelerator+M"
- $rootmenu add command -label "Print..." -accelerator "$accelerator+P"
- $rootmenu add separator
- $rootmenu add command -label "Close" -accelerator "$accelerator+W"
- $rootmenu add command -label "Quit" -accelerator "$accelerator+Q" \
- -command {menu_quit}
-}
-
-# the "Edit", "Put", and "Find" menus do not have cross-platform differences
-
-proc menu_create_media_x11 {rootmenu} {
-}
-
-proc menu_create_window_x11 {rootmenu} {
-}
-
-# the "Help" does not have cross-platform differences
-
-# ------------------------------------------------------------------------------
-# menu building functions for Windows/Win32
-
-proc menu_create_file_win32 {rootmenu} {
- global accelerator
- $rootmenu add command -label "New" -accelerator "$accelerator+N"
- $rootmenu add command -label "Open" -accelerator "$accelerator+O"
- $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 separator
- $rootmenu add command -label "Message" -accelerator "$accelerator+M"
- $rootmenu add command -label "Print..." -accelerator "$accelerator+P"
- $rootmenu add separator
- $rootmenu add command -label "Close" -accelerator "$accelerator+W"
- $rootmenu add command -label "Quit" -accelerator "$accelerator+Q" \
- -command {menu_quit}
-}
-
-# the "Edit", "Put", and "Find" menus do not have cross-platform differences
-
-proc menu_create_media_win32 {rootmenu} {
-}
-
-proc menu_create_window_win32 {rootmenu} {
-}
-
-# the "Help" does not have cross-platform differences
-
-
-# ------------------------------------------------------------------------------
-# menu building functions
-proc menu_create_file {rootmenu name} {
- [format menu_create_file_%s [tk windowingsystem]] $rootmenu
- $rootmenu entryconfigure "New" -command {menu_new}
- $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 "Close" -command {menu_close $name}
- $rootmenu entryconfigure "Message" -command {menu_send}
- $rootmenu entryconfigure "Print..." -command {menu_print $name}
-}
-
-proc menu_create_edit {rootmenu name} {
- 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" \
- -command {menu_object $name 0}
- $rootmenu add command -label "Message" -accelerator "$accelerator+2" \
- -command {menu_message $name 0}
- $rootmenu add command -label "Number" -accelerator "$accelerator+3" \
- -command {menu_floatatom $name 0}
- $rootmenu add command -label "Symbol" -accelerator "$accelerator+4" \
- -command {menu_symbolatom $name 0}
- $rootmenu add command -label "Comment" -accelerator "$accelerator+5" \
- -command {menu_comment $name 0}
- $rootmenu add separator
- $rootmenu add command -label "Bang" -accelerator "Shift+$accelerator+B" \
- -command {menu_bng $name 0}
- $rootmenu add command -label "Toggle" -accelerator "Shift+$accelerator+T" \
- -command {menu_toggle $name 0}
- $rootmenu add command -label "Number2" -accelerator "Shift+$accelerator+N" \
- -command {menu_numbox $name 0}
- $rootmenu add command -label "Vslider" -accelerator "Shift+$accelerator+V" \
- -command {menu_vslider $name 0}
- $rootmenu add command -label "Hslider" -accelerator "Shift+$accelerator+H" \
- -command {menu_hslider $name 0}
- $rootmenu add command -label "Vradio" -accelerator "Shift+$accelerator+D" \
- -command {menu_vradio $name 0}
- $rootmenu add command -label "Hradio" -accelerator "Shift+$accelerator+I" \
- -command {menu_hradio $name 0}
- $rootmenu add command -label "VU" -accelerator "Shift+$accelerator+U" \
- -command {menu_vumeter $name 0}
- $rootmenu add command -label "Canvas" -accelerator "Shift+$accelerator+C" \
- -command {menu_mycnv $name 0}
- $rootmenu add separator
- $rootmenu add command -label Graph -command {menu_graph $name}
- $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} {
- if {[tk windowingsystem] ne "aqua"} {
- $rootmenu add command -label {About Pd} \
- -command {menu_doc_open doc/1.manual 1.introduction.txt}
- }
- $rootmenu add command -label {HTML ...} \
- -command {menu_doc_open doc/1.manual index.htm}
- $rootmenu add command -label {Browser ...} \
- -command {menu_helpbrowser $help_top_directory}
-}
-
-proc menu_create_apple {rootmenu name} {
- $rootmenu add command -label "About Pd..." -command \
- {menu_doc_open doc/1.manual 1.introduction.txt}
- menu $rootmenu.preferences -tearoff 0
- $rootmenu add cascade -label "Preferences" -menu $rootmenu.preferences
- $rootmenu.preferences add command -label "Path..." \
- -command {pd pd start-path-dialog \;}
- $rootmenu.preferences add command -label "Startup..." \
- -command {pd pd start-startup-dialog \;}
- $rootmenu.preferences add command -label "Audio Settings..." \
- -command {pd pd audio-properties \;}
- $rootmenu.preferences add command -label "MIDI settings..." \
- -command {pd pd midi-properties \;}
-}
-
-proc menu_create {rootmenu} {
- menu $rootmenu
- set menulist "file edit put find media window help"
- if { [tk windowingsystem] eq "aqua" } {
- set menulist "$menulist apple"
- }
- foreach menuitem $menulist {
- menu $rootmenu.$menuitem -tearoff 0
- $rootmenu add cascade -label [string totitle $menuitem] \
- -menu $rootmenu.$menuitem
- [format menu_create_%s $menuitem] $rootmenu.$menuitem PLACEHOLDER
- if {[tk windowingsystem] eq "win32"} {
- # fix menu font size on Windows with tk scaling = 1
- $rootmenu.$menuitem configure -font menufont
- }
- }
-}
-
-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 }
- }
-}
-
-# ------------------------------------------------------------------------------
# canvas support functions
proc pdtk_canvas_new {canvas_name width height} {
if {$width < 300} {set width 300}
if {$height < 150} {set height 150}
toplevel $canvas_name -width $width -height $height
- menu_create $canvas_name.menubar
+ ::pd_menus::create_menubar $canvas_name.menubar
$canvas_name configure -menu $canvas_name.menubar
}
@@ -396,9 +61,9 @@
wm title . "Pd-devel"
wm protocol . WM_DELETE_WINDOW menu_quit
- menu_create .menubar
+ ::pd_menus::create_menubar .menubar
. configure -menu .menubar -width 400 -height 250
- menu_configure_pdwindow .menubar
+ ::pd_menus::configure_pdwindow .menubar
}
main
Added: branches/pd-devel/0.41.4/src/pd_menucommands.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pd_menucommands.tcl (rev 0)
+++ branches/pd-devel/0.41.4/src/pd_menucommands.tcl 2008-12-25 08:49:55 UTC (rev 10463)
@@ -0,0 +1,64 @@
+
+package provide pd_menucommands 0.1
+
+# ------------------------------------------------------------------------------
+# PLACEHOLDERS
+
+namespace eval ::pd_menucommands:: {
+ namespace export pd
+ namespace export menu_*
+}
+
+proc ::pd_menucommands::pd {} {
+}
+
+proc ::pd_menucommands::menu_doc_open {docdir doc} {
+ # PLACEHOLDER
+}
+
+proc ::pd_menucommands::menu_helpbrowser {dir} {
+ # PLACEHOLDER
+}
+
+proc ::pd_menucommands::menu_new {} {
+ # PLACEHOLDER
+ pdtk_canvas_new [format .flarg%d [expr round(rand()*1000)]] 30 10
+}
+
+proc ::pd_menucommands::menu_quit {} {
+ # PLACEHOLDER
+ exit
+}
+
+# ------------------------------------------------------------------------------
+# Mac OS X specific functions
+
+proc ::pd_menucommands::menu_bringalltofront {} {
+ #use [winfo children .] here to get windows that are minimized
+ foreach item [winfo children .] {
+ #get all toplevel windows, exclude menubar windows
+ if { [string equal [winfo toplevel $item] $item] && [catch {$item cget -tearoff}]} {
+ wm deiconify $item
+ }
+ }
+ #be sure to deiconify ., since the above command only gets the child toplevels
+ wm deiconify .
+}
+
+
+# ------------------------------------------------------------------------------
+# functions called from menu items
+
+
+proc ::pd_menucommands::menu_minimize {} {
+ set windowlist [wm stackorder .]
+ if {$windowlist != {}} {
+ set topwindow [lindex $windowlist end]
+ wm iconify $topwindow
+ }
+}
+
+proc ::pd_menucommands::menu_maximize {window} {
+ wm state $window zoomed
+}
+
Added: branches/pd-devel/0.41.4/src/pd_menus.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pd_menus.tcl (rev 0)
+++ branches/pd-devel/0.41.4/src/pd_menus.tcl 2008-12-25 08:49:55 UTC (rev 10463)
@@ -0,0 +1,309 @@
+# Copyright (c) 1997-2009 Miller Puckette.
+#(c) 2008 WordTech Communications LLC. License: standard Tcl license, http://www.tcl.tk/software/tcltk/license.html
+
+package provide pd_menus 0.1
+
+package require Tk
+#package require tile
+## replace Tk widgets with Ttk widgets on 8.5
+#namespace import -force ttk::*
+
+package require pd_menucommands
+namespace import ::pd_menucommands::*
+
+# TODO figure out Undo/Redo/Cut/Copy/Paste/DSP state changes for menus
+# TODO figure out parent window/window list for Window menu
+
+# ------------------------------------------------------------------------------
+# global variables
+
+# for displaying on menus
+
+namespace eval ::pd_menus:: {
+ if {[tk windowingsystem] eq "aqua"} {
+ variable accelerator "Mod1"
+ } else {
+ variable accelerator "Ctrl"
+ }
+
+ namespace export create_menubar
+ namespace export configure_pdwindow
+}
+
+# ------------------------------------------------------------------------------
+# menu building functions for Mac OS X/aqua
+
+proc ::pd_menus::create_file_menu_aqua {rootmenu} {
+ variable accelerator
+ $rootmenu add command -label "New" -accelerator "$accelerator+N"
+ $rootmenu add command -label "Open" -accelerator "$accelerator+O"
+ $rootmenu add cascade -label "Open Recent"
+ $rootmenu add separator
+ $rootmenu add command -label "Close" -accelerator "$accelerator+W"
+ $rootmenu add command -label "Save" -accelerator "$accelerator+S"
+ $rootmenu add command -label "Save As..." -accelerator "$accelerator+Shift+S"
+ # $rootmenu add command -label "Save All"
+ $rootmenu add command -label "Revert to Saved"
+ $rootmenu add separator
+ $rootmenu add command -label "Message"
+ $rootmenu add separator
+ $rootmenu add command -label "Print..." -accelerator "$accelerator+P"
+}
+
+# the "Edit", "Put", and "Find" menus do not have cross-platform differences
+
+proc ::pd_menus::create_media_menu_aqua {rootmenu} {
+}
+
+proc ::pd_menus::create_window_menu_aqua {rootmenu} {
+}
+
+# the "Help" does not have cross-platform differences
+
+# ------------------------------------------------------------------------------
+# menu building functions for UNIX/X11
+
+proc ::pd_menus::create_file_menu_x11 {rootmenu} {
+ variable accelerator
+ $rootmenu add command -label "New" -accelerator "$accelerator+N"
+ $rootmenu add command -label "Open" -accelerator "$accelerator+O"
+ $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 separator
+ $rootmenu add command -label "Message" -accelerator "$accelerator+M"
+ $rootmenu add command -label "Print..." -accelerator "$accelerator+P"
+ $rootmenu add separator
+ $rootmenu add command -label "Close" -accelerator "$accelerator+W"
+ $rootmenu add command -label "Quit" -accelerator "$accelerator+Q" \
+ -command {menu_quit}
+}
+
+# the "Edit", "Put", and "Find" menus do not have cross-platform differences
+
+proc ::pd_menus::create_media_menu_x11 {rootmenu} {
+}
+
+proc ::pd_menus::create_window_menu_x11 {rootmenu} {
+}
+
+# the "Help" does not have cross-platform differences
+
+# ------------------------------------------------------------------------------
+# menu building functions for Windows/Win32
+
+proc ::pd_menus::create_file_menu_win32 {rootmenu} {
+ variable accelerator
+ $rootmenu add command -label "New" -accelerator "$accelerator+N"
+ $rootmenu add command -label "Open" -accelerator "$accelerator+O"
+ $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 separator
+ $rootmenu add command -label "Message" -accelerator "$accelerator+M"
+ $rootmenu add command -label "Print..." -accelerator "$accelerator+P"
+ $rootmenu add separator
+ $rootmenu add command -label "Close" -accelerator "$accelerator+W"
+ $rootmenu add command -label "Quit" -accelerator "$accelerator+Q" \
+ -command {menu_quit}
+}
+
+# the "Edit", "Put", and "Find" menus do not have cross-platform differences
+
+proc ::pd_menus::create_media_menu_win32 {rootmenu} {
+}
+
+proc ::pd_menus::create_window_menu_win32 {rootmenu} {
+}
+
+# the "Help" does not have cross-platform differences
+
+
+# ------------------------------------------------------------------------------
+# menu building functions
+proc ::pd_menus::create_file_menu {rootmenu name} {
+ [format create_file_menu_%s [tk windowingsystem]] $rootmenu
+ $rootmenu entryconfigure "New" -command {menu_new}
+ $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 "Close" -command {menu_close $name}
+ $rootmenu entryconfigure "Message" -command {menu_send}
+ $rootmenu entryconfigure "Print..." -command {menu_print $name}
+}
+
+proc ::pd_menus::create_edit_menu {rootmenu name} {
+ variable 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 ::pd_menus::create_put_menu {rootmenu name} {
+ variable accelerator
+ $rootmenu add command -label "Object" -accelerator "$accelerator+1" \
+ -command {menu_object $name 0}
+ $rootmenu add command -label "Message" -accelerator "$accelerator+2" \
+ -command {menu_message $name 0}
+ $rootmenu add command -label "Number" -accelerator "$accelerator+3" \
+ -command {menu_floatatom $name 0}
+ $rootmenu add command -label "Symbol" -accelerator "$accelerator+4" \
+ -command {menu_symbolatom $name 0}
+ $rootmenu add command -label "Comment" -accelerator "$accelerator+5" \
+ -command {menu_comment $name 0}
+ $rootmenu add separator
+ $rootmenu add command -label "Bang" -accelerator "Shift+$accelerator+B" \
+ -command {menu_bng $name 0}
+ $rootmenu add command -label "Toggle" -accelerator "Shift+$accelerator+T" \
+ -command {menu_toggle $name 0}
+ $rootmenu add command -label "Number2" -accelerator "Shift+$accelerator+N" \
+ -command {menu_numbox $name 0}
+ $rootmenu add command -label "Vslider" -accelerator "Shift+$accelerator+V" \
+ -command {menu_vslider $name 0}
+ $rootmenu add command -label "Hslider" -accelerator "Shift+$accelerator+H" \
+ -command {menu_hslider $name 0}
+ $rootmenu add command -label "Vradio" -accelerator "Shift+$accelerator+D" \
+ -command {menu_vradio $name 0}
+ $rootmenu add command -label "Hradio" -accelerator "Shift+$accelerator+I" \
+ -command {menu_hradio $name 0}
+ $rootmenu add command -label "VU" -accelerator "Shift+$accelerator+U" \
+ -command {menu_vumeter $name 0}
+ $rootmenu add command -label "Canvas" -accelerator "Shift+$accelerator+C" \
+ -command {menu_mycnv $name 0}
+ $rootmenu add separator
+ $rootmenu add command -label Graph -command {menu_graph $name}
+ $rootmenu add command -label Array -command {menu_array $name}
+}
+
+proc ::pd_menus::create_find_menu {rootmenu name} {
+ variable 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 ::pd_menus::create_media_menu {rootmenu name} {
+ variable 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 ::pd_menus::create_window_menu {rootmenu name} {
+ variable 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 ::pd_menus::create_help_menu {rootmenu name} {
+ if {[tk windowingsystem] ne "aqua"} {
+ $rootmenu add command -label {About Pd} \
+ -command {menu_doc_open doc/1.manual 1.introduction.txt}
+ }
+ $rootmenu add command -label {HTML ...} \
+ -command {menu_doc_open doc/1.manual index.htm}
+ $rootmenu add command -label {Browser ...} \
+ -command {menu_helpbrowser $help_top_directory}
+}
+
+proc ::pd_menus::create_apple_menu {rootmenu name} {
+ $rootmenu add command -label "About Pd..." -command \
+ {menu_doc_open doc/1.manual 1.introduction.txt}
+ menu $rootmenu.preferences -tearoff 0
+ $rootmenu add cascade -label "Preferences" -menu $rootmenu.preferences
+ $rootmenu.preferences add command -label "Path..." \
+ -command {pd pd start-path-dialog \;}
+ $rootmenu.preferences add command -label "Startup..." \
+ -command {pd pd start-startup-dialog \;}
+ $rootmenu.preferences add command -label "Audio Settings..." \
+ -command {pd pd audio-properties \;}
+ $rootmenu.preferences add command -label "MIDI settings..." \
+ -command {pd pd midi-properties \;}
+}
+
+proc ::pd_menus::create_menubar {rootmenu} {
+ menu $rootmenu
+ set menulist "file edit put find media window help"
+ if { [tk windowingsystem] eq "aqua" } {
+ set menulist "$menulist apple"
+ }
+ foreach menuitem $menulist {
+ menu $rootmenu.$menuitem -tearoff 0
+ $rootmenu add cascade -label [string totitle $menuitem] \
+ -menu $rootmenu.$menuitem
+ [format create_%s_menu $menuitem] $rootmenu.$menuitem PLACEHOLDER
+ if {[tk windowingsystem] eq "win32"} {
+ # fix menu font size on Windows with tk scaling = 1
+ $rootmenu.$menuitem configure -font menufont
+ }
+ }
+}
+
+proc ::pd_menus::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 }
+ }
+}
+
Added: branches/pd-devel/0.41.4/src/pkgIndex.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pkgIndex.tcl (rev 0)
+++ branches/pd-devel/0.41.4/src/pkgIndex.tcl 2008-12-25 08:49:55 UTC (rev 10463)
@@ -0,0 +1,12 @@
+# Tcl package index file, version 1.1
+# This file is generated by the "pkg_mkIndex" command
+# and sourced either when an application starts up or
+# by a "package unknown" script. It invokes the
+# "package ifneeded" command to set up package-related
+# information so that packages will be loaded automatically
+# in response to "package require" commands. When this
+# script is sourced, the variable $dir must contain the
+# full path name of this file's directory.
+
+package ifneeded pdmenucommands 0.1 [list source [file join $dir pdmenucommands.tcl]]
+package ifneeded pdmenus 0.1 [list source [file join $dir pdmenus.tcl]]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Pd-cvs
mailing list