[gimp] app: stop hardcoding NORMAL_LEGACY for new layers/images



commit 7ce77c47cc2ed5616b6f8dc64e81ed6e9abf49f4
Author: Michael Natterer <mitch gimp org>
Date:   Sun Aug 20 13:45:42 2017 +0200

    app: stop hardcoding NORMAL_LEGACY for new layers/images
    
    Use GimpCoreConfig::default-new-layer-mode instead.

 app/actions/layers-commands.c      |    4 ++--
 app/core/gimp-edit.c               |    4 +++-
 app/core/gimpdrawable-transform.c  |    4 +++-
 app/core/gimpimage-merge.c         |    6 ++++--
 app/core/gimpimage-new.c           |   10 ++++++----
 app/core/gimpselection.c           |    4 +++-
 app/display/gimpdisplayshell-dnd.c |    4 +++-
 app/pdb/layer-cmds.c               |    3 ++-
 app/tools/gimpwarptool.c           |    4 +++-
 app/widgets/gimplayertreeview.c    |    6 ++++--
 tools/pdbgen/pdb/layer.pdb         |    3 ++-
 11 files changed, 35 insertions(+), 17 deletions(-)
---
diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c
index 89c7641..dccd072 100644
--- a/app/actions/layers-commands.c
+++ b/app/actions/layers-commands.c
@@ -396,7 +396,7 @@ layers_new_last_vals_cmd_callback (GtkAction *action,
       off_x   = 0;
       off_y   = 0;
       opacity = 1.0;
-      mode    = GIMP_LAYER_MODE_NORMAL_LEGACY;
+      mode    = image->gimp->config->default_new_layer_mode;
     }
 
   gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_EDIT_PASTE,
@@ -442,7 +442,7 @@ layers_new_from_visible_cmd_callback (GtkAction *action,
                                                                         TRUE),
                                            _("Visible"),
                                            GIMP_OPACITY_OPAQUE,
-                                           GIMP_LAYER_MODE_NORMAL_LEGACY,
+                                           image->gimp->config->default_new_layer_mode,
                                            profile);
 
   gimp_image_add_layer (image, layer, GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
diff --git a/app/core/gimp-edit.c b/app/core/gimp-edit.c
index a436122..6a2ef5d 100644
--- a/app/core/gimp-edit.c
+++ b/app/core/gimp-edit.c
@@ -28,6 +28,8 @@
 
 #include "core-types.h"
 
+#include "config/gimpcoreconfig.h"
+
 #include "gegl/gimp-gegl-utils.h"
 
 #include "gimp.h"
@@ -421,7 +423,7 @@ gimp_edit_paste (GimpImage     *image,
                                           floating_format,
                                           _("Pasted Layer"),
                                           GIMP_OPACITY_OPAQUE,
-                                          GIMP_LAYER_MODE_NORMAL_LEGACY);
+                                          image->gimp->config->default_new_layer_mode);
     }
 
   if (! layer)
diff --git a/app/core/gimpdrawable-transform.c b/app/core/gimpdrawable-transform.c
index 5162adc..3dc3f65 100644
--- a/app/core/gimpdrawable-transform.c
+++ b/app/core/gimpdrawable-transform.c
@@ -30,6 +30,8 @@
 
 #include "core-types.h"
 
+#include "config/gimpcoreconfig.h"
+
 #include "gegl/gimp-gegl-apply-operation.h"
 #include "gegl/gimp-gegl-utils.h"
 
@@ -1013,7 +1015,7 @@ gimp_drawable_transform_paste (GimpDrawable     *drawable,
                                          gimp_drawable_get_format_with_alpha (drawable),
                                          _("Transformation"),
                                          GIMP_OPACITY_OPAQUE,
-                                         GIMP_LAYER_MODE_NORMAL_LEGACY,
+                                         image->gimp->config->default_new_layer_mode,
                                          buffer_profile);
 
       gimp_item_set_offset (GIMP_ITEM (layer), offset_x, offset_y);
diff --git a/app/core/gimpimage-merge.c b/app/core/gimpimage-merge.c
index 394b81b..f669576 100644
--- a/app/core/gimpimage-merge.c
+++ b/app/core/gimpimage-merge.c
@@ -27,6 +27,8 @@
 
 #include "core-types.h"
 
+#include "config/gimpcoreconfig.h"
+
 #include "gegl/gimp-babl-compat.h"
 #include "gegl/gimp-gegl-apply-operation.h"
 #include "gegl/gimp-gegl-nodes.h"
@@ -527,7 +529,7 @@ gimp_image_merge_layers (GimpImage     *image,
                                     gimp_image_get_layer_format (image, FALSE),
                                     gimp_object_get_name (bottom_layer),
                                     GIMP_OPACITY_OPAQUE,
-                                    GIMP_LAYER_MODE_NORMAL_LEGACY);
+                                    image->gimp->config->default_new_layer_mode);
 
       if (! merge_layer)
         {
@@ -557,7 +559,7 @@ gimp_image_merge_layers (GimpImage     *image,
                         gimp_drawable_get_format_with_alpha (GIMP_DRAWABLE (bottom_layer)),
                         gimp_object_get_name (bottom_layer),
                         GIMP_OPACITY_OPAQUE,
-                        GIMP_LAYER_MODE_NORMAL_LEGACY);
+                        image->gimp->config->default_new_layer_mode);
 
       if (! merge_layer)
         {
diff --git a/app/core/gimpimage-new.c b/app/core/gimpimage-new.c
index 4cc5b44..b97f794 100644
--- a/app/core/gimpimage-new.c
+++ b/app/core/gimpimage-new.c
@@ -149,7 +149,7 @@ gimp_image_new_from_template (Gimp         *gimp,
                           gimp_image_get_layer_format (image, has_alpha),
                           _("Background"),
                           GIMP_OPACITY_OPAQUE,
-                          GIMP_LAYER_MODE_NORMAL_LEGACY);
+                          image->gimp->config->default_new_layer_mode);
 
   gimp_drawable_fill (GIMP_DRAWABLE (layer),
                       context, gimp_template_get_fill_type (template));
@@ -224,7 +224,9 @@ gimp_image_new_from_drawable (Gimp         *gimp,
   gimp_item_translate (GIMP_ITEM (new_layer), -off_x, -off_y, FALSE);
   gimp_item_set_visible (GIMP_ITEM (new_layer), TRUE, FALSE);
   gimp_item_set_linked (GIMP_ITEM (new_layer), FALSE, FALSE);
-  gimp_layer_set_mode (new_layer, GIMP_LAYER_MODE_NORMAL_LEGACY, FALSE);
+  gimp_layer_set_mode (new_layer,
+                       new_image->gimp->config->default_new_layer_mode,
+                       FALSE);
   gimp_layer_set_opacity (new_layer, GIMP_OPACITY_OPAQUE, FALSE);
   if (gimp_layer_can_lock_alpha (new_layer))
     gimp_layer_set_lock_alpha (new_layer, FALSE, FALSE);
@@ -322,7 +324,7 @@ gimp_image_new_from_buffer (Gimp       *gimp,
                                                                    has_alpha),
                                       _("Pasted Layer"),
                                       GIMP_OPACITY_OPAQUE,
-                                      GIMP_LAYER_MODE_NORMAL_LEGACY);
+                                      image->gimp->config->default_new_layer_mode);
 
   gimp_image_add_layer (image, layer, NULL, 0, TRUE);
 
@@ -381,7 +383,7 @@ gimp_image_new_from_pixbuf (Gimp        *gimp,
                                                                    has_alpha),
                                       layer_name,
                                       GIMP_OPACITY_OPAQUE,
-                                      GIMP_LAYER_MODE_NORMAL_LEGACY);
+                                      new_image->gimp->config->default_new_layer_mode);
 
   gimp_image_add_layer (new_image, layer, NULL, 0, TRUE);
 
diff --git a/app/core/gimpselection.c b/app/core/gimpselection.c
index 5206d8b..f8a7774 100644
--- a/app/core/gimpselection.c
+++ b/app/core/gimpselection.c
@@ -25,6 +25,8 @@
 
 #include "core-types.h"
 
+#include "config/gimpcoreconfig.h"
+
 #include "gegl/gimp-babl.h"
 #include "gegl/gimp-gegl-apply-operation.h"
 
@@ -891,7 +893,7 @@ gimp_selection_float (GimpSelection *selection,
                                            gimp_drawable_get_format_with_alpha (drawable),
                                            _("Floated Layer"),
                                            GIMP_OPACITY_OPAQUE,
-                                           GIMP_LAYER_MODE_NORMAL_LEGACY,
+                                           image->gimp->config->default_new_layer_mode,
                                            profile);
 
   /*  Set the offsets  */
diff --git a/app/display/gimpdisplayshell-dnd.c b/app/display/gimpdisplayshell-dnd.c
index d3f2f69..91a7e26 100644
--- a/app/display/gimpdisplayshell-dnd.c
+++ b/app/display/gimpdisplayshell-dnd.c
@@ -27,6 +27,8 @@
 
 #include "display-types.h"
 
+#include "config/gimpcoreconfig.h"
+
 #include "core/gimp.h"
 #include "core/gimp-edit.h"
 #include "core/gimpbuffer.h"
@@ -723,7 +725,7 @@ gimp_display_shell_drop_pixbuf (GtkWidget *widget,
                                 gimp_image_get_layer_format (image, has_alpha),
                                 _("Dropped Buffer"),
                                 GIMP_OPACITY_OPAQUE,
-                                GIMP_LAYER_MODE_NORMAL_LEGACY);
+                                image->gimp->config->default_new_layer_mode);
 
   if (new_layer)
     {
diff --git a/app/pdb/layer-cmds.c b/app/pdb/layer-cmds.c
index cc50805..84014da 100644
--- a/app/pdb/layer-cmds.c
+++ b/app/pdb/layer-cmds.c
@@ -32,6 +32,7 @@
 
 #include "pdb-types.h"
 
+#include "config/gimpcoreconfig.h"
 #include "core/gimp.h"
 #include "core/gimpdrawable.h"
 #include "core/gimpgrouplayer.h"
@@ -182,7 +183,7 @@ layer_new_from_visible_invoker (GimpProcedure         *procedure,
                                                                             TRUE),
                                                name,
                                                GIMP_OPACITY_OPAQUE,
-                                               GIMP_LAYER_MODE_NORMAL_LEGACY,
+                                               gimp->config->default_new_layer_mode,
                                                profile);
     }
 
diff --git a/app/tools/gimpwarptool.c b/app/tools/gimpwarptool.c
index ef31e30..0ee09c8 100644
--- a/app/tools/gimpwarptool.c
+++ b/app/tools/gimpwarptool.c
@@ -29,6 +29,8 @@
 
 #include "tools-types.h"
 
+#include "config/gimpcoreconfig.h"
+
 #include "gegl/gimp-gegl-apply-operation.h"
 
 #include "core/gimp.h"
@@ -1106,7 +1108,7 @@ gimp_warp_tool_animate (GimpWarpTool *wt)
 
   gimp_item_set_offset (GIMP_ITEM (layer), 0, 0);
   gimp_item_set_visible (GIMP_ITEM (layer), TRUE, FALSE);
-  gimp_layer_set_mode (layer, GIMP_LAYER_MODE_NORMAL_LEGACY, FALSE);
+  gimp_layer_set_mode (layer, image->gimp->config->default_new_layer_mode, FALSE);
   gimp_layer_set_opacity (layer, GIMP_OPACITY_OPAQUE, FALSE);
   gimp_image_add_layer (image, layer, NULL, 0, FALSE);
 
diff --git a/app/widgets/gimplayertreeview.c b/app/widgets/gimplayertreeview.c
index 0793073..bc0fcbd 100644
--- a/app/widgets/gimplayertreeview.c
+++ b/app/widgets/gimplayertreeview.c
@@ -31,6 +31,8 @@
 
 #include "widgets-types.h"
 
+#include "config/gimpcoreconfig.h"
+
 #include "core/gimp.h"
 #include "core/gimpcontainer.h"
 #include "core/gimpimage-undo.h"
@@ -809,7 +811,7 @@ gimp_layer_tree_view_drop_pixbuf (GimpContainerTreeView   *tree_view,
                                 gimp_image_get_layer_format (image, TRUE),
                                 _("Dropped Buffer"),
                                 GIMP_OPACITY_OPAQUE,
-                                GIMP_LAYER_MODE_NORMAL_LEGACY);
+                                image->gimp->config->default_new_layer_mode);
 
   gimp_image_add_layer (image, new_layer, parent, index, TRUE);
 
@@ -851,7 +853,7 @@ gimp_layer_tree_view_item_new (GimpImage *image)
                               gimp_image_get_layer_format (image, TRUE),
                               NULL,
                               GIMP_OPACITY_OPAQUE,
-                              GIMP_LAYER_MODE_NORMAL_LEGACY);
+                              image->gimp->config->default_new_layer_mode);
 
   gimp_image_add_layer (image, new_layer,
                         GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
diff --git a/tools/pdbgen/pdb/layer.pdb b/tools/pdbgen/pdb/layer.pdb
index a32c6b4..5c813a9 100644
--- a/tools/pdbgen/pdb/layer.pdb
+++ b/tools/pdbgen/pdb/layer.pdb
@@ -156,7 +156,7 @@ HELP
                                                                         TRUE),
                                            name,
                                            GIMP_OPACITY_OPAQUE,
-                                           GIMP_LAYER_MODE_NORMAL_LEGACY,
+                                           gimp->config->default_new_layer_mode,
                                            profile);
 }
 CODE
@@ -1357,6 +1357,7 @@ CODE
 @headers = qw(<cairo.h>
               "libgimpbase/gimpbase.h"
               "libgimpcolor/gimpcolor.h"
+              "config/gimpcoreconfig.h"
               "core/gimp.h"
               "core/gimpimage-color-profile.h"
               "core/gimpimage-undo.h"


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