2005-09-14 [paul] 1.9.14cvs26
[claws.git] / src / undo.h
index 7dfbe19c5d935c72e9279f2658c42da3d0cdbce1..dd00ca15f9dd1d87d750a9e6b9e41a5b7354c968 100644 (file)
 
 /* code ported from gedit */
 
-#ifndef UNDO_H__
-#define UNDO_H__
+#ifndef __UNDO_H__
+#define __UNDO_H__
 
 #include <glib.h>
-#include <gtk/gtkwidget.h>
+#include <gtk/gtktextview.h>
 #include <gtk/gtkitemfactory.h>
 
 typedef enum 
 {
        UNDO_ACTION_INSERT,
-        UNDO_ACTION_DELETE,
+       UNDO_ACTION_DELETE,
        UNDO_ACTION_REPLACE_INSERT,
-       UNDO_ACTION_REPLACE_DELETE,
+       UNDO_ACTION_REPLACE_DELETE
 } UndoAction;
 
 typedef enum 
 {
-        UNDO_STATE_TRUE,
-        UNDO_STATE_FALSE,
-        UNDO_STATE_UNCHANGED,
-        UNDO_STATE_REFRESH,
+       UNDO_STATE_TRUE,
+       UNDO_STATE_FALSE,
+       UNDO_STATE_UNCHANGED,
+       UNDO_STATE_REFRESH
 } UndoState;
 
 typedef struct _UndoMain UndoMain;
 
-typedef void (*UndoChangeState) (UndoMain *undostruct,
-       gint undo_state, gint redo_state, GtkWidget *changewidget);
+typedef void (*UndoChangeStateFunc)    (UndoMain       *undostruct,
+                                        gint            undo_state,
+                                        gint            redo_state,
+                                        gpointer        data);
 
 struct _UndoMain 
 {
-       GtkWidget *text;
-       GtkWidget *changewidget;
+       GtkTextView *textview;
+
        GList *undo;
        GList *redo;
-       UndoChangeState change_func;
+
+       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_undo_change_funct (UndoMain *undostruct, UndoChangeState func, GtkWidget *changewidget);
+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_undo                 (UndoMain               *undostruct); 
+void undo_redo                 (UndoMain               *undostruct); 
+void undo_block                        (UndoMain               *undostruct);
+void undo_unblock              (UndoMain               *undostruct);
 
-#endif /* UNDO_H__ */
+#endif /* __UNDO_H__ */