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

eighthave at users.sourceforge.net eighthave at users.sourceforge.net
Tue Jan 13 19:14:05 CET 2009


Revision: 10538
          http://pure-data.svn.sourceforge.net/pure-data/?rev=10538&view=rev
Author:   eighthave
Date:     2009-01-13 18:14:05 +0000 (Tue, 13 Jan 2009)

Log Message:
-----------
- renamed procs to make more sense:
     "create" procs actually create 'menu' widgets
     "build" procs build up a 'menu' widget to be a menu

- reordered so program flows from top to bottom

Modified Paths:
--------------
    branches/pd-devel/0.41.4/src/pd_menus.tcl

Modified: branches/pd-devel/0.41.4/src/pd_menus.tcl
===================================================================
--- branches/pd-devel/0.41.4/src/pd_menus.tcl	2009-01-13 18:11:48 UTC (rev 10537)
+++ branches/pd-devel/0.41.4/src/pd_menus.tcl	2009-01-13 18:14:05 UTC (rev 10538)
@@ -38,16 +38,18 @@
 	option add *tearOff 0
 }
 
+# ------------------------------------------------------------------------------
+# 
 proc ::pd_menus::create_menubar {mymenubar} {
 	menu $mymenubar
 	set menulist "file edit put find media window help"
-	if { [tk windowingsystem] eq "aqua" } {make_apple_menu $mymenubar}
-	if { [tk windowingsystem] eq "win32" } {make_system_menu $mymenubar}
+	if { [tk windowingsystem] eq "aqua" } {create_apple_menu $mymenubar}
+	if { [tk windowingsystem] eq "win32" } {create_system_menu $mymenubar}
 	foreach mymenu $menulist {	
 		menu $mymenubar.$mymenu
 		$mymenubar add cascade -label [string totitle $mymenu] \
 			-menu $mymenubar.$mymenu
-		[format create_%s_menu $mymenu] $mymenubar.$mymenu PLACEHOLDER
+		[format build_%s_menu $mymenu] $mymenubar.$mymenu PLACEHOLDER
 		if {[tk windowingsystem] eq "win32"} {
 			# fix menu font size on Windows with tk scaling = 1
 			$mymenubar.$mymenu configure -font menufont
@@ -72,9 +74,12 @@
 	}
 }
 
+# ------------------------------------------------------------------------------
+# menu building functions for Mac OS X/aqua
+
 # for Mac OS X only
-proc ::pd_menus::make_apple_menu {mymenu} {
-	puts stderr CREATE_APPLE_MENU
+proc ::pd_menus::create_apple_menu {mymenu} {
+	puts stderr BUILD_APPLE_MENU
 	# TODO this should open a Pd patch called about.pd
 	menu $mymenu.apple
 	$mymenu.apple add command -label [say "About Pd"] \
@@ -88,17 +93,7 @@
 	}
 }
 
-# for Windows only
-proc ::pd_menus::make_system_menu {mymenu} {
-	$mymenu add cascade -menu [menu $mymenu.system]
-	# TODO add Close, Minimize, etc and whatever else is on the little menu
-	# that is on the top left corner of the window frame
-}
-
-# ------------------------------------------------------------------------------
-# menu building functions for Mac OS X/aqua
-
-proc ::pd_menus::create_file_menu_aqua {mymenu} {
+proc ::pd_menus::build_file_menu_aqua {mymenu} {
 	variable accelerator
 	$mymenu add command -label [say "new_file"]  -accelerator "$accelerator+N"
 	$mymenu add command -label [say "Open"]      -accelerator "$accelerator+O"
@@ -117,10 +112,10 @@
 
 # the "Edit", "Put", and "Find" menus do not have cross-platform differences
 
-proc ::pd_menus::create_media_menu_aqua {mymenu} {
+proc ::pd_menus::build_media_menu_aqua {mymenu} {
 }
 
-proc ::pd_menus::create_window_menu_aqua {mymenu} {
+proc ::pd_menus::build_window_menu_aqua {mymenu} {
 }
 
 # the "Help" does not have cross-platform differences
@@ -128,7 +123,7 @@
 # ------------------------------------------------------------------------------
 # menu building functions for UNIX/X11
 
-proc ::pd_menus::create_file_menu_x11 {mymenu} {
+proc ::pd_menus::build_file_menu_x11 {mymenu} {
 	variable accelerator
 	$mymenu add command -label [say "new_file"]        -accelerator "$accelerator+N"
 	$mymenu add command -label [say "Open"]       -accelerator "$accelerator+O"
@@ -147,10 +142,10 @@
 
 # the "Edit", "Put", and "Find" menus do not have cross-platform differences
 
-proc ::pd_menus::create_media_menu_x11 {mymenu} {
+proc ::pd_menus::build_media_menu_x11 {mymenu} {
 }
 
-proc ::pd_menus::create_window_menu_x11 {mymenu} {
+proc ::pd_menus::build_window_menu_x11 {mymenu} {
 }
 
 # the "Help" does not have cross-platform differences
@@ -158,7 +153,14 @@
 # ------------------------------------------------------------------------------
 # menu building functions for Windows/Win32
 
-proc ::pd_menus::create_file_menu_win32 {mymenu} {
+# for Windows only
+proc ::pd_menus::create_system_menu {mymenu} {
+	$mymenu add cascade -menu [menu $mymenu.system]
+	# TODO add Close, Minimize, etc and whatever else is on the little menu
+	# that is on the top left corner of the window frame
+}
+
+proc ::pd_menus::build_file_menu_win32 {mymenu} {
 	variable accelerator
 	$mymenu add command -label [say "new_file"] -accelerator "$accelerator+N"
 	$mymenu add command -label [say "Open"]     -accelerator "$accelerator+O"
@@ -177,10 +179,10 @@
 
 # the "Edit", "Put", and "Find" menus do not have cross-platform differences
 
-proc ::pd_menus::create_media_menu_win32 {mymenu} {
+proc ::pd_menus::build_media_menu_win32 {mymenu} {
 }
 
-proc ::pd_menus::create_window_menu_win32 {mymenu} {
+proc ::pd_menus::build_window_menu_win32 {mymenu} {
 }
 
 # the "Help" does not have cross-platform differences
@@ -188,8 +190,8 @@
 
 # ------------------------------------------------------------------------------
 # menu building functions
-proc ::pd_menus::create_file_menu {mymenu mytoplevel} {
-	[format create_file_menu_%s [tk windowingsystem]] $mymenu
+proc ::pd_menus::build_file_menu {mymenu mytoplevel} {
+	[format build_file_menu_%s [tk windowingsystem]] $mymenu
 	$mymenu entryconfigure [say "new_file"]   -command "menu_new"
 	$mymenu entryconfigure [say "Open"]       -command "menu_open"
 	$mymenu entryconfigure [say "Save"]       -command "pdsend \"$mytoplevel menusave ;\""
@@ -200,7 +202,7 @@
 	$mymenu entryconfigure [say "Print..."]   -command "menu_print $mytoplevel"
 }
 
-proc ::pd_menus::create_edit_menu {mymenu mytoplevel} {
+proc ::pd_menus::build_edit_menu {mymenu mytoplevel} {
 	variable accelerator
 	$mymenu add command -label [say "Undo"]       -accelerator "$accelerator+Z" \
 		-command "menu_undo $mytoplevel"
@@ -250,7 +252,7 @@
 	}
 }
 
-proc ::pd_menus::create_put_menu {mymenu mytoplevel} {
+proc ::pd_menus::build_put_menu {mymenu mytoplevel} {
 	variable accelerator
 	$mymenu add command -label [say "Object"] -accelerator "$accelerator+1" \
 		-command "pdsend \"$mytoplevel obj 0;\"" 
@@ -286,7 +288,7 @@
 	$mymenu add command -label Array -command "pdsend \"$mytoplevel menuarray ;\""
 }
 
-proc ::pd_menus::create_find_menu {mymenu mytoplevel} {
+proc ::pd_menus::build_find_menu {mymenu mytoplevel} {
 	variable accelerator
 	$mymenu add command -label [say "Find..."]    -accelerator "$accelerator+F" \
 		-command "menu_findobject $mytoplevel"
@@ -296,7 +298,7 @@
 		-command "pdsend \"$mytoplevel finderror ;\"" 
 }
 
-proc ::pd_menus::create_media_menu {mymenu mytoplevel} {
+proc ::pd_menus::build_media_menu {mymenu mytoplevel} {
 	variable accelerator
 	$mymenu add radiobutton -label [say "Compute Audio On"] -accelerator "$accelerator+/" \
 		-command "pdsend \"pd dsp 1 ;\""
@@ -309,7 +311,7 @@
 		-command "menu_doc_open doc/7.stuff/tools load-meter.pd" 
 }
 
-proc ::pd_menus::create_window_menu {mymenu mytoplevel} {
+proc ::pd_menus::build_window_menu {mymenu mytoplevel} {
 	variable accelerator
 	if {[tk windowingsystem] eq "aqua"} {
 		$mymenu add command -label [say "Minimize"] -command "menu_minimize ." \
@@ -323,7 +325,7 @@
 	$mymenu add  separator
 }
 
-proc ::pd_menus::create_help_menu {mymenu mytoplevel} {
+proc ::pd_menus::build_help_menu {mymenu mytoplevel} {
 	if {[tk windowingsystem] ne "aqua"} {
 		$mymenu add command -label {About Pd} \
 			-command "placeholder menu_doc_open doc/1.manual 1.introduction.txt" 


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