Added statusbar help-messages for the Free Select Tool.

2008-05-20  Martin Nordholts  <martinn@svn.gnome.org>

	Added statusbar help-messages for the Free Select Tool.

	* app/tools/gimpfreeselecttool.c
	(gimp_free_select_tool_oper_update): Don't bail out if
	tool->display is NULL, instead modify the underlying logic to deal
	with this.

svn path=/trunk/; revision=25721
This commit is contained in:
Martin Nordholts
2008-05-20 17:06:19 +00:00
committed by Martin Nordholts
parent d6e3339f1b
commit 59e3ee1317
2 changed files with 73 additions and 20 deletions

View File

@ -1,3 +1,12 @@
2008-05-20 Martin Nordholts <martinn@svn.gnome.org>
Added statusbar help-messages for the Free Select Tool.
* app/tools/gimpfreeselecttool.c
(gimp_free_select_tool_oper_update): Don't bail out if
tool->display is NULL, instead modify the underlying logic to deal
with this.
2008-05-20 Michael Natterer <mitch@gimp.org> 2008-05-20 Michael Natterer <mitch@gimp.org>
* app/tools/gimpimagemaptool.c: remove * app/tools/gimpimagemaptool.c: remove

View File

@ -222,7 +222,8 @@ gimp_free_select_tool_should_close (GimpFreeSelectTool *fst,
gdouble dist; gdouble dist;
if (fst->polygon_modified || if (fst->polygon_modified ||
fst->n_segment_indices <= 1) fst->n_segment_indices <= 1 ||
GIMP_TOOL (fst)->display == NULL)
return FALSE; return FALSE;
dist = gimp_draw_tool_calc_distance_square (GIMP_DRAW_TOOL (fst), dist = gimp_draw_tool_calc_distance_square (GIMP_DRAW_TOOL (fst),
@ -245,6 +246,8 @@ gimp_free_select_tool_select_closest_segment_point (GimpFreeSelectTool *fst,
gint grabbed_segment_index = INVALID_INDEX; gint grabbed_segment_index = INVALID_INDEX;
gint i; gint i;
if (GIMP_TOOL (fst)->display != NULL)
{
for (i = 0; i < fst->n_segment_indices; i++) for (i = 0; i < fst->n_segment_indices; i++)
{ {
gdouble dist; gdouble dist;
@ -264,6 +267,7 @@ gimp_free_select_tool_select_closest_segment_point (GimpFreeSelectTool *fst,
grabbed_segment_index = i; grabbed_segment_index = i;
} }
} }
}
if (grabbed_segment_index != fst->grabbed_segment_index) if (grabbed_segment_index != fst->grabbed_segment_index)
{ {
@ -732,6 +736,47 @@ gimp_free_select_tool_prepare_for_move (GimpFreeSelectTool *fst)
} }
} }
static void
gimp_free_select_tool_status_update (GimpFreeSelectTool *fst,
GimpDisplay *display,
GimpCoords *coords,
gboolean proximity)
{
GimpTool *tool = GIMP_TOOL (fst);
gimp_tool_pop_status (tool, display);
if (proximity)
{
const gchar *status_text = NULL;
if (gimp_free_select_tool_is_point_grabbed (fst))
{
if (gimp_free_select_tool_should_close (fst, display, coords))
{
status_text = _("Click to complete selection");
}
else
{
status_text = _("Click-Drag to move segment vertex");
}
}
else if (fst->n_points >= 3)
{
status_text = _("Return commits, Escape cancels, Backspace removes last segment");
}
else
{
status_text = _("Click-Drag creates free segment, Click creates polygonal segment");
}
if (status_text)
{
gimp_tool_push_status (tool, display, status_text);
}
}
}
static void static void
gimp_free_select_tool_control (GimpTool *tool, gimp_free_select_tool_control (GimpTool *tool,
GimpToolAction action, GimpToolAction action,
@ -761,9 +806,6 @@ gimp_free_select_tool_oper_update (GimpTool *tool,
GimpFreeSelectTool *fst; GimpFreeSelectTool *fst;
gboolean hovering_first_point; gboolean hovering_first_point;
if (tool->display != display)
return;
fst = GIMP_FREE_SELECT_TOOL (tool); fst = GIMP_FREE_SELECT_TOOL (tool);
gimp_free_select_tool_select_closest_segment_point (fst, gimp_free_select_tool_select_closest_segment_point (fst,
@ -798,6 +840,8 @@ gimp_free_select_tool_oper_update (GimpTool *tool,
} }
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool)); gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
gimp_free_select_tool_status_update (fst, display, coords, proximity);
} }
static void static void