From 25c1a0b2803795e5d3b920449acdd45f5d47c81c Mon Sep 17 00:00:00 2001 From: David Bailes Date: Tue, 7 Jul 2020 16:25:12 +0100 Subject: [PATCH] Bug 2422 - Append Recording always scrolls vertically to bottom track Fix: Move the scrolling to ProjectAudioManager::DoRecord(), where it's known whether the recording is appending to existing tracks or not. --- src/ProjectAudioManager.cpp | 2 ++ src/TrackPanel.cpp | 20 ++++---------------- src/TrackPanel.h | 7 ------- 3 files changed, 6 insertions(+), 23 deletions(-) diff --git a/src/ProjectAudioManager.cpp b/src/ProjectAudioManager.cpp index 1956eaddb..bc3599e5f 100644 --- a/src/ProjectAudioManager.cpp +++ b/src/ProjectAudioManager.cpp @@ -733,6 +733,8 @@ bool ProjectAudioManager::DoRecord(AudacityProject &project, TrackList::Get( *p ).GroupChannels(*first, recordingChannels); // Bug 1548. First of new tracks needs the focus. TrackFocus::Get(*p).Set(first); + if (TrackList::Get(*p).back()) + TrackList::Get(*p).back()->EnsureVisible(); } //Automated Input Level Adjustment Initialization diff --git a/src/TrackPanel.cpp b/src/TrackPanel.cpp index 748617f30..ab81e7939 100644 --- a/src/TrackPanel.cpp +++ b/src/TrackPanel.cpp @@ -280,8 +280,6 @@ TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id, *this, std::move( pAx ) ); } - mRedrawAfterStop = false; - mTrackArtist = std::make_unique( this ); mTimeCount = 0; @@ -418,8 +416,6 @@ void TrackPanel::OnTimer(wxTimerEvent& ) { projectAudioIO.SetAudioIOToken(0); window.RedrawProject(); - - mRedrawAfterStop = false; } if (mLastDrawnSelectedRegion != mViewInfo->selectedRegion) { UpdateSelectionDisplay(); @@ -438,20 +434,12 @@ void TrackPanel::OnTimer(wxTimerEvent& ) // Periodically update the display while recording - if (!mRedrawAfterStop) { - mRedrawAfterStop = true; - MakeParentRedrawScrollbars(); - mListener->TP_ScrollUpDown( 99999999 ); + if ((mTimeCount % 5) == 0) { + // Must tell OnPaint() to recreate the backing bitmap + // since we've not done a full refresh. + mRefreshBacking = true; Refresh( false ); } - else { - if ((mTimeCount % 5) == 0) { - // Must tell OnPaint() to recreate the backing bitmap - // since we've not done a full refresh. - mRefreshBacking = true; - Refresh( false ); - } - } } if(mTimeCount > 1000) mTimeCount = 0; diff --git a/src/TrackPanel.h b/src/TrackPanel.h index 0c8102958..b894eb66a 100644 --- a/src/TrackPanel.h +++ b/src/TrackPanel.h @@ -202,13 +202,6 @@ protected: bool mRefreshBacking; -#ifdef EXPERIMENTAL_SPECTRAL_EDITING - -protected: - -#endif - - bool mRedrawAfterStop; protected: