[gimp] pdb: use the newly added GimpPDBContext paint options for painting



commit 6ee7b221533ba4d35a6b94af26693dfa8b1831a8
Author: Michael Natterer <mitch gimp org>
Date:   Mon Oct 31 22:08:53 2011 +0100

    pdb: use the newly added GimpPDBContext paint options for painting
    
    so all paint context settings take part in the push/pop logic.

 app/pdb/paint-tools-cmds.c       |  188 ++++++++++++++++++++-------------
 tools/pdbgen/pdb/paint_tools.pdb |  215 +++++++++++++++++++++-----------------
 2 files changed, 234 insertions(+), 169 deletions(-)
---
diff --git a/app/pdb/paint-tools-cmds.c b/app/pdb/paint-tools-cmds.c
index e78367f..99faf15 100644
--- a/app/pdb/paint-tools-cmds.c
+++ b/app/pdb/paint-tools-cmds.c
@@ -21,6 +21,7 @@
 
 #include <gegl.h>
 
+#include "libgimpconfig/gimpconfig.h"
 #include "libgimpmath/gimpmath.h"
 
 #include "pdb-types.h"
@@ -36,6 +37,7 @@
 
 #include "gimppdb.h"
 #include "gimppdb-utils.h"
+#include "gimppdbcontext.h"
 #include "gimpprocedure.h"
 #include "internal-procs.h"
 
@@ -127,13 +129,15 @@ airbrush_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-airbrush", error);
+      GimpPaintOptions *options =
+        gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                            "gimp-airbrush");
 
-      if (info &&
+      if (options &&
           gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
           gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
         {
-          GimpPaintOptions *options = gimp_paint_options_new (info);
+          options = gimp_config_duplicate (GIMP_CONFIG (options));
 
           g_object_set (options,
                         "pressure", pressure,
@@ -141,7 +145,7 @@ airbrush_invoker (GimpProcedure      *procedure,
 
           success = paint_tools_stroke (gimp, context, options, drawable,
                                         num_strokes, strokes, error,
-                                        "undo-desc", info->blurb,
+                                        "undo-desc", options->paint_info->blurb,
                                         NULL);
         }
       else
@@ -171,17 +175,19 @@ airbrush_default_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-airbrush", error);
+      GimpPaintOptions *options =
+        gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                            "gimp-airbrush");
 
-      if (info &&
+      if (options &&
           gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
           gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
         {
-          GimpPaintOptions *options = gimp_paint_options_new (info);
+          options = gimp_config_duplicate (GIMP_CONFIG (options));
 
           success = paint_tools_stroke (gimp, context, options, drawable,
                                         num_strokes, strokes, error,
-                                        "undo-desc", info->blurb,
+                                        "undo-desc", options->paint_info->blurb,
                                         NULL);
         }
       else
@@ -219,13 +225,15 @@ clone_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-clone", error);
+      GimpPaintOptions *options =
+        gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                            "gimp-clone");
 
-      if (info &&
+      if (options &&
           gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
           gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
         {
-          GimpPaintOptions *options = gimp_paint_options_new (info);
+          options = gimp_config_duplicate (GIMP_CONFIG (options));
 
           g_object_set (options,
                         "clone-type", clone_type,
@@ -233,7 +241,7 @@ clone_invoker (GimpProcedure      *procedure,
 
           success = paint_tools_stroke (gimp, context, options, drawable,
                                         num_strokes, strokes, error,
-                                        "undo-desc",    info->blurb,
+                                        "undo-desc",    options->paint_info->blurb,
                                         "src-drawable", src_drawable,
                                         "src-x",        src_x,
                                         "src-y",        src_y,
@@ -266,17 +274,19 @@ clone_default_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-clone", error);
+      GimpPaintOptions *options =
+        gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                            "gimp-clone");
 
-      if (info &&
+      if (options &&
           gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
           gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
         {
-          GimpPaintOptions *options = gimp_paint_options_new (info);
+          options = gimp_config_duplicate (GIMP_CONFIG (options));
 
           success = paint_tools_stroke (gimp, context, options, drawable,
                                         num_strokes, strokes, error,
-                                        "undo-desc", info->blurb,
+                                        "undo-desc", options->paint_info->blurb,
                                         NULL);
         }
       else
@@ -310,13 +320,15 @@ convolve_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-convolve", error);
+      GimpPaintOptions *options =
+        gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                            "gimp-convolve");
 
-      if (info &&
+      if (options &&
           gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
           gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
         {
-          GimpPaintOptions *options = gimp_paint_options_new (info);
+          options = gimp_config_duplicate (GIMP_CONFIG (options));
 
           g_object_set (options,
                         "type", convolve_type,
@@ -325,7 +337,7 @@ convolve_invoker (GimpProcedure      *procedure,
 
           success = paint_tools_stroke (gimp, context, options, drawable,
                                         num_strokes, strokes, error,
-                                        "undo-desc", info->blurb,
+                                        "undo-desc", options->paint_info->blurb,
                                         NULL);
         }
       else
@@ -355,17 +367,19 @@ convolve_default_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-convolve", error);
+      GimpPaintOptions *options =
+        gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                            "gimp-convolve");
 
-      if (info &&
+      if (options &&
           gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
           gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
         {
-          GimpPaintOptions *options = gimp_paint_options_new (info);
+          options = gimp_config_duplicate (GIMP_CONFIG (options));
 
           success = paint_tools_stroke (gimp, context, options, drawable,
                                         num_strokes, strokes, error,
-                                        "undo-desc", info->blurb,
+                                        "undo-desc", options->paint_info->blurb,
                                         NULL);
         }
       else
@@ -401,13 +415,15 @@ dodgeburn_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-dodge-burn", error);
+      GimpPaintOptions *options =
+        gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                            "gimp-dodge-burn");
 
-      if (info &&
+      if (options &&
           gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
           gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
         {
-          GimpPaintOptions *options = gimp_paint_options_new (info);
+          options = gimp_config_duplicate (GIMP_CONFIG (options));
 
           g_object_set (options,
                         "type",     dodgeburn_type,
@@ -417,7 +433,7 @@ dodgeburn_invoker (GimpProcedure      *procedure,
 
           success = paint_tools_stroke (gimp, context, options, drawable,
                                         num_strokes, strokes, error,
-                                        "undo-desc", info->blurb,
+                                        "undo-desc", options->paint_info->blurb,
                                         NULL);
         }
       else
@@ -447,17 +463,19 @@ dodgeburn_default_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-dodge-burn", error);
+      GimpPaintOptions *options =
+        gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                            "gimp-dodge-burn");
 
-      if (info &&
+      if (options &&
           gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
           gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
         {
-          GimpPaintOptions *options = gimp_paint_options_new (info);
+          options = gimp_config_duplicate (GIMP_CONFIG (options));
 
           success = paint_tools_stroke (gimp, context, options, drawable,
                                         num_strokes, strokes, error,
-                                        "undo-desc", info->blurb,
+                                        "undo-desc", options->paint_info->blurb,
                                         NULL);
         }
       else
@@ -491,13 +509,15 @@ eraser_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-eraser", error);
+      GimpPaintOptions *options =
+        gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                            "gimp-eraser");
 
-      if (info &&
+      if (options &&
           gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
           gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
         {
-          GimpPaintOptions *options = gimp_paint_options_new (info);
+          options = gimp_config_duplicate (GIMP_CONFIG (options));
 
           g_object_set (options,
                         "application-mode", method,
@@ -506,7 +526,7 @@ eraser_invoker (GimpProcedure      *procedure,
 
           success = paint_tools_stroke (gimp, context, options, drawable,
                                         num_strokes, strokes, error,
-                                        "undo-desc", info->blurb,
+                                        "undo-desc", options->paint_info->blurb,
                                         NULL);
         }
       else
@@ -536,17 +556,19 @@ eraser_default_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-eraser", error);
+      GimpPaintOptions *options =
+        gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                            "gimp-eraser");
 
-      if (info &&
+      if (options &&
           gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
           gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
         {
-          GimpPaintOptions *options = gimp_paint_options_new (info);
+          options = gimp_config_duplicate (GIMP_CONFIG (options));
 
           success = paint_tools_stroke (gimp, context, options, drawable,
                                         num_strokes, strokes, error,
-                                        "undo-desc", info->blurb,
+                                        "undo-desc", options->paint_info->blurb,
                                         NULL);
         }
       else
@@ -582,17 +604,19 @@ heal_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-heal", error);
+      GimpPaintOptions *options =
+        gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                            "gimp-heal");
 
-      if (info &&
+      if (options &&
           gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
           gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
         {
-          GimpPaintOptions *options = gimp_paint_options_new (info);
+          options = gimp_config_duplicate (GIMP_CONFIG (options));
 
           success = paint_tools_stroke (gimp, context, options, drawable,
                                         num_strokes, strokes, error,
-                                        "undo-desc",    info->blurb,
+                                        "undo-desc",    options->paint_info->blurb,
                                         "src-drawable", src_drawable,
                                         "src-x",        src_x,
                                         "src-y",        src_y,
@@ -625,17 +649,19 @@ heal_default_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-heal", error);
+      GimpPaintOptions *options =
+        gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                            "gimp-heal");
 
-      if (info &&
+      if (options &&
           gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
           gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
         {
-          GimpPaintOptions *options = gimp_paint_options_new (info);
+          options = gimp_config_duplicate (GIMP_CONFIG (options));
 
           success = paint_tools_stroke (gimp, context, options, drawable,
                                         num_strokes, strokes, error,
-                                        "undo-desc", info->blurb,
+                                        "undo-desc", options->paint_info->blurb,
                                         NULL);
         }
       else
@@ -671,15 +697,18 @@ paintbrush_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-paintbrush", error);
+      GimpPaintOptions *options =
+        gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                            "gimp-paintbrush");
 
-      if (info &&
+      if (options &&
           gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
           gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
         {
-          GimpPaintOptions *options = gimp_paint_options_new (info);
-          GimpDynamics     *pdb_dynamics = GIMP_DYNAMICS (gimp_dynamics_new (context, "pdb"));
-          GimpDynamics     *user_dynamics = gimp_context_get_dynamics (context);
+          GimpDynamics *pdb_dynamics  = GIMP_DYNAMICS (gimp_dynamics_new (context, "pdb"));
+          GimpDynamics *user_dynamics = gimp_context_get_dynamics (context);
+
+          options = gimp_config_duplicate (GIMP_CONFIG (options));
 
           g_object_set (options,
                         "application-mode", method,
@@ -688,8 +717,10 @@ paintbrush_invoker (GimpProcedure      *procedure,
 
           if (fade_out > 0)
             {
-               GimpDynamicsOutput *opacity_output = gimp_dynamics_get_output (pdb_dynamics,
-                                                                              GIMP_DYNAMICS_OUTPUT_OPACITY);
+               GimpDynamicsOutput *opacity_output =
+                 gimp_dynamics_get_output (pdb_dynamics,
+                                           GIMP_DYNAMICS_OUTPUT_OPACITY);
+
                g_object_set (opacity_output,
                              "use-fade", TRUE,
                              NULL);
@@ -697,8 +728,9 @@ paintbrush_invoker (GimpProcedure      *procedure,
 
           if (gradient_length > 0)
             {
-              GimpDynamicsOutput *color_output = gimp_dynamics_get_output (pdb_dynamics,
-                                                                           GIMP_DYNAMICS_OUTPUT_COLOR);
+              GimpDynamicsOutput *color_output =
+                gimp_dynamics_get_output (pdb_dynamics,
+                                          GIMP_DYNAMICS_OUTPUT_COLOR);
 
               g_object_set (color_output,
                             "use-fade", TRUE,
@@ -709,7 +741,7 @@ paintbrush_invoker (GimpProcedure      *procedure,
 
           success = paint_tools_stroke (gimp, context, options, drawable,
                                         num_strokes, strokes, error,
-                                        "undo-desc", info->blurb,
+                                        "undo-desc", options->paint_info->blurb,
                                         NULL);
 
           gimp_context_set_dynamics (context, user_dynamics);
@@ -743,17 +775,19 @@ paintbrush_default_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-paintbrush", error);
+      GimpPaintOptions *options =
+        gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                            "gimp-paintbrush");
 
-      if (info &&
+      if (options &&
           gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
           gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
         {
-          GimpPaintOptions *options = gimp_paint_options_new (info);
+          options = gimp_config_duplicate (GIMP_CONFIG (options));
 
           success = paint_tools_stroke (gimp, context, options, drawable,
                                         num_strokes, strokes, error,
-                                        "undo-desc", info->blurb,
+                                        "undo-desc", options->paint_info->blurb,
                                         NULL);
         }
       else
@@ -783,17 +817,19 @@ pencil_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-pencil", error);
+      GimpPaintOptions *options =
+        gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                            "gimp-pencil");
 
-      if (info &&
+      if (options &&
           gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
           gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
         {
-          GimpPaintOptions *options = gimp_paint_options_new (info);
+          options = gimp_config_duplicate (GIMP_CONFIG (options));
 
           success = paint_tools_stroke (gimp, context, options, drawable,
                                         num_strokes, strokes, error,
-                                        "undo-desc", info->blurb,
+                                        "undo-desc", options->paint_info->blurb,
                                         NULL);
         }
       else
@@ -825,13 +861,15 @@ smudge_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-smudge", error);
+      GimpPaintOptions *options =
+        gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                            "gimp-smudge");
 
-      if (info &&
+      if (options &&
           gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
           gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
         {
-          GimpPaintOptions *options = gimp_paint_options_new (info);
+          options = gimp_config_duplicate (GIMP_CONFIG (options));
 
           g_object_set (options,
                         "rate", pressure,
@@ -839,7 +877,7 @@ smudge_invoker (GimpProcedure      *procedure,
 
           success = paint_tools_stroke (gimp, context, options, drawable,
                                         num_strokes, strokes, error,
-                                        "undo-desc", info->blurb,
+                                        "undo-desc", options->paint_info->blurb,
                                         NULL);
         }
       else
@@ -869,17 +907,19 @@ smudge_default_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-smudge", error);
+      GimpPaintOptions *options =
+        gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                            "gimp-smudge");
 
-      if (info &&
+      if (options &&
           gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
           gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
         {
-          GimpPaintOptions *options = gimp_paint_options_new (info);
+          options = gimp_config_duplicate (GIMP_CONFIG (options));
 
           success = paint_tools_stroke (gimp, context, options, drawable,
                                         num_strokes, strokes, error,
-                                        "undo-desc", info->blurb,
+                                        "undo-desc", options->paint_info->blurb,
                                         NULL);
         }
       else
diff --git a/tools/pdbgen/pdb/paint_tools.pdb b/tools/pdbgen/pdb/paint_tools.pdb
index 8ea9c6f..f82c140 100644
--- a/tools/pdbgen/pdb/paint_tools.pdb
+++ b/tools/pdbgen/pdb/paint_tools.pdb
@@ -52,13 +52,15 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-airbrush", error);
+  GimpPaintOptions *options =
+    gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                        "gimp-airbrush");
 
-  if (info &&
+  if (options &&
       gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
-      GimpPaintOptions *options = gimp_paint_options_new (info);
+      options = gimp_config_duplicate (GIMP_CONFIG (options));
 
       g_object_set (options,
                     "pressure", pressure,
@@ -66,7 +68,7 @@ HELP
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
-				    "undo-desc", info->blurb,
+				    "undo-desc", options->paint_info->blurb,
 				    NULL);
     }
   else
@@ -99,17 +101,19 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-airbrush", error);
+  GimpPaintOptions *options =
+    gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                        "gimp-airbrush");
 
-  if (info &&
+  if (options &&
       gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
-      GimpPaintOptions *options = gimp_paint_options_new (info);
+      options = gimp_config_duplicate (GIMP_CONFIG (options));
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
-				    "undo-desc", info->blurb,
+				    "undo-desc", options->paint_info->blurb,
 				    NULL);
     }
   else
@@ -157,13 +161,15 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-clone", error);
+  GimpPaintOptions *options =
+    gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                        "gimp-clone");
 
-  if (info &&
+  if (options &&
       gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
-      GimpPaintOptions *options = gimp_paint_options_new (info);
+      options = gimp_config_duplicate (GIMP_CONFIG (options));
 
       g_object_set (options,
                     "clone-type", clone_type,
@@ -171,7 +177,7 @@ HELP
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
-				    "undo-desc",    info->blurb,
+                                    "undo-desc",    options->paint_info->blurb,
                                     "src-drawable", src_drawable,
                                     "src-x",        src_x,
                                     "src-y",        src_y,
@@ -208,17 +214,19 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-clone", error);
+  GimpPaintOptions *options =
+    gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                        "gimp-clone");
 
-  if (info &&
+  if (options &&
       gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
-      GimpPaintOptions *options = gimp_paint_options_new (info);
+      options = gimp_config_duplicate (GIMP_CONFIG (options));
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
-				    "undo-desc", info->blurb,
+				    "undo-desc", options->paint_info->blurb,
 				    NULL);
     }
   else
@@ -251,17 +259,19 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-convolve", error);
+  GimpPaintOptions *options =
+    gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                        "gimp-convolve");
 
-  if (info &&
+  if (options &&
       gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
-      GimpPaintOptions *options = gimp_paint_options_new (info);
+      options = gimp_config_duplicate (GIMP_CONFIG (options));
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
-				    "undo-desc", info->blurb,
+				    "undo-desc", options->paint_info->blurb,
 				    NULL);
     }
   else
@@ -296,13 +306,15 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-convolve", error);
+  GimpPaintOptions *options =
+    gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                        "gimp-convolve");
 
-  if (info &&
+  if (options &&
       gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
-      GimpPaintOptions *options = gimp_paint_options_new (info);
+      options = gimp_config_duplicate (GIMP_CONFIG (options));
 
       g_object_set (options,
                     "type", convolve_type,
@@ -311,7 +323,7 @@ HELP
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
-				    "undo-desc", info->blurb,
+				    "undo-desc", options->paint_info->blurb,
 				    NULL);
     }
   else
@@ -342,17 +354,19 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-eraser", error);
+  GimpPaintOptions *options =
+    gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                        "gimp-eraser");
 
-  if (info &&
+  if (options &&
       gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
-      GimpPaintOptions *options = gimp_paint_options_new (info);
+      options = gimp_config_duplicate (GIMP_CONFIG (options));
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
-				    "undo-desc", info->blurb,
+				    "undo-desc", options->paint_info->blurb,
 				    NULL);
     }
   else
@@ -388,13 +402,15 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-eraser", error);
+  GimpPaintOptions *options =
+    gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                        "gimp-eraser");
 
-  if (info &&
+  if (options &&
       gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
-      GimpPaintOptions *options = gimp_paint_options_new (info);
+      options = gimp_config_duplicate (GIMP_CONFIG (options));
 
       g_object_set (options,
                     "application-mode", method,
@@ -403,7 +419,7 @@ HELP
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
-				    "undo-desc", info->blurb,
+				    "undo-desc", options->paint_info->blurb,
 				    NULL);
     }
   else
@@ -439,13 +455,15 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-eraser", error);
+  GimpPaintOptions *options =
+    gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                        "gimp-eraser");
 
-  if (info &&
+  if (options &&
       gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
-      GimpPaintOptions *options = gimp_paint_options_new (info);
+      options = gimp_config_duplicate (GIMP_CONFIG (options));
 
       g_object_set (options,
                     "application-mode", method,
@@ -455,7 +473,7 @@ HELP
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
-				    "undo-desc", info->blurb,
+				    "undo-desc", options->paint_info->blurb,
 				    NULL);
     }
   else
@@ -495,17 +513,19 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-heal", error);
+  GimpPaintOptions *options =
+    gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                        "gimp-heal");
 
-  if (info &&
+  if (options &&
       gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
-      GimpPaintOptions *options = gimp_paint_options_new (info);
+      options = gimp_config_duplicate (GIMP_CONFIG (options));
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
-				    "undo-desc",    info->blurb,
+				    "undo-desc",    options->paint_info->blurb,
                                     "src-drawable", src_drawable,
                                     "src-x",        src_x,
                                     "src-y",        src_y,
@@ -542,17 +562,19 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-heal", error);
+  GimpPaintOptions *options =
+    gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                        "gimp-heal");
 
-  if (info &&
+  if (options &&
       gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
-      GimpPaintOptions *options = gimp_paint_options_new (info);
+      options = gimp_config_duplicate (GIMP_CONFIG (options));
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
-				    "undo-desc", info->blurb,
+				    "undo-desc", options->paint_info->blurb,
 				    NULL);
     }
   else
@@ -596,15 +618,18 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-paintbrush", error);
+  GimpPaintOptions *options =
+    gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                        "gimp-paintbrush");
 
-  if (info &&
+  if (options &&
       gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
-      GimpPaintOptions *options = gimp_paint_options_new (info);
-      GimpDynamics     *pdb_dynamics = GIMP_DYNAMICS (gimp_dynamics_new (context, "pdb"));
-      GimpDynamics     *user_dynamics = gimp_context_get_dynamics (context);
+      GimpDynamics *pdb_dynamics  = GIMP_DYNAMICS (gimp_dynamics_new (context, "pdb"));
+      GimpDynamics *user_dynamics = gimp_context_get_dynamics (context);
+
+      options = gimp_config_duplicate (GIMP_CONFIG (options));
 
       g_object_set (options,
                     "application-mode", method,
@@ -613,8 +638,10 @@ HELP
 
       if (fade_out > 0)
         {
-           GimpDynamicsOutput *opacity_output = gimp_dynamics_get_output (pdb_dynamics,
-                                                                          GIMP_DYNAMICS_OUTPUT_OPACITY);
+           GimpDynamicsOutput *opacity_output =
+             gimp_dynamics_get_output (pdb_dynamics,
+                                       GIMP_DYNAMICS_OUTPUT_OPACITY);
+
            g_object_set (opacity_output,
                          "use-fade", TRUE,
                          NULL);
@@ -622,8 +649,9 @@ HELP
 
       if (gradient_length > 0)
         {
-          GimpDynamicsOutput *color_output = gimp_dynamics_get_output (pdb_dynamics,
-                                                                       GIMP_DYNAMICS_OUTPUT_COLOR);
+          GimpDynamicsOutput *color_output =
+            gimp_dynamics_get_output (pdb_dynamics,
+                                      GIMP_DYNAMICS_OUTPUT_COLOR);
 
           g_object_set (color_output,
                         "use-fade", TRUE,
@@ -634,7 +662,7 @@ HELP
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
-				    "undo-desc", info->blurb,
+				    "undo-desc", options->paint_info->blurb,
 				    NULL);
 
       gimp_context_set_dynamics (context, user_dynamics);
@@ -679,17 +707,19 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-paintbrush", error);
+  GimpPaintOptions *options =
+    gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                        "gimp-paintbrush");
 
-  if (info &&
+  if (options &&
       gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
-      GimpPaintOptions *options = gimp_paint_options_new (info);
+      options = gimp_config_duplicate (GIMP_CONFIG (options));
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
-				    "undo-desc", info->blurb,
+				    "undo-desc", options->paint_info->blurb,
 				    NULL);
     }
   else
@@ -721,17 +751,19 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-pencil", error);
+  GimpPaintOptions *options =
+    gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                        "gimp-pencil");
 
-  if (info &&
+  if (options &&
       gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
-      GimpPaintOptions *options = gimp_paint_options_new (info);
+      options = gimp_config_duplicate (GIMP_CONFIG (options));
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
-				    "undo-desc", info->blurb,
+				    "undo-desc", options->paint_info->blurb,
 				    NULL);
     }
   else
@@ -762,13 +794,15 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-smudge", error);
+  GimpPaintOptions *options =
+    gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                        "gimp-smudge");
 
-  if (info &&
+  if (options &&
       gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
-      GimpPaintOptions *options = gimp_paint_options_new (info);
+      options = gimp_config_duplicate (GIMP_CONFIG (options));
 
       g_object_set (options,
                     "rate", pressure,
@@ -776,7 +810,7 @@ HELP
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
-				    "undo-desc", info->blurb,
+				    "undo-desc", options->paint_info->blurb,
 				    NULL);
     }
   else
@@ -809,17 +843,19 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-smudge", error);
+  GimpPaintOptions *options =
+    gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                        "gimp-smudge");
 
-  if (info &&
+  if (options &&
       gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
-      GimpPaintOptions *options = gimp_paint_options_new (info);
+      options = gimp_config_duplicate (GIMP_CONFIG (options));
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
-				    "undo-desc", info->blurb,
+				    "undo-desc", options->paint_info->blurb,
 				    NULL);
     }
   else
@@ -855,13 +891,15 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-dodge-burn", error);
+  GimpPaintOptions *options =
+    gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                        "gimp-dodge-burn");
 
-  if (info &&
+  if (options &&
       gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
-      GimpPaintOptions *options = gimp_paint_options_new (info);
+      options = gimp_config_duplicate (GIMP_CONFIG (options));
 
       g_object_set (options,
                     "type",     dodgeburn_type,
@@ -871,7 +909,7 @@ HELP
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
-				    "undo-desc", info->blurb,
+				    "undo-desc", options->paint_info->blurb,
 				    NULL);
     }
   else
@@ -904,17 +942,19 @@ HELP
     %invoke = (
 	code => <<'CODE'
 {
-  GimpPaintInfo *info = gimp_pdb_get_paint_info (gimp, "gimp-dodge-burn", error);
+  GimpPaintOptions *options =
+    gimp_pdb_context_get_paint_options (GIMP_PDB_CONTEXT (context),
+                                        "gimp-dodge-burn");
 
-  if (info &&
+  if (options &&
       gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) &&
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
-      GimpPaintOptions *options = gimp_paint_options_new (info);
+      options = gimp_config_duplicate (GIMP_CONFIG (options));
 
       success = paint_tools_stroke (gimp, context, options, drawable,
                                     num_strokes, strokes, error,
-				    "undo-desc", info->blurb,
+				    "undo-desc", options->paint_info->blurb,
 				    NULL);
     }
   else
@@ -925,23 +965,6 @@ CODE
 }
 
 
-# Incomplete
-
-sub ink {
-    $blurb = 'Paint in the current brush without sub-pixel sampling.';
-
-    $help = 'fixme fixme';
-
-    &std_pdb_misc;
-
-    @inargs = (
-	{ name => 'drawable', type => 'drawable',
-	  desc => 'The affected drawable' },
-	&stroke_arg
-    );
-}
-
-
 $extra{app}->{code} = <<'CODE';
 static const GimpCoords default_coords = GIMP_COORDS_DEFAULT_VALUES;
 
@@ -1012,12 +1035,14 @@ CODE
 
 
 @headers = qw("libgimpmath/gimpmath.h"
+              "libgimpconfig/gimpconfig.h"
               "core/gimpbrush.h"
               "core/gimpdynamics.h"
               "core/gimppaintinfo.h"
               "paint/gimppaintcore.h"
               "paint/gimppaintcore-stroke.h"
               "paint/gimppaintoptions.h"
+              "gimppdbcontext.h"
               "gimppdb-utils.h");
 
 @procs = qw(airbrush airbrush_default



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