1 /****************************************************************************
2 ** $Id: rs_undo.h 1648 2003-06-11 06:56:01Z andrew $
4 ** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
6 ** This file is part of the qcadlib Library project.
8 ** This file may be distributed and/or modified under the terms of the
9 ** GNU General Public License version 2 as published by the Free Software
10 ** Foundation and appearing in the file LICENSE.GPL included in the
11 ** packaging of this file.
13 ** Licensees holding valid qcadlib Professional Edition licenses may use
14 ** this file in accordance with the qcadlib Commercial License
15 ** Agreement provided with the Software.
17 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 ** See http://www.ribbonsoft.com for further details.
22 ** Contact info@ribbonsoft.com if any conditions of this licensing are
25 **********************************************************************/
31 #include "rs_undocycle.h"
34 * Undo / redo functionality. The internal undo list consists of
35 * RS_UndoCycle entries.
38 * @author Andrew Mustun
46 void addUndoCycle(RS_UndoCycle * i);
51 virtual RS_UndoCycle * getUndoCycle();
52 virtual RS_UndoCycle * getRedoCycle();
54 virtual int countUndoCycles();
55 virtual int countRedoCycles();
57 virtual void startUndoCycle();
58 virtual void addUndoable(RS_Undoable * u);
59 virtual void endUndoCycle();
62 * Must be overwritten by the implementing class and delete
63 * the given Undoable (unrecoverable). This method is called
64 * for Undoables that are no longer in the undo buffer.
66 virtual void removeUndoable(RS_Undoable * u) = 0;
68 friend std::ostream & operator<<(std::ostream & os, RS_Undo & a);
71 static bool test(void);
75 //! List of undo list items. every item is something that can be undone.
76 // Q3PtrList<RS_UndoCycle> undoList;
77 QList<RS_UndoCycle *> undoList;
80 * Index that points to the current position in the undo list.
81 * The item it points on will be undone the next time undo is called.
82 * The item after will be redone (if there is an item) when redo
90 RS_UndoCycle * currentCycle;
95 * Stub for testing the RS_Undo class.
97 class RS_UndoStub : public RS_Undo
99 virtual void removeUndoable(RS_Undoable * u)