Simplify and improve performance of credits list.
authorCarl Hetherington <cth@carlh.net>
Tue, 30 Jan 2024 00:27:25 +0000 (01:27 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 5 Feb 2024 21:13:09 +0000 (22:13 +0100)
src/wx/about_dialog.cc

index b643eb8235152d975b9f87dfbe94d28e18065fbf..2c742cce3a1549be4368297cbc0c59cd6f3e4496 100644 (file)
@@ -263,22 +263,23 @@ AboutDialog::add_section (wxString name, wxArrayString credits)
        panel->SetScrollRate (0, 32);
        auto overall_sizer = new wxBoxSizer (wxHORIZONTAL);
 
-       vector<wxSizer*> sizers;
-
-       for (int i = 0; i < N; ++i) {
-               sizers.push_back (new wxBoxSizer (wxVERTICAL));
-               overall_sizer->Add (sizers.back (), 1, wxEXPAND | wxALL, 6);
-       }
-
+       vector<wxString> 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;