Audacity  3.0.3
LabelGlyphHandle.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3 Audacity: A Digital Audio Editor
4 
5 LabelGlyphHandle.h
6 
7 Paul Licameli split from TrackPanel.cpp
8 
9 **********************************************************************/
10 
11 #ifndef __AUDACITY_LABEL_GLYPH_HANDLE__
12 #define __AUDACITY_LABEL_GLYPH_HANDLE__
13 
15 
16 class wxMouseState;
17 class LabelTrack;
18 struct LabelTrackEvent;
20 class ZoomInfo;
21 
33 {
34  LabelTrackHit( const std::shared_ptr<LabelTrack> &pLT );
36 
37  int mEdge{};
38  //This one is to distinguish ranged label from point label
39  int mMouseOverLabel{ -1 };
40  int mMouseOverLabelLeft{ -1 };
43 
44  std::shared_ptr<LabelTrack> mpLT {};
45 
47 };
48 
50 {
51 public:
52  explicit LabelGlyphHandle
53  (const std::shared_ptr<LabelTrack> &pLT,
54  const wxRect &rect, const std::shared_ptr<LabelTrackHit> &pHit);
55 
57 
58  static UIHandlePtr HitTest
59  (std::weak_ptr<LabelGlyphHandle> &holder,
60  const wxMouseState &state,
61  const std::shared_ptr<LabelTrack> &pLT, const wxRect &rect);
62 
63  virtual ~LabelGlyphHandle();
64 
65  void Enter(bool forward, AudacityProject *) override;
66 
68  (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
69 
70  Result Drag
71  (const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
72 
74  (const TrackPanelMouseState &state, AudacityProject *pProject)
75  override;
76 
78  (const TrackPanelMouseEvent &event, AudacityProject *pProject,
79  wxWindow *pParent) override;
80 
81  Result Cancel(AudacityProject *pProject) override;
82 
83  bool StopsOnKeystroke() override { return true; }
84 
85  std::shared_ptr<LabelTrackHit> mpHit{};
86 
88  (const LabelGlyphHandle &oldState, const LabelGlyphHandle &newState);
89 
90 private:
91  void HandleGlyphClick
92  (LabelTrackHit &hit,
93  const wxMouseEvent & evt, const wxRect & r, const ZoomInfo &zoomInfo,
94  NotifyingSelectedRegion &newSel);
96  (AudacityProject &project,
97  LabelTrackHit &hit,
98  const wxMouseEvent & evt, wxRect & r, const ZoomInfo &zoomInfo,
99  NotifyingSelectedRegion &newSel);
100 
101  void MayAdjustLabel
102  ( LabelTrackHit &hit,
103  int iLabel, int iEdge, bool bAllowSwapping, double fNewTime);
104  void MayMoveLabel( int iLabel, int iEdge, double fNewTime);
105 
106  std::shared_ptr<LabelTrack> mpLT {};
107  wxRect mRect {};
108 
111 };
112 
113 #endif
LabelDefaultClickHandle
Definition: LabelDefaultClickHandle.h:22
ZoomInfo
Definition: ZoomInfo.h:47
LabelDefaultClickHandle.h
LabelGlyphHandle::Enter
void Enter(bool forward, AudacityProject *) override
Definition: LabelGlyphHandle.cpp:76
LabelTrackHit::mpLT
std::shared_ptr< LabelTrack > mpLT
Definition: LabelGlyphHandle.h:44
LabelTrack
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:88
LabelGlyphHandle::HitTest
static UIHandlePtr HitTest(std::weak_ptr< LabelGlyphHandle > &holder, const wxMouseState &state, const std::shared_ptr< LabelTrack > &pLT, const wxRect &rect)
Definition: LabelGlyphHandle.cpp:91
LabelGlyphHandle::HandleGlyphDragRelease
bool HandleGlyphDragRelease(AudacityProject &project, LabelTrackHit &hit, const wxMouseEvent &evt, wxRect &r, const ZoomInfo &zoomInfo, NotifyingSelectedRegion &newSel)
Definition: LabelGlyphHandle.cpp:288
LabelGlyphHandle::MayAdjustLabel
void MayAdjustLabel(LabelTrackHit &hit, int iLabel, int iEdge, bool bAllowSwapping, double fNewTime)
Definition: LabelGlyphHandle.cpp:229
LabelGlyphHandle::Release
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
Definition: LabelGlyphHandle.cpp:452
LabelGlyphHandle::Drag
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Definition: LabelGlyphHandle.cpp:416
LabelTrackHit::mEdge
int mEdge
Definition: LabelGlyphHandle.h:37
LabelGlyphHandle::~LabelGlyphHandle
virtual ~LabelGlyphHandle()
Definition: LabelGlyphHandle.cpp:114
LabelGlyphHandle::NeedChangeHighlight
static UIHandle::Result NeedChangeHighlight(const LabelGlyphHandle &oldState, const LabelGlyphHandle &newState)
Definition: LabelGlyphHandle.cpp:82
LabelGlyphHandle::mRect
wxRect mRect
Definition: LabelGlyphHandle.h:107
LabelTrackHit::LabelTrackHit
LabelTrackHit(const std::shared_ptr< LabelTrack > &pLT)
Definition: LabelGlyphHandle.cpp:30
LabelGlyphHandle::Click
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Definition: LabelGlyphHandle.cpp:198
UIHandle::Result
unsigned Result
Definition: UIHandle.h:38
LabelTrackHit::~LabelTrackHit
~LabelTrackHit()
Definition: LabelGlyphHandle.cpp:37
LabelGlyphHandle::operator=
LabelGlyphHandle & operator=(const LabelGlyphHandle &)=default
LabelGlyphHandle::LabelGlyphHandle
LabelGlyphHandle(const std::shared_ptr< LabelTrack > &pLT, const wxRect &rect, const std::shared_ptr< LabelTrackHit > &pHit)
Definition: LabelGlyphHandle.cpp:68
UIHandlePtr
std::shared_ptr< UIHandle > UIHandlePtr
Definition: CellularPanel.h:28
LabelTrackHit::mMouseOverLabelRight
int mMouseOverLabelRight
Keeps track of which left label the mouse is currently over.
Definition: LabelGlyphHandle.h:41
HitTestPreview
Definition: HitTestResult.h:20
LabelTrackHit::mMouseOverLabel
int mMouseOverLabel
Definition: LabelGlyphHandle.h:39
LabelTrackEvent
Definition: LabelTrack.h:184
LabelGlyphHandle::HandleGlyphClick
void HandleGlyphClick(LabelTrackHit &hit, const wxMouseEvent &evt, const wxRect &r, const ZoomInfo &zoomInfo, NotifyingSelectedRegion &newSel)
Definition: LabelGlyphHandle.cpp:119
LabelGlyphHandle::mxMouseDisplacement
int mxMouseDisplacement
Displacement of mouse cursor from the centre being dragged.
Definition: LabelGlyphHandle.h:110
LabelTrackHit::mIsAdjustingLabel
bool mIsAdjustingLabel
Keeps track of which right label the mouse is currently over.
Definition: LabelGlyphHandle.h:42
LabelGlyphHandle
Definition: LabelGlyphHandle.h:50
LabelGlyphHandle::Cancel
Result Cancel(AudacityProject *pProject) override
Definition: LabelGlyphHandle.cpp:470
LabelGlyphHandle::mpLT
std::shared_ptr< LabelTrack > mpLT
Definition: LabelGlyphHandle.h:106
LabelGlyphHandle::mpHit
std::shared_ptr< LabelTrackHit > mpHit
Definition: LabelGlyphHandle.h:85
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:92
LabelGlyphHandle::StopsOnKeystroke
bool StopsOnKeystroke() override
Definition: LabelGlyphHandle.h:83
TrackPanelMouseEvent
Definition: TrackPanelMouseEvent.h:46
LabelGlyphHandle::Preview
HitTestPreview Preview(const TrackPanelMouseState &state, AudacityProject *pProject) override
Definition: LabelGlyphHandle.cpp:430
TrackPanelMouseState
Definition: TrackPanelMouseEvent.h:28
LabelTrackHit
Definition: LabelGlyphHandle.h:33
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
LabelGlyphHandle::MayMoveLabel
void MayMoveLabel(int iLabel, int iEdge, double fNewTime)
Definition: LabelGlyphHandle.cpp:262
NotifyingSelectedRegion
Definition: ViewInfo.h:44