Audacity 3.2.0
WaveClipAdjustBorderHandle.h
Go to the documentation of this file.
1/*!********************************************************************
2*
3 Audacity: A Digital Audio Editor
4
5 WaveClipAdjustBorderHandle.h
6
7 Vitaly Sverchinsky
8
9 **********************************************************************/
10
11#pragma once
12
13#include "UIHandle.h"
14#include "WaveClip.h"
15
16class WaveChannelView;
17class WaveTrack;
18
20{
21public:
22 class AdjustPolicy;
23private:
24
25 static constexpr int BoundaryThreshold = 5;
26
27 static HitTestPreview HitPreviewTrim(const AudacityProject*, bool unsafe, bool isLeftBorder);
28 static HitTestPreview HitPreviewStretch(const AudacityProject*, bool unsafe, bool isLeftBorder);
29
30 std::unique_ptr<AdjustPolicy> mAdjustPolicy{};
31 std::shared_ptr<const WaveTrack> mpTrack;
34
35public:
36 WaveClipAdjustBorderHandle(std::unique_ptr<AdjustPolicy>& adjustPolicy,
37 std::shared_ptr<const WaveTrack> pTrack,
38 bool stretchMode, bool leftBorder);
40
41 std::shared_ptr<const Track> FindTrack() const override;
42
45
46 static UIHandlePtr HitAnywhere(std::weak_ptr<WaveClipAdjustBorderHandle>& holder,
47 const std::shared_ptr<WaveTrack>& waveTrack,
48 const AudacityProject* pProject,
49 const TrackPanelMouseState& state);
50
51 static UIHandlePtr HitTest(std::weak_ptr<WaveClipAdjustBorderHandle>& holder,
52 WaveChannelView& view, const AudacityProject* pProject,
53 const TrackPanelMouseState& state);
54
55 HitTestPreview Preview(const TrackPanelMouseState& mouseState, AudacityProject* pProject) override;
56
58 (const TrackPanelMouseEvent& event, AudacityProject* pProject) override;
59
61 (const TrackPanelMouseEvent& event, AudacityProject* pProject) override;
62
64 (const TrackPanelMouseEvent& event, AudacityProject* pProject,
65 wxWindow* pParent) override;
66
67 Result Cancel(AudacityProject* pProject) override;
68
69 // TrackPanelDrawable implementation
70
71 void Draw(TrackPanelDrawingContext &context,
72 const wxRect &rect,
73 unsigned iPass ) override;
74
76 const wxRect &rect,
77 const wxRect &panelRect,
78 unsigned iPass) override;
79};
std::shared_ptr< UIHandle > UIHandlePtr
Definition: CellularPanel.h:28
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
Short-lived drawing and event-handling object associated with a TrackPanelCell.
Definition: UIHandle.h:37
unsigned Result
Definition: UIHandle.h:40
std::shared_ptr< const Track > FindTrack() const override
std::unique_ptr< AdjustPolicy > mAdjustPolicy
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
HitTestPreview Preview(const TrackPanelMouseState &mouseState, AudacityProject *pProject) override
~WaveClipAdjustBorderHandle() override
wxRect DrawingArea(TrackPanelDrawingContext &, const wxRect &rect, const wxRect &panelRect, unsigned iPass) override
void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
static HitTestPreview HitPreviewTrim(const AudacityProject *, bool unsafe, bool isLeftBorder)
WaveClipAdjustBorderHandle(WaveClipAdjustBorderHandle &&) noexcept
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
Result Cancel(AudacityProject *pProject) override
WaveClipAdjustBorderHandle(std::unique_ptr< AdjustPolicy > &adjustPolicy, std::shared_ptr< const WaveTrack > pTrack, bool stretchMode, bool leftBorder)
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
static HitTestPreview HitPreviewStretch(const AudacityProject *, bool unsafe, bool isLeftBorder)
static UIHandlePtr HitAnywhere(std::weak_ptr< WaveClipAdjustBorderHandle > &holder, const std::shared_ptr< WaveTrack > &waveTrack, const AudacityProject *pProject, const TrackPanelMouseState &state)
std::shared_ptr< const WaveTrack > mpTrack
static UIHandlePtr HitTest(std::weak_ptr< WaveClipAdjustBorderHandle > &holder, WaveChannelView &view, const AudacityProject *pProject, const TrackPanelMouseState &state)
A Track that contains audio waveform data.
Definition: WaveTrack.h:203
STL namespace.