• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/tcl-102/tk84/tk/generic/

Lines Matching defs:stack

4  *	This module provides the implementation of an undo stack.
20 * Push elem on the stack identified by stack.
29 void TkUndoPushStack ( stack, elem )
30 TkUndoAtom ** stack;
33 elem->next = *stack;
34 *stack = elem;
40 * Remove and return the top element from the stack identified by
41 * stack.
50 TkUndoAtom * TkUndoPopStack ( stack )
51 TkUndoAtom ** stack ;
54 if (*stack != NULL ) {
55 elem = *stack;
56 *stack = elem->next;
64 * insert a separator on the stack, indicating a border for
74 int TkUndoInsertSeparator ( stack )
75 TkUndoAtom ** stack;
79 if ( *stack != NULL && (*stack)->type != TK_UNDO_SEPARATOR ) {
82 TkUndoPushStack(stack,separator);
92 * Clear an entire undo or redo stack and destroy all elements in it.
101 void TkUndoClearStack ( stack )
102 TkUndoAtom ** stack; /* An Undo or Redo stack */
106 while ( (elem = TkUndoPopStack(stack)) ) {
113 *stack = NULL;
119 * Push a new elem on the stack identified by stack.
129 void TkUndoPushAction ( stack, actionScript, revertScript )
130 TkUndoRedoStack * stack; /* An Undo or Redo stack */
145 TkUndoPushStack(&(stack->undoStack), atom);
146 TkUndoClearStack(&(stack->redoStack));
153 * Initialize a new undo/redo stack
156 * un Undo/Redo stack pointer
164 int maxdepth; /* The maximum stack depth */
166 TkUndoRedoStack * stack; /* An Undo/Redo stack */
167 stack = (TkUndoRedoStack *) ckalloc(sizeof(TkUndoRedoStack));
168 stack->undoStack = NULL;
169 stack->redoStack = NULL;
170 stack->interp = interp;
171 stack->maxdepth = maxdepth;
172 stack->depth = 0;
173 return stack;
180 * Initialize a new undo/redo stack
183 * un Undo/Redo stack pointer
189 void TkUndoSetDepth ( stack, maxdepth )
190 TkUndoRedoStack * stack; /* An Undo/Redo stack */
191 int maxdepth; /* The maximum stack depth */
197 stack->maxdepth = maxdepth;
199 if ((stack->maxdepth > 0) && (stack->depth > stack->maxdepth)) {
201 * Maximum stack depth exceeded. We have to remove the last compound
202 * elements on the stack.
205 elem = stack->undoStack;
207 while (elem && (sepNumber <= stack->maxdepth)) {
220 stack->depth = stack->maxdepth;
228 * Clear both the undo and redo stack
237 void TkUndoClearStacks ( stack )
238 TkUndoRedoStack * stack; /* An Undo/Redo stack */
240 TkUndoClearStack(&(stack->undoStack));
241 TkUndoClearStack(&(stack->redoStack));
242 stack->depth = 0;
249 * Clear both the undo and redo stack
250 * also free the memory allocated to the u/r stack pointer
259 void TkUndoFreeStack ( stack )
260 TkUndoRedoStack * stack; /* An Undo/Redo stack */
262 TkUndoClearStacks(stack);
263 /* ckfree((TkUndoRedoStack *) stack); */
264 ckfree((char *) stack);
271 * insert a separator on the undo stack, indicating a border for
281 void TkUndoInsertUndoSeparator ( stack )
282 TkUndoRedoStack * stack;
284 if ( TkUndoInsertSeparator(&(stack->undoStack)) ) {
285 ++(stack->depth);
286 TkUndoSetDepth(stack,stack->maxdepth);
294 * Undo a compound action on the stack.
303 int TkUndoRevert ( stack )
304 TkUndoRedoStack * stack;
308 /* insert a separator on the undo and the redo stack */
310 TkUndoInsertUndoSeparator(stack);
311 TkUndoInsertSeparator(&(stack->redoStack));
315 elem = TkUndoPopStack(&(stack->undoStack));
323 elem = TkUndoPopStack(&(stack->undoStack));
327 Tcl_EvalObjEx(stack->interp,elem->revert,TCL_EVAL_GLOBAL);
329 TkUndoPushStack(&(stack->redoStack),elem);
330 elem = TkUndoPopStack(&(stack->undoStack));
333 /* insert a separator on the redo stack */
335 TkUndoInsertSeparator(&(stack->redoStack));
337 --(stack->depth);
346 * Redo a compound action on the stack.
355 int TkUndoApply ( stack )
356 TkUndoRedoStack * stack;
360 /* insert a separator on the undo stack */
362 TkUndoInsertSeparator(&(stack->undoStack));
366 elem = TkUndoPopStack(&(stack->redoStack));
374 elem = TkUndoPopStack(&(stack->redoStack));
378 Tcl_EvalObjEx(stack->interp,elem->apply,TCL_EVAL_GLOBAL);
380 TkUndoPushStack(&(stack->undoStack), elem);
381 elem = TkUndoPopStack(&(stack->redoStack));
384 /* insert a separator on the undo stack */
386 TkUndoInsertSeparator(&(stack->undoStack));
388 ++(stack->depth);