diff options
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/drakxtools.spec | 7 | ||||
-rw-r--r-- | perl-install/harddrake/sound.pm | 1 | ||||
-rw-r--r-- | perl-install/ugtk.pm | 144 |
3 files changed, 87 insertions, 65 deletions
diff --git a/perl-install/drakxtools.spec b/perl-install/drakxtools.spec index 78bf9e114..02d6d7331 100644 --- a/perl-install/drakxtools.spec +++ b/perl-install/drakxtools.spec @@ -1,12 +1,12 @@ Summary: The drakxtools (XFdrake, diskdrake, keyboarddrake, mousedrake...) Name: drakxtools Version: 1.1.9 -Release: 18mdk +Release: 19mdk Url: http://www.linux-mandrake.com/en/drakx.php3 Source0: %name-%version.tar.bz2 License: GPL Group: System/Configuration/Other -Requires: %{name}-newt = %version-%release, perl-GTK >= 0.6123, perl-GTK-GdkPixBuf, XFree86-100dpi-fonts, XFree86-75dpi-fonts, /usr/X11R6/bin/xtest, font-tools, usermode >= 1.44-4mdk, perl-MDK-Common >= 1.0.3-12mdk +Requires: %{name}-newt = %version-%release, perl-GTK >= 0.6123, perl-GTK-GdkImlib, XFree86-100dpi-fonts, XFree86-75dpi-fonts, /usr/X11R6/bin/xtest, font-tools, usermode >= 1.44-4mdk, perl-MDK-Common >= 1.0.3-12mdk Conflicts: drakconf < 0.96-10mdk BuildRequires: gcc BuildRequires: gettext @@ -262,6 +262,9 @@ file /etc/sysconfig/harddrake2/previous_hw | fgrep -q perl && \ %config(noreplace) %_sysconfdir/logrotate.d/drakxtools-http %changelog +* Fri Aug 23 2002 Thierry Vignaud <tvignaud@mandrakesoft.com> 1.1.9-19mdk +- draksound: use right sound slot + * Fri Aug 23 2002 Thierry Vignaud <tvignaud@mandrakesoft.com> 1.1.9-18mdk - ugtk: fix most mcc memory leaks (pending ones seems related to perl-gtk) - tinyfirewall: misc fixes (pixel) diff --git a/perl-install/harddrake/sound.pm b/perl-install/harddrake/sound.pm index 3bdfb7697..d1af14606 100644 --- a/perl-install/harddrake/sound.pm +++ b/perl-install/harddrake/sound.pm @@ -149,7 +149,6 @@ sub switch { my ($in, $device) = @_; my $driver = $device->{driver}; my $alternative = get_alternative($driver); -# $alternative = [ "i810_audio", "snd-intel8x0"]; if ($alternative) { my $new_driver = $alternative->[0]; if ($driver eq "unknown") { diff --git a/perl-install/ugtk.pm b/perl-install/ugtk.pm index b9df68c77..d98bb1ac5 100644 --- a/perl-install/ugtk.pm +++ b/perl-install/ugtk.pm @@ -3,20 +3,30 @@ package ugtk; use diagnostics; use strict; use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $border); -use MDK::Common::Math; @ISA = qw(Exporter); %EXPORT_TAGS = ( helpers => [ qw(createScrolledWindow create_menu create_notebook create_packtable create_hbox create_vbox create_adjustment create_box_with_title create_treeitem) ], - wrappers => [ qw(gtksignal_connect gtkradio gtkpack gtkpack_ gtkpack__ gtkpack2 gtkpack3 gtkpack2_ gtkpack2__ gtkpowerpack gtkcombo_setpopdown_strings gtkset_editable gtksetstyle gtkset_text gtkset_tip gtkappenditems gtkappend gtkset_shadow_type gtkset_layout gtkset_relief gtkadd gtkexpand gtkput gtktext_insert gtkset_usize gtksize gtkset_justify gtkset_active gtkset_sensitive gtkset_modal gtkset_border_width gtkmove gtkresize gtkshow gtkhide gtkdestroy gtkflush gtkcolor gtkset_mousecursor gtkset_mousecursor_normal gtkset_mousecursor_wait gtkset_background gtkset_default_fontset gtkctree_children gtkxpm gtkpng create_pix_text get_text_coord fill_tiled gtkicons_labels_widget write_on_pixmap gtkcreate_xpm gtkcreate_png gtkcreate_png_pixbuf gtkbuttonset gtkroot gtkentry) ], + wrappers => [ qw(gtksignal_connect gtkradio gtkpack gtkpack_ gtkpack__ gtkpack2 gtkpack3 gtkpack2_ gtkpack2__ gtkpowerpack gtkcombo_setpopdown_strings gtkset_editable gtksetstyle gtkset_text gtkset_tip gtkappenditems gtkappend gtkset_shadow_type gtkset_layout gtkset_relief gtkadd gtkexpand gtkput gtktext_insert gtkset_usize gtksize gtkset_justify gtkset_active gtkset_sensitive gtkset_modal gtkset_border_width gtkmove gtkresize gtkshow gtkhide gtkdestroy gtkflush gtkcolor gtkset_mousecursor gtkset_mousecursor_normal gtkset_mousecursor_wait gtkset_background gtkset_default_fontset gtkctree_children gtkxpm gtkpng create_pix_text get_text_coord fill_tiled gtkicons_labels_widget write_on_pixmap gtkcreate_xpm gtkcreate_png gtkbuttonset gtkroot gtkentry) ], various => [ qw(add2notebook add_icon_path n_line_size) ], ); $EXPORT_TAGS{all} = [ map { @$_ } values %EXPORT_TAGS ]; @EXPORT_OK = map { @$_ } values %EXPORT_TAGS; +my $use_pixbuf; +my $use_imlib; +my $use_gnome; + +BEGIN { +# eval { require Gtk::Gdk::Pixbuf; Gtk::Gdk::Pixbuf->init }; + $use_pixbuf = 0;# = $@ ? 0 : 1; + eval { require Gtk::Gdk::ImlibImage; Gtk::Gdk::ImlibImage->init }; + $use_imlib = $@ ? 0 : 1; + eval { require Gnome }; + $use_gnome = $@ ? 0 : 1; +} + use Gtk; -use Gtk::Gdk::Pixbuf; -Gtk::Gdk::Pixbuf->init; use c; use log; @@ -388,14 +398,17 @@ sub add2notebook { my ($n, $title, $book) = @_; my ($w1, $w2) = map { new Gtk::Label($_) } $title, $title; $book->{widget_title} = $w1; - $n->append_page_menu(gtkshow($book), gtkshow($w1), gtkshow($w2)); + $n->append_page_menu($book, $w1, $w2); + $book->show; + $w1->show; + $w2->show; } sub tree_set_icon { my ($node, $label, $icon) = @_; my $hbox = new Gtk::HBox(0,0); - gtkpack__(1, $hbox, gtkshow(gtkpng_pixbuf($icon)), gtkshow(new Gtk::Label($label))); + gtkpack__(1, $hbox, gtkshow(gtkpng($icon)), gtkshow(new Gtk::Label($label))); gtkadd($node, gtkshow($hbox)); } @@ -482,47 +495,54 @@ sub gtkicons_labels_widget { my @tab; my $i = 0; my $cursor_hand = new Gtk::Gdk::Cursor 60; + my $cursor_normal = new Gtk::Gdk::Cursor 68; 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 ($icon, undef) = gtkcreate_png($_->[1]); + my ($icon_h, undef) = gtkcreate_png("$_->[1]_highlight"); + + my $imlib_icon_h; + my $imlib_counter = 0; + my $imlib_counter_add = 1; + my $imlib_icon_h_width; + my $imlib_icon_h_height; + + if ($use_imlib) { + $imlib_icon_h = gtkcreate_imlib("$_->[1]_highlight"); + $imlib_icon_h_width = $imlib_icon_h->rgb_width; + $imlib_icon_h_height = $imlib_icon_h->rgb_height; + } $darea->{state} = 0; $darea->signal_connect(expose_event => sub { - my ($widget, $event) = @_; - my ($dx, $dy) = ($darea->allocation->[2], $darea->allocation->[3]); - if (!defined($dbl_area) || $darea->{state} != $dbl_area->{state}) { - my $state = $darea->{state}; - my ($pix, $width, $height) = create_pix_text($darea, $label, $color_text, $widget_for_font->style->font, $x_round, 1, - 1, 0, $background, $x_back2, $y_back2, 1, 0, $state); - ($dx, $dy) = (max($width, $x_round), $y_round + $height); - $darea->set_usize($dx, $dy); - $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], -# $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]); - } - $darea->window->draw_pixmap($darea->style->bg_gc('normal'), - $dbl_area, 0, 0, 0, 0, $dx, $dy); - ($darea->{dx}, $darea->{dy}) = ($dx, $dy); - }); + my ($dx, $dy) = ($darea->allocation->[2], $darea->allocation->[3]); + if (!defined($dbl_area) || $darea->{state} != $dbl_area->{state}) { + my $state = $darea->{state}; + my ($pix, $width, $height) = create_pix_text($darea, $label, $color_text, $widget_for_font->style->font, $x_round, 1, + 1, 0, $background, $x_back2, $y_back2, 1, 0, $state); + ($dx, $dy) = (max($width, $x_round), $y_round + $height); + $darea->set_usize($dx, $dy); + $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); + $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); + } + $darea->window->draw_pixmap($darea->style->bg_gc('normal'), + $dbl_area, 0, 0, 0, 0, $dx, $dy); + ($darea->{dx}, $darea->{dy}) = ($dx, $dy); + }); $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); + $imlib_counter = 0; + $imlib_counter_add = 1; } }); $darea->signal_connect(leave_notify_event => sub { @@ -617,7 +637,9 @@ sub create_pix_text { my $style = $fake_darea->style->copy(); if (ref($font) eq 'Gtk::Gdk::Font') { $style->font($font); - } else { $font and $style->font(Gtk::Gdk::Font->fontset_load($font)) } + } else { + $font and $style->font(Gtk::Gdk::Font->fontset_load($font)); + } $fake_darea->set_style($style); my ($width, $height, $lines, $widths, $heights) = get_text_coord ( $text, $fake_darea, $max_width, $max_height, $can_be_greater, $can_be_smaller, $centeredx, $centeredy); @@ -713,9 +735,15 @@ sub gtkset_default_fontset { Gtk::Widget->set_default_style($style); } +sub gtkcreate_imlib { + my ($f) = shift; + $f =~ m|.png$| or $f = "$f.png"; + if ($f !~ /\//) { -e "$_/$f" and $f = "$_/$f", last foreach icon_paths() } + Gtk::Gdk::ImlibImage->load_image($f); +} + sub gtkxpm { new Gtk::Pixmap(gtkcreate_xpm(@_)) } sub gtkpng { new Gtk::Pixmap(gtkcreate_png(@_)) } - sub gtkcreate_xpm { my ($f) = @_; my $rw = gtkroot(); @@ -725,36 +753,28 @@ sub gtkcreate_xpm { @l; } -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); - - $darea->signal_connect(expose_event => sub { - my ($widget, $event) = @_; - $pixbuf->render_to_drawable($widget->window, $widget->style->fg_gc('normal'), - $event->{area}->[0], $event->{area}->[1], - $event->{area}->[0], $event->{area}->[1], - min($width - $event->{area}->[0], $event->{area}->[2]), - max($width - $event->{area}->[1], $event->{area}->[3]), - 'normal', $event->{area}->[0], $event->{area}->[1]); - }); - return $darea; -} - -sub gtkcreate_png_pixbuf { +sub gtkcreate_png { my ($f) = shift; $f =~ m|.png$| or $f = "$f.png"; if ($f !~ /\//) { -e "$_/$f" and $f = "$_/$f", last foreach icon_paths() } - Gtk::Gdk::Pixbuf->new_from_file($f) or die "gtkcreate_png: missing png file $f"; + if ($use_pixbuf) { + my $pixbuf = Gtk::Gdk::Pixbuf->new_from_file($f) or die "gtkcreate_png: missing png file $f"; + my ($width, $height) = ($pixbuf->get_width(), $pixbuf->get_height); + my $rw = gtkroot(); + my $pix = new Gtk::Gdk::Pixmap($rw, $width, $height, 16); + $pixbuf->render_to_drawable_alpha($pix, 0, 0, 0, 0, $width, $height, 'bilevel', 127, 'normal', 0, 0); + my $bit = new Gtk::Gdk::Bitmap($rw, $width, $height, 1); + $pixbuf->render_threshold_alpha($bit, 0, 0, 0, 0, $width, $height, '127'); + return ($pix, $bit); + } elsif ($use_imlib) { + my $im = Gtk::Gdk::ImlibImage->load_image($f) or die "gtkcreate_png: missing png file $f"; + $im->render($im->rgb_width, $im->rgb_height); + return ($im->move_image(), $im->move_mask); + } else { + die "gtkcreate_png: cannot find a suitable library for rendering png (imlib1 or gdk_pixbuf)"; + } } -# without alpha blender -sub gtkcreate_png { - my $pixbuf = gtkcreate_png_pixbuf(@_); - return $pixbuf->render_pixmap_and_mask(127); - } - sub xpm_d { my $w = shift; Gtk::Gdk::Pixmap->create_from_xpm_d($w->window, undef, @_) } sub fill_tiled { |