Audacity 3.2.0
TrackVRulerControls.h
Go to the documentation of this file.
1/**********************************************************************
2
3Audacity: A Digital Audio Editor
4
5TrackVRulerControls.h
6
7Paul Licameli split from TrackPanel.cpp
8
9**********************************************************************/
10
11#ifndef __AUDACITY_TRACK_VRULER_CONTROLS__
12#define __AUDACITY_TRACK_VRULER_CONTROLS__
13
15
16class Track;
17class TrackView;
18class wxDC;
19
20const int kGuard = 5; // 5 pixels to reduce risk of VZooming accidentally
21
22class AUDACITY_DLL_API TrackVRulerControls /* not final */
24 , public std::enable_shared_from_this< TrackVRulerControls >
25{
26public:
27 explicit
28 TrackVRulerControls( const std::shared_ptr<TrackView> &pTrackView );
29
30 virtual ~TrackVRulerControls() = 0;
31
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
50protected:
51 std::shared_ptr<Track> DoFindTrack() override;
52
53 // TrackPanelDrawable implementation
54 void Draw(
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
const int kGuard
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:89
virtual std::shared_ptr< Track > DoFindTrack()=0
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:225
virtual std::vector< UIHandlePtr > HitTest(const TrackPanelMouseState &state, const AudacityProject *pProject)=0
virtual void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass)
virtual wxRect DrawingArea(TrackPanelDrawingContext &context, const wxRect &rect, const wxRect &panelRect, unsigned iPass)
std::weak_ptr< TrackView > mwTrackView
virtual void UpdateRuler(const wxRect &rect)=0
Track * GetTrack() const
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:26