diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-03-15 19:08:46 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-03-15 19:08:46 -0400 |
commit | c125c1acc0b20c3e405dddb5c835d9734aa0472c (patch) | |
tree | 65d57aa9f4b0324506080210448fce212e407cc7 /tools/mapedit/src/frame.cpp | |
parent | 91640f2f35d703898edb14abaae7dd63f5346027 (diff) | |
download | therapy-c125c1acc0b20c3e405dddb5c835d9734aa0472c.tar.gz therapy-c125c1acc0b20c3e405dddb5c835d9734aa0472c.tar.bz2 therapy-c125c1acc0b20c3e405dddb5c835d9734aa0472c.zip |
Added ability to edit title in map editor
Diffstat (limited to 'tools/mapedit/src/frame.cpp')
-rw-r--r-- | tools/mapedit/src/frame.cpp | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/tools/mapedit/src/frame.cpp b/tools/mapedit/src/frame.cpp index 3cd1c15..b3808e2 100644 --- a/tools/mapedit/src/frame.cpp +++ b/tools/mapedit/src/frame.cpp | |||
@@ -43,28 +43,36 @@ MapeditFrame::MapeditFrame(Map map, std::string filename) : wxFrame(NULL, wxID_A | |||
43 | 43 | ||
44 | SetMenuBar(menuBar); | 44 | SetMenuBar(menuBar); |
45 | 45 | ||
46 | wxBoxSizer* sizermain = new wxBoxSizer(wxVERTICAL); | 46 | // Layout 1: Splitter between map tree and layout 2 |
47 | wxSplitterWindow* splitter = new wxSplitterWindow(this, wxID_ANY); | 47 | // Layout 2: Non-splitter between layout 3 and tile chooser |
48 | splitter->SetSashGravity(0.0); | 48 | // Layout 3: Splitter between map editor and properties editor |
49 | splitter->SetMinimumPaneSize(50); | ||
50 | sizermain->Add(splitter, 1, wxEXPAND, 0); | ||
51 | 49 | ||
52 | wxPanel* tileEditorPanel = new wxPanel(splitter, wxID_ANY); | 50 | wxSplitterWindow* layout3 = new wxSplitterWindow(this, wxID_ANY); |
53 | tileEditor = new TileWidget(tileEditorPanel, wxID_ANY, 6, 6, wxPoint(0,0)); | 51 | layout3->SetSashGravity(1.0); |
54 | wxBoxSizer* tileSizer = new wxBoxSizer(wxVERTICAL); | 52 | layout3->SetMinimumPaneSize(20); |
55 | tileSizer->Add(tileEditor, 1, wxEXPAND, 0); | ||
56 | tileEditorPanel->SetSizer(tileSizer); | ||
57 | 53 | ||
58 | wxPanel* mapEditorPanel = new wxPanel(splitter, wxID_ANY); | 54 | tileEditor = new TileWidget(this, wxID_ANY, 6, 6, wxPoint(0,0), wxSize(TILE_WIDTH*6*7,TILE_HEIGHT*10*6)); |
59 | mapEditor = new MapeditWidget(mapEditorPanel, wxID_ANY, &this->map, tileEditor, wxPoint(0,0)); | 55 | mapEditor = new MapeditWidget(layout3, wxID_ANY, &this->map, tileEditor, wxPoint(0,0), wxSize(GAME_WIDTH*2, GAME_HEIGHT*2)); |
60 | wxBoxSizer* mapSizer = new wxBoxSizer(wxVERTICAL); | ||
61 | mapSizer->Add(mapEditor, 1, wxEXPAND, 0); | ||
62 | mapEditorPanel->SetSizer(mapSizer); | ||
63 | 56 | ||
64 | splitter->SplitVertically(tileEditorPanel, mapEditorPanel); | 57 | wxPanel* propertyEditor = new wxPanel(layout3, wxID_ANY); |
58 | titleBox = new wxTextCtrl(propertyEditor, wxID_ANY, map.getTitle()); | ||
59 | titleBox->Bind(wxEVT_TEXT, &MapeditFrame::OnTitleChange, this); | ||
65 | 60 | ||
66 | this->SetSizer(sizermain); | 61 | wxStaticText* titleLabel = new wxStaticText(propertyEditor, wxID_ANY, "Title:"); |
67 | sizermain->SetSizeHints(this); | 62 | |
63 | wxFlexGridSizer* propertySizer = new wxFlexGridSizer(1, 2, 9, 25); | ||
64 | propertySizer->Add(titleLabel); | ||
65 | propertySizer->Add(titleBox, 1, wxEXPAND); | ||
66 | propertyEditor->SetSizer(propertySizer); | ||
67 | propertySizer->SetSizeHints(propertyEditor); | ||
68 | |||
69 | layout3->SplitHorizontally(mapEditor, propertyEditor); | ||
70 | |||
71 | wxBoxSizer* sizer2 = new wxBoxSizer(wxHORIZONTAL); | ||
72 | sizer2->Add(layout3, 1, wxEXPAND, 0); | ||
73 | sizer2->Add(tileEditor, 0, wxALIGN_TOP | wxALIGN_CENTER_HORIZONTAL | wxLEFT, 2); | ||
74 | this->SetSizer(sizer2); | ||
75 | sizer2->SetSizeHints(this); | ||
68 | } | 76 | } |
69 | 77 | ||
70 | void MapeditFrame::OnExit(wxCloseEvent& event) | 78 | void MapeditFrame::OnExit(wxCloseEvent& event) |
@@ -156,3 +164,8 @@ void MapeditFrame::OnQuit(wxCommandEvent& event) | |||
156 | { | 164 | { |
157 | // TODO | 165 | // TODO |
158 | } | 166 | } |
167 | |||
168 | void MapeditFrame::OnTitleChange(wxCommandEvent& event) | ||
169 | { | ||
170 | map.setTitle(titleBox->GetLineText(0).ToStdString()); | ||
171 | } | ||