mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-08-15 14:43:32 -07:00
Don't nest Paths in Common settings
Doesn't make sense to have the Paths StaticBox inside the Common settings StaticBox so make it a top-level item as well. While at it dissolve nested constructors to make the creation of the widgets more readable. Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
parent
91a37e32f6
commit
49c887b7ca
1 changed files with 28 additions and 26 deletions
|
|
@ -52,42 +52,44 @@ enum {
|
|||
ID_DeletePath
|
||||
};
|
||||
|
||||
// Helper function for adding tooltips
|
||||
static wxWindow* Tooltipped(wxWindow* window, const wxString& tip)
|
||||
{
|
||||
window->SetToolTip(tip);
|
||||
return window;
|
||||
}
|
||||
|
||||
CinemaSidebar::CinemaSidebar(ScenarioEditor& scenarioEditor, wxWindow* sidebarContainer, wxWindow* bottomBarContainer)
|
||||
: Sidebar(scenarioEditor, sidebarContainer, bottomBarContainer)
|
||||
{
|
||||
wxStaticBoxSizer* commonSizer = new wxStaticBoxSizer(wxVERTICAL, this, _T("Common settings"));
|
||||
m_MainSizer->Add(commonSizer, wxSizerFlags().Expand());
|
||||
{
|
||||
auto* sizer = new wxStaticBoxSizer(wxVERTICAL, this, _T("Common settings"));
|
||||
|
||||
wxFlexGridSizer* gridSizer = new wxFlexGridSizer(1, 5, 5);
|
||||
gridSizer->AddGrowableCol(0);
|
||||
m_DrawPath = new wxCheckBox(sizer->GetStaticBox(), ID_PathsDrawing, _("Draw all paths"));
|
||||
m_DrawPath->SetToolTip(_("Display every cinematic path added to the map"));
|
||||
|
||||
gridSizer->Add(Tooltipped(m_DrawPath = new wxCheckBox(commonSizer->GetStaticBox(), ID_PathsDrawing, _("Draw all paths")),
|
||||
_("Display every cinematic path added to the map")));
|
||||
sizer->Add(m_DrawPath, wxSizerFlags().Expand().Border(wxALL, Atlas::Style::STATICBOX_PADDING));
|
||||
|
||||
commonSizer->Add(gridSizer, wxSizerFlags().Expand().Border(wxALL, Atlas::Style::STATICBOX_PADDING));
|
||||
m_MainSizer->Add(sizer, wxSizerFlags().Expand());
|
||||
}
|
||||
|
||||
// Paths list panel
|
||||
wxStaticBoxSizer* pathsBoxSizer = new wxStaticBoxSizer(wxVERTICAL, commonSizer->GetStaticBox(), _T("Paths"));
|
||||
wxStaticBox* pathsBox = pathsBoxSizer->GetStaticBox();
|
||||
gridSizer->Add(pathsBoxSizer, wxSizerFlags().Proportion(1).Expand());
|
||||
{
|
||||
auto* boxSizer = new wxStaticBoxSizer(wxVERTICAL, this, _T("Paths"));
|
||||
auto* box = boxSizer->GetStaticBox();
|
||||
|
||||
m_PathList = new wxListBox(box, ID_PathsList, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE | wxLB_SORT);
|
||||
|
||||
auto* deleteButton = new wxButton(box, ID_DeletePath, _("Delete"));
|
||||
deleteButton->SetToolTip(_T("Delete selected path"));
|
||||
|
||||
m_NewPathName = new wxTextCtrl(box, wxID_ANY);
|
||||
|
||||
auto* addButton = new wxButton(box, ID_AddPath, _("Add"));
|
||||
|
||||
wxFlexGridSizer* pathsSizer = new wxFlexGridSizer(1, 5, 5);
|
||||
pathsSizer->AddGrowableCol(0);
|
||||
pathsBoxSizer->Add(pathsSizer, wxSizerFlags().Expand().Border(wxALL, Atlas::Style::STATICBOX_PADDING));
|
||||
pathsSizer->Add(m_PathList, wxSizerFlags().Proportion(1).Expand());
|
||||
pathsSizer->Add(deleteButton, wxSizerFlags().Expand());
|
||||
pathsSizer->Add(m_NewPathName, wxSizerFlags().Expand());
|
||||
pathsSizer->Add(addButton, wxSizerFlags().Expand());
|
||||
|
||||
pathsSizer->Add(m_PathList = new wxListBox(pathsBox, ID_PathsList, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE | wxLB_SORT), wxSizerFlags().Proportion(1).Expand());
|
||||
commonSizer->AddSpacer(3);
|
||||
pathsSizer->Add(Tooltipped(new wxButton(pathsBox, ID_DeletePath, _("Delete")), _T("Delete selected path")), wxSizerFlags().Expand());
|
||||
boxSizer->Add(pathsSizer, wxSizerFlags().Expand().Border(wxALL, Atlas::Style::STATICBOX_PADDING));
|
||||
|
||||
pathsSizer->Add(m_NewPathName = new wxTextCtrl(pathsBox, wxID_ANY), wxSizerFlags().Expand());
|
||||
pathsSizer->Add(new wxButton(pathsBox, ID_AddPath, _("Add")), wxSizerFlags().Expand());
|
||||
m_MainSizer->Add(boxSizer, wxSizerFlags().Expand());
|
||||
}
|
||||
}
|
||||
|
||||
void CinemaSidebar::OnFirstDisplay()
|
||||
|
|
|
|||
Loading…
Reference in a new issue