[gimp/metadata-browser] app: use gimp_modifiers_to_channel_op()
- From: Roman Joost <romanofski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/metadata-browser] app: use gimp_modifiers_to_channel_op()
- Date: Fri, 2 Dec 2011 02:07:35 +0000 (UTC)
commit 5320c66f157a999c9b391e50b8c6986e425876a9
Author: Michael Natterer <mitch gimp org>
Date: Wed Oct 5 19:19:14 2011 +0200
app: use gimp_modifiers_to_channel_op()
instead of replicating its logic in a non-portable way.
app/widgets/gimpitemtreeview.c | 19 +++----------------
app/widgets/gimpselectioneditor.c | 18 ++----------------
2 files changed, 5 insertions(+), 32 deletions(-)
---
diff --git a/app/widgets/gimpitemtreeview.c b/app/widgets/gimpitemtreeview.c
index d836a56..692b84b 100644
--- a/app/widgets/gimpitemtreeview.c
+++ b/app/widgets/gimpitemtreeview.c
@@ -1416,23 +1416,10 @@ gimp_item_tree_view_item_pre_clicked (GimpCellRendererViewable *cell,
if (renderer)
{
- GimpItem *item;
- GimpChannelOps op = GIMP_CHANNEL_OP_REPLACE;
+ GimpItem *item = GIMP_ITEM (renderer->viewable);
+ GimpChannelOps op;
- item = GIMP_ITEM (renderer->viewable);
-
- if ((state & GDK_SHIFT_MASK) && (state & GDK_CONTROL_MASK))
- {
- op = GIMP_CHANNEL_OP_INTERSECT;
- }
- else if (state & GDK_SHIFT_MASK)
- {
- op = GIMP_CHANNEL_OP_ADD;
- }
- else if (state & GDK_CONTROL_MASK)
- {
- op = GIMP_CHANNEL_OP_SUBTRACT;
- }
+ op = gimp_modifiers_to_channel_op (GTK_WIDGET (item_view), state);
gimp_item_to_selection (item, op,
TRUE, FALSE, 0.0, 0.0);
diff --git a/app/widgets/gimpselectioneditor.c b/app/widgets/gimpselectioneditor.c
index 81bc3e3..61a90c6 100644
--- a/app/widgets/gimpselectioneditor.c
+++ b/app/widgets/gimpselectioneditor.c
@@ -247,7 +247,7 @@ gimp_selection_view_button_press (GtkWidget *widget,
GimpSelectionOptions *sel_options;
GimpRegionSelectOptions *options;
GimpDrawable *drawable;
- GimpChannelOps operation = GIMP_CHANNEL_OP_REPLACE;
+ GimpChannelOps operation;
gint x, y;
GimpRGB color;
@@ -270,21 +270,7 @@ gimp_selection_view_button_press (GtkWidget *widget,
if (! drawable)
return TRUE;
- if (bevent->state & GDK_SHIFT_MASK)
- {
- if (bevent->state & GDK_CONTROL_MASK)
- {
- operation = GIMP_CHANNEL_OP_INTERSECT;
- }
- else
- {
- operation = GIMP_CHANNEL_OP_ADD;
- }
- }
- else if (bevent->state & GDK_CONTROL_MASK)
- {
- operation = GIMP_CHANNEL_OP_SUBTRACT;
- }
+ operation = gimp_modifiers_to_channel_op (widget, bevent->state);
x = gimp_image_get_width (image_editor->image) * bevent->x / renderer->width;
y = gimp_image_get_height (image_editor->image) * bevent->y / renderer->height;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]