Audacity  3.0.3
TrackVRulerControls.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3 Audacity: A Digital Audio Editor
4 
5 TrackVRulerControls.h
6 
7 Paul Licameli split from TrackPanel.cpp
8 
9 **********************************************************************/
10 
11 #ifndef __AUDACITY_TRACK_VRULER_CONTROLS__
12 #define __AUDACITY_TRACK_VRULER_CONTROLS__
13 
14 #include "CommonTrackPanelCell.h"
15 
16 class Track;
17 class TrackView;
18 class wxDC;
19 
20 const int kGuard = 5; // 5 pixels to reduce risk of VZooming accidentally
21 
22 class AUDACITY_DLL_API TrackVRulerControls /* not final */
23  : public CommonTrackPanelCell
24  , public std::enable_shared_from_this< TrackVRulerControls >
25 {
26 public:
27  explicit
28  TrackVRulerControls( const std::shared_ptr<TrackView> &pTrackView );
29 
30  virtual ~TrackVRulerControls() = 0;
31 
32  static TrackVRulerControls &Get( TrackView& );
33  static const TrackVRulerControls &Get( const TrackView& );
34 
35  // Define a default hit test method, just for message and cursor
36  std::vector<UIHandlePtr> HitTest
37  (const TrackPanelMouseState &state,
38  const AudacityProject *pProject) override;
39 
40  // Helpers for handle classes' TrackPanelDrawable implementations
41  static void DrawZooming
42  ( TrackPanelDrawingContext &context, const wxRect &rect,
43  int zoomStart, int zoomEnd);
44  static wxRect ZoomingArea( const wxRect &rect, const wxRect &panelRect );
45 
46  // Modify the ruler rectangle, and related display parameters,
47  // cached in the associated track
48  virtual void UpdateRuler( const wxRect &rect ) = 0;
49 
50 protected:
51  std::shared_ptr<Track> DoFindTrack() override;
52 
53  // TrackPanelDrawable implementation
54  void Draw(
55  TrackPanelDrawingContext &context,
56  const wxRect &rect, unsigned iPass ) override;
57 
58  wxRect DrawingArea(
60  const wxRect &rect, const wxRect &panelRect, unsigned iPass ) override;
61 
62  Track *GetTrack() const;
63 
64  std::weak_ptr<TrackView> mwTrackView;
65 };
66 
67 #endif
TrackPanelCell::HitTest
virtual std::vector< UIHandlePtr > HitTest(const TrackPanelMouseState &state, const AudacityProject *pProject)=0
TrackPanelDrawingContext
Definition: TrackPanelDrawingContext.h:22
TrackPanelDrawable::DrawingArea
virtual wxRect DrawingArea(TrackPanelDrawingContext &context, const wxRect &rect, const wxRect &panelRect, unsigned iPass)
Definition: TrackPanelDrawable.cpp:22
TrackVRulerControls
Definition: TrackVRulerControls.h:25
CommonTrackPanelCell.h
BasicUI::Get
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:26
TrackVRulerControls::mwTrackView
std::weak_ptr< TrackView > mwTrackView
Definition: TrackVRulerControls.h:64
kGuard
const int kGuard
Definition: TrackVRulerControls.h:20
TrackVRulerControls::UpdateRuler
virtual void UpdateRuler(const wxRect &rect)=0
TrackVRulerControls::GetTrack
Track * GetTrack() const
Track
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:239
TrackView
Definition: TrackView.h:24
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:92
TrackPanelMouseState
Definition: TrackPanelMouseEvent.h:28
CommonTrackPanelCell::DoFindTrack
virtual std::shared_ptr< Track > DoFindTrack()=0
CommonTrackPanelCell
Definition: CommonTrackPanelCell.h:28
TrackPanelDrawable::Draw
virtual void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass)
Definition: TrackPanelDrawable.cpp:17