-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUNDO.H
61 lines (50 loc) · 1.4 KB
/
UNDO.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Undo.h - interface for CUndoStack
//
// Copyright (C) 1993-1994 George Mills and Softronics, Inc. Corporation
// All rights reserved.
//
class CUndoElement : public CObject
{
public:
enum { Illegal = 0, Delete = 1, Add = 2, Move = 3, Rename = 4, Edit = 5,
StartOfTransaction = 98, EndOfTransaction = 99 };
int m_iAction;
int m_iTransactionCookie;
CString m_str;
CLogiObj *m_pLogiObj;
CRect m_rect;
DWORD m_dwLen;
void *m_pVar;
CString GetUndoDescription();
CString GetRedoDescription();
void Init();
void Undo(CLogiDoc* pDoc);
void Cleanup(int iPass);
};
class CUndoStack : public CObject
{
public:
CUndoStack();
~CUndoStack();
void Push(CLogiObj* pLogiObj, int iActionType, LPCTSTR str = NULL);
void PushMove(CLogiObj* pLogiObj, CRect &rect);
void PushEdit(CLogiObj* pLogiObj);
int BeginTransaction(LPCTSTR description);
void EndTransaction(LPCTSTR description);
void Undo(CLogiDoc* pDoc);
void Redo(CLogiDoc* pDoc);
void Reset();
BOOL CanUndo();
BOOL CanRedo();
CString GetUndoDescription();
CString GetRedoDescription();
private:
enum {NotInProgress = 0, UndoInProgress = 1, RedoInProgress = 2};
BOOL m_iCurrentState;
int m_iTransactionCookie;
CObList m_undo;
CObList m_redo;
void InternalPush(CUndoElement *pUndo);
void InternalUndo(CLogiDoc* pDoc, CObList *pUndoList);
void InternalReset(CObList *pList);
};