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().
This commit is contained in:

committed by
Michael Natterer

parent
114f747f4c
commit
4022980314
33
ChangeLog
33
ChangeLog
@ -1,3 +1,36 @@
|
||||
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);
|
||||
@ -851,6 +852,7 @@ gimp_paint_tool_cursor_update (GimpTool *tool,
|
||||
|
||||
static void
|
||||
gimp_paint_tool_color_picked (GimpColorTool *color_tool,
|
||||
GimpColorPickState pick_state,
|
||||
GimpImageType sample_type,
|
||||
GimpRGB *color,
|
||||
gint color_index)
|
||||
|
@ -38,7 +38,8 @@ enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_SAMPLE_AVERAGE, /* overrides a GimpColorOptions property */
|
||||
PROP_PICK_MODE
|
||||
PROP_PICK_MODE,
|
||||
PROP_ADD_TO_PALETTE
|
||||
};
|
||||
|
||||
|
||||
@ -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;
|
||||
@ -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);
|
||||
@ -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);
|
||||
|
||||
@ -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)
|
||||
{
|
||||
@ -259,17 +262,17 @@ gimp_color_picker_tool_oper_update (GimpTool *tool,
|
||||
|
||||
static void
|
||||
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
|
||||
@ -341,6 +341,7 @@ gimp_color_tool_real_pick (GimpColorTool *color_tool,
|
||||
|
||||
static void
|
||||
gimp_color_tool_pick (GimpColorTool *tool,
|
||||
GimpColorPickState pick_state,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,6 +59,7 @@ struct _GimpColorToolClass
|
||||
|
||||
/* signals */
|
||||
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);
|
||||
@ -359,6 +360,7 @@ gimp_curves_tool_button_release (GimpTool *tool,
|
||||
|
||||
static void
|
||||
gimp_curves_tool_color_picked (GimpColorTool *color_tool,
|
||||
GimpColorPickState pick_state,
|
||||
GimpImageType sample_type,
|
||||
GimpRGB *color,
|
||||
gint color_index)
|
||||
|
@ -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);
|
||||
@ -1377,6 +1378,7 @@ levels_input_adjust_by_color (Levels *levels,
|
||||
|
||||
static void
|
||||
gimp_levels_tool_color_picked (GimpColorTool *color_tool,
|
||||
GimpColorPickState pick_state,
|
||||
GimpImageType sample_type,
|
||||
GimpRGB *color,
|
||||
gint color_index)
|
||||
|
@ -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);
|
||||
@ -851,6 +852,7 @@ gimp_paint_tool_cursor_update (GimpTool *tool,
|
||||
|
||||
static void
|
||||
gimp_paint_tool_color_picked (GimpColorTool *color_tool,
|
||||
GimpColorPickState pick_state,
|
||||
GimpImageType sample_type,
|
||||
GimpRGB *color,
|
||||
gint color_index)
|
||||
|
@ -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,43 +519,32 @@ gimp_palette_editor_new (Gimp *gimp,
|
||||
}
|
||||
|
||||
void
|
||||
gimp_palette_editor_update_color (GimpContext *context,
|
||||
gimp_palette_editor_pick_color (GimpPaletteEditor *editor,
|
||||
const GimpRGB *color,
|
||||
GimpUpdateColorState state)
|
||||
GimpColorPickState pick_state)
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: palette_set_active_color()
|
||||
#endif
|
||||
#if 0
|
||||
if (top_level_edit_palette)
|
||||
{
|
||||
GimpPalette *palette;
|
||||
g_return_if_fail (GIMP_IS_PALETTE_EDITOR (editor));
|
||||
g_return_if_fail (color != NULL);
|
||||
|
||||
palette = gimp_context_get_palette (top_level_edit_palette->context);
|
||||
if (GIMP_DATA_EDITOR (editor)->data_editable)
|
||||
{
|
||||
GimpData *data = gimp_data_editor_get_data (GIMP_DATA_EDITOR (editor));
|
||||
|
||||
if (palette)
|
||||
switch (pick_state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case GIMP_UPDATE_COLOR_STATE_NEW:
|
||||
top_level_edit_palette->color = gimp_palette_add_entry (palette,
|
||||
NULL,
|
||||
color);
|
||||
case GIMP_COLOR_PICK_STATE_NEW:
|
||||
editor->color = gimp_palette_add_entry (GIMP_PALETTE (data),
|
||||
NULL, color);
|
||||
break;
|
||||
|
||||
case GIMP_UPDATE_COLOR_STATE_UPDATE_NEW:
|
||||
top_level_edit_palette->color->color = *color;
|
||||
|
||||
gimp_data_dirty (GIMP_DATA (palette));
|
||||
break;
|
||||
|
||||
default:
|
||||
case GIMP_COLOR_PICK_STATE_UPDATE:
|
||||
editor->color->color = *color;
|
||||
break;
|
||||
}
|
||||
|
||||
gimp_data_dirty (data);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
@ -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 &&
|
||||
}
|
||||
}
|
||||
else if (data_editor->data_editable &&
|
||||
list &&
|
||||
list->data == editor->color &&
|
||||
bevent->button == 1 &&
|
||||
((GdkEventAny *) bevent)->type == GDK_2BUTTON_PRESS)
|
||||
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);
|
||||
|
@ -25,14 +25,6 @@
|
||||
#include "gui/gui-types.h" /* FIXME */
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GIMP_UPDATE_COLOR_STATE_NEW,
|
||||
GIMP_UPDATE_COLOR_STATE_UPDATE_NEW,
|
||||
GIMP_UPDATE_COLOR_STATE_UPDATE
|
||||
} GimpUpdateColorState;
|
||||
|
||||
|
||||
#define GIMP_TYPE_PALETTE_EDITOR (gimp_palette_editor_get_type ())
|
||||
#define GIMP_PALETTE_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PALETTE_EDITOR, GimpPaletteEditor))
|
||||
#define GIMP_PALETTE_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PALETTE_EDITOR, GimpPaletteEditorClass))
|
||||
@ -83,9 +75,9 @@ GType gimp_palette_editor_get_type (void) G_GNUC_CONST;
|
||||
GimpDataEditor * gimp_palette_editor_new (Gimp *gimp,
|
||||
GimpMenuFactory *menu_factory);
|
||||
|
||||
void gimp_palette_editor_update_color (GimpContext *context,
|
||||
void gimp_palette_editor_pick_color (GimpPaletteEditor *editor,
|
||||
const GimpRGB *color,
|
||||
GimpUpdateColorState state);
|
||||
GimpColorPickState pick_state);
|
||||
|
||||
|
||||
#endif /* __GIMP_PALETTE_EDITOR_H__ */
|
||||
|
@ -68,6 +68,25 @@ gimp_color_frame_mode_get_type (void)
|
||||
}
|
||||
|
||||
|
||||
static const GEnumValue gimp_color_pick_state_enum_values[] =
|
||||
{
|
||||
{ GIMP_COLOR_PICK_STATE_NEW, "GIMP_COLOR_PICK_STATE_NEW", "new" },
|
||||
{ GIMP_COLOR_PICK_STATE_UPDATE, "GIMP_COLOR_PICK_STATE_UPDATE", "update" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
GType
|
||||
gimp_color_pick_state_get_type (void)
|
||||
{
|
||||
static GType enum_type = 0;
|
||||
|
||||
if (!enum_type)
|
||||
enum_type = g_enum_register_static ("GimpColorPickState", gimp_color_pick_state_enum_values);
|
||||
|
||||
return enum_type;
|
||||
}
|
||||
|
||||
|
||||
static const GEnumValue gimp_cursor_format_enum_values[] =
|
||||
{
|
||||
{ GIMP_CURSOR_FORMAT_BITMAP, N_("Black & White"), "bitmap" },
|
||||
|
@ -60,6 +60,17 @@ typedef enum
|
||||
} GimpColorFrameMode;
|
||||
|
||||
|
||||
#define GIMP_TYPE_COLOR_PICK_STATE (gimp_color_pick_state_get_type ())
|
||||
|
||||
GType gimp_color_pick_state_get_type (void) G_GNUC_CONST;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GIMP_COLOR_PICK_STATE_NEW,
|
||||
GIMP_COLOR_PICK_STATE_UPDATE
|
||||
} GimpColorPickState;
|
||||
|
||||
|
||||
#define GIMP_TYPE_CURSOR_FORMAT (gimp_cursor_format_get_type ())
|
||||
|
||||
GType gimp_cursor_format_get_type (void) G_GNUC_CONST;
|
||||
|
Reference in New Issue
Block a user