Allow some paint tools to not suggest using the Ctrl modifier.

2006-08-02  Raphael Quinet  <raphael@gimp.org>

	* app/tools/gimppainttool.c (gimp_paint_tool_oper_update): Allow
	some paint tools to not suggest using the Ctrl modifier.

	* app/tools/gimpvectortool.c (gimp_vector_tool_status_update):
	slightly more elegant way to free the status string.
This commit is contained in:
Raphael Quinet
2006-08-02 14:41:24 +00:00
committed by Raphaël Quinet
parent b1c35145a2
commit 8960d6ac5a
4 changed files with 49 additions and 40 deletions

View File

@ -1,3 +1,11 @@
2006-08-02 Raphaël Quinet <raphael@gimp.org>
* app/tools/gimppainttool.c (gimp_paint_tool_oper_update): Allow
some paint tools to not suggest using the Ctrl modifier.
* app/tools/gimpvectortool.c (gimp_vector_tool_status_update):
slightly more elegant way to free the status string.
2006-08-02 Michael Natterer <mitch@gimp.org> 2006-08-02 Michael Natterer <mitch@gimp.org>
* plug-ins/common/pat.c: enable "activates-default" on the name * plug-ins/common/pat.c: enable "activates-default" on the name

View File

@ -689,21 +689,24 @@ gimp_paint_tool_oper_update (GimpTool *tool,
} }
else else
{ {
gchar *status; gchar *status;
GdkModifierType modifiers = 0;
/* HACK: A paint tool may set status_ctrl to NULL to indicate that
* it ignores the Ctrl modifier (temporarily or permanently), so
* it should not be suggested. This is different from how
* gimp_suggest_modifiers() would interpret this parameter. */
if (paint_tool->status_ctrl != NULL)
modifiers |= GDK_CONTROL_MASK;
/* suggest drawing lines only after the first point is set */
if (display == tool->display) if (display == tool->display)
status = gimp_suggest_modifiers (paint_tool->status, modifiers |= GDK_SHIFT_MASK;
(GDK_SHIFT_MASK
| GDK_CONTROL_MASK) & ~state, status = gimp_suggest_modifiers (paint_tool->status,
_("%s for a straight line"), modifiers & ~state,
paint_tool->status_ctrl, _("%s for a straight line"),
NULL); paint_tool->status_ctrl,
else NULL);
status = gimp_suggest_modifiers (paint_tool->status,
GDK_CONTROL_MASK & ~state,
NULL,
paint_tool->status_ctrl,
NULL);
gimp_tool_push_status (tool, display, status); gimp_tool_push_status (tool, display, status);
g_free (status); g_free (status);

View File

@ -689,21 +689,24 @@ gimp_paint_tool_oper_update (GimpTool *tool,
} }
else else
{ {
gchar *status; gchar *status;
GdkModifierType modifiers = 0;
/* HACK: A paint tool may set status_ctrl to NULL to indicate that
* it ignores the Ctrl modifier (temporarily or permanently), so
* it should not be suggested. This is different from how
* gimp_suggest_modifiers() would interpret this parameter. */
if (paint_tool->status_ctrl != NULL)
modifiers |= GDK_CONTROL_MASK;
/* suggest drawing lines only after the first point is set */
if (display == tool->display) if (display == tool->display)
status = gimp_suggest_modifiers (paint_tool->status, modifiers |= GDK_SHIFT_MASK;
(GDK_SHIFT_MASK
| GDK_CONTROL_MASK) & ~state, status = gimp_suggest_modifiers (paint_tool->status,
_("%s for a straight line"), modifiers & ~state,
paint_tool->status_ctrl, _("%s for a straight line"),
NULL); paint_tool->status_ctrl,
else NULL);
status = gimp_suggest_modifiers (paint_tool->status,
GDK_CONTROL_MASK & ~state,
NULL,
paint_tool->status_ctrl,
NULL);
gimp_tool_push_status (tool, display, status); gimp_tool_push_status (tool, display, status);
g_free (status); g_free (status);

View File

@ -1143,7 +1143,8 @@ gimp_vector_tool_status_update (GimpTool *tool,
if (proximity) if (proximity)
{ {
gchar *status = NULL; gchar *status = NULL;
gboolean free_status = FALSE;
switch (vector_tool->function) switch (vector_tool->function)
{ {
@ -1160,6 +1161,7 @@ gimp_vector_tool_status_update (GimpTool *tool,
status = gimp_suggest_modifiers (_("Click to create a new anchor."), status = gimp_suggest_modifiers (_("Click to create a new anchor."),
GDK_SHIFT_MASK & ~state, GDK_SHIFT_MASK & ~state,
NULL, NULL, NULL); NULL, NULL, NULL);
free_status = TRUE;
break; break;
case VECTORS_MOVE_ANCHOR: case VECTORS_MOVE_ANCHOR:
status = _("Click-Drag to move the anchor around."); status = _("Click-Drag to move the anchor around.");
@ -1172,6 +1174,7 @@ gimp_vector_tool_status_update (GimpTool *tool,
"around."), "around."),
GDK_SHIFT_MASK & ~state, GDK_SHIFT_MASK & ~state,
NULL, NULL, NULL); NULL, NULL, NULL);
free_status = TRUE;
break; break;
case VECTORS_MOVE_CURVE: case VECTORS_MOVE_CURVE:
if (GIMP_VECTOR_OPTIONS (tool->tool_info->tool_options)->polygonal) if (GIMP_VECTOR_OPTIONS (tool->tool_info->tool_options)->polygonal)
@ -1184,12 +1187,14 @@ gimp_vector_tool_status_update (GimpTool *tool,
"shape of the curve."), "shape of the curve."),
GDK_SHIFT_MASK & ~state, GDK_SHIFT_MASK & ~state,
_("%s: symmetrical"), NULL, NULL); _("%s: symmetrical"), NULL, NULL);
free_status = TRUE;
break; break;
case VECTORS_MOVE_STROKE: case VECTORS_MOVE_STROKE:
status = gimp_suggest_modifiers (_("Click-Drag to move the " status = gimp_suggest_modifiers (_("Click-Drag to move the "
"component around."), "component around."),
GDK_SHIFT_MASK & ~state, GDK_SHIFT_MASK & ~state,
NULL, NULL, NULL); NULL, NULL, NULL);
free_status = TRUE;
break; break;
case VECTORS_MOVE_VECTORS: case VECTORS_MOVE_VECTORS:
status = _("Click-Drag to move the path around."); status = _("Click-Drag to move the path around.");
@ -1199,6 +1204,7 @@ gimp_vector_tool_status_update (GimpTool *tool,
"on the path."), "on the path."),
GDK_SHIFT_MASK & ~state, GDK_SHIFT_MASK & ~state,
NULL, NULL, NULL); NULL, NULL, NULL);
free_status = TRUE;
break; break;
case VECTORS_DELETE_ANCHOR: case VECTORS_DELETE_ANCHOR:
status = _("Click to delete this anchor."); status = _("Click to delete this anchor.");
@ -1221,19 +1227,8 @@ gimp_vector_tool_status_update (GimpTool *tool,
if (status) if (status)
gimp_tool_push_status (tool, display, status); gimp_tool_push_status (tool, display, status);
/* not very elegant */ if (free_status)
switch (vector_tool->function) g_free (status);
{
case VECTORS_ADD_ANCHOR:
case VECTORS_MOVE_HANDLE:
case VECTORS_MOVE_CURVE:
case VECTORS_MOVE_STROKE:
case VECTORS_INSERT_ANCHOR:
g_free (status);
break;
default:
break;
}
} }
} }