Commit ffc9948d authored by Michael Natterer's avatar Michael Natterer 😴

app: add a canvas group for tool items

so we can control where in the canvas item stack they appear.
Put the group right below the software cursor.
parent 57755ee7
......@@ -78,6 +78,10 @@ gimp_display_shell_items_init (GimpDisplayShell *shell)
gimp_display_shell_add_item (shell, shell->layer_boundary);
g_object_unref (shell->layer_boundary);
shell->tool_items = gimp_canvas_group_new (shell);
gimp_display_shell_add_item (shell, shell->tool_items);
g_object_unref (shell->tool_items);
shell->cursor = gimp_canvas_cursor_new (shell);
gimp_canvas_item_set_visible (shell->cursor, FALSE);
gimp_display_shell_add_item (shell, shell->cursor);
......@@ -132,6 +136,26 @@ gimp_display_shell_remove_item (GimpDisplayShell *shell,
gimp_canvas_group_remove_item (GIMP_CANVAS_GROUP (shell->canvas_item), item);
}
void
gimp_display_shell_add_tool_item (GimpDisplayShell *shell,
GimpCanvasItem *item)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (GIMP_IS_CANVAS_ITEM (item));
gimp_canvas_group_add_item (GIMP_CANVAS_GROUP (shell->tool_items), item);
}
void
gimp_display_shell_remove_tool_item (GimpDisplayShell *shell,
GimpCanvasItem *item)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (GIMP_IS_CANVAS_ITEM (item));
gimp_canvas_group_remove_item (GIMP_CANVAS_GROUP (shell->tool_items), item);
}
/* private functions */
......
......@@ -22,13 +22,18 @@
#define __GIMP_DISPLAY_SHELL_ITEMS_H__
void gimp_display_shell_items_init (GimpDisplayShell *shell);
void gimp_display_shell_items_free (GimpDisplayShell *shell);
void gimp_display_shell_items_init (GimpDisplayShell *shell);
void gimp_display_shell_items_free (GimpDisplayShell *shell);
void gimp_display_shell_add_item (GimpDisplayShell *shell,
GimpCanvasItem *item);
void gimp_display_shell_remove_item (GimpDisplayShell *shell,
GimpCanvasItem *item);
void gimp_display_shell_add_item (GimpDisplayShell *shell,
GimpCanvasItem *item);
void gimp_display_shell_remove_item (GimpDisplayShell *shell,
GimpCanvasItem *item);
void gimp_display_shell_add_tool_item (GimpDisplayShell *shell,
GimpCanvasItem *item);
void gimp_display_shell_remove_tool_item (GimpDisplayShell *shell,
GimpCanvasItem *item);
#endif /* __GIMP_DISPLAY_SHELL_ITEMS_H__ */
......@@ -125,6 +125,7 @@ struct _GimpDisplayShell
GimpCanvasItem *guides; /* item proxies of guides */
GimpCanvasItem *sample_points; /* item proxies of sample points */
GimpCanvasItem *layer_boundary; /* item for the layer boundary */
GimpCanvasItem *tool_items; /* tools items, below the cursor */
GimpCanvasItem *cursor; /* item for the software cursor */
guint title_idle_id; /* title update idle ID */
......
......@@ -212,7 +212,7 @@ gimp_draw_tool_draw (GimpDrawTool *draw_tool)
{
GimpDisplayShell *shell = gimp_display_get_shell (draw_tool->display);
gimp_display_shell_add_item (shell, draw_tool->item);
gimp_display_shell_add_tool_item (shell, draw_tool->item);
}
}
}
......@@ -224,7 +224,7 @@ gimp_draw_tool_undraw (GimpDrawTool *draw_tool)
{
GimpDisplayShell *shell = gimp_display_get_shell (draw_tool->display);
gimp_display_shell_remove_item (shell, draw_tool->item);
gimp_display_shell_remove_tool_item (shell, draw_tool->item);
g_object_unref (draw_tool->item);
draw_tool->item = NULL;
}
......
......@@ -383,8 +383,8 @@ gimp_source_tool_draw (GimpDrawTool *draw_tool)
if (source_tool->src_outline)
{
gimp_display_shell_remove_item (src_shell,
source_tool->src_outline);
gimp_display_shell_remove_tool_item (src_shell,
source_tool->src_outline);
source_tool->src_outline = NULL;
}
......@@ -399,8 +399,8 @@ gimp_source_tool_draw (GimpDrawTool *draw_tool)
if (source_tool->src_outline)
{
gimp_display_shell_add_item (src_shell,
source_tool->src_outline);
gimp_display_shell_add_tool_item (src_shell,
source_tool->src_outline);
g_object_unref (source_tool->src_outline);
}
}
......@@ -415,8 +415,8 @@ gimp_source_tool_draw (GimpDrawTool *draw_tool)
source_tool->src_y + off_y,
GIMP_TOOL_HANDLE_SIZE_CROSS,
GIMP_TOOL_HANDLE_SIZE_CROSS);
gimp_display_shell_add_item (src_shell,
source_tool->src_handle);
gimp_display_shell_add_tool_item (src_shell,
source_tool->src_handle);
g_object_unref (source_tool->src_handle);
}
else
......@@ -442,15 +442,15 @@ gimp_source_tool_set_src_display (GimpSourceTool *source_tool,
if (source_tool->src_handle)
{
gimp_display_shell_remove_item (src_shell,
source_tool->src_handle);
gimp_display_shell_remove_tool_item (src_shell,
source_tool->src_handle);
source_tool->src_handle = NULL;
}
if (source_tool->src_outline)
{
gimp_display_shell_remove_item (src_shell,
source_tool->src_outline);
gimp_display_shell_remove_tool_item (src_shell,
source_tool->src_outline);
source_tool->src_outline = NULL;
}
}
......
......@@ -97,7 +97,7 @@ gimp_tool_progress_start (GimpProgress *progress,
tool->progress = gimp_canvas_progress_new (shell,
GIMP_HANDLE_ANCHOR_CENTER,
x + w / 2, y + h / 2);
gimp_display_shell_add_item (shell, tool->progress);
gimp_display_shell_add_tool_item (shell, tool->progress);
g_object_unref (tool->progress);
gimp_progress_start (GIMP_PROGRESS (tool->progress),
......@@ -119,7 +119,7 @@ gimp_tool_progress_end (GimpProgress *progress)
GimpDisplayShell *shell = gimp_display_get_shell (tool->progress_display);
gimp_progress_end (GIMP_PROGRESS (tool->progress));
gimp_display_shell_remove_item (shell, tool->progress);
gimp_display_shell_remove_tool_item (shell, tool->progress);
tool->progress = NULL;
tool->progress_display = NULL;
......
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