don't want sub-undo type undo_push_channel() takes ADD or REMOVE type

Fri Oct  1 15:18:34 1999  Austin Donnelly  <and1000@research.att.com>

	* app/channel.h: don't want sub-undo type
	* app/gimpimage.c: undo_push_channel() takes ADD or REMOVE type
	* app/undo.c: undo_push_channel() takes type.  More specific
	    CHANNEL_{ADD,REMOVE}_UNDO types.
	* app/undo.h: undo_push_channel() prototype.
	* app/undo_types.h: More specific CHANNEL_{ADD,REMOVE}_UNDO types.
This commit is contained in:
Austin Donnelly 1999-10-01 19:26:56 +00:00 committed by Austin Donnelly
parent 11409e97fb
commit 4b4d3934db
18 changed files with 137 additions and 163 deletions

View File

@ -1,3 +1,12 @@
Fri Oct 1 15:18:34 1999 Austin Donnelly <and1000@research.att.com>
* app/channel.h: don't want sub-undo type
* app/gimpimage.c: undo_push_channel() takes ADD or REMOVE type
* app/undo.c: undo_push_channel() takes type. More specific
CHANNEL_{ADD,REMOVE}_UNDO types.
* app/undo.h: undo_push_channel() prototype.
* app/undo_types.h: More specific CHANNEL_{ADD,REMOVE}_UNDO types.
Fri Oct 1 12:46:12 1999 Austin Donnelly <austin@gimp.org>
* gimprc.in: comment typo fix, plus add %D* to default

View File

@ -48,12 +48,6 @@ typedef enum
GtkType gimp_channel_get_type (void);
typedef enum /*< skip >*/
{
CHANNEL_ADD_UNDO,
CHANNEL_REMOVE_UNDO
} ChannelUndoType;
/* Special undo type */
typedef struct _ChannelUndo ChannelUndo;
@ -63,8 +57,6 @@ struct _ChannelUndo
Channel *channel; /* the actual channel */
gint prev_position; /* former position in list */
Channel *prev_channel; /* previous active channel */
ChannelUndoType undo_type; /* is this a new channel undo */
/* or a remove channel undo? */
};
/* Special undo type */

View File

@ -48,12 +48,6 @@ typedef enum
GtkType gimp_channel_get_type (void);
typedef enum /*< skip >*/
{
CHANNEL_ADD_UNDO,
CHANNEL_REMOVE_UNDO
} ChannelUndoType;
/* Special undo type */
typedef struct _ChannelUndo ChannelUndo;
@ -63,8 +57,6 @@ struct _ChannelUndo
Channel *channel; /* the actual channel */
gint prev_position; /* former position in list */
Channel *prev_channel; /* previous active channel */
ChannelUndoType undo_type; /* is this a new channel undo */
/* or a remove channel undo? */
};
/* Special undo type */

View File

@ -48,12 +48,6 @@ typedef enum
GtkType gimp_channel_get_type (void);
typedef enum /*< skip >*/
{
CHANNEL_ADD_UNDO,
CHANNEL_REMOVE_UNDO
} ChannelUndoType;
/* Special undo type */
typedef struct _ChannelUndo ChannelUndo;
@ -63,8 +57,6 @@ struct _ChannelUndo
Channel *channel; /* the actual channel */
gint prev_position; /* former position in list */
Channel *prev_channel; /* previous active channel */
ChannelUndoType undo_type; /* is this a new channel undo */
/* or a remove channel undo? */
};
/* Special undo type */

View File

@ -3232,8 +3232,7 @@ gimp_image_add_channel (GimpImage *gimage,
cu->channel = channel;
cu->prev_position = 0;
cu->prev_channel = gimage->active_channel;
cu->undo_type = 0;
undo_push_channel (gimage, cu);
undo_push_channel (gimage, CHANNEL_ADD_UNDO, cu);
/* add the channel to the list */
gimage->channels = g_slist_prepend (gimage->channels, channel_ref (channel));
@ -3261,7 +3260,6 @@ gimp_image_remove_channel (GimpImage *gimage,
cu->channel = channel;
cu->prev_position = gimp_image_get_channel_index (gimage, channel);
cu->prev_channel = gimage->active_channel;
cu->undo_type = 1;
gimage->channels = g_slist_remove (gimage->channels, channel);
@ -3277,7 +3275,7 @@ gimp_image_remove_channel (GimpImage *gimage,
drawable_update (GIMP_DRAWABLE(channel), 0, 0, drawable_width (GIMP_DRAWABLE(channel)), drawable_height (GIMP_DRAWABLE(channel)));
/* Important to push the undo here in case the push fails */
undo_push_channel (gimage, cu);
undo_push_channel (gimage, CHANNEL_REMOVE_UNDO, cu);
return channel;
}

View File

@ -3232,8 +3232,7 @@ gimp_image_add_channel (GimpImage *gimage,
cu->channel = channel;
cu->prev_position = 0;
cu->prev_channel = gimage->active_channel;
cu->undo_type = 0;
undo_push_channel (gimage, cu);
undo_push_channel (gimage, CHANNEL_ADD_UNDO, cu);
/* add the channel to the list */
gimage->channels = g_slist_prepend (gimage->channels, channel_ref (channel));
@ -3261,7 +3260,6 @@ gimp_image_remove_channel (GimpImage *gimage,
cu->channel = channel;
cu->prev_position = gimp_image_get_channel_index (gimage, channel);
cu->prev_channel = gimage->active_channel;
cu->undo_type = 1;
gimage->channels = g_slist_remove (gimage->channels, channel);
@ -3277,7 +3275,7 @@ gimp_image_remove_channel (GimpImage *gimage,
drawable_update (GIMP_DRAWABLE(channel), 0, 0, drawable_width (GIMP_DRAWABLE(channel)), drawable_height (GIMP_DRAWABLE(channel)));
/* Important to push the undo here in case the push fails */
undo_push_channel (gimage, cu);
undo_push_channel (gimage, CHANNEL_REMOVE_UNDO, cu);
return channel;
}

View File

@ -3232,8 +3232,7 @@ gimp_image_add_channel (GimpImage *gimage,
cu->channel = channel;
cu->prev_position = 0;
cu->prev_channel = gimage->active_channel;
cu->undo_type = 0;
undo_push_channel (gimage, cu);
undo_push_channel (gimage, CHANNEL_ADD_UNDO, cu);
/* add the channel to the list */
gimage->channels = g_slist_prepend (gimage->channels, channel_ref (channel));
@ -3261,7 +3260,6 @@ gimp_image_remove_channel (GimpImage *gimage,
cu->channel = channel;
cu->prev_position = gimp_image_get_channel_index (gimage, channel);
cu->prev_channel = gimage->active_channel;
cu->undo_type = 1;
gimage->channels = g_slist_remove (gimage->channels, channel);
@ -3277,7 +3275,7 @@ gimp_image_remove_channel (GimpImage *gimage,
drawable_update (GIMP_DRAWABLE(channel), 0, 0, drawable_width (GIMP_DRAWABLE(channel)), drawable_height (GIMP_DRAWABLE(channel)));
/* Important to push the undo here in case the push fails */
undo_push_channel (gimage, cu);
undo_push_channel (gimage, CHANNEL_REMOVE_UNDO, cu);
return channel;
}

View File

@ -3232,8 +3232,7 @@ gimp_image_add_channel (GimpImage *gimage,
cu->channel = channel;
cu->prev_position = 0;
cu->prev_channel = gimage->active_channel;
cu->undo_type = 0;
undo_push_channel (gimage, cu);
undo_push_channel (gimage, CHANNEL_ADD_UNDO, cu);
/* add the channel to the list */
gimage->channels = g_slist_prepend (gimage->channels, channel_ref (channel));
@ -3261,7 +3260,6 @@ gimp_image_remove_channel (GimpImage *gimage,
cu->channel = channel;
cu->prev_position = gimp_image_get_channel_index (gimage, channel);
cu->prev_channel = gimage->active_channel;
cu->undo_type = 1;
gimage->channels = g_slist_remove (gimage->channels, channel);
@ -3277,7 +3275,7 @@ gimp_image_remove_channel (GimpImage *gimage,
drawable_update (GIMP_DRAWABLE(channel), 0, 0, drawable_width (GIMP_DRAWABLE(channel)), drawable_height (GIMP_DRAWABLE(channel)));
/* Important to push the undo here in case the push fails */
undo_push_channel (gimage, cu);
undo_push_channel (gimage, CHANNEL_REMOVE_UNDO, cu);
return channel;
}

View File

@ -3232,8 +3232,7 @@ gimp_image_add_channel (GimpImage *gimage,
cu->channel = channel;
cu->prev_position = 0;
cu->prev_channel = gimage->active_channel;
cu->undo_type = 0;
undo_push_channel (gimage, cu);
undo_push_channel (gimage, CHANNEL_ADD_UNDO, cu);
/* add the channel to the list */
gimage->channels = g_slist_prepend (gimage->channels, channel_ref (channel));
@ -3261,7 +3260,6 @@ gimp_image_remove_channel (GimpImage *gimage,
cu->channel = channel;
cu->prev_position = gimp_image_get_channel_index (gimage, channel);
cu->prev_channel = gimage->active_channel;
cu->undo_type = 1;
gimage->channels = g_slist_remove (gimage->channels, channel);
@ -3277,7 +3275,7 @@ gimp_image_remove_channel (GimpImage *gimage,
drawable_update (GIMP_DRAWABLE(channel), 0, 0, drawable_width (GIMP_DRAWABLE(channel)), drawable_height (GIMP_DRAWABLE(channel)));
/* Important to push the undo here in case the push fails */
undo_push_channel (gimage, cu);
undo_push_channel (gimage, CHANNEL_REMOVE_UNDO, cu);
return channel;
}

View File

@ -1640,17 +1640,22 @@ undo_free_layer_mask (UndoState state,
int
undo_push_channel (GImage *gimage,
UndoType type,
void *cu_ptr)
{
ChannelUndo *cu;
Undo *new;
int size;
g_return_val_if_fail (type == CHANNEL_ADD_UNDO ||
type == CHANNEL_REMOVE_UNDO,
FALSE);
cu = (ChannelUndo *) cu_ptr;
size = channel_size (cu->channel) + sizeof (ChannelUndo);
if ((new = undo_push (gimage, size, CHANNEL_UNDO, TRUE)))
if ((new = undo_push (gimage, size, type, TRUE)))
{
new->data = cu_ptr;
new->pop_func = undo_pop_channel;
@ -1660,7 +1665,7 @@ undo_push_channel (GImage *gimage,
}
else
{
if (cu->undo_type == CHANNEL_REMOVE_UNDO)
if (type == CHANNEL_REMOVE_UNDO)
channel_delete (cu->channel);
g_free (cu);
return FALSE;
@ -1679,8 +1684,8 @@ undo_pop_channel (GImage *gimage,
cu = (ChannelUndo *) cu_ptr;
/* remove channel */
if ((state == UNDO && cu->undo_type == CHANNEL_ADD_UNDO) ||
(state == REDO && cu->undo_type == CHANNEL_REMOVE_UNDO))
if ((state == UNDO && type == CHANNEL_ADD_UNDO) ||
(state == REDO && type == CHANNEL_REMOVE_UNDO))
{
/* record the current position */
cu->prev_position = gimage_get_channel_index (gimage, cu->channel);
@ -1729,8 +1734,8 @@ undo_free_channel (UndoState state,
* stack and it's a channel add, or if we're freeing from
* the undo stack and it's a channel remove
*/
if ((state == REDO && cu->undo_type == CHANNEL_ADD_UNDO) ||
(state == UNDO && cu->undo_type == CHANNEL_REMOVE_UNDO))
if ((state == REDO && type == CHANNEL_ADD_UNDO) ||
(state == UNDO && type == CHANNEL_REMOVE_UNDO))
channel_delete (cu->channel);
g_free (cu);
@ -2744,7 +2749,8 @@ static struct undo_name_t {
{LAYER_MASK_REMOVE_UNDO, N_("delete layer mask")}, /* ok */
{LAYER_RENAME_UNDO, N_("rename layer")},
{LAYER_POSITION, N_("layer position")}, /* unused? */
{CHANNEL_UNDO, N_("channel")},
{CHANNEL_ADD_UNDO, N_("new channel")},
{CHANNEL_REMOVE_UNDO, N_("delete channel")},
{CHANNEL_MOD, N_("channel mod")},
{FS_TO_LAYER_UNDO, N_("FS to layer")}, /* ok */
{GIMAGE_MOD, N_("gimage")},

View File

@ -39,7 +39,7 @@ int undo_push_layer_mod (GImage *, void *);
int undo_push_layer_mask (GImage *, UndoType, void *);
int undo_push_layer_change (GImage *, int);
int undo_push_layer_position (GImage *, int);
int undo_push_channel (GImage *, void *);
int undo_push_channel (GImage *, UndoType, void *);
int undo_push_channel_mod (GImage *, void *);
int undo_push_fs_to_layer (GImage *, void *);
int undo_push_fs_rigor (GImage *, int);

View File

@ -3232,8 +3232,7 @@ gimp_image_add_channel (GimpImage *gimage,
cu->channel = channel;
cu->prev_position = 0;
cu->prev_channel = gimage->active_channel;
cu->undo_type = 0;
undo_push_channel (gimage, cu);
undo_push_channel (gimage, CHANNEL_ADD_UNDO, cu);
/* add the channel to the list */
gimage->channels = g_slist_prepend (gimage->channels, channel_ref (channel));
@ -3261,7 +3260,6 @@ gimp_image_remove_channel (GimpImage *gimage,
cu->channel = channel;
cu->prev_position = gimp_image_get_channel_index (gimage, channel);
cu->prev_channel = gimage->active_channel;
cu->undo_type = 1;
gimage->channels = g_slist_remove (gimage->channels, channel);
@ -3277,7 +3275,7 @@ gimp_image_remove_channel (GimpImage *gimage,
drawable_update (GIMP_DRAWABLE(channel), 0, 0, drawable_width (GIMP_DRAWABLE(channel)), drawable_height (GIMP_DRAWABLE(channel)));
/* Important to push the undo here in case the push fails */
undo_push_channel (gimage, cu);
undo_push_channel (gimage, CHANNEL_REMOVE_UNDO, cu);
return channel;
}

View File

@ -3232,8 +3232,7 @@ gimp_image_add_channel (GimpImage *gimage,
cu->channel = channel;
cu->prev_position = 0;
cu->prev_channel = gimage->active_channel;
cu->undo_type = 0;
undo_push_channel (gimage, cu);
undo_push_channel (gimage, CHANNEL_ADD_UNDO, cu);
/* add the channel to the list */
gimage->channels = g_slist_prepend (gimage->channels, channel_ref (channel));
@ -3261,7 +3260,6 @@ gimp_image_remove_channel (GimpImage *gimage,
cu->channel = channel;
cu->prev_position = gimp_image_get_channel_index (gimage, channel);
cu->prev_channel = gimage->active_channel;
cu->undo_type = 1;
gimage->channels = g_slist_remove (gimage->channels, channel);
@ -3277,7 +3275,7 @@ gimp_image_remove_channel (GimpImage *gimage,
drawable_update (GIMP_DRAWABLE(channel), 0, 0, drawable_width (GIMP_DRAWABLE(channel)), drawable_height (GIMP_DRAWABLE(channel)));
/* Important to push the undo here in case the push fails */
undo_push_channel (gimage, cu);
undo_push_channel (gimage, CHANNEL_REMOVE_UNDO, cu);
return channel;
}

View File

@ -48,12 +48,6 @@ typedef enum
GtkType gimp_channel_get_type (void);
typedef enum /*< skip >*/
{
CHANNEL_ADD_UNDO,
CHANNEL_REMOVE_UNDO
} ChannelUndoType;
/* Special undo type */
typedef struct _ChannelUndo ChannelUndo;
@ -63,8 +57,6 @@ struct _ChannelUndo
Channel *channel; /* the actual channel */
gint prev_position; /* former position in list */
Channel *prev_channel; /* previous active channel */
ChannelUndoType undo_type; /* is this a new channel undo */
/* or a remove channel undo? */
};
/* Special undo type */

View File

@ -3232,8 +3232,7 @@ gimp_image_add_channel (GimpImage *gimage,
cu->channel = channel;
cu->prev_position = 0;
cu->prev_channel = gimage->active_channel;
cu->undo_type = 0;
undo_push_channel (gimage, cu);
undo_push_channel (gimage, CHANNEL_ADD_UNDO, cu);
/* add the channel to the list */
gimage->channels = g_slist_prepend (gimage->channels, channel_ref (channel));
@ -3261,7 +3260,6 @@ gimp_image_remove_channel (GimpImage *gimage,
cu->channel = channel;
cu->prev_position = gimp_image_get_channel_index (gimage, channel);
cu->prev_channel = gimage->active_channel;
cu->undo_type = 1;
gimage->channels = g_slist_remove (gimage->channels, channel);
@ -3277,7 +3275,7 @@ gimp_image_remove_channel (GimpImage *gimage,
drawable_update (GIMP_DRAWABLE(channel), 0, 0, drawable_width (GIMP_DRAWABLE(channel)), drawable_height (GIMP_DRAWABLE(channel)));
/* Important to push the undo here in case the push fails */
undo_push_channel (gimage, cu);
undo_push_channel (gimage, CHANNEL_REMOVE_UNDO, cu);
return channel;
}

View File

@ -1640,17 +1640,22 @@ undo_free_layer_mask (UndoState state,
int
undo_push_channel (GImage *gimage,
UndoType type,
void *cu_ptr)
{
ChannelUndo *cu;
Undo *new;
int size;
g_return_val_if_fail (type == CHANNEL_ADD_UNDO ||
type == CHANNEL_REMOVE_UNDO,
FALSE);
cu = (ChannelUndo *) cu_ptr;
size = channel_size (cu->channel) + sizeof (ChannelUndo);
if ((new = undo_push (gimage, size, CHANNEL_UNDO, TRUE)))
if ((new = undo_push (gimage, size, type, TRUE)))
{
new->data = cu_ptr;
new->pop_func = undo_pop_channel;
@ -1660,7 +1665,7 @@ undo_push_channel (GImage *gimage,
}
else
{
if (cu->undo_type == CHANNEL_REMOVE_UNDO)
if (type == CHANNEL_REMOVE_UNDO)
channel_delete (cu->channel);
g_free (cu);
return FALSE;
@ -1679,8 +1684,8 @@ undo_pop_channel (GImage *gimage,
cu = (ChannelUndo *) cu_ptr;
/* remove channel */
if ((state == UNDO && cu->undo_type == CHANNEL_ADD_UNDO) ||
(state == REDO && cu->undo_type == CHANNEL_REMOVE_UNDO))
if ((state == UNDO && type == CHANNEL_ADD_UNDO) ||
(state == REDO && type == CHANNEL_REMOVE_UNDO))
{
/* record the current position */
cu->prev_position = gimage_get_channel_index (gimage, cu->channel);
@ -1729,8 +1734,8 @@ undo_free_channel (UndoState state,
* stack and it's a channel add, or if we're freeing from
* the undo stack and it's a channel remove
*/
if ((state == REDO && cu->undo_type == CHANNEL_ADD_UNDO) ||
(state == UNDO && cu->undo_type == CHANNEL_REMOVE_UNDO))
if ((state == REDO && type == CHANNEL_ADD_UNDO) ||
(state == UNDO && type == CHANNEL_REMOVE_UNDO))
channel_delete (cu->channel);
g_free (cu);
@ -2744,7 +2749,8 @@ static struct undo_name_t {
{LAYER_MASK_REMOVE_UNDO, N_("delete layer mask")}, /* ok */
{LAYER_RENAME_UNDO, N_("rename layer")},
{LAYER_POSITION, N_("layer position")}, /* unused? */
{CHANNEL_UNDO, N_("channel")},
{CHANNEL_ADD_UNDO, N_("new channel")},
{CHANNEL_REMOVE_UNDO, N_("delete channel")},
{CHANNEL_MOD, N_("channel mod")},
{FS_TO_LAYER_UNDO, N_("FS to layer")}, /* ok */
{GIMAGE_MOD, N_("gimage")},

View File

@ -39,7 +39,7 @@ int undo_push_layer_mod (GImage *, void *);
int undo_push_layer_mask (GImage *, UndoType, void *);
int undo_push_layer_change (GImage *, int);
int undo_push_layer_position (GImage *, int);
int undo_push_channel (GImage *, void *);
int undo_push_channel (GImage *, UndoType, void *);
int undo_push_channel_mod (GImage *, void *);
int undo_push_fs_to_layer (GImage *, void *);
int undo_push_fs_rigor (GImage *, int);

View File

@ -42,7 +42,8 @@ typedef enum
LAYER_MASK_REMOVE_UNDO,
LAYER_RENAME_UNDO,
LAYER_POSITION,
CHANNEL_UNDO,
CHANNEL_ADD_UNDO,
CHANNEL_REMOVE_UNDO,
CHANNEL_MOD,
FS_TO_LAYER_UNDO,
GIMAGE_MOD,