diff --git a/app/actions/image-commands.c b/app/actions/image-commands.c index 07b2f7ef76..6dae5f540c 100644 --- a/app/actions/image-commands.c +++ b/app/actions/image-commands.c @@ -954,6 +954,28 @@ image_merge_layers_cmd_callback (GimpAction *action, gtk_window_present (GTK_WINDOW (dialog)); } +void +image_merge_layers_last_vals_cmd_callback (GimpAction *action, + GVariant *value, + gpointer data) +{ + GimpImage *image; + GimpDisplay *display; + GimpDialogConfig *config; + return_if_no_image (image, data); + return_if_no_display (display, data); + + config = GIMP_DIALOG_CONFIG (image->gimp->config); + + image_merge_layers_callback (NULL, + image, + action_data_get_context (data), + config->layer_merge_type, + config->layer_merge_active_group_only, + config->layer_merge_discard_invisible, + display); +} + void image_flatten_image_cmd_callback (GimpAction *action, GVariant *value, diff --git a/app/actions/image-commands.h b/app/actions/image-commands.h index d2e3e1f345..018dec7e7b 100644 --- a/app/actions/image-commands.h +++ b/app/actions/image-commands.h @@ -83,6 +83,9 @@ void image_crop_to_content_cmd_callback (GimpAction *action, void image_merge_layers_cmd_callback (GimpAction *action, GVariant *value, gpointer data); +void image_merge_layers_last_vals_cmd_callback (GimpAction *action, + GVariant *value, + gpointer data); void image_flatten_image_cmd_callback (GimpAction *action, GVariant *value, gpointer data); diff --git a/app/actions/layers-actions.c b/app/actions/layers-actions.c index 86a3c7c18b..2100696b17 100644 --- a/app/actions/layers-actions.c +++ b/app/actions/layers-actions.c @@ -177,6 +177,15 @@ static const GimpActionEntry layers_actions[] = layers_merge_down_cmd_callback, GIMP_HELP_LAYER_MERGE_DOWN }, + /* this is the same as layers-merge-down, except it's sensitive even if + * the layer can't be merged down + */ + { "layers-merge-down-button", GIMP_ICON_LAYER_MERGE_DOWN, + NC_("layers-action", "Merge Do_wn"), NULL, + NC_("layers-action", "Merge this layer with the first visible layer below it"), + layers_merge_down_cmd_callback, + GIMP_HELP_LAYER_MERGE_DOWN }, + { "layers-merge-group", NULL, NC_("layers-action", "Merge Layer Group"), NULL, NC_("layers-action", "Merge the layer group's layers into one normal layer"), @@ -189,6 +198,12 @@ static const GimpActionEntry layers_actions[] = image_merge_layers_cmd_callback, GIMP_HELP_IMAGE_MERGE_LAYERS }, + { "layers-merge-layers-last-values", NULL, + NC_("layers-action", "Merge _Visible Layers"), NULL, + NC_("layers-action", "Merge all visible layers with last used values"), + image_merge_layers_last_vals_cmd_callback, + GIMP_HELP_IMAGE_MERGE_LAYERS }, + { "layers-flatten-image", NULL, NC_("layers-action", "_Flatten Image"), NULL, NC_("layers-action", "Merge all layers into one and remove transparency"), @@ -937,13 +952,15 @@ layers_actions_update (GimpActionGroup *group, SET_SENSITIVE ("layers-lower", layer && !fs && !ac && next); SET_SENSITIVE ("layers-lower-to-bottom", layer && !fs && !ac && next); - SET_VISIBLE ("layers-anchor", layer && fs && !ac); - SET_VISIBLE ("layers-merge-down", !fs); - SET_SENSITIVE ("layers-merge-down", layer && !fs && !ac && visible && next_visible); - SET_VISIBLE ("layers-merge-group", children); - SET_SENSITIVE ("layers-merge-group", layer && !fs && !ac && children); - SET_SENSITIVE ("layers-merge-layers", layer && !fs && !ac); - SET_SENSITIVE ("layers-flatten-image", layer && !fs && !ac); + SET_VISIBLE ("layers-anchor", layer && fs && !ac); + SET_VISIBLE ("layers-merge-down", !fs); + SET_SENSITIVE ("layers-merge-down", layer && !fs && !ac && visible && next_visible); + SET_VISIBLE ("layers-merge-down-button", !fs); + SET_SENSITIVE ("layers-merge-down-button", layer && !fs && !ac); + SET_VISIBLE ("layers-merge-group", children); + SET_SENSITIVE ("layers-merge-group", layer && !fs && !ac && children); + SET_SENSITIVE ("layers-merge-layers", layer && !fs && !ac); + SET_SENSITIVE ("layers-flatten-image", layer && !fs && !ac); SET_VISIBLE ("layers-text-discard", text_layer && !ac); SET_VISIBLE ("layers-text-to-vectors", text_layer && !ac); diff --git a/app/widgets/gimplayertreeview.c b/app/widgets/gimplayertreeview.c index 35cdc7cb92..9b615040dc 100644 --- a/app/widgets/gimplayertreeview.c +++ b/app/widgets/gimplayertreeview.c @@ -401,7 +401,15 @@ gimp_layer_tree_view_constructed (GObject *object) button, 5); button = gimp_editor_add_action_button (GIMP_EDITOR (layer_view), "layers", - "layers-merge-down", NULL); + "layers-merge-down-button", + "layers-merge-group", + GDK_SHIFT_MASK, + "layers-merge-layers", + GDK_CONTROL_MASK, + "layers-merge-layers-last-values", + GDK_CONTROL_MASK | + GDK_SHIFT_MASK, + NULL); gimp_container_view_enable_dnd (GIMP_CONTAINER_VIEW (layer_view), GTK_BUTTON (button), GIMP_TYPE_LAYER);