app/actions/qmask-commands.c just some cleanup.

2004-09-18  Sven Neumann  <sven@gimp.org>

	* app/actions/qmask-commands.c
	* libgimpcolor/gimprgb.c (gimp_rgba_distance): just some cleanup.

	* app/core/gimpimage-qmask.c (gimp_image_set_qmask_color): always
	set gimage->qmask_color regardless of the qmask state.

	* libgimpwidgets/gimpcolorbutton.c (gimp_color_button_new): set
	the type before setting the color.
This commit is contained in:
Sven Neumann 2004-09-17 22:16:21 +00:00 committed by Sven Neumann
parent c9cac47fbe
commit cace0a19a0
7 changed files with 36 additions and 27 deletions

View File

@ -1,3 +1,14 @@
2004-09-18 Sven Neumann <sven@gimp.org>
* app/actions/qmask-commands.c
* libgimpcolor/gimprgb.c (gimp_rgba_distance): just some cleanup.
* app/core/gimpimage-qmask.c (gimp_image_set_qmask_color): always
set gimage->qmask_color regardless of the qmask state.
* libgimpwidgets/gimpcolorbutton.c (gimp_color_button_new): set
the type before setting the color.
2004-09-17 Michael Natterer <mitch@gimp.org> 2004-09-17 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpcomponenteditor.c * app/widgets/gimpcomponenteditor.c

View File

@ -62,9 +62,9 @@ static void qmask_query_response (GtkWidget *widget,
gint response_id, gint response_id,
EditQmaskOptions *options); EditQmaskOptions *options);
static void qmask_query_scale_update (GtkAdjustment *adjustment, static void qmask_query_scale_update (GtkAdjustment *adjustment,
gpointer data); GtkWidget *panel);
static void qmask_query_color_changed (GimpColorButton *button, static void qmask_query_color_changed (GimpColorButton *button,
gpointer data); GtkAdjustment *adj);
/* public functionss */ /* public functionss */
@ -237,21 +237,20 @@ qmask_query_response (GtkWidget *widget,
static void static void
qmask_query_scale_update (GtkAdjustment *adjustment, qmask_query_scale_update (GtkAdjustment *adjustment,
gpointer data) GtkWidget *panel)
{ {
GimpRGB color; GimpRGB color;
gimp_color_button_get_color (GIMP_COLOR_BUTTON (data), &color); gimp_color_button_get_color (GIMP_COLOR_BUTTON (panel), &color);
gimp_rgb_set_alpha (&color, adjustment->value / 100.0); gimp_rgb_set_alpha (&color, adjustment->value / 100.0);
gimp_color_button_set_color (GIMP_COLOR_BUTTON (data), &color); gimp_color_button_set_color (GIMP_COLOR_BUTTON (panel), &color);
} }
static void static void
qmask_query_color_changed (GimpColorButton *button, qmask_query_color_changed (GimpColorButton *button,
gpointer data) GtkAdjustment *adj)
{ {
GtkAdjustment *adj = GTK_ADJUSTMENT (data); GimpRGB color;
GimpRGB color;
gimp_color_button_get_color (button, &color); gimp_color_button_get_color (button, &color);
gtk_adjustment_set_value (adj, color.a * 100.0); gtk_adjustment_set_value (adj, color.a * 100.0);

View File

@ -62,9 +62,9 @@ static void qmask_query_response (GtkWidget *widget,
gint response_id, gint response_id,
EditQmaskOptions *options); EditQmaskOptions *options);
static void qmask_query_scale_update (GtkAdjustment *adjustment, static void qmask_query_scale_update (GtkAdjustment *adjustment,
gpointer data); GtkWidget *panel);
static void qmask_query_color_changed (GimpColorButton *button, static void qmask_query_color_changed (GimpColorButton *button,
gpointer data); GtkAdjustment *adj);
/* public functionss */ /* public functionss */
@ -237,21 +237,20 @@ qmask_query_response (GtkWidget *widget,
static void static void
qmask_query_scale_update (GtkAdjustment *adjustment, qmask_query_scale_update (GtkAdjustment *adjustment,
gpointer data) GtkWidget *panel)
{ {
GimpRGB color; GimpRGB color;
gimp_color_button_get_color (GIMP_COLOR_BUTTON (data), &color); gimp_color_button_get_color (GIMP_COLOR_BUTTON (panel), &color);
gimp_rgb_set_alpha (&color, adjustment->value / 100.0); gimp_rgb_set_alpha (&color, adjustment->value / 100.0);
gimp_color_button_set_color (GIMP_COLOR_BUTTON (data), &color); gimp_color_button_set_color (GIMP_COLOR_BUTTON (panel), &color);
} }
static void static void
qmask_query_color_changed (GimpColorButton *button, qmask_query_color_changed (GimpColorButton *button,
gpointer data) GtkAdjustment *adj)
{ {
GtkAdjustment *adj = GTK_ADJUSTMENT (data); GimpRGB color;
GimpRGB color;
gimp_color_button_get_color (button, &color); gimp_color_button_get_color (button, &color);
gtk_adjustment_set_value (adj, color.a * 100.0); gtk_adjustment_set_value (adj, color.a * 100.0);

View File

@ -149,12 +149,11 @@ gimp_image_set_qmask_color (GimpImage *gimage,
g_return_if_fail (GIMP_IS_IMAGE (gimage)); g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (color != NULL); g_return_if_fail (color != NULL);
qmask = gimp_image_get_qmask (gimage); gimage->qmask_color = *color;
qmask = gimp_image_get_qmask (gimage);
if (qmask) if (qmask)
gimp_channel_set_color (qmask, color, TRUE); gimp_channel_set_color (qmask, color, TRUE);
else
gimage->qmask_color = *color;
} }
void void

View File

@ -149,12 +149,11 @@ gimp_image_set_qmask_color (GimpImage *gimage,
g_return_if_fail (GIMP_IS_IMAGE (gimage)); g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (color != NULL); g_return_if_fail (color != NULL);
qmask = gimp_image_get_qmask (gimage); gimage->qmask_color = *color;
qmask = gimp_image_get_qmask (gimage);
if (qmask) if (qmask)
gimp_channel_set_color (qmask, color, TRUE); gimp_channel_set_color (qmask, color, TRUE);
else
gimage->qmask_color = *color;
} }
void void

View File

@ -408,6 +408,8 @@ gimp_rgba_distance (const GimpRGB *rgba1,
g_return_val_if_fail (rgba1 != NULL, 0.0); g_return_val_if_fail (rgba1 != NULL, 0.0);
g_return_val_if_fail (rgba2 != NULL, 0.0); g_return_val_if_fail (rgba2 != NULL, 0.0);
return (fabs (rgba1->r - rgba2->r) + fabs (rgba1->g - rgba2->g) + return (fabs (rgba1->r - rgba2->r) +
fabs (rgba1->b - rgba2->b) + fabs (rgba1->a - rgba2->a)); fabs (rgba1->g - rgba2->g) +
fabs (rgba1->b - rgba2->b) +
fabs (rgba1->a - rgba2->a));
} }

View File

@ -291,8 +291,8 @@ gimp_color_button_new (const gchar *title,
gtk_widget_set_size_request (GTK_WIDGET (button->color_area), width, height); gtk_widget_set_size_request (GTK_WIDGET (button->color_area), width, height);
gimp_color_area_set_color (GIMP_COLOR_AREA (button->color_area), color);
gimp_color_area_set_type (GIMP_COLOR_AREA (button->color_area), type); gimp_color_area_set_type (GIMP_COLOR_AREA (button->color_area), type);
gimp_color_area_set_color (GIMP_COLOR_AREA (button->color_area), color);
return GTK_WIDGET (button); return GTK_WIDGET (button);
} }