Commit ca41c260 authored by Marc Lehmann's avatar Marc Lehmann
Browse files

see plug-ins/perl/Changes

parent 39f9e9ae
......@@ -13,6 +13,8 @@ Revision history for Gimp-Perl extension.
collisions. CGI-scripts should use either tcp or specify the path
directly using GIMP_HOST (see Gimp::Net for details).
- use _much_ saner defaults for the Scale types in Gimp::Fu.
- Gimp::Fu's optionmenus didn't work in net()-mode.
- implemented PF_CUSTOM (untested).
1.055 Mon Feb 22 22:38:44 CET 1999
- applied seth's script changes.
......
......@@ -80,6 +80,7 @@ sub PF_BRUSH () { PARAM_END+6 };
sub PF_PATTERN () { PARAM_END+7 };
sub PF_GRADIENT () { PARAM_END+8 };
sub PF_RADIO () { PARAM_END+9 };
sub PF_CUSTOM () { PARAM_END+10 };
sub PF_BOOL () { PF_TOGGLE };
sub PF_INT () { PF_INT32 };
......@@ -103,6 +104,7 @@ sub Gimp::RUN_FULLINTERACTIVE (){ Gimp::RUN_INTERACTIVE+100 }; # you don't want
&PF_SPINNER => 'integer',
&PF_ADJUSTMENT => 'integer',
&PF_RADIO => 'string',
&PF_CUSTOM => 'string',
&PF_IMAGE => 'NYI',
&PF_LAYER => 'NYI',
&PF_CHANNEL => 'NYI',
......@@ -113,7 +115,7 @@ sub Gimp::RUN_FULLINTERACTIVE (){ Gimp::RUN_INTERACTIVE+100 }; # you don't want
PF_STRING PF_COLOR PF_COLOUR PF_TOGGLE PF_IMAGE
PF_DRAWABLE PF_FONT PF_LAYER PF_CHANNEL PF_BOOL
PF_SLIDER PF_INT PF_SPINNER PF_ADJUSTMENT
PF_BRUSH PF_PATTERN PF_GRADIENT PF_RADIO);
PF_BRUSH PF_PATTERN PF_GRADIENT PF_RADIO PF_CUSTOM);
@EXPORT = (qw(register main),@_params);
@EXPORT_OK = qw(interact $run_mode save_image);
......@@ -313,7 +315,7 @@ sub interact($$$@) {
my $res;
$a=new Gtk::HBox (0,5);
my $b=new Gtk::OptionMenu;
$b->set_menu(new Gimp::UI::ImageMenu(sub {1},-1,$res));
$b->set_menu(new Gimp::UI::ImageMenu(sub {1},-1,\$res));
$a->pack_start ($b,1,1,0);
push(@setvals,sub{});
push(@getvals,sub{$res});
......@@ -328,21 +330,21 @@ sub interact($$$@) {
} elsif($type == PF_LAYER) {
my $res;
$a=new Gtk::OptionMenu;
$a->set_menu(new Gimp::UI::LayerMenu(sub {1},-1,$res));
$a->set_menu(new Gimp::UI::LayerMenu(sub {1},-1,\$res));
push(@setvals,sub{});
push(@getvals,sub{$res});
} elsif($type == PF_CHANNEL) {
my $res;
$a=new Gtk::OptionMenu;
$a->set_menu(new Gimp::UI::ChannelMenu(sub {1},-1,$res));
$a->set_menu(new Gimp::UI::ChannelMenu(sub {1},-1,\$res));
push(@setvals,sub{});
push(@getvals,sub{$res});
} elsif($type == PF_DRAWABLE) {
my $res;
my $res=13;
$a=new Gtk::OptionMenu;
$a->set_menu(new Gimp::UI::DrawableMenu(sub {1},-1,$res));
$a->set_menu(new Gimp::UI::DrawableMenu(sub {1},-1,\$res));
push(@setvals,sub{});
push(@getvals,sub{$res});
......@@ -373,6 +375,11 @@ sub interact($$$@) {
push(@getvals,sub{$a->get('active')});
}
} elsif($type == PF_CUSTOM) {
$a=$extra->[0];
push(@setvals,$extra->[1]);
push(@getvals,$extra->[2]);
} else {
$label="Unsupported argumenttype $type";
push(@setvals,sub{});
......@@ -472,6 +479,7 @@ sub string2pf($$) {
|| $type==PF_FONT
|| $type==PF_PATTERN
|| $type==PF_BRUSH
|| $type==PF_CUSTOM
|| $type==PF_RADIO # for now! #d#
|| $type==PF_GRADIENT) {
$s;
......@@ -588,6 +596,7 @@ sub query {
$_->[0]=PARAM_STRING if $_->[0] == PF_BRUSH;
$_->[0]=PARAM_STRING if $_->[0] == PF_PATTERN;
$_->[0]=PARAM_STRING if $_->[0] == PF_GRADIENT;
$_->[0]=PARAM_STRING if $_->[0] == PF_CUSTOM;
$_;
} @$params],
$results);
......@@ -762,6 +771,24 @@ In older Gimp-Versions a user-supplied string is returned.
Lets the user select a brush/pattern/gradient whose name is returned as a
string. The default brush/pattern/gradient-name can be preset.
=item PF_CUSTOM
PF_CUSTOM is for those of you requiring some non-standard-widget. Just supply an array reference
with three elements as extra argument:
[widget, settor, gettor]
C<widget> is Gtk widget that should be used.
C<settor> is a function that takes a single argument, the new value for
the widget (the widget should be updated accordingly).
C<gettor> is a function that should return the current value of the widget.
While the values can be of any type (as long as it fits into a scalar),
you should be prepared to get a string when the script is started from the
commandline.
=back
=cut
......
......@@ -23,10 +23,10 @@ reimplement all of it in perl.
=over 4
$option_menu = new Gimp::UI::ImageMenu;
$option_menu = new Gimp::UI::LayerMenu;
$option_menu = new Gimp::UI::ChannelMenu;
$option_menu = new Gimp::UI::DrawableMenu;
$option_menu = new Gimp::UI::ImageMenu
$option_menu = new Gimp::UI::LayerMenu
$option_menu = new Gimp::UI::ChannelMenu
$option_menu = new Gimp::UI::DrawableMenu (constraint_func, active_element, \var);
$button = new Gimp::UI::PatternSelect;
$button = new Gimp::UI::BrushSelect;
......@@ -67,24 +67,24 @@ sub Gimp::UI::DrawableMenu::_items {
}
sub new($$$$) {
my($class,$constraint,$active)=@_;
my($class,$constraint,$active,$var)=@_;
my(@items)=$class->_items;
my $menu = new Gtk::Menu;
for(@items) {
my($constraints,$result,$name)=@$_;
next unless $constraint->(@{$constraints});
my $item = new Gtk::MenuItem $name;
$item->show;
$item->signal_connect(activate => sub { $_[3]=$result });
$item->signal_connect(activate => sub { $$var=$result });
$menu->append($item);
}
if (@items) {
$_[3]=$items[0]->[1];
$$var=$items[0]->[1];
} else {
my $item = new Gtk::MenuItem "(none)";
$item->show;
$menu->append($item);
$$var=undef;
}
$menu->show_all;
$menu;
}
......
require 5.004_04;
require 5.004;
use ExtUtils::MakeMaker;
use Config;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment