[gimp] app: change parameters of gimp_fill_options_new()



commit c09a724bda8d7611db084e03ca122dbddce95c1d
Author: Michael Natterer <mitch gimp org>
Date:   Tue Mar 15 20:10:16 2016 +0100

    app: change parameters of gimp_fill_options_new()
    
    to be the same as of gimp_stroke_options_new() because it's about to
    be needed for the same purposes.

 app/actions/edit-commands.c        |    2 +-
 app/core/gimp-edit.c               |    2 +-
 app/core/gimpfilloptions.c         |   26 ++++++++++++++++++++++----
 app/core/gimpfilloptions.h         |    4 +++-
 app/display/gimpdisplayshell-dnd.c |    6 ++++--
 app/pdb/edit-cmds.c                |    6 +++---
 app/tools/gimpbucketfilltool.c     |    2 +-
 app/widgets/gimpdrawabletreeview.c |    8 ++++----
 tools/pdbgen/pdb/edit.pdb          |    6 +++---
 9 files changed, 42 insertions(+), 20 deletions(-)
---
diff --git a/app/actions/edit-commands.c b/app/actions/edit-commands.c
index 7544fef..3a6e94a 100644
--- a/app/actions/edit-commands.c
+++ b/app/actions/edit-commands.c
@@ -505,7 +505,7 @@ edit_fill_cmd_callback (GtkAction *action,
 
   fill_type = (GimpFillType) value;
 
-  options = gimp_fill_options_new (action_data_get_gimp (data));
+  options = gimp_fill_options_new (action_data_get_gimp (data), NULL, FALSE);
 
   if (gimp_fill_options_set_by_fill_type (options,
                                           action_data_get_context (data),
diff --git a/app/core/gimp-edit.c b/app/core/gimp-edit.c
index fed139a..652a145 100644
--- a/app/core/gimp-edit.c
+++ b/app/core/gimp-edit.c
@@ -407,7 +407,7 @@ gimp_edit_clear (GimpImage    *image,
   g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
   g_return_if_fail (GIMP_IS_CONTEXT (context));
 
-  options = gimp_fill_options_new (context->gimp);
+  options = gimp_fill_options_new (context->gimp, NULL, FALSE);
 
   if (gimp_drawable_has_alpha (drawable))
     gimp_fill_options_set_by_fill_type (options, context,
diff --git a/app/core/gimpfilloptions.c b/app/core/gimpfilloptions.c
index c5ced27..25e9c10 100644
--- a/app/core/gimpfilloptions.c
+++ b/app/core/gimpfilloptions.c
@@ -193,13 +193,31 @@ gimp_fill_options_get_property (GObject    *object,
 /*  public functions  */
 
 GimpFillOptions *
-gimp_fill_options_new (Gimp *gimp)
+gimp_fill_options_new (Gimp        *gimp,
+                       GimpContext *context,
+                       gboolean     use_context_color)
 {
+  GimpFillOptions *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);
+
+  options = g_object_new (GIMP_TYPE_FILL_OPTIONS,
+                          "gimp", gimp,
+                          NULL);
+
+  if (use_context_color)
+    {
+      gimp_context_define_properties (GIMP_CONTEXT (options),
+                                      GIMP_CONTEXT_PROP_MASK_FOREGROUND |
+                                      GIMP_CONTEXT_PROP_MASK_PATTERN,
+                                      FALSE);
+
+      gimp_context_set_parent (GIMP_CONTEXT (options), context);
+    }
 
-  return g_object_new (GIMP_TYPE_FILL_OPTIONS,
-                       "gimp", gimp,
-                       NULL);
+  return options;
 }
 
 GimpFillStyle
diff --git a/app/core/gimpfilloptions.h b/app/core/gimpfilloptions.h
index 8bed04e..29374bf 100644
--- a/app/core/gimpfilloptions.h
+++ b/app/core/gimpfilloptions.h
@@ -48,7 +48,9 @@ struct _GimpFillOptionsClass
 
 GType             gimp_fill_options_get_type         (void) G_GNUC_CONST;
 
-GimpFillOptions * gimp_fill_options_new              (Gimp               *gimp);
+GimpFillOptions * gimp_fill_options_new              (Gimp               *gimp,
+                                                      GimpContext        *context,
+                                                      gboolean            use_context_color);
 
 GimpFillStyle     gimp_fill_options_get_style        (GimpFillOptions    *options);
 void              gimp_fill_options_set_style        (GimpFillOptions    *options,
diff --git a/app/display/gimpdisplayshell-dnd.c b/app/display/gimpdisplayshell-dnd.c
index d4e09b9..ff98e29 100644
--- a/app/display/gimpdisplayshell-dnd.c
+++ b/app/display/gimpdisplayshell-dnd.c
@@ -401,7 +401,8 @@ gimp_display_shell_drop_pattern (GtkWidget    *widget,
                                  gpointer      data)
 {
   GimpDisplayShell *shell   = GIMP_DISPLAY_SHELL (data);
-  GimpFillOptions  *options = gimp_fill_options_new (shell->display->gimp);
+  GimpFillOptions  *options = gimp_fill_options_new (shell->display->gimp,
+                                                     NULL, FALSE);
 
   GIMP_LOG (DND, NULL);
 
@@ -422,7 +423,8 @@ gimp_display_shell_drop_color (GtkWidget     *widget,
                                gpointer       data)
 {
   GimpDisplayShell *shell   = GIMP_DISPLAY_SHELL (data);
-  GimpFillOptions  *options = gimp_fill_options_new (shell->display->gimp);
+  GimpFillOptions  *options = gimp_fill_options_new (shell->display->gimp,
+                                                     NULL, FALSE);
 
   GIMP_LOG (DND, NULL);
 
diff --git a/app/pdb/edit-cmds.c b/app/pdb/edit-cmds.c
index d0db221..d929209 100644
--- a/app/pdb/edit-cmds.c
+++ b/app/pdb/edit-cmds.c
@@ -552,7 +552,7 @@ edit_fill_invoker (GimpProcedure         *procedure,
           gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
         {
           GimpImage       *image   = gimp_item_get_image (GIMP_ITEM (drawable));
-          GimpFillOptions *options = gimp_fill_options_new (gimp);
+          GimpFillOptions *options = gimp_fill_options_new (gimp, NULL, FALSE);
 
           if (gimp_fill_options_set_by_fill_type (options, context,
                                                   fill_type, error))
@@ -606,7 +606,7 @@ edit_bucket_fill_invoker (GimpProcedure         *procedure,
           gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
         {
           GimpImage       *image   = gimp_item_get_image (GIMP_ITEM (drawable));
-          GimpFillOptions *options = gimp_fill_options_new (gimp);
+          GimpFillOptions *options = gimp_fill_options_new (gimp, NULL, FALSE);
 
           if (gimp_fill_options_set_by_fill_mode (options, context,
                                                   fill_mode, error))
@@ -683,7 +683,7 @@ edit_bucket_fill_full_invoker (GimpProcedure         *procedure,
           gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
         {
           GimpImage       *image   = gimp_item_get_image (GIMP_ITEM (drawable));
-          GimpFillOptions *options = gimp_fill_options_new (gimp);
+          GimpFillOptions *options = gimp_fill_options_new (gimp, NULL, FALSE);
 
           if (gimp_fill_options_set_by_fill_mode (options, context,
                                                   fill_mode, error))
diff --git a/app/tools/gimpbucketfilltool.c b/app/tools/gimpbucketfilltool.c
index b12c0a4..b266a97 100644
--- a/app/tools/gimpbucketfilltool.c
+++ b/app/tools/gimpbucketfilltool.c
@@ -176,7 +176,7 @@ gimp_bucket_fill_tool_button_release (GimpTool              *tool,
       GimpFillOptions *fill_options;
       GError          *error = NULL;
 
-      fill_options = gimp_fill_options_new (image->gimp);
+      fill_options = gimp_fill_options_new (image->gimp, NULL, FALSE);
 
       if (gimp_fill_options_set_by_fill_mode (fill_options, context,
                                               options->fill_mode,
diff --git a/app/widgets/gimpdrawabletreeview.c b/app/widgets/gimpdrawabletreeview.c
index 331ef7b..5ad06b4 100644
--- a/app/widgets/gimpdrawabletreeview.c
+++ b/app/widgets/gimpdrawabletreeview.c
@@ -236,7 +236,7 @@ gimp_drawable_tree_view_drop_viewable (GimpContainerTreeView   *view,
   if (dest_viewable && GIMP_IS_PATTERN (src_viewable))
     {
       GimpImage       *image   = gimp_item_get_image (GIMP_ITEM (dest_viewable));
-      GimpFillOptions *options = gimp_fill_options_new (image->gimp);
+      GimpFillOptions *options = gimp_fill_options_new (image->gimp, NULL, FALSE);
 
       gimp_fill_options_set_style (options, GIMP_FILL_STYLE_PATTERN);
       gimp_context_set_pattern (GIMP_CONTEXT (options),
@@ -267,7 +267,7 @@ gimp_drawable_tree_view_drop_color (GimpContainerTreeView   *view,
   if (dest_viewable)
     {
       GimpImage       *image   = gimp_item_get_image (GIMP_ITEM (dest_viewable));
-      GimpFillOptions *options = gimp_fill_options_new (image->gimp);
+      GimpFillOptions *options = gimp_fill_options_new (image->gimp, NULL, FALSE);
 
       gimp_fill_options_set_style (options, GIMP_FILL_STYLE_SOLID);
       gimp_context_set_foreground (GIMP_CONTEXT (options), color);
@@ -349,7 +349,7 @@ gimp_drawable_tree_view_new_pattern_dropped (GtkWidget    *widget,
 {
   GimpItemTreeView *view    = GIMP_ITEM_TREE_VIEW (data);
   GimpImage        *image   = gimp_item_tree_view_get_image (view);
-  GimpFillOptions  *options = gimp_fill_options_new (image->gimp);
+  GimpFillOptions  *options = gimp_fill_options_new (image->gimp, NULL, FALSE);
 
   gimp_fill_options_set_style (options, GIMP_FILL_STYLE_PATTERN);
   gimp_context_set_pattern (GIMP_CONTEXT (options), GIMP_PATTERN (viewable));
@@ -369,7 +369,7 @@ gimp_drawable_tree_view_new_color_dropped (GtkWidget     *widget,
 {
   GimpItemTreeView *view    = GIMP_ITEM_TREE_VIEW (data);
   GimpImage        *image   = gimp_item_tree_view_get_image (view);
-  GimpFillOptions  *options = gimp_fill_options_new (image->gimp);
+  GimpFillOptions  *options = gimp_fill_options_new (image->gimp, NULL, FALSE);
 
   gimp_fill_options_set_style (options, GIMP_FILL_STYLE_SOLID);
   gimp_context_set_foreground (GIMP_CONTEXT (options), color);
diff --git a/tools/pdbgen/pdb/edit.pdb b/tools/pdbgen/pdb/edit.pdb
index 0401f66..c1a4aa4 100644
--- a/tools/pdbgen/pdb/edit.pdb
+++ b/tools/pdbgen/pdb/edit.pdb
@@ -566,7 +566,7 @@ HELP
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
       GimpImage       *image   = gimp_item_get_image (GIMP_ITEM (drawable));
-      GimpFillOptions *options = gimp_fill_options_new (gimp);
+      GimpFillOptions *options = gimp_fill_options_new (gimp, NULL, FALSE);
 
       if (gimp_fill_options_set_by_fill_type (options, context,
                                               fill_type, error))
@@ -644,7 +644,7 @@ HELP
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
       GimpImage       *image   = gimp_item_get_image (GIMP_ITEM (drawable));
-      GimpFillOptions *options = gimp_fill_options_new (gimp);
+      GimpFillOptions *options = gimp_fill_options_new (gimp, NULL, FALSE);
 
       if (gimp_fill_options_set_by_fill_mode (options, context,
                                               fill_mode, error))
@@ -749,7 +749,7 @@ HELP
       gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error))
     {
       GimpImage       *image   = gimp_item_get_image (GIMP_ITEM (drawable));
-      GimpFillOptions *options = gimp_fill_options_new (gimp);
+      GimpFillOptions *options = gimp_fill_options_new (gimp, NULL, FALSE);
 
       if (gimp_fill_options_set_by_fill_mode (options, context,
                                               fill_mode, error))


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