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

eighthave at users.sourceforge.net eighthave at users.sourceforge.net
Wed Jan 14 00:17:20 CET 2009


Revision: 10544
          http://pure-data.svn.sourceforge.net/pure-data/?rev=10544&view=rev
Author:   eighthave
Date:     2009-01-13 23:17:19 +0000 (Tue, 13 Jan 2009)

Log Message:
-----------
- created placeholder panels for find, message, and preferences

- rename panel procs to be consistent

- rearranged key bindings to the above panels appropriately

- flushed out the apple events some after reading some Tcl source code

Modified Paths:
--------------
    branches/pd-devel/0.41.4/src/apple_events.tcl
    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

Modified: branches/pd-devel/0.41.4/src/apple_events.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/apple_events.tcl	2009-01-13 21:45:24 UTC (rev 10543)
+++ branches/pd-devel/0.41.4/src/apple_events.tcl	2009-01-13 23:17:19 UTC (rev 10544)
@@ -10,8 +10,9 @@
 set ::tk::mac::antialiasedtext 1
 
 # kAEOpenDocuments
-proc ::tk::mac::OpenDocument {} {
+proc ::tk::mac::OpenDocument {args} {
 	# TODO
+	# args will be a list of all the documents dropped on your app, or double-clicked
 }
 
 # kEventAppHidden
@@ -26,17 +27,25 @@
 
 # kAEShowPreferences
 proc ::tk::mac::ShowPreferences {} {
- 	puts "apple prefs menu item callback"
- 	puts "::tk::mac::ShowPreferences "
-	# TODO
- 	#menu_preferences
+ 	menu_preferences_panel
 }
 
 # kAEQuitApplication
-#proc exit {} {
-#	# TODO sort this out...
+#proc ::tk::mac::Quit {} {
+#	# TODO sort this out... how to quit pd-gui after sending the message
 #	puts stderr "Custom exit proc"
-#	# this proc overrides the built-in exit so we can grab the Quit event
 #	pdsend "pd verifyquit;"
-#	::exit
 #}
+
+# these I gleaned by reading the source (tkMacOSXHLEvents.c)
+proc ::tk::mac::PrintDocument {args} {
+	# TODO what's $mytoplevel here?.  I am guessing args would be the same as
+	# ::tk::mac::OpenDocument
+	#menu_print $mytoplevel
+}
+
+proc ::tk::mac::OpenApplication {} {
+}
+
+proc ::tk::mac::ReopenApplication {} {
+}

Modified: branches/pd-devel/0.41.4/src/pd_bindings.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pd_bindings.tcl	2009-01-13 21:45:24 UTC (rev 10543)
+++ branches/pd-devel/0.41.4/src/pd_bindings.tcl	2009-01-13 23:17:19 UTC (rev 10544)
@@ -24,16 +24,15 @@
 
 	# File menu
 	bind $mytoplevel <$modifier-Key-b>        "menu_helpbrowser"
+	bind $mytoplevel <$modifier-Key-f>        "menu_find_panel $mytoplevel"
 	bind $mytoplevel <$modifier-Key-n>        "menu_new"
 	bind $mytoplevel <$modifier-Key-o>        "menu_open"
 	bind $mytoplevel <$modifier-Key-p>        "menu_print $mytoplevel"
 	bind $mytoplevel <$modifier-Key-q>        "pdsend \"pd verifyquit ;\""
 	bind $mytoplevel <$modifier-Key-r>        "menu_raiseconsole"
-	bind $mytoplevel <$modifier-Key-w>        "pdsend \"$mytoplevel menuclose 0 ;\""
 	bind $mytoplevel <$modifier-Shift-Key-L>  "menu_clear_console"
 	bind $mytoplevel <$modifier-Shift-Key-Q>  "pdsend \"pd quit ;\""
 	bind $mytoplevel <$modifier-Shift-Key-R>  "menu_toggle_console"
-	bind $mytoplevel <$modifier-Shift-Key-W>  "pdsend \"$mytoplevel menuclose 1 ;\""
 
 	# DSP control
 	bind $mytoplevel <$modifier-Key-slash>    "pdsend \"pd dsp 1 ;\""
@@ -89,10 +88,10 @@
 	bind $mytoplevel <$modifier-Key-c>        "pdsend \"$mytoplevel copy ;\""
 	bind $mytoplevel <$modifier-Key-d>        "pdsend \"$mytoplevel duplicate ;\""
 	bind $mytoplevel <$modifier-Key-e>        "pdsend \"$mytoplevel editmode 0 ;\""
-	bind $mytoplevel <$modifier-Key-f>        "menu_findobject $mytoplevel"
 	bind $mytoplevel <$modifier-Key-g>        "pdsend \"$mytoplevel findagain ;\""
 	bind $mytoplevel <$modifier-Key-s>        "pdsend \"$mytoplevel menusave ;\""
 	bind $mytoplevel <$modifier-Key-v>        "pdsend \"$mytoplevel paste ;\""
+	bind $mytoplevel <$modifier-Key-w>        "pdsend \"$mytoplevel menuclose 0 ;\""
 	bind $mytoplevel <$modifier-Key-x>        "pdsend \"$mytoplevel cut ;\""
 	bind $mytoplevel <$modifier-Key-z>        "menu_undo $mytoplevel"
 	bind $mytoplevel <$modifier-Key-slash>    "pdsend \"pd dsp 1 ;\""
@@ -109,6 +108,7 @@
 	bind $mytoplevel <$modifier-Shift-Key-T> "pdsend \"$mytoplevel toggle 1 ;\""
 	bind $mytoplevel <$modifier-Shift-Key-U> "pdsend \"$mytoplevel vumeter 1 ;\""
 	bind $mytoplevel <$modifier-Shift-Key-V> "pdsend \"$mytoplevel vslider 1 ;\""
+	bind $mytoplevel <$modifier-Shift-Key-W> "pdsend \"$mytoplevel menuclose 1 ;\""
 	bind $mytoplevel <$modifier-Shift-Key-Z> "menu_redo $mytoplevel"
 	
 	if {$::windowingsystem eq "aqua"} {
@@ -116,7 +116,7 @@
 		bind $mytoplevel <$modifier-Key-t>   "menu_font $mytoplevel"
         bind $mytoplevel <$modifier-quoteleft> "menu_raisenextwindow"
 	} else {
-		bind $mytoplevel <$modifier-Key-m>    "menu_send"
+		bind $mytoplevel <$modifier-Key-m>    "menu_message_panel"
 		bind $mytoplevel <$modifier-Key-t>    "menu_texteditor"
 	}
 

Modified: branches/pd-devel/0.41.4/src/pd_menucommands.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pd_menucommands.tcl	2009-01-13 21:45:24 UTC (rev 10543)
+++ branches/pd-devel/0.41.4/src/pd_menucommands.tcl	2009-01-13 23:17:19 UTC (rev 10544)
@@ -49,12 +49,6 @@
 	}
 }
 
-proc ::pd_menucommands::menu_send {} {
-	toplevel .sendpanel
-	wm title .sendpanel "Send message"
-	# TODO insert real send panel here
-}
-
 proc ::pd_menucommands::menu_print {mytoplevel} {
     set filename [tk_getSaveFile -initialfile pd.ps \
                       -defaultextension .ps \
@@ -65,14 +59,54 @@
 }
 
 # ------------------------------------------------------------------------------
-# functions called from Edit menu
+# various panels
 
-proc ::pd_menucommands::menu_preferences {args} {
-	toplevel .preferences
-	wm title .preferences "Preferences"
-	# TODO insert real preference panel here
+proc ::pd_menucommands::menu_message_panel {} {
+	if {[winfo exists .message]} {
+		raise .message
+	} else {
+		# TODO insert real message panel here
+		toplevel .message
+		wm title .message "Message..."
+		::pd_bindings::panel_bindings .message
+		frame .message.frame
+		label .message.label -text "message" -width 30 -height 15
+		pack .message.label .message.frame -side top -expand yes -fill both
+	}
 }
 
+proc ::pd_menucommands::menu_find_panel {mytoplevel} {
+	if {[winfo exists .find]} {
+		raise .find
+	} else {
+		# TODO insert real find panel here
+		toplevel .find
+		wm title .find "Find..."
+		::pd_bindings::panel_bindings .find
+		frame .find.frame
+		label .find.label -text "find" -width 30 -height 15
+		pack .find.label .find.frame -side top -expand yes -fill both
+	}
+	# TODO this panel should probably receive <FocusIn> events so that it will
+	# find in which ever window has focus then "OK' is clicked.  It will need
+	# to filter out the Pd window, unless someone implements searching in the
+	# console text.  hmm that would be nice!
+}
+
+proc ::pd_menucommands::menu_preferences_panel {} {
+	if {[winfo exists .preferences]} {
+		raise .preferences
+	} else {
+		# TODO insert real preference panel here
+		toplevel .preferences
+		wm title .preferences "Preferences"
+		::pd_bindings::panel_bindings .preferences
+		frame .preferences.frame
+		label .preferences.label -text "preferences" -width 30 -height 15
+		pack .preferences.label .preferences.frame -side top -expand yes -fill both
+	}
+}
+
 # ------------------------------------------------------------------------------
 # 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 21:45:24 UTC (rev 10543)
+++ branches/pd-devel/0.41.4/src/pd_menus.tcl	2009-01-13 23:17:19 UTC (rev 10544)
@@ -84,7 +84,7 @@
 	$mymenu entryconfigure [say "Save As..."] -command "pdsend \"$mytoplevel menusaveas ;\""
 	#	$mymenu entryconfigure "Revert*"    -command "menu_revert $mytoplevel"
 	$mymenu entryconfigure [say "Close"]      -command "pdsend \"$mytoplevel menuclose 0 ;\""
-	$mymenu entryconfigure [say "Message"]    -command "menu_send"
+	$mymenu entryconfigure [say "Message"]    -command "menu_message_panel"
 	$mymenu entryconfigure [say "Print..."]   -command "menu_print $mytoplevel"
 }
 
@@ -138,7 +138,7 @@
 	if {$::windowingsystem ne "aqua"} {
 		$mymenu add  separator
 		$mymenu add command -label [say "Preferences"] \
-			-command "menu_preferences"
+			-command "menu_preferences_panel"
 	}
 }
 
@@ -181,7 +181,7 @@
 proc ::pd_menus::build_find_menu {mymenu mytoplevel} {
 	variable accelerator
 	$mymenu add command -label [say "Find..."]    -accelerator "$accelerator+F" \
-		-command "menu_findobject $mytoplevel"
+		-command "menu_find_panel $mytoplevel"
 	$mymenu add command -label [say "Find Again"] -accelerator "$accelerator+G" \
 		-command "pdsend \"$mytoplevel findagain ;\""
 	$mymenu add command -label [say "Find last error"] \
@@ -237,9 +237,9 @@
 	$mymenu.apple add command -label [say "About Pd"] \
 		-command "menu_doc_open doc/1.manual 1.introduction.txt" 
     $mymenu add cascade -label "Apple" -menu $mymenu.apple
+	$mymenu.apple add  separator
 	# starting in 8.4.14, this is created automatically
 	if {[regsub -- {[0-9]\.[0-9]\.([0-9][0-9]*)} [info patchlevel] {\1}] < 14} {
-		$mymenu.apple add separator
 		$mymenu.apple add command -label [say "Preferences..."] \
 			-command "menu_preferences" -accelerator "Cmd+,"
 	}


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