Commit 135ce1f8 authored by Marc Lehmann's avatar Marc Lehmann
Browse files

see plug-ins/perl/Changes

parent 7a3042dd
Revision history for Gimp-Perl extension.
- possible fix for another installation horror problem.
- fixed a longstanding bug (?): not every class had a DESTROY, so
the AUTOLOAD tried to resolve DESTROY after gimp_close had been
called.
- started to revamp the extra argument handling.
- updated PDB Explorer a bit, still broken.
1.13 Wed Sep 8 02:55:43 CEST 1999
- removed some glib-1.1 compatibility cruft.
......
......@@ -29,24 +29,24 @@ $VERSION = 1.14;
'PRESSURE', 'SOFT', 'HARD', 'RGBA_IMAGE', 'INDEXED_IMAGE', 'GRAYA_IMAGE', 'RGB_IMAGE',
'INDEXEDA_IMAGE', 'GRAY_IMAGE', 'CUSTOM', 'FG_BG_HSV', 'FG_TRANS', 'FG_BG_RGB', 'BLUE_CHANNEL',
'GREEN_CHANNEL', 'GRAY_CHANNEL', 'AUXILLARY_CHANNEL', 'INDEXED_CHANNEL', 'RED_CHANNEL', 'CONTINUOUS', 'INCREMENTAL',
'APPLY', 'DISCARD', 'UNKNOWN', 'VERTICAL', 'HORIZONTAL', 'ORIENTATION_VERTICAL','ORIENTATION_HORIZONTAL',
'ORIENTATION_UNKNOWN', 'DODGEBURN_HIGHLIGHTS','DODGEBURN_SHADOWS', 'DODGEBURN_MIDTONES', 'CUBIC_INTERPOLATION', 'LINEAR_INTERPOLATION','NEAREST_NEIGHBOR_INTERPOLATION',
'ALPHA_LUT', 'GREEN_LUT', 'BLUE_LUT', 'VALUE_LUT', 'RED_LUT', 'OFFSET_BACKGROUND', 'OFFSET_TRANSPARENT',
'BG_BUCKET_FILL', 'FG_BUCKET_FILL', 'PATTERN_BUCKET_FILL', 'FSLOWBLEED_DITHER', 'NODESTRUCT_DITHER', 'FS_DITHER', 'NO_DITHER',
'FIXED_DITHER', 'PDB_SUCCESS', 'PDB_CALLING_ERROR', 'PDB_EXECUTION_ERROR', 'PDB_PASS_THROUGH', 'WHITE_IMAGE_FILL', 'FG_IMAGE_FILL',
'TRANS_IMAGE_FILL', 'BG_IMAGE_FILL', 'NO_IMAGE_FILL', 'LOOP_SAWTOOTH', 'ONCE_BACKWARDS', 'ONCE_FORWARD', 'ONCE_END_COLOR',
'LOOP_TRIANGLE', 'MONO_PALETTE', 'WEB_PALETTE', 'MAKE_PALETTE', 'REUSE_PALETTE', 'CUSTOM_PALETTE', 'BURN',
'DODGE', 'CYAN_HUES', 'RED_HUES', 'GREEN_HUES', 'YELLOW_HUES', 'ALL_HUES', 'MAGENTA_HUES',
'BLUE_HUES', 'POINTS', 'PIXELS', 'DIVIDE_MODE', 'SUBTRACT_MODE', 'SATURATION_MODE', 'ADDITION_MODE',
'SCREEN_MODE', 'BEHIND_MODE', 'MULTIPLY_MODE', 'DARKEN_ONLY_MODE', 'DIFFERENCE_MODE', 'DISSOLVE_MODE', 'VALUE_MODE',
'LIGHTEN_ONLY_MODE', 'COLOR_MODE', 'NORMAL_MODE', 'HUE_MODE', 'OVERLAY_MODE', 'NEGATIVE_CONVOL', 'NORMAL_CONVOL',
'ABSOLUTE_CONVOL', 'BLUR_CONVOLVE', 'CUSTOM_CONVOLVE', 'SHARPEN_CONVOLVE', 'TOOL_CAN_HANDLE_CHANGING_BRUSH','REPLACE', 'SUB',
'ADD', 'INTERSECT', 'SHADOWS', 'MIDTONES', 'HIGHLIGHTS', 'IMAGE_CLONE', 'PATTERN_CLONE',
'INDEXED', 'RGB', 'GRAY', 'BLACK_MASK', 'WHITE_MASK', 'ALPHA_MASK', 'BILINEAR',
'SPIRAL_CLOCKWISE', 'SQUARE', 'RADIAL', 'CONICAL_SYMMETRIC', 'SHAPEBURST_DIMPLED', 'CONICAL_ASYMMETRIC', 'LINEAR',
'SPIRAL_ANTICLOCKWISE','SHAPEBURST_ANGULAR', 'SHAPEBURST_SPHERICAL','PLUGIN', 'EXTENSION', 'INTERNAL', 'MESSAGE_BOX',
'ERROR_CONSOLE', 'CONSOLE', 'EXPAND_AS_NECESSARY', 'CLIP_TO_BOTTOM_LAYER','CLIP_TO_IMAGE', 'FLATTEN_IMAGE', 'RUN_INTERACTIVE',
'RUN_WITH_LAST_VALS', 'RUN_NONINTERACTIVE', 'REPEAT_NONE', 'REPEAT_SAWTOOTH', 'REPEAT_TRIANGULAR',
'APPLY', 'DISCARD', 'UNKNOWN', 'VERTICAL', 'HORIZONTAL', 'DODGEBURN_HIGHLIGHTS','DODGEBURN_SHADOWS',
'DODGEBURN_MIDTONES', 'CUBIC_INTERPOLATION', 'LINEAR_INTERPOLATION','NEAREST_NEIGHBOR_INTERPOLATION','ALPHA_LUT', 'GREEN_LUT', 'BLUE_LUT',
'VALUE_LUT', 'RED_LUT', 'OFFSET_BACKGROUND', 'OFFSET_TRANSPARENT', 'BG_BUCKET_FILL', 'FG_BUCKET_FILL', 'PATTERN_BUCKET_FILL',
'FSLOWBLEED_DITHER', 'NODESTRUCT_DITHER', 'FS_DITHER', 'NO_DITHER', 'FIXED_DITHER', 'PDB_SUCCESS', 'PDB_CALLING_ERROR',
'PDB_EXECUTION_ERROR', 'PDB_PASS_THROUGH', 'WHITE_IMAGE_FILL', 'FG_IMAGE_FILL', 'TRANS_IMAGE_FILL', 'BG_IMAGE_FILL', 'NO_IMAGE_FILL',
'LOOP_SAWTOOTH', 'ONCE_BACKWARDS', 'ONCE_FORWARD', 'ONCE_END_COLOR', 'LOOP_TRIANGLE', 'MONO_PALETTE', 'WEB_PALETTE',
'MAKE_PALETTE', 'REUSE_PALETTE', 'CUSTOM_PALETTE', 'BURN', 'DODGE', 'CYAN_HUES', 'RED_HUES',
'GREEN_HUES', 'YELLOW_HUES', 'ALL_HUES', 'MAGENTA_HUES', 'BLUE_HUES', 'POINTS', 'PIXELS',
'DIVIDE_MODE', 'SUBTRACT_MODE', 'SATURATION_MODE', 'ADDITION_MODE', 'SCREEN_MODE', 'BEHIND_MODE', 'MULTIPLY_MODE',
'DARKEN_ONLY_MODE', 'DIFFERENCE_MODE', 'DISSOLVE_MODE', 'VALUE_MODE', 'LIGHTEN_ONLY_MODE', 'COLOR_MODE', 'NORMAL_MODE',
'HUE_MODE', 'OVERLAY_MODE', 'NEGATIVE_CONVOL', 'NORMAL_CONVOL', 'ABSOLUTE_CONVOL', 'BLUR_CONVOLVE', 'CUSTOM_CONVOLVE',
'SHARPEN_CONVOLVE', 'TOOL_CAN_HANDLE_CHANGING_BRUSH','REPLACE', 'SUB', 'ADD', 'INTERSECT', 'SHADOWS',
'MIDTONES', 'HIGHLIGHTS', 'IMAGE_CLONE', 'PATTERN_CLONE', 'INDEXED', 'RGB', 'GRAY',
'BLACK_MASK', 'WHITE_MASK', 'ALPHA_MASK', 'BILINEAR', 'SPIRAL_CLOCKWISE', 'SQUARE', 'RADIAL',
'CONICAL_SYMMETRIC', 'SHAPEBURST_DIMPLED', 'CONICAL_ASYMMETRIC', 'LINEAR', 'SPIRAL_ANTICLOCKWISE','SHAPEBURST_ANGULAR', 'SHAPEBURST_SPHERICAL',
'PLUGIN', 'EXTENSION', 'INTERNAL', 'MESSAGE_BOX', 'ERROR_CONSOLE', 'CONSOLE', 'EXPAND_AS_NECESSARY',
'CLIP_TO_BOTTOM_LAYER','CLIP_TO_IMAGE', 'FLATTEN_IMAGE', 'RUN_INTERACTIVE', 'RUN_WITH_LAST_VALS', 'RUN_NONINTERACTIVE', 'REPEAT_NONE',
'REPEAT_SAWTOOTH', 'REPEAT_TRIANGULAR',
#ENUM_NAME#
'STATUS_CALLING_ERROR', 'STATUS_EXECUTION_ERROR', 'STATUS_PASS_THROUGH',
'STATUS_SUCCESS', 'PARASITE_PERSISTENT', 'PARASITE_ATTACH_PARENT',
......@@ -78,30 +78,30 @@ sub GRAYA_IMAGE (){ 3} sub RGB_IMAGE (){ 0} sub INDEXEDA_IMAGE
sub FG_BG_HSV (){ 1} sub FG_TRANS (){ 2} sub FG_BG_RGB (){ 0} sub BLUE_CHANNEL (){ 2} sub GREEN_CHANNEL (){ 1}
sub GRAY_CHANNEL (){ 3} sub AUXILLARY_CHANNEL (){ 5} sub INDEXED_CHANNEL (){ 4} sub RED_CHANNEL (){ 0} sub CONTINUOUS (){ 0}
sub INCREMENTAL (){ 1} sub APPLY (){ 0} sub DISCARD (){ 1} sub UNKNOWN (){ 2} sub VERTICAL (){ 1}
sub HORIZONTAL (){ 0} sub ORIENTATION_VERTICAL(){ 2} sub ORIENTATION_HORIZONTAL(){ 1} sub ORIENTATION_UNKNOWN (){ 0} sub DODGEBURN_HIGHLIGHTS(){ 0}
sub DODGEBURN_SHADOWS (){ 2} sub DODGEBURN_MIDTONES (){ 1} sub CUBIC_INTERPOLATION (){ 1} sub LINEAR_INTERPOLATION(){ 0} sub NEAREST_NEIGHBOR_INTERPOLATION(){ 2}
sub ALPHA_LUT (){ 4} sub GREEN_LUT (){ 2} sub BLUE_LUT (){ 3} sub VALUE_LUT (){ 0} sub RED_LUT (){ 1}
sub OFFSET_BACKGROUND (){ 0} sub OFFSET_TRANSPARENT (){ 1} sub BG_BUCKET_FILL (){ 1} sub FG_BUCKET_FILL (){ 0} sub PATTERN_BUCKET_FILL (){ 2}
sub FSLOWBLEED_DITHER (){ 2} sub NODESTRUCT_DITHER (){ 4} sub FS_DITHER (){ 1} sub NO_DITHER (){ 0} sub FIXED_DITHER (){ 3}
sub PDB_SUCCESS (){ 3} sub PDB_CALLING_ERROR (){ 1} sub PDB_EXECUTION_ERROR (){ 0} sub PDB_PASS_THROUGH (){ 2} sub WHITE_IMAGE_FILL (){ 2}
sub FG_IMAGE_FILL (){ 0} sub TRANS_IMAGE_FILL (){ 3} sub BG_IMAGE_FILL (){ 1} sub NO_IMAGE_FILL (){ 4} sub LOOP_SAWTOOTH (){ 2}
sub ONCE_BACKWARDS (){ 1} sub ONCE_FORWARD (){ 0} sub ONCE_END_COLOR (){ 4} sub LOOP_TRIANGLE (){ 3} sub MONO_PALETTE (){ 3}
sub WEB_PALETTE (){ 2} sub MAKE_PALETTE (){ 0} sub REUSE_PALETTE (){ 1} sub CUSTOM_PALETTE (){ 4} sub BURN (){ 1}
sub DODGE (){ 0} sub CYAN_HUES (){ 4} sub RED_HUES (){ 1} sub GREEN_HUES (){ 3} sub YELLOW_HUES (){ 2}
sub ALL_HUES (){ 0} sub MAGENTA_HUES (){ 6} sub BLUE_HUES (){ 5} sub POINTS (){ 1} sub PIXELS (){ 0}
sub DIVIDE_MODE (){15} sub SUBTRACT_MODE (){ 8} sub SATURATION_MODE (){12} sub ADDITION_MODE (){ 7} sub SCREEN_MODE (){ 4}
sub BEHIND_MODE (){ 2} sub MULTIPLY_MODE (){ 3} sub DARKEN_ONLY_MODE (){ 9} sub DIFFERENCE_MODE (){ 6} sub DISSOLVE_MODE (){ 1}
sub VALUE_MODE (){14} sub LIGHTEN_ONLY_MODE (){10} sub COLOR_MODE (){13} sub NORMAL_MODE (){ 0} sub HUE_MODE (){11}
sub OVERLAY_MODE (){ 5} sub NEGATIVE_CONVOL (){ 2} sub NORMAL_CONVOL (){ 0} sub ABSOLUTE_CONVOL (){ 1} sub BLUR_CONVOLVE (){ 0}
sub CUSTOM_CONVOLVE (){ 2} sub SHARPEN_CONVOLVE (){ 1} sub TOOL_CAN_HANDLE_CHANGING_BRUSH(){0x0001} sub REPLACE (){ 2} sub SUB (){ 1}
sub ADD (){ 0} sub INTERSECT (){ 3} sub SHADOWS (){ 0} sub MIDTONES (){ 1} sub HIGHLIGHTS (){ 2}
sub IMAGE_CLONE (){ 0} sub PATTERN_CLONE (){ 1} sub INDEXED (){ 2} sub RGB (){ 0} sub GRAY (){ 1}
sub BLACK_MASK (){ 1} sub WHITE_MASK (){ 0} sub ALPHA_MASK (){ 2} sub BILINEAR (){ 1} sub SPIRAL_CLOCKWISE (){ 9}
sub SQUARE (){ 3} sub RADIAL (){ 2} sub CONICAL_SYMMETRIC (){ 4} sub SHAPEBURST_DIMPLED (){ 8} sub CONICAL_ASYMMETRIC (){ 5}
sub LINEAR (){ 0} sub SPIRAL_ANTICLOCKWISE(){10} sub SHAPEBURST_ANGULAR (){ 6} sub SHAPEBURST_SPHERICAL(){ 7} sub PLUGIN (){ 1}
sub EXTENSION (){ 2} sub INTERNAL (){ 0} sub MESSAGE_BOX (){ 0} sub ERROR_CONSOLE (){ 2} sub CONSOLE (){ 1}
sub EXPAND_AS_NECESSARY (){ 0} sub CLIP_TO_BOTTOM_LAYER(){ 2} sub CLIP_TO_IMAGE (){ 1} sub FLATTEN_IMAGE (){ 3} sub RUN_INTERACTIVE (){bless \(my $x=0),'Gimp::run_mode'}
sub RUN_WITH_LAST_VALS (){bless \(my $x=2),'Gimp::run_mode'} sub RUN_NONINTERACTIVE (){bless \(my $x=1),'Gimp::run_mode'} sub REPEAT_NONE (){ 0} sub REPEAT_SAWTOOTH (){ 1} sub REPEAT_TRIANGULAR (){ 2}
sub HORIZONTAL (){ 0} sub DODGEBURN_HIGHLIGHTS(){ 0} sub DODGEBURN_SHADOWS (){ 2} sub DODGEBURN_MIDTONES (){ 1} sub CUBIC_INTERPOLATION (){ 1}
sub LINEAR_INTERPOLATION(){ 0} sub NEAREST_NEIGHBOR_INTERPOLATION(){ 2} sub ALPHA_LUT (){ 4} sub GREEN_LUT (){ 2} sub BLUE_LUT (){ 3}
sub VALUE_LUT (){ 0} sub RED_LUT (){ 1} sub OFFSET_BACKGROUND (){ 0} sub OFFSET_TRANSPARENT (){ 1} sub BG_BUCKET_FILL (){ 1}
sub FG_BUCKET_FILL (){ 0} sub PATTERN_BUCKET_FILL (){ 2} sub FSLOWBLEED_DITHER (){ 2} sub NODESTRUCT_DITHER (){ 4} sub FS_DITHER (){ 1}
sub NO_DITHER (){ 0} sub FIXED_DITHER (){ 3} sub PDB_SUCCESS (){ 3} sub PDB_CALLING_ERROR (){ 1} sub PDB_EXECUTION_ERROR (){ 0}
sub PDB_PASS_THROUGH (){ 2} sub WHITE_IMAGE_FILL (){ 2} sub FG_IMAGE_FILL (){ 0} sub TRANS_IMAGE_FILL (){ 3} sub BG_IMAGE_FILL (){ 1}
sub NO_IMAGE_FILL (){ 4} sub LOOP_SAWTOOTH (){ 2} sub ONCE_BACKWARDS (){ 1} sub ONCE_FORWARD (){ 0} sub ONCE_END_COLOR (){ 4}
sub LOOP_TRIANGLE (){ 3} sub MONO_PALETTE (){ 3} sub WEB_PALETTE (){ 2} sub MAKE_PALETTE (){ 0} sub REUSE_PALETTE (){ 1}
sub CUSTOM_PALETTE (){ 4} sub BURN (){ 1} sub DODGE (){ 0} sub CYAN_HUES (){ 4} sub RED_HUES (){ 1}
sub GREEN_HUES (){ 3} sub YELLOW_HUES (){ 2} sub ALL_HUES (){ 0} sub MAGENTA_HUES (){ 6} sub BLUE_HUES (){ 5}
sub POINTS (){ 1} sub PIXELS (){ 0} sub DIVIDE_MODE (){15} sub SUBTRACT_MODE (){ 8} sub SATURATION_MODE (){12}
sub ADDITION_MODE (){ 7} sub SCREEN_MODE (){ 4} sub BEHIND_MODE (){ 2} sub MULTIPLY_MODE (){ 3} sub DARKEN_ONLY_MODE (){ 9}
sub DIFFERENCE_MODE (){ 6} sub DISSOLVE_MODE (){ 1} sub VALUE_MODE (){14} sub LIGHTEN_ONLY_MODE (){10} sub COLOR_MODE (){13}
sub NORMAL_MODE (){ 0} sub HUE_MODE (){11} sub OVERLAY_MODE (){ 5} sub NEGATIVE_CONVOL (){ 2} sub NORMAL_CONVOL (){ 0}
sub ABSOLUTE_CONVOL (){ 1} sub BLUR_CONVOLVE (){ 0} sub CUSTOM_CONVOLVE (){ 2} sub SHARPEN_CONVOLVE (){ 1} sub TOOL_CAN_HANDLE_CHANGING_BRUSH(){0x0001}
sub REPLACE (){ 2} sub SUB (){ 1} sub ADD (){ 0} sub INTERSECT (){ 3} sub SHADOWS (){ 0}
sub MIDTONES (){ 1} sub HIGHLIGHTS (){ 2} sub IMAGE_CLONE (){ 0} sub PATTERN_CLONE (){ 1} sub INDEXED (){ 2}
sub RGB (){ 0} sub GRAY (){ 1} sub BLACK_MASK (){ 1} sub WHITE_MASK (){ 0} sub ALPHA_MASK (){ 2}
sub BILINEAR (){ 1} sub SPIRAL_CLOCKWISE (){ 9} sub SQUARE (){ 3} sub RADIAL (){ 2} sub CONICAL_SYMMETRIC (){ 4}
sub SHAPEBURST_DIMPLED (){ 8} sub CONICAL_ASYMMETRIC (){ 5} sub LINEAR (){ 0} sub SPIRAL_ANTICLOCKWISE(){10} sub SHAPEBURST_ANGULAR (){ 6}
sub SHAPEBURST_SPHERICAL(){ 7} sub PLUGIN (){ 1} sub EXTENSION (){ 2} sub INTERNAL (){ 0} sub MESSAGE_BOX (){ 0}
sub ERROR_CONSOLE (){ 2} sub CONSOLE (){ 1} sub EXPAND_AS_NECESSARY (){ 0} sub CLIP_TO_BOTTOM_LAYER(){ 2} sub CLIP_TO_IMAGE (){ 1}
sub FLATTEN_IMAGE (){ 3} sub RUN_INTERACTIVE (){bless \(my $x=0),'Gimp::run_mode'} sub RUN_WITH_LAST_VALS (){bless \(my $x=2),'Gimp::run_mode'} sub RUN_NONINTERACTIVE (){bless \(my $x=1),'Gimp::run_mode'} sub REPEAT_NONE (){ 0}
sub REPEAT_SAWTOOTH (){ 1} sub REPEAT_TRIANGULAR (){ 2}
#ENUM_DEFS#
sub WRAP (){ 0 }
......
......@@ -104,10 +104,10 @@ sub Gimp::RUN_FULLINTERACTIVE (){ Gimp::RUN_INTERACTIVE+100 }; # you don't want
&PF_CUSTOM => 'string',
&PF_FILE => 'string',
&PF_TEXT => 'string',
&PF_IMAGE => 'NYI',
&PF_LAYER => 'NYI',
&PF_CHANNEL => 'NYI',
&PF_DRAWABLE => 'NYI',
&PF_IMAGE => 'path',
&PF_LAYER => 'index',
&PF_CHANNEL => 'index',
&PF_DRAWABLE => 'index',
);
@_params=qw(PF_INT8 PF_INT16 PF_INT32 PF_FLOAT PF_VALUE PF_STRING PF_COLOR
......@@ -137,6 +137,19 @@ sub carp {
goto &Carp::carp;
}
# Some Standard Arguments
my @image_params = ([&Gimp::PARAM_IMAGE , "image", "The image to work on"],
[&Gimp::PARAM_DRAWABLE , "drawable", "The drawable to work on"]);
my @load_params = ([&Gimp::PARAM_STRING , "filename", "The name of the file"],
[&Gimp::PARAM_STRING , "raw_filename","The name of the file"]);
my @save_params = (@image_params, @load_params);
my @load_retvals = ([&Gimp::PARAM_IMAGE , "image", "Output image"]);
my $image_retval = [&Gimp::PARAM_IMAGE , "image", "The resulting image"];
# expand all the pod directives in string (currently they are only removed)
sub expand_podsections() {
my $pod;
......@@ -203,6 +216,8 @@ sub this_script {
die "function '$exe' not found in this script (must be one of ".join(", ",@names).")\n";
}
my $latest_image;
sub string2pf($$) {
my($s,$type,$name,$desc)=($_[0],@{$_[1]});
if($type==PF_STRING
......@@ -229,6 +244,7 @@ sub string2pf($$) {
$s=Gimp::canonicalize_colour($s);
} elsif($type==PF_TOGGLE) {
$s?1:0;
#} elsif($type==PF_IMAGE) {
} else {
die "conversion to type $pf_type2string{$type} is not yet implemented\n";
}
......@@ -251,15 +267,17 @@ Gimp::on_net {
my $this = this_script;
my(%map,@args);
my($interact)=1;
my $params = $this->[9];
for(@{$this->[11]}) {
return unless fu_feature_present($_,$this->[1]);
my($perl_sub,$function,$blurb,$help,$author,$copyright,$date,
$menupath,$imagetypes,$params,$results,$features,$code,$type)=@$this;
for(@$features) {
return unless fu_feature_present($_, $function);
}
# %map is a hash that associates (mangled) parameter names to parameter index
@map{map mangle_key($_->[1]), @{$params}} = (0..$#{$params});
# Parse the command line
while(defined($_=shift @ARGV)) {
if (/^-+(.*)$/) {
......@@ -292,31 +310,16 @@ Gimp::on_net {
}
# Go for it
$this->[0]->($interact>0 ? $this->[7]=~/^<Image>/ ? (&Gimp::RUN_FULLINTERACTIVE,undef,undef,@args)
: (&Gimp::RUN_INTERACTIVE,@args)
: (&Gimp::RUN_NONINTERACTIVE,@args));
$perl_sub->(($interact>0 ? &Gimp::RUN_FULLINTERACTIVE : &Gimp::RUN_NONINTERACTIVE),
@args);
};
# the <Image> arguments
@image_params = ([&Gimp::PARAM_IMAGE , "image", "The image to work on"],
[&Gimp::PARAM_DRAWABLE , "drawable", "The drawable to work on"]);
@load_params = ([&Gimp::PARAM_STRING , "filename", "The name of the file"],
[&Gimp::PARAM_STRING , "raw_filename","The name of the file"]);
@save_params = (@image_params, @load_params);
@load_retvals = ([&Gimp::PARAM_IMAGE , "image", "Output image"]);
$image_retval = [&Gimp::PARAM_IMAGE , "image", "The resulting image"];
Gimp::on_query {
my($type);
expand_podsections;
script:
for(@scripts) {
my($perl_sub,$function,$blurb,$help,$author,$copyright,$date,
$menupath,$imagetypes,$params,$results,$features,$code)=@$_;
$menupath,$imagetypes,$params,$results,$features,$code,$type)=@$_;
for (@$results) {
next if ref $_;
......@@ -329,25 +332,6 @@ Gimp::on_query {
next script unless fu_feature_present($_,$function);
}
if ($menupath=~/^<Image>\//) {
$type=&Gimp::PROC_PLUG_IN;
unshift(@$params,@image_params);
} elsif ($menupath=~/^<Load>\//) {
$type=&Gimp::PROC_PLUG_IN;
unshift(@$params,@load_params);
unshift(@$results,@load_retvals);
} elsif ($menupath=~/^<Save>\//) {
$type=&Gimp::PROC_PLUG_IN;
unshift(@$params,@save_params);
} elsif ($menupath=~/^<Toolbox>\//) {
$type=&Gimp::PROC_EXTENSION;
} elsif ($menupath=~/^<None>/) {
$type=&Gimp::PROC_EXTENSION;
$menupath=undef;
} else {
die "menupath _must_ start with <Image>, <Toolbox>, <Load>, <Save> or <None>!";
}
# guess the datatype. yeah!
sub datatype(@) {
for(@_) {
......@@ -360,25 +344,24 @@ Gimp::on_query {
my %x = @_; values %x;
}
unshift(@$params,
[&Gimp::PARAM_INT32,"run_mode","Interactive, [non-interactive]"]);
for(@params) {
$_->[0]=Gimp::PARAM_INT32 if $_->[0] == PF_TOGGLE;
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_FONT;
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_BRUSH;
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_PATTERN;
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_GRADIENT;
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_CUSTOM;
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_FILE;
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_TEXT;
$_->[0]=datatype(odd_values(@{$_->[4]})) if $_->[0] == PF_RADIO;
$_->[0]=datatype($_->[3],@{$_->[4]}) if $_->[0] == PF_SLIDER;
$_->[0]=datatype($_->[3],@{$_->[4]}) if $_->[0] == PF_SPINNER;
$_->[0]=datatype($_->[3],@{$_->[4]}) if $_->[0] == PF_ADJUSTMENT;
}
Gimp->gimp_install_procedure($function,$blurb,$help,$author,$copyright,$date,
$menupath,$imagetypes,$type,
[map {
$_->[0]=Gimp::PARAM_INT32 if $_->[0] == PF_TOGGLE;
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_FONT;
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_BRUSH;
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_PATTERN;
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_GRADIENT;
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_CUSTOM;
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_FILE;
$_->[0]=Gimp::PARAM_STRING if $_->[0] == PF_TEXT;
$_->[0]=datatype(odd_values(@{$_->[4]})) if $_->[0] == PF_RADIO;
$_->[0]=datatype($_->[3],@{$_->[4]}) if $_->[0] == PF_SLIDER;
$_->[0]=datatype($_->[3],@{$_->[4]}) if $_->[0] == PF_SPINNER;
$_->[0]=datatype($_->[3],@{$_->[4]}) if $_->[0] == PF_ADJUSTMENT;
$_;
} @$params],
[[Gimp::PARAM_INT32,"run_mode","Interactive, [non-interactive]"],
@$params],
$results);
Gimp::logger(message => 'OK', function => $function, fatal => 0);
......@@ -633,12 +616,33 @@ sub register($$$$$$$$$;@) {
no strict 'refs';
my($function,$blurb,$help,$author,$copyright,$date,
$menupath,$imagetypes,$params)=splice(@_,0,9);
my($results,$features,$code);
my($results,$features,$code,$type);
$results = (ref $_[0] eq "ARRAY") ? shift : [];
$features = (ref $_[0] eq "ARRAY") ? shift : [];
$code = shift;
for($menupath) {
if (/^<Image>\//) {
$type = &Gimp::PROC_PLUG_IN;
unshift @$params, @image_params;
} elsif (/^<Load>\//) {
$type = &Gimp::PROC_PLUG_IN;
unshift @$params, @load_params;
unshift @$results, @load_retvals;
} elsif (/^<Save>\//) {
$type = &Gimp::PROC_PLUG_IN;
unshift @$params, @save_params;
} elsif (/^<Toolbox>\//) {
$type = &Gimp::PROC_EXTENSION;
} elsif (/^<None>/) {
$type = &Gimp::PROC_EXTENSION;
} else {
die "menupath _must_ start with <Image>, <Toolbox>, <Load>, <Save> or <None>!";
}
}
undef $menupath if $menupath eq "<None>";#d#
@_==0 or die "register called with too many or wrong arguments\n";
for my $p (@$params,@$results) {
......@@ -656,25 +660,9 @@ sub register($$$$$$$$$;@) {
if $function =~ y/-//;
my $perl_sub = sub {
$run_mode=shift; # global!
$run_mode = shift; # global!
my(@pre,@defaults,@lastvals,$input_image);
if ($menupath=~/^<Image>\//) {
@_ >= 2 or die "<Image> plug-in called without both image and drawable arguments!\n";
@pre = (shift,shift);
} elsif ($menupath=~/^<Toolbox>\// or !defined $menupath) {
# valid ;)
} elsif ($menupath=~/^<Load>\//) {
@_ >= 2 or die "<Load> plug-in called without the 5 standard arguments!\n";
@pre = (shift,shift);
} elsif ($menupath=~/^<Save>\//) {
@_ >= 4 or die "<Save> plug-in called without the 5 standard arguments!\n";
@pre = (shift,shift,shift,shift);
} elsif ($menupath=~/^<None>\/?/) {
} else {
die "menupath _must_ start with <Image>, <Toolbox>, <Load>, <Save> or <None>!";
}
if (@defaults) {
for (0..$#{$params}) {
$params->[$_]->[3]=$defaults[$_];
......@@ -686,6 +674,22 @@ sub register($$$$$$$$$;@) {
$_[$_]=$params->[$_]->[3] unless defined($_[$_]);
}
for($menupath) {
if (/^<Image>\//) {
@_ >= 2 or die "<Image> plug-in called without both image and drawable arguments!\n";
@pre = (shift,shift);
} elsif (/^<Toolbox>\// or !defined $menupath) {
# valid ;)
} elsif (/^<Load>\//) {
@_ >= 2 or die "<Load> plug-in called without the 3 standard arguments!\n";
@pre = (shift,shift);
} elsif (/^<Save>\//) {
@_ >= 4 or die "<Save> plug-in called without the 5 standard arguments!\n";
@pre = (shift,shift,shift,shift);
} elsif (defined $_) {
die "menupath _must_ start with <Image>, <Toolbox>, <Load>, <Save> or <None>!";
}
}
if ($run_mode == &Gimp::RUN_INTERACTIVE
|| $run_mode == &Gimp::RUN_WITH_LAST_VALS) {
my $fudata = $Gimp::Data{"$function/_fu_data"};
......@@ -694,21 +698,29 @@ sub register($$$$$$$$$;@) {
@_ = @{$fudata};
} else {
if (@_) {
# prevent the standard arguments from showing up in interact
my @hide = splice @$params, 0, scalar@pre;
my $res;
local $^W=0; # perl -w is braindamaged
# gimp is braindamaged, is doesn't deliver useful values!!
($res,@_)=interact($function,$blurb,$help,$params,@{$fudata});
return unless $res;
unshift @$params, @hide;
}
}
} elsif ($run_mode == &Gimp::RUN_FULLINTERACTIVE) {
my($res);
($res,@_)=interact($function,$blurb,$help,[@image_params,@$params],[@pre,@_]);
undef @pre;
return unless $res;
if (@_) {
my($res);
($res,@_)=interact($function,$blurb,$help,$params,@pre,@_);
undef @pre;
return unless $res;
}
} elsif ($run_mode == &Gimp::RUN_NONINTERACTIVE) {
# nop
} else {
die "run_mode must be INTERACTIVE, NONINTERACTIVE or WITH_LAST_VALS\n";
die "run_mode must be INTERACTIVE, NONINTERACTIVE or RUN_WITH_LAST_VALS\n";
}
$input_image = $_[0] if ref $_[0] eq "Gimp::Image";
$input_image = $pre[0] if ref $pre[0] eq "Gimp::Image";
......@@ -752,7 +764,7 @@ sub register($$$$$$$$$;@) {
Gimp::register_callback($function,$perl_sub);
push(@scripts,[$perl_sub,$function,$blurb,$help,$author,$copyright,$date,
$menupath,$imagetypes,$params,$results,$features,$code]);
$menupath,$imagetypes,$params,$results,$features,$code,$type]);
}
=cut
......
......@@ -39,6 +39,7 @@ sub import {
return if @_;
# overwrite some destroy functions
*Gimp::Tile::DESTROY=
*Gimp::PixelRgn::DESTROY=
*Gimp::GDrawable::DESTROY=sub {
......
......@@ -516,7 +516,6 @@ sub help_window(\$$$) {
$font = fontset_load Gtk::Gdk::Font "-*-courier-medium-r-normal--*-120-*-*-*-*-*" unless $font;
$font = $b->style->font unless $font;
$$helpwin->vbox->add($b);
$b->realize; # for gtk-1.0
$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);
......@@ -553,8 +552,6 @@ sub interact($$$$@) {
Gimp::init_gtk;
require Gimp::UI; import Gimp::UI;
my $gimp_10 = Gimp->major_version==1 && Gimp->minor_version==0;
for(;;) {
......@@ -617,7 +614,7 @@ sub interact($$$$@) {
my $setval = sub {
$val=$_[0];
unless (defined $val && $fs->set_font_name ($val)) {
warn "illegal default font description for $function: $val\n" if defined $val;
warn "Illegal default font description for $function: $val\n" if defined $val;
$val=$def;
$fs->set_font_name ($val);
}
......
......@@ -16,6 +16,11 @@ firetext! AND _grayscale_ for map_gradient(!)
script-fu 4.9 vs. 3.3
olof
* improve PDB explorer
* input image arguments
bugs
* update frosty-logo.scm t-o-p-logo.scm starscape-logo.scm starburst-logo.scm
......
......@@ -477,7 +477,7 @@ register "extension_pdb_explorer",
"This is a more interactive version of the DB Browser",
"Marc Lehmann",
"Marc Lehmann",
"0.3alpha",
"0.4alpha",
"<Toolbox>/Xtns/PDB Explorer",
"",
[],
......
......@@ -7,7 +7,7 @@
# working btw). You can follow step by step with the website at
# http://tigert.gimp.org/gimp/tutorials/beveled_text/
use Gimp;
use Gimp ':auto';
use Gimp::Fu;
use Gimp::Util;
......
......@@ -28,7 +28,7 @@ sub get_vguides {
$i=0;
my @vguides;
while ($i=$img->find_next_guide($i)) {
if ($img->get_guide_orientation($i) == &Gimp::VERTICAL_GUIDE){
if ($img->get_guide_orientation($i) == &Gimp::VERTICAL){
$keyval = sprintf("%4d", $img->get_guide_position($i));
$vkeys{$keyval} = $i;
}
......@@ -49,7 +49,7 @@ sub get_hguides {
$i=0;
my @hguides;
while ($i=$img->find_next_guide($i)) {
if ($img->get_guide_orientation($i) == &Gimp::HORIZONTAL_GUIDE){
if ($img->get_guide_orientation($i) == &Gimp::HORIZONTAL){
$keyval = sprintf("%4d", $img->get_guide_position($i));
$hkeys{$keyval} = $i;
}
......@@ -133,7 +133,7 @@ register "perlotine",
"Add guides to an image. Then run this. It will cut along the guides, and give you the html to reassemble the resulting images.",
"Seth Burgess",
"Seth Burgess <sjburges\@gimp.org>",
"1999-03-19",
"1999-09-11",
"<Image>/Guides/Perl-o-tine",
"*",
[
......
Markdown is supported
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