new signal "floating_selection_changed", removed ancient declaration of

2001-05-07  Michael Natterer  <mitch@gimp.org>

	* app/gimpimage.[hc]: new signal "floating_selection_changed",
	removed ancient declaration of _GimpImageRepaintArg.

	* app/floating_sel.c
	* app/undo.c: emit "floating_selection_changed" where approptiate.

	* app/gimage_mask.c: s/"Floated Layer"/"Floating Selection"/
	because we view this layer directly now (not some thing with an
	"L" icon).

	* app/gui/layers-commands.c: don't use confusing boolean variables
	which indicate that something is not true (reversed their logic).

	* app/widgets/Makefile.am
	* app/widgets/widgets-types.h
	* app/widgets/gimpchannellistitem.[ch]: new widget. Does nothing yet.

	* app/widgets/gimpchannellistview.c: set the button box
	insensitive when there is a floating selection.

	* app/widgets/gimpdrawablelistitem.c: made channel DND work again.
	Very ugly btw.

	* app/widgets/gimpdrawablelistview.c: connect to
	"floating_selection_changed". Fake a change of the active drawable
	so the button boxes get updated correctly.

	* app/widgets/gimplayerlistview.c: set the sensitivity of the
	buttons correctly.

	* app/widgets/gimplistitem.c: create GimpChannelListItems for
	channels.  Some very ugly code to work around broken
	GTK_STATE_INSENSITIVE propagation in list items.
This commit is contained in:
Michael Natterer 2001-05-08 01:32:25 +00:00 committed by Michael Natterer
parent f1c34ca578
commit f63cd1d979
41 changed files with 780 additions and 188 deletions

View File

@ -1,3 +1,39 @@
2001-05-07 Michael Natterer <mitch@gimp.org>
* app/gimpimage.[hc]: new signal "floating_selection_changed",
removed ancient declaration of _GimpImageRepaintArg.
* app/floating_sel.c
* app/undo.c: emit "floating_selection_changed" where approptiate.
* app/gimage_mask.c: s/"Floated Layer"/"Floating Selection"/
because we view this layer directly now (not some thing with an
"L" icon).
* app/gui/layers-commands.c: don't use confusing boolean variables
which indicate that something is not true (reversed their logic).
* app/widgets/Makefile.am
* app/widgets/widgets-types.h
* app/widgets/gimpchannellistitem.[ch]: new widget. Does nothing yet.
* app/widgets/gimpchannellistview.c: set the button box
insensitive when there is a floating selection.
* app/widgets/gimpdrawablelistitem.c: made channel DND work again.
Very ugly btw.
* app/widgets/gimpdrawablelistview.c: connect to
"floating_selection_changed". Fake a change of the active drawable
so the button boxes get updated correctly.
* app/widgets/gimplayerlistview.c: set the sensitivity of the
buttons correctly.
* app/widgets/gimplistitem.c: create GimpChannelListItems for
channels. Some very ugly code to work around broken
GTK_STATE_INSENSITIVE propagation in list items.
2001-05-06 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpchannellistview.c: enabled setting component

View File

@ -633,15 +633,15 @@ channels_menu_set_sensitivity (GimpImage *gimage)
menus_set_sensitive ("<Channels>/" menu, (condition) != 0)
SET_SENSITIVE ("New Channel...", !fs);
SET_SENSITIVE ("Raise Channel", channel && !fs && prev);
SET_SENSITIVE ("Lower Channel", channel && !fs && next);
SET_SENSITIVE ("Duplicate Channel", channel && !fs);
SET_SENSITIVE ("Channel to Selection", channel);
SET_SENSITIVE ("Add to Selection", channel);
SET_SENSITIVE ("Subtract from Selection", channel);
SET_SENSITIVE ("Intersect with Selection", channel);
SET_SENSITIVE ("Delete Channel", channel && !fs);
SET_SENSITIVE ("Edit Channel Attributes...", channel && !fs);
SET_SENSITIVE ("Raise Channel", !fs && channel && prev);
SET_SENSITIVE ("Lower Channel", !fs && channel && next);
SET_SENSITIVE ("Duplicate Channel", !fs && channel);
SET_SENSITIVE ("Channel to Selection", !fs && channel);
SET_SENSITIVE ("Add to Selection", !fs && channel);
SET_SENSITIVE ("Subtract from Selection", !fs && channel);
SET_SENSITIVE ("Intersect with Selection", !fs && channel);
SET_SENSITIVE ("Delete Channel", !fs && channel);
SET_SENSITIVE ("Edit Channel Attributes...", !fs && channel);
#undef SET_OPS_SENSITIVE
}

View File

@ -1225,8 +1225,8 @@ static void
layers_menu_set_sensitivity (GimpImage *gimage)
{
GimpLayer *layer;
gboolean fs = FALSE; /* no floating sel */
gboolean ac = FALSE; /* no active channel */
gboolean fs = FALSE; /* floating sel */
gboolean ac = FALSE; /* active channel */
gboolean lm = FALSE; /* layer mask */
gboolean lp = FALSE; /* layers present */
gboolean alpha = FALSE; /* alpha channel present */
@ -1244,8 +1244,8 @@ layers_menu_set_sensitivity (GimpImage *gimage)
if (layer)
lm = (gimp_layer_get_mask (layer)) ? TRUE : FALSE;
fs = (gimp_image_floating_sel (gimage) == NULL);
ac = (gimp_image_get_active_channel (gimage) == NULL);
fs = (gimp_image_floating_sel (gimage) != NULL);
ac = (gimp_image_get_active_channel (gimage) != NULL);
alpha = layer && gimp_layer_has_alpha (layer);
@ -1275,38 +1275,38 @@ layers_menu_set_sensitivity (GimpImage *gimage)
SET_SENSITIVE ("New Layer...", gimage);
SET_SENSITIVE ("Stack/Raise Layer",
fs && ac && gimage && lp && alpha && prev);
!fs && !ac && gimage && lp && alpha && prev);
SET_SENSITIVE ("Stack/Lower Layer",
fs && ac && gimage && lp && next && next_alpha);
!fs && !ac && gimage && lp && next && next_alpha);
SET_SENSITIVE ("Stack/Layer to Top",
fs && ac && gimage && lp && alpha && prev);
!fs && !ac && gimage && lp && alpha && prev);
SET_SENSITIVE ("Stack/Layer to Bottom",
fs && ac && gimage && lp && next && next_alpha);
!fs && !ac && gimage && lp && next && next_alpha);
SET_SENSITIVE ("Duplicate Layer", fs && ac && gimage && lp);
SET_SENSITIVE ("Anchor Layer", !fs && ac && gimage && lp);
SET_SENSITIVE ("Delete Layer", ac && gimage && lp);
SET_SENSITIVE ("Duplicate Layer", !fs && !ac && gimage && lp);
SET_SENSITIVE ("Anchor Layer", !fs && !ac && gimage && lp);
SET_SENSITIVE ("Delete Layer", !ac && gimage && lp);
SET_SENSITIVE ("Layer Boundary Size...", ac && gimage && lp);
SET_SENSITIVE ("Layer to Imagesize", ac && gimage && lp);
SET_SENSITIVE ("Scale Layer...", ac && gimage && lp);
SET_SENSITIVE ("Layer Boundary Size...", !ac && gimage && lp);
SET_SENSITIVE ("Layer to Imagesize", !ac && gimage && lp);
SET_SENSITIVE ("Scale Layer...", !ac && gimage && lp);
SET_SENSITIVE ("Merge Visible Layers...", fs && ac && gimage && lp);
SET_SENSITIVE ("Merge Down", fs && ac && gimage && lp && next);
SET_SENSITIVE ("Flatten Image", fs && ac && gimage && lp);
SET_SENSITIVE ("Merge Visible Layers...", !fs && !ac && gimage && lp);
SET_SENSITIVE ("Merge Down", !fs && !ac && gimage && lp && next);
SET_SENSITIVE ("Flatten Image", !fs && !ac && gimage && lp);
SET_SENSITIVE ("Add Layer Mask...",
fs && ac && gimage && !lm && lp && alpha && !indexed);
SET_SENSITIVE ("Apply Layer Mask", fs && ac && gimage && lm && lp);
SET_SENSITIVE ("Delete Layer Mask", fs && ac && gimage && lm && lp);
SET_SENSITIVE ("Mask to Selection", fs && ac && gimage && lm && lp);
!fs && !ac && gimage && !lm && lp && alpha && !indexed);
SET_SENSITIVE ("Apply Layer Mask", !fs && !ac && gimage && lm && lp);
SET_SENSITIVE ("Delete Layer Mask", !fs && !ac && gimage && lm && lp);
SET_SENSITIVE ("Mask to Selection", !fs && !ac && gimage && lm && lp);
SET_SENSITIVE ("Add Alpha Channel", !alpha);
SET_SENSITIVE ("Alpha to Selection", fs && ac && gimage && lp && alpha);
SET_SENSITIVE ("Add Alpha Channel", !fs && !alpha);
SET_SENSITIVE ("Alpha to Selection", !fs && !ac && gimage && lp && alpha);
SET_SENSITIVE ("Edit Layer Attributes...", ac && gimage && lp);
SET_SENSITIVE ("Edit Layer Attributes...", !fs && !ac && gimage && lp);
#undef SET_SENSITIVE
}

View File

@ -158,6 +158,7 @@ enum
MODE_CHANGED,
ALPHA_CHANGED,
SIZE_CHANGED,
FLOATING_SELECTION_CHANGED,
ACTIVE_LAYER_CHANGED,
ACTIVE_CHANNEL_CHANGED,
COMPONENT_VISIBILITY_CHANGED,
@ -244,6 +245,15 @@ gimp_image_class_init (GimpImageClass *klass)
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gimp_image_signals[FLOATING_SELECTION_CHANGED] =
gtk_signal_new ("floating_selection_changed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpImageClass,
floating_selection_changed),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gimp_image_signals[ACTIVE_LAYER_CHANGED] =
gtk_signal_new ("active_layer_changed",
GTK_RUN_FIRST,
@ -346,6 +356,7 @@ gimp_image_class_init (GimpImageClass *klass)
klass->mode_changed = NULL;
klass->alpha_changed = NULL;
klass->size_changed = NULL;
klass->floating_selection_changed = NULL;
klass->active_layer_changed = NULL;
klass->active_channel_changed = NULL;
klass->component_visibility_changed = NULL;
@ -1654,6 +1665,15 @@ gimp_image_size_changed (GimpImage *gimage)
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[SIZE_CHANGED]);
}
void
gimp_image_floating_selection_changed (GimpImage *gimage)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gtk_signal_emit (GTK_OBJECT (gimage),
gimp_image_signals[FLOATING_SELECTION_CHANGED]);
}
/************************************************************/
/* Projection functions */
/************************************************************/

View File

@ -151,6 +151,7 @@ struct _GimpImageClass
void (* mode_changed) (GimpImage *gimage);
void (* alpha_changed) (GimpImage *gimage);
void (* size_changed) (GimpImage *gimage);
void (* floating_selection_changed) (GimpImage *gimage);
void (* active_layer_changed) (GimpImage *gimage);
void (* active_channel_changed) (GimpImage *gimage);
void (* component_visibility_changed) (GimpImage *gimage,
@ -186,16 +187,6 @@ struct _Guide
};
typedef struct _GimpImageRepaintArg
{
GimpLayer *layer;
guint x;
guint y;
guint width;
guint height;
} GimpImageRepaintArg;
/* function declarations */
GtkType gimp_image_get_type (void);
@ -310,6 +301,7 @@ void gimp_image_colormap_changed (GimpImage *gimage,
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);
/* layer/channel functions */

View File

@ -376,7 +376,7 @@ gimage_mask_float (GimpImage *gimage,
layer = gimp_layer_new_from_tiles (gimage,
gimp_drawable_type_with_alpha (drawable),
tiles,
_("Floated Layer"),
_("Floating Selection"),
OPAQUE_OPACITY, NORMAL_MODE);
/* Set the offsets */

View File

@ -158,6 +158,7 @@ enum
MODE_CHANGED,
ALPHA_CHANGED,
SIZE_CHANGED,
FLOATING_SELECTION_CHANGED,
ACTIVE_LAYER_CHANGED,
ACTIVE_CHANNEL_CHANGED,
COMPONENT_VISIBILITY_CHANGED,
@ -244,6 +245,15 @@ gimp_image_class_init (GimpImageClass *klass)
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gimp_image_signals[FLOATING_SELECTION_CHANGED] =
gtk_signal_new ("floating_selection_changed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpImageClass,
floating_selection_changed),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gimp_image_signals[ACTIVE_LAYER_CHANGED] =
gtk_signal_new ("active_layer_changed",
GTK_RUN_FIRST,
@ -346,6 +356,7 @@ gimp_image_class_init (GimpImageClass *klass)
klass->mode_changed = NULL;
klass->alpha_changed = NULL;
klass->size_changed = NULL;
klass->floating_selection_changed = NULL;
klass->active_layer_changed = NULL;
klass->active_channel_changed = NULL;
klass->component_visibility_changed = NULL;
@ -1654,6 +1665,15 @@ gimp_image_size_changed (GimpImage *gimage)
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[SIZE_CHANGED]);
}
void
gimp_image_floating_selection_changed (GimpImage *gimage)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gtk_signal_emit (GTK_OBJECT (gimage),
gimp_image_signals[FLOATING_SELECTION_CHANGED]);
}
/************************************************************/
/* Projection functions */
/************************************************************/

View File

@ -151,6 +151,7 @@ struct _GimpImageClass
void (* mode_changed) (GimpImage *gimage);
void (* alpha_changed) (GimpImage *gimage);
void (* size_changed) (GimpImage *gimage);
void (* floating_selection_changed) (GimpImage *gimage);
void (* active_layer_changed) (GimpImage *gimage);
void (* active_channel_changed) (GimpImage *gimage);
void (* component_visibility_changed) (GimpImage *gimage,
@ -186,16 +187,6 @@ struct _Guide
};
typedef struct _GimpImageRepaintArg
{
GimpLayer *layer;
guint x;
guint y;
guint width;
guint height;
} GimpImageRepaintArg;
/* function declarations */
GtkType gimp_image_get_type (void);
@ -310,6 +301,7 @@ void gimp_image_colormap_changed (GimpImage *gimage,
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);
/* layer/channel functions */

View File

@ -158,6 +158,7 @@ enum
MODE_CHANGED,
ALPHA_CHANGED,
SIZE_CHANGED,
FLOATING_SELECTION_CHANGED,
ACTIVE_LAYER_CHANGED,
ACTIVE_CHANNEL_CHANGED,
COMPONENT_VISIBILITY_CHANGED,
@ -244,6 +245,15 @@ gimp_image_class_init (GimpImageClass *klass)
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gimp_image_signals[FLOATING_SELECTION_CHANGED] =
gtk_signal_new ("floating_selection_changed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpImageClass,
floating_selection_changed),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gimp_image_signals[ACTIVE_LAYER_CHANGED] =
gtk_signal_new ("active_layer_changed",
GTK_RUN_FIRST,
@ -346,6 +356,7 @@ gimp_image_class_init (GimpImageClass *klass)
klass->mode_changed = NULL;
klass->alpha_changed = NULL;
klass->size_changed = NULL;
klass->floating_selection_changed = NULL;
klass->active_layer_changed = NULL;
klass->active_channel_changed = NULL;
klass->component_visibility_changed = NULL;
@ -1654,6 +1665,15 @@ gimp_image_size_changed (GimpImage *gimage)
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[SIZE_CHANGED]);
}
void
gimp_image_floating_selection_changed (GimpImage *gimage)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gtk_signal_emit (GTK_OBJECT (gimage),
gimp_image_signals[FLOATING_SELECTION_CHANGED]);
}
/************************************************************/
/* Projection functions */
/************************************************************/

View File

@ -151,6 +151,7 @@ struct _GimpImageClass
void (* mode_changed) (GimpImage *gimage);
void (* alpha_changed) (GimpImage *gimage);
void (* size_changed) (GimpImage *gimage);
void (* floating_selection_changed) (GimpImage *gimage);
void (* active_layer_changed) (GimpImage *gimage);
void (* active_channel_changed) (GimpImage *gimage);
void (* component_visibility_changed) (GimpImage *gimage,
@ -186,16 +187,6 @@ struct _Guide
};
typedef struct _GimpImageRepaintArg
{
GimpLayer *layer;
guint x;
guint y;
guint width;
guint height;
} GimpImageRepaintArg;
/* function declarations */
GtkType gimp_image_get_type (void);
@ -310,6 +301,7 @@ void gimp_image_colormap_changed (GimpImage *gimage,
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);
/* layer/channel functions */

View File

@ -158,6 +158,7 @@ enum
MODE_CHANGED,
ALPHA_CHANGED,
SIZE_CHANGED,
FLOATING_SELECTION_CHANGED,
ACTIVE_LAYER_CHANGED,
ACTIVE_CHANNEL_CHANGED,
COMPONENT_VISIBILITY_CHANGED,
@ -244,6 +245,15 @@ gimp_image_class_init (GimpImageClass *klass)
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gimp_image_signals[FLOATING_SELECTION_CHANGED] =
gtk_signal_new ("floating_selection_changed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpImageClass,
floating_selection_changed),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gimp_image_signals[ACTIVE_LAYER_CHANGED] =
gtk_signal_new ("active_layer_changed",
GTK_RUN_FIRST,
@ -346,6 +356,7 @@ gimp_image_class_init (GimpImageClass *klass)
klass->mode_changed = NULL;
klass->alpha_changed = NULL;
klass->size_changed = NULL;
klass->floating_selection_changed = NULL;
klass->active_layer_changed = NULL;
klass->active_channel_changed = NULL;
klass->component_visibility_changed = NULL;
@ -1654,6 +1665,15 @@ gimp_image_size_changed (GimpImage *gimage)
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[SIZE_CHANGED]);
}
void
gimp_image_floating_selection_changed (GimpImage *gimage)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gtk_signal_emit (GTK_OBJECT (gimage),
gimp_image_signals[FLOATING_SELECTION_CHANGED]);
}
/************************************************************/
/* Projection functions */
/************************************************************/

View File

@ -151,6 +151,7 @@ struct _GimpImageClass
void (* mode_changed) (GimpImage *gimage);
void (* alpha_changed) (GimpImage *gimage);
void (* size_changed) (GimpImage *gimage);
void (* floating_selection_changed) (GimpImage *gimage);
void (* active_layer_changed) (GimpImage *gimage);
void (* active_channel_changed) (GimpImage *gimage);
void (* component_visibility_changed) (GimpImage *gimage,
@ -186,16 +187,6 @@ struct _Guide
};
typedef struct _GimpImageRepaintArg
{
GimpLayer *layer;
guint x;
guint y;
guint width;
guint height;
} GimpImageRepaintArg;
/* function declarations */
GtkType gimp_image_get_type (void);
@ -310,6 +301,7 @@ void gimp_image_colormap_changed (GimpImage *gimage,
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);
/* layer/channel functions */

View File

@ -158,6 +158,7 @@ enum
MODE_CHANGED,
ALPHA_CHANGED,
SIZE_CHANGED,
FLOATING_SELECTION_CHANGED,
ACTIVE_LAYER_CHANGED,
ACTIVE_CHANNEL_CHANGED,
COMPONENT_VISIBILITY_CHANGED,
@ -244,6 +245,15 @@ gimp_image_class_init (GimpImageClass *klass)
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gimp_image_signals[FLOATING_SELECTION_CHANGED] =
gtk_signal_new ("floating_selection_changed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpImageClass,
floating_selection_changed),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gimp_image_signals[ACTIVE_LAYER_CHANGED] =
gtk_signal_new ("active_layer_changed",
GTK_RUN_FIRST,
@ -346,6 +356,7 @@ gimp_image_class_init (GimpImageClass *klass)
klass->mode_changed = NULL;
klass->alpha_changed = NULL;
klass->size_changed = NULL;
klass->floating_selection_changed = NULL;
klass->active_layer_changed = NULL;
klass->active_channel_changed = NULL;
klass->component_visibility_changed = NULL;
@ -1654,6 +1665,15 @@ gimp_image_size_changed (GimpImage *gimage)
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[SIZE_CHANGED]);
}
void
gimp_image_floating_selection_changed (GimpImage *gimage)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gtk_signal_emit (GTK_OBJECT (gimage),
gimp_image_signals[FLOATING_SELECTION_CHANGED]);
}
/************************************************************/
/* Projection functions */
/************************************************************/

View File

@ -151,6 +151,7 @@ struct _GimpImageClass
void (* mode_changed) (GimpImage *gimage);
void (* alpha_changed) (GimpImage *gimage);
void (* size_changed) (GimpImage *gimage);
void (* floating_selection_changed) (GimpImage *gimage);
void (* active_layer_changed) (GimpImage *gimage);
void (* active_channel_changed) (GimpImage *gimage);
void (* component_visibility_changed) (GimpImage *gimage,
@ -186,16 +187,6 @@ struct _Guide
};
typedef struct _GimpImageRepaintArg
{
GimpLayer *layer;
guint x;
guint y;
guint width;
guint height;
} GimpImageRepaintArg;
/* function declarations */
GtkType gimp_image_get_type (void);
@ -310,6 +301,7 @@ void gimp_image_colormap_changed (GimpImage *gimage,
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);
/* layer/channel functions */

View File

@ -1484,6 +1484,8 @@ undo_pop_layer (GimpImage *gimage,
gimage->floating_sel = NULL;
/* reset the old drawable */
floating_sel_reset (lu->layer);
gimp_image_floating_selection_changed (gimage);
}
drawable_update (GIMP_DRAWABLE (lu->layer), 0, 0,
@ -1509,6 +1511,9 @@ undo_pop_layer (GimpImage *gimage,
GIMP_OBJECT (lu->layer), lu->prev_position);
gimp_image_set_active_layer (gimage, lu->layer);
if (gimp_layer_is_floating_sel (lu->layer))
gimp_image_floating_selection_changed (gimage);
drawable_update (GIMP_DRAWABLE (lu->layer), 0, 0,
GIMP_DRAWABLE (lu->layer)->width,
GIMP_DRAWABLE (lu->layer)->height);
@ -2028,6 +2033,8 @@ undo_pop_fs_to_layer (GimpImage *gimage,
break;
}
gimp_image_floating_selection_changed (gimage);
return TRUE;
}
@ -2113,6 +2120,8 @@ undo_pop_fs_rigor (GimpImage *gimage,
break;
}
gimp_image_floating_selection_changed (gimage);
return TRUE;
}
@ -2192,6 +2201,8 @@ undo_pop_fs_relax (GimpImage *gimage,
break;
}
gimp_image_floating_selection_changed (gimage);
return TRUE;
}

View File

@ -158,6 +158,7 @@ enum
MODE_CHANGED,
ALPHA_CHANGED,
SIZE_CHANGED,
FLOATING_SELECTION_CHANGED,
ACTIVE_LAYER_CHANGED,
ACTIVE_CHANNEL_CHANGED,
COMPONENT_VISIBILITY_CHANGED,
@ -244,6 +245,15 @@ gimp_image_class_init (GimpImageClass *klass)
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gimp_image_signals[FLOATING_SELECTION_CHANGED] =
gtk_signal_new ("floating_selection_changed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpImageClass,
floating_selection_changed),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gimp_image_signals[ACTIVE_LAYER_CHANGED] =
gtk_signal_new ("active_layer_changed",
GTK_RUN_FIRST,
@ -346,6 +356,7 @@ gimp_image_class_init (GimpImageClass *klass)
klass->mode_changed = NULL;
klass->alpha_changed = NULL;
klass->size_changed = NULL;
klass->floating_selection_changed = NULL;
klass->active_layer_changed = NULL;
klass->active_channel_changed = NULL;
klass->component_visibility_changed = NULL;
@ -1654,6 +1665,15 @@ gimp_image_size_changed (GimpImage *gimage)
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[SIZE_CHANGED]);
}
void
gimp_image_floating_selection_changed (GimpImage *gimage)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gtk_signal_emit (GTK_OBJECT (gimage),
gimp_image_signals[FLOATING_SELECTION_CHANGED]);
}
/************************************************************/
/* Projection functions */
/************************************************************/

View File

@ -151,6 +151,7 @@ struct _GimpImageClass
void (* mode_changed) (GimpImage *gimage);
void (* alpha_changed) (GimpImage *gimage);
void (* size_changed) (GimpImage *gimage);
void (* floating_selection_changed) (GimpImage *gimage);
void (* active_layer_changed) (GimpImage *gimage);
void (* active_channel_changed) (GimpImage *gimage);
void (* component_visibility_changed) (GimpImage *gimage,
@ -186,16 +187,6 @@ struct _Guide
};
typedef struct _GimpImageRepaintArg
{
GimpLayer *layer;
guint x;
guint y;
guint width;
guint height;
} GimpImageRepaintArg;
/* function declarations */
GtkType gimp_image_get_type (void);
@ -310,6 +301,7 @@ void gimp_image_colormap_changed (GimpImage *gimage,
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);
/* layer/channel functions */

View File

@ -82,6 +82,8 @@ floating_sel_attach (GimpLayer *layer,
/* store the affected area from the drawable in the backing store */
floating_sel_rigor (layer, TRUE);
gimp_image_floating_selection_changed (gimage);
}
void
@ -103,6 +105,8 @@ floating_sel_remove (GimpLayer *layer)
/* remove the layer from the gimage */
gimp_image_remove_layer (gimage, layer);
gimp_image_floating_selection_changed (gimage);
}
void
@ -144,6 +148,8 @@ floating_sel_anchor (GimpLayer *layer)
/* invalidate the boundaries */
gimage_mask_invalidate (gimage);
gimp_image_floating_selection_changed (gimage);
}
void
@ -238,6 +244,8 @@ floating_sel_to_layer (GimpLayer *layer)
/* This may be undesirable when invoked non-interactively... we'll see. */
/*reinit_layer_idlerender (gimage, layer);*/
gimp_image_floating_selection_changed (gimage);
}
void

View File

@ -158,6 +158,7 @@ enum
MODE_CHANGED,
ALPHA_CHANGED,
SIZE_CHANGED,
FLOATING_SELECTION_CHANGED,
ACTIVE_LAYER_CHANGED,
ACTIVE_CHANNEL_CHANGED,
COMPONENT_VISIBILITY_CHANGED,
@ -244,6 +245,15 @@ gimp_image_class_init (GimpImageClass *klass)
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gimp_image_signals[FLOATING_SELECTION_CHANGED] =
gtk_signal_new ("floating_selection_changed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpImageClass,
floating_selection_changed),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gimp_image_signals[ACTIVE_LAYER_CHANGED] =
gtk_signal_new ("active_layer_changed",
GTK_RUN_FIRST,
@ -346,6 +356,7 @@ gimp_image_class_init (GimpImageClass *klass)
klass->mode_changed = NULL;
klass->alpha_changed = NULL;
klass->size_changed = NULL;
klass->floating_selection_changed = NULL;
klass->active_layer_changed = NULL;
klass->active_channel_changed = NULL;
klass->component_visibility_changed = NULL;
@ -1654,6 +1665,15 @@ gimp_image_size_changed (GimpImage *gimage)
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[SIZE_CHANGED]);
}
void
gimp_image_floating_selection_changed (GimpImage *gimage)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gtk_signal_emit (GTK_OBJECT (gimage),
gimp_image_signals[FLOATING_SELECTION_CHANGED]);
}
/************************************************************/
/* Projection functions */
/************************************************************/

View File

@ -151,6 +151,7 @@ struct _GimpImageClass
void (* mode_changed) (GimpImage *gimage);
void (* alpha_changed) (GimpImage *gimage);
void (* size_changed) (GimpImage *gimage);
void (* floating_selection_changed) (GimpImage *gimage);
void (* active_layer_changed) (GimpImage *gimage);
void (* active_channel_changed) (GimpImage *gimage);
void (* component_visibility_changed) (GimpImage *gimage,
@ -186,16 +187,6 @@ struct _Guide
};
typedef struct _GimpImageRepaintArg
{
GimpLayer *layer;
guint x;
guint y;
guint width;
guint height;
} GimpImageRepaintArg;
/* function declarations */
GtkType gimp_image_get_type (void);
@ -310,6 +301,7 @@ void gimp_image_colormap_changed (GimpImage *gimage,
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);
/* layer/channel functions */

View File

@ -82,6 +82,8 @@ floating_sel_attach (GimpLayer *layer,
/* store the affected area from the drawable in the backing store */
floating_sel_rigor (layer, TRUE);
gimp_image_floating_selection_changed (gimage);
}
void
@ -103,6 +105,8 @@ floating_sel_remove (GimpLayer *layer)
/* remove the layer from the gimage */
gimp_image_remove_layer (gimage, layer);
gimp_image_floating_selection_changed (gimage);
}
void
@ -144,6 +148,8 @@ floating_sel_anchor (GimpLayer *layer)
/* invalidate the boundaries */
gimage_mask_invalidate (gimage);
gimp_image_floating_selection_changed (gimage);
}
void
@ -238,6 +244,8 @@ floating_sel_to_layer (GimpLayer *layer)
/* This may be undesirable when invoked non-interactively... we'll see. */
/*reinit_layer_idlerender (gimage, layer);*/
gimp_image_floating_selection_changed (gimage);
}
void

View File

@ -376,7 +376,7 @@ gimage_mask_float (GimpImage *gimage,
layer = gimp_layer_new_from_tiles (gimage,
gimp_drawable_type_with_alpha (drawable),
tiles,
_("Floated Layer"),
_("Floating Selection"),
OPAQUE_OPACITY, NORMAL_MODE);
/* Set the offsets */

View File

@ -158,6 +158,7 @@ enum
MODE_CHANGED,
ALPHA_CHANGED,
SIZE_CHANGED,
FLOATING_SELECTION_CHANGED,
ACTIVE_LAYER_CHANGED,
ACTIVE_CHANNEL_CHANGED,
COMPONENT_VISIBILITY_CHANGED,
@ -244,6 +245,15 @@ gimp_image_class_init (GimpImageClass *klass)
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gimp_image_signals[FLOATING_SELECTION_CHANGED] =
gtk_signal_new ("floating_selection_changed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpImageClass,
floating_selection_changed),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gimp_image_signals[ACTIVE_LAYER_CHANGED] =
gtk_signal_new ("active_layer_changed",
GTK_RUN_FIRST,
@ -346,6 +356,7 @@ gimp_image_class_init (GimpImageClass *klass)
klass->mode_changed = NULL;
klass->alpha_changed = NULL;
klass->size_changed = NULL;
klass->floating_selection_changed = NULL;
klass->active_layer_changed = NULL;
klass->active_channel_changed = NULL;
klass->component_visibility_changed = NULL;
@ -1654,6 +1665,15 @@ gimp_image_size_changed (GimpImage *gimage)
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[SIZE_CHANGED]);
}
void
gimp_image_floating_selection_changed (GimpImage *gimage)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gtk_signal_emit (GTK_OBJECT (gimage),
gimp_image_signals[FLOATING_SELECTION_CHANGED]);
}
/************************************************************/
/* Projection functions */
/************************************************************/

View File

@ -151,6 +151,7 @@ struct _GimpImageClass
void (* mode_changed) (GimpImage *gimage);
void (* alpha_changed) (GimpImage *gimage);
void (* size_changed) (GimpImage *gimage);
void (* floating_selection_changed) (GimpImage *gimage);
void (* active_layer_changed) (GimpImage *gimage);
void (* active_channel_changed) (GimpImage *gimage);
void (* component_visibility_changed) (GimpImage *gimage,
@ -186,16 +187,6 @@ struct _Guide
};
typedef struct _GimpImageRepaintArg
{
GimpLayer *layer;
guint x;
guint y;
guint width;
guint height;
} GimpImageRepaintArg;
/* function declarations */
GtkType gimp_image_get_type (void);
@ -310,6 +301,7 @@ void gimp_image_colormap_changed (GimpImage *gimage,
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);
/* layer/channel functions */

View File

@ -633,15 +633,15 @@ channels_menu_set_sensitivity (GimpImage *gimage)
menus_set_sensitive ("<Channels>/" menu, (condition) != 0)
SET_SENSITIVE ("New Channel...", !fs);
SET_SENSITIVE ("Raise Channel", channel && !fs && prev);
SET_SENSITIVE ("Lower Channel", channel && !fs && next);
SET_SENSITIVE ("Duplicate Channel", channel && !fs);
SET_SENSITIVE ("Channel to Selection", channel);
SET_SENSITIVE ("Add to Selection", channel);
SET_SENSITIVE ("Subtract from Selection", channel);
SET_SENSITIVE ("Intersect with Selection", channel);
SET_SENSITIVE ("Delete Channel", channel && !fs);
SET_SENSITIVE ("Edit Channel Attributes...", channel && !fs);
SET_SENSITIVE ("Raise Channel", !fs && channel && prev);
SET_SENSITIVE ("Lower Channel", !fs && channel && next);
SET_SENSITIVE ("Duplicate Channel", !fs && channel);
SET_SENSITIVE ("Channel to Selection", !fs && channel);
SET_SENSITIVE ("Add to Selection", !fs && channel);
SET_SENSITIVE ("Subtract from Selection", !fs && channel);
SET_SENSITIVE ("Intersect with Selection", !fs && channel);
SET_SENSITIVE ("Delete Channel", !fs && channel);
SET_SENSITIVE ("Edit Channel Attributes...", !fs && channel);
#undef SET_OPS_SENSITIVE
}

View File

@ -1225,8 +1225,8 @@ static void
layers_menu_set_sensitivity (GimpImage *gimage)
{
GimpLayer *layer;
gboolean fs = FALSE; /* no floating sel */
gboolean ac = FALSE; /* no active channel */
gboolean fs = FALSE; /* floating sel */
gboolean ac = FALSE; /* active channel */
gboolean lm = FALSE; /* layer mask */
gboolean lp = FALSE; /* layers present */
gboolean alpha = FALSE; /* alpha channel present */
@ -1244,8 +1244,8 @@ layers_menu_set_sensitivity (GimpImage *gimage)
if (layer)
lm = (gimp_layer_get_mask (layer)) ? TRUE : FALSE;
fs = (gimp_image_floating_sel (gimage) == NULL);
ac = (gimp_image_get_active_channel (gimage) == NULL);
fs = (gimp_image_floating_sel (gimage) != NULL);
ac = (gimp_image_get_active_channel (gimage) != NULL);
alpha = layer && gimp_layer_has_alpha (layer);
@ -1275,38 +1275,38 @@ layers_menu_set_sensitivity (GimpImage *gimage)
SET_SENSITIVE ("New Layer...", gimage);
SET_SENSITIVE ("Stack/Raise Layer",
fs && ac && gimage && lp && alpha && prev);
!fs && !ac && gimage && lp && alpha && prev);
SET_SENSITIVE ("Stack/Lower Layer",
fs && ac && gimage && lp && next && next_alpha);
!fs && !ac && gimage && lp && next && next_alpha);
SET_SENSITIVE ("Stack/Layer to Top",
fs && ac && gimage && lp && alpha && prev);
!fs && !ac && gimage && lp && alpha && prev);
SET_SENSITIVE ("Stack/Layer to Bottom",
fs && ac && gimage && lp && next && next_alpha);
!fs && !ac && gimage && lp && next && next_alpha);
SET_SENSITIVE ("Duplicate Layer", fs && ac && gimage && lp);
SET_SENSITIVE ("Anchor Layer", !fs && ac && gimage && lp);
SET_SENSITIVE ("Delete Layer", ac && gimage && lp);
SET_SENSITIVE ("Duplicate Layer", !fs && !ac && gimage && lp);
SET_SENSITIVE ("Anchor Layer", !fs && !ac && gimage && lp);
SET_SENSITIVE ("Delete Layer", !ac && gimage && lp);
SET_SENSITIVE ("Layer Boundary Size...", ac && gimage && lp);
SET_SENSITIVE ("Layer to Imagesize", ac && gimage && lp);
SET_SENSITIVE ("Scale Layer...", ac && gimage && lp);
SET_SENSITIVE ("Layer Boundary Size...", !ac && gimage && lp);
SET_SENSITIVE ("Layer to Imagesize", !ac && gimage && lp);
SET_SENSITIVE ("Scale Layer...", !ac && gimage && lp);
SET_SENSITIVE ("Merge Visible Layers...", fs && ac && gimage && lp);
SET_SENSITIVE ("Merge Down", fs && ac && gimage && lp && next);
SET_SENSITIVE ("Flatten Image", fs && ac && gimage && lp);
SET_SENSITIVE ("Merge Visible Layers...", !fs && !ac && gimage && lp);
SET_SENSITIVE ("Merge Down", !fs && !ac && gimage && lp && next);
SET_SENSITIVE ("Flatten Image", !fs && !ac && gimage && lp);
SET_SENSITIVE ("Add Layer Mask...",
fs && ac && gimage && !lm && lp && alpha && !indexed);
SET_SENSITIVE ("Apply Layer Mask", fs && ac && gimage && lm && lp);
SET_SENSITIVE ("Delete Layer Mask", fs && ac && gimage && lm && lp);
SET_SENSITIVE ("Mask to Selection", fs && ac && gimage && lm && lp);
!fs && !ac && gimage && !lm && lp && alpha && !indexed);
SET_SENSITIVE ("Apply Layer Mask", !fs && !ac && gimage && lm && lp);
SET_SENSITIVE ("Delete Layer Mask", !fs && !ac && gimage && lm && lp);
SET_SENSITIVE ("Mask to Selection", !fs && !ac && gimage && lm && lp);
SET_SENSITIVE ("Add Alpha Channel", !alpha);
SET_SENSITIVE ("Alpha to Selection", fs && ac && gimage && lp && alpha);
SET_SENSITIVE ("Add Alpha Channel", !fs && !alpha);
SET_SENSITIVE ("Alpha to Selection", !fs && !ac && gimage && lp && alpha);
SET_SENSITIVE ("Edit Layer Attributes...", ac && gimage && lp);
SET_SENSITIVE ("Edit Layer Attributes...", !fs && !ac && gimage && lp);
#undef SET_SENSITIVE
}

View File

@ -1484,6 +1484,8 @@ undo_pop_layer (GimpImage *gimage,
gimage->floating_sel = NULL;
/* reset the old drawable */
floating_sel_reset (lu->layer);
gimp_image_floating_selection_changed (gimage);
}
drawable_update (GIMP_DRAWABLE (lu->layer), 0, 0,
@ -1509,6 +1511,9 @@ undo_pop_layer (GimpImage *gimage,
GIMP_OBJECT (lu->layer), lu->prev_position);
gimp_image_set_active_layer (gimage, lu->layer);
if (gimp_layer_is_floating_sel (lu->layer))
gimp_image_floating_selection_changed (gimage);
drawable_update (GIMP_DRAWABLE (lu->layer), 0, 0,
GIMP_DRAWABLE (lu->layer)->width,
GIMP_DRAWABLE (lu->layer)->height);
@ -2028,6 +2033,8 @@ undo_pop_fs_to_layer (GimpImage *gimage,
break;
}
gimp_image_floating_selection_changed (gimage);
return TRUE;
}
@ -2113,6 +2120,8 @@ undo_pop_fs_rigor (GimpImage *gimage,
break;
}
gimp_image_floating_selection_changed (gimage);
return TRUE;
}
@ -2192,6 +2201,8 @@ undo_pop_fs_relax (GimpImage *gimage,
break;
}
gimp_image_floating_selection_changed (gimage);
return TRUE;
}

View File

@ -5,6 +5,8 @@ noinst_LTLIBRARIES = libappwidgets.la
libappwidgets_la_SOURCES = \
gimpbrushpreview.c \
gimpbrushpreview.h \
gimpchannellistitem.c \
gimpchannellistitem.h \
gimpchannellistview.c \
gimpchannellistview.h \
gimpcolorpanel.c \

View File

@ -0,0 +1,125 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpchannellistitem.c
* Copyright (C) 2001 Michael Natterer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"
#include "apptypes.h"
#include "gimpdnd.h"
#include "gimpchannellistitem.h"
#include "gimppreview.h"
#include "drawable.h"
#include "gdisplay.h"
#include "gimpchannel.h"
#include "gimpimage.h"
#include "gimpchannel.h"
#include "gimpviewable.h"
static void gimp_channel_list_item_class_init (GimpChannelListItemClass *klass);
static void gimp_channel_list_item_init (GimpChannelListItem *list_item);
static void gimp_channel_list_item_drop_color (GtkWidget *widget,
const GimpRGB *color,
gpointer data);
GtkType
gimp_channel_list_item_get_type (void)
{
static GtkType list_item_type = 0;
if (! list_item_type)
{
static const GtkTypeInfo list_item_info =
{
"GimpChannelListItem",
sizeof (GimpChannelListItem),
sizeof (GimpChannelListItemClass),
(GtkClassInitFunc) gimp_channel_list_item_class_init,
(GtkObjectInitFunc) gimp_channel_list_item_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
list_item_type = gtk_type_unique (GIMP_TYPE_DRAWABLE_LIST_ITEM,
&list_item_info);
}
return list_item_type;
}
static void
gimp_channel_list_item_class_init (GimpChannelListItemClass *klass)
{
}
static void
gimp_channel_list_item_init (GimpChannelListItem *list_item)
{
/*
static GtkTargetEntry color_target_table[] =
{
GIMP_TARGET_COLOR
};
static guint n_color_targets = (sizeof (color_target_table) /
sizeof (color_target_table[0]));
gtk_drag_dest_set (GTK_WIDGET (list_item),
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
color_target_table, n_color_targets,
GDK_ACTION_COPY);
gimp_dnd_color_dest_set (GTK_WIDGET (list_item),
gimp_channel_list_item_drop_color, NULL);
*/
}
static void
gimp_channel_list_item_drop_color (GtkWidget *widget,
const GimpRGB *color,
gpointer data)
{
GimpChannel *channel;
channel =
GIMP_CHANNEL (GIMP_PREVIEW (GIMP_LIST_ITEM (widget)->preview)->viewable);
if (gimp_rgba_distance (color, &channel->color) > 0.0001)
{
channel->color = *color;
drawable_update (GIMP_DRAWABLE (channel),
0, 0,
GIMP_DRAWABLE (channel)->width,
GIMP_DRAWABLE (channel)->height);
gdisplays_flush ();
}
}

View File

@ -0,0 +1,62 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpchannellistitem.h
* Copyright (C) 2001 Michael Natterer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_CHANNEL_LIST_ITEM_H__
#define __GIMP_CHANNEL_LIST_ITEM_H__
#include "gimpdrawablelistitem.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define GIMP_TYPE_CHANNEL_LIST_ITEM (gimp_channel_list_item_get_type ())
#define GIMP_CHANNEL_LIST_ITEM(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_CHANNEL_LIST_ITEM, GimpChannelListItem))
#define GIMP_CHANNEL_LIST_ITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_CHANNEL_LIST_ITEM, GimpChannelListItemClass))
#define GIMP_IS_CHANNEL_LIST_ITEM(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_CHANNEL_LIST_ITEM))
#define GIMP_IS_CHANNEL_LIST_ITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CHANNEL_LIST_ITEM))
typedef struct _GimpChannelListItemClass GimpChannelListItemClass;
struct _GimpChannelListItem
{
GimpDrawableListItem parent_instance;
};
struct _GimpChannelListItemClass
{
GimpDrawableListItemClass parent_class;
};
GtkType gimp_channel_list_item_get_type (void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __GIMP_CHANNEL_LIST_ITEM_H__ */

View File

@ -266,16 +266,27 @@ gimp_channel_list_view_select_item (GimpContainerView *view,
GimpViewable *item,
gpointer insert_data)
{
GimpChannelListView *list_view;
gboolean toselection_sensitive = FALSE;
GimpDrawableListView *drawable_view;
GimpChannelListView *list_view;
gboolean toselection_sensitive = FALSE;
list_view = GIMP_CHANNEL_LIST_VIEW (view);
drawable_view = GIMP_DRAWABLE_LIST_VIEW (view);
list_view = GIMP_CHANNEL_LIST_VIEW (view);
if (GIMP_CONTAINER_VIEW_CLASS (parent_class)->select_item)
GIMP_CONTAINER_VIEW_CLASS (parent_class)->select_item (view,
item,
insert_data);
if (drawable_view->gimage)
{
gtk_widget_set_sensitive
(drawable_view->button_box,
gimp_image_floating_sel (drawable_view->gimage) == NULL);
return;
}
if (item)
{
toselection_sensitive = TRUE;

View File

@ -266,16 +266,27 @@ gimp_channel_list_view_select_item (GimpContainerView *view,
GimpViewable *item,
gpointer insert_data)
{
GimpChannelListView *list_view;
gboolean toselection_sensitive = FALSE;
GimpDrawableListView *drawable_view;
GimpChannelListView *list_view;
gboolean toselection_sensitive = FALSE;
list_view = GIMP_CHANNEL_LIST_VIEW (view);
drawable_view = GIMP_DRAWABLE_LIST_VIEW (view);
list_view = GIMP_CHANNEL_LIST_VIEW (view);
if (GIMP_CONTAINER_VIEW_CLASS (parent_class)->select_item)
GIMP_CONTAINER_VIEW_CLASS (parent_class)->select_item (view,
item,
insert_data);
if (drawable_view->gimage)
{
gtk_widget_set_sensitive
(drawable_view->button_box,
gimp_image_floating_sel (drawable_view->gimage) == NULL);
return;
}
if (item)
{
toselection_sensitive = TRUE;

View File

@ -240,11 +240,16 @@ gimp_drawable_list_item_drag_drop (GtkWidget *widget,
if (return_val)
{
if (widget->parent && GIMP_IS_DRAWABLE_LIST_VIEW (widget->parent))
if (widget->parent && /* EEK */
widget->parent->parent && /* EEEEK */
widget->parent->parent->parent && /* EEEEEEK */
widget->parent->parent->parent->parent && /* EEEEEEEEK */
GIMP_IS_DRAWABLE_LIST_VIEW (widget->parent->parent->parent->parent))
{
GimpDrawableListView *list_view;
list_view = GIMP_DRAWABLE_LIST_VIEW (widget->parent);
list_view =
GIMP_DRAWABLE_LIST_VIEW (widget->parent->parent->parent->parent);
list_view->reorder_drawable_func (list_view->gimage,
GIMP_DRAWABLE (src_viewable),

View File

@ -43,6 +43,7 @@
#include "gimpdrawablelistview.h"
#include "gimplayerlistview.h"
#include "gimplistitem.h"
#include "gimppreview.h"
#include "libgimp/gimpintl.h"
@ -130,6 +131,9 @@ static void gimp_drawable_list_view_drawable_changed (GimpImage *g
GimpDrawableListView *view);
static void gimp_drawable_list_view_size_changed (GimpImage *gimage,
GimpDrawableListView *view);
static void gimp_drawable_list_view_floating_selection_changed
(GimpImage *gimage,
GimpDrawableListView *view);
static guint view_signals[LAST_SIGNAL] = { 0 };
@ -445,8 +449,7 @@ gimp_drawable_list_view_new (GimpImage *gimage,
gimp_drawable_list_view_delete_dropped,
list_view);
if (gimage)
gimp_drawable_list_view_set_image (list_view, gimage);
gimp_drawable_list_view_set_image (list_view, gimage);
return GTK_WIDGET (list_view);
}
@ -481,6 +484,9 @@ gimp_drawable_list_view_real_set_image (GimpDrawableListView *view,
gtk_signal_disconnect_by_func (GTK_OBJECT (view->gimage),
gimp_drawable_list_view_size_changed,
view);
gtk_signal_disconnect_by_func (GTK_OBJECT (view->gimage),
gimp_drawable_list_view_floating_selection_changed,
view);
gimp_container_view_set_container (GIMP_CONTAINER_VIEW (view), NULL);
}
@ -501,8 +507,14 @@ gimp_drawable_list_view_real_set_image (GimpDrawableListView *view,
gtk_signal_connect (GTK_OBJECT (view->gimage), "size_changed",
GTK_SIGNAL_FUNC (gimp_drawable_list_view_size_changed),
view);
gtk_signal_connect (GTK_OBJECT (view->gimage), "floating_selection_changed",
GTK_SIGNAL_FUNC (gimp_drawable_list_view_floating_selection_changed),
view);
gimp_drawable_list_view_drawable_changed (view->gimage, view);
if (gimp_image_floating_sel (view->gimage))
gimp_drawable_list_view_floating_selection_changed (view->gimage, view);
}
gtk_widget_set_sensitive (view->new_button, (view->gimage != NULL));
@ -891,3 +903,28 @@ gimp_drawable_list_view_size_changed (GimpImage *gimage,
gimp_container_view_set_preview_size (GIMP_CONTAINER_VIEW (view),
preview_size);
}
static void
gimp_drawable_list_view_floating_selection_changed (GimpImage *gimage,
GimpDrawableListView *view)
{
GimpViewable *floating_sel;
GList *list;
floating_sel = (GimpViewable *) gimp_image_floating_sel (gimage);
for (list = GTK_LIST (GIMP_CONTAINER_LIST_VIEW (view)->gtk_list)->children;
list;
list = g_list_next (list))
{
if (! (GIMP_PREVIEW (GIMP_LIST_ITEM (list->data)->preview)->viewable ==
floating_sel))
{
gtk_widget_set_sensitive (GTK_WIDGET (list->data),
floating_sel == NULL);
}
}
/* update button states */
gimp_drawable_list_view_drawable_changed (gimage, view);
}

View File

@ -43,6 +43,7 @@
#include "gimpdrawablelistview.h"
#include "gimplayerlistview.h"
#include "gimplistitem.h"
#include "gimppreview.h"
#include "libgimp/gimpintl.h"
@ -130,6 +131,9 @@ static void gimp_drawable_list_view_drawable_changed (GimpImage *g
GimpDrawableListView *view);
static void gimp_drawable_list_view_size_changed (GimpImage *gimage,
GimpDrawableListView *view);
static void gimp_drawable_list_view_floating_selection_changed
(GimpImage *gimage,
GimpDrawableListView *view);
static guint view_signals[LAST_SIGNAL] = { 0 };
@ -445,8 +449,7 @@ gimp_drawable_list_view_new (GimpImage *gimage,
gimp_drawable_list_view_delete_dropped,
list_view);
if (gimage)
gimp_drawable_list_view_set_image (list_view, gimage);
gimp_drawable_list_view_set_image (list_view, gimage);
return GTK_WIDGET (list_view);
}
@ -481,6 +484,9 @@ gimp_drawable_list_view_real_set_image (GimpDrawableListView *view,
gtk_signal_disconnect_by_func (GTK_OBJECT (view->gimage),
gimp_drawable_list_view_size_changed,
view);
gtk_signal_disconnect_by_func (GTK_OBJECT (view->gimage),
gimp_drawable_list_view_floating_selection_changed,
view);
gimp_container_view_set_container (GIMP_CONTAINER_VIEW (view), NULL);
}
@ -501,8 +507,14 @@ gimp_drawable_list_view_real_set_image (GimpDrawableListView *view,
gtk_signal_connect (GTK_OBJECT (view->gimage), "size_changed",
GTK_SIGNAL_FUNC (gimp_drawable_list_view_size_changed),
view);
gtk_signal_connect (GTK_OBJECT (view->gimage), "floating_selection_changed",
GTK_SIGNAL_FUNC (gimp_drawable_list_view_floating_selection_changed),
view);
gimp_drawable_list_view_drawable_changed (view->gimage, view);
if (gimp_image_floating_sel (view->gimage))
gimp_drawable_list_view_floating_selection_changed (view->gimage, view);
}
gtk_widget_set_sensitive (view->new_button, (view->gimage != NULL));
@ -891,3 +903,28 @@ gimp_drawable_list_view_size_changed (GimpImage *gimage,
gimp_container_view_set_preview_size (GIMP_CONTAINER_VIEW (view),
preview_size);
}
static void
gimp_drawable_list_view_floating_selection_changed (GimpImage *gimage,
GimpDrawableListView *view)
{
GimpViewable *floating_sel;
GList *list;
floating_sel = (GimpViewable *) gimp_image_floating_sel (gimage);
for (list = GTK_LIST (GIMP_CONTAINER_LIST_VIEW (view)->gtk_list)->children;
list;
list = g_list_next (list))
{
if (! (GIMP_PREVIEW (GIMP_LIST_ITEM (list->data)->preview)->viewable ==
floating_sel))
{
gtk_widget_set_sensitive (GTK_WIDGET (list->data),
floating_sel == NULL);
}
}
/* update button states */
gimp_drawable_list_view_drawable_changed (gimage, view);
}

View File

@ -43,6 +43,7 @@
#include "gimpdrawablelistview.h"
#include "gimplayerlistview.h"
#include "gimplistitem.h"
#include "gimppreview.h"
#include "libgimp/gimpintl.h"
@ -130,6 +131,9 @@ static void gimp_drawable_list_view_drawable_changed (GimpImage *g
GimpDrawableListView *view);
static void gimp_drawable_list_view_size_changed (GimpImage *gimage,
GimpDrawableListView *view);
static void gimp_drawable_list_view_floating_selection_changed
(GimpImage *gimage,
GimpDrawableListView *view);
static guint view_signals[LAST_SIGNAL] = { 0 };
@ -445,8 +449,7 @@ gimp_drawable_list_view_new (GimpImage *gimage,
gimp_drawable_list_view_delete_dropped,
list_view);
if (gimage)
gimp_drawable_list_view_set_image (list_view, gimage);
gimp_drawable_list_view_set_image (list_view, gimage);
return GTK_WIDGET (list_view);
}
@ -481,6 +484,9 @@ gimp_drawable_list_view_real_set_image (GimpDrawableListView *view,
gtk_signal_disconnect_by_func (GTK_OBJECT (view->gimage),
gimp_drawable_list_view_size_changed,
view);
gtk_signal_disconnect_by_func (GTK_OBJECT (view->gimage),
gimp_drawable_list_view_floating_selection_changed,
view);
gimp_container_view_set_container (GIMP_CONTAINER_VIEW (view), NULL);
}
@ -501,8 +507,14 @@ gimp_drawable_list_view_real_set_image (GimpDrawableListView *view,
gtk_signal_connect (GTK_OBJECT (view->gimage), "size_changed",
GTK_SIGNAL_FUNC (gimp_drawable_list_view_size_changed),
view);
gtk_signal_connect (GTK_OBJECT (view->gimage), "floating_selection_changed",
GTK_SIGNAL_FUNC (gimp_drawable_list_view_floating_selection_changed),
view);
gimp_drawable_list_view_drawable_changed (view->gimage, view);
if (gimp_image_floating_sel (view->gimage))
gimp_drawable_list_view_floating_selection_changed (view->gimage, view);
}
gtk_widget_set_sensitive (view->new_button, (view->gimage != NULL));
@ -891,3 +903,28 @@ gimp_drawable_list_view_size_changed (GimpImage *gimage,
gimp_container_view_set_preview_size (GIMP_CONTAINER_VIEW (view),
preview_size);
}
static void
gimp_drawable_list_view_floating_selection_changed (GimpImage *gimage,
GimpDrawableListView *view)
{
GimpViewable *floating_sel;
GList *list;
floating_sel = (GimpViewable *) gimp_image_floating_sel (gimage);
for (list = GTK_LIST (GIMP_CONTAINER_LIST_VIEW (view)->gtk_list)->children;
list;
list = g_list_next (list))
{
if (! (GIMP_PREVIEW (GIMP_LIST_ITEM (list->data)->preview)->viewable ==
floating_sel))
{
gtk_widget_set_sensitive (GTK_WIDGET (list->data),
floating_sel == NULL);
}
}
/* update button states */
gimp_drawable_list_view_drawable_changed (gimage, view);
}

View File

@ -43,6 +43,7 @@
#include "gimpdrawablelistview.h"
#include "gimplayerlistview.h"
#include "gimplistitem.h"
#include "gimppreview.h"
#include "libgimp/gimpintl.h"
@ -130,6 +131,9 @@ static void gimp_drawable_list_view_drawable_changed (GimpImage *g
GimpDrawableListView *view);
static void gimp_drawable_list_view_size_changed (GimpImage *gimage,
GimpDrawableListView *view);
static void gimp_drawable_list_view_floating_selection_changed
(GimpImage *gimage,
GimpDrawableListView *view);
static guint view_signals[LAST_SIGNAL] = { 0 };
@ -445,8 +449,7 @@ gimp_drawable_list_view_new (GimpImage *gimage,
gimp_drawable_list_view_delete_dropped,
list_view);
if (gimage)
gimp_drawable_list_view_set_image (list_view, gimage);
gimp_drawable_list_view_set_image (list_view, gimage);
return GTK_WIDGET (list_view);
}
@ -481,6 +484,9 @@ gimp_drawable_list_view_real_set_image (GimpDrawableListView *view,
gtk_signal_disconnect_by_func (GTK_OBJECT (view->gimage),
gimp_drawable_list_view_size_changed,
view);
gtk_signal_disconnect_by_func (GTK_OBJECT (view->gimage),
gimp_drawable_list_view_floating_selection_changed,
view);
gimp_container_view_set_container (GIMP_CONTAINER_VIEW (view), NULL);
}
@ -501,8 +507,14 @@ gimp_drawable_list_view_real_set_image (GimpDrawableListView *view,
gtk_signal_connect (GTK_OBJECT (view->gimage), "size_changed",
GTK_SIGNAL_FUNC (gimp_drawable_list_view_size_changed),
view);
gtk_signal_connect (GTK_OBJECT (view->gimage), "floating_selection_changed",
GTK_SIGNAL_FUNC (gimp_drawable_list_view_floating_selection_changed),
view);
gimp_drawable_list_view_drawable_changed (view->gimage, view);
if (gimp_image_floating_sel (view->gimage))
gimp_drawable_list_view_floating_selection_changed (view->gimage, view);
}
gtk_widget_set_sensitive (view->new_button, (view->gimage != NULL));
@ -891,3 +903,28 @@ gimp_drawable_list_view_size_changed (GimpImage *gimage,
gimp_container_view_set_preview_size (GIMP_CONTAINER_VIEW (view),
preview_size);
}
static void
gimp_drawable_list_view_floating_selection_changed (GimpImage *gimage,
GimpDrawableListView *view)
{
GimpViewable *floating_sel;
GList *list;
floating_sel = (GimpViewable *) gimp_image_floating_sel (gimage);
for (list = GTK_LIST (GIMP_CONTAINER_LIST_VIEW (view)->gtk_list)->children;
list;
list = g_list_next (list))
{
if (! (GIMP_PREVIEW (GIMP_LIST_ITEM (list->data)->preview)->viewable ==
floating_sel))
{
gtk_widget_set_sensitive (GTK_WIDGET (list->data),
floating_sel == NULL);
}
}
/* update button states */
gimp_drawable_list_view_drawable_changed (gimage, view);
}

View File

@ -297,9 +297,12 @@ gimp_layer_list_view_select_item (GimpContainerView *view,
{
GimpDrawableListView *drawable_view;
GimpLayerListView *list_view;
gboolean options_sensitive = FALSE;
gboolean anchor_sensitive = FALSE;
gboolean raise_sensitive = FALSE;
gboolean options_sensitive = FALSE;
gboolean anchor_sensitive = FALSE;
gboolean raise_sensitive = FALSE;
gboolean lower_sensitive = FALSE;
gboolean duplicate_sensitive = FALSE;
gboolean edit_sensitive = FALSE;
list_view = GIMP_LAYER_LIST_VIEW (view);
drawable_view = GIMP_DRAWABLE_LIST_VIEW (view);
@ -319,17 +322,27 @@ gimp_layer_list_view_select_item (GimpContainerView *view,
{
anchor_sensitive = TRUE;
}
if (gimp_drawable_has_alpha (GIMP_DRAWABLE (item)) &&
gimp_container_get_child_index (view->container, GIMP_OBJECT (item)))
else
{
raise_sensitive = TRUE;
lower_sensitive = TRUE;
duplicate_sensitive = TRUE;
edit_sensitive = TRUE;
if (gimp_drawable_has_alpha (GIMP_DRAWABLE (item)) &&
gimp_container_get_child_index (view->container,
GIMP_OBJECT (item)))
{
raise_sensitive = TRUE;
}
}
}
gtk_widget_set_sensitive (list_view->options_box, options_sensitive);
gtk_widget_set_sensitive (list_view->anchor_button, anchor_sensitive);
gtk_widget_set_sensitive (drawable_view->raise_button, raise_sensitive);
gtk_widget_set_sensitive (list_view->options_box, options_sensitive);
gtk_widget_set_sensitive (drawable_view->raise_button, raise_sensitive);
gtk_widget_set_sensitive (drawable_view->lower_button, lower_sensitive);
gtk_widget_set_sensitive (drawable_view->duplicate_button, duplicate_sensitive);
gtk_widget_set_sensitive (drawable_view->edit_button, edit_sensitive);
gtk_widget_set_sensitive (list_view->anchor_button, anchor_sensitive);
}

View File

@ -297,9 +297,12 @@ gimp_layer_list_view_select_item (GimpContainerView *view,
{
GimpDrawableListView *drawable_view;
GimpLayerListView *list_view;
gboolean options_sensitive = FALSE;
gboolean anchor_sensitive = FALSE;
gboolean raise_sensitive = FALSE;
gboolean options_sensitive = FALSE;
gboolean anchor_sensitive = FALSE;
gboolean raise_sensitive = FALSE;
gboolean lower_sensitive = FALSE;
gboolean duplicate_sensitive = FALSE;
gboolean edit_sensitive = FALSE;
list_view = GIMP_LAYER_LIST_VIEW (view);
drawable_view = GIMP_DRAWABLE_LIST_VIEW (view);
@ -319,17 +322,27 @@ gimp_layer_list_view_select_item (GimpContainerView *view,
{
anchor_sensitive = TRUE;
}
if (gimp_drawable_has_alpha (GIMP_DRAWABLE (item)) &&
gimp_container_get_child_index (view->container, GIMP_OBJECT (item)))
else
{
raise_sensitive = TRUE;
lower_sensitive = TRUE;
duplicate_sensitive = TRUE;
edit_sensitive = TRUE;
if (gimp_drawable_has_alpha (GIMP_DRAWABLE (item)) &&
gimp_container_get_child_index (view->container,
GIMP_OBJECT (item)))
{
raise_sensitive = TRUE;
}
}
}
gtk_widget_set_sensitive (list_view->options_box, options_sensitive);
gtk_widget_set_sensitive (list_view->anchor_button, anchor_sensitive);
gtk_widget_set_sensitive (drawable_view->raise_button, raise_sensitive);
gtk_widget_set_sensitive (list_view->options_box, options_sensitive);
gtk_widget_set_sensitive (drawable_view->raise_button, raise_sensitive);
gtk_widget_set_sensitive (drawable_view->lower_button, lower_sensitive);
gtk_widget_set_sensitive (drawable_view->duplicate_button, duplicate_sensitive);
gtk_widget_set_sensitive (drawable_view->edit_button, edit_sensitive);
gtk_widget_set_sensitive (list_view->anchor_button, anchor_sensitive);
}

View File

@ -25,15 +25,18 @@
#include "apptypes.h"
#include "gimpcontainer.h"
#include "gimpdnd.h"
#include "gimpdrawable.h"
#include "gimpchannellistitem.h"
#include "gimpdrawablelistitem.h"
#include "gimplayer.h"
#include "gimplayerlistitem.h"
#include "gimplistitem.h"
#include "gimpmarshal.h"
#include "gimppreview.h"
#include "gimpchannel.h"
#include "gimpcontainer.h"
#include "gimpdrawable.h"
#include "gimplayer.h"
#include "gimpmarshal.h"
#include "gimpviewable.h"
@ -284,6 +287,10 @@ gimp_list_item_new (GimpViewable *viewable,
{
list_item = gtk_type_new (GIMP_TYPE_LAYER_LIST_ITEM);
}
else if (GIMP_IS_CHANNEL (viewable))
{
list_item = gtk_type_new (GIMP_TYPE_CHANNEL_LIST_ITEM);
}
else if (GIMP_IS_DRAWABLE (viewable))
{
list_item = gtk_type_new (GIMP_TYPE_DRAWABLE_LIST_ITEM);
@ -525,6 +532,30 @@ gimp_list_item_button_state_changed (GtkWidget *widget,
break;
}
}
else if (list_item->state == GTK_STATE_INSENSITIVE)
{
/* Don't look here, no, please...
*
* I said NO ...
*/
if (GTK_WIDGET_DRAWABLE (list_item))
{
GdkEventExpose event;
event.type = GDK_EXPOSE;
event.send_event = TRUE;
event.window = list_item->window;
event.area.x = widget->allocation.x;
event.area.y = widget->allocation.y;
event.area.width = widget->allocation.width;
event.area.height = widget->allocation.height;
event.count = 0;
gdk_window_ref (event.window);
gtk_widget_event (list_item, (GdkEvent*) &event);
gdk_window_unref (event.window);
}
}
}
static void

View File

@ -50,6 +50,7 @@ typedef struct _GimpLayerListView GimpLayerListView;
typedef struct _GimpChannelListView GimpChannelListView;
typedef struct _GimpListItem GimpListItem;
typedef struct _GimpChannelListItem GimpChannelListItem;
typedef struct _GimpDrawableListItem GimpDrawableListItem;
typedef struct _GimpLayerListItem GimpLayerListItem;
typedef struct _GimpComponentListItem GimpComponentListItem;