diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-03-16 10:57:03 -0400 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-03-16 10:57:03 -0400 |
| commit | 36536297aac5c07e3d5fb96abed74570fc7615e9 (patch) | |
| tree | 51e51ade3bb8804ac63fd625374ea7b6098b3539 /tools/mapedit/src/frame.cpp | |
| parent | 54b664622737740bbb42c13d594b66a21d58ca5f (diff) | |
| download | therapy-36536297aac5c07e3d5fb96abed74570fc7615e9.tar.gz therapy-36536297aac5c07e3d5fb96abed74570fc7615e9.tar.bz2 therapy-36536297aac5c07e3d5fb96abed74570fc7615e9.zip | |
Added toolbar with file buttons to map editor
Diffstat (limited to 'tools/mapedit/src/frame.cpp')
| -rw-r--r-- | tools/mapedit/src/frame.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
| diff --git a/tools/mapedit/src/frame.cpp b/tools/mapedit/src/frame.cpp index 0b03448..a38b861 100644 --- a/tools/mapedit/src/frame.cpp +++ b/tools/mapedit/src/frame.cpp | |||
| @@ -14,7 +14,10 @@ enum { | |||
| 14 | MENU_FILE_NEW, | 14 | MENU_FILE_NEW, |
| 15 | MENU_FILE_OPEN, | 15 | MENU_FILE_OPEN, |
| 16 | MENU_FILE_SAVE, | 16 | MENU_FILE_SAVE, |
| 17 | MENU_FILE_CLOSE | 17 | MENU_FILE_CLOSE, |
| 18 | TOOL_FILE_NEW, | ||
| 19 | TOOL_FILE_OPEN, | ||
| 20 | TOOL_FILE_SAVE | ||
| 18 | }; | 21 | }; |
| 19 | 22 | ||
| 20 | wxBEGIN_EVENT_TABLE(MapeditFrame, wxFrame) | 23 | wxBEGIN_EVENT_TABLE(MapeditFrame, wxFrame) |
| @@ -24,12 +27,17 @@ wxBEGIN_EVENT_TABLE(MapeditFrame, wxFrame) | |||
| 24 | EVT_MENU(MENU_FILE_NEW, MapeditFrame::OnNew) | 27 | EVT_MENU(MENU_FILE_NEW, MapeditFrame::OnNew) |
| 25 | EVT_MENU(MENU_FILE_OPEN, MapeditFrame::OnOpen) | 28 | EVT_MENU(MENU_FILE_OPEN, MapeditFrame::OnOpen) |
| 26 | EVT_MENU(MENU_FILE_SAVE, MapeditFrame::OnSave) | 29 | EVT_MENU(MENU_FILE_SAVE, MapeditFrame::OnSave) |
| 30 | EVT_TOOL(TOOL_FILE_NEW, MapeditFrame::OnNew) | ||
| 31 | EVT_TOOL(TOOL_FILE_OPEN, MapeditFrame::OnOpen) | ||
| 32 | EVT_TOOL(TOOL_FILE_SAVE, MapeditFrame::OnSave) | ||
| 27 | EVT_MENU(MENU_FILE_CLOSE, MapeditFrame::OnClose) | 33 | EVT_MENU(MENU_FILE_CLOSE, MapeditFrame::OnClose) |
| 28 | EVT_CLOSE(MapeditFrame::OnExit) | 34 | EVT_CLOSE(MapeditFrame::OnExit) |
| 29 | wxEND_EVENT_TABLE() | 35 | wxEND_EVENT_TABLE() |
| 30 | 36 | ||
| 31 | MapeditFrame::MapeditFrame(Map map, std::string filename) : wxFrame(NULL, wxID_ANY, "Map Editor", wxDefaultPosition, wxSize(GAME_WIDTH*3, GAME_HEIGHT*2)), map(map), filename(filename) | 37 | MapeditFrame::MapeditFrame(Map map, std::string filename) : wxFrame(NULL, wxID_ANY, "Map Editor", wxDefaultPosition, wxSize(GAME_WIDTH*3, GAME_HEIGHT*2)), map(map), filename(filename) |
| 32 | { | 38 | { |
| 39 | this->map.frame = this; | ||
| 40 | |||
| 33 | wxMenu* menuFile = new wxMenu; | 41 | wxMenu* menuFile = new wxMenu; |
| 34 | menuFile->Append(MENU_FILE_NEW, "New\tCtrl-N"); | 42 | menuFile->Append(MENU_FILE_NEW, "New\tCtrl-N"); |
| 35 | menuFile->Append(MENU_FILE_OPEN, "Open\tCtrl-O"); | 43 | menuFile->Append(MENU_FILE_OPEN, "Open\tCtrl-O"); |
| @@ -137,6 +145,14 @@ MapeditFrame::MapeditFrame(Map map, std::string filename) : wxFrame(NULL, wxID_A | |||
| 137 | splitterSizer->Add(propertyEditor, 0, wxALIGN_TOP, wxALIGN_LEFT, 0); | 145 | splitterSizer->Add(propertyEditor, 0, wxALIGN_TOP, wxALIGN_LEFT, 0); |
| 138 | layout3->SetSizer(splitterSizer); | 146 | layout3->SetSizer(splitterSizer); |
| 139 | splitterSizer->SetSizeHints(layout3); | 147 | splitterSizer->SetSizeHints(layout3); |
| 148 | |||
| 149 | // Toolbar time! | ||
| 150 | toolbar = CreateToolBar(); | ||
| 151 | toolbar->AddTool(TOOL_FILE_NEW, "New", wxBitmap(wxImage("res/page_add.png"))); | ||
| 152 | toolbar->AddTool(TOOL_FILE_OPEN, "Open", wxBitmap(wxImage("res/folder_page.png"))); | ||
| 153 | toolbar->AddTool(TOOL_FILE_SAVE, "Save", wxBitmap(wxImage("res/disk.png"))); | ||
| 154 | toolbar->EnableTool(TOOL_FILE_SAVE, this->map.getDirty()); | ||
| 155 | toolbar->Realize(); | ||
| 140 | } | 156 | } |
| 141 | 157 | ||
| 142 | void MapeditFrame::OnExit(wxCloseEvent& event) | 158 | void MapeditFrame::OnExit(wxCloseEvent& event) |
| @@ -314,3 +330,8 @@ void MapeditFrame::FinishAddingEntity() | |||
| 314 | addEntityButton->Enable(); | 330 | addEntityButton->Enable(); |
| 315 | cancelEntityButton->Disable(); | 331 | cancelEntityButton->Disable(); |
| 316 | } | 332 | } |
| 333 | |||
| 334 | void MapeditFrame::MapDirtyDidChange(bool dirty) | ||
| 335 | { | ||
| 336 | toolbar->EnableTool(TOOL_FILE_SAVE, dirty); | ||
| 337 | } | ||
