Audacity 3.2.0
ChannelVRulerControls.h
Go to the documentation of this file.
1/**********************************************************************
2
3Audacity: A Digital Audio Editor
4
5ChannelVRulerControls.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 ChannelView;
18class wxDC;
19
20const int kGuard = 5; // 5 pixels to reduce risk of VZooming accidentally
21
22class AUDACITY_DLL_API ChannelVRulerControls /* not final */
23 : public CommonChannelCell
24 , public std::enable_shared_from_this<ChannelVRulerControls>
25{
26public:
27 explicit
28 ChannelVRulerControls(const std::shared_ptr<ChannelView> &pChannelView);
29
30 virtual ~ChannelVRulerControls() = 0;
31
33 static const ChannelVRulerControls &Get(const ChannelView&);
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 std::shared_ptr<const ChannelView> GetChannelView() const
51 {
52 return mwChannelView.lock();
53 }
54
55protected:
56 std::shared_ptr<Track> DoFindTrack() override;
57
58 // TrackPanelDrawable implementation
59 void Draw(
61 const wxRect &rect, unsigned iPass ) override;
62
63 wxRect DrawingArea(
65 const wxRect &rect, const wxRect &panelRect, unsigned iPass ) override;
66
67 Track *GetTrack() const;
68
69 std::weak_ptr<ChannelView> mwChannelView;
70};
71
72#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:90
std::weak_ptr< ChannelView > mwChannelView
virtual void UpdateRuler(const wxRect &rect)=0
std::shared_ptr< const ChannelView > GetChannelView() const
Track * GetTrack() const
std::shared_ptr< Track > DoFindTrack() override
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:110
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)
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:202