[gimp] app: add status message to the handle transform tool
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add status message to the handle transform tool
- Date: Mon, 19 Jun 2017 20:53:49 +0000 (UTC)
commit 96da8c1505ea6c1e11874d77d2d692b2519e099f
Author: Michael Natterer <mitch gimp org>
Date: Mon Jun 19 22:52:26 2017 +0200
app: add status message to the handle transform tool
and fix a few glitches from tool widget porting.
app/display/gimptoolhandlegrid.c | 95 ++++++++++++++++++++++++++++-------
app/tools/gimphandletransformtool.c | 17 ++++--
2 files changed, 87 insertions(+), 25 deletions(-)
---
diff --git a/app/display/gimptoolhandlegrid.c b/app/display/gimptoolhandlegrid.c
index fdd99ac..39e7422 100644
--- a/app/display/gimptoolhandlegrid.c
+++ b/app/display/gimptoolhandlegrid.c
@@ -33,6 +33,8 @@
#include "core/gimp-transform-utils.h"
#include "core/gimp-utils.h"
+#include "widgets/gimpwidgets-utils.h"
+
#include "gimpcanvashandle.h"
#include "gimpdisplayshell.h"
#include "gimptoolhandlegrid.h"
@@ -112,24 +114,24 @@ static void gimp_tool_handle_grid_motion (GimpToolWidget *widge
const GimpCoords *coords,
guint32 time,
GdkModifierType state);
-static void gimp_tool_handle_grid_hover (GimpToolWidget *widget,
- const GimpCoords *coords,
- GdkModifierType state,
- gboolean proximity);
-static gboolean gimp_tool_handle_grid_get_cursor (GimpToolWidget *widget,
- const GimpCoords *coords,
- GdkModifierType state,
- GimpCursorType *cursor,
- GimpToolCursorType *tool_cursor,
- GimpCursorModifier *cursor_modifier);
-
-static void gimp_tool_handle_grid_update_hilight (GimpToolHandleGrid *grid);
-static void gimp_tool_handle_grid_update_matrix (GimpToolHandleGrid *grid);
-
-static gboolean is_handle_position_valid (GimpToolHandleGrid *grid,
- gint handle);
-static void handle_micro_move (GimpToolHandleGrid *grid,
- gint handle);
+static void gimp_tool_handle_grid_hover (GimpToolWidget *widget,
+ const GimpCoords *coords,
+ GdkModifierType state,
+ gboolean proximity);
+static gboolean gimp_tool_handle_grid_get_cursor (GimpToolWidget *widget,
+ const GimpCoords *coords,
+ GdkModifierType state,
+ GimpCursorType *cursor,
+ GimpToolCursorType *tool_cursor,
+ GimpCursorModifier *cursor_modifier);
+
+static void gimp_tool_handle_grid_update_hilight (GimpToolHandleGrid *grid);
+static void gimp_tool_handle_grid_update_matrix (GimpToolHandleGrid *grid);
+
+static gboolean is_handle_position_valid (GimpToolHandleGrid *grid,
+ gint handle);
+static void handle_micro_move (GimpToolHandleGrid *grid,
+ gint handle);
static inline gdouble calc_angle (gdouble ax,
gdouble ay,
@@ -735,7 +737,7 @@ gimp_tool_handle_grid_motion (GimpToolWidget *widget,
{
case 1:
/* move */
- for (i = 1; i < 4; i++)
+ for (i = 0; i < 4; i++)
{
newpos_x[i] = oldpos_x[i] + diff_y;
newpos_y[i] = oldpos_y[i] + diff_y;
@@ -810,6 +812,7 @@ gimp_tool_handle_grid_hover (GimpToolWidget *widget,
{
GimpToolHandleGrid *grid = GIMP_TOOL_HANDLE_GRID (widget);
GimpToolHandleGridPrivate *private = grid->private;
+ gchar *status = NULL;
gint i;
private->mouse_x = coords->x;
@@ -828,6 +831,60 @@ gimp_tool_handle_grid_hover (GimpToolWidget *widget,
}
}
+ if (proximity)
+ {
+ GdkModifierType extend_mask = gimp_get_extend_selection_mask ();
+ GdkModifierType toggle_mask = gimp_get_toggle_behavior_mask ();
+
+ switch (private->handle_mode)
+ {
+ case GIMP_HANDLE_MODE_ADD_TRANSFORM:
+ if (private->handle > 0)
+ {
+ const gchar *s = NULL;
+
+ switch (private->n_handles)
+ {
+ case 1:
+ s = _("Click-Drag to move");
+ break;
+ case 2:
+ s = _("Click-Drag to rotate and scale");
+ break;
+ case 3:
+ s = _("Click-Drag to shear and scale");
+ break;
+ case 4:
+ s = _("Click-Drag to change perspective");
+ break;
+ }
+
+ status = gimp_suggest_modifiers (s,
+ extend_mask | toggle_mask,
+ NULL, NULL, NULL);
+ }
+ else
+ {
+ if (private->n_handles < 4)
+ status = g_strdup (_("Click to add a handle"));
+ }
+ break;
+
+ case GIMP_HANDLE_MODE_MOVE:
+ if (private->handle > 0)
+ status = g_strdup (_("Click-Drag to move this handle"));
+ break;
+
+ case GIMP_HANDLE_MODE_REMOVE:
+ if (private->handle > 0)
+ status = g_strdup (_("Click-Drag to remove this handle"));
+ break;
+ }
+ }
+
+ gimp_tool_widget_status (widget, status);
+ g_free (status);
+
gimp_tool_handle_grid_update_hilight (grid);
}
diff --git a/app/tools/gimphandletransformtool.c b/app/tools/gimphandletransformtool.c
index ce77054..fe33cab 100644
--- a/app/tools/gimphandletransformtool.c
+++ b/app/tools/gimphandletransformtool.c
@@ -312,10 +312,14 @@ gimp_handle_transform_tool_prepare (GimpTransformTool *tr_tool)
static GimpToolWidget *
gimp_handle_transform_tool_get_widget (GimpTransformTool *tr_tool)
{
- GimpTool *tool = GIMP_TOOL (tr_tool);
- GimpTransformOptions *options = GIMP_TRANSFORM_TOOL_GET_OPTIONS (tr_tool);
- GimpDisplayShell *shell = gimp_display_get_shell (tool->display);
- GimpToolWidget *widget;
+ GimpTool *tool = GIMP_TOOL (tr_tool);
+ GimpTransformOptions *options;
+ GimpHandleTransformOptions *ht_options;
+ GimpDisplayShell *shell = gimp_display_get_shell (tool->display);
+ GimpToolWidget *widget;
+
+ options = GIMP_TRANSFORM_TOOL_GET_OPTIONS (tr_tool);
+ ht_options = GIMP_HANDLE_TRANSFORM_TOOL_GET_OPTIONS (tr_tool);
widget = gimp_tool_handle_grid_new (shell,
tr_tool->x1,
@@ -344,8 +348,9 @@ gimp_handle_transform_tool_get_widget (GimpTransformTool *tr_tool)
NULL);
g_object_set (widget,
- "guide-type", options->grid_type,
- "n-guides", options->grid_size,
+ "guide-type", options->grid_type,
+ "n-guides", options->grid_size,
+ "handle-mode", ht_options->handle_mode,
NULL);
g_signal_connect (widget, "changed",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]