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< Track > &pTrack)
 
 ~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< Track > &pTrack, size_t iChannel)
 Construct from a track and a channel index. More...
 
- Public Member Functions inherited from ChannelView
 ChannelView (const std::shared_ptr< Track > &pTrack, size_t iChannel)
 Construct from a track and a channel index. More...
 
virtual ~ChannelView ()=0
 
void CopyTo (Track &track) 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 &) const override
 Serialize persistent attributes. More...
 
bool HandleXMLAttribute (const std::string_view &attr, const XMLAttributeValueView &valueView) 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 CommonTrackCell
 CommonTrackCell (const std::shared_ptr< Track > &pTrack, size_t iChannel)
 Construct from a track and a channel index. More...
 
 CommonTrackCell (ChannelGroup &group, size_t iChannel)
 Construct from a channel group and a channel index. More...
 
 ~CommonTrackCell ()
 
std::shared_ptr< TrackDoFindTrack () override
 
void Reparent (const std::shared_ptr< Track > &parent) override
 Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
 
size_t GetChannelIndex () const
 
std::shared_ptr< ChannelFindChannel ()
 May return null. More...
 
std::shared_ptr< const ChannelFindChannel () const
 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 TrackAttachment
virtual ~TrackAttachment ()
 
virtual void CopyTo (Track &track) const
 Copy state, for undo/redo purposes. More...
 
virtual void Reparent (const std::shared_ptr< Track > &parent)
 Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
 
virtual void WriteXMLAttributes (XMLWriter &) const
 Serialize persistent attributes. More...
 
virtual bool HandleXMLAttribute (const std::string_view &attr, const XMLAttributeValueView &valueView)
 Deserialize an attribute, returning true if recognized. More...
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 

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< Track > &  pTrack)
explicit

Definition at line 37 of file TimeTrackView.cpp.

38 : CommonChannelView{ pTrack, 0 }
39{
40}
Implements some hit-testing shared by many ChannelView subtypes.

◆ ~TimeTrackView()

TimeTrackView::~TimeTrackView ( )
override

Definition at line 42 of file TimeTrackView.cpp.

43{
44}

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 46 of file TimeTrackView.cpp.

49{
50 std::vector<UIHandlePtr> results;
52 ( mEnvelopeHandle, st.state, st.rect, pProject,
53 std::static_pointer_cast< TimeTrack >( FindTrack() ) );
54 if (result)
55 results.push_back(result);
56 return results;
57}
std::shared_ptr< Track > FindTrack()
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 CommonTrackPanelCell::FindTrack(), 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 66 of file TimeTrackView.cpp.

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

◆ Draw()

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

Reimplemented from TrackPanelDrawable.

Definition at line 156 of file TimeTrackView.cpp.

159{
160 if ( iPass == TrackArtist::PassTracks ) {
161 const auto pTrack = FindTrack();
162 const auto pList = pTrack->GetOwner();
163 if (!pList)
164 // Track isn't owned by a list. Can't proceed!
165 return;
166 const auto pProject = pList->GetOwner();
167 if (!pProject)
168 // List isn't owned by a project. Can't proceed!
169 // But this shouldn't happen when drawing it
170 return;
171
172 auto &zoomInfo = ViewInfo::Get(*pProject);
174 updater.SetData(&zoomInfo);
175
176 // Just using a stack-local Ruler object. Observe the "Invalidate"
177 // call above which has long been done with every redraw.
178 // Avoiding invalidation with every draw, and making the ruler persistent
179 // between drawings, would require that it be invalidated whenever the
180 // user drags points, or the time selection changes -- really too much
181 // work.
183 ruler.SetLabelEdges(false);
184
185 const auto tt = std::static_pointer_cast<const TimeTrack>(
186 pTrack->SubstitutePendingChangedTrack());
187 DrawTimeTrack(context, *tt, ruler, rect);
188 }
189 CommonChannelView::Draw(context, rect, iPass);
190}
static CustomUpdaterValue updater
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
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(), CommonTrackPanelCell::FindTrack(), ViewInfo::Get(), 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: