[gimp/gimp-2-10] app: in the move tool, blink type box when there's no item to move
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: in the move tool, blink type box when there's no item to move
- Date: Mon, 10 Dec 2018 13:57:51 +0000 (UTC)
commit 92c6f87391d93592c316b7c3eaaf17ed2cd7005b
Author: Ell <ell_se yahoo com>
Date: Mon Dec 10 07:34:27 2018 -0500
app: in the move tool, blink type box when there's no item to move
In the move tool, when there is no item of the selected type to
move, blink the move-type box widget in the tool options, in
addition to showing an error message in the status bar, to hint at
the source of the error.
(cherry picked from commit c9bc3d7a09978d61cc6c2ddb8497c3116a1884f8)
app/tools/gimpeditselectiontool.c | 14 ++++++++------
app/tools/gimpeditselectiontool.h | 3 ++-
app/tools/gimpmoveoptions.c | 17 ++++++++++-------
app/tools/gimpmoveoptions.h | 3 +++
app/tools/gimpmovetool.c | 11 ++++++-----
5 files changed, 29 insertions(+), 19 deletions(-)
---
diff --git a/app/tools/gimpeditselectiontool.c b/app/tools/gimpeditselectiontool.c
index 9c37a40e3e..c9d46e4018 100644
--- a/app/tools/gimpeditselectiontool.c
+++ b/app/tools/gimpeditselectiontool.c
@@ -1007,14 +1007,15 @@ gimp_edit_selection_tool_key_press (GimpTool *tool,
}
return gimp_edit_selection_tool_translate (tool, kevent, translate_type,
- display);
+ display, NULL);
}
gboolean
gimp_edit_selection_tool_translate (GimpTool *tool,
GdkEventKey *kevent,
GimpTransformType translate_type,
- GimpDisplay *display)
+ GimpDisplay *display,
+ GtkWidget *type_box)
{
gint inc_x = 0;
gint inc_y = 0;
@@ -1092,6 +1093,9 @@ gimp_edit_selection_tool_translate (GimpTool *tool,
case GIMP_TRANSFORM_TYPE_SELECTION:
item = GIMP_ITEM (gimp_image_get_mask (image));
+ if (gimp_channel_is_empty (GIMP_CHANNEL (item)))
+ item = NULL;
+
edit_mode = GIMP_TRANSLATE_MODE_MASK;
undo_type = GIMP_UNDO_GROUP_MASK;
@@ -1105,10 +1109,6 @@ gimp_edit_selection_tool_translate (GimpTool *tool,
/* cannot happen, don't translate this message */
locked_message = "The selection's position is locked.";
}
- else if (gimp_channel_is_empty (GIMP_CHANNEL (item)))
- {
- locked_message = _("The selection is empty.");
- }
break;
case GIMP_TRANSFORM_TYPE_PATH:
@@ -1188,6 +1188,8 @@ gimp_edit_selection_tool_translate (GimpTool *tool,
if (! item)
{
gimp_tool_message_literal (tool, display, null_message);
+ if (type_box)
+ gimp_widget_blink (type_box);
return TRUE;
}
else if (locked_message)
diff --git a/app/tools/gimpeditselectiontool.h b/app/tools/gimpeditselectiontool.h
index a79c007cdd..b34055c1a8 100644
--- a/app/tools/gimpeditselectiontool.h
+++ b/app/tools/gimpeditselectiontool.h
@@ -43,7 +43,8 @@ gboolean gimp_edit_selection_tool_key_press (GimpTool *tool,
gboolean gimp_edit_selection_tool_translate (GimpTool *tool,
GdkEventKey *kevent,
GimpTransformType translate_type,
- GimpDisplay *display);
+ GimpDisplay *display,
+ GtkWidget *type_box);
#endif /* __GIMP_EDIT_SELECTION_TOOL_H__ */
diff --git a/app/tools/gimpmoveoptions.c b/app/tools/gimpmoveoptions.c
index 170b1c437a..7f76463ca4 100644
--- a/app/tools/gimpmoveoptions.c
+++ b/app/tools/gimpmoveoptions.c
@@ -179,18 +179,21 @@ gimp_move_options_notify_type (GimpMoveOptions *move_options,
GtkWidget *
gimp_move_options_gui (GimpToolOptions *tool_options)
{
- GObject *config = G_OBJECT (tool_options);
- GtkWidget *vbox = gimp_tool_options_gui (tool_options);
- GtkWidget *hbox;
- GtkWidget *box;
- GtkWidget *label;
- GtkWidget *frame;
- gchar *title;
+ GObject *config = G_OBJECT (tool_options);
+ GimpMoveOptions *options = GIMP_MOVE_OPTIONS (tool_options);
+ GtkWidget *vbox = gimp_tool_options_gui (tool_options);
+ GtkWidget *hbox;
+ GtkWidget *box;
+ GtkWidget *label;
+ GtkWidget *frame;
+ gchar *title;
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
+ options->type_box = hbox;
+
label = gtk_label_new (_("Move:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
diff --git a/app/tools/gimpmoveoptions.h b/app/tools/gimpmoveoptions.h
index 60a463e046..bb2868332e 100644
--- a/app/tools/gimpmoveoptions.h
+++ b/app/tools/gimpmoveoptions.h
@@ -39,6 +39,9 @@ struct _GimpMoveOptions
GimpTransformType move_type;
gboolean move_current;
+
+ /* options gui */
+ GtkWidget *type_box;
};
diff --git a/app/tools/gimpmovetool.c b/app/tools/gimpmovetool.c
index 21023b0f24..393d51f903 100644
--- a/app/tools/gimpmovetool.c
+++ b/app/tools/gimpmovetool.c
@@ -272,6 +272,9 @@ gimp_move_tool_button_press (GimpTool *tool,
{
active_item = GIMP_ITEM (gimp_image_get_mask (image));
+ if (gimp_channel_is_empty (GIMP_CHANNEL (active_item)))
+ active_item = NULL;
+
translate_mode = GIMP_TRANSLATE_MODE_MASK;
if (! active_item)
@@ -283,10 +286,6 @@ gimp_move_tool_button_press (GimpTool *tool,
{
locked_message = "The selection's position is locked.";
}
- else if (gimp_channel_is_empty (GIMP_CHANNEL (active_item)))
- {
- locked_message = _("The selection is empty.");
- }
}
break;
@@ -330,6 +329,7 @@ gimp_move_tool_button_press (GimpTool *tool,
if (! active_item)
{
gimp_tool_message_literal (tool, display, null_message);
+ gimp_widget_blink (options->type_box);
gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, display);
return;
}
@@ -405,7 +405,8 @@ gimp_move_tool_key_press (GimpTool *tool,
return gimp_edit_selection_tool_translate (tool, kevent,
options->move_type,
- display);
+ display,
+ options->type_box);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]