X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fundo.C;h=b1fcb60a227e58edadd6b86f42a902a3b5f16d2e;hb=f268743f8c014ef2dadd260fd1a3873cb1d2038b;hp=6c548add76c323d425128e145ba8318f07b639a0;hpb=83acbbd5237373926c629855379e1df9a04209b2;p=lyx.git diff --git a/src/undo.C b/src/undo.C index 6c548add76..b1fcb60a22 100644 --- a/src/undo.C +++ b/src/undo.C @@ -1,102 +1,29 @@ -/* This file is part of - * ====================================================== - * - * LyX, The Document Processor - * - * Copyright 1995 Matthias Ettrich - * Copyright 1995-2001 The LyX Team. +/** + * \file undo.C + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. * - * ====================================================== */ + * \author Lars Gullik Bjønnes + * \author André Pönitz + * + * Full author contact details are available in file CREDITS. + */ #include -#ifdef __GNUG__ -#pragma implementation -#endif - #include "undo.h" +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) +{} -Undo::Undo(undo_kind kind_arg, - int number_before_arg, int number_behind_arg, - int cursor_par_arg, int cursor_pos_arg, - LyXParagraph * par_arg) -{ - kind = kind_arg; - number_of_before_par = number_before_arg; - number_of_behind_par = number_behind_arg; - number_of_cursor_par = cursor_par_arg; - cursor_pos = cursor_pos_arg; - par = par_arg; -} - - -Undo::~Undo() -{ - LyXParagraph * tmppar; - while (par) { - tmppar = par; - par = par->next(); - delete tmppar; - } -} - - -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; -} - - -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; - } -} - - -bool UndoStack::empty() const { - return stakk.empty(); -}