Commit 713e4071 authored by Michael Natterer's avatar Michael Natterer 😴

Bug 770911 - Move tool should display relative coordinates in statusbar...

...when moving guides

Show relative coordinates when moving guides and sample points, the
cursor display in the statusbar already shows absolute coordinates.
parent 12cb0983
...@@ -123,6 +123,7 @@ gimp_guide_tool_button_release (GimpTool *tool, ...@@ -123,6 +123,7 @@ gimp_guide_tool_button_release (GimpTool *tool,
if (release_type == GIMP_BUTTON_RELEASE_CANCEL) if (release_type == GIMP_BUTTON_RELEASE_CANCEL)
{ {
/* custom guides are moved live */
if (guide_tool->guide_custom) if (guide_tool->guide_custom)
gimp_image_move_guide (image, guide_tool->guide, gimp_image_move_guide (image, guide_tool->guide,
guide_tool->guide_old_position, TRUE); guide_tool->guide_old_position, TRUE);
...@@ -272,11 +273,19 @@ gimp_guide_tool_motion (GimpTool *tool, ...@@ -272,11 +273,19 @@ gimp_guide_tool_motion (GimpTool *tool,
guide_tool->guide ? guide_tool->guide ?
_("Remove Guide") : _("Cancel Guide")); _("Remove Guide") : _("Cancel Guide"));
} }
else if (guide_tool->guide)
{
gimp_tool_push_status_length (tool, display,
_("Move Guide: "),
SWAP_ORIENT (guide_tool->guide_orientation),
guide_tool->guide_position -
guide_tool->guide_old_position,
NULL);
}
else else
{ {
gimp_tool_push_status_length (tool, display, gimp_tool_push_status_length (tool, display,
guide_tool->guide ? _("Add Guide: "),
_("Move Guide: ") : _("Add Guide: "),
SWAP_ORIENT (guide_tool->guide_orientation), SWAP_ORIENT (guide_tool->guide_orientation),
guide_tool->guide_position, guide_tool->guide_position,
NULL); NULL);
...@@ -290,6 +299,7 @@ gimp_guide_tool_draw (GimpDrawTool *draw_tool) ...@@ -290,6 +299,7 @@ gimp_guide_tool_draw (GimpDrawTool *draw_tool)
if (guide_tool->guide_position != GIMP_GUIDE_POSITION_UNDEFINED) if (guide_tool->guide_position != GIMP_GUIDE_POSITION_UNDEFINED)
{ {
/* custom guides are moved live */
if (! guide_tool->guide_custom) if (! guide_tool->guide_custom)
gimp_draw_tool_add_guide (draw_tool, gimp_draw_tool_add_guide (draw_tool,
guide_tool->guide_orientation, guide_tool->guide_orientation,
...@@ -318,18 +328,18 @@ gimp_guide_tool_start (GimpTool *parent_tool, ...@@ -318,18 +328,18 @@ gimp_guide_tool_start (GimpTool *parent_tool,
if (guide) if (guide)
{ {
guide_tool->guide = guide; guide_tool->guide = guide;
guide_tool->guide_old_position = gimp_guide_get_position (guide);
guide_tool->guide_position = gimp_guide_get_position (guide); guide_tool->guide_position = gimp_guide_get_position (guide);
guide_tool->guide_orientation = gimp_guide_get_orientation (guide); guide_tool->guide_orientation = gimp_guide_get_orientation (guide);
guide_tool->guide_custom = gimp_guide_is_custom (guide); guide_tool->guide_custom = gimp_guide_is_custom (guide);
guide_tool->guide_old_position = gimp_guide_get_position (guide);
} }
else else
{ {
guide_tool->guide = NULL; guide_tool->guide = NULL;
guide_tool->guide_old_position = 0;
guide_tool->guide_position = GIMP_GUIDE_POSITION_UNDEFINED; guide_tool->guide_position = GIMP_GUIDE_POSITION_UNDEFINED;
guide_tool->guide_orientation = orientation; guide_tool->guide_orientation = orientation;
guide_tool->guide_custom = FALSE; guide_tool->guide_custom = FALSE;
guide_tool->guide_old_position = GIMP_GUIDE_POSITION_UNDEFINED;
} }
gimp_tool_set_cursor (tool, display, gimp_tool_set_cursor (tool, display,
...@@ -344,11 +354,23 @@ gimp_guide_tool_start (GimpTool *parent_tool, ...@@ -344,11 +354,23 @@ gimp_guide_tool_start (GimpTool *parent_tool,
gimp_draw_tool_start (GIMP_DRAW_TOOL (guide_tool), display); gimp_draw_tool_start (GIMP_DRAW_TOOL (guide_tool), display);
gimp_tool_push_status_length (tool, display, if (guide_tool->guide)
_("Add Guide: "), {
SWAP_ORIENT (guide_tool->guide_orientation), gimp_tool_push_status_length (tool, display,
guide_tool->guide_position, _("Move Guide: "),
NULL); SWAP_ORIENT (guide_tool->guide_orientation),
guide_tool->guide_position -
guide_tool->guide_old_position,
NULL);
}
else
{
gimp_tool_push_status_length (tool, display,
_("Add Guide: "),
SWAP_ORIENT (guide_tool->guide_orientation),
guide_tool->guide_position,
NULL);
}
} }
......
...@@ -38,12 +38,10 @@ struct _GimpGuideTool ...@@ -38,12 +38,10 @@ struct _GimpGuideTool
GimpDrawTool parent_instance; GimpDrawTool parent_instance;
GimpGuide *guide; GimpGuide *guide;
gint guide_old_position;
gint guide_position; gint guide_position;
GimpOrientationType guide_orientation; GimpOrientationType guide_orientation;
/* for live-moving custom guides */
gboolean guide_custom; gboolean guide_custom;
gint guide_old_position;
}; };
struct _GimpGuideToolClass struct _GimpGuideToolClass
......
...@@ -240,16 +240,26 @@ gimp_sample_point_tool_motion (GimpTool *tool, ...@@ -240,16 +240,26 @@ gimp_sample_point_tool_motion (GimpTool *tool,
_("Remove Sample Point") : _("Remove Sample Point") :
_("Cancel Sample Point")); _("Cancel Sample Point"));
} }
else if (sp_tool->sample_point)
{
gimp_tool_push_status_coords (tool, display,
gimp_tool_control_get_precision (tool->control),
_("Move Sample Point: "),
sp_tool->sample_point_x -
sp_tool->sample_point_old_x,
", ",
sp_tool->sample_point_y -
sp_tool->sample_point_old_y,
NULL);
}
else else
{ {
gimp_tool_push_status_coords (tool, display, gimp_tool_push_status_coords (tool, display,
gimp_tool_control_get_precision (tool->control), gimp_tool_control_get_precision (tool->control),
sp_tool->sample_point ?
_("Move Sample Point: ") :
_("Add Sample Point: "), _("Add Sample Point: "),
sp_tool->sample_point_x, sp_tool->sample_point_x,
", ", ", ",
sp_tool->sample_point_x, sp_tool->sample_point_y,
NULL); NULL);
} }
} }
...@@ -289,14 +299,19 @@ gimp_sample_point_tool_start (GimpTool *parent_tool, ...@@ -289,14 +299,19 @@ gimp_sample_point_tool_start (GimpTool *parent_tool,
sp_tool->sample_point = sample_point; sp_tool->sample_point = sample_point;
gimp_sample_point_get_position (sample_point, gimp_sample_point_get_position (sample_point,
&sp_tool->sample_point_x, &sp_tool->sample_point_old_x,
&sp_tool->sample_point_y); &sp_tool->sample_point_old_y);
sp_tool->sample_point_x = sp_tool->sample_point_old_x;
sp_tool->sample_point_y = sp_tool->sample_point_old_y;
} }
else else
{ {
sp_tool->sample_point = NULL; sp_tool->sample_point = NULL;
sp_tool->sample_point_x = GIMP_SAMPLE_POINT_POSITION_UNDEFINED; sp_tool->sample_point_old_x = 0;
sp_tool->sample_point_y = GIMP_SAMPLE_POINT_POSITION_UNDEFINED; sp_tool->sample_point_old_y = 0;
sp_tool->sample_point_x = GIMP_SAMPLE_POINT_POSITION_UNDEFINED;
sp_tool->sample_point_y = GIMP_SAMPLE_POINT_POSITION_UNDEFINED;
} }
gimp_tool_set_cursor (tool, display, gimp_tool_set_cursor (tool, display,
...@@ -311,15 +326,28 @@ gimp_sample_point_tool_start (GimpTool *parent_tool, ...@@ -311,15 +326,28 @@ gimp_sample_point_tool_start (GimpTool *parent_tool,
gimp_draw_tool_start (GIMP_DRAW_TOOL (sp_tool), display); gimp_draw_tool_start (GIMP_DRAW_TOOL (sp_tool), display);
gimp_tool_push_status_coords (tool, display, if (sp_tool->sample_point)
gimp_tool_control_get_precision (tool->control), {
sample_point ? gimp_tool_push_status_coords (tool, display,
_("Move Sample Point: ") : gimp_tool_control_get_precision (tool->control),
_("Add Sample Point: "), _("Move Sample Point: "),
sp_tool->sample_point_x, sp_tool->sample_point_x -
", ", sp_tool->sample_point_old_x,
sp_tool->sample_point_y, ", ",
NULL); sp_tool->sample_point_y -
sp_tool->sample_point_old_y,
NULL);
}
else
{
gimp_tool_push_status_coords (tool, display,
gimp_tool_control_get_precision (tool->control),
_("Add Sample Point: "),
sp_tool->sample_point_x,
", ",
sp_tool->sample_point_y,
NULL);
}
} }
......
...@@ -38,6 +38,8 @@ struct _GimpSamplePointTool ...@@ -38,6 +38,8 @@ struct _GimpSamplePointTool
GimpDrawTool parent_instance; GimpDrawTool parent_instance;
GimpSamplePoint *sample_point; GimpSamplePoint *sample_point;
gint sample_point_old_x;
gint sample_point_old_y;
gint sample_point_x; gint sample_point_x;
gint sample_point_y; gint sample_point_y;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment