Commit a342e890 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

minor cleanup.

2003-11-21  Sven Neumann  <sven@gimp.org>

	* modules/cdisplay_colorblind.c:
	* modules/cdisplay_gamma.c:
	* modules/cdisplay_high_contrast.c: minor cleanup.
parent 7f58649d
2003-11-21 Sven Neumann <sven@gimp.org>
* modules/cdisplay_colorblind.c:
* modules/cdisplay_gamma.c:
* modules/cdisplay_high_contrast.c: minor cleanup.
2003-11-21 Michael Natterer <mitch@gimp.org>
* modules/cdisplay_proof.c: GimpFileSelection -> GimpFileEntry,
......@@ -255,9 +255,7 @@ cdisplay_colorblind_init (CdisplayColorblind *colorblind)
static void
cdisplay_colorblind_finalize (GObject *object)
{
CdisplayColorblind *colorblind;
colorblind = CDISPLAY_COLORBLIND (object);
CdisplayColorblind *colorblind = CDISPLAY_COLORBLIND (object);
if (colorblind->hbox)
gtk_widget_destroy (colorblind->hbox);
......@@ -269,11 +267,9 @@ cdisplay_colorblind_finalize (GObject *object)
static GimpColorDisplay *
cdisplay_colorblind_clone (GimpColorDisplay *display)
{
CdisplayColorblind *colorblind;
CdisplayColorblind *colorblind = CDISPLAY_COLORBLIND (display);
CdisplayColorblind *copy;
colorblind = CDISPLAY_COLORBLIND (display);
copy = CDISPLAY_COLORBLIND (gimp_color_display_new (G_TYPE_FROM_INSTANCE (colorblind)));
copy->deficiency = colorblind->deficiency;
......@@ -417,11 +413,9 @@ static void
cdisplay_colorblind_load_state (GimpColorDisplay *display,
GimpParasite *state)
{
CdisplayColorblind *colorblind;
CdisplayColorblind *colorblind = CDISPLAY_COLORBLIND (display);
const gchar *str;
colorblind = CDISPLAY_COLORBLIND (display);
str = gimp_parasite_data (state);
if (str[gimp_parasite_data_size (state) - 1] == '\0')
......@@ -444,11 +438,9 @@ cdisplay_colorblind_load_state (GimpColorDisplay *display,
static GimpParasite *
cdisplay_colorblind_save_state (GimpColorDisplay *display)
{
CdisplayColorblind *colorblind;
CdisplayColorblind *colorblind = CDISPLAY_COLORBLIND (display);
gchar buf[32];
colorblind = CDISPLAY_COLORBLIND (display);
g_snprintf (buf, sizeof (buf), "%d", colorblind->deficiency);
return gimp_parasite_new ("Display/Colorblind", GIMP_PARASITE_PERSISTENT,
......@@ -458,17 +450,16 @@ cdisplay_colorblind_save_state (GimpColorDisplay *display)
static GtkWidget *
cdisplay_colorblind_configure (GimpColorDisplay *display)
{
CdisplayColorblind *colorblind;
CdisplayColorblind *colorblind = CDISPLAY_COLORBLIND (display);
GtkWidget *label;
colorblind = CDISPLAY_COLORBLIND (display);
if (colorblind->hbox)
gtk_widget_destroy (colorblind->hbox);
colorblind->hbox = gtk_hbox_new (FALSE, 2);
g_object_add_weak_pointer (G_OBJECT (colorblind->hbox),
(gpointer) &colorblind->hbox);
g_signal_connect (colorblind->hbox, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&colorblind->hbox);
label = gtk_label_new ( _("Color Deficiency Type:"));
gtk_box_pack_start (GTK_BOX (colorblind->hbox), label, FALSE, FALSE, 0);
......@@ -503,9 +494,7 @@ cdisplay_colorblind_configure (GimpColorDisplay *display)
static void
cdisplay_colorblind_configure_reset (GimpColorDisplay *display)
{
CdisplayColorblind *colorblind;
colorblind = CDISPLAY_COLORBLIND (display);
CdisplayColorblind *colorblind = CDISPLAY_COLORBLIND (display);
if (colorblind->optionmenu)
{
......@@ -520,7 +509,7 @@ cdisplay_colorblind_configure_reset (GimpColorDisplay *display)
static void
cdisplay_colorblind_changed (GimpColorDisplay *display)
{
CdisplayColorblind *colorblind;
CdisplayColorblind *colorblind = CDISPLAY_COLORBLIND (display);
gfloat anchor_e[3];
gfloat anchor[12];
......@@ -528,8 +517,6 @@ cdisplay_colorblind_changed (GimpColorDisplay *display)
* on the type of color defiency.
*/
colorblind = CDISPLAY_COLORBLIND (display);
/* Performs protan, deutan or tritan color image simulation based on
* Brettel, Vienot and Mollon JOSA 14/10 1997
* L,M,S for lambda=475,485,575,660
......
......@@ -84,7 +84,7 @@ static void gamma_configure_adj_callback (GtkAdjustment *adj,
CdisplayGamma *gamma);
static const GimpModuleInfo cdisplay_gamma_info =
static const GimpModuleInfo cdisplay_gamma_info =
{
GIMP_MODULE_ABI_VERSION,
N_("Gamma color display filter"),
......@@ -178,9 +178,7 @@ cdisplay_gamma_init (CdisplayGamma *gamma)
static void
cdisplay_gamma_finalize (GObject *object)
{
CdisplayGamma *gamma;
gamma = CDISPLAY_GAMMA (object);
CdisplayGamma *gamma = CDISPLAY_GAMMA (object);
if (gamma->hbox)
gtk_widget_destroy (gamma->hbox);
......@@ -198,15 +196,13 @@ cdisplay_gamma_finalize (GObject *object)
static GimpColorDisplay *
cdisplay_gamma_clone (GimpColorDisplay *display)
{
CdisplayGamma *gamma;
CdisplayGamma *gamma = CDISPLAY_GAMMA (display);
CdisplayGamma *copy;
gamma = CDISPLAY_GAMMA (display);
copy = CDISPLAY_GAMMA (gimp_color_display_new (G_TYPE_FROM_INSTANCE (gamma)));
copy->gamma = gamma->gamma;
memcpy (copy->lookup, gamma->lookup, sizeof (guchar) * 256);
return GIMP_COLOR_DISPLAY (copy);
......@@ -220,12 +216,10 @@ cdisplay_gamma_convert (GimpColorDisplay *display,
gint bpp,
gint bpl)
{
CdisplayGamma *gamma;
gint i, j = height;
gamma = CDISPLAY_GAMMA (display);
CdisplayGamma *gamma = CDISPLAY_GAMMA (display);
gint i, j = height;
/* You will not be using the entire buffer most of the time.
/* You will not be using the entire buffer most of the time.
* Hence, the simplistic code for this is as follows:
*
* for (j = 0; j < height; j++)
......@@ -255,9 +249,7 @@ static void
cdisplay_gamma_load_state (GimpColorDisplay *display,
GimpParasite *state)
{
CdisplayGamma *gamma;
gamma = CDISPLAY_GAMMA (display);
CdisplayGamma *gamma = CDISPLAY_GAMMA (display);
#if G_BYTE_ORDER == G_BIG_ENDIAN
memcpy (&gamma->gamma, gimp_parasite_data (state), sizeof (gdouble));
......@@ -281,11 +273,9 @@ cdisplay_gamma_load_state (GimpColorDisplay *display,
static GimpParasite *
cdisplay_gamma_save_state (GimpColorDisplay *display)
{
CdisplayGamma *gamma;
CdisplayGamma *gamma = CDISPLAY_GAMMA (display);
guint32 buf[2];
gamma = CDISPLAY_GAMMA (display);
memcpy (buf, &gamma->gamma, sizeof (double));
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
......@@ -305,17 +295,17 @@ cdisplay_gamma_save_state (GimpColorDisplay *display)
static GtkWidget *
cdisplay_gamma_configure (GimpColorDisplay *display)
{
CdisplayGamma *gamma;
CdisplayGamma *gamma = CDISPLAY_GAMMA (display);
GtkWidget *label;
GtkWidget *spinbutton;
gamma = CDISPLAY_GAMMA (display);
if (gamma->hbox)
gtk_widget_destroy (gamma->hbox);
gamma->hbox = gtk_hbox_new (FALSE, 4);
g_object_add_weak_pointer (G_OBJECT (gamma->hbox), (gpointer) &gamma->hbox);
g_signal_connect (gamma->hbox, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&gamma->hbox);
label = gtk_label_new ( _("Gamma:"));
gtk_box_pack_start (GTK_BOX (gamma->hbox), label, FALSE, FALSE, 0);
......@@ -337,9 +327,7 @@ cdisplay_gamma_configure (GimpColorDisplay *display)
static void
cdisplay_gamma_configure_reset (GimpColorDisplay *display)
{
CdisplayGamma *gamma;
gamma = CDISPLAY_GAMMA (display);
CdisplayGamma *gamma = CDISPLAY_GAMMA (display);
if (gamma->adjustment)
gtk_adjustment_set_value (GTK_ADJUSTMENT (gamma->adjustment), DEFAULT_GAMMA);
......
......@@ -175,9 +175,7 @@ cdisplay_contrast_init (CdisplayContrast *contrast)
static void
cdisplay_contrast_finalize (GObject *object)
{
CdisplayContrast *contrast;
contrast = CDISPLAY_CONTRAST (object);
CdisplayContrast *contrast = CDISPLAY_CONTRAST (object);
if (contrast->hbox)
gtk_widget_destroy (contrast->hbox);
......@@ -195,11 +193,9 @@ cdisplay_contrast_finalize (GObject *object)
static GimpColorDisplay *
cdisplay_contrast_clone (GimpColorDisplay *display)
{
CdisplayContrast *contrast;
CdisplayContrast *contrast = CDISPLAY_CONTRAST (display);
CdisplayContrast *copy;
contrast = CDISPLAY_CONTRAST (display);
copy = CDISPLAY_CONTRAST (gimp_color_display_new (G_TYPE_FROM_INSTANCE (contrast)));
copy->contrast = contrast->contrast;
......@@ -217,10 +213,8 @@ cdisplay_contrast_convert (GimpColorDisplay *display,
gint bpp,
gint bpl)
{
CdisplayContrast *contrast;
gint i, j = height;
contrast = CDISPLAY_CONTRAST (display);
CdisplayContrast *contrast = CDISPLAY_CONTRAST (display);
gint i, j = height;
/* You will not be using the entire buffer most of the time.
* Hence, the simplistic code for this is as follows:
......@@ -252,9 +246,7 @@ static void
cdisplay_contrast_load_state (GimpColorDisplay *display,
GimpParasite *state)
{
CdisplayContrast *contrast;
contrast = CDISPLAY_CONTRAST (display);
CdisplayContrast *contrast = CDISPLAY_CONTRAST (display);
#if G_BYTE_ORDER == G_BIG_ENDIAN
memcpy (&contrast->contrast, gimp_parasite_data (state), sizeof (gdouble));
......@@ -278,11 +270,9 @@ cdisplay_contrast_load_state (GimpColorDisplay *display,
static GimpParasite *
cdisplay_contrast_save_state (GimpColorDisplay *display)
{
CdisplayContrast *contrast;
CdisplayContrast *contrast = CDISPLAY_CONTRAST (display);
guint32 buf[2];
contrast = CDISPLAY_CONTRAST (display);
memcpy (buf, &contrast->contrast, sizeof (double));
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
......@@ -302,18 +292,17 @@ cdisplay_contrast_save_state (GimpColorDisplay *display)
static GtkWidget *
cdisplay_contrast_configure (GimpColorDisplay *display)
{
CdisplayContrast *contrast;
CdisplayContrast *contrast = CDISPLAY_CONTRAST (display);
GtkWidget *label;
GtkWidget *spinbutton;
contrast = CDISPLAY_CONTRAST (display);
if (contrast->hbox)
gtk_widget_destroy (contrast->hbox);
contrast->hbox = gtk_hbox_new (FALSE, 2);
g_object_add_weak_pointer (G_OBJECT (contrast->hbox),
(gpointer) &contrast->hbox);
g_signal_connect (contrast->hbox, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&contrast->hbox);
label = gtk_label_new ( _("Contrast Cycles:"));
gtk_box_pack_start (GTK_BOX (contrast->hbox), label, FALSE, FALSE, 0);
......@@ -348,7 +337,7 @@ cdisplay_contrast_configure_reset (GimpColorDisplay *display)
static void
contrast_create_lookup_table (CdisplayContrast *contrast)
{
gint i;
gint i;
if (contrast->contrast == 0.0)
contrast->contrast = 1.0;
......
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