[gimp] app: replace more gimp_(s|g)et_active_layer() to *_selected_layers().
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: replace more gimp_(s|g)et_active_layer() to *_selected_layers().
- Date: Sun, 21 Feb 2021 23:12:14 +0000 (UTC)
commit 02fa3542540f6b4ed62028edb02bea304276c821
Author: Jehan <jehan girinstud io>
Date: Sun Feb 21 17:11:34 2021 +0100
app: replace more gimp_(s|g)et_active_layer() to *_selected_layers().
app/actions/text-tool-actions.c | 8 ++++----
app/core/gimpfloatingselectionundo.c | 6 +++++-
app/core/gimplayer-floating-selection.c | 20 +++++++++-----------
app/display/gimpdisplayshell-tool-events.c | 4 +++-
4 files changed, 21 insertions(+), 17 deletions(-)
---
diff --git a/app/actions/text-tool-actions.c b/app/actions/text-tool-actions.c
index 89f58a88e4..1c7e6798d8 100644
--- a/app/actions/text-tool-actions.c
+++ b/app/actions/text-tool-actions.c
@@ -161,7 +161,7 @@ text_tool_actions_update (GimpActionGroup *group,
GimpTextTool *text_tool = GIMP_TEXT_TOOL (data);
GimpDisplay *display = GIMP_TOOL (text_tool)->display;
GimpImage *image = gimp_display_get_image (display);
- GimpLayer *layer;
+ GList *layers;
GimpVectors *vectors;
GimpDisplayShell *shell;
GtkClipboard *clipboard;
@@ -171,10 +171,10 @@ text_tool_actions_update (GimpActionGroup *group,
GimpTextDirection direction;
gint i;
- layer = gimp_image_get_active_layer (image);
+ layers = gimp_image_get_selected_layers (image);
- if (layer)
- text_layer = gimp_item_is_text_layer (GIMP_ITEM (layer));
+ if (g_list_length (layers) == 1)
+ text_layer = gimp_item_is_text_layer (GIMP_ITEM (layers->data));
vectors = gimp_image_get_active_vectors (image);
diff --git a/app/core/gimpfloatingselectionundo.c b/app/core/gimpfloatingselectionundo.c
index 6ca28abea9..f6029411f7 100644
--- a/app/core/gimpfloatingselectionundo.c
+++ b/app/core/gimpfloatingselectionundo.c
@@ -101,12 +101,16 @@ gimp_floating_selection_undo_pop (GimpUndo *undo,
case GIMP_UNDO_FS_TO_LAYER:
if (undo_mode == GIMP_UNDO_MODE_UNDO)
{
+ GList *layers;
+
/* Update the preview for the floating selection */
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (floating_layer));
gimp_layer_set_floating_sel_drawable (floating_layer,
floating_sel_undo->drawable);
- gimp_image_set_active_layer (undo->image, floating_layer);
+ layers = g_list_prepend (NULL, floating_layer);
+ gimp_image_set_selected_layers (undo->image, layers);
+ g_list_free (layers);
gimp_drawable_attach_floating_sel (gimp_layer_get_floating_sel_drawable (floating_layer),
floating_layer);
diff --git a/app/core/gimplayer-floating-selection.c b/app/core/gimplayer-floating-selection.c
index 3ccb0af18a..14b81aa0e6 100644
--- a/app/core/gimplayer-floating-selection.c
+++ b/app/core/gimplayer-floating-selection.c
@@ -217,6 +217,7 @@ floating_sel_activate_drawable (GimpLayer *layer)
{
GimpImage *image;
GimpDrawable *drawable;
+ GList *selected_drawables;
g_return_if_fail (GIMP_IS_LAYER (layer));
g_return_if_fail (gimp_layer_is_floating_sel (layer));
@@ -230,24 +231,21 @@ floating_sel_activate_drawable (GimpLayer *layer)
{
GimpLayerMask *mask = GIMP_LAYER_MASK (drawable);
- gimp_image_set_active_layer (image, gimp_layer_mask_get_layer (mask));
+ selected_drawables = g_list_prepend (NULL, gimp_layer_mask_get_layer (mask));
+ gimp_image_set_selected_layers (image, selected_drawables);
}
else if (GIMP_IS_CHANNEL (drawable))
{
- GList *channels = g_list_prepend (NULL, drawable);
-
- gimp_image_set_selected_channels (image, channels);
-
- g_list_free (channels);
+ selected_drawables = g_list_prepend (NULL, drawable);
+ gimp_image_set_selected_channels (image, selected_drawables);
}
else
{
- GList *layers = g_list_prepend (NULL, drawable);
-
- gimp_image_set_selected_layers (image, layers);
-
- g_list_free (layers);
+ selected_drawables = g_list_prepend (NULL, drawable);
+ gimp_image_set_selected_layers (image, selected_drawables);
}
+
+ g_list_free (selected_drawables);
}
const GimpBoundSeg *
diff --git a/app/display/gimpdisplayshell-tool-events.c b/app/display/gimpdisplayshell-tool-events.c
index 6fd2a75195..917b16845a 100644
--- a/app/display/gimpdisplayshell-tool-events.c
+++ b/app/display/gimpdisplayshell-tool-events.c
@@ -1560,7 +1560,9 @@ gimp_display_shell_start_scrolling (GimpDisplayShell *shell,
{
GimpStatusbar *statusbar;
- gimp_image_set_active_layer (image, layer);
+ layers = g_list_prepend (NULL, layer);
+ gimp_image_set_selected_layers (image, layers);
+ g_list_free (layers);
statusbar = gimp_display_shell_get_statusbar (shell);
gimp_statusbar_push_temp (statusbar, GIMP_MESSAGE_INFO,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]