Audacity  3.0.3
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TrackVRulerControls Class Referenceabstract

#include <TrackVRulerControls.h>

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

Public Member Functions

 TrackVRulerControls (const std::shared_ptr< TrackView > &pTrackView)
 
virtual ~TrackVRulerControls ()=0
 
std::vector< UIHandlePtrHitTest (const TrackPanelMouseState &state, const AudacityProject *pProject) override
 
virtual void UpdateRuler (const wxRect &rect)=0
 
- 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 &) PROHIBITED
 
TrackPanelCelloperator= (const TrackPanelCell &) PROHIBITED
 
virtual ~TrackPanelCell ()=0
 
virtual std::shared_ptr< TrackPanelCellContextMenuDelegate ()
 
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
 

Static Public Member Functions

static TrackVRulerControlsGet (TrackView &)
 
static const TrackVRulerControlsGet (const TrackView &)
 
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 CommonTrackPanelCell
static Hook InstallMouseWheelHook (const Hook &hook)
 
- 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
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< TrackViewmwTrackView
 

Additional Inherited Members

- Public Types inherited from CommonTrackPanelCell
using Hook = std::function< unsigned(const TrackPanelMouseEvent &evt, AudacityProject *pProject) >
 

Detailed Description

Definition at line 22 of file TrackVRulerControls.h.

Constructor & Destructor Documentation

◆ TrackVRulerControls()

TrackVRulerControls::TrackVRulerControls ( const std::shared_ptr< TrackView > &  pTrackView)
explicit

Definition at line 26 of file TrackVRulerControls.cpp.

28  : mwTrackView{ pTrackView }
29 {
30 }

◆ ~TrackVRulerControls()

TrackVRulerControls::~TrackVRulerControls ( )
pure virtual

Definition at line 32 of file TrackVRulerControls.cpp.

33 {
34 }

Member Function Documentation

◆ DoFindTrack()

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

Implements CommonTrackPanelCell.

Definition at line 46 of file TrackVRulerControls.cpp.

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

References mwTrackView.

◆ Draw()

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

Reimplemented from TrackPanelDrawable.

Definition at line 97 of file TrackVRulerControls.cpp.

100 {
101  // Common initial part of drawing for all subtypes
102  if ( iPass == TrackArtist::PassMargins ) {
103  auto rect = rect_;
104  --rect.width;
105 
106  auto dc = &context.dc;
107 
108 
109  // Paint the background
110  auto pTrack = FindTrack();
111  AColor::MediumTrackInfo(dc, pTrack && pTrack->GetSelected() );
112  dc->DrawRectangle( rect );
113 
114  // Stroke the left border
115  dc->SetPen(*wxBLACK_PEN);
116  {
117  const auto left = rect.GetLeft();
118  AColor::Line( *dc, left, rect.GetTop(), left, rect.GetBottom() );
119  }
120  }
121 }

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 TrackVRulerControls::DrawingArea ( TrackPanelDrawingContext ,
const wxRect &  rect,
const wxRect &  panelRect,
unsigned  iPass 
)
overrideprotectedvirtual

Reimplemented from TrackPanelDrawable.

Definition at line 123 of file TrackVRulerControls.cpp.

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

References TrackArtist::PassControls.

◆ DrawZooming()

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

Definition at line 60 of file TrackVRulerControls.cpp.

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

References TrackPanelDrawingContext::dc, and min().

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

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

◆ Get() [1/2]

const TrackVRulerControls & TrackVRulerControls::Get ( const TrackView trackView)
static

Definition at line 41 of file TrackVRulerControls.cpp.

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

References TrackView::GetVRulerControls().

Here is the call graph for this function:

◆ Get() [2/2]

TrackVRulerControls & TrackVRulerControls::Get ( TrackView trackView)
static

Definition at line 36 of file TrackVRulerControls.cpp.

37 {
38  return *trackView.GetVRulerControls();
39 }

References TrackView::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:

◆ GetTrack()

Track* TrackVRulerControls::GetTrack ( ) const
protected

◆ HitTest()

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

Implements TrackPanelCell.

Definition at line 54 of file TrackVRulerControls.cpp.

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

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

Here is the caller graph for this function:

◆ UpdateRuler()

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

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

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

Here is the caller graph for this function:

◆ ZoomingArea()

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

Definition at line 81 of file TrackVRulerControls.cpp.

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

References kBorderThickness, and kRightMargin.

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

Here is the caller graph for this function:

Member Data Documentation

◆ mwTrackView

std::weak_ptr<TrackView> TrackVRulerControls::mwTrackView
protected

Definition at line 64 of file TrackVRulerControls.h.

Referenced by DoFindTrack().


The documentation for this class was generated from the following files:
CommonTrackPanelCell::FindTrack
std::shared_ptr< Track > FindTrack()
Definition: CommonTrackPanelCell.h:46
AColor::Line
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
Definition: AColor.cpp:109
kBorderThickness
@ kBorderThickness
Definition: ZoomInfo.h:28
TrackPanelDrawingContext::dc
wxDC & dc
Definition: TrackPanelDrawingContext.h:23
TrackVRulerControls::mwTrackView
std::weak_ptr< TrackView > mwTrackView
Definition: TrackVRulerControls.h:64
TrackView::GetVRulerControls
std::shared_ptr< TrackVRulerControls > GetVRulerControls()
Definition: TrackView.cpp:131
TrackArtist::PassControls
@ PassControls
Definition: TrackArtist.h:84
AColor::MediumTrackInfo
static void MediumTrackInfo(wxDC *dc, bool selected)
Definition: AColor.cpp:341
min
int min(int a, int b)
Definition: CompareAudioCommand.cpp:106
kRightMargin
@ kRightMargin
Definition: ZoomInfo.h:34
TrackArtist::PassMargins
@ PassMargins
Definition: TrackArtist.h:82