diff options
author | Siep Kroonenberg <siepo@cybercomm.nl> | 2017-04-15 08:22:51 +0000 |
---|---|---|
committer | Siep Kroonenberg <siepo@cybercomm.nl> | 2017-04-15 08:22:51 +0000 |
commit | 2b467244921da9f75590f1ca21e3f6d1eae09471 (patch) | |
tree | 5551f25d5aaf35942ba0da8be9cd32d32cabf88c /Master/tlpkg/installer/install-menu-text.pl | |
parent | ade96bccf43fcbd9bdf05e4943942bf59dc3c488 (diff) |
Reworked installer and tlaunch option
git-svn-id: svn://tug.org/texlive/trunk@43805 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/installer/install-menu-text.pl')
-rw-r--r-- | Master/tlpkg/installer/install-menu-text.pl | 125 |
1 files changed, 79 insertions, 46 deletions
diff --git a/Master/tlpkg/installer/install-menu-text.pl b/Master/tlpkg/installer/install-menu-text.pl index 2571420daaa..3b7f192b5cd 100644 --- a/Master/tlpkg/installer/install-menu-text.pl +++ b/Master/tlpkg/installer/install-menu-text.pl @@ -32,10 +32,14 @@ my $ptoggle_alert = "\n". " !! Portable option changed;\n" . " !! Directories have been reinitialized!\n"; -# issue welcome message on end of installation -push @::end_install_hook, - sub { if (win32()) { print TeXLive::TLUtils::welcome(); } - else { print TeXLive::TLUtils::welcome_paths(); } }; +# @fileassocdesc also defined in install-tl +$::fileassocdesc[0] = "None"; +$::fileassocdesc[1] = "Only new"; +$::fileassocdesc[2] = "All"; + +$::deskintdesc[0] = "None"; +$::deskintdesc[1] = "Menu shortcuts"; +if (win32() && is_vista()) { $::deskintdesc[2] = "Launcher"; } sub clear_screen { return 0 if ($::opt_no_cls); @@ -47,9 +51,21 @@ sub string_to_list { return split(//, $string); } -sub button { +sub button { # for main menu: 1 char + my $val=shift; + my $vals=shift; # array ref to descriptions of possible values + if (defined $vals) { + return "[$val]"; + } else { # just yes/no + return ($val)? '[X]':'[ ]'; + } +} + +sub obutton { # for options menu: more chars allowed my $val=shift; - return ($val)? '[X]':'[ ]'; + my $vals=shift; # array ref to descriptions of possible values + $vals = [' ', 'x'] unless defined $vals; + return "[$$vals[$val]]"; } sub hbar { @@ -58,7 +74,11 @@ sub hbar { sub toggle { my $var=shift; - $vars{$var} = ($vars{$var} ? 0 : 1); + my $vals=shift; # array ref to descriptions of possible values + $vals = [' ', 'x'] unless defined $vals; + my $n_vals = @$vals; + $vars{$var} += 1; + $vars{$var} = 0 unless $vars{$var} < $n_vals; } sub menu_head { @@ -736,16 +756,17 @@ sub help_menu { sub options_menu { - my $b_path=button($vars{'option_path'}); - my $b_doc=button($vars{'option_doc'}); - my $b_src=button($vars{'option_src'}); - my $b_fmt=button($vars{'option_fmt'}); - my $b_letter=button($vars{'option_letter'}); - my $b_adjustrepo=button($vars{'option_adjustrepo'}); - my $b_deskint=button($vars{'option_desktop_integration'}); - my $b_admin=button($vars{'option_w32_multi_user'}); - my $b_addoneditor=button($vars{'collection-texworks'}); - my $b_restricted=button($vars{'option_write18_restricted'}); + my $b_path=obutton($vars{'option_path'}); + my $b_doc=obutton($vars{'option_doc'}); + my $b_src=obutton($vars{'option_src'}); + my $b_fmt=obutton($vars{'option_fmt'}); + my $b_letter=obutton($vars{'option_letter'}); + my $b_adjustrepo=obutton($vars{'option_adjustrepo'}); + my $b_deskint=obutton( + $vars{'option_desktop_integration'}, \@::deskintdesc); + my $b_admin=obutton($vars{'option_w32_multi_user'}); + my $b_addoneditor=obutton($vars{'collection-texworks'}); + my $b_restricted=obutton($vars{'option_write18_restricted'}); my $sys_bin=$vars{'option_sys_bin'}; my $sys_man=$vars{'option_sys_man'}; @@ -791,9 +812,11 @@ EOF EOF ; } - if (win32() || $::opt_all_options) { - print " <M> create Start menu shortcuts: $b_deskint\n"; - print " <N> update file associations: [$::fileassocdesc[$vars{'option_file_assocs'}]]\n"; + if ((win32() && !$vars{'portable'}) || $::opt_all_options) { + print " <M> Start menu shortcuts / launcher: ".obutton( + $vars{'option_desktop_integration'}, \@::deskintdesc)."\n"; + print " <N> update file associations: ".obutton( + $vars{'option_file_assocs'}, \@::fileassocdesc)."\n"; if ($::opt_all_options || TeXLive::TLWinGoo::admin()) { # if we are admin we allow normal user installation, too print " <U> make installation available to all users: $b_admin\n"; @@ -851,34 +874,42 @@ EOF } } - # option_desktop_integration, option_file_assocs - - if (win32() || $::opt_all_options) { - if ("\u$answer" eq 'M' and !$vars{'portable'}) { - toggle 'option_desktop_integration'; - return $command{'self'}; +# # option_desktop_integration, option_file_assocs +# +# if (win32() || $::opt_all_options) { +# if ("\u$answer" eq 'M' and !$vars{'portable'}) { +# toggle 'option_desktop_integration'; +# return $command{'self'}; +# +# } elsif ("\u$answer" eq 'N' and !$vars{'portable'}) { +# print "New value for file_assocs:\n"; +# print " 0 -- don't tweak the file associations\n"; +# print " 1 -- only add new file associations, don't overwrite old ones\n"; +# print " 2 -- always create file associations to TeX Live programs\n"; +# print "New value for file_assocs [$vars{'option_file_assocs'}]: "; +# chomp (my $a = <STDIN>); +# if ($a eq "0" || $a eq "1" || $a eq "2") { +# $vars{'option_file_assocs'} = $a; +# } +# return $command{'self'}; +# +# } elsif ("\u$answer" eq 'U' and !$vars{'portable'}) { +# toggle 'option_w32_multi_user'; +# return $command{'self'}; +# } +# } - } elsif ("\u$answer" eq 'N' and !$vars{'portable'}) { - print "New value for file_assocs:\n"; - print " 0 -- don't tweak the file associations\n"; - print " 1 -- only add new file associations, don't overwrite old ones\n"; - print " 2 -- always create file associations to TeX Live programs\n"; - print "New value for file_assocs [$vars{'option_file_assocs'}]: "; - chomp (my $a = <STDIN>); - if ($a eq "0" || $a eq "1" || $a eq "2") { - $vars{'option_file_assocs'} = $a; - } - return $command{'self'}; + # other options - } elsif ("\u$answer" eq 'U' and !$vars{'portable'}) { - toggle 'option_w32_multi_user'; - return $command{'self'}; - } - } + if (("\u$answer" eq 'M') && !$vars{'portable'}) { + toggle ('option_desktop_integration', \@::deskintdesc); + return $command{'self'}; - # other options + } elsif (("\u$answer" eq 'N') && !$vars{'portable'}) { + toggle ('option_file_assocs', \@::fileassocdesc); + return $command{'self'}; - if ("\u$answer" eq 'P') { + } elsif ("\u$answer" eq 'P') { toggle 'option_letter'; return $command{'self'}; @@ -953,7 +984,10 @@ sub main_menu { my $b_src=button($vars{'option_src'}); my $b_fmt=button($vars{'option_fmt'}); my $b_letter=button($vars{'option_letter'}); - my $b_deskint=button($vars{'option_desktop_integration'}); + my $b_deskint=button($vars{'option_desktop_integration'}, \@::deskintdesc); + if (win32()) { + my $b_fileassoc=button($vars{'option_file_assocs'}, \@::fileassocdesc); + } my $b_admin=button($vars{'option_w32_multi_user'}); my $b_addoneditor=button($vars{'collection-texworks'}); my $b_restricted=button($vars{'option_write18_restricted'}); @@ -1094,7 +1128,6 @@ EOF return $command{'self'}; } } - # needs a terminal 1 for require to succeed! 1; |