mirror of
https://github.com/cookiengineer/audacity
synced 2026-02-09 05:01:57 +01:00
Sizers are owned by wxWindow objects when added, so use safenew, or...
... use unique_ptr in the interim between building them and adding. This checks eliminates some naked news, which were not paired with deletes.
This commit is contained in:
@@ -68,65 +68,78 @@ MultiDialog::MultiDialog(wxWindow * pParent,
|
||||
{
|
||||
SetName(GetTitle());
|
||||
|
||||
wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer *vSizer = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer *iconAndTextSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxBitmap bitmap = wxArtProvider::GetIcon(wxART_WARNING,
|
||||
wxART_MESSAGE_BOX);
|
||||
wxStaticBitmap *icon = safenew wxStaticBitmap(this, -1, bitmap);
|
||||
iconAndTextSizer->Add( icon, 0, wxCENTER );
|
||||
|
||||
wxStaticText *statText = safenew wxStaticText(this, -1, message);
|
||||
statText->SetName(message); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
|
||||
iconAndTextSizer->Add(statText, 1, wxCENTER|wxLEFT,15 );
|
||||
|
||||
vSizer->Add(iconAndTextSizer, 0, wxALIGN_LEFT|wxALL, 5);
|
||||
|
||||
|
||||
int count=0;
|
||||
while(buttons[count])count++;
|
||||
wxString *buttonLabels = new wxString[count];
|
||||
|
||||
count=0;
|
||||
while(buttons[count]){
|
||||
buttonLabels[count] = buttons[count];
|
||||
count++;
|
||||
}
|
||||
|
||||
mRadioBox = safenew wxRadioBox(this,-1,
|
||||
boxMsg,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
count, buttonLabels,
|
||||
1, wxRA_SPECIFY_COLS);
|
||||
mRadioBox->SetName(boxMsg);
|
||||
mRadioBox->SetSelection(0);
|
||||
vSizer->Add(mRadioBox, 1, wxEXPAND | wxALIGN_CENTER | wxALL, 5);
|
||||
|
||||
|
||||
wxBoxSizer* buttonSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
wxButton* pButton;
|
||||
if(log)
|
||||
wxString *buttonLabels;
|
||||
wxBoxSizer *mainSizer;
|
||||
{
|
||||
pButton = safenew wxButton(this, ID_SHOW_LOG_BUTTON, _("Show Log for Details"));
|
||||
buttonSizer->Add(pButton, 0, wxALIGN_LEFT | wxALL, 5);
|
||||
pButton->SetDefault(); // Encourage user to look at files.
|
||||
auto uMainSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
||||
mainSizer = uMainSizer.get();
|
||||
|
||||
buttonSizer->AddSpacer(40);
|
||||
{
|
||||
auto vSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
||||
{
|
||||
auto iconAndTextSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
|
||||
|
||||
wxBitmap bitmap = wxArtProvider::GetIcon(wxART_WARNING,
|
||||
wxART_MESSAGE_BOX);
|
||||
wxStaticBitmap *icon = safenew wxStaticBitmap(this, -1, bitmap);
|
||||
iconAndTextSizer->Add(icon, 0, wxCENTER);
|
||||
|
||||
wxStaticText *statText = safenew wxStaticText(this, -1, message);
|
||||
statText->SetName(message); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
|
||||
iconAndTextSizer->Add(statText, 1, wxCENTER | wxLEFT, 15);
|
||||
|
||||
vSizer->Add(iconAndTextSizer.release(), 0, wxALIGN_LEFT | wxALL, 5);
|
||||
}
|
||||
|
||||
|
||||
int count = 0;
|
||||
while (buttons[count])count++;
|
||||
buttonLabels = new wxString[count];
|
||||
|
||||
count = 0;
|
||||
while (buttons[count]){
|
||||
buttonLabels[count] = buttons[count];
|
||||
count++;
|
||||
}
|
||||
|
||||
mRadioBox = safenew wxRadioBox(this, -1,
|
||||
boxMsg,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
count, buttonLabels,
|
||||
1, wxRA_SPECIFY_COLS);
|
||||
mRadioBox->SetName(boxMsg);
|
||||
mRadioBox->SetSelection(0);
|
||||
vSizer->Add(mRadioBox, 1, wxEXPAND | wxALIGN_CENTER | wxALL, 5);
|
||||
|
||||
|
||||
{
|
||||
auto buttonSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
|
||||
|
||||
wxButton* pButton;
|
||||
if (log)
|
||||
{
|
||||
pButton = safenew wxButton(this, ID_SHOW_LOG_BUTTON, _("Show Log for Details"));
|
||||
buttonSizer->Add(pButton, 0, wxALIGN_LEFT | wxALL, 5);
|
||||
pButton->SetDefault(); // Encourage user to look at files.
|
||||
|
||||
buttonSizer->AddSpacer(40);
|
||||
}
|
||||
|
||||
pButton = safenew wxButton(this, wxID_OK, _("OK"));
|
||||
if (!log)
|
||||
pButton->SetDefault();
|
||||
buttonSizer->Add(pButton, 0, wxALIGN_RIGHT | wxALL, 5);
|
||||
|
||||
vSizer->Add(buttonSizer.release(), 0, wxALIGN_CENTER | wxALL, 5);
|
||||
}
|
||||
|
||||
mainSizer->Add(vSizer.release(), 0, wxALL, 5);
|
||||
}
|
||||
|
||||
SetAutoLayout(true);
|
||||
SetSizer(uMainSizer.release());
|
||||
}
|
||||
|
||||
pButton = safenew wxButton(this, wxID_OK, _("OK"));
|
||||
if(!log)
|
||||
pButton->SetDefault();
|
||||
buttonSizer->Add(pButton, 0, wxALIGN_RIGHT | wxALL, 5);
|
||||
|
||||
vSizer->Add(buttonSizer, 0, wxALIGN_CENTER | wxALL, 5);
|
||||
|
||||
|
||||
mainSizer->Add(vSizer, 0, wxALL, 5);
|
||||
SetAutoLayout(true);
|
||||
SetSizer(mainSizer);
|
||||
mainSizer->Fit(this);
|
||||
mainSizer->SetSizeHints(this);
|
||||
delete[] buttonLabels;
|
||||
|
||||
Reference in New Issue
Block a user