Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ChannelVRulerControls Class Referenceabstract

#include <ChannelVRulerControls.h>

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

Public Member Functions

 ChannelVRulerControls (const std::shared_ptr< ChannelView > &pChannelView)
 
virtual ~ChannelVRulerControls ()=0
 
std::vector< UIHandlePtrHitTest (const TrackPanelMouseState &state, const AudacityProject *pProject) override
 
virtual void UpdateRuler (const wxRect &rect)=0
 
std::shared_ptr< const ChannelViewGetChannelView () const
 
- 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...
 

Static Public Member Functions

static ChannelVRulerControlsGet (ChannelView &)
 
static const ChannelVRulerControlsGet (const ChannelView &)
 
static void DrawZooming (TrackPanelDrawingContext &context, const wxRect &rect, int zoomStart, int zoomEnd)
 
static wxRect ZoomingArea (const wxRect &rect, const wxRect &panelRect)
 
- 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)
 

Protected Member Functions

std::shared_ptr< TrackDoFindTrack () override
 
void Draw (TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
 
wxRect DrawingArea (TrackPanelDrawingContext &, const wxRect &rect, const wxRect &panelRect, unsigned iPass) override
 
TrackGetTrack () const
 
- 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

std::weak_ptr< ChannelViewmwChannelView
 

Detailed Description

Definition at line 22 of file ChannelVRulerControls.h.

Constructor & Destructor Documentation

◆ ChannelVRulerControls()

ChannelVRulerControls::ChannelVRulerControls ( const std::shared_ptr< ChannelView > &  pChannelView)
explicit

Definition at line 26 of file ChannelVRulerControls.cpp.

28 : CommonChannelCell{ pChannelView->FindChannel() }
29 , mwChannelView{ pChannelView }
30{
31}
std::weak_ptr< ChannelView > mwChannelView
auto FindChannel() -> std::shared_ptr< Subtype >
May return null.

◆ ~ChannelVRulerControls()

ChannelVRulerControls::~ChannelVRulerControls ( )
pure virtual

Definition at line 33 of file ChannelVRulerControls.cpp.

34{
35}

Member Function Documentation

◆ DoFindTrack()

std::shared_ptr< Track > ChannelVRulerControls::DoFindTrack ( )
overrideprotectedvirtual

Implements CommonTrackPanelCell.

Definition at line 48 of file ChannelVRulerControls.cpp.

49{
50 // Just pass-through to related ChannelView object
51 const auto pView = mwChannelView.lock();
52 if (pView)
53 return pView->DoFindTrack();
54 return {};
55}

References mwChannelView.

◆ Draw()

void ChannelVRulerControls::Draw ( TrackPanelDrawingContext context,
const wxRect &  rect,
unsigned  iPass 
)
overrideprotectedvirtual

Reimplemented from TrackPanelDrawable.

Definition at line 100 of file ChannelVRulerControls.cpp.

103{
104 // Common initial part of drawing for all subtypes
105 if ( iPass == TrackArtist::PassMargins ) {
106 auto rect = rect_;
107 --rect.width;
108
109 auto dc = &context.dc;
110
111
112 // Paint the background
113 auto pTrack = FindTrack();
114 AColor::MediumTrackInfo(dc, pTrack && pTrack->GetSelected() );
115 dc->DrawRectangle( rect );
116
117 // Stroke the left border
118 dc->SetPen(*wxBLACK_PEN);
119 {
120 const auto left = rect.GetLeft();
121 AColor::Line( *dc, left, rect.GetTop(), left, rect.GetBottom() );
122 }
123 }
124}
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
Definition: AColor.cpp:185
static void MediumTrackInfo(wxDC *dc, bool selected)
Definition: AColor.cpp:427
std::shared_ptr< Track > FindTrack()

References TrackPanelDrawingContext::dc, CommonTrackPanelCell::FindTrack(), AColor::Line(), AColor::MediumTrackInfo(), and TrackArtist::PassMargins.

Referenced by LabelTrackVRulerControls::Draw(), NoteTrackVRulerControls::Draw(), SpectrumVRulerControls::Draw(), WaveformVRulerControls::Draw(), and TimeTrackVRulerControls::Draw().

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

◆ DrawingArea()

wxRect ChannelVRulerControls::DrawingArea ( TrackPanelDrawingContext ,
const wxRect &  rect,
const wxRect &  panelRect,
unsigned  iPass 
)
overrideprotectedvirtual

Reimplemented from TrackPanelDrawable.

Definition at line 126 of file ChannelVRulerControls.cpp.

129{
130 // Common area change for all subclasses when drawing the controls
131 // A bevel extends below one pixel outside of the hit-test area
132 if (iPass == TrackArtist::PassControls)
133 return { rect.x, rect.y, rect.width, rect.height + 1 };
134 else
135 return rect;
136}

References TrackArtist::PassControls.

◆ DrawZooming()

void ChannelVRulerControls::DrawZooming ( TrackPanelDrawingContext context,
const wxRect &  rect,
int  zoomStart,
int  zoomEnd 
)
static

Definition at line 63 of file ChannelVRulerControls.cpp.

66{
67 // Draw a dashed rectangle, its right side disappearing in the black right
68 // border of the track area, which is not part of this cell but right of it.
69 auto &dc = context.dc;
70
71 dc.SetBrush(*wxTRANSPARENT_BRUSH);
72 dc.SetPen(*wxBLACK_DASHED_PEN);
73
74 wxRect rect {
75 rect_.x,
76 std::min( zoomStart, zoomEnd),
77 rect_.width,
78 1 + abs( zoomEnd - zoomStart)
79 };
80
81 dc.DrawRectangle(rect);
82}
int min(int a, int b)

References TrackPanelDrawingContext::dc, and min().

Referenced by WaveChannelVZoomHandle::DoDraw(), and NoteTrackVZoomHandle::Draw().

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

◆ Get() [1/2]

ChannelVRulerControls & ChannelVRulerControls::Get ( ChannelView trackView)
static

Definition at line 37 of file ChannelVRulerControls.cpp.

38{
39 return *trackView.GetVRulerControls();
40}
std::shared_ptr< ChannelVRulerControls > GetVRulerControls()

References ChannelView::GetVRulerControls().

Referenced by anonymous_namespace{TrackPanel.cpp}::VRulerAndChannel::Children(), and TrackPanel::UpdateTrackVRuler().

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

◆ Get() [2/2]

const ChannelVRulerControls & ChannelVRulerControls::Get ( const ChannelView trackView)
static

Definition at line 42 of file ChannelVRulerControls.cpp.

44{
45 return *trackView.GetVRulerControls();
46}

References ChannelView::GetVRulerControls().

Here is the call graph for this function:

◆ GetChannelView()

std::shared_ptr< const ChannelView > ChannelVRulerControls::GetChannelView ( ) const
inline

Definition at line 50 of file ChannelVRulerControls.h.

51 {
52 return mwChannelView.lock();
53 }

◆ GetTrack()

Track * ChannelVRulerControls::GetTrack ( ) const
protected

◆ HitTest()

std::vector< UIHandlePtr > ChannelVRulerControls::HitTest ( const TrackPanelMouseState state,
const AudacityProject pProject 
)
overridevirtual

Implements TrackPanelCell.

Definition at line 57 of file ChannelVRulerControls.cpp.

59{
60 return std::vector<UIHandlePtr>{};
61}

Referenced by SpectrumVRulerControls::HitTest(), WaveformVRulerControls::HitTest(), TimeTrackVRulerControls::HitTest(), and NoteTrackVRulerControls::HitTest().

Here is the caller graph for this function:

◆ UpdateRuler()

virtual void ChannelVRulerControls::UpdateRuler ( const wxRect &  rect)
pure virtual

Implemented in LabelTrackVRulerControls, NoteTrackVRulerControls, SpectrumVRulerControls, WaveformVRulerControls, and TimeTrackVRulerControls.

Referenced by WaveChannelVRulerControls::DoDraw(), and TrackPanel::UpdateTrackVRuler().

Here is the caller graph for this function:

◆ ZoomingArea()

wxRect ChannelVRulerControls::ZoomingArea ( const wxRect &  rect,
const wxRect &  panelRect 
)
static

Definition at line 84 of file ChannelVRulerControls.cpp.

86{
87 // TODO: Don't use the constant kRightMargin, but somehow discover the
88 // neighboring track rectangle
89 return {
90 // Left edge of the rectangle disappears in the vertical line at
91 // left edge of the ruler
92 rect.x,
93 rect.y,
94 // Extend the dashed rectangle right up to the track border
95 (panelRect.width - kRightMargin + kBorderThickness) - rect.x,
96 rect.height
97 };
98}
@ kRightMargin
Definition: ZoomInfo.h:28
@ kBorderThickness
Definition: ZoomInfo.h:22

References kBorderThickness, and kRightMargin.

Referenced by WaveChannelVZoomHandle::DoDrawingArea(), and NoteTrackVZoomHandle::DrawingArea().

Here is the caller graph for this function:

Member Data Documentation

◆ mwChannelView

std::weak_ptr<ChannelView> ChannelVRulerControls::mwChannelView
protected

Definition at line 69 of file ChannelVRulerControls.h.

Referenced by DoFindTrack().


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