Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
GIMP
Commits
79bf0247
Commit
79bf0247
authored
Mar 15, 1999
by
Marc Lehmann
Browse files
see plug-ins/perl/Changes
parent
5b68e8d6
Changes
7
Hide whitespace changes
Inline
Side-by-side
plug-ins/perl/Changes
View file @
79bf0247
Revision history for Gimp-Perl extension.
- changed the definition of PF_RADIO, simplifying it (it ain't no C).
1.07 Mon Mar 15 01:27:05 CET 1999
- added examples/yinyang, examples/image_tile, examples/stamps.
- bangpath is no longer updated inplace. As a result, only plug-ins
...
...
@@ -15,7 +17,7 @@ Revision history for Gimp-Perl extension.
- gimp_progress_init now accepts either one or two arguments.
- switched to using Devel::PPPort, which hopefulyl solves all my
problems.
- argh! gimptool path was wrong again! the fix version should be much
- argh! gimptool path was wrong again! the fix
ed
version should be much
faster as well.
- new module Gimp::Pod.
- embedded pod documentation will now be shown when the Help button
...
...
plug-ins/perl/Gimp.pm
View file @
79bf0247
...
...
@@ -278,8 +278,10 @@ sub format_msg {
sub
_initialized_callback
{
if
(
@log
)
{
for
(
@log
)
{
Gimp
->
message
(
format_msg
(
$_
))
if
$_
->
[
3
]
&&
$interface_type
eq
"
lib
";
unless
(
$in_net
||
$in_query
||
$in_quit
||
$in_init
)
{
for
(
@log
)
{
Gimp
->
message
(
format_msg
(
$_
))
if
$_
->
[
3
];
}
}
Gimp
->
_gimp_append_data
('
gimp-perl-log
',
map
join
("
\
1
",
@
$_
)
.
"
\
0
",
@log
);
@log
=
();
...
...
@@ -296,7 +298,7 @@ sub logger {
$args
{
function
}
=
""
unless
defined
$args
{
function
};
$args
{
fatal
}
=
1
unless
defined
$args
{
fatal
};
push
(
@log
,[
$basename
,
@args
{'
function
','
message
','
fatal
'}]);
print
STDERR
format_msg
(
$log
[
-
1
]),"
\n
"
if
(
$in_
run
||
$in_
ne
t
||
$verbose
)
;
print
STDERR
format_msg
(
$log
[
-
1
]),"
\n
"
if
!
(
$in_
query
||
$in_
ini
t
||
$in_quit
)
||
$verbose
;
_initialized_callback
if
initialized
();
}
...
...
@@ -304,6 +306,25 @@ sub die_msg {
logger
(
message
=>
substr
(
$_
[
0
],
0
,
-
1
),
fatal
=>
1
,
function
=>
'
ERROR
');
}
unless
(
$no_SIG
)
{
$SIG
{
__DIE__
}
=
sub
{
unless
(
$^S
||
!
defined
$^S
||
$in_quit
)
{
die_msg
$_
[
0
];
initialized
()
?
die
"
BE QUIET ABOUT THIS DIE
\n
"
:
xs_exit
(
main
());
}
else
{
die
$_
[
0
];
}
};
$SIG
{
__WARN__
}
=
sub
{
unless
(
$in_quit
)
{
warn
$_
[
0
];
}
else
{
logger
(
message
=>
substr
(
$_
[
0
],
0
,
-
1
),
fatal
=>
0
,
function
=>
'
WARNING
');
}
};
}
sub
call_callback
{
my
$req
=
shift
;
my
$cb
=
shift
;
...
...
@@ -347,25 +368,6 @@ sub quiet_main {
main
;
}
unless
(
$no_SIG
)
{
$SIG
{
__DIE__
}
=
sub
{
unless
(
$^S
||
!
defined
$^S
||
$in_quit
)
{
die_msg
$_
[
0
];
initialized
()
?
die
"
BE QUIET ABOUT THIS DIE
\n
"
:
xs_exit
(
main
());
}
else
{
die
$_
[
0
];
}
};
$SIG
{
__WARN__
}
=
sub
{
unless
(
$in_quit
)
{
warn
$_
[
0
];
}
else
{
logger
(
message
=>
substr
(
$_
[
0
],
0
,
-
1
),
fatal
=>
0
,
function
=>
'
WARNING
');
}
};
}
##############################################################################
if
(
$interface_type
=~
/^lib$/i
)
{
...
...
plug-ins/perl/Gimp/Fu.pm
View file @
79bf0247
...
...
@@ -351,8 +351,9 @@ sub interact($$$@) {
my
$b
=
new
Gtk::
HBox
0
,
5
;
my
(
$r
,
$prev
);
my
$prev_sub
=
sub
{
$r
=
$_
[
0
]
};
for
(
@$extra
)
{
my
(
$label
,
$value
)
=
@$_
;
while
(
@$extra
)
{
my
$label
=
shift
@$extra
;
my
$value
=
shift
@$extra
;
my
$radio
=
new
Gtk::
RadioButton
$label
;
$radio
->
set_group
(
$prev
)
if
$prev
;
$b
->
pack_start
(
$radio
,
1
,
0
,
5
);
...
...
@@ -822,11 +823,11 @@ The same as PF_SLIDER, except that this one uses a spinbutton instead of a scale
In addition to a default value, an extra argument describing the various
options I<must> be provided. That extra argument must be a reference
to an array filled with
["
Option-Name
", integer-v
alue
]
pairs. Gimp::Fu
to an array filled with
C<
Option-Name
=> Option-V
alue
>
pairs. Gimp::Fu
will then generate a horizontal frame with radio buttons, one for each
alternative. For example:
[PF_RADIO, "direction", "the direction to move to", 5, [
["
Left
",5],["
Right
",
7]]]
[PF_RADIO, "direction", "the direction to move to", 5, [Left
=> 5,
Right
=>
7]]]
draws two buttons, when the first (the default, "Left") is activated, 5
will be returned. If the second is activated, 7 is returned.
...
...
plug-ins/perl/Gimp/Pod.pm
View file @
79bf0247
...
...
@@ -5,13 +5,25 @@ use Config;
$VERSION
=
$
Gimp::
VERSION
;
sub
myqx
(&) {
local
$/
;
local
*MYQX
;
if
(
0
==
open
MYQX
,"
-|
")
{
&
{
$_
[
0
]};
close
STDOUT
;
Gimp::
_exit
;
}
<
MYQX
>
;
}
sub
find_converters
{
my
$path
=
$Config
{
installscript
};
$converter
{
text
}
=
"
$path
/pod2text
"
if
-
x
"
$path
/pod2text
";
$converter
{
html
}
=
"
$path
/pod2html
"
if
-
x
"
$path
/pod2html
";
$converter
{
man
}
=
"
$path
/pod2man
"
if
-
x
"
$path
/pod2man
"
;
$converter
{
latex
}
=
"
$path
/pod2latex
"
if
-
x
"
$path
/pod2latex
"
;
$converter
{
text
}
=
sub
{
my
$pod
=
shift
;
require
Pod::
Text
;
myqx
{
Pod::Text::
pod2text
(
-
60000
,
$pod
)
}
};
$converter
{
texta
}
=
sub
{
my
$pod
=
shift
;
require
Pod::
Text
;
myqx
{
Pod::Text::
pod2text
(
-
60000
,
'
-a
',
$pod
)
}
};
$converter
{
html
}
=
sub
{
my
$pod
=
shift
;
require
Pod::
Html
;
myqx
{
Pod::Html::
pod2html
(
$pod
)
}
};
$converter
{
man
}
=
sub
{
qx($path/pod2man $pod)
}
if
-
x
"
$path
/pod2man
"
;
$converter
{
latex
}
=
sub
{
qx($path/pod2latex $pod)
}
if
-
x
"
$path
/pod2latex
"
;
}
sub
find
{
...
...
@@ -25,14 +37,14 @@ sub new {
bless
$self
,
$pkg
;
}
sub
cache
_doc
{
sub
_
cache
{
my
$self
=
shift
;
my
$fmt
=
shift
;
if
(
!
$self
->
{
doc
}{
$fmt
}
&&
$converter
{
$fmt
})
{
my
$doc
=
qx(
$converter{$fmt}
$self->{path})
;
my
$doc
=
$converter
{
$fmt
}
->
(
$self
->
{
path
});
undef
$doc
if
$?
>>
8
;
undef
$doc
if
$doc
=~
/^[ \t\r\n]*$/
;
$self
->
{
doc
}{
$fmt
}
=
$doc
;
$self
->
{
doc
}{
$fmt
}
=
\
$doc
;
}
$self
->
{
doc
}{
$fmt
};
}
...
...
@@ -40,7 +52,44 @@ sub cache_doc {
sub
format
{
my
$self
=
shift
;
my
$fmt
=
shift
||
'
text
';
$self
->
cache_doc
(
$fmt
);
$
{
$self
->
_cache
(
$fmt
)};
}
sub
sections
{
my
$self
=
shift
;
my
$doc
=
$self
->
_cache
('
text
');
$$doc
=~
/^\S.*$/mg
;
}
sub
section
{
my
$self
=
shift
;
my
$doc
=
$self
->
_cache
('
text
');
(
$doc
)
=
$$doc
=~
/^$_[0]$(.*?)^[A-Z]/sm
;
$doc
=~
y/\r//d
;
$doc
=~
s/^\s*\n//
;
$doc
=~
s/[ \t\r\n]+$/\n/
;
$doc
=~
s/^ //mg
;
$doc
;
}
sub
author
{
my
$self
=
shift
;
$self
->
section
('
AUTHOR
');
}
sub
blurb
{
my
$self
=
shift
;
$self
->
section
('
BLURB
')
||
$self
->
section
('
NAME
');
}
sub
description
{
my
$self
=
shift
;
$self
->
section
('
DESCRIPTION
');
}
sub
copyright
{
my
$self
=
shift
;
$self
->
section
('
COPYRIGHT
')
||
$self
->
section
('
AUTHOR
');
}
find_converters
;
...
...
@@ -59,6 +108,9 @@ Gimp::Pod - Evaluate pod documentation embedded in scripts.
$pod = new Gimp::Pod;
$text = $pod->format ();
$html = $pod->format ('html');
$synopsis = $pod->section ('SYNOPSIS');
$author = $pod->author;
@sections = $pod->sections;
=head1 DESCRIPTION
...
...
@@ -75,12 +127,32 @@ future versions might have more interesting features.
return a new Gimp::Pod object representing the current script or undef, if
an error occured.
=item format
[
format]
=item format
([$
format]
)
Returns the embedded pod documentation in the given format, or undef if no
documentation can be found. Format can be one of 'text', 'html', 'man' or
'latex'. If none is specified, 'text' is assumed.
=item section($header)
Tries to retrieve the section with the header C<$header>. There is no
trailing newline on the returned string, which may be undef in case the
section can't be found.
=item author
=item blurb
=item description
=item copyright
Tries to retrieve fields suitable for calls to the register function.
=item sections
Returns a list of paragraphs found in the pod.
=back
=head1 AUTHOR
...
...
plug-ins/perl/examples/blowinout.pl
View file @
79bf0247
...
...
@@ -90,7 +90,7 @@ register
"
Generates an animation thats blows the selected layer in or out
",
"
John Pitney
",
"
John Pitney <pitney
\@
uiuc.edu>
",
"
1999-0
2-24
",
"
1999-0
3-15
",
"
<Image>/Filters/Distorts/BlowInOut
",
"
*
",
[
...
...
@@ -99,8 +99,8 @@ register
[
PF_VALUE
,
"
distance
",
"
How far to blow
",
30
],
# What I really need here are radio buttons! Maybe they even exist...
# You wanted them...
[
PF_RADIO
,
"
direction
",
"
Blow direction
",
0
,
[
["
In
",
1
],["
Out
",
0
]]
]
,
[
PF_RADIO
,
"
series
",
"
Kind of series
",
1
,
[
["
Arithmetic
",
1
],["
Geometric
",
0
]
]]
[
PF_RADIO
,
"
direction
",
"
Blow direction
",
0
,
[
In
=>
1
,
Out
=>
0
]],
[
PF_RADIO
,
"
series
",
"
Kind of series
",
1
,
[
Arithmetic
=>
1
,
Geometric
=>
0
]]
],
[]
,
\
&blowinout
;
...
...
plug-ins/perl/examples/example-fu.pl
View file @
79bf0247
...
...
@@ -3,22 +3,29 @@
use
Gimp
;
use
Gimp::
Fu
;
register
"
my_first_gimp_fu
",
# fill in name
"
My very first Gimp::Fu script
",
# and a small description,
"
Just a starting point to derive new scripts
",
# a help text
register
"
my_first_gimp_fu
",
# fill in a function name
"
My very first Gimp::Fu script
",
# and a short description,
"
Just a starting point to derive new
"
.
# a (possibly multiline) help text
"
scripts. Always remember to put a long
"
.
"
help message here!
",
"
My name
",
# don't forget your name (author)
"
My name (my copyright)
",
# and your copyright!
"
19981006
",
# the date this script was written
"
<Toolbox>/Xtns/M
Y
Very First
",
# the menu path
"
<Toolbox>/Xtns/M
y
Very First
",
# the menu path
"
*
",
# which image types do I accept (all)
[
[
PF_SLIDER
,
"
width
"
,
"
The image width
"
,
360
,
[
300
,
500
]],
[
PF_SPINNER
,
"
height
"
,
"
The image height
"
,
100
,
[
100
,
200
]],
[
PF_STRING
,
"
text
"
,
"
The Message
"
,
"
example text
"],
[
PF_INT
,
"
bordersize
"
,
"
The bordersize
"
,
10
],
[
PF_FLOAT
,
"
borderwidth
"
,
"
The borderwidth
"
,
1
/
5
],
[
PF_FONT
,
"
font
"
,
"
The Font Family
"
],
[
PF_COLOR
,
"
text_colour
"
,
"
The (foreground) text colour
",
[
10
,
10
,
10
]],
[
PF_COLOR
,
"
bg_colour
"
,
"
The background colour
"
,
"
#ff8000
"],
[
PF_COLO
U
R
,
"
text_colour
"
,
"
The (foreground) text colour
",
[
10
,
10
,
10
]],
[
PF_COLO
U
R
,
"
bg_colour
"
,
"
The background colour
"
,
"
#ff8000
"],
[
PF_TOGGLE
,
"
ignore_cols
"
,
"
Ignore colours
"
,
0
],
[
PF_IMAGE
,
"
extra_image
"
,
"
An additonal picture to ignore
"],
[
PF_DRAWABLE
,
"
extra_draw
"
,
"
Somehting to ignroe as well
"
],
[
PF_RADIO
,
"
type
"
,
"
The effect type
"
,
0
,
[
small
=>
0
,
large
=>
1
]],
[
PF_BRUSH
,
"
a_brush
"
,
"
An unused brush
"
],
[
PF_PATTERN
,
"
a_pattern
"
,
"
An unused pattern
"
],
[
PF_GRADIENT
,
"
a_gradients
"
,
"
An unused gradients
"
],
...
...
plug-ins/perl/examples/terral_text
View file @
79bf0247
...
...
@@ -39,11 +39,11 @@ register
"
Otherwise, it overwrites the current layer and uses a solid noise
",
"
Seth Burgess
",
"
Seth Burgess <sjburges
\@
gimp.org>
",
"
1999-03-1
4
",
"
1999-03-1
5
",
"
<Image>/Filters/Render/Terral Text
",
"
RGB*,GRAY*
",
[
[
PF_RADIO
,
"
solid_noise
",
"
The Texture Type
",
0
,
[
["
solid noise
"
,
1
],[
"
current picture
"
,
0
]
]],
[
PF_RADIO
,
"
solid_noise
",
"
The Texture Type
",
0
,
["
solid noise
"
=>
1
,
"
current picture
"
=>
0
]],
[
PF_FONT
,
"
helvetica
",
"
Font Name
",
"
-*-helvetica-medium-r-normal-*-*-240-*-*-p-*-iso8859-1
"
],
[
PF_STRING
,
"
Text
",
"
Enter your Text to be Terral-ified
",
"
TerralText
"],
[
PF_SLIDER
,
"
Blur Amount
",
"
Blur Amount
",
10
,
[
0
,
26
,
1
]],
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment