From 37b4a6af5d84be4dc98f03ea34e0639e5300b54f Mon Sep 17 00:00:00 2001 From: damien Date: Mon, 10 Sep 2001 18:05:11 +0000 Subject: mouse test moved --- perl-install/install_gtk.pm | 96 --------------------------------------------- 1 file changed, 96 deletions(-) (limited to 'perl-install/install_gtk.pm') diff --git a/perl-install/install_gtk.pm b/perl-install/install_gtk.pm index 778f75381..da7ade600 100644 --- a/perl-install/install_gtk.pm +++ b/perl-install/install_gtk.pm @@ -434,100 +434,4 @@ 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(min(350, $::windowheight - 150), 6), 25); - my $darea = new Gtk::DrawingArea; - $darea->set_events([ 'button_press_mask', 'button_release_mask' ]); #$darea must be unrealized. - gtkadd($w->{window}, - gtkpack(my $vbox_grab = new Gtk::VBox(0,0), - gtksize(gtkset_usize($darea, $width+1, $height+1), $width+1, $height+1), - my $okcancel = gtkset_sensitive(create_okcancel($w, '', '', "edge"), 0), - ), - ); - $okcancel->set_uposition(2, $height-23); -# $w->{window}->set_usize($width+1, $height+1); - Gtk->timeout_add(2000, sub { gtkset_sensitive($okcancel, 1) }); - - $darea->realize(); - my ($m3_image, $m3_mask) = gtkcreate_xpm($darea, 'mouse_3b.xpm'); - my ($m3_imagep, $m3_maskp) = gtkcreate_xpm($darea, 'mouse_3b+.xpm'); - my ($m3_left, $m3_left_mask) = gtkcreate_xpm($darea, 'mouse_left.xpm'); - my ($m3_right, $m3_right_mask) = gtkcreate_xpm($darea, 'mouse_right.xpm'); - my ($m3_middle, $m3_middle_mask) = gtkcreate_xpm($darea, 'mouse_middle.xpm'); - my $image = $m3_image; - $mouse->{nbuttons} > 3 and $image = $m3_imagep; - 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->black_gc, ($width - $w) / 2, $y, $t); - }; - my $drawarea; $drawarea = sub { $darea->window->draw_pixmap ($darea->style->bg_gc('normal'), - $image, 0, 0, - ($darea->allocation->[2]-$width)/2, ($darea->allocation->[3]-$height)/2, - 210, 350); - $draw_text->(_("Please test the mouse"), $height - 80); - $draw_text->(_("To activate the mouse,"), $height - 65) if $mouse->{XMOUSETYPE} eq 'IMPS/2'; - $draw_text->(_("MOVE YOUR WHEEL!"), $height - 50) if $mouse->{XMOUSETYPE} eq 'IMPS/2'; - }; - - my $paintButton = sub { - my ($nb, $pressed) = @_; - my $x = 60 + $nb*33; - $drawarea->(); - if ($nb == 0) { - $darea->window->draw_pixmap ($darea->style->bg_gc('normal'), - $m3_left, 0, 0, - ($darea->allocation->[2]-$width)/2+31, ($darea->allocation->[3]-$height)/2 + 52, - 59, 91); - } elsif ($nb == 2) { - $darea->window->draw_pixmap ($darea->style->bg_gc('normal'), - $m3_right, 0, 0, - ($darea->allocation->[2]-$width)/2+117, ($darea->allocation->[3]-$height)/2 + 52, - 61, 91); - } elsif ($nb == 1) { - if ($mouse->{nbuttons} > 3) { - $darea->window->draw_pixmap ($darea->style->bg_gc('normal'), - $m3_middle, 0, 0, - ($darea->allocation->[2]-$width)/2+98, ($darea->allocation->[3]-$height)/2 + 67, - 13, 62); - } else { - $darea->window->draw_arc ( $darea->style->black_gc, - 1, ($darea->allocation->[2]-$width)/2 + $x, ($darea->allocation->[3]-$height)/2 + 90, 20, 25, - 0, 360*64); - } - } elsif ($nb == 4) { - $darea->window->draw_pixmap ($darea->style->bg_gc('normal'), - $m3_middle, 0, 0, - ($darea->allocation->[2]-$width)/2+98, ($darea->allocation->[3]-$height)/2 + 67, - 13, 62) - } elsif ($nb == 5) { - $darea->window->draw_pixmap ($darea->style->bg_gc('normal'), - $m3_middle, 0, 0, - ($darea->allocation->[2]-$width)/2+98, ($darea->allocation->[3]-$height)/2 + 67, - 13, 62) - } - }; - $darea->signal_connect(button_press_event => sub { - my $b = $_[1]{button}; - $paintButton->($b - 1); - }); - $darea->signal_connect(button_release_event => sub { - $drawarea->() - }); - $darea->signal_connect(expose_event => sub { $drawarea->() }); - $darea->size($width, $height); - $darea->set_events([ 'button_press_mask', 'button_release_mask' ]); - $w->sync; # HACK -# $okcancel->draw(undef); - Gtk::Gdk->pointer_grab($darea->window, 1, - [ 'pointer_motion_mask'], - $darea->window, undef ,0); - $w->main; -} - 1; -- cgit v1.2.1