From 59771587ae08c05c7428ec0c665009d4898c4b53 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Wed, 15 Mar 2006 12:49:25 +0000 Subject: [PATCH] tools/pdbgen/pdb/brush.pdb tools/pdbgen/pdb/brushes.pdb 2006-03-15 Michael Natterer * tools/pdbgen/pdb/brush.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/context.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/drawable_transform.pdb * tools/pdbgen/pdb/gradient.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/palette.pdb * tools/pdbgen/pdb/palettes.pdb * tools/pdbgen/pdb/paths.pdb * tools/pdbgen/pdb/pattern.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/procedural_db.pdb * tools/pdbgen/pdb/transform_tools.pdb: let pdbgen handle *only* variables for arguments and return values and declare all local variables inside the C code. Removed lots of alias => '' and no_declare => 1 stuff from return values, instead let pdbgen declare the variables and assign them manually in the C code. More cleanup. * tools/pdbgen/app.pl: removed support for proc->vars. * app/pdb/brush_cmds.c * app/pdb/brushes_cmds.c * app/pdb/context_cmds.c * app/pdb/drawable_cmds.c * app/pdb/drawable_transform_cmds.c * app/pdb/gradient_cmds.c * app/pdb/gradients_cmds.c * app/pdb/image_cmds.c * app/pdb/palette_cmds.c * app/pdb/palettes_cmds.c * app/pdb/paths_cmds.c * app/pdb/pattern_cmds.c * app/pdb/patterns_cmds.c * app/pdb/procedural_db_cmds.c * app/pdb/transform_tools_cmds.c * libgimp/gimpbrush_pdb.c * libgimp/gimpbrushes_pdb.c * libgimp/gimpgradient_pdb.c * libgimp/gimpgradients_pdb.c * libgimp/gimppalette_pdb.c * libgimp/gimppalettes_pdb.c * libgimp/gimppatterns_pdb.c: regenerated. --- ChangeLog | 48 +++++ app/pdb/brush_cmds.c | 253 ++++++++++++++-------- app/pdb/brushes_cmds.c | 73 +++++-- app/pdb/context_cmds.c | 100 +++++---- app/pdb/drawable_cmds.c | 14 +- app/pdb/drawable_transform_cmds.c | 114 +++++----- app/pdb/gradient_cmds.c | 132 ++++++------ app/pdb/gradients_cmds.c | 23 +- app/pdb/image_cmds.c | 3 +- app/pdb/palette_cmds.c | 94 ++++++--- app/pdb/palettes_cmds.c | 45 ++-- app/pdb/paths_cmds.c | 3 +- app/pdb/pattern_cmds.c | 36 +++- app/pdb/patterns_cmds.c | 48 +++-- app/pdb/procedural_db_cmds.c | 57 +++-- app/pdb/transform_tools_cmds.c | 56 ++--- libgimp/gimpbrush_pdb.c | 18 +- libgimp/gimpbrushes_pdb.c | 6 +- libgimp/gimpgradient_pdb.c | 18 +- libgimp/gimpgradients_pdb.c | 6 +- libgimp/gimppalette_pdb.c | 18 +- libgimp/gimppalettes_pdb.c | 6 +- libgimp/gimppatterns_pdb.c | 6 +- tools/pdbgen/app.pl | 14 -- tools/pdbgen/pdb/brush.pdb | 267 +++++++++++++----------- tools/pdbgen/pdb/brushes.pdb | 100 +++++---- tools/pdbgen/pdb/context.pdb | 142 +++++++------ tools/pdbgen/pdb/drawable.pdb | 10 +- tools/pdbgen/pdb/drawable_transform.pdb | 84 +++----- tools/pdbgen/pdb/gradient.pdb | 78 ++++--- tools/pdbgen/pdb/gradients.pdb | 25 +-- tools/pdbgen/pdb/image.pdb | 3 +- tools/pdbgen/pdb/palette.pdb | 98 +++++---- tools/pdbgen/pdb/palettes.pdb | 55 ++--- tools/pdbgen/pdb/paths.pdb | 3 +- tools/pdbgen/pdb/pattern.pdb | 36 ++-- tools/pdbgen/pdb/patterns.pdb | 62 +++--- tools/pdbgen/pdb/procedural_db.pdb | 70 ++++--- tools/pdbgen/pdb/transform_tools.pdb | 35 ++-- 39 files changed, 1288 insertions(+), 971 deletions(-) diff --git a/ChangeLog b/ChangeLog index 39fcb1b801..0fdcad05ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,51 @@ +2006-03-15 Michael Natterer + + * tools/pdbgen/pdb/brush.pdb + * tools/pdbgen/pdb/brushes.pdb + * tools/pdbgen/pdb/context.pdb + * tools/pdbgen/pdb/drawable.pdb + * tools/pdbgen/pdb/drawable_transform.pdb + * tools/pdbgen/pdb/gradient.pdb + * tools/pdbgen/pdb/gradients.pdb + * tools/pdbgen/pdb/image.pdb + * tools/pdbgen/pdb/palette.pdb + * tools/pdbgen/pdb/palettes.pdb + * tools/pdbgen/pdb/paths.pdb + * tools/pdbgen/pdb/pattern.pdb + * tools/pdbgen/pdb/patterns.pdb + * tools/pdbgen/pdb/procedural_db.pdb + * tools/pdbgen/pdb/transform_tools.pdb: let pdbgen handle *only* + variables for arguments and return values and declare all local + variables inside the C code. Removed lots of alias => '' + and no_declare => 1 stuff from return values, instead let pdbgen + declare the variables and assign them manually in the C code. + More cleanup. + + * tools/pdbgen/app.pl: removed support for proc->vars. + + * app/pdb/brush_cmds.c + * app/pdb/brushes_cmds.c + * app/pdb/context_cmds.c + * app/pdb/drawable_cmds.c + * app/pdb/drawable_transform_cmds.c + * app/pdb/gradient_cmds.c + * app/pdb/gradients_cmds.c + * app/pdb/image_cmds.c + * app/pdb/palette_cmds.c + * app/pdb/palettes_cmds.c + * app/pdb/paths_cmds.c + * app/pdb/pattern_cmds.c + * app/pdb/patterns_cmds.c + * app/pdb/procedural_db_cmds.c + * app/pdb/transform_tools_cmds.c + * libgimp/gimpbrush_pdb.c + * libgimp/gimpbrushes_pdb.c + * libgimp/gimpgradient_pdb.c + * libgimp/gimpgradients_pdb.c + * libgimp/gimppalette_pdb.c + * libgimp/gimppalettes_pdb.c + * libgimp/gimppatterns_pdb.c: regenerated. + 2006-03-15 Sven Neumann * app/actions/channels-actions.c diff --git a/app/pdb/brush_cmds.c b/app/pdb/brush_cmds.c index a0ac812456..7af1867ac5 100644 --- a/app/pdb/brush_cmds.c +++ b/app/pdb/brush_cmds.c @@ -94,7 +94,7 @@ brush_new_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; gchar *name; - GimpData *data = NULL; + gchar *actual_name = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -103,15 +103,22 @@ brush_new_invoker (Gimp *gimp, if (success) { if (strlen (name)) - data = gimp_data_factory_data_new (gimp->brush_factory, name); + { + GimpData *data = gimp_data_factory_data_new (gimp->brush_factory, name); - success = (data != NULL); + if (data) + actual_name = g_strdup (GIMP_OBJECT (data)->name); + else + success = FALSE; + } + else + success = FALSE; } return_args = procedural_db_return_args (&brush_new_proc, success); if (success) - return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (data)->name); + return_args[1].value.pdb_pointer = actual_name; return return_args; } @@ -129,7 +136,7 @@ static ProcArg brush_new_outargs[] = { { GIMP_PDB_STRING, - "name", + "actual-name", "The actual new brush name" } }; @@ -161,8 +168,7 @@ brush_duplicate_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; gchar *name; - GimpBrush *brush = NULL; - GimpBrush *brush_copy = NULL; + gchar *copy_name = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -170,16 +176,19 @@ brush_duplicate_invoker (Gimp *gimp, if (success) { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush) { - brush_copy = (GimpBrush *) + GimpBrush *brush_copy = (GimpBrush *) gimp_data_factory_data_duplicate (gimp->brush_factory, GIMP_DATA (brush)); - success = (brush_copy != NULL); + if (brush_copy) + copy_name = g_strdup (GIMP_OBJECT (brush_copy)->name); + else + success = FALSE; } else success = FALSE; @@ -188,7 +197,7 @@ brush_duplicate_invoker (Gimp *gimp, return_args = procedural_db_return_args (&brush_duplicate_proc, success); if (success) - return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (brush_copy)->name); + return_args[1].value.pdb_pointer = copy_name; return return_args; } @@ -206,7 +215,7 @@ static ProcArg brush_duplicate_outargs[] = { { GIMP_PDB_STRING, - "name", + "copy-name", "The name of the brush's copy" } }; @@ -238,7 +247,7 @@ brush_is_generated_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; gchar *name; - GimpBrush *brush = NULL; + gboolean generated = FALSE; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -246,11 +255,11 @@ brush_is_generated_invoker (Gimp *gimp, if (success) { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush) - success = TRUE; + generated = GIMP_IS_BRUSH_GENERATED (brush); else success = FALSE; } @@ -258,7 +267,7 @@ brush_is_generated_invoker (Gimp *gimp, return_args = procedural_db_return_args (&brush_is_generated_proc, success); if (success) - return_args[1].value.pdb_int = GIMP_IS_BRUSH_GENERATED (brush); + return_args[1].value.pdb_int = generated; return return_args; } @@ -309,7 +318,7 @@ brush_rename_invoker (Gimp *gimp, Argument *return_args; gchar *name; gchar *new_name; - GimpBrush *brush = NULL; + gchar *actual_name = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -321,11 +330,14 @@ brush_rename_invoker (Gimp *gimp, if (success) { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush && GIMP_DATA (brush)->writable) - gimp_object_set_name (GIMP_OBJECT (brush), new_name); + { + gimp_object_set_name (GIMP_OBJECT (brush), new_name); + actual_name = g_strdup (GIMP_OBJECT (brush)->name); + } else success = FALSE; } @@ -333,7 +345,7 @@ brush_rename_invoker (Gimp *gimp, return_args = procedural_db_return_args (&brush_rename_proc, success); if (success) - return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (brush)->name); + return_args[1].value.pdb_pointer = actual_name; return return_args; } @@ -356,7 +368,7 @@ static ProcArg brush_rename_outargs[] = { { GIMP_PDB_STRING, - "name", + "actual-name", "The actual new name of the brush" } }; @@ -387,7 +399,6 @@ brush_delete_invoker (Gimp *gimp, { gboolean success = TRUE; gchar *name; - GimpBrush *brush = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -395,7 +406,7 @@ brush_delete_invoker (Gimp *gimp, if (success) { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush && GIMP_DATA (brush)->deletable) @@ -455,7 +466,7 @@ brush_is_editable_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; gchar *name; - GimpBrush *brush = NULL; + gboolean editable = FALSE; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -463,11 +474,11 @@ brush_is_editable_invoker (Gimp *gimp, if (success) { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush) - success = TRUE; + editable = GIMP_DATA (brush)->writable; else success = FALSE; } @@ -475,7 +486,7 @@ brush_is_editable_invoker (Gimp *gimp, return_args = procedural_db_return_args (&brush_is_editable_proc, success); if (success) - return_args[1].value.pdb_int = GIMP_DATA (brush)->writable; + return_args[1].value.pdb_int = editable; return return_args; } @@ -525,7 +536,10 @@ brush_get_info_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; gchar *name; - GimpBrush *brush = NULL; + gint32 width = 0; + gint32 height = 0; + gint32 mask_bpp = 0; + gint32 color_bpp = 0; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -533,20 +547,28 @@ brush_get_info_invoker (Gimp *gimp, if (success) { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); - success = (brush != NULL); + if (brush) + { + width = brush->mask->width; + height = brush->mask->height; + mask_bpp = brush->mask->bytes; + color_bpp = brush->pixmap ? brush->pixmap->bytes : 0; + } + else + success = FALSE; } return_args = procedural_db_return_args (&brush_get_info_proc, success); if (success) { - return_args[1].value.pdb_int = brush->mask->width; - return_args[2].value.pdb_int = brush->mask->height; - return_args[3].value.pdb_int = brush->mask->bytes; - return_args[4].value.pdb_int = brush->pixmap ? brush->pixmap->bytes : 0; + return_args[1].value.pdb_int = width; + return_args[2].value.pdb_int = height; + return_args[3].value.pdb_int = mask_bpp; + return_args[4].value.pdb_int = color_bpp; } return return_args; @@ -612,13 +634,14 @@ brush_get_pixels_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; gchar *name; + gint32 width = 0; + gint32 height = 0; gint32 mask_bpp = 0; gint32 num_mask_bytes = 0; guint8 *mask_bytes = NULL; gint32 color_bpp = 0; gint32 num_color_bytes = 0; guint8 *color_bytes = NULL; - GimpBrush *brush = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -626,11 +649,13 @@ brush_get_pixels_invoker (Gimp *gimp, if (success) { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush) { + width = brush->mask->width; + height = brush->mask->height; mask_bpp = brush->mask->bytes; num_mask_bytes = brush->mask->height * brush->mask->width; mask_bytes = g_memdup (temp_buf_data (brush->mask), num_mask_bytes); @@ -651,8 +676,8 @@ brush_get_pixels_invoker (Gimp *gimp, if (success) { - return_args[1].value.pdb_int = brush->mask->width; - return_args[2].value.pdb_int = brush->mask->height; + return_args[1].value.pdb_int = width; + return_args[2].value.pdb_int = height; return_args[3].value.pdb_int = mask_bpp; return_args[4].value.pdb_int = num_mask_bytes; return_args[5].value.pdb_pointer = mask_bytes; @@ -744,7 +769,7 @@ brush_get_spacing_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; gchar *name; - GimpBrush *brush = NULL; + gint32 spacing = 0; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -752,16 +777,19 @@ brush_get_spacing_invoker (Gimp *gimp, if (success) { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); - success = (brush != NULL); + if (brush) + spacing = gimp_brush_get_spacing (brush); + else + success = FALSE; } return_args = procedural_db_return_args (&brush_get_spacing_proc, success); if (success) - return_args[1].value.pdb_int = gimp_brush_get_spacing (brush); + return_args[1].value.pdb_int = spacing; return return_args; } @@ -811,7 +839,6 @@ brush_set_spacing_invoker (Gimp *gimp, gboolean success = TRUE; gchar *name; gint32 spacing; - GimpBrush *brush = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -823,7 +850,7 @@ brush_set_spacing_invoker (Gimp *gimp, if (success) { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush) @@ -876,7 +903,7 @@ brush_get_shape_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; gchar *name; - GimpBrush *brush = NULL; + gint32 shape = 0; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -884,16 +911,19 @@ brush_get_shape_invoker (Gimp *gimp, if (success) { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); - success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush)); + if (GIMP_IS_BRUSH_GENERATED (brush)) + shape = GIMP_BRUSH_GENERATED (brush)->shape; + else + success = FALSE; } return_args = procedural_db_return_args (&brush_get_shape_proc, success); if (success) - return_args[1].value.pdb_int = GIMP_BRUSH_GENERATED (brush)->shape; + return_args[1].value.pdb_int = shape; return return_args; } @@ -943,7 +973,7 @@ brush_get_radius_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; gchar *name; - GimpBrush *brush = NULL; + gdouble radius = 0; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -951,16 +981,19 @@ brush_get_radius_invoker (Gimp *gimp, if (success) { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); - success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush)); + if (GIMP_IS_BRUSH_GENERATED (brush)) + radius = GIMP_BRUSH_GENERATED (brush)->radius; + else + success = FALSE; } return_args = procedural_db_return_args (&brush_get_radius_proc, success); if (success) - return_args[1].value.pdb_float = GIMP_BRUSH_GENERATED (brush)->radius; + return_args[1].value.pdb_float = radius; return return_args; } @@ -1010,7 +1043,7 @@ brush_get_spikes_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; gchar *name; - GimpBrush *brush = NULL; + gint32 spikes = 0; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -1018,16 +1051,19 @@ brush_get_spikes_invoker (Gimp *gimp, if (success) { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); - success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush)); + if (GIMP_IS_BRUSH_GENERATED (brush)) + spikes = GIMP_BRUSH_GENERATED (brush)->spikes; + else + success = FALSE; } return_args = procedural_db_return_args (&brush_get_spikes_proc, success); if (success) - return_args[1].value.pdb_int = GIMP_BRUSH_GENERATED (brush)->spikes; + return_args[1].value.pdb_int = spikes; return return_args; } @@ -1077,7 +1113,7 @@ brush_get_hardness_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; gchar *name; - GimpBrush *brush = NULL; + gdouble hardness = 0; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -1085,16 +1121,19 @@ brush_get_hardness_invoker (Gimp *gimp, if (success) { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); - success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush)); + if (GIMP_IS_BRUSH_GENERATED (brush)) + hardness = GIMP_BRUSH_GENERATED (brush)->hardness; + else + success = FALSE; } return_args = procedural_db_return_args (&brush_get_hardness_proc, success); if (success) - return_args[1].value.pdb_float = GIMP_BRUSH_GENERATED (brush)->hardness; + return_args[1].value.pdb_float = hardness; return return_args; } @@ -1144,7 +1183,7 @@ brush_get_aspect_ratio_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; gchar *name; - GimpBrush *brush = NULL; + gdouble aspect_ratio = 0; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -1152,16 +1191,19 @@ brush_get_aspect_ratio_invoker (Gimp *gimp, if (success) { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); - success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush)); + if (GIMP_IS_BRUSH_GENERATED (brush)) + aspect_ratio = GIMP_BRUSH_GENERATED (brush)->aspect_ratio; + else + success = FALSE; } return_args = procedural_db_return_args (&brush_get_aspect_ratio_proc, success); if (success) - return_args[1].value.pdb_float = GIMP_BRUSH_GENERATED (brush)->aspect_ratio; + return_args[1].value.pdb_float = aspect_ratio; return return_args; } @@ -1211,7 +1253,7 @@ brush_get_angle_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; gchar *name; - GimpBrush *brush = NULL; + gdouble angle = 0; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -1219,16 +1261,19 @@ brush_get_angle_invoker (Gimp *gimp, if (success) { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); - success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush)); + if (GIMP_IS_BRUSH_GENERATED (brush)) + angle = GIMP_BRUSH_GENERATED (brush)->angle; + else + success = FALSE; } return_args = procedural_db_return_args (&brush_get_angle_proc, success); if (success) - return_args[1].value.pdb_float = GIMP_BRUSH_GENERATED (brush)->angle; + return_args[1].value.pdb_float = angle; return return_args; } @@ -1279,7 +1324,7 @@ brush_set_shape_invoker (Gimp *gimp, Argument *return_args; gchar *name; gint32 shape_in; - GimpBrush *brush = NULL; + gint32 shape_out = 0; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -1289,11 +1334,15 @@ brush_set_shape_invoker (Gimp *gimp, if (success) { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush)) - gimp_brush_generated_set_shape (GIMP_BRUSH_GENERATED (brush), shape_in); + { + gimp_brush_generated_set_shape (GIMP_BRUSH_GENERATED (brush), + shape_in); + shape_out = GIMP_BRUSH_GENERATED (brush)->shape; + } else success = FALSE; } @@ -1301,7 +1350,7 @@ brush_set_shape_invoker (Gimp *gimp, return_args = procedural_db_return_args (&brush_set_shape_proc, success); if (success) - return_args[1].value.pdb_int = GIMP_BRUSH_GENERATED (brush)->shape; + return_args[1].value.pdb_int = shape_out; return return_args; } @@ -1357,7 +1406,7 @@ brush_set_radius_invoker (Gimp *gimp, Argument *return_args; gchar *name; gdouble radius_in; - GimpBrush *brush = NULL; + gdouble radius_out = 0; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -1367,11 +1416,15 @@ brush_set_radius_invoker (Gimp *gimp, if (success) { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush)) - gimp_brush_generated_set_radius (GIMP_BRUSH_GENERATED (brush), radius_in); + { + gimp_brush_generated_set_radius (GIMP_BRUSH_GENERATED (brush), + radius_in); + radius_out = GIMP_BRUSH_GENERATED (brush)->radius; + } else success = FALSE; } @@ -1379,7 +1432,7 @@ brush_set_radius_invoker (Gimp *gimp, return_args = procedural_db_return_args (&brush_set_radius_proc, success); if (success) - return_args[1].value.pdb_float = GIMP_BRUSH_GENERATED (brush)->radius; + return_args[1].value.pdb_float = radius_out; return return_args; } @@ -1435,7 +1488,7 @@ brush_set_spikes_invoker (Gimp *gimp, Argument *return_args; gchar *name; gint32 spikes_in; - GimpBrush *brush = NULL; + gint32 spikes_out = 0; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -1445,11 +1498,15 @@ brush_set_spikes_invoker (Gimp *gimp, if (success) { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush)) - gimp_brush_generated_set_spikes (GIMP_BRUSH_GENERATED (brush), spikes_in); + { + gimp_brush_generated_set_spikes (GIMP_BRUSH_GENERATED (brush), + spikes_in); + spikes_out = GIMP_BRUSH_GENERATED (brush)->spikes; + } else success = FALSE; } @@ -1457,7 +1514,7 @@ brush_set_spikes_invoker (Gimp *gimp, return_args = procedural_db_return_args (&brush_set_spikes_proc, success); if (success) - return_args[1].value.pdb_int = GIMP_BRUSH_GENERATED (brush)->spikes; + return_args[1].value.pdb_int = spikes_out; return return_args; } @@ -1513,7 +1570,7 @@ brush_set_hardness_invoker (Gimp *gimp, Argument *return_args; gchar *name; gdouble hardness_in; - GimpBrush *brush = NULL; + gdouble hardness_out = 0; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -1523,11 +1580,15 @@ brush_set_hardness_invoker (Gimp *gimp, if (success) { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush)) - gimp_brush_generated_set_hardness (GIMP_BRUSH_GENERATED (brush), hardness_in); + { + gimp_brush_generated_set_hardness (GIMP_BRUSH_GENERATED (brush), + hardness_in); + hardness_out = GIMP_BRUSH_GENERATED (brush)->hardness; + } else success = FALSE; } @@ -1535,7 +1596,7 @@ brush_set_hardness_invoker (Gimp *gimp, return_args = procedural_db_return_args (&brush_set_hardness_proc, success); if (success) - return_args[1].value.pdb_float = GIMP_BRUSH_GENERATED (brush)->hardness; + return_args[1].value.pdb_float = hardness_out; return return_args; } @@ -1591,7 +1652,7 @@ brush_set_aspect_ratio_invoker (Gimp *gimp, Argument *return_args; gchar *name; gdouble aspect_ratio_in; - GimpBrush *brush = NULL; + gdouble aspect_ratio_out = 0; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -1601,11 +1662,15 @@ brush_set_aspect_ratio_invoker (Gimp *gimp, if (success) { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush)) - gimp_brush_generated_set_aspect_ratio (GIMP_BRUSH_GENERATED (brush), aspect_ratio_in); + { + 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; } @@ -1613,7 +1678,7 @@ brush_set_aspect_ratio_invoker (Gimp *gimp, return_args = procedural_db_return_args (&brush_set_aspect_ratio_proc, success); if (success) - return_args[1].value.pdb_float = GIMP_BRUSH_GENERATED (brush)->aspect_ratio; + return_args[1].value.pdb_float = aspect_ratio_out; return return_args; } @@ -1669,7 +1734,7 @@ brush_set_angle_invoker (Gimp *gimp, Argument *return_args; gchar *name; gdouble angle_in; - GimpBrush *brush = NULL; + gdouble angle_out = 0; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -1679,11 +1744,15 @@ brush_set_angle_invoker (Gimp *gimp, if (success) { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush)) - gimp_brush_generated_set_angle (GIMP_BRUSH_GENERATED (brush), angle_in); + { + gimp_brush_generated_set_angle (GIMP_BRUSH_GENERATED (brush), + angle_in); + angle_out = GIMP_BRUSH_GENERATED (brush)->angle; + } else success = FALSE; } @@ -1691,7 +1760,7 @@ brush_set_angle_invoker (Gimp *gimp, return_args = procedural_db_return_args (&brush_set_angle_proc, success); if (success) - return_args[1].value.pdb_float = GIMP_BRUSH_GENERATED (brush)->angle; + return_args[1].value.pdb_float = angle_out; return return_args; } diff --git a/app/pdb/brushes_cmds.c b/app/pdb/brushes_cmds.c index 6e9000ce16..b44743bc2a 100644 --- a/app/pdb/brushes_cmds.c +++ b/app/pdb/brushes_cmds.c @@ -160,18 +160,31 @@ brushes_get_brush_invoker (Gimp *gimp, { gboolean success = TRUE; Argument *return_args; - GimpBrush *brush; + gchar *name = NULL; + gint32 width = 0; + gint32 height = 0; + gint32 spacing = 0; - success = (brush = gimp_context_get_brush (context)) != NULL; + GimpBrush *brush = gimp_context_get_brush (context); + + if (brush) + { + name = g_strdup (GIMP_OBJECT (brush)->name); + width = brush->mask->width; + height = brush->mask->height; + spacing = gimp_brush_get_spacing (brush); + } + else + success = FALSE; return_args = procedural_db_return_args (&brushes_get_brush_proc, success); if (success) { - return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (brush)->name); - return_args[2].value.pdb_int = brush->mask->width; - return_args[3].value.pdb_int = brush->mask->height; - return_args[4].value.pdb_int = gimp_brush_get_spacing (brush); + return_args[1].value.pdb_pointer = name; + return_args[2].value.pdb_int = width; + return_args[3].value.pdb_int = height; + return_args[4].value.pdb_int = spacing; } return return_args; @@ -225,10 +238,21 @@ brushes_get_spacing_invoker (Gimp *gimp, GimpProgress *progress, Argument *args) { + gboolean success = TRUE; Argument *return_args; + gint32 spacing = 0; - return_args = procedural_db_return_args (&brushes_get_spacing_proc, TRUE); - return_args[1].value.pdb_int = gimp_brush_get_spacing (gimp_context_get_brush (context)); + GimpBrush *brush = gimp_context_get_brush (context); + + if (brush) + spacing = gimp_brush_get_spacing (brush); + else + success = FALSE; + + return_args = procedural_db_return_args (&brushes_get_spacing_proc, success); + + if (success) + return_args[1].value.pdb_int = spacing; return return_args; } @@ -315,9 +339,14 @@ brushes_get_brush_data_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; gchar *name; + gchar *actual_name = NULL; + gdouble opacity = 0; + gint32 spacing = 0; + gint32 paint_mode = 0; + gint32 width = 0; + gint32 height = 0; gint32 length = 0; guint8 *mask_data = NULL; - GimpBrush *brush = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name && !g_utf8_validate (name, -1, NULL)) @@ -325,6 +354,8 @@ brushes_get_brush_data_invoker (Gimp *gimp, if (success) { + GimpBrush *brush; + if (name && strlen (name)) { brush = (GimpBrush *) @@ -337,8 +368,14 @@ brushes_get_brush_data_invoker (Gimp *gimp, if (brush) { - length = brush->mask->height * brush->mask->width; - mask_data = g_memdup (temp_buf_data (brush->mask), length); + actual_name = g_strdup (GIMP_OBJECT (brush)->name); + opacity = 1.0; + spacing = gimp_brush_get_spacing (brush); + paint_mode = 0; + width = brush->mask->width; + height = brush->mask->height; + length = brush->mask->height * brush->mask->width; + mask_data = g_memdup (temp_buf_data (brush->mask), length); } else success = FALSE; @@ -348,12 +385,12 @@ brushes_get_brush_data_invoker (Gimp *gimp, if (success) { - return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (brush)->name); - return_args[2].value.pdb_float = 1.0; - return_args[3].value.pdb_int = gimp_brush_get_spacing (brush); - return_args[4].value.pdb_int = 0; - return_args[5].value.pdb_int = brush->mask->width; - return_args[6].value.pdb_int = brush->mask->height; + return_args[1].value.pdb_pointer = actual_name; + return_args[2].value.pdb_float = opacity; + return_args[3].value.pdb_int = spacing; + return_args[4].value.pdb_int = paint_mode; + return_args[5].value.pdb_int = width; + return_args[6].value.pdb_int = height; return_args[7].value.pdb_int = length; return_args[8].value.pdb_pointer = mask_data; } @@ -374,7 +411,7 @@ static ProcArg brushes_get_brush_data_outargs[] = { { GIMP_PDB_STRING, - "name", + "actual-name", "The brush name" }, { diff --git a/app/pdb/context_cmds.c b/app/pdb/context_cmds.c index fe9e7ee258..fef8a2d9b2 100644 --- a/app/pdb/context_cmds.c +++ b/app/pdb/context_cmds.c @@ -97,13 +97,9 @@ context_push_invoker (Gimp *gimp, { gboolean success = TRUE; if (gimp->current_plug_in && gimp->current_plug_in->open) - { - success = plug_in_context_push (gimp->current_plug_in); - } + success = plug_in_context_push (gimp->current_plug_in); else - { - success = FALSE; - } + success = FALSE; return procedural_db_return_args (&context_push_proc, success); } @@ -133,13 +129,9 @@ context_pop_invoker (Gimp *gimp, { gboolean success = TRUE; if (gimp->current_plug_in && gimp->current_plug_in->open) - { - success = plug_in_context_pop (gimp->current_plug_in); - } + success = plug_in_context_pop (gimp->current_plug_in); else - { - success = FALSE; - } + success = FALSE; return procedural_db_return_args (&context_pop_proc, success); } @@ -169,14 +161,19 @@ context_get_paint_method_invoker (Gimp *gimp, { gboolean success = TRUE; Argument *return_args; - GimpPaintInfo *paint_info; + gchar *name = NULL; - success = (paint_info = gimp_context_get_paint_info (context)) != NULL; + GimpPaintInfo *paint_info = gimp_context_get_paint_info (context); + + if (paint_info) + name = g_strdup (gimp_object_get_name (GIMP_OBJECT (paint_info))); + else + success = FALSE; return_args = procedural_db_return_args (&context_get_paint_method_proc, success); if (success) - return_args[1].value.pdb_pointer = g_strdup (gimp_object_get_name (GIMP_OBJECT (paint_info))); + return_args[1].value.pdb_pointer = name; return return_args; } @@ -216,7 +213,6 @@ context_set_paint_method_invoker (Gimp *gimp, { gboolean success = TRUE; gchar *name; - GimpPaintInfo *paint_info; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -224,7 +220,7 @@ context_set_paint_method_invoker (Gimp *gimp, if (success) { - paint_info = (GimpPaintInfo *) + GimpPaintInfo *paint_info = (GimpPaintInfo *) gimp_container_get_child_by_name (gimp->paint_info_list, name); if (paint_info) @@ -675,14 +671,19 @@ context_get_brush_invoker (Gimp *gimp, { gboolean success = TRUE; Argument *return_args; - GimpBrush *brush; + gchar *name = NULL; - success = (brush = gimp_context_get_brush (context)) != NULL; + GimpBrush *brush = gimp_context_get_brush (context); + + if (brush) + name = g_strdup (gimp_object_get_name (GIMP_OBJECT (brush))); + else + success = FALSE; return_args = procedural_db_return_args (&context_get_brush_proc, success); if (success) - return_args[1].value.pdb_pointer = g_strdup (gimp_object_get_name (GIMP_OBJECT (brush))); + return_args[1].value.pdb_pointer = name; return return_args; } @@ -722,7 +723,6 @@ context_set_brush_invoker (Gimp *gimp, { gboolean success = TRUE; gchar *name; - GimpBrush *brush; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -730,7 +730,7 @@ context_set_brush_invoker (Gimp *gimp, if (success) { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush) @@ -777,14 +777,19 @@ context_get_pattern_invoker (Gimp *gimp, { gboolean success = TRUE; Argument *return_args; - GimpPattern *pattern; + gchar *name = NULL; - success = (pattern = gimp_context_get_pattern (context)) != NULL; + GimpPattern *pattern = gimp_context_get_pattern (context); + + if (pattern) + name = g_strdup (gimp_object_get_name (GIMP_OBJECT (pattern))); + else + success = FALSE; return_args = procedural_db_return_args (&context_get_pattern_proc, success); if (success) - return_args[1].value.pdb_pointer = g_strdup (gimp_object_get_name (GIMP_OBJECT (pattern))); + return_args[1].value.pdb_pointer = name; return return_args; } @@ -824,7 +829,6 @@ context_set_pattern_invoker (Gimp *gimp, { gboolean success = TRUE; gchar *name; - GimpPattern *pattern; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -832,7 +836,7 @@ context_set_pattern_invoker (Gimp *gimp, if (success) { - pattern = (GimpPattern *) + GimpPattern *pattern = (GimpPattern *) gimp_container_get_child_by_name (gimp->pattern_factory->container, name); if (pattern) @@ -879,14 +883,19 @@ context_get_gradient_invoker (Gimp *gimp, { gboolean success = TRUE; Argument *return_args; - GimpGradient *gradient; + gchar *name = NULL; - success = (gradient = gimp_context_get_gradient (context)) != NULL; + GimpGradient *gradient = gimp_context_get_gradient (context); + + if (gradient) + name = g_strdup (gimp_object_get_name (GIMP_OBJECT (gradient))); + else + success = FALSE; return_args = procedural_db_return_args (&context_get_gradient_proc, success); if (success) - return_args[1].value.pdb_pointer = g_strdup (gimp_object_get_name (GIMP_OBJECT (gradient))); + return_args[1].value.pdb_pointer = name; return return_args; } @@ -926,7 +935,6 @@ context_set_gradient_invoker (Gimp *gimp, { gboolean success = TRUE; gchar *name; - GimpGradient *gradient; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -934,7 +942,7 @@ context_set_gradient_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -981,14 +989,19 @@ context_get_palette_invoker (Gimp *gimp, { gboolean success = TRUE; Argument *return_args; - GimpPalette *palette; + gchar *name = NULL; - success = (palette = gimp_context_get_palette (context)) != NULL; + GimpPalette *palette = gimp_context_get_palette (context); + + if (palette) + name = g_strdup (gimp_object_get_name (GIMP_OBJECT (palette))); + else + success = FALSE; return_args = procedural_db_return_args (&context_get_palette_proc, success); if (success) - return_args[1].value.pdb_pointer = g_strdup (gimp_object_get_name (GIMP_OBJECT (palette))); + return_args[1].value.pdb_pointer = name; return return_args; } @@ -1028,7 +1041,6 @@ context_set_palette_invoker (Gimp *gimp, { gboolean success = TRUE; gchar *name; - GimpPalette *palette; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -1036,7 +1048,7 @@ context_set_palette_invoker (Gimp *gimp, if (success) { - palette = (GimpPalette *) + GimpPalette *palette = (GimpPalette *) gimp_container_get_child_by_name (gimp->palette_factory->container, name); if (palette) @@ -1083,14 +1095,19 @@ context_get_font_invoker (Gimp *gimp, { gboolean success = TRUE; Argument *return_args; - GimpFont *font; + gchar *name = NULL; - success = (font = gimp_context_get_font (context)) != NULL; + GimpFont *font = gimp_context_get_font (context); + + if (font) + name = g_strdup (gimp_object_get_name (GIMP_OBJECT (font))); + else + success = FALSE; return_args = procedural_db_return_args (&context_get_font_proc, success); if (success) - return_args[1].value.pdb_pointer = g_strdup (gimp_object_get_name (GIMP_OBJECT (font))); + return_args[1].value.pdb_pointer = name; return return_args; } @@ -1130,7 +1147,6 @@ context_set_font_invoker (Gimp *gimp, { gboolean success = TRUE; gchar *name; - GimpFont *font; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -1138,7 +1154,7 @@ context_set_font_invoker (Gimp *gimp, if (success) { - font = (GimpFont *) + GimpFont *font = (GimpFont *) gimp_container_get_child_by_name (gimp->fonts, name); if (font) diff --git a/app/pdb/drawable_cmds.c b/app/pdb/drawable_cmds.c index 67701c4008..949e135161 100644 --- a/app/pdb/drawable_cmds.c +++ b/app/pdb/drawable_cmds.c @@ -1853,9 +1853,6 @@ drawable_get_pixel_invoker (Gimp *gimp, gint32 y; gint32 num_channels = 0; guint8 *pixel = NULL; - guint8 *p; - gint b; - Tile *tile; drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) @@ -1874,6 +1871,10 @@ drawable_get_pixel_invoker (Gimp *gimp, if (x < gimp_item_width (GIMP_ITEM (drawable)) && y < gimp_item_height (GIMP_ITEM (drawable))) { + Tile *tile; + guint8 *p; + gint b; + num_channels = gimp_drawable_bytes (drawable); pixel = g_new (guint8, num_channels); @@ -1967,9 +1968,6 @@ drawable_set_pixel_invoker (Gimp *gimp, gint32 y; gint32 num_channels; guint8 *pixel; - guint8 *p; - gint b; - Tile *tile; drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) @@ -1993,6 +1991,10 @@ drawable_set_pixel_invoker (Gimp *gimp, y < gimp_item_height (GIMP_ITEM (drawable)) && num_channels == gimp_drawable_bytes (drawable)) { + Tile *tile; + guint8 *p; + gint b; + tile = tile_manager_get_tile (gimp_drawable_data (drawable), x, y, TRUE, TRUE); diff --git a/app/pdb/drawable_transform_cmds.c b/app/pdb/drawable_transform_cmds.c index 114b42e007..e4c869f9d2 100644 --- a/app/pdb/drawable_transform_cmds.c +++ b/app/pdb/drawable_transform_cmds.c @@ -500,32 +500,39 @@ drawable_transform_perspective_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; GimpDrawable *drawable; + gdouble x0; + gdouble y0; + gdouble x1; + gdouble y1; + gdouble x2; + gdouble y2; + gdouble x3; + gdouble y3; gint32 transform_direction; gint32 interpolation; gboolean supersample; gint32 recursion_level; gboolean clip_result; - gdouble trans_info[8]; drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) success = FALSE; - trans_info[X0] = args[1].value.pdb_float; + x0 = args[1].value.pdb_float; - trans_info[Y0] = args[2].value.pdb_float; + y0 = args[2].value.pdb_float; - trans_info[X1] = args[3].value.pdb_float; + x1 = args[3].value.pdb_float; - trans_info[Y1] = args[4].value.pdb_float; + y1 = args[4].value.pdb_float; - trans_info[X2] = args[5].value.pdb_float; + x2 = args[5].value.pdb_float; - trans_info[Y2] = args[6].value.pdb_float; + y2 = args[6].value.pdb_float; - trans_info[X3] = args[7].value.pdb_float; + x3 = args[7].value.pdb_float; - trans_info[Y3] = args[8].value.pdb_float; + y3 = args[8].value.pdb_float; transform_direction = args[9].value.pdb_int; if (transform_direction < GIMP_TRANSFORM_FORWARD || transform_direction > GIMP_TRANSFORM_BACKWARD) @@ -558,10 +565,10 @@ drawable_transform_perspective_invoker (Gimp *gimp, gimp_matrix3_identity (&matrix); gimp_transform_matrix_perspective (&matrix, x, y, width, height, - trans_info[X0], trans_info[Y0], - trans_info[X1], trans_info[Y1], - trans_info[X2], trans_info[Y2], - trans_info[X3], trans_info[Y3]); + x0, y0, + x1, y1, + x2, y2, + x3, y3); if (progress) gimp_progress_start (progress, _("Perspective"), FALSE); @@ -696,29 +703,36 @@ drawable_transform_perspective_default_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; GimpDrawable *drawable; + gdouble x0; + gdouble y0; + gdouble x1; + gdouble y1; + gdouble x2; + gdouble y2; + gdouble x3; + gdouble y3; gboolean interpolate; gboolean clip_result; - gdouble trans_info[8]; drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) success = FALSE; - trans_info[X0] = args[1].value.pdb_float; + x0 = args[1].value.pdb_float; - trans_info[Y0] = args[2].value.pdb_float; + y0 = args[2].value.pdb_float; - trans_info[X1] = args[3].value.pdb_float; + x1 = args[3].value.pdb_float; - trans_info[Y1] = args[4].value.pdb_float; + y1 = args[4].value.pdb_float; - trans_info[X2] = args[5].value.pdb_float; + x2 = args[5].value.pdb_float; - trans_info[Y2] = args[6].value.pdb_float; + y2 = args[6].value.pdb_float; - trans_info[X3] = args[7].value.pdb_float; + x3 = args[7].value.pdb_float; - trans_info[Y3] = args[8].value.pdb_float; + y3 = args[8].value.pdb_float; interpolate = args[9].value.pdb_int ? TRUE : FALSE; @@ -740,10 +754,10 @@ drawable_transform_perspective_default_invoker (Gimp *gimp, gimp_matrix3_identity (&matrix); gimp_transform_matrix_perspective (&matrix, x, y, width, height, - trans_info[X0], trans_info[Y0], - trans_info[X1], trans_info[Y1], - trans_info[X2], trans_info[Y2], - trans_info[X3], trans_info[Y3]); + x0, y0, + x1, y1, + x2, y2, + x3, y3); if (interpolate) interpolation_type = gimp->config->interpolation_type; @@ -1296,24 +1310,27 @@ drawable_transform_scale_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; GimpDrawable *drawable; + gdouble x0; + gdouble y0; + gdouble x1; + gdouble y1; gint32 transform_direction; gint32 interpolation; gboolean supersample; gint32 recursion_level; gboolean clip_result; - gdouble trans_info[4]; drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) success = FALSE; - trans_info[X0] = args[1].value.pdb_float; + x0 = args[1].value.pdb_float; - trans_info[Y0] = args[2].value.pdb_float; + y0 = args[2].value.pdb_float; - trans_info[X1] = args[3].value.pdb_float; + x1 = args[3].value.pdb_float; - trans_info[Y1] = args[4].value.pdb_float; + y1 = args[4].value.pdb_float; transform_direction = args[5].value.pdb_int; if (transform_direction < GIMP_TRANSFORM_FORWARD || transform_direction > GIMP_TRANSFORM_BACKWARD) @@ -1335,9 +1352,7 @@ drawable_transform_scale_invoker (Gimp *gimp, { gint x, y, width, height; - success = (gimp_item_is_attached (GIMP_ITEM (drawable)) && - trans_info[X0] < trans_info[X1] && - trans_info[Y0] < trans_info[Y1]); + success = (gimp_item_is_attached (GIMP_ITEM (drawable)) && x0 < x1 && y0 < y1); if (success && gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) @@ -1348,10 +1363,9 @@ drawable_transform_scale_invoker (Gimp *gimp, gimp_matrix3_identity (&matrix); gimp_transform_matrix_scale (&matrix, x, y, width, height, - trans_info[X0], - trans_info[Y0], - trans_info[X1] - trans_info[X0], - trans_info[Y1] - trans_info[Y0]); + x0, y0, + x1 - x0, + y1 - y0); if (progress) gimp_progress_start (progress, _("Scaling"), FALSE); @@ -1466,21 +1480,24 @@ drawable_transform_scale_default_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; GimpDrawable *drawable; + gdouble x0; + gdouble y0; + gdouble x1; + gdouble y1; gboolean interpolate; gboolean clip_result; - gdouble trans_info[4]; drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) success = FALSE; - trans_info[X0] = args[1].value.pdb_float; + x0 = args[1].value.pdb_float; - trans_info[Y0] = args[2].value.pdb_float; + y0 = args[2].value.pdb_float; - trans_info[X1] = args[3].value.pdb_float; + x1 = args[3].value.pdb_float; - trans_info[Y1] = args[4].value.pdb_float; + y1 = args[4].value.pdb_float; interpolate = args[5].value.pdb_int ? TRUE : FALSE; @@ -1490,9 +1507,7 @@ drawable_transform_scale_default_invoker (Gimp *gimp, { gint x, y, width, height; - success = (gimp_item_is_attached (GIMP_ITEM (drawable)) && - trans_info[X0] < trans_info[X1] && - trans_info[Y0] < trans_info[Y1]); + success = (gimp_item_is_attached (GIMP_ITEM (drawable)) && x0 < x1 && y0 < y1); if (success && gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) @@ -1504,10 +1519,9 @@ drawable_transform_scale_default_invoker (Gimp *gimp, gimp_matrix3_identity (&matrix); gimp_transform_matrix_scale (&matrix, x, y, width, height, - trans_info[X0], - trans_info[Y0], - trans_info[X1] - trans_info[X0], - trans_info[Y1] - trans_info[Y0]); + x0, y0, + x1 - x0, + y1 - y0); if (interpolate) interpolation_type = gimp->config->interpolation_type; diff --git a/app/pdb/gradient_cmds.c b/app/pdb/gradient_cmds.c index 50a4c58dd2..d1033535a4 100644 --- a/app/pdb/gradient_cmds.c +++ b/app/pdb/gradient_cmds.c @@ -111,7 +111,7 @@ gradient_new_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; gchar *name; - GimpData *data = NULL; + gchar *actual_name = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -120,15 +120,22 @@ gradient_new_invoker (Gimp *gimp, if (success) { if (strlen (name)) - data = gimp_data_factory_data_new (gimp->gradient_factory, name); + { + GimpData *data = gimp_data_factory_data_new (gimp->gradient_factory, name); - success = (data != NULL); + if (data) + actual_name = g_strdup (GIMP_OBJECT (data)->name); + else + success = FALSE; + } + else + success = FALSE; } return_args = procedural_db_return_args (&gradient_new_proc, success); if (success) - return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (data)->name); + return_args[1].value.pdb_pointer = actual_name; return return_args; } @@ -146,7 +153,7 @@ static ProcArg gradient_new_outargs[] = { { GIMP_PDB_STRING, - "name", + "actual-name", "The actual new gradient name" } }; @@ -178,8 +185,7 @@ gradient_duplicate_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; gchar *name; - GimpGradient *gradient = NULL; - GimpGradient *gradient_copy = NULL; + gchar *copy_name = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -187,16 +193,19 @@ gradient_duplicate_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) { - gradient_copy = (GimpGradient *) + GimpGradient *gradient_copy = (GimpGradient *) gimp_data_factory_data_duplicate (gimp->gradient_factory, GIMP_DATA (gradient)); - success = (gradient_copy != NULL); + if (gradient_copy) + copy_name = g_strdup (GIMP_OBJECT (gradient_copy)->name); + else + success = FALSE; } else success = FALSE; @@ -205,7 +214,7 @@ gradient_duplicate_invoker (Gimp *gimp, return_args = procedural_db_return_args (&gradient_duplicate_proc, success); if (success) - return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (gradient_copy)->name); + return_args[1].value.pdb_pointer = copy_name; return return_args; } @@ -223,7 +232,7 @@ static ProcArg gradient_duplicate_outargs[] = { { GIMP_PDB_STRING, - "name", + "copy-name", "The name of the gradient's copy" } }; @@ -255,7 +264,7 @@ gradient_is_editable_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; gchar *name; - GimpGradient *gradient = NULL; + gboolean editable = FALSE; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -263,11 +272,11 @@ gradient_is_editable_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) - success = TRUE; + editable = GIMP_DATA (gradient)->writable; else success = FALSE; } @@ -275,7 +284,7 @@ gradient_is_editable_invoker (Gimp *gimp, return_args = procedural_db_return_args (&gradient_is_editable_proc, success); if (success) - return_args[1].value.pdb_int = GIMP_DATA (gradient)->writable; + return_args[1].value.pdb_int = editable; return return_args; } @@ -326,7 +335,7 @@ gradient_rename_invoker (Gimp *gimp, Argument *return_args; gchar *name; gchar *new_name; - GimpGradient *gradient = NULL; + gchar *actual_name = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -338,11 +347,14 @@ gradient_rename_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient && GIMP_DATA (gradient)->writable) - gimp_object_set_name (GIMP_OBJECT (gradient), new_name); + { + gimp_object_set_name (GIMP_OBJECT (gradient), new_name); + actual_name = g_strdup (GIMP_OBJECT (gradient)->name); + } else success = FALSE; } @@ -350,7 +362,7 @@ gradient_rename_invoker (Gimp *gimp, return_args = procedural_db_return_args (&gradient_rename_proc, success); if (success) - return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (gradient)->name); + return_args[1].value.pdb_pointer = actual_name; return return_args; } @@ -373,7 +385,7 @@ static ProcArg gradient_rename_outargs[] = { { GIMP_PDB_STRING, - "name", + "actual-name", "The actual new name of the gradient" } }; @@ -404,7 +416,6 @@ gradient_delete_invoker (Gimp *gimp, { gboolean success = TRUE; gchar *name; - GimpGradient *gradient = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -412,7 +423,7 @@ gradient_delete_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient && GIMP_DATA (gradient)->deletable) @@ -476,7 +487,6 @@ gradient_get_uniform_samples_invoker (Gimp *gimp, gboolean reverse; gint32 num_color_samples = 0; gdouble *color_samples = NULL; - GimpGradient *gradient; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -490,7 +500,7 @@ gradient_get_uniform_samples_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -598,7 +608,6 @@ gradient_get_custom_samples_invoker (Gimp *gimp, gboolean reverse; gint32 num_color_samples = 0; gdouble *color_samples = NULL; - GimpGradient *gradient; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -614,7 +623,7 @@ gradient_get_custom_samples_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -723,7 +732,6 @@ gradient_segment_get_left_color_invoker (Gimp *gimp, gint32 segment; GimpRGB color; gdouble opacity = 0; - GimpGradient *gradient = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -735,7 +743,7 @@ gradient_segment_get_left_color_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -824,7 +832,6 @@ gradient_segment_set_left_color_invoker (Gimp *gimp, gint32 segment; GimpRGB color; gdouble opacity; - GimpGradient *gradient = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -842,7 +849,7 @@ gradient_segment_set_left_color_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -920,7 +927,6 @@ gradient_segment_get_right_color_invoker (Gimp *gimp, gint32 segment; GimpRGB color; gdouble opacity = 0; - GimpGradient *gradient = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -932,7 +938,7 @@ gradient_segment_get_right_color_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -1021,7 +1027,6 @@ gradient_segment_set_right_color_invoker (Gimp *gimp, gint32 segment; GimpRGB color; gdouble opacity; - GimpGradient *gradient = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -1039,7 +1044,7 @@ gradient_segment_set_right_color_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -1116,7 +1121,6 @@ gradient_segment_get_left_pos_invoker (Gimp *gimp, gchar *name; gint32 segment; gdouble pos = 0; - GimpGradient *gradient = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -1128,7 +1132,7 @@ gradient_segment_get_left_pos_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -1209,7 +1213,6 @@ gradient_segment_set_left_pos_invoker (Gimp *gimp, gint32 segment; gdouble pos; gdouble final_pos = 0; - GimpGradient *gradient = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -1225,7 +1228,7 @@ gradient_segment_set_left_pos_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -1311,7 +1314,6 @@ gradient_segment_get_middle_pos_invoker (Gimp *gimp, gchar *name; gint32 segment; gdouble pos = 0; - GimpGradient *gradient = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -1323,7 +1325,7 @@ gradient_segment_get_middle_pos_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -1404,7 +1406,6 @@ gradient_segment_set_middle_pos_invoker (Gimp *gimp, gint32 segment; gdouble pos; gdouble final_pos = 0; - GimpGradient *gradient = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -1420,7 +1421,7 @@ gradient_segment_set_middle_pos_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -1506,7 +1507,6 @@ gradient_segment_get_right_pos_invoker (Gimp *gimp, gchar *name; gint32 segment; gdouble pos = 0; - GimpGradient *gradient = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -1518,7 +1518,7 @@ gradient_segment_get_right_pos_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -1599,7 +1599,6 @@ gradient_segment_set_right_pos_invoker (Gimp *gimp, gint32 segment; gdouble pos; gdouble final_pos = 0; - GimpGradient *gradient = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -1615,7 +1614,7 @@ gradient_segment_set_right_pos_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -1701,7 +1700,6 @@ gradient_segment_get_blending_function_invoker (Gimp *gimp, gchar *name; gint32 segment; gint32 blend_func = 0; - GimpGradient *gradient = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -1713,7 +1711,7 @@ gradient_segment_get_blending_function_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -1794,7 +1792,6 @@ gradient_segment_get_coloring_type_invoker (Gimp *gimp, gchar *name; gint32 segment; gint32 coloring_type = 0; - GimpGradient *gradient = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -1806,7 +1803,7 @@ gradient_segment_get_coloring_type_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -1887,7 +1884,6 @@ gradient_segment_range_set_blending_function_invoker (Gimp *gimp, gint32 start_segment; gint32 end_segment; gint32 blending_function; - GimpGradient *gradient = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -1905,7 +1901,7 @@ gradient_segment_range_set_blending_function_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -2004,7 +2000,6 @@ gradient_segment_range_set_coloring_type_invoker (Gimp *gimp, gint32 start_segment; gint32 end_segment; gint32 coloring_type; - GimpGradient *gradient = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -2022,7 +2017,7 @@ gradient_segment_range_set_coloring_type_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -2120,7 +2115,6 @@ gradient_segment_range_flip_invoker (Gimp *gimp, gchar *name; gint32 start_segment; gint32 end_segment; - GimpGradient *gradient = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -2134,7 +2128,7 @@ gradient_segment_range_flip_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -2228,7 +2222,6 @@ gradient_segment_range_replicate_invoker (Gimp *gimp, gint32 start_segment; gint32 end_segment; gint32 replicate_times; - GimpGradient *gradient = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -2246,7 +2239,7 @@ gradient_segment_range_replicate_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -2345,7 +2338,6 @@ gradient_segment_range_split_midpoint_invoker (Gimp *gimp, gchar *name; gint32 start_segment; gint32 end_segment; - GimpGradient *gradient = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -2359,7 +2351,7 @@ gradient_segment_range_split_midpoint_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -2453,7 +2445,6 @@ gradient_segment_range_split_uniform_invoker (Gimp *gimp, gint32 start_segment; gint32 end_segment; gint32 split_parts; - GimpGradient *gradient = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -2471,7 +2462,7 @@ gradient_segment_range_split_uniform_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -2570,7 +2561,6 @@ gradient_segment_range_delete_invoker (Gimp *gimp, gchar *name; gint32 start_segment; gint32 end_segment; - GimpGradient *gradient = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -2584,7 +2574,7 @@ gradient_segment_range_delete_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -2677,7 +2667,6 @@ gradient_segment_range_redistribute_handles_invoker (Gimp *gimp, gchar *name; gint32 start_segment; gint32 end_segment; - GimpGradient *gradient = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -2691,7 +2680,7 @@ gradient_segment_range_redistribute_handles_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -2783,7 +2772,6 @@ gradient_segment_range_blend_colors_invoker (Gimp *gimp, gchar *name; gint32 start_segment; gint32 end_segment; - GimpGradient *gradient = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -2797,7 +2785,7 @@ gradient_segment_range_blend_colors_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -2891,7 +2879,6 @@ gradient_segment_range_blend_opacity_invoker (Gimp *gimp, gchar *name; gint32 start_segment; gint32 end_segment; - GimpGradient *gradient = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -2905,7 +2892,7 @@ gradient_segment_range_blend_opacity_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -3003,7 +2990,6 @@ gradient_segment_range_move_invoker (Gimp *gimp, gdouble delta; gboolean control_compress; gdouble final_delta = 0; - GimpGradient *gradient = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -3023,7 +3009,7 @@ gradient_segment_range_move_invoker (Gimp *gimp, if (success) { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) diff --git a/app/pdb/gradients_cmds.c b/app/pdb/gradients_cmds.c index ee8f39f5eb..c774c77e75 100644 --- a/app/pdb/gradients_cmds.c +++ b/app/pdb/gradients_cmds.c @@ -376,8 +376,9 @@ gradients_get_gradient_data_invoker (Gimp *gimp, gchar *name; gint32 sample_size; gboolean reverse; + gchar *actual_name = NULL; + gint32 width = 0; gdouble *values = NULL; - GimpGradient *gradient = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name && !g_utf8_validate (name, -1, NULL)) @@ -391,6 +392,8 @@ gradients_get_gradient_data_invoker (Gimp *gimp, if (success) { + GimpGradient *gradient; + if (name && strlen (name)) { gradient = (GimpGradient *) @@ -408,15 +411,17 @@ gradients_get_gradient_data_invoker (Gimp *gimp, gdouble *pv; gdouble pos, delta; GimpRGB color; - gint i; - i = sample_size; pos = 0.0; - delta = 1.0 / (i - 1); + delta = 1.0 / (sample_size - 1); - pv = values = g_new (gdouble, i * 4); + actual_name = g_strdup (GIMP_OBJECT (gradient)->name); + values = g_new (gdouble, sample_size * 4); + width = sample_size * 4; - while (i--) + pv = values; + + while (sample_size) { seg = gimp_gradient_get_color_at (gradient, seg, pos, reverse, &color); @@ -436,8 +441,8 @@ gradients_get_gradient_data_invoker (Gimp *gimp, if (success) { - return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (gradient)->name); - return_args[2].value.pdb_int = sample_size * 4; + return_args[1].value.pdb_pointer = actual_name; + return_args[2].value.pdb_int = width; return_args[3].value.pdb_pointer = values; } @@ -467,7 +472,7 @@ static ProcArg gradients_get_gradient_data_outargs[] = { { GIMP_PDB_STRING, - "name", + "actual-name", "The gradient name" }, { diff --git a/app/pdb/image_cmds.c b/app/pdb/image_cmds.c index b44ea036d1..47813f2d7a 100644 --- a/app/pdb/image_cmds.c +++ b/app/pdb/image_cmds.c @@ -4378,7 +4378,6 @@ image_get_name_invoker (Gimp *gimp, Argument *return_args; GimpImage *gimage; gchar *name = NULL; - gchar *filename; gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int); if (! GIMP_IS_IMAGE (gimage)) @@ -4386,7 +4385,7 @@ image_get_name_invoker (Gimp *gimp, if (success) { - filename = gimp_image_get_filename (gimage); + gchar *filename = gimp_image_get_filename (gimage); if (filename) name = g_filename_display_basename (filename); diff --git a/app/pdb/palette_cmds.c b/app/pdb/palette_cmds.c index 018d0d53b6..4802782e33 100644 --- a/app/pdb/palette_cmds.c +++ b/app/pdb/palette_cmds.c @@ -78,7 +78,7 @@ palette_new_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; gchar *name; - GimpData *data = NULL; + gchar *actual_name = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -87,15 +87,22 @@ palette_new_invoker (Gimp *gimp, if (success) { if (strlen (name)) - data = gimp_data_factory_data_new (gimp->palette_factory, name); + { + GimpData *data = gimp_data_factory_data_new (gimp->palette_factory, name); - success = (data != NULL); + if (data) + actual_name = g_strdup (GIMP_OBJECT (data)->name); + else + success = FALSE; + } + else + success = FALSE; } return_args = procedural_db_return_args (&palette_new_proc, success); if (success) - return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (data)->name); + return_args[1].value.pdb_pointer = actual_name; return return_args; } @@ -113,7 +120,7 @@ static ProcArg palette_new_outargs[] = { { GIMP_PDB_STRING, - "name", + "actual-name", "The actual new palette name" } }; @@ -145,7 +152,7 @@ palette_duplicate_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; gchar *name; - GimpPalette *palette_copy = NULL; + gchar *copy_name = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -158,11 +165,14 @@ palette_duplicate_invoker (Gimp *gimp, if (palette) { - palette_copy = (GimpPalette *) + GimpPalette *palette_copy = (GimpPalette *) gimp_data_factory_data_duplicate (gimp->palette_factory, GIMP_DATA (palette)); - success = (palette_copy != NULL); + if (palette_copy) + copy_name = g_strdup (GIMP_OBJECT (palette_copy)->name); + else + success = FALSE; } else success = FALSE; @@ -171,7 +181,7 @@ palette_duplicate_invoker (Gimp *gimp, return_args = procedural_db_return_args (&palette_duplicate_proc, success); if (success) - return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (palette_copy)->name); + return_args[1].value.pdb_pointer = copy_name; return return_args; } @@ -189,7 +199,7 @@ static ProcArg palette_duplicate_outargs[] = { { GIMP_PDB_STRING, - "name", + "copy-name", "The name of the palette's copy" } }; @@ -222,7 +232,7 @@ palette_rename_invoker (Gimp *gimp, Argument *return_args; gchar *name; gchar *new_name; - GimpPalette *palette = NULL; + gchar *actual_name = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -234,11 +244,14 @@ palette_rename_invoker (Gimp *gimp, if (success) { - palette = (GimpPalette *) + GimpPalette *palette = (GimpPalette *) gimp_container_get_child_by_name (gimp->palette_factory->container, name); if (palette && GIMP_DATA (palette)->writable) - gimp_object_set_name (GIMP_OBJECT (palette), new_name); + { + gimp_object_set_name (GIMP_OBJECT (palette), new_name); + actual_name = g_strdup (GIMP_OBJECT (palette)->name); + } else success = FALSE; } @@ -246,7 +259,7 @@ palette_rename_invoker (Gimp *gimp, return_args = procedural_db_return_args (&palette_rename_proc, success); if (success) - return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (palette)->name); + return_args[1].value.pdb_pointer = actual_name; return return_args; } @@ -269,7 +282,7 @@ static ProcArg palette_rename_outargs[] = { { GIMP_PDB_STRING, - "name", + "actual-name", "The actual new name of the palette" } }; @@ -367,7 +380,7 @@ palette_is_editable_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; gchar *name; - GimpPalette *palette = NULL; + gboolean editable = FALSE; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -375,11 +388,11 @@ palette_is_editable_invoker (Gimp *gimp, if (success) { - palette = (GimpPalette *) + GimpPalette *palette = (GimpPalette *) gimp_container_get_child_by_name (gimp->palette_factory->container, name); if (palette) - success = TRUE; + editable = GIMP_DATA (palette)->writable; else success = FALSE; } @@ -387,7 +400,7 @@ palette_is_editable_invoker (Gimp *gimp, return_args = procedural_db_return_args (&palette_is_editable_proc, success); if (success) - return_args[1].value.pdb_int = GIMP_DATA (palette)->writable; + return_args[1].value.pdb_int = editable; return return_args; } @@ -437,7 +450,7 @@ palette_get_info_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; gchar *name; - GimpPalette *palette = NULL; + gint32 num_colors = 0; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -445,16 +458,19 @@ palette_get_info_invoker (Gimp *gimp, if (success) { - palette = (GimpPalette *) + GimpPalette *palette = (GimpPalette *) gimp_container_get_child_by_name (gimp->palette_factory->container, name); - success = (palette != NULL); + if (palette) + num_colors = palette->n_colors; + else + success = FALSE; } return_args = procedural_db_return_args (&palette_get_info_proc, success); if (success) - return_args[1].value.pdb_int = palette->n_colors; + return_args[1].value.pdb_int = num_colors; return return_args; } @@ -504,7 +520,7 @@ palette_get_columns_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; gchar *name; - GimpPalette *palette = NULL; + gint32 num_columns = 0; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -512,16 +528,19 @@ palette_get_columns_invoker (Gimp *gimp, if (success) { - palette = (GimpPalette *) + GimpPalette *palette = (GimpPalette *) gimp_container_get_child_by_name (gimp->palette_factory->container, name); - success = (palette != NULL); + if (palette) + num_columns = palette->n_columns; + else + success = FALSE; } return_args = procedural_db_return_args (&palette_get_columns_proc, success); if (success) - return_args[1].value.pdb_int = palette->n_columns; + return_args[1].value.pdb_int = num_columns; return return_args; } @@ -637,7 +656,7 @@ palette_add_entry_invoker (Gimp *gimp, gchar *name; gchar *entry_name; GimpRGB color; - GimpPaletteEntry *entry = NULL; + gint32 entry_num = 0; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -655,7 +674,12 @@ palette_add_entry_invoker (Gimp *gimp, gimp_container_get_child_by_name (gimp->palette_factory->container, name); if (palette && GIMP_DATA (palette)->writable) - entry = gimp_palette_add_entry (palette, -1, entry_name, &color); + { + GimpPaletteEntry *entry = + gimp_palette_add_entry (palette, -1, entry_name, &color); + + entry_num = entry->position; + } else success = FALSE; } @@ -663,7 +687,7 @@ palette_add_entry_invoker (Gimp *gimp, return_args = procedural_db_return_args (&palette_add_entry_proc, success); if (success) - return_args[1].value.pdb_int = entry->position; + return_args[1].value.pdb_int = entry_num; return return_args; } @@ -963,7 +987,7 @@ palette_entry_get_name_invoker (Gimp *gimp, Argument *return_args; gchar *name; gint32 entry_num; - GimpPaletteEntry *entry = NULL; + gchar *entry_name = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -979,7 +1003,11 @@ palette_entry_get_name_invoker (Gimp *gimp, if (palette) { if (entry_num >= 0 && entry_num < palette->n_colors) - entry = g_list_nth_data (palette->colors, entry_num); + { + GimpPaletteEntry *entry = g_list_nth_data (palette->colors, entry_num); + + entry_name = g_strdup (entry->name); + } else success = FALSE; } @@ -990,7 +1018,7 @@ palette_entry_get_name_invoker (Gimp *gimp, return_args = procedural_db_return_args (&palette_entry_get_name_proc, success); if (success) - return_args[1].value.pdb_pointer = g_strdup (entry->name); + return_args[1].value.pdb_pointer = entry_name; return return_args; } diff --git a/app/pdb/palettes_cmds.c b/app/pdb/palettes_cmds.c index 9e968eba30..fc51af76ef 100644 --- a/app/pdb/palettes_cmds.c +++ b/app/pdb/palettes_cmds.c @@ -157,16 +157,25 @@ palettes_get_palette_invoker (Gimp *gimp, { gboolean success = TRUE; Argument *return_args; - GimpPalette *palette; + gchar *name = NULL; + gint32 num_colors = 0; - success = (palette = gimp_context_get_palette (context)) != NULL; + GimpPalette *palette = gimp_context_get_palette (context); + + if (palette) + { + name = g_strdup (GIMP_OBJECT (palette)->name); + num_colors = palette->n_colors; + } + else + success = FALSE; return_args = procedural_db_return_args (&palettes_get_palette_proc, success); if (success) { - return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (palette)->name); - return_args[2].value.pdb_int = palette->n_colors; + return_args[1].value.pdb_pointer = name; + return_args[2].value.pdb_int = num_colors; } return return_args; @@ -214,8 +223,9 @@ palettes_get_palette_entry_invoker (Gimp *gimp, Argument *return_args; gchar *name; gint32 entry_num; + gchar *actual_name = NULL; + gint32 num_colors = 0; GimpRGB color; - GimpPalette *palette = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name && !g_utf8_validate (name, -1, NULL)) @@ -225,6 +235,8 @@ palettes_get_palette_entry_invoker (Gimp *gimp, if (success) { + GimpPalette *palette; + if (name && strlen (name)) { palette = (GimpPalette *) @@ -238,19 +250,16 @@ palettes_get_palette_entry_invoker (Gimp *gimp, if (palette) { - if (entry_num < 0 || entry_num >= palette->n_colors) + if (entry_num >= 0 && entry_num < palette->n_colors) { - success = FALSE; + GimpPaletteEntry *entry = g_list_nth_data (palette->colors, entry_num); + + actual_name = g_strdup (GIMP_OBJECT (palette)->name); + num_colors = palette->n_colors; + color = entry->color; } else - { - GimpPaletteEntry *entry; - - entry = (GimpPaletteEntry *) - g_list_nth_data (palette->colors, entry_num); - - color = entry->color; - } + success = FALSE; } else success = FALSE; @@ -260,8 +269,8 @@ palettes_get_palette_entry_invoker (Gimp *gimp, if (success) { - return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (palette)->name); - return_args[2].value.pdb_int = palette->n_colors; + return_args[1].value.pdb_pointer = actual_name; + return_args[2].value.pdb_int = num_colors; return_args[3].value.pdb_color = color; } @@ -286,7 +295,7 @@ static ProcArg palettes_get_palette_entry_outargs[] = { { GIMP_PDB_STRING, - "name", + "actual-name", "The palette name" }, { diff --git a/app/pdb/paths_cmds.c b/app/pdb/paths_cmds.c index 8d3f1a9c00..95eeceb1c7 100644 --- a/app/pdb/paths_cmds.c +++ b/app/pdb/paths_cmds.c @@ -361,7 +361,6 @@ path_get_points_invoker (Gimp *gimp, gint32 path_closed = 0; gint32 num_point_details = 0; gdouble *points_pairs = NULL; - GimpVectors *vectors; gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int); if (! GIMP_IS_IMAGE (gimage)) @@ -373,7 +372,7 @@ path_get_points_invoker (Gimp *gimp, if (success) { - vectors = gimp_image_get_vectors_by_name (gimage, name); + GimpVectors *vectors = gimp_image_get_vectors_by_name (gimage, name); if (vectors) { diff --git a/app/pdb/pattern_cmds.c b/app/pdb/pattern_cmds.c index 2181a2bd0c..8fe316c25a 100644 --- a/app/pdb/pattern_cmds.c +++ b/app/pdb/pattern_cmds.c @@ -53,7 +53,9 @@ pattern_get_info_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; gchar *name; - GimpPattern *pattern = NULL; + gint32 width = 0; + gint32 height = 0; + gint32 bpp = 0; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -61,19 +63,26 @@ pattern_get_info_invoker (Gimp *gimp, if (success) { - pattern = (GimpPattern *) + GimpPattern *pattern = (GimpPattern *) gimp_container_get_child_by_name (gimp->pattern_factory->container, name); - success = (pattern != NULL); + if (pattern) + { + width = pattern->mask->width; + height = pattern->mask->height; + bpp = pattern->mask->bytes; + } + else + success = FALSE; } return_args = procedural_db_return_args (&pattern_get_info_proc, success); if (success) { - return_args[1].value.pdb_int = pattern->mask->width; - return_args[2].value.pdb_int = pattern->mask->height; - return_args[3].value.pdb_int = pattern->mask->bytes; + return_args[1].value.pdb_int = width; + return_args[2].value.pdb_int = height; + return_args[3].value.pdb_int = bpp; } return return_args; @@ -134,9 +143,11 @@ pattern_get_pixels_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; gchar *name; + gint32 width = 0; + gint32 height = 0; + gint32 bpp = 0; gint32 num_color_bytes = 0; guint8 *color_bytes = NULL; - GimpPattern *pattern = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL || !g_utf8_validate (name, -1, NULL)) @@ -144,11 +155,14 @@ pattern_get_pixels_invoker (Gimp *gimp, if (success) { - pattern = (GimpPattern *) + GimpPattern *pattern = (GimpPattern *) gimp_container_get_child_by_name (gimp->pattern_factory->container, name); if (pattern) { + width = pattern->mask->width; + height = pattern->mask->height; + bpp = pattern->mask->bytes; num_color_bytes = pattern->mask->height * pattern->mask->width * pattern->mask->bytes; color_bytes = g_memdup (temp_buf_data (pattern->mask), @@ -162,9 +176,9 @@ pattern_get_pixels_invoker (Gimp *gimp, if (success) { - return_args[1].value.pdb_int = pattern->mask->width; - return_args[2].value.pdb_int = pattern->mask->height; - return_args[3].value.pdb_int = pattern->mask->bytes; + return_args[1].value.pdb_int = width; + return_args[2].value.pdb_int = height; + return_args[3].value.pdb_int = bpp; return_args[4].value.pdb_int = num_color_bytes; return_args[5].value.pdb_pointer = color_bytes; } diff --git a/app/pdb/patterns_cmds.c b/app/pdb/patterns_cmds.c index 4bc194661d..3695032113 100644 --- a/app/pdb/patterns_cmds.c +++ b/app/pdb/patterns_cmds.c @@ -156,17 +156,28 @@ patterns_get_pattern_invoker (Gimp *gimp, { gboolean success = TRUE; Argument *return_args; - GimpPattern *pattern; + gchar *name = NULL; + gint32 width = 0; + gint32 height = 0; - success = (pattern = gimp_context_get_pattern (context)) != NULL; + GimpPattern *pattern = gimp_context_get_pattern (context); + + if (pattern) + { + name = g_strdup (GIMP_OBJECT (pattern)->name); + width = pattern->mask->width; + height = pattern->mask->height; + } + else + success = FALSE; return_args = procedural_db_return_args (&patterns_get_pattern_proc, success); if (success) { - return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (pattern)->name); - return_args[2].value.pdb_int = pattern->mask->width; - return_args[3].value.pdb_int = pattern->mask->height; + return_args[1].value.pdb_pointer = name; + return_args[2].value.pdb_int = width; + return_args[3].value.pdb_int = height; } return return_args; @@ -218,9 +229,12 @@ patterns_get_pattern_data_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; gchar *name; + gchar *actual_name = NULL; + gint32 width = 0; + gint32 height = 0; + gint32 mask_bpp = 0; gint32 length = 0; guint8 *mask_data = NULL; - GimpPattern *pattern = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name && !g_utf8_validate (name, -1, NULL)) @@ -228,6 +242,8 @@ patterns_get_pattern_data_invoker (Gimp *gimp, if (success) { + GimpPattern *pattern; + if (name && strlen (name)) { pattern = (GimpPattern *) @@ -241,9 +257,13 @@ patterns_get_pattern_data_invoker (Gimp *gimp, if (pattern) { - length = pattern->mask->height * pattern->mask->width * - pattern->mask->bytes; - mask_data = g_memdup (temp_buf_data (pattern->mask), length); + actual_name = g_strdup (GIMP_OBJECT (pattern)->name); + width = pattern->mask->width; + height = pattern->mask->height; + mask_bpp = pattern->mask->bytes; + length = pattern->mask->height * pattern->mask->width * + pattern->mask->bytes; + mask_data = g_memdup (temp_buf_data (pattern->mask), length); } else success = FALSE; @@ -253,10 +273,10 @@ patterns_get_pattern_data_invoker (Gimp *gimp, if (success) { - return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (pattern)->name); - return_args[2].value.pdb_int = pattern->mask->width; - return_args[3].value.pdb_int = pattern->mask->height; - return_args[4].value.pdb_int = pattern->mask->bytes; + return_args[1].value.pdb_pointer = actual_name; + return_args[2].value.pdb_int = width; + return_args[3].value.pdb_int = height; + return_args[4].value.pdb_int = mask_bpp; return_args[5].value.pdb_int = length; return_args[6].value.pdb_pointer = mask_data; } @@ -277,7 +297,7 @@ static ProcArg patterns_get_pattern_data_outargs[] = { { GIMP_PDB_STRING, - "name", + "actual-name", "The pattern name" }, { diff --git a/app/pdb/procedural_db_cmds.c b/app/pdb/procedural_db_cmds.c index 22d3f74481..facb7bc467 100644 --- a/app/pdb/procedural_db_cmds.c +++ b/app/pdb/procedural_db_cmds.c @@ -165,8 +165,8 @@ procedural_db_query_invoker (Gimp *gimp, gchar *copyright; gchar *date; gchar *proc_type; - gint num_procs; - gchar **procs; + gint32 num_matches = 0; + gchar **procedure_names = NULL; name = (gchar *) args[0].value.pdb_pointer; if (name == NULL) @@ -199,16 +199,17 @@ procedural_db_query_invoker (Gimp *gimp, if (success) { success = procedural_db_query (gimp, - name, blurb, help, author, copyright, date, proc_type, - &num_procs, &procs); + name, blurb, help, author, + copyright, date, proc_type, + &num_matches, &procedure_names); } return_args = procedural_db_return_args (&procedural_db_query_proc, success); if (success) { - return_args[1].value.pdb_int = num_procs; - return_args[2].value.pdb_pointer = procs; + return_args[1].value.pdb_int = num_matches; + return_args[2].value.pdb_pointer = procedure_names; } return return_args; @@ -420,8 +421,9 @@ procedural_db_proc_arg_invoker (Gimp *gimp, Argument *return_args; gchar *proc_name; gint32 arg_num; - ProcRecord *proc; - ProcArg *arg = NULL; + gint32 arg_type = 0; + gchar *arg_name = NULL; + gchar *arg_desc = NULL; proc_name = (gchar *) args[0].value.pdb_pointer; if (proc_name == NULL || !g_utf8_validate (proc_name, -1, NULL)) @@ -431,7 +433,8 @@ procedural_db_proc_arg_invoker (Gimp *gimp, if (success) { - gchar *canonical; + ProcRecord *proc; + gchar *canonical; canonical = gimp_canonicalize_identifier (proc_name); @@ -450,7 +453,13 @@ procedural_db_proc_arg_invoker (Gimp *gimp, g_free (canonical); if (proc && (arg_num >= 0 && arg_num < proc->num_args)) - arg = &proc->args[arg_num]; + { + ProcArg *arg = &proc->args[arg_num]; + + arg_type = arg->arg_type; + arg_name = g_strdup (arg->name); + arg_desc = g_strdup (arg->description); + } else success = FALSE; } @@ -459,9 +468,9 @@ procedural_db_proc_arg_invoker (Gimp *gimp, if (success) { - return_args[1].value.pdb_int = arg->arg_type; - return_args[2].value.pdb_pointer = g_strdup (arg->name); - return_args[3].value.pdb_pointer = g_strdup (arg->description); + return_args[1].value.pdb_int = arg_type; + return_args[2].value.pdb_pointer = arg_name; + return_args[3].value.pdb_pointer = arg_desc; } return return_args; @@ -528,8 +537,9 @@ procedural_db_proc_val_invoker (Gimp *gimp, Argument *return_args; gchar *proc_name; gint32 val_num; - ProcRecord *proc; - ProcArg *val = NULL; + gint32 val_type = 0; + gchar *val_name = NULL; + gchar *val_desc = NULL; proc_name = (gchar *) args[0].value.pdb_pointer; if (proc_name == NULL || !g_utf8_validate (proc_name, -1, NULL)) @@ -539,7 +549,8 @@ procedural_db_proc_val_invoker (Gimp *gimp, if (success) { - gchar *canonical; + ProcRecord *proc; + gchar *canonical; canonical = gimp_canonicalize_identifier (proc_name); @@ -558,7 +569,13 @@ procedural_db_proc_val_invoker (Gimp *gimp, g_free (canonical); if (proc && (val_num >= 0 && val_num < proc->num_values)) - val = &proc->values[val_num]; + { + ProcArg *val = &proc->values[val_num]; + + val_type = val->arg_type; + val_name = g_strdup (val->name); + val_desc = g_strdup (val->description); + } else success = FALSE; } @@ -567,9 +584,9 @@ procedural_db_proc_val_invoker (Gimp *gimp, if (success) { - return_args[1].value.pdb_int = val->arg_type; - return_args[2].value.pdb_pointer = g_strdup (val->name); - return_args[3].value.pdb_pointer = g_strdup (val->description); + return_args[1].value.pdb_int = val_type; + return_args[2].value.pdb_pointer = val_name; + return_args[3].value.pdb_pointer = val_desc; } return return_args; diff --git a/app/pdb/transform_tools_cmds.c b/app/pdb/transform_tools_cmds.c index a19252e143..ffac75b57b 100644 --- a/app/pdb/transform_tools_cmds.c +++ b/app/pdb/transform_tools_cmds.c @@ -147,7 +147,14 @@ perspective_invoker (Gimp *gimp, Argument *return_args; GimpDrawable *drawable; gboolean interpolation; - gdouble trans_info[8]; + gdouble x0; + gdouble y0; + gdouble x1; + gdouble y1; + gdouble x2; + gdouble y2; + gdouble x3; + gdouble y3; drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) @@ -155,21 +162,21 @@ perspective_invoker (Gimp *gimp, interpolation = args[1].value.pdb_int ? TRUE : FALSE; - trans_info[X0] = args[2].value.pdb_float; + x0 = args[2].value.pdb_float; - trans_info[Y0] = args[3].value.pdb_float; + y0 = args[3].value.pdb_float; - trans_info[X1] = args[4].value.pdb_float; + x1 = args[4].value.pdb_float; - trans_info[Y1] = args[5].value.pdb_float; + y1 = args[5].value.pdb_float; - trans_info[X2] = args[6].value.pdb_float; + x2 = args[6].value.pdb_float; - trans_info[Y2] = args[7].value.pdb_float; + y2 = args[7].value.pdb_float; - trans_info[X3] = args[8].value.pdb_float; + x3 = args[8].value.pdb_float; - trans_info[Y3] = args[9].value.pdb_float; + y3 = args[9].value.pdb_float; if (success) { @@ -187,10 +194,10 @@ perspective_invoker (Gimp *gimp, gimp_matrix3_identity (&matrix); gimp_transform_matrix_perspective (&matrix, x, y, width, height, - trans_info[X0], trans_info[Y0], - trans_info[X1], trans_info[Y1], - trans_info[X2], trans_info[Y2], - trans_info[X3], trans_info[Y3]); + x0, y0, + x1, y1, + x2, y2, + x3, y3); if (interpolation) interpolation_type = gimp->config->interpolation_type; @@ -418,7 +425,10 @@ scale_invoker (Gimp *gimp, Argument *return_args; GimpDrawable *drawable; gboolean interpolation; - gdouble trans_info[4]; + gdouble x0; + gdouble y0; + gdouble x1; + gdouble y1; drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable)))) @@ -426,21 +436,20 @@ scale_invoker (Gimp *gimp, interpolation = args[1].value.pdb_int ? TRUE : FALSE; - trans_info[X0] = args[2].value.pdb_float; + x0 = args[2].value.pdb_float; - trans_info[Y0] = args[3].value.pdb_float; + y0 = args[3].value.pdb_float; - trans_info[X1] = args[4].value.pdb_float; + x1 = args[4].value.pdb_float; - trans_info[Y1] = args[5].value.pdb_float; + y1 = args[5].value.pdb_float; if (success) { gint x, y, width, height; success = (gimp_item_is_attached (GIMP_ITEM (drawable)) && - trans_info[X0] < trans_info[X1] && - trans_info[Y0] < trans_info[Y1]); + x0 < x1 && y0 < y1); if (success && gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) @@ -452,10 +461,9 @@ scale_invoker (Gimp *gimp, gimp_matrix3_identity (&matrix); gimp_transform_matrix_scale (&matrix, x, y, width, height, - trans_info[X0], - trans_info[Y0], - trans_info[X1] - trans_info[X0], - trans_info[Y1] - trans_info[Y0]); + x0, y0, + x1 - x0, + y1 - y0); if (interpolation) interpolation_type = gimp->config->interpolation_type; diff --git a/libgimp/gimpbrush_pdb.c b/libgimp/gimpbrush_pdb.c index 498472e94a..0ffdbfb69e 100644 --- a/libgimp/gimpbrush_pdb.c +++ b/libgimp/gimpbrush_pdb.c @@ -44,7 +44,7 @@ gimp_brush_new (const gchar *name) { GimpParam *return_vals; gint nreturn_vals; - gchar *ret_name = NULL; + gchar *actual_name = NULL; return_vals = gimp_run_procedure ("gimp-brush-new", &nreturn_vals, @@ -52,11 +52,11 @@ gimp_brush_new (const gchar *name) GIMP_PDB_END); if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) - ret_name = g_strdup (return_vals[1].data.d_string); + actual_name = g_strdup (return_vals[1].data.d_string); gimp_destroy_params (return_vals, nreturn_vals); - return ret_name; + return actual_name; } /** @@ -76,7 +76,7 @@ gimp_brush_duplicate (const gchar *name) { GimpParam *return_vals; gint nreturn_vals; - gchar *ret_name = NULL; + gchar *copy_name = NULL; return_vals = gimp_run_procedure ("gimp-brush-duplicate", &nreturn_vals, @@ -84,11 +84,11 @@ gimp_brush_duplicate (const gchar *name) GIMP_PDB_END); if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) - ret_name = g_strdup (return_vals[1].data.d_string); + copy_name = g_strdup (return_vals[1].data.d_string); gimp_destroy_params (return_vals, nreturn_vals); - return ret_name; + return copy_name; } /** @@ -142,7 +142,7 @@ gimp_brush_rename (const gchar *name, { GimpParam *return_vals; gint nreturn_vals; - gchar *ret_name = NULL; + gchar *actual_name = NULL; return_vals = gimp_run_procedure ("gimp-brush-rename", &nreturn_vals, @@ -151,11 +151,11 @@ gimp_brush_rename (const gchar *name, GIMP_PDB_END); if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) - ret_name = g_strdup (return_vals[1].data.d_string); + actual_name = g_strdup (return_vals[1].data.d_string); gimp_destroy_params (return_vals, nreturn_vals); - return ret_name; + return actual_name; } /** diff --git a/libgimp/gimpbrushes_pdb.c b/libgimp/gimpbrushes_pdb.c index 07e3156f0b..b07929ea4f 100644 --- a/libgimp/gimpbrushes_pdb.c +++ b/libgimp/gimpbrushes_pdb.c @@ -213,7 +213,7 @@ gimp_brushes_get_brush_data (const gchar *name, { GimpParam *return_vals; gint nreturn_vals; - gchar *ret_name = NULL; + gchar *actual_name = NULL; return_vals = gimp_run_procedure ("gimp-brushes-get-brush-data", &nreturn_vals, @@ -224,7 +224,7 @@ gimp_brushes_get_brush_data (const gchar *name, if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) { - ret_name = g_strdup (return_vals[1].data.d_string); + actual_name = g_strdup (return_vals[1].data.d_string); *opacity = return_vals[2].data.d_float; *spacing = return_vals[3].data.d_int32; *paint_mode = return_vals[4].data.d_int32; @@ -238,5 +238,5 @@ gimp_brushes_get_brush_data (const gchar *name, gimp_destroy_params (return_vals, nreturn_vals); - return ret_name; + return actual_name; } diff --git a/libgimp/gimpgradient_pdb.c b/libgimp/gimpgradient_pdb.c index f41c941e47..ed460b0906 100644 --- a/libgimp/gimpgradient_pdb.c +++ b/libgimp/gimpgradient_pdb.c @@ -44,7 +44,7 @@ gimp_gradient_new (const gchar *name) { GimpParam *return_vals; gint nreturn_vals; - gchar *ret_name = NULL; + gchar *actual_name = NULL; return_vals = gimp_run_procedure ("gimp-gradient-new", &nreturn_vals, @@ -52,11 +52,11 @@ gimp_gradient_new (const gchar *name) GIMP_PDB_END); if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) - ret_name = g_strdup (return_vals[1].data.d_string); + actual_name = g_strdup (return_vals[1].data.d_string); gimp_destroy_params (return_vals, nreturn_vals); - return ret_name; + return actual_name; } /** @@ -76,7 +76,7 @@ gimp_gradient_duplicate (const gchar *name) { GimpParam *return_vals; gint nreturn_vals; - gchar *ret_name = NULL; + gchar *copy_name = NULL; return_vals = gimp_run_procedure ("gimp-gradient-duplicate", &nreturn_vals, @@ -84,11 +84,11 @@ gimp_gradient_duplicate (const gchar *name) GIMP_PDB_END); if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) - ret_name = g_strdup (return_vals[1].data.d_string); + copy_name = g_strdup (return_vals[1].data.d_string); gimp_destroy_params (return_vals, nreturn_vals); - return ret_name; + return copy_name; } /** @@ -142,7 +142,7 @@ gimp_gradient_rename (const gchar *name, { GimpParam *return_vals; gint nreturn_vals; - gchar *ret_name = NULL; + gchar *actual_name = NULL; return_vals = gimp_run_procedure ("gimp-gradient-rename", &nreturn_vals, @@ -151,11 +151,11 @@ gimp_gradient_rename (const gchar *name, GIMP_PDB_END); if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) - ret_name = g_strdup (return_vals[1].data.d_string); + actual_name = g_strdup (return_vals[1].data.d_string); gimp_destroy_params (return_vals, nreturn_vals); - return ret_name; + return actual_name; } /** diff --git a/libgimp/gimpgradients_pdb.c b/libgimp/gimpgradients_pdb.c index 57f35542aa..7d89f1a2a7 100644 --- a/libgimp/gimpgradients_pdb.c +++ b/libgimp/gimpgradients_pdb.c @@ -198,7 +198,7 @@ gimp_gradients_get_gradient_data (const gchar *name, { GimpParam *return_vals; gint nreturn_vals; - gchar *ret_name = NULL; + gchar *actual_name = NULL; return_vals = gimp_run_procedure ("gimp-gradients-get-gradient-data", &nreturn_vals, @@ -211,7 +211,7 @@ gimp_gradients_get_gradient_data (const gchar *name, if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) { - ret_name = g_strdup (return_vals[1].data.d_string); + actual_name = g_strdup (return_vals[1].data.d_string); *width = return_vals[2].data.d_int32; *grad_data = g_new (gdouble, *width); memcpy (*grad_data, return_vals[3].data.d_floatarray, @@ -220,5 +220,5 @@ gimp_gradients_get_gradient_data (const gchar *name, gimp_destroy_params (return_vals, nreturn_vals); - return ret_name; + return actual_name; } diff --git a/libgimp/gimppalette_pdb.c b/libgimp/gimppalette_pdb.c index 3b93dcabdd..d7dc9087b0 100644 --- a/libgimp/gimppalette_pdb.c +++ b/libgimp/gimppalette_pdb.c @@ -42,7 +42,7 @@ gimp_palette_new (const gchar *name) { GimpParam *return_vals; gint nreturn_vals; - gchar *ret_name = NULL; + gchar *actual_name = NULL; return_vals = gimp_run_procedure ("gimp-palette-new", &nreturn_vals, @@ -50,11 +50,11 @@ gimp_palette_new (const gchar *name) GIMP_PDB_END); if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) - ret_name = g_strdup (return_vals[1].data.d_string); + actual_name = g_strdup (return_vals[1].data.d_string); gimp_destroy_params (return_vals, nreturn_vals); - return ret_name; + return actual_name; } /** @@ -74,7 +74,7 @@ gimp_palette_duplicate (const gchar *name) { GimpParam *return_vals; gint nreturn_vals; - gchar *ret_name = NULL; + gchar *copy_name = NULL; return_vals = gimp_run_procedure ("gimp-palette-duplicate", &nreturn_vals, @@ -82,11 +82,11 @@ gimp_palette_duplicate (const gchar *name) GIMP_PDB_END); if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) - ret_name = g_strdup (return_vals[1].data.d_string); + copy_name = g_strdup (return_vals[1].data.d_string); gimp_destroy_params (return_vals, nreturn_vals); - return ret_name; + return copy_name; } /** @@ -108,7 +108,7 @@ gimp_palette_rename (const gchar *name, { GimpParam *return_vals; gint nreturn_vals; - gchar *ret_name = NULL; + gchar *actual_name = NULL; return_vals = gimp_run_procedure ("gimp-palette-rename", &nreturn_vals, @@ -117,11 +117,11 @@ gimp_palette_rename (const gchar *name, GIMP_PDB_END); if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) - ret_name = g_strdup (return_vals[1].data.d_string); + actual_name = g_strdup (return_vals[1].data.d_string); gimp_destroy_params (return_vals, nreturn_vals); - return ret_name; + return actual_name; } /** diff --git a/libgimp/gimppalettes_pdb.c b/libgimp/gimppalettes_pdb.c index 82c85c538b..cf0a077739 100644 --- a/libgimp/gimppalettes_pdb.c +++ b/libgimp/gimppalettes_pdb.c @@ -146,7 +146,7 @@ gimp_palettes_get_palette_entry (const gchar *name, { GimpParam *return_vals; gint nreturn_vals; - gchar *ret_name = NULL; + gchar *actual_name = NULL; return_vals = gimp_run_procedure ("gimp-palettes-get-palette-entry", &nreturn_vals, @@ -156,12 +156,12 @@ gimp_palettes_get_palette_entry (const gchar *name, if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) { - ret_name = g_strdup (return_vals[1].data.d_string); + actual_name = g_strdup (return_vals[1].data.d_string); *num_colors = return_vals[2].data.d_int32; *color = return_vals[3].data.d_color; } gimp_destroy_params (return_vals, nreturn_vals); - return ret_name; + return actual_name; } diff --git a/libgimp/gimppatterns_pdb.c b/libgimp/gimppatterns_pdb.c index a7ee2a1ab8..a74b86a494 100644 --- a/libgimp/gimppatterns_pdb.c +++ b/libgimp/gimppatterns_pdb.c @@ -154,7 +154,7 @@ gimp_patterns_get_pattern_data (const gchar *name, { GimpParam *return_vals; gint nreturn_vals; - gchar *ret_name = NULL; + gchar *actual_name = NULL; return_vals = gimp_run_procedure ("gimp-patterns-get-pattern-data", &nreturn_vals, @@ -165,7 +165,7 @@ gimp_patterns_get_pattern_data (const gchar *name, if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) { - ret_name = g_strdup (return_vals[1].data.d_string); + actual_name = g_strdup (return_vals[1].data.d_string); *width = return_vals[2].data.d_int32; *height = return_vals[3].data.d_int32; *mask_bpp = return_vals[4].data.d_int32; @@ -177,5 +177,5 @@ gimp_patterns_get_pattern_data (const gchar *name, gimp_destroy_params (return_vals, nreturn_vals); - return ret_name; + return actual_name; } diff --git a/tools/pdbgen/app.pl b/tools/pdbgen/app.pl index ce29d43d29..5e944401bb 100644 --- a/tools/pdbgen/app.pl +++ b/tools/pdbgen/app.pl @@ -158,17 +158,6 @@ sub declare_args { $result; } -sub declare_vars { - my $proc = shift; - my $code = ""; - if (exists $proc->{invoke}->{vars}) { - foreach (@{$proc->{invoke}->{vars}}) { - $code .= ' ' x 2 . $_ . ";\n"; - } - } - $code; -} - sub make_arg_recs { my $proc = shift; @@ -530,7 +519,6 @@ CODE $pos++; } - $code .= &declare_vars($proc); $code .= "\n" if length($code); $code .= &format_code_frag($custom, 0) . "}\n"; } @@ -562,7 +550,6 @@ CODE } $code .= &declare_args($tempproc, $out, qw(inargs)) . "\n"; - $code .= &declare_vars($proc); my $marshal = ""; foreach (@{$tempproc->{inargs}}) { @@ -623,7 +610,6 @@ CODE $invoker .= ' ' x 2 . "Argument *return_args;\n" if scalar @outargs; $invoker .= &declare_args($proc, $out, qw(inargs outargs)); - $invoker .= &declare_vars($proc); $invoker .= &marshal_inargs($proc, 0); $invoker .= "\n" if $invoker && $invoker !~ /\n\n/s; diff --git a/tools/pdbgen/pdb/brush.pdb b/tools/pdbgen/pdb/brush.pdb index aabb1fee23..f4c1b31f4a 100644 --- a/tools/pdbgen/pdb/brush.pdb +++ b/tools/pdbgen/pdb/brush.pdb @@ -38,19 +38,24 @@ sub brush_new { ); @outargs = ( - { name => 'name', type => 'string', - desc => 'The actual new brush name', - alias => 'g_strdup (GIMP_OBJECT (data)->name)', no_declare => 1 }, + { name => 'actual_name', type => 'string', init => 1, + desc => 'The actual new brush name' } ); %invoke = ( - vars => [ 'GimpData *data = NULL'], code => <<'CODE' { if (strlen (name)) - data = gimp_data_factory_data_new (gimp->brush_factory, name); + { + GimpData *data = gimp_data_factory_data_new (gimp->brush_factory, name); - success = (data != NULL); + if (data) + actual_name = g_strdup (GIMP_OBJECT (data)->name); + else + success = FALSE; + } + else + success = FALSE; } CODE ); @@ -67,27 +72,26 @@ sub brush_duplicate { ); @outargs = ( - { name => 'name', type => 'string', - desc => "The name of the brush's copy", - alias => 'g_strdup (GIMP_OBJECT (brush_copy)->name)', - no_declare => 1 } + { name => 'copy_name', type => 'string', init => 1, + desc => "The name of the brush's copy" } ); %invoke = ( - vars => [ 'GimpBrush *brush = NULL', - 'GimpBrush *brush_copy = NULL' ], code => <<'CODE' { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush) { - brush_copy = (GimpBrush *) + GimpBrush *brush_copy = (GimpBrush *) gimp_data_factory_data_duplicate (gimp->brush_factory, GIMP_DATA (brush)); - success = (brush_copy != NULL); + if (brush_copy) + copy_name = g_strdup (GIMP_OBJECT (brush_copy)->name); + else + success = FALSE; } else success = FALSE; @@ -107,21 +111,18 @@ sub brush_is_generated { ); @outargs = ( - { name => 'generated', type => 'boolean', - desc => "True if the brush is generated", - alias => 'GIMP_IS_BRUSH_GENERATED (brush)', - no_declare => 1 } + { name => 'generated', type => 'boolean', init => 1, + desc => "True if the brush is generated" } ); %invoke = ( - vars => [ 'GimpBrush *brush = NULL' ], code => <<'CODE' { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush) - success = TRUE; + generated = GIMP_IS_BRUSH_GENERATED (brush); else success = FALSE; } @@ -140,21 +141,18 @@ sub brush_is_editable { ); @outargs = ( - { name => 'editable', type => 'boolean', - desc => "True if the brush can be edited", - alias => 'GIMP_DATA (brush)->writable', - no_declare => 1 } + { name => 'editable', type => 'boolean', init => 1, + desc => "True if the brush can be edited" } ); %invoke = ( - vars => [ 'GimpBrush *brush = NULL' ], code => <<'CODE' { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush) - success = TRUE; + editable = GIMP_DATA (brush)->writable; else success = FALSE; } @@ -175,20 +173,21 @@ sub brush_rename { ); @outargs = ( - { name => 'name', type => 'string', - desc => "The actual new name of the brush", - alias => 'g_strdup (GIMP_OBJECT (brush)->name)', no_declare => 1 }, + { name => 'actual_name', type => 'string', init => 1, + desc => "The actual new name of the brush" } ); %invoke = ( - vars => [ 'GimpBrush *brush = NULL' ], code => <<'CODE' { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush && GIMP_DATA (brush)->writable) - gimp_object_set_name (GIMP_OBJECT (brush), new_name); + { + gimp_object_set_name (GIMP_OBJECT (brush), new_name); + actual_name = g_strdup (GIMP_OBJECT (brush)->name); + } else success = FALSE; } @@ -207,10 +206,9 @@ sub brush_delete { ); %invoke = ( - vars => [ 'GimpBrush *brush = NULL' ], code => <<'CODE' { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush && GIMP_DATA (brush)->deletable) @@ -248,28 +246,31 @@ HELP ); @outargs = ( - { name => 'width', type => 'int32', no_declare => '1', - alias => 'brush->mask->width', void_ret => '1', + { name => 'width', type => 'int32', init => 1, void_ret => 1, desc => "The brush width" }, - { name => 'height', type => 'int32', no_declare => '1', - alias => 'brush->mask->height', + { name => 'height', type => 'int32', init => 1, desc => "The brush height" }, - { name => 'mask_bpp', type => 'int32', no_declare => '1', - alias => 'brush->mask->bytes', + { name => 'mask_bpp', type => 'int32', init => 1, desc => "The brush mask bpp" }, - { name => 'color_bpp', type => 'int32', no_declare => '1', - alias => 'brush->pixmap ? brush->pixmap->bytes : 0', + { name => 'color_bpp', type => 'int32', init => 1, desc => "The brush color bpp" } ); %invoke = ( - vars => [ 'GimpBrush *brush = NULL' ], code => <<'CODE' { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); - success = (brush != NULL); + if (brush) + { + width = brush->mask->width; + height = brush->mask->height; + mask_bpp = brush->mask->bytes; + color_bpp = brush->pixmap ? brush->pixmap->bytes : 0; + } + else + success = FALSE; } CODE ); @@ -292,11 +293,9 @@ HELP ); @outargs = ( - { name => 'width', type => 'int32', no_declare => '1', - alias => 'brush->mask->width', void_ret => '1', + { name => 'width', type => 'int32', init => 1, void_ret => '1', desc => "The brush width" }, - { name => 'height', type => 'int32', no_declare => '1', - alias => 'brush->mask->height', + { name => 'height', type => 'int32', init => 1, desc => "The brush height" }, { name => 'mask_bpp', type => 'int32', init => '1', desc => "The brush mask bpp" }, @@ -313,14 +312,15 @@ HELP ); %invoke = ( - vars => [ 'GimpBrush *brush = NULL' ], code => <<'CODE' { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush) { + width = brush->mask->width; + height = brush->mask->height; mask_bpp = brush->mask->bytes; num_mask_bytes = brush->mask->height * brush->mask->width; mask_bytes = g_memdup (temp_buf_data (brush->mask), num_mask_bytes); @@ -356,20 +356,21 @@ HELP ); @outargs = ( - { name => 'spacing', type => '0 <= int32 <= 1000', + { name => 'spacing', type => '0 <= int32 <= 1000', init => 1, desc => 'The brush spacing: %%desc%%', - alias => 'gimp_brush_get_spacing (brush)', - no_declare => 1, void_ret => 1 } + void_ret => 1 } ); %invoke = ( - vars => [ 'GimpBrush *brush = NULL' ], code => <<'CODE' { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); - success = (brush != NULL); + if (brush) + spacing = gimp_brush_get_spacing (brush); + else + success = FALSE; } CODE ); @@ -394,20 +395,21 @@ HELP ); @outargs = ( - { name => 'shape', type => 'int32', no_declare => '1', - alias => 'GIMP_BRUSH_GENERATED (brush)->shape', + { name => 'shape', type => 'int32', init => 1, desc => "An enumerated value representing the brush shape" } ); %invoke = ( - vars => [ 'GimpBrush *brush = NULL' ], code => <<'CODE' { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); - success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush)); + if (GIMP_IS_BRUSH_GENERATED (brush)) + shape = GIMP_BRUSH_GENERATED (brush)->shape; + else + success = FALSE; } CODE ); @@ -428,20 +430,20 @@ HELP ); @outargs = ( - { name => 'radius', type => 'float', no_declare => '1', - alias => 'GIMP_BRUSH_GENERATED (brush)->radius', + { name => 'radius', type => 'float', init => 1, desc => "The radius of the brush in pixels" } ); - %invoke = ( - vars => [ 'GimpBrush *brush = NULL' ], code => <<'CODE' { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); - success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush)); + if (GIMP_IS_BRUSH_GENERATED (brush)) + radius = GIMP_BRUSH_GENERATED (brush)->radius; + else + success = FALSE; } CODE ); @@ -462,20 +464,20 @@ HELP ); @outargs = ( - { name => 'spikes', type => 'int32', no_declare => '1', - alias => 'GIMP_BRUSH_GENERATED (brush)->spikes', + { name => 'spikes', type => 'int32', init => 1, desc => "The number of spikes on the brush." } ); - %invoke = ( - vars => [ 'GimpBrush *brush = NULL' ], code => <<'CODE' { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); - success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush)); + if (GIMP_IS_BRUSH_GENERATED (brush)) + spikes = GIMP_BRUSH_GENERATED (brush)->spikes; + else + success = FALSE; } CODE ); @@ -498,20 +500,20 @@ HELP ); @outargs = ( - { name => 'hardness', type => 'float', no_declare => '1', - alias => 'GIMP_BRUSH_GENERATED (brush)->hardness', + { name => 'hardness', type => 'float', init => 1, desc => "The hardness of the brush." } ); - %invoke = ( - vars => [ 'GimpBrush *brush = NULL' ], code => <<'CODE' { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); - success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush)); + if (GIMP_IS_BRUSH_GENERATED (brush)) + hardness = GIMP_BRUSH_GENERATED (brush)->hardness; + else + success = FALSE; } CODE ); @@ -532,20 +534,20 @@ HELP ); @outargs = ( - { name => 'aspect_ratio', type => 'float', no_declare => '1', - alias => 'GIMP_BRUSH_GENERATED (brush)->aspect_ratio', + { name => 'aspect_ratio', type => 'float', init => 1, desc => "The aspect ratio of the brush." } ); - %invoke = ( - vars => [ 'GimpBrush *brush = NULL' ], code => <<'CODE' { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); - success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush)); + if (GIMP_IS_BRUSH_GENERATED (brush)) + aspect_ratio = GIMP_BRUSH_GENERATED (brush)->aspect_ratio; + else + success = FALSE; } CODE ); @@ -566,20 +568,20 @@ HELP ); @outargs = ( - { name => 'angle', type => 'float', no_declare => '1', - alias => 'GIMP_BRUSH_GENERATED (brush)->angle', + { name => 'angle', type => 'float', init => 1, desc => "The rotation angle of the brush." } ); - %invoke = ( - vars => [ 'GimpBrush *brush = NULL' ], code => <<'CODE' { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); - success = (brush != NULL && GIMP_IS_BRUSH_GENERATED (brush)); + if (GIMP_IS_BRUSH_GENERATED (brush)) + angle = GIMP_BRUSH_GENERATED (brush)->angle; + else + success = FALSE; } CODE ); @@ -602,10 +604,9 @@ HELP ); %invoke = ( - vars => [ 'GimpBrush *brush = NULL' ], code => <<'CODE' { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush) @@ -639,20 +640,22 @@ HELP ); @outargs = ( - { name => 'shape_out', type => 'int32', no_declare => '1', - alias => 'GIMP_BRUSH_GENERATED (brush)->shape', + { name => 'shape_out', type => 'int32', init => 1, desc => "The brush shape actually assigned" } ); %invoke = ( - vars => [ 'GimpBrush *brush = NULL' ], code => <<'CODE' { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush)) - gimp_brush_generated_set_shape (GIMP_BRUSH_GENERATED (brush), shape_in); + { + gimp_brush_generated_set_shape (GIMP_BRUSH_GENERATED (brush), + shape_in); + shape_out = GIMP_BRUSH_GENERATED (brush)->shape; + } else success = FALSE; } @@ -678,20 +681,22 @@ HELP ); @outargs = ( - { name => 'radius_out', type => 'float', no_declare => '1', - alias => 'GIMP_BRUSH_GENERATED (brush)->radius', + { name => 'radius_out', type => 'float', init => 1, desc => "The brush radius actually assigned" } ); %invoke = ( - vars => [ 'GimpBrush *brush = NULL' ], code => <<'CODE' { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush)) - gimp_brush_generated_set_radius (GIMP_BRUSH_GENERATED (brush), radius_in); + { + gimp_brush_generated_set_radius (GIMP_BRUSH_GENERATED (brush), + radius_in); + radius_out = GIMP_BRUSH_GENERATED (brush)->radius; + } else success = FALSE; } @@ -717,20 +722,22 @@ HELP ); @outargs = ( - { name => 'spikes_out', type => 'int32', no_declare => '1', - alias => 'GIMP_BRUSH_GENERATED (brush)->spikes', + { name => 'spikes_out', type => 'int32', init => 1, desc => "The number of spikes actually assigned" } ); %invoke = ( - vars => [ 'GimpBrush *brush = NULL' ], code => <<'CODE' { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush)) - gimp_brush_generated_set_spikes (GIMP_BRUSH_GENERATED (brush), spikes_in); + { + gimp_brush_generated_set_spikes (GIMP_BRUSH_GENERATED (brush), + spikes_in); + spikes_out = GIMP_BRUSH_GENERATED (brush)->spikes; + } else success = FALSE; } @@ -756,20 +763,22 @@ HELP ); @outargs = ( - { name => 'hardness_out', type => 'float', no_declare => '1', - alias => 'GIMP_BRUSH_GENERATED (brush)->hardness', + { name => 'hardness_out', type => 'float', init => 1, desc => "The brush hardness actually assigned" } ); %invoke = ( - vars => [ 'GimpBrush *brush = NULL' ], code => <<'CODE' { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush)) - gimp_brush_generated_set_hardness (GIMP_BRUSH_GENERATED (brush), hardness_in); + { + gimp_brush_generated_set_hardness (GIMP_BRUSH_GENERATED (brush), + hardness_in); + hardness_out = GIMP_BRUSH_GENERATED (brush)->hardness; + } else success = FALSE; } @@ -795,20 +804,22 @@ HELP ); @outargs = ( - { name => 'aspect_ratio_out', type => 'float', no_declare => '1', - alias => 'GIMP_BRUSH_GENERATED (brush)->aspect_ratio', + { name => 'aspect_ratio_out', type => 'float', init => 1, desc => "The brush aspect ratio actually assigned" } ); %invoke = ( - vars => [ 'GimpBrush *brush = NULL' ], code => <<'CODE' { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush)) - gimp_brush_generated_set_aspect_ratio (GIMP_BRUSH_GENERATED (brush), aspect_ratio_in); + { + 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; } @@ -834,20 +845,22 @@ HELP ); @outargs = ( - { name => 'angle_out', type => 'float', no_declare => '1', - alias => 'GIMP_BRUSH_GENERATED (brush)->angle', + { name => 'angle_out', type => 'float', init => 1, desc => "The brush rotation angle actually assigned" } ); %invoke = ( - vars => [ 'GimpBrush *brush = NULL' ], code => <<'CODE' { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush && GIMP_DATA (brush)->writable && GIMP_IS_BRUSH_GENERATED (brush)) - gimp_brush_generated_set_angle (GIMP_BRUSH_GENERATED (brush), angle_in); + { + gimp_brush_generated_set_angle (GIMP_BRUSH_GENERATED (brush), + angle_in); + angle_out = GIMP_BRUSH_GENERATED (brush)->angle; + } else success = FALSE; } diff --git a/tools/pdbgen/pdb/brushes.pdb b/tools/pdbgen/pdb/brushes.pdb index 41efdc8a93..bc7f3108fd 100644 --- a/tools/pdbgen/pdb/brushes.pdb +++ b/tools/pdbgen/pdb/brushes.pdb @@ -66,23 +66,32 @@ sub brushes_get_brush { &std_pdb_deprecated ('gimp-context-get-brush'); @outargs = ( - { name => 'name', type => 'string', no_declare => 1, - desc => 'The brush name', - alias => 'g_strdup (GIMP_OBJECT (brush)->name)' }, - { name => 'width', type => 'int32', no_declare => 1, - desc => 'The brush width', - alias => 'brush->mask->width' }, - { name => 'height', type => 'int32', no_declare => 1, - desc => 'The brush height', - alias => 'brush->mask->height' }, - { name => 'spacing', type => '0 <= int32 <= 1000', no_declare => 1, - desc => 'The brush spacing: %%desc%%', - alias => 'gimp_brush_get_spacing (brush)' } + { name => 'name', type => 'string', init => 1, + desc => 'The brush name' }, + { name => 'width', type => 'int32', init => 1, + desc => 'The brush width' }, + { name => 'height', type => 'int32', init => 1, + desc => 'The brush height' }, + { name => 'spacing', type => '0 <= int32 <= 1000', init => 1, + desc => 'The brush spacing: %%desc%%' } ); %invoke = ( - vars => [ 'GimpBrush *brush' ], - code => 'success = (brush = gimp_context_get_brush (context)) != NULL;' + code =><<'CODE' +{ + GimpBrush *brush = gimp_context_get_brush (context); + + if (brush) + { + name = g_strdup (GIMP_OBJECT (brush)->name); + width = brush->mask->width; + height = brush->mask->height; + spacing = gimp_brush_get_spacing (brush); + } + else + success = FALSE; +} +CODE ); } @@ -90,10 +99,21 @@ sub brushes_get_spacing { &std_pdb_deprecated ('gimp-brush-get-spacing'); @outargs = ( - { name => 'spacing', type => '0 <= int32 <= 1000', - desc => 'The brush spacing: %%desc%%', - alias => 'gimp_brush_get_spacing (gimp_context_get_brush (context))', - no_declare => 1 } + { name => 'spacing', type => '0 <= int32 <= 1000', init => 1, + desc => 'The brush spacing: %%desc%%' } + ); + + %invoke = ( + code =><<'CODE' +{ + GimpBrush *brush = gimp_context_get_brush (context); + + if (brush) + spacing = gimp_brush_get_spacing (brush); + else + success = FALSE; +} +CODE ); } @@ -120,25 +140,18 @@ sub brushes_get_brush_data { ); @outargs = ( - { name => 'name', type => 'string', no_declare => 1, - desc => 'The brush name', - alias => 'g_strdup (GIMP_OBJECT (brush)->name)' }, - { name => 'opacity', type => '0 <= float <= 100', no_declare => 1, - desc => 'The brush opacity: %%desc%%', - alias => '1.0' }, - { name => 'spacing', type => '0 <= int32 <= 1000', no_declare => 1, - desc => 'The brush spacing: %%desc%%', - alias => 'gimp_brush_get_spacing (brush)' }, - { name => 'paint_mode', type => 'enum GimpLayerModeEffects', - no_declare => 1, - desc => 'The paint mode: { %%desc%% }', - alias => '0' }, - { name => 'width', type => 'int32', no_declare => 1, - desc => 'The brush width', - alias => 'brush->mask->width' }, - { name => 'height', type => 'int32', no_declare => 1, - desc => 'The brush height', - alias => 'brush->mask->height' }, + { name => 'actual_name', type => 'string', init => 1, + desc => 'The brush name' }, + { name => 'opacity', type => '0 <= float <= 100', init => 1, + desc => 'The brush opacity: %%desc%%' }, + { name => 'spacing', type => '0 <= int32 <= 1000', init => 1, + desc => 'The brush spacing: %%desc%%' }, + { name => 'paint_mode', type => 'enum GimpLayerModeEffects', init => 1, + desc => 'The paint mode: { %%desc%% }' }, + { name => 'width', type => 'int32', init => 1, + desc => 'The brush width' }, + { name => 'height', type => 'int32', init => 1, + desc => 'The brush height' }, { name => 'mask_data', type => 'int8array', init => 1, desc => 'The brush mask data', array => { name => 'length', init => 1, @@ -146,9 +159,10 @@ sub brushes_get_brush_data { ); %invoke = ( - vars => [ 'GimpBrush *brush = NULL' ], code => <<'CODE' { + GimpBrush *brush; + if (name && strlen (name)) { brush = (GimpBrush *) @@ -161,8 +175,14 @@ sub brushes_get_brush_data { if (brush) { - length = brush->mask->height * brush->mask->width; - mask_data = g_memdup (temp_buf_data (brush->mask), length); + actual_name = g_strdup (GIMP_OBJECT (brush)->name); + opacity = 1.0; + spacing = gimp_brush_get_spacing (brush); + paint_mode = 0; + width = brush->mask->width; + height = brush->mask->height; + length = brush->mask->height * brush->mask->width; + mask_data = g_memdup (temp_buf_data (brush->mask), length); } else success = FALSE; diff --git a/tools/pdbgen/pdb/context.pdb b/tools/pdbgen/pdb/context.pdb index 08d71fe975..5f76b93356 100644 --- a/tools/pdbgen/pdb/context.pdb +++ b/tools/pdbgen/pdb/context.pdb @@ -39,13 +39,9 @@ HELP code => <<'CODE' { if (gimp->current_plug_in && gimp->current_plug_in->open) - { - success = plug_in_context_push (gimp->current_plug_in); - } + success = plug_in_context_push (gimp->current_plug_in); else - { - success = FALSE; - } + success = FALSE; } CODE ); @@ -66,13 +62,9 @@ HELP code => <<'CODE' { if (gimp->current_plug_in && gimp->current_plug_in->open) - { - success = plug_in_context_pop (gimp->current_plug_in); - } + success = plug_in_context_pop (gimp->current_plug_in); else - { - success = FALSE; - } + success = FALSE; } CODE ); @@ -88,15 +80,21 @@ HELP &mitch_pdb_misc('2005', '2.4'); @outargs = ( - { name => 'name', type => 'string', - desc => 'The name of the active paint method', - alias => 'g_strdup (gimp_object_get_name (GIMP_OBJECT (paint_info)))', - no_declare => 1 } + { name => 'name', type => 'string', init => 1, + desc => 'The name of the active paint method' } ); %invoke = ( - vars => [ 'GimpPaintInfo *paint_info' ], - code => 'success = (paint_info = gimp_context_get_paint_info (context)) != NULL;' + code => <<'CODE' +{ + GimpPaintInfo *paint_info = gimp_context_get_paint_info (context); + + if (paint_info) + name = g_strdup (gimp_object_get_name (GIMP_OBJECT (paint_info))); + else + success = FALSE; +} +CODE ); } @@ -120,10 +118,9 @@ HELP ); %invoke = ( - vars => [ 'GimpPaintInfo *paint_info' ], code => <<'CODE' { - paint_info = (GimpPaintInfo *) + GimpPaintInfo *paint_info = (GimpPaintInfo *) gimp_container_get_child_by_name (gimp->paint_info_list, name); if (paint_info) @@ -341,15 +338,21 @@ HELP &pdb_misc; @outargs = ( - { name => 'name', type => 'string', - desc => 'The name of the active brush', - alias => 'g_strdup (gimp_object_get_name (GIMP_OBJECT (brush)))', - no_declare => 1 } + { name => 'name', type => 'string', init => 1, + desc => 'The name of the active brush' } ); %invoke = ( - vars => [ 'GimpBrush *brush' ], - code => 'success = (brush = gimp_context_get_brush (context)) != NULL;' + code => <<'CODE' +{ + GimpBrush *brush = gimp_context_get_brush (context); + + if (brush) + name = g_strdup (gimp_object_get_name (GIMP_OBJECT (brush))); + else + success = FALSE; +} +CODE ); } @@ -372,10 +375,9 @@ HELP ); %invoke = ( - vars => [ 'GimpBrush *brush' ], code => <<'CODE' { - brush = (GimpBrush *) + GimpBrush *brush = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, name); if (brush) @@ -399,15 +401,21 @@ HELP &pdb_misc; @outargs = ( - { name => 'name', type => 'string', - desc => 'The name of the active pattern', - alias => 'g_strdup (gimp_object_get_name (GIMP_OBJECT (pattern)))', - no_declare => 1 } + { name => 'name', type => 'string', init => 1, + desc => 'The name of the active pattern' } ); %invoke = ( - vars => [ 'GimpPattern *pattern' ], - code => 'success = (pattern = gimp_context_get_pattern (context)) != NULL;' + code => <<'CODE' +{ + GimpPattern *pattern = gimp_context_get_pattern (context); + + if (pattern) + name = g_strdup (gimp_object_get_name (GIMP_OBJECT (pattern))); + else + success = FALSE; +} +CODE ); } @@ -430,10 +438,9 @@ HELP ); %invoke = ( - vars => [ 'GimpPattern *pattern' ], code => <<'CODE' { - pattern = (GimpPattern *) + GimpPattern *pattern = (GimpPattern *) gimp_container_get_child_by_name (gimp->pattern_factory->container, name); if (pattern) @@ -455,15 +462,21 @@ HELP &pdb_misc; @outargs = ( - { name => 'name', type => 'string', - desc => 'The name of the active gradient', - alias => 'g_strdup (gimp_object_get_name (GIMP_OBJECT (gradient)))', - no_declare => 1 } + { name => 'name', type => 'string', init => 1, + desc => 'The name of the active gradient' } ); %invoke = ( - vars => [ 'GimpGradient *gradient' ], - code => 'success = (gradient = gimp_context_get_gradient (context)) != NULL;' + code => <<'CODE' +{ + GimpGradient *gradient = gimp_context_get_gradient (context); + + if (gradient) + name = g_strdup (gimp_object_get_name (GIMP_OBJECT (gradient))); + else + success = FALSE; +} +CODE ); } @@ -486,10 +499,9 @@ HELP ); %invoke = ( - vars => [ 'GimpGradient *gradient' ], code => <<'CODE' { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -511,15 +523,21 @@ HELP &pdb_misc; @outargs = ( - { name => 'name', type => 'string', - desc => 'The name of the active palette', - alias => 'g_strdup (gimp_object_get_name (GIMP_OBJECT (palette)))', - no_declare => 1 } + { name => 'name', type => 'string', init => 1, + desc => 'The name of the active palette' } ); %invoke = ( - vars => [ 'GimpPalette *palette' ], - code => 'success = (palette = gimp_context_get_palette (context)) != NULL;' + code => <<'CODE' +{ + GimpPalette *palette = gimp_context_get_palette (context); + + if (palette) + name = g_strdup (gimp_object_get_name (GIMP_OBJECT (palette))); + else + success = FALSE; +} +CODE ); } @@ -542,10 +560,9 @@ HELP ); %invoke = ( - vars => [ 'GimpPalette *palette' ], code => <<'CODE' { - palette = (GimpPalette *) + GimpPalette *palette = (GimpPalette *) gimp_container_get_child_by_name (gimp->palette_factory->container, name); if (palette) @@ -567,15 +584,21 @@ HELP &pdb_misc; @outargs = ( - { name => 'name', type => 'string', - desc => 'The name of the active font', - alias => 'g_strdup (gimp_object_get_name (GIMP_OBJECT (font)))', - no_declare => 1 } + { name => 'name', type => 'string', init => 1, + desc => 'The name of the active font' } ); %invoke = ( - vars => [ 'GimpFont *font' ], - code => 'success = (font = gimp_context_get_font (context)) != NULL;' + code => <<'CODE' +{ + GimpFont *font = gimp_context_get_font (context); + + if (font) + name = g_strdup (gimp_object_get_name (GIMP_OBJECT (font))); + else + success = FALSE; +} +CODE ); } @@ -598,10 +621,9 @@ HELP ); %invoke = ( - vars => [ 'GimpFont *font' ], code => <<'CODE' { - font = (GimpFont *) + GimpFont *font = (GimpFont *) gimp_container_get_child_by_name (gimp->fonts, name); if (font) diff --git a/tools/pdbgen/pdb/drawable.pdb b/tools/pdbgen/pdb/drawable.pdb index 00d034928f..b4e2a1e421 100644 --- a/tools/pdbgen/pdb/drawable.pdb +++ b/tools/pdbgen/pdb/drawable.pdb @@ -521,12 +521,15 @@ HELP ); %invoke = ( - vars => [ 'guint8 *p', 'gint b', 'Tile *tile' ], code => <<'CODE' { if (x < gimp_item_width (GIMP_ITEM (drawable)) && y < gimp_item_height (GIMP_ITEM (drawable))) { + Tile *tile; + guint8 *p; + gint b; + num_channels = gimp_drawable_bytes (drawable); pixel = g_new (guint8, num_channels); @@ -577,13 +580,16 @@ HELP ); %invoke = ( - vars => [ 'guint8 *p', 'gint b', 'Tile *tile' ], code => <<'CODE' { if (x < gimp_item_width (GIMP_ITEM (drawable)) && y < gimp_item_height (GIMP_ITEM (drawable)) && num_channels == gimp_drawable_bytes (drawable)) { + Tile *tile; + guint8 *p; + gint b; + tile = tile_manager_get_tile (gimp_drawable_data (drawable), x, y, TRUE, TRUE); diff --git a/tools/pdbgen/pdb/drawable_transform.pdb b/tools/pdbgen/pdb/drawable_transform.pdb index fcfebfcba3..569f4b52dc 100644 --- a/tools/pdbgen/pdb/drawable_transform.pdb +++ b/tools/pdbgen/pdb/drawable_transform.pdb @@ -44,15 +44,14 @@ sub transform_options_default_args () { } sub transform_invoke { - my ($progress_text, $assemble_matrix, $variables, $check) = @_; + my ($progress_text, $assemble_matrix, $check) = @_; my $success_check = 'gimp_item_is_attached (GIMP_ITEM (drawable));'; if ($check) { - $success_check = "(gimp_item_is_attached (GIMP_ITEM (drawable)) &&\n" . $check; + $success_check = "(gimp_item_is_attached (GIMP_ITEM (drawable)) && " . $check . ");"; } %invoke = ( - vars => $variables, code => <<"CODE" { gint x, y, width, height; @@ -86,15 +85,14 @@ CODE } sub transform_default_invoke { - my ($progress_text, $assemble_matrix, $variables, $check) = @_; + my ($progress_text, $assemble_matrix, $check) = @_; my $success_check = 'gimp_item_is_attached (GIMP_ITEM (drawable));'; if ($check) { - $success_check = "(gimp_item_is_attached (GIMP_ITEM (drawable)) &&\n" . $check; + $success_check = "(gimp_item_is_attached (GIMP_ITEM (drawable)) && " . $check . ");"; } %invoke = ( - vars => $variables, code => <<"CODE" { gint x, y, width, height; @@ -316,8 +314,7 @@ HELP push @inargs, { name => "$_$pos", type => 'float', desc => "The new $_ coordinate of $where corner of original - bounding box", - alias => "trans_info[\U$_\E$pos]", no_declare => 1 } + bounding box" } } $pos++; } @@ -330,14 +327,14 @@ HELP desc => 'The newly mapped drawable' } ); - transform_invoke ("Perspective", < "$_$pos", type => 'float', desc => "The new $_ coordinate of $where corner of original - bounding box", - alias => "trans_info[\U$_\E$pos]", no_declare => 1 } + bounding box" } } $pos++; } @@ -380,14 +376,14 @@ HELP desc => 'The newly mapped drawable' } ); - transform_default_invoke ("Perspective", < 'The affected drawable' }, { name => 'x0', type => 'float', desc => 'The new x coordinate of the upper-left corner of the - scaled region', - alias => 'trans_info[X0]', no_declare => 1 }, + scaled region' }, { name => 'y0', type => 'float', desc => 'The new y coordinate of the upper-left corner of the - scaled region', - alias => 'trans_info[Y0]', no_declare => 1 }, + scaled region' }, { name => 'x1', type => 'float', desc => 'The new x coordinate of the lower-right corner of the - scaled region', - alias => 'trans_info[X1]', no_declare => 1 }, + scaled region' }, { name => 'y1', type => 'float', desc => 'The new y coordinate of the lower-right corner of the - scaled region', - alias => 'trans_info[Y1]', no_declare => 1 }, + scaled region' }, &transform_options_args ); @@ -581,18 +573,14 @@ HELP desc => 'The scaled drawable' } ); - transform_invoke ("Scaling", < 'The affected drawable' }, { name => 'x0', type => 'float', desc => 'The new x coordinate of the upper-left corner of the - scaled region', - alias => 'trans_info[X0]', no_declare => 1 }, + scaled region' }, { name => 'y0', type => 'float', desc => 'The new y coordinate of the upper-left corner of the - scaled region', - alias => 'trans_info[Y0]', no_declare => 1 }, + scaled region' }, { name => 'x1', type => 'float', desc => 'The new x coordinate of the lower-right corner of the - scaled region', - alias => 'trans_info[X1]', no_declare => 1 }, + scaled region' }, { name => 'y1', type => 'float', desc => 'The new y coordinate of the lower-right corner of the - scaled region', - alias => 'trans_info[Y1]', no_declare => 1 }, + scaled region' }, &transform_options_default_args ); @@ -634,18 +618,14 @@ HELP desc => 'The scaled drawable' } ); - transform_default_invoke ("Scaling", <gradient_factory->container, name); if (gradient) @@ -83,7 +83,6 @@ HELP } %invoke = ( - vars => [ 'GimpGradient *gradient = NULL' ], code => &_gen_gradient_search_for_segment_code(<<"CODE"), color.a = opacity / 100.0; gimp_gradient_segment_set_${side}_color (gradient, seg, &color); @@ -119,7 +118,6 @@ HELP ); %invoke = ( - vars => [ 'GimpGradient *gradient = NULL' ], code => &_gen_gradient_search_for_segment_code(<<"CODE"), gimp_gradient_segment_get_${side}_color (gradient, seg, &color); opacity = color.a * 100.0; @@ -159,7 +157,6 @@ HELP ); %invoke = ( - vars => [ 'GimpGradient *gradient = NULL' ], code => &_gen_gradient_search_for_segment_code(<<"CODE"), pos = gimp_gradient_segment_get_${side}_pos (gradient, seg); CODE @@ -212,7 +209,6 @@ HELP ); %invoke = ( - vars => [ 'GimpGradient *gradient = NULL' ], code => &_gen_gradient_search_for_segment_code(<<"CODE"), final_pos = gimp_gradient_segment_set_${side}_pos (gradient, seg, pos); @@ -235,19 +231,24 @@ sub gradient_new { ); @outargs = ( - { name => 'name', type => 'string', - desc => 'The actual new gradient name', - alias => 'g_strdup (GIMP_OBJECT (data)->name)', no_declare => 1 }, + { name => 'actual_name', type => 'string', init => 1, + desc => 'The actual new gradient name' } ); %invoke = ( - vars => [ 'GimpData *data = NULL'], code => <<'CODE' { if (strlen (name)) - data = gimp_data_factory_data_new (gimp->gradient_factory, name); + { + GimpData *data = gimp_data_factory_data_new (gimp->gradient_factory, name); - success = (data != NULL); + if (data) + actual_name = g_strdup (GIMP_OBJECT (data)->name); + else + success = FALSE; + } + else + success = FALSE; } CODE ); @@ -265,27 +266,26 @@ sub gradient_duplicate { ); @outargs = ( - { name => 'name', type => 'string', - desc => "The name of the gradient's copy", - alias => 'g_strdup (GIMP_OBJECT (gradient_copy)->name)', - no_declare => 1 } + { name => 'copy_name', type => 'string', init => 1, + desc => "The name of the gradient's copy" } ); %invoke = ( - vars => [ 'GimpGradient *gradient = NULL', - 'GimpGradient *gradient_copy = NULL' ], code => <<"CODE" { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) { - gradient_copy = (GimpGradient *) + GimpGradient *gradient_copy = (GimpGradient *) gimp_data_factory_data_duplicate (gimp->gradient_factory, GIMP_DATA (gradient)); - success = (gradient_copy != NULL); + if (gradient_copy) + copy_name = g_strdup (GIMP_OBJECT (gradient_copy)->name); + else + success = FALSE; } else success = FALSE; @@ -306,21 +306,18 @@ sub gradient_is_editable { ); @outargs = ( - { name => 'editable', type => 'boolean', - desc => "True if the gradient can be edited", - alias => 'GIMP_DATA (gradient)->writable', - no_declare => 1 } + { name => 'editable', type => 'boolean', init => 1, + desc => "True if the gradient can be edited" } ); %invoke = ( - vars => [ 'GimpGradient *gradient = NULL' ], code => <<'CODE' { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) - success = TRUE; + editable = GIMP_DATA (gradient)->writable; else success = FALSE; } @@ -342,20 +339,21 @@ sub gradient_rename { ); @outargs = ( - { name => 'name', type => 'string', - desc => "The actual new name of the gradient", - alias => 'g_strdup (GIMP_OBJECT (gradient)->name)', no_declare => 1 } + { name => 'actual_name', type => 'string', init => 1, + desc => "The actual new name of the gradient" } ); %invoke = ( - vars => [ 'GimpGradient *gradient = NULL' ], code => <<"CODE" { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient && GIMP_DATA (gradient)->writable) - gimp_object_set_name (GIMP_OBJECT (gradient), new_name); + { + gimp_object_set_name (GIMP_OBJECT (gradient), new_name); + actual_name = g_strdup (GIMP_OBJECT (gradient)->name); + } else success = FALSE; } @@ -375,10 +373,9 @@ sub gradient_delete { ); %invoke = ( - vars => [ 'GimpGradient *gradient = NULL' ], code => <<"CODE" { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient && GIMP_DATA (gradient)->deletable) @@ -443,10 +440,9 @@ HELP &sample_outargs; %invoke = ( - vars => [ 'GimpGradient *gradient' ], code => <<'CODE' { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -510,10 +506,9 @@ HELP &sample_outargs; %invoke = ( - vars => [ 'GimpGradient *gradient' ], code => <<'CODE' { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) @@ -621,7 +616,6 @@ HELP ); %invoke = ( - vars => [ 'GimpGradient *gradient = NULL' ], code => &_gen_gradient_search_for_segment_code(<<"CODE"), blend_func = gimp_gradient_segment_get_blending_function (gradient, seg); @@ -654,7 +648,6 @@ HELP ); %invoke = ( - vars => [ 'GimpGradient *gradient = NULL' ], code => &_gen_gradient_search_for_segment_code(<<"CODE"), coloring_type = gimp_gradient_segment_get_coloring_type (gradient, seg); @@ -693,10 +686,9 @@ sub _gen_gradient_operate_on_segments_range $action_on_success =~ s/^$indent/' ' x 14/meg; %invoke = ( - vars => [ 'GimpGradient *gradient = NULL' ], code => <<"CODE", { - gradient = (GimpGradient *) + GimpGradient *gradient = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, name); if (gradient) diff --git a/tools/pdbgen/pdb/gradients.pdb b/tools/pdbgen/pdb/gradients.pdb index 2d1b85dba2..6c2647ec4c 100644 --- a/tools/pdbgen/pdb/gradients.pdb +++ b/tools/pdbgen/pdb/gradients.pdb @@ -183,20 +183,19 @@ sub gradients_get_gradient_data { ); @outargs = ( - { name => 'name', type => 'string', - desc => 'The gradient name', - alias => 'g_strdup (GIMP_OBJECT (gradient)->name)', no_declare => 1 }, + { name => 'actual_name', type => 'string', init => 1, + desc => 'The gradient name' }, { name => 'grad_data', type => 'floatarray', alias => 'values', desc => 'The gradient sample data', init => 1, - array => { name => 'width', - desc => 'The gradient sample width (r,g,b,a)', - alias => 'sample_size * 4', no_declare => 1 } } + array => { name => 'width', init => 1, + desc => 'The gradient sample width (r,g,b,a)' } } ); %invoke = ( - vars => [ 'GimpGradient *gradient = NULL' ], code => <<"CODE" { + GimpGradient *gradient; + if (name && strlen (name)) { gradient = (GimpGradient *) @@ -214,15 +213,17 @@ sub gradients_get_gradient_data { gdouble *pv; gdouble pos, delta; GimpRGB color; - gint i; - i = sample_size; pos = 0.0; - delta = 1.0 / (i - 1); + delta = 1.0 / (sample_size - 1); - pv = values = g_new (gdouble, i * 4); + actual_name = g_strdup (GIMP_OBJECT (gradient)->name); + values = g_new (gdouble, sample_size * 4); + width = sample_size * 4; - while (i--) + pv = values; + + while (sample_size) { seg = gimp_gradient_get_color_at (gradient, seg, pos, reverse, &color); diff --git a/tools/pdbgen/pdb/image.pdb b/tools/pdbgen/pdb/image.pdb index 4f5f99d017..d1278e3a82 100644 --- a/tools/pdbgen/pdb/image.pdb +++ b/tools/pdbgen/pdb/image.pdb @@ -1395,10 +1395,9 @@ CODE2 $outargs[0]->{init} = 1; %invoke = ( - vars => [ 'gchar *filename' ], code => <<'CODE2' { - filename = gimp_image_get_filename (gimage); + gchar *filename = gimp_image_get_filename (gimage); if (filename) name = g_filename_display_basename (filename); diff --git a/tools/pdbgen/pdb/palette.pdb b/tools/pdbgen/pdb/palette.pdb index 3319d6b4b4..7535a13cba 100644 --- a/tools/pdbgen/pdb/palette.pdb +++ b/tools/pdbgen/pdb/palette.pdb @@ -29,19 +29,24 @@ sub palette_new { ); @outargs = ( - { name => 'name', type => 'string', - desc => 'The actual new palette name', - alias => 'g_strdup (GIMP_OBJECT (data)->name)', no_declare => 1 }, + { name => 'actual_name', type => 'string', init => 1, + desc => 'The actual new palette name' } ); %invoke = ( - vars => [ 'GimpData *data = NULL'], code => <<'CODE' { if (strlen (name)) - data = gimp_data_factory_data_new (gimp->palette_factory, name); + { + GimpData *data = gimp_data_factory_data_new (gimp->palette_factory, name); - success = (data != NULL); + if (data) + actual_name = g_strdup (GIMP_OBJECT (data)->name); + else + success = FALSE; + } + else + success = FALSE; } CODE ); @@ -59,21 +64,18 @@ sub palette_is_editable { ); @outargs = ( - { name => 'editable', type => 'boolean', - desc => "True if the palette can be edited", - alias => 'GIMP_DATA (palette)->writable', - no_declare => 1 } + { name => 'editable', type => 'boolean', init => 1, + desc => "True if the palette can be edited" } ); %invoke = ( - vars => [ 'GimpPalette *palette = NULL' ], code => <<'CODE' { - palette = (GimpPalette *) + GimpPalette *palette = (GimpPalette *) gimp_container_get_child_by_name (gimp->palette_factory->container, name); if (palette) - success = TRUE; + editable = GIMP_DATA (palette)->writable; else success = FALSE; } @@ -93,14 +95,11 @@ sub palette_duplicate { ); @outargs = ( - { name => 'name', type => 'string', - desc => "The name of the palette's copy", - alias => 'g_strdup (GIMP_OBJECT (palette_copy)->name)', - no_declare => 1 } + { name => 'copy_name', type => 'string', init => 1, + desc => "The name of the palette's copy" } ); %invoke = ( - vars => [ 'GimpPalette *palette_copy = NULL' ], code => <<'CODE' { GimpPalette *palette = (GimpPalette *) @@ -108,11 +107,14 @@ sub palette_duplicate { if (palette) { - palette_copy = (GimpPalette *) + GimpPalette *palette_copy = (GimpPalette *) gimp_data_factory_data_duplicate (gimp->palette_factory, GIMP_DATA (palette)); - success = (palette_copy != NULL); + if (palette_copy) + copy_name = g_strdup (GIMP_OBJECT (palette_copy)->name); + else + success = FALSE; } else success = FALSE; @@ -135,20 +137,21 @@ sub palette_rename { ); @outargs = ( - { name => 'name', type => 'string', - desc => "The actual new name of the palette", - alias => 'g_strdup (GIMP_OBJECT (palette)->name)', no_declare => 1 }, + { name => 'actual_name', type => 'string', init => 1, + desc => "The actual new name of the palette" } ); %invoke = ( - vars => [ 'GimpPalette *palette = NULL' ], code => <<'CODE' { - palette = (GimpPalette *) + GimpPalette *palette = (GimpPalette *) gimp_container_get_child_by_name (gimp->palette_factory->container, name); if (palette && GIMP_DATA (palette)->writable) - gimp_object_set_name (GIMP_OBJECT (palette), new_name); + { + gimp_object_set_name (GIMP_OBJECT (palette), new_name); + actual_name = g_strdup (GIMP_OBJECT (palette)->name); + } else success = FALSE; } @@ -210,19 +213,20 @@ HELP ); @outargs = ( - { name => 'num_colors', type => 'int32', no_declare => '1', - alias => 'palette->n_colors', void_ret => '1', + { name => 'num_colors', type => 'int32', void_ret => '1', init => 1, desc => "The number of colors in the palette" } ); %invoke = ( - vars => [ 'GimpPalette *palette = NULL' ], code => <<'CODE' { - palette = (GimpPalette *) + GimpPalette *palette = (GimpPalette *) gimp_container_get_child_by_name (gimp->palette_factory->container, name); - success = (palette != NULL); + if (palette) + num_colors = palette->n_colors; + else + success = FALSE; } CODE ); @@ -243,19 +247,20 @@ HELP ); @outargs = ( - { name => 'num_columns', type => 'int32', no_declare => '0', - alias => 'palette->n_columns', + { name => 'num_columns', type => 'int32', init => 1, desc => "The number of columns used to display this palette" } ); %invoke = ( - vars => [ 'GimpPalette *palette = NULL' ], code => <<'CODE' { - palette = (GimpPalette *) + GimpPalette *palette = (GimpPalette *) gimp_container_get_child_by_name (gimp->palette_factory->container, name); - success = (palette != NULL); + if (palette) + num_columns = palette->n_columns; + else + success = FALSE; } CODE ); @@ -313,20 +318,23 @@ HELP ); @outargs = ( - { name => 'entry_num', type => 'int32', void_ret => '1', - alias => 'entry->position', no_declare => '1', + { name => 'entry_num', type => 'int32', void_ret => '1', init => 1, desc => 'The index of the added entry' } ); %invoke = ( - vars => [ 'GimpPaletteEntry *entry = NULL' ], code => <<'CODE' { GimpPalette *palette = (GimpPalette *) gimp_container_get_child_by_name (gimp->palette_factory->container, name); if (palette && GIMP_DATA (palette)->writable) - entry = gimp_palette_add_entry (palette, -1, entry_name, &color); + { + GimpPaletteEntry *entry = + gimp_palette_add_entry (palette, -1, entry_name, &color); + + entry_num = entry->position; + } else success = FALSE; } @@ -484,13 +492,11 @@ HELP ); @outargs = ( - { name => 'entry_name', type => 'string', void_ret => 1, - no_declare => '1', alias => 'g_strdup (entry->name)', + { name => 'entry_name', type => 'string', void_ret => 1, init => 1, desc => 'The name requested' } ); %invoke = ( - vars => [ 'GimpPaletteEntry *entry = NULL' ], code => <<'CODE' { GimpPalette *palette = (GimpPalette *) @@ -499,7 +505,11 @@ HELP if (palette) { if (entry_num >= 0 && entry_num < palette->n_colors) - entry = g_list_nth_data (palette->colors, entry_num); + { + GimpPaletteEntry *entry = g_list_nth_data (palette->colors, entry_num); + + entry_name = g_strdup (entry->name); + } else success = FALSE; } diff --git a/tools/pdbgen/pdb/palettes.pdb b/tools/pdbgen/pdb/palettes.pdb index 62d4601946..0a43dd9ade 100644 --- a/tools/pdbgen/pdb/palettes.pdb +++ b/tools/pdbgen/pdb/palettes.pdb @@ -65,17 +65,26 @@ sub palettes_get_palette { &std_pdb_deprecated ('gimp-context-get-palette'); @outargs = ( - { name => 'name', type => 'string', no_declare => 1, - desc => 'The palette name', null_ok => '1', - alias => 'g_strdup (GIMP_OBJECT (palette)->name)' }, - { name => 'num_colors', type => 'int32', no_declare => 1, - desc => 'The palette num_colors', - alias => 'palette->n_colors' } + { name => 'name', type => 'string', init => 1, + desc => 'The palette name', null_ok => '1' }, + { name => 'num_colors', type => 'int32', init => 1, + desc => 'The palette num_colors' } ); %invoke = ( - vars => [ 'GimpPalette *palette' ], - code => 'success = (palette = gimp_context_get_palette (context)) != NULL;' + code => <<'CODE' +{ + GimpPalette *palette = gimp_context_get_palette (context); + + if (palette) + { + name = g_strdup (GIMP_OBJECT (palette)->name); + num_colors = palette->n_colors; + } + else + success = FALSE; +} +CODE ); } @@ -91,20 +100,19 @@ sub palettes_get_palette_entry { ); @outargs = ( - { name => 'name', type => 'string', no_declare => 1, - desc => 'The palette name', null_ok => '1', - alias => 'g_strdup (GIMP_OBJECT (palette)->name)' }, - { name => 'num_colors', type => 'int32', no_declare => 1, - desc => 'The palette num_colors', - alias => 'palette->n_colors' }, + { name => 'actual_name', type => 'string', init => 1, + desc => 'The palette name' }, + { name => 'num_colors', type => 'int32', init => 1, + desc => 'The palette num_colors' }, { name => 'color', type => 'color', void_ret => 1, desc => 'The color requested' } ); %invoke = ( - vars => [ 'GimpPalette *palette = NULL' ], code => <<"CODE" { + GimpPalette *palette; + if (name && strlen (name)) { palette = (GimpPalette *) @@ -118,19 +126,16 @@ sub palettes_get_palette_entry { if (palette) { - if (entry_num < 0 || entry_num >= palette->n_colors) + if (entry_num >= 0 && entry_num < palette->n_colors) { - success = FALSE; + GimpPaletteEntry *entry = g_list_nth_data (palette->colors, entry_num); + + actual_name = g_strdup (GIMP_OBJECT (palette)->name); + num_colors = palette->n_colors; + color = entry->color; } else - { - GimpPaletteEntry *entry; - - entry = (GimpPaletteEntry *) - g_list_nth_data (palette->colors, entry_num); - - color = entry->color; - } + success = FALSE; } else success = FALSE; diff --git a/tools/pdbgen/pdb/paths.pdb b/tools/pdbgen/pdb/paths.pdb index e879883338..0ac1a17389 100644 --- a/tools/pdbgen/pdb/paths.pdb +++ b/tools/pdbgen/pdb/paths.pdb @@ -80,10 +80,9 @@ HELP ); %invoke = ( - vars => [ 'GimpVectors *vectors' ], code => <<'CODE' { - vectors = gimp_image_get_vectors_by_name (gimage, name); + GimpVectors *vectors = gimp_image_get_vectors_by_name (gimage, name); if (vectors) { diff --git a/tools/pdbgen/pdb/pattern.pdb b/tools/pdbgen/pdb/pattern.pdb index dfc5922157..c814efb5a1 100644 --- a/tools/pdbgen/pdb/pattern.pdb +++ b/tools/pdbgen/pdb/pattern.pdb @@ -33,25 +33,28 @@ HELP ); @outargs = ( - { name => 'width', type => 'int32', no_declare => '1', - alias => 'pattern->mask->width', void_ret => '1', + { name => 'width', type => 'int32', init => 1, void_ret => '1', desc => "The pattern width" }, - { name => 'height', type => 'int32', no_declare => '1', - alias => 'pattern->mask->height', + { name => 'height', type => 'int32', init => 1, desc => "The pattern height" }, - { name => 'bpp', type => 'int32', no_declare => '1', - alias => 'pattern->mask->bytes', + { name => 'bpp', type => 'int32', init => 1, desc => "The pattern bpp" } ); %invoke = ( - vars => [ 'GimpPattern *pattern = NULL' ], code => <<'CODE' { - pattern = (GimpPattern *) + GimpPattern *pattern = (GimpPattern *) gimp_container_get_child_by_name (gimp->pattern_factory->container, name); - success = (pattern != NULL); + if (pattern) + { + width = pattern->mask->width; + height = pattern->mask->height; + bpp = pattern->mask->bytes; + } + else + success = FALSE; } CODE ); @@ -76,14 +79,11 @@ HELP ); @outargs = ( - { name => 'width', type => 'int32', no_declare => '1', - alias => 'pattern->mask->width', void_ret => '1', + { name => 'width', type => 'int32', init => 1, void_ret => '1', desc => "The pattern width" }, - { name => 'height', type => 'int32', no_declare => '1', - alias => 'pattern->mask->height', + { name => 'height', type => 'int32', init => 1, desc => "The pattern height" }, - { name => 'bpp', type => 'int32', no_declare => '1', - alias => 'pattern->mask->bytes', + { name => 'bpp', type => 'int32', init => 1, desc => "The pattern bpp" }, { name => 'color_bytes', type => 'int8array', init => 1, desc => 'The pattern data.', @@ -92,14 +92,16 @@ HELP ); %invoke = ( - vars => [ 'GimpPattern *pattern = NULL' ], code => <<'CODE' { - pattern = (GimpPattern *) + GimpPattern *pattern = (GimpPattern *) gimp_container_get_child_by_name (gimp->pattern_factory->container, name); if (pattern) { + width = pattern->mask->width; + height = pattern->mask->height; + bpp = pattern->mask->bytes; num_color_bytes = pattern->mask->height * pattern->mask->width * pattern->mask->bytes; color_bytes = g_memdup (temp_buf_data (pattern->mask), diff --git a/tools/pdbgen/pdb/patterns.pdb b/tools/pdbgen/pdb/patterns.pdb index 6af5114f1e..682b9e209d 100644 --- a/tools/pdbgen/pdb/patterns.pdb +++ b/tools/pdbgen/pdb/patterns.pdb @@ -65,20 +65,29 @@ sub patterns_get_pattern { &std_pdb_deprecated ('gimp-context-get-pattern'); @outargs = ( - { name => 'name', type => 'string', no_declare => 1, - desc => 'The pattern name', - alias =>'g_strdup (GIMP_OBJECT (pattern)->name)' }, - { name => 'width', type => 'int32', no_declare => 1, - desc => 'The pattern width', - alias => 'pattern->mask->width' }, - { name => 'height', type => 'int32', no_declare => 1, - desc => 'The pattern height', - alias => 'pattern->mask->height' } + { name => 'name', type => 'string', init => 1, + desc => 'The pattern name' }, + { name => 'width', type => 'int32', init => 1, + desc => 'The pattern width' }, + { name => 'height', type => 'int32', init => 1, + desc => 'The pattern height' } ); %invoke = ( - vars => [ 'GimpPattern *pattern' ], - code => 'success = (pattern = gimp_context_get_pattern (context)) != NULL;' + code =><<'CODE' +{ + GimpPattern *pattern = gimp_context_get_pattern (context); + + if (pattern) + { + name = g_strdup (GIMP_OBJECT (pattern)->name); + width = pattern->mask->width; + height = pattern->mask->height; + } + else + success = FALSE; +} +CODE ); } @@ -92,18 +101,14 @@ sub patterns_get_pattern_data { ); @outargs = ( - { name => 'name', type => 'string', no_declare => 1, - desc => 'The pattern name', - alias =>'g_strdup (GIMP_OBJECT (pattern)->name)' }, - { name => 'width', type => 'int32', no_declare => 1, - desc => 'The pattern width', - alias => 'pattern->mask->width' }, - { name => 'height', type => 'int32', no_declare => 1, - desc => 'The pattern height', - alias => 'pattern->mask->height' }, + { name => 'actual_name', type => 'string', init => 1, + desc => 'The pattern name' }, + { name => 'width', type => 'int32', init => 1, + desc => 'The pattern width' }, + { name => 'height', type => 'int32', init => 1, + desc => 'The pattern height' }, { name => 'mask_bpp', type => 'int32', init => 1, - desc => 'Pattern bytes per pixel', - alias => 'pattern->mask->bytes', no_declare => 1 }, + desc => 'Pattern bytes per pixel' }, { name => 'mask_data', type => 'int8array', init => 1, desc => 'The pattern mask data', array => { name => 'length', init => 1, @@ -111,9 +116,10 @@ sub patterns_get_pattern_data { ); %invoke = ( - vars => [ 'GimpPattern *pattern = NULL' ], code => <<'CODE' { + GimpPattern *pattern; + if (name && strlen (name)) { pattern = (GimpPattern *) @@ -127,9 +133,13 @@ sub patterns_get_pattern_data { if (pattern) { - length = pattern->mask->height * pattern->mask->width * - pattern->mask->bytes; - mask_data = g_memdup (temp_buf_data (pattern->mask), length); + actual_name = g_strdup (GIMP_OBJECT (pattern)->name); + width = pattern->mask->width; + height = pattern->mask->height; + mask_bpp = pattern->mask->bytes; + length = pattern->mask->height * pattern->mask->width * + pattern->mask->bytes; + mask_data = g_memdup (temp_buf_data (pattern->mask), length); } else success = FALSE; diff --git a/tools/pdbgen/pdb/procedural_db.pdb b/tools/pdbgen/pdb/procedural_db.pdb index 228aa6ddb6..4df302e576 100644 --- a/tools/pdbgen/pdb/procedural_db.pdb +++ b/tools/pdbgen/pdb/procedural_db.pdb @@ -41,22 +41,20 @@ HELP ); @outargs = ( - { name => "${type}_type", type => 'enum GimpPDBArgType (no GIMP_PDB_END)', - desc => "The type of $long_type { %%desc%% }", void_ret => 1, - alias => "${type}->arg_type", no_declare => 1 }, - { name => "${type}_name", type => 'string', - desc => "The name of the $long_type", - alias => "g_strdup (${type}->name)", no_declare => 1 }, - { name => "${type}_desc", type => 'string', - desc => "A description of the $long_type", - alias => "g_strdup (${type}->description)", no_declare => 1 } + { name => "${type}_type", + type => 'enum GimpPDBArgType (no GIMP_PDB_END)', init => 1, + desc => "The type of $long_type { %%desc%% }", void_ret => 1 }, + { name => "${type}_name", type => 'string', init => 1, + desc => "The name of the $long_type" }, + { name => "${type}_desc", type => 'string', init => 1, + desc => "A description of the $long_type" } ); %invoke = ( - vars => [ 'ProcRecord *proc', "ProcArg *$type = NULL" ], code => <= 0 && ${type}_num < proc->num_$real_type)) - $type = \&proc->${real_type}\[${type}_num]; + { + ProcArg *$type = \&proc->${real_type}\[${type}_num]; + + ${type}_type = ${type}->arg_type; + ${type}_name = g_strdup (${type}->name); + ${type}_desc = g_strdup (${type}->description); + } else success = FALSE; } @@ -161,33 +165,39 @@ HELP &std_pdb_misc; - foreach (qw(name blurb help author copyright date proc_type)) { - push @inargs, { name => $_, type => 'string', no_validate => 1, - desc => "The regex for procedure $_" }; - } - - $inargs[$#inargs]->{desc} =~ - s - ; + @inargs = ( + { name => 'name', type => 'string', no_validate => 1, + desc => 'The regex for procedure name' }, + { name => 'blurb', type => 'string', no_validate => 1, + desc => 'The regex for procedure blurb' }, + { name => 'help', type => 'string', no_validate => 1, + desc => 'The regex for procedure help' }, + { name => 'author', type => 'string', no_validate => 1, + desc => 'The regex for procedure author' }, + { name => 'copyright', type => 'string', no_validate => 1, + desc => 'The regex for procedure copyright' }, + { name => 'date', type => 'string', no_validate => 1, + desc => 'The regex for procedure date' }, + { name => 'proc_type', type => 'string', no_validate => 1, + desc => 'The regex for procedure type: { \'Internal GIMP procedure\', + \'GIMP Plug-In\', \'GIMP Extension\', + \'Temporary Procedure\' }' } + ); @outargs = ( { name => 'procedure_names', type => 'stringarray', void_ret => 1, - desc => 'The list of procedure names', - alias => 'procs', no_declare => 1, - array => { name => 'num_matches', - desc => 'The number of matching procedures', - alias => 'num_procs', no_declare => 1 } - } + desc => 'The list of procedure names', init => 1, + array => { name => 'num_matches', init => 1, + desc => 'The number of matching procedures' } } ); %invoke = ( - vars => [ 'gint num_procs', 'gchar **procs' ], code => < "$_$pos", type => 'float', desc => "The new $_ coordinate of $where corner of original - bounding box", - alias => "trans_info[\U$_\E$pos]", no_declare => 1 } + bounding box" } } $pos++; } @@ -78,7 +77,6 @@ sub perspective { ); %invoke = ( - vars => [ 'gdouble trans_info[8]' ], code => <<'CODE' { gint x, y, width, height; @@ -95,10 +93,10 @@ sub perspective { gimp_matrix3_identity (&matrix); gimp_transform_matrix_perspective (&matrix, x, y, width, height, - trans_info[X0], trans_info[Y0], - trans_info[X1], trans_info[Y1], - trans_info[X2], trans_info[Y2], - trans_info[X3], trans_info[Y3]); + x0, y0, + x1, y1, + x2, y2, + x3, y3); if (interpolation) interpolation_type = gimp->config->interpolation_type; @@ -187,20 +185,16 @@ sub scale { desc => 'Whether to use interpolation' }, { name => 'x0', type => 'float', desc => 'The new x coordinate of the upper-left corner of the - scaled region', - alias => 'trans_info[X0]', no_declare => 1 }, + scaled region' }, { name => 'y0', type => 'float', desc => 'The new y coordinate of the upper-left corner of the - scaled region', - alias => 'trans_info[Y0]', no_declare => 1 }, + scaled region' }, { name => 'x1', type => 'float', desc => 'The new x coordinate of the lower-right corner of the - scaled region', - alias => 'trans_info[X1]', no_declare => 1 }, + scaled region' }, { name => 'y1', type => 'float', desc => 'The new y coordinate of the lower-right corner of the - scaled region', - alias => 'trans_info[Y1]', no_declare => 1 } + scaled region' } ); @outargs = ( @@ -209,14 +203,12 @@ sub scale { ); %invoke = ( - vars => [ 'gdouble trans_info[4]' ], code => <<'CODE' { gint x, y, width, height; success = (gimp_item_is_attached (GIMP_ITEM (drawable)) && - trans_info[X0] < trans_info[X1] && - trans_info[Y0] < trans_info[Y1]); + x0 < x1 && y0 < y1); if (success && gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height)) @@ -228,10 +220,9 @@ sub scale { gimp_matrix3_identity (&matrix); gimp_transform_matrix_scale (&matrix, x, y, width, height, - trans_info[X0], - trans_info[Y0], - trans_info[X1] - trans_info[X0], - trans_info[Y1] - trans_info[Y0]); + x0, y0, + x1 - x0, + y1 - y0); if (interpolation) interpolation_type = gimp->config->interpolation_type;