[gimp] app: If the user makes a new gradient, commit the old one
- From: Michael Henning <mhenning src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: If the user makes a new gradient, commit the old one
- Date: Mon, 4 Aug 2014 21:23:34 +0000 (UTC)
commit 59dfa2e6e6cdcecb646599c174b1bb264a1635ae
Author: Michael Henning <drawoc darkrefraction com>
Date: Mon Aug 4 17:17:01 2014 -0400
app: If the user makes a new gradient, commit the old one
app/tools/gimpblendtool.c | 34 +++++++++++++++++++++++++++++-----
app/tools/gimpblendtool.h | 1 +
2 files changed, 30 insertions(+), 5 deletions(-)
---
diff --git a/app/tools/gimpblendtool.c b/app/tools/gimpblendtool.c
index f5a2832..540d2ae 100644
--- a/app/tools/gimpblendtool.c
+++ b/app/tools/gimpblendtool.c
@@ -323,13 +323,19 @@ gimp_blend_tool_button_press (GimpTool *tool,
if (blend_tool->grabbed_point == POINT_NONE)
{
+ if (gimp_draw_tool_is_active (GIMP_DRAW_TOOL (blend_tool)))
+ {
+ gimp_tool_control (tool, GIMP_TOOL_ACTION_COMMIT, display);
+ gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, display);
+ }
+
if (gimp_blend_tool_is_shapeburst (blend_tool))
{
blend_tool->grabbed_point = POINT_FILL_MODE;
}
else
{
- blend_tool->grabbed_point = POINT_END;
+ blend_tool->grabbed_point = POINT_INIT_MODE;
blend_tool->start_x = coords->x;
blend_tool->start_y = coords->y;
@@ -350,7 +356,8 @@ gimp_blend_tool_button_press (GimpTool *tool,
tool->display = display;
gimp_blend_tool_update_items (blend_tool);
- if (blend_tool->grabbed_point != POINT_FILL_MODE)
+ if (blend_tool->grabbed_point != POINT_FILL_MODE &&
+ blend_tool->grabbed_point != POINT_INIT_MODE)
{
gimp_blend_tool_update_preview_coords (blend_tool);
gimp_image_map_apply (blend_tool->image_map, NULL);
@@ -379,6 +386,11 @@ gimp_blend_tool_button_release (GimpTool *tool,
/* XXX: handle cancel properly */
/* if (release_type == GIMP_BUTTON_RELEASE_CANCEL) */
+ if (blend_tool->grabbed_point == POINT_INIT_MODE)
+ {
+ gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, display);
+ }
+
if (blend_tool->grabbed_point == POINT_FILL_MODE)
{
/* XXX: Temporary, until the handles are working properly for shapebursts */
@@ -405,6 +417,15 @@ gimp_blend_tool_motion (GimpTool *tool,
blend_tool->mouse_x = coords->x;
blend_tool->mouse_y = coords->y;
+ if (blend_tool->grabbed_point == POINT_INIT_MODE)
+ {
+ GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (blend_tool);
+
+ gimp_draw_tool_pause (draw_tool);
+ blend_tool->grabbed_point = POINT_END;
+ gimp_draw_tool_resume (draw_tool);
+ }
+
/* Move the whole line if alt is pressed */
if (state & GDK_MOD1_MASK)
{
@@ -426,7 +447,8 @@ gimp_blend_tool_motion (GimpTool *tool,
gimp_tool_pop_status (tool, display);
gimp_blend_tool_push_status (blend_tool, state, display);
- gimp_blend_tool_update_items (blend_tool);
+ if (GIMP_IS_CANVAS_LINE (blend_tool->line))
+ gimp_blend_tool_update_items (blend_tool);
gimp_blend_tool_update_preview_coords (blend_tool);
gimp_image_map_apply (blend_tool->image_map, NULL);
@@ -562,7 +584,8 @@ gimp_blend_tool_draw (GimpDrawTool *draw_tool)
{
GimpBlendTool *blend_tool = GIMP_BLEND_TOOL (draw_tool);
- if (blend_tool->grabbed_point != POINT_FILL_MODE)
+ if (blend_tool->grabbed_point != POINT_FILL_MODE &&
+ blend_tool->grabbed_point != POINT_INIT_MODE)
{
blend_tool->line =
gimp_draw_tool_add_line (draw_tool,
@@ -617,7 +640,8 @@ static void
gimp_blend_tool_update_items (GimpBlendTool *blend_tool)
{
if (gimp_draw_tool_is_active (GIMP_DRAW_TOOL (blend_tool)) &&
- blend_tool->grabbed_point != POINT_FILL_MODE)
+ blend_tool->grabbed_point != POINT_FILL_MODE &&
+ blend_tool->grabbed_point != POINT_INIT_MODE)
{
gimp_canvas_line_set (blend_tool->line,
blend_tool->start_x,
diff --git a/app/tools/gimpblendtool.h b/app/tools/gimpblendtool.h
index 3dca1e1..0362b0b 100644
--- a/app/tools/gimpblendtool.h
+++ b/app/tools/gimpblendtool.h
@@ -27,6 +27,7 @@ typedef enum
POINT_NONE = 0,
POINT_START,
POINT_END,
+ POINT_INIT_MODE,
POINT_FILL_MODE
} GimpBlendToolPoint;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]