diff options
author | Norbert Preining <preining@logic.at> | 2008-08-04 00:18:16 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-08-04 00:18:16 +0000 |
commit | 24c0f0e706d399658078561662cdda6dd0b9b7ed (patch) | |
tree | 03c999ba4680cb0c613ee8c073e4412002627a02 | |
parent | 2e3e358d350ac1f2bd87ea9ad9fb2ae74ae2977b (diff) |
install-gui: switch from pack to grid, no more size computations necessary
that allows us to use longer labels ...
git-svn-id: svn://tug.org/texlive/trunk@10055 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/tlpkg/installer/install-menu-perltk.pl | 166 |
1 files changed, 80 insertions, 86 deletions
diff --git a/Master/tlpkg/installer/install-menu-perltk.pl b/Master/tlpkg/installer/install-menu-perltk.pl index 8ee5af9baaa..7649abf515c 100644 --- a/Master/tlpkg/installer/install-menu-perltk.pl +++ b/Master/tlpkg/installer/install-menu-perltk.pl @@ -209,25 +209,6 @@ 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); - } - debug("setting column widths to a=$a, c=$c\n"); calc_depends; $mainwindow = Tk::MainWindow->new; @@ -249,112 +230,123 @@ sub run_menu { my $fr = $mw->Frame; $fl->pack(-side => 'left', -expand => 1, -fill => "y"); $fr->pack(-side => 'right'); - $fr->Label(-text => $text{'title'})->pack; - $fr->Label(-text => "------- $text{'basicinfo'} -------")->pack; + + + 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); + # binary system line if (!win32()) { - 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++; + $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); } + $row++; + # scheme line - 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'); + $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); + + $row++; # further customization - $fr->Label(-text => "------- $text{'custom'} -------")->pack; + $fr->Label(-text => "------- $text{'custom'} -------")->grid(-row => $row, -column => 1,-columnspan => 3); + $row++; # standard collection line - 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'); + $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); + $row++; # lang collection line - 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'); + $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); + $row++; $collectionstext = $fr->Label(); - $collectionstext->pack; + $collectionstext->grid(-row => $row, -column => 1, -columnspan => 3); + $row++; # further customization - $fr->Label(-text => "------- $text{'dirsetup'} -------")->pack; + $fr->Label(-text => "------- $text{'dirsetup'} -------")->grid(-row => $row, -column => 1, -columnspan => 3); + $row++; # texdir line - my $ftexdir = $fr->Frame; $ftexdir->pack; - $ftexdir->Label(-text => $labels{'texdir'}, -width => $a, -anchor => 'w')->pack(-side => 'left'); - $texdirtext = $ftexdir->Label(-width => $b, -anchor => 'w')->pack(-side => 'left'); - $ftexdir->Button(-width => $c, -text => $text{'change'}, -command => sub { menu_edit_vars_value("TEXDIR"); })->pack(-side => 'left'); + $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); + $row++; # texmflocal line - my $flocal = $fr->Frame; $flocal->pack; - $flocal->Label(-text => $labels{'localdir'}, -width => $a, -anchor => 'w')->pack(-side => 'left'); - $texmflocaltext = $flocal->Label(-width => $b, -anchor => 'w')->pack(-side => 'left'); - $flocal->Button(-width => $c, -text => $text{'change'}, -command => sub { menu_edit_vars_value("TEXMFLOCAL"); })->pack(-side => 'left'); + $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); + $row++; # texmfsysvar line - my $fsys = $fr->Frame; $fsys->pack; - $fsys->Label(-text => $labels{'sysvardir'}, -width => $a, -anchor => 'w')->pack(-side => 'left'); - $texmfsysvartext = $fsys->Label(-width => $b, -anchor => 'w')->pack(-side => 'left'); - $fsys->Button(-width => $c, -text => $text{'change'}, -command => sub { menu_edit_vars_value("TEXMFSYSVAR"); })->pack(-side => 'left'); + $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); + $row++; # texmfsysvar line - my $fconfig = $fr->Frame; $fconfig->pack; - $fconfig->Label(-text => $labels{'sysconfigdir'}, -width => $a, -anchor => 'w')->pack(-side => 'left'); - $texmfsysconfigtext = $fconfig->Label(-width => $b, -anchor => 'w')->pack(-side => 'left'); - $fconfig->Button(-width => $c, -text => $text{'change'}, -command => sub { menu_edit_vars_value("TEXMFSYSCONFIG"); })->pack(-side => 'left'); + $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); + $row++; # texmfhome line - my $fhome = $fr->Frame; $fhome->pack; - $fhome->Label(-text => $labels{'texmfhome'}, -width => $a, -anchor => 'w')->pack(-side => 'left'); - $texmfhometext = $fhome->Label(-width => $b, -anchor => 'w')->pack(-side => 'left'); - $fhome->Button(-width => $c, -text => $text{'change'}, -command => sub { menu_edit_vars_value("TEXMFHOME"); })->pack(-side => 'left'); - + $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); + $row++; # Options - $fr->Label(-text => "------- $text{'options'} -------")->pack; + $fr->Label(-text => "------- $text{'options'} -------")->grid(-row => $row, -column => 1, -columnspan => 3); + $row++; # optpaper - 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'); + $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); - 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'); + $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); if ($vars{'doc_splitting_supported'}) { - 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'); + $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); } if ($vars{'src_splitting_supported'}) { - 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'); + $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); } if (unix()) { + $row++; # Symlinks - $fr->Label(-text => "------- $text{'sysint'} -------")->pack; + $fr->Label(-text => "------- $text{'sysint'} -------")->grid(-row => $row, -column => 1,-columnspan => 3); - 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') + $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); } # install/cancel buttons @@ -382,9 +374,11 @@ sub run_menu { -command => sub { $return = $MENU_ABORT; $mainwindow->destroy } )->pack(-side => 'right'); $mw->bind('<Escape>', [ $quitbutton, 'Invoke' ]); - $f3->pack(-expand => 'x'); + $row++; + $f3->grid(-row => $row, -column => 1, -columnspan => 3); $::statusbar = $fr->Label(-text => $text{'status'}); - $::statusbar->pack; + $row++; + $::statusbar->grid(-row => $row, -column => 1, -columnspan => 3); menu_update_texts(); $mw->pack(-expand => 1, -fill => "both"); $mw->update; |