Commit 101c5a2d authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

pass GIMP_COLOR_AREA_CHECKS_SMALL instead of TRUE for the type of the

2005-05-29  Sven Neumann  <sven@gimp.org>

	* app/widgets/gimpdnd.c (gimp_dnd_get_color_icon): pass
	GIMP_COLOR_AREA_CHECKS_SMALL instead of TRUE for the type of the
	GimpColorArea.

	* app/widgets/gimpcoloreditor.c: added a "context" property.

	* libgimpwidgets/gimpcolorarea.c (gimp_color_area_set_color):
	always use gimp_rgba_distance(), regardless of the area's type.
parent e905e899
2005-05-29 Sven Neumann <sven@gimp.org>
* app/widgets/gimpdnd.c (gimp_dnd_get_color_icon): pass
GIMP_COLOR_AREA_CHECKS_SMALL instead of TRUE for the type of the
GimpColorArea.
* app/widgets/gimpcoloreditor.c: added a "context" property.
* libgimpwidgets/gimpcolorarea.c (gimp_color_area_set_color):
always use gimp_rgba_distance(), regardless of the area's type.
2005-05-28 Manish Singh <yosh@gimp.org> 2005-05-28 Manish Singh <yosh@gimp.org>
* plug-ins/pygimp/gimpmodule.c * plug-ins/pygimp/gimpmodule.c
......
...@@ -42,11 +42,28 @@ ...@@ -42,11 +42,28 @@
#include "gimp-intl.h" #include "gimp-intl.h"
enum
{
PROP_0,
PROP_CONTEXT
};
static void gimp_color_editor_class_init (GimpColorEditorClass *klass); static void gimp_color_editor_class_init (GimpColorEditorClass *klass);
static void gimp_color_editor_init (GimpColorEditor *editor); static void gimp_color_editor_init (GimpColorEditor *editor);
static void gimp_color_editor_docked_iface_init (GimpDockedInterface *docked_iface); static void gimp_color_editor_docked_iface_init (GimpDockedInterface *docked_iface);
static void gimp_color_editor_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_color_editor_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_color_editor_destroy (GtkObject *object); static void gimp_color_editor_destroy (GtkObject *object);
static void gimp_color_editor_style_set (GtkWidget *widget, static void gimp_color_editor_style_set (GtkWidget *widget,
GtkStyle *prev_style); GtkStyle *prev_style);
...@@ -56,8 +73,6 @@ static GList *gimp_color_editor_get_aux_info (GimpDocked *docked); ...@@ -56,8 +73,6 @@ static GList *gimp_color_editor_get_aux_info (GimpDocked *docked);
static void gimp_color_editor_set_context (GimpDocked *docked, static void gimp_color_editor_set_context (GimpDocked *docked,
GimpContext *context); GimpContext *context);
static void gimp_color_editor_destroy (GtkObject *object);
static void gimp_color_editor_fg_changed (GimpContext *context, static void gimp_color_editor_fg_changed (GimpContext *context,
const GimpRGB *rgb, const GimpRGB *rgb,
GimpColorEditor *editor); GimpColorEditor *editor);
...@@ -123,14 +138,25 @@ gimp_color_editor_get_type (void) ...@@ -123,14 +138,25 @@ gimp_color_editor_get_type (void)
static void static void
gimp_color_editor_class_init (GimpColorEditorClass* klass) gimp_color_editor_class_init (GimpColorEditorClass* klass)
{ {
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
parent_class = g_type_class_peek_parent (klass); parent_class = g_type_class_peek_parent (klass);
object_class->destroy = gimp_color_editor_destroy; object_class->set_property = gimp_color_editor_set_property;
object_class->get_property = gimp_color_editor_get_property;
gtk_object_class->destroy = gimp_color_editor_destroy;
widget_class->style_set = gimp_color_editor_style_set;
g_object_class_install_property (object_class, PROP_CONTEXT,
g_param_spec_object ("context",
NULL, NULL,
GIMP_TYPE_CONTEXT,
G_PARAM_READWRITE));
widget_class->style_set = gimp_color_editor_style_set;
} }
static void static void
...@@ -260,6 +286,53 @@ gimp_color_editor_init (GimpColorEditor *editor) ...@@ -260,6 +286,53 @@ gimp_color_editor_init (GimpColorEditor *editor)
editor); editor);
} }
static void
gimp_color_editor_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
switch (property_id)
{
case PROP_CONTEXT:
gimp_docked_set_context (GIMP_DOCKED (object),
g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_color_editor_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpColorEditor *editor = GIMP_COLOR_EDITOR (object);
switch (property_id)
{
case PROP_CONTEXT:
g_value_set_object (value, editor->context);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_color_editor_destroy (GtkObject *object)
{
GimpColorEditor *editor = GIMP_COLOR_EDITOR (object);
if (editor->context)
gimp_docked_set_context (GIMP_DOCKED (editor), NULL);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static GtkWidget * static GtkWidget *
gimp_color_editor_get_preview (GimpDocked *docked, gimp_color_editor_get_preview (GimpDocked *docked,
GimpContext *context, GimpContext *context,
...@@ -399,30 +472,12 @@ gimp_color_editor_set_context (GimpDocked *docked, ...@@ -399,30 +472,12 @@ gimp_color_editor_set_context (GimpDocked *docked,
gimp_fg_bg_editor_set_context (GIMP_FG_BG_EDITOR (editor->fg_bg), context); gimp_fg_bg_editor_set_context (GIMP_FG_BG_EDITOR (editor->fg_bg), context);
} }
static void
gimp_color_editor_destroy (GtkObject *object)
{
GimpColorEditor *editor = GIMP_COLOR_EDITOR (object);
if (editor->context)
gimp_docked_set_context (GIMP_DOCKED (editor), NULL);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
GtkWidget * GtkWidget *
gimp_color_editor_new (GimpContext *context) gimp_color_editor_new (GimpContext *context)
{ {
GimpColorEditor *editor; return g_object_new (GIMP_TYPE_COLOR_EDITOR,
"context", context,
g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL); NULL);
editor = g_object_new (GIMP_TYPE_COLOR_EDITOR, NULL);
if (context)
gimp_docked_set_context (GIMP_DOCKED (editor), context);
return GTK_WIDGET (editor);
} }
static void static void
......
...@@ -1268,8 +1268,9 @@ gimp_dnd_get_color_icon (GtkWidget *widget, ...@@ -1268,8 +1268,9 @@ gimp_dnd_get_color_icon (GtkWidget *widget,
(* (GimpDndDragColorFunc) get_color_func) (widget, &color, get_color_data); (* (GimpDndDragColorFunc) get_color_func) (widget, &color, get_color_data);
color_area = gimp_color_area_new (&color, TRUE, 0); color_area = gimp_color_area_new (&color, GIMP_COLOR_AREA_SMALL_CHECKS, 0);
gtk_widget_set_size_request (color_area, DRAG_PREVIEW_SIZE, DRAG_PREVIEW_SIZE); gtk_widget_set_size_request (color_area,
DRAG_PREVIEW_SIZE, DRAG_PREVIEW_SIZE);
return color_area; return color_area;
} }
......
...@@ -388,16 +388,8 @@ gimp_color_area_set_color (GimpColorArea *area, ...@@ -388,16 +388,8 @@ gimp_color_area_set_color (GimpColorArea *area,
g_return_if_fail (GIMP_IS_COLOR_AREA (area)); g_return_if_fail (GIMP_IS_COLOR_AREA (area));
g_return_if_fail (color != NULL); g_return_if_fail (color != NULL);
if (area->type == GIMP_COLOR_AREA_FLAT) if (gimp_rgba_distance (&area->color, color) < 0.000001)
{ return;
if (gimp_rgb_distance (&area->color, color) < 0.000001)
return;
}
else
{
if (gimp_rgba_distance (&area->color, color) < 0.000001)
return;
}
area->color = *color; area->color = *color;
......
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