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