Commit 4503b4a2 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

added gimp-buffers-get-list, should probably get its own PDB group.

2005-09-27  Michael Natterer  <mitch@gimp.org>

	* tools/pdbgen/pdb/buffer.pdb: added gimp-buffers-get-list,
	should probably get its own PDB group.

	* libgimp/gimp.def: changed accordingly.

	* app/pdb/buffer_cmds.c
	* app/pdb/internal_procs.c
	* libgimp/gimpbuffer_pdb.[ch]: regenerated.
parent 489aebab
2005-09-27 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/pdb/buffer.pdb: added gimp-buffers-get-list,
should probably get its own PDB group.
* libgimp/gimp.def: changed accordingly.
* app/pdb/buffer_cmds.c
* app/pdb/internal_procs.c
* libgimp/gimpbuffer_pdb.[ch]: regenerated.
2005-09-27 Sven Neumann <sven@gimp.org>
* app/core/gimp-gui.h
......
......@@ -29,9 +29,11 @@
#include "core/gimp.h"
#include "core/gimpbuffer.h"
#include "core/gimpcontainer-filter.h"
#include "core/gimpcontainer.h"
#include "gimp-intl.h"
static ProcRecord buffers_get_list_proc;
static ProcRecord buffer_rename_proc;
static ProcRecord buffer_delete_proc;
static ProcRecord buffer_get_width_proc;
......@@ -42,6 +44,7 @@ static ProcRecord buffer_get_image_type_proc;
void
register_buffer_procs (Gimp *gimp)
{
procedural_db_register (gimp, &buffers_get_list_proc);
procedural_db_register (gimp, &buffer_rename_proc);
procedural_db_register (gimp, &buffer_delete_proc);
procedural_db_register (gimp, &buffer_get_width_proc);
......@@ -50,6 +53,77 @@ register_buffer_procs (Gimp *gimp)
procedural_db_register (gimp, &buffer_get_image_type_proc);
}
static Argument *
buffers_get_list_invoker (Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
gchar *filter;
gint32 num_buffers;
gchar **buffer_list = NULL;
filter = (gchar *) args[0].value.pdb_pointer;
if (filter && !g_utf8_validate (filter, -1, NULL))
success = FALSE;
if (success)
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);
if (success)
{
return_args[1].value.pdb_int = num_buffers;
return_args[2].value.pdb_pointer = buffer_list;
}
return return_args;
}
static ProcArg buffers_get_list_inargs[] =
{
{
GIMP_PDB_STRING,
"filter",
"An optional regular expression used to filter the list"
}
};
static ProcArg buffers_get_list_outargs[] =
{
{
GIMP_PDB_INT32,
"num-buffers",
"The number of buffers"
},
{
GIMP_PDB_STRINGARRAY,
"buffer-list",
"The list of buffer names"
}
};
static ProcRecord buffers_get_list_proc =
{
"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 <mitch@gimp.org>",
"2005",
NULL,
GIMP_INTERNAL,
1,
buffers_get_list_inargs,
2,
buffers_get_list_outargs,
{ { buffers_get_list_invoker } }
};
static Argument *
buffer_rename_invoker (Gimp *gimp,
GimpContext *context,
......
......@@ -76,7 +76,7 @@ void register_undo_procs (Gimp *gimp);
void register_unit_procs (Gimp *gimp);
void register_vectors_procs (Gimp *gimp);
/* 479 procedures registered total */
/* 480 procedures registered total */
void
internal_procs_init (Gimp *gimp,
......@@ -97,79 +97,79 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Buffer procedures"), 0.065);
register_buffer_procs (gimp);
(* status_callback) (NULL, _("Channel"), 0.077);
(* status_callback) (NULL, _("Channel"), 0.079);
register_channel_procs (gimp);
(* status_callback) (NULL, _("Color"), 0.098);
(* status_callback) (NULL, _("Color"), 0.1);
register_color_procs (gimp);
(* status_callback) (NULL, _("Context"), 0.132);
(* status_callback) (NULL, _("Context"), 0.133);
register_context_procs (gimp);
(* status_callback) (NULL, _("Convert"), 0.177);
(* status_callback) (NULL, _("Convert"), 0.179);
register_convert_procs (gimp);
(* status_callback) (NULL, _("Display procedures"), 0.184);
(* status_callback) (NULL, _("Display procedures"), 0.185);
register_display_procs (gimp);
(* status_callback) (NULL, _("Drawable procedures"), 0.194);
(* status_callback) (NULL, _("Drawable procedures"), 0.196);
register_drawable_procs (gimp);
(* status_callback) (NULL, _("Transformation procedures"), 0.267);
(* status_callback) (NULL, _("Transformation procedures"), 0.269);
register_drawable_transform_procs (gimp);
(* status_callback) (NULL, _("Edit procedures"), 0.301);
(* status_callback) (NULL, _("Edit procedures"), 0.302);
register_edit_procs (gimp);
(* status_callback) (NULL, _("File Operations"), 0.332);
(* status_callback) (NULL, _("File Operations"), 0.333);
register_fileops_procs (gimp);
(* status_callback) (NULL, _("Floating selections"), 0.353);
(* status_callback) (NULL, _("Floating selections"), 0.354);
register_floating_sel_procs (gimp);
(* status_callback) (NULL, _("Font UI"), 0.365);
(* status_callback) (NULL, _("Font UI"), 0.367);
register_font_select_procs (gimp);
(* status_callback) (NULL, _("Fonts"), 0.372);
(* status_callback) (NULL, _("Fonts"), 0.373);
register_fonts_procs (gimp);
(* status_callback) (NULL, _("Gimprc procedures"), 0.376);
(* status_callback) (NULL, _("Gimprc procedures"), 0.377);
register_gimprc_procs (gimp);
(* status_callback) (NULL, _("Gradient"), 0.39);
(* status_callback) (NULL, _("Gradient"), 0.392);
register_gradient_procs (gimp);
(* status_callback) (NULL, _("Gradient UI"), 0.453);
(* status_callback) (NULL, _("Gradient UI"), 0.454);
register_gradient_select_procs (gimp);
(* status_callback) (NULL, _("Gradients"), 0.459);
(* status_callback) (NULL, _("Gradients"), 0.46);
register_gradients_procs (gimp);
(* status_callback) (NULL, _("Guide procedures"), 0.47);
(* status_callback) (NULL, _("Guide procedures"), 0.471);
register_guides_procs (gimp);
(* status_callback) (NULL, _("Help procedures"), 0.482);
(* status_callback) (NULL, _("Help procedures"), 0.483);
register_help_procs (gimp);
(* status_callback) (NULL, _("Image"), 0.484);
(* status_callback) (NULL, _("Image"), 0.485);
register_image_procs (gimp);
(* status_callback) (NULL, _("Layer"), 0.616);
(* status_callback) (NULL, _("Layer"), 0.617);
register_layer_procs (gimp);
(* status_callback) (NULL, _("Message procedures"), 0.672);
(* status_callback) (NULL, _("Message procedures"), 0.673);
register_message_procs (gimp);
(* status_callback) (NULL, _("Miscellaneous"), 0.678);
(* status_callback) (NULL, _("Miscellaneous"), 0.679);
register_misc_procs (gimp);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.685);
register_paint_tools_procs (gimp);
(* status_callback) (NULL, _("Palette"), 0.716);
(* status_callback) (NULL, _("Palette"), 0.717);
register_palette_procs (gimp);
(* status_callback) (NULL, _("Palette UI"), 0.745);
(* status_callback) (NULL, _("Palette UI"), 0.746);
register_palette_select_procs (gimp);
(* status_callback) (NULL, _("Palettes"), 0.752);
......@@ -181,7 +181,7 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Paths"), 0.785);
register_paths_procs (gimp);
(* status_callback) (NULL, _("Pattern"), 0.818);
(* status_callback) (NULL, _("Pattern"), 0.819);
register_pattern_procs (gimp);
(* status_callback) (NULL, _("Pattern UI"), 0.823);
......@@ -190,13 +190,13 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Patterns"), 0.829);
register_patterns_procs (gimp);
(* status_callback) (NULL, _("Plug-in"), 0.837);
(* status_callback) (NULL, _("Plug-in"), 0.838);
register_plug_in_procs (gimp);
(* status_callback) (NULL, _("Procedural database"), 0.85);
register_procedural_db_procs (gimp);
(* status_callback) (NULL, _("Progress"), 0.868);
(* status_callback) (NULL, _("Progress"), 0.869);
register_progress_procs (gimp);
(* status_callback) (NULL, _("Image mask"), 0.885);
......@@ -208,7 +208,7 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Text procedures"), 0.931);
register_text_tool_procs (gimp);
(* status_callback) (NULL, _("Transform Tool procedures"), 0.939);
(* status_callback) (NULL, _("Transform Tool procedures"), 0.94);
register_transform_tools_procs (gimp);
(* status_callback) (NULL, _("Undo"), 0.952);
......
......@@ -48,6 +48,7 @@ EXPORTS
gimp_buffer_get_image_type
gimp_buffer_ger_width
gimp_buffer_rename
gimp_buffers_get_list
gimp_by_color_select
gimp_channel_combine_masks
gimp_channel_copy
......
......@@ -25,6 +25,49 @@
#include "gimp.h"
/**
* gimp_buffers_get_list:
* @filter: An optional regular expression used to filter the list.
* @num_buffers: The number of buffers.
*
* Retrieve a complete listing of the available buffers.
*
* This procedure returns a complete listing of available named
* buffers.
*
* Returns: The list of buffer names.
*
* Since: GIMP 2.4
*/
gchar **
gimp_buffers_get_list (const gchar *filter,
gint *num_buffers)
{
GimpParam *return_vals;
gint nreturn_vals;
gchar **buffer_list = NULL;
gint i;
return_vals = gimp_run_procedure ("gimp-buffers-get-list",
&nreturn_vals,
GIMP_PDB_STRING, filter,
GIMP_PDB_END);
*num_buffers = 0;
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
{
*num_buffers = return_vals[1].data.d_int32;
buffer_list = g_new (gchar *, *num_buffers);
for (i = 0; i < *num_buffers; i++)
buffer_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
}
gimp_destroy_params (return_vals, nreturn_vals);
return buffer_list;
}
/**
* gimp_buffer_rename:
* @buffer_name: The buffer name.
......
......@@ -29,6 +29,8 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
gchar** gimp_buffers_get_list (const gchar *filter,
gint *num_buffers);
gchar* gimp_buffer_rename (const gchar *buffer_name,
const gchar *new_name);
gboolean gimp_buffer_delete (const gchar *buffer_name);
......
......@@ -19,6 +19,35 @@
# The defs
sub buffers_get_list {
$blurb = 'Retrieve a complete listing of the available buffers.';
$help = <<'HELP';
This procedure returns a complete listing of available named buffers.
HELP
$author = $copyright = 'Michael Natterer <mitch@gimp.org>';
$date = '2005';
$since = '2.4';
@inargs = (
{ name => 'filter', type => 'string', null_ok => 1,
desc => 'An optional regular expression used to filter the list' }
);
@outargs = (
{ name => 'buffer_list', type => 'stringarray',
desc => 'The list of buffer names',
array => { name => 'num_buffers',
desc => 'The number of buffers' },
init => 1 }
);
%invoke = (
code => 'buffer_list = gimp_container_get_filtered_name_array (gimp->named_buffers, filter, &num_buffers);'
);
}
sub buffer_rename {
$blurb = 'Renames a named buffer.';
......@@ -233,9 +262,11 @@ CODE
}
@headers = qw(<string.h> "core/gimp.h" "core/gimpbuffer.h"
"core/gimpcontainer.h" "gimp-intl.h");
"core/gimpcontainer.h" "core/gimpcontainer-filter.h"
"gimp-intl.h");
@procs = qw(buffer_rename buffer_delete
@procs = qw(buffers_get_list
buffer_rename buffer_delete
buffer_get_width buffer_get_height
buffer_get_bytes buffer_get_image_type);
%exports = (app => [@procs], lib => [@procs]);
......
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