mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-03 22:19:07 +02:00
Bug1676, more: don't bother caching the first visible track...
... because the sequence of update of the cache and the use of it were wrong on Linux, resulting in wrong display when dragging tracks. Finding the first visible track is too cheap to justify this memoizing of it. Commit 8eb64f5f71d19a4c634cb8312fd1fa93ac75f17f was not sufficient to fix the bug, but I think remains necessary. It feels good to throw away this needless complication.
This commit is contained in:
parent
eb7260320a
commit
95560ad510
@ -949,20 +949,6 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
|
||||
|
||||
mLastSavedTracks.reset();
|
||||
|
||||
// Register for tracklist updates
|
||||
mTracks->Connect(EVT_TRACKLIST_PERMUTED,
|
||||
wxCommandEventHandler(AudacityProject::OnTrackListUpdate),
|
||||
NULL,
|
||||
this);
|
||||
mTracks->Connect(EVT_TRACKLIST_DELETION,
|
||||
wxCommandEventHandler(AudacityProject::OnTrackListUpdate),
|
||||
NULL,
|
||||
this);
|
||||
mTracks->Connect(EVT_TRACKLIST_RESIZING,
|
||||
wxCommandEventHandler(AudacityProject::OnTrackListUpdate),
|
||||
NULL,
|
||||
this);
|
||||
|
||||
//
|
||||
// Initialize view info (shared with TrackPanel)
|
||||
//
|
||||
@ -1984,9 +1970,6 @@ void AudacityProject::FixScrollbars()
|
||||
rescroll = false;
|
||||
}
|
||||
|
||||
if (lastv != mViewInfo.vpos)
|
||||
InvalidateFirstVisible();
|
||||
|
||||
// wxScrollbar only supports int values but we need a greater range, so
|
||||
// we scale the scrollbar coordinates on demand. We only do this if we
|
||||
// would exceed the int range, so we can always use the maximum resolution
|
||||
@ -2035,8 +2018,8 @@ void AudacityProject::FixScrollbars()
|
||||
|
||||
std::shared_ptr<Track> AudacityProject::GetFirstVisible()
|
||||
{
|
||||
auto pTrack = mViewInfo.track.lock();
|
||||
if (!pTrack && GetTracks()) {
|
||||
std::shared_ptr<Track> pTrack;
|
||||
if (GetTracks()) {
|
||||
// Recompute on demand and memo-ize
|
||||
TrackListIterator iter(GetTracks());
|
||||
for (Track *t = iter.First(); t; t = iter.Next()) {
|
||||
@ -2048,17 +2031,11 @@ std::shared_ptr<Track> AudacityProject::GetFirstVisible()
|
||||
break;
|
||||
}
|
||||
}
|
||||
mViewInfo.track = pTrack;
|
||||
}
|
||||
|
||||
return pTrack;
|
||||
}
|
||||
|
||||
void AudacityProject::InvalidateFirstVisible()
|
||||
{
|
||||
mViewInfo.track.reset();
|
||||
}
|
||||
|
||||
void AudacityProject::UpdateLayout()
|
||||
{
|
||||
if (!mTrackPanel)
|
||||
@ -2213,14 +2190,6 @@ void AudacityProject::OnToolBarUpdate(wxCommandEvent & event)
|
||||
event.Skip(false); /* No need to propagate any further */
|
||||
}
|
||||
|
||||
// The projects tracklist has been updated
|
||||
void AudacityProject::OnTrackListUpdate(wxCommandEvent & event)
|
||||
{
|
||||
InvalidateFirstVisible();
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
///Handles the redrawing necessary for tasks as they partially update in the background.
|
||||
void AudacityProject::OnODTaskUpdate(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
@ -2267,9 +2236,6 @@ void AudacityProject::DoScroll()
|
||||
int lastv = mViewInfo.vpos;
|
||||
mViewInfo.vpos = mVsbar->GetThumbPosition() * mViewInfo.scrollStep;
|
||||
|
||||
if (lastv != mViewInfo.vpos)
|
||||
InvalidateFirstVisible();
|
||||
|
||||
//mchinen: do not always set this project to be the active one.
|
||||
//a project may autoscroll while playing in the background
|
||||
//I think this is okay since OnMouseEvent has one of these.
|
||||
@ -2675,20 +2641,6 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event)
|
||||
|
||||
mImportXMLTagHandler.reset();
|
||||
|
||||
// Unregister for tracklist updates
|
||||
mTracks->Disconnect(EVT_TRACKLIST_PERMUTED,
|
||||
wxCommandEventHandler(AudacityProject::OnTrackListUpdate),
|
||||
NULL,
|
||||
this);
|
||||
mTracks->Disconnect(EVT_TRACKLIST_DELETION,
|
||||
wxCommandEventHandler(AudacityProject::OnTrackListUpdate),
|
||||
NULL,
|
||||
this);
|
||||
mTracks->Disconnect(EVT_TRACKLIST_RESIZING,
|
||||
wxCommandEventHandler(AudacityProject::OnTrackListUpdate),
|
||||
NULL,
|
||||
this);
|
||||
|
||||
// Delete all the tracks to free up memory and DirManager references.
|
||||
mTracks->Clear();
|
||||
mTracks.reset();
|
||||
@ -3523,7 +3475,6 @@ bool AudacityProject::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
||||
|
||||
if (longVpos != 0) {
|
||||
// PRL: It seems this must happen after SetSnapTo
|
||||
mViewInfo.track.reset();
|
||||
mViewInfo.vpos = longVpos;
|
||||
mbInitializingScrollbar = true;
|
||||
}
|
||||
|
@ -192,7 +192,6 @@ class AUDACITY_DLL_API AudacityProject final : public wxFrame,
|
||||
ViewInfo &GetViewInfo() { return mViewInfo; }
|
||||
|
||||
std::shared_ptr<Track> GetFirstVisible();
|
||||
void InvalidateFirstVisible();
|
||||
|
||||
void GetPlayRegion(double* playRegionStart, double *playRegionEnd);
|
||||
bool IsPlayRegionLocked() { return mLockPlayRegion; }
|
||||
@ -357,7 +356,6 @@ public:
|
||||
void OnOpenAudioFile(wxCommandEvent & event);
|
||||
void OnODTaskUpdate(wxCommandEvent & event);
|
||||
void OnODTaskComplete(wxCommandEvent & event);
|
||||
void OnTrackListUpdate(wxCommandEvent & event);
|
||||
|
||||
void HandleResize();
|
||||
void UpdateLayout();
|
||||
|
@ -158,8 +158,6 @@ public:
|
||||
|
||||
// Scroll info
|
||||
|
||||
std::weak_ptr<Track> track; // first visible track
|
||||
|
||||
double total; // total width in secs
|
||||
// Current horizontal scroll bar positions, in pixels
|
||||
wxInt64 sbarH;
|
||||
|
Loading…
x
Reference in New Issue
Block a user