2006-04-02 Michael Natterer <mitch@gimp.org> * tools/pdbgen/pdb.pl: added a const_type member to all PDB types, Removed casts from all get_value_funcs which return const pointers, they can stay const now. * tools/pdbgen/app.pl: use the const_type to declare input args. * app/pdb/gimpprocedure.h: pass const arguments to the internal marshallers. * app/xcf/xcf.c: changed accordingly. * tools/pdbgen/pdb/paint_tools.pdb * tools/pdbgen/pdb/paths.pdb: added some const qualifiers. * tools/pdbgen/lib.pl: use the const_type for input args instead of adding the const qualifier based on the type. * app/pdb/_cmds.c * libgimp/gimpparasite_pdb.[ch]: regenerated. Unrelated: * app/pdb/gimpargument.c (gimp_arguments_destroy): no need any more to destroy the argument array in reverse order (we don't need access to the previous element because arrays in GValues memory manage themselves now).
548 lines
19 KiB
C
548 lines
19 KiB
C
/* The GIMP -- an image manipulation program
|
|
* Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
*/
|
|
|
|
/* NOTE: This file is autogenerated by pdbgen.pl. */
|
|
|
|
#include "config.h"
|
|
|
|
#include <string.h>
|
|
|
|
#include <glib-object.h>
|
|
|
|
#include "pdb-types.h"
|
|
#include "gimpargument.h"
|
|
#include "gimpprocedure.h"
|
|
#include "procedural_db.h"
|
|
#include "core/gimpparamspecs.h"
|
|
|
|
#include "core/gimp.h"
|
|
#include "core/gimpbuffer.h"
|
|
#include "core/gimpcontainer-filter.h"
|
|
#include "core/gimpcontainer.h"
|
|
#include "gimp-intl.h"
|
|
|
|
static GimpProcedure buffers_get_list_proc;
|
|
static GimpProcedure buffer_rename_proc;
|
|
static GimpProcedure buffer_delete_proc;
|
|
static GimpProcedure buffer_get_width_proc;
|
|
static GimpProcedure buffer_get_height_proc;
|
|
static GimpProcedure buffer_get_bytes_proc;
|
|
static GimpProcedure buffer_get_image_type_proc;
|
|
|
|
void
|
|
register_buffer_procs (Gimp *gimp)
|
|
{
|
|
GimpProcedure *procedure;
|
|
|
|
/*
|
|
* buffers_get_list
|
|
*/
|
|
procedure = gimp_procedure_init (&buffers_get_list_proc, 1, 2);
|
|
gimp_procedure_add_argument (procedure,
|
|
GIMP_PDB_STRING,
|
|
gimp_param_spec_string ("filter",
|
|
"filter",
|
|
"An optional regular expression used to filter the list",
|
|
FALSE, TRUE,
|
|
NULL,
|
|
GIMP_PARAM_READWRITE));
|
|
gimp_procedure_add_return_value (procedure,
|
|
GIMP_PDB_INT32,
|
|
g_param_spec_int ("num-buffers",
|
|
"num buffers",
|
|
"The number of buffers",
|
|
0, G_MAXINT32, 0,
|
|
GIMP_PARAM_READWRITE));
|
|
gimp_procedure_add_return_value (procedure,
|
|
GIMP_PDB_STRINGARRAY,
|
|
gimp_param_spec_string_array ("buffer-list",
|
|
"buffer list",
|
|
"The list of buffer names",
|
|
GIMP_PARAM_READWRITE));
|
|
procedural_db_register (gimp, procedure);
|
|
|
|
/*
|
|
* buffer_rename
|
|
*/
|
|
procedure = gimp_procedure_init (&buffer_rename_proc, 2, 1);
|
|
gimp_procedure_add_argument (procedure,
|
|
GIMP_PDB_STRING,
|
|
gimp_param_spec_string ("buffer-name",
|
|
"buffer name",
|
|
"The buffer name",
|
|
FALSE, FALSE,
|
|
NULL,
|
|
GIMP_PARAM_READWRITE));
|
|
gimp_procedure_add_argument (procedure,
|
|
GIMP_PDB_STRING,
|
|
gimp_param_spec_string ("new-name",
|
|
"new name",
|
|
"The buffer's new name",
|
|
FALSE, FALSE,
|
|
NULL,
|
|
GIMP_PARAM_READWRITE));
|
|
gimp_procedure_add_return_value (procedure,
|
|
GIMP_PDB_STRING,
|
|
gimp_param_spec_string ("real-name",
|
|
"real name",
|
|
"The real name given to the buffer",
|
|
FALSE, FALSE,
|
|
NULL,
|
|
GIMP_PARAM_READWRITE));
|
|
procedural_db_register (gimp, procedure);
|
|
|
|
/*
|
|
* buffer_delete
|
|
*/
|
|
procedure = gimp_procedure_init (&buffer_delete_proc, 1, 0);
|
|
gimp_procedure_add_argument (procedure,
|
|
GIMP_PDB_STRING,
|
|
gimp_param_spec_string ("buffer-name",
|
|
"buffer name",
|
|
"The buffer name",
|
|
FALSE, FALSE,
|
|
NULL,
|
|
GIMP_PARAM_READWRITE));
|
|
procedural_db_register (gimp, procedure);
|
|
|
|
/*
|
|
* buffer_get_width
|
|
*/
|
|
procedure = gimp_procedure_init (&buffer_get_width_proc, 1, 1);
|
|
gimp_procedure_add_argument (procedure,
|
|
GIMP_PDB_STRING,
|
|
gimp_param_spec_string ("buffer-name",
|
|
"buffer name",
|
|
"The buffer name",
|
|
FALSE, FALSE,
|
|
NULL,
|
|
GIMP_PARAM_READWRITE));
|
|
gimp_procedure_add_return_value (procedure,
|
|
GIMP_PDB_INT32,
|
|
g_param_spec_int ("width",
|
|
"width",
|
|
"The buffer width",
|
|
G_MININT32, G_MAXINT32, 0,
|
|
GIMP_PARAM_READWRITE));
|
|
procedural_db_register (gimp, procedure);
|
|
|
|
/*
|
|
* buffer_get_height
|
|
*/
|
|
procedure = gimp_procedure_init (&buffer_get_height_proc, 1, 1);
|
|
gimp_procedure_add_argument (procedure,
|
|
GIMP_PDB_STRING,
|
|
gimp_param_spec_string ("buffer-name",
|
|
"buffer name",
|
|
"The buffer name",
|
|
FALSE, FALSE,
|
|
NULL,
|
|
GIMP_PARAM_READWRITE));
|
|
gimp_procedure_add_return_value (procedure,
|
|
GIMP_PDB_INT32,
|
|
g_param_spec_int ("height",
|
|
"height",
|
|
"The buffer height",
|
|
G_MININT32, G_MAXINT32, 0,
|
|
GIMP_PARAM_READWRITE));
|
|
procedural_db_register (gimp, procedure);
|
|
|
|
/*
|
|
* buffer_get_bytes
|
|
*/
|
|
procedure = gimp_procedure_init (&buffer_get_bytes_proc, 1, 1);
|
|
gimp_procedure_add_argument (procedure,
|
|
GIMP_PDB_STRING,
|
|
gimp_param_spec_string ("buffer-name",
|
|
"buffer name",
|
|
"The buffer name",
|
|
FALSE, FALSE,
|
|
NULL,
|
|
GIMP_PARAM_READWRITE));
|
|
gimp_procedure_add_return_value (procedure,
|
|
GIMP_PDB_INT32,
|
|
g_param_spec_int ("bytes",
|
|
"bytes",
|
|
"The buffer bpp",
|
|
G_MININT32, G_MAXINT32, 0,
|
|
GIMP_PARAM_READWRITE));
|
|
procedural_db_register (gimp, procedure);
|
|
|
|
/*
|
|
* buffer_get_image_type
|
|
*/
|
|
procedure = gimp_procedure_init (&buffer_get_image_type_proc, 1, 1);
|
|
gimp_procedure_add_argument (procedure,
|
|
GIMP_PDB_STRING,
|
|
gimp_param_spec_string ("buffer-name",
|
|
"buffer name",
|
|
"The buffer name",
|
|
FALSE, FALSE,
|
|
NULL,
|
|
GIMP_PARAM_READWRITE));
|
|
gimp_procedure_add_return_value (procedure,
|
|
GIMP_PDB_INT32,
|
|
g_param_spec_enum ("image-type",
|
|
"image type",
|
|
"The buffer image type: { GIMP_RGB (0), GIMP_GRAY (1), GIMP_INDEXED (2) }",
|
|
GIMP_TYPE_IMAGE_BASE_TYPE,
|
|
GIMP_RGB,
|
|
GIMP_PARAM_READWRITE));
|
|
procedural_db_register (gimp, procedure);
|
|
|
|
}
|
|
|
|
static GimpArgument *
|
|
buffers_get_list_invoker (GimpProcedure *procedure,
|
|
Gimp *gimp,
|
|
GimpContext *context,
|
|
GimpProgress *progress,
|
|
const GimpArgument *args)
|
|
{
|
|
gboolean success = TRUE;
|
|
GimpArgument *return_vals;
|
|
const gchar *filter;
|
|
gint32 num_buffers = 0;
|
|
gchar **buffer_list = NULL;
|
|
|
|
filter = g_value_get_string (&args[0].value);
|
|
|
|
if (success)
|
|
{
|
|
buffer_list = gimp_container_get_filtered_name_array (gimp->named_buffers,
|
|
filter, &num_buffers);
|
|
}
|
|
|
|
return_vals = gimp_procedure_get_return_values (procedure, success);
|
|
|
|
if (success)
|
|
{
|
|
g_value_set_int (&return_vals[1].value, num_buffers);
|
|
gimp_value_take_stringarray (&return_vals[2].value, buffer_list, num_buffers);
|
|
}
|
|
|
|
return return_vals;
|
|
}
|
|
|
|
static GimpProcedure buffers_get_list_proc =
|
|
{
|
|
TRUE, TRUE,
|
|
"gimp-buffers-get-list",
|
|
"gimp-buffers-get-list",
|
|
"Retrieve a complete listing of the available buffers.",
|
|
"This procedure returns a complete listing of available named buffers.",
|
|
"Michael Natterer <mitch@gimp.org>",
|
|
"Michael Natterer",
|
|
"2005",
|
|
NULL,
|
|
GIMP_INTERNAL,
|
|
0, NULL, 0, NULL,
|
|
{ { buffers_get_list_invoker } }
|
|
};
|
|
|
|
static GimpArgument *
|
|
buffer_rename_invoker (GimpProcedure *procedure,
|
|
Gimp *gimp,
|
|
GimpContext *context,
|
|
GimpProgress *progress,
|
|
const GimpArgument *args)
|
|
{
|
|
gboolean success = TRUE;
|
|
GimpArgument *return_vals;
|
|
const gchar *buffer_name;
|
|
const gchar *new_name;
|
|
gchar *real_name = NULL;
|
|
|
|
buffer_name = g_value_get_string (&args[0].value);
|
|
new_name = g_value_get_string (&args[1].value);
|
|
|
|
if (success)
|
|
{
|
|
GimpBuffer *buffer = (GimpBuffer *)
|
|
gimp_container_get_child_by_name (gimp->named_buffers, buffer_name);
|
|
|
|
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_vals = gimp_procedure_get_return_values (procedure, success);
|
|
|
|
if (success)
|
|
g_value_take_string (&return_vals[1].value, real_name);
|
|
|
|
return return_vals;
|
|
}
|
|
|
|
static GimpProcedure buffer_rename_proc =
|
|
{
|
|
TRUE, TRUE,
|
|
"gimp-buffer-rename",
|
|
"gimp-buffer-rename",
|
|
"Renames a named buffer.",
|
|
"This procedure renames a named buffer.",
|
|
"Michael Natterer <mitch@gimp.org>",
|
|
"Michael Natterer",
|
|
"2005",
|
|
NULL,
|
|
GIMP_INTERNAL,
|
|
0, NULL, 0, NULL,
|
|
{ { buffer_rename_invoker } }
|
|
};
|
|
|
|
static GimpArgument *
|
|
buffer_delete_invoker (GimpProcedure *procedure,
|
|
Gimp *gimp,
|
|
GimpContext *context,
|
|
GimpProgress *progress,
|
|
const GimpArgument *args)
|
|
{
|
|
gboolean success = TRUE;
|
|
const gchar *buffer_name;
|
|
|
|
buffer_name = g_value_get_string (&args[0].value);
|
|
|
|
if (success)
|
|
{
|
|
GimpBuffer *buffer = (GimpBuffer *)
|
|
gimp_container_get_child_by_name (gimp->named_buffers, buffer_name);
|
|
|
|
if (buffer)
|
|
success = gimp_container_remove (gimp->named_buffers, GIMP_OBJECT (buffer));
|
|
else
|
|
success = FALSE;
|
|
}
|
|
|
|
return gimp_procedure_get_return_values (procedure, success);
|
|
}
|
|
|
|
static GimpProcedure buffer_delete_proc =
|
|
{
|
|
TRUE, TRUE,
|
|
"gimp-buffer-delete",
|
|
"gimp-buffer-delete",
|
|
"Deletes a named buffer.",
|
|
"This procedure deletes a named buffer.",
|
|
"David Gowers <neota@softhome.net>",
|
|
"David Gowers <neota@softhome.net>",
|
|
"2005",
|
|
NULL,
|
|
GIMP_INTERNAL,
|
|
0, NULL, 0, NULL,
|
|
{ { buffer_delete_invoker } }
|
|
};
|
|
|
|
static GimpArgument *
|
|
buffer_get_width_invoker (GimpProcedure *procedure,
|
|
Gimp *gimp,
|
|
GimpContext *context,
|
|
GimpProgress *progress,
|
|
const GimpArgument *args)
|
|
{
|
|
gboolean success = TRUE;
|
|
GimpArgument *return_vals;
|
|
const gchar *buffer_name;
|
|
gint32 width = 0;
|
|
|
|
buffer_name = g_value_get_string (&args[0].value);
|
|
|
|
if (success)
|
|
{
|
|
GimpBuffer *buffer = (GimpBuffer *)
|
|
gimp_container_get_child_by_name (gimp->named_buffers, buffer_name);
|
|
|
|
if (buffer)
|
|
width = gimp_buffer_get_width (buffer);
|
|
else
|
|
success = FALSE;
|
|
}
|
|
|
|
return_vals = gimp_procedure_get_return_values (procedure, success);
|
|
|
|
if (success)
|
|
g_value_set_int (&return_vals[1].value, width);
|
|
|
|
return return_vals;
|
|
}
|
|
|
|
static GimpProcedure buffer_get_width_proc =
|
|
{
|
|
TRUE, TRUE,
|
|
"gimp-buffer-get-width",
|
|
"gimp-buffer-get-width",
|
|
"Retrieves the specified buffer's width.",
|
|
"This procedure retrieves the specified named buffer's width.",
|
|
"Michael Natterer <mitch@gimp.org>",
|
|
"Michael Natterer",
|
|
"2005",
|
|
NULL,
|
|
GIMP_INTERNAL,
|
|
0, NULL, 0, NULL,
|
|
{ { buffer_get_width_invoker } }
|
|
};
|
|
|
|
static GimpArgument *
|
|
buffer_get_height_invoker (GimpProcedure *procedure,
|
|
Gimp *gimp,
|
|
GimpContext *context,
|
|
GimpProgress *progress,
|
|
const GimpArgument *args)
|
|
{
|
|
gboolean success = TRUE;
|
|
GimpArgument *return_vals;
|
|
const gchar *buffer_name;
|
|
gint32 height = 0;
|
|
|
|
buffer_name = g_value_get_string (&args[0].value);
|
|
|
|
if (success)
|
|
{
|
|
GimpBuffer *buffer = (GimpBuffer *)
|
|
gimp_container_get_child_by_name (gimp->named_buffers, buffer_name);
|
|
|
|
if (buffer)
|
|
height = gimp_buffer_get_height (buffer);
|
|
else
|
|
success = FALSE;
|
|
}
|
|
|
|
return_vals = gimp_procedure_get_return_values (procedure, success);
|
|
|
|
if (success)
|
|
g_value_set_int (&return_vals[1].value, height);
|
|
|
|
return return_vals;
|
|
}
|
|
|
|
static GimpProcedure buffer_get_height_proc =
|
|
{
|
|
TRUE, TRUE,
|
|
"gimp-buffer-get-height",
|
|
"gimp-buffer-get-height",
|
|
"Retrieves the specified buffer's height.",
|
|
"This procedure retrieves the specified named buffer's height.",
|
|
"Michael Natterer <mitch@gimp.org>",
|
|
"Michael Natterer",
|
|
"2005",
|
|
NULL,
|
|
GIMP_INTERNAL,
|
|
0, NULL, 0, NULL,
|
|
{ { buffer_get_height_invoker } }
|
|
};
|
|
|
|
static GimpArgument *
|
|
buffer_get_bytes_invoker (GimpProcedure *procedure,
|
|
Gimp *gimp,
|
|
GimpContext *context,
|
|
GimpProgress *progress,
|
|
const GimpArgument *args)
|
|
{
|
|
gboolean success = TRUE;
|
|
GimpArgument *return_vals;
|
|
const gchar *buffer_name;
|
|
gint32 bytes = 0;
|
|
|
|
buffer_name = g_value_get_string (&args[0].value);
|
|
|
|
if (success)
|
|
{
|
|
GimpBuffer *buffer = (GimpBuffer *)
|
|
gimp_container_get_child_by_name (gimp->named_buffers, buffer_name);
|
|
|
|
if (buffer)
|
|
bytes = gimp_buffer_get_bytes (buffer);
|
|
else
|
|
success = FALSE;
|
|
}
|
|
|
|
return_vals = gimp_procedure_get_return_values (procedure, success);
|
|
|
|
if (success)
|
|
g_value_set_int (&return_vals[1].value, bytes);
|
|
|
|
return return_vals;
|
|
}
|
|
|
|
static GimpProcedure buffer_get_bytes_proc =
|
|
{
|
|
TRUE, TRUE,
|
|
"gimp-buffer-get-bytes",
|
|
"gimp-buffer-get-bytes",
|
|
"Retrieves the specified buffer's bytes.",
|
|
"This procedure retrieves the specified named buffer's bytes.",
|
|
"Michael Natterer <mitch@gimp.org>",
|
|
"Michael Natterer",
|
|
"2005",
|
|
NULL,
|
|
GIMP_INTERNAL,
|
|
0, NULL, 0, NULL,
|
|
{ { buffer_get_bytes_invoker } }
|
|
};
|
|
|
|
static GimpArgument *
|
|
buffer_get_image_type_invoker (GimpProcedure *procedure,
|
|
Gimp *gimp,
|
|
GimpContext *context,
|
|
GimpProgress *progress,
|
|
const GimpArgument *args)
|
|
{
|
|
gboolean success = TRUE;
|
|
GimpArgument *return_vals;
|
|
const gchar *buffer_name;
|
|
gint32 image_type = 0;
|
|
|
|
buffer_name = g_value_get_string (&args[0].value);
|
|
|
|
if (success)
|
|
{
|
|
GimpBuffer *buffer = (GimpBuffer *)
|
|
gimp_container_get_child_by_name (gimp->named_buffers, buffer_name);
|
|
|
|
if (buffer)
|
|
image_type = gimp_buffer_get_image_type (buffer);
|
|
else
|
|
success = FALSE;
|
|
}
|
|
|
|
return_vals = gimp_procedure_get_return_values (procedure, success);
|
|
|
|
if (success)
|
|
g_value_set_enum (&return_vals[1].value, image_type);
|
|
|
|
return return_vals;
|
|
}
|
|
|
|
static GimpProcedure buffer_get_image_type_proc =
|
|
{
|
|
TRUE, TRUE,
|
|
"gimp-buffer-get-image-type",
|
|
"gimp-buffer-get-image-type",
|
|
"Retrieves the specified buffer's image type.",
|
|
"This procedure retrieves the specified named buffer's image type.",
|
|
"Michael Natterer <mitch@gimp.org>",
|
|
"Michael Natterer",
|
|
"2005",
|
|
NULL,
|
|
GIMP_INTERNAL,
|
|
0, NULL, 0, NULL,
|
|
{ { buffer_get_image_type_invoker } }
|
|
};
|