Audacity  3.0.3
Public Member Functions | Private Member Functions | Private Attributes | List of all members
TimeTrackVRulerControls Class Referencefinal

#include <TimeTrackVRulerControls.h>

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

Public Member Functions

 TimeTrackVRulerControls (const std::shared_ptr< TrackView > &pTrackView)
 
 ~TimeTrackVRulerControls ()
 
std::vector< UIHandlePtrHitTest (const TrackPanelMouseState &state, const AudacityProject *) override
 
- Public Member Functions inherited from TrackVRulerControls
 TrackVRulerControls (const std::shared_ptr< TrackView > &pTrackView)
 
virtual ~TrackVRulerControls ()=0
 
std::vector< UIHandlePtrHitTest (const TrackPanelMouseState &state, const AudacityProject *pProject) override
 
- 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
 

Private Member Functions

 TimeTrackVRulerControls (const TimeTrackVRulerControls &)=delete
 
TimeTrackVRulerControlsoperator= (const TimeTrackVRulerControls &)=delete
 
void Draw (TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
 
void UpdateRuler (const wxRect &rect) override
 

Private Attributes

std::weak_ptr< TimeTrackVZoomHandlemVZoomHandle
 

Additional Inherited Members

- Public Types inherited from CommonTrackPanelCell
using Hook = std::function< unsigned(const TrackPanelMouseEvent &evt, AudacityProject *pProject) >
 
- Static Public Member Functions inherited from TrackVRulerControls
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 inherited from TrackVRulerControls
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 inherited from TrackVRulerControls
std::weak_ptr< TrackViewmwTrackView
 

Detailed Description

Definition at line 20 of file TimeTrackVRulerControls.h.

Constructor & Destructor Documentation

◆ TimeTrackVRulerControls() [1/2]

TimeTrackVRulerControls::TimeTrackVRulerControls ( const TimeTrackVRulerControls )
privatedelete

◆ TimeTrackVRulerControls() [2/2]

TimeTrackVRulerControls::TimeTrackVRulerControls ( const std::shared_ptr< TrackView > &  pTrackView)
inlineexplicit

Definition at line 27 of file TimeTrackVRulerControls.h.

28  : TrackVRulerControls( pTrackView ) {}

◆ ~TimeTrackVRulerControls()

TimeTrackVRulerControls::~TimeTrackVRulerControls ( )

Definition at line 29 of file TimeTrackVRulerControls.cpp.

30 {
31 }

Member Function Documentation

◆ Draw()

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

Reimplemented from TrackPanelDrawable.

Definition at line 63 of file TimeTrackVRulerControls.cpp.

66 {
67  TrackVRulerControls::Draw( context, rect_, iPass );
68 
69  // Draw on a later pass because the bevel overpaints one pixel
70  // out of bounds on the bottom
71 
72  if ( iPass == TrackArtist::PassControls ) {
73  auto t = FindTrack();
74  if ( !t )
75  return;
76 
77  auto rect = rect_;
78  --rect.width;
79  --rect.height;
80 
81  auto dc = &context.dc;
82  wxRect bev = rect;
83  bev.Inflate(-1, 0);
84  bev.width += 1;
85  AColor::BevelTrackInfo(*dc, true, bev);
86 
87  // Right align the ruler
88  wxRect rr = rect;
89  rr.width--;
90  if (t && t->vrulerSize.GetWidth() < rect.GetWidth()) {
91  int adj = rr.GetWidth() - t->vrulerSize.GetWidth();
92  rr.x += adj;
93  rr.width -= adj;
94  }
95 
96  UpdateRuler(rr);
97 
98  auto vruler = &ruler();
99 
100  vruler->SetTickColour( theTheme.Colour( clrTrackPanelText ));
101  vruler->Draw(*dc);
102  }
103 }

References AColor::BevelTrackInfo(), ThemeBase::Colour(), TrackPanelDrawingContext::dc, TrackVRulerControls::Draw(), CommonTrackPanelCell::FindTrack(), TrackArtist::PassControls, anonymous_namespace{TimeTrackVRulerControls.cpp}::ruler(), theTheme, and UpdateRuler().

Here is the call graph for this function:

◆ HitTest()

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

Implements TrackPanelCell.

Definition at line 41 of file TimeTrackVRulerControls.cpp.

44 {
45  std::vector<UIHandlePtr> results;
46 
47  if ( st.state.GetX() <= st.rect.GetRight() - kGuard ) {
48  auto pTrack = FindTrack()->SharedPointer<TimeTrack>( );
49  if (pTrack) {
50  auto result = std::make_shared<TimeTrackVZoomHandle>(
51  pTrack, st.rect, st.state.m_y );
52  result = AssignUIHandlePtr(mVZoomHandle, result);
53  results.push_back(result);
54  }
55  }
56 
57  auto more = TrackVRulerControls::HitTest(st, pProject);
58  std::copy(more.begin(), more.end(), std::back_inserter(results));
59 
60  return results;
61 }

References AssignUIHandlePtr(), CommonTrackPanelCell::FindTrack(), TrackVRulerControls::HitTest(), kGuard, mVZoomHandle, TrackPanelMouseState::rect, and TrackPanelMouseState::state.

Here is the call graph for this function:

◆ operator=()

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

◆ UpdateRuler()

void TimeTrackVRulerControls::UpdateRuler ( const wxRect &  rect)
overrideprivatevirtual

Implements TrackVRulerControls.

Definition at line 105 of file TimeTrackVRulerControls.cpp.

106 {
107  const auto tt = std::static_pointer_cast< TimeTrack >( FindTrack() );
108  if (!tt)
109  return;
110  auto vruler = &ruler();
111 
112  float min, max;
113  min = tt->GetRangeLower() * 100.0;
114  max = tt->GetRangeUpper() * 100.0;
115 
116  vruler->SetDbMirrorValue( 0.0 );
117  vruler->SetBounds(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height-1);
118  vruler->SetOrientation(wxVERTICAL);
119  vruler->SetRange(max, min);
120  vruler->SetFormat((tt->GetDisplayLog()) ? Ruler::RealLogFormat : Ruler::RealFormat);
121  vruler->SetUnits({});
122  vruler->SetLabelEdges(false);
123  vruler->SetLog(tt->GetDisplayLog());
124 
125  vruler->GetMaxSize( &tt->vrulerSize.x, &tt->vrulerSize.y );
126 }

References CommonTrackPanelCell::FindTrack(), min(), Ruler::RealFormat, Ruler::RealLogFormat, and anonymous_namespace{TimeTrackVRulerControls.cpp}::ruler().

Referenced by Draw().

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

Member Data Documentation

◆ mVZoomHandle

std::weak_ptr<TimeTrackVZoomHandle> TimeTrackVRulerControls::mVZoomHandle
private

Definition at line 45 of file TimeTrackVRulerControls.h.

Referenced by HitTest().


The documentation for this class was generated from the following files:
TrackVRulerControls::TrackVRulerControls
TrackVRulerControls(const std::shared_ptr< TrackView > &pTrackView)
Definition: TrackVRulerControls.cpp:26
CommonTrackPanelCell::FindTrack
std::shared_ptr< Track > FindTrack()
Definition: CommonTrackPanelCell.h:46
Ruler::RealFormat
@ RealFormat
Definition: Ruler.h:31
TrackPanelDrawingContext::dc
wxDC & dc
Definition: TrackPanelDrawingContext.h:23
TimeTrackVRulerControls::UpdateRuler
void UpdateRuler(const wxRect &rect) override
Definition: TimeTrackVRulerControls.cpp:105
AColor::BevelTrackInfo
static void BevelTrackInfo(wxDC &dc, bool up, const wxRect &r, bool highlight=false)
Definition: AColor.cpp:248
anonymous_namespace{TimeTrackVRulerControls.cpp}::ruler
Ruler & ruler()
Definition: TimeTrackVRulerControls.cpp:34
TimeTrackVRulerControls::mVZoomHandle
std::weak_ptr< TimeTrackVZoomHandle > mVZoomHandle
Definition: TimeTrackVRulerControls.h:45
TrackArtist::PassControls
@ PassControls
Definition: TrackArtist.h:84
kGuard
const int kGuard
Definition: TrackVRulerControls.h:20
TrackVRulerControls::HitTest
std::vector< UIHandlePtr > HitTest(const TrackPanelMouseState &state, const AudacityProject *pProject) override
Definition: TrackVRulerControls.cpp:55
Ruler::RealLogFormat
@ RealLogFormat
Definition: Ruler.h:32
theTheme
THEME_API Theme theTheme
Definition: Theme.cpp:79
min
int min(int a, int b)
Definition: CompareAudioCommand.cpp:106
TrackVRulerControls::Draw
void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
Definition: TrackVRulerControls.cpp:97
ThemeBase::Colour
wxColour & Colour(int iIndex)
Definition: Theme.cpp:1189
AssignUIHandlePtr
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
Definition: UIHandle.h:151
TimeTrack
A kind of Track used to 'warp time'.
Definition: TimeTrack.h:24