2005-09-14 [paul] 1.9.14cvs26
[claws.git] / src / undo.h
index 36fd7a7c01383723bf275fe6b4b611c677d2938c..dd00ca15f9dd1d87d750a9e6b9e41a5b7354c968 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-// code ported from gedit
+/* code ported from gedit */
 
 #ifndef __UNDO_H__
 #define __UNDO_H__
 
-typedef enum {
-        UNDO_ACTION_INSERT,
-        UNDO_ACTION_DELETE,
+#include <glib.h>
+#include <gtk/gtktextview.h>
+#include <gtk/gtkitemfactory.h>
+
+typedef enum 
+{
+       UNDO_ACTION_INSERT,
+       UNDO_ACTION_DELETE,
+       UNDO_ACTION_REPLACE_INSERT,
+       UNDO_ACTION_REPLACE_DELETE
 } UndoAction;
 
-typedef enum {
-        UNDO_STATE_TRUE,
-        UNDO_STATE_FALSE,
-        UNDO_STATE_UNCHANGED,
-        UNDO_STATE_REFRESH,
+typedef enum 
+{
+       UNDO_STATE_TRUE,
+       UNDO_STATE_FALSE,
+       UNDO_STATE_UNCHANGED,
+       UNDO_STATE_REFRESH
 } UndoState;
 
+typedef struct _UndoMain UndoMain;
+
+typedef void (*UndoChangeStateFunc)    (UndoMain       *undostruct,
+                                        gint            undo_state,
+                                        gint            redo_state,
+                                        gpointer        data);
+
+struct _UndoMain 
+{
+       GtkTextView *textview;
+
+       GList *undo;
+       GList *redo;
+
+       UndoChangeStateFunc change_state_func;
+       gpointer change_state_data;
+
+       gboolean undo_state : 1;
+       gboolean redo_state : 1;
+
+       gint paste;
+};
+
+UndoMain *undo_init            (GtkWidget              *text);
+void undo_destroy              (UndoMain               *undostruct);
+
+void undo_set_change_state_func        (UndoMain               *undostruct,
+                                UndoChangeStateFunc     func,
+                                gpointer                data);
+
+void undo_undo                 (UndoMain               *undostruct); 
+void undo_redo                 (UndoMain               *undostruct); 
+void undo_block                        (UndoMain               *undostruct);
+void undo_unblock              (UndoMain               *undostruct);
+
 #endif /* __UNDO_H__ */