[gimp] app: make setting of layer mode on new layers smarter in layers-commands.c



commit dcefc10eca00ae8473d8f2e9be94e0a95371d47a
Author: Michael Natterer <mitch gimp org>
Date:   Tue Apr 24 13:58:30 2018 +0200

    app: make setting of layer mode on new layers smarter in layers-commands.c
    
    If the mode remembered in GimpDialogConfig is NORMAL or NORMAL_LEGACY,
    use the image's default new layer mode instead.

 app/actions/layers-commands.c |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c
index 6f27b4f..ae197d5 100644
--- a/app/actions/layers-commands.c
+++ b/app/actions/layers-commands.c
@@ -320,7 +320,14 @@ layers_new_cmd_callback (GtkAction *action,
 
   if (! dialog)
     {
-      GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config);
+      GimpDialogConfig *config     = GIMP_DIALOG_CONFIG (image->gimp->config);
+      GimpLayerMode     layer_mode = config->layer_new_mode;
+
+      if (layer_mode == GIMP_LAYER_MODE_NORMAL ||
+          layer_mode == GIMP_LAYER_MODE_NORMAL_LEGACY)
+        {
+          layer_mode = gimp_image_get_default_new_layer_mode (image);
+        }
 
       dialog = layer_options_dialog_new (image, NULL,
                                          action_data_get_context (data),
@@ -331,7 +338,7 @@ layers_new_cmd_callback (GtkAction *action,
                                          _("Create a New Layer"),
                                          GIMP_HELP_LAYER_NEW,
                                          config->layer_new_name,
-                                         config->layer_new_mode,
+                                         layer_mode,
                                          config->layer_new_blend_space,
                                          config->layer_new_composite_space,
                                          config->layer_new_composite_mode,
@@ -360,6 +367,7 @@ layers_new_last_vals_cmd_callback (GtkAction *action,
   GtkWidget        *widget;
   GimpLayer        *layer;
   GimpDialogConfig *config;
+  GimpLayerMode     layer_mode;
 
   return_if_no_image (image, data);
   return_if_no_widget (widget, data);
@@ -375,13 +383,21 @@ layers_new_last_vals_cmd_callback (GtkAction *action,
       return;
     }
 
+  layer_mode = config->layer_new_mode;
+
+  if (layer_mode == GIMP_LAYER_MODE_NORMAL ||
+      layer_mode == GIMP_LAYER_MODE_NORMAL_LEGACY)
+    {
+      layer_mode = gimp_image_get_default_new_layer_mode (image);
+    }
+
   layer = gimp_layer_new (image,
                           gimp_image_get_width  (image),
                           gimp_image_get_height (image),
                           gimp_image_get_layer_format (image, TRUE),
                           config->layer_new_name,
                           config->layer_new_opacity,
-                          config->layer_new_mode);
+                          layer_mode);
 
   gimp_drawable_fill (GIMP_DRAWABLE (layer),
                       action_data_get_context (data),


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