From 94ff1382d99df80b6fb28ccad9951ffa943e69c5 Mon Sep 17 00:00:00 2001 From: Marc Lehmann Date: Sat, 11 Mar 2000 14:12:48 +0000 Subject: [PATCH] see plug-ins/perl/Changes --- plug-ins/perl/Changes | 2 ++ plug-ins/perl/TODO | 1 + plug-ins/perl/UI/UI.pm | 21 ++++++++++++++------- plug-ins/perl/UI/basewidget.pm | 2 +- plug-ins/perl/examples/layerfuncs | 16 ++++++++-------- 5 files changed, 26 insertions(+), 16 deletions(-) diff --git a/plug-ins/perl/Changes b/plug-ins/perl/Changes index 8dd36976d6..b45bf1acf5 100644 --- a/plug-ins/perl/Changes +++ b/plug-ins/perl/Changes @@ -21,6 +21,8 @@ Revision history for Gimp-Perl extension. - experimental 5.6 thread compatibility improvements. - corrected menu hiliting problem in firetext and glowing_steel. - add a call to gimp_plugin_add_domain to Lib.xs. + - fix some of the bugs Raphael "reported" (missing Gtk makde Gimp::UI + crash). 1.19 Thu Jan 6 00:21:58 CET 2000 - used N_ to mark all the menu paths, since gimp now tries to diff --git a/plug-ins/perl/TODO b/plug-ins/perl/TODO index 1c7d420fea..f974c6fc46 100644 --- a/plug-ins/perl/TODO +++ b/plug-ins/perl/TODO @@ -24,6 +24,7 @@ API generalization gimp_desaturate -> drawable bugs + * .pot file -> add to dist. * damnit libintl crazy shit [DONE] * alow gimp_selection_shrink with a zero argument. * font_text with negative size? bug report #5523 diff --git a/plug-ins/perl/UI/UI.pm b/plug-ins/perl/UI/UI.pm index 0507780146..19e433a8dd 100644 --- a/plug-ins/perl/UI/UI.pm +++ b/plug-ins/perl/UI/UI.pm @@ -2,7 +2,6 @@ package Gimp::UI; use Gimp ('__'); use Gimp::Fu; -use Gtk; use base 'DynaLoader'; BEGIN { @@ -47,6 +46,19 @@ reimplement all of it in perl. =cut +if (eval { require Gtk; import Gtk (); 1 }) { + local $/; + eval ; + die $@ if $@; + close DATA; +} + +1; + +# All Gtk-dependent functions are put below +__DATA__ +#line 58 + @Gimp::UI::ImageMenu::ISA =qw(Gimp::UI); @Gimp::UI::LayerMenu::ISA =qw(Gimp::UI); @Gimp::UI::ChannelMenu::ISA =qw(Gimp::UI); @@ -101,7 +113,6 @@ sub new($$$$) { package Gimp::UI::PreviewSelect; -use Gtk; use Gimp '__'; sub GTK_CLASS_INIT { @@ -200,7 +211,6 @@ sub GTK_OBJECT_INIT { package Gimp::UI::PatternSelect; -use Gtk; use Gimp '__'; use Gimp::basewidget Gtk::Button; @@ -249,7 +259,6 @@ sub set_preview { package Gimp::UI::BrushSelect; -use Gtk; use Gimp '__'; use Gimp::basewidget Gtk::Button; @@ -293,7 +302,6 @@ sub set_preview { package Gimp::UI::GradientSelect; -use Gtk; use Gimp '__'; use Gimp::basewidget Gtk::Button; @@ -325,7 +333,6 @@ sub new { package Gimp::UI::ColorSelectButton; -use Gtk; use Gimp '__'; use Gimp::basewidget Gtk::Button; @@ -520,7 +527,7 @@ sub help_window(\$$$) { $b->insert($font,$b->style->fg(-normal),undef,__"BLURB:\n\n$blurb\n\nHELP:\n\n$help"); $b->set_usize($font->string_width('M')*80,($font->ascent+$font->descent)*26); - my $button = new Gtk::Button __"OK"; + my $button = Gtk::Button->new(__"OK"); signal_connect $button "clicked",sub { hide $$helpwin }; $$helpwin->action_area->add($button); diff --git a/plug-ins/perl/UI/basewidget.pm b/plug-ins/perl/UI/basewidget.pm index 4f624048af..5221d656f1 100644 --- a/plug-ins/perl/UI/basewidget.pm +++ b/plug-ins/perl/UI/basewidget.pm @@ -1,7 +1,7 @@ package Gimp::basewidget; # pragma -use Gimp; use Gtk; +use Gimp; $VERSION = 1.19; diff --git a/plug-ins/perl/examples/layerfuncs b/plug-ins/perl/examples/layerfuncs index d7f9833ace..7a357f2b14 100755 --- a/plug-ins/perl/examples/layerfuncs +++ b/plug-ins/perl/examples/layerfuncs @@ -8,18 +8,18 @@ use Gimp::Util; # These are a couple of one-liners that you might find handy. Both should # be undoable w/o any special magick, and work with any gimp. -#register "layer_to_image_size", "Layer2ImageSize", "Expands layer to image size", -# "Seth Burgess", "Seth Burgess ", "1.0", -# N_"/Layers/Layer to Image Size", "RGB*, GRAY*", [ ], sub { -# ($img, $layer) = @_; -# $layer->resize($img->width, $img->height, $layer->offsets); -# return(); -#}; +register "layer_to_image_size", "Layer2ImageSize", "Expands layer to image size", + "Seth Burgess", "Seth Burgess ", "1.0", + "", "*", [ ], sub { + ($img, $layer) = @_; + $layer->resize($img->width, $img->height, $layer->offsets); + return(); +}; register "center_layer", "Center Layer", "Centers the current layer on the image", "Seth Burgess", "Seth Burgess ", - "1.0", N_"/Layers/Center Layer", "RGB*, GRAY*", [], sub { + "1.0", N_"/Layers/Center Layer", "*", [], sub { ($img, $layer) = @_; $layer->set_offsets(($img->width - $layer->width )/2, ($img->height - $layer->height)/2);