gimp r27393 - in trunk: . app/actions app/core app/dialogs app/pdb tools/pdbgen/pdb



Author: mitch
Date: Sat Oct 25 08:52:20 2008
New Revision: 27393
URL: http://svn.gnome.org/viewvc/gimp?rev=27393&view=rev

Log:
2008-10-25  Michael Natterer  <mitch gimp org>

	* app/core/gimpstrokeoptions.[ch]: add "gboolean use_context_color"
	parameter to gimp_stroke_options_new() and set the passed context
	as parent of the new options only if it's TRUE. Also fixed the
	GimpConfig::duplicate() implementation to really duplicate the
	object and not just return an object containing default values.

	* app/core/gimpfilloptions.[ch]: add gimp_fill_options_new().

	* app/actions/select-commands.c
	* app/dialogs/stroke-dialog.c
	* app/actions/vectors-commands.c
	* tools/pdbgen/pdb/edit.pdb
	* tools/pdbgen/pdb/paths.pdb: pass TRUE to gimp_stroke_options_new().

	* app/pdb/edit-cmds.c
	* app/pdb/paths-cmds.c: regenerated.



Modified:
   trunk/ChangeLog
   trunk/app/actions/select-commands.c
   trunk/app/actions/vectors-commands.c
   trunk/app/core/gimpfilloptions.c
   trunk/app/core/gimpfilloptions.h
   trunk/app/core/gimpstrokeoptions.c
   trunk/app/core/gimpstrokeoptions.h
   trunk/app/dialogs/stroke-dialog.c
   trunk/app/pdb/edit-cmds.c
   trunk/app/pdb/paths-cmds.c
   trunk/tools/pdbgen/pdb/edit.pdb
   trunk/tools/pdbgen/pdb/paths.pdb

Modified: trunk/app/actions/select-commands.c
==============================================================================
--- trunk/app/actions/select-commands.c	(original)
+++ trunk/app/actions/select-commands.c	Sat Oct 25 08:52:20 2008
@@ -369,7 +369,7 @@
   if (options)
     g_object_ref (options);
   else
-    options = gimp_stroke_options_new (image->gimp, context);
+    options = gimp_stroke_options_new (image->gimp, context, TRUE);
 
   if (! gimp_item_stroke (GIMP_ITEM (gimp_image_get_mask (image)),
                           drawable, context, options, FALSE, NULL, &error))

Modified: trunk/app/actions/vectors-commands.c
==============================================================================
--- trunk/app/actions/vectors-commands.c	(original)
+++ trunk/app/actions/vectors-commands.c	Sat Oct 25 08:52:20 2008
@@ -420,7 +420,7 @@
   if (options)
     g_object_ref (options);
   else
-    options = gimp_stroke_options_new (image->gimp, context);
+    options = gimp_stroke_options_new (image->gimp, context, TRUE);
 
   if (! gimp_item_stroke (GIMP_ITEM (vectors), drawable, context, options, FALSE,
                           NULL, &error))

Modified: trunk/app/core/gimpfilloptions.c
==============================================================================
--- trunk/app/core/gimpfilloptions.c	(original)
+++ trunk/app/core/gimpfilloptions.c	Sat Oct 25 08:52:20 2008
@@ -28,6 +28,7 @@
 
 #include "core-types.h"
 
+#include "gimp.h"
 #include "gimpfilloptions.h"
 #include "gimpviewable.h"
 
@@ -156,3 +157,16 @@
       break;
     }
 }
+
+
+/*  public functions  */
+
+GimpFillOptions *
+gimp_fill_options_new (Gimp *gimp)
+{
+  g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
+
+  return g_object_new (GIMP_TYPE_FILL_OPTIONS,
+                       "gimp", gimp,
+                       NULL);
+}

Modified: trunk/app/core/gimpfilloptions.h
==============================================================================
--- trunk/app/core/gimpfilloptions.h	(original)
+++ trunk/app/core/gimpfilloptions.h	Sat Oct 25 08:52:20 2008
@@ -54,7 +54,9 @@
 };
 
 
-GType  gimp_fill_options_get_type (void) G_GNUC_CONST;
+GType             gimp_fill_options_get_type (void) G_GNUC_CONST;
+
+GimpFillOptions * gimp_fill_options_new      (Gimp *gimp);
 
 
 #endif /* __GIMP_FILL_OPTIONS_H__ */

Modified: trunk/app/core/gimpstrokeoptions.c
==============================================================================
--- trunk/app/core/gimpstrokeoptions.c	(original)
+++ trunk/app/core/gimpstrokeoptions.c	Sat Oct 25 08:52:20 2008
@@ -94,6 +94,8 @@
 
 #define parent_class gimp_stroke_options_parent_class
 
+static GimpConfigInterface *parent_config_iface = NULL;
+
 static guint stroke_options_signals[LAST_SIGNAL] = { 0 };
 
 
@@ -185,6 +187,11 @@
 {
   GimpConfigInterface *config_iface = (GimpConfigInterface *) iface;
 
+  parent_config_iface = g_type_interface_peek_parent (config_iface);
+
+  if (! parent_config_iface)
+    parent_config_iface = g_type_default_interface_peek (GIMP_TYPE_CONFIG);
+
   config_iface->duplicate = gimp_stroke_options_duplicate;
 }
 
@@ -325,8 +332,7 @@
   GimpStrokeOptions *options = GIMP_STROKE_OPTIONS (config);
   GimpStrokeOptions *new_options;
 
-  new_options = gimp_stroke_options_new (GIMP_CONTEXT (options)->gimp,
-                                         GIMP_CONTEXT (options));
+  new_options = GIMP_STROKE_OPTIONS (parent_config_iface->duplicate (config));
 
   if (options->paint_options)
     {
@@ -345,13 +351,15 @@
 
 GimpStrokeOptions *
 gimp_stroke_options_new (Gimp        *gimp,
-                         GimpContext *context)
+                         GimpContext *context,
+                         gboolean     use_context_color)
 {
   GimpPaintInfo     *paint_info = NULL;
   GimpStrokeOptions *options;
 
   g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
   g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL);
+  g_return_val_if_fail (use_context_color == FALSE || context != NULL, NULL);
 
   if (context)
     paint_info = gimp_context_get_paint_info (context);
@@ -364,13 +372,15 @@
                           "paint-info", paint_info,
                           NULL);
 
-  gimp_context_define_properties (GIMP_CONTEXT (options),
-                                  GIMP_CONTEXT_FOREGROUND_MASK |
-                                  GIMP_CONTEXT_PATTERN_MASK,
-                                  FALSE);
+  if (use_context_color)
+    {
+      gimp_context_define_properties (GIMP_CONTEXT (options),
+                                      GIMP_CONTEXT_FOREGROUND_MASK |
+                                      GIMP_CONTEXT_PATTERN_MASK,
+                                      FALSE);
 
-  if (context)
-    gimp_context_set_parent (GIMP_CONTEXT (options), context);
+      gimp_context_set_parent (GIMP_CONTEXT (options), context);
+    }
 
   return options;
 }

Modified: trunk/app/core/gimpstrokeoptions.h
==============================================================================
--- trunk/app/core/gimpstrokeoptions.h	(original)
+++ trunk/app/core/gimpstrokeoptions.h	Sat Oct 25 08:52:20 2008
@@ -71,7 +71,8 @@
 GType               gimp_stroke_options_get_type          (void) G_GNUC_CONST;
 
 GimpStrokeOptions * gimp_stroke_options_new               (Gimp              *gimp,
-                                                           GimpContext       *context);
+                                                           GimpContext       *context,
+                                                           gboolean           use_context_color);
 void                gimp_stroke_options_take_dash_pattern (GimpStrokeOptions *options,
                                                            GimpDashPreset     preset,
                                                            GArray            *pattern);

Modified: trunk/app/dialogs/stroke-dialog.c
==============================================================================
--- trunk/app/dialogs/stroke-dialog.c	(original)
+++ trunk/app/dialogs/stroke-dialog.c	Sat Oct 25 08:52:20 2008
@@ -88,7 +88,7 @@
 
   image = gimp_item_get_image (item);
 
-  options = gimp_stroke_options_new (context->gimp, context);
+  options = gimp_stroke_options_new (context->gimp, context, TRUE);
 
   saved_options = g_object_get_data (G_OBJECT (context->gimp),
                                      "saved-stroke-options");
@@ -307,7 +307,7 @@
         if (saved_options)
           g_object_ref (saved_options);
         else
-          saved_options = gimp_stroke_options_new (context->gimp, context);
+          saved_options = gimp_stroke_options_new (context->gimp, context, TRUE);
 
         gimp_config_sync (G_OBJECT (options), G_OBJECT (saved_options), 0);
 

Modified: trunk/app/pdb/edit-cmds.c
==============================================================================
--- trunk/app/pdb/edit-cmds.c	(original)
+++ trunk/app/pdb/edit-cmds.c	Sat Oct 25 08:52:20 2008
@@ -747,7 +747,7 @@
       if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
         {
           GimpImage         *image   = gimp_item_get_image (GIMP_ITEM (drawable));
-          GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context);
+          GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context, TRUE);
 
           g_object_set (options,
                         "method", GIMP_STROKE_METHOD_PAINT_CORE,
@@ -787,7 +787,7 @@
       if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) &&
           gimp_pdb_item_is_attached (GIMP_ITEM (vectors), error))
         {
-          GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context);
+          GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context, TRUE);
 
           g_object_set (options,
                         "method", GIMP_STROKE_METHOD_PAINT_CORE,

Modified: trunk/app/pdb/paths-cmds.c
==============================================================================
--- trunk/app/pdb/paths-cmds.c	(original)
+++ trunk/app/pdb/paths-cmds.c	Sat Oct 25 08:52:20 2008
@@ -333,7 +333,7 @@
 
       if (vectors && drawable)
         {
-          GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context);
+          GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context, TRUE);
 
           g_object_set (options,
                         "method", GIMP_STROKE_METHOD_PAINT_CORE,

Modified: trunk/tools/pdbgen/pdb/edit.pdb
==============================================================================
--- trunk/tools/pdbgen/pdb/edit.pdb	(original)
+++ trunk/tools/pdbgen/pdb/edit.pdb	Sat Oct 25 08:52:20 2008
@@ -833,7 +833,7 @@
   if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
     {
       GimpImage         *image   = gimp_item_get_image (GIMP_ITEM (drawable));
-      GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context);
+      GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context, TRUE);
 
       g_object_set (options,
                     "method", GIMP_STROKE_METHOD_PAINT_CORE,
@@ -876,7 +876,7 @@
   if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error) &&
       gimp_pdb_item_is_attached (GIMP_ITEM (vectors), error))
     {
-      GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context);
+      GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context, TRUE);
 
       g_object_set (options,
                     "method", GIMP_STROKE_METHOD_PAINT_CORE,

Modified: trunk/tools/pdbgen/pdb/paths.pdb
==============================================================================
--- trunk/tools/pdbgen/pdb/paths.pdb	(original)
+++ trunk/tools/pdbgen/pdb/paths.pdb	Sat Oct 25 08:52:20 2008
@@ -268,7 +268,7 @@
 
   if (vectors && drawable)
     {
-      GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context);
+      GimpStrokeOptions *options = gimp_stroke_options_new (gimp, context, TRUE);
 
       g_object_set (options,
                     "method", GIMP_STROKE_METHOD_PAINT_CORE,



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