1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-13 22:21:11 +02: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:
Paul Licameli
2016-02-18 14:53:43 -05:00
parent c7d3ff7299
commit 1c07741d57
26 changed files with 1338 additions and 1233 deletions

View File

@@ -751,19 +751,24 @@ wxDialog( parent, id, title, position, size, style | wxRESIZE_BORDER )
mFile = _mFile;
scount = mFile->GetStreamCount();
for (wxInt32 i = 0; i < scount; i++)
mFile->SetStreamUsage(i,FALSE);
mFile->SetStreamUsage(i, FALSE);
wxBoxSizer *vertSizer = new wxBoxSizer( wxVERTICAL );
wxArrayString *choices = mFile->GetStreamInfo();
StreamList = safenew wxListBox(this, -1, wxDefaultPosition, wxDefaultSize, *choices , wxLB_EXTENDED | wxLB_ALWAYS_SB);
wxBoxSizer *vertSizer;
{
auto uVertSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
vertSizer = uVertSizer.get();
vertSizer->Add( StreamList, 1, wxEXPAND | wxALIGN_LEFT | wxALL, 5 );
wxArrayString *choices = mFile->GetStreamInfo();
StreamList = safenew wxListBox(this, -1, wxDefaultPosition, wxDefaultSize, *choices, wxLB_EXTENDED | wxLB_ALWAYS_SB);
vertSizer->Add( CreateStdButtonSizer(this, eCancelButton|eOkButton), 0, wxEXPAND );
vertSizer->Add(StreamList, 1, wxEXPAND | wxALIGN_LEFT | wxALL, 5);
SetAutoLayout( true );
vertSizer->Add(CreateStdButtonSizer(this, eCancelButton | eOkButton).release(), 0, wxEXPAND);
SetSizer( vertSizer );
SetAutoLayout(true);
SetSizer(uVertSizer.release());
}
vertSizer->Fit( this );

View File

@@ -240,8 +240,8 @@ static wxString AskCopyOrEdit()
wxDialog dialog(NULL, -1, wxString(_("Warning")));
dialog.SetName(dialog.GetTitle());
wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
dialog.SetSizer(vbox);
wxBoxSizer *vbox;
dialog.SetSizer(vbox = safenew wxBoxSizer(wxVERTICAL));
wxStaticText *message = safenew wxStaticText(&dialog, -1, wxString::Format(_("\
When importing uncompressed audio files you can either copy them \
@@ -261,19 +261,27 @@ How do you want to import the current file(s)?"), oldCopyPref == wxT("copy") ? _
wxStaticBox *box = safenew wxStaticBox(&dialog, -1, _("Choose an import method"));
box->SetName(box->GetLabel());
wxStaticBoxSizer *boxsizer = new wxStaticBoxSizer(box, wxVERTICAL);
wxRadioButton *copyRadio = safenew wxRadioButton(&dialog, -1, _("Make a &copy of the files before editing (safer)"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
boxsizer->Add(copyRadio, 0, wxALL);
copyRadio->SetName(wxStripMenuCodes(copyRadio->GetLabel()));
wxRadioButton *aliasRadio;
wxRadioButton *copyRadio;
wxCheckBox *dontAskNextTimeBox;
wxRadioButton *aliasRadio = safenew wxRadioButton(&dialog, -1, _("Read the files &directly from the original (faster)"));
boxsizer->Add(aliasRadio, 0, wxALL);
aliasRadio->SetName(wxStripMenuCodes(aliasRadio->GetLabel()));
{
auto boxsizer = std::make_unique<wxStaticBoxSizer>(box, wxVERTICAL);
copyRadio = safenew wxRadioButton(&dialog, -1, _("Make a &copy of the files before editing (safer)"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
boxsizer->Add(copyRadio, 0, wxALL);
copyRadio->SetName(wxStripMenuCodes(copyRadio->GetLabel()));
aliasRadio = safenew wxRadioButton(&dialog, -1, _("Read the files &directly from the original (faster)"));
boxsizer->Add(aliasRadio, 0, wxALL);
aliasRadio->SetName(wxStripMenuCodes(aliasRadio->GetLabel()));
dontAskNextTimeBox = safenew wxCheckBox(&dialog, -1, _("Don't &warn again and always use my choice above"));
boxsizer->Add(dontAskNextTimeBox, 0, wxALL);
vbox->Add(boxsizer.release(), 0, wxALL, 10);
}
wxCheckBox *dontAskNextTimeBox = safenew wxCheckBox(&dialog, -1, _("Don't &warn again and always use my choice above"));
boxsizer->Add(dontAskNextTimeBox, 0, wxALL);
vbox->Add(boxsizer, 0, wxALL, 10);
dontAskNextTimeBox->SetName(wxStripMenuCodes(dontAskNextTimeBox->GetLabel()));