mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-04 17:59:37 +00:00
app: layers-select-* multi-selection aware.
Allows to move multiple selection up and down, within each selected layer's own depth.
This commit is contained in:
parent
8f22f12ee7
commit
22a86c44ca
2 changed files with 37 additions and 31 deletions
|
@ -558,26 +558,26 @@ static const GimpEnumActionEntry layers_alpha_to_selection_actions[] =
|
||||||
static const GimpEnumActionEntry layers_select_actions[] =
|
static const GimpEnumActionEntry layers_select_actions[] =
|
||||||
{
|
{
|
||||||
{ "layers-select-top", NULL,
|
{ "layers-select-top", NULL,
|
||||||
NC_("layers-action", "Select _Top Layer"), "Home",
|
NC_("layers-action", "Select _Top Layers"), "Home",
|
||||||
NC_("layers-action", "Select the topmost layer"),
|
NC_("layers-action", "Select the topmost layers"),
|
||||||
GIMP_ACTION_SELECT_FIRST, FALSE,
|
GIMP_ACTION_SELECT_FIRST, FALSE,
|
||||||
GIMP_HELP_LAYER_TOP },
|
GIMP_HELP_LAYER_TOP },
|
||||||
|
|
||||||
{ "layers-select-bottom", NULL,
|
{ "layers-select-bottom", NULL,
|
||||||
NC_("layers-action", "Select _Bottom Layer"), "End",
|
NC_("layers-action", "Select _Bottom Layers"), "End",
|
||||||
NC_("layers-action", "Select the bottommost layer"),
|
NC_("layers-action", "Select the bottommost layers"),
|
||||||
GIMP_ACTION_SELECT_LAST, FALSE,
|
GIMP_ACTION_SELECT_LAST, FALSE,
|
||||||
GIMP_HELP_LAYER_BOTTOM },
|
GIMP_HELP_LAYER_BOTTOM },
|
||||||
|
|
||||||
{ "layers-select-previous", NULL,
|
{ "layers-select-previous", NULL,
|
||||||
NC_("layers-action", "Select _Previous Layer"), "Prior",
|
NC_("layers-action", "Select _Previous Layers"), "Prior",
|
||||||
NC_("layers-action", "Select the layer above the current layer"),
|
NC_("layers-action", "Select the layers above the current layers"),
|
||||||
GIMP_ACTION_SELECT_PREVIOUS, FALSE,
|
GIMP_ACTION_SELECT_PREVIOUS, FALSE,
|
||||||
GIMP_HELP_LAYER_PREVIOUS },
|
GIMP_HELP_LAYER_PREVIOUS },
|
||||||
|
|
||||||
{ "layers-select-next", NULL,
|
{ "layers-select-next", NULL,
|
||||||
NC_("layers-action", "Select _Next Layer"), "Next",
|
NC_("layers-action", "Select _Next Layers"), "Next",
|
||||||
NC_("layers-action", "Select the layer below the current layer"),
|
NC_("layers-action", "Select the layers below the current layers"),
|
||||||
GIMP_ACTION_SELECT_NEXT, FALSE,
|
GIMP_ACTION_SELECT_NEXT, FALSE,
|
||||||
GIMP_HELP_LAYER_NEXT }
|
GIMP_HELP_LAYER_NEXT }
|
||||||
};
|
};
|
||||||
|
@ -781,9 +781,7 @@ layers_actions_update (GimpActionGroup *group,
|
||||||
gboolean bs_mutable = FALSE;
|
gboolean bs_mutable = FALSE;
|
||||||
gboolean cs_mutable = FALSE;
|
gboolean cs_mutable = FALSE;
|
||||||
gboolean cm_mutable = FALSE;
|
gboolean cm_mutable = FALSE;
|
||||||
GList *next = NULL;
|
|
||||||
GList *next_visible = NULL;
|
GList *next_visible = NULL;
|
||||||
GList *prev = NULL;
|
|
||||||
gboolean next_mode = TRUE;
|
gboolean next_mode = TRUE;
|
||||||
gboolean prev_mode = TRUE;
|
gboolean prev_mode = TRUE;
|
||||||
gboolean last_mode = FALSE;
|
gboolean last_mode = FALSE;
|
||||||
|
@ -966,10 +964,7 @@ layers_actions_update (GimpActionGroup *group,
|
||||||
|
|
||||||
if (list)
|
if (list)
|
||||||
{
|
{
|
||||||
prev = g_list_previous (list);
|
for (next_visible = g_list_next (list);
|
||||||
next = g_list_next (list);
|
|
||||||
|
|
||||||
for (next_visible = next;
|
|
||||||
next_visible;
|
next_visible;
|
||||||
next_visible = g_list_next (next_visible))
|
next_visible = g_list_next (next_visible))
|
||||||
{
|
{
|
||||||
|
@ -1028,10 +1023,10 @@ layers_actions_update (GimpActionGroup *group,
|
||||||
SET_SENSITIVE ("layers-mode-previous", n_layers > 0 && !ac && prev_mode);
|
SET_SENSITIVE ("layers-mode-previous", n_layers > 0 && !ac && prev_mode);
|
||||||
SET_SENSITIVE ("layers-mode-next", n_layers > 0 && !ac && next_mode);
|
SET_SENSITIVE ("layers-mode-next", n_layers > 0 && !ac && next_mode);
|
||||||
|
|
||||||
SET_SENSITIVE ("layers-select-top", layer && !fs && !ac && prev);
|
SET_SENSITIVE ("layers-select-top", n_layers > 0 && !fs && !ac && have_prev);
|
||||||
SET_SENSITIVE ("layers-select-bottom", layer && !fs && !ac && next);
|
SET_SENSITIVE ("layers-select-bottom", n_layers > 0 && !fs && !ac && have_next);
|
||||||
SET_SENSITIVE ("layers-select-previous", layer && !fs && !ac && prev);
|
SET_SENSITIVE ("layers-select-previous", n_layers > 0 && !fs && !ac && have_prev);
|
||||||
SET_SENSITIVE ("layers-select-next", layer && !fs && !ac && next);
|
SET_SENSITIVE ("layers-select-next", n_layers > 0 && !fs && !ac && have_next);
|
||||||
|
|
||||||
SET_SENSITIVE ("layers-raise", n_layers > 0 && !fs && !ac && have_prev);
|
SET_SENSITIVE ("layers-raise", n_layers > 0 && !fs && !ac && have_prev);
|
||||||
SET_SENSITIVE ("layers-raise-to-top", n_layers > 0 && !fs && !ac && have_prev);
|
SET_SENSITIVE ("layers-raise-to-top", n_layers > 0 && !fs && !ac && have_prev);
|
||||||
|
|
|
@ -577,30 +577,41 @@ layers_select_cmd_callback (GimpAction *action,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GimpImage *image;
|
GimpImage *image;
|
||||||
GimpLayer *layer;
|
GList *new_layers = NULL;
|
||||||
|
GList *layers;
|
||||||
|
GList *iter;
|
||||||
GimpContainer *container;
|
GimpContainer *container;
|
||||||
GimpLayer *new_layer;
|
GimpLayer *new_layer;
|
||||||
GimpActionSelectType select_type;
|
GimpActionSelectType select_type;
|
||||||
|
gboolean run_once;
|
||||||
return_if_no_image (image, data);
|
return_if_no_image (image, data);
|
||||||
|
|
||||||
select_type = (GimpActionSelectType) g_variant_get_int32 (value);
|
select_type = (GimpActionSelectType) g_variant_get_int32 (value);
|
||||||
|
|
||||||
layer = gimp_image_get_active_layer (image);
|
layers = gimp_image_get_selected_layers (image);
|
||||||
|
run_once = (g_list_length (layers) == 0);
|
||||||
|
|
||||||
if (layer)
|
for (iter = layers; iter || run_once; iter = iter ? iter->next : NULL)
|
||||||
container = gimp_item_get_container (GIMP_ITEM (layer));
|
{
|
||||||
else
|
if (iter)
|
||||||
|
container = gimp_item_get_container (GIMP_ITEM (iter->data));
|
||||||
|
else /* run_once */
|
||||||
container = gimp_image_get_layers (image);
|
container = gimp_image_get_layers (image);
|
||||||
|
|
||||||
new_layer = (GimpLayer *) action_select_object (select_type,
|
new_layer = (GimpLayer *) action_select_object (select_type,
|
||||||
container,
|
container,
|
||||||
(GimpObject *) layer);
|
(GimpObject *) iter->data);
|
||||||
|
if (new_layer)
|
||||||
|
new_layers = g_list_prepend (new_layers, new_layer);
|
||||||
|
}
|
||||||
|
|
||||||
if (new_layer && new_layer != layer)
|
if (new_layers)
|
||||||
{
|
{
|
||||||
gimp_image_set_active_layer (image, new_layer);
|
gimp_image_set_selected_layers (image, new_layers);
|
||||||
gimp_image_flush (image);
|
gimp_image_flush (image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_list_free (new_layers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue