ObjectSidebar::ObjectSidebar(ScenarioEditor& scenarioEditor, wxWindow* sidebarContainer, wxWindow* bottomBarContainer) : Sidebar(scenarioEditor, sidebarContainer, bottomBarContainer), p(new ObjectSidebarImpl()) { wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(new wxStaticText(this, wxID_ANY, _("Filter")), wxSizerFlags().Align(wxALIGN_CENTER)); wxTextCtrl* objectFilter = new wxTextCtrl(this, ID_ObjectFilter); sizer->Add(objectFilter, wxSizerFlags().Expand().Proportion(1)); m_MainSizer->Add(sizer, wxSizerFlags().Expand()); wxArrayString strings; strings.Add(_("Entities")); strings.Add(_("Actors (all)")); wxChoice* objectType = new wxChoice(this, ID_ObjectType, wxDefaultPosition, wxDefaultSize, strings); objectType->SetSelection(0); m_MainSizer->Add(objectType, wxSizerFlags().Expand()); p->m_ObjectListBox = new wxListBox(this, ID_SelectObject, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE|wxLB_HSCROLL); m_MainSizer->Add(p->m_ObjectListBox, wxSizerFlags().Proportion(1).Expand()); m_MainSizer->Add(new wxButton(this, ID_ToggleViewer, _("Switch to Actor Viewer")), wxSizerFlags().Expand()); m_BottomBar = new ObjectBottomBar(bottomBarContainer, scenarioEditor, scenarioEditor.GetObjectSettings(), scenarioEditor.GetMapSettings(), p); p->m_ToolConn = scenarioEditor.GetToolManager().GetCurrentTool().RegisterObserver(0, &ObjectSidebar::OnToolChange, this); }
ObjectSidebarImpl(ScenarioEditor& scenarioEditor) : m_ObjectListBox(NULL), m_ActorViewerActive(false), m_ActorViewerEntity(_T("actor|structures/fndn_1x1.xml")), m_ActorViewerAnimation(_T("idle")), m_ActorViewerSpeed(0.f), m_ObjectSettings(scenarioEditor.GetObjectSettings()) { }
MapSettingsControl::MapSettingsControl(wxWindow* parent, ScenarioEditor& scenarioEditor) : wxPanel(parent, wxID_ANY), m_MapSettings(scenarioEditor.GetMapSettings()) { wxStaticBoxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Map settings")); SetSizer(sizer); }
TerrainSidebar::TerrainSidebar(ScenarioEditor& scenarioEditor, wxWindow* sidebarContainer, wxWindow* bottomBarContainer) : Sidebar(scenarioEditor, sidebarContainer, bottomBarContainer) { { ///////////////////////////////////////////////////////////////////////// // Terrain elevation wxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Elevation tools")); wxSizer* gridSizer = new wxGridSizer(3); gridSizer->Add(Tooltipped(new ToolButton(scenarioEditor.GetToolManager(), this, _("Modify"), _T("AlterElevation")), _("Brush with left mouse buttons to raise terrain,\nright mouse button to lower it")), wxSizerFlags().Expand()); gridSizer->Add(Tooltipped(new ToolButton(scenarioEditor.GetToolManager(), this, _("Smooth"), _T("SmoothElevation")), _("Brush with left mouse button to smooth terrain,\nright mouse button to roughen it")), wxSizerFlags().Expand()); gridSizer->Add(Tooltipped(new ToolButton(scenarioEditor.GetToolManager(), this, _("Flatten"), _T("FlattenElevation")), _("Brush with left mouse button to flatten terrain")), wxSizerFlags().Expand()); sizer->Add(gridSizer, wxSizerFlags().Expand()); m_MainSizer->Add(sizer, wxSizerFlags().Expand().Border(wxTOP, 10)); } { ///////////////////////////////////////////////////////////////////////// // Terrain texture wxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Texture tools")); wxSizer* gridSizer = new wxGridSizer(3); gridSizer->Add(Tooltipped(new ToolButton(scenarioEditor.GetToolManager(), this, _("Paint"), _T("PaintTerrain")), _("Brush with left mouse button to paint texture dominantly,\nright mouse button to paint submissively")), wxSizerFlags().Expand()); gridSizer->Add(Tooltipped(new ToolButton(scenarioEditor.GetToolManager(), this, _("Replace"), _T("ReplaceTerrain")), _("Replace all of a terrain texture with a new one")), wxSizerFlags().Expand()); gridSizer->Add(Tooltipped(new ToolButton(scenarioEditor.GetToolManager(), this, _("Fill"), _T("FillTerrain")), _T("Bucket fill a patch of terrain texture with a new one")), wxSizerFlags().Expand()); sizer->Add(gridSizer, wxSizerFlags().Expand()); m_MainSizer->Add(sizer, wxSizerFlags().Expand().Border(wxTOP, 10)); } { ///////////////////////////////////////////////////////////////////////// // Brush settings wxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Brush")); g_Brush_Elevation.CreateUI(this, sizer); m_MainSizer->Add(sizer, wxSizerFlags().Expand().Border(wxTOP, 10)); } { ///////////////////////////////////////////////////////////////////////// // Visualise wxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Visualise")); m_MainSizer->Add(sizer, wxSizerFlags().Expand().Border(wxTOP, 10)); wxFlexGridSizer* visSizer = new wxFlexGridSizer(2, 5, 5); visSizer->AddGrowableCol(1); sizer->Add(visSizer, wxSizerFlags().Expand()); wxArrayString defaultChoices; defaultChoices.Add(_("(none)")); m_PassabilityChoice = new wxChoice(this, ID_Passability, wxDefaultPosition, wxDefaultSize, defaultChoices); m_PassabilityChoice->SetSelection(0); visSizer->Add(new wxStaticText(this, wxID_ANY, _("Passability")), wxSizerFlags().Align(wxALIGN_CENTER|wxALIGN_RIGHT)); visSizer->Add(Tooltipped(m_PassabilityChoice, _("View passability classes")), wxSizerFlags().Expand()); visSizer->Add(new wxStaticText(this, wxID_ANY, _("Priorities")), wxSizerFlags().Align(wxALIGN_CENTER|wxALIGN_RIGHT)); visSizer->Add(Tooltipped(new wxCheckBox(this, ID_ShowPriorities, _("")), _("Show terrain texture priorities"))); } { ///////////////////////////////////////////////////////////////////////// // Misc tools wxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Misc tools")); sizer->Add(new wxButton(this, ID_ResizeMap, _("Resize map")), wxSizerFlags().Expand()); m_MainSizer->Add(sizer, wxSizerFlags().Expand().Border(wxTOP, 10)); } m_BottomBar = new TerrainBottomBar(scenarioEditor, bottomBarContainer); }
TerrainSidebar::TerrainSidebar(ScenarioEditor& scenarioEditor, wxWindow* sidebarContainer, wxWindow* bottomBarContainer) : Sidebar(scenarioEditor, sidebarContainer, bottomBarContainer) { { ///////////////////////////////////////////////////////////////////////// // Terrain elevation wxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Elevation tools")); wxSizer* gridSizer = new wxGridSizer(3); gridSizer->Add(new ToolButton(scenarioEditor.GetToolManager(), this, _("Modify"), _T("AlterElevation")), wxSizerFlags().Expand()); gridSizer->Add(new ToolButton(scenarioEditor.GetToolManager(), this, _("Smooth"), _T("SmoothElevation")), wxSizerFlags().Expand()); gridSizer->Add(new ToolButton(scenarioEditor.GetToolManager(), this, _("Flatten"), _T("FlattenElevation")), wxSizerFlags().Expand()); sizer->Add(gridSizer, wxSizerFlags().Expand()); m_MainSizer->Add(sizer, wxSizerFlags().Expand().Border(wxTOP, 10)); } { ///////////////////////////////////////////////////////////////////////// // Terrain texture wxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Texture tools")); wxSizer* gridSizer = new wxGridSizer(3); gridSizer->Add(new ToolButton(scenarioEditor.GetToolManager(), this, _("Paint"), _T("PaintTerrain")), wxSizerFlags().Expand()); gridSizer->Add(new ToolButton(scenarioEditor.GetToolManager(), this, _("Replace"), _T("ReplaceTerrain")), wxSizerFlags().Expand()); sizer->Add(gridSizer, wxSizerFlags().Expand()); m_MainSizer->Add(sizer, wxSizerFlags().Expand().Border(wxTOP, 10)); } { ///////////////////////////////////////////////////////////////////////// // Brush settings wxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Brush")); g_Brush_Elevation.CreateUI(this, sizer); m_MainSizer->Add(sizer, wxSizerFlags().Expand().Border(wxTOP, 10)); } { ///////////////////////////////////////////////////////////////////////// // Visualise wxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Visualise")); m_MainSizer->Add(sizer, wxSizerFlags().Expand().Border(wxTOP, 10)); wxSizer* visSizer = new wxFlexGridSizer(2, 2, 5, 5); sizer->Add(visSizer); wxArrayString defaultChoices; defaultChoices.Add(_("(none)")); m_PassabilityChoice = new wxChoice(this, ID_Passability, wxDefaultPosition, wxDefaultSize, defaultChoices); m_PassabilityChoice->SetSelection(0); visSizer->Add(new wxStaticText(this, wxID_ANY, _("Passability")), wxSizerFlags().Align(wxALIGN_CENTER|wxALIGN_RIGHT)); visSizer->Add(m_PassabilityChoice); visSizer->Add(new wxStaticText(this, wxID_ANY, _("Priorities")), wxSizerFlags().Align(wxALIGN_CENTER|wxALIGN_RIGHT)); visSizer->Add(new wxCheckBox(this, ID_ShowPriorities, _(""))); } { ///////////////////////////////////////////////////////////////////////// // Misc tools wxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Misc tools")); sizer->Add(new wxButton(this, ID_ResizeMap, _("Resize map")), wxSizerFlags().Expand()); m_MainSizer->Add(sizer, wxSizerFlags().Expand().Border(wxTOP, 10)); } m_BottomBar = new TerrainBottomBar(scenarioEditor, bottomBarContainer); }
PlayerSettingsControl::PlayerSettingsControl(wxWindow* parent, ScenarioEditor& scenarioEditor) : wxPanel(parent, wxID_ANY), m_ScenarioEditor(scenarioEditor), m_InGUIUpdate(false), m_MapSettings(scenarioEditor.GetMapSettings()), m_NumPlayers(0) { // To prevent recursion, don't handle GUI events right now m_InGUIUpdate = true; wxStaticBoxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Player settings")); SetSizer(sizer); wxBoxSizer* boxSizer = new wxBoxSizer(wxHORIZONTAL); boxSizer->Add(new wxStaticText(this, wxID_ANY, _("Num players")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT)); wxSpinCtrl* numPlayersSpin = new wxSpinCtrl(this, ID_NumPlayers, wxEmptyString, wxDefaultPosition, wxSize(40, -1)); numPlayersSpin->SetValue(MAX_NUM_PLAYERS); numPlayersSpin->SetRange(1, MAX_NUM_PLAYERS); boxSizer->Add(numPlayersSpin); sizer->Add(boxSizer, wxSizerFlags().Expand().Proportion(0)); sizer->AddSpacer(5); m_Players = new PlayerNotebook(m_ScenarioEditor, this); sizer->Add(m_Players, wxSizerFlags().Expand().Proportion(1)); m_InGUIUpdate = false; }