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

add some perl evilness to make the includes in the generated files look

2008-02-07  Michael Natterer  <mitch@gimp.org>

	* tools/pdbgen/app.pl: add some perl evilness to make the includes
	in the generated files look almost like they should.

	* tools/pdbgen/pdb/*.pdb: remove inclusion of "core/gimp.h" where
	not needed, clean up lists of includes and functions and reorder
	some functions to make more sense. Zero logic changed.

	* app/pdb/*_cmds.c
	* libgimp/gimpcontext_pdb.[ch]
	* libgimp/gimpbrush_pdb.[ch]: regenerated.


svn path=/trunk/; revision=24829
parent 7f2a8fc3
2008-02-07 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/app.pl: add some perl evilness to make the includes
in the generated files look almost like they should.
* tools/pdbgen/pdb/*.pdb: remove inclusion of "core/gimp.h" where
not needed, clean up lists of includes and functions and reorder
some functions to make more sense. Zero logic changed.
* app/pdb/*_cmds.c
* libgimp/gimpcontext_pdb.[ch]
* libgimp/gimpbrush_pdb.[ch]: regenerated.
2008-02-07 Sven Neumann <sven@gimp.org>
* configure.in: added configure checks for the iso-codes package.
......
......@@ -25,9 +25,6 @@
#include <glib-object.h>
#include "pdb-types.h"
#include "gimppdb.h"
#include "gimpprocedure.h"
#include "core/gimpparamspecs.h"
#include "base/temp-buf.h"
#include "core/gimp.h"
......@@ -35,8 +32,11 @@
#include "core/gimpbrushgenerated.h"
#include "core/gimpcontext.h"
#include "core/gimpdatafactory.h"
#include "gimppdb-utils.h"
#include "core/gimpparamspecs.h"
#include "gimppdb.h"
#include "gimppdb-utils.h"
#include "gimpprocedure.h"
#include "internal_procs.h"
......@@ -453,26 +453,32 @@ brush_get_shape_invoker (GimpProcedure *procedure,
}
static GValueArray *
brush_get_radius_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
brush_set_shape_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GValueArray *return_vals;
const gchar *name;
gdouble radius = 0.0;
gint32 shape_in;
gint32 shape_out = 0;
name = g_value_get_string (&args->values[0]);
shape_in = g_value_get_enum (&args->values[1]);
if (success)
{
GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error);
GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, TRUE, error);
if (brush)
radius = GIMP_BRUSH_GENERATED (brush)->radius;
{
gimp_brush_generated_set_shape (GIMP_BRUSH_GENERATED (brush),
shape_in);
shape_out = GIMP_BRUSH_GENERATED (brush)->shape;
}
else
success = FALSE;
}
......@@ -480,13 +486,13 @@ brush_get_radius_invoker (GimpProcedure *procedure,
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
g_value_set_double (&return_vals->values[1], radius);
g_value_set_enum (&return_vals->values[1], shape_out);
return return_vals;
}
static GValueArray *
brush_get_spikes_invoker (GimpProcedure *procedure,
brush_get_radius_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
......@@ -496,7 +502,7 @@ brush_get_spikes_invoker (GimpProcedure *procedure,
gboolean success = TRUE;
GValueArray *return_vals;
const gchar *name;
gint32 spikes = 0;
gdouble radius = 0.0;
name = g_value_get_string (&args->values[0]);
......@@ -505,7 +511,7 @@ brush_get_spikes_invoker (GimpProcedure *procedure,
GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error);
if (brush)
spikes = GIMP_BRUSH_GENERATED (brush)->spikes;
radius = GIMP_BRUSH_GENERATED (brush)->radius;
else
success = FALSE;
}
......@@ -513,32 +519,38 @@ brush_get_spikes_invoker (GimpProcedure *procedure,
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
g_value_set_int (&return_vals->values[1], spikes);
g_value_set_double (&return_vals->values[1], radius);
return return_vals;
}
static GValueArray *
brush_get_hardness_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
brush_set_radius_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GValueArray *return_vals;
const gchar *name;
gdouble hardness = 0.0;
gdouble radius_in;
gdouble radius_out = 0.0;
name = g_value_get_string (&args->values[0]);
radius_in = g_value_get_double (&args->values[1]);
if (success)
{
GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error);
GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, TRUE, error);
if (brush)
hardness = GIMP_BRUSH_GENERATED (brush)->hardness;
{
gimp_brush_generated_set_radius (GIMP_BRUSH_GENERATED (brush),
radius_in);
radius_out = GIMP_BRUSH_GENERATED (brush)->radius;
}
else
success = FALSE;
}
......@@ -546,23 +558,23 @@ brush_get_hardness_invoker (GimpProcedure *procedure,
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
g_value_set_double (&return_vals->values[1], hardness);
g_value_set_double (&return_vals->values[1], radius_out);
return return_vals;
}
static GValueArray *
brush_get_aspect_ratio_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
brush_get_spikes_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GValueArray *return_vals;
const gchar *name;
gdouble aspect_ratio = 0.0;
gint32 spikes = 0;
name = g_value_get_string (&args->values[0]);
......@@ -571,7 +583,7 @@ brush_get_aspect_ratio_invoker (GimpProcedure *procedure,
GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error);
if (brush)
aspect_ratio = GIMP_BRUSH_GENERATED (brush)->aspect_ratio;
spikes = GIMP_BRUSH_GENERATED (brush)->spikes;
else
success = FALSE;
}
......@@ -579,32 +591,38 @@ brush_get_aspect_ratio_invoker (GimpProcedure *procedure,
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
g_value_set_double (&return_vals->values[1], aspect_ratio);
g_value_set_int (&return_vals->values[1], spikes);
return return_vals;
}
static GValueArray *
brush_get_angle_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
brush_set_spikes_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GValueArray *return_vals;
const gchar *name;
gdouble angle = 0.0;
gint32 spikes_in;
gint32 spikes_out = 0;
name = g_value_get_string (&args->values[0]);
spikes_in = g_value_get_int (&args->values[1]);
if (success)
{
GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error);
GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, TRUE, error);
if (brush)
angle = GIMP_BRUSH_GENERATED (brush)->angle;
{
gimp_brush_generated_set_spikes (GIMP_BRUSH_GENERATED (brush),
spikes_in);
spikes_out = GIMP_BRUSH_GENERATED (brush)->spikes;
}
else
success = FALSE;
}
......@@ -612,38 +630,32 @@ brush_get_angle_invoker (GimpProcedure *procedure,
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
g_value_set_double (&return_vals->values[1], angle);
g_value_set_int (&return_vals->values[1], spikes_out);
return return_vals;
}
static GValueArray *
brush_set_shape_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
brush_get_hardness_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GValueArray *return_vals;
const gchar *name;
gint32 shape_in;
gint32 shape_out = 0;
gdouble hardness = 0.0;
name = g_value_get_string (&args->values[0]);
shape_in = g_value_get_enum (&args->values[1]);
if (success)
{
GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, TRUE, error);
GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error);
if (brush)
{
gimp_brush_generated_set_shape (GIMP_BRUSH_GENERATED (brush),
shape_in);
shape_out = GIMP_BRUSH_GENERATED (brush)->shape;
}
hardness = GIMP_BRUSH_GENERATED (brush)->hardness;
else
success = FALSE;
}
......@@ -651,27 +663,27 @@ brush_set_shape_invoker (GimpProcedure *procedure,
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
g_value_set_enum (&return_vals->values[1], shape_out);
g_value_set_double (&return_vals->values[1], hardness);
return return_vals;
}
static GValueArray *
brush_set_radius_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
brush_set_hardness_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GValueArray *return_vals;
const gchar *name;
gdouble radius_in;
gdouble radius_out = 0.0;
gdouble hardness_in;
gdouble hardness_out = 0.0;
name = g_value_get_string (&args->values[0]);
radius_in = g_value_get_double (&args->values[1]);
hardness_in = g_value_get_double (&args->values[1]);
if (success)
{
......@@ -679,9 +691,9 @@ brush_set_radius_invoker (GimpProcedure *procedure,
if (brush)
{
gimp_brush_generated_set_radius (GIMP_BRUSH_GENERATED (brush),
radius_in);
radius_out = GIMP_BRUSH_GENERATED (brush)->radius;
gimp_brush_generated_set_hardness (GIMP_BRUSH_GENERATED (brush),
hardness_in);
hardness_out = GIMP_BRUSH_GENERATED (brush)->hardness;
}
else
success = FALSE;
......@@ -690,38 +702,32 @@ brush_set_radius_invoker (GimpProcedure *procedure,
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
g_value_set_double (&return_vals->values[1], radius_out);
g_value_set_double (&return_vals->values[1], hardness_out);
return return_vals;
}
static GValueArray *
brush_set_spikes_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
brush_get_aspect_ratio_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GValueArray *return_vals;
const gchar *name;
gint32 spikes_in;
gint32 spikes_out = 0;
gdouble aspect_ratio = 0.0;
name = g_value_get_string (&args->values[0]);
spikes_in = g_value_get_int (&args->values[1]);
if (success)
{
GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, TRUE, error);
GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error);
if (brush)
{
gimp_brush_generated_set_spikes (GIMP_BRUSH_GENERATED (brush),
spikes_in);
spikes_out = GIMP_BRUSH_GENERATED (brush)->spikes;
}
aspect_ratio = GIMP_BRUSH_GENERATED (brush)->aspect_ratio;
else
success = FALSE;
}
......@@ -729,27 +735,27 @@ brush_set_spikes_invoker (GimpProcedure *procedure,
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
g_value_set_int (&return_vals->values[1], spikes_out);
g_value_set_double (&return_vals->values[1], aspect_ratio);
return return_vals;
}
static GValueArray *
brush_set_hardness_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
brush_set_aspect_ratio_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GValueArray *return_vals;
const gchar *name;
gdouble hardness_in;
gdouble hardness_out = 0.0;
gdouble aspect_ratio_in;
gdouble aspect_ratio_out = 0.0;
name = g_value_get_string (&args->values[0]);
hardness_in = g_value_get_double (&args->values[1]);
aspect_ratio_in = g_value_get_double (&args->values[1]);
if (success)
{
......@@ -757,9 +763,9 @@ brush_set_hardness_invoker (GimpProcedure *procedure,
if (brush)
{
gimp_brush_generated_set_hardness (GIMP_BRUSH_GENERATED (brush),
hardness_in);
hardness_out = GIMP_BRUSH_GENERATED (brush)->hardness;
gimp_brush_generated_set_aspect_ratio (GIMP_BRUSH_GENERATED (brush),
aspect_ratio_in);
aspect_ratio_out = GIMP_BRUSH_GENERATED (brush)->aspect_ratio;
}
else
success = FALSE;
......@@ -768,38 +774,32 @@ brush_set_hardness_invoker (GimpProcedure *procedure,
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
g_value_set_double (&return_vals->values[1], hardness_out);
g_value_set_double (&return_vals->values[1], aspect_ratio_out);
return return_vals;
}
static GValueArray *
brush_set_aspect_ratio_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
brush_get_angle_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GValueArray *return_vals;
const gchar *name;
gdouble aspect_ratio_in;
gdouble aspect_ratio_out = 0.0;
gdouble angle = 0.0;
name = g_value_get_string (&args->values[0]);
aspect_ratio_in = g_value_get_double (&args->values[1]);
if (success)
{
GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, TRUE, error);
GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, FALSE, error);
if (brush)
{
gimp_brush_generated_set_aspect_ratio (GIMP_BRUSH_GENERATED (brush),
aspect_ratio_in);
aspect_ratio_out = GIMP_BRUSH_GENERATED (brush)->aspect_ratio;
}
angle = GIMP_BRUSH_GENERATED (brush)->angle;
else
success = FALSE;
}
......@@ -807,7 +807,7 @@ brush_set_aspect_ratio_invoker (GimpProcedure *procedure,
return_vals = gimp_procedure_get_return_values (procedure, success);
if (success)
g_value_set_double (&return_vals->values[1], aspect_ratio_out);
g_value_set_double (&return_vals->values[1], angle);
return return_vals;
}
......@@ -1239,14 +1239,14 @@ register_brush_procs (GimpPDB *pdb)
g_object_unref (procedure);
/*
* gimp-brush-get-radius
* gimp-brush-set-shape
*/
procedure = gimp_procedure_new (brush_get_radius_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-brush-get-radius");
procedure = gimp_procedure_new (brush_set_shape_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-brush-set-shape");
gimp_procedure_set_static_strings (procedure,
"gimp-brush-get-radius",
"Get the radius of a generated brush.",
"This procedure gets the radius value for a generated brush. If called for any other type of brush, it does not succeed.",
"gimp-brush-set-shape",
"Set the shape of a generated brush.",
"This procedure sets the shape value for a generated brush. If called for any other type of brush, it does not succeed. The current possibilities are Circle (GIMP_BRUSH_GENERATED_CIRCLE), Square (GIMP_BRUSH_GENERATED_SQUARE), and Diamond (GIMP_BRUSH_GENERATED_DIAMOND). Other shapes are likely to be added in the future.",
"Bill Skaggs <weskaggs@primate.ucdavis.edu>",
"Bill Skaggs",
"2004",
......@@ -1258,24 +1258,32 @@ register_brush_procs (GimpPDB *pdb)
FALSE, FALSE, TRUE,
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_enum ("shape-in",
"shape in",
"The brush shape",
GIMP_TYPE_BRUSH_GENERATED_SHAPE,
GIMP_BRUSH_GENERATED_CIRCLE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_double ("radius",
"radius",
"The radius of the brush in pixels",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
g_param_spec_enum ("shape-out",
"shape out",
"The brush shape actually assigned",
GIMP_TYPE_BRUSH_GENERATED_SHAPE,
GIMP_BRUSH_GENERATED_CIRCLE,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-brush-get-spikes
* gimp-brush-get-radius
*/
procedure = gimp_procedure_new (brush_get_spikes_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-brush-get-spikes");
procedure = gimp_procedure_new (brush_get_radius_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-brush-get-radius");
gimp_procedure_set_static_strings (procedure,
"gimp-brush-get-spikes",
"Get the number of spikes for a generated brush.",
"This procedure gets the number of spikes for a generated brush. If called for any other type of brush, it does not succeed.",
"gimp-brush-get-radius",
"Get the radius of a generated brush.",
"This procedure gets the radius value for a generated brush. If called for any other type of brush, it does not succeed.",
"Bill Skaggs <weskaggs@primate.ucdavis.edu>",
"Bill Skaggs",
"2004",
......@@ -1288,23 +1296,23 @@ register_brush_procs (GimpPDB *pdb)
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_int32 ("spikes",
"spikes",
"The number of spikes on the brush.",
G_MININT32, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
g_param_spec_double ("radius",
"radius",
"The radius of the brush in pixels",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-brush-get-hardness
* gimp-brush-set-radius
*/
procedure = gimp_procedure_new (brush_get_hardness_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-brush-get-hardness");
procedure = gimp_procedure_new (brush_set_radius_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-brush-set-radius");
gimp_procedure_set_static_strings (procedure,
"gimp-brush-get-hardness",
"Get the hardness of a generated brush.",
"This procedure gets the hardness of a generated brush. The hardness of a brush is the amount its intensity fades at the outside edge. If called for any other type of brush, the function does not succeed.",
"gimp-brush-set-radius",
"Set the radius of a generated brush.",
"This procedure sets the radius for a generated brush. If called for any other type of brush, it does not succeed.",
"Bill Skaggs <weskaggs@primate.ucdavis.edu>",
"Bill Skaggs",
"2004",
......@@ -1316,24 +1324,30 @@ register_brush_procs (GimpPDB *pdb)
FALSE, FALSE, TRUE,
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_double ("radius-in",
"radius in",
"The desired brush radius",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_double ("hardness",
"hardness",
"The hardness of the brush.",
g_param_spec_double ("radius-out",
"radius out",
"The brush radius actually assigned",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-brush-get-aspect-ratio
* gimp-brush-get-spikes
*/
procedure = gimp_procedure_new (brush_get_aspect_ratio_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-brush-get-aspect-ratio");
procedure = gimp_procedure_new (brush_get_spikes_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-brush-get-spikes");
gimp_procedure_set_static_strings (procedure,
"gimp-brush-get-aspect-ratio",
"Get the aspect ratio of a generated brush.",
"This procedure gets the aspect ratio of a generated brush. If called for any other type of brush, it does not succeed.",
"gimp-brush-get-spikes",
"Get the number of spikes for a generated brush.",
"This procedure gets the number of spikes for a generated brush. If called for any other type of brush, it does not succeed.",
"Bill Skaggs <weskaggs@primate.ucdavis.edu>",
"Bill Skaggs",
"2004",
......@@ -1346,23 +1360,23 @@ register_brush_procs (GimpPDB *pdb)
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_double ("aspect-ratio",
"aspect ratio",
"The aspect ratio of the brush.",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE));
gimp_param_spec_int32 ("spikes",