[gimp/wip/Jehan/layers-dockable-refresh: 60/105] app, pdb: get rid of various gimp_image_get_active_channel().
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/wip/Jehan/layers-dockable-refresh: 60/105] app, pdb: get rid of various gimp_image_get_active_channel().
- Date: Thu, 23 Dec 2021 00:44:34 +0000 (UTC)
commit bdb4aa3477b0432effc618104a2a975cc55df09e
Author: Jehan <jehan girinstud io>
Date: Sun Jun 20 00:16:38 2021 +0200
app, pdb: get rid of various gimp_image_get_active_channel().
Replace them with gimp_image_get_selected_channels().
app/actions/image-actions.c | 2 +-
app/actions/layers-actions.c | 4 ++--
app/actions/layers-commands.c | 10 ++++++++--
app/core/gimpimage-quick-mask.c | 2 +-
app/dialogs/layer-add-mask-dialog.c | 11 ++++++++---
app/pdb/internal-procs.c | 2 +-
app/pdb/layer-cmds.c | 8 ++++++--
pdb/groups/layer.pdb | 8 ++++++--
8 files changed, 33 insertions(+), 14 deletions(-)
---
diff --git a/app/actions/image-actions.c b/app/actions/image-actions.c
index ce42238d3c..cdfdef7d4b 100644
--- a/app/actions/image-actions.c
+++ b/app/actions/image-actions.c
@@ -435,7 +435,7 @@ image_actions_update (GimpActionGroup *group,
is_indexed = (base_type == GIMP_INDEXED);
is_u8_gamma = (precision == GIMP_PRECISION_U8_NON_LINEAR);
is_double = (component_type == GIMP_COMPONENT_TYPE_DOUBLE);
- aux = (gimp_image_get_active_channel (image) != NULL);
+ aux = (gimp_image_get_selected_channels (image) != NULL);
lp = ! gimp_image_is_empty (image);
sel = ! gimp_channel_is_empty (gimp_image_get_mask (image));
diff --git a/app/actions/layers-actions.c b/app/actions/layers-actions.c
index 898477338f..01b3626e86 100644
--- a/app/actions/layers-actions.c
+++ b/app/actions/layers-actions.c
@@ -766,7 +766,7 @@ layers_actions_update (GimpActionGroup *group,
GList *iter = NULL;
GimpLayer *layer = NULL;
gboolean fs = FALSE; /* floating sel */
- gboolean ac = FALSE; /* active channel */
+ gboolean ac = FALSE; /* Has selected channels */
gboolean sel = FALSE;
gboolean indexed = FALSE; /* is indexed */
gboolean lock_alpha = TRUE;
@@ -802,7 +802,7 @@ layers_actions_update (GimpActionGroup *group,
if (image)
{
fs = (gimp_image_get_floating_selection (image) != NULL);
- ac = (gimp_image_get_active_channel (image) != NULL);
+ ac = (gimp_image_get_selected_channels (image) != NULL);
sel = ! gimp_channel_is_empty (gimp_image_get_mask (image));
indexed = (gimp_image_get_base_type (image) == GIMP_INDEXED);
diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c
index 32073bfd65..43508337d2 100644
--- a/app/actions/layers-commands.c
+++ b/app/actions/layers-commands.c
@@ -1383,9 +1383,15 @@ layers_mask_add_last_vals_cmd_callback (GimpAction *action,
if (config->layer_add_mask_type == GIMP_ADD_MASK_CHANNEL)
{
- channel = gimp_image_get_active_channel (image);
+ GList *selected_channels;
- if (! channel)
+ selected_channels = gimp_image_get_selected_channels (image);
+
+ if (selected_channels)
+ {
+ channel = selected_channels->data;
+ }
+ else
{
GimpContainer *channels = gimp_image_get_channels (image);
diff --git a/app/core/gimpimage-quick-mask.c b/app/core/gimpimage-quick-mask.c
index d9ad50319e..baff60dec5 100644
--- a/app/core/gimpimage-quick-mask.c
+++ b/app/core/gimpimage-quick-mask.c
@@ -65,7 +65,7 @@ gimp_image_set_quick_mask_state (GimpImage *image,
if (private->quick_mask_state)
channel_was_active = (private->quick_mask_state & CHANNEL_WAS_ACTIVE) != 0;
else
- channel_was_active = gimp_image_get_active_channel (image) != NULL;
+ channel_was_active = (gimp_image_get_selected_channels (image) != NULL);
/* Set private->quick_mask_state early so we can return early when
* being called recursively.
diff --git a/app/dialogs/layer-add-mask-dialog.c b/app/dialogs/layer-add-mask-dialog.c
index 77f12627b5..c122832b80 100644
--- a/app/dialogs/layer-add-mask-dialog.c
+++ b/app/dialogs/layer-add-mask-dialog.c
@@ -86,6 +86,7 @@ layer_add_mask_dialog_new (GList *layers,
GtkWidget *button;
GimpImage *image;
GimpChannel *channel;
+ GList *channels;
gchar *title;
gchar *desc;
gint n_layers = g_list_length (layers);
@@ -169,9 +170,13 @@ layer_add_mask_dialog_new (GList *layers,
G_CALLBACK (layer_add_mask_dialog_channel_selected),
private);
- channel = gimp_image_get_active_channel (image);
-
- if (! channel)
+ channels = gimp_image_get_selected_channels (image);
+ if (channels)
+ /* Mask dialog only requires one channel. Just take any of the
+ * selected ones randomly.
+ */
+ channel = channels->data;
+ else
channel = GIMP_CHANNEL (gimp_container_get_first_child (gimp_image_get_channels (image)));
gimp_container_view_select_item (GIMP_CONTAINER_VIEW (combo),
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 25446a4097..08410e66eb 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
#include "internal-procs.h"
-/* 759 procedures registered total */
+/* 761 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)
diff --git a/app/pdb/layer-cmds.c b/app/pdb/layer-cmds.c
index 53a6068482..131fc40411 100644
--- a/app/pdb/layer-cmds.c
+++ b/app/pdb/layer-cmds.c
@@ -558,10 +558,14 @@ layer_create_mask_invoker (GimpProcedure *procedure,
if (mask_type == GIMP_ADD_MASK_CHANNEL)
{
- channel = gimp_image_get_active_channel (gimp_item_get_image (GIMP_ITEM (layer)));
+ GList *channels;
- if (! channel)
+ channels = gimp_image_get_selected_channels (gimp_item_get_image (GIMP_ITEM (layer)));
+
+ if (! channels)
success = FALSE;
+ else
+ channel = channels->data;
}
if (success)
diff --git a/pdb/groups/layer.pdb b/pdb/groups/layer.pdb
index 79057a506e..71b03b59a0 100644
--- a/pdb/groups/layer.pdb
+++ b/pdb/groups/layer.pdb
@@ -358,10 +358,14 @@ HELP
if (mask_type == GIMP_ADD_MASK_CHANNEL)
{
- channel = gimp_image_get_active_channel (gimp_item_get_image (GIMP_ITEM (layer)));
+ GList *channels;
- if (! channel)
+ channels = gimp_image_get_selected_channels (gimp_item_get_image (GIMP_ITEM (layer)));
+
+ if (! channels)
success = FALSE;
+ else
+ channel = channels->data;
}
if (success)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]