summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perl-install/ugtk.pm72
1 files changed, 34 insertions, 38 deletions
diff --git a/perl-install/ugtk.pm b/perl-install/ugtk.pm
index b9df68c77..d2ecf7b83 100644
--- a/perl-install/ugtk.pm
+++ b/perl-install/ugtk.pm
@@ -3,7 +3,6 @@ package ugtk;
use diagnostics;
use strict;
use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $border);
-use MDK::Common::Math;
@ISA = qw(Exporter);
%EXPORT_TAGS = (
@@ -482,14 +481,14 @@ sub gtkicons_labels_widget {
my @tab;
my $i = 0;
my $cursor_hand = new Gtk::Gdk::Cursor 60;
+ my $state = 0;
foreach (@$args) {
my $label = $_->[0];
my $dbl_area;
- my $darea = new Gtk::DrawingArea;
- my $icon = gtkcreate_png_pixbuf($_->[1]);
- my $icon_h = gtkcreate_png_pixbuf("$_->[1]_highlight");
+ my $darea = gtkpng_pixbuf($_->[1]);
+ my $darea_h = gtkpng_pixbuf("$_->[1]_highlight");
+ my $state;
- $darea->{state} = 0;
$darea->signal_connect(expose_event => sub {
my ($widget, $event) = @_;
my ($dx, $dy) = ($darea->allocation->[2], $darea->allocation->[3]);
@@ -499,20 +498,21 @@ sub gtkicons_labels_widget {
1, 0, $background, $x_back2, $y_back2, 1, 0, $state);
($dx, $dy) = (max($width, $x_round), $y_round + $height);
$darea->set_usize($dx, $dy);
+ undef $dbl_area;
$dbl_area = new Gtk::Gdk::Pixmap($darea->window, max($width, $x_round), $y_round + $height);
$dbl_area->{state} = $darea->{state};
fill_tiled($darea, $dbl_area, $background, $x_back2, $y_back2, $dx, $dy);
- # FIXME: use renter_to
- my $ic = $darea->{state} ? $icon_h : $icon;
- #$event->{area}->[0], $event->{area}->[1],
+ # FIXME: use render_to
+ my $ic = $darea->{state} ? $darea_h : $darea;
+# #$event->{area}->[0], $event->{area}->[1],
+## $dbl_area->draw_pixmap($darea->style->bg_gc('normal'),
+## $darea->{state} ? $icon_h : $icon, 0, 0, ($dx - $icon_width)/2, 0, $icon_width, $icon_height);
# $dbl_area->draw_pixmap($darea->style->bg_gc('normal'),
-# $darea->{state} ? $icon_h : $icon, 0, 0, ($dx - $icon_width)/2, 0, $icon_width, $icon_height);
- $dbl_area->draw_pixmap($darea->style->bg_gc('normal'),
- $pix, 0, 0, ($dx - $width)/2, $y_round, $width, $height);
- $ic->render_to_drawable($darea->window, $darea->style->bg_gc('normal'),
- 0, 0, $event->{area}->[0], $event->{area}->[1], #($dx - $icon_width)/2,0,
- $ic->get_width, $ic->get_height,
- 'normal', $event->{area}->[0], $event->{area}->[1]);
+# $pix, 0, 0, ($dx - $width)/2, $y_round, $width, $height);
+# $ic->render_to_drawable($darea->window, $darea->style->bg_gc('normal'),
+# 0, 0, $event->{area}->[0], $event->{area}->[1], #($dx - $icon_width)/2,0,
+# $ic->get_width, $ic->get_height,
+# 'normal', $event->{area}->[0], $event->{area}->[1]);
}
$darea->window->draw_pixmap($darea->style->bg_gc('normal'),
$dbl_area, 0, 0, 0, 0, $dx, $dy);
@@ -520,32 +520,30 @@ sub gtkicons_labels_widget {
});
$darea->set_events(['exposure_mask', 'enter_notify_mask', 'leave_notify_mask', 'button_press_mask', 'button_release_mask' ]);
$darea->signal_connect(enter_notify_event => sub {
- if ($darea->{state} == 0) {
- $darea->{state} = 1;
- $darea->draw(undef);
- }
- });
+ if ($state == 0) {
+ $state = 1;
+ $darea->draw(undef);
+ }
+ });
$darea->signal_connect(leave_notify_event => sub {
- if ($darea->{state} == 1) {
- $darea->{state} = 0;
- $darea->draw(undef);
- }
- });
+ if ($state == 1) {
+ $state = 0;
+ $darea->draw(undef);
+ }
+ });
my $label_exec = $_->[0];
$darea->signal_connect(button_release_event => sub {
- $darea->{state} = 0;
- $darea->draw(undef);
- $exec_func->($exec_hash->{$label_exec});
-# $exec_hash->{$label_exec}{function}->($exec_hash->{$label_exec}{arg});
- });
+ $state = 0;
+ $darea->draw(undef);
+ $exec_func->($exec_hash->{$label_exec});
+ });
$darea->signal_connect(realize => sub { $darea->window->set_cursor($cursor_hand) });
- $tab[$i] = $darea;
- $i++;
+ $tab[$i++] = $darea;
}
my $fixed = new Gtk::Fixed;
foreach (@tab) { $fixed->put($_, 75, 65) }
my $redraw_function = sub {
- $fixed->move(@$_) foreach compute_icons($fixed->allocation->[2], $fixed->allocation->[3], 40, 15, 20, @tab);
+ $fixed->move(@$_) foreach compute_icons($fixed->allocation->[2], $fixed->allocation->[3], 40, 15, 20, @tab);
};
$fixed->signal_connect(expose_event => $redraw_function);
$fixed->signal_connect(realize => sub {
@@ -728,7 +726,7 @@ sub gtkcreate_xpm {
sub gtkpng_pixbuf {
my $pixbuf = gtkcreate_png_pixbuf(@_);
my ($rw, $width, $height) = (gtkroot(), $pixbuf->get_width(), $pixbuf->get_height);
- my $darea = new gtkset_usize(Gtk::DrawingArea, $width, $height);
+ my $darea = gtkset_usize(new Gtk::DrawingArea, $width, $height);
$darea->signal_connect(expose_event => sub {
my ($widget, $event) = @_;
@@ -749,7 +747,7 @@ sub gtkcreate_png_pixbuf {
Gtk::Gdk::Pixbuf->new_from_file($f) or die "gtkcreate_png: missing png file $f";
}
-# without alpha blender
+# without alpha blender (aka 1 transparency level only for old gtk::pixamp)
sub gtkcreate_png {
my $pixbuf = gtkcreate_png_pixbuf(@_);
return $pixbuf->render_pixmap_and_mask(127);
@@ -778,9 +776,7 @@ sub compute_icons {
my $nb = $#tab;
my $nb_sav = $nb;
my $index = 0;
- my @dx2;
- my @dx;
- my @dy;
+ my (@dx, @dx2, @dy);
my $line_up = 0;
bcl_init:
@dx2 = undef;