static TrackList::Get()...
... not member function of AudacityProject
This commit is contained in:
parent
1ed9338e6f
commit
14ab93a01f
|
@ -876,7 +876,7 @@ AdornedRulerPanel::AdornedRulerPanel(AudacityProject* project,
|
|||
mRuler.SetLabelEdges( false );
|
||||
mRuler.SetFormat( Ruler::TimeFormat );
|
||||
|
||||
mTracks = project->GetTracks();
|
||||
mTracks = &TrackList::Get( *project );
|
||||
|
||||
mIsSnapped = false;
|
||||
|
||||
|
|
|
@ -892,7 +892,7 @@ bool AudacityApp::MRUOpen(const FilePath &fullPathStr) {
|
|||
// there are no tracks, but there's an Undo history, etc, then
|
||||
// bad things can happen, including data files moving to the NEW
|
||||
// project directory, etc.
|
||||
if (proj && (proj->GetDirty() || !proj->GetTracks()->empty()))
|
||||
if (proj && (proj->GetDirty() || !TrackList::Get( *proj ).empty()))
|
||||
proj = nullptr;
|
||||
// This project is clean; it's never been touched. Therefore
|
||||
// all relevant member variables are in their initial state,
|
||||
|
@ -1073,7 +1073,7 @@ bool AudacityApp::OnExceptionInMainLoop()
|
|||
pProject->RollbackState();
|
||||
|
||||
// Forget pending changes in the TrackList
|
||||
pProject->GetTracks()->ClearPendingTracks();
|
||||
TrackList::Get( *pProject ).ClearPendingTracks();
|
||||
|
||||
pProject->RedrawProject();
|
||||
}
|
||||
|
|
|
@ -289,7 +289,7 @@ RecordingRecoveryHandler::RecordingRecoveryHandler(AudacityProject* proj)
|
|||
|
||||
int RecordingRecoveryHandler::FindTrack() const
|
||||
{
|
||||
WaveTrackArray tracks = mProject->GetTracks()->GetWaveTrackArray(false);
|
||||
WaveTrackArray tracks = TrackList::Get( *mProject ).GetWaveTrackArray(false);
|
||||
int index;
|
||||
if (mAutoSaveIdent)
|
||||
{
|
||||
|
@ -322,7 +322,7 @@ bool RecordingRecoveryHandler::HandleXMLTag(const wxChar *tag,
|
|||
return false;
|
||||
}
|
||||
|
||||
WaveTrackArray tracks = mProject->GetTracks()->GetWaveTrackArray(false);
|
||||
WaveTrackArray tracks = TrackList::Get( *mProject ).GetWaveTrackArray(false);
|
||||
int index = FindTrack();
|
||||
// We need to find the track and sequence where the blockfile belongs
|
||||
|
||||
|
@ -408,7 +408,7 @@ void RecordingRecoveryHandler::HandleXMLEndTag(const wxChar *tag)
|
|||
// Still in inner loop
|
||||
return;
|
||||
|
||||
WaveTrackArray tracks = mProject->GetTracks()->GetWaveTrackArray(false);
|
||||
WaveTrackArray tracks = TrackList::Get( *mProject ).GetWaveTrackArray(false);
|
||||
int index = FindTrack();
|
||||
// We need to find the track and sequence where the blockfile belongs
|
||||
|
||||
|
|
|
@ -479,14 +479,9 @@ double MacroCommands::GetEndTime()
|
|||
//AudacityMessageBox( _("No project to process!") );
|
||||
return -1.0;
|
||||
}
|
||||
TrackList * tracks = project->GetTracks();
|
||||
if( tracks == NULL )
|
||||
{
|
||||
//AudacityMessageBox( _("No tracks to process!") );
|
||||
return -1.0;
|
||||
}
|
||||
auto &tracks = TrackList::Get( *project );
|
||||
|
||||
double endTime = tracks->GetEndTime();
|
||||
double endTime = tracks.GetEndTime();
|
||||
return endTime;
|
||||
}
|
||||
|
||||
|
@ -499,14 +494,9 @@ bool MacroCommands::IsMono()
|
|||
return false;
|
||||
}
|
||||
|
||||
TrackList * tracks = project->GetTracks();
|
||||
if( tracks == NULL )
|
||||
{
|
||||
//AudacityMessageBox( _("No tracks to process!") );
|
||||
return false;
|
||||
}
|
||||
auto &tracks = TrackList::Get( *project );
|
||||
|
||||
return ( tracks->Any() - &Track::IsLeader ).empty();
|
||||
return ( tracks.Any() - &Track::IsLeader ).empty();
|
||||
}
|
||||
|
||||
wxString MacroCommands::BuildCleanFileName(const FilePath &fileName,
|
||||
|
|
|
@ -323,7 +323,7 @@ void ApplyMacroDialog::OnApplyToFiles(wxCommandEvent & WXUNUSED(event))
|
|||
gPrefs->Flush();
|
||||
|
||||
AudacityProject *project = GetActiveProject();
|
||||
if (!project->GetTracks()->empty()) {
|
||||
if (!TrackList::Get( *project ).empty()) {
|
||||
AudacityMessageBox(_("Please save and close the current project first."));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ using BoolBlockFileHash = std::unordered_map<BlockFile *, bool>;
|
|||
static void GetAllSeqBlocks(AudacityProject *project,
|
||||
BlockPtrArray *outBlocks)
|
||||
{
|
||||
for (auto waveTrack : project->GetTracks()->Any< WaveTrack >()) {
|
||||
for (auto waveTrack : TrackList::Get( *project ).Any< WaveTrack >()) {
|
||||
for(const auto &clip : waveTrack->GetAllClips()) {
|
||||
Sequence *sequence = clip->GetSequence();
|
||||
BlockArray &blocks = sequence->GetBlockArray();
|
||||
|
|
|
@ -583,7 +583,7 @@ void FreqWindow::GetAudio()
|
|||
|
||||
int selcount = 0;
|
||||
bool warning = false;
|
||||
for (auto track : p->GetTracks()->Selected< const WaveTrack >()) {
|
||||
for (auto track : TrackList::Get( *p ).Selected< const WaveTrack >()) {
|
||||
if (selcount==0) {
|
||||
mRate = track->GetRate();
|
||||
auto start = track->TimeToLongSamples(p->mViewInfo.selectedRegion.t0());
|
||||
|
|
|
@ -103,7 +103,7 @@ static ProjectFileIORegistry::Entry registerFactory{
|
|||
wxT( "labeltrack" ),
|
||||
[]( AudacityProject &project ){
|
||||
auto &trackFactory = *project.GetTrackFactory();
|
||||
auto &tracks = *project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
return tracks.Add(trackFactory.NewLabelTrack());
|
||||
}
|
||||
};
|
||||
|
@ -1988,7 +1988,7 @@ bool LabelTrack::OnKeyDown(SelectedRegion &newSel, wxKeyEvent & event)
|
|||
|
||||
case WXK_ESCAPE:
|
||||
if (mRestoreFocus >= 0) {
|
||||
auto track = *GetActiveProject()->GetTracks()->Any()
|
||||
auto track = *TrackList::Get( *GetActiveProject() ).Any()
|
||||
.begin().advance(mRestoreFocus);
|
||||
if (track)
|
||||
GetActiveProject()->GetTrackPanel()->SetFocusedTrack(track);
|
||||
|
@ -3084,12 +3084,12 @@ void LabelTrack::DoEditLabels
|
|||
{
|
||||
auto format = project.GetSelectionFormat(),
|
||||
freqFormat = project.GetFrequencySelectionFormatName();
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackFactory = project.GetTrackFactory();
|
||||
auto rate = project.GetRate();
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
|
||||
LabelDialog dlg(&project, *trackFactory, tracks,
|
||||
LabelDialog dlg(&project, *trackFactory, &tracks,
|
||||
lt, index,
|
||||
viewInfo, rate,
|
||||
format, freqFormat);
|
||||
|
|
|
@ -489,7 +489,8 @@ void LyricsPanel::UpdateLyrics(wxEvent &e)
|
|||
return;
|
||||
|
||||
// Lyrics come from only the first label track.
|
||||
auto pLabelTrack = *mProject->GetTracks()->Any< const LabelTrack >().begin();
|
||||
auto pLabelTrack =
|
||||
*TrackList::Get( *mProject ).Any< const LabelTrack >().begin();
|
||||
if (!pLabelTrack)
|
||||
return;
|
||||
|
||||
|
|
|
@ -433,8 +433,8 @@ CommandFlag MenuManager::GetUpdateFlags
|
|||
if (!selectedRegion.isPoint())
|
||||
flags |= TimeSelectedFlag;
|
||||
|
||||
auto tracks = project.GetTracks();
|
||||
auto trackRange = tracks->Any();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackRange = tracks.Any();
|
||||
if ( trackRange )
|
||||
flags |= TracksExistFlag;
|
||||
trackRange.Visit(
|
||||
|
|
|
@ -904,30 +904,30 @@ MixerBoard::MixerBoard(AudacityProject* pProject,
|
|||
*/
|
||||
|
||||
mPrevT1 = 0.0;
|
||||
mTracks = mProject->GetTracks();
|
||||
mTracks = &TrackList::Get( *mProject );
|
||||
|
||||
// Events from the project don't propagate directly to this other frame, so...
|
||||
mProject->Bind(EVT_TRACK_PANEL_TIMER,
|
||||
&MixerBoard::OnTimer,
|
||||
this);
|
||||
|
||||
mProject->GetTracks()->Bind(EVT_TRACKLIST_SELECTION_CHANGE,
|
||||
mTracks->Bind(EVT_TRACKLIST_SELECTION_CHANGE,
|
||||
&MixerBoard::OnTrackChanged,
|
||||
this);
|
||||
|
||||
mProject->GetTracks()->Bind(EVT_TRACKLIST_PERMUTED,
|
||||
mTracks->Bind(EVT_TRACKLIST_PERMUTED,
|
||||
&MixerBoard::OnTrackSetChanged,
|
||||
this);
|
||||
|
||||
mProject->GetTracks()->Bind(EVT_TRACKLIST_ADDITION,
|
||||
mTracks->Bind(EVT_TRACKLIST_ADDITION,
|
||||
&MixerBoard::OnTrackSetChanged,
|
||||
this);
|
||||
|
||||
mProject->GetTracks()->Bind(EVT_TRACKLIST_DELETION,
|
||||
mTracks->Bind(EVT_TRACKLIST_DELETION,
|
||||
&MixerBoard::OnTrackSetChanged,
|
||||
this);
|
||||
|
||||
mProject->GetTracks()->Bind(EVT_TRACKLIST_TRACK_DATA_CHANGE,
|
||||
mTracks->Bind(EVT_TRACKLIST_TRACK_DATA_CHANGE,
|
||||
&MixerBoard::OnTrackChanged,
|
||||
this);
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ static ProjectFileIORegistry::Entry registerFactory{
|
|||
wxT( "notetrack" ),
|
||||
[]( AudacityProject &project ){
|
||||
auto &trackFactory = *project.GetTrackFactory();
|
||||
auto &tracks = *project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
return tracks.Add(trackFactory.NewNoteTrack());
|
||||
}
|
||||
};
|
||||
|
|
142
src/Project.cpp
142
src/Project.cpp
|
@ -1062,7 +1062,8 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
|
|||
mUndoManager(std::make_unique<UndoManager>())
|
||||
, mCommandManager( std::make_unique<CommandManager>() )
|
||||
{
|
||||
auto &window = *this;
|
||||
auto &project = *this;
|
||||
auto &window = project;
|
||||
|
||||
mNextWindowID = NextID;
|
||||
|
||||
|
@ -1074,8 +1075,6 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
|
|||
gPrefs->Flush();
|
||||
}
|
||||
|
||||
mTracks = TrackList::Create();
|
||||
|
||||
#ifdef EXPERIMENTAL_DA2
|
||||
SetBackgroundColour(theTheme.Colour( clrMedium ));
|
||||
#endif
|
||||
|
@ -1225,11 +1224,15 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
|
|||
{
|
||||
auto mainPage = window.GetMainPage();
|
||||
wxASSERT( mainPage ); // to justify safenew
|
||||
|
||||
// The right hand side translates to NEW TrackPanel(...) in normal
|
||||
// Audacity without additional DLLs.
|
||||
auto &tracks = TrackList::Get( project );
|
||||
mTrackPanel = safenew TrackPanel(mainPage,
|
||||
window.NextWindowID(),
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
mTracks,
|
||||
tracks.shared_from_this(),
|
||||
&mViewInfo,
|
||||
this,
|
||||
mRuler);
|
||||
|
@ -1408,21 +1411,23 @@ void AudacityProject::ApplyUpdatedTheme()
|
|||
|
||||
AudioIOStartStreamOptions AudacityProject::GetDefaultPlayOptions()
|
||||
{
|
||||
auto &project = *this;
|
||||
AudioIOStartStreamOptions options { GetRate() };
|
||||
options.timeTrack = GetTracks()->GetTimeTrack();
|
||||
options.timeTrack = TrackList::Get( project ).GetTimeTrack();
|
||||
options.listener = this;
|
||||
return options;
|
||||
}
|
||||
|
||||
AudioIOStartStreamOptions AudacityProject::GetSpeedPlayOptions()
|
||||
{
|
||||
auto &project = *this;
|
||||
auto PlayAtSpeedRate = gAudioIO->GetBestRate(
|
||||
false, //not capturing
|
||||
true, //is playing
|
||||
GetRate() //suggested rate
|
||||
);
|
||||
AudioIOStartStreamOptions options{ PlayAtSpeedRate };
|
||||
options.timeTrack = GetTracks()->GetTimeTrack();
|
||||
options.timeTrack = TrackList::Get( project ).GetTimeTrack();
|
||||
options.listener = this;
|
||||
return options;
|
||||
}
|
||||
|
@ -1447,7 +1452,7 @@ void AudacityProject::UpdatePrefsVariables()
|
|||
#if 0
|
||||
// The DefaultProjectSample rate is the rate for new projects.
|
||||
// Do not change this project's rate, unless there are no tracks.
|
||||
if( GetTrackCount() == 0){
|
||||
if( TrackList::Get( *this ).size() == 0){
|
||||
gPrefs->Read(wxT("/SamplingRate/DefaultProjectSampleRate"), &mRate, AudioIO::GetOptimalSupportedSampleRate());
|
||||
// If necessary, we change this rate in the selection toolbar too.
|
||||
auto bar = GetSelectionBar();
|
||||
|
@ -1469,10 +1474,12 @@ void AudacityProject::UpdatePrefs()
|
|||
|
||||
void AudacityProject::RedrawProject(const bool bForceWaveTracks /*= false*/)
|
||||
{
|
||||
auto &project = *this;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
FixScrollbars();
|
||||
if (bForceWaveTracks && GetTracks())
|
||||
if (bForceWaveTracks)
|
||||
{
|
||||
for (auto pWaveTrack : GetTracks()->Any<WaveTrack>())
|
||||
for ( auto pWaveTrack : tracks.Any< WaveTrack >() )
|
||||
for (const auto &clip: pWaveTrack->GetClips())
|
||||
clip->MarkChanged();
|
||||
}
|
||||
|
@ -1662,9 +1669,11 @@ void AudacityProject::AS_SetSelectionFormat(const NumericFormatSymbol & format)
|
|||
|
||||
double AudacityProject::SSBL_GetRate() const
|
||||
{
|
||||
auto &project = *this;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
// Return maximum of project rate and all track rates.
|
||||
return std::max( mRate,
|
||||
mTracks->Any<const WaveTrack>().max( &WaveTrack::GetRate ) );
|
||||
tracks.Any<const WaveTrack>().max( &WaveTrack::GetRate ) );
|
||||
}
|
||||
|
||||
const NumericFormatSymbol & AudacityProject::SSBL_GetFrequencySelectionFormatName()
|
||||
|
@ -1885,10 +1894,12 @@ bool AudacityProject::MayScrollBeyondZero() const
|
|||
|
||||
double AudacityProject::ScrollingLowerBoundTime() const
|
||||
{
|
||||
auto &project = *this;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
if (!MayScrollBeyondZero())
|
||||
return 0;
|
||||
const double screen = mTrackPanel->GetScreenEndTime() - mViewInfo.h;
|
||||
return std::min(mTracks->GetStartTime(), -screen);
|
||||
return std::min(tracks.GetStartTime(), -screen);
|
||||
}
|
||||
|
||||
// PRL: Bug1197: we seem to need to compute all in double, to avoid differing results on Mac
|
||||
|
@ -1964,13 +1975,13 @@ bool AudacityProject::TP_ScrollUpDown(int delta)
|
|||
|
||||
void AudacityProject::FixScrollbars()
|
||||
{
|
||||
if (!GetTracks())
|
||||
return;
|
||||
auto &project = *this;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
bool refresh = false;
|
||||
bool rescroll = false;
|
||||
|
||||
int totalHeight = (mTracks->GetHeight() + 32);
|
||||
int totalHeight = (tracks.GetHeight() + 32);
|
||||
|
||||
int panelWidth, panelHeight;
|
||||
mTrackPanel->GetTracksUsableArea(&panelWidth, &panelHeight);
|
||||
|
@ -1990,7 +2001,6 @@ void AudacityProject::FixScrollbars()
|
|||
}
|
||||
|
||||
auto LastTime = std::numeric_limits<double>::lowest();
|
||||
auto &tracks = *GetTracks();
|
||||
for (const Track *track : tracks) {
|
||||
// Iterate over pending changed tracks if present.
|
||||
track = track->SubstitutePendingChangedTrack().get();
|
||||
|
@ -2475,6 +2485,7 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event)
|
|||
{
|
||||
auto &project = *this;
|
||||
auto &projectFileIO = project;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &window = project;
|
||||
|
||||
// We are called for the wxEVT_CLOSE_WINDOW, wxEVT_END_SESSION, and
|
||||
|
@ -2525,7 +2536,7 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event)
|
|||
}
|
||||
|
||||
// MY: Use routine here so other processes can make same check
|
||||
bool bHasTracks = !GetTracks()->empty();
|
||||
bool bHasTracks = !tracks.empty();
|
||||
|
||||
// We may not bother to prompt the user to save, if the
|
||||
// project is now empty.
|
||||
|
@ -2642,8 +2653,7 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event)
|
|||
mTags.reset();
|
||||
|
||||
// Delete all the tracks to free up memory and DirManager references.
|
||||
mTracks->Clear();
|
||||
mTracks.reset();
|
||||
tracks.Clear();
|
||||
|
||||
// This must be done before the following Deref() since it holds
|
||||
// references to the DirManager.
|
||||
|
@ -2886,7 +2896,7 @@ void AudacityProject::OpenFiles(AudacityProject *proj)
|
|||
// there are no tracks, but there's an Undo history, etc, then
|
||||
// bad things can happen, including data files moving to the NEW
|
||||
// project directory, etc.
|
||||
if ( proj && ( proj->mDirty || !proj->mTracks->empty() ) )
|
||||
if ( proj && ( proj->mDirty || !TrackList::Get( *proj ).empty() ) )
|
||||
proj = nullptr;
|
||||
|
||||
// This project is clean; it's never been touched. Therefore
|
||||
|
@ -2941,6 +2951,8 @@ AudacityProject *AudacityProject::OpenProject(
|
|||
auto AudacityProject::ReadProjectFile( const FilePath &fileName )
|
||||
-> ReadProjectResults
|
||||
{
|
||||
auto &project = *this;
|
||||
|
||||
mFileName = fileName;
|
||||
mbLoadedFromAup = true;
|
||||
|
||||
|
@ -3006,7 +3018,8 @@ auto AudacityProject::ReadProjectFile( const FilePath &fileName )
|
|||
|
||||
mLastSavedTracks = TrackList::Create();
|
||||
|
||||
for (auto t : GetTracks()->Any()) {
|
||||
auto &tracks = TrackList::Get( project );
|
||||
for (auto t : tracks.Any()) {
|
||||
if (t->GetErrorOpening())
|
||||
{
|
||||
wxLogWarning(
|
||||
|
@ -3042,6 +3055,9 @@ AudacityProject::sRecoveryFactory{
|
|||
// See comment in AudacityApp::MRUOpen().
|
||||
void AudacityProject::OpenFile(const FilePath &fileNameArg, bool addtohistory)
|
||||
{
|
||||
auto &project = *this;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
// On Win32, we may be given a short (DOS-compatible) file name on rare
|
||||
// occassions (e.g. stuff like "C:\PROGRA~1\AUDACI~1\PROJEC~1.AUP"). We
|
||||
// convert these to long file name first.
|
||||
|
@ -3170,7 +3186,7 @@ void AudacityProject::OpenFile(const FilePath &fileNameArg, bool addtohistory)
|
|||
|
||||
if (bParseSuccess) {
|
||||
InitialState();
|
||||
mTrackPanel->SetFocusedTrack(*GetTracks()->Any().begin());
|
||||
mTrackPanel->SetFocusedTrack( *tracks.Any().begin() );
|
||||
HandleResize();
|
||||
mTrackPanel->Refresh(false);
|
||||
mTrackPanel->Update(); // force any repaint to happen now,
|
||||
|
@ -3248,7 +3264,7 @@ void AudacityProject::OpenFile(const FilePath &fileNameArg, bool addtohistory)
|
|||
else if (status & FSCKstatus_CHANGED)
|
||||
{
|
||||
// Mark the wave tracks as changed and redraw.
|
||||
for (auto wt : GetTracks()->Any<WaveTrack>())
|
||||
for ( auto wt : tracks.Any<WaveTrack>() )
|
||||
// Only wave tracks have a notion of "changed".
|
||||
for (const auto &clip: wt->GetClips())
|
||||
clip->MarkChanged();
|
||||
|
@ -3282,10 +3298,10 @@ void AudacityProject::OpenFile(const FilePath &fileNameArg, bool addtohistory)
|
|||
// may have spared the files at the expense of leaked memory). But
|
||||
// here is a better way to accomplish the intent, doing like what happens
|
||||
// when the project closes:
|
||||
for ( auto pTrack : mTracks->Any< WaveTrack >() )
|
||||
for ( auto pTrack : tracks.Any< WaveTrack >() )
|
||||
pTrack->CloseLock();
|
||||
|
||||
mTracks->Clear(); //mTracks->Clear(true);
|
||||
tracks.Clear(); //tracks.Clear(true);
|
||||
|
||||
mFileName = wxT("");
|
||||
SetProjectTitle();
|
||||
|
@ -3367,10 +3383,13 @@ void AudacityProject::EnqueueODTasks()
|
|||
//OD***Blocks.
|
||||
if(ODManager::HasLoadedODFlag())
|
||||
{
|
||||
auto &project = *this;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
std::vector<std::unique_ptr<ODTask>> newTasks;
|
||||
//std::vector<ODDecodeTask*> decodeTasks;
|
||||
unsigned int createdODTasks=0;
|
||||
for (auto wt : GetTracks()->Any<WaveTrack>()) {
|
||||
for (auto wt : tracks.Any<WaveTrack>()) {
|
||||
//check the track for blocks that need decoding.
|
||||
//There may be more than one type e.g. FLAC/FFMPEG/lame
|
||||
unsigned int odFlags = wt->GetODFlags();
|
||||
|
@ -3661,6 +3680,9 @@ void AudacityProject::WriteXMLHeader(XMLWriter &xmlFile) const
|
|||
void AudacityProject::WriteXML(XMLWriter &xmlFile, bool bWantSaveCopy)
|
||||
// may throw
|
||||
{
|
||||
auto &proj = *this;
|
||||
auto &tracks = TrackList::Get( proj );
|
||||
|
||||
//TIMER_START( "AudacityProject::WriteXML", xml_writer_timer );
|
||||
// Warning: This block of code is duplicated in Save, for now...
|
||||
wxString project = mFileName;
|
||||
|
@ -3707,7 +3729,7 @@ void AudacityProject::WriteXML(XMLWriter &xmlFile, bool bWantSaveCopy)
|
|||
mTags->WriteXML(xmlFile);
|
||||
|
||||
unsigned int ndx = 0;
|
||||
GetTracks()->Any().Visit(
|
||||
tracks.Any().Visit(
|
||||
[&](WaveTrack *pWaveTrack) {
|
||||
if (bWantSaveCopy) {
|
||||
if (!pWaveTrack->IsLeader())
|
||||
|
@ -3814,7 +3836,9 @@ bool AudacityProject::DoSave (const bool fromSaveAs,
|
|||
// Some confirmation dialogs
|
||||
if (!bWantSaveCopy)
|
||||
{
|
||||
if ( ! GetTracks()->Any() )
|
||||
auto &project = *this;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
if ( ! tracks.Any() )
|
||||
{
|
||||
if (GetUndoManager()->UnsavedChanges() && mEmptyCanBeDirty) {
|
||||
int result = AudacityMessageBox(_("Your project is now empty.\nIf saved, the project will have no tracks.\n\nTo save any previously open tracks:\nClick 'No', Edit > Undo until all tracks\nare open, then File > Save Project.\n\nSave anyway?"),
|
||||
|
@ -4026,7 +4050,9 @@ bool AudacityProject::DoSave (const bool fromSaveAs,
|
|||
mLastSavedTracks->Clear();
|
||||
mLastSavedTracks = TrackList::Create();
|
||||
|
||||
for (auto t : GetTracks()->Any()) {
|
||||
auto &project = *this;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
for ( auto t : tracks.Any() ) {
|
||||
mLastSavedTracks->Add(t->Duplicate());
|
||||
|
||||
//only after the xml has been saved we can mark it saved.
|
||||
|
@ -4056,6 +4082,9 @@ bool AudacityProject::DoSave (const bool fromSaveAs,
|
|||
bool AudacityProject::SaveCopyWaveTracks(const FilePath & strProjectPathName,
|
||||
const bool bLossless /*= false*/)
|
||||
{
|
||||
auto &project = *this;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
wxString extension, fileFormat;
|
||||
#ifdef USE_LIBVORBIS
|
||||
if (bLossless) {
|
||||
|
@ -4078,7 +4107,7 @@ bool AudacityProject::SaveCopyWaveTracks(const FilePath & strProjectPathName,
|
|||
auto ppSavedTrackList = TrackList::Create();
|
||||
auto &pSavedTrackList = *ppSavedTrackList;
|
||||
|
||||
auto trackRange = GetTracks()->Any<WaveTrack>();
|
||||
auto trackRange = tracks.Any< WaveTrack >();
|
||||
for (auto pWaveTrack : trackRange)
|
||||
{
|
||||
numWaveTracks++;
|
||||
|
@ -4137,7 +4166,7 @@ bool AudacityProject::SaveCopyWaveTracks(const FilePath & strProjectPathName,
|
|||
wxFileName uniqueTrackFileName;
|
||||
for (auto pTrack : (trackRange + &Track::IsLeader))
|
||||
{
|
||||
SelectionStateChanger changer{ GetSelectionState(), *GetTracks() };
|
||||
SelectionStateChanger changer{ GetSelectionState(), tracks };
|
||||
auto channels = TrackList::Channels(pTrack);
|
||||
|
||||
for (auto channel : channels)
|
||||
|
@ -4166,11 +4195,13 @@ AudacityProject::AddImportedTracks(const FilePath &fileName,
|
|||
TrackHolders &&newTracks)
|
||||
{
|
||||
auto &project = *this;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
std::vector< std::shared_ptr< Track > > results;
|
||||
|
||||
SelectActions::SelectNone( project );
|
||||
|
||||
bool initiallyEmpty = mTracks->empty();
|
||||
bool initiallyEmpty = tracks.empty();
|
||||
double newRate = 0;
|
||||
wxString trackNameBase = fileName.AfterLast(wxFILE_SEP_PATH).BeforeLast('.');
|
||||
int i = -1;
|
||||
|
@ -4184,10 +4215,10 @@ AudacityProject::AddImportedTracks(const FilePath &fileName,
|
|||
auto first = group.begin()->get();
|
||||
auto nChannels = group.size();
|
||||
for (auto &uNewTrack : group) {
|
||||
auto newTrack = mTracks->Add( uNewTrack );
|
||||
auto newTrack = tracks.Add( uNewTrack );
|
||||
results.push_back(newTrack->SharedPointer());
|
||||
}
|
||||
mTracks->GroupChannels(*first, nChannels);
|
||||
tracks.GroupChannels(*first, nChannels);
|
||||
}
|
||||
newTracks.clear();
|
||||
|
||||
|
@ -4576,10 +4607,14 @@ will be irreversibly overwritten."), fName, fName);
|
|||
|
||||
void AudacityProject::InitialState()
|
||||
{
|
||||
auto &project = *this;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
GetUndoManager()->ClearStates();
|
||||
|
||||
GetUndoManager()->PushState(GetTracks(), mViewInfo.selectedRegion, mTags,
|
||||
_("Created new project"), wxT(""));
|
||||
GetUndoManager()->PushState(
|
||||
&tracks, mViewInfo.selectedRegion, mTags,
|
||||
_("Created new project"), wxT(""));
|
||||
|
||||
GetUndoManager()->StateSaved();
|
||||
|
||||
|
@ -4590,16 +4625,18 @@ void AudacityProject::InitialState()
|
|||
|
||||
bool AudacityProject::UndoAvailable()
|
||||
{
|
||||
TrackList* trackList = GetTracks();
|
||||
auto &project = *this;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
return GetUndoManager()->UndoAvailable() &&
|
||||
!(trackList != nullptr && trackList->HasPendingTracks());
|
||||
!tracks.HasPendingTracks();
|
||||
}
|
||||
|
||||
bool AudacityProject::RedoAvailable()
|
||||
{
|
||||
TrackList* trackList = GetTracks();
|
||||
auto &project = *this;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
return GetUndoManager()->RedoAvailable() &&
|
||||
!(trackList != nullptr && trackList->HasPendingTracks());
|
||||
!tracks.HasPendingTracks();
|
||||
}
|
||||
|
||||
void AudacityProject::PushState(const wxString &desc, const wxString &shortDesc)
|
||||
|
@ -4611,8 +4648,11 @@ void AudacityProject::PushState(const wxString &desc,
|
|||
const wxString &shortDesc,
|
||||
UndoPush flags )
|
||||
{
|
||||
GetUndoManager()->PushState(GetTracks(), mViewInfo.selectedRegion, mTags,
|
||||
desc, shortDesc, flags);
|
||||
auto &project = *this;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
GetUndoManager()->PushState(
|
||||
&tracks, mViewInfo.selectedRegion, mTags,
|
||||
desc, shortDesc, flags);
|
||||
|
||||
mDirty = true;
|
||||
|
||||
|
@ -4635,7 +4675,10 @@ void AudacityProject::RollbackState()
|
|||
|
||||
void AudacityProject::ModifyState(bool bWantsAutoSave)
|
||||
{
|
||||
GetUndoManager()->ModifyState(GetTracks(), mViewInfo.selectedRegion, mTags);
|
||||
auto &project = *this;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
GetUndoManager()->ModifyState(
|
||||
&tracks, mViewInfo.selectedRegion, mTags);
|
||||
if (bWantsAutoSave)
|
||||
AutoSave();
|
||||
GetTrackPanel()->HandleCursorForPresentMouseState();
|
||||
|
@ -4646,6 +4689,9 @@ void AudacityProject::ModifyState(bool bWantsAutoSave)
|
|||
// Need to keep it and its tracks "t" available for Undo/Redo/SetStateTo.
|
||||
void AudacityProject::PopState(const UndoState &state)
|
||||
{
|
||||
auto &project = *this;
|
||||
auto &dstTracks = TrackList::Get( project );
|
||||
|
||||
mViewInfo.selectedRegion = state.selectedRegion;
|
||||
|
||||
// Restore tags
|
||||
|
@ -4653,13 +4699,13 @@ void AudacityProject::PopState(const UndoState &state)
|
|||
|
||||
TrackList *const tracks = state.tracks.get();
|
||||
|
||||
mTracks->Clear();
|
||||
dstTracks.Clear();
|
||||
bool odUsed = false;
|
||||
std::unique_ptr<ODComputeSummaryTask> computeTask;
|
||||
|
||||
for (auto t : tracks->Any())
|
||||
{
|
||||
auto copyTrack = mTracks->Add(t->Duplicate());
|
||||
auto copyTrack = dstTracks.Add(t->Duplicate());
|
||||
|
||||
//add the track to OD if the manager exists. later we might do a more rigorous check...
|
||||
copyTrack->TypeSwitch( [&](WaveTrack *wt) {
|
||||
|
@ -4759,7 +4805,9 @@ void AudacityProject::Rewind(bool shift)
|
|||
///////////////////////////////////////////////////////////////////
|
||||
void AudacityProject::SkipEnd(bool shift)
|
||||
{
|
||||
double len = mTracks->GetEndTime();
|
||||
auto &project = *this;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
double len = tracks.GetEndTime();
|
||||
|
||||
mViewInfo.selectedRegion.setT1(len, false);
|
||||
if (!shift)
|
||||
|
@ -5142,12 +5190,14 @@ void AudacityProject::OnAudioIOStopRecording()
|
|||
// Only push state if we were capturing and not monitoring
|
||||
if (GetAudioIOToken() > 0)
|
||||
{
|
||||
auto &project = *this;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &intervals = gAudioIO->LostCaptureIntervals();
|
||||
if (intervals.size()) {
|
||||
// Make a track with labels for recording errors
|
||||
auto uTrack = GetTrackFactory()->NewLabelTrack();
|
||||
auto pTrack = uTrack.get();
|
||||
GetTracks()->Add( uTrack );
|
||||
tracks.Add( uTrack );
|
||||
/* i18n-hint: A name given to a track, appearing as its menu button.
|
||||
The translation should be short or else it will not display well.
|
||||
At most, about 11 Latin characters.
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "Experimental.h"
|
||||
|
||||
#include "ClientData.h"
|
||||
#include "Track.h"
|
||||
#include "Prefs.h"
|
||||
#include "SelectionState.h"
|
||||
#include "ViewInfo.h"
|
||||
|
@ -40,6 +39,8 @@
|
|||
|
||||
#include "import/ImportRaw.h" // defines TrackHolders
|
||||
|
||||
#include <xml/XMLTagHandler.h> // to inherit
|
||||
|
||||
const int AudacityProjectTimerID = 5200;
|
||||
|
||||
class wxMemoryDC;
|
||||
|
@ -176,7 +177,6 @@ class MenuManager;
|
|||
using AttachedObjects = ClientData::Site<
|
||||
AudacityProject, ClientData::Base, ClientData::SkipCopying, std::shared_ptr
|
||||
>;
|
||||
|
||||
class AUDACITY_DLL_API AudacityProject final : public wxFrame,
|
||||
public TrackPanelListener,
|
||||
public SelectionBarListener,
|
||||
|
@ -201,9 +201,6 @@ class AUDACITY_DLL_API AudacityProject final : public wxFrame,
|
|||
AudioIOStartStreamOptions GetDefaultPlayOptions();
|
||||
AudioIOStartStreamOptions GetSpeedPlayOptions();
|
||||
|
||||
TrackList *GetTracks() { return mTracks.get(); }
|
||||
const TrackList *GetTracks() const { return mTracks.get(); }
|
||||
size_t GetTrackCount() const { return GetTracks()->size(); }
|
||||
UndoManager *GetUndoManager() { return mUndoManager.get(); }
|
||||
|
||||
sampleFormat GetDefaultFormat() { return mDefaultFormat; }
|
||||
|
@ -561,9 +558,6 @@ public:
|
|||
// BEFORE doing any editing of it!
|
||||
std::shared_ptr<Tags> mTags;
|
||||
|
||||
// List of tracks and display info
|
||||
std::shared_ptr<TrackList> mTracks;
|
||||
|
||||
int mSnapTo;
|
||||
NumericFormatSymbol mSelectionFormat;
|
||||
NumericFormatSymbol mFrequencySelectionFormatName;
|
||||
|
@ -597,7 +591,7 @@ private:
|
|||
wxPanel *mTopPanel{};
|
||||
TrackPanel *mTrackPanel{};
|
||||
SelectionState mSelectionState{};
|
||||
std::unique_ptr<TrackFactory> mTrackFactory{};
|
||||
std::unique_ptr<TrackFactory> mTrackFactory;
|
||||
wxWindow * mMainPage;
|
||||
wxPanel * mMainPanel;
|
||||
wxScrollBar *mHsbar;
|
||||
|
|
|
@ -708,8 +708,8 @@ void ScreenFrame::SizeTracks(int h)
|
|||
// If there should be more-than-stereo tracks, this makes
|
||||
// each channel as high as for a stereo channel
|
||||
|
||||
auto tracks = mContext.project.GetTracks();
|
||||
for (auto t : tracks->Leaders<WaveTrack>()) {
|
||||
auto &tracks = TrackList::Get( mContext.project );
|
||||
for (auto t : tracks.Leaders<WaveTrack>()) {
|
||||
auto channels = TrackList::Channels(t);
|
||||
auto nChannels = channels.size();
|
||||
auto height = nChannels == 1 ? 2 * h : h;
|
||||
|
@ -721,7 +721,7 @@ void ScreenFrame::SizeTracks(int h)
|
|||
|
||||
void ScreenFrame::OnShortTracks(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
for (auto t : mContext.project.GetTracks()->Any<WaveTrack>())
|
||||
for (auto t : TrackList::Get( mContext.project ).Any<WaveTrack>())
|
||||
t->SetHeight(t->GetMinimizedHeight());
|
||||
|
||||
mContext.project.RedrawProject();
|
||||
|
|
|
@ -44,7 +44,7 @@ static ProjectFileIORegistry::Entry registerFactory{
|
|||
wxT( "timetrack" ),
|
||||
[]( AudacityProject &project ){
|
||||
auto &trackFactory = *project.GetTrackFactory();
|
||||
auto &tracks = *project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
return tracks.Add(trackFactory.NewTimeTrack());
|
||||
}
|
||||
};
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include "MissingAliasFileDialog.h"
|
||||
#include "Project.h"
|
||||
#include "Prefs.h"
|
||||
#include "Track.h"
|
||||
#include "widgets/NumericTextCtrl.h"
|
||||
#include "widgets/HelpSystem.h"
|
||||
#include "widgets/AudacityMessageBox.h"
|
||||
|
@ -631,7 +632,7 @@ int TimerRecordDialog::ExecutePostRecordActions(bool bWasStopped) {
|
|||
Exporter e;
|
||||
MissingAliasFilesDialog::SetShouldShow(true);
|
||||
bExportOK = e.ProcessFromTimerRecording(
|
||||
pProject, false, 0.0, pProject->GetTracks()->GetEndTime(),
|
||||
pProject, false, 0.0, TrackList::Get( *pProject ).GetEndTime(),
|
||||
m_fnAutoExportFile, m_iAutoExportFormat,
|
||||
m_iAutoExportSubFormat, m_iAutoExportFilterIndex);
|
||||
}
|
||||
|
|
|
@ -569,6 +569,20 @@ wxDEFINE_EVENT(EVT_TRACKLIST_DELETION, TrackListEvent);
|
|||
// same value as in the default constructed TrackId:
|
||||
long TrackList::sCounter = -1;
|
||||
|
||||
static const AudacityProject::AttachedObjects::RegisteredFactory key{
|
||||
[](AudacityProject&) { return TrackList::Create(); }
|
||||
};
|
||||
|
||||
TrackList &TrackList::Get( AudacityProject &project )
|
||||
{
|
||||
return project.AttachedObjects::Get< TrackList >( key );
|
||||
}
|
||||
|
||||
const TrackList &TrackList::Get( const AudacityProject &project )
|
||||
{
|
||||
return Get( const_cast< AudacityProject & >( project ) );
|
||||
}
|
||||
|
||||
TrackList::TrackList()
|
||||
: wxEvtHandler()
|
||||
{
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <functional>
|
||||
#include <wx/longlong.h>
|
||||
|
||||
#include "ClientData.h"
|
||||
#include "SampleFormat.h"
|
||||
#include "tracks/ui/CommonTrackPanelCell.h"
|
||||
#include "xml/XMLTagHandler.h"
|
||||
|
@ -1158,8 +1159,11 @@ wxDECLARE_EXPORTED_EVENT(AUDACITY_DLL_API,
|
|||
/** \brief TrackList is a flat linked list of tracks supporting Add, Remove,
|
||||
* Clear, and Contains, plus serialization of the list of tracks.
|
||||
*/
|
||||
class TrackList final : public wxEvtHandler, public ListOfTracks
|
||||
class TrackList final
|
||||
: public wxEvtHandler
|
||||
, public ListOfTracks
|
||||
, public std::enable_shared_from_this<TrackList>
|
||||
, public ClientData::Base
|
||||
{
|
||||
// privatize this, make you use Add instead:
|
||||
using ListOfTracks::push_back;
|
||||
|
@ -1178,6 +1182,9 @@ class TrackList final : public wxEvtHandler, public ListOfTracks
|
|||
void clear() = delete;
|
||||
|
||||
public:
|
||||
static TrackList &Get( AudacityProject &project );
|
||||
static const TrackList &Get( const AudacityProject &project );
|
||||
|
||||
// Create an empty TrackList
|
||||
// Don't call directly -- use Create() instead
|
||||
TrackList();
|
||||
|
|
|
@ -577,7 +577,7 @@ void TrackPanel::ProcessUIHandleResult
|
|||
|
||||
// Copy data from the underlying tracks to the pending tracks that are
|
||||
// really displayed
|
||||
panel->GetProject()->GetTracks()->UpdatePendingTracks();
|
||||
TrackList::Get( *panel->GetProject() ).UpdatePendingTracks();
|
||||
|
||||
using namespace RefreshCode;
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "HitTestResult.h"
|
||||
#include "Project.h"
|
||||
#include "RefreshCode.h"
|
||||
#include "Track.h"
|
||||
#include "TrackPanelMouseEvent.h"
|
||||
#include "tracks/ui/TrackControls.h"
|
||||
|
||||
|
@ -90,12 +91,12 @@ TrackPanelResizeHandle::TrackPanelResizeHandle
|
|||
UIHandle::Result TrackPanelResizeHandle::Drag
|
||||
(const TrackPanelMouseEvent &evt, AudacityProject *pProject)
|
||||
{
|
||||
auto pTrack = pProject->GetTracks()->Lock(mpTrack);
|
||||
auto &tracks = TrackList::Get( *pProject );
|
||||
auto pTrack = tracks.Lock(mpTrack);
|
||||
if ( !pTrack )
|
||||
return RefreshCode::Cancelled;
|
||||
|
||||
const wxMouseEvent &event = evt.event;
|
||||
TrackList *const tracks = pProject->GetTracks();
|
||||
|
||||
int delta = (event.m_y - mMouseClickY);
|
||||
|
||||
|
@ -179,13 +180,13 @@ UIHandle::Result TrackPanelResizeHandle::Drag
|
|||
{
|
||||
case IsResizingBelowLinkedTracks:
|
||||
{
|
||||
auto prev = * -- tracks->Find(pTrack.get());
|
||||
auto prev = * -- tracks.Find(pTrack.get());
|
||||
doResizeBelow(prev, false);
|
||||
break;
|
||||
}
|
||||
case IsResizingBetweenLinkedTracks:
|
||||
{
|
||||
auto next = * ++ tracks->Find(pTrack.get());
|
||||
auto next = * ++ tracks.Find(pTrack.get());
|
||||
doResizeBetween(next, false);
|
||||
break;
|
||||
}
|
||||
|
@ -224,11 +225,11 @@ UIHandle::Result TrackPanelResizeHandle::Release
|
|||
|
||||
UIHandle::Result TrackPanelResizeHandle::Cancel(AudacityProject *pProject)
|
||||
{
|
||||
auto pTrack = pProject->GetTracks()->Lock(mpTrack);
|
||||
auto &tracks = TrackList::Get( *pProject );
|
||||
auto pTrack = tracks.Lock(mpTrack);
|
||||
if ( !pTrack )
|
||||
return RefreshCode::Cancelled;
|
||||
|
||||
TrackList *const tracks = pProject->GetTracks();
|
||||
|
||||
switch (mMode) {
|
||||
case IsResizing:
|
||||
|
@ -239,7 +240,7 @@ UIHandle::Result TrackPanelResizeHandle::Cancel(AudacityProject *pProject)
|
|||
break;
|
||||
case IsResizingBetweenLinkedTracks:
|
||||
{
|
||||
Track *const next = * ++ tracks->Find(pTrack.get());
|
||||
Track *const next = * ++ tracks.Find(pTrack.get());
|
||||
pTrack->SetHeight(mInitialUpperActualHeight);
|
||||
pTrack->SetMinimized(mInitialMinimized);
|
||||
next->SetHeight(mInitialActualHeight);
|
||||
|
@ -248,7 +249,7 @@ UIHandle::Result TrackPanelResizeHandle::Cancel(AudacityProject *pProject)
|
|||
break;
|
||||
case IsResizingBelowLinkedTracks:
|
||||
{
|
||||
Track *const prev = * -- tracks->Find(pTrack.get());
|
||||
Track *const prev = * -- tracks.Find(pTrack.get());
|
||||
pTrack->SetHeight(mInitialActualHeight);
|
||||
pTrack->SetMinimized(mInitialMinimized);
|
||||
prev->SetHeight(mInitialUpperActualHeight);
|
||||
|
|
|
@ -74,7 +74,7 @@ static ProjectFileIORegistry::Entry registerFactory{
|
|||
wxT( "wavetrack" ),
|
||||
[]( AudacityProject &project ){
|
||||
auto &trackFactory = *project.GetTrackFactory();
|
||||
auto &tracks = *project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
return tracks.Add(trackFactory.NewWaveTrack());
|
||||
}
|
||||
};
|
||||
|
|
|
@ -71,7 +71,7 @@ bool CompareAudioCommand::GetSelection(const CommandContext &context, AudacityPr
|
|||
|
||||
// Get the selected tracks and check that there are at least two to
|
||||
// compare
|
||||
auto trackRange = proj.GetTracks()->Selected< const WaveTrack >();
|
||||
auto trackRange = TrackList::Get( proj ).Selected< const WaveTrack >();
|
||||
mTrack0 = *trackRange.first;
|
||||
if (mTrack0 == NULL)
|
||||
{
|
||||
|
|
|
@ -482,9 +482,9 @@ bool GetInfoCommand::SendBoxes(const CommandContext &context)
|
|||
|
||||
bool GetInfoCommand::SendTracks(const CommandContext & context)
|
||||
{
|
||||
TrackList *projTracks = context.project.GetTracks();
|
||||
auto &tracks = TrackList::Get( context.project );
|
||||
context.StartArray();
|
||||
for (auto trk : projTracks->Leaders())
|
||||
for (auto trk : tracks.Leaders())
|
||||
{
|
||||
TrackPanel *panel = context.project.GetTrackPanel();
|
||||
Track * fTrack = panel->GetFocusedTrack();
|
||||
|
@ -529,10 +529,10 @@ bool GetInfoCommand::SendTracks(const CommandContext & context)
|
|||
|
||||
bool GetInfoCommand::SendClips(const CommandContext &context)
|
||||
{
|
||||
TrackList *tracks = context.project.GetTracks();
|
||||
auto &tracks = TrackList::Get( context.project );
|
||||
int i=0;
|
||||
context.StartArray();
|
||||
for (auto waveTrack : tracks->Leaders<WaveTrack>()) {
|
||||
for (auto waveTrack : tracks.Leaders<WaveTrack>()) {
|
||||
WaveClipPointers ptrs( waveTrack->SortedClipArray());
|
||||
for(WaveClip * pClip : ptrs ) {
|
||||
context.StartStruct();
|
||||
|
@ -551,11 +551,11 @@ bool GetInfoCommand::SendClips(const CommandContext &context)
|
|||
|
||||
bool GetInfoCommand::SendEnvelopes(const CommandContext &context)
|
||||
{
|
||||
TrackList *tracks = context.project.GetTracks();
|
||||
auto &tracks = TrackList::Get( context.project );
|
||||
int i=0;
|
||||
int j=0;
|
||||
context.StartArray();
|
||||
for (auto waveTrack : tracks->Leaders<WaveTrack>()) {
|
||||
for (auto waveTrack : tracks.Leaders<WaveTrack>()) {
|
||||
WaveClipPointers ptrs( waveTrack->SortedClipArray());
|
||||
for(WaveClip * pClip : ptrs ) {
|
||||
context.StartStruct();
|
||||
|
@ -588,10 +588,10 @@ bool GetInfoCommand::SendEnvelopes(const CommandContext &context)
|
|||
|
||||
bool GetInfoCommand::SendLabels(const CommandContext &context)
|
||||
{
|
||||
TrackList *tracks = context.project.GetTracks();
|
||||
auto &tracks = TrackList::Get( context.project );
|
||||
int i=0;
|
||||
context.StartArray();
|
||||
for (auto t : tracks->Leaders()) {
|
||||
for (auto t : tracks.Leaders()) {
|
||||
t->TypeSwitch( [&](LabelTrack *labelTrack) {
|
||||
#ifdef VERBOSE_LABELS_FORMATTING
|
||||
for (int nn = 0; nn< (int)labelTrack->mLabels.size(); nn++) {
|
||||
|
@ -718,7 +718,7 @@ void GetInfoCommand::ExploreTrackPanel( const CommandContext &context,
|
|||
|
||||
wxRect trackRect = pWin->GetRect();
|
||||
|
||||
for (auto t : pProj->GetTracks()->Any() + IsVisibleTrack{ pProj }) {
|
||||
for ( auto t : TrackList::Get( *pProj ).Any() + IsVisibleTrack{ pProj } ) {
|
||||
trackRect.y = t->GetY() - pTP->mViewInfo->vpos;
|
||||
trackRect.height = t->GetHeight();
|
||||
|
||||
|
|
|
@ -782,7 +782,7 @@ wxRect ScreenshotCommand::GetTrackRect( AudacityProject * pProj, TrackPanel * pa
|
|||
};
|
||||
|
||||
int count = 0;
|
||||
for (auto t : pProj->GetTracks()->Leaders()) {
|
||||
for (auto t : TrackList::Get( *pProj ).Leaders()) {
|
||||
count += 1;
|
||||
if( count > n )
|
||||
{
|
||||
|
@ -816,7 +816,7 @@ bool ScreenshotCommand::Apply(const CommandContext & context)
|
|||
TrackPanel *panel = context.project.GetTrackPanel();
|
||||
AdornedRulerPanel *ruler = panel->mRuler;
|
||||
|
||||
int nTracks = context.project.GetTracks()->size();
|
||||
int nTracks = TrackList::Get( context.project ).size();
|
||||
|
||||
int x1,y1,x2,y2;
|
||||
w->ClientToScreen(&x1, &y1);
|
||||
|
|
|
@ -98,7 +98,7 @@ bool SelectTimeCommand::Apply(const CommandContext & context){
|
|||
mRelativeTo = 0;
|
||||
|
||||
AudacityProject * p = &context.project;
|
||||
double end = p->GetTracks()->GetEndTime();
|
||||
double end = TrackList::Get( *p ).GetEndTime();
|
||||
double t0;
|
||||
double t1;
|
||||
|
||||
|
@ -214,7 +214,7 @@ bool SelectTracksCommand::Apply(const CommandContext &context)
|
|||
// Used to invalidate cached selection and tracks.
|
||||
Effect::IncEffectCounter();
|
||||
int index = 0;
|
||||
TrackList *tracks = context.project.GetTracks();
|
||||
auto &tracks = TrackList::Get( context.project );
|
||||
|
||||
// Defaults if no value...
|
||||
if( !bHasNumTracks )
|
||||
|
@ -226,7 +226,7 @@ bool SelectTracksCommand::Apply(const CommandContext &context)
|
|||
double last = mFirstTrack+mNumTracks;
|
||||
double first = mFirstTrack;
|
||||
|
||||
for (auto t : tracks->Leaders()) {
|
||||
for (auto t : tracks.Leaders()) {
|
||||
auto channels = TrackList::Channels(t);
|
||||
double term = 0.0;
|
||||
// Add 0.01 so we are free of rounding errors in comparisons.
|
||||
|
|
|
@ -67,13 +67,13 @@ bool SetLabelCommand::Apply(const CommandContext & context)
|
|||
|
||||
//wxString mode = GetString(wxT("Type"));
|
||||
AudacityProject * p = &context.project;
|
||||
TrackList *tracks = context.project.GetTracks();
|
||||
auto &tracks = TrackList::Get( *p );
|
||||
LabelStruct * pLabel = NULL;
|
||||
int i=0;
|
||||
int nn=0;
|
||||
|
||||
LabelTrack *labelTrack {};
|
||||
for (auto lt : tracks->Any<LabelTrack>()) {
|
||||
for (auto lt : tracks.Any<LabelTrack>()) {
|
||||
if( i > mLabelIndex )
|
||||
break;
|
||||
labelTrack = lt;
|
||||
|
|
|
@ -94,8 +94,8 @@ bool SetTrackBase::Apply(const CommandContext & context )
|
|||
{
|
||||
long i = 0;// track counter
|
||||
long j = 0;// channel counter
|
||||
auto tracks = context.project.GetTracks();
|
||||
for ( auto t : tracks->Leaders() )
|
||||
auto &tracks = TrackList::Get( context.project );
|
||||
for ( auto t : tracks.Leaders() )
|
||||
{
|
||||
auto channels = TrackList::Channels(t);
|
||||
for ( auto channel : channels ) {
|
||||
|
|
|
@ -51,7 +51,7 @@ bool ContrastDialog::GetDB(float &dB)
|
|||
|
||||
AudacityProject *p = GetActiveProject();
|
||||
auto range =
|
||||
p->GetTracks()->SelectedLeaders< const WaveTrack >();
|
||||
TrackList::Get( *p ).SelectedLeaders< const WaveTrack >();
|
||||
auto numberSelectedTracks = range.size();
|
||||
if (numberSelectedTracks > 1) {
|
||||
AudacityMessageDialog m(NULL, _("You can only measure one track at a time."), _("Error"), wxOK);
|
||||
|
@ -346,7 +346,7 @@ void ContrastDialog::OnGetForeground(wxCommandEvent & /*event*/)
|
|||
{
|
||||
AudacityProject *p = GetActiveProject();
|
||||
|
||||
if( p->GetTracks()->Selected< const WaveTrack >() ) {
|
||||
if( TrackList::Get( *p ).Selected< const WaveTrack >() ) {
|
||||
mForegroundStartT->SetValue(p->mViewInfo.selectedRegion.t0());
|
||||
mForegroundEndT->SetValue(p->mViewInfo.selectedRegion.t1());
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ void ContrastDialog::OnGetBackground(wxCommandEvent & /*event*/)
|
|||
{
|
||||
AudacityProject *p = GetActiveProject();
|
||||
|
||||
if( p->GetTracks()->Selected< const WaveTrack >() ) {
|
||||
if( TrackList::Get( *p ).Selected< const WaveTrack >() ) {
|
||||
mBackgroundStartT->SetValue(p->mViewInfo.selectedRegion.t0());
|
||||
mBackgroundEndT->SetValue(p->mViewInfo.selectedRegion.t1());
|
||||
}
|
||||
|
|
|
@ -509,7 +509,7 @@ bool EffectEqualization::Init()
|
|||
double rate = 0.0;
|
||||
|
||||
auto trackRange =
|
||||
GetActiveProject()->GetTracks()->Selected< const WaveTrack >();
|
||||
TrackList::Get( *GetActiveProject() ).Selected< const WaveTrack >();
|
||||
if (trackRange) {
|
||||
rate = (*(trackRange.first++)) -> GetRate();
|
||||
++selcount;
|
||||
|
|
|
@ -539,7 +539,7 @@ bool NyquistEffect::Init()
|
|||
bool bAllowSpectralEditing = true;
|
||||
|
||||
for ( auto t :
|
||||
project->GetTracks()->Selected< const WaveTrack >() ) {
|
||||
TrackList::Get( *project ).Selected< const WaveTrack >() ) {
|
||||
if (t->GetDisplay() != WaveTrack::Spectrum ||
|
||||
!(t->GetSpectrogramSettings().SpectralSelectionEnabled())) {
|
||||
bAllowSpectralEditing = false;
|
||||
|
@ -715,7 +715,7 @@ bool NyquistEffect::Process()
|
|||
wxString waveTrackList; // track positions of selected audio tracks.
|
||||
|
||||
{
|
||||
auto countRange = project->GetTracks()->Leaders();
|
||||
auto countRange = TrackList::Get( *project ).Leaders();
|
||||
for (auto t : countRange) {
|
||||
t->TypeSwitch( [&](const WaveTrack *) {
|
||||
numWave++;
|
||||
|
@ -1643,7 +1643,7 @@ double NyquistEffect::GetCtrlValue(const wxString &s)
|
|||
AudacityProject *project = GetActiveProject();
|
||||
if (project && s.IsSameAs(wxT("half-srate"), false)) {
|
||||
auto rate =
|
||||
project->GetTracks()->Selected< const WaveTrack >()
|
||||
TrackList::Get( *project ).Selected< const WaveTrack >()
|
||||
.min( &WaveTrack::GetRate );
|
||||
return (rate / 2.0);
|
||||
}
|
||||
|
|
|
@ -461,10 +461,10 @@ bool Exporter::ExamineTracks()
|
|||
double earliestBegin = mT1;
|
||||
double latestEnd = mT0;
|
||||
|
||||
const TrackList *tracks = mProject->GetTracks();
|
||||
auto &tracks = TrackList::Get( *mProject );
|
||||
|
||||
for (auto tr :
|
||||
tracks->Any< const WaveTrack >()
|
||||
tracks.Any< const WaveTrack >()
|
||||
+ ( mSelectedOnly ? &Track::IsSelected : &Track::Any )
|
||||
- &WaveTrack::GetMute
|
||||
) {
|
||||
|
@ -841,7 +841,7 @@ bool Exporter::CheckMix()
|
|||
if (exportedChannels < 0)
|
||||
exportedChannels = mPlugins[mFormat]->GetMaxChannels(mSubFormat);
|
||||
|
||||
ExportMixerDialog md(mProject->GetTracks(),
|
||||
ExportMixerDialog md(&TrackList::Get( *mProject ),
|
||||
mSelectedOnly,
|
||||
exportedChannels,
|
||||
NULL,
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "../Mix.h"
|
||||
#include "../Prefs.h"
|
||||
#include "../ShuttleGui.h"
|
||||
#include "../Track.h"
|
||||
#include "../float_cast.h"
|
||||
#include "../widgets/FileHistory.h"
|
||||
#include "../widgets/AudacityMessageBox.h"
|
||||
|
@ -426,12 +427,12 @@ ProgressResult ExportCL::Export(AudacityProject *project,
|
|||
os->Write(&header, sizeof(wav_header));
|
||||
|
||||
// Mix 'em up
|
||||
const TrackList *tracks = project->GetTracks();
|
||||
const auto &tracks = TrackList::Get( *project );
|
||||
const WaveTrackConstArray waveTracks =
|
||||
tracks->GetWaveTrackConstArray(selectionOnly, false);
|
||||
tracks.GetWaveTrackConstArray(selectionOnly, false);
|
||||
auto mixer = CreateMixer(
|
||||
waveTracks,
|
||||
tracks->GetTimeTrack(),
|
||||
tracks.GetTimeTrack(),
|
||||
t0,
|
||||
t1,
|
||||
channels,
|
||||
|
|
|
@ -39,6 +39,7 @@ function.
|
|||
#include "../Mix.h"
|
||||
#include "../Project.h"
|
||||
#include "../Tags.h"
|
||||
#include "../Track.h"
|
||||
#include "../widgets/AudacityMessageBox.h"
|
||||
#include "../widgets/ProgressDialog.h"
|
||||
|
||||
|
@ -871,7 +872,7 @@ ProgressResult ExportFFmpeg::Export(AudacityProject *project,
|
|||
return ProgressResult::Cancelled;
|
||||
}
|
||||
mName = fName;
|
||||
const TrackList *tracks = project->GetTracks();
|
||||
const auto &tracks = TrackList::Get( *project );
|
||||
bool ret = true;
|
||||
|
||||
if (mSubFormat >= FMT_LAST) {
|
||||
|
@ -895,9 +896,9 @@ ProgressResult ExportFFmpeg::Export(AudacityProject *project,
|
|||
size_t pcmBufferSize = 1024;
|
||||
|
||||
const WaveTrackConstArray waveTracks =
|
||||
tracks->GetWaveTrackConstArray(selectionOnly, false);
|
||||
tracks.GetWaveTrackConstArray(selectionOnly, false);
|
||||
auto mixer = CreateMixer(waveTracks,
|
||||
tracks->GetTimeTrack(),
|
||||
tracks.GetTimeTrack(),
|
||||
t0, t1,
|
||||
channels, pcmBufferSize, true,
|
||||
mSampleRate, int16Sample, true, mixerSpec);
|
||||
|
|
|
@ -38,6 +38,7 @@ and libvorbis examples, Monty <monty@xiph.org>
|
|||
#include "../ShuttleGui.h"
|
||||
|
||||
#include "../Tags.h"
|
||||
#include "../Track.h"
|
||||
|
||||
#include "../widgets/AudacityMessageBox.h"
|
||||
#include "../widgets/ProgressDialog.h"
|
||||
|
@ -252,7 +253,7 @@ ProgressResult ExportFLAC::Export(AudacityProject *project,
|
|||
int WXUNUSED(subformat))
|
||||
{
|
||||
double rate = project->GetRate();
|
||||
const TrackList *tracks = project->GetTracks();
|
||||
const auto &tracks = TrackList::Get( *project );
|
||||
|
||||
wxLogNull logNo; // temporarily disable wxWidgets error messages
|
||||
auto updateResult = ProgressResult::Success;
|
||||
|
@ -365,9 +366,9 @@ ProgressResult ExportFLAC::Export(AudacityProject *project,
|
|||
} );
|
||||
|
||||
const WaveTrackConstArray waveTracks =
|
||||
tracks->GetWaveTrackConstArray(selectionOnly, false);
|
||||
tracks.GetWaveTrackConstArray(selectionOnly, false);
|
||||
auto mixer = CreateMixer(waveTracks,
|
||||
tracks->GetTimeTrack(),
|
||||
tracks.GetTimeTrack(),
|
||||
t0, t1,
|
||||
numChannels, SAMPLES_PER_RUN, false,
|
||||
rate, format, true, mixerSpec);
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include "../Project.h"
|
||||
#include "../ShuttleGui.h"
|
||||
#include "../Tags.h"
|
||||
#include "../Track.h"
|
||||
#include "../widgets/AudacityMessageBox.h"
|
||||
#include "../widgets/ProgressDialog.h"
|
||||
|
||||
|
@ -212,7 +213,7 @@ ProgressResult ExportMP2::Export(AudacityProject *project,
|
|||
bool stereo = (channels == 2);
|
||||
long bitrate = gPrefs->Read(wxT("/FileFormats/MP2Bitrate"), 160);
|
||||
double rate = project->GetRate();
|
||||
const TrackList *tracks = project->GetTracks();
|
||||
const auto &tracks = TrackList::Get( *project );
|
||||
|
||||
wxLogNull logNo; /* temporarily disable wxWidgets error messages */
|
||||
|
||||
|
@ -264,11 +265,11 @@ ProgressResult ExportMP2::Export(AudacityProject *project,
|
|||
ArrayOf<unsigned char> mp2Buffer{ mp2BufferSize };
|
||||
|
||||
const WaveTrackConstArray waveTracks =
|
||||
tracks->GetWaveTrackConstArray(selectionOnly, false);
|
||||
tracks.GetWaveTrackConstArray(selectionOnly, false);
|
||||
auto updateResult = ProgressResult::Success;
|
||||
{
|
||||
auto mixer = CreateMixer(waveTracks,
|
||||
tracks->GetTimeTrack(),
|
||||
tracks.GetTimeTrack(),
|
||||
t0, t1,
|
||||
stereo ? 2 : 1, pcmBufferSize, true,
|
||||
rate, int16Sample, true, mixerSpec);
|
||||
|
|
|
@ -87,6 +87,7 @@
|
|||
#include "../Project.h"
|
||||
#include "../ShuttleGui.h"
|
||||
#include "../Tags.h"
|
||||
#include "../Track.h"
|
||||
#include "../widgets/HelpSystem.h"
|
||||
#include "../widgets/LinkingHtmlWindow.h"
|
||||
#include "../widgets/AudacityMessageBox.h"
|
||||
|
@ -1756,7 +1757,7 @@ ProgressResult ExportMP3::Export(AudacityProject *project,
|
|||
#ifndef DISABLE_DYNAMIC_LOADING_LAME
|
||||
wxWindow *parent = project;
|
||||
#endif // DISABLE_DYNAMIC_LOADING_LAME
|
||||
const TrackList *tracks = project->GetTracks();
|
||||
const auto &tracks = TrackList::Get( *project );
|
||||
MP3Exporter exporter;
|
||||
|
||||
#ifdef DISABLE_DYNAMIC_LOADING_LAME
|
||||
|
@ -1902,10 +1903,10 @@ ProgressResult ExportMP3::Export(AudacityProject *project,
|
|||
wxASSERT(buffer);
|
||||
|
||||
const WaveTrackConstArray waveTracks =
|
||||
tracks->GetWaveTrackConstArray(selectionOnly, false);
|
||||
tracks.GetWaveTrackConstArray(selectionOnly, false);
|
||||
{
|
||||
auto mixer = CreateMixer(waveTracks,
|
||||
tracks->GetTimeTrack(),
|
||||
tracks.GetTimeTrack(),
|
||||
t0, t1,
|
||||
channels, inSamples, true,
|
||||
rate, int16Sample, true, mixerSpec);
|
||||
|
|
|
@ -132,7 +132,7 @@ ExportMultiple::ExportMultiple(AudacityProject *project)
|
|||
SetName(GetTitle());
|
||||
|
||||
mProject = project;
|
||||
mTracks = project->GetTracks();
|
||||
mTracks = &TrackList::Get( *project );
|
||||
// Construct an array of non-owning pointers
|
||||
for (const auto &plugin : mExporter.GetPlugins())
|
||||
mPlugins.push_back(plugin.get());
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "../ShuttleGui.h"
|
||||
|
||||
#include "../Tags.h"
|
||||
#include "../Track.h"
|
||||
#include "../widgets/AudacityMessageBox.h"
|
||||
#include "../widgets/ProgressDialog.h"
|
||||
|
||||
|
@ -170,7 +171,7 @@ ProgressResult ExportOGG::Export(AudacityProject *project,
|
|||
int WXUNUSED(subformat))
|
||||
{
|
||||
double rate = project->GetRate();
|
||||
const TrackList *tracks = project->GetTracks();
|
||||
const auto &tracks = TrackList::Get( *project );
|
||||
double quality = (gPrefs->Read(wxT("/FileFormats/OggExportQuality"), 50)/(float)100.0);
|
||||
|
||||
wxLogNull logNo; // temporarily disable wxWidgets error messages
|
||||
|
@ -274,10 +275,10 @@ ProgressResult ExportOGG::Export(AudacityProject *project,
|
|||
}
|
||||
|
||||
const WaveTrackConstArray waveTracks =
|
||||
tracks->GetWaveTrackConstArray(selectionOnly, false);
|
||||
tracks.GetWaveTrackConstArray(selectionOnly, false);
|
||||
{
|
||||
auto mixer = CreateMixer(waveTracks,
|
||||
tracks->GetTimeTrack(),
|
||||
tracks.GetTimeTrack(),
|
||||
t0, t1,
|
||||
numChannels, SAMPLES_PER_RUN, false,
|
||||
rate, floatSample, true, mixerSpec);
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "../Project.h"
|
||||
#include "../ShuttleGui.h"
|
||||
#include "../Tags.h"
|
||||
#include "../Track.h"
|
||||
#include "../ondemand/ODManager.h"
|
||||
#include "../widgets/AudacityMessageBox.h"
|
||||
#include "../widgets/ErrorDialog.h"
|
||||
|
@ -442,7 +443,7 @@ ProgressResult ExportPCM::Export(AudacityProject *project,
|
|||
int subformat)
|
||||
{
|
||||
double rate = project->GetRate();
|
||||
const TrackList *tracks = project->GetTracks();
|
||||
const auto &tracks = TrackList::Get( *project );
|
||||
int sf_format;
|
||||
|
||||
if (subformat < 0 || static_cast<unsigned int>(subformat) >= WXSIZEOF(kFormats))
|
||||
|
@ -532,11 +533,11 @@ ProgressResult ExportPCM::Export(AudacityProject *project,
|
|||
size_t maxBlockLen = 44100 * 5;
|
||||
|
||||
const WaveTrackConstArray waveTracks =
|
||||
tracks->GetWaveTrackConstArray(selectionOnly, false);
|
||||
tracks.GetWaveTrackConstArray(selectionOnly, false);
|
||||
{
|
||||
wxASSERT(info.channels >= 0);
|
||||
auto mixer = CreateMixer(waveTracks,
|
||||
tracks->GetTimeTrack(),
|
||||
tracks.GetTimeTrack(),
|
||||
t0, t1,
|
||||
info.channels, maxBlockLen, true,
|
||||
rate, format, true, mixerSpec);
|
||||
|
|
|
@ -417,8 +417,8 @@ void LOFImportFileHandle::lofOpenFiles(wxString* ln)
|
|||
;
|
||||
else if (Internat::CompatibleToDouble(tokenholder, &offset))
|
||||
{
|
||||
auto tracks = mProject->GetTracks();
|
||||
auto t = *tracks->Leaders().rbegin();
|
||||
auto &tracks = TrackList::Get( *mProject );
|
||||
auto t = *tracks.Leaders().rbegin();
|
||||
|
||||
// t is now the last track in the project, unless the import of
|
||||
// all tracks failed, in which case it will be null. In that
|
||||
|
@ -471,7 +471,7 @@ void LOFImportFileHandle::doDurationAndScrollOffset()
|
|||
bool doSomething = callDurationFactor || callScrollOffset;
|
||||
if (callDurationFactor)
|
||||
{
|
||||
double longestDuration = mProject->GetTracks()->GetEndTime();
|
||||
double longestDuration = TrackList::Get( *mProject ).GetEndTime();
|
||||
mProject->ZoomBy(longestDuration / durationFactor);
|
||||
callDurationFactor = false;
|
||||
}
|
||||
|
|
|
@ -248,10 +248,10 @@ int FindClipBoundaries
|
|||
(AudacityProject &project,
|
||||
double time, bool next, std::vector<FoundClipBoundary>& finalResults)
|
||||
{
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
finalResults.clear();
|
||||
|
||||
bool anyWaveTracksSelected{ tracks->Selected< const WaveTrack >() };
|
||||
bool anyWaveTracksSelected{ tracks.Selected< const WaveTrack >() };
|
||||
|
||||
|
||||
// first search the tracks individually
|
||||
|
@ -259,7 +259,7 @@ int FindClipBoundaries
|
|||
std::vector<FoundClipBoundary> results;
|
||||
|
||||
int nTracksSearched = 0;
|
||||
auto leaders = tracks->Leaders();
|
||||
auto leaders = tracks.Leaders();
|
||||
auto rangeLeaders = leaders.Filter<const WaveTrack>();
|
||||
if (anyWaveTracksSelected)
|
||||
rangeLeaders = rangeLeaders + &Track::GetSelected;
|
||||
|
@ -481,17 +481,17 @@ int FindClips
|
|||
(AudacityProject &project,
|
||||
double t0, double t1, bool next, std::vector<FoundClip>& finalResults)
|
||||
{
|
||||
const auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
finalResults.clear();
|
||||
|
||||
bool anyWaveTracksSelected{ tracks->Selected< const WaveTrack >() };
|
||||
bool anyWaveTracksSelected{ tracks.Selected< const WaveTrack >() };
|
||||
|
||||
// first search the tracks individually
|
||||
|
||||
std::vector<FoundClip> results;
|
||||
|
||||
int nTracksSearched = 0;
|
||||
auto leaders = tracks->Leaders();
|
||||
auto leaders = tracks.Leaders();
|
||||
auto rangeLeaders = leaders.Filter<const WaveTrack>();
|
||||
if (anyWaveTracksSelected)
|
||||
rangeLeaders = rangeLeaders + &Track::GetSelected;
|
||||
|
@ -653,8 +653,8 @@ double DoClipMove
|
|||
track->GetSelected() && !selectedRegion.isPoint();
|
||||
state.trackExclusions.clear();
|
||||
|
||||
TimeShiftHandle::CreateListOfCapturedClips
|
||||
( state, viewInfo, *track, trackList, syncLocked, t0 );
|
||||
TimeShiftHandle::CreateListOfCapturedClips(
|
||||
state, viewInfo, *track, trackList, syncLocked, t0 );
|
||||
|
||||
auto desiredT0 = viewInfo.OffsetTimeByPixels( t0, ( right ? 1 : -1 ) );
|
||||
auto desiredSlideAmount = desiredT0 - t0;
|
||||
|
@ -700,12 +700,11 @@ void DoClipLeftOrRight
|
|||
auto &panel = *project.GetTrackPanel();
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto &selectedRegion = viewInfo.selectedRegion;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto isSyncLocked = project.IsSyncLocked();
|
||||
|
||||
auto amount = DoClipMove
|
||||
( viewInfo, panel.GetFocusedTrack(),
|
||||
*tracks, isSyncLocked, right );
|
||||
auto amount = DoClipMove( viewInfo, panel.GetFocusedTrack(),
|
||||
tracks, isSyncLocked, right );
|
||||
|
||||
panel.ScrollIntoView(selectedRegion.t0());
|
||||
panel.Refresh(false);
|
||||
|
|
|
@ -33,11 +33,11 @@ void FinishCopy
|
|||
// (This was formerly the first part of overly-long OnPaste.)
|
||||
bool DoPasteText(AudacityProject &project)
|
||||
{
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
for (auto pLabelTrack : tracks->Any<LabelTrack>())
|
||||
for (auto pLabelTrack : tracks.Any<LabelTrack>())
|
||||
{
|
||||
// Does this track have an active label?
|
||||
if (pLabelTrack->HasSelection()) {
|
||||
|
@ -68,13 +68,13 @@ bool DoPasteText(AudacityProject &project)
|
|||
// (This was formerly the second part of overly-long OnPaste.)
|
||||
bool DoPasteNothingSelected(AudacityProject &project)
|
||||
{
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackFactory = project.GetTrackFactory();
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
// First check whether anything's selected.
|
||||
if (tracks->Selected())
|
||||
if (tracks.Selected())
|
||||
return false;
|
||||
else
|
||||
{
|
||||
|
@ -111,7 +111,7 @@ bool DoPasteNothingSelected(AudacityProject &project)
|
|||
},
|
||||
[&](const TimeTrack *) {
|
||||
// Maintain uniqueness of the time track!
|
||||
pNewTrack = tracks->GetTimeTrack();
|
||||
pNewTrack = tracks.GetTimeTrack();
|
||||
if (!pNewTrack)
|
||||
uNewTrack = trackFactory->NewTimeTrack(),
|
||||
pNewTrack = uNewTrack.get();
|
||||
|
@ -127,7 +127,7 @@ bool DoPasteNothingSelected(AudacityProject &project)
|
|||
|
||||
pNewTrack->SetSelected(true);
|
||||
if (uNewTrack)
|
||||
FinishCopy(pClip, uNewTrack, *tracks);
|
||||
FinishCopy(pClip, uNewTrack, tracks);
|
||||
else
|
||||
Track::FinishCopy(pClip, pNewTrack);
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ void OnRedo(const CommandContext &context)
|
|||
void OnCut(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto ruler = project.GetRulerPanel();
|
||||
|
@ -290,7 +290,7 @@ void OnCut(const CommandContext &context)
|
|||
// cutting the _text_ inside of labels, i.e. if you're
|
||||
// in the middle of editing the label text and select "Cut".
|
||||
|
||||
for (auto lt : tracks->Selected< LabelTrack >()) {
|
||||
for (auto lt : tracks.Selected< LabelTrack >()) {
|
||||
if (lt->CutSelectedText()) {
|
||||
trackPanel->Refresh(false);
|
||||
return;
|
||||
|
@ -303,7 +303,7 @@ void OnCut(const CommandContext &context)
|
|||
auto pNewClipboard = TrackList::Create();
|
||||
auto &newClipboard = *pNewClipboard;
|
||||
|
||||
tracks->Selected().Visit(
|
||||
tracks.Selected().Visit(
|
||||
#if defined(USE_MIDI)
|
||||
[&](NoteTrack *n) {
|
||||
// Since portsmf has a built-in cut operator, we use that instead
|
||||
|
@ -330,7 +330,7 @@ void OnCut(const CommandContext &context)
|
|||
// Proceed to change the project. If this throws, the project will be
|
||||
// rolled back by the top level handler.
|
||||
|
||||
(tracks->Any() + &Track::IsSelectedOrSyncLockSelected).Visit(
|
||||
(tracks.Any() + &Track::IsSelectedOrSyncLockSelected).Visit(
|
||||
#if defined(USE_MIDI)
|
||||
[](NoteTrack*) {
|
||||
//if NoteTrack, it was cut, so do not clear anything
|
||||
|
@ -367,7 +367,7 @@ void OnCut(const CommandContext &context)
|
|||
void OnDelete(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto &tracks = *project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
for (auto n : tracks.Any()) {
|
||||
|
@ -392,11 +392,11 @@ void OnDelete(const CommandContext &context)
|
|||
void OnCopy(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
for (auto lt : tracks->Selected< LabelTrack >()) {
|
||||
for (auto lt : tracks.Selected< LabelTrack >()) {
|
||||
if (lt->CopySelectedText()) {
|
||||
//trackPanel->Refresh(false);
|
||||
return;
|
||||
|
@ -409,7 +409,7 @@ void OnCopy(const CommandContext &context)
|
|||
auto pNewClipboard = TrackList::Create();
|
||||
auto &newClipboard = *pNewClipboard;
|
||||
|
||||
for (auto n : tracks->Selected()) {
|
||||
for (auto n : tracks.Selected()) {
|
||||
auto dest = n->Copy(selectedRegion.t0(),
|
||||
selectedRegion.t1());
|
||||
FinishCopy(n, dest, newClipboard);
|
||||
|
@ -426,7 +426,7 @@ void OnCopy(const CommandContext &context)
|
|||
void OnPaste(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto trackFactory = project.GetTrackFactory();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
@ -449,7 +449,7 @@ void OnPaste(const CommandContext &context)
|
|||
double t0 = selectedRegion.t0();
|
||||
double t1 = selectedRegion.t1();
|
||||
|
||||
auto pN = tracks->Any().begin();
|
||||
auto pN = tracks.Any().begin();
|
||||
|
||||
Track *ff = NULL;
|
||||
const Track *lastClipBeforeMismatch = NULL;
|
||||
|
@ -632,7 +632,7 @@ void OnPaste(const CommandContext &context)
|
|||
// between projects
|
||||
locker.create(static_cast<const WaveTrack*>(wc));
|
||||
|
||||
tracks->Any().StartingWith(*pN).Visit(
|
||||
tracks.Any().StartingWith(*pN).Visit(
|
||||
[&](WaveTrack *wt, const Track::Fallthrough &fallthrough) {
|
||||
if (!wt->GetSelected())
|
||||
return fallthrough();
|
||||
|
@ -689,11 +689,11 @@ void OnPaste(const CommandContext &context)
|
|||
void OnDuplicate(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
// This iteration is unusual because we add to the list inside the loop
|
||||
auto range = tracks->Selected();
|
||||
auto range = tracks.Selected();
|
||||
auto last = *range.rbegin();
|
||||
for (auto n : range) {
|
||||
// Make copies not for clipboard but for direct addition to the project
|
||||
|
@ -701,7 +701,7 @@ void OnDuplicate(const CommandContext &context)
|
|||
selectedRegion.t1(), false);
|
||||
dest->Init(*n);
|
||||
dest->SetOffset(wxMax(selectedRegion.t0(), n->GetOffset()));
|
||||
tracks->Add( dest );
|
||||
tracks.Add( dest );
|
||||
|
||||
// This break is really needed, else we loop infinitely
|
||||
if (n == last)
|
||||
|
@ -716,7 +716,7 @@ void OnDuplicate(const CommandContext &context)
|
|||
void OnSplitCut(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
auto &clipboard = Clipboard::Get();
|
||||
|
@ -727,7 +727,7 @@ void OnSplitCut(const CommandContext &context)
|
|||
|
||||
Track::Holder dest;
|
||||
|
||||
tracks->Selected().Visit(
|
||||
tracks.Selected().Visit(
|
||||
[&](WaveTrack *n) {
|
||||
dest = n->SplitCut(
|
||||
selectedRegion.t0(),
|
||||
|
@ -757,10 +757,10 @@ void OnSplitCut(const CommandContext &context)
|
|||
void OnSplitDelete(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
tracks->Selected().Visit(
|
||||
tracks.Selected().Visit(
|
||||
[&](WaveTrack *wt) {
|
||||
wt->SplitDelete(selectedRegion.t0(),
|
||||
selectedRegion.t1());
|
||||
|
@ -783,11 +783,11 @@ void OnSplitDelete(const CommandContext &context)
|
|||
void OnSilence(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
for ( auto n : tracks->Selected< AudioTrack >() )
|
||||
for ( auto n : tracks.Selected< AudioTrack >() )
|
||||
n->Silence(selectedRegion.t0(), selectedRegion.t1());
|
||||
|
||||
project.PushState(
|
||||
|
@ -802,13 +802,13 @@ void OnSilence(const CommandContext &context)
|
|||
void OnTrim(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
if (selectedRegion.isPoint())
|
||||
return;
|
||||
|
||||
tracks->Selected().Visit(
|
||||
tracks.Selected().Visit(
|
||||
#ifdef USE_MIDI
|
||||
[&](NoteTrack *nt) {
|
||||
nt->Trim(selectedRegion.t0(),
|
||||
|
@ -834,14 +834,14 @@ void OnTrim(const CommandContext &context)
|
|||
void OnSplit(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
double sel0 = selectedRegion.t0();
|
||||
double sel1 = selectedRegion.t1();
|
||||
|
||||
for (auto wt : tracks->Selected< WaveTrack >())
|
||||
for (auto wt : tracks.Selected< WaveTrack >())
|
||||
wt->Split( sel0, sel1 );
|
||||
|
||||
project.PushState(_("Split"), _("Split"));
|
||||
|
@ -900,13 +900,13 @@ void OnSplit(const CommandContext &context)
|
|||
void OnSplitNew(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
Track::Holder dest;
|
||||
|
||||
// This iteration is unusual because we add to the list inside the loop
|
||||
auto range = tracks->Selected();
|
||||
auto range = tracks.Selected();
|
||||
auto last = *range.rbegin();
|
||||
for (auto track : range) {
|
||||
track->TypeSwitch(
|
||||
|
@ -922,7 +922,7 @@ void OnSplitNew(const CommandContext &context)
|
|||
dest = wt->SplitCut(newt0, newt1);
|
||||
if (dest) {
|
||||
dest->SetOffset(wxMax(newt0, offset));
|
||||
FinishCopy(wt, dest, *tracks);
|
||||
FinishCopy(wt, dest, tracks);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
|
@ -951,10 +951,10 @@ void OnSplitNew(const CommandContext &context)
|
|||
void OnJoin(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
for (auto wt : tracks->Selected< WaveTrack >())
|
||||
for (auto wt : tracks.Selected< WaveTrack >())
|
||||
wt->Join(selectedRegion.t0(),
|
||||
selectedRegion.t1());
|
||||
|
||||
|
@ -970,10 +970,10 @@ void OnJoin(const CommandContext &context)
|
|||
void OnDisjoin(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
for (auto wt : tracks->Selected< WaveTrack >())
|
||||
for (auto wt : tracks.Selected< WaveTrack >())
|
||||
wt->Disjoin(selectedRegion.t0(),
|
||||
selectedRegion.t1());
|
||||
|
||||
|
|
|
@ -30,13 +30,13 @@ namespace {
|
|||
void DoExport
|
||||
(AudacityProject &project, const wxString & Format )
|
||||
{
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
Exporter e;
|
||||
|
||||
MissingAliasFilesDialog::SetShouldShow(true);
|
||||
double t0 = 0.0;
|
||||
double t1 = tracks->GetEndTime();
|
||||
double t1 = tracks.GetEndTime();
|
||||
|
||||
// Prompt for file name and/or extension?
|
||||
bool bPromptingRequired =
|
||||
|
@ -110,7 +110,7 @@ namespace FileActions {
|
|||
AudacityProject *DoImportMIDI(
|
||||
AudacityProject *pProject, const FilePath &fileName)
|
||||
{
|
||||
auto tracks = pProject->GetTracks();
|
||||
auto &tracks = TrackList::Get( *pProject );
|
||||
|
||||
AudacityProject *pNewProject {};
|
||||
if ( !pProject )
|
||||
|
@ -123,7 +123,7 @@ AudacityProject *DoImportMIDI(
|
|||
if (::ImportMIDI(fileName, newTrack.get())) {
|
||||
|
||||
SelectActions::SelectNone( *pProject );
|
||||
auto pTrack = tracks->Add( newTrack );
|
||||
auto pTrack = tracks.Add( newTrack );
|
||||
pTrack->SetSelected(true);
|
||||
|
||||
pProject->PushState(wxString::Format(_("Imported MIDI from '%s'"),
|
||||
|
@ -241,11 +241,11 @@ void OnExportSelection(const CommandContext &context)
|
|||
void OnExportLabels(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
/* i18n-hint: filename containing exported text from label tracks */
|
||||
wxString fName = _("labels.txt");
|
||||
auto trackRange = tracks->Any<const LabelTrack>();
|
||||
auto trackRange = tracks.Any<const LabelTrack>();
|
||||
auto numLabelTracks = trackRange.size();
|
||||
|
||||
if (numLabelTracks == 0) {
|
||||
|
@ -312,11 +312,11 @@ void OnExportMultiple(const CommandContext &context)
|
|||
void OnExportMIDI(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
// Make sure that there is
|
||||
// exactly one NoteTrack selected.
|
||||
const auto range = tracks->Selected< const NoteTrack >();
|
||||
const auto range = tracks.Selected< const NoteTrack >();
|
||||
const auto numNoteTracksSelected = range.size();
|
||||
|
||||
if(numNoteTracksSelected > 1) {
|
||||
|
@ -439,7 +439,7 @@ void OnImportLabels(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto trackFactory = project.GetTrackFactory();
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
wxString fileName =
|
||||
FileNames::SelectFile(FileNames::Operation::Open,
|
||||
|
@ -470,7 +470,7 @@ void OnImportLabels(const CommandContext &context)
|
|||
|
||||
SelectActions::SelectNone( project );
|
||||
newTrack->SetSelected(true);
|
||||
tracks->Add( newTrack );
|
||||
tracks.Add( newTrack );
|
||||
|
||||
project.PushState(wxString::
|
||||
Format(_("Imported labels from '%s'"), fileName),
|
||||
|
@ -537,8 +537,8 @@ void OnPrint(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto name = project.GetProjectName();
|
||||
auto tracks = project.GetTracks();
|
||||
HandlePrint(&project, name, tracks, *project.GetTrackPanel());
|
||||
auto &tracks = TrackList::Get( project );
|
||||
HandlePrint(&project, name, &tracks, *project.GetTrackPanel());
|
||||
}
|
||||
|
||||
void OnExit(const CommandContext &WXUNUSED(context) )
|
||||
|
|
|
@ -17,7 +17,7 @@ int DoAddLabel(
|
|||
AudacityProject &project, const SelectedRegion ®ion,
|
||||
bool preserveFocus = false)
|
||||
{
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto trackFactory = project.GetTrackFactory();
|
||||
|
||||
|
@ -36,13 +36,13 @@ int DoAddLabel(
|
|||
|
||||
// Look for a label track at or after the focused track
|
||||
auto iter = pFocusedTrack
|
||||
? tracks->Find(pFocusedTrack)
|
||||
: tracks->Any().begin();
|
||||
? tracks.Find(pFocusedTrack)
|
||||
: tracks.Any().begin();
|
||||
auto lt = * iter.Filter< LabelTrack >();
|
||||
|
||||
// If none found, start a NEW label track and use it
|
||||
if (!lt)
|
||||
lt = tracks->Add(trackFactory->NewLabelTrack());
|
||||
lt = tracks.Add(trackFactory->NewLabelTrack());
|
||||
|
||||
// LLL: Commented as it seemed a little forceful to remove users
|
||||
// selection when adding the label. This does not happen if
|
||||
|
@ -279,7 +279,7 @@ void OnAddLabelPlaying(const CommandContext &context)
|
|||
void OnPasteNewLabel(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackFactory = project.GetTrackFactory();
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
@ -287,18 +287,18 @@ void OnPasteNewLabel(const CommandContext &context)
|
|||
bool bPastedSomething = false;
|
||||
|
||||
{
|
||||
auto trackRange = tracks->Selected< const LabelTrack >();
|
||||
auto trackRange = tracks.Selected< const LabelTrack >();
|
||||
if (trackRange.empty())
|
||||
{
|
||||
// If there are no selected label tracks, try to choose the first label
|
||||
// track after some other selected track
|
||||
Track *t = *tracks->Selected().begin()
|
||||
Track *t = *tracks.Selected().begin()
|
||||
.Filter( &Track::Any )
|
||||
.Filter<LabelTrack>();
|
||||
|
||||
// If no match found, add one
|
||||
if (!t) {
|
||||
t = tracks->Add(trackFactory->NewLabelTrack());
|
||||
t = tracks.Add(trackFactory->NewLabelTrack());
|
||||
}
|
||||
|
||||
// Select this track so the loop picks it up
|
||||
|
@ -307,7 +307,7 @@ void OnPasteNewLabel(const CommandContext &context)
|
|||
}
|
||||
|
||||
LabelTrack *plt = NULL; // the previous track
|
||||
for ( auto lt : tracks->Selected< LabelTrack >() )
|
||||
for ( auto lt : tracks.Selected< LabelTrack >() )
|
||||
{
|
||||
// Unselect the last label, so we'll have just one active label when
|
||||
// we're done
|
||||
|
@ -353,7 +353,7 @@ void OnToggleTypeToCreateLabel(const CommandContext &WXUNUSED(context) )
|
|||
void OnCutLabels(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto &tracks = *project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
if( selectedRegion.isPoint() )
|
||||
|
@ -385,7 +385,7 @@ void OnCutLabels(const CommandContext &context)
|
|||
void OnDeleteLabels(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto &tracks = *project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
if( selectedRegion.isPoint() )
|
||||
|
@ -407,7 +407,7 @@ void OnDeleteLabels(const CommandContext &context)
|
|||
void OnSplitCutLabels(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto &tracks = *project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
if( selectedRegion.isPoint() )
|
||||
|
@ -429,7 +429,7 @@ void OnSplitCutLabels(const CommandContext &context)
|
|||
void OnSplitDeleteLabels(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto &tracks = *project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
if( selectedRegion.isPoint() )
|
||||
|
@ -452,7 +452,7 @@ void OnSilenceLabels(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &tracks = *project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
if( selectedRegion.isPoint() )
|
||||
|
@ -473,7 +473,7 @@ void OnCopyLabels(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &tracks = *project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
if( selectedRegion.isPoint() )
|
||||
|
@ -492,7 +492,7 @@ void OnCopyLabels(const CommandContext &context)
|
|||
void OnSplitLabels(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto &tracks = *project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
EditByLabel( tracks, selectedRegion, &WaveTrack::Split, false );
|
||||
|
@ -510,7 +510,7 @@ void OnSplitLabels(const CommandContext &context)
|
|||
void OnJoinLabels(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto &tracks = *project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
if( selectedRegion.isPoint() )
|
||||
|
@ -531,7 +531,7 @@ void OnJoinLabels(const CommandContext &context)
|
|||
void OnDisjoinLabels(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto &tracks = *project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
if( selectedRegion.isPoint() )
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "../Menus.h"
|
||||
#include "../Prefs.h"
|
||||
#include "../Project.h"
|
||||
#include "../Track.h"
|
||||
#include "../TrackPanel.h"
|
||||
#include "../TrackPanelAx.h"
|
||||
#include "../commands/CommandContext.h"
|
||||
|
@ -83,13 +84,13 @@ void DoPrevTrack(
|
|||
AudacityProject &project, bool shift, bool circularTrackNavigation )
|
||||
{
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectionState = project.GetSelectionState();
|
||||
|
||||
Track* t = trackPanel->GetFocusedTrack();
|
||||
if( t == NULL ) // if there isn't one, focus on last
|
||||
{
|
||||
t = *tracks->Any().rbegin();
|
||||
t = *tracks.Any().rbegin();
|
||||
trackPanel->SetFocusedTrack( t );
|
||||
trackPanel->EnsureVisible( t );
|
||||
project.ModifyState(false);
|
||||
|
@ -101,14 +102,14 @@ void DoPrevTrack(
|
|||
bool pSelected = false;
|
||||
if( shift )
|
||||
{
|
||||
p = * -- tracks->FindLeader( t ); // Get previous track
|
||||
p = * -- tracks.FindLeader( t ); // Get previous track
|
||||
if( p == NULL ) // On first track
|
||||
{
|
||||
// JKC: wxBell() is probably for accessibility, so a blind
|
||||
// user knows they were at the top track.
|
||||
wxBell();
|
||||
if( circularTrackNavigation )
|
||||
p = *tracks->Any().rbegin();
|
||||
p = *tracks.Any().rbegin();
|
||||
else
|
||||
{
|
||||
trackPanel->EnsureVisible( t );
|
||||
|
@ -157,13 +158,13 @@ void DoPrevTrack(
|
|||
}
|
||||
else
|
||||
{
|
||||
p = * -- tracks->FindLeader( t ); // Get previous track
|
||||
p = * -- tracks.FindLeader( t ); // Get previous track
|
||||
if( p == NULL ) // On first track so stay there?
|
||||
{
|
||||
wxBell();
|
||||
if( circularTrackNavigation )
|
||||
{
|
||||
auto range = tracks->Leaders();
|
||||
auto range = tracks.Leaders();
|
||||
p = * range.rbegin(); // null if range is empty
|
||||
trackPanel->SetFocusedTrack( p ); // Wrap to the last track
|
||||
trackPanel->EnsureVisible( p );
|
||||
|
@ -193,13 +194,13 @@ void DoNextTrack(
|
|||
AudacityProject &project, bool shift, bool circularTrackNavigation )
|
||||
{
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectionState = project.GetSelectionState();
|
||||
|
||||
auto t = trackPanel->GetFocusedTrack(); // Get currently focused track
|
||||
if( t == NULL ) // if there isn't one, focus on first
|
||||
{
|
||||
t = *tracks->Any().begin();
|
||||
t = *tracks.Any().begin();
|
||||
trackPanel->SetFocusedTrack( t );
|
||||
trackPanel->EnsureVisible( t );
|
||||
project.ModifyState(false);
|
||||
|
@ -208,12 +209,12 @@ void DoNextTrack(
|
|||
|
||||
if( shift )
|
||||
{
|
||||
auto n = * ++ tracks->FindLeader( t ); // Get next track
|
||||
auto n = * ++ tracks.FindLeader( t ); // Get next track
|
||||
if( n == NULL ) // On last track so stay there
|
||||
{
|
||||
wxBell();
|
||||
if( circularTrackNavigation )
|
||||
n = *tracks->Any().begin();
|
||||
n = *tracks.Any().begin();
|
||||
else
|
||||
{
|
||||
trackPanel->EnsureVisible( t );
|
||||
|
@ -261,13 +262,13 @@ void DoNextTrack(
|
|||
}
|
||||
else
|
||||
{
|
||||
auto n = * ++ tracks->FindLeader( t ); // Get next track
|
||||
auto n = * ++ tracks.FindLeader( t ); // Get next track
|
||||
if( n == NULL ) // On last track so stay there
|
||||
{
|
||||
wxBell();
|
||||
if( circularTrackNavigation )
|
||||
{
|
||||
n = *tracks->Any().begin();
|
||||
n = *tracks.Any().begin();
|
||||
trackPanel->SetFocusedTrack( n ); // Wrap to the first track
|
||||
trackPanel->EnsureVisible( n );
|
||||
project.ModifyState(false);
|
||||
|
@ -456,13 +457,13 @@ void OnFirstTrack(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
Track *t = trackPanel->GetFocusedTrack();
|
||||
if (!t)
|
||||
return;
|
||||
|
||||
auto f = *tracks->Any().begin();
|
||||
auto f = *tracks.Any().begin();
|
||||
if (t != f)
|
||||
{
|
||||
trackPanel->SetFocusedTrack(f);
|
||||
|
@ -475,13 +476,13 @@ void OnLastTrack(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
Track *t = trackPanel->GetFocusedTrack();
|
||||
if (!t)
|
||||
return;
|
||||
|
||||
auto l = *tracks->Any().rbegin();
|
||||
auto l = *tracks.Any().rbegin();
|
||||
if (t != l)
|
||||
{
|
||||
trackPanel->SetFocusedTrack(l);
|
||||
|
|
|
@ -393,7 +393,7 @@ bool DoEffect(
|
|||
const PluginID & ID, const CommandContext &context, unsigned flags )
|
||||
{
|
||||
AudacityProject &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto trackFactory = project.GetTrackFactory();
|
||||
auto rate = project.GetRate();
|
||||
|
@ -417,7 +417,7 @@ bool DoEffect(
|
|||
|
||||
MissingAliasFilesDialog::SetShouldShow(true);
|
||||
|
||||
auto nTracksOriginally = project.GetTrackCount();
|
||||
auto nTracksOriginally = tracks.size();
|
||||
wxWindow *focus = wxWindow::FindFocus();
|
||||
wxWindow *parent = nullptr;
|
||||
if (focus != nullptr) {
|
||||
|
@ -438,7 +438,7 @@ bool DoEffect(
|
|||
|
||||
int count = 0;
|
||||
bool clean = true;
|
||||
for (auto t : tracks->Selected< const WaveTrack >()) {
|
||||
for (auto t : tracks.Selected< const WaveTrack >()) {
|
||||
if (t->GetEndTime() != 0.0)
|
||||
clean = false;
|
||||
count++;
|
||||
|
@ -447,7 +447,7 @@ bool DoEffect(
|
|||
EffectManager & em = EffectManager::Get();
|
||||
|
||||
success = em.DoEffect(ID, &project, rate,
|
||||
tracks, trackFactory, &selectedRegion,
|
||||
&tracks, trackFactory, &selectedRegion,
|
||||
(flags & kConfigured) == 0);
|
||||
|
||||
if (!success)
|
||||
|
@ -497,7 +497,7 @@ bool DoEffect(
|
|||
// New tracks added? Scroll them into view so that user sees them.
|
||||
// Don't care what track type. An analyser might just have added a
|
||||
// Label track and we want to see it.
|
||||
if( project.GetTrackCount() > nTracksOriginally ){
|
||||
if( tracks.size() > nTracksOriginally ){
|
||||
// 0.0 is min scroll position, 1.0 is max scroll position.
|
||||
trackPanel->VerticalScroll( 1.0 );
|
||||
} else {
|
||||
|
|
|
@ -22,18 +22,17 @@ namespace {
|
|||
void DoSelectTimeAndTracks
|
||||
(AudacityProject &project, bool bAllTime, bool bAllTracks)
|
||||
{
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
if( bAllTime )
|
||||
selectedRegion.setTimes(
|
||||
tracks->GetMinOffset(), tracks->GetEndTime());
|
||||
tracks.GetMinOffset(), tracks.GetEndTime());
|
||||
|
||||
if( bAllTracks ) {
|
||||
for (auto t : tracks->Any()){
|
||||
for (auto t : tracks.Any())
|
||||
t->SetSelected(true);
|
||||
}
|
||||
|
||||
project.ModifyState(false);
|
||||
trackPanel->Refresh(false);
|
||||
|
@ -45,19 +44,19 @@ void DoSelectTimeAndTracks
|
|||
void DoSelectTimeAndAudioTracks
|
||||
(AudacityProject &project, bool bAllTime, bool bAllTracks)
|
||||
{
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
if( bAllTime )
|
||||
selectedRegion.setTimes(
|
||||
tracks->GetMinOffset(), tracks->GetEndTime());
|
||||
tracks.GetMinOffset(), tracks.GetEndTime());
|
||||
|
||||
if( bAllTracks ) {
|
||||
// Unselect all tracks before selecting audio.
|
||||
for (auto t : tracks->Any())
|
||||
for (auto t : tracks.Any())
|
||||
t->SetSelected(false);
|
||||
for (auto t : tracks->Any<WaveTrack>())
|
||||
for (auto t : tracks.Any<WaveTrack>())
|
||||
t->SetSelected(true);
|
||||
|
||||
project.ModifyState(false);
|
||||
|
@ -67,13 +66,13 @@ void DoSelectTimeAndAudioTracks
|
|||
|
||||
void DoNextPeakFrequency(AudacityProject &project, bool up)
|
||||
{
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
|
||||
// Find the first selected wave track that is in a spectrogram view.
|
||||
const WaveTrack *pTrack {};
|
||||
for ( auto wt : tracks->Selected< const WaveTrack >() ) {
|
||||
for ( auto wt : tracks.Selected< const WaveTrack >() ) {
|
||||
const int display = wt->GetDisplay();
|
||||
if (display == WaveTrack::Spectrum) {
|
||||
pTrack = wt;
|
||||
|
@ -93,14 +92,14 @@ double NearestZeroCrossing
|
|||
(AudacityProject &project, double t0)
|
||||
{
|
||||
auto rate = project.GetRate();
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
// Window is 1/100th of a second.
|
||||
auto windowSize = size_t(std::max(1.0, rate / 100));
|
||||
Floats dist{ windowSize, true };
|
||||
|
||||
int nTracks = 0;
|
||||
for (auto one : tracks->Selected< const WaveTrack >()) {
|
||||
for (auto one : tracks.Selected< const WaveTrack >()) {
|
||||
auto oneWindowSize = size_t(std::max(1.0, one->GetRate() / 100));
|
||||
Floats oneDist{ oneWindowSize };
|
||||
auto s = one->TimeToLongSamples(t0);
|
||||
|
@ -268,14 +267,14 @@ void MoveWhenAudioInactive
|
|||
{
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto ruler = project.GetRulerPanel();
|
||||
|
||||
// If TIME_UNIT_SECONDS, snap-to will be off.
|
||||
int snapToTime = project.GetSnapTo();
|
||||
const double t0 = viewInfo.selectedRegion.t0();
|
||||
const double end = std::max(
|
||||
tracks->GetEndTime(),
|
||||
tracks.GetEndTime(),
|
||||
trackPanel->GetScreenEndTime());
|
||||
|
||||
// Move the cursor
|
||||
|
@ -321,7 +320,7 @@ SelectionOperation operation)
|
|||
{
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
if( operation == CURSOR_MOVE )
|
||||
{
|
||||
|
@ -333,7 +332,7 @@ SelectionOperation operation)
|
|||
const double t0 = viewInfo.selectedRegion.t0();
|
||||
const double t1 = viewInfo.selectedRegion.t1();
|
||||
const double end = std::max(
|
||||
tracks->GetEndTime(),
|
||||
tracks.GetEndTime(),
|
||||
trackPanel->GetScreenEndTime());
|
||||
|
||||
// Is it t0 or t1 moving?
|
||||
|
@ -419,7 +418,7 @@ void DoBoundaryMove(AudacityProject &project, int step, SeekInfo &info)
|
|||
{
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
// step is negative, then is moving left. step positive, moving right.
|
||||
// Move the left/right selection boundary, to expand the selection
|
||||
|
@ -454,7 +453,7 @@ void DoBoundaryMove(AudacityProject &project, int step, SeekInfo &info)
|
|||
const double t0 = viewInfo.selectedRegion.t0();
|
||||
const double t1 = viewInfo.selectedRegion.t1();
|
||||
const double end = std::max(
|
||||
tracks->GetEndTime(),
|
||||
tracks.GetEndTime(),
|
||||
trackPanel->GetScreenEndTime());
|
||||
|
||||
double newT = viewInfo.OffsetTimeByPixels( bMoveT0 ? t0 : t1, pixels);
|
||||
|
@ -486,7 +485,8 @@ namespace SelectActions {
|
|||
|
||||
void SelectNone( AudacityProject &project )
|
||||
{
|
||||
for (auto t : project.GetTracks()->Any())
|
||||
auto &tracks = TrackList::Get( project );
|
||||
for (auto t : tracks.Any())
|
||||
t->SetSelected(false);
|
||||
|
||||
project.GetTrackPanel()->Refresh(false);
|
||||
|
@ -505,15 +505,15 @@ void SelectAllIfNone( AudacityProject &project )
|
|||
void DoListSelection
|
||||
(AudacityProject &project, Track *t, bool shift, bool ctrl, bool modifyState)
|
||||
{
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectionState = project.GetSelectionState();
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto isSyncLocked = project.IsSyncLocked();
|
||||
|
||||
selectionState.HandleListSelection
|
||||
( *tracks, viewInfo, *t,
|
||||
shift, ctrl, isSyncLocked );
|
||||
selectionState.HandleListSelection(
|
||||
tracks, viewInfo, *t,
|
||||
shift, ctrl, isSyncLocked );
|
||||
|
||||
if (! ctrl )
|
||||
trackPanel->SetFocusedTrack(t);
|
||||
|
@ -539,11 +539,11 @@ void DoSelectAllAudio(AudacityProject &project)
|
|||
// without this function selecting all tracks.
|
||||
void DoSelectSomething(AudacityProject &project)
|
||||
{
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
bool bTime = selectedRegion.isPoint();
|
||||
bool bTracks = tracks->Selected().empty();
|
||||
bool bTracks = tracks.Selected().empty();
|
||||
|
||||
if( bTime || bTracks )
|
||||
DoSelectTimeAndTracks( project, bTime, bTracks );
|
||||
|
@ -581,11 +581,11 @@ void OnSelectAllTracks(const CommandContext &context)
|
|||
void OnSelectSyncLockSel(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
|
||||
bool selected = false;
|
||||
for (auto t : tracks->Any()
|
||||
for (auto t : tracks.Any()
|
||||
+ &Track::IsSyncLockSelected - &Track::IsSelected) {
|
||||
t->SetSelected(true);
|
||||
selected = true;
|
||||
|
@ -679,13 +679,13 @@ void OnSetRightSelection(const CommandContext &context)
|
|||
void OnSelectStartCursor(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
double kWayOverToRight = std::numeric_limits<double>::max();
|
||||
|
||||
auto range = tracks->Selected();
|
||||
auto range = tracks.Selected();
|
||||
if ( ! range )
|
||||
return;
|
||||
|
||||
|
@ -705,13 +705,13 @@ void OnSelectStartCursor(const CommandContext &context)
|
|||
void OnSelectCursorEnd(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
double kWayOverToLeft = std::numeric_limits<double>::lowest();
|
||||
|
||||
auto range = tracks->Selected();
|
||||
auto range = tracks.Selected();
|
||||
if ( ! range )
|
||||
return;
|
||||
|
||||
|
@ -732,10 +732,10 @@ void OnSelectTrackStartToEnd(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
|
||||
auto range = tracks->Selected();
|
||||
auto range = tracks.Selected();
|
||||
double maxEndOffset = range.max( &Track::GetEndTime );
|
||||
double minOffset = range.min( &Track::GetStartTime );
|
||||
|
||||
|
@ -976,13 +976,13 @@ void OnCursorSelEnd(const CommandContext &context)
|
|||
void OnCursorTrackStart(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
double kWayOverToRight = std::numeric_limits<double>::max();
|
||||
|
||||
auto trackRange = tracks->Selected();
|
||||
auto trackRange = tracks.Selected();
|
||||
if (trackRange.empty())
|
||||
// This should have been prevented by command manager
|
||||
return;
|
||||
|
@ -1003,13 +1003,13 @@ void OnCursorTrackStart(const CommandContext &context)
|
|||
void OnCursorTrackEnd(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
double kWayOverToLeft = std::numeric_limits<double>::lowest();
|
||||
|
||||
auto trackRange = tracks->Selected();
|
||||
auto trackRange = tracks.Selected();
|
||||
if (trackRange.empty())
|
||||
// This should have been prevented by command manager
|
||||
return;
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace {
|
|||
void DoMixAndRender
|
||||
(AudacityProject &project, bool toNewTrack)
|
||||
{
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackFactory = project.GetTrackFactory();
|
||||
auto rate = project.GetRate();
|
||||
auto defaultFormat = project.GetDefaultFormat();
|
||||
|
@ -47,12 +47,12 @@ void DoMixAndRender
|
|||
|
||||
WaveTrack::Holder uNewLeft, uNewRight;
|
||||
::MixAndRender(
|
||||
tracks, trackFactory, rate, defaultFormat, 0.0, 0.0, uNewLeft, uNewRight);
|
||||
&tracks, trackFactory, rate, defaultFormat, 0.0, 0.0, uNewLeft, uNewRight);
|
||||
|
||||
if (uNewLeft) {
|
||||
// Remove originals, get stats on what tracks were mixed
|
||||
|
||||
auto trackRange = tracks->Selected< WaveTrack >();
|
||||
auto trackRange = tracks.Selected< WaveTrack >();
|
||||
auto selectedCount = (trackRange + &Track::IsLeader).size();
|
||||
wxString firstName;
|
||||
if (selectedCount > 0)
|
||||
|
@ -60,18 +60,18 @@ void DoMixAndRender
|
|||
if (!toNewTrack) {
|
||||
// Beware iterator invalidation!
|
||||
for (auto &it = trackRange.first, &end = trackRange.second; it != end;)
|
||||
tracks->Remove( *it++ );
|
||||
tracks.Remove( *it++ );
|
||||
}
|
||||
|
||||
// Add NEW tracks
|
||||
|
||||
auto pNewLeft = tracks->Add( uNewLeft );
|
||||
auto pNewLeft = tracks.Add( uNewLeft );
|
||||
decltype(pNewLeft) pNewRight{};
|
||||
if (uNewRight)
|
||||
pNewRight = tracks->Add( uNewRight );
|
||||
pNewRight = tracks.Add( uNewRight );
|
||||
|
||||
// Do this only after adding tracks to the list
|
||||
tracks->GroupChannels(*pNewLeft, pNewRight ? 2 : 1);
|
||||
tracks.GroupChannels(*pNewLeft, pNewRight ? 2 : 1);
|
||||
|
||||
// If we're just rendering (not mixing), keep the track name the same
|
||||
if (selectedCount==1) {
|
||||
|
@ -110,10 +110,10 @@ void DoMixAndRender
|
|||
|
||||
void DoPanTracks(AudacityProject &project, float PanValue)
|
||||
{
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
// count selected wave tracks
|
||||
const auto range = tracks->Any< WaveTrack >();
|
||||
const auto range = tracks.Any< WaveTrack >();
|
||||
const auto selectedRange = range + &Track::IsSelected;
|
||||
auto count = selectedRange.size();
|
||||
|
||||
|
@ -153,7 +153,7 @@ const size_t kAlignLabelsCount = alignLabels.end() - alignLabels.begin();
|
|||
void DoAlign
|
||||
(AudacityProject &project, int index, bool moveSel)
|
||||
{
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
|
||||
wxString action;
|
||||
|
@ -161,8 +161,8 @@ void DoAlign
|
|||
double delta = 0.0;
|
||||
double newPos = -1.0;
|
||||
|
||||
auto channelRange = tracks->Selected< AudioTrack >();
|
||||
auto trackRange = tracks->SelectedLeaders< AudioTrack >();
|
||||
auto channelRange = tracks.Selected< AudioTrack >();
|
||||
auto trackRange = tracks.SelectedLeaders< AudioTrack >();
|
||||
|
||||
auto FindOffset = []( const Track *pTrack ) {
|
||||
return TrackList::Channels(pTrack).min( &Track::GetOffset ); };
|
||||
|
@ -255,7 +255,7 @@ void DoAlign
|
|||
|
||||
if ((unsigned)index >= kAlignLabelsCount) {
|
||||
// This is an alignLabelsNoSync command.
|
||||
for (auto t : tracks->SelectedLeaders< AudioTrack >()) {
|
||||
for (auto t : tracks.SelectedLeaders< AudioTrack >()) {
|
||||
// This shifts different tracks in different ways, so no sync-lock
|
||||
// move.
|
||||
// Only align Wave and Note tracks end to end.
|
||||
|
@ -278,7 +278,7 @@ void DoAlign
|
|||
|
||||
if (delta != 0.0) {
|
||||
// For a fixed-distance shift move sync-lock selected tracks also.
|
||||
for (auto t : tracks->Any() + &Track::IsSelectedOrSyncLockSelected )
|
||||
for (auto t : tracks.Any() + &Track::IsSelectedOrSyncLockSelected )
|
||||
t->SetOffset(t->GetOffset() + delta);
|
||||
}
|
||||
|
||||
|
@ -471,14 +471,14 @@ void DoSortTracks( AudacityProject &project, int flags )
|
|||
// This one place outside of TrackList where we must use undisguised
|
||||
// std::list iterators! Avoid this elsewhere!
|
||||
std::vector<TrackNodePointer> arr;
|
||||
auto pTracks = project.GetTracks();
|
||||
arr.reserve(pTracks->size());
|
||||
auto &tracks = TrackList::Get( project );
|
||||
arr.reserve(tracks.size());
|
||||
|
||||
// First find the permutation.
|
||||
// This routine, very unusually, deals with the underlying stl list
|
||||
// iterators, not with TrackIter! Dangerous!
|
||||
for (auto iter = pTracks->ListOfTracks::begin(),
|
||||
end = pTracks->ListOfTracks::end(); iter != end; ++iter) {
|
||||
for (auto iter = tracks.ListOfTracks::begin(),
|
||||
end = tracks.ListOfTracks::end(); iter != end; ++iter) {
|
||||
const auto &track = *iter;
|
||||
if ( !track->IsLeader() )
|
||||
// keep channels contiguous
|
||||
|
@ -515,11 +515,11 @@ void DoSortTracks( AudacityProject &project, int flags )
|
|||
ndx += channels.size();
|
||||
}
|
||||
}
|
||||
arr.insert(arr.begin() + ndx, TrackNodePointer{iter, pTracks});
|
||||
arr.insert(arr.begin() + ndx, TrackNodePointer{iter, &tracks});
|
||||
}
|
||||
|
||||
// Now apply the permutation
|
||||
pTracks->Permute(arr);
|
||||
tracks.Permute(arr);
|
||||
}
|
||||
|
||||
void SetTrackGain(AudacityProject &project, WaveTrack * wt, LWSlider * slider)
|
||||
|
@ -556,29 +556,29 @@ namespace TrackActions {
|
|||
|
||||
void DoRemoveTracks( AudacityProject &project )
|
||||
{
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
|
||||
std::vector<Track*> toRemove;
|
||||
for (auto track : tracks->Selected())
|
||||
for (auto track : tracks.Selected())
|
||||
toRemove.push_back(track);
|
||||
|
||||
// Capture the track preceding the first removed track
|
||||
Track *f{};
|
||||
if (!toRemove.empty()) {
|
||||
auto found = tracks->Find(toRemove[0]);
|
||||
auto found = tracks.Find(toRemove[0]);
|
||||
f = *--found;
|
||||
}
|
||||
|
||||
for (auto track : toRemove)
|
||||
tracks->Remove(track);
|
||||
tracks.Remove(track);
|
||||
|
||||
if (!f)
|
||||
// try to use the last track
|
||||
f = *tracks->Any().rbegin();
|
||||
f = *tracks.Any().rbegin();
|
||||
if (f) {
|
||||
// Try to use the first track after the removal
|
||||
auto found = tracks->FindLeader(f);
|
||||
auto found = tracks.FindLeader(f);
|
||||
auto t = *++found;
|
||||
if (t)
|
||||
f = t;
|
||||
|
@ -596,7 +596,7 @@ void DoRemoveTracks( AudacityProject &project )
|
|||
|
||||
void DoTrackMute(AudacityProject &project, Track *t, bool exclusive)
|
||||
{
|
||||
auto &tracks = *project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &trackPanel = *project.GetTrackPanel();
|
||||
|
||||
// Whatever t is, replace with lead channel
|
||||
|
@ -645,7 +645,7 @@ void DoTrackMute(AudacityProject &project, Track *t, bool exclusive)
|
|||
|
||||
void DoTrackSolo(AudacityProject &project, Track *t, bool exclusive)
|
||||
{
|
||||
auto &tracks = *project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &trackPanel = *project.GetTrackPanel();
|
||||
|
||||
// Whatever t is, replace with lead channel
|
||||
|
@ -697,7 +697,7 @@ void DoTrackSolo(AudacityProject &project, Track *t, bool exclusive)
|
|||
|
||||
void DoRemoveTrack(AudacityProject &project, Track * toRemove)
|
||||
{
|
||||
auto &tracks = *project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &trackPanel = *project.GetTrackPanel();
|
||||
|
||||
// If it was focused, then NEW focus is the next or, if
|
||||
|
@ -738,7 +738,7 @@ void DoMoveTrack
|
|||
(AudacityProject &project, Track* target, MoveChoice choice)
|
||||
{
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
wxString longDesc, shortDesc;
|
||||
|
||||
|
@ -751,8 +751,8 @@ void DoMoveTrack
|
|||
|
||||
// TODO: write TrackList::Rotate to do this in one step and avoid emitting
|
||||
// an event for each swap
|
||||
while (tracks->CanMoveUp(target))
|
||||
tracks->Move(target, true);
|
||||
while (tracks.CanMoveUp(target))
|
||||
tracks.Move(target, true);
|
||||
|
||||
break;
|
||||
case OnMoveBottomID:
|
||||
|
@ -762,14 +762,14 @@ void DoMoveTrack
|
|||
|
||||
// TODO: write TrackList::Rotate to do this in one step and avoid emitting
|
||||
// an event for each swap
|
||||
while (tracks->CanMoveDown(target))
|
||||
tracks->Move(target, false);
|
||||
while (tracks.CanMoveDown(target))
|
||||
tracks.Move(target, false);
|
||||
|
||||
break;
|
||||
default:
|
||||
bool bUp = (OnMoveUpID == choice);
|
||||
|
||||
tracks->Move(target, bUp);
|
||||
tracks.Move(target, bUp);
|
||||
longDesc =
|
||||
/* i18n-hint: Past tense of 'to move', as in 'moved audio track up'.*/
|
||||
bUp? _("Moved '%s' Up")
|
||||
|
@ -794,13 +794,13 @@ struct Handler : CommandHandlerObject {
|
|||
void OnNewWaveTrack(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackFactory = project.GetTrackFactory();
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto defaultFormat = project.GetDefaultFormat();
|
||||
auto rate = project.GetRate();
|
||||
|
||||
auto t = tracks->Add(trackFactory->NewWaveTrack(defaultFormat, rate));
|
||||
auto t = tracks.Add(trackFactory->NewWaveTrack(defaultFormat, rate));
|
||||
SelectActions::SelectNone( project );
|
||||
|
||||
t->SetSelected(true);
|
||||
|
@ -814,7 +814,7 @@ void OnNewWaveTrack(const CommandContext &context)
|
|||
void OnNewStereoTrack(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackFactory = project.GetTrackFactory();
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto defaultFormat = project.GetDefaultFormat();
|
||||
|
@ -822,13 +822,13 @@ void OnNewStereoTrack(const CommandContext &context)
|
|||
|
||||
SelectActions::SelectNone( project );
|
||||
|
||||
auto left = tracks->Add(trackFactory->NewWaveTrack(defaultFormat, rate));
|
||||
auto left = tracks.Add(trackFactory->NewWaveTrack(defaultFormat, rate));
|
||||
left->SetSelected(true);
|
||||
|
||||
auto right = tracks->Add(trackFactory->NewWaveTrack(defaultFormat, rate));
|
||||
auto right = tracks.Add(trackFactory->NewWaveTrack(defaultFormat, rate));
|
||||
right->SetSelected(true);
|
||||
|
||||
tracks->GroupChannels(*left, 2);
|
||||
tracks.GroupChannels(*left, 2);
|
||||
|
||||
project.PushState(_("Created new stereo audio track"), _("New Track"));
|
||||
|
||||
|
@ -839,11 +839,11 @@ void OnNewStereoTrack(const CommandContext &context)
|
|||
void OnNewLabelTrack(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackFactory = project.GetTrackFactory();
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
|
||||
auto t = tracks->Add(trackFactory->NewLabelTrack());
|
||||
auto t = tracks.Add(trackFactory->NewLabelTrack());
|
||||
|
||||
SelectActions::SelectNone( project );
|
||||
|
||||
|
@ -858,16 +858,16 @@ void OnNewLabelTrack(const CommandContext &context)
|
|||
void OnNewTimeTrack(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackFactory = project.GetTrackFactory();
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
|
||||
if (tracks->GetTimeTrack()) {
|
||||
if (tracks.GetTimeTrack()) {
|
||||
AudacityMessageBox(_("This version of Audacity only allows one time track for each project window."));
|
||||
return;
|
||||
}
|
||||
|
||||
auto t = tracks->AddToHead(trackFactory->NewTimeTrack());
|
||||
auto t = tracks.AddToHead(trackFactory->NewTimeTrack());
|
||||
|
||||
SelectActions::SelectNone( project );
|
||||
|
||||
|
@ -903,7 +903,7 @@ void OnResample(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto projectRate = project.GetRate();
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &undoManager = *project.GetUndoManager();
|
||||
|
||||
int newRate;
|
||||
|
@ -974,7 +974,7 @@ void OnResample(const CommandContext &context)
|
|||
|
||||
int ndx = 0;
|
||||
auto flags = UndoPush::AUTOSAVE;
|
||||
for (auto wt : tracks->Selected< WaveTrack >())
|
||||
for (auto wt : tracks.Selected< WaveTrack >())
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
|
@ -1013,11 +1013,11 @@ void OnRemoveTracks(const CommandContext &context)
|
|||
void OnMuteAllTracks(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto soloSimple = project.IsSoloSimple();
|
||||
auto soloNone = project.IsSoloNone();
|
||||
|
||||
for (auto pt : tracks->Any<PlayableTrack>())
|
||||
for (auto pt : tracks.Any<PlayableTrack>())
|
||||
{
|
||||
pt->SetMute(true);
|
||||
if (soloSimple || soloNone)
|
||||
|
@ -1031,11 +1031,11 @@ void OnMuteAllTracks(const CommandContext &context)
|
|||
void OnUnmuteAllTracks(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto soloSimple = project.IsSoloSimple();
|
||||
auto soloNone = project.IsSoloNone();
|
||||
|
||||
for (auto pt : tracks->Any<PlayableTrack>())
|
||||
for (auto pt : tracks.Any<PlayableTrack>())
|
||||
{
|
||||
pt->SetMute(false);
|
||||
if (soloSimple || soloNone)
|
||||
|
@ -1399,10 +1399,10 @@ void OnTrackMoveUp(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
Track *const focusedTrack = trackPanel->GetFocusedTrack();
|
||||
if (tracks->CanMoveUp(focusedTrack)) {
|
||||
if (tracks.CanMoveUp(focusedTrack)) {
|
||||
DoMoveTrack(project, focusedTrack, OnMoveUpID);
|
||||
trackPanel->Refresh(false);
|
||||
}
|
||||
|
@ -1412,10 +1412,10 @@ void OnTrackMoveDown(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
Track *const focusedTrack = trackPanel->GetFocusedTrack();
|
||||
if (tracks->CanMoveDown(focusedTrack)) {
|
||||
if (tracks.CanMoveDown(focusedTrack)) {
|
||||
DoMoveTrack(project, focusedTrack, OnMoveDownID);
|
||||
trackPanel->Refresh(false);
|
||||
}
|
||||
|
@ -1425,10 +1425,10 @@ void OnTrackMoveTop(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
Track *const focusedTrack = trackPanel->GetFocusedTrack();
|
||||
if (tracks->CanMoveUp(focusedTrack)) {
|
||||
if (tracks.CanMoveUp(focusedTrack)) {
|
||||
DoMoveTrack(project, focusedTrack, OnMoveTopID);
|
||||
trackPanel->Refresh(false);
|
||||
}
|
||||
|
@ -1438,10 +1438,10 @@ void OnTrackMoveBottom(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
Track *const focusedTrack = trackPanel->GetFocusedTrack();
|
||||
if (tracks->CanMoveDown(focusedTrack)) {
|
||||
if (tracks.CanMoveDown(focusedTrack)) {
|
||||
DoMoveTrack(project, focusedTrack, OnMoveBottomID);
|
||||
trackPanel->Refresh(false);
|
||||
}
|
||||
|
|
|
@ -132,11 +132,11 @@ void DoPlayStop(const CommandContext &context)
|
|||
|
||||
void DoMoveToLabel(AudacityProject &project, bool next)
|
||||
{
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
|
||||
// Find the number of label tracks, and ptr to last track found
|
||||
auto trackRange = tracks->Any<LabelTrack>();
|
||||
auto trackRange = tracks.Any<LabelTrack>();
|
||||
auto lt = *trackRange.rbegin();
|
||||
auto nLabelTrack = trackRange.size();
|
||||
|
||||
|
@ -146,7 +146,7 @@ void DoMoveToLabel(AudacityProject &project, bool next)
|
|||
else if (nLabelTrack > 1) {
|
||||
// find first label track, if any, starting at the focused track
|
||||
lt =
|
||||
*tracks->Find(trackPanel->GetFocusedTrack()).Filter<LabelTrack>();
|
||||
*tracks.Find(trackPanel->GetFocusedTrack()).Filter<LabelTrack>();
|
||||
if (!lt)
|
||||
trackPanel->MessageForScreenReader(
|
||||
_("no label track at or below focused track"));
|
||||
|
@ -295,12 +295,12 @@ void DoRecord( AudacityProject &project )
|
|||
|
||||
void DoLockPlayRegion( AudacityProject &project )
|
||||
{
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto ruler = project.GetRulerPanel();
|
||||
|
||||
double start, end;
|
||||
project.GetPlayRegion(&start, &end);
|
||||
if (start >= tracks->GetEndTime()) {
|
||||
if (start >= tracks.GetEndTime()) {
|
||||
AudacityMessageBox(_("Cannot lock region beyond\nend of project."),
|
||||
_("Error"));
|
||||
}
|
||||
|
@ -416,7 +416,7 @@ void OnTimerRecord(const CommandContext &context)
|
|||
// preventing issues surrounding "dirty" projects when Automatic Save/Export
|
||||
// is used in Timer Recording.
|
||||
if ((undoManager.UnsavedChanges()) &&
|
||||
(project.GetTracks()->Any() || project.EmptyCanBeDirty())) {
|
||||
(TrackList::Get( project ).Any() || project.EmptyCanBeDirty())) {
|
||||
AudacityMessageBox(_("Timer Recording cannot be used while you have unsaved changes.\n\nPlease save or close this project and try again."),
|
||||
_("Timer Recording"),
|
||||
wxICON_INFORMATION | wxOK);
|
||||
|
@ -435,7 +435,7 @@ void OnTimerRecord(const CommandContext &context)
|
|||
int modalResult = dialog.ShowModal();
|
||||
if (modalResult == wxID_CANCEL)
|
||||
{
|
||||
// Cancelled before recording - don't need to do anyting.
|
||||
// Cancelled before recording - don't need to do anything.
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -589,7 +589,8 @@ void OnPunchAndRoll(const CommandContext &context)
|
|||
const auto duplex = ControlToolBar::UseDuplex();
|
||||
if (duplex)
|
||||
// play all
|
||||
transportTracks = GetAllPlaybackTracks(*project.GetTracks(), false, true);
|
||||
transportTracks =
|
||||
GetAllPlaybackTracks( TrackList::Get( project ), false, true);
|
||||
else
|
||||
// play recording tracks only
|
||||
std::copy(tracks.begin(), tracks.end(),
|
||||
|
|
|
@ -121,7 +121,7 @@ namespace ViewActions {
|
|||
|
||||
double GetZoomOfToFit( const AudacityProject &project )
|
||||
{
|
||||
const auto &tracks = *project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
const auto &viewInfo = project.GetViewInfo();
|
||||
const auto &trackPanel = *project.GetTrackPanel();
|
||||
|
||||
|
@ -143,10 +143,10 @@ double GetZoomOfToFit( const AudacityProject &project )
|
|||
void DoZoomFit(AudacityProject &project)
|
||||
{
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
const double start = viewInfo.bScrollBeyondZero
|
||||
? std::min(tracks->GetStartTime(), 0.0)
|
||||
? std::min(tracks.GetStartTime(), 0.0)
|
||||
: 0;
|
||||
|
||||
project.Zoom( GetZoomOfToFit( project ) );
|
||||
|
@ -156,10 +156,10 @@ void DoZoomFit(AudacityProject &project)
|
|||
void DoZoomFitV(AudacityProject &project)
|
||||
{
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
// Only nonminimized audio tracks will be resized
|
||||
auto range = tracks->Any<AudioTrack>() - &Track::GetMinimized;
|
||||
auto range = tracks.Any<AudioTrack>() - &Track::GetMinimized;
|
||||
auto count = range.size();
|
||||
if (count == 0)
|
||||
return;
|
||||
|
@ -171,7 +171,7 @@ void DoZoomFitV(AudacityProject &project)
|
|||
|
||||
// The height of minimized and non-audio tracks cannot be apportioned
|
||||
height -=
|
||||
tracks->Any().sum( &Track::GetHeight ) - range.sum( &Track::GetHeight );
|
||||
tracks.Any().sum( &Track::GetHeight ) - range.sum( &Track::GetHeight );
|
||||
|
||||
// Give each resized track the average of the remaining height
|
||||
height = height / count;
|
||||
|
@ -269,9 +269,9 @@ void OnAdvancedVZoom(const CommandContext &context)
|
|||
void OnCollapseAllTracks(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
for (auto t : tracks->Any())
|
||||
for (auto t : tracks.Any())
|
||||
t->SetMinimized(true);
|
||||
|
||||
project.ModifyState(true);
|
||||
|
@ -281,9 +281,9 @@ void OnCollapseAllTracks(const CommandContext &context)
|
|||
void OnExpandAllTracks(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto tracks = project.GetTracks();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
for (auto t : tracks->Any())
|
||||
for (auto t : tracks.Any())
|
||||
t->SetMinimized(false);
|
||||
|
||||
project.ModifyState(true);
|
||||
|
|
|
@ -175,7 +175,7 @@ void ODTask::DoSome(float amountWork)
|
|||
|
||||
bool ODTask::IsTaskAssociatedWithProject(AudacityProject* proj)
|
||||
{
|
||||
for (auto tr : proj->GetTracks()->Any<const WaveTrack>())
|
||||
for (auto tr : TrackList::Get( *proj ).Any<const WaveTrack>())
|
||||
{
|
||||
//go over all tracks in the project
|
||||
//look inside our task's track list for one that matches this projects one.
|
||||
|
|
|
@ -460,7 +460,7 @@ void ControlToolBar::EnableDisableButtons()
|
|||
bool busy = gAudioIO->IsBusy();
|
||||
|
||||
// Only interested in audio type tracks
|
||||
bool tracks = p && p->GetTracks()->Any<AudioTrack>(); // PRL: PlayableTrack ?
|
||||
bool tracks = p && TrackList::Get( *p ).Any<AudioTrack>(); // PRL: PlayableTrack ?
|
||||
|
||||
if (p) {
|
||||
TranscriptionToolBar *const playAtSpeedTB = p->GetTranscriptionToolBar();
|
||||
|
@ -596,19 +596,17 @@ int ControlToolBar::PlayPlayRegion(const SelectedRegion &selectedRegion,
|
|||
if (!p)
|
||||
return -1; // Should never happen, but...
|
||||
|
||||
TrackList *t = p->GetTracks();
|
||||
if (!t)
|
||||
return -1; // Should never happen, but...
|
||||
auto &tracks = TrackList::Get( *p );
|
||||
|
||||
mLastPlayMode = mode;
|
||||
|
||||
bool hasaudio;
|
||||
if (useMidi)
|
||||
hasaudio = ! p->GetTracks()->Any<PlayableTrack>().empty();
|
||||
hasaudio = ! tracks.Any<PlayableTrack>().empty();
|
||||
else
|
||||
hasaudio = ! p->GetTracks()->Any<WaveTrack>().empty();
|
||||
hasaudio = ! tracks.Any<WaveTrack>().empty();
|
||||
|
||||
double latestEnd = (playWhiteSpace)? t1 : t->GetEndTime();
|
||||
double latestEnd = (playWhiteSpace)? t1 : tracks.GetEndTime();
|
||||
|
||||
if (!hasaudio)
|
||||
return -1; // No need to continue without audio tracks
|
||||
|
@ -630,25 +628,25 @@ int ControlToolBar::PlayPlayRegion(const SelectedRegion &selectedRegion,
|
|||
}
|
||||
else {
|
||||
// loop the entire project
|
||||
t0 = t->GetStartTime();
|
||||
t1 = t->GetEndTime();
|
||||
t0 = tracks.GetStartTime();
|
||||
t1 = tracks.GetEndTime();
|
||||
}
|
||||
} else {
|
||||
// move t0 to valid range
|
||||
if (t0 < 0) {
|
||||
t0 = t->GetStartTime();
|
||||
t0 = tracks.GetStartTime();
|
||||
}
|
||||
else if (t0 > t->GetEndTime()) {
|
||||
t0 = t->GetEndTime();
|
||||
else if (t0 > tracks.GetEndTime()) {
|
||||
t0 = tracks.GetEndTime();
|
||||
}
|
||||
#if defined(EXPERIMENTAL_SEEK_BEHIND_CURSOR)
|
||||
else {
|
||||
init_seek = t0; //AC: init_seek is where playback will 'start'
|
||||
t0 = t->GetStartTime();
|
||||
t0 = tracks.GetStartTime();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
t1 = t->GetEndTime();
|
||||
t1 = tracks.GetEndTime();
|
||||
}
|
||||
else {
|
||||
// maybe t1 < t0, with backwards scrubbing for instance
|
||||
|
@ -698,7 +696,7 @@ int ControlToolBar::PlayPlayRegion(const SelectedRegion &selectedRegion,
|
|||
}
|
||||
*/
|
||||
token = gAudioIO->StartStream(
|
||||
GetAllPlaybackTracks(*t, false, useMidi),
|
||||
GetAllPlaybackTracks( tracks, false, useMidi ),
|
||||
t0, t1, options);
|
||||
}
|
||||
if (token != 0) {
|
||||
|
@ -920,10 +918,10 @@ WaveTrackArray ControlToolBar::ChooseExistingRecordingTracks(
|
|||
if (!strictRules && !selectedOnly)
|
||||
return {};
|
||||
|
||||
auto trackList = p->GetTracks();
|
||||
auto &trackList = TrackList::Get( *p );
|
||||
std::vector<unsigned> channelCounts;
|
||||
WaveTrackArray candidates;
|
||||
const auto range = trackList->Leaders<WaveTrack>();
|
||||
const auto range = trackList.Leaders<WaveTrack>();
|
||||
for ( auto candidate : selectedOnly ? range + &Track::IsSelected : range ) {
|
||||
// count channels in this track
|
||||
const auto channels = TrackList::Channels( candidate );
|
||||
|
@ -1000,7 +998,7 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt)
|
|||
WaveTrackArray existingTracks;
|
||||
|
||||
if (appendRecord) {
|
||||
const auto trackRange = p->GetTracks()->Any< const WaveTrack >();
|
||||
const auto trackRange = TrackList::Get( *p ).Any< const WaveTrack >();
|
||||
|
||||
// Try to find wave tracks to record into. (If any are selected,
|
||||
// try to choose only from them; else if wave tracks exist, may record into any.)
|
||||
|
@ -1030,7 +1028,7 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt)
|
|||
// playback.
|
||||
/* TODO: set up stereo tracks if that is how the user has set up
|
||||
* their preferences, and choose sample format based on prefs */
|
||||
transportTracks = GetAllPlaybackTracks(*p->GetTracks(), false, true);
|
||||
transportTracks = GetAllPlaybackTracks(TrackList::Get( *p ), false, true);
|
||||
for (const auto &wt : existingTracks) {
|
||||
auto end = transportTracks.playbackTracks.end();
|
||||
auto it = std::find(transportTracks.playbackTracks.begin(), end, wt);
|
||||
|
@ -1135,7 +1133,7 @@ bool ControlToolBar::DoRecord(AudacityProject &project,
|
|||
// Get a copy of the track to be appended, to be pushed into
|
||||
// undo history only later.
|
||||
auto pending = std::static_pointer_cast<WaveTrack>(
|
||||
p->GetTracks()->RegisterPendingChangedTrack(
|
||||
TrackList::Get( *p ).RegisterPendingChangedTrack(
|
||||
updater, wt.get() ) );
|
||||
|
||||
// End of current track is before or at recording start time.
|
||||
|
@ -1154,7 +1152,7 @@ bool ControlToolBar::DoRecord(AudacityProject &project,
|
|||
}
|
||||
transportTracks.captureTracks.push_back(pending);
|
||||
}
|
||||
p->GetTracks()->UpdatePendingTracks();
|
||||
TrackList::Get( *p ).UpdatePendingTracks();
|
||||
}
|
||||
|
||||
if( transportTracks.captureTracks.empty() )
|
||||
|
@ -1163,8 +1161,8 @@ bool ControlToolBar::DoRecord(AudacityProject &project,
|
|||
wxString defaultTrackName, defaultRecordingTrackName;
|
||||
|
||||
// Count the tracks.
|
||||
const auto trackList = p->GetTracks();
|
||||
auto numTracks = trackList->Leaders<const WaveTrack>().size();
|
||||
auto &trackList = TrackList::Get( *p );
|
||||
auto numTracks = trackList.Leaders< const WaveTrack >().size();
|
||||
|
||||
auto recordingChannels = std::max(1L, gPrefs->Read(wxT("/AudioIO/RecordChannels"), 2));
|
||||
|
||||
|
@ -1229,12 +1227,12 @@ bool ControlToolBar::DoRecord(AudacityProject &project,
|
|||
newTrack->SetMinimized(true);
|
||||
}
|
||||
|
||||
p->GetTracks()->RegisterPendingNewTrack( newTrack );
|
||||
TrackList::Get( *p ).RegisterPendingNewTrack( newTrack );
|
||||
transportTracks.captureTracks.push_back(newTrack);
|
||||
// Bug 1548. New track needs the focus.
|
||||
p->GetTrackPanel()->SetFocusedTrack( newTrack.get() );
|
||||
}
|
||||
p->GetTracks()->GroupChannels(*first, recordingChannels);
|
||||
TrackList::Get( *p ).GroupChannels(*first, recordingChannels);
|
||||
}
|
||||
|
||||
//Automated Input Level Adjustment Initialization
|
||||
|
@ -1341,7 +1339,7 @@ void ControlToolBar::SetupCutPreviewTracks(double WXUNUSED(playStart), double cu
|
|||
ClearCutPreviewTracks();
|
||||
AudacityProject *p = GetActiveProject();
|
||||
if (p) {
|
||||
auto trackRange = p->GetTracks()->Selected<const PlayableTrack>();
|
||||
auto trackRange = TrackList::Get( *p ).Selected< const PlayableTrack >();
|
||||
if( !trackRange.empty() ) {
|
||||
auto cutPreviewTracks = TrackList::Create();
|
||||
for (const auto track1 : trackRange) {
|
||||
|
@ -1501,11 +1499,11 @@ void ControlToolBar::StopScrolling()
|
|||
void ControlToolBar::CommitRecording()
|
||||
{
|
||||
const auto project = GetActiveProject();
|
||||
project->GetTracks()->ApplyPendingTracks();
|
||||
TrackList::Get( *project ).ApplyPendingTracks();
|
||||
}
|
||||
|
||||
void ControlToolBar::CancelRecording()
|
||||
{
|
||||
const auto project = GetActiveProject();
|
||||
project->GetTracks()->ClearPendingTracks();
|
||||
TrackList::Get( *project ).ClearPendingTracks();
|
||||
}
|
||||
|
|
|
@ -442,7 +442,7 @@ void TranscriptionToolBar::PlayAtSpeed(bool looped, bool cutPreview)
|
|||
// VariSpeed play reuses Scrubbing.
|
||||
bool bFixedSpeedPlay = !gPrefs->ReadBool(wxT("/AudioIO/VariSpeedPlay"), true);
|
||||
// Scrubbing doesn't support note tracks, but the fixed-speed method using time tracks does.
|
||||
if (p->GetTracks()->Any<NoteTrack>())
|
||||
if ( TrackList::Get( *p ).Any< NoteTrack >() )
|
||||
bFixedSpeedPlay = true;
|
||||
|
||||
// Scrubbing only supports straight through play.
|
||||
|
|
|
@ -13,7 +13,6 @@ Paul Licameli split from TrackPanel.cpp
|
|||
|
||||
#include "../../../HitTestResult.h"
|
||||
#include "../../../LabelTrack.h"
|
||||
#include "../../../Project.h"
|
||||
#include "../../../RefreshCode.h"
|
||||
#include "../../../TrackPanelMouseEvent.h"
|
||||
|
||||
|
@ -33,9 +32,9 @@ void LabelDefaultClickHandle::SaveState( AudacityProject *pProject )
|
|||
{
|
||||
mLabelState = std::make_shared<LabelState>();
|
||||
auto &pairs = mLabelState->mPairs;
|
||||
TrackList *const tracks = pProject->GetTracks();
|
||||
auto &tracks = TrackList::Get( *pProject );
|
||||
|
||||
for (auto lt : tracks->Any<LabelTrack>())
|
||||
for (auto lt : tracks.Any<LabelTrack>())
|
||||
pairs.push_back( std::make_pair(
|
||||
lt->SharedPointer<LabelTrack>(), lt->SaveFlags() ) );
|
||||
}
|
||||
|
@ -44,7 +43,7 @@ void LabelDefaultClickHandle::RestoreState( AudacityProject *pProject )
|
|||
{
|
||||
if ( mLabelState ) {
|
||||
for ( const auto &pair : mLabelState->mPairs )
|
||||
if (auto pLt = pProject->GetTracks()->Lock(pair.first))
|
||||
if (auto pLt = TrackList::Get( *pProject ).Lock(pair.first))
|
||||
pLt->RestoreFlags( pair.second );
|
||||
mLabelState.reset();
|
||||
}
|
||||
|
@ -62,7 +61,7 @@ UIHandle::Result LabelDefaultClickHandle::Click
|
|||
SaveState( pProject );
|
||||
|
||||
const auto pLT = evt.pCell.get();
|
||||
for (auto lt : pProject->GetTracks()->Any<LabelTrack>()) {
|
||||
for (auto lt : TrackList::Get( *pProject ).Any<LabelTrack>()) {
|
||||
if (pLT != lt) {
|
||||
lt->ResetFlags();
|
||||
lt->Unselect();
|
||||
|
|
|
@ -74,9 +74,9 @@ UIHandle::Result LabelTextHandle::Click
|
|||
auto result = LabelDefaultClickHandle::Click( evt, pProject );
|
||||
|
||||
auto &selectionState = pProject->GetSelectionState();
|
||||
TrackList *const tracks = pProject->GetTracks();
|
||||
auto &tracks = TrackList::Get( *pProject );
|
||||
mChanger =
|
||||
std::make_shared< SelectionStateChanger >( selectionState, *tracks );
|
||||
std::make_shared< SelectionStateChanger >( selectionState, tracks );
|
||||
|
||||
const wxMouseEvent &event = evt.event;
|
||||
ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
|
@ -89,13 +89,13 @@ UIHandle::Result LabelTextHandle::Click
|
|||
// IF the user clicked a label, THEN select all other tracks by Label
|
||||
|
||||
//do nothing if at least one other track is selected
|
||||
bool done = tracks->Selected().any_of(
|
||||
bool done = tracks.Selected().any_of(
|
||||
[&](const Track *pTrack){ return pTrack != pLT.get(); }
|
||||
);
|
||||
|
||||
if (!done) {
|
||||
//otherwise, select all tracks
|
||||
for (auto t : tracks->Any())
|
||||
for (auto t : tracks.Any())
|
||||
selectionState.SelectTrack( *t, true, true );
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ UIHandle::Result LabelTextHandle::Drag
|
|||
auto result = LabelDefaultClickHandle::Drag( evt, pProject );
|
||||
|
||||
const wxMouseEvent &event = evt.event;
|
||||
auto pLT = pProject->GetTracks()->Lock(mpLT);
|
||||
auto pLT = TrackList::Get( *pProject ).Lock(mpLT);
|
||||
if(pLT)
|
||||
pLT->HandleTextDragRelease(event);
|
||||
|
||||
|
@ -167,7 +167,7 @@ UIHandle::Result LabelTextHandle::Release
|
|||
}
|
||||
|
||||
const wxMouseEvent &event = evt.event;
|
||||
auto pLT = pProject->GetTracks()->Lock(mpLT);
|
||||
auto pLT = TrackList::Get( *pProject ).Lock(mpLT);
|
||||
if (pLT)
|
||||
pLT->HandleTextDragRelease(event);
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ UIHandle::Result NoteTrackButtonHandle::Release
|
|||
{
|
||||
using namespace RefreshCode;
|
||||
|
||||
auto pTrack = pProject->GetTracks()->Lock(mpTrack);
|
||||
auto pTrack = TrackList::Get( *pProject ).Lock(mpTrack);
|
||||
if (!pTrack)
|
||||
return Cancelled;
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ UIHandle::Result NoteTrackVZoomHandle::Drag
|
|||
(const TrackPanelMouseEvent &evt, AudacityProject *pProject)
|
||||
{
|
||||
using namespace RefreshCode;
|
||||
auto pTrack = pProject->GetTracks()->Lock(mpTrack);
|
||||
auto pTrack = TrackList::Get( *pProject ).Lock(mpTrack);
|
||||
if (!pTrack)
|
||||
return Cancelled;
|
||||
|
||||
|
@ -268,7 +268,7 @@ UIHandle::Result NoteTrackVZoomHandle::Release
|
|||
wxWindow *pParent)
|
||||
{
|
||||
using namespace RefreshCode;
|
||||
auto pTrack = pProject->GetTracks()->Lock(mpTrack);
|
||||
auto pTrack = TrackList::Get( *pProject ).Lock(mpTrack);
|
||||
if (!pTrack)
|
||||
return RefreshNone;
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "../../../Menus.h"
|
||||
#include "../../../Project.h"
|
||||
#include "../../../RefreshCode.h"
|
||||
#include "../../../Track.h"
|
||||
#include "../../../TrackPanel.h"
|
||||
#include "../../../TrackPanelMouseEvent.h"
|
||||
|
||||
|
|
|
@ -604,7 +604,7 @@ void WaveTrackMenuTable::InitMenu(Menu *pMenu, void *pUserData)
|
|||
(display == WaveTrack::Spectrum) && !bAudioBusy);
|
||||
|
||||
AudacityProject *const project = ::GetActiveProject();
|
||||
TrackList *const tracks = project->GetTracks();
|
||||
auto &tracks = TrackList::Get( *project );
|
||||
bool unsafe = EffectManager::Get().RealtimeIsActive() &&
|
||||
project->IsAudioActive();
|
||||
|
||||
|
@ -618,7 +618,7 @@ void WaveTrackMenuTable::InitMenu(Menu *pMenu, void *pUserData)
|
|||
mpData = static_cast<TrackControls::InitMenuData*>(pUserData);
|
||||
WaveTrack *const pTrack2 = static_cast<WaveTrack*>(mpData->pTrack);
|
||||
|
||||
auto next = * ++ tracks->Find(pTrack2);
|
||||
auto next = * ++ tracks.Find(pTrack2);
|
||||
|
||||
if (isMono) {
|
||||
const bool canMakeStereo =
|
||||
|
@ -841,15 +841,15 @@ void WaveTrackMenuTable::OnChannelChange(wxCommandEvent & event)
|
|||
void WaveTrackMenuTable::OnMergeStereo(wxCommandEvent &)
|
||||
{
|
||||
AudacityProject *const project = ::GetActiveProject();
|
||||
const auto tracks = project->GetTracks();
|
||||
auto &tracks = TrackList::Get( *project );
|
||||
|
||||
WaveTrack *const pTrack = static_cast<WaveTrack*>(mpData->pTrack);
|
||||
wxASSERT(pTrack);
|
||||
|
||||
auto partner = static_cast< WaveTrack * >
|
||||
( *tracks->Find( pTrack ).advance( 1 ) );
|
||||
( *tracks.Find( pTrack ).advance( 1 ) );
|
||||
|
||||
tracks->GroupChannels( *pTrack, 2 );
|
||||
tracks.GroupChannels( *pTrack, 2 );
|
||||
|
||||
// Set partner's parameters to match target.
|
||||
partner->Merge(*pTrack);
|
||||
|
@ -913,7 +913,7 @@ void WaveTrackMenuTable::SplitStereo(bool stereo)
|
|||
++nChannels;
|
||||
}
|
||||
|
||||
project->GetTracks()->GroupChannels( *pTrack, 1 );
|
||||
TrackList::Get( *project ).GroupChannels( *pTrack, 1 );
|
||||
int averageHeight = totalHeight / nChannels;
|
||||
|
||||
for (auto channel : channels)
|
||||
|
@ -938,9 +938,9 @@ void WaveTrackMenuTable::OnSwapChannels(wxCommandEvent &)
|
|||
|
||||
SplitStereo(false);
|
||||
|
||||
TrackList *const tracks = project->GetTracks();
|
||||
tracks->MoveUp( partner );
|
||||
tracks->GroupChannels( *partner, 2 );
|
||||
auto &tracks = TrackList::Get( *project );
|
||||
tracks.MoveUp( partner );
|
||||
tracks.GroupChannels( *partner, 2 );
|
||||
|
||||
if (hasFocus)
|
||||
project->GetTrackPanel()->SetFocusedTrack(partner);
|
||||
|
|
|
@ -594,7 +594,7 @@ UIHandle::Result WaveTrackVZoomHandle::Drag
|
|||
(const TrackPanelMouseEvent &evt, AudacityProject *pProject)
|
||||
{
|
||||
using namespace RefreshCode;
|
||||
auto pTrack = pProject->GetTracks()->Lock(mpTrack);
|
||||
auto pTrack = TrackList::Get( *pProject ).Lock(mpTrack);
|
||||
if (!pTrack)
|
||||
return Cancelled;
|
||||
|
||||
|
@ -618,7 +618,7 @@ UIHandle::Result WaveTrackVZoomHandle::Release
|
|||
wxWindow *pParent)
|
||||
{
|
||||
using namespace RefreshCode;
|
||||
auto pTrack = pProject->GetTracks()->Lock(mpTrack);
|
||||
auto pTrack = TrackList::Get( *pProject ).Lock(mpTrack);
|
||||
if (!pTrack)
|
||||
return RefreshNone;
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "../../HitTestResult.h"
|
||||
#include "../../Project.h"
|
||||
#include "../../RefreshCode.h"
|
||||
#include "../../Track.h"
|
||||
#include "../../TrackPanelMouseEvent.h"
|
||||
#include "../../UIHandle.h"
|
||||
|
||||
|
@ -50,7 +51,8 @@ public:
|
|||
// AS: If the user clicked outside all tracks, make nothing
|
||||
// selected.
|
||||
if ((event.ButtonDown() || event.ButtonDClick())) {
|
||||
pProject->GetSelectionState().SelectNone( *pProject->GetTracks() );
|
||||
pProject->GetSelectionState().SelectNone(
|
||||
TrackList::Get( *pProject ) );
|
||||
result |= RefreshAll;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ Paul Licameli
|
|||
#include "ButtonHandle.h"
|
||||
|
||||
#include "../../HitTestResult.h"
|
||||
#include "../../Project.h"
|
||||
#include "../../RefreshCode.h"
|
||||
#include "../../Track.h"
|
||||
#include "../../TrackPanelMouseEvent.h"
|
||||
#include "../ui/TrackControls.h"
|
||||
|
||||
|
@ -37,7 +37,7 @@ UIHandle::Result ButtonHandle::Click
|
|||
(const TrackPanelMouseEvent &evt, AudacityProject *pProject)
|
||||
{
|
||||
using namespace RefreshCode;
|
||||
auto pTrack = pProject->GetTracks()->Lock(mpTrack);
|
||||
auto pTrack = TrackList::Get( *pProject ).Lock(mpTrack);
|
||||
if ( !pTrack )
|
||||
return Cancelled;
|
||||
|
||||
|
@ -61,7 +61,7 @@ UIHandle::Result ButtonHandle::Drag
|
|||
{
|
||||
const wxMouseEvent &event = evt.event;
|
||||
using namespace RefreshCode;
|
||||
auto pTrack = pProject->GetTracks()->Lock(mpTrack);
|
||||
auto pTrack = TrackList::Get( *pProject ).Lock(mpTrack);
|
||||
if (!pTrack)
|
||||
return Cancelled;
|
||||
|
||||
|
@ -84,7 +84,7 @@ UIHandle::Result ButtonHandle::Release
|
|||
wxWindow *pParent)
|
||||
{
|
||||
using namespace RefreshCode;
|
||||
auto pTrack = pProject->GetTracks()->Lock(mpTrack);
|
||||
auto pTrack = TrackList::Get( *pProject ).Lock(mpTrack);
|
||||
if (!pTrack)
|
||||
return Cancelled;
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
|
||||
#include "../../Project.h"
|
||||
#include "../../RefreshCode.h"
|
||||
#include "../../Track.h"
|
||||
#include "../../TrackPanel.h"
|
||||
#include "../../TrackPanelMouseEvent.h"
|
||||
|
||||
|
@ -36,7 +37,7 @@ unsigned CommonTrackPanelCell::HandleWheelRotation
|
|||
{
|
||||
using namespace RefreshCode;
|
||||
|
||||
if (pProject->GetTracks()->empty())
|
||||
if ( TrackList::Get( *pProject ).empty() )
|
||||
// Scrolling and Zoom in and out commands are disabled when there are no tracks.
|
||||
// This should be disabled too for consistency. Otherwise
|
||||
// you do see changes in the time ruler.
|
||||
|
@ -106,7 +107,7 @@ unsigned CommonTrackPanelCell::HandleWheelRotation
|
|||
xx = viewInfo.TimeToPosition(center_h, trackLeftEdge);
|
||||
|
||||
// Time corresponding to last (most far right) audio.
|
||||
double audioEndTime = pProject->GetTracks()->GetEndTime();
|
||||
double audioEndTime = TrackList::Get( *pProject ).GetEndTime();
|
||||
|
||||
// Disabled this code to fix Bug 1923 (tricky to wheel-zoom right of waveform).
|
||||
#if 0
|
||||
|
|
|
@ -14,6 +14,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "../../AColor.h"
|
||||
#include "../../AdornedRulerPanel.h"
|
||||
#include "../../Project.h"
|
||||
#include "../../Track.h" //
|
||||
#include "../../TrackPanelAx.h"
|
||||
#include "../../TrackPanel.h"
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "../../AdornedRulerPanel.h"
|
||||
#include "../../AudioIO.h"
|
||||
#include "../../Project.h"
|
||||
#include "../../Track.h"
|
||||
#include "../../TrackPanel.h"
|
||||
#include "Scrubbing.h"
|
||||
#include "../../toolbars/ControlToolBar.h"
|
||||
|
|
|
@ -336,7 +336,7 @@ bool Scrubber::MaybeStartScrubbing(wxCoord xx)
|
|||
const ViewInfo &viewInfo = mProject->GetViewInfo();
|
||||
TrackPanel *const trackPanel = mProject->GetTrackPanel();
|
||||
ControlToolBar * const ctb = mProject->GetControlToolBar();
|
||||
double maxTime = mProject->GetTracks()->GetEndTime();
|
||||
double maxTime = TrackList::Get( *mProject ).GetEndTime();
|
||||
const int leftOffset = trackPanel->GetLeftOffset();
|
||||
double time0 = std::min(maxTime,
|
||||
viewInfo.PositionToTime(mScrubStartPosition, leftOffset)
|
||||
|
@ -387,7 +387,8 @@ bool Scrubber::MaybeStartScrubbing(wxCoord xx)
|
|||
|
||||
#endif
|
||||
mOptions.minTime = 0;
|
||||
mOptions.maxTime = std::max(0.0, mProject->GetTracks()->GetEndTime());
|
||||
mOptions.maxTime =
|
||||
std::max(0.0, TrackList::Get( *mProject ).GetEndTime());
|
||||
mOptions.minStutterTime =
|
||||
#ifdef DRAG_SCRUB
|
||||
mDragging ? 0.0 :
|
||||
|
@ -470,7 +471,7 @@ bool Scrubber::StartSpeedPlay(double speed, double time0, double time1)
|
|||
mOptions.maxSpeed = speed +0.01;
|
||||
|
||||
if (time1 == time0)
|
||||
time1 = std::max(0.0, mProject->GetTracks()->GetEndTime());
|
||||
time1 = std::max(0.0, TrackList::Get( *mProject ).GetEndTime());
|
||||
mOptions.minTime = 0;
|
||||
mOptions.maxTime = time1;
|
||||
mOptions.minStutterTime = std::max(0.0, MinStutter);
|
||||
|
|
|
@ -385,7 +385,7 @@ UIHandlePtr SelectHandle::HitTest
|
|||
|
||||
const ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
auto result = std::make_shared<SelectHandle>(
|
||||
pTrack, oldUseSnap, *pProject->GetTracks(), st, viewInfo );
|
||||
pTrack, oldUseSnap, TrackList::Get( *pProject ), st, viewInfo );
|
||||
|
||||
result = AssignUIHandlePtr(holder, result);
|
||||
|
||||
|
@ -525,7 +525,7 @@ UIHandle::Result SelectHandle::Click
|
|||
using namespace RefreshCode;
|
||||
|
||||
wxMouseEvent &event = evt.event;
|
||||
const auto sTrack = pProject->GetTracks()->Lock(mpTrack);
|
||||
const auto sTrack = TrackList::Get( *pProject ).Lock(mpTrack);
|
||||
const auto pTrack = sTrack.get();
|
||||
ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
|
||||
|
@ -553,10 +553,10 @@ UIHandle::Result SelectHandle::Click
|
|||
|
||||
auto &selectionState = pProject->GetSelectionState();
|
||||
if (event.LeftDClick() && !event.ShiftDown()) {
|
||||
TrackList *const trackList = pProject->GetTracks();
|
||||
auto &trackList = TrackList::Get( *pProject );
|
||||
|
||||
// Deselect all other tracks and select this one.
|
||||
selectionState.SelectNone( *trackList );
|
||||
selectionState.SelectNone( trackList );
|
||||
|
||||
selectionState.SelectTrack( *pTrack, true, true );
|
||||
|
||||
|
@ -584,9 +584,9 @@ UIHandle::Result SelectHandle::Click
|
|||
|
||||
mInitialSelection = viewInfo.selectedRegion;
|
||||
|
||||
TrackList *const trackList = pProject->GetTracks();
|
||||
mSelectionStateChanger = std::make_shared< SelectionStateChanger >
|
||||
( selectionState, *trackList );
|
||||
auto &trackList = TrackList::Get( *pProject );
|
||||
mSelectionStateChanger =
|
||||
std::make_shared< SelectionStateChanger >( selectionState, trackList );
|
||||
|
||||
mSelectionBoundary = 0;
|
||||
|
||||
|
@ -599,8 +599,7 @@ UIHandle::Result SelectHandle::Click
|
|||
// I. Shift-click adjusts an existing selection
|
||||
if (bShiftDown || bCtrlDown) {
|
||||
if (bShiftDown)
|
||||
selectionState.ChangeSelectionOnShiftClick
|
||||
( *trackList, *pTrack );
|
||||
selectionState.ChangeSelectionOnShiftClick( trackList, *pTrack );
|
||||
if( bCtrlDown ){
|
||||
//Commented out bIsSelected toggles, as in Track Control Panel.
|
||||
//bool bIsSelected = pTrack->GetSelected();
|
||||
|
@ -758,7 +757,7 @@ UIHandle::Result SelectHandle::Click
|
|||
|
||||
if (startNewSelection) {
|
||||
// If we didn't move a selection boundary, start a NEW selection
|
||||
selectionState.SelectNone( *trackList );
|
||||
selectionState.SelectNone( trackList );
|
||||
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
||||
StartFreqSelection (viewInfo, event.m_y, mRect.y, mRect.height, pTrack);
|
||||
#endif
|
||||
|
@ -808,7 +807,7 @@ UIHandle::Result SelectHandle::Drag
|
|||
}
|
||||
|
||||
// Also fuhggeddaboudit if not in a track.
|
||||
auto pTrack = pProject->GetTracks()->Lock(mpTrack);
|
||||
auto pTrack = TrackList::Get( *pProject ).Lock(mpTrack);
|
||||
if (!pTrack)
|
||||
return RefreshNone;
|
||||
|
||||
|
@ -833,10 +832,10 @@ UIHandle::Result SelectHandle::Drag
|
|||
// Handle which tracks are selected
|
||||
Track *sTrack = pTrack.get();
|
||||
Track *eTrack = clickedTrack.get();
|
||||
auto trackList = pProject->GetTracks();
|
||||
auto &trackList = TrackList::Get( *pProject );
|
||||
if ( sTrack && eTrack && !event.ControlDown() ) {
|
||||
auto &selectionState = pProject->GetSelectionState();
|
||||
selectionState.SelectRangeOfTracks( *trackList, *sTrack, *eTrack );
|
||||
selectionState.SelectRangeOfTracks( trackList, *sTrack, *eTrack );
|
||||
}
|
||||
|
||||
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
||||
|
@ -847,7 +846,7 @@ UIHandle::Result SelectHandle::Drag
|
|||
(pProject, viewInfo, y, mRect.y, mRect.height, pTrack.get());
|
||||
else
|
||||
#endif
|
||||
if (pProject->GetTracks()->Lock(mFreqSelTrack) == pTrack)
|
||||
if ( TrackList::Get( *pProject ).Lock(mFreqSelTrack) == pTrack )
|
||||
AdjustFreqSelection(
|
||||
static_cast<WaveTrack*>(pTrack.get()),
|
||||
viewInfo, y, mRect.y, mRect.height);
|
||||
|
@ -1141,7 +1140,7 @@ void SelectHandle::AdjustSelection
|
|||
|
||||
auto pTrack = Track::SharedPointer( track );
|
||||
if (!pTrack)
|
||||
pTrack = pProject->GetTracks()->Lock(mpTrack);
|
||||
pTrack = TrackList::Get( *pProject ).Lock(mpTrack);
|
||||
|
||||
if (pTrack && mSnapManager.get()) {
|
||||
bool rightEdge = (selend > mSelStart);
|
||||
|
|
|
@ -13,8 +13,8 @@ Paul Licameli
|
|||
|
||||
#include "../../widgets/ASlider.h"
|
||||
#include "../../HitTestResult.h"
|
||||
#include "../../Project.h"
|
||||
#include "../../RefreshCode.h"
|
||||
#include "../../Track.h"
|
||||
#include "../../TrackPanelMouseEvent.h"
|
||||
|
||||
SliderHandle::SliderHandle
|
||||
|
@ -112,6 +112,6 @@ UIHandle::Result SliderHandle::Cancel(AudacityProject *pProject)
|
|||
|
||||
LWSlider *SliderHandle::GetSlider( AudacityProject *pProject )
|
||||
{
|
||||
auto pTrack = pProject->GetTracks()->Lock(mpTrack);
|
||||
auto pTrack = TrackList::Get( *pProject ).Lock(mpTrack);
|
||||
return mSliderFn( pProject, mRect, pTrack.get() );
|
||||
}
|
||||
|
|
|
@ -364,7 +364,7 @@ UIHandle::Result TimeShiftHandle::Click
|
|||
if (!pTrack)
|
||||
return RefreshCode::Cancelled;
|
||||
|
||||
TrackList *const trackList = pProject->GetTracks();
|
||||
auto &trackList = TrackList::Get( *pProject );
|
||||
|
||||
mClipMoveState.clear();
|
||||
mDidSlideVertically = false;
|
||||
|
@ -404,14 +404,14 @@ UIHandle::Result TimeShiftHandle::Click
|
|||
if ( ! ok )
|
||||
return Cancelled;
|
||||
else if ( captureClips )
|
||||
CreateListOfCapturedClips
|
||||
( mClipMoveState, viewInfo, *pTrack, *trackList,
|
||||
pProject->IsSyncLocked(), clickTime );
|
||||
CreateListOfCapturedClips(
|
||||
mClipMoveState, viewInfo, *pTrack, trackList,
|
||||
pProject->IsSyncLocked(), clickTime );
|
||||
|
||||
mSlideUpDownOnly = event.CmdDown() && !multiToolModeActive;
|
||||
mRect = rect;
|
||||
mClipMoveState.mMouseClickX = event.m_x;
|
||||
mSnapManager = std::make_shared<SnapManager>(trackList,
|
||||
mSnapManager = std::make_shared<SnapManager>(&trackList,
|
||||
&viewInfo,
|
||||
&mClipMoveState.capturedClipArray,
|
||||
&mClipMoveState.trackExclusions,
|
||||
|
@ -700,7 +700,7 @@ UIHandle::Result TimeShiftHandle::Drag
|
|||
return RefreshCode::RefreshNone;
|
||||
|
||||
|
||||
TrackList *const trackList = pProject->GetTracks();
|
||||
auto &trackList = TrackList::Get( *pProject );
|
||||
|
||||
// GM: DoSlide now implementing snap-to
|
||||
// samples functionality based on sample rate.
|
||||
|
@ -734,7 +734,7 @@ UIHandle::Result TimeShiftHandle::Drag
|
|||
/* && !mCapturedClipIsSelection*/
|
||||
&& pTrack->TypeSwitch<bool>( [&] (WaveTrack *) {
|
||||
if ( DoSlideVertical( viewInfo, event.m_x, mClipMoveState,
|
||||
*trackList, *mCapturedTrack, *pTrack, desiredSlideAmount ) ) {
|
||||
trackList, *mCapturedTrack, *pTrack, desiredSlideAmount ) ) {
|
||||
mCapturedTrack = pTrack;
|
||||
mDidSlideVertically = true;
|
||||
}
|
||||
|
@ -755,7 +755,7 @@ UIHandle::Result TimeShiftHandle::Drag
|
|||
|
||||
mClipMoveState.hSlideAmount = desiredSlideAmount;
|
||||
|
||||
DoSlideHorizontal( mClipMoveState, *trackList, *mCapturedTrack );
|
||||
DoSlideHorizontal( mClipMoveState, trackList, *mCapturedTrack );
|
||||
|
||||
if (mClipMoveState.capturedClipIsSelection) {
|
||||
// Slide the selection, too
|
||||
|
|
|
@ -14,6 +14,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "../../Menus.h"
|
||||
#include "../../Project.h"
|
||||
#include "../../RefreshCode.h"
|
||||
#include "../../Track.h"
|
||||
#include "../../TrackPanel.h"
|
||||
#include "../../commands/CommandManager.h"
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "../../RefreshCode.h"
|
||||
#include "../../Menus.h"
|
||||
#include "../../Project.h"
|
||||
#include "../../Track.h"
|
||||
#include "../../TrackPanel.h" // for TrackInfo
|
||||
#include "../../TrackPanelMouseEvent.h"
|
||||
#include <wx/textdlg.h>
|
||||
|
@ -121,12 +122,12 @@ void TrackMenuTable::InitMenu(Menu *pMenu, void *pUserData)
|
|||
mpData = static_cast<TrackControls::InitMenuData*>(pUserData);
|
||||
Track *const pTrack = mpData->pTrack;
|
||||
|
||||
TrackList *const tracks = GetActiveProject()->GetTracks();
|
||||
const auto &tracks = TrackList::Get( *GetActiveProject() );
|
||||
|
||||
pMenu->Enable(OnMoveUpID, tracks->CanMoveUp(pTrack));
|
||||
pMenu->Enable(OnMoveDownID, tracks->CanMoveDown(pTrack));
|
||||
pMenu->Enable(OnMoveTopID, tracks->CanMoveUp(pTrack));
|
||||
pMenu->Enable(OnMoveBottomID, tracks->CanMoveDown(pTrack));
|
||||
pMenu->Enable(OnMoveUpID, tracks.CanMoveUp(pTrack));
|
||||
pMenu->Enable(OnMoveDownID, tracks.CanMoveDown(pTrack));
|
||||
pMenu->Enable(OnMoveTopID, tracks.CanMoveUp(pTrack));
|
||||
pMenu->Enable(OnMoveBottomID, tracks.CanMoveDown(pTrack));
|
||||
}
|
||||
|
||||
BEGIN_POPUP_MENU(TrackMenuTable)
|
||||
|
|
|
@ -113,7 +113,7 @@ UIHandle::Result TrackSelectHandle::Drag
|
|||
|
||||
const wxMouseEvent &event = evt.event;
|
||||
|
||||
TrackList *const tracks = pProject->GetTracks();
|
||||
auto &tracks = TrackList::Get( *pProject );
|
||||
|
||||
// probably harmless during play? However, we do disallow the click, so check this too.
|
||||
bool unsafe = pProject->IsAudioActive();
|
||||
|
@ -121,12 +121,12 @@ UIHandle::Result TrackSelectHandle::Drag
|
|||
return result;
|
||||
|
||||
if (event.m_y < mMoveUpThreshold || event.m_y < 0) {
|
||||
tracks->MoveUp(mpTrack.get());
|
||||
tracks.MoveUp(mpTrack.get());
|
||||
--mRearrangeCount;
|
||||
}
|
||||
else if ( event.m_y > mMoveDownThreshold
|
||||
|| event.m_y > evt.whole.GetHeight() ) {
|
||||
tracks->MoveDown(mpTrack.get());
|
||||
tracks.MoveDown(mpTrack.get());
|
||||
++mRearrangeCount;
|
||||
}
|
||||
else
|
||||
|
@ -212,21 +212,21 @@ void TrackSelectHandle::CalculateRearrangingThresholds(const wxMouseEvent & even
|
|||
// user.
|
||||
|
||||
AudacityProject *const project = ::GetActiveProject();
|
||||
TrackList *const tracks = project->GetTracks();
|
||||
auto &tracks = TrackList::Get( *project );
|
||||
|
||||
if (tracks->CanMoveUp(mpTrack.get()))
|
||||
if (tracks.CanMoveUp(mpTrack.get()))
|
||||
mMoveUpThreshold =
|
||||
event.m_y -
|
||||
tracks->GetGroupHeight(
|
||||
* -- tracks->FindLeader( mpTrack.get() ) );
|
||||
tracks.GetGroupHeight(
|
||||
* -- tracks.FindLeader( mpTrack.get() ) );
|
||||
else
|
||||
mMoveUpThreshold = INT_MIN;
|
||||
|
||||
if (tracks->CanMoveDown(mpTrack.get()))
|
||||
if (tracks.CanMoveDown(mpTrack.get()))
|
||||
mMoveDownThreshold =
|
||||
event.m_y +
|
||||
tracks->GetGroupHeight(
|
||||
* ++ tracks->FindLeader( mpTrack.get() ) );
|
||||
tracks.GetGroupHeight(
|
||||
* ++ tracks.FindLeader( mpTrack.get() ) );
|
||||
else
|
||||
mMoveDownThreshold = INT_MAX;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue