[PD-cvs] packages/patches extended-help-menu.patch,1.1,1.2

Hans-Christoph Steiner eighthave at users.sourceforge.net
Sat Nov 26 02:51:37 CET 2005


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

Modified Files:
	extended-help-menu.patch 
Log Message:
added in Jamie's dlopn patch so I can use his binaries; fixed a number of bugs reported on the list; added platform-specific noncvs handling

Index: extended-help-menu.patch
===================================================================
RCS file: /cvsroot/pure-data/packages/patches/extended-help-menu.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** extended-help-menu.patch	21 Nov 2005 04:37:41 -0000	1.1
--- extended-help-menu.patch	26 Nov 2005 01:51:35 -0000	1.2
***************
*** 2,37 ****
  ===================================================================
  RCS file: /cvsroot/pure-data/pd/src/u_main.tk,v
! --- pd-0.38-4/src/u_main.tk	Sun Feb 20 20:03:36 2005
! +++ u_main.tk	Wed Nov 16 00:33:02 2005
! @@ -374,22 +374,41 @@
!  set help_directory $pd_guidir/doc
!  set help_top_directory $pd_guidir/doc
   
- +################## generate_menu_doc_link #########################
- +# This procedure generates a temporary mirror of the documentation directory
- +# in /tmp so that it can be opened from the Help->Pure Documentation... menu
- +# under Mac OS X.  It is meant to be run at startup.
- +# Damn you Apple and your "hide stuff from the user" "features".  
- +# <hans at at.or.at.>
- +proc generate_menu_doc_link {} {
- +    global help_directory
- +	 
- +	 regsub -all "/" $help_directory "." help_directory_alias
- +	 set help_directory_alias /tmp/$help_directory_alias
- +	 set help_directory_tmpdir $help_directory_alias/doc
- +	 # if something other than a directory exists, delete it
- +	 if [file exists $help_directory_alias] {
- +		  file delete -force -- $help_directory_alias
- +	 }
- +	 if { ! [ file isdirectory $help_directory_tmpdir ] } {
- +		  file mkdir $help_directory_tmpdir
- +	 }
- +	 foreach file [ lsort [ glob -dir $help_directory * ] ] {
- +		  regsub -all ".*/" $file "" link_file_name
- +		  file link -symbolic [file join $help_directory_tmpdir $link_file_name ] $file 
- +	 }
- +	 set help_directory $help_directory_tmpdir
- +}
  +
  +################## menu_documentation #########################
   proc menu_documentation {} {
--- 2,135 ----
  ===================================================================
  RCS file: /cvsroot/pure-data/pd/src/u_main.tk,v
! retrieving revision 1.7.2.4
! diff -u -w -r1.7.2.4 u_main.tk
! --- u_main.tk	21 Feb 2005 04:20:20 -0000	1.7.2.4
! +++ u_main.tk	25 Nov 2005 22:47:06 -0000
! @@ -24,6 +24,14 @@
!  # Tearoff is set to true by default:
!  set pd_tearoff 1
   
  +
+ +# 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
+ +# this is the default name for the Help menu
+ +set help_menu_name "help"
+ +
+ +#################### init for Windows ####################
+  if {$pd_nt == 1} {
+      global pd_guidir
+      global pd_tearoff
+ @@ -32,8 +40,12 @@
+      set pd_guidir $pd_gui3/..
+      load $pd_guidir/bin/pdtcl.dll
+      set pd_tearoff 1
+ +    set help_top_directory $pd_guidir/doc
+ +    # init last help directory browsed
+ +    set help_directory $help_top_directory
+  }
+  
+ +##################### init for Mac OS X/Darwin ####################
+  if {$pd_nt == 2} {
+  # turn on James Tittle II's fast drawing (wait until I can test this...):
+  #   set tk::mac::useCGDrawing 1
+ @@ -43,6 +55,39 @@
+      set pd_guidir $pd_gui2/..
+      load $pd_guidir/bin/pdtcl
+      set pd_tearoff 0
+ +    set help_top_directory $pd_guidir/doc
+ +    
+ +    
+ +    # This procedure generates a temporary mirror of the documentation directory
+ +    # in /tmp so that it can be opened from the Help->Pure Documentation... menu
+ +    # under Mac OS X.  It is meant to be run at startup.
+ +    # Damn you Apple and your hide-stuff-from-the-user "features".  
+ +    # <hans at at.or.at.>
+ +    regsub -all "/" $help_top_directory "." help_directory_alias
+ +    set help_directory_alias /tmp/.pd_help_directory_alias-$help_directory_alias
+ +    set help_directory_tmpdir $help_directory_alias/doc
+ +    # if something other than a directory exists, delete it
+ +    if [file exists $help_directory_alias] {
+ +	file delete -force -- $help_directory_alias
+ +    }
+ +    if { ! [ file isdirectory $help_directory_tmpdir ] } {
+ +	file mkdir $help_directory_tmpdir
+ +    }
+ +    foreach file [ lsort [ glob -dir $help_top_directory * ] ] {
+ +	regsub -all ".*/" $file "" link_file_name
+ +	file link -symbolic $help_directory_tmpdir/$link_file_name $file 
+ +    }
+ +    # init last help directory browsed
+ +    set help_directory $help_directory_tmpdir
+ +
+ +
+ +    # 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
+ +    # Apple doesn't allow cascading menus in their Help so I had to call this 
+ +    # one "docs" <hans at at.or.at>
+ +    set help_menu_name "docs"
+ +
+  
+  	 # tk::mac::OpenDocument is called with the filenames put into the 
+  	 # var args whenever docs are either dropped on the Pd.app icon or 
+ @@ -60,14 +105,22 @@
+  # hack so you can easily test-run this script in linux... define pd_guidir
+  # (which is normally defined at startup in pd under linux...)
+  
+ +#################### init for GNU/Linux ####################
+  if {$pd_nt == 0} {
+      if {! [info exists pd_guidir]} {
+      	global pd_guidir
+      	puts stderr {setting pd_guidir to '.'}
+  	set pd_guidir .
+ +	set help_top_directory $pd_guidir/doc
+ +	# init last help directory browsed
+ +	set help_directory $help_top_directory
+      }
+  }
+  
+ +#################### init for all platforms ####################
+ +
+ +
+ +
+  # it's unfortunate but we seem to have to turn off global bindings
+  # for Text objects to get control-s and control-t to do what we want for
+  # "text" dialogs below.  Also we have to get rid of tab's changing the focus.
+ @@ -95,25 +148,15 @@
+  if {$pd_nt != 2} {
+      .mbar add cascade -label "Windows" -menu .mbar.windows
+      .mbar add cascade -label "Media" -menu .mbar.audio
+ -# 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
+ -	 menu .mbar.help -tearoff $pd_tearoff
+ -	 .mbar add cascade -label "Help" -menu .mbar.help
+  } else {
+  	 menu .mbar.apple -tearoff 0
+  	 .mbar add cascade -label "Apple" -menu .mbar.apple 
+  # arrange menus according to Apple HIG
+      .mbar add cascade -label "Media" -menu .mbar.audio
+      .mbar add cascade -label "Window" -menu .mbar.windows
+ -# 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
+ -# Apple doesn't allow cascading menus in their Help so I had to call this 
+ -# one $mbar.docs # <hans at at.or.at>
+ -	 menu .mbar.docs -tearoff $pd_tearoff
+ -	 .mbar add cascade -label "Help" -menu .mbar.docs
+  }
+ +menu .mbar.$help_menu_name -tearoff $pd_tearoff
+ +.mbar add cascade -label "Help" -menu .mbar.$help_menu_name
+  
+  set ctrls_audio_on 0
+  set ctrls_meter_on 0
+ @@ -371,25 +414,15 @@
+  	 }
+  }
+  
+ -set help_directory $pd_guidir/doc
+ -set help_top_directory $pd_guidir/doc
+ -
  +################## menu_documentation #########################
   proc menu_documentation {} {
***************
*** 48,52 ****
  -    } else {
   	set filename [tk_getOpenFile -defaultextension .pd \
!  	-filetypes { {{documentation} {.pd .txt .htm}} } \
   	-initialdir $help_directory]
  -    }    
--- 146,151 ----
  -    } else {
   	set filename [tk_getOpenFile -defaultextension .pd \
! -	-filetypes { {{documentation} {.pd .txt .htm}} } \
! +		      -filetypes { {{documentation} {.pd .txt .htm .html}} } \
   	-initialdir $help_directory]
  -    }    
***************
*** 54,58 ****
       	if {[string first .txt $filename] >= 0} {
       	    menu_opentext $filename
! @@ -411,35 +430,57 @@
    
       set dirname $pd_guidir/$subdir
--- 153,157 ----
       	if {[string first .txt $filename] >= 0} {
       	    menu_opentext $filename
! @@ -411,42 +444,69 @@
    
       set dirname $pd_guidir/$subdir
***************
*** 74,116 ****
  -		[pdtk_enquote $dirname] \;]
  +				menu_openhtml $dirname/$basename
- +		  }
       }
   }
   
  -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>
  +proc menu_doc_submenu {helpmenu base_dir sub_dir} {
! +	 global pd_tearoff
! +	 global help_top_directory
! +	 
! +	 set menu_dir $help_top_directory/$base_dir/$sub_dir
! +	 
! +	 foreach file [ lsort [ glob -nocomplain -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|tk|pdf|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 "\\\." [string tolower $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
--- 173,217 ----
  -		[pdtk_enquote $dirname] \;]
  +				menu_openhtml $dirname/$basename
       }
   }
+ +}
+ +
   
  -proc doc_submenu {helpmenu subdir} {
  -	 global help_top_directory pd_tearoff
  +################## 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>
  +proc menu_doc_submenu {helpmenu base_dir sub_dir} {
! +    global pd_tearoff
! +    global help_top_directory
!  
! -	 set menudir $help_top_directory/$subdir
! +    set menu_dir $help_top_directory/$base_dir/$sub_dir
!  
! -    regsub -all "\\\." $subdir "" submenu
! +    catch {
! +	foreach file [ lsort [ glob -nocomplain -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 "Warning doc_submenu found a link: $file"
! +	    }
! +	    if { $file_type == "file" } {
! +		# only put certain file types on the menu
! +		if {[regexp ".*\.(htm|html|c|pd|txt|tk|pdf|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 "\\\." [string tolower $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
***************
*** 123,154 ****
  -		  $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]
! +		  }
   	 }
   }
   
! @@ -494,7 +535,18 @@
   
   
   #          the "Help" menu
  -	 if {$pd_nt != 2} {
! +	 if {$pd_nt == 2} {
! +# Apple doesn't allow cascading menus in their Help so I had to call this 
! +# one "docs"  <hans at at.or.at>
! +		  generate_menu_doc_link
! +		  $mbar.docs add command -label {Browse Documentation...} \
! +				-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 +554,9 @@
!  	-command {menu_doc_open doc/1.manual 1.introduction.txt} 
!      $mbar.help add command -label {Pure Documentation...} \
   	-command {menu_documentation} 
  -		  # add menu items for each section instead of using Pd patches
--- 224,255 ----
  -		  $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} {
! -    global pd_apilist pd_nt pd_tearoff
! +    global pd_apilist pd_nt pd_tearoff help_menu_name
!  #          the "Audio" menu
!      $mbar.audio add command -label {audio ON} -accelerator [accel_munge "Ctrl+/"] \
!  	-command {menu_audio 1} 
! @@ -494,30 +554,15 @@
   
   
   #          the "Help" menu
  -	 if {$pd_nt != 2} {
! -# 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
! -    $mbar.help add command -label {About Pd} \
! -	-command {menu_doc_open doc/1.manual 1.introduction.txt} 
! -    $mbar.help add command -label {Pure Documentation...} \
! +    puts stderr "Starting Menu crap"
! +    $mbar.$help_menu_name add command -label {Browse Documentation...} \
   	-command {menu_documentation} 
  -		  # add menu items for each section instead of using Pd patches
***************
*** 162,166 ****
  -
  -	 $mbar.$helpmenuname add command -label {1 manual...} \
! +		  $mbar.help add command -label {1 manual...} \
   		  -command {menu_doc_open doc/1.manual index.htm} 
  -	 doc_submenu $mbar.$helpmenuname 2.control.examples
--- 263,268 ----
  -
  -	 $mbar.$helpmenuname add command -label {1 manual...} \
! +    # the help menu only really works well on Mac OS X <hans at at.or.at>
! +    $mbar.$help_menu_name add command -label {Pd HTML Manual...} \
   		  -command {menu_doc_open doc/1.manual index.htm} 
  -	 doc_submenu $mbar.$helpmenuname 2.control.examples
***************
*** 169,174 ****
  -	 doc_submenu $mbar.$helpmenuname 5.reference
  -	 doc_submenu $mbar.$helpmenuname 6.externs
! +	 }
   }
   
   #################### the "File" menu for the Pd window ##############
--- 271,304 ----
  -	 doc_submenu $mbar.$helpmenuname 5.reference
  -	 doc_submenu $mbar.$helpmenuname 6.externs
! +    $mbar.$help_menu_name add separator
! +    menu_doc_submenu $mbar.$help_menu_name "." "."
! +    puts stderr "Finishing Menu crap"
   }
   
   #################### the "File" menu for the Pd window ##############
+ @@ -820,6 +865,7 @@
+      global pd_opendir
+      global pd_tearoff
+      global pd_nt
+ +    global help_menu_name
+  
+      toplevel $name -menu $name.m
+  #    puts stderr [concat geometry: $geometry]
+ @@ -1078,13 +1124,11 @@
+  # 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
+  	 if {$pd_nt != 2} {
+ -    menu $name.m.help -tearoff $pd_tearoff
+ -    $name.m add cascade -label Help -menu $name.m.help
+ +	menu $name.m.$help_menu_name -tearoff $pd_tearoff
+ +	$name.m add cascade -label Help -menu $name.m.$help_menu_name
+  	 } else {
+ -		  # Apple doesn't allow cascading menus in their Help
+ -		  # so I had to call this one "docs". <hans at at.or.at>
+ -		  menu $name.m.docs -tearoff $pd_tearoff
+ -		  $name.m add cascade -label Help -menu  $name.m.docs
+ +	menu $name.m.$help_menu_name -tearoff $pd_tearoff
+ +	$name.m add cascade -label Help -menu  $name.m.$help_menu_name
+  	 }
+  
+      menu_addstd $name.m





More information about the Pd-cvs mailing list