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 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)
 

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 : mwChannelView{ pChannelView }
29{
30}
std::weak_ptr< ChannelView > mwChannelView

◆ ~ChannelVRulerControls()

ChannelVRulerControls::~ChannelVRulerControls ( )
pure virtual

Definition at line 32 of file ChannelVRulerControls.cpp.

33{
34}

Member Function Documentation

◆ DoFindTrack()

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

Implements CommonTrackPanelCell.

Definition at line 47 of file ChannelVRulerControls.cpp.

48{
49 const auto pView = mwChannelView.lock();
50 if (pView)
51 return pView->FindTrack();
52 return {};
53}

References mwChannelView.

◆ Draw()

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

Reimplemented from TrackPanelDrawable.

Definition at line 98 of file ChannelVRulerControls.cpp.

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

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

References TrackArtist::PassControls.

◆ DrawZooming()

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

Definition at line 61 of file ChannelVRulerControls.cpp.

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

37{
38 return *trackView.GetVRulerControls();
39}
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 41 of file ChannelVRulerControls.cpp.

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

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 55 of file ChannelVRulerControls.cpp.

57{
58 return std::vector<UIHandlePtr>{};
59}

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 82 of file ChannelVRulerControls.cpp.

84{
85 // TODO: Don't use the constant kRightMargin, but somehow discover the
86 // neighboring track rectangle
87 return {
88 // Left edge of the rectangle disappears in the vertical line at
89 // left edge of the ruler
90 rect.x,
91 rect.y,
92 // Extend the dashed rectangle right up to the track border
93 (panelRect.width - kRightMargin + kBorderThickness) - rect.x,
94 rect.height
95 };
96}
@ 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: