mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-19 06:07:42 +02:00
Use TrackFactory in more places...
... There should now be no direct allocation of Track subclasses with new, except in those classes' own methods
This commit is contained in:
parent
1e641957ca
commit
5162ab5c5b
@ -86,7 +86,7 @@ BEGIN_EVENT_TABLE(LabelDialog, wxDialog)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
LabelDialog::LabelDialog(wxWindow *parent,
|
||||
DirManager *dirmanager,
|
||||
TrackFactory &factory,
|
||||
TrackList *tracks,
|
||||
ViewInfo &viewinfo,
|
||||
double rate,
|
||||
@ -97,7 +97,7 @@ LabelDialog::LabelDialog(wxWindow *parent,
|
||||
wxDefaultPosition,
|
||||
wxSize(800, 600),
|
||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
|
||||
mDirManager(dirmanager),
|
||||
mFactory(factory),
|
||||
mTracks(tracks),
|
||||
mViewInfo(&viewinfo),
|
||||
mRate(rate),
|
||||
@ -319,7 +319,7 @@ bool LabelDialog::TransferDataFromWindow()
|
||||
wxString name = mTrackNames[tndx + 1].AfterFirst(wxT('-')).Mid(1);
|
||||
|
||||
// Create the NEW track and add to track list
|
||||
LabelTrack *newTrack = new LabelTrack(mDirManager);
|
||||
LabelTrack *newTrack = mFactory.NewLabelTrack();
|
||||
newTrack->SetName(name);
|
||||
mTracks->Add(newTrack);
|
||||
tndx++;
|
||||
@ -564,7 +564,7 @@ void LabelDialog::OnImport(wxCommandEvent & WXUNUSED(event))
|
||||
else {
|
||||
// Create a temporary label track and load the labels
|
||||
// into it
|
||||
LabelTrack *lt = new LabelTrack(mDirManager);
|
||||
LabelTrack *lt = mFactory.NewLabelTrack();
|
||||
lt->Import(f);
|
||||
|
||||
// Add the labesls to our collection
|
||||
@ -632,7 +632,7 @@ void LabelDialog::OnExport(wxCommandEvent & WXUNUSED(event))
|
||||
}
|
||||
|
||||
// Transfer our collection to a temporary label track
|
||||
LabelTrack *lt = new LabelTrack(mDirManager);
|
||||
LabelTrack *lt = mFactory.NewLabelTrack();
|
||||
int i;
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "Internat.h"
|
||||
#include "widgets/Grid.h"
|
||||
|
||||
class DirManager;
|
||||
class TrackFactory;
|
||||
class TrackList;
|
||||
class RowData;
|
||||
class EmptyLabelRenderer;
|
||||
@ -35,7 +35,7 @@ class LabelDialog final : public wxDialog
|
||||
public:
|
||||
|
||||
LabelDialog(wxWindow *parent,
|
||||
DirManager *dirmanager,
|
||||
TrackFactory &factory,
|
||||
TrackList *tracks,
|
||||
ViewInfo &viewinfo,
|
||||
double rate,
|
||||
@ -76,7 +76,7 @@ class LabelDialog final : public wxDialog
|
||||
|
||||
RowDataArray mData;
|
||||
|
||||
DirManager *mDirManager;
|
||||
TrackFactory &mFactory;
|
||||
TrackList *mTracks;
|
||||
ViewInfo *mViewInfo;
|
||||
wxArrayString mTrackNames;
|
||||
|
@ -4358,7 +4358,7 @@ void AudacityProject::OnPasteNewLabel()
|
||||
|
||||
// If no match found, add one
|
||||
if (!t) {
|
||||
t = new LabelTrack(mDirManager);
|
||||
t = GetTrackFactory()->NewLabelTrack();
|
||||
mTracks->Add(t);
|
||||
}
|
||||
|
||||
@ -5495,7 +5495,7 @@ void AudacityProject::OnImportLabels()
|
||||
return;
|
||||
}
|
||||
|
||||
LabelTrack *newTrack = new LabelTrack(mDirManager);
|
||||
LabelTrack *newTrack = GetTrackFactory()->NewLabelTrack();
|
||||
wxString sTrackName;
|
||||
wxFileName::SplitPath(fileName, NULL, NULL, &sTrackName, NULL);
|
||||
newTrack->SetName(sTrackName);
|
||||
@ -5538,7 +5538,7 @@ void AudacityProject::OnImportMIDI()
|
||||
|
||||
void AudacityProject::DoImportMIDI(const wxString &fileName)
|
||||
{
|
||||
NoteTrack *newTrack = new NoteTrack(mDirManager);
|
||||
NoteTrack *newTrack = GetTrackFactory()->NewNoteTrack();
|
||||
|
||||
if (::ImportMIDI(fileName, newTrack)) {
|
||||
|
||||
@ -6289,7 +6289,7 @@ void AudacityProject::OnNewStereoTrack()
|
||||
|
||||
void AudacityProject::OnNewLabelTrack()
|
||||
{
|
||||
LabelTrack *t = new LabelTrack(mDirManager);
|
||||
LabelTrack *t = GetTrackFactory()->NewLabelTrack();
|
||||
|
||||
SelectNone();
|
||||
|
||||
@ -6385,7 +6385,7 @@ int AudacityProject::DoAddLabel(const SelectedRegion ®ion, bool preserveFocus
|
||||
|
||||
// If none found, start a NEW label track and use it
|
||||
if (!lt) {
|
||||
lt = new LabelTrack(mDirManager);
|
||||
lt = GetTrackFactory()->NewLabelTrack();
|
||||
mTracks->Add(lt);
|
||||
}
|
||||
|
||||
@ -6455,7 +6455,7 @@ void AudacityProject::OnEditLabels()
|
||||
{
|
||||
wxString format = GetSelectionFormat();
|
||||
|
||||
LabelDialog dlg(this, mDirManager, mTracks, mViewInfo, mRate, format);
|
||||
LabelDialog dlg(this, *GetTrackFactory(), mTracks, mViewInfo, mRate, format);
|
||||
|
||||
if (dlg.ShowModal() == wxID_OK) {
|
||||
PushState(_("Edited labels"), _("Label"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user