[PD-cvs] SF.net SVN: pure-data:[10526] branches/pd-devel/0.41.4/src

eighthave at users.sourceforge.net eighthave at users.sourceforge.net
Tue Jan 13 07:46:55 CET 2009


Revision: 10526
          http://pure-data.svn.sourceforge.net/pure-data/?rev=10526&view=rev
Author:   eighthave
Date:     2009-01-13 06:46:55 +0000 (Tue, 13 Jan 2009)

Log Message:
-----------
- renamed 'pd' command to 'pdsend' and worked towards moving it closely to pd
  message syntax.  

- replaced menu_* procs that just sent a message to pd with 'pdsend'

- removed redundant menu_* procs

- trapped 'exit' event on Mac OS X/Aqua and included 'apple_events' package in
  AppMain.tcl so that it gets loaded with running Wish/Aqua

- set the minimum window size on win32 and x11 so that the menubar doesn't get
  hidden
 -This line, and those below, will be ignored--

M    src/pd_menucommands.tcl
M    src/pd_bindings.tcl
M    src/apple_events.tcl
M    src/AppMain.tcl
M    src/pdtk_canvas.tcl
M    src/wheredoesthisgo.tcl
M    src/pkgIndex.tcl
M    src/pd_menus.tcl
M    src/pd_connect.tcl
M    src/pd.tk
M    src/pd_iemgui.tcl

Modified Paths:
--------------
    branches/pd-devel/0.41.4/src/AppMain.tcl
    branches/pd-devel/0.41.4/src/apple_events.tcl
    branches/pd-devel/0.41.4/src/pd.tk
    branches/pd-devel/0.41.4/src/pd_bindings.tcl
    branches/pd-devel/0.41.4/src/pd_connect.tcl
    branches/pd-devel/0.41.4/src/pd_iemgui.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/pdtk_canvas.tcl
    branches/pd-devel/0.41.4/src/pkgIndex.tcl
    branches/pd-devel/0.41.4/src/wheredoesthisgo.tcl

Modified: branches/pd-devel/0.41.4/src/AppMain.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/AppMain.tcl	2009-01-13 04:18:07 UTC (rev 10525)
+++ branches/pd-devel/0.41.4/src/AppMain.tcl	2009-01-13 06:46:55 UTC (rev 10526)
@@ -1,7 +1,11 @@
 # this file is for the Wish.app on Mac OS X
 
+
+puts --------------------------AppMain.tcl-----------------------------------
 catch {console show}
 
+package require apple_events
+
 puts "AppMain.tcl"
 puts "argv0: $argv0"
 puts "executable: [info nameofexecutable]"

Modified: branches/pd-devel/0.41.4/src/apple_events.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/apple_events.tcl	2009-01-13 04:18:07 UTC (rev 10525)
+++ branches/pd-devel/0.41.4/src/apple_events.tcl	2009-01-13 06:46:55 UTC (rev 10526)
@@ -4,7 +4,7 @@
 # from http://wiki.tcl.tk/12987
 
 # minimum line thickness to anti-alias (default: 3)
-set tk::mac::CGAntialiasLimit 2
+set tk::mac::CGAntialiasLimit 0
 
 # enable/disable anti-aliased text
 set ::tk::mac::antialiasedtext 1
@@ -26,9 +26,13 @@
 }
 
 #kAEQuitApplication
-#proc exit {} {
-# this proc overrides the built-in exit
-#}
+proc exit {} {
+	puts stderr "Custom exit proc"
+	# this proc overrides the built-in exit so we can grab the Quit event
+	pdsend "pd verifyquit;"
+	::exit
+	# TODO sort this out...
+}
 
 proc spinCursor {widget count} {
 	$widget configure -cursor spinning$count

Modified: branches/pd-devel/0.41.4/src/pd.tk
===================================================================
--- branches/pd-devel/0.41.4/src/pd.tk	2009-01-13 04:18:07 UTC (rev 10525)
+++ branches/pd-devel/0.41.4/src/pd.tk	2009-01-13 06:46:55 UTC (rev 10526)
@@ -5,6 +5,10 @@
 # WARRANTIES, see the file, "LICENSE.txt," in this distribution.
 # Copyright (c) 1997-2009 Miller Puckette.
 
+# TODO implement checking to see if another Pd is already running follwoing
+# this code example: http://tcl.tk/man/tcl8.4/TkCmd/send.htm
+
+
 puts -------------------------------pd.tk-----------------------------------
 
 package require Tcl 8.3
@@ -29,7 +33,7 @@
 
 # import into the global namespace for backwards compatibility
 namespace import ::pd_post::pdtk_post
-namespace import ::pd_connect::pd
+namespace import ::pd_connect::pdsend
 
 
 #------------------------------------------------------------------------------#
@@ -49,6 +53,7 @@
 
 
 
+
 #------------------------------------------------------------------------------#
 # global variables
 
@@ -128,7 +133,7 @@
 	pdtk_post "args: $args"
 	set oldtclversion 0
 	set fontlist "8 5 8 9 6 10 10 7 11 12 7 12 14 8 14 16 10 16 18 11 18 24 14 24 30 18 30 36 22 36"
-	pd [concat pd init [pdtk_enquote [pwd]] $oldtclversion $fontlist \;];
+	pdsend "pd init [pdtk_enquote [pwd]] $oldtclversion $fontlist ;"
 	# TODO what else is needed from the original?
 }
 
@@ -142,7 +147,7 @@
     set answer [tk_messageBox -type yesno -icon question \
 					-default $default -message $message]
     if {$answer eq "yes"} {
-		pd $reply_to_pd
+		pdsend $reply_to_pd
 	}
 }
 
@@ -163,7 +168,11 @@
 
 	# TODO slide off screen windows into view
 	wm geometry $name $geometry
-	wm minsize $name 50 20
+	if {[tk windowingsystem] eq "aqua"} {
+		wm minsize $name 50 20
+	} else { # leave room for the menubar
+		wm minsize $name 310 30
+	}
 	canvas $name.c -width $width -height $height -background white \
 		-highlightthickness 0
 	# TODO add scrollbars here
@@ -191,6 +200,10 @@
 	post_tclinfo
 	pdtk_post "Starting pd.tk with main($argc $argv)"
 	init
+	# we are not using Tk scaling, so fix it to 1 on all platforms.  This
+	# guarantees that patches will be pixel-exact on every platform
+	tk scaling 1
+
 	# TODO check args for -stderr and set pdtk_post accordingly
 
 	::pd_menus::create_menubar .menubar

Modified: branches/pd-devel/0.41.4/src/pd_bindings.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pd_bindings.tcl	2009-01-13 04:18:07 UTC (rev 10525)
+++ branches/pd-devel/0.41.4/src/pd_bindings.tcl	2009-01-13 06:46:55 UTC (rev 10526)
@@ -26,15 +26,17 @@
 	bind $name <$modifier-Key-n>        "menu_new"
 	bind $name <$modifier-Key-o>        "menu_open"
 	bind $name <$modifier-Key-p>        "menu_print $name"
-	bind $name <$modifier-Key-q>        "menu_quit"
+	bind $name <$modifier-Key-q>        "pdsend \"pd verifyquit ;\""
 	bind $name <$modifier-Key-r>        "menu_raiseconsole"
-	bind $name <$modifier-Key-w>        "menu_close $name"
+	bind $name <$modifier-Key-w>        "pdsend \"$name menuclose 0 ;\""
 	bind $name <$modifier-Shift-Key-L>  "menu_clear_console"
+	bind $name <$modifier-Shift-Key-Q>  "pdsend \"pd quit ;\""
 	bind $name <$modifier-Shift-Key-R>  "menu_toggle_console"
+	bind $name <$modifier-Shift-Key-W>  "pdsend \"$name menuclose 1 ;\""
 
 	# DSP control
-	bind $name <$modifier-Key-slash>    "menu_audio 1"
-	bind $name <$modifier-Key-period>   "menu_audio 0"
+	bind $name <$modifier-Key-slash>    "pdsend \"pd dsp 1 ;\""
+	bind $name <$modifier-Key-period>   "pdsend \"pd dsp 0 ;\""
 }
 
 proc ::pd_bindings::pdwindow_bindings {name} {
@@ -42,6 +44,7 @@
 
 	window_bindings $name
 
+	# TODO update this to work with the console, if it is used
 	bind . <$modifier-Key-a> ".printout.text tag add sel 1.0 end"
 	bind . <$modifier-Key-x> "tk_textCut .printout.text"
 	bind . <$modifier-Key-c> "tk_textCopy .printout.text"
@@ -49,7 +52,7 @@
 	bind . <$modifier-Key-w> {::pd_post::pdtk_post "Can't close Pd window, ignored.\n"}
 
 	# Tcl event bindings
-	wm protocol . WM_DELETE_WINDOW "menu_quit"
+	wm protocol . WM_DELETE_WINDOW "pdsend \"pd verifyquit ;\""
 
 	# do window maintenance when entering the Pd window (Window menu, scrollbars, etc)
 	#bind $name <FocusIn> {pdtk_pdwindowmaintenance}
@@ -73,35 +76,35 @@
 	window_bindings $name
 
 	# key bindings -------------------------------------------------------------
-	bind $name <$modifier-Key-1>        "menu_object $name 1"
-	bind $name <$modifier-Key-2>        "menu_message $name 1"
-	bind $name <$modifier-Key-3>        "menu_floatatom $name 1"
-	bind $name <$modifier-Key-4>        "menu_symbolatom $name 1"
-	bind $name <$modifier-Key-5>        "menu_comment $name 1"
-	bind $name <$modifier-Key-a>        "menu_selectall $name"
-	bind $name <$modifier-Key-c>        "menu_copy $name"
-	bind $name <$modifier-Key-d>        "menu_duplicate $name"
-	bind $name <$modifier-Key-e>        "menu_editmode $name"
+	bind $name <$modifier-Key-1>        "pdsend \"$name obj ;\""
+	bind $name <$modifier-Key-2>        "pdsend \"$name msg ;\""
+	bind $name <$modifier-Key-3>        "pdsend \"$name floatatom ;\""
+	bind $name <$modifier-Key-4>        "pdsend \"$name symbolatom ;\""
+	bind $name <$modifier-Key-5>        "pdsend \"$name text ;\""
+	bind $name <$modifier-Key-a>        "pdsend \"$name selectall ;\""
+	bind $name <$modifier-Key-c>        "pdsend \"$name copy ;\""
+	bind $name <$modifier-Key-d>        "pdsend \"$name duplicate ;\""
+	bind $name <$modifier-Key-e>        "pdsend \"$name editmode 0 ;\""
 	bind $name <$modifier-Key-f>        "menu_findobject $name"
-	bind $name <$modifier-Key-g>        "menu_findagain $name"
-	bind $name <$modifier-Key-s>        "menu_save $name"
-	bind $name <$modifier-Key-v>        "menu_paste $name"
-	bind $name <$modifier-Key-x>        "menu_cut $name"
+	bind $name <$modifier-Key-g>        "pdsend \"$name findagain ;\""
+	bind $name <$modifier-Key-s>        "pdsend \"$name menusave ;\""
+	bind $name <$modifier-Key-v>        "pdsend \"$name paste ;\""
+	bind $name <$modifier-Key-x>        "pdsend \"$name cut ;\""
 	bind $name <$modifier-Key-z>        "menu_undo $name"
-	bind $name <$modifier-Key-slash>    "menu_audio 1"
-	bind $name <$modifier-Key-period>   "menu_audio 0"
+	bind $name <$modifier-Key-slash>    "pdsend \"pd dsp 1 ;\""
+	bind $name <$modifier-Key-period>   "pdsend \"pd dsp 0 ;\""
 
 	# annoying, but Tk's bind needs uppercase letter to get the Shift
-	bind $name <$modifier-Shift-Key-B>  "menu_bang"
-	bind $name <$modifier-Shift-Key-C>  "menu_canvas"
-	bind $name <$modifier-Shift-Key-D>  "menu_vradio"
-	bind $name <$modifier-Shift-Key-H>  "menu_hslider"
-	bind $name <$modifier-Shift-Key-I>  "menu_hradio"
-	bind $name <$modifier-Shift-Key-N>  "menu_number2"
-	bind $name <$modifier-Shift-Key-S>  "menu_saveas $name"
-	bind $name <$modifier-Shift-Key-T>  "menu_toggle"
-	bind $name <$modifier-Shift-Key-U>  "menu_vumeter"
-	bind $name <$modifier-Shift-Key-V>  "menu_vslider"
+	bind $name <$modifier-Shift-Key-B>  "pdsend \"$name bng 1 ;\""
+	bind $name <$modifier-Shift-Key-C>  "pdsend \"$name mycnv 1 ;\""
+	bind $name <$modifier-Shift-Key-D>  "pdsend \"$name vradio 1 ;\""
+	bind $name <$modifier-Shift-Key-H>  "pdsend \"$name hslider 1 ;\""
+	bind $name <$modifier-Shift-Key-I>  "pdsend \"$name hradio 1 ;\""
+	bind $name <$modifier-Shift-Key-N>  "pdsend \"$name numbox 1 ;\""
+	bind $name <$modifier-Shift-Key-S>  "pdsend \"$name menusaveas ;\""
+	bind $name <$modifier-Shift-Key-T>  "pdsend \"$name toggle 1 ;\""
+	bind $name <$modifier-Shift-Key-U>  "pdsend \"$name vumeter 1 ;\""
+	bind $name <$modifier-Shift-Key-V>  "pdsend \"$name vslider 1 ;\""
 	bind $name <$modifier-Shift-Key-Z>  "menu_redo $name"
 	
 	if {[tk windowingsystem] eq "aqua"} {
@@ -109,8 +112,8 @@
 		bind $name <$modifier-Key-t>    "menu_font $name"
         bind $name <$modifier-quoteleft> "menu_raisenextwindow"
 	} else {
-		bind $name <$modifier-Key-m>    "menu_send $name"
-		bind $name <$modifier-Key-t>    "menu_texteditor $name"
+		bind $name <$modifier-Key-m>    "menu_send"
+		bind $name <$modifier-Key-t>    "menu_texteditor"
 	}
 
 	# mouse bindings -----------------------------------------------------------
@@ -142,6 +145,6 @@
 	#bind $name <FocusIn> {pdtk_canvaswindowmaintenance}
 
 	# window protocol bindings
-    wm protocol $name WM_DELETE_WINDOW "menu_close $name"
+    wm protocol $name WM_DELETE_WINDOW "pdsend \"$name menuclose 0 ;\""
 }
 

Modified: branches/pd-devel/0.41.4/src/pd_connect.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pd_connect.tcl	2009-01-13 04:18:07 UTC (rev 10525)
+++ branches/pd-devel/0.41.4/src/pd_connect.tcl	2009-01-13 06:46:55 UTC (rev 10526)
@@ -6,7 +6,7 @@
 
 	namespace export to_pd
 	namespace export create_socket
-	namespace export pd
+	namespace export pdsend
 }
 
 proc ::pd_connect::configure_socket {sock} {
@@ -16,6 +16,7 @@
 
 # if pd opens first, it starts pd-gui, then pd-gui connects to port 5400
 proc ::pd_connect::to_pd {port} {
+	puts "::pd_connect::to_pd"
 	variable pd_socket
 	puts stderr "Connecting to localhost $port ..."
 	if {[catch {set pd_socket [socket localhost $port]}]} {
@@ -29,6 +30,7 @@
 # if pd-gui opens first, it creates socket, and pd connects to port 5600. If
 # it can't create, then it keeps adding 1 to the port and tries again
 proc ::pd_connect::create_socket {} {
+	puts "::pd_connect::create_socket"
 	if {[catch {set sock [socket -server ::pd_connect::from_pd -myaddr localhost 0]}]} {
 		puts stderr "ERROR: failed to allocate port, exiting!"
 		exit 3
@@ -38,24 +40,27 @@
 }
 
 proc ::pd_connect::from_pd {channel clientaddr clientport} {
+	puts "::pd_connect::from_pd"
 	variable pd_socket $channel
 	puts "Connection from $clientaddr:$clientport registered"
 	::pd_connect::configure_socket $pd_socket
 }
 
-# send a message from Tcl to Pd
-proc ::pd_connect::pd {message} {
+# send a pd/FUDI message from Tcl to Pd. This function aims to behave like a
+# [send] in Pd, except the first argument is the name to send to.
+proc ::pd_connect::pdsend {message} { # 'args' is special, it gets everything
+	puts "pdsend $message"
 	variable pd_socket
-	if {[catch {puts $pd_socket $message}]} {
+	if {[catch {puts $pd_socket $message} errorname]} {
+		puts stderr "pdsend errorname: >>$errorname<<"
 		error "Not connected to 'pd' process"
 	}
 }
 
-# figure out which namespace the eval is using... this probably needs to be
-# global so that eval runs in the global namespace
+# TODO exit if the other side drops the socket
+# TODO this currently drops whitespace, like tabs
 proc ::pd_connect::pd_readsocket {cmd_from_pd} {
 	variable pd_socket
-#	if {$cmd_from_pd == ""} {puts stderr "called with blank args aka READABLE"}
 	append cmd_from_pd [gets $pd_socket]
 	puts stderr "cmd_from_pd: $cmd_from_pd"
 	if {[catch {uplevel #0 $cmd_from_pd} errorname]} {

Modified: branches/pd-devel/0.41.4/src/pd_iemgui.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pd_iemgui.tcl	2009-01-13 04:18:07 UTC (rev 10525)
+++ branches/pd-devel/0.41.4/src/pd_iemgui.tcl	2009-01-13 06:46:55 UTC (rev 10526)
@@ -364,7 +364,7 @@
     set hhhrcv [pdtk_unspace $hhhrcv]
     set hhhgui_nam [pdtk_unspace $hhhgui_nam]
     
-    pd [concat $id dialog \
+    pdsend [concat $id dialog \
 			[eval concat $$var_iemgui_wdt] \
 			[eval concat $$var_iemgui_hgt] \
 			[eval concat $$var_iemgui_min_rng] \
@@ -386,7 +386,7 @@
 			\;]
 }
 
-proc ::pd_iemgui::cancel {id} {pd [concat $id cancel \;]}
+proc ::pd_iemgui::cancel {id} {pdsend "$id cancel ;"}
 
 proc ::pd_iemgui::ok {id} {
     ::pd_iemgui::apply $id

Modified: branches/pd-devel/0.41.4/src/pd_menucommands.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pd_menucommands.tcl	2009-01-13 04:18:07 UTC (rev 10525)
+++ branches/pd-devel/0.41.4/src/pd_menucommands.tcl	2009-01-13 06:46:55 UTC (rev 10526)
@@ -33,9 +33,9 @@
 proc ::pd_menucommands::menu_new {} {
     variable untitled_number
     variable untitled_directory
-    pd [concat pd filename Untitled-$untitled_number $untitled_directory \;]
-    pd "#N canvas ;"
-	pd "#X pop 1 ;"
+    pdsend "pd filename Untitled-$untitled_number $untitled_directory ;"
+    pdsend "#N canvas ;"
+	pdsend "#X pop 1 ;"
     set untitled_number [expr $untitled_number + 1]
 }
 
@@ -49,141 +49,31 @@
 	}
 }
 
-proc ::pd_menucommands::menu_close {name} {
-    pd "$name menuclose 0 ;"
+proc ::pd_menucommands::menu_send {} {
+	toplevel .sendpanel
+	wm title .sendpanel "Send message"
+	# TODO insert real send panel here
 }
 
-proc ::pd_menucommands::menu_save {name} {
-    pd "$name menusave ;"
+proc ::pd_menucommands::menu_print {name} {
+    set filename [tk_getSaveFile -initialfile pd.ps \
+                      -defaultextension .ps \
+                      -filetypes { {{postscript} {.ps}} }]
+    if {$filename != ""} {
+        $name.c postscript -file $filename 
+    }
 }
 
-proc ::pd_menucommands::menu_saveas {name} {
-    pd "$name menusaveas ;"
-}
-
-proc menu_really_quit {} {
-	pd "pd quit ;"
-}
-
-proc menu_quit {} {
-	pd "pd verifyquit ;"
-}
-
 # ------------------------------------------------------------------------------
 # functions called from Edit menu
 
-proc ::pd_menucommands::menu_cut {name} {
-    pd "$name cut ;"
-}
-
-proc ::pd_menucommands::menu_copy {name} {
-    pd "$name copy ;"
-}
-
-proc ::pd_menucommands::menu_paste {name} {
-    pd "$name paste ;"
-}
-
-proc ::pd_menucommands::menu_duplicate {name} {
-    pd "$name duplicate ;"
-}
-
-proc ::pd_menucommands::menu_selectall {name} {
-    pd "$name selectall ;"
-}
-
-proc ::pd_menucommands::menu_texteditor {name} {
-    pd "$name texteditor ;"
-}
-
-proc ::pd_menucommands::menu_font {name} {
-    pd "$name menufont ;"
-}
-
-proc ::pd_menucommands::menu_tidyup {name} {
-    pd "$name tidy ;"
-}
-
-proc ::pd_menucommands::menu_editmode {name} {
-    pd "$name editmode 0 ;"
-}
-
 proc ::pd_menucommands::menu_preferences {args} {
 	toplevel .preferences
 	wm title .preferences "Preferences"
 	# TODO insert real preference panel here
 }
 
-
 # ------------------------------------------------------------------------------
-# functions called from Put menu
-
-proc ::pd_menucommands::menu_object {name accel} {
-    pd "$name obj $accel ;"
-}
-
-proc ::pd_menucommands::menu_message {name accel} {
-    pd "$name msg $accel ;"
-}
-
-proc ::pd_menucommands::menu_floatatom {name accel} {
-    pd "$name floatatom $accel ;"
-}
-
-proc ::pd_menucommands::menu_symbolatom {name accel} {
-    pd "$name symbolatom $accel ;"
-}
-
-proc ::pd_menucommands::menu_comment {name accel} {
-    pd "$name text $accel ;"
-}
-
-proc ::pd_menucommands::menu_graph {name} {
-    pd "$name graph ;"
-}
-
-proc ::pd_menucommands::menu_array {name} {
-    pd "$name menuarray ;"
-}
-
-############iemlib##################
-proc ::pd_menucommands::menu_bng {name accel} {
-    pd "$name bng $accel ;"
-}
-
-proc ::pd_menucommands::menu_toggle {name accel} {
-    pd "$name toggle $accel ;"
-}
-
-proc ::pd_menucommands::menu_numbox {name accel} {
-    pd "$name numbox $accel ;"
-}
-
-proc ::pd_menucommands::menu_vslider {name accel} {
-    pd "$name vslider $accel ;"
-}
-
-proc ::pd_menucommands::menu_hslider {name accel} {
-    pd "$name hslider $accel ;"
-}
-
-proc ::pd_menucommands::menu_hradio {name accel} {
-    pd "$name hradio $accel ;"
-}
-
-proc ::pd_menucommands::menu_vradio {name accel} {
-    pd "$name vradio $accel ;"
-}
-
-proc ::pd_menucommands::menu_vumeter {name accel} {
-    pd "$name vumeter $accel ;"
-}
-
-proc ::pd_menucommands::menu_mycnv {name accel} {
-    pd "$name mycnv $accel ;"
-}
-
-# ------------------------------------------------------------------------------
 # window management functions
 
 

Modified: branches/pd-devel/0.41.4/src/pd_menus.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pd_menus.tcl	2009-01-13 04:18:07 UTC (rev 10525)
+++ branches/pd-devel/0.41.4/src/pd_menus.tcl	2009-01-13 06:46:55 UTC (rev 10526)
@@ -85,7 +85,7 @@
 	$rootmenu add  separator
 	$rootmenu add command -label [say "Close"]      -accelerator "$accelerator+W"
 	$rootmenu add command -label [say "Quit"]       -accelerator "$accelerator+Q" \
-		-command "menu_quit"
+		-command "pdsend \"pd verifyquit ;\""
 }
 
 # the "Edit", "Put", and "Find" menus do not have cross-platform differences
@@ -115,7 +115,7 @@
 	$rootmenu add  separator
 	$rootmenu add command -label [say "Close"]    -accelerator "$accelerator+W"
 	$rootmenu add command -label [say "Quit"]     -accelerator "$accelerator+Q"\
-		-command "menu_quit"
+		-command "pdsend \"pd verifyquit ;\""
 }
 
 # the "Edit", "Put", and "Find" menus do not have cross-platform differences
@@ -133,12 +133,12 @@
 # menu building functions
 proc ::pd_menus::create_file_menu {rootmenu name} {
 	[format create_file_menu_%s [tk windowingsystem]] $rootmenu
-	$rootmenu entryconfigure [say "new_file"]        -command "menu_new"
+	$rootmenu entryconfigure [say "new_file"]   -command "menu_new"
 	$rootmenu entryconfigure [say "Open"]       -command "menu_open"
-	$rootmenu entryconfigure [say "Save"]       -command "menu_save $name"
-	$rootmenu entryconfigure [say "Save As..."] -command "menu_saveas $name"
+	$rootmenu entryconfigure [say "Save"]       -command "pdsend \"$name menusave ;\""
+	$rootmenu entryconfigure [say "Save As..."] -command "pdsend \"$name menusaveas ;\""
 	#	$rootmenu entryconfigure "Revert*"    -command "menu_revert $name"
-	$rootmenu entryconfigure [say "Close"]      -command "menu_close $name"
+	$rootmenu entryconfigure [say "Close"]      -command "pdsend \"$name menuclose 0 ;\""
 	$rootmenu entryconfigure [say "Message"]    -command "menu_send"
 	$rootmenu entryconfigure [say "Print..."]   -command "menu_print $name"
 }
@@ -151,15 +151,15 @@
 		-command "menu_redo $name"
 	$rootmenu add  separator
 	$rootmenu add command -label [say "Cut"]        -accelerator "$accelerator+X" \
-		-command "menu_cut $name"
+		-command "pdsend \"$name cut ;\""
 	$rootmenu add command -label [say "Copy"]       -accelerator "$accelerator+C" \
-		-command "menu_copy $name"
+		-command "pdsend \"$name copy ;\""
 	$rootmenu add command -label [say "Paste"]      -accelerator "$accelerator+V" \
-		-command "menu_paste $name"
+		-command "pdsend \"$name paste ;\""
 	$rootmenu add command -label [say "Duplicate"]  -accelerator "$accelerator+D" \
-		-command "menu_duplicate $name"
+		-command "pdsend \"$name duplicate ;\""
 	$rootmenu add command -label [say "Select All"] -accelerator "$accelerator+A" \
-		-command "menu_selectall $name"
+		-command "pdsend \"$name selectall ;\""
 	$rootmenu add  separator
 	if {[tk windowingsystem] eq "aqua"} {
 		$rootmenu add command -label [say "Text Editor"] \
@@ -173,7 +173,7 @@
 			-command "menu_font $name"
 	}
 	$rootmenu add command -label [say "Tidy Up"] \
-		-command "menu_tidyup $name"
+		-command "pdsend \"$name tidy ;\""
 	$rootmenu add command -label [say "Toggle Console"] -accelerator "Shift+$accelerator+R" \
 		-command {.controls.switches.console invoke}
 	$rootmenu add command -label [say "Clear Console"] -accelerator "Shift+$accelerator+L" \
@@ -181,7 +181,7 @@
 	$rootmenu add  separator
 	$rootmenu add radiobutton -label [say "Edit Mode"] -accelerator "$accelerator+E" \
 		-indicatoron true -selectcolor grey85 \
-		-command "menu_editmode $name" \
+		-command "pdsend \"$name editmode ;\"" \
 		
 	#    if { $editable == 0 } {
 	#        $name.m.edit entryconfigure "Edit mode" -indicatoron false 
@@ -196,37 +196,37 @@
 proc ::pd_menus::create_put_menu {rootmenu name} {
 	variable accelerator
 	$rootmenu add command -label [say "Object"] -accelerator "$accelerator+1" \
-		-command "menu_object $name 0" 
+		-command "pdsend \"$name obj 0;\"" 
 	$rootmenu add command -label [say "Message"] -accelerator "$accelerator+2" \
-		-command "menu_message $name 0"
+		-command "pdsend \"$name msg 0;\""
 	$rootmenu add command -label [say "Number"] -accelerator "$accelerator+3" \
-		-command "menu_floatatom $name 0"
+		-command "pdsend \"$name floatatom  0;\""
 	$rootmenu add command -label [say "Symbol"] -accelerator "$accelerator+4" \
-		-command "menu_symbolatom $name 0"
+		-command "pdsend \"$name symbolatom  0;\""
 	$rootmenu add command -label [say "Comment"] -accelerator "$accelerator+5" \
-		-command "menu_comment $name 0"
+		-command "pdsend \"$name text  0;\""
 	$rootmenu add  separator
 	$rootmenu add command -label [say "Bang"]    -accelerator "Shift+$accelerator+B" \
-		-command "menu_bng $name 0"
+		-command "pdsend \"$name bng  0;\""
 	$rootmenu add command -label [say "Toggle"]  -accelerator "Shift+$accelerator+T" \
-		-command "menu_toggle $name 0"
+		-command "pdsend \"$name toggle  0;\""
 	$rootmenu add command -label [say "Number2"] -accelerator "Shift+$accelerator+N" \
-		-command "menu_numbox $name 0"
+		-command "pdsend \"$name numbox  0;\""
 	$rootmenu add command -label [say "Vslider"] -accelerator "Shift+$accelerator+V" \
-		-command "menu_vslider $name 0"
+		-command "pdsend \"$name vslider  0;\""
 	$rootmenu add command -label [say "Hslider"] -accelerator "Shift+$accelerator+H" \
-		-command "menu_hslider $name 0"
+		-command "pdsend \"$name hslider  0;\""
 	$rootmenu add command -label [say "Vradio"]  -accelerator "Shift+$accelerator+D" \
-		-command "menu_vradio $name 0"
+		-command "pdsend \"$name vradio  0;\""
 	$rootmenu add command -label [say "Hradio"]  -accelerator "Shift+$accelerator+I" \
-		-command "menu_hradio $name 0"
+		-command "pdsend \"$name hradio  0;\""
 	$rootmenu add command -label [say "VU Meter"] -accelerator "Shift+$accelerator+U"\
-		-command "menu_vumeter $name 0"
+		-command "pdsend \"$name vumeter  0;\""
 	$rootmenu add command -label [say "Canvas"]  -accelerator "Shift+$accelerator+C" \
-		-command "menu_mycnv $name 0"
+		-command "pdsend \"$name mycnv  0;\""
 	$rootmenu add  separator
-	$rootmenu add command -label Graph -command "menu_graph $name" 
-	$rootmenu add command -label Array -command "menu_array $name"
+	$rootmenu add command -label Graph -command "pdsend \"$name graph ;\"" 
+	$rootmenu add command -label Array -command "pdsend \"$name menuarray ;\""
 }
 
 proc ::pd_menus::create_find_menu {rootmenu name} {
@@ -234,17 +234,17 @@
 	$rootmenu add command -label [say "Find..."]    -accelerator "$accelerator+F" \
 		-command "menu_findobject $name"
 	$rootmenu add command -label [say "Find Again"] -accelerator "$accelerator+G" \
-		-command "menu_findagain $name"
+		-command "pdsend \"$name findagain ;\""
 	$rootmenu add command -label [say "Find last error"] \
-		-command "menu_finderror" 
+		-command "pdsend \"$name finderror ;\"" 
 }
 
 proc ::pd_menus::create_media_menu {rootmenu name} {
 	variable accelerator
 	$rootmenu add radiobutton -label [say "Compute Audio On"] -accelerator "$accelerator+/" \
-		-command "menu_audio 1" 
+		-command "pdsend \"pd dsp 1 ;\""
 	$rootmenu add radiobutton -label [say "Compute Audio Off"] -accelerator "$accelerator+." \
-		-command "menu_audio 0" -indicatoron true
+		-command "pdsend \"pd dsp 0 ;\"" -indicatoron true 
 	$rootmenu add  separator    
 	$rootmenu add command -label [say "Test Audio and MIDI"] \
 		-command "menu_doc_open doc/7.stuff/tools testtone.pd" 

Modified: branches/pd-devel/0.41.4/src/pdtk_canvas.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pdtk_canvas.tcl	2009-01-13 04:18:07 UTC (rev 10525)
+++ branches/pd-devel/0.41.4/src/pdtk_canvas.tcl	2009-01-13 06:46:55 UTC (rev 10526)
@@ -22,21 +22,21 @@
 # mouse usage
 
 proc pdtk_canvas_motion {canvasname x y mods} {
-    pd "[to_top $canvasname] motion [$canvasname canvasx $x] [$canvasname canvasy $y] $mods;"
+    pdsend "[to_top $canvasname] motion [$canvasname canvasx $x] [$canvasname canvasy $y] $mods;"
 }
 
 proc pdtk_canvas_mouse {canvasname x y b f} {
 	# TODO perhaps the Tcl/C function names should match "mouse" message
 	# rather than "mousedown" function
-    pd "[to_top $canvasname] mouse [$canvasname canvasx $x] [$canvasname canvasy $y] $b $f;"
+    pdsend "[to_top $canvasname] mouse [$canvasname canvasx $x] [$canvasname canvasy $y] $b $f;"
 }
 
 proc pdtk_canvas_mouseup {canvasname x y b} {
-    pd "[to_top $canvasname] mouseup [$canvasname canvasx $x] [$canvasname canvasy $y] $b;"
+    pdsend "[to_top $canvasname] mouseup [$canvasname canvasx $x] [$canvasname canvasy $y] $b;"
 }
 
 proc pdtk_canvas_rightclick {canvasname x y b} {
-    pd "[to_top $canvasname] mouse [$canvasname canvasx $x] [$canvasname canvasy $y] $b 8;"
+    pdsend "[to_top $canvasname] mouse [$canvasname canvasx $x] [$canvasname canvasy $y] $b 8;"
 }
 
 # on X11, button 2 "pastes" from the X windows clipboard
@@ -53,11 +53,11 @@
 # invisible (arg is "").  Invisibility means the Window Manager has minimized
 # us.  We don't get a final "unmap" event when we destroy the window.
 proc pdtk_canvas_map {name} {
-    pd "$name map 1 ;"
+    pdsend "$name map 1 ;"
 }
 
 proc pdtk_canvas_unmap {name} {
-    pd "$name map 0 ;"
+    pdsend "$name map 0 ;"
 }
 
 # check or uncheck the "edit" menu item

Modified: branches/pd-devel/0.41.4/src/pkgIndex.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pkgIndex.tcl	2009-01-13 04:18:07 UTC (rev 10525)
+++ branches/pd-devel/0.41.4/src/pkgIndex.tcl	2009-01-13 06:46:55 UTC (rev 10526)
@@ -8,6 +8,7 @@
 # script is sourced, the variable $dir must contain the
 # full path name of this file's directory.
 
+package ifneeded apple_events 0.1 [list source [file join $dir apple_events.tcl]]
 package ifneeded pd_bindings 0.1 [list source [file join $dir pd_bindings.tcl]]
 package ifneeded pd_connect 0.1 [list source [file join $dir pd_connect.tcl]]
 package ifneeded pd_iemgui 0.1 [list source [file join $dir pd_iemgui.tcl]]

Modified: branches/pd-devel/0.41.4/src/wheredoesthisgo.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/wheredoesthisgo.tcl	2009-01-13 04:18:07 UTC (rev 10525)
+++ branches/pd-devel/0.41.4/src/wheredoesthisgo.tcl	2009-01-13 06:46:55 UTC (rev 10526)
@@ -28,7 +28,7 @@
     set pd_opendir $directory
     set basename [string range $filename [expr [string last / $filename] + 1] end]
     if {[string last .pd $filename] >= 0} {
-        pd "pd open [pdtk_enquote $basename] [pdtk_enquote $directory] ;"
+        pdsend "pd open [pdtk_enquote $basename] [pdtk_enquote $directory] ;"
     }
 }
 


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