DDraceNetwork Docs
editor_history.h
Go to the documentation of this file.
1#ifndef GAME_EDITOR_EDITOR_HISTORY_H
2#define GAME_EDITOR_EDITOR_HISTORY_H
3
4#include "editor_action.h"
5
6#include <deque>
7#include <memory>
8#include <vector>
9
11{
12public:
14 {
15 m_pEditor = nullptr;
16 m_IsBulk = false;
17 }
18
20 {
21 Clear();
22 }
23
24 void RecordAction(const std::shared_ptr<IEditorAction> &pAction);
25 void RecordAction(const std::shared_ptr<IEditorAction> &pAction, const char *pDisplay);
26 void Execute(const std::shared_ptr<IEditorAction> &pAction, const char *pDisplay = nullptr);
27
28 bool Undo();
29 bool Redo();
30
31 void Clear();
32 bool CanUndo() const { return !m_vpUndoActions.empty(); }
33 bool CanRedo() const { return !m_vpRedoActions.empty(); }
34
35 void BeginBulk();
36 void EndBulk(const char *pDisplay = nullptr);
37 void EndBulk(int DisplayToUse);
38
40 std::deque<std::shared_ptr<IEditorAction>> m_vpUndoActions;
41 std::deque<std::shared_ptr<IEditorAction>> m_vpRedoActions;
42
43private:
44 std::vector<std::shared_ptr<IEditorAction>> m_vpBulkActions;
46};
47
48#endif
Definition: editor_history.h:11
~CEditorHistory()
Definition: editor_history.h:19
void BeginBulk()
Definition: editor_history.cpp:73
std::vector< std::shared_ptr< IEditorAction > > m_vpBulkActions
Definition: editor_history.h:44
void Clear()
Definition: editor_history.cpp:67
void Execute(const std::shared_ptr< IEditorAction > &pAction, const char *pDisplay=nullptr)
Definition: editor_history.cpp:12
std::deque< std::shared_ptr< IEditorAction > > m_vpUndoActions
Definition: editor_history.h:40
bool Undo()
Definition: editor_history.cpp:39
CEditor * m_pEditor
Definition: editor_history.h:39
std::deque< std::shared_ptr< IEditorAction > > m_vpRedoActions
Definition: editor_history.h:41
CEditorHistory()
Definition: editor_history.h:13
bool CanRedo() const
Definition: editor_history.h:33
void EndBulk(const char *pDisplay=nullptr)
Definition: editor_history.cpp:79
bool m_IsBulk
Definition: editor_history.h:45
bool Redo()
Definition: editor_history.cpp:53
void RecordAction(const std::shared_ptr< IEditorAction > &pAction)
Definition: editor_history.cpp:7
bool CanUndo() const
Definition: editor_history.h:32
Definition: editor.h:276