Commit 109abaee authored by Dave Neary's avatar Dave Neary Committed by David Neary
Browse files

app/core/gimpimage.[ch] app/core/gimpimage-mask.c


2001-05-31  Dave Neary  <dneary@eircom.net>

	* app/core/gimpimage.[ch]
	* app/core/gimpimage-mask.c
	* app/tools/gimpbycolorselecttool.c
	* app/undo.c: Added a "mask_changed" signal, to allow
	gimpbycolorselect to update it's dialog properly, and take out a
	silly dependency in gimpimage.

	One outstanding issue is that now the dialog doesn't close
	automatically when the tool context changes. Working on it :)
parent 11c2f6ca
2001-05-31 Dave Neary <dneary@eircom.net>
* app/core/gimpimage.[ch]
* app/core/gimpimage-mask.c
* app/tools/gimpbycolorselecttool.c
* app/undo.c: Added a "mask_changed" signal, to allow
gimpbycolorselect to update it's dialog properly, and take out a
silly dependency in gimpimage.
One outstanding issue is that now the dialog doesn't close
automatically when the tool context changes. Working on it :)
2001-05-30 Michael Natterer <mitch@gimp.org>
* app/base/Makefile.am
......
......@@ -166,6 +166,7 @@ enum
ACTIVE_CHANNEL_CHANGED,
COMPONENT_VISIBILITY_CHANGED,
COMPONENT_ACTIVE_CHANGED,
MASK_CHANGED,
CLEAN,
DIRTY,
......@@ -297,6 +298,15 @@ gimp_image_class_init (GimpImageClass *klass)
GTK_TYPE_NONE, 1,
GTK_TYPE_INT);
gimp_image_signals[MASK_CHANGED] =
gtk_signal_new ("mask_changed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpImageClass,
mask_changed),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gimp_image_signals[CLEAN] =
gtk_signal_new ("clean",
GTK_RUN_FIRST,
......@@ -366,6 +376,7 @@ gimp_image_class_init (GimpImageClass *klass)
klass->active_channel_changed = NULL;
klass->component_visibility_changed = NULL;
klass->component_active_changed = NULL;
klass->mask_changed = NULL;
klass->clean = NULL;
klass->dirty = NULL;
......@@ -429,8 +440,6 @@ gimp_image_init (GimpImage *gimage)
gimage->paths = NULL;
gimage->by_color_select = FALSE;
gimage->qmask_state = FALSE;
gimage->qmask_color.r = 1.0;
gimage->qmask_color.g = 0.0;
......@@ -1665,6 +1674,14 @@ gimp_image_mode_changed (GimpImage *gimage)
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[MODE_CHANGED]);
}
void
gimp_image_mask_changed (GimpImage *gimage)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[MASK_CHANGED]);
}
void
gimp_image_alpha_changed (GimpImage *gimage)
{
......
......@@ -110,9 +110,6 @@ struct _GimpImage
gboolean visible[MAX_CHANNELS]; /* visible channels */
gboolean active[MAX_CHANNELS]; /* active channels */
gboolean by_color_select; /* TRUE if there's an active */
/* "by color" selection dialog */
gboolean qmask_state; /* TRUE if qmask is on */
GimpRGB qmask_color; /* rgba triplet of the color */
......@@ -148,6 +145,7 @@ struct _GimpImageClass
ChannelType channel);
void (* component_active_changed) (GimpImage *gimage,
ChannelType channel);
void (* mask_changed) (GimpImage *gimage);
void (* clean) (GimpImage *gimage);
void (* dirty) (GimpImage *gimage);
......@@ -281,6 +279,7 @@ void gimp_image_mode_changed (GimpImage *gimage);
void gimp_image_alpha_changed (GimpImage *gimage);
void gimp_image_size_changed (GimpImage *gimage);
void gimp_image_floating_selection_changed (GimpImage *gimage);
void gimp_image_mask_changed (GimpImage *gimage);
/* layer/channel functions */
......
......@@ -159,6 +159,9 @@ gimage_mask_invalidate (GimpImage *gimage)
0, 0,
GIMP_DRAWABLE (layer)->width,
GIMP_DRAWABLE (layer)->height);
/* Issue the MASK_CHANGED signal here */
gimp_image_mask_changed(gimage);
}
......
......@@ -166,6 +166,7 @@ enum
ACTIVE_CHANNEL_CHANGED,
COMPONENT_VISIBILITY_CHANGED,
COMPONENT_ACTIVE_CHANGED,
MASK_CHANGED,
CLEAN,
DIRTY,
......@@ -297,6 +298,15 @@ gimp_image_class_init (GimpImageClass *klass)
GTK_TYPE_NONE, 1,
GTK_TYPE_INT);
gimp_image_signals[MASK_CHANGED] =
gtk_signal_new ("mask_changed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpImageClass,
mask_changed),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gimp_image_signals[CLEAN] =
gtk_signal_new ("clean",
GTK_RUN_FIRST,
......@@ -366,6 +376,7 @@ gimp_image_class_init (GimpImageClass *klass)
klass->active_channel_changed = NULL;
klass->component_visibility_changed = NULL;
klass->component_active_changed = NULL;
klass->mask_changed = NULL;
klass->clean = NULL;
klass->dirty = NULL;
......@@ -429,8 +440,6 @@ gimp_image_init (GimpImage *gimage)
gimage->paths = NULL;
gimage->by_color_select = FALSE;
gimage->qmask_state = FALSE;
gimage->qmask_color.r = 1.0;
gimage->qmask_color.g = 0.0;
......@@ -1665,6 +1674,14 @@ gimp_image_mode_changed (GimpImage *gimage)
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[MODE_CHANGED]);
}
void
gimp_image_mask_changed (GimpImage *gimage)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[MASK_CHANGED]);
}
void
gimp_image_alpha_changed (GimpImage *gimage)
{
......
......@@ -110,9 +110,6 @@ struct _GimpImage
gboolean visible[MAX_CHANNELS]; /* visible channels */
gboolean active[MAX_CHANNELS]; /* active channels */
gboolean by_color_select; /* TRUE if there's an active */
/* "by color" selection dialog */
gboolean qmask_state; /* TRUE if qmask is on */
GimpRGB qmask_color; /* rgba triplet of the color */
......@@ -148,6 +145,7 @@ struct _GimpImageClass
ChannelType channel);
void (* component_active_changed) (GimpImage *gimage,
ChannelType channel);
void (* mask_changed) (GimpImage *gimage);
void (* clean) (GimpImage *gimage);
void (* dirty) (GimpImage *gimage);
......@@ -281,6 +279,7 @@ void gimp_image_mode_changed (GimpImage *gimage);
void gimp_image_alpha_changed (GimpImage *gimage);
void gimp_image_size_changed (GimpImage *gimage);
void gimp_image_floating_selection_changed (GimpImage *gimage);
void gimp_image_mask_changed (GimpImage *gimage);
/* layer/channel functions */
......
......@@ -166,6 +166,7 @@ enum
ACTIVE_CHANNEL_CHANGED,
COMPONENT_VISIBILITY_CHANGED,
COMPONENT_ACTIVE_CHANGED,
MASK_CHANGED,
CLEAN,
DIRTY,
......@@ -297,6 +298,15 @@ gimp_image_class_init (GimpImageClass *klass)
GTK_TYPE_NONE, 1,
GTK_TYPE_INT);
gimp_image_signals[MASK_CHANGED] =
gtk_signal_new ("mask_changed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpImageClass,
mask_changed),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gimp_image_signals[CLEAN] =
gtk_signal_new ("clean",
GTK_RUN_FIRST,
......@@ -366,6 +376,7 @@ gimp_image_class_init (GimpImageClass *klass)
klass->active_channel_changed = NULL;
klass->component_visibility_changed = NULL;
klass->component_active_changed = NULL;
klass->mask_changed = NULL;
klass->clean = NULL;
klass->dirty = NULL;
......@@ -429,8 +440,6 @@ gimp_image_init (GimpImage *gimage)
gimage->paths = NULL;
gimage->by_color_select = FALSE;
gimage->qmask_state = FALSE;
gimage->qmask_color.r = 1.0;
gimage->qmask_color.g = 0.0;
......@@ -1665,6 +1674,14 @@ gimp_image_mode_changed (GimpImage *gimage)
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[MODE_CHANGED]);
}
void
gimp_image_mask_changed (GimpImage *gimage)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[MASK_CHANGED]);
}
void
gimp_image_alpha_changed (GimpImage *gimage)
{
......
......@@ -110,9 +110,6 @@ struct _GimpImage
gboolean visible[MAX_CHANNELS]; /* visible channels */
gboolean active[MAX_CHANNELS]; /* active channels */
gboolean by_color_select; /* TRUE if there's an active */
/* "by color" selection dialog */
gboolean qmask_state; /* TRUE if qmask is on */
GimpRGB qmask_color; /* rgba triplet of the color */
......@@ -148,6 +145,7 @@ struct _GimpImageClass
ChannelType channel);
void (* component_active_changed) (GimpImage *gimage,
ChannelType channel);
void (* mask_changed) (GimpImage *gimage);
void (* clean) (GimpImage *gimage);
void (* dirty) (GimpImage *gimage);
......@@ -281,6 +279,7 @@ void gimp_image_mode_changed (GimpImage *gimage);
void gimp_image_alpha_changed (GimpImage *gimage);
void gimp_image_size_changed (GimpImage *gimage);
void gimp_image_floating_selection_changed (GimpImage *gimage);
void gimp_image_mask_changed (GimpImage *gimage);
/* layer/channel functions */
......
......@@ -166,6 +166,7 @@ enum
ACTIVE_CHANNEL_CHANGED,
COMPONENT_VISIBILITY_CHANGED,
COMPONENT_ACTIVE_CHANGED,
MASK_CHANGED,
CLEAN,
DIRTY,
......@@ -297,6 +298,15 @@ gimp_image_class_init (GimpImageClass *klass)
GTK_TYPE_NONE, 1,
GTK_TYPE_INT);
gimp_image_signals[MASK_CHANGED] =
gtk_signal_new ("mask_changed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpImageClass,
mask_changed),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gimp_image_signals[CLEAN] =
gtk_signal_new ("clean",
GTK_RUN_FIRST,
......@@ -366,6 +376,7 @@ gimp_image_class_init (GimpImageClass *klass)
klass->active_channel_changed = NULL;
klass->component_visibility_changed = NULL;
klass->component_active_changed = NULL;
klass->mask_changed = NULL;
klass->clean = NULL;
klass->dirty = NULL;
......@@ -429,8 +440,6 @@ gimp_image_init (GimpImage *gimage)
gimage->paths = NULL;
gimage->by_color_select = FALSE;
gimage->qmask_state = FALSE;
gimage->qmask_color.r = 1.0;
gimage->qmask_color.g = 0.0;
......@@ -1665,6 +1674,14 @@ gimp_image_mode_changed (GimpImage *gimage)
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[MODE_CHANGED]);
}
void
gimp_image_mask_changed (GimpImage *gimage)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[MASK_CHANGED]);
}
void
gimp_image_alpha_changed (GimpImage *gimage)
{
......
......@@ -110,9 +110,6 @@ struct _GimpImage
gboolean visible[MAX_CHANNELS]; /* visible channels */
gboolean active[MAX_CHANNELS]; /* active channels */
gboolean by_color_select; /* TRUE if there's an active */
/* "by color" selection dialog */
gboolean qmask_state; /* TRUE if qmask is on */
GimpRGB qmask_color; /* rgba triplet of the color */
......@@ -148,6 +145,7 @@ struct _GimpImageClass
ChannelType channel);
void (* component_active_changed) (GimpImage *gimage,
ChannelType channel);
void (* mask_changed) (GimpImage *gimage);
void (* clean) (GimpImage *gimage);
void (* dirty) (GimpImage *gimage);
......@@ -281,6 +279,7 @@ void gimp_image_mode_changed (GimpImage *gimage);
void gimp_image_alpha_changed (GimpImage *gimage);
void gimp_image_size_changed (GimpImage *gimage);
void gimp_image_floating_selection_changed (GimpImage *gimage);
void gimp_image_mask_changed (GimpImage *gimage);
/* layer/channel functions */
......
......@@ -166,6 +166,7 @@ enum
ACTIVE_CHANNEL_CHANGED,
COMPONENT_VISIBILITY_CHANGED,
COMPONENT_ACTIVE_CHANGED,
MASK_CHANGED,
CLEAN,
DIRTY,
......@@ -297,6 +298,15 @@ gimp_image_class_init (GimpImageClass *klass)
GTK_TYPE_NONE, 1,
GTK_TYPE_INT);
gimp_image_signals[MASK_CHANGED] =
gtk_signal_new ("mask_changed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpImageClass,
mask_changed),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gimp_image_signals[CLEAN] =
gtk_signal_new ("clean",
GTK_RUN_FIRST,
......@@ -366,6 +376,7 @@ gimp_image_class_init (GimpImageClass *klass)
klass->active_channel_changed = NULL;
klass->component_visibility_changed = NULL;
klass->component_active_changed = NULL;
klass->mask_changed = NULL;
klass->clean = NULL;
klass->dirty = NULL;
......@@ -429,8 +440,6 @@ gimp_image_init (GimpImage *gimage)
gimage->paths = NULL;
gimage->by_color_select = FALSE;
gimage->qmask_state = FALSE;
gimage->qmask_color.r = 1.0;
gimage->qmask_color.g = 0.0;
......@@ -1665,6 +1674,14 @@ gimp_image_mode_changed (GimpImage *gimage)
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[MODE_CHANGED]);
}
void
gimp_image_mask_changed (GimpImage *gimage)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[MASK_CHANGED]);
}
void
gimp_image_alpha_changed (GimpImage *gimage)
{
......
......@@ -110,9 +110,6 @@ struct _GimpImage
gboolean visible[MAX_CHANNELS]; /* visible channels */
gboolean active[MAX_CHANNELS]; /* active channels */
gboolean by_color_select; /* TRUE if there's an active */
/* "by color" selection dialog */
gboolean qmask_state; /* TRUE if qmask is on */
GimpRGB qmask_color; /* rgba triplet of the color */
......@@ -148,6 +145,7 @@ struct _GimpImageClass
ChannelType channel);
void (* component_active_changed) (GimpImage *gimage,
ChannelType channel);
void (* mask_changed) (GimpImage *gimage);
void (* clean) (GimpImage *gimage);
void (* dirty) (GimpImage *gimage);
......@@ -281,6 +279,7 @@ void gimp_image_mode_changed (GimpImage *gimage);
void gimp_image_alpha_changed (GimpImage *gimage);
void gimp_image_size_changed (GimpImage *gimage);
void gimp_image_floating_selection_changed (GimpImage *gimage);
void gimp_image_mask_changed (GimpImage *gimage);
/* layer/channel functions */
......
......@@ -1114,15 +1114,6 @@ undo_pop_mask (GimpImage *gimage,
/* we know the bounds */
sel_mask->bounds_known = TRUE;
/* if there is a "by color" selection dialog active
* for this gimage's mask, send it an update notice
*
* This should never happen... we should be using a signal to
* do this.
*/
if (gimage->by_color_select)
gimp_by_color_select_tool_initialize_by_image (gimage);
return TRUE;
}
......
......@@ -166,6 +166,7 @@ enum
ACTIVE_CHANNEL_CHANGED,
COMPONENT_VISIBILITY_CHANGED,
COMPONENT_ACTIVE_CHANGED,
MASK_CHANGED,
CLEAN,
DIRTY,
......@@ -297,6 +298,15 @@ gimp_image_class_init (GimpImageClass *klass)
GTK_TYPE_NONE, 1,
GTK_TYPE_INT);
gimp_image_signals[MASK_CHANGED] =
gtk_signal_new ("mask_changed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpImageClass,
mask_changed),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gimp_image_signals[CLEAN] =
gtk_signal_new ("clean",
GTK_RUN_FIRST,
......@@ -366,6 +376,7 @@ gimp_image_class_init (GimpImageClass *klass)
klass->active_channel_changed = NULL;
klass->component_visibility_changed = NULL;
klass->component_active_changed = NULL;
klass->mask_changed = NULL;
klass->clean = NULL;
klass->dirty = NULL;
......@@ -429,8 +440,6 @@ gimp_image_init (GimpImage *gimage)
gimage->paths = NULL;
gimage->by_color_select = FALSE;
gimage->qmask_state = FALSE;
gimage->qmask_color.r = 1.0;
gimage->qmask_color.g = 0.0;
......@@ -1665,6 +1674,14 @@ gimp_image_mode_changed (GimpImage *gimage)
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[MODE_CHANGED]);
}
void
gimp_image_mask_changed (GimpImage *gimage)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[MASK_CHANGED]);
}
void
gimp_image_alpha_changed (GimpImage *gimage)
{
......
......@@ -110,9 +110,6 @@ struct _GimpImage
gboolean visible[MAX_CHANNELS]; /* visible channels */
gboolean active[MAX_CHANNELS]; /* active channels */
gboolean by_color_select; /* TRUE if there's an active */
/* "by color" selection dialog */
gboolean qmask_state; /* TRUE if qmask is on */
GimpRGB qmask_color; /* rgba triplet of the color */
......@@ -148,6 +145,7 @@ struct _GimpImageClass
ChannelType channel);
void (* component_active_changed) (GimpImage *gimage,
ChannelType channel);
void (* mask_changed) (GimpImage *gimage);
void (* clean) (GimpImage *gimage);
void (* dirty) (GimpImage *gimage);
......@@ -281,6 +279,7 @@ void gimp_image_mode_changed (GimpImage *gimage);
void gimp_image_alpha_changed (GimpImage *gimage);
void gimp_image_size_changed (GimpImage *gimage);
void gimp_image_floating_selection_changed (GimpImage *gimage);
void gimp_image_mask_changed (GimpImage *gimage);
/* layer/channel functions */
......
......@@ -166,6 +166,7 @@ enum
ACTIVE_CHANNEL_CHANGED,
COMPONENT_VISIBILITY_CHANGED,
COMPONENT_ACTIVE_CHANGED,
MASK_CHANGED,
CLEAN,
DIRTY,
......@@ -297,6 +298,15 @@ gimp_image_class_init (GimpImageClass *klass)
GTK_TYPE_NONE, 1,
GTK_TYPE_INT);
gimp_image_signals[MASK_CHANGED] =
gtk_signal_new ("mask_changed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpImageClass,
mask_changed),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gimp_image_signals[CLEAN] =
gtk_signal_new ("clean",
GTK_RUN_FIRST,
......@@ -366,6 +376,7 @@ gimp_image_class_init (GimpImageClass *klass)
klass->active_channel_changed = NULL;
klass->component_visibility_changed = NULL;
klass->component_active_changed = NULL;
klass->mask_changed = NULL;
klass->clean = NULL;
klass->dirty = NULL;
......@@ -429,8 +440,6 @@ gimp_image_init (GimpImage *gimage)
gimage->paths = NULL;
gimage->by_color_select = FALSE;
gimage->qmask_state = FALSE;
gimage->qmask_color.r = 1.0;
gimage->qmask_color.g = 0.0;
......@@ -1665,6 +1674,14 @@ gimp_image_mode_changed (GimpImage *gimage)
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[MODE_CHANGED]);
}
void
gimp_image_mask_changed (GimpImage *gimage)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[MASK_CHANGED]);
}
void
gimp_image_alpha_changed (GimpImage *gimage)
{
......
......@@ -110,9 +110,6 @@ struct _GimpImage
gboolean visible[MAX_CHANNELS]; /* visible channels */
gboolean active[MAX_CHANNELS]; /* active channels */
gboolean by_color_select; /* TRUE if there's an active */
/* "by color" selection dialog */
gboolean qmask_state; /* TRUE if qmask is on */
GimpRGB qmask_color; /* rgba triplet of the color */
......@@ -148,6 +145,7 @@ struct _GimpImageClass
ChannelType channel);
void (* component_active_changed) (GimpImage *gimage,
ChannelType channel);
void (* mask_changed) (GimpImage *gimage);
void (* clean) (GimpImage *gimage);
void (* dirty) (GimpImage *gimage);
......@@ -281,6 +279,7 @@ void gimp_image_mode_changed (GimpImage *gimage);
void gimp_image_alpha_changed (GimpImage *gimage);
void gimp_image_size_changed (GimpImage *gimage);
void gimp_image_floating_selection_changed (GimpImage *gimage);
void gimp_image_mask_changed (GimpImage *gimage);
/* layer/channel functions */
......
......@@ -88,6 +88,7 @@ static void gimp_by_color_select_tool_class_init (GimpByColorSelectToolClass *
static void gimp_by_color_select_tool_init (GimpByColorSelectTool *by_color_select);
static void gimp_by_color_select_tool_destroy (GtkObject *object);
static void gimp_by_color_select_tool_initialize_by_image (GimpImage *gimage);
static void by_color_select_color_drop (GtkWidget *widget,
const GimpRGB *color,
......@@ -116,6 +117,7 @@ static void by_color_select_oper_update (GimpTool *tool,
static void by_color_select_control (GimpTool *tool,
ToolAction action,