[gimp] Bug 785061 - Add channels-select-(prev|next|top|bottom) actions.
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 785061 - Add channels-select-(prev|next|top|bottom) actions.
- Date: Thu, 16 Nov 2017 01:10:02 +0000 (UTC)
commit 1e87642ef094b80a57d421fd3c72902fc1fff0a3
Author: Jehan <jehan girinstud io>
Date: Thu Nov 16 01:26:19 2017 +0100
Bug 785061 - Add channels-select-(prev|next|top|bottom) actions.
app/actions/channels-actions.c | 37 +++++++++++++++++++++++++++++++++++++
app/actions/channels-commands.c | 22 ++++++++++++++++++++++
app/actions/channels-commands.h | 4 ++++
app/widgets/gimphelp-ids.h | 4 ++++
4 files changed, 67 insertions(+), 0 deletions(-)
---
diff --git a/app/actions/channels-actions.c b/app/actions/channels-actions.c
index 63a126a..4d9dcaf 100644
--- a/app/actions/channels-actions.c
+++ b/app/actions/channels-actions.c
@@ -218,6 +218,33 @@ static const GimpEnumActionEntry channels_to_selection_actions[] =
GIMP_HELP_CHANNEL_SELECTION_INTERSECT }
};
+static const GimpEnumActionEntry channels_select_actions[] =
+{
+ { "channels-select-top", NULL,
+ NC_("channels-action", "Select _Top Channel"), NULL,
+ NC_("channels-action", "Select the topmost channel"),
+ GIMP_ACTION_SELECT_FIRST, FALSE,
+ GIMP_HELP_CHANNEL_TOP },
+
+ { "channels-select-bottom", NULL,
+ NC_("channels-action", "Select _Bottom Channel"), NULL,
+ NC_("channels-action", "Select the bottommost channel"),
+ GIMP_ACTION_SELECT_LAST, FALSE,
+ GIMP_HELP_CHANNEL_BOTTOM },
+
+ { "channels-select-previous", NULL,
+ NC_("channels-action", "Select _Previous Channel"), NULL,
+ NC_("channels-action", "Select the channel above the current channel"),
+ GIMP_ACTION_SELECT_PREVIOUS, FALSE,
+ GIMP_HELP_CHANNEL_PREVIOUS },
+
+ { "channels-select-next", NULL,
+ NC_("channels-action", "Select _Next Channel"), NULL,
+ NC_("channels-action", "Select the channel below the current channel"),
+ GIMP_ACTION_SELECT_NEXT, FALSE,
+ GIMP_HELP_CHANNEL_NEXT }
+};
+
void
channels_actions_setup (GimpActionGroup *group)
@@ -240,6 +267,11 @@ channels_actions_setup (GimpActionGroup *group)
G_N_ELEMENTS (channels_to_selection_actions),
G_CALLBACK (channels_to_selection_cmd_callback));
+ gimp_action_group_add_enum_actions (group, "channels-action",
+ channels_select_actions,
+ G_N_ELEMENTS (channels_select_actions),
+ G_CALLBACK (channels_select_cmd_callback));
+
items_actions_setup (group, "channels");
}
@@ -305,6 +337,11 @@ channels_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("channels-selection-subtract", !fs && (channel || component));
SET_SENSITIVE ("channels-selection-intersect", !fs && (channel || component));
+ SET_SENSITIVE ("channels-select-top", !fs && channel && prev);
+ SET_SENSITIVE ("channels-select-bottom", !fs && channel && next);
+ SET_SENSITIVE ("channels-select-previous", !fs && channel && prev);
+ SET_SENSITIVE ("channels-select-next", !fs && channel && next);
+
#undef SET_SENSITIVE
items_actions_update (group, "channels", GIMP_ITEM (channel));
diff --git a/app/actions/channels-commands.c b/app/actions/channels-commands.c
index 3d4e89e..734cb75 100644
--- a/app/actions/channels-commands.c
+++ b/app/actions/channels-commands.c
@@ -424,6 +424,28 @@ channels_color_tag_cmd_callback (GtkAction *action,
(GimpColorTag) value);
}
+void
+channels_select_cmd_callback (GtkAction *action,
+ gint value,
+ gpointer data)
+{
+ GimpImage *image;
+ GimpChannel *channel;
+ GimpChannel *channel2;
+ GimpContainer *container;
+ return_if_no_channel (image, channel, data);
+
+ container = gimp_image_get_channels (image);
+ channel2 = (GimpChannel *) action_select_object ((GimpActionSelectType) value,
+ container,
+ (GimpObject *) channel);
+
+ if (channel2 && channel2 != channel)
+ {
+ gimp_image_set_active_channel (image, channel2);
+ gimp_image_flush (image);
+ }
+}
/* private functions */
diff --git a/app/actions/channels-commands.h b/app/actions/channels-commands.h
index f88ff92..3b57f72 100644
--- a/app/actions/channels-commands.h
+++ b/app/actions/channels-commands.h
@@ -56,5 +56,9 @@ void channels_color_tag_cmd_callback (GtkAction *action,
gint value,
gpointer data);
+void channels_select_cmd_callback (GtkAction *action,
+ gint value,
+ gpointer data);
+
#endif /* __CHANNELS_COMMANDS_H__ */
diff --git a/app/widgets/gimphelp-ids.h b/app/widgets/gimphelp-ids.h
index 174546b..9238406 100644
--- a/app/widgets/gimphelp-ids.h
+++ b/app/widgets/gimphelp-ids.h
@@ -233,6 +233,10 @@
#define GIMP_HELP_CHANNEL_LOWER_TO_BOTTOM "gimp-channel-lower-to-bottom"
#define GIMP_HELP_CHANNEL_DUPLICATE "gimp-channel-duplicate"
#define GIMP_HELP_CHANNEL_DELETE "gimp-channel-delete"
+#define GIMP_HELP_CHANNEL_PREVIOUS "gimp-channel-previous"
+#define GIMP_HELP_CHANNEL_NEXT "gimp-channel-next"
+#define GIMP_HELP_CHANNEL_TOP "gimp-channel-top"
+#define GIMP_HELP_CHANNEL_BOTTOM "gimp-channel-bottom"
#define GIMP_HELP_CHANNEL_VISIBLE "gimp-channel-visible"
#define GIMP_HELP_CHANNEL_LINKED "gimp-channel-linked"
#define GIMP_HELP_CHANNEL_COLOR_TAG "gimp-channel-color-tag"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]