Audacity 3.2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
TimeTrackView Class Referencefinal

#include <TimeTrackView.h>

Inheritance diagram for TimeTrackView:
[legend]
Collaboration diagram for TimeTrackView:
[legend]

Public Member Functions

 TimeTrackView (const std::shared_ptr< Channel > &pChannel)
 
 ~TimeTrackView () override
 
std::shared_ptr< ChannelVRulerControlsDoGetVRulerControls () override
 
- Public Member Functions inherited from CommonChannelView
std::shared_ptr< TrackPanelCellContextMenuDelegate () override
 
std::vector< UIHandlePtrHitTest (const TrackPanelMouseState &, const AudacityProject *pProject) final
 
void TimeShiftHitTest ()
 
virtual int GetMinimizedHeight () const override
 
 ChannelView (const std::shared_ptr< Channel > &pChannel)
 
- Public Member Functions inherited from ChannelView
 ChannelView (const std::shared_ptr< Channel > &pChannel)
 
virtual ~ChannelView ()=0
 
void Reparent (const std::shared_ptr< Track > &parent, size_t iChannel) override
 Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
 
void CopyTo (Track &track, size_t iChannel) const override
 Copy state, for undo/redo purposes. More...
 
bool GetMinimized () const
 
void SetMinimized (bool minimized)
 
int GetCumulativeHeightBefore () const
 
int GetExpandedHeight () const
 
virtual int GetMinimizedHeight () const =0
 
int GetHeight () const
 
void SetCumulativeHeightBefore (int y)
 Set cached value dependent on position within the track list. More...
 
void SetExpandedHeight (int height)
 
std::shared_ptr< ChannelVRulerControlsGetVRulerControls ()
 
std::shared_ptr< const ChannelVRulerControlsGetVRulerControls () const
 
virtual std::shared_ptr< CommonTrackCellGetAffordanceControls ()
 
void WriteXMLAttributes (XMLWriter &writer, size_t iChannel) const override
 Serialize persistent attributes. More...
 
bool HandleXMLAttribute (const std::string_view &attr, const XMLAttributeValueView &valueView, size_t iChannel) override
 Deserialize an attribute, returning true if recognized. More...
 
virtual Refinement GetSubViews (const wxRect &rect)
 
virtual bool IsSpectral () const
 
virtual void DoSetMinimized (bool isMinimized)
 
- Public Member Functions inherited from CommonChannelCell
 CommonChannelCell (const std::shared_ptr< Channel > &pChannel)
 Construct from a channel. More...
 
 ~CommonChannelCell ()
 
std::shared_ptr< TrackDoFindTrack () override
 
void Reparent (const std::shared_ptr< Track > &parent, size_t iChannel) override
 Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
 
template<typename Subtype = Channel>
auto FindChannel () -> std::shared_ptr< Subtype >
 May return null. More...
 
template<typename Subtype = const Channel>
auto FindChannel () const -> std::enable_if_t< std::is_const_v< Subtype >, std::shared_ptr< Subtype > >
 May return null. More...
 
- Public Member Functions inherited from CommonTrackPanelCell
 CommonTrackPanelCell ()
 
virtual ~CommonTrackPanelCell ()=0
 
HitTestPreview DefaultPreview (const TrackPanelMouseState &, const AudacityProject *) override
 
std::shared_ptr< TrackFindTrack ()
 
std::shared_ptr< const TrackFindTrack () const
 
virtual std::vector< MenuItemGetMenuItems (const wxRect &rect, const wxPoint *pPosition, AudacityProject *pProject)
 Return a list of items for DoContextMenu() (empties for separators) More...
 
- Public Member Functions inherited from TrackPanelCell
 TrackPanelCell ()=default
 
 TrackPanelCell (const TrackPanelCell &)=delete
 
TrackPanelCelloperator= (const TrackPanelCell &)=delete
 
virtual ~TrackPanelCell ()=0
 
virtual HitTestPreview DefaultPreview (const TrackPanelMouseState &state, const AudacityProject *pProject)
 
virtual std::vector< UIHandlePtrHitTest (const TrackPanelMouseState &state, const AudacityProject *pProject)=0
 
virtual unsigned HandleWheelRotation (const TrackPanelMouseEvent &event, AudacityProject *pProject)
 
virtual std::shared_ptr< TrackPanelCellContextMenuDelegate ()
 
virtual unsigned DoContextMenu (const wxRect &rect, wxWindow *pParent, const wxPoint *pPosition, AudacityProject *pProject)
 
virtual unsigned CaptureKey (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
 
virtual unsigned KeyDown (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
 
virtual unsigned KeyUp (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
 
virtual unsigned Char (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
 
virtual unsigned LoseFocus (AudacityProject *project)
 
- Public Member Functions inherited from TrackPanelNode
 TrackPanelNode ()
 
virtual ~TrackPanelNode ()=0
 
- Public Member Functions inherited from TrackPanelDrawable
virtual ~TrackPanelDrawable ()=0
 
virtual void Draw (TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass)
 
virtual wxRect DrawingArea (TrackPanelDrawingContext &context, const wxRect &rect, const wxRect &panelRect, unsigned iPass)
 
- Public Member Functions inherited from ChannelAttachment
virtual ~ChannelAttachment ()
 
virtual void CopyTo (Track &track, size_t iChannel) const
 Copy state, for undo/redo purposes. More...
 
virtual void Reparent (const std::shared_ptr< Track > &parent, size_t iChannel)
 Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
 
virtual void WriteXMLAttributes (XMLWriter &writer, size_t iChannel) const
 Serialize persistent attributes. More...
 
virtual bool HandleXMLAttribute (const std::string_view &attr, const XMLAttributeValueView &valueView, size_t iChannel)
 Deserialize an attribute, returning true if recognized. More...
 

Private Member Functions

 TimeTrackView (const TimeTrackView &)=delete
 
TimeTrackViewoperator= (const TimeTrackView &)=delete
 
std::vector< UIHandlePtrDetailedHitTest (const TrackPanelMouseState &state, const AudacityProject *pProject, int currentTool, bool bMultiTool) override
 
void Draw (TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
 

Private Attributes

std::weak_ptr< EnvelopeHandlemEnvelopeHandle
 

Additional Inherited Members

- Public Types inherited from ChannelView
enum  : unsigned { DefaultHeight = 150 }
 
using Refinement = std::vector< std::pair< wxCoord, std::shared_ptr< ChannelView > > >
 
- Static Public Member Functions inherited from CommonChannelView
static void GetEnvelopeValues (const Envelope &env, double aligned_time, double sampleDur, double *buffer, int bufferLen, int leftOffset, const ZoomInfo &zoomInfo)
 Get many envelope points for pixel columns at once, but don't assume uniform time per pixel. More...
 
- Static Public Member Functions inherited from ChannelView
static ChannelViewGet (Channel &channel)
 
static const ChannelViewGet (const Channel &channel)
 
static ChannelViewFind (Channel *pChannel)
 
static const ChannelViewFind (const Channel *pChannel)
 
static int GetChannelGroupHeight (const Track *pTrack)
 
static int GetCumulativeHeight (const Channel *pChannel)
 
static int GetCumulativeHeight (const Track *pTrack)
 
static int GetTotalHeight (const TrackList &list)
 
- Static Public Member Functions inherited from TrackPanelDrawable
static wxRect MaximizeWidth (const wxRect &rect, const wxRect &panelRect)
 
static wxRect MaximizeHeight (const wxRect &rect, const wxRect &panelRect)
 
- Public Attributes inherited from CommonChannelView
std::weak_ptr< TimeShiftHandlemTimeShiftHandle
 
- Public Attributes inherited from ChannelView
std::pair< int, int > vrulerSize
 
virtual std::vector< UIHandlePtrDetailedHitTest (const TrackPanelMouseState &, const AudacityProject *pProject, int currentTool, bool bMultiTool)=0
 
virtual std::shared_ptr< ChannelVRulerControlsDoGetVRulerControls ()=0
 
- Protected Member Functions inherited from CommonTrackPanelCell
virtual std::shared_ptr< TrackDoFindTrack ()=0
 
unsigned DoContextMenu (const wxRect &rect, wxWindow *pParent, const wxPoint *pPosition, AudacityProject *pProject) override
 
unsigned HandleWheelRotation (const TrackPanelMouseEvent &event, AudacityProject *pProject) override
 
- Protected Attributes inherited from CommonChannelView
std::weak_ptr< SelectHandlemSelectHandle
 
- Protected Attributes inherited from ChannelView
std::shared_ptr< ChannelVRulerControlsmpVRulerControls
 

Detailed Description

Definition at line 18 of file TimeTrackView.h.

Constructor & Destructor Documentation

◆ TimeTrackView() [1/2]

TimeTrackView::TimeTrackView ( const TimeTrackView )
privatedelete

◆ TimeTrackView() [2/2]

TimeTrackView::TimeTrackView ( const std::shared_ptr< Channel > &  pChannel)
explicit

Definition at line 38 of file TimeTrackView.cpp.

39 : CommonChannelView{ pChannel }
40{
41}
Implements some hit-testing shared by many ChannelView subtypes.

◆ ~TimeTrackView()

TimeTrackView::~TimeTrackView ( )
override

Definition at line 43 of file TimeTrackView.cpp.

44{
45}

Member Function Documentation

◆ DetailedHitTest()

std::vector< UIHandlePtr > TimeTrackView::DetailedHitTest ( const TrackPanelMouseState state,
const AudacityProject pProject,
int  currentTool,
bool  bMultiTool 
)
overrideprivatevirtual

Implements CommonChannelView.

Definition at line 47 of file TimeTrackView.cpp.

50{
51 std::vector<UIHandlePtr> results;
53 mEnvelopeHandle, st.state, st.rect, pProject,
54 FindChannel<TimeTrack>());
55 if (result)
56 results.push_back(result);
57 return results;
58}
static UIHandlePtr TimeTrackHitTest(std::weak_ptr< EnvelopeHandle > &holder, const wxMouseState &state, const wxRect &rect, const AudacityProject *pProject, const std::shared_ptr< TimeTrack > &tt)
std::weak_ptr< EnvelopeHandle > mEnvelopeHandle
Definition: TimeTrackView.h:36

References mEnvelopeHandle, TrackPanelMouseState::rect, TrackPanelMouseState::state, and EnvelopeHandle::TimeTrackHitTest().

Here is the call graph for this function:

◆ DoGetVRulerControls()

std::shared_ptr< ChannelVRulerControls > TimeTrackView::DoGetVRulerControls ( )
overridevirtual

Implements ChannelView.

Definition at line 67 of file TimeTrackView.cpp.

68{
69 return
70 std::make_shared<TimeTrackVRulerControls>(shared_from_this());
71}

◆ Draw()

void TimeTrackView::Draw ( TrackPanelDrawingContext context,
const wxRect &  rect,
unsigned  iPass 
)
overrideprivatevirtual

Reimplemented from TrackPanelDrawable.

Definition at line 157 of file TimeTrackView.cpp.

160{
161 if ( iPass == TrackArtist::PassTracks ) {
162 const auto artist = TrackArtist::Get(context);
163 const auto &pendingTracks = *artist->pPendingTracks;
164 const auto pChannel = FindChannel();
165 if (!pChannel)
166 return;
167 const auto pList =
168 static_cast<const TimeTrack*>(pChannel.get())->GetOwner();
169 if (!pList)
170 // Track isn't owned by a list. Can't proceed!
171 return;
172 const auto pProject = pList->GetOwner();
173 if (!pProject)
174 // List isn't owned by a project. Can't proceed!
175 // But this shouldn't happen when drawing it
176 return;
177
178 auto &zoomInfo = ViewInfo::Get(*pProject);
180 updater.SetData(&zoomInfo);
181
182 // Just using a stack-local Ruler object. Observe the "Invalidate"
183 // call above which has long been done with every redraw.
184 // Avoiding invalidation with every draw, and making the ruler persistent
185 // between drawings, would require that it be invalidated whenever the
186 // user drags points, or the time selection changes -- really too much
187 // work.
189 ruler.SetLabelEdges(false);
190
191 const auto &tt = static_cast<const TimeTrack&>(
192 pendingTracks.SubstitutePendingChangedChannel(*pChannel));
193 DrawTimeTrack(context, tt, ruler, rect);
194 }
195 CommonChannelView::Draw(context, rect, iPass);
196}
static CustomUpdaterValue updater
auto FindChannel() -> std::shared_ptr< Subtype >
May return null.
void SetData(RulerUpdater::Labels majorLabels, RulerUpdater::Labels minorLabels, RulerUpdater::Labels minorMinorLabels)
Definition: CustomUpdater.h:27
Used to display a Ruler.
Definition: Ruler.h:34
void SetLabelEdges(bool labelEdges)
Definition: Ruler.cpp:179
static const TimeFormat & Instance()
Definition: TimeFormat.cpp:15
A kind of Track used to 'warp time'.
Definition: TimeTrack.h:24
static TrackArtist * Get(TrackPanelDrawingContext &)
Definition: TrackArtist.cpp:69
std::shared_ptr< TrackList > GetOwner() const
Definition: Track.h:230
virtual void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass)
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:235
void DrawTimeTrack(TrackPanelDrawingContext &context, const TimeTrack &track, Ruler &ruler, const wxRect &rect)

References TrackPanelDrawable::Draw(), anonymous_namespace{TimeTrackView.cpp}::DrawTimeTrack(), CommonChannelCell::FindChannel(), ViewInfo::Get(), TrackArtist::Get(), Track::GetOwner(), TimeFormat::Instance(), TrackArtist::PassTracks, anonymous_namespace{TimeTrackVRulerControls.cpp}::ruler(), CustomUpdater::SetData(), Ruler::SetLabelEdges(), and updater.

Here is the call graph for this function:

◆ operator=()

TimeTrackView & TimeTrackView::operator= ( const TimeTrackView )
privatedelete

Member Data Documentation

◆ mEnvelopeHandle

std::weak_ptr<EnvelopeHandle> TimeTrackView::mEnvelopeHandle
private

Definition at line 36 of file TimeTrackView.h.

Referenced by DetailedHitTest().


The documentation for this class was generated from the following files: