aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/llundo.h
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llui/llundo.h')
-rw-r--r--linden/indra/llui/llundo.h48
1 files changed, 23 insertions, 25 deletions
diff --git a/linden/indra/llui/llundo.h b/linden/indra/llui/llundo.h
index 2bf04bc..6921259 100644
--- a/linden/indra/llui/llundo.h
+++ b/linden/indra/llui/llundo.h
@@ -1,6 +1,6 @@
1/** 1/**
2 * @file llundo.h 2 * @file llundo.h
3 * @brief LLUndo class header file 3 * @brief Generic interface for undo/redo circular buffer.
4 * 4 *
5 * $LicenseInfo:firstyear=2000&license=viewergpl$ 5 * $LicenseInfo:firstyear=2000&license=viewergpl$
6 * 6 *
@@ -32,34 +32,24 @@
32#ifndef LL_LLUNDO_H 32#ifndef LL_LLUNDO_H
33#define LL_LLUNDO_H 33#define LL_LLUNDO_H
34 34
35class LLUndoAction
36{
37 friend class LLUndoBuffer;
38protected:
39 S32 mClusterID;
40protected:
41 LLUndoAction(): mClusterID(0) {};
42 virtual ~LLUndoAction(){};
43
44public:
45 static LLUndoAction *create() { return NULL; }
46
47 virtual void undo() = 0;
48 virtual void redo() = 0;
49 virtual void cleanup() {};
50};
51 35
52class LLUndoBuffer 36class LLUndoBuffer
53{ 37{
54protected:
55 LLUndoAction **mActions; // array of pointers to undoactions
56 S32 mNumActions; // total number of actions in ring buffer
57 S32 mNextAction; // next action to perform undo/redo on
58 S32 mLastAction; // last action actually added to undo buffer
59 S32 mFirstAction; // beginning of ring buffer (don't undo any further)
60 S32 mOperationID; // current operation id, for undoing and redoing in clusters
61
62public: 38public:
39 class LLUndoAction
40 {
41 friend class LLUndoBuffer;
42 public:
43 virtual void undo() = 0;
44 virtual void redo() = 0;
45 virtual void cleanup() {};
46 protected:
47 LLUndoAction(): mClusterID(0) {};
48 virtual ~LLUndoAction(){};
49 private:
50 S32 mClusterID;
51 };
52
63 LLUndoBuffer( LLUndoAction (*create_func()), S32 initial_count ); 53 LLUndoBuffer( LLUndoAction (*create_func()), S32 initial_count );
64 virtual ~LLUndoBuffer(); 54 virtual ~LLUndoBuffer();
65 55
@@ -70,6 +60,14 @@ public:
70 BOOL canRedo() { return (mNextAction != mLastAction); } 60 BOOL canRedo() { return (mNextAction != mLastAction); }
71 61
72 void flushActions(); 62 void flushActions();
63
64private:
65 LLUndoAction **mActions; // array of pointers to undoactions
66 S32 mNumActions; // total number of actions in ring buffer
67 S32 mNextAction; // next action to perform undo/redo on
68 S32 mLastAction; // last action actually added to undo buffer
69 S32 mFirstAction; // beginning of ring buffer (don't undo any further)
70 S32 mOperationID; // current operation id, for undoing and redoing in clusters
73}; 71};
74 72
75#endif //LL_LLUNDO_H 73#endif //LL_LLUNDO_H