Audacity  3.0.3
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 (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 {}
 

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

Constructor & Destructor Documentation

◆ LabelTrackHit()

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

Definition at line 30 of file LabelGlyphHandle.cpp.

31  : mpLT{ pLT }
32 {
33  pLT->Bind(
34  EVT_LABELTRACK_PERMUTED, &LabelTrackHit::OnLabelPermuted, this );
35 }

◆ ~LabelTrackHit()

LabelTrackHit::~LabelTrackHit ( )

Definition at line 37 of file LabelGlyphHandle.cpp.

38 {
39  // Must do this because this sink isn't wxEvtHandler
40  mpLT->Unbind(
41  EVT_LABELTRACK_PERMUTED, &LabelTrackHit::OnLabelPermuted, this );
42 }

References mpLT, and OnLabelPermuted().

Here is the call graph for this function:

Member Function Documentation

◆ OnLabelPermuted()

void LabelTrackHit::OnLabelPermuted ( LabelTrackEvent e)

Definition at line 44 of file LabelGlyphHandle.cpp.

45 {
46  e.Skip();
47  if ( e.mpTrack.lock() != mpLT )
48  return;
49 
50  auto former = e.mFormerPosition;
51  auto present = e.mPresentPosition;
52 
53  auto update = [=]( int &index ){
54  if ( index == former )
55  index = present;
56  else if ( former < index && index <= present )
57  -- index;
58  else if ( former > index && index >= present )
59  ++ index;
60  };
61 
62  update( mMouseOverLabelLeft );
63  update( mMouseOverLabelRight );
64  update( mMouseOverLabel );
65 }

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

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 42 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 40 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 41 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 44 of file LabelGlyphHandle.h.

Referenced by OnLabelPermuted(), and ~LabelTrackHit().


The documentation for this struct was generated from the following files:
LabelTrackEvent::mFormerPosition
int mFormerPosition
Definition: LabelTrack.h:207
LabelTrackHit::mpLT
std::shared_ptr< LabelTrack > mpLT
Definition: LabelGlyphHandle.h:44
LabelTrackEvent::mPresentPosition
int mPresentPosition
Definition: LabelTrack.h:210
LabelTrackHit::mMouseOverLabelRight
int mMouseOverLabelRight
Keeps track of which left label the mouse is currently over.
Definition: LabelGlyphHandle.h:41
LabelTrackHit::mMouseOverLabel
int mMouseOverLabel
Definition: LabelGlyphHandle.h:39
TrackListEvent::mpTrack
std::weak_ptr< Track > mpTrack
Definition: Track.h:1238
LabelTrackHit::mMouseOverLabelLeft
int mMouseOverLabelLeft
Keeps track of which (ranged) label the mouse is currently over.
Definition: LabelGlyphHandle.h:40
LabelTrackHit::OnLabelPermuted
void OnLabelPermuted(LabelTrackEvent &e)
Definition: LabelGlyphHandle.cpp:44