Commit 0f1f8b7b authored by Jehan's avatar Jehan

app: layers-resize and layers-scale work on one layer at once.

Making these actions multi-layer aware here means checking only exactly
1 layer is selected as these actions have GUI which shows dimensions and
preview (for the layer dimension action, i.e. layers-resize).
parent bf7d5557
Pipeline #200399 passed with stages
in 23 minutes and 30 seconds
......@@ -773,8 +773,6 @@ layers_actions_update (GimpActionGroup *group,
gboolean lock_alpha = TRUE;
gboolean can_lock_alpha = FALSE;
gboolean text_layer = FALSE;
gboolean writable = FALSE;
gboolean movable = FALSE;
gboolean bs_mutable = FALSE; /* At least 1 selected layers' blend space is mutable. */
gboolean cs_mutable = FALSE; /* At least 1 selected layers' composite space is mutable. */
gboolean cm_mutable = FALSE; /* At least 1 selected layers' composite mode is mutable. */
......@@ -990,9 +988,7 @@ layers_actions_update (GimpActionGroup *group,
gimp_action_group_set_action_active (group, action, TRUE);
mask = gimp_layer_get_mask (layer);
writable = ! gimp_item_is_content_locked (GIMP_ITEM (layer));
movable = ! gimp_item_is_position_locked (GIMP_ITEM (layer));
mask = gimp_layer_get_mask (layer);
text_layer = gimp_item_is_text_layer (GIMP_ITEM (layer));
}
......@@ -1059,9 +1055,9 @@ layers_actions_update (GimpActionGroup *group,
SET_VISIBLE ("layers-text-to-vectors", text_layer && !ac);
SET_VISIBLE ("layers-text-along-vectors", text_layer && !ac);
SET_SENSITIVE ("layers-resize", writable && movable && !ac);
SET_SENSITIVE ("layers-resize", n_layers == 1 && all_writable && all_movable && !ac);
SET_SENSITIVE ("layers-resize-to-image", all_writable && all_movable && !ac);
SET_SENSITIVE ("layers-scale", writable && movable && !ac);
SET_SENSITIVE ("layers-scale", n_layers == 1 && all_writable && all_movable && !ac);
SET_SENSITIVE ("layers-crop-to-selection", all_writable && all_movable && sel);
SET_SENSITIVE ("layers-crop-to-content", all_writable && all_movable);
......
......@@ -1061,13 +1061,18 @@ layers_resize_cmd_callback (GimpAction *action,
{
GimpImage *image;
GimpLayer *layer;
GList *layers;
GtkWidget *widget;
GtkWidget *dialog;
return_if_no_layer (image, layer, data);
return_if_no_layers (image, layers, data);
return_if_no_widget (widget, data);
#define RESIZE_DIALOG_KEY "gimp-resize-dialog"
g_return_if_fail (g_list_length (layers) == 1);
layer = layers->data;
dialog = dialogs_get_dialog (G_OBJECT (layer), RESIZE_DIALOG_KEY);
if (! dialog)
......@@ -1131,14 +1136,19 @@ layers_scale_cmd_callback (GimpAction *action,
gpointer data)
{
GimpImage *image;
GList *layers;
GimpLayer *layer;
GtkWidget *widget;
GtkWidget *dialog;
return_if_no_layer (image, layer, data);
return_if_no_layers (image, layers, data);
return_if_no_widget (widget, data);
#define SCALE_DIALOG_KEY "gimp-scale-dialog"
g_return_if_fail (g_list_length (layers) == 1);
layer = layers->data;
dialog = dialogs_get_dialog (G_OBJECT (layer), SCALE_DIALOG_KEY);
if (! dialog)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment