Commit dfc1fbde authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

tools/pdbgen/pdb/buffer.pdb tools/pdbgen/pdb/color.pdb

2006-03-22  Michael Natterer  <mitch@gimp.org>

	* tools/pdbgen/pdb/buffer.pdb
	* tools/pdbgen/pdb/color.pdb
	* tools/pdbgen/pdb/display.pdb
	* tools/pdbgen/pdb/drawable.pdb
	* tools/pdbgen/pdb/drawable_transform.pdb
	* tools/pdbgen/pdb/fileops.pdb
	* tools/pdbgen/pdb/font_select.pdb
	* tools/pdbgen/pdb/gimprc.pdb
	* tools/pdbgen/pdb/layer.pdb
	* tools/pdbgen/pdb/selection.pdb
	* tools/pdbgen/pdb/text_tool.pdb
	* tools/pdbgen/pdb/transform_tools.pdb: more perl stuff flattened,
	cleanup, nitpickyness.

	* app/pdb/buffer_cmds.c
	* app/pdb/color_cmds.c
	* app/pdb/display_cmds.c
	* app/pdb/drawable_cmds.c
	* app/pdb/layer_cmds.c
	* app/pdb/selection_cmds.c
	* libgimp/gimpselection_pdb.[ch]: regenerated.
parent f5ba4548
2006-03-22 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/pdb/buffer.pdb
* tools/pdbgen/pdb/color.pdb
* tools/pdbgen/pdb/display.pdb
* tools/pdbgen/pdb/drawable.pdb
* tools/pdbgen/pdb/drawable_transform.pdb
* tools/pdbgen/pdb/fileops.pdb
* tools/pdbgen/pdb/font_select.pdb
* tools/pdbgen/pdb/gimprc.pdb
* tools/pdbgen/pdb/layer.pdb
* tools/pdbgen/pdb/selection.pdb
* tools/pdbgen/pdb/text_tool.pdb
* tools/pdbgen/pdb/transform_tools.pdb: more perl stuff flattened,
cleanup, nitpickyness.
* app/pdb/buffer_cmds.c
* app/pdb/color_cmds.c
* app/pdb/display_cmds.c
* app/pdb/drawable_cmds.c
* app/pdb/layer_cmds.c
* app/pdb/selection_cmds.c
* libgimp/gimpselection_pdb.[ch]: regenerated.
2006-03-22 Sven Neumann <sven@gimp.org>
* app/base/siox.c (siox_foreground_extract): fixed assertions and
......
......@@ -70,7 +70,10 @@ buffers_get_list_invoker (Gimp *gimp,
success = FALSE;
if (success)
buffer_list = gimp_container_get_filtered_name_array (gimp->named_buffers, filter, &num_buffers);
{
buffer_list = gimp_container_get_filtered_name_array (gimp->named_buffers,
filter, &num_buffers);
}
return_args = procedural_db_return_args (&buffers_get_list_proc, success);
......@@ -149,13 +152,13 @@ buffer_rename_invoker (Gimp *gimp,
GimpBuffer *buffer = (GimpBuffer *)
gimp_container_get_child_by_name (gimp->named_buffers, buffer_name);
success = (buffer != NULL && strlen (new_name) > 0);
if (success)
if (buffer && strlen (new_name))
{
gimp_object_set_name (GIMP_OBJECT (buffer), new_name);
real_name = g_strdup (gimp_object_get_name (GIMP_OBJECT (buffer)));
}
else
success = FALSE;
}
return_args = procedural_db_return_args (&buffer_rename_proc, success);
......@@ -225,10 +228,10 @@ buffer_delete_invoker (Gimp *gimp,
GimpBuffer *buffer = (GimpBuffer *)
gimp_container_get_child_by_name (gimp->named_buffers, buffer_name);
success = (buffer != NULL);
if (success)
if (buffer)
success = gimp_container_remove (gimp->named_buffers, GIMP_OBJECT (buffer));
else
success = FALSE;
}
return procedural_db_return_args (&buffer_delete_proc, success);
......
......@@ -241,11 +241,9 @@ levels_invoker (Gimp *gimp,
if (success)
gimp_drawable_levels (drawable, context,
channel,
low_input,
high_input,
low_input, high_input,
gamma,
low_output,
high_output);
low_output, high_output);
}
return procedural_db_return_args (&levels_proc, success);
......@@ -580,7 +578,7 @@ desaturate_full_invoker (Gimp *gimp,
success = FALSE;
if (success)
gimp_drawable_desaturate (drawable, (GimpDesaturateMode) desaturate_mode);
gimp_drawable_desaturate (drawable, desaturate_mode);
}
return procedural_db_return_args (&desaturate_full_proc, success);
......
......@@ -65,11 +65,14 @@ display_new_invoker (Gimp *gimp,
{
display = gimp_create_display (gimp, gimage, GIMP_UNIT_PIXEL, 1.0);
success = (display != NULL);
/* the first display takes ownership of the image */
if (success && gimage->disp_count == 1)
g_object_unref (gimage);
if (display)
{
/* the first display takes ownership of the image */
if (gimage->disp_count == 1)
g_object_unref (gimage);
}
else
success = FALSE;
}
return_args = procedural_db_return_args (&display_new_proc, success);
......
......@@ -1026,7 +1026,7 @@ drawable_get_image_invoker (Gimp *gimp,
if (success)
{
success = (gimage = gimp_item_get_image (GIMP_ITEM (drawable))) != NULL;
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
}
return_args = procedural_db_return_args (&drawable_get_image_proc, success);
......@@ -1093,7 +1093,8 @@ drawable_set_image_invoker (Gimp *gimp,
if (success)
{
success = (gimage == gimp_item_get_image (GIMP_ITEM (drawable)));
if (gimage != gimp_item_get_image (GIMP_ITEM (drawable)))
success = FALSE;
}
return procedural_db_return_args (&drawable_set_image_proc, success);
......
......@@ -756,7 +756,10 @@ layer_set_offsets_invoker (Gimp *gimp,
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_ITEM_DISPLACE,
_("Move Layer"));
gimp_item_translate (GIMP_ITEM (layer), offx - GIMP_ITEM (layer)->offset_x, offy - GIMP_ITEM (layer)->offset_y, TRUE);
offx -= GIMP_ITEM (layer)->offset_x;
offy -= GIMP_ITEM (layer)->offset_y;
gimp_item_translate (GIMP_ITEM (layer), offx, offy, TRUE);
if (gimp_item_get_linked (GIMP_ITEM (layer)))
gimp_item_linked_translate (GIMP_ITEM (layer), offx, offy, TRUE);
......
......@@ -477,7 +477,9 @@ selection_invert_invoker (Gimp *gimp,
success = FALSE;
if (success)
gimp_channel_invert (gimp_image_get_mask (gimage), TRUE);
{
gimp_channel_invert (gimp_image_get_mask (gimage), TRUE);
}
return procedural_db_return_args (&selection_invert_proc, success);
}
......@@ -523,7 +525,9 @@ selection_sharpen_invoker (Gimp *gimp,
success = FALSE;
if (success)
gimp_channel_sharpen (gimp_image_get_mask (gimage), TRUE);
{
gimp_channel_sharpen (gimp_image_get_mask (gimage), TRUE);
}
return procedural_db_return_args (&selection_sharpen_proc, success);
}
......@@ -569,7 +573,9 @@ selection_all_invoker (Gimp *gimp,
success = FALSE;
if (success)
gimp_channel_all (gimp_image_get_mask (gimage), TRUE);
{
gimp_channel_all (gimp_image_get_mask (gimage), TRUE);
}
return procedural_db_return_args (&selection_all_proc, success);
}
......@@ -615,7 +621,9 @@ selection_none_invoker (Gimp *gimp,
success = FALSE;
if (success)
gimp_channel_clear (gimp_image_get_mask (gimage), NULL, TRUE);
{
gimp_channel_clear (gimp_image_get_mask (gimage), NULL, TRUE);
}
return procedural_db_return_args (&selection_none_proc, success);
}
......@@ -666,7 +674,10 @@ selection_feather_invoker (Gimp *gimp,
success = FALSE;
if (success)
gimp_channel_feather (gimp_image_get_mask (gimage), radius, radius, TRUE);
{
gimp_channel_feather (gimp_image_get_mask (gimage),
radius, radius, TRUE);
}
return procedural_db_return_args (&selection_feather_proc, success);
}
......@@ -722,7 +733,10 @@ selection_border_invoker (Gimp *gimp,
success = FALSE;
if (success)
gimp_channel_border (gimp_image_get_mask (gimage), radius, radius, TRUE);
{
gimp_channel_border (gimp_image_get_mask (gimage),
radius, radius, TRUE);
}
return procedural_db_return_args (&selection_border_proc, success);
}
......@@ -778,7 +792,10 @@ selection_grow_invoker (Gimp *gimp,
success = FALSE;
if (success)
gimp_channel_grow (gimp_image_get_mask (gimage), steps, steps, TRUE);
{
gimp_channel_grow (gimp_image_get_mask (gimage),
steps, steps, TRUE);
}
return procedural_db_return_args (&selection_grow_proc, success);
}
......@@ -823,18 +840,21 @@ selection_shrink_invoker (Gimp *gimp,
{
gboolean success = TRUE;
GimpImage *gimage;
gint32 radius;
gint32 steps;
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_IMAGE (gimage))
success = FALSE;
radius = args[1].value.pdb_int;
if (radius < 0)
steps = args[1].value.pdb_int;
if (steps < 0)
success = FALSE;
if (success)
gimp_channel_shrink (gimp_image_get_mask (gimage), radius, radius, FALSE, TRUE);
{
gimp_channel_shrink (gimp_image_get_mask (gimage),
steps, steps, FALSE, TRUE);
}
return procedural_db_return_args (&selection_shrink_proc, success);
}
......@@ -848,8 +868,8 @@ static ProcArg selection_shrink_inargs[] =
},
{
GIMP_PDB_INT32,
"radius",
"Radius of shrink (in pixels)"
"steps",
"Steps of shrink (in pixels)"
}
};
......@@ -998,7 +1018,12 @@ selection_save_invoker (Gimp *gimp,
success = FALSE;
if (success)
success = (channel = gimp_selection_save (gimp_image_get_mask (gimage))) != NULL;
{
channel = gimp_selection_save (gimp_image_get_mask (gimage));
if (! channel)
success = FALSE;
}
return_args = procedural_db_return_args (&selection_save_proc, success);
......
......@@ -459,7 +459,7 @@ gimp_selection_grow (gint32 image_ID,
/**
* gimp_selection_shrink:
* @image_ID: The image.
* @radius: Radius of shrink (in pixels).
* @steps: Steps of shrink (in pixels).
*
* Shrink the image's selection
*
......@@ -471,7 +471,7 @@ gimp_selection_grow (gint32 image_ID,
*/
gboolean
gimp_selection_shrink (gint32 image_ID,
gint radius)
gint steps)
{
GimpParam *return_vals;
gint nreturn_vals;
......@@ -480,7 +480,7 @@ gimp_selection_shrink (gint32 image_ID,
return_vals = gimp_run_procedure ("gimp-selection-shrink",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_INT32, radius,
GIMP_PDB_INT32, steps,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
......
......@@ -56,7 +56,7 @@ gboolean gimp_selection_border (gint32 image_ID,
gboolean gimp_selection_grow (gint32 image_ID,
gint steps);
gboolean gimp_selection_shrink (gint32 image_ID,
gint radius);
gint steps);
gboolean gimp_selection_layer_alpha (gint32 layer_ID);
gboolean gimp_selection_load (gint32 channel_ID);
gint32 gimp_selection_save (gint32 image_ID);
......
......@@ -39,7 +39,12 @@ HELP
);
%invoke = (
code => 'buffer_list = gimp_container_get_filtered_name_array (gimp->named_buffers, filter, &num_buffers);'
code => <<'CODE'
{
buffer_list = gimp_container_get_filtered_name_array (gimp->named_buffers,
filter, &num_buffers);
}
CODE
);
}
......@@ -62,18 +67,18 @@ sub buffer_rename {
);
%invoke = (
code => <<CODE
code => <<'CODE'
{
GimpBuffer *buffer = (GimpBuffer *)
gimp_container_get_child_by_name (gimp->named_buffers, buffer_name);
success = (buffer != NULL && strlen (new_name) > 0);
if (success)
if (buffer && strlen (new_name))
{
gimp_object_set_name (GIMP_OBJECT (buffer), new_name);
real_name = g_strdup (gimp_object_get_name (GIMP_OBJECT (buffer)));
}
else
success = FALSE;
}
CODE
);
......@@ -93,15 +98,15 @@ sub buffer_delete {
);
%invoke = (
code => <<CODE
code => <<'CODE'
{
GimpBuffer *buffer = (GimpBuffer *)
gimp_container_get_child_by_name (gimp->named_buffers, buffer_name);
success = (buffer != NULL);
if (success)
if (buffer)
success = gimp_container_remove (gimp->named_buffers, GIMP_OBJECT (buffer));
else
success = FALSE;
}
CODE
);
......
......@@ -131,11 +131,9 @@ HELP
if (success)
gimp_drawable_levels (drawable, context,
channel,
low_input,
high_input,
low_input, high_input,
gamma,
low_output,
high_output);
low_output, high_output);
}
CODE
);
......@@ -178,8 +176,6 @@ CODE
);
}
sub levels_auto {
&std_pdb_deprecated ('gimp_levels_stretch');
......@@ -294,11 +290,14 @@ CODE
}
sub desaturate_full {
$blurb = 'Desaturate the contents of the specified drawable, with the specified formula.';
$blurb = <<'BLURB';
Desaturate the contents of the specified drawable, with the specified formula.
BLURB
$help = <<'HELP';
This procedure desaturates the contents of the specified drawable, with the specified
formula. This procedure only works on drawables of type RGB color.
This procedure desaturates the contents of the specified drawable,
with the specified formula. This procedure only works on drawables of
type RGB color.
HELP
$author = $copyright = 'Karine Delvare';
......@@ -321,7 +320,7 @@ HELP
success = FALSE;
if (success)
gimp_drawable_desaturate (drawable, (GimpDesaturateMode) desaturate_mode);
gimp_drawable_desaturate (drawable, desaturate_mode);
}
CODE
);
......
......@@ -44,11 +44,14 @@ HELP
{
display = gimp_create_display (gimp, gimage, GIMP_UNIT_PIXEL, 1.0);
success = (display != NULL);
/* the first display takes ownership of the image */
if (success && gimage->disp_count == 1)
g_object_unref (gimage);
if (display)
{
/* the first display takes ownership of the image */
if (gimage->disp_count == 1)
g_object_unref (gimage);
}
else
success = FALSE;
}
CODE
);
......
......@@ -240,7 +240,7 @@ sub drawable_get_image {
%invoke = (
code => <<'CODE'
{
success = (gimage = gimp_item_get_image (GIMP_ITEM (drawable))) != NULL;
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
}
CODE
);
......@@ -954,7 +954,8 @@ sub drawable_set_image {
%invoke = (
code =><<'CODE'
{
success = (gimage == gimp_item_get_image (GIMP_ITEM (drawable)));
if (gimage != gimp_item_get_image (GIMP_ITEM (drawable)))
success = FALSE;
}
CODE
);
......
......@@ -305,21 +305,32 @@ HELP
@inargs = (
{ name => 'drawable', type => 'drawable',
desc => 'The affected drawable' }
);
my $pos = 0;
foreach $where (qw(upper-left upper-right lower-left lower-right)) {
foreach (qw(x y)) {
push @inargs,
{ name => "$_$pos", type => 'float',
desc => "The new $_ coordinate of $where corner of original
bounding box" }
}
$pos++;
}
@inargs = (@inargs,
&transform_options_args
desc => 'The affected drawable' },
{ name => 'x0', type => 'float',
desc => 'The new x coordinate of upper-left corner of original
bounding box' },
{ name => 'y0', type => 'float',
desc => 'The new y coordinate of upper-left corner of original
bounding box' },
{ name => 'x1', type => 'float',
desc => 'The new x coordinate of upper-right corner of original
bounding box' },
{ name => 'y1', type => 'float',
desc => 'The new y coordinate of upper-right corner of original
bounding box' },
{ name => 'x2', type => 'float',
desc => 'The new x coordinate of lower-left corner of original
bounding box' },
{ name => 'y2', type => 'float',
desc => 'The new y coordinate of lower-left corner of original
bounding box' },
{ name => 'x3', type => 'float',
desc => 'The new x coordinate of lower-right corner of original
bounding box' },
{ name => 'y3', type => 'float',
desc => 'The new y coordinate of lower-right corner of original
bounding box' },
&transform_options_args
);
@outargs = (
......@@ -354,21 +365,32 @@ HELP
@inargs = (
{ name => 'drawable', type => 'drawable',
desc => 'The affected drawable' }
);
my $pos = 0;
foreach $where (qw(upper-left upper-right lower-left lower-right)) {
foreach (qw(x y)) {
push @inargs,
{ name => "$_$pos", type => 'float',
desc => "The new $_ coordinate of $where corner of original
bounding box" }
}
$pos++;
}
@inargs = (@inargs,
&transform_options_default_args
desc => 'The affected drawable' },
{ name => 'x0', type => 'float',
desc => 'The new x coordinate of upper-left corner of original
bounding box' },
{ name => 'y0', type => 'float',
desc => 'The new y coordinate of upper-left corner of original
bounding box' },
{ name => 'x1', type => 'float',
desc => 'The new x coordinate of upper-right corner of original
bounding box' },
{ name => 'y1', type => 'float',
desc => 'The new y coordinate of upper-right corner of original
bounding box' },
{ name => 'x2', type => 'float',
desc => 'The new x coordinate of lower-left corner of original
bounding box' },
{ name => 'y2', type => 'float',
desc => 'The new y coordinate of lower-left corner of original
bounding box' },
{ name => 'x3', type => 'float',
desc => 'The new x coordinate of lower-right corner of original
bounding box' },
{ name => 'y3', type => 'float',
desc => 'The new y coordinate of lower-right corner of original
bounding box' },
&transform_options_default_args
);
@outargs = (
......
......@@ -42,7 +42,9 @@ HELP
desc => 'The name as entered by the user' }
);
@outargs = ( &std_image_arg );
@outargs = (
&std_image_arg
);
$outargs[0]->{desc} = 'The output image';
%invoke = (
......
......@@ -28,9 +28,8 @@ sub fonts_popup {
desc => 'The callback PDB proc to call when font selection is made' },
{ name => 'popup_title', type => 'string',
desc => 'Title to give the font popup window' },
{ name => 'initial_font', type => 'string',
desc => 'The name of the font to set as the first selected',
null_ok => 1 }
{ name => 'initial_font', type => 'string', null_ok => 1,
desc => 'The name of the font to set as the first selected' }
);
%invoke = (
......
......@@ -85,7 +85,7 @@ HELP
);
%invoke = (
code => <<'CODE'
code => <<'CODE'
{
if (strlen (token))
{
......
......@@ -379,8 +379,6 @@ CODE
}
sub layer_set_offsets {
&layer_translate;
$blurb = 'Set the layer offsets.';
$help = <<'HELP';
......@@ -389,10 +387,37 @@ relative to the image origin and can be any values. This operation is valid
only on layers which have been added to an image.
HELP
foreach (qw(x y)) {
$invoke{code} =~
s/(off$_),/$1 - GIMP_ITEM (layer)->offset_$_,/;
}
&std_pdb_misc;
@inargs = (
{ name => 'layer', type => 'layer',
desc => 'The layer' },
{ name => 'offx', type => 'int32',
desc => "Offset in x direction" },
{ name => 'offy', type => 'int32',
desc => "Offset in y direction" }
);
%invoke = (
code => <<'CODE'
{
GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (layer));
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_ITEM_DISPLACE,
_("Move Layer"));
offx -= GIMP_ITEM (layer)->offset_x;
offy -= GIMP_ITEM (layer)->offset_y;
gimp_item_translate (GIMP_ITEM (layer), offx, offy, TRUE);
if (gimp_item_get_linked (GIMP_ITEM (layer)))
gimp_item_linked_translate (GIMP_ITEM (layer), offx, offy, TRUE);
gimp_image_undo_group_end (gimage);
}
CODE
);
}
sub layer_get_mask {
......
......@@ -17,37 +17,6 @@
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
sub selection_simple_proc {
my $op = shift;
&std_pdb_misc;
@inargs = (
&std_image_arg
);
%invoke = ( code => "gimp_channel_$op (gimp_image_get_mask (gimage), TRUE);" );
}
sub selection_change_proc {
my ($op, $arg, $type, $edge_lock) = @_;
$blurb = "\u$op the image's selection";
$help = "This procedure ${op}s the selection. ";
&std_pdb_misc;
@inargs = (
&std_image_arg,
{ name => $arg, type => "0 <= $type",
desc => "\u$arg of $op (in pixels)" }
);
%invoke = ( code => "gimp_channel_$op (gimp_image_get_mask (gimage), $arg, $arg$edge_lock, TRUE);" );
}
# The defs
sub selection_bounds {
$blurb = 'Find the bounding box of the current selection.';
......@@ -217,19 +186,29 @@ CODE
}
sub selection_invert {
&selection_simple_proc('invert');
$blurb = 'Invert the selection mask.';
$help = <<'HELP';
This procedure inverts the selection mask. For every pixel in the selection
channel, its new value is calculated as (255 - old_value).
HELP
&std_pdb_misc;
@inargs = (
&std_image_arg
);
%invoke = (
code => <<'CODE'
{
gimp_channel_invert (gimp_image_get_mask (gimage), TRUE);
}
CODE
);
}
sub selection_sharpen {
&selection_simple_proc('sharpen');
$blurb = 'Sharpen the selection mask.';
$help = <<'HELP';
......@@ -237,17 +216,43 @@ This procedure sharpens the selection mask. For every pixel in the selection
channel, if the value is > 0, the new pixel is assigned a value of 255. This
removes any "anti-aliasing" that might exist in the selection mask's boundary.
HELP
&std_pdb_misc;
@inargs = (
&std_image_arg
);
%invoke = (
code => <<'CODE'
{
gimp_channel_sharpen (gimp_image_get_mask (gimage), TRUE);
}
CODE
);
}
sub selection_all {
&selection_simple_proc('all');
$blurb = 'Select all of the image.';
$help = <<'HELP';
This procedure sets the selection mask to completely encompass the image. Every
pixel in the selection channel is set to 255.
HELP
&std_pdb_misc;
@inargs = (
&std_image_arg
);
%invoke = (
code => <<'CODE'
{
gimp_channel_all (gimp_image_get_mask (gimage), TRUE);
}