1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-25 16:48:44 +02:00

Avoid wasteful Refresh() in stereo track spectrogram view.

Thanks to Darrell Walisser for the outline of the problem, which was causing laggy dragging of stereo track sizes in spectrogram view.
This was caused by refreshing the horizontal ruler unnecessarily.
This commit is contained in:
James Crook 2016-09-11 16:52:49 +01:00
parent 8b9fab8ff5
commit 4251ef8c48

View File

@ -4860,9 +4860,7 @@ void TrackPanel::HandleSliders(wxMouseEvent &event, bool pan)
void TrackPanel::OnTrackListResized(wxCommandEvent & e)
{
Track *t = (Track *) e.GetClientData();
UpdateVRuler(t);
e.Skip();
}
@ -7289,16 +7287,20 @@ void TrackPanel::UpdateVRulerSize()
TrackListIterator iter(GetTracks());
Track *t = iter.First();
if (t) {
// Find the maximum of the VRuler sizes.
// We are only interested in width in fact.
wxSize s = t->vrulerSize;
while (t) {
s.IncTo(t->vrulerSize);
t = iter.Next();
}
if (vrulerSize != s) {
vrulerSize = s;
// If the width of the VRuler has changed, we need to
// shift the HRuler
if (vrulerSize.GetWidth() != s.GetWidth()) {
mRuler->SetLeftOffset(GetLeftOffset()); // bevel on AdornedRuler
mRuler->Refresh();
}
vrulerSize = s;
}
Refresh(false);
}