Changeset View
Changeset View
Standalone View
Standalone View
source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Map/Map.cpp
Show All 15 Lines | |||||
*/ | */ | ||||
#include "precompiled.h" | #include "precompiled.h" | ||||
#include "Map.h" | #include "Map.h" | ||||
#include "AtlasObject/AtlasObject.h" | #include "AtlasObject/AtlasObject.h" | ||||
#include "GameInterface/Messages.h" | #include "GameInterface/Messages.h" | ||||
#include "MapResizeDialog/MapResizeDialog.h" | |||||
#include "ScenarioEditor/ScenarioEditor.h" | #include "ScenarioEditor/ScenarioEditor.h" | ||||
#include "ScenarioEditor/Tools/Common/Tools.h" | #include "ScenarioEditor/Tools/Common/Tools.h" | ||||
#include "wx/busyinfo.h" | #include "wx/busyinfo.h" | ||||
#include "wx/filename.h" | #include "wx/filename.h" | ||||
#define CREATE_CHECKBOX(window, parentSizer, name, description, ID) \ | #define CREATE_CHECKBOX(window, parentSizer, name, description, ID) \ | ||||
parentSizer->Add(new wxStaticText(window, wxID_ANY, _(name)), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT)); \ | parentSizer->Add(new wxStaticText(window, wxID_ANY, _(name)), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT)); \ | ||||
Show All 23 Lines | enum | ||||
ID_RandomSeed, | ID_RandomSeed, | ||||
ID_RandomReseed, | ID_RandomReseed, | ||||
ID_RandomGenerate, | ID_RandomGenerate, | ||||
ID_SimPlay, | ID_SimPlay, | ||||
ID_SimFast, | ID_SimFast, | ||||
ID_SimSlow, | ID_SimSlow, | ||||
ID_SimPause, | ID_SimPause, | ||||
ID_SimReset, | ID_SimReset, | ||||
ID_OpenPlayerPanel | ID_OpenPlayerPanel, | ||||
ID_ResizeMap | |||||
}; | }; | ||||
enum | enum | ||||
{ | { | ||||
SimInactive, | SimInactive, | ||||
SimPlaying, | SimPlaying, | ||||
SimPlayingFast, | SimPlayingFast, | ||||
SimPlayingSlow, | SimPlayingSlow, | ||||
▲ Show 20 Lines • Show All 334 Lines • ▼ Show 20 Lines | scrollSizer->Add(m_MapSettingsCtrl, wxSizerFlags().Expand()); | ||||
sizer->AddSpacer(5); | sizer->AddSpacer(5); | ||||
sizer->Add(Tooltipped(new wxButton(scrolledWindow, ID_RandomGenerate, _("Generate map")), | sizer->Add(Tooltipped(new wxButton(scrolledWindow, ID_RandomGenerate, _("Generate map")), | ||||
_("Run selected random map script")), wxSizerFlags().Expand()); | _("Run selected random map script")), wxSizerFlags().Expand()); | ||||
} | } | ||||
{ | { | ||||
///////////////////////////////////////////////////////////////////////// | |||||
// Misc tools | |||||
wxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, scrolledWindow, _("Misc tools")); | |||||
sizer->Add(new wxButton(scrolledWindow, ID_ResizeMap, _("Resize/Recenter map")), wxSizerFlags().Expand()); | |||||
scrollSizer->Add(sizer, wxSizerFlags().Expand().Border(wxTOP, 10)); | |||||
} | |||||
{ | |||||
///////////////////////////////////////////////////////////////////////// | ///////////////////////////////////////////////////////////////////////// | ||||
// Simulation buttons | // Simulation buttons | ||||
wxStaticBoxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, scrolledWindow, _("Simulation test")); | wxStaticBoxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, scrolledWindow, _("Simulation test")); | ||||
scrollSizer->Add(sizer, wxSizerFlags().Expand().Border(wxTOP, 8)); | scrollSizer->Add(sizer, wxSizerFlags().Expand().Border(wxTOP, 8)); | ||||
wxGridSizer* gridSizer = new wxGridSizer(5); | wxGridSizer* gridSizer = new wxGridSizer(5); | ||||
gridSizer->Add(Tooltipped(new wxButton(scrolledWindow, ID_SimPlay, _("Play"), wxDefaultPosition, wxSize(48, -1)), | gridSizer->Add(Tooltipped(new wxButton(scrolledWindow, ID_SimPlay, _("Play"), wxDefaultPosition, wxSize(48, -1)), | ||||
_("Run the simulation at normal speed")), wxSizerFlags().Expand()); | _("Run the simulation at normal speed")), wxSizerFlags().Expand()); | ||||
▲ Show 20 Lines • Show All 218 Lines • ▼ Show 20 Lines | void MapSidebar::OnRandomGenerate(wxCommandEvent& WXUNUSED(evt)) | ||||
m_ScenarioEditor.NotifyOnMapReload(); | m_ScenarioEditor.NotifyOnMapReload(); | ||||
} | } | ||||
void MapSidebar::OnOpenPlayerPanel(wxCommandEvent& WXUNUSED(evt)) | void MapSidebar::OnOpenPlayerPanel(wxCommandEvent& WXUNUSED(evt)) | ||||
{ | { | ||||
m_ScenarioEditor.SelectPage(_T("PlayerSidebar")); | m_ScenarioEditor.SelectPage(_T("PlayerSidebar")); | ||||
} | } | ||||
void MapSidebar::OnResizeMap(wxCommandEvent& WXUNUSED(evt)) | |||||
{ | |||||
MapResizeDialog dlg(this); | |||||
if (dlg.ShowModal() != wxID_OK) | |||||
return; | |||||
wxPoint offset = dlg.GetOffset(); | |||||
POST_COMMAND(ResizeMap, (dlg.GetNewSize(), offset.x, offset.y)); | |||||
} | |||||
BEGIN_EVENT_TABLE(MapSidebar, Sidebar) | BEGIN_EVENT_TABLE(MapSidebar, Sidebar) | ||||
EVT_COLLAPSIBLEPANE_CHANGED(wxID_ANY, MapSidebar::OnCollapse) | EVT_COLLAPSIBLEPANE_CHANGED(wxID_ANY, MapSidebar::OnCollapse) | ||||
EVT_BUTTON(ID_SimPlay, MapSidebar::OnSimPlay) | EVT_BUTTON(ID_SimPlay, MapSidebar::OnSimPlay) | ||||
EVT_BUTTON(ID_SimFast, MapSidebar::OnSimPlay) | EVT_BUTTON(ID_SimFast, MapSidebar::OnSimPlay) | ||||
EVT_BUTTON(ID_SimSlow, MapSidebar::OnSimPlay) | EVT_BUTTON(ID_SimSlow, MapSidebar::OnSimPlay) | ||||
EVT_BUTTON(ID_SimPause, MapSidebar::OnSimPause) | EVT_BUTTON(ID_SimPause, MapSidebar::OnSimPause) | ||||
EVT_BUTTON(ID_SimReset, MapSidebar::OnSimReset) | EVT_BUTTON(ID_SimReset, MapSidebar::OnSimReset) | ||||
EVT_BUTTON(ID_RandomReseed, MapSidebar::OnRandomReseed) | EVT_BUTTON(ID_RandomReseed, MapSidebar::OnRandomReseed) | ||||
EVT_BUTTON(ID_RandomGenerate, MapSidebar::OnRandomGenerate) | EVT_BUTTON(ID_RandomGenerate, MapSidebar::OnRandomGenerate) | ||||
EVT_BUTTON(ID_OpenPlayerPanel, MapSidebar::OnOpenPlayerPanel) | EVT_BUTTON(ID_OpenPlayerPanel, MapSidebar::OnOpenPlayerPanel) | ||||
EVT_BUTTON(ID_ResizeMap, MapSidebar::OnResizeMap) | |||||
END_EVENT_TABLE(); | END_EVENT_TABLE(); |
Wildfire Games · Phabricator