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.
This commit is contained in:
Michael Natterer 2016-10-01 22:45:51 +02:00
parent 12cb09836a
commit 713e4071b2
4 changed files with 79 additions and 29 deletions

View File

@ -123,6 +123,7 @@ gimp_guide_tool_button_release (GimpTool *tool,
if (release_type == GIMP_BUTTON_RELEASE_CANCEL)
{
/* custom guides are moved live */
if (guide_tool->guide_custom)
gimp_image_move_guide (image, guide_tool->guide,
guide_tool->guide_old_position, TRUE);
@ -272,11 +273,19 @@ gimp_guide_tool_motion (GimpTool *tool,
guide_tool->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
{
gimp_tool_push_status_length (tool, display,
guide_tool->guide ?
_("Move Guide: ") : _("Add Guide: "),
_("Add Guide: "),
SWAP_ORIENT (guide_tool->guide_orientation),
guide_tool->guide_position,
NULL);
@ -290,6 +299,7 @@ gimp_guide_tool_draw (GimpDrawTool *draw_tool)
if (guide_tool->guide_position != GIMP_GUIDE_POSITION_UNDEFINED)
{
/* custom guides are moved live */
if (! guide_tool->guide_custom)
gimp_draw_tool_add_guide (draw_tool,
guide_tool->guide_orientation,
@ -318,18 +328,18 @@ gimp_guide_tool_start (GimpTool *parent_tool,
if (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_orientation = gimp_guide_get_orientation (guide);
guide_tool->guide_custom = gimp_guide_is_custom (guide);
guide_tool->guide_old_position = gimp_guide_get_position (guide);
}
else
{
guide_tool->guide = NULL;
guide_tool->guide_old_position = 0;
guide_tool->guide_position = GIMP_GUIDE_POSITION_UNDEFINED;
guide_tool->guide_orientation = orientation;
guide_tool->guide_custom = FALSE;
guide_tool->guide_old_position = GIMP_GUIDE_POSITION_UNDEFINED;
}
gimp_tool_set_cursor (tool, display,
@ -344,12 +354,24 @@ gimp_guide_tool_start (GimpTool *parent_tool,
gimp_draw_tool_start (GIMP_DRAW_TOOL (guide_tool), display);
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
{
gimp_tool_push_status_length (tool, display,
_("Add Guide: "),
SWAP_ORIENT (guide_tool->guide_orientation),
guide_tool->guide_position,
NULL);
}
}
/* public functions */

View File

@ -38,12 +38,10 @@ struct _GimpGuideTool
GimpDrawTool parent_instance;
GimpGuide *guide;
gint guide_old_position;
gint guide_position;
GimpOrientationType guide_orientation;
/* for live-moving custom guides */
gboolean guide_custom;
gint guide_old_position;
};
struct _GimpGuideToolClass

View File

@ -240,16 +240,26 @@ gimp_sample_point_tool_motion (GimpTool *tool,
_("Remove 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
{
gimp_tool_push_status_coords (tool, display,
gimp_tool_control_get_precision (tool->control),
sp_tool->sample_point ?
_("Move Sample Point: ") :
_("Add Sample Point: "),
sp_tool->sample_point_x,
", ",
sp_tool->sample_point_x,
sp_tool->sample_point_y,
NULL);
}
}
@ -289,12 +299,17 @@ gimp_sample_point_tool_start (GimpTool *parent_tool,
sp_tool->sample_point = sample_point;
gimp_sample_point_get_position (sample_point,
&sp_tool->sample_point_x,
&sp_tool->sample_point_y);
&sp_tool->sample_point_old_x,
&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
{
sp_tool->sample_point = NULL;
sp_tool->sample_point_old_x = 0;
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;
}
@ -311,16 +326,29 @@ gimp_sample_point_tool_start (GimpTool *parent_tool,
gimp_draw_tool_start (GIMP_DRAW_TOOL (sp_tool), display);
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
{
gimp_tool_push_status_coords (tool, display,
gimp_tool_control_get_precision (tool->control),
sample_point ?
_("Move Sample Point: ") :
_("Add Sample Point: "),
sp_tool->sample_point_x,
", ",
sp_tool->sample_point_y,
NULL);
}
}
/* public functions */

View File

@ -38,6 +38,8 @@ struct _GimpSamplePointTool
GimpDrawTool parent_instance;
GimpSamplePoint *sample_point;
gint sample_point_old_x;
gint sample_point_old_y;
gint sample_point_x;
gint sample_point_y;
};