Commit 48845d0a authored by William Skaggs's avatar William Skaggs

Bill Skaggs <weskaggs@primate.ucdavis.edu>

	* app/widgets/gimpcolorframe.[ch]: add "has-color-area" property,
	FALSE by default.

	* app/widgets/gimpsamplepointeditor.c: explicitly add a color
	area to the color frames.
parent 33131e6a
2005-06-03 Bill Skaggs <weskaggs@primate.ucdavis.edu>
* app/widgets/gimpcolorframe.[ch]: add "has-color-area" property,
FALSE by default.
* app/widgets/gimpsamplepointeditor.c: explicitly add a color
area to the color frames.
2005-06-04 Sven Neumann <sven@gimp.org>
* app/widgets/gimpdnd.c (gimp_dnd_get_viewable_icon): show the
......
......@@ -36,6 +36,7 @@ enum
{
PROP_0,
PROP_HAS_NUMBER,
PROP_HAS_COLOR_AREA,
PROP_NUMBER
};
......@@ -105,6 +106,12 @@ gimp_color_frame_class_init (GimpColorFrameClass *klass)
FALSE,
G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_HAS_NUMBER,
g_param_spec_boolean ("has-color-area",
NULL, NULL,
FALSE,
G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_NUMBER,
g_param_spec_int ("number",
NULL, NULL,
......@@ -149,12 +156,13 @@ gimp_color_frame_init (GimpColorFrame *frame)
gtk_box_pack_start (GTK_BOX (hbox), frame->number_label, FALSE, FALSE, 0);
frame->color_area = gimp_color_area_new (&frame->color,
GIMP_COLOR_AREA_SMALL_CHECKS, 0);
GIMP_COLOR_AREA_SMALL_CHECKS,
GDK_BUTTON1_MASK);
gtk_widget_set_size_request (frame->color_area, 30, 20);
gimp_color_area_set_color (GIMP_COLOR_AREA (frame->color_area),
&frame->color);
gtk_box_pack_end (GTK_BOX (hbox), frame->color_area, TRUE, TRUE, 0);
gtk_widget_show (frame->color_area);
gimp_color_frame_set_has_color_area (frame, FALSE);
vbox2 = gtk_vbox_new (TRUE, 2);
gtk_box_pack_start (GTK_BOX (vbox), vbox2, FALSE, FALSE, 0);
......@@ -195,6 +203,10 @@ gimp_color_frame_get_property (GObject *object,
g_value_set_boolean (value, frame->has_number);
break;
case PROP_HAS_COLOR_AREA:
g_value_set_boolean (value, frame->has_color_area);
break;
case PROP_NUMBER:
g_value_set_int (value, frame->number);
break;
......@@ -219,6 +231,10 @@ gimp_color_frame_set_property (GObject *object,
gimp_color_frame_set_has_number (frame, g_value_get_boolean (value));
break;
case PROP_HAS_COLOR_AREA:
gimp_color_frame_set_has_color_area (frame, g_value_get_boolean (value));
break;
case PROP_NUMBER:
gimp_color_frame_set_number (frame, g_value_get_int (value));
break;
......@@ -258,6 +274,25 @@ gimp_color_frame_set_has_number (GimpColorFrame *frame,
}
}
void
gimp_color_frame_set_has_color_area (GimpColorFrame *frame,
gboolean has_color_area)
{
g_return_if_fail (GIMP_IS_COLOR_FRAME (frame));
if (has_color_area != frame->has_color_area)
{
frame->has_color_area = has_color_area ? TRUE : FALSE;
if (frame->has_color_area)
gtk_widget_show (frame->color_area);
else
gtk_widget_hide (frame->color_area);
g_object_notify (G_OBJECT (frame), "has-color-area");
}
}
void
gimp_color_frame_set_number (GimpColorFrame *frame,
gint number)
......@@ -384,8 +419,9 @@ gimp_color_frame_update (GimpColorFrame *frame)
gimp_rgba_get_uchar (&frame->color, &r, &g, &b, &a);
gimp_color_area_set_color (GIMP_COLOR_AREA (frame->color_area),
&frame->color);
if (frame->has_color_area)
gimp_color_area_set_color (GIMP_COLOR_AREA (frame->color_area),
&frame->color);
switch (frame->frame_mode)
{
......
......@@ -48,6 +48,7 @@ struct _GimpColorFrame
GimpColorFrameMode frame_mode;
gboolean has_number;
gboolean has_color_area;
gint number;
GtkWidget *menu;
......@@ -67,18 +68,20 @@ GType gimp_color_frame_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_color_frame_new (void);
void gimp_color_frame_set_has_number (GimpColorFrame *frame,
gboolean has_number);
void gimp_color_frame_set_number (GimpColorFrame *frame,
gint number);
void gimp_color_frame_set_mode (GimpColorFrame *frame,
GimpColorFrameMode mode);
void gimp_color_frame_set_color (GimpColorFrame *frame,
GimpImageType sample_type,
const GimpRGB *color,
gint color_index);
void gimp_color_frame_set_invalid (GimpColorFrame *frame);
void gimp_color_frame_set_has_number (GimpColorFrame *frame,
gboolean has_number);
void gimp_color_frame_set_has_color_area (GimpColorFrame *frame,
gboolean has_color_area);
void gimp_color_frame_set_number (GimpColorFrame *frame,
gint number);
void gimp_color_frame_set_mode (GimpColorFrame *frame,
GimpColorFrameMode mode);
void gimp_color_frame_set_color (GimpColorFrame *frame,
GimpImageType sample_type,
const GimpRGB *color,
gint color_index);
void gimp_color_frame_set_invalid (GimpColorFrame *frame);
#endif /* __GIMP_COLOR_FRAME_H__ */
......@@ -147,6 +147,7 @@ gimp_sample_point_editor_init (GimpSamplePointEditor *editor)
frame = editor->color_frames[i] = gimp_color_frame_new ();
gimp_color_frame_set_has_number (GIMP_COLOR_FRAME (frame), TRUE);
gimp_color_frame_set_has_color_area (GIMP_COLOR_FRAME (frame), TRUE);
gimp_color_frame_set_number (GIMP_COLOR_FRAME (frame), i + 1);
gimp_color_frame_set_mode (GIMP_COLOR_FRAME (frame),
GIMP_COLOR_FRAME_MODE_PIXEL);
......
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