MCPcopy Create free account
hub / github.com/audacity/audacity / DoDrawScrubIndicator

Method DoDrawScrubIndicator

src/AdornedRulerPanel.cpp:2606–2663  ·  view source on GitHub ↗

Draws the scrubbing/seeking indicator.

Source from the content-addressed store, hash-verified

2604
2605// Draws the scrubbing/seeking indicator.
2606void AdornedRulerPanel::DoDrawScrubIndicator(
2607 wxDC * dc, wxCoord xx, int width, bool scrub, bool seek)
2608{
2609 ADCChanger changer(dc); // Undo pen and brush changes at function exit
2610
2611 wxPoint tri[ 3 ];
2612 if (seek) {
2613 auto height = IndicatorHeightForWidth(width);
2614 // Make four triangles
2615 const int TriangleWidth = width * 3 / 8;
2616
2617 // Double-double headed, left-right
2618 auto yy = ShowingScrubRuler()
2619 ? mScrubZone.y
2620 : (mInner.GetBottom() + 1) - 1 /* bevel */ - height;
2621 tri[ 0 ].x = xx - IndicatorOffset;
2622 tri[ 0 ].y = yy;
2623 tri[ 1 ].x = xx - IndicatorOffset;
2624 tri[ 1 ].y = yy + height;
2625 tri[ 2 ].x = xx - TriangleWidth;
2626 tri[ 2 ].y = yy + height / 2;
2627 dc->DrawPolygon( 3, tri );
2628
2629 tri[ 0 ].x -= TriangleWidth;
2630 tri[ 1 ].x -= TriangleWidth;
2631 tri[ 2 ].x -= TriangleWidth;
2632 dc->DrawPolygon( 3, tri );
2633
2634 tri[ 0 ].x = tri[ 1 ].x = xx + IndicatorOffset;
2635 tri[ 2 ].x = xx + TriangleWidth;
2636 dc->DrawPolygon( 3, tri );
2637
2638
2639 tri[ 0 ].x += TriangleWidth;
2640 tri[ 1 ].x += TriangleWidth;
2641 tri[ 2 ].x += TriangleWidth;
2642 dc->DrawPolygon( 3, tri );
2643 }
2644 else if (scrub) {
2645 auto height = IndicatorHeightForWidth(width);
2646 const int IndicatorHalfWidth = width / 2;
2647
2648 // Double headed, left-right
2649 auto yy = ShowingScrubRuler()
2650 ? mScrubZone.y
2651 : (mInner.GetBottom() + 1) - 1 /* bevel */ - height;
2652 tri[ 0 ].x = xx - IndicatorOffset;
2653 tri[ 0 ].y = yy;
2654 tri[ 1 ].x = xx - IndicatorOffset;
2655 tri[ 1 ].y = yy + height;
2656 tri[ 2 ].x = xx - IndicatorHalfWidth;
2657 tri[ 2 ].y = yy + height / 2;
2658 dc->DrawPolygon( 3, tri );
2659 tri[ 0 ].x = tri[ 1 ].x = xx + IndicatorOffset;
2660 tri[ 2 ].x = xx + IndicatorHalfWidth;
2661 dc->DrawPolygon( 3, tri );
2662 }
2663}

Callers 1

DrawMethod · 0.80

Calls 1

IndicatorHeightForWidthFunction · 0.85

Tested by

no test coverage detected