1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-23 07:40:05 +02:00

Fix some display problems in scrolling play: mitigate scrollbar flashing, and...

This commit is contained in:
Paul Licameli 2016-05-03 23:38:59 -04:00
commit ac5e6a021d
2 changed files with 27 additions and 4 deletions

View File

@ -243,10 +243,31 @@ public:
} }
} }
void SetScrollbar(int position, int thumbSize,
int range, int pageSize,
bool refresh = true) override;
private: private:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
void ScrollBar::SetScrollbar(int position, int thumbSize,
int range, int pageSize,
bool refresh)
{
// Mitigate flashing of scrollbars by refreshing only when something really changes.
auto changed =
position != GetThumbPosition() ||
thumbSize != GetThumbSize() ||
range != GetRange() ||
pageSize != GetPageSize();
if (!changed)
return;
wxScrollBar::SetScrollbar(position, thumbSize, range, pageSize, refresh);
}
BEGIN_EVENT_TABLE(ScrollBar, wxScrollBar) BEGIN_EVENT_TABLE(ScrollBar, wxScrollBar)
EVT_SET_FOCUS(ScrollBar::OnSetFocus) EVT_SET_FOCUS(ScrollBar::OnSetFocus)
END_EVENT_TABLE() END_EVENT_TABLE()
@ -1775,7 +1796,6 @@ void AudacityProject::FixScrollbars()
mHsbar->SetScrollbar(scaledSbarH + offset, scaledSbarScreen, scaledSbarTotal, mHsbar->SetScrollbar(scaledSbarH + offset, scaledSbarScreen, scaledSbarTotal,
scaledSbarScreen, TRUE); scaledSbarScreen, TRUE);
mHsbar->Refresh();
} }
// Vertical scrollbar // Vertical scrollbar
@ -1783,7 +1803,6 @@ void AudacityProject::FixScrollbars()
panelHeight / mViewInfo.scrollStep, panelHeight / mViewInfo.scrollStep,
totalHeight / mViewInfo.scrollStep, totalHeight / mViewInfo.scrollStep,
panelHeight / mViewInfo.scrollStep, TRUE); panelHeight / mViewInfo.scrollStep, TRUE);
mVsbar->Refresh();
if (refresh || (rescroll && if (refresh || (rescroll &&
(GetScreenEndTime() - mViewInfo.h) < mViewInfo.total)) { (GetScreenEndTime() - mViewInfo.h) < mViewInfo.total)) {

View File

@ -479,13 +479,17 @@ void TranscriptionToolBar::OnPlaySpeed(wxCommandEvent & WXUNUSED(event))
auto doubleClicked = button->IsDoubleClicked(); auto doubleClicked = button->IsDoubleClicked();
button->ClearDoubleClicked(); button->ClearDoubleClicked();
if (doubleClicked) if (doubleClicked) {
GetActiveProject()->GetPlaybackScroller().Activate(true); GetActiveProject()->GetPlaybackScroller().Activate(true);
// Pop up the button
SetButton(false, button);
}
else { else {
// Let control have precedence over shift // Let control have precedence over shift
const bool cutPreview = mButtons[TTB_PlaySpeed]->WasControlDown(); const bool cutPreview = mButtons[TTB_PlaySpeed]->WasControlDown();
const bool looped = !cutPreview && const bool looped = !cutPreview &&
button->WasShiftDown(); button->WasShiftDown();
PlayAtSpeed(looped, cutPreview); PlayAtSpeed(looped, cutPreview);
} }
} }