[gimp/wip/Jehan/issue-498-quick-brush-edit: 4/26] app: display the brush outline (or fallback or circle) when resizing.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/wip/Jehan/issue-498-quick-brush-edit: 4/26] app: display the brush outline (or fallback or circle) when resizing.
- Date: Wed, 17 Aug 2022 12:20:45 +0000 (UTC)
commit 5be997fbdfbabf92d56a5dc72179f81ea28b9442
Author: Jehan <jehan girinstud io>
Date: Mon Mar 14 19:15:43 2022 +0100
app: display the brush outline (or fallback or circle) when resizing.
Bypass temporarily the "Show brush outline" settings when resizing
on-canvas.
app/display/gimpdisplayshell-tool-events.c | 22 +++++++++++++++++++---
app/tools/gimppainttool.c | 28 ++++++++++++++++++++++++++++
app/tools/gimppainttool.h | 3 +++
3 files changed, 50 insertions(+), 3 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-tool-events.c b/app/display/gimpdisplayshell-tool-events.c
index eeb31b2861..62f00634b1 100644
--- a/app/display/gimpdisplayshell-tool-events.c
+++ b/app/display/gimpdisplayshell-tool-events.c
@@ -54,6 +54,7 @@
#include "tools/gimpguidetool.h"
#include "tools/gimpmovetool.h"
+#include "tools/gimppainttool.h"
#include "tools/gimpsamplepointtool.h"
#include "tools/gimptoolcontrol.h"
#include "tools/tool_manager.h"
@@ -1709,11 +1710,17 @@ gimp_display_shell_start_scrolling (GimpDisplayShell *shell,
}
else if (shell->mod1_settings == TRUE)
{
- /* no-op. */
+ Gimp *gimp = gimp_display_get_gimp (shell->display);
+ GimpTool *active_tool = tool_manager_get_active (gimp);
+
+ if (GIMP_IS_PAINT_TOOL (active_tool))
+ gimp_paint_tool_force_draw (GIMP_PAINT_TOOL (active_tool), TRUE);
}
else
- gimp_display_shell_set_override_cursor (shell,
- (GimpCursorType) GDK_FLEUR);
+ {
+ gimp_display_shell_set_override_cursor (shell,
+ (GimpCursorType) GDK_FLEUR);
+ }
}
static void
@@ -1724,6 +1731,15 @@ gimp_display_shell_stop_scrolling (GimpDisplayShell *shell,
gimp_display_shell_unset_override_cursor (shell);
+ if (shell->mod1_settings == TRUE)
+ {
+ Gimp *gimp = gimp_display_get_gimp (shell->display);
+ GimpTool *active_tool = tool_manager_get_active (gimp);
+
+ if (GIMP_IS_PAINT_TOOL (active_tool))
+ gimp_paint_tool_force_draw (GIMP_PAINT_TOOL (active_tool), FALSE);
+ }
+
shell->scrolling = FALSE;
shell->scroll_start_x = 0;
shell->scroll_start_y = 0;
diff --git a/app/tools/gimppainttool.c b/app/tools/gimppainttool.c
index 679c5a3c3e..07db2fda85 100644
--- a/app/tools/gimppainttool.c
+++ b/app/tools/gimppainttool.c
@@ -801,6 +801,7 @@ gimp_paint_tool_draw (GimpDrawTool *draw_tool)
}
gimp_paint_tool_set_draw_fallback (paint_tool, FALSE, 0.0);
+ gimp_paint_tool_set_draw_circle (paint_tool, FALSE, 0.0);
if (paint_tool->draw_brush)
outline = gimp_paint_tool_get_outline (paint_tool,
@@ -1071,3 +1072,30 @@ gimp_paint_tool_set_draw_circle (GimpPaintTool *tool,
tool->draw_circle = draw_circle;
tool->circle_size = circle_size;
}
+
+
+/**
+ * gimp_paint_tool_force_draw:
+ * @tool:
+ * @force:
+ *
+ * If @force is %TRUE, the brush, or a fallback, or circle will be
+ * drawn, regardless of the Preferences settings. This can be used for
+ * code such as when modifying brush size or shape on-canvas with a
+ * visual feedback, temporarily bypassing the user setting.
+ */
+void
+gimp_paint_tool_force_draw (GimpPaintTool *tool,
+ gboolean force)
+{
+ GimpDisplayConfig *display_config;
+
+ g_return_if_fail (GIMP_IS_PAINT_TOOL (tool));
+
+ display_config = GIMP_DISPLAY_CONFIG (GIMP_TOOL (tool)->tool_info->gimp->config);
+
+ if (force)
+ tool->draw_brush = TRUE;
+ else
+ tool->draw_brush = display_config->show_brush_outline;
+}
diff --git a/app/tools/gimppainttool.h b/app/tools/gimppainttool.h
index 4f1375221e..0941ffbaeb 100644
--- a/app/tools/gimppainttool.h
+++ b/app/tools/gimppainttool.h
@@ -108,5 +108,8 @@ void gimp_paint_tool_set_draw_circle (GimpPaintTool *tool,
gboolean draw_circle,
gint circle_size);
+void gimp_paint_tool_force_draw (GimpPaintTool *tool,
+ gboolean force);
+
#endif /* __GIMP_PAINT_TOOL_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]