[PD-cvs] packages/darwin_app/patches extended-help-menu.patch, 1.3, 1.4

Hans-Christoph Steiner eighthave at users.sourceforge.net
Tue Nov 15 08:25:13 CET 2005


Update of /cvsroot/pure-data/packages/darwin_app/patches
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3254

Modified Files:
	extended-help-menu.patch 
Log Message:
fixed up recursion so it only needs to be called once; added image/sound/movie launching support

Index: extended-help-menu.patch
===================================================================
RCS file: /cvsroot/pure-data/packages/darwin_app/patches/extended-help-menu.patch,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** extended-help-menu.patch	12 Nov 2005 00:48:48 -0000	1.3
--- extended-help-menu.patch	15 Nov 2005 07:25:11 -0000	1.4
***************
*** 1,6 ****
! Index: u_main.tk
! ===================================================================
! --- u_main.tk	Sun Feb 20 20:03:36 2005
! +++ u_main.tk	Fri Nov 11 19:40:51 2005
  @@ -374,22 +374,40 @@
   set help_directory $pd_guidir/doc
--- 1,4 ----
! --- pd-0.38-3/src/u_main.tk	Sun Feb 20 20:03:36 2005
! +++ u_main.tk	Tue Nov 15 02:22:59 2005
  @@ -374,22 +374,40 @@
   set help_directory $pd_guidir/doc
***************
*** 52,56 ****
       	if {[string first .txt $filename] >= 0} {
       	    menu_opentext $filename
! @@ -421,25 +439,41 @@
       }
   }
--- 50,67 ----
       	if {[string first .txt $filename] >= 0} {
       	    menu_opentext $filename
! @@ -411,38 +429,56 @@
!   
!      set dirname $pd_guidir/$subdir
!  
! -    if {[regexp ".*\.(txt|c)$" $basename]} {
! +    if {[regexp ".*\.(txt|c|css)$" $basename]} {
!      	menu_opentext $dirname/$basename
!      } elseif {[regexp ".*\.html?$" $basename]} {
!  		  menu_openhtml $dirname/$basename
! +    } elseif {[regexp ".*\.(wav|aif|aiff|jpg|jpeg|gif|png|mov|avi)$" $basename]} {
! +		  menu_openhtml $dirname/$basename
!      } else {
!      	pd [concat pd open [pdtk_enquote $basename] \
!  		[pdtk_enquote $dirname] \;]
       }
   }
***************
*** 58,65 ****
  -proc doc_submenu {helpmenu subdir} {
  -	 global help_top_directory pd_tearoff
!  
  -	 set menudir $help_top_directory/$subdir
  +################## menu_doc_submenu #########################
! +
  +# this is a recursive function to generation a nested menu in the help menu
  +# which shows the complete contents of the doc directory <hans at at.or.at>
--- 69,78 ----
  -proc doc_submenu {helpmenu subdir} {
  -	 global help_top_directory pd_tearoff
! -
  -	 set menudir $help_top_directory/$subdir
+  
+ -    regsub -all "\\\." $subdir "" submenu
  +################## menu_doc_submenu #########################
!  
  +# this is a recursive function to generation a nested menu in the help menu
  +# which shows the complete contents of the doc directory <hans at at.or.at>
***************
*** 67,82 ****
  +	 global pd_tearoff
  +	 global help_top_directory
  +
! +	 set menu_dir $help_top_directory/$base_dir/$sub_dir
!  
! -    regsub -all "\\\." $subdir "" submenu
! +    regsub -all "\\\." $sub_dir "" submenu
!  
   	 menu $helpmenu.$submenu -tearoff $pd_tearoff
  -    regsub -all "\\\." $subdir " " submenuname
! +    regsub -all "\\\." $sub_dir " " submenuname
   	 $helpmenu add cascade -label $submenuname \
   		  -menu $helpmenu.$submenu
!  
  -# use this glob pattern to exclude the supporting files
  -#	 foreach file [ lsort [ glob -dir $menudir {*[0-9][0-9]*} ] ] 
--- 80,108 ----
  +	 global pd_tearoff
  +	 global help_top_directory
+ +	 
+ +	 set menu_dir [file join $help_top_directory $base_dir $sub_dir]
  +
! +	 foreach file [ lsort [ glob -dir $menu_dir * ] ] {
! +		  set file_type [file type $file]
! +		  regsub {.*/(.*$)} $file {\1} file_name
! +# If links are going to be used then there needs to be a check to see if each
! +# link might cause this function to recurse forever  <hans at at.or.at>
! +#		  if { $file_type == "link"} {
! +#				puts stderr "LINK: $file"
! +#		  }
! +		  if { $file_type == "file" } {
! +				# only put certain file types on the menu
! +				if {[regexp ".*\.(htm|html|c|pd|txt|wav|aif|aiff)$" $file]} {
! +					 $helpmenu add command -label $file_name \
! +						  -command "menu_doc_open doc/$base_dir/$sub_dir $file_name"
! +				}
! +		  } elseif { $file_type == "directory" } {
! +				regsub -all "\\\." $file_name "" submenu
   	 menu $helpmenu.$submenu -tearoff $pd_tearoff
  -    regsub -all "\\\." $subdir " " submenuname
! +				regsub -all "\\\." $file_name " " submenuname
   	 $helpmenu add cascade -label $submenuname \
   		  -menu $helpmenu.$submenu
! -
  -# use this glob pattern to exclude the supporting files
  -#	 foreach file [ lsort [ glob -dir $menudir {*[0-9][0-9]*} ] ] 
***************
*** 86,110 ****
  -		  $helpmenu.$submenu add command -label $filename \
  -				-command "menu_doc_open doc/$subdir $filename"
- +	 foreach file [ lsort [ glob -dir $menu_dir * ] ] {
- +		  set file_type [file type $file]
- +# If links are going to be used then there needs to be a check to see if each
- +# link might cause this function to recurse forever  <hans at at.or.at>
- +#		  if { $file_type == "link"} {
- +#				puts stderr "LINK: $file"
- +#		  }
- +		  if { $file_type == "file" } {
- +				set file_name ""
- +				regsub {.*/.*\.(.+$)} $file {\1} file_extension
- +				regsub {.*/(.*\..+$)} $file {\1} file_name
- +				# test by file_extension so that only .htm .html .c .pd and .txt get put on the menu
- +				$helpmenu.$submenu add command -label $file_name \
- +					 -command "menu_doc_open doc/$base_dir/$sub_dir $file_name"
- +		  } elseif { $file_type == "directory" } {
  +				menu_doc_submenu $helpmenu.$submenu $base_dir/$sub_dir [file tail $file]
- +		  }
   	 }
   }
   
! @@ -494,7 +528,23 @@
   
   
--- 112,126 ----
  -		  $helpmenu.$submenu add command -label $filename \
  -				-command "menu_doc_open doc/$subdir $filename"
  +				menu_doc_submenu $helpmenu.$submenu $base_dir/$sub_dir [file tail $file]
   	 }
   }
   
! +
! +}
! +
!  ############# routine to add media, help, and apple menu items ###############
!  
!  proc menu_addstd {mbar} {
! @@ -494,7 +530,18 @@
   
   
***************
*** 118,135 ****
  +				-command {menu_documentation} 
  +	 # the help menu only really works well on Mac OS X <hans at at.or.at>
! +		  $mbar.docs add separator
! +		  $mbar.docs add command -label {1 manual...} \
  +				-command {menu_doc_open doc/1.manual index.htm} 
! +		  menu_doc_submenu $mbar.docs "." 2.control.examples
! +		  menu_doc_submenu $mbar.docs "." 3.audio.examples
! +		  menu_doc_submenu $mbar.docs "." 4.fft.examples
! +		  menu_doc_submenu $mbar.docs "." 5.reference
! +		  menu_doc_submenu $mbar.docs "." 6.externs
! +		  menu_doc_submenu $mbar.docs "." 7.stuff
  +	 } else {
   # a menu on the main menubar named "$whatever.help" while be treated
   # as a special menu with specific behaviors on different platforms.
   # See SPECIAL MENUS IN MENUBARS http://www.tcl.tk/man/tcl8.4/TkCmd/menu.htm
! @@ -502,22 +552,9 @@
   	-command {menu_doc_open doc/1.manual 1.introduction.txt} 
       $mbar.help add command -label {Pure Documentation...} \
--- 134,146 ----
  +				-command {menu_documentation} 
  +	 # the help menu only really works well on Mac OS X <hans at at.or.at>
! +		  $mbar.docs add command -label {Pd HTML Manual...} \
  +				-command {menu_doc_open doc/1.manual index.htm} 
! +		  $mbar.docs add separator
! +		  menu_doc_submenu $mbar.docs "." "."
  +	 } else {
   # a menu on the main menubar named "$whatever.help" while be treated
   # as a special menu with specific behaviors on different platforms.
   # See SPECIAL MENUS IN MENUBARS http://www.tcl.tk/man/tcl8.4/TkCmd/menu.htm
! @@ -502,22 +549,9 @@
   	-command {menu_doc_open doc/1.manual 1.introduction.txt} 
       $mbar.help add command -label {Pure Documentation...} \





More information about the Pd-cvs mailing list