summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiep Kroonenberg <siepo@cybercomm.nl>2011-05-13 17:24:55 +0000
committerSiep Kroonenberg <siepo@cybercomm.nl>2011-05-13 17:24:55 +0000
commita342e1349d55273171dde77acbcb6d975bb2e46d (patch)
treecf319e865db8895fb1b73dc4b3ef8aa0cb96bdd8
parent13ee8176807fbd28586b001e100e52b110185e72 (diff)
Updated comments; obsolete subs removed from TLWinGoo
git-svn-id: svn://tug.org/texlive/trunk@22457 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm4
-rw-r--r--Master/tlpkg/TeXLive/TLWinGoo.pm109
2 files changed, 23 insertions, 90 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index 28e0baab29d..9f6961b5fef 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -1611,6 +1611,8 @@ sub _do_postaction_filetype {
return 1;
}
+# alternate filetype (= progid) for an extension;
+# associated program shows up in `open with' menu
sub _do_postaction_progid {
my ($how, $tlpobj, $pa) = @_;
return 1 unless win32();
@@ -1622,14 +1624,12 @@ sub _do_postaction_progid {
return 0;
}
- # name can be an arbitrary string
if (!defined($keyval{'extension'})) {
tlwarn("extension of progid postaction not given\n");
return 0;
}
my $extension = $keyval{'extension'};
- # cmd can be an arbitrary string
if (!defined($keyval{'filetype'})) {
tlwarn("filetype of progid postaction not given\n");
return 0;
diff --git a/Master/tlpkg/TeXLive/TLWinGoo.pm b/Master/tlpkg/TeXLive/TLWinGoo.pm
index 2c6c15d2289..365e86b7b0f 100644
--- a/Master/tlpkg/TeXLive/TLWinGoo.pm
+++ b/Master/tlpkg/TeXLive/TLWinGoo.pm
@@ -55,8 +55,6 @@ C<TeXLive::TLWinGoo> -- Additional utilities for Windows
TeXLive::TLWinGoo::unregister_extension($mode, $extension);
TeXLive::TLWinGoo::register_file_type($file_type, $command);
TeXLive::TLWinGoo::unregister_file_type($file_type);
- TeXLive::TLWinGoo::register_application($prog, $cmd, $exts);
- TeXLive::TLWinGoo::unregister_application($prog, $cmd);
=head2 ACTIVATING CHANGES IMMEDIATELY
@@ -549,9 +547,15 @@ sub adjust_reg_path_for_texlive {
return 0;
}
-### helper subs for file types ###
+### File types ###
-# merge recursive hashes such as occur in the registry
+# Refactored from 2010 edition. New functionality:
+# add_to_progids for defining alternate filetypes for an extension.
+# Their associated programs show up in the `open with' right-click menu.
+
+### helper subs ###
+
+# merge recursive hash refs such as occur in the registry
sub hash_merge {
my $target = shift; # the recursive hash ref to be modified by $mods
@@ -682,6 +686,8 @@ sub do_write_regkey {
return 1;
}
+# remove a registry key under HKCU or HKLM, depending on privilege level
+
sub do_remove_regkey {
my $keypath = shift; # key or value
my $hivename = $is_admin ? 'HKLM' : 'HKCU';
@@ -759,11 +765,14 @@ sub current_valdata {
return $valdata;
}
+### now the exported file type functions ###
+
=pod
=item C<add_to_progids($ext, $filetype)>
-Add $filetype to the list of programs which open $ext files
+Add $filetype to the list of alternate progids/filetypes of extension $ext.
+The associated program shows up in the `open with' right-click menu.
=cut
@@ -780,7 +789,7 @@ sub add_to_progids {
=item C<remove_from_progids($ext, $filetype)>
-Remove $filetype from the list of programs which open $ext files
+Remove $filetype from the list of alternate filetypes for $ext
=cut
@@ -818,11 +827,13 @@ If $mode is 0, nothing is actually done.
For $mode 1, the filetype for the extension is preserved, but only
if shell actions are defined for it. This is slightly changed from
-previous versions. Because that Windows often creates filetypes for
+previous versions. Because Windows often creates filetypes for
extensions automatically, it seems better to ignore filetypes
-without actions.
+without actions. If the old filetype is not overwritten, the new
+filetype is added to the openwithprogids list.
-For $mode 2, the filetype is always overwritten.
+For $mode 2, the filetype is always overwritten. The old filetype
+moves to the openwithprogids list if necessary.
=cut
@@ -914,7 +925,7 @@ sub register_file_type {
=item C<unregister_file_type($file_type)>
-Reversal of register_script_type.
+Reversal of register_file_type.
=cut
@@ -929,84 +940,6 @@ sub unregister_file_type {
=pod
-=item C<register_application($prog, $cmd, $exts)>
-
-Add registry entry to set full path of $prog to $path and optionally
-specify which extensions it handles
-
-=cut
-
-sub register_application {
- my $prog = shift;
- my $cmd = shift;
- my $exts = shift;
-
- my $hsh;
- foreach my $e (@$exts) {$hsh->{"/$e"} = "";}
- $cmd =~ s!/!\\!g;
- my $keyhash = {
- "shell/" => {
- "open/" => {
- "command/" => {
- "/" => $cmd
- }
- }
- },
- "SupportedTypes" => $hsh
- };
- do_write_regkey("Software/Classes/Applications/$prog", $keyhash);
-}
-
-=pod
-
-=item C<unregister_application($prog, $cmd)>
-
-Reversal of register_application. Return value: key no longer exists.
-
-=cut
-
-sub unregister_application {
- my $prog = shift;
- my $cmd = shift;
- my $hive = $is_admin ? "LMachine" : "CUser";
- my $regpath = "Software/Classes/Applications/$prog";
- my $regkey = $Registry->{"$hive/$regpath/"};
- return 1 unless $regkey;
- my $current_cmd = $regkey->{"shell/open/command//"};
- do_remove_regkey("$hive/$regpath/") if $cmd eq $current_cmd;
- return !defined($regkey);
-}
-#
-#=pod
-#
-#=item C<add_to_openwithlist($ext, $prog)>
-#
-#Add $prog to the list of programs which open $ext files
-#
-#=cut
-#
-#sub add_to_openwithlist {
-# my $ext = shift;
-# my $prog = shift;
-# do_write_regkey("Software/Classes/$ext/OpenWithList/$prog", {});
-#}
-#
-#=pod
-#
-#=item C<remove_from_openwithlist($ext, $prog)>
-#
-#Remove $prog from the list of programs which open $ext files
-#
-#=cut
-#
-#sub remove_from_openwithlist {
-# my $ext = shift;
-# my $prog = shift;
-# do_remove_regkey("Software/Classes/$ext/OpenWithList/$prog");
-#}
-
-=pod
-
=back
=head2 ACTIVATING CHANGES IMMEDIATELY