summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/tlpkg/installer/install-menu-perltk.pl228
1 files changed, 113 insertions, 115 deletions
diff --git a/Master/tlpkg/installer/install-menu-perltk.pl b/Master/tlpkg/installer/install-menu-perltk.pl
index 1e19700d6c9..3d9124e7719 100644
--- a/Master/tlpkg/installer/install-menu-perltk.pl
+++ b/Master/tlpkg/installer/install-menu-perltk.pl
@@ -1,4 +1,5 @@
#!/usr/bin/env perl
+#
# $Id$
#
# Copyright 2008 Norbert Preining, Reinhard Kotucha
@@ -85,7 +86,7 @@ push @::start_install_hook, sub { update_statusbar("Starting installation");
push @::start_postinst_hook, sub { update_statusbar("Starting post-installation Jobs");
Tk::DoOneEvent(Tk::Event::DONT_WAIT); Tk::DoOneEvent(Tk::Event::DONT_WAIT);};
push @::end_install_hook, sub { update_statusbar("Installation finished");
- Tk::DoOneEvent(Tk::Event::DONT_WAIT); Tk::DoOneEvent(Tk::Event::DONT_WAIT);};
+ Tk::DoOneEvent(Tk::Event::DONT_WAIT); Tk::DoOneEvent(Tk::Event::DONT_WAIT); };
push @::install_packages_hook, \&update_statusbar;
# no idea how many of those are necessary, 1 is definitely not enough!
@@ -176,7 +177,7 @@ if (($::lang ne "en") && ($::lang ne "C")) {
http://tug.org/texlive/doc.html#install-tl-xlate for information.)\n\n");
} else {
# merge the translated strings into the text string
- open(LANG, "<$::installerdir/tlpkg/installer/lang/perltk-$::lang");
+ open(LANG,"<$::installerdir/tlpkg/installer/lang/perltk-$::lang");
my %trans;
while (<LANG>) {
chomp;
@@ -206,12 +207,31 @@ my $srcyesno = ( $vars{'option_src'} ? $text{'yes'} : $text{'no'} );
my $docyesno = ( $vars{'option_doc'} ? $text{'yes'} : $text{'no'} );
sub run_menu {
+ # computing $a:
+ my $a = 0;
+ foreach my $l (keys %labels) {
+ my $l = length($labels{$l});
+ $a = $l if ($l > $a);
+ }
+ # add one char width for spacing
+ $a++;
+ my $b = 35;
+ if (win32()) {
+ $b = 30;
+ }
+ # computation of $c
+ my $c = 0;
+ foreach my $l (qw/change toggle/) {
+ my $l = length($text{$l});
+ $c = $l if ($l > $c);
+ }
+ $c++;
+ debug("setting column widths to a=$a, c=$c\n");
calc_depends;
$mainwindow = Tk::MainWindow->new;
if (!win32()) {
- require Tk::Pane;
- $subframe = $mainwindow->Scrolled("Frame", -scrollbars => "oe");
+ eval 'require Tk::Pane; $subframe = $mainwindow->Scrolled("Frame", -scrollbars => "oe");';
} else {
$subframe = $mainwindow->Frame;
}
@@ -227,124 +247,112 @@ sub run_menu {
my $fr = $mw->Frame;
$fl->pack(-side => 'left', -expand => 1, -fill => "y");
$fr->pack(-side => 'right');
-
-
- my $row = 1;
- $fr->Label(-text => $text{'title'})->grid(-row => $row, -column => 1, -columnspan => 3);
-
- $row++;
- $fr->Label(-text => "------- $text{'basicinfo'} -------")->grid(-row => $row, -column => 1, -columnspan => 3);
-
+ $fr->Label(-text => $text{'title'})->pack;
+ $fr->Label(-text => "------- $text{'basicinfo'} -------")->pack;
# binary system line
if (!win32()) {
- $row++;
- $fr->Label(-text => $labels{'binsys'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w');
- $bintextbutton = $fr->Label(-anchor => 'w');
- $bintextbutton->grid(-row => $row, -column => 2, -padx => "2m");
- $fr->Button(-text => $text{'change'}, -command => sub { menu_select_binsystems(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ my $fbin = $fr->Frame; $fbin->pack;
+ $fbin->Label(-text => $labels{'binsys'}, -width => $a, -anchor => 'w')->pack(-side => 'left');
+ $bintextbutton = $fbin->Label(-width => $b, -anchor => 'w'); $bintextbutton->pack(-side => 'left');
+ $fbin->Button(-width => $c, -text => $text{'change'}, -command => sub { menu_select_binsystems(); })->pack(-side => 'left');
}
- $row++;
-
# scheme line
- $fr->Label(-text => $labels{'scheme'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w');
- $schemebutton = $fr->Label(-anchor => 'w');
- $schemebutton->grid(-row => $row, -column => 2, -padx => "2m");
- $fr->Button(-text => $text{'change'}, -command => sub { menu_select_scheme(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
-
- $row++;
+ my $fscheme = $fr->Frame; $fscheme->pack;
+ $fscheme->Label(-text => $labels{'scheme'}, -width => $a, -anchor => 'w')->pack(-side => 'left');
+ $schemebutton = $fscheme->Label(-width => $b, -anchor => 'w'); $schemebutton->pack(-side => 'left');
+ $fscheme->Button(-width => $c, -text => $text{'change'}, -command => sub { menu_select_scheme(); })->pack(-side => 'left');
# further customization
- $fr->Label(-text => "------- $text{'custom'} -------")->grid(-row => $row, -column => 1,-columnspan => 3);
+ $fr->Label(-text => "------- $text{'custom'} -------")->pack;
- $row++;
# standard collection line
- $fr->Label(-text => $labels{'stdcoll'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w');
- $fr->Button(-text => $text{'change'}, -command => sub { menu_select_standard_collections(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ my $fcoll = $fr->Frame; $fcoll->pack;
+ $fcoll->Label(-text => $labels{'stdcoll'}, -width => $a, -anchor => 'w')->pack(-side => 'left');
+ $fcoll->Label(-width => $b)->pack(-side => 'left');
+ $fcoll->Button(-width => $c, -text => $text{'change'}, -command => sub { menu_select_standard_collections(); })->pack(-side => 'left');
- $row++;
# lang collection line
- $fr->Label(-text => $labels{'langcoll'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w');
- $langcoltext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -padx => "2m");
- $fr->Button( -text => $text{'change'}, -command => sub { menu_select_lang_collections(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ my $flang = $fr->Frame; $flang->pack;
+ $flang->Label(-text => $labels{'langcoll'}, -width => $a, -anchor => 'w')->pack(-side => 'left');
+ # $flang->Label(-width => $b)->pack(-side => 'left');
+ $langcoltext = $flang->Label(-width => $b, -anchor => 'w')->pack(-side => 'left');
+ $flang->Button(-width => $c, -text => $text{'change'}, -command => sub { menu_select_lang_collections(); })->pack(-side => 'left');
- $row++;
$collectionstext = $fr->Label();
- $collectionstext->grid(-row => $row, -column => 1, -columnspan => 3);
+ $collectionstext->pack;
- $row++;
# further customization
- $fr->Label(-text => "------- $text{'dirsetup'} -------")->grid(-row => $row, -column => 1, -columnspan => 3);
+ $fr->Label(-text => "------- $text{'dirsetup'} -------")->pack;
- $row++;
# 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");
+ my $ftexdir = $fr->Frame; $ftexdir->pack(-fill => 'x');
+ $ftexdir->Label(-text => $labels{'texdir'}, -anchor => 'w')->pack(-side => 'left');
+ $texdirtext = $ftexdir->Label->pack(-side => 'left', -expand => 1, -anchor => 'e', -padx => 20);
+ $ftexdir->Button(-width => $c, -text => $text{'change'}, -command => sub { menu_edit_vars_value("TEXDIR"); })->pack(-side => 'left');
- $row++;
# texmflocal line
- $fr->Label(-text => $labels{'localdir'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w');
- $texmflocaltext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -padx => "2m");
- $fr->Button(-text => $text{'change'}, -command => sub { menu_edit_vars_value("TEXMFLOCAL"); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ my $flocal = $fr->Frame; $flocal->pack(-fill => 'x');
+ $flocal->Label(-text => $labels{'localdir'}, -anchor => 'w')->pack(-side => 'left');
+ $texmflocaltext = $flocal->Label->pack(-side => 'left', -expand => 1, -anchor => 'e', -padx => 20);
+ $flocal->Button(-width => $c, -text => $text{'change'}, -command => sub { menu_edit_vars_value("TEXMFLOCAL"); })->pack(-side => 'left');
- $row++;
# texmfsysvar line
- $fr->Label(-text => $labels{'sysvardir'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w');
- $texmfsysvartext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -padx => "2m");
- $fr->Button(-text => $text{'change'}, -command => sub { menu_edit_vars_value("TEXMFSYSVAR"); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ my $fsys = $fr->Frame; $fsys->pack(-fill => 'x');
+ $fsys->Label(-text => $labels{'sysvardir'}, -anchor => 'w')->pack(-side => 'left');
+ $texmfsysvartext = $fsys->Label->pack(-side => 'left', -expand => 1, -anchor => 'e', -padx => 20);
+ $fsys->Button(-width => $c, -text => $text{'change'}, -command => sub { menu_edit_vars_value("TEXMFSYSVAR"); })->pack(-side => 'left');
- $row++;
# texmfsysvar line
- $fr->Label(-text => $labels{'sysconfigdir'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w');
- $texmfsysconfigtext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -padx => "2m");
- $fr->Button(-text => $text{'change'}, -command => sub { menu_edit_vars_value("TEXMFSYSCONFIG"); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ my $fconfig = $fr->Frame; $fconfig->pack(-fill => 'x');
+ $fconfig->Label(-text => $labels{'sysconfigdir'}, -anchor => 'w')->pack(-side => 'left');
+ $texmfsysconfigtext = $fconfig->Label->pack(-side => 'left', -expand => 1, -anchor => 'e', -padx => 20);
+ $fconfig->Button(-width => $c, -text => $text{'change'}, -command => sub { menu_edit_vars_value("TEXMFSYSCONFIG"); })->pack(-side => 'left');
- $row++;
# texmfhome line
- $fr->Label(-text => $labels{'texmfhome'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w');
- $texmfhometext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -padx => "2m");
- $fr->Button(-text => $text{'change'}, -command => sub { menu_edit_vars_value("TEXMFHOME"); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ my $fhome = $fr->Frame; $fhome->pack(-fill => 'x');
+ $fhome->Label(-text => $labels{'texmfhome'}, -anchor => 'w')->pack(-side => 'left');
+ $texmfhometext = $fhome->Label->pack(-side => 'left', -expand => 1, -anchor => 'e', -padx => 20);
+ $fhome->Button(-width => $c, -text => $text{'change'}, -command => sub { menu_edit_vars_value("TEXMFHOME"); })->pack(-side => 'left');
+
- $row++;
# Options
- $fr->Label(-text => "------- $text{'options'} -------")->grid(-row => $row, -column => 1, -columnspan => 3);
+ $fr->Label(-text => "------- $text{'options'} -------")->pack;
- $row++;
# optpaper
- $fr->Label(-text => $labels{'optletter'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w');
- $fr->Label(-anchor => 'w', -textvariable => \$letteryesno)->grid(-row => $row, -column => 2, -padx => "2m");
- $fr->Button(-text => $text{'toggle'}, -command => sub { toggle_and_set_opt_variable(\$vars{'option_letter'}, \$letteryesno); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ my $fletter = $fr->Frame; $fletter->pack;
+ $fletter->Label(-text => $labels{'optletter'}, -width => $a, -anchor => 'w')->pack(-side => 'left');
+ $fletter->Label(-width => $b, -anchor => 'w', -textvariable => \$letteryesno)->pack(-side => 'left');
+ $fletter->Button(-width => $c, -text => $text{'toggle'}, -command => sub { toggle_and_set_opt_variable(\$vars{'option_letter'}, \$letteryesno); })->pack(-side => 'left');
- $row++;
- $fr->Label(-text => $labels{'optfmt'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w');
- $fr->Label(-anchor => 'w', -textvariable => \$fmtyesno)->grid(-row => $row, -column => 2, -padx => "2m");
- $fr->Button(-text => $text{'toggle'}, -command => sub { toggle_and_set_opt_variable(\$vars{'option_fmt'}, \$fmtyesno); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ my $ffmt = $fr->Frame; $ffmt->pack;
+ $ffmt->Label(-text => $labels{'optfmt'}, -width => $a, -anchor => 'w')->pack(-side => 'left');
+ $ffmt->Label(-width => $b, -anchor => 'w', -textvariable => \$fmtyesno)->pack(-side => 'left');
+ $ffmt->Button(-width => $c, -text => $text{'toggle'}, -command => sub { toggle_and_set_opt_variable(\$vars{'option_fmt'}, \$fmtyesno); })->pack(-side => 'left');
if ($vars{'doc_splitting_supported'}) {
- $row++;
- $fr->Label(-text => $labels{'optdoc'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w');
- $fr->Label(-anchor => 'w', -textvariable => \$docyesno)->grid(-row => $row, -column => 2, -padx => "2m");
- $fr->Button(-text => $text{'toggle'}, -command => sub { toggle_and_set_opt_variable(\$vars{'option_doc'}, \$docyesno); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ my $fdoc = $fr->Frame; $fdoc->pack;
+ $fdoc->Label(-text => $labels{'optdoc'}, -width => $a, -anchor => 'w')->pack(-side => 'left');
+ $fdoc->Label(-width => $b, -anchor => 'w', -textvariable => \$docyesno)->pack(-side => 'left');
+ $fdoc->Button(-width => $c, -text => $text{'toggle'}, -command => sub { toggle_and_set_opt_variable(\$vars{'option_doc'}, \$docyesno); })->pack(-side => 'left');
}
if ($vars{'src_splitting_supported'}) {
- $row++;
- $fr->Label(-text => $labels{'optsrc'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w');
- $fr->Label(-anchor => 'w', -textvariable => \$srcyesno)->grid(-row => $row, -column => 2, -padx => "2m");
- $fr->Button(-text => $text{'toggle'}, -command => sub { toggle_and_set_opt_variable(\$vars{'option_src'}, \$srcyesno); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ my $fsrc = $fr->Frame; $fsrc->pack;
+ $fsrc->Label(-text => $labels{'optsrc'}, -width => $a, -anchor => 'w')->pack(-side => 'left');
+ $fsrc->Label(-width => $b, -anchor => 'w', -textvariable => \$srcyesno)->pack(-side => 'left');
+ $fsrc->Button(-width => $c, -text => $text{'toggle'}, -command => sub { toggle_and_set_opt_variable(\$vars{'option_src'}, \$srcyesno); })->pack(-side => 'left');
}
if (unix()) {
- $row++;
# Symlinks
- $fr->Label(-text => "------- $text{'sysint'} -------")->grid(-row => $row, -column => 1,-columnspan => 3);
+ $fr->Label(-text => "------- $text{'sysint'} -------")->pack;
- $row++;
- $fr->Label(-text => $labels{'symlink'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w');
- $symlinktext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -padx => "2m");
- $fr->Button(-text => $text{'change'}, -command => sub { menu_select_symlink(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ my $fsym = $fr->Frame; $fsym->pack;
+ $fsym->Label(-text => $labels{'symlink'}, -width => $a, -anchor => 'w')->pack(-side => 'left');
+ $symlinktext = $fsym->Label(-width => $b, -anchor => 'w')->pack(-side => 'left');
+ $fsym->Button(-width => $c, -text => $text{'change'}, -command => sub { menu_select_symlink(); })->pack(-side => 'left')
}
# install/cancel buttons
@@ -372,11 +380,9 @@ sub run_menu {
-command => sub { $return = $MENU_ABORT; $mainwindow->destroy }
)->pack(-side => 'right');
$mw->bind('<Escape>', [ $quitbutton, 'Invoke' ]);
- $row++;
- $f3->grid(-row => $row, -column => 1, -columnspan => 3);
+ $f3->pack(-expand => 'x');
$::statusbar = $fr->Label(-text => $text{'status'});
- $row++;
- $::statusbar->grid(-row => $row, -column => 1, -columnspan => 3);
+ $::statusbar->pack;
menu_update_texts();
$mw->pack(-expand => 1, -fill => "both");
$mw->update;
@@ -388,9 +394,11 @@ sub run_menu {
$rh = $maxheight;
$rw += 20; # for the scrollbar
}
- $subframe->configure(-height => $rh, -width=>$rw);
+ eval '$subframe->configure(-height => $rh, -width=>$rw)' if
+ (!win32() or win_version()>=5.1);
$subframe->pack(-expand => 1, -fill => "both");
- $mainwindow->configure(-height => $rh, -width=>$rw);
+ eval '$mainwindow->configure(-height => $rh, -width=>$rw)' if
+ (!win32() or win_version()>=5.1);
#$mw->pack(-expand => 1, -fill => "both");
Tk::MainLoop();
return($return);
@@ -565,26 +573,10 @@ sub menu_select_lang_collections {
sub menu_select_symlink {
our ($lbin,$lman,$linfo);
our $osym = $vars{'option_symlinks'};
- our ($binlab,$binb,$manlab,$manb,$infolab,$infob);
sub set_unset_buttons {
$lbin = ($osym ? $vars{'sys_bin'} : '');
$linfo = ($osym ? $vars{'sys_info'} : '');
$lman = ($osym ? $vars{'sys_man'} : '');
- if ($osym) {
- $binlab->grid(-row => 2, -column => 1, -sticky => "w", -padx => "2m");
- $binb->grid(-row => 2, -column => 2, -sticky => "ew", -padx => "2m");
- $manlab->grid(-row => 3, -column => 1, -sticky => "w", -padx => "2m");
- $manb->grid(-row => 3, -column => 2, -sticky => "ew", -padx => "2m");
- $infolab->grid(-row => 4, -column => 1, -sticky => "w", -padx => "2m");
- $infob->grid(-row => 4, -column => 2, -sticky => "ew", -padx => "2m");
- } else {
- $infob->gridForget;
- $infolab->gridForget;
- $manb->gridForget;
- $manlab->gridForget;
- $binb->gridForget;
- $binlab->gridForget;
- }
}
sub return_callback {
if ($osym) {
@@ -601,23 +593,29 @@ sub menu_select_symlink {
$vars{'option_symlinks'} = $osym;
menu_update_texts();
}
+ set_unset_buttons();
my $sw = $mainwindow->Toplevel(-title => $labels{'symlink'});
$sw->transient($mainwindow);
$sw->grab();
$sw->Checkbutton(-variable => \$osym,
-text => $text{'createsym'},
- -command => sub { set_unset_buttons(); } )->grid(-column => 1,
- -row => 1,
- -columnspan => 2,
- -padx => "2m");
- $binlab = $sw->Label(-text => $text{'binto'});
- $binb = $sw->Entry(-textvariable => \$lbin);
- $manlab = $sw->Label(-text => $text{'manto'});
- $manb = $sw->Entry(-textvariable => \$lman);
- $infolab = $sw->Label(-text => $text{'infoto'});
- $infob = $sw->Entry(-textvariable => \$linfo);
- set_unset_buttons();
- my $f2 = $sw->Frame; $f2->grid(-column => 1, -columnspan => 2, -row => 5);
+ -command => sub { set_unset_buttons(); } )->pack;
+ my $fbin = $sw->Frame;
+ $fbin->Label(-text => $text{'binto'})->pack(-side => 'left');
+ my $binb = $fbin->Entry(-textvariable => \$lbin, -width => 30);
+ $binb->pack(-side => 'right');
+ $fbin->pack(-expand => 'x');
+ my $fman = $sw->Frame;
+ $fman->Label(-text => $text{'manto'})->pack(-side => 'left');
+ my $manb = $fman->Entry(-textvariable => \$lman, -width => 30);
+ $manb->pack(-side => 'right');
+ $fman->pack(-expand => 'x');
+ my $finfo = $sw->Frame;
+ $finfo->Label(-text => $text{'infoto'})->pack(-side => 'left');
+ my $infob = $finfo->Entry(-textvariable => \$linfo, -width => 30);
+ $infob->pack(-side => 'right');
+ $finfo->pack(-expand => 'x');
+ my $f2 = $sw->Frame; $f2->pack(-expand => 'x');
my $okbutton = $f2->Button(-text => $text{'ok'},
-command => sub { return_callback(); $sw->destroy })->pack(-side => 'left');
my $cancelbutton = $f2->Button(-text => $text{'cancel'},