summary refs log tree commit diff stats
path: root/tools/mapedit/src/frame.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/mapedit/src/frame.h')
-rw-r--r--tools/mapedit/src/frame.h32
1 files changed, 27 insertions, 5 deletions
diff --git a/tools/mapedit/src/frame.h b/tools/mapedit/src/frame.h index 4aa44c5..f1e4efc 100644 --- a/tools/mapedit/src/frame.h +++ b/tools/mapedit/src/frame.h
@@ -12,24 +12,36 @@
12#include "tile_widget.h" 12#include "tile_widget.h"
13#include <list> 13#include <list>
14#include <wx/notebook.h> 14#include <wx/notebook.h>
15#include <memory>
16#include <wx/treectrl.h>
17
18class MapPtrCtr : public wxTreeItemData {
19 public:
20 Map* map;
21
22 MapPtrCtr(Map* map) : map(map) {}
23};
15 24
16class MapeditFrame : public wxFrame { 25class MapeditFrame : public wxFrame {
17 public: 26 public:
18 MapeditFrame() {} 27 MapeditFrame() {}
19 MapeditFrame(Map map, std::string filename); 28 MapeditFrame(std::unique_ptr<World> world);
20 29
21 MapeditWidget* GetMapEditor(); 30 MapeditWidget* GetMapEditor();
22 void StartAddingEntity(); 31 void StartAddingEntity();
23 void FinishAddingEntity(); 32 void FinishAddingEntity();
24 void MapDirtyDidChange(bool dirty); 33 void MapDirtyDidChange(bool dirty);
25 34
26 static void NewMap(); 35 static void NewWorld();
27 static void OpenMap(const char* filename); 36 static void OpenWorld(std::string filename);
28 37
29 std::list<wxWindow*>::iterator closer; 38 std::list<wxWindow*>::iterator closer;
30 39
31 private: 40 private:
32 static void LaunchWindow(Map map, const char* filename); 41 static void LaunchWindow(std::unique_ptr<World> world);
42 void populateMapTree(wxTreeItemId node, std::list<std::shared_ptr<Map>> maps);
43 void SelectMap(Map* map);
44 wxTreeItemId MoveTreeNode(wxTreeItemId toCopy, wxTreeItemId newParent);
33 45
34 void ZoomIn(wxCommandEvent& event); 46 void ZoomIn(wxCommandEvent& event);
35 void ZoomOut(wxCommandEvent& event); 47 void ZoomOut(wxCommandEvent& event);
@@ -44,8 +56,15 @@ class MapeditFrame : public wxFrame {
44 void OnTabChanging(wxBookCtrlEvent& event); 56 void OnTabChanging(wxBookCtrlEvent& event);
45 void OnAddEntity(wxCommandEvent& event); 57 void OnAddEntity(wxCommandEvent& event);
46 void OnCancelAddEntity(wxCommandEvent& event); 58 void OnCancelAddEntity(wxCommandEvent& event);
59 void OnAddRoot(wxCommandEvent& event);
60 void OnAddChild(wxCommandEvent& event);
61 void OnDidSelectMap(wxTreeEvent& event);
62 void OnWillSelectMap(wxTreeEvent& event);
63 void OnWillDragMap(wxTreeEvent& event);
64 void OnDidDragMap(wxTreeEvent& event);
47 65
48 Map map; 66 std::unique_ptr<World> world;
67 Map* currentMap;
49 MapeditWidget* mapEditor; 68 MapeditWidget* mapEditor;
50 TileWidget* tileEditor; 69 TileWidget* tileEditor;
51 wxTextCtrl* titleBox; 70 wxTextCtrl* titleBox;
@@ -55,6 +74,9 @@ class MapeditFrame : public wxFrame {
55 wxButton* addEntityButton; 74 wxButton* addEntityButton;
56 wxButton* cancelEntityButton; 75 wxButton* cancelEntityButton;
57 wxToolBar* toolbar; 76 wxToolBar* toolbar;
77 wxMenu* menuFile;
78 wxTreeCtrl* mapTree;
79 wxTreeItemId dragMap;
58 80
59 bool addingEntity = false; 81 bool addingEntity = false;
60 82