X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fundo.C;h=3fa8ca88a969e58e4977a59adf384dcdd164eef2;hb=09e01879979643949f1f2c7216023f1f35d5ada2;hp=62a0481c886df1230c5b7fd24d1685a7f9825afa;hpb=1d7d3cc4afa2205c801ccc2aa71c7ac59359dc5f;p=lyx.git diff --git a/src/undo.C b/src/undo.C index 62a0481c88..3fa8ca88a9 100644 --- a/src/undo.C +++ b/src/undo.C @@ -1,10 +1,10 @@ /* This file is part of * ====================================================== - * + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2001 The LyX Team. * * ====================================================== */ @@ -12,60 +12,17 @@ #include "undo.h" -#ifdef __GNUG__ -#pragma implementation -#endif - -UndoStack::UndoStack() - : limit(100) {} - - -Undo * UndoStack::pop() -{ - if (stakk.empty()) return 0; - Undo * result = stakk.front(); - stakk.pop_front(); - return result; -} - - -Undo * UndoStack::top() -{ - if (stakk.empty()) return 0; - return stakk.front(); -} - - -UndoStack::~UndoStack() -{ - clear(); -} - - -void UndoStack::clear() -{ - while (!stakk.empty()) { - Undo * tmp = stakk.front(); - stakk.pop_front(); - delete tmp; - } -} - - -void UndoStack::SetStackLimit(Stakk::size_type l) -{ - limit = l; -} - +Undo::Undo(undo_kind kind_arg, int inset, + int first, int last, + int cursor, int cursor_pos_arg, + ParagraphList const & par) + : + kind(kind_arg), + inset_id(inset), + first_par_offset(first), + last_par_offset(last), + cursor_par_offset(cursor), + cursor_pos(cursor_pos_arg), + pars(par) +{} -void UndoStack::push(Undo * undo_arg) -{ - if (!undo_arg) return; - - stakk.push_front(undo_arg); - if (stakk.size() > limit) { - Undo * tmp = stakk.back(); - stakk.pop_back(); - delete tmp; - } -}