1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-07 07:39:29 +02:00

Scrub handle changes appearance for seeking

This commit is contained in:
Paul Licameli 2016-06-02 16:05:56 -04:00
parent bbb93a7400
commit 364794fd68
3 changed files with 41 additions and 7 deletions

View File

@ -99,7 +99,7 @@ void PlayIndicatorOverlayBase::Draw(OverlayPanel &panel, wxDC &dc)
else if(auto ruler = dynamic_cast<AdornedRulerPanel*>(&panel)) {
wxASSERT(!mIsMaster);
ruler->DoDrawIndicator(&dc, mLastIndicatorX, !rec, IndicatorMediumWidth, false);
ruler->DoDrawIndicator(&dc, mLastIndicatorX, !rec, IndicatorMediumWidth, false, false);
}
else
wxASSERT(false);

View File

@ -1791,7 +1791,7 @@ std::pair<wxRect, bool> QuickPlayRulerOverlay::DoGetRectangle(wxSize size)
if (x >= 0) {
// These dimensions are always sufficient, even if a little
// excessive for the small triangle:
const int width = IndicatorBigWidth();
const int width = IndicatorBigWidth() * 3 / 2;
const auto height = IndicatorHeightForWidth(width);
const int indsize = width / 2;
@ -1814,12 +1814,14 @@ void QuickPlayRulerOverlay::Draw(OverlayPanel &panel, wxDC &dc)
mOldQPIndicatorPos = mNewQPIndicatorPos;
if (mOldQPIndicatorPos >= 0) {
auto ruler = GetRuler();
const auto &scrubber = mPartner.mProject->GetScrubber();
auto scrub =
ruler->mMouseEventState == AdornedRulerPanel::mesNone &&
(ruler->mPrevZone == AdornedRulerPanel::StatusChoice::EnteringScrubZone ||
(mPartner.mProject->GetScrubber().HasStartedScrubbing()));
(scrubber.HasStartedScrubbing()));
auto seek = scrub && scrubber.Seeks();
auto width = scrub ? IndicatorBigWidth() : IndicatorSmallWidth;
ruler->DoDrawIndicator(&dc, mOldQPIndicatorPos, true, width, scrub);
ruler->DoDrawIndicator(&dc, mOldQPIndicatorPos, true, width, scrub, seek);
}
}
@ -3162,14 +3164,46 @@ void AdornedRulerPanel::SetLeftOffset(int offset)
// Draws the play/recording position indicator.
void AdornedRulerPanel::DoDrawIndicator
(wxDC * dc, wxCoord xx, bool playing, int width, bool scrub)
(wxDC * dc, wxCoord xx, bool playing, int width, bool scrub, bool seek)
{
ADCChanger changer(dc); // Undo pen and brush changes at function exit
AColor::IndicatorColor( dc, playing );
wxPoint tri[ 3 ];
if (scrub) {
if (seek) {
auto height = IndicatorHeightForWidth(width);
// Make four triangles
const int TriangleWidth = width * 3 / 8;
// Double-double headed, left-right
auto yy = mShowScrubbing
? mScrubZone.y
: (mInner.GetBottom() + 1) - 1 /* bevel */ - height;
tri[ 0 ].x = xx - IndicatorOffset;
tri[ 0 ].y = yy;
tri[ 1 ].x = xx - IndicatorOffset;
tri[ 1 ].y = yy + height;
tri[ 2 ].x = xx - TriangleWidth;
tri[ 2 ].y = yy + height / 2;
dc->DrawPolygon( 3, tri );
tri[ 0 ].x -= TriangleWidth;
tri[ 1 ].x -= TriangleWidth;
tri[ 2 ].x -= TriangleWidth;
dc->DrawPolygon( 3, tri );
tri[ 0 ].x = tri[ 1 ].x = xx + IndicatorOffset;
tri[ 2 ].x = xx + TriangleWidth;
dc->DrawPolygon( 3, tri );
tri[ 0 ].x += TriangleWidth;
tri[ 1 ].x += TriangleWidth;
tri[ 2 ].x += TriangleWidth;
dc->DrawPolygon( 3, tri );
}
else if (scrub) {
auto height = IndicatorHeightForWidth(width);
const int IndicatorHalfWidth = width / 2;

View File

@ -351,7 +351,7 @@ private:
void DoDrawSelection(wxDC * dc);
public:
void DoDrawIndicator(wxDC * dc, wxCoord xx, bool playing, int width, bool scrub);
void DoDrawIndicator(wxDC * dc, wxCoord xx, bool playing, int width, bool scrub, bool seek);
void UpdateButtonStates();
private: