Changeset 448
- Timestamp:
- 12/24/07 00:11:07 (5 years ago)
- Files:
-
- plgtkimageview/examples/interactive.pl (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plgtkimageview/examples/interactive.pl
r447 r448 1 1 #!/usr/bin/perl -w 2 3 # Copyright (c) 2007 by Muppet <scott@asofyet.org> 4 # based on the original gtkimageview/tests/interactive.c 5 # 6 # This library is free software; you can redistribute it and/or 7 # modify it under the terms of the GNU Library General Public 8 # License as published by the Free Software Foundation; either 9 # version 3 of the License, or (at your option) any later version. 10 # 11 # This library is distributed in the hope that it will be useful, 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 # Library General Public License for more details. 15 # 16 # You should have received a copy of the GNU General Public License 17 # along with this program. If not, see <http://www.gnu.org/licenses/>. 18 2 19 # -*- Mode: perl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; coding: utf-8 -*- 3 20 # vim: set expandtab softtabstop=4 shiftwidth=4 : … … 72 89 # Only active the transform_group if the loaded object is a single 73 90 # image -- transformations cannot be applied to animations. 74 $transform_group->set_sensitive ($anim->is_static_image ());91 $transform_group->set_sensitive ($anim->is_static_image); 75 92 }; 76 93 if ($@) { … … 82 99 my $r = shift; 83 100 sprintf "(%d, %d)-[%d, %d]", $r->x, $r->y, $r->width, $r->height; 101 } 102 103 sub get_enum_nick { 104 my ($package, $value) = @_; 105 my @v = Glib::Type->list_values ($package); 106 return $v[$value]{nick}; 84 107 } 85 108 … … 88 111 my @v = Glib::Type->list_values ($package); 89 112 for (my $i = 0 ; $i < @v ; $i++) { 90 use Data::Dumper;91 print Dumper($v[$i]);92 113 return $i if $v[$i]{name} eq $string or $v[$i]{nick} eq $string; 93 114 } … … 200 221 my ($action, $current) = @_; 201 222 my $color = 0; 202 my $transp = $current->get_current_value ();223 my $transp = $current->get_current_value; 203 224 if ($transp == GTK_IMAGE_TRANSP_COLOR) { 204 225 $color = 0x000000; 205 226 } 206 $view->set_transp ( $transp, $color);227 $view->set_transp (get_enum_nick('Gtk2::ImageTransp', $transp), $color); 207 228 } 208 229 … … 496 517 497 518 # Transform group 498 my$transform_group = Gtk2::ActionGroup->new ("transform");519 $transform_group = Gtk2::ActionGroup->new ("transform"); 499 520 if ($transform_group) { 500 521 $transform_group->add_actions (\@transform_actions);
