static TrackPanel::Get()...

... not member functions of AudacityProject
This commit is contained in:
Paul Licameli 2019-04-21 17:01:31 -04:00
parent 00117897bc
commit d1ad8f55e0
39 changed files with 506 additions and 453 deletions

View File

@ -530,19 +530,19 @@ namespace
wxCoord GetPlayHeadX( const AudacityProject *pProject )
{
const TrackPanel *tp = pProject->GetTrackPanel();
const auto &tp = TrackPanel::Get( *pProject );
int width;
tp->GetTracksUsableArea(&width, NULL);
return tp->GetLeftOffset()
tp.GetTracksUsableArea(&width, NULL);
return tp.GetLeftOffset()
+ width * TracksPrefs::GetPinnedHeadPositionPreference();
}
double GetPlayHeadFraction( const AudacityProject *pProject, wxCoord xx )
{
const TrackPanel *tp = pProject->GetTrackPanel();
const auto &tp = TrackPanel::Get( *pProject );
int width;
tp->GetTracksUsableArea(&width, NULL);
auto fraction = (xx - tp->GetLeftOffset()) / double(width);
tp.GetTracksUsableArea(&width, NULL);
auto fraction = (xx - tp.GetLeftOffset()) / double(width);
return std::max(0.0, std::min(1.0, fraction));
}
@ -1637,7 +1637,7 @@ void AdornedRulerPanel::SetPanelSize()
void AdornedRulerPanel::DrawBothOverlays()
{
mProject->GetTrackPanel()->DrawOverlays( false );
TrackPanel::Get( *mProject ).DrawOverlays( false );
DrawOverlays( false );
}
@ -1680,11 +1680,11 @@ void AdornedRulerPanel::OnTogglePinnedState(wxCommandEvent & /*event*/)
void AdornedRulerPanel::UpdateQuickPlayPos(wxCoord &mousePosX, bool shiftDown)
{
// Keep Quick-Play within usable track area.
TrackPanel *tp = mProject->GetTrackPanel();
const auto &tp = TrackPanel::Get( *mProject );
int width;
tp->GetTracksUsableArea(&width, NULL);
mousePosX = std::max(mousePosX, tp->GetLeftOffset());
mousePosX = std::min(mousePosX, tp->GetLeftOffset() + width - 1);
tp.GetTracksUsableArea(&width, NULL);
mousePosX = std::max(mousePosX, tp.GetLeftOffset());
mousePosX = std::min(mousePosX, tp.GetLeftOffset() + width - 1);
mQuickPlayPosUnsnapped = mQuickPlayPos = Pos2Time(mousePosX);
@ -2198,7 +2198,7 @@ void AdornedRulerPanel::CreateOverlays()
if (!mOverlay) {
mOverlay =
std::make_shared<QuickPlayIndicatorOverlay>( mProject );
mProject->GetTrackPanel()->AddOverlay( mOverlay );
TrackPanel::Get( *mProject ).AddOverlay( mOverlay );
this->AddOverlay( mOverlay->mPartner );
}
}

View File

@ -796,7 +796,7 @@ namespace {
LabelTrackHit *findHit()
{
// Fetch the highlighting state
auto target = GetActiveProject()->GetTrackPanel()->Target();
auto target = TrackPanel::Get( *GetActiveProject() ).Target();
if (target) {
auto handle = dynamic_cast<LabelGlyphHandle*>( target.get() );
if (handle)
@ -1820,7 +1820,7 @@ unsigned LabelTrack::KeyDown(wxKeyEvent & event, ViewInfo &viewInfo, wxWindow *W
// Make sure caret is in view
int x;
if (CalcCursorX(&x)) {
pProj->GetTrackPanel()->ScrollIntoView(x);
TrackPanel::Get( *pProj ).ScrollIntoView(x);
}
// If selection modified, refresh
@ -1993,7 +1993,7 @@ bool LabelTrack::OnKeyDown(SelectedRegion &newSel, wxKeyEvent & event)
auto track = *TrackList::Get( *GetActiveProject() ).Any()
.begin().advance(mRestoreFocus);
if (track)
GetActiveProject()->GetTrackPanel()->SetFocusedTrack(track);
TrackPanel::Get( *GetActiveProject() ).SetFocusedTrack(track);
mRestoreFocus = -1;
}
mSelIndex = -1;
@ -3110,18 +3110,17 @@ int LabelTrack::DialogForLabelName(
AudacityProject &project,
const SelectedRegion& region, const wxString& initialValue, wxString& value)
{
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &viewInfo = ViewInfo::Get( project );
wxPoint position =
trackPanel->FindTrackRect(trackPanel->GetFocusedTrack()).GetBottomLeft();
wxPoint position = trackPanel.FindTrackRect(trackPanel.GetFocusedTrack()).GetBottomLeft();
// The start of the text in the text box will be roughly in line with the label's position
// if it's a point label, or the start of its region if it's a region label.
position.x += trackPanel->GetLabelWidth()
position.x += trackPanel.GetLabelWidth()
+ std::max(0, static_cast<int>(viewInfo.TimeToPosition(region.t0())))
-40;
position.y += 2; // just below the bottom of the track
position = trackPanel->ClientToScreen(position);
position = trackPanel.ClientToScreen(position);
AudacityTextEntryDialog dialog{ &project,
_("Name:"),
_("New label"),

View File

@ -377,7 +377,7 @@ CommandFlag MenuManager::GetFocusedFrame(AudacityProject &project)
{
wxWindow *w = wxWindow::FindFocus();
while (w && project.GetTrackPanel()) {
while (w) {
if (w == ToolManager::Get( project ).GetTopDock()) {
return TopDockHasFocus;
}

View File

@ -408,7 +408,7 @@ void MixerTrackCluster::HandleSliderGain(const bool bWantPushState /*= false*/)
GetRight()->SetGain(fValue);
// Update the TrackPanel correspondingly.
mProject->GetTrackPanel()->RefreshTrack(mTrack.get());
TrackPanel::Get( *mProject ).RefreshTrack(mTrack.get());
if (bWantPushState)
mProject->PushState(_("Moved gain slider"), _("Gain"), UndoPush::CONSOLIDATE );
}
@ -421,7 +421,7 @@ void MixerTrackCluster::HandleSliderVelocity(const bool bWantPushState /*= false
GetNote()->SetVelocity(fValue);
// Update the TrackPanel correspondingly.
mProject->GetTrackPanel()->RefreshTrack(mTrack.get());
TrackPanel::Get( *mProject ).RefreshTrack(mTrack.get());
if (bWantPushState)
mProject->PushState(_("Moved velocity slider"), _("Velocity"), UndoPush::CONSOLIDATE);
}
@ -436,7 +436,7 @@ void MixerTrackCluster::HandleSliderPan(const bool bWantPushState /*= false*/)
GetRight()->SetPan(fValue);
// Update the TrackPanel correspondingly.
mProject->GetTrackPanel()->RefreshTrack(mTrack.get());
TrackPanel::Get( *mProject ).RefreshTrack(mTrack.get());
if (bWantPushState)
mProject->PushState(_("Moved pan slider"), _("Pan"), UndoPush::CONSOLIDATE );
@ -753,7 +753,7 @@ void MixerTrackCluster::OnButton_Mute(wxCommandEvent& WXUNUSED(event))
}
else
// Update only the changed track.
mProject->GetTrackPanel()->RefreshTrack(mTrack.get());
TrackPanel::Get( *mProject ).RefreshTrack(mTrack.get());
}
void MixerTrackCluster::OnButton_Solo(wxCommandEvent& WXUNUSED(event))

View File

@ -1205,23 +1205,8 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
}
bs->Layout();
{
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,
tracks.shared_from_this(),
&viewInfo,
this,
mRuler);
}
auto &trackPanel = TrackPanel::Get( project );
mPlaybackScroller = std::make_unique<PlaybackScroller>(this);
MenuManager::Get( project ).CreateMenusAndCommands( project );
@ -1255,7 +1240,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
auto hs = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
// Track panel
hs->Add(mTrackPanel, 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP);
hs->Add(&trackPanel, 1, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP);
{
// Vertical grouping
@ -1274,7 +1259,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
auto hs = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
// Bottom scrollbar
hs->Add(mTrackPanel->GetLeftOffset() - 1, 0);
hs->Add(trackPanel.GetLeftOffset() - 1, 0);
hs->Add(mHsbar, 1, wxALIGN_BOTTOM);
hs->Add(mVsbar->GetSize().GetWidth(), 0);
bs->Add(hs.release(), 0, wxEXPAND | wxALIGN_LEFT);
@ -1290,14 +1275,14 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
mMainPanel->Layout();
wxASSERT( mTrackPanel->GetProject()==this);
wxASSERT( trackPanel.GetProject()==this);
// MM: Give track panel the focus to ensure keyboard commands work
mTrackPanel->SetFocus();
trackPanel.SetFocus();
InitialState();
FixScrollbars();
mRuler->SetLeftOffset(mTrackPanel->GetLeftOffset()); // bevel on AdornedRuler
mRuler->SetLeftOffset(trackPanel.GetLeftOffset()); // bevel on AdornedRuler
//
// Set the Icon
@ -1337,7 +1322,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
// mTrackPanel->SetDropTarget(safenew AudacityDropTarget(this));
// SetDropTarget takes ownership
mTrackPanel->SetDropTarget(safenew DropTarget(this));
trackPanel.SetDropTarget(safenew DropTarget(this));
#endif
wxTheApp->Bind(EVT_THEME_CHANGE, &AudacityProject::OnThemeChange, this);
@ -1360,9 +1345,11 @@ AudacityProject::~AudacityProject()
void AudacityProject::ApplyUpdatedTheme()
{
auto &project = *this;
auto &trackPanel = TrackPanel::Get( project );
SetBackgroundColour(theTheme.Colour( clrMedium ));
ClearBackground();// For wxGTK.
mTrackPanel->ApplyUpdatedTheme();
trackPanel.ApplyUpdatedTheme();
}
@ -1433,6 +1420,7 @@ void AudacityProject::RedrawProject(const bool bForceWaveTracks /*= false*/)
{
auto &project = *this;
auto &tracks = TrackList::Get( project );
auto &trackPanel = TrackPanel::Get( project );
FixScrollbars();
if (bForceWaveTracks)
{
@ -1440,12 +1428,14 @@ void AudacityProject::RedrawProject(const bool bForceWaveTracks /*= false*/)
for (const auto &clip: pWaveTrack->GetClips())
clip->MarkChanged();
}
mTrackPanel->Refresh(false);
trackPanel.Refresh(false);
}
void AudacityProject::RefreshCursor()
{
mTrackPanel->HandleCursorForPresentMouseState();
auto &project = *this;
auto &trackPanel = TrackPanel::Get( project );
trackPanel.HandleCursorForPresentMouseState();
}
void AudacityProject::OnThemeChange(wxCommandEvent& evt)
@ -1594,13 +1584,14 @@ const NumericFormatSymbol & AudacityProject::AS_GetSelectionFormat()
void AudacityProject::AS_SetSelectionFormat(const NumericFormatSymbol & format)
{
auto &project = *this;
mSelectionFormat = format;
gPrefs->Write(wxT("/SelectionFormat"), mSelectionFormat.Internal());
gPrefs->Flush();
if (SnapSelection() && GetTrackPanel())
GetTrackPanel()->Refresh(false);
if (SnapSelection())
TrackPanel::Get( project ).Refresh(false);
}
double AudacityProject::SSBL_GetRate() const
@ -1644,6 +1635,7 @@ void AudacityProject::SSBL_ModifySpectralSelection(double &bottom, double &top,
{
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
auto &project = *this;
auto &trackPanel = TrackPanel::Get( project );
auto &viewInfo = ViewInfo::Get( project );
double nyq = SSBL_GetRate() / 2.0;
@ -1652,7 +1644,7 @@ void AudacityProject::SSBL_ModifySpectralSelection(double &bottom, double &top,
if (top >= 0.0)
top = std::min(nyq, top);
viewInfo.selectedRegion.setFrequencies(bottom, top);
mTrackPanel->Refresh(false);
trackPanel.Refresh(false);
if (done) {
ModifyState(false);
}
@ -1708,9 +1700,10 @@ const NumericFormatSymbol & AudacityProject::GetSelectionFormat() const
void AudacityProject::AS_ModifySelection(double &start, double &end, bool done)
{
auto &project = *this;
auto &trackPanel = TrackPanel::Get( project );
auto &viewInfo = ViewInfo::Get( project );
viewInfo.selectedRegion.setTimes(start, end);
mTrackPanel->Refresh(false);
trackPanel.Refresh(false);
if (done) {
ModifyState(false);
}
@ -1848,10 +1841,11 @@ double AudacityProject::ScrollingLowerBoundTime() const
{
auto &project = *this;
auto &tracks = TrackList::Get( project );
auto &trackPanel = TrackPanel::Get( project );
auto &viewInfo = ViewInfo::Get( project );
if (!MayScrollBeyondZero())
return 0;
const double screen = mTrackPanel->GetScreenEndTime() - viewInfo.h;
const double screen = trackPanel.GetScreenEndTime() - viewInfo.h;
return std::min(tracks.GetStartTime(), -screen);
}
@ -1934,6 +1928,7 @@ void AudacityProject::FixScrollbars()
{
auto &project = *this;
auto &tracks = TrackList::Get( project );
auto &trackPanel = TrackPanel::Get( project );
auto &viewInfo = ViewInfo::Get( project );
bool refresh = false;
@ -1942,7 +1937,7 @@ void AudacityProject::FixScrollbars()
int totalHeight = (tracks.GetHeight() + 32);
int panelWidth, panelHeight;
mTrackPanel->GetTracksUsableArea(&panelWidth, &panelHeight);
trackPanel.GetTracksUsableArea(&panelWidth, &panelHeight);
// (From Debian...at least I think this is the change cooresponding
// to this comment)
@ -1968,7 +1963,7 @@ void AudacityProject::FixScrollbars()
std::max(LastTime, viewInfo.selectedRegion.t1());
const double screen =
GetTrackPanel()->GetScreenEndTime() - viewInfo.h;
trackPanel.GetScreenEndTime() - viewInfo.h;
const double halfScreen = screen / 2.0;
// If we can scroll beyond zero,
@ -2015,7 +2010,7 @@ void AudacityProject::FixScrollbars()
bool oldhstate;
bool oldvstate;
bool newhstate =
(GetTrackPanel()->GetScreenEndTime() - viewInfo.h) < viewInfo.total;
(trackPanel.GetScreenEndTime() - viewInfo.h) < viewInfo.total;
bool newvstate = panelHeight < totalHeight;
#ifdef __WXGTK__
@ -2074,8 +2069,8 @@ void AudacityProject::FixScrollbars()
panelHeight / viewInfo.scrollStep, TRUE);
if (refresh || (rescroll &&
(GetTrackPanel()->GetScreenEndTime() - viewInfo.h) < viewInfo.total)) {
mTrackPanel->Refresh(false);
(trackPanel.GetScreenEndTime() - viewInfo.h) < viewInfo.total)) {
trackPanel.Refresh(false);
}
MenuManager::Get( project ).UpdateMenus( project );
@ -2084,17 +2079,17 @@ void AudacityProject::FixScrollbars()
UpdateLayout();
}
CallAfter(
[this]{ if (GetTrackPanel())
GetTrackPanel()->HandleCursorForPresentMouseState(); } );
wxWeakRef< TrackPanel > pPanel = &TrackPanel::Get( project );
CallAfter( [pPanel]{
if ( pPanel )
pPanel->HandleCursorForPresentMouseState();
} );
}
void AudacityProject::UpdateLayout()
{
if (!mTrackPanel)
return;
auto &project = *this;
auto &trackPanel = TrackPanel::Get( project );
auto &toolManager = ToolManager::Get( project );
// 1. Layout panel, to get widths of the docks.
@ -2111,7 +2106,7 @@ void AudacityProject::UpdateLayout()
// Retrieve position of the track panel to use as the size of the top
// third of the window
wxPoint tppos = ClientToScreen(mTrackPanel->GetParent()->GetPosition());
wxPoint tppos = ClientToScreen(trackPanel.GetParent()->GetPosition());
// Retrieve position of bottom dock to use as the size of the bottom
// third of the window
@ -2123,8 +2118,13 @@ void AudacityProject::UpdateLayout()
void AudacityProject::HandleResize()
{
if (!mTrackPanel)
// Activate events can fire during window teardown, so just
// ignore them.
if (mIsDeleting) {
return;
}
auto &project = *this;
FixScrollbars();
@ -2274,11 +2274,12 @@ void AudacityProject::OnScroll(wxScrollEvent & WXUNUSED(event))
void AudacityProject::DoScroll()
{
auto &project = *this;
auto &trackPanel = TrackPanel::Get( project );
auto &viewInfo = ViewInfo::Get( project );
const double lowerBound = ScrollingLowerBoundTime();
int width;
mTrackPanel->GetTracksUsableArea(&width, NULL);
trackPanel.GetTracksUsableArea(&width, NULL);
viewInfo.SetBeforeScreenWidth(viewInfo.sbarH, width, lowerBound);
@ -2300,12 +2301,14 @@ void AudacityProject::DoScroll()
//SetActiveProject(this);
if (!mAutoScrolling) {
mTrackPanel->Refresh(false);
trackPanel.Refresh(false);
}
CallAfter(
[this]{ if (GetTrackPanel())
GetTrackPanel()->HandleCursorForPresentMouseState(); } );
wxWeakRef< TrackPanel > pPanel = &TrackPanel::Get( project );
CallAfter( [pPanel]{
if ( pPanel )
pPanel->HandleCursorForPresentMouseState();
} );
}
void AudacityProject::OnMenu(wxCommandEvent & event)
@ -2363,14 +2366,14 @@ void AudacityProject::MacShowUndockedToolbars(bool show)
void AudacityProject::OnActivate(wxActivateEvent & event)
{
auto &project = *this;
// Activate events can fire during window teardown, so just
// ignore them.
if (IsBeingDeleted()) {
return;
}
auto &project = *this;
mActive = event.GetActive();
// Under Windows, focus can be "lost" when returning to
@ -2393,11 +2396,8 @@ void AudacityProject::OnActivate(wxActivateEvent & event)
else {
auto &toolManager = ToolManager::Get( project );
SetActiveProject(this);
if ( ! toolManager.RestoreFocus() ) {
if (mTrackPanel) {
mTrackPanel->SetFocus();
}
}
if ( ! toolManager.RestoreFocus() )
TrackPanel::Get( project ).SetFocus();
#ifdef __WXMAC__
MacShowUndockedToolbars(true);
@ -2589,11 +2589,7 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event)
// deleting things like tracks and such out from underneath it.
// Check validity of mTrackPanel per bug 584 Comment 1.
// Deeper fix is in the Import code, but this failsafes against crash.
if (mTrackPanel)
{
mTrackPanel->Destroy();
mTrackPanel = NULL; // Make sure this gets set...see HandleResize()
}
TrackPanel::Destroy( project );
// Finalize the tool manager before the children since it needs
// to save the state of the toolbars.
@ -3008,6 +3004,7 @@ void AudacityProject::OpenFile(const FilePath &fileNameArg, bool addtohistory)
{
auto &project = *this;
auto &tracks = TrackList::Get( project );
auto &trackPanel = TrackPanel::Get( project );
auto &dirManager = DirManager::Get( project );
// On Win32, we may be given a short (DOS-compatible) file name on rare
@ -3138,10 +3135,10 @@ void AudacityProject::OpenFile(const FilePath &fileNameArg, bool addtohistory)
if (bParseSuccess) {
InitialState();
mTrackPanel->SetFocusedTrack( *tracks.Any().begin() );
trackPanel.SetFocusedTrack( *tracks.Any().begin() );
HandleResize();
mTrackPanel->Refresh(false);
mTrackPanel->Update(); // force any repaint to happen now,
trackPanel.Refresh(false);
trackPanel.Update(); // force any repaint to happen now,
// else any asynch calls into the blockfile code will not have
// finished logging errors (if any) before the call to ProjectFSCK()
@ -3221,7 +3218,7 @@ void AudacityProject::OpenFile(const FilePath &fileNameArg, bool addtohistory)
for (const auto &clip: wt->GetClips())
clip->MarkChanged();
mTrackPanel->Refresh(true);
trackPanel.Refresh(true);
// Vaughan, 2010-08-20: This was bogus, as all the actions in ProjectFSCK
// that return FSCKstatus_CHANGED cannot be undone.
@ -4258,13 +4255,16 @@ AudacityProject::AddImportedTracks(const FilePath &fileName,
void AudacityProject::ZoomAfterImport(Track *pTrack)
{
auto &project = *this;
auto &trackPanel = TrackPanel::Get( project );
ViewActions::DoZoomFit(*this);
mTrackPanel->SetFocus();
trackPanel.SetFocus();
RedrawProject();
if (!pTrack)
pTrack = mTrackPanel->GetFirstSelectedTrack();
mTrackPanel->EnsureVisible(pTrack);
pTrack = trackPanel.GetFirstSelectedTrack();
trackPanel.EnsureVisible(pTrack);
}
// If pNewTrackList is passed in non-NULL, it gets filled with the pointers to NEW tracks.
@ -4641,7 +4641,7 @@ void AudacityProject::PushState(const wxString &desc,
if((flags & UndoPush::AUTOSAVE) != UndoPush::MINIMAL)
AutoSave();
GetTrackPanel()->HandleCursorForPresentMouseState();
TrackPanel::Get( project ).HandleCursorForPresentMouseState();
}
void AudacityProject::RollbackState()
@ -4662,7 +4662,7 @@ void AudacityProject::ModifyState(bool bWantsAutoSave)
&tracks, viewInfo.selectedRegion, tags.shared_from_this());
if (bWantsAutoSave)
AutoSave();
GetTrackPanel()->HandleCursorForPresentMouseState();
TrackPanel::Get( project ).HandleCursorForPresentMouseState();
}
// LL: Is there a memory leak here as "l" and "t" are not deleted???
@ -4727,13 +4727,14 @@ void AudacityProject::PopState(const UndoState &state)
void AudacityProject::SetStateTo(unsigned int n)
{
auto &project = *this;
auto &trackPanel = TrackPanel::Get( project );
auto &undoManager = UndoManager::Get( project );
undoManager.SetStateTo(n,
[this]( const UndoState &state ){ PopState(state); } );
HandleResize();
mTrackPanel->SetFocusedTrack(NULL);
mTrackPanel->Refresh(false);
trackPanel.SetFocusedTrack(NULL);
trackPanel.Refresh(false);
MenuManager::Get( project ).ModifyUndoMenuItems( project );
}
@ -4748,7 +4749,7 @@ void AudacityProject::Zoom(double level)
// tOnLeft is the amount of time we would need before the selection left edge to center it.
float t0 = viewInfo.selectedRegion.t0();
float t1 = viewInfo.selectedRegion.t1();
float tAvailable = GetTrackPanel()->GetScreenEndTime() - viewInfo.h;
float tAvailable = TrackPanel::Get( project ).GetScreenEndTime() - viewInfo.h;
float tOnLeft = (tAvailable - t0 + t1)/2.0;
// Bug 1292 (Enh) is effectively a request to do this scrolling of the selection into view.
// If tOnLeft is positive, then we have room for the selection, so scroll to it.
@ -4797,6 +4798,7 @@ void AudacityProject::SkipEnd(bool shift)
{
auto &project = *this;
auto &tracks = TrackList::Get( project );
auto &trackPanel = TrackPanel::Get( project );
auto &viewInfo = ViewInfo::Get( project );
double len = tracks.GetEndTime();
@ -4805,8 +4807,8 @@ void AudacityProject::SkipEnd(bool shift)
viewInfo.selectedRegion.setT0(len);
// Make sure the end of the track is visible
mTrackPanel->ScrollIntoView(len);
mTrackPanel->Refresh(false);
trackPanel.ScrollIntoView(len);
trackPanel.Refresh(false);
}
@ -5273,10 +5275,10 @@ bool AudacityProject::IsSyncLocked()
void AudacityProject::SetSyncLock(bool flag)
{
auto &project = *this;
if (flag != mIsSyncLocked) {
mIsSyncLocked = flag;
if (GetTrackPanel())
GetTrackPanel()->Refresh(false);
TrackPanel::Get( project ).Refresh(false);
}
}
@ -5452,18 +5454,18 @@ void AudacityProject::PlaybackScroller::OnTimer(wxCommandEvent &event)
// to the application, so scrub speed control is smoother.
// (So I see at least with OS 10.10 and wxWidgets 3.0.2.)
// Is there another way to ensure that than by refreshing?
const auto trackPanel = mProject->GetTrackPanel();
trackPanel->Refresh(false);
auto &trackPanel = TrackPanel::Get( *mProject );
trackPanel.Refresh(false);
}
else if (mMode != Mode::Off) {
// Pan the view, so that we put the play indicator at some fixed
// fraction of the window width.
auto &viewInfo = ViewInfo::Get( *mProject );
TrackPanel *const trackPanel = mProject->GetTrackPanel();
auto &trackPanel = TrackPanel::Get( *mProject );
const int posX = viewInfo.TimeToPosition(viewInfo.mRecentStreamTime);
int width;
trackPanel->GetTracksUsableArea(&width, NULL);
trackPanel.GetTracksUsableArea(&width, NULL);
int deltaX;
switch (mMode)
{
@ -5482,13 +5484,14 @@ void AudacityProject::PlaybackScroller::OnTimer(wxCommandEvent &event)
if (!mProject->MayScrollBeyondZero())
// Can't scroll too far left
viewInfo.h = std::max(0.0, viewInfo.h);
trackPanel->Refresh(false);
trackPanel.Refresh(false);
}
}
void AudacityProject::ZoomInByFactor( double ZoomFactor )
{
auto &project = *this;
auto &trackPanel = TrackPanel::Get( project );
auto &viewInfo = ViewInfo::Get( project );
// LLL: Handling positioning differently when audio is
@ -5496,8 +5499,8 @@ void AudacityProject::ZoomInByFactor( double ZoomFactor )
if ((gAudioIO->IsStreamActive(GetAudioIOToken()) != 0) &&
!gAudioIO->IsPaused()){
ZoomBy(ZoomFactor);
mTrackPanel->ScrollIntoView(gAudioIO->GetStreamTime());
mTrackPanel->Refresh(false);
trackPanel.ScrollIntoView(gAudioIO->GetStreamTime());
trackPanel.Refresh(false);
return;
}
@ -5505,7 +5508,7 @@ void AudacityProject::ZoomInByFactor( double ZoomFactor )
// when there's a selection that's currently at least
// partially on-screen
const double endTime = GetTrackPanel()->GetScreenEndTime();
const double endTime = trackPanel.GetScreenEndTime();
const double duration = endTime - viewInfo.h;
bool selectionIsOnscreen =
@ -5533,7 +5536,7 @@ void AudacityProject::ZoomInByFactor( double ZoomFactor )
// Zoom in
ZoomBy(ZoomFactor);
const double newDuration =
GetTrackPanel()->GetScreenEndTime() - viewInfo.h;
trackPanel.GetScreenEndTime() - viewInfo.h;
// Recenter on selCenter
TP_ScrollWindow(selCenter - newDuration / 2);
@ -5546,7 +5549,7 @@ void AudacityProject::ZoomInByFactor( double ZoomFactor )
ZoomBy(ZoomFactor);
const double newDuration =
GetTrackPanel()->GetScreenEndTime() - viewInfo.h;
trackPanel.GetScreenEndTime() - viewInfo.h;
double newh = origLeft + (origWidth - newDuration) / 2;
// MM: Commented this out because it was confusing users
@ -5568,14 +5571,15 @@ void AudacityProject::ZoomInByFactor( double ZoomFactor )
void AudacityProject::ZoomOutByFactor( double ZoomFactor )
{
auto &project = *this;
auto &trackPanel = TrackPanel::Get( project );
auto &viewInfo = ViewInfo::Get( project );
//Zoom() may change these, so record original values:
const double origLeft = viewInfo.h;
const double origWidth = GetTrackPanel()->GetScreenEndTime() - origLeft;
const double origWidth = trackPanel.GetScreenEndTime() - origLeft;
ZoomBy(ZoomFactor);
const double newWidth = GetTrackPanel()->GetScreenEndTime() - viewInfo.h;
const double newWidth = trackPanel.GetScreenEndTime() - viewInfo.h;
const double newh = origLeft + (origWidth - newWidth) / 2;
// newh = (newh > 0) ? newh : 0;

View File

@ -302,8 +302,6 @@ public:
wxWindow *GetMainPage() { return mMainPage; }
wxPanel *GetTopPanel() { return mTopPanel; }
TrackPanel * GetTrackPanel() {return mTrackPanel;}
const TrackPanel * GetTrackPanel() const {return mTrackPanel;}
bool GetTracksFitVerticallyZoomed() { return mTracksFitVerticallyZoomed; } //lda
void SetTracksFitVerticallyZoomed(bool flag) { mTracksFitVerticallyZoomed = flag; } //lda
@ -544,7 +542,6 @@ private:
AdornedRulerPanel *mRuler{};
wxPanel *mTopPanel{};
TrackPanel *mTrackPanel{};
wxWindow * mMainPage;
wxPanel * mMainPanel;
wxScrollBar *mHsbar;

View File

@ -209,6 +209,48 @@ std::unique_ptr<wxCursor> MakeCursor( int WXUNUSED(CursorId), const char * const
}
namespace{
AudacityProject::AttachedWindows::RegisteredFactory sKey{
[]( AudacityProject &project ) -> wxWeakRef< wxWindow > {
auto &ruler = *project.GetRulerPanel();
auto &viewInfo = ViewInfo::Get( project );
auto &window = project;
auto mainPage = window.GetMainPage();
wxASSERT( mainPage ); // to justify safenew
auto &tracks = TrackList::Get( project );
return safenew TrackPanel(mainPage,
window.NextWindowID(),
wxDefaultPosition,
wxDefaultSize,
tracks.shared_from_this(),
&viewInfo,
&project,
&ruler);
}
};
}
TrackPanel &TrackPanel::Get( AudacityProject &project )
{
return project.AttachedWindows::Get< TrackPanel >( sKey );
}
const TrackPanel &TrackPanel::Get( const AudacityProject &project )
{
return Get( const_cast< AudacityProject & >( project ) );
}
void TrackPanel::Destroy( AudacityProject &project )
{
auto *pPanel = project.AttachedWindows::Find( sKey );
if (pPanel) {
pPanel->wxWindow::Destroy();
project.AttachedWindows::Assign( sKey, nullptr );
}
}
// Don't warn us about using 'this' in the base member initializer list.
#ifndef __WXGTK__ //Get rid if this pragma for gtk
@ -219,11 +261,11 @@ TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id,
const wxSize & size,
const std::shared_ptr<TrackList> &tracks,
ViewInfo * viewInfo,
TrackPanelListener * listener,
AudacityProject * project,
AdornedRulerPanel * ruler)
: CellularPanel(parent, id, pos, size, viewInfo,
wxWANTS_CHARS | wxNO_BORDER),
mListener(listener),
mListener(project),
mTracks(tracks),
mRuler(ruler),
mTrackArtist(nullptr),
@ -2846,7 +2888,7 @@ unsigned TrackPanelCell::Char(wxKeyEvent &event, ViewInfo &, wxWindow *)
IsVisibleTrack::IsVisibleTrack(AudacityProject *project)
: mPanelRect {
wxPoint{ 0, ViewInfo::Get( *project ).vpos },
project->GetTrackPanel()->GetTracksUsableArea()
TrackPanel::Get( *project ).GetTracksUsableArea()
}
{}

View File

@ -257,13 +257,17 @@ class AUDACITY_DLL_API TrackPanel final
, private PrefsListener
{
public:
static TrackPanel &Get( AudacityProject &project );
static const TrackPanel &Get( const AudacityProject &project );
static void Destroy( AudacityProject &project );
TrackPanel(wxWindow * parent,
wxWindowID id,
const wxPoint & pos,
const wxSize & size,
const std::shared_ptr<TrackList> &tracks,
ViewInfo * viewInfo,
TrackPanelListener * listener,
AudacityProject * project,
AdornedRulerPanel * ruler );
virtual ~ TrackPanel();

View File

@ -487,8 +487,8 @@ bool GetInfoCommand::SendTracks(const CommandContext & context)
context.StartArray();
for (auto trk : tracks.Leaders())
{
TrackPanel *panel = context.project.GetTrackPanel();
Track * fTrack = panel->GetFocusedTrack();
auto &panel = TrackPanel::Get( context.project );
Track * fTrack = panel.GetFocusedTrack();
context.StartStruct();
context.AddItem( trk->GetName(), "name" );
@ -715,12 +715,12 @@ void GetInfoCommand::ExploreTrackPanel( const CommandContext &context,
wxPoint P, wxWindow * pWin, int WXUNUSED(Id), int depth )
{
AudacityProject * pProj = &context.project;
TrackPanel * pTP = pProj->GetTrackPanel();
auto &tp = TrackPanel::Get( *pProj );
wxRect trackRect = pWin->GetRect();
for ( auto t : TrackList::Get( *pProj ).Any() + IsVisibleTrack{ pProj } ) {
trackRect.y = t->GetY() - pTP->mViewInfo->vpos;
trackRect.y = t->GetY() - tp.mViewInfo->vpos;
trackRect.height = t->GetHeight();
#if 0
@ -775,9 +775,9 @@ void GetInfoCommand::ExploreTrackPanel( const CommandContext &context,
// The VRuler.
{
wxRect R = trackRect;
R.x += pTP->GetVRulerOffset();
R.x += tp.GetVRulerOffset();
R.y += kTopMargin;
R.width = pTP->GetVRulerWidth();
R.width = tp.GetVRulerWidth();
R.height -= (kTopMargin + kBottomMargin);
R.SetPosition( R.GetPosition() + P );

View File

@ -814,7 +814,7 @@ bool ScreenshotCommand::Apply(const CommandContext & context)
if (!w)
return false;
TrackPanel *panel = context.project.GetTrackPanel();
TrackPanel *panel = &TrackPanel::Get( context.project );
AdornedRulerPanel *ruler = panel->mRuler;
int nTracks = TrackList::Get( context.project ).size();

View File

@ -86,7 +86,7 @@ void SelectTimeCommand::PopulateOrExchange(ShuttleGui & S)
bool SelectTimeCommand::Apply(const CommandContext & context){
// Many commands need focus on track panel.
// No harm in setting it with a scripted select.
context.project.GetTrackPanel()->SetFocus();
TrackPanel::Get( context.project ).SetFocus();
if( !bHasT0 && !bHasT1 )
return true;

View File

@ -163,11 +163,11 @@ bool SetTrackStatusCommand::ApplyInner(const CommandContext & context, Track * t
if( !bIsSecondChannel ){
if( bHasFocused )
{
TrackPanel *panel = context.project.GetTrackPanel();
auto &panel = TrackPanel::Get( context.project );
if( bFocused)
panel->SetFocusedTrack( t );
else if( t== panel->GetFocusedTrack() )
panel->SetFocusedTrack( nullptr );
panel.SetFocusedTrack( t );
else if( t== panel.GetFocusedTrack() )
panel.SetFocusedTrack( nullptr );
}
}
return true;
@ -395,8 +395,8 @@ bool SetTrackVisualsCommand::ApplyInner(const CommandContext & context, Track *
mVZoomTop = c + ZOOMLIMIT / 2.0;
}
wt->SetDisplayBounds(mVZoomBottom, mVZoomTop);
TrackPanel *const tp = ::GetActiveProject()->GetTrackPanel();
tp->UpdateVRulers();
auto &tp = TrackPanel::Get( *::GetActiveProject() );
tp.UpdateVRulers();
}
if( wt && bHasUseSpecPrefs ){

View File

@ -374,7 +374,7 @@ wxString ClipBoundaryMessage(const std::vector<FoundClipBoundary>& results)
void DoSelectClipBoundary(AudacityProject &project, bool next)
{
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
std::vector<FoundClipBoundary> results;
FindClipBoundaries(project, next ? selectedRegion.t1() :
@ -389,10 +389,10 @@ void DoSelectClipBoundary(AudacityProject &project, bool next)
selectedRegion.setT0(results[0].time);
project.ModifyState(false);
trackPanel->Refresh(false);
trackPanel.Refresh(false);
wxString message = ClipBoundaryMessage(results);
trackPanel->MessageForScreenReader(message);
trackPanel.MessageForScreenReader(message);
}
}
@ -559,7 +559,7 @@ int FindClips
void DoSelectClip(AudacityProject &project, bool next)
{
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
std::vector<FoundClip> results;
FindClips(project, selectedRegion.t0(),
@ -572,8 +572,8 @@ void DoSelectClip(AudacityProject &project, bool next)
double t1 = results[0].endTime;
selectedRegion.setTimes(t0, t1);
project.ModifyState(false);
trackPanel->ScrollIntoView(selectedRegion.t0());
trackPanel->Refresh(false);
trackPanel.ScrollIntoView(selectedRegion.t0());
trackPanel.Refresh(false);
// create and send message to screen reader
wxString message;
@ -598,7 +598,7 @@ void DoSelectClip(AudacityProject &project, bool next)
else
message = wxString::Format(_("%s, %s"), message, str);
}
trackPanel->MessageForScreenReader(message);
trackPanel.MessageForScreenReader(message);
}
}
@ -606,7 +606,7 @@ void DoCursorClipBoundary
(AudacityProject &project, bool next)
{
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
std::vector<FoundClipBoundary> results;
FindClipBoundaries(project, next ? selectedRegion.t1() :
@ -618,11 +618,11 @@ void DoCursorClipBoundary
double time = results[0].time;
selectedRegion.setTimes(time, time);
project.ModifyState(false);
trackPanel->ScrollIntoView(selectedRegion.t0());
trackPanel->Refresh(false);
trackPanel.ScrollIntoView(selectedRegion.t0());
trackPanel.Refresh(false);
wxString message = ClipBoundaryMessage(results);
trackPanel->MessageForScreenReader(message);
trackPanel.MessageForScreenReader(message);
}
}
@ -698,17 +698,17 @@ void DoClipLeftOrRight
return;
}
auto &panel = *project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &viewInfo = ViewInfo::Get( project );
auto &selectedRegion = viewInfo.selectedRegion;
auto &tracks = TrackList::Get( project );
auto isSyncLocked = project.IsSyncLocked();
auto amount = DoClipMove( viewInfo, panel.GetFocusedTrack(),
auto amount = DoClipMove( viewInfo, trackPanel.GetFocusedTrack(),
tracks, isSyncLocked, right );
panel.ScrollIntoView(selectedRegion.t0());
panel.Refresh(false);
trackPanel.ScrollIntoView(selectedRegion.t0());
trackPanel.Refresh(false);
if (amount != 0.0) {
wxString message = right? _("Time shifted clips to the right") :
@ -722,7 +722,7 @@ void DoClipLeftOrRight
}
if ( amount == 0.0 )
panel.MessageForScreenReader( _("clip not moved"));
trackPanel.MessageForScreenReader( _("clip not moved"));
}
}

View File

@ -35,7 +35,7 @@ void FinishCopy
bool DoPasteText(AudacityProject &project)
{
auto &tracks = TrackList::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
for (auto pLabelTrack : tracks.Any<LabelTrack>())
@ -52,7 +52,7 @@ bool DoPasteText(AudacityProject &project)
// Make sure caret is in view
int x;
if (pLabelTrack->CalcCursorX(&x)) {
trackPanel->ScrollIntoView(x);
trackPanel.ScrollIntoView(x);
}
// Redraw everyting (is that necessary???) and bail
@ -71,7 +71,7 @@ bool DoPasteNothingSelected(AudacityProject &project)
{
auto &tracks = TrackList::Get( project );
auto &trackFactory = TrackFactory::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
// First check whether anything's selected.
@ -150,7 +150,7 @@ bool DoPasteNothingSelected(AudacityProject &project)
project.RedrawProject();
if (pFirstNewTrack)
trackPanel->EnsureVisible(pFirstNewTrack);
trackPanel.EnsureVisible(pFirstNewTrack);
return true;
}
@ -226,7 +226,7 @@ bool DoEditMetadata
void DoUndo(AudacityProject &project)
{
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &undoManager = UndoManager::Get( project );
if (!project.UndoAvailable()) {
@ -235,14 +235,14 @@ void DoUndo(AudacityProject &project)
}
// can't undo while dragging
if (trackPanel->IsMouseCaptured()) {
if (trackPanel.IsMouseCaptured()) {
return;
}
undoManager.Undo(
[&]( const UndoState &state ){ project.PopState( state ); } );
trackPanel->EnsureVisible(trackPanel->GetFirstSelectedTrack());
trackPanel.EnsureVisible(trackPanel.GetFirstSelectedTrack());
project.RedrawProject();
@ -261,7 +261,7 @@ void OnUndo(const CommandContext &context)
void OnRedo(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &undoManager = UndoManager::Get( project );
if (!project.RedoAvailable()) {
@ -269,14 +269,14 @@ void OnRedo(const CommandContext &context)
return;
}
// Can't redo whilst dragging
if (trackPanel->IsMouseCaptured()) {
if (trackPanel.IsMouseCaptured()) {
return;
}
undoManager.Redo(
[&]( const UndoState &state ){ project.PopState( state ); } );
trackPanel->EnsureVisible(trackPanel->GetFirstSelectedTrack());
trackPanel.EnsureVisible(trackPanel.GetFirstSelectedTrack());
project.RedrawProject();
@ -287,7 +287,7 @@ void OnCut(const CommandContext &context)
{
auto &project = context.project;
auto &tracks = TrackList::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
auto ruler = project.GetRulerPanel();
@ -297,7 +297,7 @@ void OnCut(const CommandContext &context)
for (auto lt : tracks.Selected< LabelTrack >()) {
if (lt->CutSelectedText()) {
trackPanel->Refresh(false);
trackPanel.Refresh(false);
return;
}
}
@ -398,12 +398,12 @@ void OnCopy(const CommandContext &context)
{
auto &project = context.project;
auto &tracks = TrackList::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
for (auto lt : tracks.Selected< LabelTrack >()) {
if (lt->CopySelectedText()) {
//trackPanel->Refresh(false);
//trackPanel.Refresh(false);
return;
}
}
@ -425,14 +425,14 @@ void OnCopy(const CommandContext &context)
selectedRegion.t0(), selectedRegion.t1(), &project );
//Make sure the menus/toolbar states get updated
trackPanel->Refresh(false);
trackPanel.Refresh(false);
}
void OnPaste(const CommandContext &context)
{
auto &project = context.project;
auto &tracks = TrackList::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &trackFactory = TrackFactory::Get( project );
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
auto isSyncLocked = project.IsSyncLocked();
@ -687,7 +687,7 @@ void OnPaste(const CommandContext &context)
project.RedrawProject();
if (ff)
trackPanel->EnsureVisible(ff);
trackPanel.EnsureVisible(ff);
}
}
@ -789,7 +789,7 @@ void OnSilence(const CommandContext &context)
{
auto &project = context.project;
auto &tracks = TrackList::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
for ( auto n : tracks.Selected< AudioTrack >() )
@ -801,7 +801,7 @@ void OnSilence(const CommandContext &context)
selectedRegion.t0()),
_("Silence"));
trackPanel->Refresh(false);
trackPanel.Refresh(false);
}
void OnTrim(const CommandContext &context)
@ -840,7 +840,7 @@ void OnSplit(const CommandContext &context)
{
auto &project = context.project;
auto &tracks = TrackList::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
double sel0 = selectedRegion.t0();
@ -850,7 +850,7 @@ void OnSplit(const CommandContext &context)
wt->Split( sel0, sel1 );
project.PushState(_("Split"), _("Split"));
trackPanel->Refresh(false);
trackPanel.Refresh(false);
#if 0
//ANSWER-ME: Do we need to keep this commented out OnSplit() code?
// This whole section no longer used...
@ -897,7 +897,7 @@ void OnSplit(const CommandContext &context)
PushState(_("Split"), _("Split"));
FixScrollbars();
trackPanel->Refresh(false);
trackPanel.Refresh(false);
*/
#endif
}

View File

@ -10,6 +10,7 @@
#include "../Prefs.h"
#include "../Printing.h"
#include "../Project.h"
#include "../TrackPanel.h"
#include "../ViewInfo.h"
#include "../WaveTrack.h"
#include "../commands/CommandContext.h"
@ -539,7 +540,7 @@ void OnPrint(const CommandContext &context)
auto &project = context.project;
auto name = project.GetProjectName();
auto &tracks = TrackList::Get( project );
HandlePrint(&project, name, &tracks, *project.GetTrackPanel());
HandlePrint(&project, name, &tracks, TrackPanel::Get( project ));
}
void OnExit(const CommandContext &WXUNUSED(context) )

View File

@ -19,7 +19,7 @@ int DoAddLabel(
bool preserveFocus = false)
{
auto &tracks = TrackList::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &trackFactory = TrackFactory::Get( project );
wxString title; // of label
@ -33,7 +33,7 @@ int DoAddLabel(
}
// If the focused track is a label track, use that
Track *const pFocusedTrack = trackPanel->GetFocusedTrack();
Track *const pFocusedTrack = trackPanel.GetFocusedTrack();
// Look for a label track at or after the focused track
auto iter = pFocusedTrack
@ -73,9 +73,9 @@ int DoAddLabel(
project.RedrawProject();
if (!useDialog) {
trackPanel->EnsureVisible(lt);
trackPanel.EnsureVisible(lt);
}
trackPanel->SetFocus();
trackPanel.SetFocus();
return index;
}
@ -282,7 +282,7 @@ void OnPasteNewLabel(const CommandContext &context)
auto &project = context.project;
auto &tracks = TrackList::Get( project );
auto &trackFactory = TrackFactory::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
bool bPastedSomething = false;
@ -328,8 +328,8 @@ void OnPasteNewLabel(const CommandContext &context)
// plt should point to the last label track pasted to -- ensure it's visible
// and set focus
if (plt) {
trackPanel->EnsureVisible(plt);
trackPanel->SetFocus();
trackPanel.EnsureVisible(plt);
trackPanel.SetFocus();
}
if (bPastedSomething) {
@ -451,7 +451,7 @@ void OnSplitDeleteLabels(const CommandContext &context)
void OnSilenceLabels(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &tracks = TrackList::Get( project );
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
@ -466,13 +466,13 @@ void OnSilenceLabels(const CommandContext &context)
/* i18n-hint: (verb)*/
_( "Silence Labeled Audio" ) );
trackPanel->Refresh( false );
trackPanel.Refresh( false );
}
void OnCopyLabels(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &tracks = TrackList::Get( project );
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
@ -486,7 +486,7 @@ void OnCopyLabels(const CommandContext &context)
/* i18n-hint: (verb)*/
_( "Copy Labeled Audio" ) );
trackPanel->Refresh( false );
trackPanel.Refresh( false );
}
void OnSplitLabels(const CommandContext &context)

View File

@ -36,7 +36,7 @@ void NextOrPrevFrame(AudacityProject &project, bool forward)
wxWindow *const begin [rotationSize] = {
project.GetTopPanel(),
project.GetTrackPanel(),
&TrackPanel::Get( project ),
botDock,
};
@ -84,16 +84,16 @@ void NextOrPrevFrame(AudacityProject &project, bool forward)
void DoPrevTrack(
AudacityProject &project, bool shift, bool circularTrackNavigation )
{
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &tracks = TrackList::Get( project );
auto &selectionState = SelectionState::Get( project );
Track* t = trackPanel->GetFocusedTrack();
Track* t = trackPanel.GetFocusedTrack();
if( t == NULL ) // if there isn't one, focus on last
{
t = *tracks.Any().rbegin();
trackPanel->SetFocusedTrack( t );
trackPanel->EnsureVisible( t );
trackPanel.SetFocusedTrack( t );
trackPanel.EnsureVisible( t );
project.ModifyState(false);
return;
}
@ -113,7 +113,7 @@ void DoPrevTrack(
p = *tracks.Any().rbegin();
else
{
trackPanel->EnsureVisible( t );
trackPanel.EnsureVisible( t );
return;
}
}
@ -124,8 +124,8 @@ void DoPrevTrack(
{
selectionState.SelectTrack
( *t, false, false );
trackPanel->SetFocusedTrack( p ); // move focus to next track up
trackPanel->EnsureVisible( p );
trackPanel.SetFocusedTrack( p ); // move focus to next track up
trackPanel.EnsureVisible( p );
project.ModifyState(false);
return;
}
@ -133,8 +133,8 @@ void DoPrevTrack(
{
selectionState.SelectTrack
( *p, true, false );
trackPanel->SetFocusedTrack( p ); // move focus to next track up
trackPanel->EnsureVisible( p );
trackPanel.SetFocusedTrack( p ); // move focus to next track up
trackPanel.EnsureVisible( p );
project.ModifyState(false);
return;
}
@ -142,8 +142,8 @@ void DoPrevTrack(
{
selectionState.SelectTrack
( *p, false, false );
trackPanel->SetFocusedTrack( p ); // move focus to next track up
trackPanel->EnsureVisible( p );
trackPanel.SetFocusedTrack( p ); // move focus to next track up
trackPanel.EnsureVisible( p );
project.ModifyState(false);
return;
}
@ -151,8 +151,8 @@ void DoPrevTrack(
{
selectionState.SelectTrack
( *t, true, false );
trackPanel->SetFocusedTrack( p ); // move focus to next track up
trackPanel->EnsureVisible( p );
trackPanel.SetFocusedTrack( p ); // move focus to next track up
trackPanel.EnsureVisible( p );
project.ModifyState(false);
return;
}
@ -167,21 +167,21 @@ void DoPrevTrack(
{
auto range = tracks.Leaders();
p = * range.rbegin(); // null if range is empty
trackPanel->SetFocusedTrack( p ); // Wrap to the last track
trackPanel->EnsureVisible( p );
trackPanel.SetFocusedTrack( p ); // Wrap to the last track
trackPanel.EnsureVisible( p );
project.ModifyState(false);
return;
}
else
{
trackPanel->EnsureVisible( t );
trackPanel.EnsureVisible( t );
return;
}
}
else
{
trackPanel->SetFocusedTrack( p ); // move focus to next track up
trackPanel->EnsureVisible( p );
trackPanel.SetFocusedTrack( p ); // move focus to next track up
trackPanel.EnsureVisible( p );
project.ModifyState(false);
return;
}
@ -194,16 +194,16 @@ void DoPrevTrack(
void DoNextTrack(
AudacityProject &project, bool shift, bool circularTrackNavigation )
{
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &tracks = TrackList::Get( project );
auto &selectionState = SelectionState::Get( project );
auto t = trackPanel->GetFocusedTrack(); // Get currently focused track
auto t = trackPanel.GetFocusedTrack(); // Get currently focused track
if( t == NULL ) // if there isn't one, focus on first
{
t = *tracks.Any().begin();
trackPanel->SetFocusedTrack( t );
trackPanel->EnsureVisible( t );
trackPanel.SetFocusedTrack( t );
trackPanel.EnsureVisible( t );
project.ModifyState(false);
return;
}
@ -218,7 +218,7 @@ void DoNextTrack(
n = *tracks.Any().begin();
else
{
trackPanel->EnsureVisible( t );
trackPanel.EnsureVisible( t );
return;
}
}
@ -228,8 +228,8 @@ void DoNextTrack(
{
selectionState.SelectTrack
( *t, false, false );
trackPanel->SetFocusedTrack( n ); // move focus to next track down
trackPanel->EnsureVisible( n );
trackPanel.SetFocusedTrack( n ); // move focus to next track down
trackPanel.EnsureVisible( n );
project.ModifyState(false);
return;
}
@ -237,8 +237,8 @@ void DoNextTrack(
{
selectionState.SelectTrack
( *n, true, false );
trackPanel->SetFocusedTrack( n ); // move focus to next track down
trackPanel->EnsureVisible( n );
trackPanel.SetFocusedTrack( n ); // move focus to next track down
trackPanel.EnsureVisible( n );
project.ModifyState(false);
return;
}
@ -246,8 +246,8 @@ void DoNextTrack(
{
selectionState.SelectTrack
( *n, false, false );
trackPanel->SetFocusedTrack( n ); // move focus to next track down
trackPanel->EnsureVisible( n );
trackPanel.SetFocusedTrack( n ); // move focus to next track down
trackPanel.EnsureVisible( n );
project.ModifyState(false);
return;
}
@ -255,8 +255,8 @@ void DoNextTrack(
{
selectionState.SelectTrack
( *t, true, false );
trackPanel->SetFocusedTrack( n ); // move focus to next track down
trackPanel->EnsureVisible( n );
trackPanel.SetFocusedTrack( n ); // move focus to next track down
trackPanel.EnsureVisible( n );
project.ModifyState(false);
return;
}
@ -270,21 +270,21 @@ void DoNextTrack(
if( circularTrackNavigation )
{
n = *tracks.Any().begin();
trackPanel->SetFocusedTrack( n ); // Wrap to the first track
trackPanel->EnsureVisible( n );
trackPanel.SetFocusedTrack( n ); // Wrap to the first track
trackPanel.EnsureVisible( n );
project.ModifyState(false);
return;
}
else
{
trackPanel->EnsureVisible( t );
trackPanel.EnsureVisible( t );
return;
}
}
else
{
trackPanel->SetFocusedTrack( n ); // move focus to next track down
trackPanel->EnsureVisible( n );
trackPanel.SetFocusedTrack( n ); // move focus to next track down
trackPanel.EnsureVisible( n );
project.ModifyState(false);
return;
}
@ -457,39 +457,39 @@ void OnCursorDown(const CommandContext &context)
void OnFirstTrack(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &tracks = TrackList::Get( project );
Track *t = trackPanel->GetFocusedTrack();
Track *t = trackPanel.GetFocusedTrack();
if (!t)
return;
auto f = *tracks.Any().begin();
if (t != f)
{
trackPanel->SetFocusedTrack(f);
trackPanel.SetFocusedTrack(f);
project.ModifyState(false);
}
trackPanel->EnsureVisible(f);
trackPanel.EnsureVisible(f);
}
void OnLastTrack(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &tracks = TrackList::Get( project );
Track *t = trackPanel->GetFocusedTrack();
Track *t = trackPanel.GetFocusedTrack();
if (!t)
return;
auto l = *tracks.Any().rbegin();
if (t != l)
{
trackPanel->SetFocusedTrack(l);
trackPanel.SetFocusedTrack(l);
project.ModifyState(false);
}
trackPanel->EnsureVisible(l);
trackPanel.EnsureVisible(l);
}
void OnShiftUp(const CommandContext &context)
@ -507,21 +507,21 @@ void OnShiftDown(const CommandContext &context)
void OnToggle(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &selectionState = SelectionState::Get( project );
Track *t;
t = trackPanel->GetFocusedTrack(); // Get currently focused track
t = trackPanel.GetFocusedTrack(); // Get currently focused track
if (!t)
return;
selectionState.SelectTrack
( *t, !t->GetSelected(), true );
trackPanel->EnsureVisible( t );
trackPanel.EnsureVisible( t );
project.ModifyState(false);
trackPanel->GetAx().Updated();
trackPanel.GetAx().Updated();
return;
}

View File

@ -421,7 +421,7 @@ bool DoEffect(
{
AudacityProject &project = context.project;
auto &tracks = TrackList::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &trackFactory = TrackFactory::Get( project );
auto rate = project.GetRate();
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
@ -526,10 +526,10 @@ bool DoEffect(
// Label track and we want to see it.
if( tracks.size() > nTracksOriginally ){
// 0.0 is min scroll position, 1.0 is max scroll position.
trackPanel->VerticalScroll( 1.0 );
trackPanel.VerticalScroll( 1.0 );
} else {
trackPanel->EnsureVisible(trackPanel->GetFirstSelectedTrack());
trackPanel->Refresh(false);
trackPanel.EnsureVisible(trackPanel.GetFirstSelectedTrack());
trackPanel.Refresh(false);
}
return true;

View File

@ -25,7 +25,7 @@ void DoSelectTimeAndTracks
(AudacityProject &project, bool bAllTime, bool bAllTracks)
{
auto &tracks = TrackList::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
if( bAllTime )
@ -37,7 +37,7 @@ void DoSelectTimeAndTracks
t->SetSelected(true);
project.ModifyState(false);
trackPanel->Refresh(false);
trackPanel.Refresh(false);
}
}
@ -47,7 +47,7 @@ void DoSelectTimeAndAudioTracks
(AudacityProject &project, bool bAllTime, bool bAllTracks)
{
auto &tracks = TrackList::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
if( bAllTime )
@ -62,7 +62,7 @@ void DoSelectTimeAndAudioTracks
t->SetSelected(true);
project.ModifyState(false);
trackPanel->Refresh(false);
trackPanel.Refresh(false);
}
}
@ -70,7 +70,7 @@ void DoNextPeakFrequency(AudacityProject &project, bool up)
{
auto &tracks = TrackList::Get( project );
auto &viewInfo = ViewInfo::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
// Find the first selected wave track that is in a spectrogram view.
const WaveTrack *pTrack {};
@ -85,7 +85,7 @@ void DoNextPeakFrequency(AudacityProject &project, bool up)
if (pTrack) {
SpectrumAnalyst analyst;
SelectHandle::SnapCenterOnce(analyst, viewInfo, pTrack, up);
trackPanel->Refresh(false);
trackPanel.Refresh(false);
project.ModifyState(false);
}
}
@ -268,7 +268,7 @@ void MoveWhenAudioInactive
(AudacityProject &project, double seekStep, TimeUnit timeUnit)
{
auto &viewInfo = ViewInfo::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &tracks = TrackList::Get( project );
auto ruler = project.GetRulerPanel();
@ -277,7 +277,7 @@ void MoveWhenAudioInactive
const double t0 = viewInfo.selectedRegion.t0();
const double end = std::max(
tracks.GetEndTime(),
trackPanel->GetScreenEndTime());
trackPanel.GetScreenEndTime());
// Move the cursor
// Already in cursor mode?
@ -295,7 +295,7 @@ void MoveWhenAudioInactive
viewInfo.selectedRegion.collapseToT0();
// Move the visual cursor, avoiding an unnecessary complete redraw
trackPanel->DrawOverlays(false);
trackPanel.DrawOverlays(false);
ruler->DrawOverlays(false);
// This updates the selection shown on the selection bar, and the play
@ -308,11 +308,11 @@ void MoveWhenAudioInactive
viewInfo.selectedRegion.collapseToT0();
else
viewInfo.selectedRegion.collapseToT1();
trackPanel->Refresh(false);
trackPanel.Refresh(false);
}
// Make sure NEW position is in view
trackPanel->ScrollIntoView(viewInfo.selectedRegion.t1());
trackPanel.ScrollIntoView(viewInfo.selectedRegion.t1());
return;
}
@ -321,7 +321,7 @@ void SeekWhenAudioInactive
SelectionOperation operation)
{
auto &viewInfo = ViewInfo::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &tracks = TrackList::Get( project );
if( operation == CURSOR_MOVE )
@ -335,7 +335,7 @@ SelectionOperation operation)
const double t1 = viewInfo.selectedRegion.t1();
const double end = std::max(
tracks.GetEndTime(),
trackPanel->GetScreenEndTime());
trackPanel.GetScreenEndTime());
// Is it t0 or t1 moving?
bool bMoveT0 = (operation == SELECTION_CONTRACT && seekStep > 0) ||
@ -357,8 +357,8 @@ SelectionOperation operation)
viewInfo.selectedRegion.setT1( newT );
// Ensure it is visible, and refresh.
trackPanel->ScrollIntoView(newT);
trackPanel->Refresh(false);
trackPanel.ScrollIntoView(newT);
trackPanel.Refresh(false);
}
// Handle small cursor and play head movements
@ -419,7 +419,7 @@ void DoCursorMove(
void DoBoundaryMove(AudacityProject &project, int step, SeekInfo &info)
{
auto &viewInfo = ViewInfo::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &tracks = TrackList::Get( project );
// step is negative, then is moving left. step positive, moving right.
@ -448,7 +448,7 @@ void DoBoundaryMove(AudacityProject &project, int step, SeekInfo &info)
viewInfo.selectedRegion.setT1(indicator);
project.ModifyState(false);
trackPanel->Refresh(false);
trackPanel.Refresh(false);
return;
}
@ -456,7 +456,7 @@ void DoBoundaryMove(AudacityProject &project, int step, SeekInfo &info)
const double t1 = viewInfo.selectedRegion.t1();
const double end = std::max(
tracks.GetEndTime(),
trackPanel->GetScreenEndTime());
trackPanel.GetScreenEndTime());
double newT = viewInfo.OffsetTimeByPixels( bMoveT0 ? t0 : t1, pixels);
// constrain to be in the track/screen limits.
@ -473,8 +473,8 @@ void DoBoundaryMove(AudacityProject &project, int step, SeekInfo &info)
viewInfo.selectedRegion.setT1( newT );
// Ensure it is visible, and refresh.
trackPanel->ScrollIntoView(newT);
trackPanel->Refresh(false);
trackPanel.ScrollIntoView(newT);
trackPanel.Refresh(false);
project.ModifyState(false);
}
@ -491,7 +491,8 @@ void SelectNone( AudacityProject &project )
for (auto t : tracks.Any())
t->SetSelected(false);
project.GetTrackPanel()->Refresh(false);
auto &trackPanel = TrackPanel::Get( project );
trackPanel.Refresh(false);
}
// Select the full time range, if no
@ -509,7 +510,7 @@ void DoListSelection
(AudacityProject &project, Track *t, bool shift, bool ctrl, bool modifyState)
{
auto &tracks = TrackList::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &selectionState = SelectionState::Get( project );
auto &viewInfo = ViewInfo::Get( project );
auto isSyncLocked = project.IsSyncLocked();
@ -519,7 +520,7 @@ void DoListSelection
shift, ctrl, isSyncLocked );
if (! ctrl )
trackPanel->SetFocusedTrack(t);
trackPanel.SetFocusedTrack(t);
project.Refresh(false);
if (modifyState)
project.ModifyState(true);
@ -585,7 +586,7 @@ void OnSelectSyncLockSel(const CommandContext &context)
{
auto &project = context.project;
auto &tracks = TrackList::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
bool selected = false;
for (auto t : tracks.Any()
@ -597,7 +598,7 @@ void OnSelectSyncLockSel(const CommandContext &context)
if (selected)
project.ModifyState(false);
trackPanel->Refresh(false);
trackPanel.Refresh(false);
}
//this pops up a dialog which allows the left selection to be set.
@ -608,7 +609,7 @@ void OnSetLeftSelection(const CommandContext &context)
auto &project = context.project;
auto token = project.GetAudioIOToken();
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
bool bSelChanged = false;
if ((token > 0) && gAudioIO->IsStreamActive(token))
@ -637,7 +638,7 @@ void OnSetLeftSelection(const CommandContext &context)
if (bSelChanged)
{
project.ModifyState(false);
trackPanel->Refresh(false);
trackPanel.Refresh(false);
}
}
@ -646,7 +647,7 @@ void OnSetRightSelection(const CommandContext &context)
auto &project = context.project;
auto token = project.GetAudioIOToken();
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
bool bSelChanged = false;
if ((token > 0) && gAudioIO->IsStreamActive(token))
@ -675,7 +676,7 @@ void OnSetRightSelection(const CommandContext &context)
if (bSelChanged)
{
project.ModifyState(false);
trackPanel->Refresh(false);
trackPanel.Refresh(false);
}
}
@ -683,7 +684,7 @@ void OnSelectStartCursor(const CommandContext &context)
{
auto &project = context.project;
auto &tracks = TrackList::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
double kWayOverToRight = std::numeric_limits<double>::max();
@ -702,14 +703,14 @@ void OnSelectStartCursor(const CommandContext &context)
project.ModifyState(false);
trackPanel->Refresh(false);
trackPanel.Refresh(false);
}
void OnSelectCursorEnd(const CommandContext &context)
{
auto &project = context.project;
auto &tracks = TrackList::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
double kWayOverToLeft = std::numeric_limits<double>::lowest();
@ -728,7 +729,7 @@ void OnSelectCursorEnd(const CommandContext &context)
project.ModifyState(false);
trackPanel->Refresh(false);
trackPanel.Refresh(false);
}
void OnSelectTrackStartToEnd(const CommandContext &context)
@ -736,7 +737,7 @@ void OnSelectTrackStartToEnd(const CommandContext &context)
auto &project = context.project;
auto &viewInfo = ViewInfo::Get( project );
auto &tracks = TrackList::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto range = tracks.Selected();
double maxEndOffset = range.max( &Track::GetEndTime );
@ -748,7 +749,7 @@ void OnSelectTrackStartToEnd(const CommandContext &context)
viewInfo.selectedRegion.setTimes( minOffset, maxEndOffset );
project.ModifyState(false);
trackPanel->Refresh(false);
trackPanel.Refresh(false);
}
// Handler state:
@ -766,7 +767,7 @@ void OnSelectionRestore(const CommandContext &context)
{
auto &project = context.project;
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
if ((mRegionSave.t0() == 0.0) &&
(mRegionSave.t1() == 0.0))
@ -776,7 +777,7 @@ void OnSelectionRestore(const CommandContext &context)
project.ModifyState(false);
trackPanel->Refresh(false);
trackPanel.Refresh(false);
}
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
@ -788,7 +789,7 @@ double mLastF1{ SelectedRegion::UndefinedFrequency };
void OnToggleSpectralSelection(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
const double f0 = selectedRegion.f0();
@ -806,7 +807,7 @@ void OnToggleSpectralSelection(const CommandContext &context)
else
selectedRegion.setFrequencies(mLastF0, mLastF1);
trackPanel->Refresh(false);
trackPanel.Refresh(false);
project.ModifyState(false);
}
@ -830,7 +831,7 @@ double mCursorPositionStored{ 0.0 };
void OnSelectCursorStoredCursor(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
auto isAudioActive = project.IsAudioActive();
@ -843,7 +844,7 @@ void OnSelectCursorStoredCursor(const CommandContext &context)
std::max(cursorPositionCurrent, mCursorPositionStored));
project.ModifyState(false);
trackPanel->Refresh(false);
trackPanel.Refresh(false);
}
}
@ -862,7 +863,7 @@ void OnZeroCrossing(const CommandContext &context)
{
auto &project = context.project;
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
const double t0 = NearestZeroCrossing(project, selectedRegion.t0());
if (selectedRegion.isPoint())
@ -876,7 +877,7 @@ void OnZeroCrossing(const CommandContext &context)
project.ModifyState(false);
trackPanel->Refresh(false);
trackPanel.Refresh(false);
}
void OnSnapToOff(const CommandContext &context)
@ -955,32 +956,32 @@ void OnSelContractRight(const CommandContext &context)
void OnCursorSelStart(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
selectedRegion.collapseToT0();
project.ModifyState(false);
trackPanel->ScrollIntoView(selectedRegion.t0());
trackPanel->Refresh(false);
trackPanel.ScrollIntoView(selectedRegion.t0());
trackPanel.Refresh(false);
}
void OnCursorSelEnd(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
selectedRegion.collapseToT1();
project.ModifyState(false);
trackPanel->ScrollIntoView(selectedRegion.t1());
trackPanel->Refresh(false);
trackPanel.ScrollIntoView(selectedRegion.t1());
trackPanel.Refresh(false);
}
void OnCursorTrackStart(const CommandContext &context)
{
auto &project = context.project;
auto &tracks = TrackList::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
double kWayOverToRight = std::numeric_limits<double>::max();
@ -999,15 +1000,15 @@ void OnCursorTrackStart(const CommandContext &context)
selectedRegion.setTimes(minOffset, minOffset);
project.ModifyState(false);
trackPanel->ScrollIntoView(selectedRegion.t0());
trackPanel->Refresh(false);
trackPanel.ScrollIntoView(selectedRegion.t0());
trackPanel.Refresh(false);
}
void OnCursorTrackEnd(const CommandContext &context)
{
auto &project = context.project;
auto &tracks = TrackList::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
double kWayOverToLeft = std::numeric_limits<double>::lowest();
@ -1026,8 +1027,8 @@ void OnCursorTrackEnd(const CommandContext &context)
selectedRegion.setTimes(maxEndOffset, maxEndOffset);
project.ModifyState(false);
trackPanel->ScrollIntoView(selectedRegion.t1());
trackPanel->Refresh(false);
trackPanel.ScrollIntoView(selectedRegion.t1());
trackPanel.Refresh(false);
}
void OnSkipStart(const CommandContext &context)

View File

@ -18,7 +18,7 @@ void SetTool(AudacityProject &project, int tool)
ToolsToolBar *toolbar = project.GetToolsToolBar();
if (toolbar) {
toolbar->SetCurrentTool(tool);
project.GetTrackPanel()->Refresh(false);
TrackPanel::Get( project ).Refresh(false);
}
}
@ -207,13 +207,13 @@ void OnPrevTool(const CommandContext &context)
{
auto &project = context.project;
auto toolbar = project.GetToolsToolBar();
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
if (toolbar) {
// Use GetDownTool() here since GetCurrentTool() can return a value that
// doesn't represent the real tool if the Multi-tool is being used.
toolbar->SetCurrentTool((toolbar->GetDownTool()+(numTools-1))%numTools);
trackPanel->Refresh(false);
trackPanel.Refresh(false);
}
}
@ -221,13 +221,13 @@ void OnNextTool(const CommandContext &context)
{
auto &project = context.project;
auto toolbar = project.GetToolsToolBar();
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
if (toolbar) {
// Use GetDownTool() here since GetCurrentTool() can return a value that
// doesn't represent the real tool if the Multi-tool is being used.
toolbar->SetCurrentTool((toolbar->GetDownTool()+1)%numTools);
trackPanel->Refresh(false);
trackPanel.Refresh(false);
}
}

View File

@ -42,7 +42,7 @@ void DoMixAndRender
auto &trackFactory = TrackFactory::Get( project );
auto rate = project.GetRate();
auto defaultFormat = project.GetDefaultFormat();
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
MissingAliasFilesDialog::SetShouldShow(true);
@ -102,9 +102,9 @@ void DoMixAndRender
project.PushState(msg, _("Mix and Render"));
}
trackPanel->SetFocus();
trackPanel->SetFocusedTrack(pNewLeft);
trackPanel->EnsureVisible(pNewLeft);
trackPanel.SetFocus();
trackPanel.SetFocusedTrack(pNewLeft);
trackPanel.EnsureVisible(pNewLeft);
project.RedrawProject();
}
}
@ -533,7 +533,7 @@ void SetTrackGain(AudacityProject &project, WaveTrack * wt, LWSlider * slider)
project.PushState(_("Adjusted gain"), _("Gain"), UndoPush::CONSOLIDATE);
project.GetTrackPanel()->RefreshTrack(wt);
TrackPanel::Get( project ).RefreshTrack(wt);
}
void SetTrackPan(AudacityProject &project, WaveTrack * wt, LWSlider * slider)
@ -546,7 +546,7 @@ void SetTrackPan(AudacityProject &project, WaveTrack * wt, LWSlider * slider)
project.PushState(_("Adjusted Pan"), _("Pan"), UndoPush::CONSOLIDATE);
project.GetTrackPanel()->RefreshTrack(wt);
TrackPanel::Get( project ).RefreshTrack(wt);
}
}
@ -558,7 +558,7 @@ namespace TrackActions {
void DoRemoveTracks( AudacityProject &project )
{
auto &tracks = TrackList::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
std::vector<Track*> toRemove;
for (auto track : tracks.Selected())
@ -587,18 +587,18 @@ void DoRemoveTracks( AudacityProject &project )
// If we actually have something left, then make sure it's seen
if (f)
trackPanel->EnsureVisible(f);
trackPanel.EnsureVisible(f);
project.PushState(_("Removed audio track(s)"), _("Remove Track"));
trackPanel->UpdateViewIfNoTracks();
trackPanel->Refresh(false);
trackPanel.UpdateViewIfNoTracks();
trackPanel.Refresh(false);
}
void DoTrackMute(AudacityProject &project, Track *t, bool exclusive)
{
auto &tracks = TrackList::Get( project );
auto &trackPanel = *project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
// Whatever t is, replace with lead channel
t = *tracks.FindLeader(t);
@ -647,7 +647,7 @@ void DoTrackMute(AudacityProject &project, Track *t, bool exclusive)
void DoTrackSolo(AudacityProject &project, Track *t, bool exclusive)
{
auto &tracks = TrackList::Get( project );
auto &trackPanel = *project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
// Whatever t is, replace with lead channel
t = *tracks.FindLeader(t);
@ -699,7 +699,7 @@ void DoTrackSolo(AudacityProject &project, Track *t, bool exclusive)
void DoRemoveTrack(AudacityProject &project, Track * toRemove)
{
auto &tracks = TrackList::Get( project );
auto &trackPanel = *project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
// If it was focused, then NEW focus is the next or, if
// unavailable, the previous track. (The NEW focus is set
@ -738,7 +738,7 @@ void DoRemoveTrack(AudacityProject &project, Track * toRemove)
void DoMoveTrack
(AudacityProject &project, Track* target, MoveChoice choice)
{
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &tracks = TrackList::Get( project );
wxString longDesc, shortDesc;
@ -785,7 +785,7 @@ void DoMoveTrack
longDesc = longDesc.Format(target->GetName());
project.PushState(longDesc, shortDesc);
trackPanel->Refresh(false);
trackPanel.Refresh(false);
}
// Menu handler functions
@ -797,7 +797,7 @@ void OnNewWaveTrack(const CommandContext &context)
auto &project = context.project;
auto &tracks = TrackList::Get( project );
auto &trackFactory = TrackFactory::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto defaultFormat = project.GetDefaultFormat();
auto rate = project.GetRate();
@ -809,7 +809,7 @@ void OnNewWaveTrack(const CommandContext &context)
project.PushState(_("Created new audio track"), _("New Track"));
project.RedrawProject();
trackPanel->EnsureVisible(t);
trackPanel.EnsureVisible(t);
}
void OnNewStereoTrack(const CommandContext &context)
@ -817,7 +817,7 @@ void OnNewStereoTrack(const CommandContext &context)
auto &project = context.project;
auto &tracks = TrackList::Get( project );
auto &trackFactory = TrackFactory::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto defaultFormat = project.GetDefaultFormat();
auto rate = project.GetRate();
@ -834,7 +834,7 @@ void OnNewStereoTrack(const CommandContext &context)
project.PushState(_("Created new stereo audio track"), _("New Track"));
project.RedrawProject();
trackPanel->EnsureVisible(left);
trackPanel.EnsureVisible(left);
}
void OnNewLabelTrack(const CommandContext &context)
@ -842,7 +842,7 @@ void OnNewLabelTrack(const CommandContext &context)
auto &project = context.project;
auto &tracks = TrackList::Get( project );
auto &trackFactory = TrackFactory::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto t = tracks.Add( trackFactory.NewLabelTrack() );
@ -853,7 +853,7 @@ void OnNewLabelTrack(const CommandContext &context)
project.PushState(_("Created new label track"), _("New Track"));
project.RedrawProject();
trackPanel->EnsureVisible(t);
trackPanel.EnsureVisible(t);
}
void OnNewTimeTrack(const CommandContext &context)
@ -861,7 +861,7 @@ void OnNewTimeTrack(const CommandContext &context)
auto &project = context.project;
auto &tracks = TrackList::Get( project );
auto &trackFactory = TrackFactory::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
if (tracks.GetTimeTrack()) {
AudacityMessageBox(_("This version of Audacity only allows one time track for each project window."));
@ -877,7 +877,7 @@ void OnNewTimeTrack(const CommandContext &context)
project.PushState(_("Created new time track"), _("New Track"));
project.RedrawProject();
trackPanel->EnsureVisible(t);
trackPanel.EnsureVisible(t);
}
void OnStereoToMono(const CommandContext &context)
@ -1229,8 +1229,8 @@ void OnSortTime(const CommandContext &context)
project.PushState(_("Tracks sorted by time"), _("Sort by Time"));
auto trackPanel = project.GetTrackPanel();
trackPanel->Refresh(false);
auto &trackPanel = TrackPanel::Get( project );
trackPanel.Refresh(false);
}
void OnSortName(const CommandContext &context)
@ -1240,14 +1240,14 @@ void OnSortName(const CommandContext &context)
project.PushState(_("Tracks sorted by name"), _("Sort by Name"));
auto trackPanel = project.GetTrackPanel();
trackPanel->Refresh(false);
auto &trackPanel = TrackPanel::Get( project );
trackPanel.Refresh(false);
}
void OnSyncLock(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
bool bSyncLockTracks;
gPrefs->Read(wxT("/GUI/SyncLockTracks"), &bSyncLockTracks, false);
@ -1257,7 +1257,7 @@ void OnSyncLock(const CommandContext &context)
// Toolbar, project sync-lock handled within
MenuManager::ModifyAllProjectToolbarMenus();
trackPanel->Refresh(false);
trackPanel.Refresh(false);
}
///The following methods operate controls on specified tracks,
@ -1265,11 +1265,11 @@ void OnSyncLock(const CommandContext &context)
void OnTrackPan(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
Track *const track = trackPanel->GetFocusedTrack();
Track *const track = trackPanel.GetFocusedTrack();
if (track) track->TypeSwitch( [&](WaveTrack *wt) {
LWSlider *slider = trackPanel->PanSlider(wt);
LWSlider *slider = trackPanel.PanSlider(wt);
if (slider->ShowDialog())
SetTrackPan(project, wt, slider);
});
@ -1278,11 +1278,11 @@ void OnTrackPan(const CommandContext &context)
void OnTrackPanLeft(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
Track *const track = trackPanel->GetFocusedTrack();
Track *const track = trackPanel.GetFocusedTrack();
if (track) track->TypeSwitch( [&](WaveTrack *wt) {
LWSlider *slider = trackPanel->PanSlider(wt);
LWSlider *slider = trackPanel.PanSlider(wt);
slider->Decrease(1);
SetTrackPan(project, wt, slider);
});
@ -1291,11 +1291,11 @@ void OnTrackPanLeft(const CommandContext &context)
void OnTrackPanRight(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
Track *const track = trackPanel->GetFocusedTrack();
Track *const track = trackPanel.GetFocusedTrack();
if (track) track->TypeSwitch( [&](WaveTrack *wt) {
LWSlider *slider = trackPanel->PanSlider(wt);
LWSlider *slider = trackPanel.PanSlider(wt);
slider->Increase(1);
SetTrackPan(project, wt, slider);
});
@ -1304,12 +1304,12 @@ void OnTrackPanRight(const CommandContext &context)
void OnTrackGain(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
/// This will pop up the track gain dialog for specified track
Track *const track = trackPanel->GetFocusedTrack();
Track *const track = trackPanel.GetFocusedTrack();
if (track) track->TypeSwitch( [&](WaveTrack *wt) {
LWSlider *slider = trackPanel->GainSlider(wt);
LWSlider *slider = trackPanel.GainSlider(wt);
if (slider->ShowDialog())
SetTrackGain(project, wt, slider);
});
@ -1318,11 +1318,11 @@ void OnTrackGain(const CommandContext &context)
void OnTrackGainInc(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
Track *const track = trackPanel->GetFocusedTrack();
Track *const track = trackPanel.GetFocusedTrack();
if (track) track->TypeSwitch( [&](WaveTrack *wt) {
LWSlider *slider = trackPanel->GainSlider(wt);
LWSlider *slider = trackPanel.GainSlider(wt);
slider->Increase(1);
SetTrackGain(project, wt, slider);
});
@ -1331,11 +1331,11 @@ void OnTrackGainInc(const CommandContext &context)
void OnTrackGainDec(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
Track *const track = trackPanel->GetFocusedTrack();
Track *const track = trackPanel.GetFocusedTrack();
if (track) track->TypeSwitch( [&](WaveTrack *wt) {
LWSlider *slider = trackPanel->GainSlider(wt);
LWSlider *slider = trackPanel.GainSlider(wt);
slider->Decrease(1);
SetTrackGain(project, wt, slider);
});
@ -1344,17 +1344,17 @@ void OnTrackGainDec(const CommandContext &context)
void OnTrackMenu(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
trackPanel->OnTrackMenu();
trackPanel.OnTrackMenu();
}
void OnTrackMute(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
const auto track = trackPanel->GetFocusedTrack();
const auto track = trackPanel.GetFocusedTrack();
if (track) track->TypeSwitch( [&](PlayableTrack *t) {
DoTrackMute(project, t, false);
});
@ -1363,9 +1363,9 @@ void OnTrackMute(const CommandContext &context)
void OnTrackSolo(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
const auto track = trackPanel->GetFocusedTrack();
const auto track = trackPanel.GetFocusedTrack();
if (track) track->TypeSwitch( [&](PlayableTrack *t) {
DoTrackSolo(project, t, false);
});
@ -1374,9 +1374,9 @@ void OnTrackSolo(const CommandContext &context)
void OnTrackClose(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
Track *t = trackPanel->GetFocusedTrack();
Track *t = trackPanel.GetFocusedTrack();
if (!t)
return;
@ -1392,59 +1392,59 @@ void OnTrackClose(const CommandContext &context)
DoRemoveTrack(project, t);
trackPanel->UpdateViewIfNoTracks();
trackPanel->Refresh(false);
trackPanel.UpdateViewIfNoTracks();
trackPanel.Refresh(false);
}
void OnTrackMoveUp(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &tracks = TrackList::Get( project );
Track *const focusedTrack = trackPanel->GetFocusedTrack();
Track *const focusedTrack = trackPanel.GetFocusedTrack();
if (tracks.CanMoveUp(focusedTrack)) {
DoMoveTrack(project, focusedTrack, OnMoveUpID);
trackPanel->Refresh(false);
trackPanel.Refresh(false);
}
}
void OnTrackMoveDown(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &tracks = TrackList::Get( project );
Track *const focusedTrack = trackPanel->GetFocusedTrack();
Track *const focusedTrack = trackPanel.GetFocusedTrack();
if (tracks.CanMoveDown(focusedTrack)) {
DoMoveTrack(project, focusedTrack, OnMoveDownID);
trackPanel->Refresh(false);
trackPanel.Refresh(false);
}
}
void OnTrackMoveTop(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &tracks = TrackList::Get( project );
Track *const focusedTrack = trackPanel->GetFocusedTrack();
Track *const focusedTrack = trackPanel.GetFocusedTrack();
if (tracks.CanMoveUp(focusedTrack)) {
DoMoveTrack(project, focusedTrack, OnMoveTopID);
trackPanel->Refresh(false);
trackPanel.Refresh(false);
}
}
void OnTrackMoveBottom(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &tracks = TrackList::Get( project );
Track *const focusedTrack = trackPanel->GetFocusedTrack();
Track *const focusedTrack = trackPanel.GetFocusedTrack();
if (tracks.CanMoveDown(focusedTrack)) {
DoMoveTrack(project, focusedTrack, OnMoveBottomID);
trackPanel->Refresh(false);
trackPanel.Refresh(false);
}
}

View File

@ -134,7 +134,7 @@ void DoPlayStop(const CommandContext &context)
void DoMoveToLabel(AudacityProject &project, bool next)
{
auto &tracks = TrackList::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
// Find the number of label tracks, and ptr to last track found
auto trackRange = tracks.Any<LabelTrack>();
@ -142,14 +142,14 @@ void DoMoveToLabel(AudacityProject &project, bool next)
auto nLabelTrack = trackRange.size();
if (nLabelTrack == 0 ) {
trackPanel->MessageForScreenReader(_("no label track"));
trackPanel.MessageForScreenReader(_("no label track"));
}
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(
trackPanel.MessageForScreenReader(
_("no label track at or below focused track"));
}
@ -173,17 +173,17 @@ void DoMoveToLabel(AudacityProject &project, bool next)
}
else {
selectedRegion = label->selectedRegion;
trackPanel->ScrollIntoView(selectedRegion.t0());
trackPanel.ScrollIntoView(selectedRegion.t0());
project.RedrawProject();
}
wxString message;
message.Printf(
wxT("%s %d of %d"), label->title, i + 1, lt->GetNumLabels() );
trackPanel->MessageForScreenReader(message);
trackPanel.MessageForScreenReader(message);
}
else {
trackPanel->MessageForScreenReader(_("no labels in label track"));
trackPanel.MessageForScreenReader(_("no labels in label track"));
}
}
}
@ -704,11 +704,11 @@ void OnPlayOneSecond(const CommandContext &context)
if( !MakeReadyToPlay(project) )
return;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto controlToolBar = project.GetControlToolBar();
auto options = project.GetDefaultPlayOptions();
double pos = trackPanel->GetMostRecentXPos();
double pos = trackPanel.GetMostRecentXPos();
controlToolBar->PlayPlayRegion(
SelectedRegion(pos - 0.5, pos + 0.5), options,
PlayMode::oneSecondPlay);
@ -728,11 +728,11 @@ void OnPlayToSelection(const CommandContext &context)
if( !MakeReadyToPlay(project) )
return;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &viewInfo = ViewInfo::Get( project );
const auto &selectedRegion = viewInfo.selectedRegion;
double pos = trackPanel->GetMostRecentXPos();
double pos = trackPanel.GetMostRecentXPos();
double t0,t1;
// check region between pointer and the nearest selection edge

View File

@ -46,7 +46,7 @@ AudacityProject::AttachedWindows::RegisteredFactory sLyricsWindowKey{
double GetZoomOfSelection( const AudacityProject &project )
{
auto &viewInfo = ViewInfo::Get( project );
const auto &trackPanel = *project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
const double lowerBound =
std::max(viewInfo.selectedRegion.t0(),
@ -144,7 +144,7 @@ double GetZoomOfToFit( const AudacityProject &project )
{
auto &tracks = TrackList::Get( project );
auto &viewInfo = ViewInfo::Get( project );
const auto &trackPanel = *project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
const double end = tracks.GetEndTime();
const double start = viewInfo.bScrollBeyondZero
@ -176,7 +176,7 @@ void DoZoomFit(AudacityProject &project)
void DoZoomFitV(AudacityProject &project)
{
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
auto &tracks = TrackList::Get( project );
// Only nonminimized audio tracks will be resized
@ -187,7 +187,7 @@ void DoZoomFitV(AudacityProject &project)
// Find total height to apportion
int height;
trackPanel->GetTracksUsableArea(NULL, &height);
trackPanel.GetTracksUsableArea(NULL, &height);
height -= 28;
// The height of minimized and non-audio tracks cannot be apportioned
@ -215,10 +215,10 @@ void OnZoomIn(const CommandContext &context)
void OnZoomNormal(const CommandContext &context)
{
auto &project = context.project;
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
project.Zoom(ZoomInfo::GetDefaultZoom());
trackPanel->Refresh(false);
trackPanel.Refresh(false);
}
void OnZoomOut(const CommandContext &context)
@ -240,7 +240,7 @@ void OnZoomToggle(const CommandContext &context)
{
auto &project = context.project;
auto &viewInfo = ViewInfo::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
// const double origLeft = viewInfo.h;
// const double origWidth = GetScreenEndTime() - origLeft;
@ -253,7 +253,7 @@ void OnZoomToggle(const CommandContext &context)
fabs(log(Zoom1 / Z)) > fabs(log( Z / Zoom2)) ? Zoom1:Zoom2;
project.Zoom(ChosenZoom);
trackPanel->Refresh(false);
trackPanel.Refresh(false);
// const double newWidth = GetScreenEndTime() - viewInfo.h;
// const double newh = origLeft + (origWidth - newWidth) / 2;
// TP_ScrollWindow(newh);
@ -316,7 +316,7 @@ void OnGoSelStart(const CommandContext &context)
auto &project = context.project;
auto &viewInfo = ViewInfo::Get( project );
auto &selectedRegion = viewInfo.selectedRegion;
auto &trackPanel = *project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
if (selectedRegion.isPoint())
return;
@ -330,7 +330,7 @@ void OnGoSelEnd(const CommandContext &context)
auto &project = context.project;
auto &viewInfo = ViewInfo::Get( project );
auto &selectedRegion = viewInfo.selectedRegion;
auto &trackPanel = *project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
if (selectedRegion.isPoint())
return;
@ -383,7 +383,7 @@ void OnShowClipping(const CommandContext &context)
{
auto &project = context.project;
auto &commandManager = CommandManager::Get( project );
auto trackPanel = project.GetTrackPanel();
auto &trackPanel = TrackPanel::Get( project );
bool checked = !gPrefs->Read(wxT("/GUI/ShowClipping"), 0L);
gPrefs->Write(wxT("/GUI/ShowClipping"), checked);
@ -393,7 +393,7 @@ void OnShowClipping(const CommandContext &context)
wxTheApp->AddPendingEvent(wxCommandEvent{
EVT_PREFS_UPDATE, ShowClippingPrefsID() });
trackPanel->Refresh(false);
trackPanel.Refresh(false);
}
#if defined(EXPERIMENTAL_EFFECTS_RACK)

View File

@ -426,9 +426,9 @@ void SpectrumPrefs::Rollback()
}
if (isOpenPage) {
TrackPanel *const tp = ::GetActiveProject()->GetTrackPanel();
tp->UpdateVRulers();
tp->Refresh(false);
auto &tp = TrackPanel::Get ( *::GetActiveProject() );
tp.UpdateVRulers();
tp.Refresh(false);
}
}
@ -473,9 +473,9 @@ void SpectrumPrefs::Preview()
}
if (isOpenPage) {
TrackPanel *const tp = ::GetActiveProject()->GetTrackPanel();
tp->UpdateVRulers();
tp->Refresh(false);
auto &tp = TrackPanel::Get( *::GetActiveProject() );
tp.UpdateVRulers();
tp.Refresh(false);
}
}

View File

@ -188,9 +188,9 @@ bool WaveformPrefs::Commit()
}
if (isOpenPage) {
TrackPanel *const tp = ::GetActiveProject()->GetTrackPanel();
tp->UpdateVRulers();
tp->Refresh(false);
auto &tp = TrackPanel::Get( *::GetActiveProject() );
tp.UpdateVRulers();
tp.Refresh(false);
}
return true;

View File

@ -1232,7 +1232,7 @@ bool ControlToolBar::DoRecord(AudacityProject &project,
TrackList::Get( *p ).RegisterPendingNewTrack( newTrack );
transportTracks.captureTracks.push_back(newTrack);
// Bug 1548. New track needs the focus.
p->GetTrackPanel()->SetFocusedTrack( newTrack.get() );
TrackPanel::Get( *p ).SetFocusedTrack( newTrack.get() );
}
TrackList::Get( *p ).GroupChannels(*first, recordingChannels);
}

View File

@ -339,7 +339,7 @@ void DeviceToolBar::EnableDisableButtons()
if (focus == mHost || focus == mInput || focus == mOutput || focus == mInputChannels) {
AudacityProject *activeProject = GetActiveProject();
if (activeProject) {
activeProject->GetTrackPanel()->SetFocus();
TrackPanel::Get( *activeProject ).SetFocus();
}
}
}

View File

@ -83,7 +83,7 @@ UIHandlePtr VelocitySliderHandle::HitTest
[]( AudacityProject *pProject, const wxRect &sliderRect, Track *pTrack ) {
return TrackInfo::VelocitySlider
(sliderRect, static_cast<NoteTrack*>( pTrack ), true,
const_cast<TrackPanel*>(pProject->GetTrackPanel()));
&TrackPanel::Get( *pProject ));
};
auto result = std::make_shared<VelocitySliderHandle>(
sliderFn, sliderRect, pTrack );

View File

@ -43,7 +43,7 @@ wxString MuteButtonHandle::Tip(const wxMouseState &) const
auto name = _("Mute");
auto project = ::GetActiveProject();
auto focused =
project->GetTrackPanel()->GetFocusedTrack() == GetTrack().get();
TrackPanel::Get( *project ).GetFocusedTrack() == GetTrack().get();
if (!focused)
return name;
@ -99,7 +99,7 @@ wxString SoloButtonHandle::Tip(const wxMouseState &) const
auto name = _("Solo");
auto project = ::GetActiveProject();
auto focused =
project->GetTrackPanel()->GetFocusedTrack() == GetTrack().get();
TrackPanel::Get( *project ).GetFocusedTrack() == GetTrack().get();
if (!focused)
return name;

View File

@ -931,7 +931,8 @@ void WaveTrackMenuTable::OnSwapChannels(wxCommandEvent &)
if (channels.size() != 2)
return;
Track *const focused = project->GetTrackPanel()->GetFocusedTrack();
auto &trackPanel = TrackPanel::Get( *project );
Track *const focused = trackPanel.GetFocusedTrack();
const bool hasFocus = channels.contains( focused );
auto partner = *channels.rbegin();
@ -943,7 +944,7 @@ void WaveTrackMenuTable::OnSwapChannels(wxCommandEvent &)
tracks.GroupChannels( *partner, 2 );
if (hasFocus)
project->GetTrackPanel()->SetFocusedTrack(partner);
trackPanel.SetFocusedTrack(partner);
/* i18n-hint: The string names a track */
project->PushState(wxString::Format(_("Swapped Channels in '%s'"),

View File

@ -80,7 +80,7 @@ UIHandlePtr GainSliderHandle::HitTest
[]( AudacityProject *pProject, const wxRect &sliderRect, Track *pTrack ) {
return TrackInfo::GainSlider
(sliderRect, static_cast<WaveTrack*>( pTrack ), true,
const_cast<TrackPanel*>(pProject->GetTrackPanel()));
&TrackPanel::Get( *pProject ));
};
auto result =
std::make_shared<GainSliderHandle>( sliderFn, sliderRect2, pTrack );
@ -156,7 +156,7 @@ UIHandlePtr PanSliderHandle::HitTest
[]( AudacityProject *pProject, const wxRect &sliderRect, Track *pTrack ) {
return TrackInfo::PanSlider
(sliderRect, static_cast<WaveTrack*>( pTrack ), true,
const_cast<TrackPanel*>(pProject->GetTrackPanel()));
&TrackPanel::Get( *pProject ));
};
auto result = std::make_shared<PanSliderHandle>(
sliderFn, sliderRect, pTrack );

View File

@ -81,7 +81,7 @@ public:
static const AudacityProject::AttachedObjects::RegisteredFactory key{
[]( AudacityProject &parent ){
auto result = std::make_shared< BackgroundCell >( &parent );
parent.GetTrackPanel()->SetBackgroundCell( result );
TrackPanel::Get( parent ).SetBackgroundCell( result );
return result;
}
};

View File

@ -78,7 +78,8 @@ unsigned CommonTrackPanelCell::HandleWheelRotation
// MM: Zoom in/out when used with Control key down
// We're converting pixel positions to times,
// counting pixels from the left edge of the track.
int trackLeftEdge = pProject->GetTrackPanel()->GetLeftOffset();
auto &trackPanel = TrackPanel::Get( *pProject );
int trackLeftEdge = trackPanel.GetLeftOffset();
// Time corresponding to mouse position
wxCoord xx;
@ -88,7 +89,7 @@ unsigned CommonTrackPanelCell::HandleWheelRotation
// Scrubbing? Expand or contract about the center, ignoring mouse position
if (scrubber.IsScrollScrubbing())
center_h = viewInfo.h +
(pProject->GetTrackPanel()->GetScreenEndTime() - viewInfo.h) / 2.0;
(trackPanel.GetScreenEndTime() - viewInfo.h) / 2.0;
// Zooming out? Focus on mouse.
else if( steps <= 0 )
center_h = mouse_h;

View File

@ -32,7 +32,7 @@ namespace {
static const AudacityProject::AttachedObjects::RegisteredFactory sOverlayKey{
[]( AudacityProject &parent ){
auto result = std::make_shared< EditCursorOverlay >( &parent );
parent.GetTrackPanel()->AddOverlay( result );
TrackPanel::Get( parent ).AddOverlay( result );
return result;
}
};
@ -61,7 +61,7 @@ std::pair<wxRect, bool> EditCursorOverlay::DoGetRectangle(wxSize size)
else {
mCursorTime = selection.t0();
mNewCursorX = ZoomInfo::Get( *mProject ).TimeToPosition(
mCursorTime, mProject->GetTrackPanel()->GetLeftOffset());
mCursorTime, TrackPanel::Get( *mProject ).GetLeftOffset());
}
// Excessive height in case of the ruler, but it matters little.
@ -90,10 +90,11 @@ void EditCursorOverlay::Draw(OverlayPanel &panel, wxDC &dc)
const auto &viewInfo = ZoomInfo::Get( *mProject );
auto &trackPanel = TrackPanel::Get( *mProject );
const bool
onScreen = between_incexc(viewInfo.h,
mCursorTime,
mProject->GetTrackPanel()->GetScreenEndTime());
trackPanel.GetScreenEndTime());
if (!onScreen)
return;
@ -108,7 +109,7 @@ void EditCursorOverlay::Draw(OverlayPanel &panel, wxDC &dc)
if (!pTrack)
return;
if (pTrack->GetSelected() ||
mProject->GetTrackPanel()->GetAx().IsFocused(pTrack))
trackPanel.GetAx().IsFocused(pTrack))
{
// AColor::Line includes both endpoints so use GetBottom()
AColor::Line(dc, mLastCursorX, rect.GetTop(), mLastCursorX, rect.GetBottom());

View File

@ -118,7 +118,7 @@ void PlayIndicatorOverlayBase::Draw(OverlayPanel &panel, wxDC &dc)
static const AudacityProject::AttachedObjects::RegisteredFactory sOverlayKey{
[]( AudacityProject &parent ){
auto result = std::make_shared< PlayIndicatorOverlay >( &parent );
parent.GetTrackPanel()->AddOverlay( result );
TrackPanel::Get( parent ).AddOverlay( result );
return result;
}
};
@ -145,9 +145,9 @@ void PlayIndicatorOverlay::OnTimer(wxCommandEvent &event)
}
}
auto trackPanel = mProject->GetTrackPanel();
auto &trackPanel = TrackPanel::Get( *mProject );
int width;
trackPanel->GetTracksUsableArea(&width, nullptr);
trackPanel.GetTracksUsableArea(&width, nullptr);
if (!mProject->IsAudioActive()) {
mNewIndicatorX = -1;
@ -155,8 +155,8 @@ void PlayIndicatorOverlay::OnTimer(wxCommandEvent &event)
const auto &scrubber = Scrubber::Get( *mProject );
if (scrubber.HasMark()) {
auto position = scrubber.GetScrubStartPosition();
const auto offset = trackPanel->GetLeftOffset();
if(position >= trackPanel->GetLeftOffset() &&
const auto offset = trackPanel.GetLeftOffset();
if(position >= trackPanel.GetLeftOffset() &&
position < offset + width)
mNewIndicatorX = position;
}
@ -173,11 +173,12 @@ void PlayIndicatorOverlay::OnTimer(wxCommandEvent &event)
// Use a small tolerance to avoid flicker of play head pinned all the way
// left or right
auto &trackPanel = TrackPanel::Get( *mProject );
const auto tolerance = pinned ? 1.5 * kTimerInterval / 1000.0 : 0;
bool onScreen = playPos >= 0.0 &&
between_incexc(viewInfo.h - tolerance,
playPos,
mProject->GetTrackPanel()->GetScreenEndTime() + tolerance);
trackPanel.GetScreenEndTime() + tolerance);
// This displays the audio time, too...
mProject->TP_DisplaySelection();
@ -207,7 +208,7 @@ void PlayIndicatorOverlay::OnTimer(wxCommandEvent &event)
onScreen = playPos >= 0.0 &&
between_incexc(viewInfo.h,
playPos,
mProject->GetTrackPanel()->GetScreenEndTime());
trackPanel.GetScreenEndTime());
}
}
@ -217,7 +218,7 @@ void PlayIndicatorOverlay::OnTimer(wxCommandEvent &event)
mProject->TP_RedrawScrollbars();
if (onScreen)
mNewIndicatorX = viewInfo.TimeToPosition(playPos, trackPanel->GetLeftOffset());
mNewIndicatorX = viewInfo.TimeToPosition(playPos, trackPanel.GetLeftOffset());
else
mNewIndicatorX = -1;

View File

@ -350,10 +350,10 @@ bool Scrubber::MaybeStartScrubbing(wxCoord xx)
wxCoord position = xx;
if (abs(mScrubStartPosition - position) >= SCRUBBING_PIXEL_TOLERANCE) {
auto &viewInfo = ViewInfo::Get( *mProject );
TrackPanel *const trackPanel = mProject->GetTrackPanel();
auto &trackPanel = TrackPanel::Get( *mProject );
ControlToolBar * const ctb = mProject->GetControlToolBar();
double maxTime = TrackList::Get( *mProject ).GetEndTime();
const int leftOffset = trackPanel->GetLeftOffset();
const int leftOffset = trackPanel.GetLeftOffset();
double time0 = std::min(maxTime,
viewInfo.PositionToTime(mScrubStartPosition, leftOffset)
);
@ -562,8 +562,8 @@ void Scrubber::ContinueScrubbingPoll()
gAudioIO->UpdateScrub(speed, mOptions);
} else {
const wxMouseState state(::wxGetMouseState());
const auto trackPanel = mProject->GetTrackPanel();
const wxPoint position = trackPanel->ScreenToClient(state.GetPosition());
auto &trackPanel = TrackPanel::Get( *mProject );
const wxPoint position = trackPanel.ScreenToClient(state.GetPosition());
auto &viewInfo = ViewInfo::Get( *mProject );
#ifdef DRAG_SCRUB
if (mDragging && mSmoothScrollingScrub) {
@ -580,7 +580,7 @@ void Scrubber::ContinueScrubbingPoll()
else
#endif
{
const auto origin = trackPanel->GetLeftOffset();
const auto origin = trackPanel.GetLeftOffset();
auto xx = position.x;
if (!seek && !mSmoothScrollingScrub) {
// If mouse is out-of-bounds, so that we scrub at maximum speed
@ -588,7 +588,7 @@ void Scrubber::ContinueScrubbingPoll()
// extreme position to avoid catching-up and halting before the
// screen scrolls.
int width;
trackPanel->GetTracksUsableArea(&width, NULL);
trackPanel.GetTracksUsableArea(&width, NULL);
auto delta = xx - origin;
if (delta < 0)
delta -= width;
@ -797,7 +797,7 @@ double Scrubber::FindScrubSpeed(bool seeking, double time) const
{
auto &viewInfo = ViewInfo::Get( *mProject );
const double screen =
mProject->GetTrackPanel()->GetScreenEndTime() - viewInfo.h;
TrackPanel::Get( *mProject ).GetScreenEndTime() - viewInfo.h;
return (seeking ? FindSeekSpeed : FindScrubbingSpeed)
(viewInfo, mMaxSpeed, screen, time);
}
@ -885,7 +885,7 @@ void Scrubber::Forwarder::OnMouse(wxMouseEvent &event)
static const AudacityProject::AttachedObjects::RegisteredFactory sOverlayKey{
[]( AudacityProject &parent ){
auto result = std::make_shared< ScrubbingOverlay >( &parent );
parent.GetTrackPanel()->AddOverlay( result );
TrackPanel::Get( parent ).AddOverlay( result );
return result;
}
};
@ -981,12 +981,12 @@ void ScrubbingOverlay::OnTimer(wxCommandEvent &event)
mNextScrubRect = wxRect();
}
else {
TrackPanel *const trackPanel = mProject->GetTrackPanel();
TrackPanel &trackPanel = TrackPanel::Get( *mProject );
int panelWidth, panelHeight;
trackPanel->GetSize(&panelWidth, &panelHeight);
trackPanel.GetSize(&panelWidth, &panelHeight);
// Where's the mouse?
position = trackPanel->ScreenToClient(position);
position = trackPanel.ScreenToClient(position);
const bool seeking = scrubber.Seeks() || scrubber.TemporarilySeeks();
@ -996,7 +996,7 @@ void ScrubbingOverlay::OnTimer(wxCommandEvent &event)
scrubber.IsScrollScrubbing()
? scrubber.FindScrubSpeed( seeking,
ViewInfo::Get( *mProject )
.PositionToTime(position.x, trackPanel->GetLeftOffset()))
.PositionToTime(position.x, trackPanel.GetLeftOffset()))
: maxScrubSpeed;
const wxChar *format =
@ -1011,7 +1011,7 @@ void ScrubbingOverlay::OnTimer(wxCommandEvent &event)
// Find the origin for drawing text
wxCoord width, height;
{
wxClientDC dc(trackPanel);
wxClientDC dc( &trackPanel );
static const wxFont labelFont(24, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
dc.SetFont(labelFont);
dc.GetTextExtent(mNextScrubSpeedText, &width, &height);
@ -1047,13 +1047,13 @@ void Scrubber::DoScrub(bool seek)
const bool wasScrubbing = HasMark() || IsScrubbing();
const bool scroll = ShouldScrubPinned();
if (!wasScrubbing) {
auto tp = mProject->GetTrackPanel();
wxCoord xx = tp->ScreenToClient(::wxGetMouseState().GetPosition()).x;
auto &tp = TrackPanel::Get( *mProject );
wxCoord xx = tp.ScreenToClient(::wxGetMouseState().GetPosition()).x;
// Limit x
int width;
tp->GetTracksUsableArea(&width, nullptr);
const auto offset = tp->GetLeftOffset();
tp.GetTracksUsableArea(&width, nullptr);
const auto offset = tp.GetLeftOffset();
xx = (std::max(offset, std::min(offset + width - 1, xx)));
MarkScrubStart(xx, scroll, seek);

View File

@ -534,7 +534,7 @@ UIHandle::Result SelectHandle::Click
mMostRecentX = event.m_x;
mMostRecentY = event.m_y;
TrackPanel *const trackPanel = pProject->GetTrackPanel();
auto &trackPanel = TrackPanel::Get( *pProject );
bool selectChange = (
event.LeftDown() &&
@ -608,7 +608,7 @@ UIHandle::Result SelectHandle::Click
//Actual bIsSelected will always add.
bool bIsSelected = false;
// Don't toggle away the last selected track.
if( !bIsSelected || trackPanel->GetSelectedTrackCount() > 1 )
if( !bIsSelected || trackPanel.GetSelectedTrackCount() > 1 )
selectionState.SelectTrack( *pTrack, !bIsSelected, true );
}
@ -765,7 +765,7 @@ UIHandle::Result SelectHandle::Click
#endif
StartSelection(pProject);
selectionState.SelectTrack( *pTrack, true, true );
trackPanel->SetFocusedTrack(pTrack);
trackPanel.SetFocusedTrack(pTrack);
//On-Demand: check to see if there is an OD thing associated with this track.
pTrack->TypeSwitch( [&](WaveTrack *wt) {
if(ODManager::IsInstanceCreated())
@ -1066,7 +1066,7 @@ void SelectHandle::TimerHandler::OnTimer(wxCommandEvent &event)
// smoother on MacOS 9.
const auto project = mConnectedProject;
const auto trackPanel = project->GetTrackPanel();
const auto &trackPanel = TrackPanel::Get( *project );
if (mParent->mMostRecentX >= mParent->mRect.x + mParent->mRect.width) {
mParent->mAutoScrolling = true;
project->TP_ScrollRight();
@ -1081,7 +1081,7 @@ void SelectHandle::TimerHandler::OnTimer(wxCommandEvent &event)
// track area.
int xx = mParent->mMostRecentX, yy = 0;
trackPanel->ClientToScreen(&xx, &yy);
trackPanel.ClientToScreen(&xx, &yy);
if (xx == 0) {
mParent->mAutoScrolling = true;
project->TP_ScrollLeft();
@ -1104,10 +1104,10 @@ void SelectHandle::TimerHandler::OnTimer(wxCommandEvent &event)
// AS: For some reason, GCC won't let us pass this directly.
wxMouseEvent evt(wxEVT_MOTION);
const auto size = trackPanel->GetSize();
const auto size = trackPanel.GetSize();
mParent->Drag(TrackPanelMouseEvent{ evt, mParent->mRect, size, pTrack }, project);
mParent->mAutoScrolling = false;
mConnectedProject->GetTrackPanel()->Refresh(false);
TrackPanel::Get( *mConnectedProject ).Refresh(false);
}
}
@ -1406,7 +1406,7 @@ void SelectHandle::MoveSnappingFreqSelection
// SelectNone();
// SelectTrack(pTrack, true);
pProject->GetTrackPanel()->SetFocusedTrack(pTrack);
TrackPanel::Get( *pProject ).SetFocusedTrack(pTrack);
}
}

View File

@ -165,7 +165,7 @@ wxString CloseButtonHandle::Tip(const wxMouseState &) const
auto name = _("Close");
auto project = ::GetActiveProject();
auto focused =
project->GetTrackPanel()->GetFocusedTrack() == GetTrack().get();
TrackPanel::Get( *project ).GetFocusedTrack() == GetTrack().get();
if (!focused)
return name;
@ -207,7 +207,7 @@ MenuButtonHandle::~MenuButtonHandle()
UIHandle::Result MenuButtonHandle::CommitChanges
(const wxMouseEvent &, AudacityProject *pProject, wxWindow *WXUNUSED(pParent))
{
auto pPanel = pProject->GetTrackPanel();
auto &trackPanel = TrackPanel::Get( *pProject );
auto pCell = mpCell.lock();
if (!pCell)
return RefreshCode::Cancelled;
@ -215,7 +215,8 @@ UIHandle::Result MenuButtonHandle::CommitChanges
static_cast<CommonTrackPanelCell*>(pCell.get())->FindTrack();
if (!pTrack)
return RefreshCode::Cancelled;
pPanel->CallAfter( [=]{ pPanel->OnTrackMenu( pTrack.get() ); } );
trackPanel.CallAfter(
[&trackPanel,pTrack]{ trackPanel.OnTrackMenu( pTrack.get() ); } );
return RefreshCode::RefreshNone;
}
@ -224,7 +225,7 @@ wxString MenuButtonHandle::Tip(const wxMouseState &) const
auto name = _("Open menu...");
auto project = ::GetActiveProject();
auto focused =
project->GetTrackPanel()->GetFocusedTrack() == GetTrack().get();
TrackPanel::Get( *project ).GetFocusedTrack() == GetTrack().get();
if (!focused)
return name;

View File

@ -143,7 +143,7 @@ UIHandle::Result TrackSelectHandle::Drag
HitTestPreview TrackSelectHandle::Preview
(const TrackPanelMouseState &, const AudacityProject *project)
{
const auto trackCount = project->GetTrackPanel()->GetTrackCount();
const auto trackCount = TrackPanel::Get( *project ).GetTrackCount();
auto message = Message(trackCount);
if (mClicked) {
static auto disabledCursor =