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 32 of file LabelGlyphHandle.cpp.

33 : mpLT{ pLT }
34{
35 mSubscription = pLT->Subscribe( *this, &LabelTrackHit::OnLabelPermuted );
36}
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 38 of file LabelGlyphHandle.cpp.

39{
40}

Member Function Documentation

◆ OnLabelPermuted()

void LabelTrackHit::OnLabelPermuted ( const LabelTrackEvent e)

Definition at line 42 of file LabelGlyphHandle.cpp.

43{
44 if ( e.mpTrack.lock() != mpLT )
45 return;
47 return;
48
49 auto former = e.mFormerPosition;
50 auto present = e.mPresentPosition;
51
52 auto update = [=]( int &index ){
53 if ( index == former )
54 index = present;
55 else if ( former < index && index <= present )
56 -- index;
57 else if ( former > index && index >= present )
58 ++ index;
59 };
60
61 update( mMouseOverLabelLeft );
62 update( mMouseOverLabelRight );
63 update( mMouseOverLabel );
64}
const std::weak_ptr< Track > mpTrack
Definition: LabelTrack.h:241
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: