summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/install_any.pm5
-rw-r--r--perl-install/install_steps_gtk.pm24
2 files changed, 25 insertions, 4 deletions
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index 9f10eac6a..b207962c7 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -1033,11 +1033,14 @@ sub copy_advertising {
getAndSaveFile("$source_dir/$_", "$dir/$_");
s/\.png/\.pl/;
getAndSaveFile("$source_dir/$_", "$dir/$_");
- s/\.pl/\.png/;
+ s/\.pl/_icon\.png/;
+ getAndSaveFile("$source_dir/$_", "$dir/$_");
+ s/_icon\.png/\.png/;
}
@advertising_images = map { "$dir/$_" } @files;
}
}
+
sub remove_advertising {
my ($o) = @_;
unlink @advertising_images;
diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm
index bd3f75065..d8ba74121 100644
--- a/perl-install/install_steps_gtk.pm
+++ b/perl-install/install_steps_gtk.pm
@@ -536,10 +536,14 @@ sub installPackages {
my $f = $install_any::advertising_images[$i++ % @install_any::advertising_images];
log::l("advertising $f");
my $pl = $f; $pl =~ s/\.png$/\.pl/;
- my ($draw_text, $width, $height, @data);
+ my $icon_name = $f; $icon_name =~ s/\.png$/_icon\.png/;
+ my ($draw_text, $width, $height, @data, $icon, $icon_dx, $icon_dy, $icon_px);
-e $pl and $draw_text = 1;
eval(cat_($pl)) if $draw_text;
my ($pix, undef) = gtkcreate_png($f);
+ if ($icon) {
+ ($icon_px, undef) = gtkcreate_png($icon_name);
+ }
my $dbl_area;
my $darea = new Gtk::DrawingArea;
gtkpack($box, $advertising = !$draw_text ?
@@ -553,18 +557,32 @@ sub installPackages {
$pix, 0, 0, ($dx-$width)/2, 0, $width, $height);
my $gc_text = new Gtk::Gdk::GC($darea->window);
$gc_text->set_foreground(gtkcolor(65535, 65535, 65535));
+ my $yicon = 0;
+ my $decy = 0;
+ my $first = 1;
foreach (@data) {
my ($text, $x, $y, $area_width, $area_height, $bold) = @$_;
my ($width, $height, $lines, $widths, $heights, $ascents, $descents) =
get_text_coord ($text, $darea->style, $area_width, $area_height, 1, 0, 1, 1);
+ if ($first && $icon) {
+ my $iconx = ($dx-$width)/2 + $x + ${$widths}[0] - $icon_dx;
+ my $icony = $y + ${$heights}[0] - $icon_dy/2;
+ $icony > 0 or $icony = 0;
+ $dbl_area->draw_pixmap($darea->style->bg_gc('normal'), $icon_px, 0, 0,
+ $iconx, $icony, $icon_dx, $icon_dy
+ );
+ $yicon = $icony + $icon_dy;
+ }
my $i = 0;
+ $yicon > $y + ${$heights}[0] and $decy = $yicon - ($y + ${$heights}[$i]);
foreach (@{$lines}) {
$dbl_area->draw_string($darea->style->font, $gc_text,
- ($dx-$width)/2 + $x + ${$widths}[$i], $y + ${$heights}[$i], $_);
+ ($dx-$width)/2 + $x + ${$widths}[$i], $decy + $y + ${$heights}[$i], $_);
$bold and $dbl_area->draw_string($darea->style->font, $gc_text,
- ($dx-$width)/2 + $x + ${$widths}[$i] + 1, $y + ${$heights}[$i], $_);
+ ($dx-$width)/2 + $x + ${$widths}[$i] + 1, $decy + $y + ${$heights}[$i], $_);
$i++;
}
+ $first = 0;
}
}
$darea->window->draw_pixmap($darea->style->bg_gc('normal'),