Audacity 3.2.0
Public Member Functions | Public Attributes | List of all members
LabelTrackHit Struct Reference

#include <LabelGlyphHandle.h>

Collaboration diagram for LabelTrackHit:
[legend]

Public Member Functions

 LabelTrackHit (const std::shared_ptr< LabelTrack > &pLT)
 
 ~LabelTrackHit ()
 
void OnLabelPermuted (const LabelTrackEvent &e)
 

Public Attributes

int mEdge {}
 
int mMouseOverLabel { -1 }
 
int mMouseOverLabelLeft { -1 }
 Keeps track of which (ranged) label the mouse is currently over. More...
 
int mMouseOverLabelRight { -1 }
 Keeps track of which left label the mouse is currently over. More...
 
bool mIsAdjustingLabel {}
 Keeps track of which right label the mouse is currently over. More...
 
std::shared_ptr< LabelTrackmpLT {}
 
Observer::Subscription mSubscription
 

Detailed Description

mEdge: 0 if not over a glyph, else a bitwise or of : 1 if over the left-hand glyph, 2 if over the right-hand glyph on a label, 4 if over center.

mMouseLabelLeft - index of any left label hit mMouseLabelRight - index of any right label hit

Definition at line 33 of file LabelGlyphHandle.h.

Constructor & Destructor Documentation

◆ LabelTrackHit()

LabelTrackHit::LabelTrackHit ( const std::shared_ptr< LabelTrack > &  pLT)

Definition at line 31 of file LabelGlyphHandle.cpp.

32 : mpLT{ pLT }
33{
34 mSubscription = pLT->Subscribe( *this, &LabelTrackHit::OnLabelPermuted );
35}
std::shared_ptr< LabelTrack > mpLT
void OnLabelPermuted(const LabelTrackEvent &e)
Observer::Subscription mSubscription

References mSubscription, and OnLabelPermuted().

Here is the call graph for this function:

◆ ~LabelTrackHit()

LabelTrackHit::~LabelTrackHit ( )

Definition at line 37 of file LabelGlyphHandle.cpp.

38{
39}

Member Function Documentation

◆ OnLabelPermuted()

void LabelTrackHit::OnLabelPermuted ( const LabelTrackEvent e)

Definition at line 41 of file LabelGlyphHandle.cpp.

42{
43 if ( e.mpTrack.lock() != mpLT )
44 return;
46 return;
47
48 auto former = e.mFormerPosition;
49 auto present = e.mPresentPosition;
50
51 auto update = [=]( int &index ){
52 if ( index == former )
53 index = present;
54 else if ( former < index && index <= present )
55 -- index;
56 else if ( former > index && index >= present )
57 ++ index;
58 };
59
60 update( mMouseOverLabelLeft );
61 update( mMouseOverLabelRight );
62 update( mMouseOverLabel );
63}
const std::weak_ptr< Track > mpTrack
Definition: LabelTrack.h:211
enum LabelTrackEvent::Type type
int mMouseOverLabelRight
Keeps track of which left label the mouse is currently over.
int mMouseOverLabelLeft
Keeps track of which (ranged) label the mouse is currently over.

References LabelTrackEvent::mFormerPosition, mMouseOverLabel, mMouseOverLabelLeft, mMouseOverLabelRight, mpLT, LabelTrackEvent::mPresentPosition, LabelTrackEvent::mpTrack, LabelTrackEvent::Permutation, and LabelTrackEvent::type.

Referenced by LabelTrackHit().

Here is the caller graph for this function:

Member Data Documentation

◆ mEdge

int LabelTrackHit::mEdge {}

◆ mIsAdjustingLabel

bool LabelTrackHit::mIsAdjustingLabel {}

Keeps track of which right label the mouse is currently over.

Definition at line 43 of file LabelGlyphHandle.h.

Referenced by LabelGlyphHandle::HandleGlyphClick(), and LabelGlyphHandle::HandleGlyphDragRelease().

◆ mMouseOverLabel

int LabelTrackHit::mMouseOverLabel { -1 }

◆ mMouseOverLabelLeft

int LabelTrackHit::mMouseOverLabelLeft { -1 }

Keeps track of which (ranged) label the mouse is currently over.

Definition at line 41 of file LabelGlyphHandle.h.

Referenced by LabelGlyphHandle::HandleGlyphClick(), LabelGlyphHandle::HandleGlyphDragRelease(), LabelGlyphHandle::MayAdjustLabel(), OnLabelPermuted(), and LabelTrackView::OverGlyph().

◆ mMouseOverLabelRight

int LabelTrackHit::mMouseOverLabelRight { -1 }

Keeps track of which left label the mouse is currently over.

Definition at line 42 of file LabelGlyphHandle.h.

Referenced by LabelGlyphHandle::HandleGlyphClick(), LabelGlyphHandle::HandleGlyphDragRelease(), LabelGlyphHandle::MayAdjustLabel(), OnLabelPermuted(), and LabelTrackView::OverGlyph().

◆ mpLT

std::shared_ptr<LabelTrack> LabelTrackHit::mpLT {}

Definition at line 45 of file LabelGlyphHandle.h.

Referenced by OnLabelPermuted().

◆ mSubscription

Observer::Subscription LabelTrackHit::mSubscription

Definition at line 47 of file LabelGlyphHandle.h.

Referenced by LabelTrackHit().


The documentation for this struct was generated from the following files: