summaryrefslogtreecommitdiffstats
path: root/perl-install/install_gtk.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/install_gtk.pm')
-rw-r--r--perl-install/install_gtk.pm103
1 files changed, 87 insertions, 16 deletions
diff --git a/perl-install/install_gtk.pm b/perl-install/install_gtk.pm
index 9e38b3038..2840166dc 100644
--- a/perl-install/install_gtk.pm
+++ b/perl-install/install_gtk.pm
@@ -1,4 +1,4 @@
-package install_gtk;
+package install_gtk; # $Id$
use diagnostics;
use strict;
@@ -12,6 +12,7 @@ use devices;
#-INTERN CONSTANT
#-#####################################################################################
my @themes_vga16 = qw(blue blackwhite savane);
+my @themes_desktop = qw(mdk-Desktop DarkMarble marble3d blueHeart);
my @themes = qw(mdk DarkMarble marble3d blueHeart);
my (@background1, @background2);
@@ -34,6 +35,7 @@ sub load_rc {
sub default_theme {
my ($o) = @_;
+ @themes = @themes_desktop if $o->{meta_class} eq 'desktop';
@themes = @themes_vga16 if $o->{simple_themes} || $o->{vga16};
install_theme($o, $o->{theme} || $themes[0]);
}
@@ -41,7 +43,6 @@ sub default_theme {
#------------------------------------------------------------------------------
sub install_theme {
my ($o, $theme) = @_;
- $::live and return;
$o->{theme} = $theme || $o->{theme};
@@ -63,7 +64,8 @@ widget "*Steps*" style "small-font"
));
}
- gtkset_background(@background1);# unless $::testing;
+
+ gtkset_background(@background1) unless $::live; #- || testing;
create_logo_window($o);
create_help_window($o);
@@ -71,12 +73,12 @@ widget "*Steps*" style "small-font"
#------------------------------------------------------------------------------
sub create_big_help {
+ my ($o) = @_;
my $w = my_gtk->new('', grab => 1, force_position => [ $::stepswidth, $::logoheight ]);
$w->{rwindow}->set_usize($::logowidth, $::rootheight - $::logoheight);
gtkadd($w->{window},
gtkpack_(new Gtk::VBox(0,0),
- 1, createScrolledWindow(gtktext_insert(new Gtk::Text,
- formatAlaTeX(_ deref($help::steps{$::o->{step}})))),
+ 1, createScrolledWindow(gtktext_insert(new Gtk::Text, $o->{current_help})),
0, gtksignal_connect(my $ok = new Gtk::Button(_("Ok")), "clicked" => sub { Gtk->main_quit }),
));
$ok->grab_focus;
@@ -87,7 +89,6 @@ sub create_big_help {
#------------------------------------------------------------------------------
sub create_help_window {
my ($o) = @_;
- $::live and return;
my $w;
if ($w = $o->{help_window}) {
@@ -102,11 +103,10 @@ sub create_help_window {
my $pixmap = new Gtk::Pixmap(gtkcreate_xpm($w->{window}, "$ENV{SHARE_PATH}/help.xpm"));
gtkadd($w->{window},
gtkpack_(new Gtk::HBox(0,-2),
- 0, gtkadd(gtksignal_connect(new Gtk::Button, clicked => \&create_big_help), $pixmap),
+ 0, gtkadd(gtksignal_connect(new Gtk::Button, clicked => sub { create_big_help($o) }), $pixmap),
1, createScrolledWindow($o->{help_window_text} = new Gtk::Text),
));
- gtktext_insert($o->{help_window_text}, $o->{step} ? formatAlaTeX(_ deref($help::steps{$o->{step}})) : '');
-
+ $o->set_help($o->{step}) if $o->{step};
$w->show;
$o->{help_window} = $w;
}
@@ -114,7 +114,6 @@ sub create_help_window {
#------------------------------------------------------------------------------
sub create_steps_window {
my ($o) = @_;
- $::live and return;
my $PIX_H = my $PIX_W = 21;
@@ -126,7 +125,7 @@ sub create_steps_window {
$w->{rwindow}->set_usize($::stepswidth, $::stepsheight);
$w->{rwindow}->set_name('Steps');
$w->{rwindow}->set_events('button_press_mask');
- $w->show;
+ #$w->show;
gtkadd($w->{window},
gtkpack_(new Gtk::VBox(0,0),
@@ -181,7 +180,6 @@ sub create_steps_window {
#------------------------------------------------------------------------------
sub create_logo_window {
my ($o) = @_;
- $::live and return;
gtkdestroy($o->{logo_window});
my $w = bless {}, 'my_gtk';
@@ -190,7 +188,7 @@ sub create_logo_window {
$w->{rwindow}->set_usize($::logowidth, $::logoheight);
$w->{rwindow}->set_name("logo");
$w->show;
- my $file = "logo-mandrake.xpm";
+ my $file = $o->{meta_class} eq 'desktop' ? "logo-mandrake-Desktop.xpm" : "logo-mandrake.xpm";
-r $file or $file = "$ENV{SHARE_PATH}/$file";
if (-r $file) {
my $ww = $w->{window};
@@ -202,10 +200,8 @@ sub create_logo_window {
#------------------------------------------------------------------------------
sub init_sizes() {
-# my $maxheight = arch() eq "ppc" ? 1024 : 600;
-# my $maxwidth = arch() eq "ppc" ? 1280 : 800;
- ($::rootheight, $::rootwidth) = (480, 640);
($::rootheight, $::rootwidth) = my_gtk::gtkroot()->get_size;
+ $::live and $::rootheight -= 80;
#- ($::rootheight, $::rootwidth) = (min(768, $::rootheight), min(1024, $::rootwidth));
($::stepswidth, $::stepsheight) = (145, $::rootheight);
($::logowidth, $::logoheight) = ($::rootwidth - $::stepswidth, 40);
@@ -364,4 +360,79 @@ END
#- ModeLine "640x480" 28 640 672 768 800 480 490 492 525
+sub test_mouse {
+ my ($mouse) = @_;
+
+ my $w = my_gtk->new;
+ my ($width, $height, $offset) = (210, round_up($::windowheight - 150, 6), 25);
+ my ($bw, $bh) = ($width / 3, $height / 3);
+
+ gtkadd($w->{window},
+ gtkpack(new Gtk::VBox(0,0),
+ my $darea = gtkset_usize(new Gtk::DrawingArea, $width+1, $height+1),
+ '',
+ create_okcancel($w, '', '', "edge"),
+ ),
+ );
+
+ my $draw_rect; $draw_rect = sub {
+ my ($black, $fill, $rect) = @_;
+ $draw_rect->(0, 1, $rect) if !$fill; #- blank it first
+ $darea->window->draw_rectangle($black ? $darea->style->fg_gc('normal') : $darea->style->bg_gc('normal'), $fill, @$rect);
+ $darea->draw($rect);
+ };
+ my $paintWheel = sub {
+ my ($x, $y, $w, $h) = ($width / 2 - $bw / 6, $bh / 4, $bw / 3, $bh / 2);
+ $mouse->{nbuttons} = max($mouse->{nbuttons}, 5); #- it means, the mouse has more than 3 buttons...
+ $draw_rect->(1, 0, [ $x, $y, $w, $h ]);
+
+ my $offset = 0 if 0;
+ $offset += $_[0] if $_[0];
+ my $step = 10;
+ for (my $i = $offset % $step; $i < $h; $i += $step) {
+ $draw_rect->(1, 1, [ $x, $y + $i, $w, min(2, $h - $i) ]);
+ }
+ };
+ my $paintButton = sub {
+ my ($nb, $pressed) = @_;
+ my $rect = [ $bw * $nb, 0, $bw, $bh ];
+ $draw_rect->(1, $pressed, $rect);
+ $paintWheel->(0) if $nb == 1 && $mouse->{nbuttons} > 3;
+ };
+ my $draw_text = sub {
+ my ($t, $y) = @_;
+ my $font = $darea->style->font;
+ my $w = $font->string_width($t);
+ $darea->window->draw_string($font, $darea->style->fg_gc('normal'), ($width - $w) / 2, $y, $t);
+ };
+ my $default_time = 10;
+ my $time = $default_time;
+ $darea->signal_connect(button_press_event => sub {
+ my $b = $_[1]{button};
+ $time = $default_time;
+ $b >= 4 ?
+ $paintWheel->($b == 4 ? -1 : 1) :
+ $paintButton->($b - 1, 1);
+ });
+ $darea->signal_connect(button_release_event => sub {
+ my $b = $_[1]{button};
+ $paintButton->($b - 1, 0) if $b < 4;
+ });
+ $darea->size($width, $height);
+ $darea->set_events([ 'button_press_mask', 'button_release_mask' ]);
+
+ $w->sync; # HACK
+ $draw_rect->(1, 0, [ 0, 0, $width, $height]);
+ $draw_text->(_("Please test the mouse"), 2 * $bh - 20);
+ $draw_text->(_("To activate the mouse,"), 2 * $bh + 10) if $mouse->{XMOUSETYPE} eq 'IMPS/2';
+ $draw_text->(_("MOVE YOUR WHEEL!"), 2 * $bh + 30) if $mouse->{XMOUSETYPE} eq 'IMPS/2';
+
+ $paintButton->($_, 0) foreach 0..2;
+ $w->{cancel}->grab_focus;
+# my $timeout = Gtk->timeout_add(1000, sub { if ($time-- == 0) { log::l("timeout test_mouse"); undef $w->{retval}; Gtk->main_quit } 1 });
+# my $b = before_leaving { log::l("removing timeout"); Gtk->timeout_remove($timeout) };
+ $w->main;
+}
+
+
1;