From 34bc66326680d9c985c716b5842e13731566352b Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 30 Jan 2024 01:27:25 +0100 Subject: [PATCH] Simplify and improve performance of credits list. --- src/wx/about_dialog.cc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/wx/about_dialog.cc b/src/wx/about_dialog.cc index b643eb823..2c742cce3 100644 --- a/src/wx/about_dialog.cc +++ b/src/wx/about_dialog.cc @@ -263,22 +263,23 @@ AboutDialog::add_section (wxString name, wxArrayString credits) panel->SetScrollRate (0, 32); auto overall_sizer = new wxBoxSizer (wxHORIZONTAL); - vector sizers; - - for (int i = 0; i < N; ++i) { - sizers.push_back (new wxBoxSizer (wxVERTICAL)); - overall_sizer->Add (sizers.back (), 1, wxEXPAND | wxALL, 6); - } - + vector strings(N); int c = 0; for (size_t i = 0; i < credits.Count(); ++i) { - add_label_to_sizer (sizers[c], panel, credits[i], false); + strings[c] += credits[i] + wxT("\n"); ++c; if (c == N) { c = 0; } } + for (int i = 0; i < N; ++i) { + auto label = new wxStaticText(panel, wxID_ANY, strings[i]); + auto sizer = new wxBoxSizer(wxVERTICAL); + sizer->Add(label); + overall_sizer->Add(sizer, 1, wxEXPAND | wxALL, 6); + } + panel->SetSizerAndFit (overall_sizer); _notebook->AddPage (panel, name, first); first = false; -- 2.30.2