[gimp] app: add GimpPaintTool::paint_prepare() vfunc
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add GimpPaintTool::paint_prepare() vfunc
- Date: Wed, 2 Oct 2019 14:17:15 +0000 (UTC)
commit ffd6c2eda24d6d6d658b15e32919f7d11be6ead9
Author: Ell <ell_se yahoo com>
Date: Wed Oct 2 16:49:51 2019 +0300
app: add GimpPaintTool::paint_prepare() vfunc
... which is called when starting to paint, before the tool's
paint-core is started, allowing the tool to configure the core.
Move the call to gimp_paint_core_set_show_all() to the default
implementation of paint_prepare().
app/tools/gimppainttool-paint.c | 4 +++-
app/tools/gimppainttool.c | 15 +++++++++++++++
app/tools/gimppainttool.h | 2 ++
3 files changed, 20 insertions(+), 1 deletion(-)
---
diff --git a/app/tools/gimppainttool-paint.c b/app/tools/gimppainttool-paint.c
index cecaacd0a0..905f80360b 100644
--- a/app/tools/gimppainttool-paint.c
+++ b/app/tools/gimppainttool-paint.c
@@ -262,7 +262,9 @@ gimp_paint_tool_paint_start (GimpPaintTool *paint_tool,
if (gimp_paint_tool_paint_use_thread (paint_tool))
gimp_drawable_start_paint (drawable);
- gimp_paint_core_set_show_all (core, shell->show_all);
+ /* Prepare to start the paint core */
+ if (GIMP_PAINT_TOOL_GET_CLASS (paint_tool)->paint_prepare)
+ GIMP_PAINT_TOOL_GET_CLASS (paint_tool)->paint_prepare (paint_tool, display);
/* Start the paint core */
if (! gimp_paint_core_start (core,
diff --git a/app/tools/gimppainttool.c b/app/tools/gimppainttool.c
index f3d6922a33..ad8e1765a6 100644
--- a/app/tools/gimppainttool.c
+++ b/app/tools/gimppainttool.c
@@ -99,6 +99,10 @@ static void gimp_paint_tool_oper_update (GimpTool *tool,
static void gimp_paint_tool_draw (GimpDrawTool *draw_tool);
+static void
+ gimp_paint_tool_real_paint_prepare (GimpPaintTool *paint_tool,
+ GimpDisplay *display);
+
static GimpCanvasItem *
gimp_paint_tool_get_outline (GimpPaintTool *paint_tool,
GimpDisplay *display,
@@ -142,6 +146,8 @@ gimp_paint_tool_class_init (GimpPaintToolClass *klass)
tool_class->oper_update = gimp_paint_tool_oper_update;
draw_tool_class->draw = gimp_paint_tool_draw;
+
+ klass->paint_prepare = gimp_paint_tool_real_paint_prepare;
}
static void
@@ -817,6 +823,15 @@ gimp_paint_tool_draw (GimpDrawTool *draw_tool)
GIMP_DRAW_TOOL_CLASS (parent_class)->draw (draw_tool);
}
+static void
+gimp_paint_tool_real_paint_prepare (GimpPaintTool *paint_tool,
+ GimpDisplay *display)
+{
+ GimpDisplayShell *shell = gimp_display_get_shell (display);
+
+ gimp_paint_core_set_show_all (paint_tool->core, shell->show_all);
+}
+
static GimpCanvasItem *
gimp_paint_tool_get_outline (GimpPaintTool *paint_tool,
GimpDisplay *display,
diff --git a/app/tools/gimppainttool.h b/app/tools/gimppainttool.h
index dc383cc9b5..18e48f72ce 100644
--- a/app/tools/gimppainttool.h
+++ b/app/tools/gimppainttool.h
@@ -69,6 +69,8 @@ struct _GimpPaintToolClass
{
GimpColorToolClass parent_class;
+ void (* paint_prepare) (GimpPaintTool *paint_tool,
+ GimpDisplay *display);
void (* paint_start) (GimpPaintTool *paint_tool);
void (* paint_end) (GimpPaintTool *paint_tool);
void (* paint_flush) (GimpPaintTool *paint_tool);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]