added new function gimp_container_get_name_array().

2003-09-04  Sven Neumann  <sven@gimp.org>

	* app/core/gimpcontainer.[ch]: added new function
	gimp_container_get_name_array().

	* tools/pdbgen/pdb/brushes.pdb
	* tools/pdbgen/pdb/gradients.pdb
	* tools/pdbgen/pdb/palettes.pdb
	* tools/pdbgen/pdb/paths.pdb
	* tools/pdbgen/pdb/patterns.pdb: use the new GimpContainer function
	instead of duplicating this code over and over again.

	* app/pdb/brushes_cmds.c
	* app/pdb/gradients_cmds.c
	* app/pdb/palettes_cmds.c
	* app/pdb/paths_cmds.c
	* app/pdb/patterns_cmds.c
	* libgimp/gimpgradients_pdb.c: regenerated.

	* tools/pdbgen/Makefile.am
	* tools/pdbgen/pdb/fonts.pdb: added new file that defines a simple
	PDB API for fonts.

	* tools/pdbgen/groups.pl
	* app/pdb/Makefile.am
	* app/pdb/fonts_cmds.c
	* app/pdb/internal_procs.c
	* libgimp/gimp_pdb.h
	* libgimp/gimpfonts_pdb.[ch]: (re)generated.
This commit is contained in:
Sven Neumann 2003-09-04 12:02:31 +00:00 committed by Sven Neumann
parent ea865689d0
commit 0acc96d9f1
23 changed files with 468 additions and 240 deletions

View File

@ -1,3 +1,33 @@
2003-09-04 Sven Neumann <sven@gimp.org>
* app/core/gimpcontainer.[ch]: added new function
gimp_container_get_name_array().
* tools/pdbgen/pdb/brushes.pdb
* tools/pdbgen/pdb/gradients.pdb
* tools/pdbgen/pdb/palettes.pdb
* tools/pdbgen/pdb/paths.pdb
* tools/pdbgen/pdb/patterns.pdb: use the new GimpContainer function
instead of duplicating this code over and over again.
* app/pdb/brushes_cmds.c
* app/pdb/gradients_cmds.c
* app/pdb/palettes_cmds.c
* app/pdb/paths_cmds.c
* app/pdb/patterns_cmds.c
* libgimp/gimpgradients_pdb.c: regenerated.
* tools/pdbgen/Makefile.am
* tools/pdbgen/pdb/fonts.pdb: added new file that defines a simple
PDB API for fonts.
* tools/pdbgen/groups.pl
* app/pdb/Makefile.am
* app/pdb/fonts_cmds.c
* app/pdb/internal_procs.c
* libgimp/gimp_pdb.h
* libgimp/gimpfonts_pdb.[ch]: (re)generated.
2003-09-04 Simon Budig <simon@gimp.org> 2003-09-04 Simon Budig <simon@gimp.org>
* app/vectors/gimpbezierstroke.c: Changed the direct dragging * app/vectors/gimpbezierstroke.c: Changed the direct dragging

View File

@ -789,8 +789,8 @@ gimp_container_clear (GimpContainer *container)
} }
gboolean gboolean
gimp_container_have (GimpContainer *container, gimp_container_have (const GimpContainer *container,
GimpObject *object) GimpObject *object)
{ {
g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE); g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
@ -852,6 +852,39 @@ gimp_container_get_child_index (const GimpContainer *container,
object); object);
} }
static void
gimp_container_get_name_array_foreach_func (GimpObject *object,
gchar ***names)
{
gchar **name = *names;
*name = g_strdup (gimp_object_get_name (object));
*names++;
}
gchar **
gimp_container_get_name_array (const GimpContainer *container,
gint *length)
{
gchar **names;
g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL);
g_return_val_if_fail (length != NULL, NULL);
*length = gimp_container_num_children (container);
if (*length == 0)
return NULL;
names = g_new (gchar *, *length);
GIMP_CONTAINER_GET_CLASS (container)->foreach (container,
(GFunc) gimp_container_get_name_array_foreach_func,
&names);
return names;
}
static void static void
gimp_container_add_handler_foreach_func (GimpObject *object, gimp_container_add_handler_foreach_func (GimpObject *object,
GimpContainerHandler *handler) GimpContainerHandler *handler)

View File

@ -103,7 +103,7 @@ void gimp_container_thaw (GimpContainer *container);
gboolean gimp_container_frozen (GimpContainer *container); gboolean gimp_container_frozen (GimpContainer *container);
void gimp_container_clear (GimpContainer *container); void gimp_container_clear (GimpContainer *container);
gboolean gimp_container_have (GimpContainer *container, gboolean gimp_container_have (const GimpContainer *container,
GimpObject *object); GimpObject *object);
void gimp_container_foreach (GimpContainer *container, void gimp_container_foreach (GimpContainer *container,
GFunc func, GFunc func,
@ -116,6 +116,9 @@ GimpObject * gimp_container_get_child_by_index (const GimpContainer *container,
gint gimp_container_get_child_index (const GimpContainer *container, gint gimp_container_get_child_index (const GimpContainer *container,
const GimpObject *object); const GimpObject *object);
gchar ** gimp_container_get_name_array (const GimpContainer *container,
gint *length);
GQuark gimp_container_add_handler (GimpContainer *container, GQuark gimp_container_add_handler (GimpContainer *container,
const gchar *signame, const gchar *signame,
GCallback callback, GCallback callback,

View File

@ -18,6 +18,7 @@ libapppdb_a_SOURCES = \
fileops_cmds.c \ fileops_cmds.c \
floating_sel_cmds.c \ floating_sel_cmds.c \
font_select_cmds.c \ font_select_cmds.c \
fonts_cmds.c \
gimprc_cmds.c \ gimprc_cmds.c \
gradient_select_cmds.c \ gradient_select_cmds.c \
gradients_cmds.c \ gradients_cmds.c \

View File

@ -102,30 +102,16 @@ static Argument *
brushes_get_list_invoker (Gimp *gimp, brushes_get_list_invoker (Gimp *gimp,
Argument *args) Argument *args)
{ {
gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar **brushes; gint32 num_brushes;
GList *list; gchar **brush_list;
int i = 0;
brushes = g_new (char *, gimp->brush_factory->container->num_children); brush_list = gimp_container_get_name_array (gimp->brush_factory->container, &num_brushes);
for (list = GIMP_LIST (gimp->brush_factory->container)->list; return_args = procedural_db_return_args (&brushes_get_list_proc, TRUE);
list;
list = g_list_next (list))
{
brushes[i++] = g_strdup (GIMP_OBJECT (list->data)->name);
}
success = (i > 0); return_args[1].value.pdb_int = num_brushes;
return_args[2].value.pdb_pointer = brush_list;
return_args = procedural_db_return_args (&brushes_get_list_proc, success);
if (success)
{
return_args[1].value.pdb_int = gimp->brush_factory->container->num_children;
return_args[2].value.pdb_pointer = brushes;
}
return return_args; return return_args;
} }

115
app/pdb/fonts_cmds.c Normal file
View File

@ -0,0 +1,115 @@
/* 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 <glib-object.h>
#include "libgimpbase/gimpbasetypes.h"
#include "pdb-types.h"
#include "procedural_db.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "text/gimpfonts.h"
static ProcRecord fonts_refresh_proc;
static ProcRecord fonts_get_list_proc;
void
register_fonts_procs (Gimp *gimp)
{
procedural_db_register (gimp, &fonts_refresh_proc);
procedural_db_register (gimp, &fonts_get_list_proc);
}
static Argument *
fonts_refresh_invoker (Gimp *gimp,
Argument *args)
{
gimp_fonts_load (gimp);
return procedural_db_return_args (&fonts_refresh_proc, TRUE);
}
static ProcRecord fonts_refresh_proc =
{
"gimp_fonts_refresh",
"Refresh current fonts.",
"This procedure retrieves all fonts currently in the user's font path and updates the font dialogs accordingly.",
"Sven Neumann",
"Sven Neumann",
"2003",
GIMP_INTERNAL,
0,
NULL,
0,
NULL,
{ { fonts_refresh_invoker } }
};
static Argument *
fonts_get_list_invoker (Gimp *gimp,
Argument *args)
{
Argument *return_args;
gint32 num_fonts;
gchar **font_list;
font_list = gimp_container_get_name_array (gimp->fonts, &num_fonts);
return_args = procedural_db_return_args (&fonts_get_list_proc, TRUE);
return_args[1].value.pdb_int = num_fonts;
return_args[2].value.pdb_pointer = font_list;
return return_args;
}
static ProcArg fonts_get_list_outargs[] =
{
{
GIMP_PDB_INT32,
"num_fonts",
"The number of available fonts"
},
{
GIMP_PDB_STRINGARRAY,
"font_list",
"The list of font names"
}
};
static ProcRecord fonts_get_list_proc =
{
"gimp_fonts_get_list",
"Retrieve the list of loaded fonts.",
"This procedure returns a list of the fonts that are currently available.",
"Sven Neumann",
"Sven Neumann",
"2003",
GIMP_INTERNAL,
0,
NULL,
2,
fonts_get_list_outargs,
{ { fonts_get_list_invoker } }
};

View File

@ -85,30 +85,16 @@ static Argument *
gradients_get_list_invoker (Gimp *gimp, gradients_get_list_invoker (Gimp *gimp,
Argument *args) Argument *args)
{ {
gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar **gradients; gint32 num_gradients;
GList *list; gchar **gradient_list;
gint i = 0;
gradients = g_new (gchar *, gimp->gradient_factory->container->num_children); gradient_list = gimp_container_get_name_array (gimp->gradient_factory->container, &num_gradients);
for (list = GIMP_LIST (gimp->gradient_factory->container)->list; return_args = procedural_db_return_args (&gradients_get_list_proc, TRUE);
list;
list = g_list_next (list))
{
gradients[i++] = g_strdup (GIMP_OBJECT (list->data)->name);
}
success = (i > 0); return_args[1].value.pdb_int = num_gradients;
return_args[2].value.pdb_pointer = gradient_list;
return_args = procedural_db_return_args (&gradients_get_list_proc, success);
if (success)
{
return_args[1].value.pdb_int = gimp->gradient_factory->container->num_children;
return_args[2].value.pdb_pointer = gradients;
}
return return_args; return return_args;
} }
@ -122,7 +108,7 @@ static ProcArg gradients_get_list_outargs[] =
}, },
{ {
GIMP_PDB_STRINGARRAY, GIMP_PDB_STRINGARRAY,
"gradient_names", "gradient_list",
"The list of gradient names" "The list of gradient names"
} }
}; };

View File

@ -41,6 +41,7 @@ void register_edit_procs (Gimp *gimp);
void register_fileops_procs (Gimp *gimp); void register_fileops_procs (Gimp *gimp);
void register_floating_sel_procs (Gimp *gimp); void register_floating_sel_procs (Gimp *gimp);
void register_font_select_procs (Gimp *gimp); void register_font_select_procs (Gimp *gimp);
void register_fonts_procs (Gimp *gimp);
void register_gimprc_procs (Gimp *gimp); void register_gimprc_procs (Gimp *gimp);
void register_gradient_select_procs (Gimp *gimp); void register_gradient_select_procs (Gimp *gimp);
void register_gradients_procs (Gimp *gimp); void register_gradients_procs (Gimp *gimp);
@ -68,7 +69,7 @@ void register_transform_tools_procs (Gimp *gimp);
void register_undo_procs (Gimp *gimp); void register_undo_procs (Gimp *gimp);
void register_unit_procs (Gimp *gimp); void register_unit_procs (Gimp *gimp);
/* 345 procedures registered total */ /* 347 procedures registered total */
void void
internal_procs_init (Gimp *gimp, internal_procs_init (Gimp *gimp,
@ -83,106 +84,109 @@ internal_procs_init (Gimp *gimp,
(* status_callback) (NULL, _("Brushes"), 0.009); (* status_callback) (NULL, _("Brushes"), 0.009);
register_brushes_procs (gimp); register_brushes_procs (gimp);
(* status_callback) (NULL, _("Channel"), 0.041); (* status_callback) (NULL, _("Channel"), 0.04);
register_channel_procs (gimp); register_channel_procs (gimp);
(* status_callback) (NULL, _("Color"), 0.087); (* status_callback) (NULL, _("Color"), 0.086);
register_color_procs (gimp); register_color_procs (gimp);
(* status_callback) (NULL, _("Convert"), 0.125); (* status_callback) (NULL, _("Convert"), 0.124);
register_convert_procs (gimp); register_convert_procs (gimp);
(* status_callback) (NULL, _("Display procedures"), 0.133); (* status_callback) (NULL, _("Display procedures"), 0.133);
register_display_procs (gimp); register_display_procs (gimp);
(* status_callback) (NULL, _("Drawable procedures"), 0.145); (* status_callback) (NULL, _("Drawable procedures"), 0.144);
register_drawable_procs (gimp); register_drawable_procs (gimp);
(* status_callback) (NULL, _("Edit procedures"), 0.212); (* status_callback) (NULL, _("Edit procedures"), 0.21);
register_edit_procs (gimp); register_edit_procs (gimp);
(* status_callback) (NULL, _("File Operations"), 0.229); (* status_callback) (NULL, _("File Operations"), 0.228);
register_fileops_procs (gimp); register_fileops_procs (gimp);
(* status_callback) (NULL, _("Floating selections"), 0.252); (* status_callback) (NULL, _("Floating selections"), 0.251);
register_floating_sel_procs (gimp); register_floating_sel_procs (gimp);
(* status_callback) (NULL, _("Font UI"), 0.27); (* status_callback) (NULL, _("Font UI"), 0.268);
register_font_select_procs (gimp); register_font_select_procs (gimp);
(* status_callback) (NULL, _("Gimprc procedures"), 0.278); (* status_callback) (NULL, _("Fonts"), 0.277);
register_fonts_procs (gimp);
(* status_callback) (NULL, _("Gimprc procedures"), 0.282);
register_gimprc_procs (gimp); register_gimprc_procs (gimp);
(* status_callback) (NULL, _("Gradient UI"), 0.29); (* status_callback) (NULL, _("Gradient UI"), 0.294);
register_gradient_select_procs (gimp); register_gradient_select_procs (gimp);
(* status_callback) (NULL, _("Gradients"), 0.299); (* status_callback) (NULL, _("Gradients"), 0.303);
register_gradients_procs (gimp); register_gradients_procs (gimp);
(* status_callback) (NULL, _("Guide procedures"), 0.319); (* status_callback) (NULL, _("Guide procedures"), 0.323);
register_guides_procs (gimp); register_guides_procs (gimp);
(* status_callback) (NULL, _("Help procedures"), 0.336); (* status_callback) (NULL, _("Help procedures"), 0.34);
register_help_procs (gimp); register_help_procs (gimp);
(* status_callback) (NULL, _("Image"), 0.339); (* status_callback) (NULL, _("Image"), 0.343);
register_image_procs (gimp); register_image_procs (gimp);
(* status_callback) (NULL, _("Layer"), 0.525); (* status_callback) (NULL, _("Layer"), 0.527);
register_layer_procs (gimp); register_layer_procs (gimp);
(* status_callback) (NULL, _("Message procedures"), 0.617); (* status_callback) (NULL, _("Message procedures"), 0.62);
register_message_procs (gimp); register_message_procs (gimp);
(* status_callback) (NULL, _("Miscellaneous"), 0.626); (* status_callback) (NULL, _("Miscellaneous"), 0.628);
register_misc_procs (gimp); register_misc_procs (gimp);
(* status_callback) (NULL, _("Misc Tool procedures"), 0.632); (* status_callback) (NULL, _("Misc Tool procedures"), 0.634);
register_misc_tools_procs (gimp); register_misc_tools_procs (gimp);
(* status_callback) (NULL, _("Paint Tool procedures"), 0.641); (* status_callback) (NULL, _("Paint Tool procedures"), 0.643);
register_paint_tools_procs (gimp); register_paint_tools_procs (gimp);
(* status_callback) (NULL, _("Palette"), 0.684); (* status_callback) (NULL, _("Palette"), 0.686);
register_palette_procs (gimp); register_palette_procs (gimp);
(* status_callback) (NULL, _("Palette UI"), 0.701); (* status_callback) (NULL, _("Palette UI"), 0.703);
register_palette_select_procs (gimp); register_palette_select_procs (gimp);
(* status_callback) (NULL, _("Palettes"), 0.71); (* status_callback) (NULL, _("Palettes"), 0.712);
register_palettes_procs (gimp); register_palettes_procs (gimp);
(* status_callback) (NULL, _("Parasite procedures"), 0.725); (* status_callback) (NULL, _("Parasite procedures"), 0.726);
register_parasite_procs (gimp); register_parasite_procs (gimp);
(* status_callback) (NULL, _("Paths"), 0.759); (* status_callback) (NULL, _("Paths"), 0.761);
register_paths_procs (gimp); register_paths_procs (gimp);
(* status_callback) (NULL, _("Pattern UI"), 0.8); (* status_callback) (NULL, _("Pattern UI"), 0.801);
register_pattern_select_procs (gimp); register_pattern_select_procs (gimp);
(* status_callback) (NULL, _("Patterns"), 0.809); (* status_callback) (NULL, _("Patterns"), 0.81);
register_patterns_procs (gimp); register_patterns_procs (gimp);
(* status_callback) (NULL, _("Plug-in"), 0.823); (* status_callback) (NULL, _("Plug-in"), 0.824);
register_plug_in_procs (gimp); register_plug_in_procs (gimp);
(* status_callback) (NULL, _("Procedural database"), 0.841); (* status_callback) (NULL, _("Procedural database"), 0.841);
register_procedural_db_procs (gimp); register_procedural_db_procs (gimp);
(* status_callback) (NULL, _("Image mask"), 0.864); (* status_callback) (NULL, _("Image mask"), 0.865);
register_selection_procs (gimp); register_selection_procs (gimp);
(* status_callback) (NULL, _("Selection Tool procedures"), 0.916); (* status_callback) (NULL, _("Selection Tool procedures"), 0.916);
register_selection_tools_procs (gimp); register_selection_tools_procs (gimp);
(* status_callback) (NULL, _("Text procedures"), 0.93); (* status_callback) (NULL, _("Text procedures"), 0.931);
register_text_tool_procs (gimp); register_text_tool_procs (gimp);
(* status_callback) (NULL, _("Transform Tool procedures"), 0.942); (* status_callback) (NULL, _("Transform Tool procedures"), 0.942);
register_transform_tools_procs (gimp); register_transform_tools_procs (gimp);
(* status_callback) (NULL, _("Undo"), 0.959); (* status_callback) (NULL, _("Undo"), 0.96);
register_undo_procs (gimp); register_undo_procs (gimp);
(* status_callback) (NULL, _("Units"), 0.965); (* status_callback) (NULL, _("Units"), 0.965);

View File

@ -91,30 +91,16 @@ static Argument *
palettes_get_list_invoker (Gimp *gimp, palettes_get_list_invoker (Gimp *gimp,
Argument *args) Argument *args)
{ {
gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar **palettes; gint32 num_palettes;
GList *list; gchar **palette_list;
gint i = 0;
palettes = g_new (gchar *, gimp->palette_factory->container->num_children); palette_list = gimp_container_get_name_array (gimp->palette_factory->container, &num_palettes);
for (list = GIMP_LIST (gimp->palette_factory->container)->list; return_args = procedural_db_return_args (&palettes_get_list_proc, TRUE);
list;
list = g_list_next (list))
{
palettes[i++] = g_strdup (GIMP_OBJECT (list->data)->name);
}
success = (i > 0); return_args[1].value.pdb_int = num_palettes;
return_args[2].value.pdb_pointer = palette_list;
return_args = procedural_db_return_args (&palettes_get_list_proc, success);
if (success)
{
return_args[1].value.pdb_int = gimp->palette_factory->container->num_children;
return_args[2].value.pdb_pointer = palettes;
}
return return_args; return return_args;
} }

View File

@ -82,33 +82,15 @@ path_list_invoker (Gimp *gimp,
gboolean success = TRUE; gboolean success = TRUE;
Argument *return_args; Argument *return_args;
GimpImage *gimage; GimpImage *gimage;
gint32 num_paths = 0; gint32 num_paths;
gchar **path_list = NULL; gchar **path_list;
gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int); gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
if (! GIMP_IS_IMAGE (gimage)) if (! GIMP_IS_IMAGE (gimage))
success = FALSE; success = FALSE;
if (success) if (success)
{ path_list = gimp_container_get_name_array (gimage->vectors, &num_paths);
num_paths = gimp_container_num_children (gimage->vectors);
if (num_paths > 0)
{
gint count = 0;
GList *list;
path_list = g_new (gchar *, num_paths);
for (list = GIMP_LIST (gimage->vectors)->list;
list;
list = g_list_next (list))
{
path_list[count++] =
g_strdup (gimp_object_get_name (GIMP_OBJECT (list->data)));
}
}
}
return_args = procedural_db_return_args (&path_list_proc, success); return_args = procedural_db_return_args (&path_list_proc, success);

View File

@ -81,30 +81,16 @@ static Argument *
patterns_get_list_invoker (Gimp *gimp, patterns_get_list_invoker (Gimp *gimp,
Argument *args) Argument *args)
{ {
gboolean success = TRUE;
Argument *return_args; Argument *return_args;
gchar **patterns; gint32 num_patterns;
GList *list; gchar **pattern_list;
gint i = 0;
patterns = g_new (gchar *, gimp->pattern_factory->container->num_children); pattern_list = gimp_container_get_name_array (gimp->pattern_factory->container, &num_patterns);
for (list = GIMP_LIST (gimp->pattern_factory->container)->list; return_args = procedural_db_return_args (&patterns_get_list_proc, TRUE);
list;
list = g_list_next (list))
{
patterns[i++] = g_strdup (GIMP_OBJECT (list->data)->name);
}
success = (i > 0); return_args[1].value.pdb_int = num_patterns;
return_args[2].value.pdb_pointer = pattern_list;
return_args = procedural_db_return_args (&patterns_get_list_proc, success);
if (success)
{
return_args[1].value.pdb_int = gimp->pattern_factory->container->num_children;
return_args[2].value.pdb_pointer = patterns;
}
return return_args; return return_args;
} }

View File

@ -34,6 +34,7 @@
#include <libgimp/gimpedit_pdb.h> #include <libgimp/gimpedit_pdb.h>
#include <libgimp/gimpfileops_pdb.h> #include <libgimp/gimpfileops_pdb.h>
#include <libgimp/gimpfloatingsel_pdb.h> #include <libgimp/gimpfloatingsel_pdb.h>
#include <libgimp/gimpfonts_pdb.h>
#include <libgimp/gimpfontselect_pdb.h> #include <libgimp/gimpfontselect_pdb.h>
#include <libgimp/gimpgimprc_pdb.h> #include <libgimp/gimpgimprc_pdb.h>
#include <libgimp/gimpgradients_pdb.h> #include <libgimp/gimpgradients_pdb.h>

92
libgimp/gimpfonts_pdb.c Normal file
View File

@ -0,0 +1,92 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* gimpfonts_pdb.c
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; 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 "gimp.h"
/**
* gimp_fonts_refresh:
*
* Refresh current fonts.
*
* This procedure retrieves all fonts currently in the user's font path
* and updates the font dialogs accordingly.
*
* Returns: TRUE on success.
*/
gboolean
gimp_fonts_refresh (void)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp_fonts_refresh",
&nreturn_vals,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_fonts_get_list:
* @num_fonts: The number of available fonts.
*
* Retrieve the list of loaded fonts.
*
* This procedure returns a list of the fonts that are currently
* available.
*
* Returns: The list of font names.
*/
gchar **
gimp_fonts_get_list (gint *num_fonts)
{
GimpParam *return_vals;
gint nreturn_vals;
gchar **font_list = NULL;
gint i;
return_vals = gimp_run_procedure ("gimp_fonts_get_list",
&nreturn_vals,
GIMP_PDB_END);
*num_fonts = 0;
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
{
*num_fonts = return_vals[1].data.d_int32;
font_list = g_new (gchar *, *num_fonts);
for (i = 0; i < *num_fonts; i++)
font_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
}
gimp_destroy_params (return_vals, nreturn_vals);
return font_list;
}

38
libgimp/gimpfonts_pdb.h Normal file
View File

@ -0,0 +1,38 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* gimpfonts_pdb.h
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; 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 */
#ifndef __GIMP_FONTS_PDB_H__
#define __GIMP_FONTS_PDB_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
gboolean gimp_fonts_refresh (void);
gchar** gimp_fonts_get_list (gint *num_fonts);
G_END_DECLS
#endif /* __GIMP_FONTS_PDB_H__ */

View File

@ -72,7 +72,7 @@ gimp_gradients_get_list (gint *num_gradients)
{ {
GimpParam *return_vals; GimpParam *return_vals;
gint nreturn_vals; gint nreturn_vals;
gchar **gradient_names = NULL; gchar **gradient_list = NULL;
gint i; gint i;
return_vals = gimp_run_procedure ("gimp_gradients_get_list", return_vals = gimp_run_procedure ("gimp_gradients_get_list",
@ -84,14 +84,14 @@ gimp_gradients_get_list (gint *num_gradients)
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
{ {
*num_gradients = return_vals[1].data.d_int32; *num_gradients = return_vals[1].data.d_int32;
gradient_names = g_new (gchar *, *num_gradients); gradient_list = g_new (gchar *, *num_gradients);
for (i = 0; i < *num_gradients; i++) for (i = 0; i < *num_gradients; i++)
gradient_names[i] = g_strdup (return_vals[2].data.d_stringarray[i]); gradient_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
} }
gimp_destroy_params (return_vals, nreturn_vals); gimp_destroy_params (return_vals, nreturn_vals);
return gradient_names; return gradient_list;
} }
/** /**

View File

@ -13,6 +13,7 @@ pdb_sources = \
pdb/fileops.pdb \ pdb/fileops.pdb \
pdb/floating_sel.pdb \ pdb/floating_sel.pdb \
pdb/font_select.pdb \ pdb/font_select.pdb \
pdb/fonts.pdb \
pdb/gimprc.pdb \ pdb/gimprc.pdb \
pdb/gradient_select.pdb \ pdb/gradient_select.pdb \
pdb/gradients.pdb \ pdb/gradients.pdb \

View File

@ -11,6 +11,7 @@
fileops fileops
floating_sel floating_sel
font_select font_select
fonts
gimprc gimprc
gradient_select gradient_select
gradients gradients

View File

@ -104,29 +104,12 @@ HELP
@outargs = ( @outargs = (
{ name => 'brush_list', type => 'stringarray', { name => 'brush_list', type => 'stringarray',
desc => 'The list of brush names', desc => 'The list of brush names',
alias => 'brushes',
array => { name => 'num_brushes', array => { name => 'num_brushes',
desc => 'The number of brushes in the brush list', desc => 'The number of brushes in the brush list' } }
alias => 'gimp->brush_factory->container->num_children',
no_declare => 1 } }
); );
%invoke = ( %invoke = (
vars => [ 'GList *list', 'int i = 0' ], code => 'brush_list = gimp_container_get_name_array (gimp->brush_factory->container, &num_brushes);'
code => <<'CODE'
{
brushes = g_new (char *, gimp->brush_factory->container->num_children);
for (list = GIMP_LIST (gimp->brush_factory->container)->list;
list;
list = g_list_next (list))
{
brushes[i++] = g_strdup (GIMP_OBJECT (list->data)->name);
}
success = (i > 0);
}
CODE
); );
} }

View File

@ -0,0 +1,70 @@
# The GIMP -- an image manipulation program
# Copyright (C) 1995 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.
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
sub pdb_misc {
$author = $copyright = 'Sven Neumann';
$date = '2003';
}
# The defs
sub fonts_refresh {
$blurb = 'Refresh current fonts.';
$help = <<'HELP';
This procedure retrieves all fonts currently in the user's font path
and updates the font dialogs accordingly.
HELP
&pdb_misc;
%invoke = (
code => 'gimp_fonts_load (gimp);'
);
}
sub fonts_get_list {
$blurb = 'Retrieve the list of loaded fonts.';
$help = <<'HELP';
This procedure returns a list of the fonts that are currently available.
HELP
&pdb_misc;
@outargs = (
{ name => 'font_list', type => 'stringarray',
desc => 'The list of font names',
array => { name => 'num_fonts',
desc => 'The number of available fonts' } }
);
%invoke = (
code => 'font_list = gimp_container_get_name_array (gimp->fonts, &num_fonts);'
);
}
@headers = qw("core/gimp.h" "core/gimpcontainer.h" "text/gimpfonts.h");
@procs = qw(fonts_refresh fonts_get_list);
%exports = (app => [@procs], lib => [@procs]);
$desc = 'Fonts';
1;

View File

@ -57,30 +57,14 @@ HELP
&pdb_misc; &pdb_misc;
@outargs = ( @outargs = (
{ name => 'gradient_names', type => 'stringarray', { name => 'gradient_list', type => 'stringarray',
desc => 'The list of gradient names', alias => 'gradients', desc => 'The list of gradient names',
array => { name => 'num_gradients', array => { name => 'num_gradients',
desc => 'The number of loaded gradients', desc => 'The number of loaded gradients' } }
alias => 'gimp->gradient_factory->container->num_children',
no_declare => 1 } }
); );
%invoke = ( %invoke = (
vars => [ 'GList *list', 'gint i = 0' ], code => 'gradient_list = gimp_container_get_name_array (gimp->gradient_factory->container, &num_gradients);'
code => <<'CODE'
{
gradients = g_new (gchar *, gimp->gradient_factory->container->num_children);
for (list = GIMP_LIST (gimp->gradient_factory->container)->list;
list;
list = g_list_next (list))
{
gradients[i++] = g_strdup (GIMP_OBJECT (list->data)->name);
}
success = (i > 0);
}
CODE
); );
} }

View File

@ -100,29 +100,12 @@ HELP
@outargs = ( @outargs = (
{ name => 'palette_list', type => 'stringarray', { name => 'palette_list', type => 'stringarray',
desc => 'The list of palette names', desc => 'The list of palette names',
alias => 'palettes',
array => { name => 'num_palettes', array => { name => 'num_palettes',
desc => 'The number of palettes in the list', desc => 'The number of palettes in the list' } }
alias => 'gimp->palette_factory->container->num_children',
no_declare => 1 } }
); );
%invoke = ( %invoke = (
vars => [ 'GList *list', 'gint i = 0' ], code => 'palette_list = gimp_container_get_name_array (gimp->palette_factory->container, &num_palettes);'
code => <<'CODE'
{
palettes = g_new (gchar *, gimp->palette_factory->container->num_children);
for (list = GIMP_LIST (gimp->palette_factory->container)->list;
list;
list = g_list_next (list))
{
palettes[i++] = g_strdup (GIMP_OBJECT (list->data)->name);
}
success = (i > 0);
}
CODE
); );
} }

View File

@ -37,34 +37,14 @@ HELP
$inargs[0]->{desc} = 'The ID of the image to list the paths from'; $inargs[0]->{desc} = 'The ID of the image to list the paths from';
@outargs = ( @outargs = (
{ name => 'path_list', type => 'stringarray', init => 1, { name => 'path_list', type => 'stringarray',
desc => 'List of the paths belonging to this image', desc => 'List of the paths belonging to this image',
array => { name => 'num_paths', init => 1, array => { name => 'num_paths',
desc => 'The number of paths returned' } } desc => 'The number of paths returned' } }
); );
%invoke = ( %invoke = (
code => <<'CODE' code => 'path_list = gimp_container_get_name_array (gimage->vectors, &num_paths);'
{
num_paths = gimp_container_num_children (gimage->vectors);
if (num_paths > 0)
{
gint count = 0;
GList *list;
path_list = g_new (gchar *, num_paths);
for (list = GIMP_LIST (gimage->vectors)->list;
list;
list = g_list_next (list))
{
path_list[count++] =
g_strdup (gimp_object_get_name (GIMP_OBJECT (list->data)));
}
}
}
CODE
); );
} }

View File

@ -82,29 +82,12 @@ HELP
@outargs = ( @outargs = (
{ name => 'pattern_list', type => 'stringarray', { name => 'pattern_list', type => 'stringarray',
desc => 'The list of pattern names', desc => 'The list of pattern names',
alias => 'patterns',
array => { name => 'num_patterns', array => { name => 'num_patterns',
desc => 'The number of patterns in the pattern list', desc => 'The number of patterns in the pattern list' } }
alias => 'gimp->pattern_factory->container->num_children',
no_declare => 1 } }
); );
%invoke = ( %invoke = (
vars => [ 'GList *list', 'gint i = 0' ], code => 'pattern_list = gimp_container_get_name_array (gimp->pattern_factory->container, &num_patterns);'
code => <<'CODE'
{
patterns = g_new (gchar *, gimp->pattern_factory->container->num_children);
for (list = GIMP_LIST (gimp->pattern_factory->container)->list;
list;
list = g_list_next (list))
{
patterns[i++] = g_strdup (GIMP_OBJECT (list->data)->name);
}
success = (i > 0);
}
CODE
); );
} }