summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2008-12-08 18:06:40 +0000
committerNorbert Preining <preining@logic.at>2008-12-08 18:06:40 +0000
commit82a39c8e95e8f199d78ba92ed15db9d6477bb96d (patch)
treec29dffbafcf5d33f93a5218676ba2de18a331948
parentb35c5c6f1e0a739ddd1d233a5c16977a160b45ac (diff)
tlmgr2 paper setting in perl code, also for gui
git-svn-id: svn://tug.org/texlive/trunk@11555 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf/scripts/texlive/papersize-setting.pl113
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgr2.pl14
-rw-r--r--Master/texmf/scripts/texlive/tlmgrgui/gui-config2.pl293
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgrgui/tlmgrgui2.pl3
4 files changed, 398 insertions, 25 deletions
diff --git a/Master/texmf/scripts/texlive/papersize-setting.pl b/Master/texmf/scripts/texlive/papersize-setting.pl
index 92a7d264622..56e44dc21fb 100644
--- a/Master/texmf/scripts/texlive/papersize-setting.pl
+++ b/Master/texmf/scripts/texlive/papersize-setting.pl
@@ -20,6 +20,27 @@ use strict;
our $localtlpdb;
+our %default_paper_config_path_component;
+
+$default_paper_config_path_component{"pdftex"} =
+ "tex/generic/config/pdftexconfig.tex";
+$default_paper_config_path_component{"xdvi"} =
+ "xdvi/XDvi";
+$default_paper_config_path_component{"dvipdfm"} =
+ "dvipdfm/config/config";
+$default_paper_config_path_component{"dvipdfmx"} =
+ "dvipdfmx/dvipdfmx.cfg";
+$default_paper_config_path_component{"context"} =
+ "tex/context/user/cont-sys.tex";
+$default_paper_config_path_component{"dvips"} =
+ "dvips/config/config.ps";
+
+# Output is actually done to the components in this hash, and
+# if a value is undefined to the one from %default_....
+#
+our %paper_config_path_component;
+
+
my %pdftex_papersize = (
"letter" => [ '8.5 true in', '11 true in' ],
"a4" => [ '210 true mm', '297 true mm' ],
@@ -84,11 +105,16 @@ our %papersetting_subs;
sub paper_all {
for my $p (keys %papersetting_subs) {
- info("setting paper size for $p to @_\n");
+ #info("setting paper size for $p to @_\n");
&{$papersetting_subs{$p}}(@_);
}
}
+sub get_paper_list {
+ my $prog = shift;
+ return ( &{$papersetting_subs{$prog}} ( "/dummy", "--returnlist" ) );
+}
+
#
# pdftex pdftexconfig.tex format
# /--- pdftexconfig.tex ---
@@ -103,6 +129,9 @@ sub paper_all {
#
sub paper_pdftex {
my $outtree = shift;
+ my $outcomp = $paper_config_path_component{"pdftex"};
+ $outcomp || ($outcomp = $default_paper_config_path_component{"pdftex"});
+ my $outfile = "$outtree/$outcomp";
my $newpaper = shift;
my $cf = `kpsewhich --progname=pdftex --format=tex pdftexconfig.tex`;
chomp($cf);
@@ -154,6 +183,13 @@ sub paper_pdftex {
for my $p (keys %pdftex_papersize) {
info("$p\n") unless ($p eq $currentpaper);
}
+ } elsif ($newpaper eq "--returnlist") {
+ my @ret;
+ push @ret, "$currentpaper";
+ for my $p (keys %pdftex_papersize) {
+ push @ret, $p;
+ }
+ return @ret;
} else {
my $found = 0;
for my $p (keys %pdftex_papersize) {
@@ -185,9 +221,15 @@ sub paper_pdftex {
$lines[$#lines] = $newwline;
}
}
- # TODO
- warn "Output should go to $outtree/tex/generic/config/pdftexconfig.tex";
- for (@lines) { print; }
+ info("Setting paper for pdftex to $newpaper.\n");
+ mkdirhier(dirname($outfile));
+ if (!open(TMP, ">$outfile")) {
+ tlwarn("Cannot write to $outfile: $!\n");
+ tlwarn("Not setting paper for pdftex.\n");
+ return;
+ }
+ for (@lines) { print TMP; }
+ close (TMP);
} else {
warn "Not a valid paper size for pdftex: $newpaper\n";
}
@@ -230,6 +272,9 @@ $papersetting_subs{"pdftex"} = \&paper_pdftex;
#
sub paper_dvips {
my $outtree = shift;
+ my $outcomp = $paper_config_path_component{"dvips"};
+ $outcomp || ($outcomp = $default_paper_config_path_component{"dvips"});
+ my $outfile = "$outtree/$outcomp";
my $newpaper = shift;
my $configps = `kpsewhich --progname=dvips --format='dvips config' config.ps`;
chomp($configps);
@@ -268,6 +313,8 @@ sub paper_dvips {
for my $p (@papersizes) {
info("$p\n"); # first is already the selected one
}
+ } elsif ($newpaper eq "--returnlist") {
+ return(@papersizes);
} else {
my $found = 0;
for my $p (@papersizes) {
@@ -294,9 +341,15 @@ sub paper_dvips {
}
push @newlines, $lines[$idx];
}
- # TODO
- warn "Output should go to $outtree/dvips/config/config.ps";
- for (@newlines) { print; }
+ info("Setting paper for dvips to $newpaper.\n");
+ mkdirhier(dirname($outfile));
+ if (!open(TMP, ">$outfile")) {
+ tlwarn("Cannot write to $outfile: $!\n");
+ tlwarn("Not setting paper for dvips.\n");
+ return;
+ }
+ for (@newlines) { print TMP; }
+ close (TMP);
} else {
warn "Not a valid paper size for dvips: $newpaper\n";
}
@@ -323,6 +376,9 @@ $papersetting_subs{"dvips"} = \&paper_dvips;
#
sub paper_context {
my $outtree = shift;
+ my $outcomp = $paper_config_path_component{"context"};
+ $outcomp || ($outcomp = $default_paper_config_path_component{"context"});
+ my $outfile = "$outtree/$outcomp";
my $newpaper = shift;
# check that context is installed at all
if (!defined($localtlpdb->get_package("context"))) {
@@ -346,8 +402,8 @@ sub paper_context {
} else {
return($ll);
}
- }, "$outtree/tex/context/user/cont-sys.rme", \@bla,
- 'a4', '\setuppapersize[a4][a4]', $newpaper);
+ },
+ $outfile, \@bla, 'a4', '\setuppapersize[a4][a4]', $newpaper);
}
$papersetting_subs{"context"} = \&paper_context;
@@ -365,6 +421,9 @@ $papersetting_subs{"context"} = \&paper_context;
#
sub paper_xdvi {
my $outtree = shift;
+ my $outcomp = $paper_config_path_component{"xdvi"};
+ $outcomp || ($outcomp = $default_paper_config_path_component{"xdvi"});
+ my $outfile = "$outtree/$outcomp";
my $newpaper = shift;
my $xdvi = `kpsewhich --progname=xdvi --format='other text files' XDvi`;
chomp($xdvi);
@@ -374,8 +433,7 @@ sub paper_xdvi {
my ($ll,$np) = @_;
$ll =~ s/^\*paper:\s+(\w+)\s*$/\*paper: $np\n/;
return($ll);
- }, "$outtree/xdvi/XDvi", \@bla,
- '(not defined)', '*paper: a4', $newpaper);
+ }, $outfile, \@bla, '(not defined)', '*paper: a4', $newpaper);
}
$papersetting_subs{"xdvi"} = \&paper_xdvi;
@@ -396,13 +454,16 @@ $papersetting_subs{"xdvi"} = \&paper_xdvi;
#
#
sub do_dvipdfm_and_x {
- my ($inp, $prog, $outp, $paplist, $newpaper) = @_;
+ my ($inp, $prog, $outtree, $paplist, $newpaper) = @_;
+ my $outcomp = $paper_config_path_component{$prog};
+ $outcomp || ($outcomp = $default_paper_config_path_component{$prog});
+ my $outfile = "$outtree/$outcomp";
paper_do_simple($inp, $prog, '^p\s+', '^p\s+(\w+)\s*$',
sub {
my ($ll,$np) = @_;
$ll =~ s/^p\s+(\w+)\s*$/p $np\n/;
return($ll);
- }, $outp, $paplist, '(not defined)', 'p a4', $newpaper);
+ }, $outfile, $paplist, '(not defined)', 'p a4', $newpaper);
}
sub paper_dvipdfm {
@@ -411,18 +472,17 @@ sub paper_dvipdfm {
my $inp = `kpsewhich --progname=dvipdfm --format='other text files' config`;
chomp($inp);
my @bla = keys %dvipdfm_papersize;
- do_dvipdfm_and_x($inp, "dvipdfm", "$outtree/dvipdfm/config/config",
- \@bla, $newpaper);
+ do_dvipdfm_and_x($inp, "dvipdfm", $outtree, \@bla, $newpaper);
}
$papersetting_subs{"dvipdfm"} = \&paper_dvipdfm;
+
sub paper_dvipdfmx {
my $outtree = shift;
my $newpaper = shift;
my $inp = `kpsewhich --progname=dvipdfmx --format='other text files' dvipdfmx.cfg`;
chomp($inp);
my @bla = keys %dvipdfm_papersize;
- do_dvipdfm_and_x($inp, "dvipdfmx", "$outtree/dvipdfmx/dvipdfmx.cfg",
- \@bla, $newpaper);
+ do_dvipdfm_and_x($inp, "dvipdfmx", $outtree, \@bla, $newpaper);
}
$papersetting_subs{"dvipdfmx"} = \&paper_dvipdfmx;
@@ -477,6 +537,13 @@ sub paper_do_simple {
for my $p (@$paplist) {
info("$p\n") unless ($p eq $currentpaper);
}
+ } elsif ($newpaper eq "--returnlist") {
+ my @ret;
+ push @ret, $currentpaper;
+ for my $p (@$paplist) {
+ push @ret, $p unless ($p eq $currentpaper);
+ }
+ return(@ret);
} else {
my $found = 0;
for my $p (@$paplist) {
@@ -500,9 +567,15 @@ sub paper_do_simple {
if (!$foundcfg) {
push @newlines, &$bl($defaultline, $newpaper);
}
- # should save to $outf
- warn "Output should go to $outp";
- for (@newlines) { print; }
+ info("Setting paper for $prog to $newpaper.\n");
+ mkdirhier(dirname($outp));
+ if (!open(TMP, ">$outp")) {
+ tlwarn("Cannot write to $outp: $!\n");
+ tlwarn("Not setting paper for $prog.\n");
+ return;
+ }
+ for (@newlines) { print TMP; }
+ close (TMP);
} else {
warn "Not a valid paper size for $prog: $newpaper\n";
}
diff --git a/Master/texmf/scripts/texlive/tlmgr2.pl b/Master/texmf/scripts/texlive/tlmgr2.pl
index 591ca70931b..e19b341296a 100755
--- a/Master/texmf/scripts/texlive/tlmgr2.pl
+++ b/Master/texmf/scripts/texlive/tlmgr2.pl
@@ -67,8 +67,8 @@ use TeXLive::TLMedia;
use TeXLive::TLUtils;
use TeXLive::TLWinGoo;
use TeXLive::TLPostActions;
-TeXLive::TLUtils->import(qw(member info give_ctan_mirror win32
- merge_into copy log debug));
+TeXLive::TLUtils->import(qw(member info give_ctan_mirror win32 dirname
+ mkdirhier merge_into copy log debug));
use Cwd qw/abs_path/;
use Pod::Usage;
use Getopt::Long qw(:config no_autoabbrev require_order);
@@ -623,6 +623,7 @@ sub action_paper {
chomp($texmfsysvar);
my $texmfsysconfig = `kpsewhich -var-value=TEXMFSYSCONFIG`;
chomp($texmfsysconfig);
+
# we are doing -sys variants
$ENV{"TEXMFVAR"} = $texmfsysvar;
@@ -636,13 +637,20 @@ sub action_paper {
tlwarn("tlmgr paper needs an argument: a4 | letter\n");
return;
}
+ # output is done to the path components as given in
+ # our %paper_config_path_component, and if not present the defaults
+ # in %default_paper_config_path_component;
+ # together with the tree as given in the first argument of paper_*
paper_all($texmfsysconfig, $newpaper);
} else {
# now we have as first argument a program
my $prog = $action;
- # pass on everything to th paper_* subs
+ # pass on everything to the paper_* subs
# get rid of useless "paper" argument
shift @ARGV;
+ # see above for the selection of the output
+ # if we want to change the output the value in %paper_config_path_component
+ # has to be changed
&{$papersetting_subs{$prog}}($texmfsysconfig, @ARGV);
}
if ($localtlpdb->option_create_formats) {
diff --git a/Master/texmf/scripts/texlive/tlmgrgui/gui-config2.pl b/Master/texmf/scripts/texlive/tlmgrgui/gui-config2.pl
new file mode 100644
index 00000000000..13a5dd84638
--- /dev/null
+++ b/Master/texmf/scripts/texlive/tlmgrgui/gui-config2.pl
@@ -0,0 +1,293 @@
+# gui-config2.pl
+# $Id$
+#
+# Copyright 2008 Tomasz Luczak, Norbert Preining
+#
+# GUI for tlmgr
+#
+
+our $back_config = $back->add("config",-label => ___"config");
+$screens{"config"} = $back_config;
+
+my $default_location = $localtlpdb->option_location;
+my $default_formats = ($localtlpdb->option_create_formats ? ___"yes" : ___"no");
+my $default_docfiles = ($localtlpdb->option_install_docfiles ? ___"yes" : ___"no");
+my $default_srcfiles = ($localtlpdb->option_install_srcfiles ? ___"yes" : ___"no");
+
+# this will be loaded only on unix systems!
+#
+
+my $back_config_set = $back_config->Labelframe(-text => ___"defaultsettings");
+$back_config_set->pack(-fill => "both", -padx => "2m", -pady => "2m");
+
+my $back_config_set_l1 = $back_config_set->Label(-text => ___"defaultsource", -anchor => "w");
+my $back_config_set_m1 = $back_config_set->Label(-textvariable => \$default_location);
+my $back_config_set_r1 = $back_config_set->Button(-text => ___"change",
+ -command => sub { menu_default_location(); });
+
+my $back_config_set_l2 = $back_config_set->Label(-text => ___"createformats", -anchor => "w");
+my $back_config_set_m2 = $back_config_set->Label(-textvariable => \$default_formats);
+my $back_config_set_r2 = $back_config_set->Button(-text => ___"toggle",
+ -command => sub { toggle_setting("formats"); });
+
+my $back_config_set_l3 = $back_config_set->Label(-text => ___"installdoc", -anchor => "w");
+my $back_config_set_m3 = $back_config_set->Label(-textvariable => \$default_docfiles);
+my $back_config_set_r3 = $back_config_set->Button(-text => ___"toggle",
+ -command => sub { toggle_setting("docfiles"); });
+
+my $back_config_set_l4 = $back_config_set->Label(-text => ___"installsrc", -anchor => "w");
+my $back_config_set_m4 = $back_config_set->Label(-textvariable => \$default_srcfiles);
+my $back_config_set_r4 = $back_config_set->Button(-text => ___"toggle",
+ -command => sub { toggle_setting("srcfiles"); });
+
+
+$back_config_set_l1->grid(-row => 1, -column => 1,
+ -padx => "2m", -pady => "2m", -sticky => "nwe");
+$back_config_set_m1->grid(-row => 1, -column => 2,
+ -padx => "2m", -pady => "2m", -sticky => "nwe");
+$back_config_set_r1->grid(-row => 1, -column => 3,
+ -padx => "2m", -pady => "2m", -sticky => "nwe");
+$back_config_set_l2->grid(-row => 2, -column => 1,
+ -padx => "2m", -pady => "2m", -sticky => "nwe");
+$back_config_set_m2->grid(-row => 2, -column => 2,
+ -padx => "2m", -pady => "2m", -sticky => "nwe");
+$back_config_set_r2->grid(-row => 2, -column => 3,
+ -padx => "2m", -pady => "2m", -sticky => "nwe");
+$back_config_set_l3->grid(-row => 3, -column => 1,
+ -padx => "2m", -pady => "2m", -sticky => "nwe");
+$back_config_set_m3->grid(-row => 3, -column => 2,
+ -padx => "2m", -pady => "2m", -sticky => "nwe");
+$back_config_set_r3->grid(-row => 3, -column => 3,
+ -padx => "2m", -pady => "2m", -sticky => "nwe");
+$back_config_set_l4->grid(-row => 4, -column => 1,
+ -padx => "2m", -pady => "2m", -sticky => "nwe");
+$back_config_set_m4->grid(-row => 4, -column => 2,
+ -padx => "2m", -pady => "2m", -sticky => "nwe");
+$back_config_set_r4->grid(-row => 4, -column => 3,
+ -padx => "2m", -pady => "2m", -sticky => "nwe");
+
+#############
+
+my $lower = $back_config->Frame;
+$lower->pack(-fill => "both");
+
+my $back_config_pap = $lower->Labelframe(-text => ___"papersettings");
+
+
+my $back_config_pap_l1 = $back_config_pap->Label(-text => ___"defaultpaperall", -anchor => "w");
+my $back_config_pap_m1 = $back_config_pap->Button(-text => "A4",
+ -command => sub { change_paper("all", "a4"); });
+my $back_config_pap_r1 = $back_config_pap->Button(-text => "letter",
+ -command => sub { change_paper("all", "letter"); });
+
+$back_config_pap_l1->grid(-row => 1, -column => 1,
+ -padx => "2m", -pady => "2m", -sticky => "nswe");
+$back_config_pap_m1->grid(-row => 1, -column => 2,
+ -padx => "2m", -pady => "2m", -sticky => "nswe");
+$back_config_pap_r1->grid(-row => 1, -column => 3,
+ -padx => "2m", -pady => "2m", -sticky => "nswe");
+
+my %papers;
+my %defaultpaper;
+
+sub init_paper_xdvi {
+ if (!win32()) {
+ @{$papers{"xdvi"}} = get_paper_list("xdvi");
+ $defaultpaper{"xdvi"} = ${$papers{"xdvi"}}[0];
+ }
+}
+sub init_paper_pdftex {
+ @{$papers{"pdftex"}} = get_paper_list("pdftex");
+ $defaultpaper{"pdftex"} = ${$papers{"pdftex"}}[0];
+}
+sub init_paper_dvips {
+ @{$papers{"dvips"}} = get_paper_list("dvips");
+ $defaultpaper{"dvips"} = ${$papers{"dvips"}}[0];
+}
+sub init_paper_dvipdfm {
+ @{$papers{"dvipdfm"}} = get_paper_list("dvipdfm");
+ $defaultpaper{"dvipdfm"} = ${$papers{"dvipdfm"}}[0];
+}
+sub init_paper_context {
+ if (defined($localtlpdb->get_package("bin-context"))) {
+ @{$papers{"context"}} = get_paper_list("context");
+ $defaultpaper{"context"} = ${$papers{"context"}}[0];
+ }
+}
+sub init_paper_dvipdfmx {
+ @{$papers{"dvipdfmx"}} = get_paper_list("dvipdfmx");
+ $defaultpaper{"dvipdfmx"} = ${$papers{"dvipdfmx"}}[0];
+}
+
+my %init_paper_subs;
+$init_paper_subs{"xdvi"} = \&init_paper_xdvi;
+$init_paper_subs{"pdftex"} = \&init_paper_pdftex;
+$init_paper_subs{"dvips"} = \&init_paper_dvips;
+$init_paper_subs{"context"} = \&init_paper_context;
+$init_paper_subs{"dvipdfm"} = \&init_paper_dvipdfm;
+$init_paper_subs{"dvipdfmx"} = \&init_paper_dvipdfmx;
+
+sub init_all_papers {
+ for my $p (keys %init_paper_subs) {
+ &{$init_paper_subs{$p}}();
+ }
+}
+
+init_all_papers();
+
+my $row = 2;
+my (%l,%m,%r);
+foreach my $p (sort keys %papers) {
+ if (($p eq "context") && !defined($localtlpdb->get_package("bin-context"))) {
+ next;
+ }
+ $l{$p} = $back_config_pap->Label(-text => ___("defaultpaperfor") . " $p", -anchor => "w");
+ $m{$p} = $back_config_pap->Label(-textvariable => \$defaultpaper{$p}, -anchor => "w");
+ $r{$p} = $back_config_pap->Button(-text => ___"change",
+ -command => sub { select_paper($p); }, -anchor => "w");
+ $l{$p}->grid(-row => $row, -column => 1,
+ -padx => "2m", -pady => "2m", -sticky => "nsw");
+ $m{$p}->grid(-row => $row, -column => 2,
+ -padx => "2m", -pady => "2m", -sticky => "nsw");
+ $r{$p}->grid(-row => $row, -column => 3,
+ -padx => "2m", -pady => "2m", -sticky => "nsw");
+ $row++;
+}
+
+$back_config_pap->pack(-side => 'left', -fill => "both", -padx => "2m", -pady => "2m");
+
+
+my $back_config_act = $lower->Labelframe(-text => ___"actions");
+
+
+$back_config_act->Button(-text => ___"reinitlsr",
+ -command => sub { run_program_show_output("mktexlsr"); })->pack(-expand => 1, -fill => "x", -padx => "2m", -pady => "2m");
+$back_config_act->Button(-text => ___"recreateformats",
+ -command => sub { run_program_show_output("fmtutil-sys --all"); })->pack(-expand => 1, -fill => "x", -padx => "2m", -pady => "2m");
+$back_config_act->Button(-text => ___"updatemaps",
+ -command => sub { run_program_show_output("updmap-sys"); })->pack(-expand => 1, -fill => "x", -padx => "2m", -pady => "2m");
+
+$back_config_act->pack(-side => 'right', -fill => "both", -padx => "2m", -pady => "2m", -expand => 1, -ipadx => "2m", -ipady => "2m");
+
+
+
+sub menu_default_location {
+ my $val = $default_location;
+ my $sw = $mw->Toplevel(-title => ___"changedefaultsrc");
+ $sw->transient($mw);
+ $sw->grab();
+ $sw->Label(-text => ___"newdefaultsrc")->pack(-padx => "2m", -pady => "2m");
+
+ my $f1 = $sw->Frame;
+ my $entry = $f1->Entry(-text => $val, -width => 50);
+ $entry->pack(-side => "left",-padx => "2m", -pady => "2m");
+
+ my $f2 = $sw->Frame;
+ $f2->Button(-text => ___"choosedir",
+ -command => sub {
+ my $var = $sw->chooseDirectory;
+ if (defined($var)) {
+ $entry->delete(0,"end");
+ $entry->insert(0,$var);
+ }
+ })->pack(-side => "left",-padx => "2m", -pady => "2m");
+ $f2->Button(-text => ___"defaultnet",
+ -command => sub {
+ $entry->delete(0,"end");
+ $entry->insert(0,$TeXLiveURL);
+ })->pack(-side => "left",-padx => "2m", -pady => "2m");
+ $f1->pack;
+ $f2->pack;
+
+ my $f = $sw->Frame;
+ my $okbutton = $f->Button(-text => ___"ok",
+ -command => sub { $default_location = $entry->get;
+ $localtlpdb->option_location($default_location);
+ $localtlpdb->save;
+ $sw->destroy })->pack(-side => 'left',-padx => "2m", -pady => "2m");
+ my $cancelbutton = $f->Button(-text => ___"cancel",
+ -command => sub { $sw->destroy })->pack(-side => 'right',-padx => "2m", -pady => "2m");
+ $f->pack(-expand => 'x');
+ $sw->bind('<Return>', [ $okbutton, 'Invoke' ]);
+ $sw->bind('<Escape>', [ $cancelbutton, 'Invoke' ]);
+}
+
+sub toggle_setting() {
+ my ($key) = @_;
+ if ($key eq "formats") {
+ my $new = ($localtlpdb->option_create_formats ? 0 : 1);
+ $localtlpdb->option_create_formats($new);
+ $default_formats = ($new ? ___"yes" : ___"no");
+ } elsif ($key eq "srcfiles") {
+ my $new = ($localtlpdb->option_install_srcfiles ? 0 : 1);
+ $localtlpdb->option_install_srcfiles($new);
+ $default_srcfiles = ($new ? ___"yes" : ___"no");
+ } elsif ($key eq "docfiles") {
+ my $new = ($localtlpdb->option_install_docfiles ? 0 : 1);
+ $localtlpdb->option_install_docfiles($new);
+ $default_docfiles = ($new ? ___"yes" : ___"no");
+ }
+ $localtlpdb->save;
+}
+
+
+sub change_paper {
+ my ($prog, $pap) = @_;
+ if ($prog eq "all") {
+ execute_action_gui ("paper", $pap);
+ init_all_papers();
+ } else {
+ execute_action_gui ($prog, "paper", $pap);
+ &{$init_paper_subs{$prog}}();
+ }
+}
+
+sub select_paper {
+ my $prog = shift;
+ my $foo = $back_config->Toplevel(-title => ___("paperfor") . " $prog");
+ $foo->transient($mw);
+ $foo->grab();
+ my $var = $defaultpaper{$prog};
+ my $opt = $foo->BrowseEntry(-label => ___("defaultpaperfor") . " $prog", -variable => \$var);
+ foreach my $p (sort @{$papers{$prog}}) {
+ $opt->insert("end",$p);
+ }
+ $opt->pack(-padx => "2m", -pady => "2m");
+ my $f = $foo->Frame;
+ my $okbutton = $f->Button(-text => ___"ok", -command => sub { change_paper($prog,$var); $foo->destroy; })->pack(-side => "left", -padx => "2m", -pady => "2m");
+ my $cancelbutton = $f->Button(-text => ___"cancel", -command => sub { $foo->destroy; })->pack(-side => "left", -padx => "2m", -pady => "2m");
+ $f->pack;
+ $foo->bind('<Return>', [ $okbutton, 'Invoke' ]);
+ $foo->bind('<Escape>', [ $cancelbutton, 'Invoke' ]);
+}
+
+
+
+sub old_select_paper {
+ my $prog = shift;
+ my $foo = $back_config->Toplevel(-title => ___("paperfor") . " $prog");
+ my $var = $defaultpaper{$prog};
+ my @lop = @{$papers{$prog}};
+ my $nrpercols = 15;
+ my $row = 1;
+ my $col = 1;
+ foreach my $p (sort @{$papers{$prog}}) {
+ $foo->Radiobutton(-variable => \$var, -value => $p, -text => $p, -anchor => "w")->grid(-row => $row, -column => $col, -padx => "2m", -pady => "2m", -sticky => "nsw");
+ $row++;
+ if ($row > $nrpercols) {
+ $col++;
+ $row = 1;
+ }
+ }
+ $foo->Button(-text => ___"ok", -command => sub { change_paper($prog,$var); $foo->destroy; })->grid(-row => $nrpercols+1, -column => 1);
+ $foo->Button(-text => ___"cancel", -command => sub { $foo->destroy; })->grid(-row => $nrpercols+1, -column => 2);
+}
+
+1;
+
+### Local Variables:
+### perl-indent-level: 2
+### tab-width: 2
+### indent-tabs-mode: nil
+### End:
+# vim:set tabstop=2 expandtab: #
diff --git a/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui2.pl b/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui2.pl
index 0c44f972077..f765a0df31c 100755
--- a/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui2.pl
+++ b/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui2.pl
@@ -331,7 +331,7 @@ if (!win32()) {
require("gui-arch.pl");
}
# config screen
-require("gui-config.pl");
+require("gui-config2.pl");
if ($opt_load) {
run_update_functions();
@@ -383,7 +383,6 @@ sub set_text_win {
}
sub run_program_show_output {
- warn("tlmgr running old style way: @_");
my $td = $mw->Toplevel(-title => ___"tlmgr process");
$td->transient($mw);
$td->grab();