11#ifndef __AUDACITY_ADORNED_RULER_PANEL__
12#define __AUDACITY_ADORNED_RULER_PANEL__
41 const wxPoint& pos = wxDefaultPosition,
42 const wxSize&
size = wxDefaultSize,
48 (
bool eraseBackground =
true,
const wxRect *rect = (
const wxRect *) NULL)
53 void SetFocusFromKbd()
override;
57 static int GetRulerHeight(
bool showScrubBar);
60 void SetLeftOffset(
int offset);
64 void SetPlayRegion(
double playRegionStart,
double playRegionEnd);
66 void TogglePinnedHead();
68 void GetMaxSize(wxCoord *width, wxCoord *height);
70 void InvalidateRuler();
73 void ReCreateButtons();
75 void UpdateQuickPlayPos(wxCoord &mousePosX);
77 bool ShowingScrubRuler()
const;
81 void DrawBothOverlays();
86 void OnIdle( wxIdleEvent &evt );
88 void OnPaint(wxPaintEvent &evt);
89 void OnSize(wxSizeEvent &evt);
90 void OnLeave(wxMouseEvent &evt);
99 bool newDefault,
bool cutPreview,
const double *pStartTime =
nullptr);
101 void DoDrawBackground(wxDC * dc);
102 void DoDrawEdge(wxDC *dc);
103 void DoDrawMarks(wxDC * dc,
bool );
104 wxRect RegionRectangle(
double t0,
double t1)
const;
105 wxRect PlayRegionRectangle()
const;
106 wxRect SelectedRegionRectangle()
const;
107 void DoDrawPlayRegion(wxDC * dc,
108 const wxRect &rectP,
const wxRect &rectL,
const wxRect &rectR);
109 void DoDrawPlayRegionLimits(wxDC * dc,
const wxRect &rect);
110 void DoDrawOverlap(wxDC * dc,
const wxRect &rect);
111 void DoDrawSelection(wxDC * dc,
112 const wxRect &rectS,
const wxRect &rectL,
const wxRect &rectR);
115 void DoDrawScrubIndicator(wxDC * dc, wxCoord xx,
int width,
bool scrub,
bool seek);
116 void UpdateButtonStates();
120 struct Resetter {
void operator () (
bool *p)
const {
if(p) *p =
false; } };
126 void SetNumGuides(
size_t nn);
130 void ShowContextMenu( MenuChoice choice,
const wxPoint *pPosition);
132 double Pos2Time(
int p,
bool ignoreFisheye =
false)
const;
133 int Time2Pos(
double t,
bool ignoreFisheye =
false)
const;
135 bool IsWithinMarker(
int mousePosX,
double markerTime);
154 static constexpr size_t MAX_GUIDES = 2;
155 double mQuickPlayOffset[MAX_GUIDES]{};
156 double mQuickPlayPosUnsnapped[MAX_GUIDES]{};
157 double mQuickPlayPos[MAX_GUIDES]{};
158 bool mIsSnapped[MAX_GUIDES]{};
159 size_t mNumGuides{ 1 };
168 void ShowMenu(
const wxPoint & pos);
169 void ShowScrubMenu(
const wxPoint & pos);
171 void HandleSnapping(
size_t index);
172 void OnTimelineFormatChange(wxCommandEvent& evt);
173 void OnSyncSelToQuickPlay(wxCommandEvent &evt);
174 void OnAutoScroll(wxCommandEvent &evt);
179 void OnPinnedButton(wxCommandEvent & event);
180 void OnTogglePinnedState(wxCommandEvent & event);
189 mesSelectingPlayRegionRange
197 DECLARE_EVENT_TABLE()
199 wxWindow *mButtons[3];
200 bool mNeedButtonUpdate {
true };
208 std::shared_ptr<TrackPanelNode>
Root()
override;
216 unsigned refreshResult)
override;
220 void CreateOverlays();
223 class TrackPanelGuidelineOverlay;
224 std::shared_ptr<TrackPanelGuidelineOverlay>
mOverlay;
255 std::pair<double, double> mLastDrawnPlayRegion{};
256 bool mLastPlayRegionActive =
false;
257 double mLastDrawnH{};
258 double mLastDrawnZoom{};
This is an Audacity Specific ruler panel which additionally has border, selection markers,...
std::shared_ptr< ScrubbingCell > mScrubbingCell
Observer::Subscription mAudioIOSubscription
PlayRegion mOldPlayRegion
AudacityProject *const mProject
bool AcceptsFocus() const override
wxRect GetInnerRect() const
bool AcceptsFocusFromKeyboard() const override
std::shared_ptr< TrackPanelGuidelineOverlay > mOverlay
std::unique_ptr< bool, Resetter > TempAllowFocus
bool mPlayRegionDragsSelection
static bool s_AcceptsFocus
void HandleQPClick(wxMouseEvent &event, wxCoord mousePosX)
Observer::Subscription mPlayRegionSubscription
void HandleQPRelease(wxMouseEvent &event)
Observer::Subscription mRulerInvalidatedSubscription
TimeDisplayMode mTimeDisplayMode
void HandleQPDrag(wxMouseEvent &event, wxCoord mousePosX)
Observer::Subscription mThemeChangeSubscription
MouseEventState mMouseEventState
std::shared_ptr< QPCell > mQPCell
double mLeftDownClickUnsnapped
@ mesDraggingPlayRegionStart
@ mesDraggingPlayRegionEnd
@ mesSelectingPlayRegionClick
SelectedRegion mLastDrawnSelectedRegion
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
void OnSize(wxSizeEvent &event)
Formerly part of TrackPanel, this abstract base class has no special knowledge of Track objects and i...
virtual std::shared_ptr< TrackPanelNode > Root()=0
virtual AudacityProject * GetProject() const =0
virtual std::shared_ptr< TrackPanelCell > GetFocusedCell()=0
virtual void UpdateStatusMessage(const TranslatableString &)=0
virtual void SetFocusedCell()=0
virtual void ProcessUIHandleResult(TrackPanelCell *pClickedCell, TrackPanelCell *pLatestCell, unsigned refreshResult)=0
A move-only handle representing a connection to a Publisher.
A listener notified of changes in preferences.
virtual void UpdatePrefs()=0
Defines a selected portion of a project.
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Holds a msgid for the translation catalog; may also bind format arguments.
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
void ClearPlayRegion(AudacityProject &project)
Default message type for Publisher.