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

app: change enum GimpColorPickState to { START, UPDATE, END }

It used to be { NEW, UPDATE } but that didn't allow to distinguish the
final END update, which we will soon need for automatic color history
updating. Make sure all places that handle motion events on colors
(pick from canvas, gradient editor) correctly send and handle END
events.
parent bb5effe9
......@@ -245,7 +245,7 @@ gimp_color_tool_button_press (GimpTool *tool,
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), display);
gimp_color_tool_pick (color_tool, GIMP_COLOR_PICK_STATE_NEW,
gimp_color_tool_pick (color_tool, GIMP_COLOR_PICK_STATE_START,
coords->x, coords->y);
}
}
......@@ -336,6 +336,9 @@ gimp_color_tool_button_release (GimpTool *tool,
else
{
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));
gimp_color_tool_pick (color_tool, GIMP_COLOR_PICK_STATE_END,
coords->x, coords->y);
}
}
......@@ -683,7 +686,7 @@ gimp_color_tool_real_picked (GimpColorTool *color_tool,
GimpData *data;
/* don't blink like mad when updating */
if (pick_state == GIMP_COLOR_PICK_STATE_UPDATE)
if (pick_state != GIMP_COLOR_PICK_STATE_START)
gimp_dockable_blink_cancel (GIMP_DOCKABLE (dockable));
palette_editor = gtk_bin_get_child (GTK_BIN (dockable));
......
......@@ -152,7 +152,8 @@ static void view_set_hint (GimpGradientEditor *editor,
gint x);
static void view_pick_color (GimpGradientEditor *editor,
GimpColorPickMode mode,
GimpColorPickMode pick_mode,
GimpColorPickState pick_state,
gint x);
/* Gradient control functions */
......@@ -820,6 +821,7 @@ view_events (GtkWidget *widget,
(mevent->state & gimp_get_toggle_behavior_mask ()) ?
GIMP_COLOR_PICK_MODE_BACKGROUND :
GIMP_COLOR_PICK_MODE_FOREGROUND,
GIMP_COLOR_PICK_STATE_UPDATE,
mevent->x);
}
else
......@@ -849,6 +851,7 @@ view_events (GtkWidget *widget,
(bevent->state & gimp_get_toggle_behavior_mask ()) ?
GIMP_COLOR_PICK_MODE_BACKGROUND :
GIMP_COLOR_PICK_MODE_FOREGROUND,
GIMP_COLOR_PICK_STATE_START,
bevent->x);
}
}
......@@ -915,6 +918,7 @@ view_events (GtkWidget *widget,
(bevent->state & gimp_get_toggle_behavior_mask ()) ?
GIMP_COLOR_PICK_MODE_BACKGROUND :
GIMP_COLOR_PICK_MODE_FOREGROUND,
GIMP_COLOR_PICK_STATE_END,
bevent->x);
break;
}
......@@ -969,7 +973,8 @@ view_set_hint (GimpGradientEditor *editor,
static void
view_pick_color (GimpGradientEditor *editor,
GimpColorPickMode mode,
GimpColorPickMode pick_mode,
GimpColorPickState pick_state,
gint x)
{
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (editor);
......@@ -993,7 +998,7 @@ view_pick_color (GimpGradientEditor *editor,
str3 = g_strdup_printf ("(%0.3f, %0.3f, %0.3f)", color.r, color.g, color.b);
if (mode == GIMP_COLOR_PICK_MODE_FOREGROUND)
if (pick_mode == GIMP_COLOR_PICK_MODE_FOREGROUND)
{
gimp_context_set_foreground (data_editor->context, &color);
......
......@@ -464,7 +464,7 @@ gimp_palette_editor_pick_color (GimpPaletteEditor *editor,
switch (pick_state)
{
case GIMP_COLOR_PICK_STATE_NEW:
case GIMP_COLOR_PICK_STATE_START:
if (editor->color)
index = editor->color->position + 1;
......@@ -475,6 +475,7 @@ gimp_palette_editor_pick_color (GimpPaletteEditor *editor,
break;
case GIMP_COLOR_PICK_STATE_UPDATE:
case GIMP_COLOR_PICK_STATE_END:
gimp_palette_set_entry_color (GIMP_PALETTE (data),
editor->color->position,
color);
......
......@@ -168,15 +168,17 @@ gimp_color_pick_state_get_type (void)
{
static const GEnumValue values[] =
{
{ GIMP_COLOR_PICK_STATE_NEW, "GIMP_COLOR_PICK_STATE_NEW", "new" },
{ GIMP_COLOR_PICK_STATE_START, "GIMP_COLOR_PICK_STATE_START", "start" },
{ GIMP_COLOR_PICK_STATE_UPDATE, "GIMP_COLOR_PICK_STATE_UPDATE", "update" },
{ GIMP_COLOR_PICK_STATE_END, "GIMP_COLOR_PICK_STATE_END", "end" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
{ GIMP_COLOR_PICK_STATE_NEW, "GIMP_COLOR_PICK_STATE_NEW", NULL },
{ GIMP_COLOR_PICK_STATE_START, "GIMP_COLOR_PICK_STATE_START", NULL },
{ GIMP_COLOR_PICK_STATE_UPDATE, "GIMP_COLOR_PICK_STATE_UPDATE", NULL },
{ GIMP_COLOR_PICK_STATE_END, "GIMP_COLOR_PICK_STATE_END", NULL },
{ 0, NULL, NULL }
};
......
......@@ -89,8 +89,9 @@ GType gimp_color_pick_state_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_COLOR_PICK_STATE_NEW,
GIMP_COLOR_PICK_STATE_UPDATE
GIMP_COLOR_PICK_STATE_START,
GIMP_COLOR_PICK_STATE_UPDATE,
GIMP_COLOR_PICK_STATE_END
} GimpColorPickState;
......
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