From 0d30e9b57229905f78e7bd60fe5d3cde72851f28 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Mon, 16 Mar 2015 16:53:05 -0400 Subject: Rewrote map editor so a single file contains all maps Maps are viewed in a tree control on the left. They can be dragged and dropped. Maps are bolded when they are dirty. Saving saves expansion status and order of maps in tree. --- tools/mapedit/src/frame.h | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'tools/mapedit/src/frame.h') 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 @@ #include "tile_widget.h" #include #include +#include +#include + +class MapPtrCtr : public wxTreeItemData { + public: + Map* map; + + MapPtrCtr(Map* map) : map(map) {} +}; class MapeditFrame : public wxFrame { public: MapeditFrame() {} - MapeditFrame(Map map, std::string filename); + MapeditFrame(std::unique_ptr world); MapeditWidget* GetMapEditor(); void StartAddingEntity(); void FinishAddingEntity(); void MapDirtyDidChange(bool dirty); - static void NewMap(); - static void OpenMap(const char* filename); + static void NewWorld(); + static void OpenWorld(std::string filename); std::list::iterator closer; private: - static void LaunchWindow(Map map, const char* filename); + static void LaunchWindow(std::unique_ptr world); + void populateMapTree(wxTreeItemId node, std::list> maps); + void SelectMap(Map* map); + wxTreeItemId MoveTreeNode(wxTreeItemId toCopy, wxTreeItemId newParent); void ZoomIn(wxCommandEvent& event); void ZoomOut(wxCommandEvent& event); @@ -44,8 +56,15 @@ class MapeditFrame : public wxFrame { void OnTabChanging(wxBookCtrlEvent& event); void OnAddEntity(wxCommandEvent& event); void OnCancelAddEntity(wxCommandEvent& event); + void OnAddRoot(wxCommandEvent& event); + void OnAddChild(wxCommandEvent& event); + void OnDidSelectMap(wxTreeEvent& event); + void OnWillSelectMap(wxTreeEvent& event); + void OnWillDragMap(wxTreeEvent& event); + void OnDidDragMap(wxTreeEvent& event); - Map map; + std::unique_ptr world; + Map* currentMap; MapeditWidget* mapEditor; TileWidget* tileEditor; wxTextCtrl* titleBox; @@ -55,6 +74,9 @@ class MapeditFrame : public wxFrame { wxButton* addEntityButton; wxButton* cancelEntityButton; wxToolBar* toolbar; + wxMenu* menuFile; + wxTreeCtrl* mapTree; + wxTreeItemId dragMap; bool addingEntity = false; -- cgit 1.4.1