summaryrefslogtreecommitdiffstats
path: root/generic/tkText.h
diff options
context:
space:
mode:
authorhobbs <hobbs>2001-11-13 00:19:05 (GMT)
committerhobbs <hobbs>2001-11-13 00:19:05 (GMT)
commite3690695eaccf83b8076fd877d17ed591c43065d (patch)
tree65c1489fbcc7a86e2140be2d55b1ffd0ccbd2577 /generic/tkText.h
parent3027f28d1f2411602324f0964f7f1ad28742cf93 (diff)
downloadtk-e3690695eaccf83b8076fd877d17ed591c43065d.zip
tk-e3690695eaccf83b8076fd877d17ed591c43065d.tar.gz
tk-e3690695eaccf83b8076fd877d17ed591c43065d.tar.bz2
added TIP#26 text widget undo/redo functionality
Diffstat (limited to 'generic/tkText.h')
-rw-r--r--generic/tkText.h55
1 files changed, 51 insertions, 4 deletions
diff --git a/generic/tkText.h b/generic/tkText.h
index f89c18f..b9e4727 100644
--- a/generic/tkText.h
+++ b/generic/tkText.h
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkText.h,v 1.7 2000/01/06 02:18:58 hobbs Exp $
+ * RCS: @(#) $Id: tkText.h,v 1.8 2001/11/13 00:19:05 hobbs Exp $
*/
#ifndef _TKTEXT
@@ -451,6 +451,25 @@ typedef struct TkTextTabArray {
* BE THE LAST IN THE STRUCTURE. */
} TkTextTabArray;
+/* enum definining the types used in an edit stack */
+
+typedef enum {
+ SEPARATOR, /* Marker */
+ INSERT, /* The undo is an insert */
+ DELETE /* The undo is a delete */
+} TkTextEditType;
+
+/* strcut defining the basic undo/redo stack element */
+
+typedef struct TkTextEditAtom {
+ TkTextEditType type; /* The type that will trigger the
+ * required action*/
+ char * index; /* The starting index of the range */
+ char * string; /* The text to be inserted / deleted */
+ struct TkTextEditAtom * next; /* Pointer to the next element in the
+ * stack */
+} TkTextEditAtom;
+
/*
* A data structure of the following type is kept for each text widget that
* currently exists for this process:
@@ -604,7 +623,7 @@ typedef struct TkText {
/* Pointer to segment for "current" mark,
* or NULL if none. */
XEvent pickEvent; /* The event from which the current character
- * was chosen. Must be saved so that we
+ * was chosen. Must be saved so that we
* can repick after modifications to the
* text. */
int numCurTags; /* Number of tags associated with character
@@ -616,15 +635,43 @@ typedef struct TkText {
* Miscellaneous additional information:
*/
- char *takeFocus; /* Value of -takeFocus option; not used in
+ char *takeFocus; /* Value of -takeFocus option; not used in
* the C code, but used by keyboard traversal
* scripts. Malloc'ed, but may be NULL. */
char *xScrollCmd; /* Prefix of command to issue to update
* horizontal scrollbar when view changes. */
char *yScrollCmd; /* Prefix of command to issue to update
* vertical scrollbar when view changes. */
- int flags; /* Miscellaneous flags; see below for
+ int flags; /* Miscellaneous flags; see below for
* definitions. */
+
+ /*
+ * Information related to the undo/redo functonality
+ */
+
+ TkTextEditAtom * undoStack; /* The undo stack */
+
+ TkTextEditAtom * redoStack; /* The redo stack */
+
+ int undo; /* non zero means the undo/redo behaviour is
+ * enabled */
+
+ int autoSeparators; /* non zero means the separatorss will be
+ * inserted automatically */
+
+ int modifiedSet; /* Flag indicating that the 'dirtynesss' of
+ * the text widget has been expplicitly set.
+ */
+
+ int isDirty; /* Flag indicating the 'dirtynesss' of the text
+ * widget. If the flag is not zero, unsaved
+ * modifications have been applied to the
+ * text widget */
+
+ int isDirtyIncrement; /* Amount with which the isDirty flag is
+ * incremented every edit action
+ */
+
} TkText;
/*