Debian Codegraph @

pTk/mTk/generic/tkUndo.h

raw symbols SCIP
1 /*
2 * tkUndo.h --
3 *
4 * Declarations shared among the files that implement an undo
5 * stack.
6 *
7 * Copyright (c) 2002 Ludwig Callewaert.
8 *
9 * See the file "license.terms" for information on usage and redistribution
10 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11 *
12 * RCS: @(#) $Id: tkUndo.h,v 1.1 2002/06/21 23:09:55 hobbs Exp $
13 */
14
15 #ifndef _TKUNDO
16 #define _TKUNDO
17
18 #ifndef _TK
19 #include "tk.h"
20 #endif
21
22 #ifdef BUILD_tk
23 # undef TCL_STORAGE_CLASS
24 # define TCL_STORAGE_CLASS DLLEXPORT
25 #endif
26
27 /* enum definining the types used in an undo stack */
28
29 typedef enum {
30 TK_UNDO_SEPARATOR, /* Marker */
31 TK_UNDO_ACTION /* Command */
32 } TkUndoAtomType;
33
34 /* struct defining the basic undo/redo stack element */
35
36 typedef struct TkUndoAtom {
37 TkUndoAtomType type; /* The type that will trigger the
38 * required action*/
39 Tcl_Obj * apply; /* Command to apply the action that was taken */
40 Tcl_Obj * revert; /* The command to undo the action */
41 struct TkUndoAtom * next; /* Pointer to the next element in the
42 * stack */
43 } TkUndoAtom;
44
45 /* struct defining the basic undo/redo stack element */
46
47 typedef struct TkUndoRedoStack {
48 TkUndoAtom * undoStack; /* The undo stack */
49 TkUndoAtom * redoStack; /* The redo stack */
50 Tcl_Interp * interp ; /* The interpreter in which to execute the revert and apply scripts */
51 int maxdepth;
52 int depth;
53 } TkUndoRedoStack;
54
55 /* basic functions */
56
57 EXTERN void TkUndoPushStack _ANSI_ARGS_((TkUndoAtom ** stack,
58 TkUndoAtom * elem));
59
60 EXTERN TkUndoAtom * TkUndoPopStack _ANSI_ARGS_((TkUndoAtom ** stack));
61
62 EXTERN int TkUndoInsertSeparator _ANSI_ARGS_((TkUndoAtom ** stack));
63
64 EXTERN void TkUndoClearStack _ANSI_ARGS_((TkUndoAtom ** stack));
65
66 /* functions working on an undo/redo stack */
67
68 EXTERN TkUndoRedoStack * TkUndoInitStack _ANSI_ARGS_((Tcl_Interp * interp,
69 int maxdepth));
70
71 EXTERN void TkUndoSetDepth _ANSI_ARGS_((TkUndoRedoStack * stack,
72 int maxdepth));
73
74 EXTERN void TkUndoClearStacks _ANSI_ARGS_((TkUndoRedoStack * stack));
75
76 EXTERN void TkUndoFreeStack _ANSI_ARGS_((TkUndoRedoStack * stack));
77
78 EXTERN void TkUndoInsertUndoSeparator _ANSI_ARGS_((TkUndoRedoStack * stack));
79
80 EXTERN void TkUndoPushAction _ANSI_ARGS_((TkUndoRedoStack * stack,
81 Tcl_DString * actionScript, Tcl_DString * revertScript));
82
83 EXTERN int TkUndoRevert _ANSI_ARGS_((TkUndoRedoStack * stack));
84
85 EXTERN int TkUndoApply _ANSI_ARGS_((TkUndoRedoStack * stack));
86
87 # undef TCL_STORAGE_CLASS
88 # define TCL_STORAGE_CLASS DLLIMPORT
89
90 #endif /* _TKUNDO */