Audacity 3.2.0
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
AdornedRulerPanel::ScrubbingRulerOverlay Class Referencefinal
Inheritance diagram for AdornedRulerPanel::ScrubbingRulerOverlay:
[legend]
Collaboration diagram for AdornedRulerPanel::ScrubbingRulerOverlay:
[legend]

Public Member Functions

 ScrubbingRulerOverlay (TrackPanelGuidelineOverlay &partner)
 
void Update ()
 
- Public Member Functions inherited from Overlay
 Overlay ()=default
 
 Overlay (const Overlay &)=delete
 
Overlayoperator= (const Overlay &)=delete
 
virtual ~Overlay ()=0
 
virtual unsigned SequenceNumber () const =0
 This number determines an ordering of overlays, so that those with higher numbers overpaint those with lower numbers that intersect. More...
 
std::pair< wxRect, bool > GetRectangle (wxSize size)
 
virtual std::pair< wxRect, bool > DoGetRectangle (wxSize size)=0
 
virtual void Erase (wxDC &dc, wxDC &src)
 
virtual void Draw (OverlayPanel &panel, wxDC &dc)=0
 

Public Attributes

int mNewQPIndicatorPos { -1 }
 
int mNewIndicatorSnapped { -1 }
 
bool mNewScrub {}
 
bool mNewSeek {}
 

Private Member Functions

AdornedRulerPanelGetRuler () const
 
unsigned SequenceNumber () const override
 This number determines an ordering of overlays, so that those with higher numbers overpaint those with lower numbers that intersect. More...
 
std::pair< wxRect, bool > DoGetRectangle (wxSize size) override
 
void Draw (OverlayPanel &panel, wxDC &dc) override
 

Private Attributes

TrackPanelGuidelineOverlaymPartner
 
int mOldQPIndicatorPos { -1 }
 
bool mOldScrub {}
 
bool mOldSeek {}
 

Detailed Description

Definition at line 422 of file AdornedRulerPanel.cpp.

Constructor & Destructor Documentation

◆ ScrubbingRulerOverlay()

AdornedRulerPanel::ScrubbingRulerOverlay::ScrubbingRulerOverlay ( TrackPanelGuidelineOverlay partner)

Definition at line 493 of file AdornedRulerPanel.cpp.

495: mPartner(partner)
496{
497}

Member Function Documentation

◆ DoGetRectangle()

std::pair< wxRect, bool > AdornedRulerPanel::ScrubbingRulerOverlay::DoGetRectangle ( wxSize  size)
overrideprivatevirtual

Implements Overlay.

Definition at line 554 of file AdornedRulerPanel.cpp.

555{
556 Update();
557
558 const auto x = mOldQPIndicatorPos;
559 if (x >= 0) {
560 // These dimensions are always sufficient, even if a little
561 // excessive for the small triangle:
562 const int width = IndicatorBigWidth() * 3 / 2;
563 //const auto height = IndicatorHeightForWidth(width);
564
565 const int indsize = width / 2;
566
567 auto xx = x - indsize;
568 auto yy = 0;
569 return {
570 { xx, yy,
571 indsize * 2 + 1,
572 GetRuler()->GetSize().GetHeight() },
574 || (mOldScrub != mNewScrub)
575 || (mOldSeek != mNewSeek) )
576 };
577 }
578 else
579 return { {}, mNewQPIndicatorPos >= 0 };
580}
int IndicatorBigWidth()

References IndicatorBigWidth().

Here is the call graph for this function:

◆ Draw()

void AdornedRulerPanel::ScrubbingRulerOverlay::Draw ( OverlayPanel panel,
wxDC &  dc 
)
overrideprivatevirtual

Implements Overlay.

Definition at line 582 of file AdornedRulerPanel.cpp.

584{
588 if (mOldQPIndicatorPos >= 0) {
589 auto ruler = GetRuler();
591 ruler->DoDrawScrubIndicator(
593 }
594}
@ IndicatorSmallWidth

References IndicatorBigWidth(), IndicatorSmallWidth, and anonymous_namespace{TimeTrackVRulerControls.cpp}::ruler().

Here is the call graph for this function:

◆ GetRuler()

AdornedRulerPanel * AdornedRulerPanel::ScrubbingRulerOverlay::GetRuler ( ) const
private

Definition at line 499 of file AdornedRulerPanel.cpp.

500{
501 return &Get( *mPartner.mProject );
502}
static AdornedRulerPanel & Get(AudacityProject &project)

References AdornedRulerPanel::Get().

Here is the call graph for this function:

◆ SequenceNumber()

unsigned AdornedRulerPanel::ScrubbingRulerOverlay::SequenceNumber ( ) const
overrideprivatevirtual

This number determines an ordering of overlays, so that those with higher numbers overpaint those with lower numbers that intersect.

Implements Overlay.

Definition at line 548 of file AdornedRulerPanel.cpp.

549{
550 return 30;
551}

◆ Update()

void AdornedRulerPanel::ScrubbingRulerOverlay::Update ( )

Definition at line 504 of file AdornedRulerPanel.cpp.

505{
506 const auto project = mPartner.mProject;
507 auto &scrubber = Scrubber::Get( *project );
508 auto ruler = GetRuler();
509
510 bool scrubbing = (scrubber.IsScrubbing()
511 && !scrubber.IsSpeedPlaying()
512 && !scrubber.IsKeyboardScrubbing());
513
514 // Hide during transport, or if mouse is not in the ruler, unless scrubbing
515 if ((!ruler->LastCell() || ProjectAudioIO::Get( *project ).IsAudioActive())
516 && !scrubbing)
518 else {
519 const auto &selectedRegion = ViewInfo::Get( *project ).selectedRegion;
520 double latestEnd =
521 std::max(ruler->mTracks->GetEndTime(), selectedRegion.t1());
522 // This will determine the x coordinate of the line and of the
523 // ruler indicator
524
525 // Test all snap points
527 for (size_t ii = 0;
528 mNewIndicatorSnapped == -1 && ii < ruler->mNumGuides; ++ii) {
529 if (ruler->mIsSnapped[ii]) {
531 }
532 }
533 mNewQPIndicatorPos = ruler->Time2Pos(
534 ruler->mQuickPlayPos[std::max(0, mNewIndicatorSnapped)]);
535
536 // These determine which shape is drawn on the ruler, and whether
537 // in the scrub or the qp zone
538 mNewScrub =
539 !ruler->IsMouseCaptured() && // not doing some other drag in the ruler
540 (ruler->LastCell() == ruler->mScrubbingCell ||
541 (scrubber.HasMark()));
543 (scrubber.Seeks() || scrubber.TemporarilySeeks());
544 }
545}
const auto project
bool IsAudioActive() const
static ProjectAudioIO & Get(AudacityProject &project)
static Scrubber & Get(AudacityProject &project)
Definition: Scrubbing.cpp:186
NotifyingSelectedRegion selectedRegion
Definition: ViewInfo.h:216
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:235

References ProjectAudioIO::Get(), ViewInfo::Get(), Scrubber::Get(), ProjectAudioIO::IsAudioActive(), project, anonymous_namespace{TimeTrackVRulerControls.cpp}::ruler(), and ViewInfo::selectedRegion.

Here is the call graph for this function:

Member Data Documentation

◆ mNewIndicatorSnapped

int AdornedRulerPanel::ScrubbingRulerOverlay::mNewIndicatorSnapped { -1 }

Definition at line 428 of file AdornedRulerPanel.cpp.

◆ mNewQPIndicatorPos

int AdornedRulerPanel::ScrubbingRulerOverlay::mNewQPIndicatorPos { -1 }

Definition at line 427 of file AdornedRulerPanel.cpp.

◆ mNewScrub

bool AdornedRulerPanel::ScrubbingRulerOverlay::mNewScrub {}

Definition at line 430 of file AdornedRulerPanel.cpp.

◆ mNewSeek

bool AdornedRulerPanel::ScrubbingRulerOverlay::mNewSeek {}

Definition at line 431 of file AdornedRulerPanel.cpp.

◆ mOldQPIndicatorPos

int AdornedRulerPanel::ScrubbingRulerOverlay::mOldQPIndicatorPos { -1 }
private

Definition at line 446 of file AdornedRulerPanel.cpp.

◆ mOldScrub

bool AdornedRulerPanel::ScrubbingRulerOverlay::mOldScrub {}
private

Definition at line 447 of file AdornedRulerPanel.cpp.

◆ mOldSeek

bool AdornedRulerPanel::ScrubbingRulerOverlay::mOldSeek {}
private

Definition at line 448 of file AdornedRulerPanel.cpp.

◆ mPartner

TrackPanelGuidelineOverlay& AdornedRulerPanel::ScrubbingRulerOverlay::mPartner
private

Definition at line 443 of file AdornedRulerPanel.cpp.


The documentation for this class was generated from the following file: