Commit bf8db4ad authored by EDT 1999  Austin Donnelly's avatar EDT 1999 Austin Donnelly Committed by Austin Donnelly
Browse files

Honest, guv, it's not a feature - it's a tightly integrated package of

Mon Sep 20 12:51:30 EDT 1999  Austin Donnelly  <austin@gimp.org>

	Honest, guv, it's not a feature - it's a tightly integrated
	package of undo system cleanups and fixes.

	NEW FILES:
	* app/undo_history.c: window showing recent undo (and redo) steps
	    available.
	* app/undo_types.h: broken out of undo.h to fix circular includes.

	MODIFIED FILES:
	* app/Makefile.am: compile undo_history.c
	* app/channel.h: use enum for channel undo type, not just magic
	    numbers.
	* app/layer.h: same for layer undos.
	* app/commands.c: edit_show_undo_history_cmd_callback() function to
	    pull up undo history window.
	* app/commands.h: prototype for above.
	* app/gdisplay.c: make undo / redo menu items sensitive according
	    to whether they would do anything.  Would be easy to change
	    the text to say what would be undone/redone, but I don't know
	    the GTK.
	* app/gimpimage.c: new signal emitted by gimage:
	    UNDO_EVENT. gimp_image_undo_event() function to emit it.
	* app/gimpimage.h: prototype for above.
	* app/gimpimageP.h: pushing_undo_group member is now an undo_type,
	    not an int.  Keep undo history widget here too (if created).
	* app/menus.c: add "Edit/Undo history..." to image menu.
	* app/undo.c: new types: enums undo_type and undo_state rather than
	    ints and magic numbers.  All undo_pop_* and undo_free_*
	    functions made static.  New static function
	    undo_type_to_name().  Issue undo event signals on various
	    important events (eg undo pushed, undo popped etc).
	    undo_push() now takes a "dirties_image" arg to say whether
	    image should be dirtied.  Layer moves now dirty the image.  A
	    couple of g_return_if_fails () on undo_pop and undo_redo to
	    assert we're not in the middle of an undo group.
	    undo_get_{undo,redo}_name() to peek at names of top items on
	    undo and redo stacks resp.   undo_map_over_{undo,redo}_stack()
	    to run a function for each item or group on stack.  Layer and
	    channel undos use symbolic names rather than 0 or 1.  Array
	    mapping undo types to names.
	* app/undo.h: split out undo types to undo_types.h.  Prototypes
	    for functions described above.  undo_event_t enum.
	    undo_history_new() prototype lives here too.

	Random other fixes:
	* app/gimpdrawable.c
	* app/image_render.c: default labels in switches to keep egcs happy.

	* app/nav_window.c: some fixes to (sort of) cope with image res !=
	    screen res.  Still needs work to handle non-square pixels
	    properly.

	* app/paths_dialog.c: bad idea to call gimp_image_dirty()
	    directly.  Even though it's currently commented out.
parent dae8fd9d
Mon Sep 20 12:51:30 EDT 1999 Austin Donnelly <austin@gimp.org>
Honest, guv, it's not a feature - it's a tightly integrated
package of undo system cleanups and fixes.
NEW FILES:
* app/undo_history.c: window showing recent undo (and redo) steps
available.
* app/undo_types.h: broken out of undo.h to fix circular includes.
MODIFIED FILES:
* app/Makefile.am: compile undo_history.c
* app/channel.h: use enum for channel undo type, not just magic
numbers.
* app/layer.h: same for layer undos.
* app/commands.c: edit_show_undo_history_cmd_callback() function to
pull up undo history window.
* app/commands.h: prototype for above.
* app/gdisplay.c: make undo / redo menu items sensitive according
to whether they would do anything. Would be easy to change
the text to say what would be undone/redone, but I don't know
the GTK.
* app/gimpimage.c: new signal emitted by gimage:
UNDO_EVENT. gimp_image_undo_event() function to emit it.
* app/gimpimage.h: prototype for above.
* app/gimpimageP.h: pushing_undo_group member is now an undo_type,
not an int. Keep undo history widget here too (if created).
* app/menus.c: add "Edit/Undo history..." to image menu.
* app/undo.c: new types: enums undo_type and undo_state rather than
ints and magic numbers. All undo_pop_* and undo_free_*
functions made static. New static function
undo_type_to_name(). Issue undo event signals on various
important events (eg undo pushed, undo popped etc).
undo_push() now takes a "dirties_image" arg to say whether
image should be dirtied. Layer moves now dirty the image. A
couple of g_return_if_fails () on undo_pop and undo_redo to
assert we're not in the middle of an undo group.
undo_get_{undo,redo}_name() to peek at names of top items on
undo and redo stacks resp. undo_map_over_{undo,redo}_stack()
to run a function for each item or group on stack. Layer and
channel undos use symbolic names rather than 0 or 1. Array
mapping undo types to names.
* app/undo.h: split out undo types to undo_types.h. Prototypes
for functions described above. undo_event_t enum.
undo_history_new() prototype lives here too.
Random other fixes:
* app/gimpdrawable.c
* app/image_render.c: default labels in switches to keep egcs happy.
* app/nav_window.c: some fixes to (sort of) cope with image res !=
screen res. Still needs work to handle non-square pixels
properly.
* app/paths_dialog.c: bad idea to call gimp_image_dirty()
directly. Even though it's currently commented out.
Mon Sep 20 18:23:18 1999 ape@gandalf.spacetec.no (Asbjorn Pettersen)
* configure.in: Add app/unittest/Makefile
......
......@@ -418,6 +418,7 @@ gimp_SOURCES = \
undo.c \
undo.h \
undo_cmds.c \
undo_history.c \
unitrc.h \
unit_cmds.c \
wilber.h \
......
......@@ -236,6 +236,25 @@ edit_redo_cmd_callback (GtkWidget *widget,
undo_redo (gdisp->gimage);
}
void
edit_show_undo_history_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
GImage * gimage;
return_if_no_display (gdisp);
gimage = gdisp->gimage;
if (!gimage->undo_history)
gimage->undo_history = undo_history_new (gimage);
if (!GTK_WIDGET_VISIBLE (gimage->undo_history))
gtk_widget_show (gimage->undo_history);
else
gdk_window_raise (gimage->undo_history->window);
}
void
edit_named_cut_cmd_callback (GtkWidget *widget,
gpointer client_data)
......
......@@ -22,6 +22,7 @@ void edit_fill_cmd_callback (GtkWidget *, gpointer);
void edit_stroke_cmd_callback (GtkWidget *, gpointer);
void edit_undo_cmd_callback (GtkWidget *, gpointer);
void edit_redo_cmd_callback (GtkWidget *, gpointer);
void edit_show_undo_history_cmd_callback (GtkWidget *, gpointer);
void edit_named_cut_cmd_callback (GtkWidget *, gpointer);
void edit_named_copy_cmd_callback (GtkWidget *, gpointer);
void edit_named_paste_cmd_callback (GtkWidget *, gpointer);
......
......@@ -48,16 +48,22 @@ typedef enum
GtkType gimp_channel_get_type (void);
typedef enum {
CHANNEL_ADD_UNDO,
CHANNEL_REMOVE_UNDO
} channel_undo_type;
/* Special undo type */
typedef struct _ChannelUndo ChannelUndo;
struct _ChannelUndo
{
Channel *channel; /* the actual channel */
gint prev_position; /* former position in list */
Channel *prev_channel; /* previous active channel */
gint undo_type; /* is this a new channel undo */
/* or a remove channel undo? */
Channel *channel; /* the actual channel */
gint prev_position; /* former position in list */
Channel *prev_channel; /* previous active channel */
channel_undo_type undo_type; /* is this a new channel undo */
/* or a remove channel undo? */
};
/* Special undo type */
......
......@@ -236,6 +236,25 @@ edit_redo_cmd_callback (GtkWidget *widget,
undo_redo (gdisp->gimage);
}
void
edit_show_undo_history_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay * gdisp;
GImage * gimage;
return_if_no_display (gdisp);
gimage = gdisp->gimage;
if (!gimage->undo_history)
gimage->undo_history = undo_history_new (gimage);
if (!GTK_WIDGET_VISIBLE (gimage->undo_history))
gtk_widget_show (gimage->undo_history);
else
gdk_window_raise (gimage->undo_history->window);
}
void
edit_named_cut_cmd_callback (GtkWidget *widget,
gpointer client_data)
......
......@@ -22,6 +22,7 @@ void edit_fill_cmd_callback (GtkWidget *, gpointer);
void edit_stroke_cmd_callback (GtkWidget *, gpointer);
void edit_undo_cmd_callback (GtkWidget *, gpointer);
void edit_redo_cmd_callback (GtkWidget *, gpointer);
void edit_show_undo_history_cmd_callback (GtkWidget *, gpointer);
void edit_named_cut_cmd_callback (GtkWidget *, gpointer);
void edit_named_copy_cmd_callback (GtkWidget *, gpointer);
void edit_named_paste_cmd_callback (GtkWidget *, gpointer);
......
......@@ -48,16 +48,22 @@ typedef enum
GtkType gimp_channel_get_type (void);
typedef enum {
CHANNEL_ADD_UNDO,
CHANNEL_REMOVE_UNDO
} channel_undo_type;
/* Special undo type */
typedef struct _ChannelUndo ChannelUndo;
struct _ChannelUndo
{
Channel *channel; /* the actual channel */
gint prev_position; /* former position in list */
Channel *prev_channel; /* previous active channel */
gint undo_type; /* is this a new channel undo */
/* or a remove channel undo? */
Channel *channel; /* the actual channel */
gint prev_position; /* former position in list */
Channel *prev_channel; /* previous active channel */
channel_undo_type undo_type; /* is this a new channel undo */
/* or a remove channel undo? */
};
/* Special undo type */
......
......@@ -48,16 +48,22 @@ typedef enum
GtkType gimp_channel_get_type (void);
typedef enum {
CHANNEL_ADD_UNDO,
CHANNEL_REMOVE_UNDO
} channel_undo_type;
/* Special undo type */
typedef struct _ChannelUndo ChannelUndo;
struct _ChannelUndo
{
Channel *channel; /* the actual channel */
gint prev_position; /* former position in list */
Channel *prev_channel; /* previous active channel */
gint undo_type; /* is this a new channel undo */
/* or a remove channel undo? */
Channel *channel; /* the actual channel */
gint prev_position; /* former position in list */
Channel *prev_channel; /* previous active channel */
channel_undo_type undo_type; /* is this a new channel undo */
/* or a remove channel undo? */
};
/* Special undo type */
......
......@@ -309,6 +309,9 @@ gimp_drawable_type_with_alpha (GimpDrawable *drawable)
return GRAYA_GIMAGE; break;
case INDEXED_GIMAGE:
return INDEXEDA_GIMAGE; break;
default:
g_assert_not_reached ();
break;
}
return 0;
}
......
......@@ -98,6 +98,7 @@ enum {
RESIZE,
RESTRUCTURE,
COLORMAP_CHANGED,
UNDO_EVENT,
LAST_SIGNAL
};
......@@ -140,6 +141,9 @@ gimp_image_class_init (GimpImageClass *klass)
gimp_image_signals[COLORMAP_CHANGED] =
gimp_signal_new ("colormap_changed", GTK_RUN_FIRST, type, 0,
gimp_sigtype_int);
gimp_image_signals[UNDO_EVENT] =
gimp_signal_new ("undo_event", GTK_RUN_FIRST, type, 0,
gimp_sigtype_int);
gtk_object_class_add_signals (object_class, gimp_image_signals, LAST_SIGNAL);
}
......@@ -3359,6 +3363,12 @@ gimp_image_enable_undo (GimpImage *gimage)
return gimp_image_thaw_undo (gimage);
}
void
gimp_image_undo_event (GimpImage *gimage, int event)
{
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[UNDO_EVENT], event);
}
/* NOTE about the gimage->dirty counter:
* If 0, then the image is clean (ie, copy on disk is the same as the one
......
......@@ -249,6 +249,7 @@ gboolean gimp_image_enable_undo (GimpImage *);
gboolean gimp_image_disable_undo (GimpImage *);
gboolean gimp_image_freeze_undo (GimpImage *);
gboolean gimp_image_thaw_undo (GimpImage *);
void gimp_image_undo_event (GimpImage *, int);
gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
......
......@@ -98,6 +98,7 @@ enum {
RESIZE,
RESTRUCTURE,
COLORMAP_CHANGED,
UNDO_EVENT,
LAST_SIGNAL
};
......@@ -140,6 +141,9 @@ gimp_image_class_init (GimpImageClass *klass)
gimp_image_signals[COLORMAP_CHANGED] =
gimp_signal_new ("colormap_changed", GTK_RUN_FIRST, type, 0,
gimp_sigtype_int);
gimp_image_signals[UNDO_EVENT] =
gimp_signal_new ("undo_event", GTK_RUN_FIRST, type, 0,
gimp_sigtype_int);
gtk_object_class_add_signals (object_class, gimp_image_signals, LAST_SIGNAL);
}
......@@ -3359,6 +3363,12 @@ gimp_image_enable_undo (GimpImage *gimage)
return gimp_image_thaw_undo (gimage);
}
void
gimp_image_undo_event (GimpImage *gimage, int event)
{
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[UNDO_EVENT], event);
}
/* NOTE about the gimage->dirty counter:
* If 0, then the image is clean (ie, copy on disk is the same as the one
......
......@@ -249,6 +249,7 @@ gboolean gimp_image_enable_undo (GimpImage *);
gboolean gimp_image_disable_undo (GimpImage *);
gboolean gimp_image_freeze_undo (GimpImage *);
gboolean gimp_image_thaw_undo (GimpImage *);
void gimp_image_undo_event (GimpImage *, int);
gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
......
......@@ -98,6 +98,7 @@ enum {
RESIZE,
RESTRUCTURE,
COLORMAP_CHANGED,
UNDO_EVENT,
LAST_SIGNAL
};
......@@ -140,6 +141,9 @@ gimp_image_class_init (GimpImageClass *klass)
gimp_image_signals[COLORMAP_CHANGED] =
gimp_signal_new ("colormap_changed", GTK_RUN_FIRST, type, 0,
gimp_sigtype_int);
gimp_image_signals[UNDO_EVENT] =
gimp_signal_new ("undo_event", GTK_RUN_FIRST, type, 0,
gimp_sigtype_int);
gtk_object_class_add_signals (object_class, gimp_image_signals, LAST_SIGNAL);
}
......@@ -3359,6 +3363,12 @@ gimp_image_enable_undo (GimpImage *gimage)
return gimp_image_thaw_undo (gimage);
}
void
gimp_image_undo_event (GimpImage *gimage, int event)
{
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[UNDO_EVENT], event);
}
/* NOTE about the gimage->dirty counter:
* If 0, then the image is clean (ie, copy on disk is the same as the one
......
......@@ -249,6 +249,7 @@ gboolean gimp_image_enable_undo (GimpImage *);
gboolean gimp_image_disable_undo (GimpImage *);
gboolean gimp_image_freeze_undo (GimpImage *);
gboolean gimp_image_thaw_undo (GimpImage *);
void gimp_image_undo_event (GimpImage *, int);
gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
......
......@@ -98,6 +98,7 @@ enum {
RESIZE,
RESTRUCTURE,
COLORMAP_CHANGED,
UNDO_EVENT,
LAST_SIGNAL
};
......@@ -140,6 +141,9 @@ gimp_image_class_init (GimpImageClass *klass)
gimp_image_signals[COLORMAP_CHANGED] =
gimp_signal_new ("colormap_changed", GTK_RUN_FIRST, type, 0,
gimp_sigtype_int);
gimp_image_signals[UNDO_EVENT] =
gimp_signal_new ("undo_event", GTK_RUN_FIRST, type, 0,
gimp_sigtype_int);
gtk_object_class_add_signals (object_class, gimp_image_signals, LAST_SIGNAL);
}
......@@ -3359,6 +3363,12 @@ gimp_image_enable_undo (GimpImage *gimage)
return gimp_image_thaw_undo (gimage);
}
void
gimp_image_undo_event (GimpImage *gimage, int event)
{
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[UNDO_EVENT], event);
}
/* NOTE about the gimage->dirty counter:
* If 0, then the image is clean (ie, copy on disk is the same as the one
......
......@@ -249,6 +249,7 @@ gboolean gimp_image_enable_undo (GimpImage *);
gboolean gimp_image_disable_undo (GimpImage *);
gboolean gimp_image_freeze_undo (GimpImage *);
gboolean gimp_image_thaw_undo (GimpImage *);
void gimp_image_undo_event (GimpImage *, int);
gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
......
......@@ -98,6 +98,7 @@ enum {
RESIZE,
RESTRUCTURE,
COLORMAP_CHANGED,
UNDO_EVENT,
LAST_SIGNAL
};
......@@ -140,6 +141,9 @@ gimp_image_class_init (GimpImageClass *klass)
gimp_image_signals[COLORMAP_CHANGED] =
gimp_signal_new ("colormap_changed", GTK_RUN_FIRST, type, 0,
gimp_sigtype_int);
gimp_image_signals[UNDO_EVENT] =
gimp_signal_new ("undo_event", GTK_RUN_FIRST, type, 0,
gimp_sigtype_int);
gtk_object_class_add_signals (object_class, gimp_image_signals, LAST_SIGNAL);
}
......@@ -3359,6 +3363,12 @@ gimp_image_enable_undo (GimpImage *gimage)
return gimp_image_thaw_undo (gimage);
}
void
gimp_image_undo_event (GimpImage *gimage, int event)
{
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[UNDO_EVENT], event);
}
/* NOTE about the gimage->dirty counter:
* If 0, then the image is clean (ie, copy on disk is the same as the one
......
......@@ -249,6 +249,7 @@ gboolean gimp_image_enable_undo (GimpImage *);
gboolean gimp_image_disable_undo (GimpImage *);
gboolean gimp_image_freeze_undo (GimpImage *);
gboolean gimp_image_thaw_undo (GimpImage *);
void gimp_image_undo_event (GimpImage *, int);
gint gimp_image_dirty (GimpImage *);
gint gimp_image_clean (GimpImage *);
void gimp_image_clean_all (GimpImage *);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment