app: add "Snap brush outline to stroke" option to the preferences
Add a new "Snap brush outline to stroke" toggle to the "Image
Windows" preferences page. When enabled, the brush outline in
paint tools snaps to the individual dabs while painting, instead of
following the cursor precisely (this is the existing behavior).
When disabled, the brush outline follows the cursor while painting
in the same way it does while not painting.
Disable the option by default. This seems to be what most other
programs are doing, and it does give paitning a smoother feel.
(cherry picked from commit 499834a1cb
)
This commit is contained in:
@ -57,6 +57,7 @@ enum
|
||||
PROP_CURSOR_MODE,
|
||||
PROP_CURSOR_UPDATING,
|
||||
PROP_SHOW_BRUSH_OUTLINE,
|
||||
PROP_SNAP_BRUSH_OUTLINE,
|
||||
PROP_SHOW_PAINT_TOOL_CURSOR,
|
||||
PROP_IMAGE_TITLE_FORMAT,
|
||||
PROP_IMAGE_STATUS_FORMAT,
|
||||
@ -202,6 +203,13 @@ gimp_display_config_class_init (GimpDisplayConfigClass *klass)
|
||||
TRUE,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_SNAP_BRUSH_OUTLINE,
|
||||
"snap-brush-outline",
|
||||
"Snap brush outline",
|
||||
SNAP_BRUSH_OUTLINE_BLURB,
|
||||
FALSE,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_SHOW_PAINT_TOOL_CURSOR,
|
||||
"show-paint-tool-cursor",
|
||||
"Show paint tool cursor",
|
||||
@ -427,6 +435,9 @@ gimp_display_config_set_property (GObject *object,
|
||||
case PROP_SHOW_BRUSH_OUTLINE:
|
||||
display_config->show_brush_outline = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_SNAP_BRUSH_OUTLINE:
|
||||
display_config->snap_brush_outline = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_SHOW_PAINT_TOOL_CURSOR:
|
||||
display_config->show_paint_tool_cursor = g_value_get_boolean (value);
|
||||
break;
|
||||
@ -536,6 +547,9 @@ gimp_display_config_get_property (GObject *object,
|
||||
case PROP_SHOW_BRUSH_OUTLINE:
|
||||
g_value_set_boolean (value, display_config->show_brush_outline);
|
||||
break;
|
||||
case PROP_SNAP_BRUSH_OUTLINE:
|
||||
g_value_set_boolean (value, display_config->snap_brush_outline);
|
||||
break;
|
||||
case PROP_SHOW_PAINT_TOOL_CURSOR:
|
||||
g_value_set_boolean (value, display_config->show_paint_tool_cursor);
|
||||
break;
|
||||
|
@ -53,6 +53,7 @@ struct _GimpDisplayConfig
|
||||
GimpCursorMode cursor_mode;
|
||||
gboolean cursor_updating;
|
||||
gboolean show_brush_outline;
|
||||
gboolean snap_brush_outline;
|
||||
gboolean show_paint_tool_cursor;
|
||||
gchar *image_title_format;
|
||||
gchar *image_status_format;
|
||||
|
@ -380,6 +380,10 @@ _("Save the tool options when GIMP exits.")
|
||||
_("When enabled, all paint tools will show a preview of the current " \
|
||||
"brush's outline.")
|
||||
|
||||
#define SNAP_BRUSH_OUTLINE_BLURB \
|
||||
_("When enabled, the brush outline will snap to individual dabs while " \
|
||||
"painting.")
|
||||
|
||||
#define SHOW_HELP_BUTTON_BLURB \
|
||||
_("When enabled, dialogs will show a help button that gives access to " \
|
||||
"the related help page. Without this button, the help page can still " \
|
||||
|
@ -2881,9 +2881,18 @@ prefs_dialog_new (Gimp *gimp,
|
||||
vbox2 = prefs_frame_new (_("Mouse Pointers"),
|
||||
GTK_CONTAINER (vbox), FALSE);
|
||||
|
||||
prefs_check_button_add (object, "show-brush-outline",
|
||||
_("Show _brush outline"),
|
||||
GTK_BOX (vbox2));
|
||||
button = prefs_check_button_add (object, "show-brush-outline",
|
||||
_("Show _brush outline"),
|
||||
GTK_BOX (vbox2));
|
||||
|
||||
vbox3 = prefs_frame_new (NULL, GTK_CONTAINER (vbox2), FALSE);
|
||||
g_object_bind_property (button, "active",
|
||||
vbox3, "sensitive",
|
||||
G_BINDING_SYNC_CREATE);
|
||||
prefs_check_button_add (object, "snap-brush-outline",
|
||||
_("S_nap brush outline to stroke"),
|
||||
GTK_BOX (vbox3));
|
||||
|
||||
prefs_check_button_add (object, "show-paint-tool-cursor",
|
||||
_("Show pointer for paint _tools"),
|
||||
GTK_BOX (vbox2));
|
||||
|
@ -186,12 +186,14 @@ gimp_paint_tool_paint_timeout (GimpPaintTool *paint_tool)
|
||||
GimpDisplay *display = paint_tool->display;
|
||||
GimpImage *image = gimp_display_get_image (display);
|
||||
|
||||
gimp_draw_tool_pause (draw_tool);
|
||||
if (paint_tool->snap_brush)
|
||||
gimp_draw_tool_pause (draw_tool);
|
||||
|
||||
gimp_projection_flush_now (gimp_image_get_projection (image), TRUE);
|
||||
gimp_display_flush_now (display);
|
||||
|
||||
gimp_draw_tool_resume (draw_tool);
|
||||
if (paint_tool->snap_brush)
|
||||
gimp_draw_tool_resume (draw_tool);
|
||||
}
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
|
@ -210,6 +210,7 @@ gimp_paint_tool_constructed (GObject *object)
|
||||
|
||||
paint_tool->show_cursor = display_config->show_paint_tool_cursor;
|
||||
paint_tool->draw_brush = display_config->show_brush_outline;
|
||||
paint_tool->snap_brush = display_config->snap_brush_outline;
|
||||
|
||||
g_signal_connect_object (display_config, "notify::show-paint-tool-cursor",
|
||||
G_CALLBACK (gimp_paint_tool_cursor_notify),
|
||||
@ -217,6 +218,9 @@ gimp_paint_tool_constructed (GObject *object)
|
||||
g_signal_connect_object (display_config, "notify::show-brush-outline",
|
||||
G_CALLBACK (gimp_paint_tool_cursor_notify),
|
||||
paint_tool, 0);
|
||||
g_signal_connect_object (display_config, "notify::snap-brush-outline",
|
||||
G_CALLBACK (gimp_paint_tool_cursor_notify),
|
||||
paint_tool, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -413,7 +417,13 @@ gimp_paint_tool_motion (GimpTool *tool,
|
||||
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
|
||||
return;
|
||||
|
||||
if (! paint_tool->snap_brush)
|
||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
||||
|
||||
gimp_paint_tool_paint_motion (paint_tool, coords, time);
|
||||
|
||||
if (! paint_tool->snap_brush)
|
||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -685,7 +695,8 @@ gimp_paint_tool_draw (GimpDrawTool *draw_tool)
|
||||
|
||||
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
|
||||
|
||||
if (gimp_paint_tool_paint_is_active (paint_tool))
|
||||
if (gimp_paint_tool_paint_is_active (paint_tool) &&
|
||||
paint_tool->snap_brush)
|
||||
{
|
||||
cur_x = paint_tool->paint_x + off_x;
|
||||
cur_y = paint_tool->paint_y + off_y;
|
||||
@ -906,6 +917,7 @@ gimp_paint_tool_cursor_notify (GimpDisplayConfig *config,
|
||||
|
||||
paint_tool->show_cursor = config->show_paint_tool_cursor;
|
||||
paint_tool->draw_brush = config->show_brush_outline;
|
||||
paint_tool->snap_brush = config->snap_brush_outline;
|
||||
|
||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (paint_tool));
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ struct _GimpPaintTool
|
||||
|
||||
gboolean show_cursor;
|
||||
gboolean draw_brush;
|
||||
gboolean snap_brush;
|
||||
gboolean draw_fallback;
|
||||
gint fallback_size;
|
||||
gboolean draw_circle;
|
||||
|
Reference in New Issue
Block a user