1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-04 17:49:45 +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:
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)
EVT_SET_FOCUS(ScrollBar::OnSetFocus)
END_EVENT_TABLE()
@ -1775,7 +1796,6 @@ void AudacityProject::FixScrollbars()
mHsbar->SetScrollbar(scaledSbarH + offset, scaledSbarScreen, scaledSbarTotal,
scaledSbarScreen, TRUE);
mHsbar->Refresh();
}
// Vertical scrollbar
@ -1783,7 +1803,6 @@ void AudacityProject::FixScrollbars()
panelHeight / mViewInfo.scrollStep,
totalHeight / mViewInfo.scrollStep,
panelHeight / mViewInfo.scrollStep, TRUE);
mVsbar->Refresh();
if (refresh || (rescroll &&
(GetScreenEndTime() - mViewInfo.h) < mViewInfo.total)) {

View File

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