diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-03-15 19:27:55 -0400 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-03-15 19:27:55 -0400 |
| commit | dca2aea57957c6af1af535f23ae392e7517ebd51 (patch) | |
| tree | 170d7e471d3872c07e508998320a3a5e537454fe /tools/mapedit/src/frame.cpp | |
| parent | c125c1acc0b20c3e405dddb5c835d9734aa0472c (diff) | |
| download | therapy-dca2aea57957c6af1af535f23ae392e7517ebd51.tar.gz therapy-dca2aea57957c6af1af535f23ae392e7517ebd51.tar.bz2 therapy-dca2aea57957c6af1af535f23ae392e7517ebd51.zip | |
Fixed functionality of quit menu item in map editor
Diffstat (limited to 'tools/mapedit/src/frame.cpp')
| -rw-r--r-- | tools/mapedit/src/frame.cpp | 37 |
1 files changed, 31 insertions, 6 deletions
| diff --git a/tools/mapedit/src/frame.cpp b/tools/mapedit/src/frame.cpp index b3808e2..e0df030 100644 --- a/tools/mapedit/src/frame.cpp +++ b/tools/mapedit/src/frame.cpp | |||
| @@ -3,6 +3,9 @@ | |||
| 3 | #include "tile_widget.h" | 3 | #include "tile_widget.h" |
| 4 | #include <wx/splitter.h> | 4 | #include <wx/splitter.h> |
| 5 | #include "panel.h" | 5 | #include "panel.h" |
| 6 | #include <list> | ||
| 7 | |||
| 8 | static std::list<wxWindow*> openWindows; | ||
| 6 | 9 | ||
| 7 | enum { | 10 | enum { |
| 8 | MENU_VIEW_ZOOM_IN, | 11 | MENU_VIEW_ZOOM_IN, |
| @@ -102,6 +105,8 @@ void MapeditFrame::OnExit(wxCloseEvent& event) | |||
| 102 | } | 105 | } |
| 103 | } | 106 | } |
| 104 | 107 | ||
| 108 | *closer = nullptr; | ||
| 109 | |||
| 105 | event.Skip(); | 110 | event.Skip(); |
| 106 | } | 111 | } |
| 107 | 112 | ||
| @@ -122,8 +127,7 @@ void MapeditFrame::ZoomOut(wxCommandEvent& event) | |||
| 122 | 127 | ||
| 123 | void MapeditFrame::OnNew(wxCommandEvent& event) | 128 | void MapeditFrame::OnNew(wxCommandEvent& event) |
| 124 | { | 129 | { |
| 125 | MapeditFrame* frame = new MapeditFrame(); | 130 | NewMap(); |
| 126 | frame->Show(true); | ||
| 127 | } | 131 | } |
| 128 | 132 | ||
| 129 | void MapeditFrame::OnOpen(wxCommandEvent& event) | 133 | void MapeditFrame::OnOpen(wxCommandEvent& event) |
| @@ -134,9 +138,7 @@ void MapeditFrame::OnOpen(wxCommandEvent& event) | |||
| 134 | return; | 138 | return; |
| 135 | } | 139 | } |
| 136 | 140 | ||
| 137 | std::string filename = openFileDialog.GetPath().ToStdString(); | 141 | OpenMap(openFileDialog.GetPath().c_str()); |
| 138 | MapeditFrame* frame = new MapeditFrame(Map(filename), filename); | ||
| 139 | frame->Show(true); | ||
| 140 | } | 142 | } |
| 141 | 143 | ||
| 142 | void MapeditFrame::OnSave(wxCommandEvent& event) | 144 | void MapeditFrame::OnSave(wxCommandEvent& event) |
| @@ -162,10 +164,33 @@ void MapeditFrame::OnClose(wxCommandEvent& event) | |||
| 162 | 164 | ||
| 163 | void MapeditFrame::OnQuit(wxCommandEvent& event) | 165 | void MapeditFrame::OnQuit(wxCommandEvent& event) |
| 164 | { | 166 | { |
| 165 | // TODO | 167 | for (auto window : openWindows) |
| 168 | { | ||
| 169 | if (window != nullptr) | ||
| 170 | { | ||
| 171 | window->Close(false); | ||
| 172 | } | ||
| 173 | } | ||
| 166 | } | 174 | } |
| 167 | 175 | ||
| 168 | void MapeditFrame::OnTitleChange(wxCommandEvent& event) | 176 | void MapeditFrame::OnTitleChange(wxCommandEvent& event) |
| 169 | { | 177 | { |
| 170 | map.setTitle(titleBox->GetLineText(0).ToStdString()); | 178 | map.setTitle(titleBox->GetLineText(0).ToStdString()); |
| 171 | } | 179 | } |
| 180 | |||
| 181 | void MapeditFrame::NewMap() | ||
| 182 | { | ||
| 183 | LaunchWindow(Map(), ""); | ||
| 184 | } | ||
| 185 | |||
| 186 | void MapeditFrame::OpenMap(const char* filename) | ||
| 187 | { | ||
| 188 | LaunchWindow(Map(filename), filename); | ||
| 189 | } | ||
| 190 | |||
| 191 | void MapeditFrame::LaunchWindow(Map map, const char* filename) | ||
| 192 | { | ||
| 193 | MapeditFrame* frame = new MapeditFrame(map, filename); | ||
| 194 | frame->closer = openWindows.insert(end(openWindows), frame); | ||
| 195 | frame->Show(true); | ||
| 196 | } | ||
