Commit b07c7184 authored by Daniel Egger's avatar Daniel Egger

New dialog_hide functions which are utilised from convert.c to hide



 New dialog_hide functions which are utilised from convert.c to hide
 dialogs before converting an image to indexed. Bug #23104.
parent 1050dc64
Fri Sep 29 03:10:10 CEST 2000 Daniel Egger <egger@suse.de>
* app/brightness_contrast.c:
* app/brightness_contrast.h:
* app/color_balance.c:
* app/color_balance.h:
* app/curves.c:
* app/curves.h:
* app/hue_saturation.c:
* app/hue_saturation.h:
* app/levels.c:
* app/levels.h:
* app/posterize.c:
* app/posterize.h:
* app/threshold.c:
* app/threshold.h: Added *_dialog_hide functions which
hides the dialog when open.
* app/convert.c: Use them to hide dialog before converting
image to indexed where the operations would crash the GIMP.
Closes bug #23104.
Thu Sep 28 16:03:09 CEST 2000 Daniel Egger <egger@suse.de>
* app/menus.c: Simplify a few help paths.
......
......@@ -147,8 +147,7 @@ color_balance_control (Tool *tool,
break;
case HALT:
if (color_balance_dialog)
color_balance_cancel_callback (NULL, (gpointer) color_balance_dialog);
color_balance_dialog_hide ();
break;
default:
......@@ -182,6 +181,13 @@ tools_new_color_balance (void)
return tool;
}
void
color_balance_dialog_hide (void)
{
if (color_balance_dialog)
color_balance_cancel_callback (NULL, (gpointer) color_balance_dialog);
}
void
tools_free_color_balance (Tool *tool)
{
......@@ -190,8 +196,7 @@ tools_free_color_balance (Tool *tool)
color_bal = (ColorBalance *) tool->private;
/* Close the color select dialog */
if (color_balance_dialog)
color_balance_cancel_callback (NULL, (gpointer) color_balance_dialog);
color_balance_dialog_hide ();
g_free (color_bal);
}
......
......@@ -61,6 +61,7 @@ Tool * tools_new_color_balance (void);
void tools_free_color_balance (Tool *tool);
void color_balance_initialize (GDisplay *gdisp);
void color_balance_dialog_hide (void);
void color_balance (PixelRegion *srcPR,
PixelRegion *destPR,
void *data);
......
......@@ -372,8 +372,7 @@ curves_control (Tool *tool,
break;
case HALT:
if (curves_dialog)
curves_cancel_callback (NULL, (gpointer) curves_dialog);
curves_dialog_hide ();
break;
default:
......@@ -410,6 +409,13 @@ tools_new_curves (void)
return tool;
}
void
curves_dialog_hide (void)
{
if (curves_dialog)
curves_cancel_callback (NULL, (gpointer) curves_dialog);
}
void
tools_free_curves (Tool *tool)
{
......@@ -418,8 +424,7 @@ tools_free_curves (Tool *tool)
private = (Curves *) tool->private;
/* Close the color select dialog */
if (curves_dialog)
curves_cancel_callback (NULL, (gpointer) curves_dialog);
curves_dialog_hide ();
g_free (private);
}
......
......@@ -65,6 +65,7 @@ struct _CurvesDialog
Tool * tools_new_curves (void);
void tools_free_curves (Tool *tool);
void curves_dialog_hide (void);
void curves_initialize (GDisplay *gdisp);
void curves_free (void);
float curves_lut_func (CurvesDialog *cd,
......
......@@ -224,8 +224,7 @@ hue_saturation_control (Tool *tool,
break;
case HALT:
if (hue_saturation_dialog)
hue_saturation_cancel_callback (NULL, (gpointer) hue_saturation_dialog);
hue_saturation_dialog_hide ();
break;
default:
......@@ -259,6 +258,13 @@ tools_new_hue_saturation (void)
return tool;
}
void
hue_saturation_dialog_hide (void)
{
if (hue_saturation_dialog)
hue_saturation_cancel_callback (NULL, (gpointer) hue_saturation_dialog);
}
void
tools_free_hue_saturation (Tool *tool)
{
......@@ -267,8 +273,7 @@ tools_free_hue_saturation (Tool *tool)
color_bal = (HueSaturation *) tool->private;
/* Close the hue saturation dialog */
if (hue_saturation_dialog)
hue_saturation_cancel_callback (NULL, (gpointer) hue_saturation_dialog);
hue_saturation_dialog_hide ();
g_free (color_bal);
}
......
......@@ -62,6 +62,7 @@ void tools_free_hue_saturation (Tool *tool);
void hue_saturation_initialize (GDisplay *gdisp);
void hue_saturation_free (void);
void hue_saturation_dialog_hide (void);
void hue_saturation (PixelRegion *srcPR,
PixelRegion *destPR,
void *data);
......
......@@ -150,8 +150,7 @@ threshold_control (Tool *tool,
break;
case HALT:
if (threshold_dialog)
threshold_cancel_callback (NULL, (gpointer) threshold_dialog);
threshold_dialog_hide ();
break;
default:
......@@ -185,6 +184,13 @@ tools_new_threshold (void)
return tool;
}
void
threshold_dialog_hide (void)
{
if (threshold_dialog)
threshold_cancel_callback (NULL, (gpointer) threshold_dialog);
}
void
tools_free_threshold (Tool *tool)
{
......@@ -193,8 +199,7 @@ tools_free_threshold (Tool *tool)
thresh = (Threshold *) tool->private;
/* Close the threshold dialog */
if (threshold_dialog)
threshold_cancel_callback (NULL, (gpointer) threshold_dialog);
threshold_dialog_hide ();
g_free (thresh);
}
......
......@@ -49,6 +49,7 @@ struct _ThresholdDialog
Tool * tools_new_threshold (void);
void tools_free_threshold (Tool *tool);
void threshold_dialog_hide (void);
void threshold_initialize (GDisplay *gdisp);
void threshold_2 (void *data,
PixelRegion *srcPR,
......
......@@ -105,8 +105,7 @@ brightness_contrast_control (Tool *tool,
break;
case HALT:
if (brightness_contrast_dialog)
brightness_contrast_cancel_callback (NULL, (gpointer) brightness_contrast_dialog);
brightness_contrast_dialog_hide ();
break;
default:
......@@ -141,6 +140,14 @@ tools_new_brightness_contrast (void)
return tool;
}
void
brightness_contrast_dialog_hide (void)
{
if (brightness_contrast_dialog)
brightness_contrast_cancel_callback (NULL,
(gpointer) brightness_contrast_dialog);
}
void
tools_free_brightness_contrast (Tool *tool)
{
......@@ -149,8 +156,7 @@ tools_free_brightness_contrast (Tool *tool)
bc = (BrightnessContrast *) tool->private;
/* Close the brightness-contrast dialog */
if (brightness_contrast_dialog)
brightness_contrast_cancel_callback (NULL, (gpointer) brightness_contrast_dialog);
brightness_contrast_dialog_hide ();
g_free (bc);
}
......
......@@ -23,6 +23,8 @@
Tool * tools_new_brightness_contrast (void);
void tools_free_brightness_contrast (Tool *tool);
void brightness_contrast_dialog_hide (void);
void brightness_contrast_initialize (GDisplay *gdisp);
#endif /* __BRIGHTNESS_CONTRAST_H__ */
......@@ -147,8 +147,7 @@ color_balance_control (Tool *tool,
break;
case HALT:
if (color_balance_dialog)
color_balance_cancel_callback (NULL, (gpointer) color_balance_dialog);
color_balance_dialog_hide ();
break;
default:
......@@ -182,6 +181,13 @@ tools_new_color_balance (void)
return tool;
}
void
color_balance_dialog_hide (void)
{
if (color_balance_dialog)
color_balance_cancel_callback (NULL, (gpointer) color_balance_dialog);
}
void
tools_free_color_balance (Tool *tool)
{
......@@ -190,8 +196,7 @@ tools_free_color_balance (Tool *tool)
color_bal = (ColorBalance *) tool->private;
/* Close the color select dialog */
if (color_balance_dialog)
color_balance_cancel_callback (NULL, (gpointer) color_balance_dialog);
color_balance_dialog_hide ();
g_free (color_bal);
}
......
......@@ -61,6 +61,7 @@ Tool * tools_new_color_balance (void);
void tools_free_color_balance (Tool *tool);
void color_balance_initialize (GDisplay *gdisp);
void color_balance_dialog_hide (void);
void color_balance (PixelRegion *srcPR,
PixelRegion *destPR,
void *data);
......
......@@ -90,6 +90,7 @@
#include <string.h>
#include "appenv.h"
#include "color_balance.h"
#include "convert.h"
#include "cursorutil.h"
#include "drawable.h"
......@@ -97,6 +98,7 @@
#include "fsdither.h"
#include "gdisplay.h"
#include "gimpui.h"
#include "hue_saturation.h"
#include "undo.h"
#include "palette.h"
#include "palette_select.h"
......@@ -874,6 +876,17 @@ indexed_ok_callback (GtkWidget *widget,
else
dither_type = FIXED_DITHER;
/* Close the dialogs when open because they're useless for indexed images
and could crash the GIMP when used nevertheless */
color_balance_dialog_hide();
hue_saturation_dialog_hide ();
brightness_contrast_dialog_hide();
threshold_dialog_hide ();
levels_dialog_hide ();
curves_dialog_hide ();
posterize_dialog_hide ();
/* Convert the image to indexed color */
convert_image (dialog->gimage, INDEXED, dialog->num_cols,
dither_type, dialog->alphadither,
......
......@@ -90,6 +90,7 @@
#include <string.h>
#include "appenv.h"
#include "color_balance.h"
#include "convert.h"
#include "cursorutil.h"
#include "drawable.h"
......@@ -97,6 +98,7 @@
#include "fsdither.h"
#include "gdisplay.h"
#include "gimpui.h"
#include "hue_saturation.h"
#include "undo.h"
#include "palette.h"
#include "palette_select.h"
......@@ -874,6 +876,17 @@ indexed_ok_callback (GtkWidget *widget,
else
dither_type = FIXED_DITHER;
/* Close the dialogs when open because they're useless for indexed images
and could crash the GIMP when used nevertheless */
color_balance_dialog_hide();
hue_saturation_dialog_hide ();
brightness_contrast_dialog_hide();
threshold_dialog_hide ();
levels_dialog_hide ();
curves_dialog_hide ();
posterize_dialog_hide ();
/* Convert the image to indexed color */
convert_image (dialog->gimage, INDEXED, dialog->num_cols,
dither_type, dialog->alphadither,
......
......@@ -372,8 +372,7 @@ curves_control (Tool *tool,
break;
case HALT:
if (curves_dialog)
curves_cancel_callback (NULL, (gpointer) curves_dialog);
curves_dialog_hide ();
break;
default:
......@@ -410,6 +409,13 @@ tools_new_curves (void)
return tool;
}
void
curves_dialog_hide (void)
{
if (curves_dialog)
curves_cancel_callback (NULL, (gpointer) curves_dialog);
}
void
tools_free_curves (Tool *tool)
{
......@@ -418,8 +424,7 @@ tools_free_curves (Tool *tool)
private = (Curves *) tool->private;
/* Close the color select dialog */
if (curves_dialog)
curves_cancel_callback (NULL, (gpointer) curves_dialog);
curves_dialog_hide ();
g_free (private);
}
......
......@@ -65,6 +65,7 @@ struct _CurvesDialog
Tool * tools_new_curves (void);
void tools_free_curves (Tool *tool);
void curves_dialog_hide (void);
void curves_initialize (GDisplay *gdisp);
void curves_free (void);
float curves_lut_func (CurvesDialog *cd,
......
......@@ -90,6 +90,7 @@
#include <string.h>
#include "appenv.h"
#include "color_balance.h"
#include "convert.h"
#include "cursorutil.h"
#include "drawable.h"
......@@ -97,6 +98,7 @@
#include "fsdither.h"
#include "gdisplay.h"
#include "gimpui.h"
#include "hue_saturation.h"
#include "undo.h"
#include "palette.h"
#include "palette_select.h"
......@@ -874,6 +876,17 @@ indexed_ok_callback (GtkWidget *widget,
else
dither_type = FIXED_DITHER;
/* Close the dialogs when open because they're useless for indexed images
and could crash the GIMP when used nevertheless */
color_balance_dialog_hide();
hue_saturation_dialog_hide ();
brightness_contrast_dialog_hide();
threshold_dialog_hide ();
levels_dialog_hide ();
curves_dialog_hide ();
posterize_dialog_hide ();
/* Convert the image to indexed color */
convert_image (dialog->gimage, INDEXED, dialog->num_cols,
dither_type, dialog->alphadither,
......
......@@ -224,8 +224,7 @@ hue_saturation_control (Tool *tool,
break;
case HALT:
if (hue_saturation_dialog)
hue_saturation_cancel_callback (NULL, (gpointer) hue_saturation_dialog);
hue_saturation_dialog_hide ();
break;
default:
......@@ -259,6 +258,13 @@ tools_new_hue_saturation (void)
return tool;
}
void
hue_saturation_dialog_hide (void)
{
if (hue_saturation_dialog)
hue_saturation_cancel_callback (NULL, (gpointer) hue_saturation_dialog);
}
void
tools_free_hue_saturation (Tool *tool)
{
......@@ -267,8 +273,7 @@ tools_free_hue_saturation (Tool *tool)
color_bal = (HueSaturation *) tool->private;
/* Close the hue saturation dialog */
if (hue_saturation_dialog)
hue_saturation_cancel_callback (NULL, (gpointer) hue_saturation_dialog);
hue_saturation_dialog_hide ();
g_free (color_bal);
}
......
......@@ -62,6 +62,7 @@ void tools_free_hue_saturation (Tool *tool);
void hue_saturation_initialize (GDisplay *gdisp);
void hue_saturation_free (void);
void hue_saturation_dialog_hide (void);
void hue_saturation (PixelRegion *srcPR,
PixelRegion *destPR,
void *data);
......
......@@ -176,8 +176,7 @@ levels_control (Tool *tool,
break;
case HALT:
if (levels_dialog)
levels_cancel_callback (NULL, (gpointer) levels_dialog);
levels_dialog_hide ();
break;
default:
......@@ -211,6 +210,13 @@ tools_new_levels (void)
return tool;
}
void
levels_dialog_hide (void)
{
if (levels_dialog)
levels_cancel_callback (NULL, (gpointer) levels_dialog);
}
void
tools_free_levels (Tool *tool)
{
......@@ -219,8 +225,7 @@ tools_free_levels (Tool *tool)
private = (Levels *) tool->private;
/* Close the color select dialog */
if (levels_dialog)
levels_cancel_callback (NULL, (gpointer) levels_dialog);
levels_dialog_hide ();
g_free (private);
}
......
......@@ -23,6 +23,7 @@
Tool * tools_new_levels (void);
void tools_free_levels (Tool *tool);
void levels_dialog_hide (void);
void levels_initialize (GDisplay *gdisp);
void levels_free (void);
......
......@@ -91,8 +91,7 @@ posterize_control (Tool *tool,
break;
case HALT:
if (posterize_dialog)
posterize_cancel_callback (NULL, (gpointer) posterize_dialog);
posterize_dialog_hide ();
break;
default:
......@@ -126,6 +125,13 @@ tools_new_posterize (void)
return tool;
}
void
posterize_dialog_hide (void)
{
if (posterize_dialog)
posterize_cancel_callback (NULL, (gpointer) posterize_dialog);
}
void
tools_free_posterize (Tool *tool)
{
......@@ -134,8 +140,7 @@ tools_free_posterize (Tool *tool)
post = (Posterize *) tool->private;
/* Close the posterize dialog */
if (posterize_dialog)
posterize_cancel_callback (NULL, (gpointer) posterize_dialog);
posterize_dialog_hide ();
g_free (post);
}
......
......@@ -23,6 +23,7 @@
Tool * tools_new_posterize (void);
void tools_free_posterize (Tool *tool);
void posterize_dialog_hide (void);
void posterize_initialize (GDisplay *gdisp);
#endif /* __POSTERIZE_H__ */
......@@ -150,8 +150,7 @@ threshold_control (Tool *tool,
break;
case HALT:
if (threshold_dialog)
threshold_cancel_callback (NULL, (gpointer) threshold_dialog);
threshold_dialog_hide ();
break;
default:
......@@ -185,6 +184,13 @@ tools_new_threshold (void)
return tool;
}
void
threshold_dialog_hide (void)
{
if (threshold_dialog)
threshold_cancel_callback (NULL, (gpointer) threshold_dialog);
}
void
tools_free_threshold (Tool *tool)
{
......@@ -193,8 +199,7 @@ tools_free_threshold (Tool *tool)
thresh = (Threshold *) tool->private;
/* Close the threshold dialog */
if (threshold_dialog)
threshold_cancel_callback (NULL, (gpointer) threshold_dialog);
threshold_dialog_hide ();
g_free (thresh);
}
......
......@@ -49,6 +49,7 @@ struct _ThresholdDialog
Tool * tools_new_threshold (void);
void tools_free_threshold (Tool *tool);
void threshold_dialog_hide (void);
void threshold_initialize (GDisplay *gdisp);
void threshold_2 (void *data,
PixelRegion *srcPR,
......
......@@ -105,8 +105,7 @@ brightness_contrast_control (Tool *tool,
break;
case HALT:
if (brightness_contrast_dialog)
brightness_contrast_cancel_callback (NULL, (gpointer) brightness_contrast_dialog);
brightness_contrast_dialog_hide ();
break;
default:
......@@ -141,6 +140,14 @@ tools_new_brightness_contrast (void)
return tool;
}
void
brightness_contrast_dialog_hide (void)
{
if (brightness_contrast_dialog)
brightness_contrast_cancel_callback (NULL,
(gpointer) brightness_contrast_dialog);
}
void
tools_free_brightness_contrast (Tool *tool)
{
......@@ -149,8 +156,7 @@ tools_free_brightness_contrast (Tool *tool)
bc = (BrightnessContrast *) tool->private;
/* Close the brightness-contrast dialog */
if (brightness_contrast_dialog)
brightness_contrast_cancel_callback (NULL, (gpointer) brightness_contrast_dialog);
brightness_contrast_dialog_hide ();
g_free (bc);
}
......
......@@ -23,6 +23,8 @@
Tool * tools_new_brightness_contrast (void);
void tools_free_brightness_contrast (Tool *tool);
void brightness_contrast_dialog_hide (void);
void brightness_contrast_initialize (GDisplay *gdisp);
#endif /* __BRIGHTNESS_CONTRAST_H__ */
......@@ -147,8 +147,7 @@ color_balance_control (Tool *tool,
break;
case HALT:
if (color_balance_dialog)
color_balance_cancel_callback (NULL, (gpointer) color_balance_dialog);
color_balance_dialog_hide ();
break;
default:
......@@ -182,6 +181,13 @@ tools_new_color_balance (void)
return tool;
}
void
color_balance_dialog_hide (void)
{
if (color_balance_dialog)
color_balance_cancel_callback (NULL, (gpointer) color_balance_dialog);
}
void
tools_free_color_balance (Tool *tool)
{
......@@ -190,8 +196,7 @@ tools_free_color_balance (Tool *tool)
color_bal = (ColorBalance *) tool->private;
/* Close the color select dialog */
if (color_balance_dialog)
color_balance_cancel_callback (NULL, (gpointer) color_balance_dialog);
color_balance_dialog_hide ();
g_free (color_bal);
}
......
......@@ -61,6 +61,7 @@ Tool * tools_new_color_balance (void);
void tools_free_color_balance (Tool *tool);
void color_balance_initialize (GDisplay *gdisp);
void color_balance_dialog_hide (void);
void color_balance (PixelRegion *srcPR,
PixelRegion *destPR,
void *data);
......
......@@ -372,8 +372,7 @@ curves_control (Tool *tool,
break;
case HALT:
if (curves_dialog)
curves_cancel_callback (NULL, (gpointer) curves_dialog);
curves_dialog_hide ();
break;
default:
......@@ -410,6 +409,13 @@ tools_new_curves (void)
return tool;
}
void
curves_dialog_hide (void)
{
if (curves_dialog)
curves_cancel_callback (NULL, (gpointer) curves_dialog);
}