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);
159 static constexpr size_t MAX_GUIDES = 2;
160 double mQuickPlayOffset[MAX_GUIDES]{};
161 double mQuickPlayPosUnsnapped[MAX_GUIDES]{};
162 double mQuickPlayPos[MAX_GUIDES]{};
163 bool mIsSnapped[MAX_GUIDES]{};
164 size_t mNumGuides{ 1 };
173 void ShowMenu(
const wxPoint & pos);
174 void ShowScrubMenu(
const wxPoint & pos);
176 void HandleSnapping(
size_t index);
177 void UpdateBeatsAndMeasuresFormat();
178 void RefreshTimelineFormat();
179 void OnTimelineFormatChange(wxCommandEvent& evt);
180 void OnSyncSelToQuickPlay(wxCommandEvent &evt);
182 void OnAutoScroll(wxCommandEvent &evt);
187 void OnPinnedButton(wxCommandEvent & event);
188 void OnTogglePinnedState(wxCommandEvent & event);
198 mesSelectingPlayRegionRange
206 DECLARE_EVENT_TABLE()
208 wxWindow *mButtons[3];
209 bool mNeedButtonUpdate {
true };
217 std::shared_ptr<TrackPanelNode>
Root()
override;
225 unsigned refreshResult)
override;
229 void CreateOverlays();
232 class TrackPanelGuidelineOverlay;
233 std::shared_ptr<TrackPanelGuidelineOverlay>
mOverlay;
264 std::pair<double, double> mLastDrawnPlayRegion{};
265 bool mLastPlayRegionActive =
false;
266 double mLastDrawnH{};
267 double mLastDrawnZoom{};
EnumSetting< AdornedRulerPanel::RulerTypeValues > RulerPanelViewPreference
This is an Audacity Specific ruler panel which additionally has border, selection markers,...
std::shared_ptr< ScrubbingCell > mScrubbingCell
Observer::Subscription mAudioIOSubscription
Observer::Subscription mProjectTimeSignatureChangedSubscription
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)
void HandleQPDrag(wxMouseEvent &event, wxCoord mousePosX)
Observer::Subscription mThemeChangeSubscription
RulerTypeValues mRulerType
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 void UpdateStatusMessage(const TranslatableString &)=0
virtual void SetFocusedCell()=0
virtual TrackPanelCell * GetFocusedCell()=0
virtual void ProcessUIHandleResult(TrackPanelCell *pClickedCell, TrackPanelCell *pLatestCell, unsigned refreshResult)=0
Adapts EnumSettingBase to a particular enumeration type.
A move-only handle representing a connection to a Publisher.
A listener notified of changes in preferences.
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)
AUDACITY_DLL_API void UpdatePrefs(wxWindow *pParent)
Default message type for Publisher.