new function gimp_drawable_set_visible(). Renamed gimp_drawable_visible()

2001-03-04  Michael Natterer  <mitch@gimp.org>

	* app/gimpdrawable.[ch]: new function gimp_drawable_set_visible().
	Renamed gimp_drawable_visible() to gimp_drawable_get_visible().
	Added a "visibility_changed" signal.

	* app/gimplistitem.[ch]: new virtual function "set_viewable"
	which allows subclasses to connect to the viewable's signals.

	* app/gimpdrawablelistitem.[ch]: added an eye button. Implement
	"set_viewable" to connect to the "visibility_changed" signal.

	* app/gimpchannel.[ch]: removed unused function
	gimp_channel_toggle_visibility().

	* app/channels_dialog.c
	* app/floating_sel.c
	* app/gimage_mask.c
	* app/gimpimage.c
	* app/gimplayer.c
	* app/layers_dialog.c
	* app/xcf.c
	* app/pdb/channel_cmds.c
	* app/pdb/layer_cmds.c
	* app/pdb/pdb_glue.h
	* tools/pdbgen/pdb/channel.pdb
	* tools/pdbgen/pdb/layer.pdb: removed direct access of
	drawable->visible and use the functions instead. Also makes PDB
	code generation nicer.

	* pixmaps/eye.xpm: cropped it a bit.
This commit is contained in:
Michael Natterer 2001-03-04 16:52:37 +00:00 committed by Michael Natterer
parent 5d0edd70da
commit 65235b91a9
45 changed files with 929 additions and 270 deletions

View File

@ -1,3 +1,33 @@
2001-03-04 Michael Natterer <mitch@gimp.org>
* app/gimpdrawable.[ch]: new function gimp_drawable_set_visible().
Renamed gimp_drawable_visible() to gimp_drawable_get_visible().
Added a "visibility_changed" signal.
* app/gimpdrawablelistitem.[ch]
* app/gimplistitem.[ch]
* app/gimpchannel.[ch]: removed unused function
gimp_channel_toggle_visibility().
* app/channels_dialog.c
* app/floating_sel.c
* app/gimage_mask.c
* app/gimpimage.c
* app/gimplayer.c
* app/layers_dialog.c
* app/xcf.c
* app/pdb/channel_cmds.c
* app/pdb/layer_cmds.c
* app/pdb/pdb_glue.h
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: removed direct access of
drawable->visible and use the functions instead. Also makes PDB
code generation nicer.
* pixmaps/eye.xpm: cropped it a bit.
2001-03-04 Zbigniew Chyla <cyba@gnome.pl>
* app/commands.c (image_scale_callback),

View File

@ -1898,6 +1898,7 @@ channel_widget_button_events (GtkWidget *widget,
gpointer data)
{
ChannelWidget *channel_widget;
GimpChannel *channel;
GtkWidget *event_widget;
GdkEventButton *bevent;
gint return_val;
@ -1913,10 +1914,12 @@ channel_widget_button_events (GtkWidget *widget,
(ChannelWidget *) gtk_object_get_user_data (GTK_OBJECT (widget));
return_val = FALSE;
channel = channel_widget->channel;
switch (channel_widget->type)
{
case AUXILLARY_CHANNEL:
visible = GIMP_DRAWABLE (channel_widget->channel)->visible;
visible = gimp_drawable_get_visible (GIMP_DRAWABLE (channel));
width = GIMP_DRAWABLE (channel_widget->channel)->width;
height = GIMP_DRAWABLE (channel_widget->channel)->height;
break;
@ -1965,7 +1968,7 @@ channel_widget_button_events (GtkWidget *widget,
{
exclusive = FALSE;
if (channel_widget->type == AUXILLARY_CHANNEL)
GIMP_DRAWABLE (channel_widget->channel)->visible = !visible;
gimp_drawable_set_visible (GIMP_DRAWABLE (channel), ! visible);
else
gimp_image_set_component_visible (channel_widget->gimage,
channel_widget->type,
@ -2014,7 +2017,8 @@ channel_widget_button_events (GtkWidget *widget,
else
{
if (channel_widget->type == AUXILLARY_CHANNEL)
GIMP_DRAWABLE (channel_widget->channel)->visible = !visible;
gimp_drawable_set_visible (GIMP_DRAWABLE (channel),
! visible);
else
gimp_image_set_component_visible (channel_widget->gimage,
channel_widget->type,
@ -2306,7 +2310,8 @@ channel_widget_eye_redraw (ChannelWidget *channel_widget)
switch (channel_widget->type)
{
case AUXILLARY_CHANNEL:
visible = GIMP_DRAWABLE (channel_widget->channel)->visible;
visible =
gimp_drawable_get_visible (GIMP_DRAWABLE (channel_widget->channel));
break;
default:
visible = gimp_image_get_component_visible (channel_widget->gimage,
@ -2375,7 +2380,7 @@ channel_widget_exclusive_visible (ChannelWidget *channel_widget)
switch (cw->type)
{
case AUXILLARY_CHANNEL:
visible |= GIMP_DRAWABLE (cw->channel)->visible;
visible |= gimp_drawable_get_visible (GIMP_DRAWABLE (cw->channel));
break;
default:
visible |= gimp_image_get_component_visible (cw->gimage, cw->type);
@ -2393,7 +2398,7 @@ channel_widget_exclusive_visible (ChannelWidget *channel_widget)
switch (cw->type)
{
case AUXILLARY_CHANNEL:
GIMP_DRAWABLE (cw->channel)->visible = !visible;
gimp_drawable_set_visible (GIMP_DRAWABLE (cw->channel), ! visible);
break;
default:
gimp_image_set_component_visible (cw->gimage, cw->type, !visible);
@ -2403,7 +2408,7 @@ channel_widget_exclusive_visible (ChannelWidget *channel_widget)
switch (cw->type)
{
case AUXILLARY_CHANNEL:
GIMP_DRAWABLE (cw->channel)->visible = TRUE;
gimp_drawable_set_visible (GIMP_DRAWABLE (cw->channel), TRUE);
break;
default:
gimp_image_set_component_visible (cw->gimage, cw->type, TRUE);

View File

@ -204,7 +204,9 @@ gimp_channel_copy (const GimpChannel *channel)
GIMP_DRAWABLE (channel)->height,
channel_name,
&channel->color);
GIMP_DRAWABLE (new_channel)->visible = GIMP_DRAWABLE (channel)->visible;
new_channel->show_masked = channel->show_masked;
/* copy the contents across channels */
@ -413,14 +415,6 @@ gimp_channel_resize (GimpChannel *channel,
GIMP_DRAWABLE (channel)->height);
}
gboolean
gimp_channel_toggle_visibility (GimpChannel *channel)
{
GIMP_DRAWABLE (channel)->visible = !GIMP_DRAWABLE (channel)->visible;
return GIMP_DRAWABLE (channel)->visible;
}
/******************************/
/* selection mask functions */

View File

@ -109,7 +109,6 @@ void gimp_channel_resize (GimpChannel *channel,
gint offx,
gint offy);
gboolean gimp_channel_toggle_visibility (GimpChannel *channel);
/* selection mask functions */

View File

@ -204,7 +204,9 @@ gimp_channel_copy (const GimpChannel *channel)
GIMP_DRAWABLE (channel)->height,
channel_name,
&channel->color);
GIMP_DRAWABLE (new_channel)->visible = GIMP_DRAWABLE (channel)->visible;
new_channel->show_masked = channel->show_masked;
/* copy the contents across channels */
@ -413,14 +415,6 @@ gimp_channel_resize (GimpChannel *channel,
GIMP_DRAWABLE (channel)->height);
}
gboolean
gimp_channel_toggle_visibility (GimpChannel *channel)
{
GIMP_DRAWABLE (channel)->visible = !GIMP_DRAWABLE (channel)->visible;
return GIMP_DRAWABLE (channel)->visible;
}
/******************************/
/* selection mask functions */

View File

@ -109,7 +109,6 @@ void gimp_channel_resize (GimpChannel *channel,
gint offx,
gint offy);
gboolean gimp_channel_toggle_visibility (GimpChannel *channel);
/* selection mask functions */

View File

@ -52,6 +52,7 @@
enum
{
VISIBILITY_CHANGED,
REMOVED,
LAST_SIGNAL
};
@ -112,6 +113,15 @@ gimp_drawable_class_init (GimpDrawableClass *klass)
parent_class = gtk_type_class (GIMP_TYPE_VIEWABLE);
gimp_drawable_signals[VISIBILITY_CHANGED] =
gtk_signal_new ("visibility_changed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpDrawableClass,
visibility_changed),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gimp_drawable_signals[REMOVED] =
gtk_signal_new ("removed",
GTK_RUN_FIRST,
@ -346,8 +356,9 @@ gimp_drawable_configure (GimpDrawable *drawable,
if (drawable->tiles)
tile_manager_destroy (drawable->tiles);
drawable->tiles = tile_manager_new (width, height, bpp);
drawable->visible = TRUE;
drawable->tiles = tile_manager_new (width, height, bpp);
gimp_drawable_set_visible (drawable, TRUE);
if (gimage)
gimp_drawable_set_gimage (drawable, gimage);
@ -594,13 +605,32 @@ gimp_drawable_type_with_alpha (const GimpDrawable *drawable)
}
gboolean
gimp_drawable_visible (const GimpDrawable *drawable)
gimp_drawable_get_visible (const GimpDrawable *drawable)
{
g_return_val_if_fail (drawable != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
return drawable->visible;
}
void
gimp_drawable_set_visible (GimpDrawable *drawable,
gboolean visible)
{
g_return_if_fail (drawable != NULL);
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
visible = visible ? TRUE : FALSE;
if (drawable->visible != visible)
{
drawable->visible = visible;
gtk_signal_emit (GTK_OBJECT (drawable),
gimp_drawable_signals[VISIBILITY_CHANGED]);
}
}
guchar *
gimp_drawable_get_color_at (GimpDrawable *drawable,
gint x,

View File

@ -59,7 +59,8 @@ struct _GimpDrawableClass
{
GimpViewableClass parent_class;
void (* removed) (GimpDrawable *drawable);
void (* visibility_changed) (GimpDrawable *drawable);
void (* removed) (GimpDrawable *drawable);
};
@ -105,7 +106,9 @@ TileManager * gimp_drawable_shadow (GimpDrawable *drawable);
gint gimp_drawable_bytes (const GimpDrawable *drawable);
gint gimp_drawable_width (const GimpDrawable *drawable);
gint gimp_drawable_height (const GimpDrawable *drawable);
gboolean gimp_drawable_visible (const GimpDrawable *drawable);
gboolean gimp_drawable_get_visible (const GimpDrawable *drawable);
void gimp_drawable_set_visible (GimpDrawable *drawable,
gboolean visible);
void gimp_drawable_offsets (const GimpDrawable *drawable,
gint *offset_x,
gint *offset_y);

View File

@ -1695,8 +1695,10 @@ gimp_image_construct_layers (GimpImage *gimage,
/* only add layers that are visible and not floating selections
to the list */
if (! gimp_layer_is_floating_sel (layer) &&
gimp_drawable_visible (GIMP_DRAWABLE (layer)))
reverse_list = g_slist_prepend (reverse_list, layer);
gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
{
reverse_list = g_slist_prepend (reverse_list, layer);
}
}
while (reverse_list)
@ -1801,7 +1803,7 @@ gimp_image_construct_channels (GimpImage *gimage,
{
channel = (GimpChannel *) reverse_list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (channel)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (channel)))
{
/* configure the pixel regions */
pixel_region_init (&src1PR,
@ -1852,7 +1854,7 @@ gimp_image_initialize_projection (GimpImage *gimage,
layer = (GimpLayer *) list->data;
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)) &&
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)) &&
! gimp_layer_has_alpha (layer) &&
(off_x <= x) &&
(off_y <= y) &&
@ -1931,7 +1933,7 @@ gimp_image_construct (GimpImage *gimage,
(! g_slist_next (gimage->layers)) && /* It's the only layer. */
(gimp_layer_has_alpha ((GimpLayer *) (gimage->layers->data))) && /* It's !flat. */
/* It's visible. */
(gimp_drawable_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
(gimp_drawable_get_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
(gimp_drawable_width (GIMP_DRAWABLE (gimage->layers->data)) ==
gimage->width) &&
(gimp_drawable_height (GIMP_DRAWABLE (gimage->layers->data)) ==
@ -2730,7 +2732,7 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
{
layer = (GimpLayer *) list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
merge_list = g_slist_append (merge_list, layer);
}
@ -2781,7 +2783,7 @@ gimp_image_flatten (GimpImage *gimage)
{
layer = (GimpLayer *) list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
merge_list = g_slist_append (merge_list, layer);
}
@ -2821,7 +2823,7 @@ gimp_image_merge_down (GimpImage *gimage,
{
layer = (GimpLayer *) layer_list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
merge_list = g_slist_append (NULL, layer);
}
@ -3137,7 +3139,7 @@ gimp_image_merge_layers (GimpImage *gimage,
undo_push_group_end (gimage);
/* Update the gimage */
GIMP_DRAWABLE (merge_layer)->visible = TRUE;
gimp_drawable_set_visible (GIMP_DRAWABLE (merge_layer), TRUE);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[RESTRUCTURE]);
@ -3540,7 +3542,7 @@ gimp_image_add_channel (GimpImage *gimage,
gimp_image_set_active_channel (gimage, channel);
/* if channel is visible, update the image */
if (gimp_drawable_visible (GIMP_DRAWABLE (channel)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (channel)))
drawable_update (GIMP_DRAWABLE (channel),
0, 0,
gimp_drawable_width (GIMP_DRAWABLE (channel)),
@ -3977,7 +3979,7 @@ gimp_image_get_new_preview (GimpViewable *viewable,
layer = (GimpLayer *) list->data;
/* only add layers that are visible to the list */
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
{
/* floating selections are added right above the layer
they are attached to */

View File

@ -557,7 +557,8 @@ gimage_mask_save (GImage *gimage)
new_channel = gimp_channel_copy (gimp_image_get_mask (gimage));
/* saved selections are not visible by default */
GIMP_DRAWABLE(new_channel)->visible = FALSE;
gimp_drawable_set_visible (GIMP_DRAWABLE (new_channel), FALSE);
gimp_image_add_channel (gimage, new_channel, -1);
return new_channel;

View File

@ -1695,8 +1695,10 @@ gimp_image_construct_layers (GimpImage *gimage,
/* only add layers that are visible and not floating selections
to the list */
if (! gimp_layer_is_floating_sel (layer) &&
gimp_drawable_visible (GIMP_DRAWABLE (layer)))
reverse_list = g_slist_prepend (reverse_list, layer);
gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
{
reverse_list = g_slist_prepend (reverse_list, layer);
}
}
while (reverse_list)
@ -1801,7 +1803,7 @@ gimp_image_construct_channels (GimpImage *gimage,
{
channel = (GimpChannel *) reverse_list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (channel)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (channel)))
{
/* configure the pixel regions */
pixel_region_init (&src1PR,
@ -1852,7 +1854,7 @@ gimp_image_initialize_projection (GimpImage *gimage,
layer = (GimpLayer *) list->data;
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)) &&
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)) &&
! gimp_layer_has_alpha (layer) &&
(off_x <= x) &&
(off_y <= y) &&
@ -1931,7 +1933,7 @@ gimp_image_construct (GimpImage *gimage,
(! g_slist_next (gimage->layers)) && /* It's the only layer. */
(gimp_layer_has_alpha ((GimpLayer *) (gimage->layers->data))) && /* It's !flat. */
/* It's visible. */
(gimp_drawable_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
(gimp_drawable_get_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
(gimp_drawable_width (GIMP_DRAWABLE (gimage->layers->data)) ==
gimage->width) &&
(gimp_drawable_height (GIMP_DRAWABLE (gimage->layers->data)) ==
@ -2730,7 +2732,7 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
{
layer = (GimpLayer *) list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
merge_list = g_slist_append (merge_list, layer);
}
@ -2781,7 +2783,7 @@ gimp_image_flatten (GimpImage *gimage)
{
layer = (GimpLayer *) list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
merge_list = g_slist_append (merge_list, layer);
}
@ -2821,7 +2823,7 @@ gimp_image_merge_down (GimpImage *gimage,
{
layer = (GimpLayer *) layer_list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
merge_list = g_slist_append (NULL, layer);
}
@ -3137,7 +3139,7 @@ gimp_image_merge_layers (GimpImage *gimage,
undo_push_group_end (gimage);
/* Update the gimage */
GIMP_DRAWABLE (merge_layer)->visible = TRUE;
gimp_drawable_set_visible (GIMP_DRAWABLE (merge_layer), TRUE);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[RESTRUCTURE]);
@ -3540,7 +3542,7 @@ gimp_image_add_channel (GimpImage *gimage,
gimp_image_set_active_channel (gimage, channel);
/* if channel is visible, update the image */
if (gimp_drawable_visible (GIMP_DRAWABLE (channel)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (channel)))
drawable_update (GIMP_DRAWABLE (channel),
0, 0,
gimp_drawable_width (GIMP_DRAWABLE (channel)),
@ -3977,7 +3979,7 @@ gimp_image_get_new_preview (GimpViewable *viewable,
layer = (GimpLayer *) list->data;
/* only add layers that are visible to the list */
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
{
/* floating selections are added right above the layer
they are attached to */

View File

@ -1695,8 +1695,10 @@ gimp_image_construct_layers (GimpImage *gimage,
/* only add layers that are visible and not floating selections
to the list */
if (! gimp_layer_is_floating_sel (layer) &&
gimp_drawable_visible (GIMP_DRAWABLE (layer)))
reverse_list = g_slist_prepend (reverse_list, layer);
gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
{
reverse_list = g_slist_prepend (reverse_list, layer);
}
}
while (reverse_list)
@ -1801,7 +1803,7 @@ gimp_image_construct_channels (GimpImage *gimage,
{
channel = (GimpChannel *) reverse_list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (channel)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (channel)))
{
/* configure the pixel regions */
pixel_region_init (&src1PR,
@ -1852,7 +1854,7 @@ gimp_image_initialize_projection (GimpImage *gimage,
layer = (GimpLayer *) list->data;
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)) &&
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)) &&
! gimp_layer_has_alpha (layer) &&
(off_x <= x) &&
(off_y <= y) &&
@ -1931,7 +1933,7 @@ gimp_image_construct (GimpImage *gimage,
(! g_slist_next (gimage->layers)) && /* It's the only layer. */
(gimp_layer_has_alpha ((GimpLayer *) (gimage->layers->data))) && /* It's !flat. */
/* It's visible. */
(gimp_drawable_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
(gimp_drawable_get_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
(gimp_drawable_width (GIMP_DRAWABLE (gimage->layers->data)) ==
gimage->width) &&
(gimp_drawable_height (GIMP_DRAWABLE (gimage->layers->data)) ==
@ -2730,7 +2732,7 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
{
layer = (GimpLayer *) list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
merge_list = g_slist_append (merge_list, layer);
}
@ -2781,7 +2783,7 @@ gimp_image_flatten (GimpImage *gimage)
{
layer = (GimpLayer *) list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
merge_list = g_slist_append (merge_list, layer);
}
@ -2821,7 +2823,7 @@ gimp_image_merge_down (GimpImage *gimage,
{
layer = (GimpLayer *) layer_list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
merge_list = g_slist_append (NULL, layer);
}
@ -3137,7 +3139,7 @@ gimp_image_merge_layers (GimpImage *gimage,
undo_push_group_end (gimage);
/* Update the gimage */
GIMP_DRAWABLE (merge_layer)->visible = TRUE;
gimp_drawable_set_visible (GIMP_DRAWABLE (merge_layer), TRUE);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[RESTRUCTURE]);
@ -3540,7 +3542,7 @@ gimp_image_add_channel (GimpImage *gimage,
gimp_image_set_active_channel (gimage, channel);
/* if channel is visible, update the image */
if (gimp_drawable_visible (GIMP_DRAWABLE (channel)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (channel)))
drawable_update (GIMP_DRAWABLE (channel),
0, 0,
gimp_drawable_width (GIMP_DRAWABLE (channel)),
@ -3977,7 +3979,7 @@ gimp_image_get_new_preview (GimpViewable *viewable,
layer = (GimpLayer *) list->data;
/* only add layers that are visible to the list */
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
{
/* floating selections are added right above the layer
they are attached to */

View File

@ -1695,8 +1695,10 @@ gimp_image_construct_layers (GimpImage *gimage,
/* only add layers that are visible and not floating selections
to the list */
if (! gimp_layer_is_floating_sel (layer) &&
gimp_drawable_visible (GIMP_DRAWABLE (layer)))
reverse_list = g_slist_prepend (reverse_list, layer);
gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
{
reverse_list = g_slist_prepend (reverse_list, layer);
}
}
while (reverse_list)
@ -1801,7 +1803,7 @@ gimp_image_construct_channels (GimpImage *gimage,
{
channel = (GimpChannel *) reverse_list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (channel)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (channel)))
{
/* configure the pixel regions */
pixel_region_init (&src1PR,
@ -1852,7 +1854,7 @@ gimp_image_initialize_projection (GimpImage *gimage,
layer = (GimpLayer *) list->data;
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)) &&
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)) &&
! gimp_layer_has_alpha (layer) &&
(off_x <= x) &&
(off_y <= y) &&
@ -1931,7 +1933,7 @@ gimp_image_construct (GimpImage *gimage,
(! g_slist_next (gimage->layers)) && /* It's the only layer. */
(gimp_layer_has_alpha ((GimpLayer *) (gimage->layers->data))) && /* It's !flat. */
/* It's visible. */
(gimp_drawable_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
(gimp_drawable_get_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
(gimp_drawable_width (GIMP_DRAWABLE (gimage->layers->data)) ==
gimage->width) &&
(gimp_drawable_height (GIMP_DRAWABLE (gimage->layers->data)) ==
@ -2730,7 +2732,7 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
{
layer = (GimpLayer *) list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
merge_list = g_slist_append (merge_list, layer);
}
@ -2781,7 +2783,7 @@ gimp_image_flatten (GimpImage *gimage)
{
layer = (GimpLayer *) list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
merge_list = g_slist_append (merge_list, layer);
}
@ -2821,7 +2823,7 @@ gimp_image_merge_down (GimpImage *gimage,
{
layer = (GimpLayer *) layer_list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
merge_list = g_slist_append (NULL, layer);
}
@ -3137,7 +3139,7 @@ gimp_image_merge_layers (GimpImage *gimage,
undo_push_group_end (gimage);
/* Update the gimage */
GIMP_DRAWABLE (merge_layer)->visible = TRUE;
gimp_drawable_set_visible (GIMP_DRAWABLE (merge_layer), TRUE);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[RESTRUCTURE]);
@ -3540,7 +3542,7 @@ gimp_image_add_channel (GimpImage *gimage,
gimp_image_set_active_channel (gimage, channel);
/* if channel is visible, update the image */
if (gimp_drawable_visible (GIMP_DRAWABLE (channel)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (channel)))
drawable_update (GIMP_DRAWABLE (channel),
0, 0,
gimp_drawable_width (GIMP_DRAWABLE (channel)),
@ -3977,7 +3979,7 @@ gimp_image_get_new_preview (GimpViewable *viewable,
layer = (GimpLayer *) list->data;
/* only add layers that are visible to the list */
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
{
/* floating selections are added right above the layer
they are attached to */

View File

@ -1695,8 +1695,10 @@ gimp_image_construct_layers (GimpImage *gimage,
/* only add layers that are visible and not floating selections
to the list */
if (! gimp_layer_is_floating_sel (layer) &&
gimp_drawable_visible (GIMP_DRAWABLE (layer)))
reverse_list = g_slist_prepend (reverse_list, layer);
gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
{
reverse_list = g_slist_prepend (reverse_list, layer);
}
}
while (reverse_list)
@ -1801,7 +1803,7 @@ gimp_image_construct_channels (GimpImage *gimage,
{
channel = (GimpChannel *) reverse_list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (channel)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (channel)))
{
/* configure the pixel regions */
pixel_region_init (&src1PR,
@ -1852,7 +1854,7 @@ gimp_image_initialize_projection (GimpImage *gimage,
layer = (GimpLayer *) list->data;
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)) &&
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)) &&
! gimp_layer_has_alpha (layer) &&
(off_x <= x) &&
(off_y <= y) &&
@ -1931,7 +1933,7 @@ gimp_image_construct (GimpImage *gimage,
(! g_slist_next (gimage->layers)) && /* It's the only layer. */
(gimp_layer_has_alpha ((GimpLayer *) (gimage->layers->data))) && /* It's !flat. */
/* It's visible. */
(gimp_drawable_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
(gimp_drawable_get_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
(gimp_drawable_width (GIMP_DRAWABLE (gimage->layers->data)) ==
gimage->width) &&
(gimp_drawable_height (GIMP_DRAWABLE (gimage->layers->data)) ==
@ -2730,7 +2732,7 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
{
layer = (GimpLayer *) list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
merge_list = g_slist_append (merge_list, layer);
}
@ -2781,7 +2783,7 @@ gimp_image_flatten (GimpImage *gimage)
{
layer = (GimpLayer *) list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
merge_list = g_slist_append (merge_list, layer);
}
@ -2821,7 +2823,7 @@ gimp_image_merge_down (GimpImage *gimage,
{
layer = (GimpLayer *) layer_list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
merge_list = g_slist_append (NULL, layer);
}
@ -3137,7 +3139,7 @@ gimp_image_merge_layers (GimpImage *gimage,
undo_push_group_end (gimage);
/* Update the gimage */
GIMP_DRAWABLE (merge_layer)->visible = TRUE;
gimp_drawable_set_visible (GIMP_DRAWABLE (merge_layer), TRUE);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[RESTRUCTURE]);
@ -3540,7 +3542,7 @@ gimp_image_add_channel (GimpImage *gimage,
gimp_image_set_active_channel (gimage, channel);
/* if channel is visible, update the image */
if (gimp_drawable_visible (GIMP_DRAWABLE (channel)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (channel)))
drawable_update (GIMP_DRAWABLE (channel),
0, 0,
gimp_drawable_width (GIMP_DRAWABLE (channel)),
@ -3977,7 +3979,7 @@ gimp_image_get_new_preview (GimpViewable *viewable,
layer = (GimpLayer *) list->data;
/* only add layers that are visible to the list */
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
{
/* floating selections are added right above the layer
they are attached to */

View File

@ -1695,8 +1695,10 @@ gimp_image_construct_layers (GimpImage *gimage,
/* only add layers that are visible and not floating selections
to the list */
if (! gimp_layer_is_floating_sel (layer) &&
gimp_drawable_visible (GIMP_DRAWABLE (layer)))
reverse_list = g_slist_prepend (reverse_list, layer);
gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
{
reverse_list = g_slist_prepend (reverse_list, layer);
}
}
while (reverse_list)
@ -1801,7 +1803,7 @@ gimp_image_construct_channels (GimpImage *gimage,
{
channel = (GimpChannel *) reverse_list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (channel)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (channel)))
{
/* configure the pixel regions */
pixel_region_init (&src1PR,
@ -1852,7 +1854,7 @@ gimp_image_initialize_projection (GimpImage *gimage,
layer = (GimpLayer *) list->data;
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)) &&
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)) &&
! gimp_layer_has_alpha (layer) &&
(off_x <= x) &&
(off_y <= y) &&
@ -1931,7 +1933,7 @@ gimp_image_construct (GimpImage *gimage,
(! g_slist_next (gimage->layers)) && /* It's the only layer. */
(gimp_layer_has_alpha ((GimpLayer *) (gimage->layers->data))) && /* It's !flat. */
/* It's visible. */
(gimp_drawable_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
(gimp_drawable_get_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
(gimp_drawable_width (GIMP_DRAWABLE (gimage->layers->data)) ==
gimage->width) &&
(gimp_drawable_height (GIMP_DRAWABLE (gimage->layers->data)) ==
@ -2730,7 +2732,7 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
{
layer = (GimpLayer *) list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
merge_list = g_slist_append (merge_list, layer);
}
@ -2781,7 +2783,7 @@ gimp_image_flatten (GimpImage *gimage)
{
layer = (GimpLayer *) list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
merge_list = g_slist_append (merge_list, layer);
}
@ -2821,7 +2823,7 @@ gimp_image_merge_down (GimpImage *gimage,
{
layer = (GimpLayer *) layer_list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
merge_list = g_slist_append (NULL, layer);
}
@ -3137,7 +3139,7 @@ gimp_image_merge_layers (GimpImage *gimage,
undo_push_group_end (gimage);
/* Update the gimage */
GIMP_DRAWABLE (merge_layer)->visible = TRUE;
gimp_drawable_set_visible (GIMP_DRAWABLE (merge_layer), TRUE);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[RESTRUCTURE]);
@ -3540,7 +3542,7 @@ gimp_image_add_channel (GimpImage *gimage,
gimp_image_set_active_channel (gimage, channel);
/* if channel is visible, update the image */
if (gimp_drawable_visible (GIMP_DRAWABLE (channel)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (channel)))
drawable_update (GIMP_DRAWABLE (channel),
0, 0,
gimp_drawable_width (GIMP_DRAWABLE (channel)),
@ -3977,7 +3979,7 @@ gimp_image_get_new_preview (GimpViewable *viewable,
layer = (GimpLayer *) list->data;
/* only add layers that are visible to the list */
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
{
/* floating selections are added right above the layer
they are attached to */

View File

@ -220,7 +220,7 @@ floating_sel_to_layer (GimpLayer *layer)
/* Set pointers */
layer->fs.drawable = NULL;
gimage->floating_sel = NULL;
GIMP_DRAWABLE (layer)->visible = TRUE;
gimp_drawable_set_visible (GIMP_DRAWABLE (layer), TRUE);
/* if the floating selection exceeds the attached layer's extents,
update the new layer */
@ -406,14 +406,18 @@ floating_sel_composite (GimpLayer *layer,
* is constructed, before any other composition takes place.
*/
/* If this isn't the first composite, restore the image underneath */
/* If this isn't the first composite,
* restore the image underneath
*/
if (! layer->fs.initial)
floating_sel_restore (layer, x, y, w, h);
else if (GIMP_DRAWABLE(layer)->visible)
else if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
layer->fs.initial = FALSE;
/* First restore what's behind the image if necessary, then check for visibility */
if (GIMP_DRAWABLE(layer)->visible)
/* First restore what's behind the image if necessary,
* then check for visibility
*/
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
{
/* Find the minimum area we need to composite -- in gimage space */
gimp_drawable_offsets (layer->fs.drawable, &offx, &offy);

View File

@ -291,6 +291,7 @@ gimp_layer_copy (GimpLayer *layer,
GIMP_DRAWABLE (new_layer)->offset_x = GIMP_DRAWABLE (layer)->offset_x;
GIMP_DRAWABLE (new_layer)->offset_y = GIMP_DRAWABLE (layer)->offset_y;
GIMP_DRAWABLE (new_layer)->visible = GIMP_DRAWABLE (layer)->visible;
new_layer->linked = layer->linked;
new_layer->preserve_trans = layer->preserve_trans;
@ -1186,7 +1187,7 @@ gimp_layer_pick_correlate (GimpLayer *layer,
if (x >= 0 && x < GIMP_DRAWABLE (layer)->width &&
y >= 0 && y < GIMP_DRAWABLE (layer)->height &&
GIMP_DRAWABLE (layer)->visible)
gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
{
/* If the point is inside, and the layer has no
* alpha channel, success!

View File

@ -1695,8 +1695,10 @@ gimp_image_construct_layers (GimpImage *gimage,
/* only add layers that are visible and not floating selections
to the list */
if (! gimp_layer_is_floating_sel (layer) &&
gimp_drawable_visible (GIMP_DRAWABLE (layer)))
reverse_list = g_slist_prepend (reverse_list, layer);
gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
{
reverse_list = g_slist_prepend (reverse_list, layer);
}
}
while (reverse_list)
@ -1801,7 +1803,7 @@ gimp_image_construct_channels (GimpImage *gimage,
{
channel = (GimpChannel *) reverse_list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (channel)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (channel)))
{
/* configure the pixel regions */
pixel_region_init (&src1PR,
@ -1852,7 +1854,7 @@ gimp_image_initialize_projection (GimpImage *gimage,
layer = (GimpLayer *) list->data;
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)) &&
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)) &&
! gimp_layer_has_alpha (layer) &&
(off_x <= x) &&
(off_y <= y) &&
@ -1931,7 +1933,7 @@ gimp_image_construct (GimpImage *gimage,
(! g_slist_next (gimage->layers)) && /* It's the only layer. */
(gimp_layer_has_alpha ((GimpLayer *) (gimage->layers->data))) && /* It's !flat. */
/* It's visible. */
(gimp_drawable_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
(gimp_drawable_get_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
(gimp_drawable_width (GIMP_DRAWABLE (gimage->layers->data)) ==
gimage->width) &&
(gimp_drawable_height (GIMP_DRAWABLE (gimage->layers->data)) ==
@ -2730,7 +2732,7 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
{
layer = (GimpLayer *) list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
merge_list = g_slist_append (merge_list, layer);
}
@ -2781,7 +2783,7 @@ gimp_image_flatten (GimpImage *gimage)
{
layer = (GimpLayer *) list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
merge_list = g_slist_append (merge_list, layer);
}
@ -2821,7 +2823,7 @@ gimp_image_merge_down (GimpImage *gimage,
{
layer = (GimpLayer *) layer_list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
merge_list = g_slist_append (NULL, layer);
}
@ -3137,7 +3139,7 @@ gimp_image_merge_layers (GimpImage *gimage,
undo_push_group_end (gimage);
/* Update the gimage */
GIMP_DRAWABLE (merge_layer)->visible = TRUE;
gimp_drawable_set_visible (GIMP_DRAWABLE (merge_layer), TRUE);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[RESTRUCTURE]);
@ -3540,7 +3542,7 @@ gimp_image_add_channel (GimpImage *gimage,
gimp_image_set_active_channel (gimage, channel);
/* if channel is visible, update the image */
if (gimp_drawable_visible (GIMP_DRAWABLE (channel)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (channel)))
drawable_update (GIMP_DRAWABLE (channel),
0, 0,
gimp_drawable_width (GIMP_DRAWABLE (channel)),
@ -3977,7 +3979,7 @@ gimp_image_get_new_preview (GimpViewable *viewable,
layer = (GimpLayer *) list->data;
/* only add layers that are visible to the list */
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
{
/* floating selections are added right above the layer
they are attached to */

View File

@ -220,7 +220,7 @@ floating_sel_to_layer (GimpLayer *layer)
/* Set pointers */
layer->fs.drawable = NULL;
gimage->floating_sel = NULL;
GIMP_DRAWABLE (layer)->visible = TRUE;
gimp_drawable_set_visible (GIMP_DRAWABLE (layer), TRUE);
/* if the floating selection exceeds the attached layer's extents,
update the new layer */
@ -406,14 +406,18 @@ floating_sel_composite (GimpLayer *layer,
* is constructed, before any other composition takes place.
*/
/* If this isn't the first composite, restore the image underneath */
/* If this isn't the first composite,
* restore the image underneath
*/
if (! layer->fs.initial)
floating_sel_restore (layer, x, y, w, h);
else if (GIMP_DRAWABLE(layer)->visible)
else if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
layer->fs.initial = FALSE;
/* First restore what's behind the image if necessary, then check for visibility */
if (GIMP_DRAWABLE(layer)->visible)
/* First restore what's behind the image if necessary,
* then check for visibility
*/
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
{
/* Find the minimum area we need to composite -- in gimage space */
gimp_drawable_offsets (layer->fs.drawable, &offx, &offy);

View File

@ -557,7 +557,8 @@ gimage_mask_save (GImage *gimage)
new_channel = gimp_channel_copy (gimp_image_get_mask (gimage));
/* saved selections are not visible by default */
GIMP_DRAWABLE(new_channel)->visible = FALSE;
gimp_drawable_set_visible (GIMP_DRAWABLE (new_channel), FALSE);
gimp_image_add_channel (gimage, new_channel, -1);
return new_channel;

View File

@ -204,7 +204,9 @@ gimp_channel_copy (const GimpChannel *channel)
GIMP_DRAWABLE (channel)->height,
channel_name,
&channel->color);
GIMP_DRAWABLE (new_channel)->visible = GIMP_DRAWABLE (channel)->visible;
new_channel->show_masked = channel->show_masked;
/* copy the contents across channels */
@ -413,14 +415,6 @@ gimp_channel_resize (GimpChannel *channel,
GIMP_DRAWABLE (channel)->height);
}
gboolean
gimp_channel_toggle_visibility (GimpChannel *channel)
{
GIMP_DRAWABLE (channel)->visible = !GIMP_DRAWABLE (channel)->visible;
return GIMP_DRAWABLE (channel)->visible;
}
/******************************/
/* selection mask functions */

View File

@ -109,7 +109,6 @@ void gimp_channel_resize (GimpChannel *channel,
gint offx,
gint offy);
gboolean gimp_channel_toggle_visibility (GimpChannel *channel);
/* selection mask functions */

View File

@ -52,6 +52,7 @@
enum
{
VISIBILITY_CHANGED,
REMOVED,
LAST_SIGNAL
};
@ -112,6 +113,15 @@ gimp_drawable_class_init (GimpDrawableClass *klass)
parent_class = gtk_type_class (GIMP_TYPE_VIEWABLE);
gimp_drawable_signals[VISIBILITY_CHANGED] =
gtk_signal_new ("visibility_changed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpDrawableClass,
visibility_changed),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gimp_drawable_signals[REMOVED] =
gtk_signal_new ("removed",
GTK_RUN_FIRST,
@ -346,8 +356,9 @@ gimp_drawable_configure (GimpDrawable *drawable,
if (drawable->tiles)
tile_manager_destroy (drawable->tiles);
drawable->tiles = tile_manager_new (width, height, bpp);
drawable->visible = TRUE;
drawable->tiles = tile_manager_new (width, height, bpp);
gimp_drawable_set_visible (drawable, TRUE);
if (gimage)
gimp_drawable_set_gimage (drawable, gimage);
@ -594,13 +605,32 @@ gimp_drawable_type_with_alpha (const GimpDrawable *drawable)
}
gboolean
gimp_drawable_visible (const GimpDrawable *drawable)
gimp_drawable_get_visible (const GimpDrawable *drawable)
{
g_return_val_if_fail (drawable != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
return drawable->visible;
}
void
gimp_drawable_set_visible (GimpDrawable *drawable,
gboolean visible)
{
g_return_if_fail (drawable != NULL);
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
visible = visible ? TRUE : FALSE;
if (drawable->visible != visible)
{
drawable->visible = visible;
gtk_signal_emit (GTK_OBJECT (drawable),
gimp_drawable_signals[VISIBILITY_CHANGED]);
}
}
guchar *
gimp_drawable_get_color_at (GimpDrawable *drawable,
gint x,

View File

@ -59,7 +59,8 @@ struct _GimpDrawableClass
{
GimpViewableClass parent_class;
void (* removed) (GimpDrawable *drawable);
void (* visibility_changed) (GimpDrawable *drawable);
void (* removed) (GimpDrawable *drawable);
};
@ -105,7 +106,9 @@ TileManager * gimp_drawable_shadow (GimpDrawable *drawable);
gint gimp_drawable_bytes (const GimpDrawable *drawable);
gint gimp_drawable_width (const GimpDrawable *drawable);
gint gimp_drawable_height (const GimpDrawable *drawable);
gboolean gimp_drawable_visible (const GimpDrawable *drawable);
gboolean gimp_drawable_get_visible (const GimpDrawable *drawable);
void gimp_drawable_set_visible (GimpDrawable *drawable,
gboolean visible);
void gimp_drawable_offsets (const GimpDrawable *drawable,
gint *offset_x,
gint *offset_y);

View File

@ -23,8 +23,11 @@
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "apptypes.h"
#include "drawable.h"
#include "gdisplay.h"
#include "gimpchannel.h"
#include "gimpcontainer.h"
@ -35,10 +38,16 @@
#include "gimppreview.h"
#include "gimpviewable.h"
#include "pixmaps/eye.xpm"
static void gimp_drawable_list_item_class_init (GimpDrawableListItemClass *klass);
static void gimp_drawable_list_item_init (GimpDrawableListItem *list_item);
static void gimp_drawable_list_item_set_viewable (GimpListItem *list_item,
GimpViewable *viewable,
gint preview_size);
static gboolean gimp_drawable_list_item_drag_motion (GtkWidget *widget,
GdkDragContext *context,
gint x,
@ -50,6 +59,17 @@ static gboolean gimp_drawable_list_item_drag_drop (GtkWidget *widget
gint y,
guint time);
static void gimp_drawable_list_item_eye_toggled (GtkWidget *widget,
gpointer data);
static void gimp_drawable_list_item_visibility_changed (GimpDrawable *drawable,
gpointer data);
static void gimp_drawable_list_item_button_realize (GtkWidget *widget,
gpointer data);
static void gimp_drawable_list_item_button_state_changed (GtkWidget *widget,
GtkStateType previous_state,
gpointer data);
static GimpListItemClass *parent_class = NULL;
@ -82,21 +102,91 @@ gimp_drawable_list_item_get_type (void)
static void
gimp_drawable_list_item_class_init (GimpDrawableListItemClass *klass)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GimpListItemClass *list_item_class;
object_class = (GtkObjectClass *) klass;
widget_class = (GtkWidgetClass *) klass;
object_class = (GtkObjectClass *) klass;
widget_class = (GtkWidgetClass *) klass;
list_item_class = (GimpListItemClass *) klass;
parent_class = gtk_type_class (GTK_TYPE_LIST_ITEM);
parent_class = gtk_type_class (GIMP_TYPE_LIST_ITEM);
widget_class->drag_motion = gimp_drawable_list_item_drag_motion;
widget_class->drag_drop = gimp_drawable_list_item_drag_drop;
widget_class->drag_motion = gimp_drawable_list_item_drag_motion;
widget_class->drag_drop = gimp_drawable_list_item_drag_drop;
list_item_class->set_viewable = gimp_drawable_list_item_set_viewable;
}
static void
gimp_drawable_list_item_init (GimpDrawableListItem *list_item)
{
GtkWidget *abox;
GtkWidget *pixmap;
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_box_pack_start (GTK_BOX (GIMP_LIST_ITEM (list_item)->hbox), abox,
FALSE, FALSE, 0);
gtk_widget_show (abox);
list_item->eye_button = gtk_toggle_button_new ();
gtk_button_set_relief (GTK_BUTTON (list_item->eye_button), GTK_RELIEF_NONE);
gtk_container_add (GTK_CONTAINER (abox), list_item->eye_button);
gtk_widget_show (list_item->eye_button);
gtk_signal_connect (GTK_OBJECT (list_item->eye_button), "realize",
GTK_SIGNAL_FUNC (gimp_drawable_list_item_button_realize),
list_item);
gtk_signal_connect (GTK_OBJECT (list_item->eye_button), "state_changed",
GTK_SIGNAL_FUNC (gimp_drawable_list_item_button_state_changed),
list_item);
pixmap = gimp_pixmap_new (eye_xpm);
gtk_container_add (GTK_CONTAINER (list_item->eye_button), pixmap);
gtk_widget_show (pixmap);
}
static void
gimp_drawable_list_item_set_viewable (GimpListItem *list_item,
GimpViewable *viewable,
gint preview_size)
{
GimpDrawableListItem *drawable_item;
GimpDrawable *drawable;
gboolean visible;
if (GIMP_LIST_ITEM_CLASS (parent_class)->set_viewable)
GIMP_LIST_ITEM_CLASS (parent_class)->set_viewable (list_item,
viewable,
preview_size);
drawable_item = GIMP_DRAWABLE_LIST_ITEM (list_item);
drawable = GIMP_DRAWABLE (GIMP_PREVIEW (list_item->preview)->viewable);
visible = gimp_drawable_get_visible (drawable);
if (! visible)
{
GtkRequisition requisition;
gtk_widget_size_request (drawable_item->eye_button, &requisition);
gtk_widget_set_usize (drawable_item->eye_button,
requisition.width,
requisition.height);
gtk_widget_hide (GTK_BIN (drawable_item->eye_button)->child);
}
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (drawable_item->eye_button),
visible);
gtk_signal_connect (GTK_OBJECT (drawable_item->eye_button), "toggled",
GTK_SIGNAL_FUNC (gimp_drawable_list_item_eye_toggled),
list_item);
gtk_signal_connect (GTK_OBJECT (viewable), "visibility_changed",
GTK_SIGNAL_FUNC (gimp_drawable_list_item_visibility_changed),
list_item);
}
static gboolean
@ -175,3 +265,118 @@ gimp_drawable_list_item_drag_drop (GtkWidget *widget,
return return_val;
}
static void
gimp_drawable_list_item_eye_toggled (GtkWidget *widget,
gpointer data)
{
GimpListItem *list_item;
GimpDrawable *drawable;
gboolean visible;
list_item = GIMP_LIST_ITEM (data);
drawable = GIMP_DRAWABLE (GIMP_PREVIEW (list_item->preview)->viewable);
visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
if (visible != gimp_drawable_get_visible (drawable))
{
if (! visible)
{
gtk_widget_set_usize (GTK_WIDGET (widget),
GTK_WIDGET (widget)->allocation.width,
GTK_WIDGET (widget)->allocation.height);
gtk_widget_hide (GTK_BIN (widget)->child);
}
else
{
gtk_widget_show (GTK_BIN (widget)->child);
gtk_widget_set_usize (GTK_WIDGET (widget), -1, -1);
}
gtk_signal_handler_block_by_func (GTK_OBJECT (drawable),
gimp_drawable_list_item_visibility_changed,
list_item);
gimp_drawable_set_visible (drawable, visible);
gtk_signal_handler_unblock_by_func (GTK_OBJECT (drawable),
gimp_drawable_list_item_visibility_changed,
list_item);
drawable_update (drawable, 0, 0,
drawable->width,
drawable->height);
gdisplays_flush ();
}
}
static void
gimp_drawable_list_item_visibility_changed (GimpDrawable *drawable,
gpointer data)
{
GimpListItem *list_item;
GtkToggleButton *toggle;
gboolean visible;
list_item = GIMP_LIST_ITEM (data);
toggle = GTK_TOGGLE_BUTTON (GIMP_DRAWABLE_LIST_ITEM (data)->eye_button);
visible = gimp_drawable_get_visible (drawable);
if (visible != toggle->active)
{
if (! visible)
{
gtk_widget_set_usize (GTK_WIDGET (toggle),
GTK_WIDGET (toggle)->allocation.width,
GTK_WIDGET (toggle)->allocation.height);
gtk_widget_hide (GTK_BIN (toggle)->child);
}
else
{
gtk_widget_show (GTK_BIN (toggle)->child);
gtk_widget_set_usize (GTK_WIDGET (toggle), -1, -1);
}
gtk_signal_handler_block_by_func (GTK_OBJECT (toggle),
gimp_drawable_list_item_eye_toggled,
list_item);
gtk_toggle_button_set_active (toggle, visible);
gtk_signal_handler_unblock_by_func (GTK_OBJECT (toggle),
gimp_drawable_list_item_eye_toggled,
list_item);
}
}
static void
gimp_drawable_list_item_button_realize (GtkWidget *widget,
gpointer data)
{
gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
}
static void
gimp_drawable_list_item_button_state_changed (GtkWidget *widget,
GtkStateType previous_state,
gpointer data)
{
GtkWidget *list_item;
list_item = GTK_WIDGET (data);
if (widget->state != list_item->state)
{
switch (widget->state)
{
case GTK_STATE_NORMAL:
case GTK_STATE_ACTIVE:
/* beware: recursion */
gtk_widget_set_state (widget, list_item->state);
break;
default:
break;
}
}
}

View File

@ -43,6 +43,8 @@ typedef struct _GimpDrawableListItemClass GimpDrawableListItemClass;
struct _GimpDrawableListItem
{
GimpListItem parent_instance;
GtkWidget *eye_button;
};
struct _GimpDrawableListItemClass

View File

@ -1695,8 +1695,10 @@ gimp_image_construct_layers (GimpImage *gimage,
/* only add layers that are visible and not floating selections
to the list */
if (! gimp_layer_is_floating_sel (layer) &&
gimp_drawable_visible (GIMP_DRAWABLE (layer)))
reverse_list = g_slist_prepend (reverse_list, layer);
gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
{
reverse_list = g_slist_prepend (reverse_list, layer);
}
}
while (reverse_list)
@ -1801,7 +1803,7 @@ gimp_image_construct_channels (GimpImage *gimage,
{
channel = (GimpChannel *) reverse_list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (channel)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (channel)))
{
/* configure the pixel regions */
pixel_region_init (&src1PR,
@ -1852,7 +1854,7 @@ gimp_image_initialize_projection (GimpImage *gimage,
layer = (GimpLayer *) list->data;
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)) &&
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)) &&
! gimp_layer_has_alpha (layer) &&
(off_x <= x) &&
(off_y <= y) &&
@ -1931,7 +1933,7 @@ gimp_image_construct (GimpImage *gimage,
(! g_slist_next (gimage->layers)) && /* It's the only layer. */
(gimp_layer_has_alpha ((GimpLayer *) (gimage->layers->data))) && /* It's !flat. */
/* It's visible. */
(gimp_drawable_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
(gimp_drawable_get_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
(gimp_drawable_width (GIMP_DRAWABLE (gimage->layers->data)) ==
gimage->width) &&
(gimp_drawable_height (GIMP_DRAWABLE (gimage->layers->data)) ==
@ -2730,7 +2732,7 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
{
layer = (GimpLayer *) list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
merge_list = g_slist_append (merge_list, layer);
}
@ -2781,7 +2783,7 @@ gimp_image_flatten (GimpImage *gimage)
{
layer = (GimpLayer *) list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
merge_list = g_slist_append (merge_list, layer);
}
@ -2821,7 +2823,7 @@ gimp_image_merge_down (GimpImage *gimage,
{
layer = (GimpLayer *) layer_list->data;
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
merge_list = g_slist_append (NULL, layer);
}
@ -3137,7 +3139,7 @@ gimp_image_merge_layers (GimpImage *gimage,
undo_push_group_end (gimage);
/* Update the gimage */
GIMP_DRAWABLE (merge_layer)->visible = TRUE;
gimp_drawable_set_visible (GIMP_DRAWABLE (merge_layer), TRUE);
gtk_signal_emit (GTK_OBJECT (gimage), gimp_image_signals[RESTRUCTURE]);
@ -3540,7 +3542,7 @@ gimp_image_add_channel (GimpImage *gimage,
gimp_image_set_active_channel (gimage, channel);
/* if channel is visible, update the image */
if (gimp_drawable_visible (GIMP_DRAWABLE (channel)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (channel)))
drawable_update (GIMP_DRAWABLE (channel),
0, 0,
gimp_drawable_width (GIMP_DRAWABLE (channel)),
@ -3977,7 +3979,7 @@ gimp_image_get_new_preview (GimpViewable *viewable,
layer = (GimpLayer *) list->data;
/* only add layers that are visible to the list */
if (gimp_drawable_visible (GIMP_DRAWABLE (layer)))
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
{
/* floating selections are added right above the layer
they are attached to */

View File

@ -291,6 +291,7 @@ gimp_layer_copy (GimpLayer *layer,
GIMP_DRAWABLE (new_layer)->offset_x = GIMP_DRAWABLE (layer)->offset_x;
GIMP_DRAWABLE (new_layer)->offset_y = GIMP_DRAWABLE (layer)->offset_y;
GIMP_DRAWABLE (new_layer)->visible = GIMP_DRAWABLE (layer)->visible;
new_layer->linked = layer->linked;
new_layer->preserve_trans = layer->preserve_trans;
@ -1186,7 +1187,7 @@ gimp_layer_pick_correlate (GimpLayer *layer,
if (x >= 0 && x < GIMP_DRAWABLE (layer)->width &&
y >= 0 && y < GIMP_DRAWABLE (layer)->height &&
GIMP_DRAWABLE (layer)->visible)
gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
{
/* If the point is inside, and the layer has no
* alpha channel, success!

View File

@ -30,13 +30,28 @@
#include "gimpdrawable.h"
#include "gimpdrawablelistitem.h"
#include "gimplistitem.h"
#include "gimpmarshal.h"
#include "gimppreview.h"
#include "gimpviewable.h"
enum
{
SET_VIEWABLE,
LAST_SIGNAL
};
static void gimp_list_item_class_init (GimpListItemClass *klass);
static void gimp_list_item_init (GimpListItem *list_item);
static void gimp_list_item_set_viewable (GimpListItem *list_item,
GimpViewable *viewable,
gint preview_size);
static void gimp_list_item_real_set_viewable (GimpListItem *list_item,
GimpViewable *viewable,
gint preview_size);
static void gimp_list_item_draw (GtkWidget *widget,
GdkRectangle *area);
static void gimp_list_item_drag_leave (GtkWidget *widget,
@ -59,7 +74,9 @@ static GimpViewable * gimp_list_item_drag_viewable (GtkWidget *widget,
gpointer data);
static GtkListItemClass *parent_class = NULL;
static guint list_item_signals[LAST_SIGNAL] = { 0 };
static GtkListItemClass *parent_class = NULL;
GtkType
@ -98,10 +115,23 @@ gimp_list_item_class_init (GimpListItemClass *klass)
parent_class = gtk_type_class (GTK_TYPE_LIST_ITEM);
list_item_signals[SET_VIEWABLE] =
gtk_signal_new ("set_viewable",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpListItemClass,
set_viewable),
gimp_marshal_NONE__OBJECT_INT,
GTK_TYPE_NONE, 2,
GIMP_TYPE_VIEWABLE,
GTK_TYPE_INT);
widget_class->draw = gimp_list_item_draw;
widget_class->drag_leave = gimp_list_item_drag_leave;
widget_class->drag_motion = gimp_list_item_drag_motion;
widget_class->drag_drop = gimp_list_item_drag_drop;
klass->set_viewable = gimp_list_item_real_set_viewable;
}
static void
@ -243,6 +273,25 @@ gimp_list_item_new (GimpViewable *viewable,
list_item = gtk_type_new (GIMP_TYPE_LIST_ITEM);
}
gimp_list_item_set_viewable (list_item, viewable, preview_size);
return GTK_WIDGET (list_item);
}
static void
gimp_list_item_set_viewable (GimpListItem *list_item,
GimpViewable *viewable,
gint preview_size)
{
gtk_signal_emit (GTK_OBJECT (list_item), list_item_signals[SET_VIEWABLE],
viewable, preview_size);
}
static void
gimp_list_item_real_set_viewable (GimpListItem *list_item,
GimpViewable *viewable,
gint preview_size)
{
list_item->preview = gimp_preview_new (viewable, preview_size, 1, FALSE);
gtk_box_pack_start (GTK_BOX (list_item->hbox), list_item->preview,
FALSE, FALSE, 0);
@ -272,8 +321,6 @@ gimp_list_item_new (GimpViewable *viewable,
GTK_DEST_DEFAULT_ALL,
GTK_OBJECT (viewable)->klass->type,
GDK_ACTION_MOVE);
return GTK_WIDGET (list_item);
}
void

View File

@ -58,6 +58,10 @@ struct _GimpListItem
struct _GimpListItemClass
{
GtkListItemClass parent_class;
void (* set_viewable) (GimpListItem *list_item,
GimpViewable *viewable,
gint preview_size);
};

View File

@ -1898,6 +1898,7 @@ channel_widget_button_events (GtkWidget *widget,
gpointer data)
{
ChannelWidget *channel_widget;
GimpChannel *channel;
GtkWidget *event_widget;
GdkEventButton *bevent;
gint return_val;
@ -1913,10 +1914,12 @@ channel_widget_button_events (GtkWidget *widget,
(ChannelWidget *) gtk_object_get_user_data (GTK_OBJECT (widget));
return_val = FALSE;
channel = channel_widget->channel;
switch (channel_widget->type)
{
case AUXILLARY_CHANNEL:
visible = GIMP_DRAWABLE (channel_widget->channel)->visible;
visible = gimp_drawable_get_visible (GIMP_DRAWABLE (channel));
width = GIMP_DRAWABLE (channel_widget->channel)->width;
height = GIMP_DRAWABLE (channel_widget->channel)->height;
break;
@ -1965,7 +1968,7 @@ channel_widget_button_events (GtkWidget *widget,
{
exclusive = FALSE;
if (channel_widget->type == AUXILLARY_CHANNEL)
GIMP_DRAWABLE (channel_widget->channel)->visible = !visible;
gimp_drawable_set_visible (GIMP_DRAWABLE (channel), ! visible);
else
gimp_image_set_component_visible (channel_widget->gimage,
channel_widget->type,
@ -2014,7 +2017,8 @@ channel_widget_button_events (GtkWidget *widget,
else
{
if (channel_widget->type == AUXILLARY_CHANNEL)
GIMP_DRAWABLE (channel_widget->channel)->visible = !visible;
gimp_drawable_set_visible (GIMP_DRAWABLE (channel),
! visible);
else
gimp_image_set_component_visible (channel_widget->gimage,
channel_widget->type,
@ -2306,7 +2310,8 @@ channel_widget_eye_redraw (ChannelWidget *channel_widget)
switch (channel_widget->type)
{
case AUXILLARY_CHANNEL:
visible = GIMP_DRAWABLE (channel_widget->channel)->visible;
visible =
gimp_drawable_get_visible (GIMP_DRAWABLE (channel_widget->channel));
break;
default:
visible = gimp_image_get_component_visible (channel_widget->gimage,
@ -2375,7 +2380,7 @@ channel_widget_exclusive_visible (ChannelWidget *channel_widget)
switch (cw->type)
{
case AUXILLARY_CHANNEL:
visible |= GIMP_DRAWABLE (cw->channel)->visible;
visible |= gimp_drawable_get_visible (GIMP_DRAWABLE (cw->channel));
break;
default:
visible |= gimp_image_get_component_visible (cw->gimage, cw->type);
@ -2393,7 +2398,7 @@ channel_widget_exclusive_visible (ChannelWidget *channel_widget)
switch (cw->type)
{
case AUXILLARY_CHANNEL:
GIMP_DRAWABLE (cw->channel)->visible = !visible;
gimp_drawable_set_visible (GIMP_DRAWABLE (cw->channel), ! visible);
break;
default:
gimp_image_set_component_visible (cw->gimage, cw->type, !visible);
@ -2403,7 +2408,7 @@ channel_widget_exclusive_visible (ChannelWidget *channel_widget)
switch (cw->type)
{
case AUXILLARY_CHANNEL:
GIMP_DRAWABLE (cw->channel)->visible = TRUE;
gimp_drawable_set_visible (GIMP_DRAWABLE (cw->channel), TRUE);
break;
default:
gimp_image_set_component_visible (cw->gimage, cw->type, TRUE);

View File

@ -2656,7 +2656,8 @@ layer_widget_button_events (GtkWidget *widget,
if (widget == layer_widget->eye_widget)
{
old_state = GIMP_DRAWABLE (layer_widget->layer)->visible;
old_state =
gimp_drawable_get_visible (GIMP_DRAWABLE (layer_widget->layer));
/* If this was a shift-click, make all/none visible */
if (event->button.state & GDK_SHIFT_MASK)
@ -2667,8 +2668,8 @@ layer_widget_button_events (GtkWidget *widget,
else
{
exclusive = FALSE;
GIMP_DRAWABLE (layer_widget->layer)->visible =
!GIMP_DRAWABLE (layer_widget->layer)->visible;
gimp_drawable_set_visible (GIMP_DRAWABLE (layer_widget->layer),
! old_state);
layer_widget_eye_redraw (layer_widget);
}
}
@ -2698,7 +2699,7 @@ layer_widget_button_events (GtkWidget *widget,
layer_widget->gimage->height);
gdisplays_flush ();
}
else if (old_state != GIMP_DRAWABLE (layer_widget->layer)->visible)
else if (old_state != gimp_drawable_get_visible (GIMP_DRAWABLE (layer_widget->layer)))
{
/* Invalidate the gimage preview */
gimp_viewable_invalidate_preview
@ -2733,8 +2734,8 @@ layer_widget_button_events (GtkWidget *widget,
}
else
{
GIMP_DRAWABLE (layer_widget->layer)->visible =
!GIMP_DRAWABLE (layer_widget->layer)->visible;
gimp_drawable_set_visible (GIMP_DRAWABLE (layer_widget->layer),
! gimp_drawable_get_visible (GIMP_DRAWABLE (layer_widget->layer)));
layer_widget_eye_redraw (layer_widget);
}
}
@ -3219,7 +3220,7 @@ layer_widget_eye_redraw (LayerWidget *layer_widget)
gdk_window_set_background (layer_widget->eye_widget->window, color);
if (GIMP_DRAWABLE(layer_widget->layer)->visible)
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer_widget->layer)))
{
if (!eye_pixmap[NORMAL])
{
@ -3354,7 +3355,7 @@ layer_widget_exclusive_visible (LayerWidget *layer_widget)
lw = (LayerWidget *) list->data;
if (lw != layer_widget)
visible |= GIMP_DRAWABLE (lw->layer)->visible;
visible |= gimp_drawable_get_visible (GIMP_DRAWABLE (lw->layer));
}
/* Now, toggle the visibility for all layers except the specified one */
@ -3363,9 +3364,9 @@ layer_widget_exclusive_visible (LayerWidget *layer_widget)
lw = (LayerWidget *) list->data;
if (lw != layer_widget)
GIMP_DRAWABLE (lw->layer)->visible = !visible;
gimp_drawable_set_visible (GIMP_DRAWABLE (lw->layer), ! visible);
else
GIMP_DRAWABLE (lw->layer)->visible = TRUE;
gimp_drawable_set_visible (GIMP_DRAWABLE (lw->layer), TRUE);
layer_widget_eye_redraw (lw);
}

View File

@ -2656,7 +2656,8 @@ layer_widget_button_events (GtkWidget *widget,
if (widget == layer_widget->eye_widget)
{
old_state = GIMP_DRAWABLE (layer_widget->layer)->visible;
old_state =
gimp_drawable_get_visible (GIMP_DRAWABLE (layer_widget->layer));
/* If this was a shift-click, make all/none visible */
if (event->button.state & GDK_SHIFT_MASK)
@ -2667,8 +2668,8 @@ layer_widget_button_events (GtkWidget *widget,
else
{
exclusive = FALSE;
GIMP_DRAWABLE (layer_widget->layer)->visible =
!GIMP_DRAWABLE (layer_widget->layer)->visible;
gimp_drawable_set_visible (GIMP_DRAWABLE (layer_widget->layer),
! old_state);
layer_widget_eye_redraw (layer_widget);
}
}
@ -2698,7 +2699,7 @@ layer_widget_button_events (GtkWidget *widget,
layer_widget->gimage->height);
gdisplays_flush ();
}
else if (old_state != GIMP_DRAWABLE (layer_widget->layer)->visible)
else if (old_state != gimp_drawable_get_visible (GIMP_DRAWABLE (layer_widget->layer)))
{
/* Invalidate the gimage preview */
gimp_viewable_invalidate_preview
@ -2733,8 +2734,8 @@ layer_widget_button_events (GtkWidget *widget,
}
else
{
GIMP_DRAWABLE (layer_widget->layer)->visible =
!GIMP_DRAWABLE (layer_widget->layer)->visible;
gimp_drawable_set_visible (GIMP_DRAWABLE (layer_widget->layer),
! gimp_drawable_get_visible (GIMP_DRAWABLE (layer_widget->layer)));
layer_widget_eye_redraw (layer_widget);
}
}
@ -3219,7 +3220,7 @@ layer_widget_eye_redraw (LayerWidget *layer_widget)
gdk_window_set_background (layer_widget->eye_widget->window, color);
if (GIMP_DRAWABLE(layer_widget->layer)->visible)
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer_widget->layer)))
{
if (!eye_pixmap[NORMAL])
{
@ -3354,7 +3355,7 @@ layer_widget_exclusive_visible (LayerWidget *layer_widget)
lw = (LayerWidget *) list->data;
if (lw != layer_widget)
visible |= GIMP_DRAWABLE (lw->layer)->visible;
visible |= gimp_drawable_get_visible (GIMP_DRAWABLE (lw->layer));
}
/* Now, toggle the visibility for all layers except the specified one */
@ -3363,9 +3364,9 @@ layer_widget_exclusive_visible (LayerWidget *layer_widget)
lw = (LayerWidget *) list->data;
if (lw != layer_widget)
GIMP_DRAWABLE (lw->layer)->visible = !visible;
gimp_drawable_set_visible (GIMP_DRAWABLE (lw->layer), ! visible);
else
GIMP_DRAWABLE (lw->layer)->visible = TRUE;
gimp_drawable_set_visible (GIMP_DRAWABLE (lw->layer), TRUE);
layer_widget_eye_redraw (lw);
}

View File

@ -477,7 +477,7 @@ channel_get_visible_invoker (Argument *args)
return_args = procedural_db_return_args (&channel_get_visible_proc, success);
if (success)
return_args[1].value.pdb_int = GIMP_DRAWABLE (channel)->visible;
return_args[1].value.pdb_int = gimp_channel_get_visible (channel);
return return_args;
}
@ -530,7 +530,7 @@ channel_set_visible_invoker (Argument *args)
visible = args[1].value.pdb_int ? TRUE : FALSE;
if (success)
GIMP_DRAWABLE (channel)->visible = visible;
gimp_channel_set_visible (channel, visible);
return procedural_db_return_args (&channel_set_visible_proc, success);
}

View File

@ -1029,7 +1029,7 @@ layer_get_visible_invoker (Argument *args)
return_args = procedural_db_return_args (&layer_get_visible_proc, success);
if (success)
return_args[1].value.pdb_int = GIMP_DRAWABLE (layer)->visible;
return_args[1].value.pdb_int = gimp_layer_get_visible (layer);
return return_args;
}
@ -1082,7 +1082,7 @@ layer_set_visible_invoker (Argument *args)
visible = args[1].value.pdb_int ? TRUE : FALSE;
if (success)
GIMP_DRAWABLE (layer)->visible = visible;
gimp_layer_set_visible (layer, visible);
return procedural_db_return_args (&layer_set_visible_proc, success);
}

View File

@ -24,15 +24,19 @@
#define gimp_drawable_layer_mask GIMP_IS_LAYER_MASK
#define gimp_drawable_channel GIMP_IS_CHANNEL
#define gimp_layer_set_name(l,n) gimp_object_set_name(GIMP_OBJECT(l),(n))
#define gimp_layer_get_name(l) gimp_object_get_name(GIMP_OBJECT(l))
#define gimp_layer_set_tattoo(l,t) gimp_drawable_set_tattoo(GIMP_DRAWABLE(l),(t))
#define gimp_layer_get_tattoo(l) gimp_drawable_get_tattoo(GIMP_DRAWABLE(l))
#define gimp_layer_set_name(l,n) gimp_object_set_name(GIMP_OBJECT(l),(n))
#define gimp_layer_get_name(l) gimp_object_get_name(GIMP_OBJECT(l))
#define gimp_layer_get_visible(l) gimp_drawable_get_visible(GIMP_DRAWABLE(l))
#define gimp_layer_set_visible(l,v) gimp_drawable_set_visible(GIMP_DRAWABLE(l),(v))
#define gimp_layer_set_tattoo(l,t) gimp_drawable_set_tattoo(GIMP_DRAWABLE(l),(t))
#define gimp_layer_get_tattoo(l) gimp_drawable_get_tattoo(GIMP_DRAWABLE(l))
#define gimp_channel_set_name(c,n) gimp_object_set_name(GIMP_OBJECT(c),(n))
#define gimp_channel_get_name(c) gimp_object_get_name(GIMP_OBJECT(c))
#define gimp_channel_set_tattoo(c,t) gimp_drawable_set_tattoo(GIMP_DRAWABLE(c),(t))
#define gimp_channel_get_tattoo(c) gimp_drawable_get_tattoo(GIMP_DRAWABLE(c))
#define gimp_channel_set_name(c,n) gimp_object_set_name(GIMP_OBJECT(c),(n))
#define gimp_channel_get_name(c) gimp_object_get_name(GIMP_OBJECT(c))
#define gimp_channel_get_visible(c) gimp_drawable_get_visible(GIMP_DRAWABLE(c))
#define gimp_channel_set_visible(c,v) gimp_drawable_set_visible(GIMP_DRAWABLE(c),(v))
#define gimp_channel_set_tattoo(c,t) gimp_drawable_set_tattoo(GIMP_DRAWABLE(c),(t))
#define gimp_channel_get_tattoo(c) gimp_drawable_get_tattoo(GIMP_DRAWABLE(c))
#endif /* __PDB_GLUE_H__ */

View File

@ -23,8 +23,11 @@
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "apptypes.h"
#include "drawable.h"
#include "gdisplay.h"
#include "gimpchannel.h"
#include "gimpcontainer.h"
@ -35,10 +38,16 @@
#include "gimppreview.h"
#include "gimpviewable.h"
#include "pixmaps/eye.xpm"
static void gimp_drawable_list_item_class_init (GimpDrawableListItemClass *klass);
static void gimp_drawable_list_item_init (GimpDrawableListItem *list_item);
static void gimp_drawable_list_item_set_viewable (GimpListItem *list_item,
GimpViewable *viewable,
gint preview_size);
static gboolean gimp_drawable_list_item_drag_motion (GtkWidget *widget,
GdkDragContext *context,
gint x,
@ -50,6 +59,17 @@ static gboolean gimp_drawable_list_item_drag_drop (GtkWidget *widget
gint y,
guint time);
static void gimp_drawable_list_item_eye_toggled (GtkWidget *widget,
gpointer data);
static void gimp_drawable_list_item_visibility_changed (GimpDrawable *drawable,
gpointer data);
static void gimp_drawable_list_item_button_realize (GtkWidget *widget,
gpointer data);
static void gimp_drawable_list_item_button_state_changed (GtkWidget *widget,
GtkStateType previous_state,
gpointer data);
static GimpListItemClass *parent_class = NULL;
@ -82,21 +102,91 @@ gimp_drawable_list_item_get_type (void)
static void
gimp_drawable_list_item_class_init (GimpDrawableListItemClass *klass)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GimpListItemClass *list_item_class;
object_class = (GtkObjectClass *) klass;
widget_class = (GtkWidgetClass *) klass;
object_class = (GtkObjectClass *) klass;
widget_class = (GtkWidgetClass *) klass;
list_item_class = (GimpListItemClass *) klass;
parent_class = gtk_type_class (GTK_TYPE_LIST_ITEM);
parent_class = gtk_type_class (GIMP_TYPE_LIST_ITEM);
widget_class->drag_motion = gimp_drawable_list_item_drag_motion;
widget_class->drag_drop = gimp_drawable_list_item_drag_drop;
widget_class->drag_motion = gimp_drawable_list_item_drag_motion;
widget_class->drag_drop = gimp_drawable_list_item_drag_drop;
list_item_class->set_viewable = gimp_drawable_list_item_set_viewable;
}
static void
gimp_drawable_list_item_init (GimpDrawableListItem *list_item)
{
GtkWidget *abox;
GtkWidget *pixmap;
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_box_pack_start (GTK_BOX (GIMP_LIST_ITEM (list_item)->hbox), abox,
FALSE, FALSE, 0);
gtk_widget_show (abox);
list_item->eye_button = gtk_toggle_button_new ();
gtk_button_set_relief (GTK_BUTTON (list_item->eye_button), GTK_RELIEF_NONE);
gtk_container_add (GTK_CONTAINER (abox), list_item->eye_button);
gtk_widget_show (list_item->eye_button);
gtk_signal_connect (GTK_OBJECT (list_item->eye_button), "realize",
GTK_SIGNAL_FUNC (gimp_drawable_list_item_button_realize),
list_item);
gtk_signal_connect (GTK_OBJECT (list_item->eye_button), "state_changed",
GTK_SIGNAL_FUNC (gimp_drawable_list_item_button_state_changed),
list_item);
pixmap = gimp_pixmap_new (eye_xpm);
gtk_container_add (GTK_CONTAINER (list_item->eye_button), pixmap);
gtk_widget_show (pixmap);
}
static void
gimp_drawable_list_item_set_viewable (GimpListItem *list_item,
GimpViewable *viewable,
gint preview_size)
{
GimpDrawableListItem *drawable_item;
GimpDrawable *drawable;
gboolean visible;
if (GIMP_LIST_ITEM_CLASS (parent_class)->set_viewable)
GIMP_LIST_ITEM_CLASS (parent_class)->set_viewable (list_item,
viewable,
preview_size);
drawable_item = GIMP_DRAWABLE_LIST_ITEM (list_item);
drawable = GIMP_DRAWABLE (GIMP_PREVIEW (list_item->preview)->viewable);
visible = gimp_drawable_get_visible (drawable);
if (! visible)
{
GtkRequisition requisition;
gtk_widget_size_request (drawable_item->eye_button, &requisition);
gtk_widget_set_usize (drawable_item->eye_button,
requisition.width,
requisition.height);
gtk_widget_hide (GTK_BIN (drawable_item->eye_button)->child);
}
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (drawable_item->eye_button),
visible);
gtk_signal_connect (GTK_OBJECT (drawable_item->eye_button), "toggled",
GTK_SIGNAL_FUNC (gimp_drawable_list_item_eye_toggled),
list_item);
gtk_signal_connect (GTK_OBJECT (viewable), "visibility_changed",
GTK_SIGNAL_FUNC (gimp_drawable_list_item_visibility_changed),
list_item);
}
static gboolean
@ -175,3 +265,118 @@ gimp_drawable_list_item_drag_drop (GtkWidget *widget,
return return_val;
}
static void
gimp_drawable_list_item_eye_toggled (GtkWidget *widget,
gpointer data)
{
GimpListItem *list_item;
GimpDrawable *drawable;
gboolean visible;
list_item = GIMP_LIST_ITEM (data);
drawable = GIMP_DRAWABLE (GIMP_PREVIEW (list_item->preview)->viewable);
visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
if (visible != gimp_drawable_get_visible (drawable))
{
if (! visible)
{
gtk_widget_set_usize (GTK_WIDGET (widget),
GTK_WIDGET (widget)->allocation.width,
GTK_WIDGET (widget)->allocation.height);
gtk_widget_hide (GTK_BIN (widget)->child);
}
else
{
gtk_widget_show (GTK_BIN (widget)->child);
gtk_widget_set_usize (GTK_WIDGET (widget), -1, -1);
}
gtk_signal_handler_block_by_func (GTK_OBJECT (drawable),
gimp_drawable_list_item_visibility_changed,
list_item);
gimp_drawable_set_visible (drawable, visible);
gtk_signal_handler_unblock_by_func (GTK_OBJECT (drawable),
gimp_drawable_list_item_visibility_changed,
list_item);
drawable_update (drawable, 0, 0,
drawable->width,
drawable->height);
gdisplays_flush ();
}
}
static void
gimp_drawable_list_item_visibility_changed (GimpDrawable *drawable,
gpointer data)
{
GimpListItem *list_item;
GtkToggleButton *toggle;
gboolean visible;
list_item = GIMP_LIST_ITEM (data);
toggle = GTK_TOGGLE_BUTTON (GIMP_DRAWABLE_LIST_ITEM (data)->eye_button);
visible = gimp_drawable_get_visible (drawable);
if (visible != toggle->active)
{
if (! visible)
{
gtk_widget_set_usize (GTK_WIDGET (toggle),
GTK_WIDGET (toggle)->allocation.width,
GTK_WIDGET (toggle)->allocation.height);
gtk_widget_hide (GTK_BIN (toggle)->child);
}
else
{
gtk_widget_show (GTK_BIN (toggle)->child);
gtk_widget_set_usize (GTK_WIDGET (toggle), -1, -1);
}
gtk_signal_handler_block_by_func (GTK_OBJECT (toggle),
gimp_drawable_list_item_eye_toggled,
list_item);
gtk_toggle_button_set_active (toggle, visible);
gtk_signal_handler_unblock_by_func (GTK_OBJECT (toggle),
gimp_drawable_list_item_eye_toggled,
list_item);
}
}
static void
gimp_drawable_list_item_button_realize (GtkWidget *widget,
gpointer data)
{
gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
}
static void
gimp_drawable_list_item_button_state_changed (GtkWidget *widget,
GtkStateType previous_state,
gpointer data)
{
GtkWidget *list_item;
list_item = GTK_WIDGET (data);
if (widget->state != list_item->state)
{
switch (widget->state)
{
case GTK_STATE_NORMAL:
case GTK_STATE_ACTIVE:
/* beware: recursion */
gtk_widget_set_state (widget, list_item->state);
break;
default:
break;
}
}
}

View File

@ -43,6 +43,8 @@ typedef struct _GimpDrawableListItemClass GimpDrawableListItemClass;
struct _GimpDrawableListItem
{
GimpListItem parent_instance;
GtkWidget *eye_button;
};
struct _GimpDrawableListItemClass

View File

@ -30,13 +30,28 @@
#include "gimpdrawable.h"
#include "gimpdrawablelistitem.h"
#include "gimplistitem.h"
#include "gimpmarshal.h"
#include "gimppreview.h"
#include "gimpviewable.h"
enum
{
SET_VIEWABLE,
LAST_SIGNAL
};
static void gimp_list_item_class_init (GimpListItemClass *klass);
static void gimp_list_item_init (GimpListItem *list_item);
static void gimp_list_item_set_viewable (GimpListItem *list_item,
GimpViewable *viewable,
gint preview_size);
static void gimp_list_item_real_set_viewable (GimpListItem *list_item,
GimpViewable *viewable,
gint preview_size);
static void gimp_list_item_draw (GtkWidget *widget,
GdkRectangle *area);
static void gimp_list_item_drag_leave (GtkWidget *widget,
@ -59,7 +74,9 @@ static GimpViewable * gimp_list_item_drag_viewable (GtkWidget *widget,
gpointer data);
static GtkListItemClass *parent_class = NULL;
static guint list_item_signals[LAST_SIGNAL] = { 0 };
static GtkListItemClass *parent_class = NULL;
GtkType
@ -98,10 +115,23 @@ gimp_list_item_class_init (GimpListItemClass *klass)
parent_class = gtk_type_class (GTK_TYPE_LIST_ITEM);
list_item_signals[SET_VIEWABLE] =
gtk_signal_new ("set_viewable",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpListItemClass,
set_viewable),
gimp_marshal_NONE__OBJECT_INT,
GTK_TYPE_NONE, 2,
GIMP_TYPE_VIEWABLE,
GTK_TYPE_INT);
widget_class->draw = gimp_list_item_draw;
widget_class->drag_leave = gimp_list_item_drag_leave;
widget_class->drag_motion = gimp_list_item_drag_motion;
widget_class->drag_drop = gimp_list_item_drag_drop;
klass->set_viewable = gimp_list_item_real_set_viewable;
}
static void
@ -243,6 +273,25 @@ gimp_list_item_new (GimpViewable *viewable,
list_item = gtk_type_new (GIMP_TYPE_LIST_ITEM);
}
gimp_list_item_set_viewable (list_item, viewable, preview_size);
return GTK_WIDGET (list_item);
}
static void
gimp_list_item_set_viewable (GimpListItem *list_item,
GimpViewable *viewable,
gint preview_size)
{
gtk_signal_emit (GTK_OBJECT (list_item), list_item_signals[SET_VIEWABLE],
viewable, preview_size);
}
static void
gimp_list_item_real_set_viewable (GimpListItem *list_item,
GimpViewable *viewable,
gint preview_size)
{
list_item->preview = gimp_preview_new (viewable, preview_size, 1, FALSE);
gtk_box_pack_start (GTK_BOX (list_item->hbox), list_item->preview,
FALSE, FALSE, 0);
@ -272,8 +321,6 @@ gimp_list_item_new (GimpViewable *viewable,
GTK_DEST_DEFAULT_ALL,
GTK_OBJECT (viewable)->klass->type,
GDK_ACTION_MOVE);
return GTK_WIDGET (list_item);
}
void

View File

@ -58,6 +58,10 @@ struct _GimpListItem
struct _GimpListItemClass
{
GtkListItemClass parent_class;
void (* set_viewable) (GimpListItem *list_item,
GimpViewable *viewable,
gint preview_size);
};

View File

@ -659,17 +659,21 @@ xcf_save_layer_props (XcfInfo *info,
}
xcf_save_prop (info, PROP_OPACITY, layer->opacity);
xcf_save_prop (info, PROP_VISIBLE, GIMP_DRAWABLE(layer)->visible);
xcf_save_prop (info, PROP_VISIBLE,
gimp_drawable_get_visible (GIMP_DRAWABLE (layer)));
xcf_save_prop (info, PROP_LINKED, layer->linked);
xcf_save_prop (info, PROP_PRESERVE_TRANSPARENCY, layer->preserve_trans);
xcf_save_prop (info, PROP_APPLY_MASK, layer->apply_mask);
xcf_save_prop (info, PROP_EDIT_MASK, layer->edit_mask);
xcf_save_prop (info, PROP_SHOW_MASK, layer->show_mask);
xcf_save_prop (info, PROP_OFFSETS, GIMP_DRAWABLE(layer)->offset_x, GIMP_DRAWABLE(layer)->offset_y);
xcf_save_prop (info, PROP_OFFSETS,
GIMP_DRAWABLE (layer)->offset_x,
GIMP_DRAWABLE (layer)->offset_y);
xcf_save_prop (info, PROP_MODE, layer->mode);
xcf_save_prop (info, PROP_TATTOO, GIMP_DRAWABLE(layer)->tattoo);
if (parasite_list_length (GIMP_DRAWABLE(layer)->parasites) > 0)
xcf_save_prop (info, PROP_PARASITES, GIMP_DRAWABLE(layer)->parasites);
xcf_save_prop (info, PROP_TATTOO, GIMP_DRAWABLE (layer)->tattoo);
if (parasite_list_length (GIMP_DRAWABLE (layer)->parasites) > 0)
xcf_save_prop (info, PROP_PARASITES, GIMP_DRAWABLE (layer)->parasites);
xcf_save_prop (info, PROP_END);
}
@ -679,6 +683,8 @@ xcf_save_channel_props (XcfInfo *info,
GImage *gimage,
GimpChannel *channel)
{
guchar col[3];
if (channel == gimp_image_get_active_channel (gimage))
xcf_save_prop (info, PROP_ACTIVE_CHANNEL);
@ -686,19 +692,17 @@ xcf_save_channel_props (XcfInfo *info,
xcf_save_prop (info, PROP_SELECTION);
xcf_save_prop (info, PROP_OPACITY, (gint) (channel->color.a * 255.999));
xcf_save_prop (info, PROP_VISIBLE, GIMP_DRAWABLE(channel)->visible);
xcf_save_prop (info, PROP_VISIBLE,
gimp_drawable_get_visible (GIMP_DRAWABLE (channel)));
xcf_save_prop (info, PROP_SHOW_MASKED, channel->show_masked);
{
guchar col[3];
gimp_rgb_get_uchar (&channel->color, &col[0], &col[1], &col[2]);
xcf_save_prop (info, PROP_COLOR, col);
gimp_rgb_get_uchar (&channel->color, &col[0], &col[1], &col[2]);
xcf_save_prop (info, PROP_COLOR, col);
}
xcf_save_prop (info, PROP_TATTOO, GIMP_DRAWABLE (channel)->tattoo);
xcf_save_prop (info, PROP_TATTOO, GIMP_DRAWABLE(channel)->tattoo);
if (parasite_list_length (GIMP_DRAWABLE(channel)->parasites) > 0)
xcf_save_prop (info, PROP_PARASITES, GIMP_DRAWABLE(channel)->parasites);
if (parasite_list_length (GIMP_DRAWABLE (channel)->parasites) > 0)
xcf_save_prop (info, PROP_PARASITES, GIMP_DRAWABLE (channel)->parasites);
xcf_save_prop (info, PROP_END);
}
@ -2067,7 +2071,13 @@ xcf_load_layer_props (XcfInfo *info,
info->cp += xcf_read_int32 (info->fp, (guint32*) &layer->opacity, 1);
break;
case PROP_VISIBLE:
info->cp += xcf_read_int32 (info->fp, (guint32*) &GIMP_DRAWABLE(layer)->visible, 1);
{
gboolean visible;
info->cp += xcf_read_int32 (info->fp, (guint32 *) &visible, 1);
gimp_drawable_set_visible (GIMP_DRAWABLE (layer),
visible ? TRUE : FALSE);
}
break;
case PROP_LINKED:
info->cp += xcf_read_int32 (info->fp, (guint32*) &layer->linked, 1);
@ -2166,7 +2176,13 @@ xcf_load_channel_props (XcfInfo *info,
}
break;
case PROP_VISIBLE:
info->cp += xcf_read_int32 (info->fp, (guint32*) &GIMP_DRAWABLE(channel)->visible, 1);
{
gboolean visible;
info->cp += xcf_read_int32 (info->fp, (guint32 *) &visible, 1);
gimp_drawable_set_visible (GIMP_DRAWABLE (channel),
visible ? TRUE : FALSE);
}
break;
case PROP_SHOW_MASKED:
info->cp += xcf_read_int32 (info->fp, (guint32*) &channel->show_masked, 1);

View File

@ -659,17 +659,21 @@ xcf_save_layer_props (XcfInfo *info,
}
xcf_save_prop (info, PROP_OPACITY, layer->opacity);
xcf_save_prop (info, PROP_VISIBLE, GIMP_DRAWABLE(layer)->visible);
xcf_save_prop (info, PROP_VISIBLE,
gimp_drawable_get_visible (GIMP_DRAWABLE (layer)));
xcf_save_prop (info, PROP_LINKED, layer->linked);
xcf_save_prop (info, PROP_PRESERVE_TRANSPARENCY, layer->preserve_trans);
xcf_save_prop (info, PROP_APPLY_MASK, layer->apply_mask);
xcf_save_prop (info, PROP_EDIT_MASK, layer->edit_mask);
xcf_save_prop (info, PROP_SHOW_MASK, layer->show_mask);
xcf_save_prop (info, PROP_OFFSETS, GIMP_DRAWABLE(layer)->offset_x, GIMP_DRAWABLE(layer)->offset_y);
xcf_save_prop (info, PROP_OFFSETS,
GIMP_DRAWABLE (layer)->offset_x,
GIMP_DRAWABLE (layer)->offset_y);
xcf_save_prop (info, PROP_MODE, layer->mode);
xcf_save_prop (info, PROP_TATTOO, GIMP_DRAWABLE(layer)->tattoo);
if (parasite_list_length (GIMP_DRAWABLE(layer)->parasites) > 0)
xcf_save_prop (info, PROP_PARASITES, GIMP_DRAWABLE(layer)->parasites);
xcf_save_prop (info, PROP_TATTOO, GIMP_DRAWABLE (layer)->tattoo);
if (parasite_list_length (GIMP_DRAWABLE (layer)->parasites) > 0)
xcf_save_prop (info, PROP_PARASITES, GIMP_DRAWABLE (layer)->parasites);
xcf_save_prop (info, PROP_END);
}
@ -679,6 +683,8 @@ xcf_save_channel_props (XcfInfo *info,
GImage *gimage,
GimpChannel *channel)
{
guchar col[3];
if (channel == gimp_image_get_active_channel (gimage))
xcf_save_prop (info, PROP_ACTIVE_CHANNEL);
@ -686,19 +692,17 @@ xcf_save_channel_props (XcfInfo *info,
xcf_save_prop (info, PROP_SELECTION);
xcf_save_prop (info, PROP_OPACITY, (gint) (channel->color.a * 255.999));
xcf_save_prop (info, PROP_VISIBLE, GIMP_DRAWABLE(channel)->visible);
xcf_save_prop (info, PROP_VISIBLE,
gimp_drawable_get_visible (GIMP_DRAWABLE (channel)));
xcf_save_prop (info, PROP_SHOW_MASKED, channel->show_masked);
{
guchar col[3];
gimp_rgb_get_uchar (&channel->color, &col[0], &col[1], &col[2]);
xcf_save_prop (info, PROP_COLOR, col);
gimp_rgb_get_uchar (&channel->color, &col[0], &col[1], &col[2]);
xcf_save_prop (info, PROP_COLOR, col);
}
xcf_save_prop (info, PROP_TATTOO, GIMP_DRAWABLE (channel)->tattoo);
xcf_save_prop (info, PROP_TATTOO, GIMP_DRAWABLE(channel)->tattoo);
if (parasite_list_length (GIMP_DRAWABLE(channel)->parasites) > 0)
xcf_save_prop (info, PROP_PARASITES, GIMP_DRAWABLE(channel)->parasites);
if (parasite_list_length (GIMP_DRAWABLE (channel)->parasites) > 0)
xcf_save_prop (info, PROP_PARASITES, GIMP_DRAWABLE (channel)->parasites);
xcf_save_prop (info, PROP_END);
}
@ -2067,7 +2071,13 @@ xcf_load_layer_props (XcfInfo *info,
info->cp += xcf_read_int32 (info->fp, (guint32*) &layer->opacity, 1);
break;
case PROP_VISIBLE:
info->cp += xcf_read_int32 (info->fp, (guint32*) &GIMP_DRAWABLE(layer)->visible, 1);
{
gboolean visible;
info->cp += xcf_read_int32 (info->fp, (guint32 *) &visible, 1);
gimp_drawable_set_visible (GIMP_DRAWABLE (layer),
visible ? TRUE : FALSE);
}
break;
case PROP_LINKED:
info->cp += xcf_read_int32 (info->fp, (guint32*) &layer->linked, 1);
@ -2166,7 +2176,13 @@ xcf_load_channel_props (XcfInfo *info,
}
break;
case PROP_VISIBLE:
info->cp += xcf_read_int32 (info->fp, (guint32*) &GIMP_DRAWABLE(channel)->visible, 1);
{
gboolean visible;
info->cp += xcf_read_int32 (info->fp, (guint32 *) &visible, 1);
gimp_drawable_set_visible (GIMP_DRAWABLE (channel),
visible ? TRUE : FALSE);
}
break;
case PROP_SHOW_MASKED:
info->cp += xcf_read_int32 (info->fp, (guint32*) &channel->show_masked, 1);

View File

@ -1,6 +1,6 @@
/* XPM */
static char * eye_xpm[] = {
"24 24 76 1",
"22 22 76 1",
" c None",
". c #000000",
"+ c #292929",
@ -77,27 +77,25 @@ static char * eye_xpm[] = {
"I c #070707",
"J c #353535",
"K c #5A5A5A",
" ",
" ",
" ",
" ",
" ",
" ",
" ........ ",
" ...+@#$$%... ",
" ..&*=-;>,')!~,.. ",
" ..{]^/(_:...<^[}.. ",
" ..|123456-....7689.. ",
" .0a26b(6-.....cded]. ",
" .fgh8icj......kl1mn. ",
" o]p0q........rstuv ",
" wx1y>.......zAB, ",
" >CDE......FG.. ",
" ..EHIIJK.. ",
" ...... ",
" ",
" ",
" ",
" ",
" ",
" "};
" ",
" ",
" ",
" ",
" ",
" ........ ",
" ...+@#$$%... ",
" ..&*=-;>,')!~,.. ",
" ..{]^/(_:...<^[}.. ",
" ..|123456-....7689.. ",
" .0a26b(6-.....cded]. ",
" .fgh8icj......kl1mn. ",
" o]p0q........rstuv ",
" wx1y>.......zAB, ",
" >CDE......FG.. ",
" ..EHIIJK.. ",
" ...... ",
" ",
" ",
" ",
" ",
" "};

View File

@ -246,11 +246,7 @@ CODE
&channel_accessors('name', 'string', 'name', 1);
&channel_accessors('visible', 'boolean', 'visibility', 0,
[ '$outargs[0]->{alias} =~
s/(channel)/GIMP_DRAWABLE ($1)/',
'$invoke{code} =~
s/(channel)/GIMP_DRAWABLE ($1)/' ]);
&channel_accessors('visible', 'boolean', 'visibility', 1);
&channel_accessors('show_masked', 'boolean', 'composite method', 0,
<<'CODE');

View File

@ -468,9 +468,7 @@ HELP
&layer_accessors('name', 'string', 'name', 1, 0);
&layer_accessors('visible', 'boolean', 'visibility', 0, 0,
[ '$outargs[0]->{alias} =~ s/(layer)/GIMP_DRAWABLE ($1)/',
'$invoke{code} =~ s/(layer)/GIMP_DRAWABLE ($1)/' ]);
&layer_accessors('visible', 'boolean', 'visibility', 1, 0);
&layer_accessors('preserve_trans', 'boolean', 'preserve transperancy', 0, 1);