Commit 40229803 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

Fixed a 1.2 -> 2.0 regression that was forgotten:

2004-06-30  Michael Natterer  <mitch@gimp.org>

	Fixed a 1.2 -> 2.0 regression that was forgotten:

	* app/widgets/widgets-enums.[ch]: added enum GimpColorPickState
	which can be one of { NEW, UPDATE }.

	* app/widgets/gimppaletteeditor.[ch]: changed #if 0'ed function
	gimp_palette_editor_update_color() to
	gimp_palette_editor_pick_color() and restored the functionality of
	creating/updating colors via this API

	Changed button_press handler to only edit the color on double
	click if it's really a double click on the same color.
	Fixes bug #141381.

	* app/tools/gimpcolorpickeroptions.[ch]: added boolean property
	"add-to-palette" and a GUI for it.

	* app/core/gimpmarshal.list
	* app/tools/gimpcolortool.[ch]: added a GimpColorPickState
	parameter to the "color_picked" signal. Pass NEW on button_press
	and UPDATE on motion.

	* app/tools/gimpcurvestool.c (gimp_curves_tool_color_picked)
	* app/tools/gimplevelstool.c (gimp_levels_tool_color_picked)
	* app/tools/gimppainttool.c (gimp_paint_tool_color_picked):
	changed accordingly

	* app/tools/gimpcolorpickertool.c (gimp_color_picker_tool_picked):
	If "add-to-palette" is TRUE, get the palette editor and call
	gimp_palette_editor_pick_color().
parent 114f747f
2004-06-30 Michael Natterer <mitch@gimp.org>
Fixed a 1.2 -> 2.0 regression that was forgotten:
* app/widgets/widgets-enums.[ch]: added enum GimpColorPickState
which can be one of { NEW, UPDATE }.
* app/widgets/gimppaletteeditor.[ch]: changed #if 0'ed function
gimp_palette_editor_update_color() to
gimp_palette_editor_pick_color() and restored the functionality of
creating/updating colors via this API
Changed button_press handler to only edit the color on double
click if it's really a double click on the same color.
Fixes bug #141381.
* app/tools/gimpcolorpickeroptions.[ch]: added boolean property
"add-to-palette" and a GUI for it.
* app/core/gimpmarshal.list
* app/tools/gimpcolortool.[ch]: added a GimpColorPickState
parameter to the "color_picked" signal. Pass NEW on button_press
and UPDATE on motion.
* app/tools/gimpcurvestool.c (gimp_curves_tool_color_picked)
* app/tools/gimplevelstool.c (gimp_levels_tool_color_picked)
* app/tools/gimppainttool.c (gimp_paint_tool_color_picked):
changed accordingly
* app/tools/gimpcolorpickertool.c (gimp_color_picker_tool_picked):
If "add-to-palette" is TRUE, get the palette editor and call
gimp_palette_editor_pick_color().
2004-06-30 Sven Neumann <sven@gimp.org>
* app/widgets/gimpselectiondata.[ch]: renamed the SVG related
......
......@@ -31,7 +31,7 @@ VOID: BOXED
VOID: DOUBLE
VOID: DOUBLE, DOUBLE
VOID: ENUM
VOID: ENUM, BOXED, INT
VOID: ENUM, ENUM, BOXED, INT
VOID: ENUM, OBJECT
VOID: ENUM, POINTER
VOID: FLAGS
......
......@@ -103,6 +103,7 @@ static void gimp_paint_tool_cursor_update (GimpTool *tool,
static void gimp_paint_tool_draw (GimpDrawTool *draw_tool);
static void gimp_paint_tool_color_picked (GimpColorTool *color_tool,
GimpColorPickState pick_state,
GimpImageType sample_type,
GimpRGB *color,
gint color_index);
......@@ -850,10 +851,11 @@ gimp_paint_tool_cursor_update (GimpTool *tool,
}
static void
gimp_paint_tool_color_picked (GimpColorTool *color_tool,
GimpImageType sample_type,
GimpRGB *color,
gint color_index)
gimp_paint_tool_color_picked (GimpColorTool *color_tool,
GimpColorPickState pick_state,
GimpImageType sample_type,
GimpRGB *color,
gint color_index)
{
GimpTool *tool = GIMP_TOOL (color_tool);
......
......@@ -38,7 +38,8 @@ enum
{
PROP_0,
PROP_SAMPLE_AVERAGE, /* overrides a GimpColorOptions property */
PROP_PICK_MODE
PROP_PICK_MODE,
PROP_ADD_TO_PALETTE
};
......@@ -67,14 +68,14 @@ gimp_color_picker_options_get_type (void)
static const GTypeInfo info =
{
sizeof (GimpColorPickerOptionsClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_color_picker_options_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpColorPickerOptions),
0, /* n_preallocs */
NULL /* instance_init */
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_color_picker_options_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpColorPickerOptions),
0, /* n_preallocs */
NULL /* instance_init */
};
type = g_type_register_static (GIMP_TYPE_COLOR_OPTIONS,
......@@ -107,6 +108,10 @@ gimp_color_picker_options_class_init (GimpColorPickerOptionsClass *klass)
GIMP_TYPE_COLOR_PICK_MODE,
GIMP_COLOR_PICK_MODE_FOREGROUND,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_ADD_TO_PALETTE,
"add-to-palette", NULL,
FALSE,
0);
}
static void
......@@ -125,6 +130,9 @@ gimp_color_picker_options_set_property (GObject *object,
case PROP_PICK_MODE:
options->pick_mode = g_value_get_enum (value);
break;
case PROP_ADD_TO_PALETTE:
options->add_to_palette = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......@@ -148,6 +156,9 @@ gimp_color_picker_options_get_property (GObject *object,
case PROP_PICK_MODE:
g_value_set_enum (value, options->pick_mode);
break;
case PROP_ADD_TO_PALETTE:
g_value_set_boolean (value, options->add_to_palette);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......@@ -157,7 +168,7 @@ gimp_color_picker_options_get_property (GObject *object,
GtkWidget *
gimp_color_picker_options_gui (GimpToolOptions *tool_options)
{
GObject *config = G_OBJECT (tool_options);
GObject *config = G_OBJECT (tool_options);
GtkWidget *vbox;
GtkWidget *button;
GtkWidget *frame;
......@@ -180,5 +191,14 @@ gimp_color_picker_options_gui (GimpToolOptions *tool_options)
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
gtk_widget_show (frame);
/* the add to palette toggle */
str = g_strdup_printf (_("Add to palette %s"),
gimp_get_mod_string (GDK_SHIFT_MASK));
button = gimp_prop_check_button_new (config, "add-to-palette", str);
g_free (str);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
gtk_widget_show (button);
return vbox;
}
......@@ -39,6 +39,7 @@ struct _GimpColorPickerOptions
GimpColorOptions parent_instance;
GimpColorPickMode pick_mode;
gboolean add_to_palette;
};
......
......@@ -31,6 +31,7 @@
#include "core/gimptoolinfo.h"
#include "widgets/gimpcolorframe.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimppaletteeditor.h"
#include "widgets/gimptooldialog.h"
......@@ -68,6 +69,7 @@ static void gimp_color_picker_tool_oper_update (GimpTool *tool,
GimpDisplay *gdisp);
static void gimp_color_picker_tool_picked (GimpColorTool *color_tool,
GimpColorPickState pick_state,
GimpImageType sample_type,
GimpRGB *color,
gint color_index);
......@@ -112,18 +114,18 @@ gimp_color_picker_tool_get_type (void)
static const GTypeInfo tool_info =
{
sizeof (GimpColorPickerToolClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_color_picker_tool_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpColorPickerTool),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_color_picker_tool_init,
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_color_picker_tool_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpColorPickerTool),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_color_picker_tool_init,
};
tool_type = g_type_register_static (GIMP_TYPE_COLOR_TOOL,
"GimpColorPickerTool",
"GimpColorPickerTool",
&tool_info, 0);
}
......@@ -133,13 +135,9 @@ gimp_color_picker_tool_get_type (void)
static void
gimp_color_picker_tool_class_init (GimpColorPickerToolClass *klass)
{
GObjectClass *object_class;
GimpToolClass *tool_class;
GimpColorToolClass *color_tool_class;
object_class = G_OBJECT_CLASS (klass);
tool_class = GIMP_TOOL_CLASS (klass);
color_tool_class = GIMP_COLOR_TOOL_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
GimpColorToolClass *color_tool_class = GIMP_COLOR_TOOL_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
......@@ -192,8 +190,8 @@ gimp_color_picker_tool_finalize (GObject *object)
static void
gimp_color_picker_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *gdisp)
GimpToolAction action,
GimpDisplay *gdisp)
{
GimpColorPickerTool *picker_tool = GIMP_COLOR_PICKER_TOOL (tool);
......@@ -223,7 +221,12 @@ gimp_color_picker_tool_modifier_key (GimpTool *tool,
options = GIMP_COLOR_PICKER_OPTIONS (tool->tool_info->tool_options);
if (key == GDK_CONTROL_MASK)
if (key == GDK_SHIFT_MASK)
{
g_object_set (options, "add-to-palette", ! options->add_to_palette,
NULL);
}
else if (key == GDK_CONTROL_MASK)
{
switch (options->pick_mode)
{
......@@ -258,18 +261,18 @@ gimp_color_picker_tool_oper_update (GimpTool *tool,
}
static void
gimp_color_picker_tool_picked (GimpColorTool *color_tool,
GimpImageType sample_type,
GimpRGB *color,
gint color_index)
gimp_color_picker_tool_picked (GimpColorTool *color_tool,
GimpColorPickState pick_state,
GimpImageType sample_type,
GimpRGB *color,
gint color_index)
{
GimpTool *tool;
GimpColorPickerTool *picker_tool;
GimpTool *tool = GIMP_TOOL (color_tool);
GimpColorPickerTool *picker_tool = GIMP_COLOR_PICKER_TOOL (color_tool);
GimpColorPickerOptions *options;
GimpContext *user_context;
tool = GIMP_TOOL (color_tool);
picker_tool = GIMP_COLOR_PICKER_TOOL (color_tool);
options = GIMP_COLOR_PICKER_OPTIONS (color_tool->options);
if (! picker_tool->dialog)
gimp_color_picker_tool_info_create (picker_tool);
......@@ -277,13 +280,38 @@ gimp_color_picker_tool_picked (GimpColorTool *color_tool,
gimp_color_picker_tool_info_update (picker_tool, sample_type,
color, color_index);
options = GIMP_COLOR_PICKER_OPTIONS (color_tool->options);
user_context = gimp_get_user_context (tool->gdisp->gimage->gimp);
#if 0
gimp_palette_editor_update_color (user_context, color, update_state);
#endif
if (options->add_to_palette)
{
GimpDialogFactory *dialog_factory;
GdkScreen *screen;
GtkWidget *dockable;
GtkWidget *palette_editor;
GimpData *data;
dialog_factory = gimp_dialog_factory_from_name ("dock");
screen = gtk_widget_get_screen (tool->gdisp->shell);
dockable = gimp_dialog_factory_dialog_raise (dialog_factory,
screen,
"gimp-palette-editor",
-1);
palette_editor = gtk_bin_get_child (GTK_BIN (dockable));
data = gimp_data_editor_get_data (GIMP_DATA_EDITOR (palette_editor));
if (! data)
{
data = GIMP_DATA (gimp_context_get_palette (user_context));
gimp_data_editor_set_data (GIMP_DATA_EDITOR (palette_editor), data);
}
gimp_palette_editor_pick_color (GIMP_PALETTE_EDITOR (palette_editor),
color, pick_state);
}
switch (options->pick_mode)
{
......
......@@ -80,6 +80,7 @@ static gboolean gimp_color_tool_real_pick (GimpColorTool *color_tool,
GimpRGB *color,
gint *color_index);
static void gimp_color_tool_pick (GimpColorTool *tool,
GimpColorPickState pick_state,
gint x,
gint y);
......@@ -120,13 +121,9 @@ gimp_color_tool_get_type (void)
static void
gimp_color_tool_class_init (GimpColorToolClass *klass)
{
GObjectClass *object_class;
GimpToolClass *tool_class;
GimpDrawToolClass *draw_class;
object_class = G_OBJECT_CLASS (klass);
tool_class = GIMP_TOOL_CLASS (klass);
draw_class = GIMP_DRAW_TOOL_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
GimpDrawToolClass *draw_class = GIMP_DRAW_TOOL_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
......@@ -136,8 +133,9 @@ gimp_color_tool_class_init (GimpColorToolClass *klass)
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpColorToolClass, picked),
NULL, NULL,
gimp_marshal_VOID__ENUM_BOXED_INT,
G_TYPE_NONE, 3,
gimp_marshal_VOID__ENUM_ENUM_BOXED_INT,
G_TYPE_NONE, 4,
GIMP_TYPE_COLOR_PICK_STATE,
GIMP_TYPE_IMAGE_TYPE,
GIMP_TYPE_COLOR | G_SIGNAL_TYPE_STATIC_SCOPE,
G_TYPE_INT);
......@@ -207,7 +205,8 @@ gimp_color_tool_button_press (GimpTool *tool,
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), gdisp);
gimp_color_tool_pick (color_tool, coords->x, coords->y);
gimp_color_tool_pick (color_tool, GIMP_COLOR_PICK_STATE_NEW,
coords->x, coords->y);
}
}
......@@ -248,7 +247,8 @@ gimp_color_tool_motion (GimpTool *tool,
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
gimp_color_tool_pick (color_tool, coords->x, coords->y);
gimp_color_tool_pick (color_tool, GIMP_COLOR_PICK_STATE_UPDATE,
coords->x, coords->y);
}
static void
......@@ -340,9 +340,10 @@ gimp_color_tool_real_pick (GimpColorTool *color_tool,
}
static void
gimp_color_tool_pick (GimpColorTool *tool,
gint x,
gint y)
gimp_color_tool_pick (GimpColorTool *tool,
GimpColorPickState pick_state,
gint x,
gint y)
{
GimpColorToolClass *klass;
GimpImageType sample_type;
......@@ -354,11 +355,8 @@ gimp_color_tool_pick (GimpColorTool *tool,
if (klass->pick &&
klass->pick (tool, x, y, &sample_type, &color, &color_index))
{
g_signal_emit (tool,
gimp_color_tool_signals[PICKED], 0,
sample_type,
&color,
color_index);
g_signal_emit (tool, gimp_color_tool_signals[PICKED], 0,
pick_state, sample_type, &color, color_index);
}
}
......
......@@ -50,18 +50,19 @@ struct _GimpColorToolClass
GimpDrawToolClass parent_class;
/* virtual functions */
gboolean (* pick) (GimpColorTool *tool,
gint x,
gint y,
GimpImageType *sample_type,
GimpRGB *color,
gint *color_index);
gboolean (* pick) (GimpColorTool *tool,
gint x,
gint y,
GimpImageType *sample_type,
GimpRGB *color,
gint *color_index);
/* signals */
void (* picked) (GimpColorTool *tool,
GimpImageType sample_type,
GimpRGB *color,
gint color_index);
void (* picked) (GimpColorTool *tool,
GimpColorPickState pick_state,
GimpImageType sample_type,
GimpRGB *color,
gint color_index);
};
......
......@@ -88,6 +88,7 @@ static void gimp_curves_tool_button_release (GimpTool *tool,
GimpDisplay *gdisp);
static void gimp_curves_tool_color_picked (GimpColorTool *color_tool,
GimpColorPickState pick_state,
GimpImageType sample_type,
GimpRGB *color,
gint color_index);
......@@ -358,10 +359,11 @@ gimp_curves_tool_button_release (GimpTool *tool,
}
static void
gimp_curves_tool_color_picked (GimpColorTool *color_tool,
GimpImageType sample_type,
GimpRGB *color,
gint color_index)
gimp_curves_tool_color_picked (GimpColorTool *color_tool,
GimpColorPickState pick_state,
GimpImageType sample_type,
GimpRGB *color,
gint color_index)
{
GimpCurvesTool *tool = GIMP_CURVES_TOOL (color_tool);
GimpDrawable *drawable;
......
......@@ -91,6 +91,7 @@ static gboolean gimp_levels_tool_initialize (GimpTool *tool,
GimpDisplay *gdisp);
static void gimp_levels_tool_color_picked (GimpColorTool *color_tool,
GimpColorPickState pick_state,
GimpImageType sample_type,
GimpRGB *color,
gint color_index);
......@@ -1376,10 +1377,11 @@ levels_input_adjust_by_color (Levels *levels,
}
static void
gimp_levels_tool_color_picked (GimpColorTool *color_tool,
GimpImageType sample_type,
GimpRGB *color,
gint color_index)
gimp_levels_tool_color_picked (GimpColorTool *color_tool,
GimpColorPickState pick_state,
GimpImageType sample_type,
GimpRGB *color,
gint color_index)
{
GimpLevelsTool *tool = GIMP_LEVELS_TOOL (color_tool);
guchar col[5];
......
......@@ -103,6 +103,7 @@ static void gimp_paint_tool_cursor_update (GimpTool *tool,
static void gimp_paint_tool_draw (GimpDrawTool *draw_tool);
static void gimp_paint_tool_color_picked (GimpColorTool *color_tool,
GimpColorPickState pick_state,
GimpImageType sample_type,
GimpRGB *color,
gint color_index);
......@@ -850,10 +851,11 @@ gimp_paint_tool_cursor_update (GimpTool *tool,
}
static void
gimp_paint_tool_color_picked (GimpColorTool *color_tool,
GimpImageType sample_type,
GimpRGB *color,
gint color_index)
gimp_paint_tool_color_picked (GimpColorTool *color_tool,
GimpColorPickState pick_state,
GimpImageType sample_type,
GimpRGB *color,
gint color_index)
{
GimpTool *tool = GIMP_TOOL (color_tool);
......
......@@ -189,13 +189,9 @@ gimp_palette_editor_get_type (void)
static void
gimp_palette_editor_class_init (GimpPaletteEditorClass *klass)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GimpDataEditorClass *editor_class;
object_class = GTK_OBJECT_CLASS (klass);
widget_class = GTK_WIDGET_CLASS (klass);
editor_class = GIMP_DATA_EDITOR_CLASS (klass);
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GimpDataEditorClass *editor_class = GIMP_DATA_EDITOR_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
......@@ -209,7 +205,7 @@ gimp_palette_editor_class_init (GimpPaletteEditorClass *klass)
static void
gimp_palette_editor_init (GimpPaletteEditor *editor)
{
GtkWidget *scrolledwindow;
GtkWidget *scrolled_win;
GtkWidget *eventbox;
GtkWidget *alignment;
GtkWidget *hbox;
......@@ -223,17 +219,17 @@ gimp_palette_editor_init (GimpPaletteEditor *editor)
editor->columns = COLUMNS;
editor->columns_valid = TRUE;
editor->scrolled_window = scrolledwindow =
editor->scrolled_window = scrolled_win =
gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_size_request (scrolledwindow, -1, PREVIEW_HEIGHT);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
gtk_widget_set_size_request (scrolled_win, -1, PREVIEW_HEIGHT);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_box_pack_start (GTK_BOX (editor), scrolledwindow, TRUE, TRUE, 0);
gtk_widget_show (scrolledwindow);
gtk_box_pack_start (GTK_BOX (editor), scrolled_win, TRUE, TRUE, 0);
gtk_widget_show (scrolled_win);
eventbox = gtk_event_box_new ();
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolledwindow),
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win),
eventbox);
gtk_widget_show (eventbox);
......@@ -351,7 +347,6 @@ gimp_palette_editor_init (GimpPaletteEditor *editor)
editor);
}
static void
gimp_palette_editor_docked_iface_init (GimpDockedInterface *docked_iface)
{
......@@ -414,9 +409,7 @@ gimp_palette_editor_get_aux_info (GimpDocked *docked)
static void
gimp_palette_editor_destroy (GtkObject *object)
{
GimpPaletteEditor *editor;
editor = GIMP_PALETTE_EDITOR (object);
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (object);
if (editor->color_notebook)
{
......@@ -430,9 +423,7 @@ gimp_palette_editor_destroy (GtkObject *object)
static void
gimp_palette_editor_unmap (GtkWidget *widget)
{
GimpPaletteEditor *editor;
editor = GIMP_PALETTE_EDITOR (widget);
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (widget);
if (editor->color_notebook)
color_notebook_hide (editor->color_notebook);
......@@ -444,9 +435,7 @@ static void
gimp_palette_editor_set_data (GimpDataEditor *editor,
GimpData *data)
{
GimpPaletteEditor *palette_editor;
palette_editor = GIMP_PALETTE_EDITOR (editor);
GimpPaletteEditor *palette_editor = GIMP_PALETTE_EDITOR (editor);
g_signal_handlers_block_by_func (palette_editor->columns_data,
palette_editor_columns_changed,
......@@ -475,9 +464,7 @@ gimp_palette_editor_set_data (GimpDataEditor *editor,
if (editor->data)
{
GimpPalette *palette;
palette = GIMP_PALETTE (editor->data);
GimpPalette *palette = GIMP_PALETTE (editor->data);
g_signal_connect (editor->data, "invalidate_preview",
G_CALLBACK (palette_editor_invalidate_preview),
......@@ -532,42 +519,31 @@ gimp_palette_editor_new (Gimp *gimp,
}
void
gimp_palette_editor_update_color (GimpContext *context,
const GimpRGB *color,
GimpUpdateColorState state)
gimp_palette_editor_pick_color (GimpPaletteEditor *editor,
const GimpRGB *color,
GimpColorPickState pick_state)
{
#ifdef __GNUC__
#warning FIXME: palette_set_active_color()
#endif
#if 0
if (top_level_edit_palette)
{
GimpPalette *palette;
palette = gimp_context_get_palette (top_level_edit_palette->context);
if (palette)
{
switch (state)
{
case GIMP_UPDATE_COLOR_STATE_NEW:
top_level_edit_palette->color = gimp_palette_add_entry (palette,
NULL,
color);
break;
g_return_if_fail (GIMP_IS_PALETTE_EDITOR (editor));
g_return_if_fail (color != NULL);
case GIMP_UPDATE_COLOR_STATE_UPDATE_NEW:
top_level_edit_palette->color->color = *color;
if (GIMP_DATA_EDITOR (editor)->data_editable)
{
GimpData *data = gimp_data_editor_get_data (GIMP_DATA_EDITOR (editor));
gimp_data_dirty (GIMP_DATA (palette));
break;
switch (pick_state)
{
case GIMP_COLOR_PICK_STATE_NEW:
editor->color = gimp_palette_add_entry (GIMP_PALETTE (data),
NULL, color);
break;
case GIMP_COLOR_PICK_STATE_UPDATE:
editor->color->color = *color;
break;
}
default:
break;
}
}
gimp_data_dirty (data);
}
#endif
}
......@@ -623,7 +599,11 @@ palette_editor_color_area_button_press (GtkWidget *widget,
else
editor->dnd_color = NULL;
if ((bevent->button == 1 || bevent->button == 3) && palette)
if (! palette)
return FALSE;
if (bevent->type == GDK_BUTTON_PRESS &&
(bevent->button == 1 || bevent->button == 3))
{
palette_editor_select_entry (editor, list ? list->data : NULL);
......@@ -637,15 +617,16 @@ palette_editor_color_area_button_press (GtkWidget *widget,
&editor->color->color);
palette_editor_draw_entries (editor, row, col);
if (data_editor->data_editable &&
bevent->button == 1 &&
((GdkEventAny *) bevent)->type == GDK_2BUTTON_PRESS)
{
gtk_button_clicked (GTK_BUTTON (editor->edit_button));
}
}
}
else if (data_editor->data_editable &&
list &&
list->data == editor->color &&
bevent->button == 1 &&
bevent->type == GDK_2BUTTON_PRESS)
{
gtk_button_clicked (GTK_BUTTON (editor->edit_button));
}
return FALSE; /* continue with eventbox_button_press */
}
......@@ -975,11 +956,9 @@ static void
palette_editor_select_entry (GimpPaletteEditor *editor,
GimpPaletteEntry *entry)
{
GimpDataEditor *data_editor;
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (editor);
GimpPalette *palette;
data_editor = GIMP_DATA_EDITOR (editor);
palette = GIMP_PALETTE (data_editor->data);
if (editor->color != entry)
......@@ -1291,12 +1270,10 @@ palette_editor_color_notebook_callback (ColorNotebook *color_notebook,
ColorNotebookState state,
gpointer data)
{
GimpPaletteEditor *editor;
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
GimpPalette *palette;
GimpContext *user_context;
editor = GIMP_PALETTE_EDITOR (data);
palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
user_context = gimp_get_user_context (GIMP_DATA_EDITOR (editor)->data_factory->gimp);
...