[gimp] app: Fix pdb properly this time



commit 1a8edd7d1da2fb59e265c7dce3f25d9470c75e74
Author: Alexia Death <alexiadeath gmail com>
Date:   Sat Mar 19 17:12:14 2011 +0200

    app: Fix pdb properly this time

 app/pdb/paint-tools-cmds.c       |   94 ++++++++--------
 tools/pdbgen/pdb/paint_tools.pdb |  226 +++++++++++++++++++++++++++++++++++++-
 2 files changed, 270 insertions(+), 50 deletions(-)
---
diff --git a/app/pdb/paint-tools-cmds.c b/app/pdb/paint-tools-cmds.c
index 1e2195d..7b2bd5b 100644
--- a/app/pdb/paint-tools-cmds.c
+++ b/app/pdb/paint-tools-cmds.c
@@ -28,7 +28,6 @@
 #include "core/gimpbrush.h"
 #include "core/gimpdrawable.h"
 #include "core/gimpdynamics.h"
-#include "core/gimpdynamicsoutput.h"
 #include "core/gimppaintinfo.h"
 #include "core/gimpparamspecs.h"
 #include "paint/gimppaintcore-stroke.h"
@@ -129,9 +128,9 @@ airbrush_invoker (GimpProcedure      *procedure,
           gint height;
           gint width;
 
-          gimp_brush_transform_size(brush, 1.0, 1.0, 0.0, &height, &width);
+          gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
 
-          brush_size = MAX(height, width);
+          brush_size = MAX (height, width);
 
           g_object_set (options,
                         "brush-size", brush_size,
@@ -182,9 +181,9 @@ airbrush_default_invoker (GimpProcedure      *procedure,
           gint height;
           gint width;
 
-          gimp_brush_transform_size(brush, 1.0, 1.0, 0.0, &height, &width);
+          gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
 
-          brush_size = MAX(height, width);
+          brush_size = MAX (height, width);
 
           g_object_set (options,
                         "brush-size", brush_size,
@@ -242,9 +241,9 @@ clone_invoker (GimpProcedure      *procedure,
           gint height;
           gint width;
 
-          gimp_brush_transform_size(brush, 1.0, 1.0, 0.0, &height, &width);
+          gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
 
-          brush_size = MAX(height, width);
+          brush_size = MAX (height, width);
 
           g_object_set (options,
                         "brush-size", brush_size,
@@ -298,9 +297,9 @@ clone_default_invoker (GimpProcedure      *procedure,
           gint height;
           gint width;
 
-          gimp_brush_transform_size(brush, 1.0, 1.0, 0.0, &height, &width);
+          gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
 
-          brush_size = MAX(height, width);
+          brush_size = MAX (height, width);
 
           g_object_set (options,
                         "brush-size", brush_size,
@@ -354,14 +353,14 @@ convolve_invoker (GimpProcedure      *procedure,
           gint height;
           gint width;
 
-          gimp_brush_transform_size(brush, 1.0, 1.0, 0.0, &height, &width);
+          gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
 
-          brush_size = MAX(height, width);
+          brush_size = MAX (height, width);
 
           g_object_set (options,
                         "brush-size", brush_size,
-                        "type",       convolve_type,
-                        "rate",       pressure,
+                        "type", convolve_type,
+                        "rate", pressure,
                         NULL);
 
           success = paint_tools_stroke (gimp, context, options, drawable,
@@ -408,9 +407,9 @@ convolve_default_invoker (GimpProcedure      *procedure,
           gint height;
           gint width;
 
-          gimp_brush_transform_size(brush, 1.0, 1.0, 0.0, &height, &width);
+          gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
 
-          brush_size = MAX(height, width);
+          brush_size = MAX (height, width);
 
           g_object_set (options,
                         "brush-size", brush_size,
@@ -466,15 +465,18 @@ dodgeburn_invoker (GimpProcedure      *procedure,
           gint height;
           gint width;
 
-          gimp_brush_transform_size(brush, 1.0, 1.0, 0.0, &height, &width);
+          gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
 
-          brush_size = MAX(height, width);
+          brush_size = MAX (height, width);
 
           g_object_set (options,
                         "brush-size", brush_size,
-                        "type",       dodgeburn_type,
-                        "mode",       dodgeburn_mode,
-                        "exposure",   exposure,
+                        NULL);
+
+          g_object_set (options,
+                        "type",     dodgeburn_type,
+                        "mode",     dodgeburn_mode,
+                        "exposure", exposure,
                         NULL);
 
           success = paint_tools_stroke (gimp, context, options, drawable,
@@ -521,9 +523,9 @@ dodgeburn_default_invoker (GimpProcedure      *procedure,
           gint height;
           gint width;
 
-          gimp_brush_transform_size(brush, 1.0, 1.0, 0.0, &height, &width);
+          gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
 
-          brush_size = MAX(height, width);
+          brush_size = MAX (height, width);
 
           g_object_set (options,
                         "brush-size", brush_size,
@@ -577,9 +579,9 @@ eraser_invoker (GimpProcedure      *procedure,
           gint height;
           gint width;
 
-          gimp_brush_transform_size(brush, 1.0, 1.0, 0.0, &height, &width);
+          gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
 
-          brush_size = MAX(height, width);
+          brush_size = MAX (height, width);
 
           g_object_set (options,
                         "brush-size",       brush_size,
@@ -631,9 +633,9 @@ eraser_default_invoker (GimpProcedure      *procedure,
           gint height;
           gint width;
 
-          gimp_brush_transform_size(brush, 1.0, 1.0, 0.0, &height, &width);
+          gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
 
-          brush_size = MAX(height, width);
+          brush_size = MAX (height, width);
 
           g_object_set (options,
                         "brush-size", brush_size,
@@ -689,9 +691,9 @@ heal_invoker (GimpProcedure      *procedure,
           gint height;
           gint width;
 
-          gimp_brush_transform_size(brush, 1.0, 1.0, 0.0, &height, &width);
+          gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
 
-          brush_size = MAX(height, width);
+          brush_size = MAX (height, width);
 
           g_object_set (options,
                         "brush-size", brush_size,
@@ -744,9 +746,9 @@ heal_default_invoker (GimpProcedure      *procedure,
           gint height;
           gint width;
 
-          gimp_brush_transform_size(brush, 1.0, 1.0, 0.0, &height, &width);
+          gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
 
-          brush_size = MAX(height, width);
+          brush_size = MAX (height, width);
 
           g_object_set (options,
                         "brush-size", brush_size,
@@ -804,9 +806,9 @@ paintbrush_invoker (GimpProcedure      *procedure,
           gint height;
           gint width;
 
-          gimp_brush_transform_size(brush, 1.0, 1.0, 0.0, &height, &width);
+          gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
 
-          brush_size = MAX(height, width);
+          brush_size = MAX (height, width);
 
           g_object_set (options,
                         "brush-size",       brush_size,
@@ -816,17 +818,18 @@ paintbrush_invoker (GimpProcedure      *procedure,
 
           if (fade_out > 0)
             {
-              GimpDynamicsOutput *opacity_output = gimp_dynamics_get_output(pcb_dynamics,
-                                                                            GIMP_DYNAMICS_OUTPUT_OPACITY);
-              g_object_set (opacity_output,
-                            "use-fade", TRUE,
-                            NULL);
+               GimpDynamicsOutput *opacity_output = gimp_dynamics_get_output(pcb_dynamics,
+                                                                             GIMP_DYNAMICS_OUTPUT_OPACITY);
+               g_object_set (opacity_output,
+                             "use-fade", TRUE,
+                             NULL);
             }
 
           if (gradient_length > 0)
             {
               GimpDynamicsOutput *color_output = gimp_dynamics_get_output(pcb_dynamics,
                                                                           GIMP_DYNAMICS_OUTPUT_COLOR);
+
               g_object_set (color_output,
                             "use-fade", TRUE,
                             NULL);
@@ -880,9 +883,9 @@ paintbrush_default_invoker (GimpProcedure      *procedure,
           gint height;
           gint width;
 
-          gimp_brush_transform_size(brush, 1.0, 1.0, 0.0, &height, &width);
+          gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
 
-          brush_size = MAX(height, width);
+          brush_size = MAX (height, width);
 
           g_object_set (options,
                         "brush-size", brush_size,
@@ -932,14 +935,13 @@ pencil_invoker (GimpProcedure      *procedure,
           gint height;
           gint width;
 
-          gimp_brush_transform_size(brush, 1.0, 1.0, 0.0, &height, &width);
+          gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
 
-          brush_size = MAX(height, width);
+          brush_size = MAX (height, width);
 
           g_object_set (options,
                         "brush-size", brush_size,
                         NULL);
-
           success = paint_tools_stroke (gimp, context, options, drawable,
                                         num_strokes, strokes, error,
                                         "undo-desc", info->blurb,
@@ -986,9 +988,9 @@ smudge_invoker (GimpProcedure      *procedure,
           gint height;
           gint width;
 
-          gimp_brush_transform_size(brush, 1.0, 1.0, 0.0, &height, &width);
+          gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
 
-          brush_size = MAX(height, width);
+          brush_size = MAX (height, width);
 
           g_object_set (options,
                         "brush-size", brush_size,
@@ -1039,9 +1041,9 @@ smudge_default_invoker (GimpProcedure      *procedure,
           gint height;
           gint width;
 
-          gimp_brush_transform_size(brush, 1.0, 1.0, 0.0, &height, &width);
+          gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
 
-          brush_size = MAX(height, width);
+          brush_size = MAX (height, width);
 
           g_object_set (options,
                         "brush-size", brush_size,
diff --git a/tools/pdbgen/pdb/paint_tools.pdb b/tools/pdbgen/pdb/paint_tools.pdb
index 486ad17..e583704 100644
--- a/tools/pdbgen/pdb/paint_tools.pdb
+++ b/tools/pdbgen/pdb/paint_tools.pdb
@@ -59,8 +59,17 @@ HELP
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
+      GimpBrush        *brush   = gimp_context_get_brush (context);
+      gdouble brush_size;
+      gint height;
+      gint width;
+
+      gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
+
+      brush_size = MAX (height, width);
 
       g_object_set (options,
+                    "brush-size", brush_size,
                     "pressure", pressure,
                     NULL);
 
@@ -106,6 +115,18 @@ HELP
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
+      GimpBrush        *brush   = gimp_context_get_brush (context);
+      gdouble brush_size;
+      gint height;
+      gint width;
+
+      gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
+
+      brush_size = MAX (height, width);
+
+      g_object_set (options,
+                    "brush-size", brush_size,
+                    NULL);
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
@@ -164,8 +185,17 @@ HELP
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
+      GimpBrush        *brush   = gimp_context_get_brush (context);
+      gdouble brush_size;
+      gint height;
+      gint width;
+
+      gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
+
+      brush_size = MAX (height, width);
 
       g_object_set (options,
+                    "brush-size", brush_size,
                     "clone-type", clone_type,
                     NULL);
 
@@ -215,6 +245,18 @@ HELP
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
+      GimpBrush        *brush   = gimp_context_get_brush (context);
+      gdouble brush_size;
+      gint height;
+      gint width;
+
+      gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
+
+      brush_size = MAX (height, width);
+
+      g_object_set (options,
+                    "brush-size", brush_size,
+                    NULL);
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
@@ -258,6 +300,18 @@ HELP
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
+      GimpBrush        *brush   = gimp_context_get_brush (context);
+      gdouble brush_size;
+      gint height;
+      gint width;
+
+      gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
+
+      brush_size = MAX (height, width);
+
+      g_object_set (options,
+                    "brush-size", brush_size,
+                    NULL);
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
@@ -303,8 +357,17 @@ HELP
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
+      GimpBrush        *brush   = gimp_context_get_brush (context);
+      gdouble brush_size;
+      gint height;
+      gint width;
+
+      gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
+
+      brush_size = MAX (height, width);
 
       g_object_set (options,
+                    "brush-size", brush_size,
                     "type", convolve_type,
                     "rate", pressure,
                     NULL);
@@ -349,6 +412,18 @@ HELP
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
+      GimpBrush        *brush   = gimp_context_get_brush (context);
+      gdouble brush_size;
+      gint height;
+      gint width;
+
+      gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
+
+      brush_size = MAX (height, width);
+
+      g_object_set (options,
+                    "brush-size", brush_size,
+                    NULL);
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
@@ -395,8 +470,17 @@ HELP
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
+      GimpBrush        *brush   = gimp_context_get_brush (context);
+      gdouble brush_size;
+      gint height;
+      gint width;
+
+      gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
+
+      brush_size = MAX (height, width);
 
       g_object_set (options,
+                    "brush-size",       brush_size,
                     "application-mode", method,
                     "hard",             hardness,
                     NULL);
@@ -446,8 +530,17 @@ HELP
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
+      GimpBrush        *brush   = gimp_context_get_brush (context);
+      gdouble brush_size;
+      gint height;
+      gint width;
+
+      gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
+
+      brush_size = MAX (height, width);
 
       g_object_set (options,
+                    "brush-size",       brush_size,
                     "application-mode", method,
                     "hard",             hardness,
                     "anti-erase",       TRUE,
@@ -502,6 +595,18 @@ HELP
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
+      GimpBrush        *brush   = gimp_context_get_brush (context);
+      gdouble brush_size;
+      gint height;
+      gint width;
+
+      gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
+
+      brush_size = MAX (height, width);
+
+      g_object_set (options,
+                    "brush-size", brush_size,
+                    NULL);
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
@@ -549,6 +654,18 @@ HELP
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
+      GimpBrush        *brush   = gimp_context_get_brush (context);
+      gdouble brush_size;
+      gint height;
+      gint width;
+
+      gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
+
+      brush_size = MAX (height, width);
+
+      g_object_set (options,
+                    "brush-size", brush_size,
+                    NULL);
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
@@ -603,19 +720,50 @@ HELP
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
+      GimpDynamics     *pcb_dynamics = GIMP_DYNAMICS(gimp_dynamics_new(context, "pcb"));
+      GimpDynamics     *user_dynamics = gimp_context_get_dynamics(context);
+      GimpBrush        *brush   = gimp_context_get_brush (context);
+      gdouble brush_size;
+      gint height;
+      gint width;
+
+      gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
+
+      brush_size = MAX (height, width);
 
       g_object_set (options,
+                    "brush-size",       brush_size,
                     "application-mode", method,
-                    "use-fade",         fade_out > 0.0,
-                    "fade-length",      fade_out,
-                    "use-gradient",     gradient_length > 0.0,
-                    "gradient-length",  gradient_length,
+                    "fade-length",      MAX(fade_out, gradient_length),
                     NULL);
 
+      if (fade_out > 0)
+        {
+           GimpDynamicsOutput *opacity_output = gimp_dynamics_get_output(pcb_dynamics,
+                                                                         GIMP_DYNAMICS_OUTPUT_OPACITY);
+           g_object_set (opacity_output,
+                         "use-fade", TRUE,
+                         NULL);
+        }
+
+      if (gradient_length > 0)
+        {
+          GimpDynamicsOutput *color_output = gimp_dynamics_get_output(pcb_dynamics,
+                                                                      GIMP_DYNAMICS_OUTPUT_COLOR);
+
+          g_object_set (color_output,
+                        "use-fade", TRUE,
+                        NULL);
+        }
+
+      gimp_context_set_dynamics (context, pcb_dynamics);
+
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
 				    "undo-desc", info->blurb,
 				    NULL);
+
+      gimp_context_set_dynamics (context, user_dynamics);
     }
   else
     success = FALSE;
@@ -662,6 +810,18 @@ HELP
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
+      GimpBrush        *brush   = gimp_context_get_brush (context);
+      gdouble brush_size;
+      gint height;
+      gint width;
+
+      gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
+
+      brush_size = MAX (height, width);
+
+      g_object_set (options,
+                    "brush-size", brush_size,
+                    NULL);
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
@@ -704,7 +864,18 @@ HELP
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
+      GimpBrush        *brush   = gimp_context_get_brush (context);
+      gdouble brush_size;
+      gint height;
+      gint width;
+
+      gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
 
+      brush_size = MAX (height, width);
+
+      g_object_set (options,
+                    "brush-size", brush_size,
+                    NULL);
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
 				    "undo-desc", info->blurb,
@@ -745,8 +916,17 @@ HELP
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
+      GimpBrush        *brush   = gimp_context_get_brush (context);
+      gdouble brush_size;
+      gint height;
+      gint width;
+
+      gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
+
+      brush_size = MAX (height, width);
 
       g_object_set (options,
+                    "brush-size", brush_size,
                     "rate", pressure,
                     NULL);
 
@@ -792,6 +972,18 @@ HELP
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
+      GimpBrush        *brush   = gimp_context_get_brush (context);
+      gdouble brush_size;
+      gint height;
+      gint width;
+
+      gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
+
+      brush_size = MAX (height, width);
+
+      g_object_set (options,
+                    "brush-size", brush_size,
+                    NULL);
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
@@ -838,6 +1030,18 @@ HELP
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
+      GimpBrush        *brush   = gimp_context_get_brush (context);
+      gdouble brush_size;
+      gint height;
+      gint width;
+
+      gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
+
+      brush_size = MAX (height, width);
+
+      g_object_set (options,
+                    "brush-size", brush_size,
+                    NULL);
 
       g_object_set (options,
                     "type",     dodgeburn_type,
@@ -887,6 +1091,18 @@ HELP
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
       GimpPaintOptions *options = gimp_paint_options_new (info);
+      GimpBrush        *brush   = gimp_context_get_brush (context);
+      gdouble brush_size;
+      gint height;
+      gint width;
+
+      gimp_brush_transform_size (brush, 1.0, 1.0, 0.0, &height, &width);
+
+      brush_size = MAX (height, width);
+
+      g_object_set (options,
+                    "brush-size", brush_size,
+                    NULL);
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
@@ -977,6 +1193,8 @@ CODE
 
 
 @headers = qw("libgimpmath/gimpmath.h"
+              "core/gimpbrush.h"
+              "core/gimpdynamics.h"
               "core/gimppaintinfo.h"
               "paint/gimppaintcore.h"
               "paint/gimppaintcore-stroke.h"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]