summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2008-08-08 22:58:27 +0000
committerNorbert Preining <preining@logic.at>2008-08-08 22:58:27 +0000
commitd80b5b8a86af0e5922b60592803325ef7727990a (patch)
tree427ba2d01c6eb4f3f6cceb148198d393de8cf79f /Master
parent2edb5e08df5d5d06500ed916c0e4b8a18e0c653c (diff)
add a fancy selector to the install GUI for TEXDIR
git-svn-id: svn://tug.org/texlive/trunk@10192 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-xMaster/install-tl3
-rw-r--r--Master/tlpkg/installer/install-menu-perltk.pl81
2 files changed, 82 insertions, 2 deletions
diff --git a/Master/install-tl b/Master/install-tl
index f33c5bf0d47..6051f2808dc 100755
--- a/Master/install-tl
+++ b/Master/install-tl
@@ -155,6 +155,8 @@ $opt_gui = 1 if (win32);
# default language for GUI installer
$::lang = "en";
+# use the fancy directory selector for TEXDIR
+$::alternative_selector = 0;
# if we find a file installation.profile we ask the user whether we should
# continue with the installation
@@ -182,6 +184,7 @@ GetOptions(
"portable" => \$opt_portable,
"non-admin" => \$opt_nonadmin,
"location|url=s" => \$opt_location,
+ "fancyselector" => \$::alternative_selector,
"version" => \$opt_version,
"help|?" => \$opt_help) or pod2usage(1);
diff --git a/Master/tlpkg/installer/install-menu-perltk.pl b/Master/tlpkg/installer/install-menu-perltk.pl
index 593b9475446..a3592c7ccf5 100644
--- a/Master/tlpkg/installer/install-menu-perltk.pl
+++ b/Master/tlpkg/installer/install-menu-perltk.pl
@@ -33,6 +33,9 @@ require Tk;
require Tk::Dialog;
require Tk::DialogBox;
require Tk::PNG;
+if ($::alternative_selector) {
+ require Tk::DirTree;
+}
use utf8;
no utf8;
@@ -295,7 +298,12 @@ sub run_menu {
# texdir line
$fr->Label(-text => $labels{'texdir'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w');
$texdirtext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -padx => "2m");
- $fr->Button(-text => $text{'change'}, -command => sub { menu_edit_vars_value("TEXDIR"); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ if ($::alternative_selector) {
+ $fr->Button(-text => $text{'change'}, -command => sub { menu_edit_texdir("TEXDIR"); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ } else {
+ $fr->Button(-text => $text{'change'}, -command => sub { menu_edit_vars_value("TEXDIR"); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ }
+
$row++;
# texmflocal line
@@ -392,6 +400,7 @@ sub run_menu {
$row++;
$::statusbar->grid(-row => $row, -column => 1, -columnspan => 3);
menu_update_texts();
+ $fr->gridColumnconfigure(2, -minsize => 300);
$mw->pack(-expand => 1, -fill => "both");
$mw->update;
my $rh = $mw->reqheight;
@@ -400,7 +409,7 @@ sub run_menu {
debug("Requested height: $rh, requested width: $rw, max height: $maxheight\n");
if ($rh > $maxheight) {
$rh = $maxheight;
- $rw += 20; # for the scrollbar
+ $rw += 20; # for the scrollbar = =
}
$subframe->configure(-height => $rh, -width=>$rw);
$subframe->pack(-expand => 1, -fill => "both");
@@ -410,6 +419,73 @@ sub run_menu {
return($return);
}
+sub menu_edit_texdir {
+ my $key = shift;
+ our $addyear = 1;
+ our $addtexlive = 1;
+ my $val = $vars{$key};
+ our $currsel;
+ our $entry;
+ sub update_label {
+ my $t = $currsel;
+ $t .= "/texlive" if ($addtexlive);
+ $t .= "/$texlive_release" if ($addyear);
+ $entry->configure(-text => "$t");
+ }
+ my $hint_var;
+ if ($key ne 'TEXMFHOME') {
+ $hint_var = win32() ? $ENV{'USERPROFILE'} : $ENV{'HOME'};
+ } else {
+ $hint_var = win32() ? '%USERPROFILE%' : '$HOME';
+ }
+ my $hint_text = $text{'hinthome'};
+ $hint_text =~ s/%%%/$hint_var/;
+ if ($val =~ m!^(.*)/texlive/$texlive_release$!) {
+ $currsel = "$1";
+ $addyear = 1;
+ $addtexlive = 1;
+ } elsif ($val =~ m!^(.*)/$texlive_release$!) {
+ $currsel = "$1";
+ $addyear = 1;
+ $addtexlive = 0;
+ } elsif ($val =~ m!^(.*)/texlive$!) {
+ $currsel = "$1";
+ $addyear = 0;
+ $addtexlive = 1;
+ } else {
+ $addyear = 0;
+ $addtexlive = 0;
+ $currsel = $val;
+ }
+ my $sw = $mainwindow->Toplevel(-title => $text{'changevar'});
+ $sw->transient($mainwindow);
+ $sw->grab();
+ $sw->Label(-text => $text{'enterpath'} . " $key: " . $hint_text)->pack(-padx => "2m", -pady => "2m");
+ $entry = $sw->Entry(-width => 60)->pack(-padx => "2m", -pady => "2m");
+ my $f = $sw->Frame;
+ my $c1 = $f->Checkbutton(-text => 'Add "texlive"', -variable => \$addtexlive,
+ -command => \&update_label);
+ my $c2 = $f->Checkbutton(-text => "Add \"$texlive_release\"", -variable => \$addyear,
+ -command => \&update_label);
+ my $foo = $sw->Scrolled("DirTree", -scrollbars => "osoe",
+ -browsecmd => sub { my ($d) = @_; $currsel = $d; update_label(); },
+ -directory => "$currsel");
+ my $ff = $sw->Frame;
+ my $ok = $ff->Button(-text => $text{'ok'}, -command => sub { $val = $entry->get; callback_edit_directories($key,$val); $sw->destroy; });
+ my $cancel = $ff->Button(-text => $text{'cancel'}, -command => sub { $sw->destroy; });
+ update_label();
+ $c1->pack(-side => 'left', -padx => "2m", -pady => "2m");
+ $c2->pack(-side => 'right', -padx => "2m", -pady => "2m");
+ $f->pack;
+ $foo->pack(-fill => "both", -expand => 1);
+ $ok->pack(-side => 'left' , -padx => "2m", -pady => "2m");
+ $cancel->pack(-side => 'right', -padx => "2m", -pady => "2m");
+ $ff->pack;
+ # bindings
+ $sw->bind('<Return>' => [ $ok, 'Invoke']);
+ $sw->bind('<Escape>' => [ $cancel, 'Invoke']);
+}
+
sub menu_edit_vars_value {
my $key = shift;
my $sw = $mainwindow->Toplevel(-title => $text{'changevar'});
@@ -438,6 +514,7 @@ sub menu_edit_vars_value {
$sw->bind('<Escape>' => [ $cancelbutton, 'Invoke']);
}
+
sub menu_select_scheme {
my $sw = $mainwindow->Toplevel(-title => $labels{'scheme'});
$sw->transient($mainwindow);