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

#include <NoteTrackView.h>

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

Public Member Functions

 NoteTrackView (const std::shared_ptr< Channel > &pChannel)
 
 ~NoteTrackView () 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

 NoteTrackView (const NoteTrackView &)=delete
 
NoteTrackViewoperator= (const NoteTrackView &)=delete
 
std::shared_ptr< ChannelVRulerControlsDoGetVRulerControls () override
 
std::shared_ptr< CommonTrackCellGetAffordanceControls () override
 
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::shared_ptr< CommonTrackCellmpAffordanceCellControl
 

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 16 of file NoteTrackView.h.

Constructor & Destructor Documentation

◆ NoteTrackView() [1/2]

NoteTrackView::NoteTrackView ( const NoteTrackView )
privatedelete

◆ NoteTrackView() [2/2]

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

Definition at line 35 of file NoteTrackView.cpp.

36 : CommonChannelView{ pChannel }
37{
38}
Implements some hit-testing shared by many ChannelView subtypes.

◆ ~NoteTrackView()

NoteTrackView::~NoteTrackView ( )
override

Definition at line 40 of file NoteTrackView.cpp.

41{
42}

Member Function Documentation

◆ DetailedHitTest()

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

Implements CommonChannelView.

Definition at line 44 of file NoteTrackView.cpp.

47{
48 // Eligible for stretch?
49 UIHandlePtr result;
50 std::vector<UIHandlePtr> results;
51#ifdef USE_MIDI
52#ifdef EXPERIMENTAL_MIDI_STRETCHING
54 mStretchHandle, state, pProject, FindChannel<NoteTrack>());
55 if (result)
56 results.push_back(result);
57#endif
58#endif
59
60 return results;
61}
std::shared_ptr< UIHandle > UIHandlePtr
Definition: CellularPanel.h:28
static UIHandlePtr HitTest(std::weak_ptr< StretchHandle > &holder, const TrackPanelMouseState &state, const AudacityProject *pProject, const std::shared_ptr< NoteTrack > &pTrack)

References StretchHandle::HitTest().

Here is the call graph for this function:

◆ DoGetVRulerControls()

std::shared_ptr< ChannelVRulerControls > NoteTrackView::DoGetVRulerControls ( )
overrideprivatevirtual

Implements ChannelView.

Definition at line 71 of file NoteTrackView.cpp.

72{
73 return
74 std::make_shared<NoteTrackVRulerControls>( shared_from_this() );
75}

◆ Draw()

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

Reimplemented from TrackPanelDrawable.

Definition at line 720 of file NoteTrackView.cpp.

723{
724 const auto artist = TrackArtist::Get(context);
725 const auto &pendingTracks = *artist->pPendingTracks;
726
727 if ( iPass == TrackArtist::PassTracks ) {
728 const auto pChannel = FindChannel();
729 if (!pChannel)
730 return;
731 const auto &nt = static_cast<const NoteTrack&>(
732 pendingTracks.SubstitutePendingChangedChannel(*pChannel));
733 bool muted = false;
734 const auto artist = TrackArtist::Get( context );
735 const auto hasSolo = artist->hasSolo;
736 muted = (hasSolo || nt.GetMute()) && !nt.GetSolo();
737
740 bool selected{ false };
741 if (auto affordance = std::dynamic_pointer_cast<NoteTrackAffordanceControls>(GetAffordanceControls()))
742 {
743 selected = affordance->IsSelected();
744 }
745
746 DrawNoteTrack(context, nt, rect, muted, selected);
747 }
748 CommonChannelView::Draw(context, rect, iPass);
749}
static wxBrush labelSelectedBrush
Definition: AColor.h:122
static wxBrush labelUnselectedBrush
Definition: AColor.h:121
auto FindChannel() -> std::shared_ptr< Subtype >
May return null.
A Track that is used for Midi notes. (Somewhat old code).
Definition: NoteTrack.h:78
std::shared_ptr< CommonTrackCell > GetAffordanceControls() override
static TrackArtist * Get(TrackPanelDrawingContext &)
Definition: TrackArtist.cpp:69
virtual void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass)
AUDACITY_DLL_API void DrawBackgroundWithSelection(TrackPanelDrawingContext &context, const wxRect &rect, const Channel &channel, const wxBrush &selBrush, const wxBrush &unselBrush, bool useSelection=true)
Definition: TrackArt.cpp:651
void DrawNoteTrack(TrackPanelDrawingContext &context, const NoteTrack &track, const wxRect &rect, bool muted, bool selected)

References TrackPanelDrawable::Draw(), TrackArt::DrawBackgroundWithSelection(), anonymous_namespace{NoteTrackView.cpp}::DrawNoteTrack(), CommonChannelCell::FindChannel(), TrackArtist::Get(), GetAffordanceControls(), AColor::labelSelectedBrush, AColor::labelUnselectedBrush, and TrackArtist::PassTracks.

Here is the call graph for this function:

◆ GetAffordanceControls()

std::shared_ptr< CommonTrackCell > NoteTrackView::GetAffordanceControls ( )
overrideprivatevirtual

Reimplemented from ChannelView.

Definition at line 80 of file NoteTrackView.cpp.

81{
82 if (mpAffordanceCellControl == nullptr)
83 {
84 mpAffordanceCellControl = std::make_shared<NoteTrackAffordanceControls>(DoFindTrack());
85 }
87}
std::shared_ptr< Track > DoFindTrack() override
std::shared_ptr< CommonTrackCell > mpAffordanceCellControl
Definition: NoteTrackView.h:40

References CommonChannelCell::DoFindTrack(), and mpAffordanceCellControl.

Referenced by Draw().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

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

Member Data Documentation

◆ mpAffordanceCellControl

std::shared_ptr<CommonTrackCell> NoteTrackView::mpAffordanceCellControl
private

Definition at line 40 of file NoteTrackView.h.

Referenced by GetAffordanceControls().


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