From ba1e80b8cbace357a2c30874edaeb8fe4ce1895d Mon Sep 17 00:00:00 2001 From: Simon Judd Date: Fri, 29 Dec 2023 19:15:23 +1030 Subject: [PATCH] Minor code cleanup Did this in the database_330 branch so will here too --- src/MainEditor/UI/StartPanel.cpp | 40 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/MainEditor/UI/StartPanel.cpp b/src/MainEditor/UI/StartPanel.cpp index b49b381d1..8733f6492 100644 --- a/src/MainEditor/UI/StartPanel.cpp +++ b/src/MainEditor/UI/StartPanel.cpp @@ -86,6 +86,7 @@ SToolBarButton* createActionButton(wxWindow* parent, const string& action_id, co button->setExactFit(false); button->setFontSize(1.1f); button->setPadding(8); + button->Bind(wxEVT_STOOLBAR_BUTTON_CLICKED, [action_id](wxCommandEvent&) { SActionHandler::doAction(action_id); }); return button; } @@ -135,26 +136,25 @@ wxSizer* createActionsSizer(wxWindow* parent) { auto sizer = new wxBoxSizer(wxVERTICAL); - // Create buttons - auto open_button = createActionButton(parent, "aman_open", "Open Archive", "open"); - auto opendir_button = createActionButton(parent, "aman_opendir", "Open Directory", "opendir"); - auto newarchive_button = createActionButton(parent, "aman_newarchive", "Create New Archive", "newarchive"); - auto newmap_button = createActionButton(parent, "aman_newmap", "Create New Map", "mapeditor"); - - // Bind events - open_button->Bind(wxEVT_STOOLBAR_BUTTON_CLICKED, [](wxCommandEvent&) { SActionHandler::doAction("aman_open"); }); - opendir_button->Bind( - wxEVT_STOOLBAR_BUTTON_CLICKED, [](wxCommandEvent&) { SActionHandler::doAction("aman_opendir"); }); - newarchive_button->Bind( - wxEVT_STOOLBAR_BUTTON_CLICKED, [](wxCommandEvent&) { SActionHandler::doAction("aman_newarchive"); }); - newmap_button->Bind( - wxEVT_STOOLBAR_BUTTON_CLICKED, [](wxCommandEvent&) { SActionHandler::doAction("aman_newmap"); }); - - // Layout - sizer->Add(open_button, wxSizerFlags().Expand().Border(wxBOTTOM, ui::pad())); - sizer->Add(opendir_button, wxSizerFlags().Expand().Border(wxBOTTOM, ui::pad())); - sizer->Add(newarchive_button, wxSizerFlags().Expand().Border(wxBOTTOM, ui::pad())); - sizer->Add(newmap_button, wxSizerFlags().Expand()); + // Open Archive + sizer->Add( + createActionButton(parent, "aman_open", "Open Archive", "open"), + wxSizerFlags().Expand().Border(wxBOTTOM, ui::pad())); + + // Open Directory + sizer->Add( + createActionButton(parent, "aman_opendir", "Open Directory", "opendir"), + wxSizerFlags().Expand().Border(wxBOTTOM, ui::pad())); + + // New Archive + sizer->Add( + createActionButton(parent, "aman_newarchive", "Create New Archive", "newarchive"), + wxSizerFlags().Expand().Border(wxBOTTOM, ui::pad())); + + // New Map + sizer->Add( + createActionButton(parent, "aman_newmap", "Create New Map", "mapeditor"), + wxSizerFlags().Expand().Border(wxBOTTOM, ui::pad())); return sizer; }