Audacity 3.2.0
WaveTrackAffordanceControls.h
Go to the documentation of this file.
1/*!********************************************************************
2*
3 Audacity: A Digital Audio Editor
4
5 WaveTrackAffordanceControls.h
6
7 Vitaly Sverchinsky
8
9 **********************************************************************/
10
11#pragma once
12
13#include <wx/font.h>
14
15#include "Channel.h"
16#include "Observer.h"
17#include "ViewInfo.h"
18#include "WaveTrack.h"
21
22
23struct TrackListEvent;
24
26class SelectHandle;
27class WaveClip;
34class TrackList;
35
36//Handles clip movement, selection, navigation and
37//allow name change
38class AUDACITY_DLL_API WaveTrackAffordanceControls :
39 public CommonTrackCell,
40 public TextEditDelegate,
41 public std::enable_shared_from_this<WaveTrackAffordanceControls>
42{
44
46 std::weak_ptr<ClipOverflowButtonHandle> mOverflowButtonHandle;
47 std::weak_ptr<ClipPitchAndSpeedButtonHandle> mPitchButtonHandle;
48 std::weak_ptr<ClipPitchAndSpeedButtonHandle> mSpeedButtonHandle;
49 std::weak_ptr<WaveTrackAffordanceHandle> mAffordanceHandle;
50 std::weak_ptr<TrackPanelResizeHandle> mResizeHandle;
51 std::weak_ptr<WaveClipTitleEditHandle> mTitleEditHandle;
52 std::weak_ptr<SelectHandle> mSelectHandle;
53 std::weak_ptr<WaveClipAdjustBorderHandle> mClipBorderAdjustHandle;
54
56 std::shared_ptr<TextEditHelper> mTextEditHelper;
57
59
60 //Helper container used to track clips names visibility
61 std::vector<IntervalIterator> mVisibleIntervals;
62
63public:
64 WaveTrackAffordanceControls(const std::shared_ptr<Track>& pTrack);
65
66 std::vector<UIHandlePtr> HitTest(const TrackPanelMouseState& state, const AudacityProject* pProject) override;
67
68 void Draw(TrackPanelDrawingContext& context, const wxRect& rect, unsigned iPass) override;
69
70 IntervalIterator GetSelectedInterval() const;
71
72 unsigned CaptureKey
73 (wxKeyEvent& event, ViewInfo& viewInfo, wxWindow* pParent,
74 AudacityProject* project) override;
75
76 unsigned KeyDown (wxKeyEvent& event, ViewInfo& viewInfo, wxWindow* pParent,
77 AudacityProject* project) override;
78
79 unsigned Char
80 (wxKeyEvent& event, ViewInfo& viewInfo, wxWindow* pParent,
81 AudacityProject* project) override;
82
83 unsigned LoseFocus(AudacityProject *project) override;
84
85 void OnTextEditFinished(AudacityProject* project, const wxString& text) override;
87 void OnTextModified(AudacityProject* project, const wxString& text) override;
88 void OnTextContextMenu(AudacityProject* project, const wxPoint& position) override;
89
90 unsigned OnAffordanceClick(const TrackPanelMouseEvent& event, AudacityProject* project);
91
92 bool OnTextCopy(AudacityProject& project);
93 bool OnTextCut(AudacityProject& project);
94 bool OnTextPaste(AudacityProject& project);
95 bool OnTextSelect(AudacityProject& project);
96
97 void StartEditSelectedClipName(AudacityProject& project);
98
99 void StartEditSelectedClipSpeed(AudacityProject& project);
100
102
103 std::vector<MenuItem> GetMenuItems(
104 const wxRect &rect, const wxPoint *pPosition, AudacityProject *pProject )
105 override;
106private:
107
108 bool IsIntervalVisible(const IntervalIterator& it) const noexcept;
111 bool StartEditClipName(AudacityProject& project, IntervalIterator it);
112
113 void ResetClipNameEdit();
114
115 void OnTrackListEvent(const TrackListEvent& evt);
116
117 void OnSelectionChange(NotifyingSelectedRegionMessage);
118
119 unsigned ExitTextEditing();
120
121 std::shared_ptr<TextEditHelper> MakeTextEditHelper(const wxString& text);
122
125};
Abstract class ChannelGroup with two discrete iterable dimensions, channels and intervals; subclasses...
const auto project
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
virtual std::vector< MenuItem > GetMenuItems(const wxRect &rect, const wxPoint *pPosition, AudacityProject *pProject)
Return a list of items for DoContextMenu() (empties for separators)
A move-only handle representing a connection to a Publisher.
Definition: Observer.h:70
virtual void OnTextModified(AudacityProject *project, const wxString &text)=0
virtual void OnTextEditCancelled(AudacityProject *project)=0
virtual void OnTextEditFinished(AudacityProject *project, const wxString &text)=0
virtual void OnTextContextMenu(AudacityProject *project, const wxPoint &position)=0
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:850
virtual unsigned KeyDown(wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
virtual unsigned CaptureKey(wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
virtual unsigned LoseFocus(AudacityProject *project)
virtual unsigned Char(wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
virtual std::vector< UIHandlePtr > HitTest(const TrackPanelMouseState &state, const AudacityProject *pProject)=0
virtual void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass)
Constructed from one channel, but changes height of all channels in a track.
This allows multiple clips to be a part of one WaveTrack.
Definition: WaveClip.h:238
std::weak_ptr< ClipPitchAndSpeedButtonHandle > mPitchButtonHandle
std::weak_ptr< WaveClipAdjustBorderHandle > mClipBorderAdjustHandle
std::weak_ptr< TrackPanelResizeHandle > mResizeHandle
std::vector< IntervalIterator > mVisibleIntervals
std::weak_ptr< WaveTrackAffordanceHandle > mAffordanceHandle
std::weak_ptr< ClipOverflowButtonHandle > mOverflowButtonHandle
Observer::Subscription mSelectionChangeSubscription
std::shared_ptr< TextEditHelper > mTextEditHelper
std::weak_ptr< ClipPitchAndSpeedButtonHandle > mSpeedButtonHandle
std::weak_ptr< SelectHandle > mSelectHandle
Observer::Subscription mTrackListEventSubscription
std::weak_ptr< WaveClipTitleEditHandle > mTitleEditHandle
Implements some features which are specific to Wave Clips.
Notification of changes in individual tracks of TrackList, or of TrackList's composition.
Definition: Track.h:803