From cace0a19a08bcad71a68193cb2860a1dc3a6316a Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Fri, 17 Sep 2004 22:16:21 +0000 Subject: [PATCH] app/actions/qmask-commands.c just some cleanup. 2004-09-18 Sven Neumann * 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. --- ChangeLog | 11 +++++++++++ app/actions/qmask-commands.c | 17 ++++++++--------- app/actions/quick-mask-commands.c | 17 ++++++++--------- app/core/gimpimage-qmask.c | 5 ++--- app/core/gimpimage-quick-mask.c | 5 ++--- libgimpcolor/gimprgb.c | 6 ++++-- libgimpwidgets/gimpcolorbutton.c | 2 +- 7 files changed, 36 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0ffd57a3d9..84001cb83c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2004-09-18 Sven Neumann + + * 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 * app/widgets/gimpcomponenteditor.c diff --git a/app/actions/qmask-commands.c b/app/actions/qmask-commands.c index 574de9146c..1ad4bde9ba 100644 --- a/app/actions/qmask-commands.c +++ b/app/actions/qmask-commands.c @@ -62,9 +62,9 @@ static void qmask_query_response (GtkWidget *widget, gint response_id, EditQmaskOptions *options); static void qmask_query_scale_update (GtkAdjustment *adjustment, - gpointer data); + GtkWidget *panel); static void qmask_query_color_changed (GimpColorButton *button, - gpointer data); + GtkAdjustment *adj); /* public functionss */ @@ -237,21 +237,20 @@ qmask_query_response (GtkWidget *widget, static void 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_color_button_set_color (GIMP_COLOR_BUTTON (data), &color); + gimp_color_button_set_color (GIMP_COLOR_BUTTON (panel), &color); } static void 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); gtk_adjustment_set_value (adj, color.a * 100.0); diff --git a/app/actions/quick-mask-commands.c b/app/actions/quick-mask-commands.c index 574de9146c..1ad4bde9ba 100644 --- a/app/actions/quick-mask-commands.c +++ b/app/actions/quick-mask-commands.c @@ -62,9 +62,9 @@ static void qmask_query_response (GtkWidget *widget, gint response_id, EditQmaskOptions *options); static void qmask_query_scale_update (GtkAdjustment *adjustment, - gpointer data); + GtkWidget *panel); static void qmask_query_color_changed (GimpColorButton *button, - gpointer data); + GtkAdjustment *adj); /* public functionss */ @@ -237,21 +237,20 @@ qmask_query_response (GtkWidget *widget, static void 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_color_button_set_color (GIMP_COLOR_BUTTON (data), &color); + gimp_color_button_set_color (GIMP_COLOR_BUTTON (panel), &color); } static void 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); gtk_adjustment_set_value (adj, color.a * 100.0); diff --git a/app/core/gimpimage-qmask.c b/app/core/gimpimage-qmask.c index e5416d1397..8b9d240caa 100644 --- a/app/core/gimpimage-qmask.c +++ b/app/core/gimpimage-qmask.c @@ -149,12 +149,11 @@ gimp_image_set_qmask_color (GimpImage *gimage, g_return_if_fail (GIMP_IS_IMAGE (gimage)); g_return_if_fail (color != NULL); - qmask = gimp_image_get_qmask (gimage); + gimage->qmask_color = *color; + qmask = gimp_image_get_qmask (gimage); if (qmask) gimp_channel_set_color (qmask, color, TRUE); - else - gimage->qmask_color = *color; } void diff --git a/app/core/gimpimage-quick-mask.c b/app/core/gimpimage-quick-mask.c index e5416d1397..8b9d240caa 100644 --- a/app/core/gimpimage-quick-mask.c +++ b/app/core/gimpimage-quick-mask.c @@ -149,12 +149,11 @@ gimp_image_set_qmask_color (GimpImage *gimage, g_return_if_fail (GIMP_IS_IMAGE (gimage)); g_return_if_fail (color != NULL); - qmask = gimp_image_get_qmask (gimage); + gimage->qmask_color = *color; + qmask = gimp_image_get_qmask (gimage); if (qmask) gimp_channel_set_color (qmask, color, TRUE); - else - gimage->qmask_color = *color; } void diff --git a/libgimpcolor/gimprgb.c b/libgimpcolor/gimprgb.c index d9a5e69909..9c74f669a2 100644 --- a/libgimpcolor/gimprgb.c +++ b/libgimpcolor/gimprgb.c @@ -408,6 +408,8 @@ gimp_rgba_distance (const GimpRGB *rgba1, g_return_val_if_fail (rgba1 != NULL, 0.0); g_return_val_if_fail (rgba2 != NULL, 0.0); - return (fabs (rgba1->r - rgba2->r) + fabs (rgba1->g - rgba2->g) + - fabs (rgba1->b - rgba2->b) + fabs (rgba1->a - rgba2->a)); + return (fabs (rgba1->r - rgba2->r) + + fabs (rgba1->g - rgba2->g) + + fabs (rgba1->b - rgba2->b) + + fabs (rgba1->a - rgba2->a)); } diff --git a/libgimpwidgets/gimpcolorbutton.c b/libgimpwidgets/gimpcolorbutton.c index e56fe4482e..bf272c3c5f 100644 --- a/libgimpwidgets/gimpcolorbutton.c +++ b/libgimpwidgets/gimpcolorbutton.c @@ -291,8 +291,8 @@ gimp_color_button_new (const gchar *title, 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_color (GIMP_COLOR_AREA (button->color_area), color); return GTK_WIDGET (button); }