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

eighthave at users.sourceforge.net eighthave at users.sourceforge.net
Thu Jan 8 03:29:19 CET 2009


Revision: 10480
          http://pure-data.svn.sourceforge.net/pure-data/?rev=10480&view=rev
Author:   eighthave
Date:     2009-01-08 02:29:19 +0000 (Thu, 08 Jan 2009)

Log Message:
-----------
- added placeholder proc to allow executing without constant errors, while
  retaining existing code

- created package for post

- created wheredoesthisgo package to for functions that are useful, but don't
  fit into a package yet

- wrestled unsuccessfully with pkg_mkIndex

- replaced more {} quotes with "" on menu commands

Modified Paths:
--------------
    branches/pd-devel/0.41.4/src/make_pkgIndex.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_menucommands.tcl
    branches/pd-devel/0.41.4/src/pd_menus.tcl
    branches/pd-devel/0.41.4/src/pkgIndex.tcl

Added Paths:
-----------
    branches/pd-devel/0.41.4/src/pd_post.tcl
    branches/pd-devel/0.41.4/src/wheredoesthisgo.tcl

Modified: branches/pd-devel/0.41.4/src/make_pkgIndex.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/make_pkgIndex.tcl	2009-01-08 01:11:05 UTC (rev 10479)
+++ branches/pd-devel/0.41.4/src/make_pkgIndex.tcl	2009-01-08 02:29:19 UTC (rev 10480)
@@ -1,5 +1,9 @@
 #!/usr/bin/tclsh
 
-pkg_mkIndex -verbose [pwd] *.tcl
+puts stdout "Watch out, this doesn't work on packages with namespace import"
+pkg_mkIndex -lazy -verbose -- [pwd] *.tcl *.[info sharedlibextension]
 
+## this currently needs to be added to pkg_mkIndex manually, ug
+#package ifneeded pd_menus 0.1 [list source [file join $dir pd_menus.tcl]]
 
+

Modified: branches/pd-devel/0.41.4/src/pd.tk
===================================================================
--- branches/pd-devel/0.41.4/src/pd.tk	2009-01-08 01:11:05 UTC (rev 10479)
+++ branches/pd-devel/0.41.4/src/pd.tk	2009-01-08 02:29:19 UTC (rev 10480)
@@ -3,6 +3,7 @@
 # WARRANTIES, see the file, "LICENSE.txt," in this distribution.
 # Copyright (c) 1997-2009 Miller Puckette.
 
+package require Tcl 8.3
 package require Tk
 
 ## replace Tk widgets with Ttk widgets
@@ -10,14 +11,17 @@
 #namespace import -force ttk::*
 
 # set . as first dir in auto_path
-#set auto_path [linsert $auto_path 0 "/Users/hans/code/pure-data/branches/pd-devel/0.41.4/src"]
 set auto_path [linsert $auto_path 0 "."]
 
 package require pd_connect
 package require pd_menus
 package require pd_bindings
+package require pd_post
+# TODO eliminate this kludge:
+package require wheredoesthisgo
 
-# import 'pd' into the global namespace for backwards compatibility
+# import into the global namespace for backwards compatibility
+namespace import ::pd_post::pdtk_post
 namespace import ::pd_connect::pd
 
 # ------------------------------------------------------------------------------
@@ -88,12 +92,6 @@
 	# TODO what else is needed from the original?
 }
 
-
-proc pdtk_post {s} {
-	# TODO this should be switchable between Pd window and stderr
-	puts stderr $s
-}
-
 # ------------------------------------------------------------------------------
 # kludges to avoid changing C code
 

Modified: branches/pd-devel/0.41.4/src/pd_bindings.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pd_bindings.tcl	2009-01-08 01:11:05 UTC (rev 10479)
+++ branches/pd-devel/0.41.4/src/pd_bindings.tcl	2009-01-08 02:29:19 UTC (rev 10480)
@@ -1,18 +1,21 @@
 package provide pd_bindings 0.1
 
 package require pd_menucommands
+package require pd_post
 
 namespace eval ::pd_bindings:: {
+	variable modifier
+
+	namespace export window_bindings
+	namespace export panel_bindings
+	namespace export canvas_bindings
+
 	# for key bindings
 	if {[tk windowingsystem] eq "aqua"} {
-		variable modifier "Mod1"
+		set modifier "Mod1"
 	} else {
-		variable modifier "Control"
+		set modifier "Control"
 	}
-
-	namespace export window_bindings
-	namespace export panel_bindings
-	namespace export canvas_bindings
 }
 
 proc ::pd_bindings::window_bindings {name} {
@@ -43,7 +46,7 @@
 	bind . <$modifier-Key-x> "tk_textCut .printout.text"
 	bind . <$modifier-Key-c> "tk_textCopy .printout.text"
 	bind . <$modifier-Key-v> "tk_textPaste .printout.text"
-	bind . <$modifier-Key-w> {pdtk_post "Can't close Pd window, ignored.\n"}
+	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"

Modified: branches/pd-devel/0.41.4/src/pd_menucommands.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pd_menucommands.tcl	2009-01-08 01:11:05 UTC (rev 10479)
+++ branches/pd-devel/0.41.4/src/pd_menucommands.tcl	2009-01-08 02:29:19 UTC (rev 10480)
@@ -1,8 +1,7 @@
 
 package provide pd_menucommands 0.1
 
-# ------------------------------------------------------------------------------
-# PLACEHOLDERS
+package require pd_post
 
 namespace eval ::pd_menucommands:: {
     variable untitled_number "1"
@@ -11,19 +10,6 @@
 	namespace export menu_*
 }
 
-proc ::pd_menucommands::menu_doc_open {docdir doc} {
-	# PLACEHOLDER
-}
-
-proc ::pd_menucommands::menu_helpbrowser {dir} {
-	# PLACEHOLDER
-}
-
-proc ::pd_menucommands::menu_quit {} {
-	# PLACEHOLDER
-	exit
-}
-
 # ------------------------------------------------------------------------------
 # Mac OS X specific functions
 

Modified: branches/pd-devel/0.41.4/src/pd_menus.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pd_menus.tcl	2009-01-08 01:11:05 UTC (rev 10479)
+++ branches/pd-devel/0.41.4/src/pd_menus.tcl	2009-01-08 02:29:19 UTC (rev 10480)
@@ -3,33 +3,36 @@
 
 package provide pd_menus 0.1
 
+package require pd_menucommands
+package require pd_say
 package require Tk
 #package require tile
 ## replace Tk widgets with Ttk widgets on 8.5
 #namespace import -force ttk::*
 
-package require pd_menucommands
-package require pd_say
-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
+# TODO what is the Tcl package constructor or init()?
 
+	
+
 # ------------------------------------------------------------------------------
 # global variables
 
-# for displaying on menus
+# TODO this should properly be inside the pd_menus namespace, now it is global
+namespace import ::pd_menucommands::* 
 
 namespace eval ::pd_menus:: {
-	# TODO this should be only a variable declaration with the if in some kind of init()
+	variable accelerator
+	
+	namespace export create_menubar
+	namespace export configure_pdwindow
+
 	if {[tk windowingsystem] eq "aqua"} {
-		variable accelerator "Meta"
+		set accelerator "Meta"
 	} else {
-		variable accelerator "Ctrl"
+		set accelerator "Ctrl"
 	}
-	
-	namespace export create_menubar
-	namespace export configure_pdwindow
 }
 
 # ------------------------------------------------------------------------------
@@ -79,7 +82,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 "menu_quit"
 }
 
 # the "Edit", "Put", and "Find" menus do not have cross-platform differences
@@ -109,7 +112,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 "menu_quit"
 }
 
 # the "Edit", "Put", and "Find" menus do not have cross-platform differences
@@ -127,55 +130,55 @@
 # 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 "Open"]       -command {menu_open}
-	$rootmenu entryconfigure [say "Save"]       -command {menu_save $name}
-	$rootmenu entryconfigure [say "Save As..."] -command {menu_saveas $name}
-	#	$rootmenu entryconfigure "Revert*"    -command {menu_revert $name}
-	$rootmenu entryconfigure [say "Close"]      -command [concat menu_close $name]
-	$rootmenu entryconfigure [say "Message"]    -command {menu_send}
-	$rootmenu entryconfigure [say "Print..."]   -command {menu_print $name}
+	$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 "Revert*"    -command "menu_revert $name"
+	$rootmenu entryconfigure [say "Close"]      -command "menu_close $name"
+	$rootmenu entryconfigure [say "Message"]    -command "menu_send"
+	$rootmenu entryconfigure [say "Print..."]   -command "menu_print $name"
 }
 
 proc ::pd_menus::create_edit_menu {rootmenu name} {
 	variable accelerator
 	$rootmenu add command -label [say "Undo"]       -accelerator "$accelerator+Z" \
-		-command {menu_undo $name}
+		-command "menu_undo $name"
 	$rootmenu add command -label [say "Redo"]       -accelerator "Shift+$accelerator+Z" \
-		-command {menu_redo $name}
+		-command "menu_redo $name"
 	$rootmenu add  separator
 	$rootmenu add command -label [say "Cut"]        -accelerator "$accelerator+X" \
-		-command {menu_cut $name}
+		-command "menu_cut $name"
 	$rootmenu add command -label [say "Copy"]       -accelerator "$accelerator+C" \
-		-command {menu_copy $name}
+		-command "menu_copy $name"
 	$rootmenu add command -label [say "Paste"]      -accelerator "$accelerator+V" \
-		-command {menu_paste $name}
+		-command "menu_paste $name"
 	$rootmenu add command -label [say "Duplicate"]  -accelerator "$accelerator+D" \
-		-command {menu_duplicate $name}
+		-command "menu_duplicate $name"
 	$rootmenu add command -label [say "Select All"] -accelerator "$accelerator+A" \
-		-command {menu_selectall $name}
+		-command "menu_selectall $name"
 	$rootmenu add  separator
 	if {[tk windowingsystem] eq "aqua"} {
 		$rootmenu add command -label [say "Text Editor"] \
-			-command {menu_texteditor $name}
+			-command "menu_texteditor $name"
 		$rootmenu add command -label [say "Font"]  -accelerator "$accelerator+T" \
-			-command {menu_font $name}
+			-command "menu_font $name"
 	} else {
 		$rootmenu add command -label [say "Text Editor"] -accelerator "$accelerator+T"\
-			-command {menu_texteditor $name}
+			-command "menu_texteditor $name"
 		$rootmenu add command -label [say "Font"] \
-			-command {menu_font $name}
+			-command "menu_font $name"
 	}
 	$rootmenu add command -label [say "Tidy Up"] \
-		-command {menu_tidyup $name}
+		-command "menu_tidyup $name"
 	$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" \
-		-command {menu_clear_console}
+		-command "menu_clear_console"
 	$rootmenu add  separator
 	$rootmenu add radiobutton -label [say "Edit Mode"] -accelerator "$accelerator+E" \
 		-indicatoron true -selectcolor grey85 \
-		-command {menu_editmode $name} \
+		-command "menu_editmode $name" \
 		
 	#    if { $editable == 0 } {
 	#        $name.m.edit entryconfigure "Edit mode" -indicatoron false 
@@ -185,72 +188,72 @@
 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 "menu_object $name 0" 
 	$rootmenu add command -label [say "Message"] -accelerator "$accelerator+2" \
-		-command {menu_message $name 0}
+		-command "menu_message $name 0"
 	$rootmenu add command -label [say "Number"]  -accelerator "$accelerator+3" \
-		-command {menu_floatatom $name 0}
+		-command "menu_floatatom $name 0"
 	$rootmenu add command -label [say "Symbol"]  -accelerator "$accelerator+4" \
-		-command {menu_symbolatom $name 0}
+		-command "menu_symbolatom $name 0"
 	$rootmenu add command -label [say "Comment"] -accelerator "$accelerator+5" \
-		-command {menu_comment $name 0}
+		-command "menu_comment $name 0"
 	$rootmenu add  separator
 	$rootmenu add command -label [say "Bang"]    -accelerator "Shift+$accelerator+B" \
-		-command {menu_bng $name 0}
+		-command "menu_bng $name 0"
 	$rootmenu add command -label [say "Toggle"]  -accelerator "Shift+$accelerator+T" \
-		-command {menu_toggle $name 0}
+		-command "menu_toggle $name 0"
 	$rootmenu add command -label [say "Number2"] -accelerator "Shift+$accelerator+N" \
-		-command {menu_numbox $name 0}
+		-command "menu_numbox $name 0"
 	$rootmenu add command -label [say "Vslider"] -accelerator "Shift+$accelerator+V" \
-		-command {menu_vslider $name 0}
+		-command "menu_vslider $name 0"
 	$rootmenu add command -label [say "Hslider"] -accelerator "Shift+$accelerator+H" \
-		-command {menu_hslider $name 0}
+		-command "menu_hslider $name 0"
 	$rootmenu add command -label [say "Vradio"]  -accelerator "Shift+$accelerator+D" \
-		-command {menu_vradio $name 0}
+		-command "menu_vradio $name 0"
 	$rootmenu add command -label [say "Hradio"]  -accelerator "Shift+$accelerator+I" \
-		-command {menu_hradio $name 0}
+		-command "menu_hradio $name 0"
 	$rootmenu add command -label [say "VU Meter"] -accelerator "Shift+$accelerator+U"\
-		-command {menu_vumeter $name 0}
+		-command "menu_vumeter $name 0"
 	$rootmenu add command -label [say "Canvas"]  -accelerator "Shift+$accelerator+C" \
-		-command {menu_mycnv $name 0}
+		-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}
+	$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 [say "Find..."]    -accelerator "$accelerator+F" \
-		-command {menu_findobject $name}
+		-command "menu_findobject $name"
 	$rootmenu add command -label [say "Find Again"] -accelerator "$accelerator+G" \
-		-command {menu_findagain $name}
+		-command "menu_findagain $name"
 	$rootmenu add command -label [say "Find last error"] \
-		-command {menu_finderror} 
+		-command "menu_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 "menu_audio 1" 
 	$rootmenu add radiobutton -label [say "Compute Audio Off"] -accelerator "$accelerator+." \
-		-command {menu_audio 0} -indicatoron true
+		-command "menu_audio 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} 
+		-command "menu_doc_open doc/7.stuff/tools testtone.pd" 
 	$rootmenu add command -label [say "Load Meter"] \
-		-command {menu_doc_open doc/7.stuff/tools load-meter.pd} 
+		-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 [say "Minimize"] -command {menu_minimize .} \
+		$rootmenu add command -label [say "Minimize"] -command "menu_minimize ." \
 			-accelerator "$accelerator+M"
-		$rootmenu add command -label [say "Zoom"] -command {menu_zoom .}
+		$rootmenu add command -label [say "Zoom"] -command "menu_zoom ."
 		$rootmenu add  separator
 	}
 	$rootmenu add command -label [say "Parent Window"] -state disabled
-	$rootmenu add command -label [say "Pd window"] -command {menu_raise_console} \
+	$rootmenu add command -label [say "Pd window"] -command "menu_raise_console" \
 		-accelerator "$accelerator+R" -state disabled
 	$rootmenu add  separator
 }
@@ -258,17 +261,17 @@
 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} 
+			-command "placeholder menu_doc_open doc/1.manual 1.introduction.txt" 
 	}
 	$rootmenu add command -label {HTML ...} \
-		-command {menu_doc_open doc/1.manual index.htm}
+		-command "placeholder menu_doc_open doc/1.manual index.htm"
 	$rootmenu add command -label {Browser ...} \
-		-command {menu_helpbrowser $help_top_directory} 
+		-command "placeholder menu_helpbrowser \$help_top_directory" 
 }
 
 proc ::pd_menus::create_apple_menu {rootmenu name} {
 	$rootmenu add command -label [say "About Pd..."] -command \
-		{menu_doc_open doc/1.manual 1.introduction.txt} 
+		"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 [say "Path..."] \

Added: branches/pd-devel/0.41.4/src/pd_post.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pd_post.tcl	                        (rev 0)
+++ branches/pd-devel/0.41.4/src/pd_post.tcl	2009-01-08 02:29:19 UTC (rev 10480)
@@ -0,0 +1,13 @@
+
+package provide pd_post 0.1
+
+namespace eval ::pd_post:: {
+
+	namespace export pdtk_post
+}
+
+proc ::pd_post::pdtk_post {message} {
+	# TODO this should be switchable between Pd window and stderr
+	puts stderr $message
+}
+

Modified: branches/pd-devel/0.41.4/src/pkgIndex.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pkgIndex.tcl	2009-01-08 01:11:05 UTC (rev 10479)
+++ branches/pd-devel/0.41.4/src/pkgIndex.tcl	2009-01-08 02:29:19 UTC (rev 10480)
@@ -1,5 +1,5 @@
 # Tcl package index file, version 1.1
-# This file is generated by the "pkg_mkIndex" command
+# This file is generated by the "pkg_mkIndex -lazy" 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
@@ -8,9 +8,11 @@
 # script is sourced, the variable $dir must contain the
 # full path name of this file's directory.
 
-package ifneeded pd_bindings 0.1 [list source [file join $dir pd_bindings.tcl]]
-package ifneeded pd_iemgui 0.1 [list source [file join $dir pd_iemgui.tcl]]
-package ifneeded pd_menucommands 0.1 [list source [file join $dir pd_menucommands.tcl]]
+package ifneeded pd_bindings 0.1 [list tclPkgSetup $dir pd_bindings 0.1 {{pd_bindings.tcl source {::pd_bindings::canvas_bindings ::pd_bindings::panel_bindings ::pd_bindings::window_bindings}}}]
+package ifneeded pd_connect 0.1 [list tclPkgSetup $dir pd_connect 0.1 {{pd_connect.tcl source {::pd_connect::connect_to_pd ::pd_connect::pd}}}]
+package ifneeded pd_iemgui 0.1 [list tclPkgSetup $dir pd_iemgui 0.1 {{pd_iemgui.tcl source ::pd_iemgui::pdtk_iemgui_dialog}}]
+package ifneeded pd_menucommands 0.1 [list tclPkgSetup $dir pd_menucommands 0.1 {{pd_menucommands.tcl source {::pd_menucommands::menu_bringalltofront ::pd_menucommands::menu_close ::pd_menucommands::menu_maximize ::pd_menucommands::menu_minimize ::pd_menucommands::menu_new ::pd_menucommands::menu_open}}}]
+package ifneeded pd_post 0.1 [list tclPkgSetup $dir pd_post 0.1 {{pd_post.tcl source ::pd_post::pdtk_post}}]
+package ifneeded pd_say 0.1 [list tclPkgSetup $dir pd_say 0.1 {{pd_say.tcl source {init_locale say say2 say_category say_namespace}}}]
+package ifneeded wheredoesthisgo 0.1 [list tclPkgSetup $dir wheredoesthisgo 0.1 {{wheredoesthisgo.tcl source placeholder}}]
 package ifneeded pd_menus 0.1 [list source [file join $dir pd_menus.tcl]]
-package ifneeded pd_say 0.1 [list source [file join $dir pd_say.tcl]]
-package ifneeded pd_connect 0.1 [list source [file join $dir pd_connect.tcl]]

Added: branches/pd-devel/0.41.4/src/wheredoesthisgo.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/wheredoesthisgo.tcl	                        (rev 0)
+++ branches/pd-devel/0.41.4/src/wheredoesthisgo.tcl	2009-01-08 02:29:19 UTC (rev 10480)
@@ -0,0 +1,13 @@
+
+package provide wheredoesthisgo 0.1
+
+# a place to temporarily store things until they find a home
+
+set help_top_directory ""
+
+proc placeholder {args} {
+	# PLACEHOLDER
+	::pd_post::pdtk_post "PLACEHOLDER $args"
+}
+
+


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