summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>1999-07-30 11:16:01 +0000
committerPascal Rigaux <pixel@mandriva.com>1999-07-30 11:16:01 +0000
commit3d79e422764401cf0d18a86bdf2679511119cdbc (patch)
treed54b9d808abea542594e7a7b5da7687d27dfa474 /perl-install
parent0ec07d89144fab40d351a24dca0645eca179ce29 (diff)
downloaddrakx-backup-do-not-use-3d79e422764401cf0d18a86bdf2679511119cdbc.tar
drakx-backup-do-not-use-3d79e422764401cf0d18a86bdf2679511119cdbc.tar.gz
drakx-backup-do-not-use-3d79e422764401cf0d18a86bdf2679511119cdbc.tar.bz2
drakx-backup-do-not-use-3d79e422764401cf0d18a86bdf2679511119cdbc.tar.xz
drakx-backup-do-not-use-3d79e422764401cf0d18a86bdf2679511119cdbc.zip
no_comment
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/Makefile11
-rw-r--r--perl-install/Xconfigurator.pm111
-rw-r--r--perl-install/Xconfigurator_consts.pm15
-rw-r--r--perl-install/common.pm3
-rw-r--r--perl-install/interactive.pm8
-rw-r--r--perl-install/share/po/Makefile2
6 files changed, 108 insertions, 42 deletions
diff --git a/perl-install/Makefile b/perl-install/Makefile
index 30ea0be7f..c4567e638 100644
--- a/perl-install/Makefile
+++ b/perl-install/Makefile
@@ -5,18 +5,19 @@ DEST = $(ROOTDEST)/Mandrake/instimage
DESTREP4PMS = $(DEST)/usr/bin/perl-install
PERL = perl
LOCALFILES = $(PERL) mouseconfig
+DIRS = po pci_probing
EXCLUDE = $(LOCALFILES) boot.img keymaps xmodmaps consolefonts install
-.PHONY: all po tags install clean verify_c
+.PHONY: all $(DIRS) tags install clean verify_c
-all: $(SO_FILES) po install1_hd
+all: $(SO_FILES) $(DIRS) install1_hd
tags:
etags -o - $(PMS) | perl2etags > TAGS
clean:
test ! -e c/Makefile || $(MAKE) -C c clean
- $(MAKE) -C po clean
+ for i in $(DIRS); do $(MAKE) -C $$i clean; done
rm -f c/c.xs install1_hd gendepslist
find . -name "*~" -o -name "TAGS" -o -name "*.old" | xargs rm -f
@@ -41,8 +42,8 @@ $(SO_FILES): c/c.xs
install1_hd: install1_hd.c
$(CC) -static -Wall -o $@ $<
-po:
- $(MAKE) -C po
+$(DIRS):
+ $(MAKE) -C $@
test_pms: verify_c
perl2fcalls -excludec install2
diff --git a/perl-install/Xconfigurator.pm b/perl-install/Xconfigurator.pm
index f9f84bdbf..17c553a0c 100644
--- a/perl-install/Xconfigurator.pm
+++ b/perl-install/Xconfigurator.pm
@@ -2,13 +2,14 @@ package Xconfigurator;
use diagnostics;
use strict;
-use vars qw($in $install $resolution_wanted @depths @resolutions @accelservers @allservers %videomemory @ramdac_name @ramdac_id @clockchip_name @clockchip_id %keymap_translate @vsync_range %standard_monitors $intro_text $finalcomment_text $s3_comment $cirrus_comment $probeonlywarning_text $monitorintro_text $hsyncintro_text $vsyncintro_text $XF86firstchunk_text $keyboardsection_start $keyboardsection_part2 $keyboardsection_end $pointersection_text1 $pointersection_text2 $monitorsection_text1 $monitorsection_text2 $monitorsection_text3 $monitorsection_text4 $modelines_text_Trident_TG_96xx $modelines_text $devicesection_text $screensection_text1);
+use vars qw($in $install $resolution_wanted @depths %depths @resolutions @accelservers @allservers %videomemory @ramdac_name @ramdac_id @clockchip_name @clockchip_id %keymap_translate @vsync_range %standard_monitors $intro_text $finalcomment_text $s3_comment $cirrus_comment $probeonlywarning_text $monitorintro_text $hsyncintro_text $vsyncintro_text $XF86firstchunk_text $keyboardsection_start $keyboardsection_part2 $keyboardsection_end $pointersection_text1 $pointersection_text2 $monitorsection_text1 $monitorsection_text2 $monitorsection_text3 $monitorsection_text4 $modelines_text_Trident_TG_96xx $modelines_text $devicesection_text $screensection_text1);
use pci_probing::main;
use common qw(:common :file);
use log;
use Xconfigurator_consts;
+use my_gtk qw(:wrappers);
my $tmpconfig = "/tmp/Xconfig";
@@ -120,7 +121,7 @@ sub findLegalModes {
my ($card) = @_;
my $mem = $card->{memory} || 1000000;
- foreach (@resolutions) {
+ foreach (reverse @resolutions) {
my ($h, $v) = split 'x';
foreach $_ (@depths) {
@@ -230,7 +231,14 @@ sub testFinalConfig($) {
my ($h, $w) = Gtk::Gdk::Window->new_foreign(Gtk::Gdk->ROOT_WINDOW)->get_size;
$my_gtk::force_position = [ $w / 3, $h / 2.4 ];
$my_gtk::force_focus = 1;
- exit !interactive_gtk->new->ask_yesorno('', _("It this ok?"));
+ my $text = Gtk::Label->new;
+ my $time = 8;
+ Gtk->timeout_add(1000, sub {
+ $text->set(_("(leaving in %d seconds)", $time));
+ $time-- or Gtk->main_quit;
+ });
+
+ exit !interactive_gtk->new->ask_yesorno('', [ _("Is this ok?"), $text ], 1);
};
my $rc = close F;
kill 2, $pid;
@@ -242,8 +250,6 @@ sub autoResolutions($) {
my ($o) = @_;
my $card = $o->{card};
- my $hres_wanted = first(split 'x', $o->{resolution_wanted});
-
# For the mono and vga16 server, no further configuration is required.
return if member($card->{server}, "Mono", "VGA16");
@@ -257,16 +263,27 @@ sub autoResolutions($) {
delete $card->{depth}->{$_};
} else {
$card->{clocklines} ||= $clocklines unless $card->{flags}->{noclockprobe};
- $card->{depth}->{$_} = $resolutions;
+ $card->{depth}->{$_} = [ sort { $b->[0] <=> $a->[0] } @$resolutions ];
+ }
+ }
+}
- $ok ||= $resolutions;
- my ($b) = sort { $b->[0] <=> $a->[0] } @$resolutions;
+sub autoDefaultDepth($$) {
+ my ($card, $resolution_wanted) = @_;
+ my $wres_wanted = first(split 'x', $resolution_wanted);
+ my $depth = $card->{default_depth};
- # require $resolution_wanted, no matter what bpp this requires
- $card->{default_depth} = $_, last if $b->[0] >= $hres_wanted;
- }
+ # unset default_depth if there is no resolution in this depth
+ undef $depth if $depth && !$card->{depth}->{$depth};
+ my $best = $depth;
+
+ while (my ($d, $r) = each %{$card->{depth}}) {
+ $depth = $depth ? max($depth, $d) : $d;
+
+ # try to have $resolution_wanted
+ $best = $best ? max($best, $d) : $d if $r->[0][0] >= $wres_wanted;
}
- $ok or die "no valid modes";
+ $card->{default_depth} = $best || $depth or die "no valid modes";
}
@@ -311,12 +328,62 @@ Do you want to try?"))) {
# restore the virtual console
setVirtual($vt);
}
- my %l;
- foreach ($card->{depth})
- ask_from_list(_("Resolution"),
- _("Choose resolution and color depth"),
- [ ]);
+ autoDefaultDepth($card, $o->{resolution_wanted} || $resolution_wanted);
+
+
+ my $W = my_gtk->new(_("Resolution"));
+ my %txt2depth = reverse %depths;
+ my $chosen_depth = $card->{default_depth};
+ my $chosen_w = 9999999; # will be set by the combo callback
+ my ($r, $depth_combo, %w2depth, %w2h, %w2widget);
+
+ my $set_depth = sub { $depth_combo->entry->set_text(translate($depths{$chosen_depth})) };
+
+
+ while (my ($depth, $res) = each %{$card->{depth}}) {
+ foreach (@$res) {
+ $w2h{$_->[0]} = $_->[1];
+ push @{$w2depth{$_->[0]}}, $depth;
+ }
+ }
+ while (my ($w, $h) = each %w2h) {
+ my $V = $w . "x" . $h;
+ $w2widget{$w} = $r = new Gtk::RadioButton($r ? ($V, $r) : $V);
+ $r->signal_connect("clicked" => sub {
+ $chosen_w = $w;
+ unless (member($chosen_depth, @{$w2depth{$w}})) {
+ $chosen_depth = max(@{$w2depth{$w}});
+ &$set_depth();
+ }
+ });
+ }
+
+ gtkadd($W->{window},
+ gtkpack_($W->create_box_with_title(_("Choose resolution and color depth")),
+ 1, gtkpack(new Gtk::HBox(0,20),
+ $depth_combo = new Gtk::Combo,
+ gtkpack_(new Gtk::VBox(0,0),
+ map { 0, $w2widget{$_} } ikeys(%w2widget),
+ ),
+ ),
+ 0, $W->create_okcancel,
+ ));
+ $depth_combo->disable_activate;
+ $depth_combo->set_use_arrows_always(1);
+ $depth_combo->entry->set_editable(0);
+ $depth_combo->set_popdown_strings(map { translate($depths{$_}) } ikeys(%{$card->{depth}}));
+ $depth_combo->entry->signal_connect(changed => sub {
+ $chosen_depth = $txt2depth{untranslate($depth_combo->entry->get_text, keys %txt2depth)};
+ my $w = $card->{depth}->{$chosen_depth}->[0][0];
+ $chosen_w > $w and $w2widget{$chosen_w = $w}->set_active(1);
+ });
+ &$set_depth();
+ my $rc = $W->main;
+
+ $card->{default_depth} = $chosen_depth;
+ $card->{depth}->{$chosen_depth} = [ grep { $_->[0] <= $chosen_w } @{$card->{depth}->{$chosen_depth}} ];
+ $rc;
}
@@ -417,7 +484,7 @@ Section "Screen"
);
print F " DefaultColorDepth $defdepth\n" if $defdepth;
- foreach (sort { $a <=> $b } keys %$depths) {
+ foreach (ikeys(%$depths)) {
my $m = join(" ",
map { '"' . join("x", @$_) . '"' }
sort { $b->[0] <=> $a->[0] } @{$depths->{$_}});
@@ -474,19 +541,17 @@ sub main {
$in = $interact;
$install = $install_pkg;
- $o->{resolution_wanted} ||= $resolution_wanted;
-
XF86check_link();
$o->{card} = cardConfiguration($o->{card});
$o->{monitor} = monitorConfiguration($o->{monitor});
- resolutionsConfiguration($o);
+ my $ok = resolutionsConfiguration($o);
- my $ok = testFinalConfig($o);
- my $quit;
+ $ok &&= testFinalConfig($o);
+ my $quit;
until ($ok || $quit) {
my %c = my @c = (
diff --git a/perl-install/Xconfigurator_consts.pm b/perl-install/Xconfigurator_consts.pm
index 841704332..ae8f39d9d 100644
--- a/perl-install/Xconfigurator_consts.pm
+++ b/perl-install/Xconfigurator_consts.pm
@@ -4,15 +4,14 @@ use common qw(:common);
uk => "gb",
);
-@depths = qw(8 15 16 24 32);
-
-%depths_text = (
- __("256 colors") => 8,
- __("32 thousand colors") => 15,
- __("65 thousand colors") => 16,
- __("16 millions of colors") => 24,
- __("4 billions of colors") => 32,
+%depths = (
+ 8 => __("256 colors"),
+ 15 => __("32 thousand colors"),
+ 16 => __("65 thousand colors"),
+ 24 => __("16 millions of colors"),
+ 32 => __("4 billions of colors"),
);
+@depths = ikeys(%depths);
$resolution_wanted = "1024x768";
@resolutions = qw(640x480 800x600 1024x768 1152x864 1280x1024 1600x1200);
diff --git a/perl-install/common.pm b/perl-install/common.pm
index ec8f92366..c6d96682c 100644
--- a/perl-install/common.pm
+++ b/perl-install/common.pm
@@ -6,7 +6,7 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $printable_chars $sizeof_int $bitof_int
@ISA = qw(Exporter);
%EXPORT_TAGS = (
- common => [ qw(_ __ min max sum bool member divide is_empty_array_ref add2hash set_new set_add round_up round_down first second top uniq translate untranslate) ],
+ common => [ qw(_ __ min max sum bool ikeys member divide is_empty_array_ref add2hash set_new set_add round_up round_down first second top uniq translate untranslate) ],
functional => [ qw(fold_left) ],
file => [ qw(dirname basename touch all glob_ cat_ chop_ mode) ],
system => [ qw(sync makedev unmakedev psizeof strcpy gettimeofday syscall_ crypt_) ],
@@ -30,6 +30,7 @@ sub first { $_[0] }
sub second { $_[1] }
sub top { $_[$#_] }
sub uniq { my %l; @l{@_} = (); keys %l }
+sub ikeys { my %l = @_; sort { $a <=> $b } keys %l }
sub add2hash { my ($a, $b) = @_; while (my ($k, $v) = each %{$b || {}}) { $a->{$k} ||= $v } }
sub member { my $e = shift; foreach (@_) { $e eq $_ and return 1 } 0 }
sub dirname { @_ == 1 or die "usage: dirname <name>\n"; local $_ = shift; s|[^/]*/*\s*$||; s|(.)/*$|$1|; $_ || '.' }
diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm
index 977adea5a..65b3c895b 100644
--- a/perl-install/interactive.pm
+++ b/perl-install/interactive.pm
@@ -19,12 +19,12 @@ sub ask_warn($$$) {
ask_from_list($o, $title, $message, [ _("Ok") ]);
}
sub ask_yesorno($$$) {
- my ($o, $title, $message) = @_;
- ask_from_list_($o, $title, $message, [ __("Yes"), __("No") ]) eq "Yes";
+ my ($o, $title, $message, $def) = @_;
+ ask_from_list_($o, $title, $message, [ __("Yes"), __("No") ], $def ? "No" : "Yes") eq "Yes";
}
sub ask_okcancel($$$) {
- my ($o, $title, $message) = @_;
- ask_from_list_($o, $title, $message, [ __("Ok"), __("Cancel") ]) eq "Ok";
+ my ($o, $title, $message, $def) = @_;
+ ask_from_list_($o, $title, $message, [ __("Ok"), __("Cancel") ], $def ? "Cancel" : "Ok") eq "Ok";
}
sub ask_from_list_($$$$;$) {
my ($o, $title, $message, $l, $def) = @_;
diff --git a/perl-install/share/po/Makefile b/perl-install/share/po/Makefile
index 6743ddaf9..8c7948b42 100644
--- a/perl-install/share/po/Makefile
+++ b/perl-install/share/po/Makefile
@@ -1,4 +1,4 @@
-PMSFILES = $(shell find .. -name "*.pm")
+PMSFILES = $(shell find .. -name "*.pm" | grep -v "^../po")
POFILES = $(wildcard *.po)
FROMPOFILES = $(POFILES:%.po=%.pm)