summaryrefslogtreecommitdiffstats
path: root/generic/tkText.h
diff options
context:
space:
mode:
authorhobbs <hobbs>2002-06-21 23:09:53 (GMT)
committerhobbs <hobbs>2002-06-21 23:09:53 (GMT)
commita0edbf3ca6fa387b4197db27447f16b9c4bb58ab (patch)
tree454006e4ff105b7ca979593a68e8dc7ea1cd12f4 /generic/tkText.h
parentdd3ada4cac8079dae041786afcc06b495e1b9354 (diff)
downloadtk-a0edbf3ca6fa387b4197db27447f16b9c4bb58ab.zip
tk-a0edbf3ca6fa387b4197db27447f16b9c4bb58ab.tar.gz
tk-a0edbf3ca6fa387b4197db27447f16b9c4bb58ab.tar.bz2
* doc/text.n: TIP #104 implementation which generalizes the
* generic/tkText.c: undo/redo stack to not be tied solely to the * generic/tkText.h: text widget. The APIs are still private. * generic/tkUndo.c: This also adds a stack limiting ability and * generic/tkUndo.h: a -maxundo option to the text widget (in * library/text.tcl: addition to the options from TIP #26) should * mac/tkMacDefault.h: users want to limit the undo/redo stack * tests/text.test: (should not be necessary in most cases). * unix/Makefile.in: [Patch #554763] (callewart) * unix/tkUnixDefault.h: * win/Makefile.in: * win/makefile.vc: * win/tkWinDefault.h:
Diffstat (limited to 'generic/tkText.h')
-rw-r--r--generic/tkText.h37
1 files changed, 17 insertions, 20 deletions
diff --git a/generic/tkText.h b/generic/tkText.h
index 79e5220..0937b8f 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.10 2002/01/25 21:09:37 dgp Exp $
+ * RCS: @(#) $Id: tkText.h,v 1.11 2002/06/21 23:09:54 hobbs Exp $
*/
#ifndef _TKTEXT
@@ -20,6 +20,10 @@
#include "tk.h"
#endif
+#ifndef _TKUNDO
+#include "tkUndo.h"
+#endif
+
#ifdef BUILD_tk
# undef TCL_STORAGE_CLASS
# define TCL_STORAGE_CLASS DLLEXPORT
@@ -451,24 +455,13 @@ typedef struct TkTextTabArray {
* BE THE LAST IN THE STRUCTURE. */
} TkTextTabArray;
-/* enum definining the types used in an edit stack */
+/* enum definining the edit modes of */
typedef enum {
- TK_EDIT_SEPARATOR, /* Marker */
- TK_EDIT_INSERT, /* The undo is an insert */
- TK_EDIT_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;
+ TK_TEXT_EDIT_INSERT, /* insert mode */
+ TK_TEXT_EDIT_DELETE, /* delete mode */
+ TK_TEXT_EDIT_OTHER /* none of the above */
+} TkTextEditMode;
/*
* A data structure of the following type is kept for each text widget that
@@ -649,13 +642,14 @@ typedef struct TkText {
* Information related to the undo/redo functonality
*/
- TkTextEditAtom * undoStack; /* The undo stack */
-
- TkTextEditAtom * redoStack; /* The redo stack */
+ TkUndoRedoStack * undoStack; /* The undo/redo stack */
int undo; /* non zero means the undo/redo behaviour is
* enabled */
+ int maxUndo; /* The maximum depth of the undo stack expressed
+ * as the maximum number of compound statements */
+
int autoSeparators; /* non zero means the separatorss will be
* inserted automatically */
@@ -672,6 +666,9 @@ typedef struct TkText {
* incremented every edit action
*/
+ TkTextEditMode lastEditMode; /* Keeps track of what the last edit mode was
+ */
+
} TkText;
/*