app: don't create a fallback crosshair in gimp_brush_tool_create_outline()

Instead, draw the crosshair in gimp_brush_tool_draw() if create_outline()
didn't return an item *and* if there is no brush tool cursor.

In gimp_source_tool_draw(), don't add an additional crosshair if
create_outline() returned an item.

This fixes both "no cursor at all" and "both outline and crosshair
shown" for certain prefs settings conbinations (bug #623734).
This commit is contained in:
Michael Natterer 2014-04-09 14:30:46 +02:00
parent d43022e5c4
commit e8459beb24
3 changed files with 42 additions and 32 deletions

View File

@ -289,8 +289,18 @@ gimp_brush_tool_draw (GimpDrawTool *draw_tool)
item = gimp_brush_tool_create_outline (brush_tool,
draw_tool->display,
brush_tool->brush_x,
brush_tool->brush_y,
! brush_tool->show_cursor);
brush_tool->brush_y);
if (! item && ! brush_tool->show_cursor)
{
item = gimp_canvas_handle_new (gimp_display_get_shell (draw_tool->display),
GIMP_HANDLE_CROSS,
GIMP_HANDLE_ANCHOR_CENTER,
brush_tool->brush_x,
brush_tool->brush_y,
GIMP_TOOL_HANDLE_SIZE_SMALL,
GIMP_TOOL_HANDLE_SIZE_SMALL);
}
if (item)
{
@ -303,8 +313,7 @@ GimpCanvasItem *
gimp_brush_tool_create_outline (GimpBrushTool *brush_tool,
GimpDisplay *display,
gdouble x,
gdouble y,
gboolean draw_fallback)
gdouble y)
{
GimpBrushCore *brush_core;
GimpPaintOptions *options;
@ -358,15 +367,6 @@ gimp_brush_tool_create_outline (GimpBrushTool *brush_tool,
return gimp_canvas_path_new (shell, boundary, x, y, FALSE,
GIMP_PATH_STYLE_OUTLINE);
}
else if (draw_fallback)
{
return gimp_canvas_handle_new (shell,
GIMP_HANDLE_CROSS,
GIMP_HANDLE_ANCHOR_CENTER,
x, y,
GIMP_TOOL_HANDLE_SIZE_SMALL,
GIMP_TOOL_HANDLE_SIZE_SMALL);
}
return NULL;
}

View File

@ -53,8 +53,7 @@ GType gimp_brush_tool_get_type (void) G_GNUC_CONST;
GimpCanvasItem * gimp_brush_tool_create_outline (GimpBrushTool *brush_tool,
GimpDisplay *display,
gdouble x,
gdouble y,
gboolean draw_fallback);
gdouble y);
#endif /* __GIMP_BRUSH_TOOL_H__ */

View File

@ -402,8 +402,7 @@ gimp_source_tool_draw (GimpDrawTool *draw_tool)
gimp_brush_tool_create_outline (GIMP_BRUSH_TOOL (source_tool),
source_tool->src_display,
source_tool->src_x + off_x,
source_tool->src_y + off_y,
FALSE);
source_tool->src_y + off_y);
if (source_tool->src_outline)
{
@ -413,25 +412,37 @@ gimp_source_tool_draw (GimpDrawTool *draw_tool)
}
}
if (! source_tool->src_handle)
if (source_tool->src_outline)
{
source_tool->src_handle =
gimp_canvas_handle_new (src_shell,
GIMP_HANDLE_CROSS,
GIMP_HANDLE_ANCHOR_CENTER,
source_tool->src_x + off_x,
source_tool->src_y + off_y,
GIMP_TOOL_HANDLE_SIZE_CROSS,
GIMP_TOOL_HANDLE_SIZE_CROSS);
gimp_display_shell_add_tool_item (src_shell,
source_tool->src_handle);
g_object_unref (source_tool->src_handle);
if (source_tool->src_handle)
{
gimp_display_shell_remove_tool_item (src_shell,
source_tool->src_handle);
source_tool->src_handle = NULL;
}
}
else
{
gimp_canvas_handle_set_position (source_tool->src_handle,
source_tool->src_x + off_x,
source_tool->src_y + off_y);
if (! source_tool->src_handle)
{
source_tool->src_handle =
gimp_canvas_handle_new (src_shell,
GIMP_HANDLE_CROSS,
GIMP_HANDLE_ANCHOR_CENTER,
source_tool->src_x + off_x,
source_tool->src_y + off_y,
GIMP_TOOL_HANDLE_SIZE_CROSS,
GIMP_TOOL_HANDLE_SIZE_CROSS);
gimp_display_shell_add_tool_item (src_shell,
source_tool->src_handle);
g_object_unref (source_tool->src_handle);
}
else
{
gimp_canvas_handle_set_position (source_tool->src_handle,
source_tool->src_x + off_x,
source_tool->src_y + off_y);
}
}
}
}