2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright (C) 1995 Matthias Ettrich, 1995, 1996 LyX Team
9 *======================================================*/
17 #include "definitions.h"
18 #include "lyxparagraph.h"
38 int number_of_before_par;
40 int number_of_behind_par;
42 int number_of_cursor_par;
44 int cursor_pos; // valid if >= 0
48 Undo(undo_kind kind_arg,
49 int number_before_arg, int number_behind_arg,
50 int cursor_par_arg, int cursor_pos_arg,
51 LyXParagraph* par_arg)
54 number_of_before_par = number_before_arg;
55 number_of_behind_par = number_behind_arg;
56 number_of_cursor_par = cursor_par_arg;
57 cursor_pos = cursor_pos_arg;
72 /// A limited Stack for the undo informations. Matthias 290496
94 // size must be initialised (thornley)
96 limit = 100; // the maximum number of undo steps stored. 0 means NO LIMIT.
97 // Limit can be changed with UndoStack::SetStackLimit(int)
103 result = current->undo;
105 current = current->previous;
110 size = 0; // for safety...
117 return current->undo;
127 Undo* tmp_undo = Pop();
134 void SetStackLimit(int limit_arg) {
139 void Push(Undo* undo_arg){
144 tmp->undo = undo_arg;
145 tmp->previous = current;
148 if (limit && size > limit){
149 for (i=0; i<limit && tmp; i++)
151 while(tmp && tmp->previous){
152 tmp2 = tmp->previous->previous;
153 delete tmp->previous;
155 tmp->previous = tmp2;