diff options
Diffstat (limited to 'tools/mapedit/src/frame.h')
| -rw-r--r-- | tools/mapedit/src/frame.h | 30 |
1 files changed, 24 insertions, 6 deletions
| diff --git a/tools/mapedit/src/frame.h b/tools/mapedit/src/frame.h index 067c848..b0f27e9 100644 --- a/tools/mapedit/src/frame.h +++ b/tools/mapedit/src/frame.h | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <wx/notebook.h> | 14 | #include <wx/notebook.h> |
| 15 | #include <memory> | 15 | #include <memory> |
| 16 | #include <wx/treectrl.h> | 16 | #include <wx/treectrl.h> |
| 17 | #include "undo.h" | ||
| 17 | 18 | ||
| 18 | class MapPtrCtr : public wxTreeItemData { | 19 | class MapPtrCtr : public wxTreeItemData { |
| 19 | public: | 20 | public: |
| @@ -37,7 +38,6 @@ class MapeditFrame : public wxFrame { | |||
| 37 | 38 | ||
| 38 | std::list<wxWindow*>::iterator closer; | 39 | std::list<wxWindow*>::iterator closer; |
| 39 | 40 | ||
| 40 | private: | ||
| 41 | static void LaunchWindow(std::unique_ptr<World> world); | 41 | static void LaunchWindow(std::unique_ptr<World> world); |
| 42 | void populateMapTree(wxTreeItemId node, std::list<std::shared_ptr<Map>> maps); | 42 | void populateMapTree(wxTreeItemId node, std::list<std::shared_ptr<Map>> maps); |
| 43 | void SelectMap(Map* map); | 43 | void SelectMap(Map* map); |
| @@ -60,7 +60,6 @@ class MapeditFrame : public wxFrame { | |||
| 60 | void OnAddRoot(wxCommandEvent& event); | 60 | void OnAddRoot(wxCommandEvent& event); |
| 61 | void OnAddChild(wxCommandEvent& event); | 61 | void OnAddChild(wxCommandEvent& event); |
| 62 | void OnDidSelectMap(wxTreeEvent& event); | 62 | void OnDidSelectMap(wxTreeEvent& event); |
| 63 | void OnWillSelectMap(wxTreeEvent& event); | ||
| 64 | void OnWillDragMap(wxTreeEvent& event); | 63 | void OnWillDragMap(wxTreeEvent& event); |
| 65 | void OnDidDragMap(wxTreeEvent& event); | 64 | void OnDidDragMap(wxTreeEvent& event); |
| 66 | void OnRightClickTree(wxTreeEvent& event); | 65 | void OnRightClickTree(wxTreeEvent& event); |
| @@ -69,25 +68,44 @@ class MapeditFrame : public wxFrame { | |||
| 69 | 68 | ||
| 70 | std::unique_ptr<World> world; | 69 | std::unique_ptr<World> world; |
| 71 | Map* currentMap; | 70 | Map* currentMap; |
| 71 | |||
| 72 | MapeditWidget* mapEditor; | 72 | MapeditWidget* mapEditor; |
| 73 | TileWidget* tileEditor; | 73 | TileWidget* tileEditor; |
| 74 | wxTextCtrl* titleBox; | 74 | wxToolBar* toolbar; |
| 75 | std::string filename; | 75 | wxMenu* menuFile; |
| 76 | |||
| 77 | // Notebook | ||
| 76 | wxNotebook* notebook; | 78 | wxNotebook* notebook; |
| 77 | wxChoice* entityTypeBox; | 79 | wxChoice* entityTypeBox; |
| 78 | wxButton* addEntityButton; | 80 | wxButton* addEntityButton; |
| 79 | wxButton* cancelEntityButton; | 81 | wxButton* cancelEntityButton; |
| 80 | wxToolBar* toolbar; | 82 | |
| 81 | wxMenu* menuFile; | 83 | // Map tree |
| 82 | wxTreeCtrl* mapTree; | 84 | wxTreeCtrl* mapTree; |
| 83 | wxTreeItemId dragMap; | 85 | wxTreeItemId dragMap; |
| 84 | wxMenu* mapTreePopup; | 86 | wxMenu* mapTreePopup; |
| 87 | bool dontSelectMap = false; | ||
| 88 | |||
| 89 | // Property editor | ||
| 90 | UndoableTextBox* titleBox; | ||
| 91 | wxString prevTitle; | ||
| 85 | wxStaticText* startposLabel; | 92 | wxStaticText* startposLabel; |
| 86 | wxButton* setStartposButton; | 93 | wxButton* setStartposButton; |
| 87 | wxButton* cancelStartposButton; | 94 | wxButton* cancelStartposButton; |
| 88 | 95 | ||
| 96 | // Undo stuff | ||
| 97 | wxMenu* menuEdit; | ||
| 98 | std::list<std::shared_ptr<Undoable>> history; | ||
| 99 | std::list<std::shared_ptr<Undoable>>::iterator currentAction {begin(history)}; | ||
| 100 | void OnUndo(wxCommandEvent& event); | ||
| 101 | void OnRedo(wxCommandEvent& event); | ||
| 102 | void UpdateUndoLabels(); | ||
| 103 | void commitAction(std::shared_ptr<Undoable> action); | ||
| 104 | void commitAfter(std::shared_ptr<Undoable> action); | ||
| 105 | |||
| 89 | bool addingEntity = false; | 106 | bool addingEntity = false; |
| 90 | 107 | ||
| 108 | private: | ||
| 91 | wxDECLARE_EVENT_TABLE(); | 109 | wxDECLARE_EVENT_TABLE(); |
| 92 | }; | 110 | }; |
| 93 | 111 | ||
