11#ifndef __AUDACITY_ADORNED_RULER_PANEL__
12#define __AUDACITY_ADORNED_RULER_PANEL__
37 const wxPoint& pos = wxDefaultPosition,
38 const wxSize&
size = wxDefaultSize,
44 (
bool eraseBackground =
true,
const wxRect *rect = (
const wxRect *) NULL)
49 void SetFocusFromKbd()
override;
53 static int GetRulerHeight(
bool showScrubBar);
56 void SetLeftOffset(
int offset);
60 void SetPlayRegion(
double playRegionStart,
double playRegionEnd);
62 void TogglePinnedHead();
64 void GetMaxSize(wxCoord *width, wxCoord *height);
66 void InvalidateRuler();
69 void ReCreateButtons();
71 void UpdateQuickPlayPos(wxCoord &mousePosX);
73 bool ShowingScrubRuler()
const;
77 void DrawBothOverlays();
82 void OnIdle( wxIdleEvent &evt );
84 void OnPaint(wxPaintEvent &evt);
85 void OnSize(wxSizeEvent &evt);
86 void OnLeave(wxMouseEvent &evt);
95 bool newDefault,
bool cutPreview,
const double *pStartTime =
nullptr);
97 void DoDrawBackground(wxDC * dc);
98 void DoDrawEdge(wxDC *dc);
99 void DoDrawMarks(wxDC * dc,
bool );
100 wxRect RegionRectangle(
double t0,
double t1)
const;
101 wxRect PlayRegionRectangle()
const;
102 wxRect SelectedRegionRectangle()
const;
103 void DoDrawPlayRegion(wxDC * dc,
104 const wxRect &rectP,
const wxRect &rectL,
const wxRect &rectR);
105 void DoDrawPlayRegionLimits(wxDC * dc,
const wxRect &rect);
106 void DoDrawOverlap(wxDC * dc,
const wxRect &rect);
107 void DoDrawSelection(wxDC * dc,
108 const wxRect &rectS,
const wxRect &rectL,
const wxRect &rectR);
111 void DoDrawScrubIndicator(wxDC * dc, wxCoord xx,
int width,
bool scrub,
bool seek);
112 void UpdateButtonStates();
116 struct Resetter {
void operator () (
bool *p)
const {
if(p) *p =
false; } };
122 void SetNumGuides(
size_t nn);
126 void ShowContextMenu( MenuChoice choice,
const wxPoint *pPosition);
128 double Pos2Time(
int p,
bool ignoreFisheye =
false)
const;
129 int Time2Pos(
double t,
bool ignoreFisheye =
false)
const;
131 bool IsWithinMarker(
int mousePosX,
double markerTime);
148 static constexpr size_t MAX_GUIDES = 2;
149 double mQuickPlayOffset[MAX_GUIDES]{};
150 double mQuickPlayPosUnsnapped[MAX_GUIDES]{};
151 double mQuickPlayPos[MAX_GUIDES]{};
152 bool mIsSnapped[MAX_GUIDES]{};
153 size_t mNumGuides{ 1 };
162 void ShowMenu(
const wxPoint & pos);
163 void ShowScrubMenu(
const wxPoint & pos);
165 void HandleSnapping(
size_t index);
166 void OnSyncSelToQuickPlay(wxCommandEvent &evt);
168 void OnAutoScroll(wxCommandEvent &evt);
173 void OnPinnedButton(wxCommandEvent & event);
174 void OnTogglePinnedState(wxCommandEvent & event);
184 mesSelectingPlayRegionRange
192 DECLARE_EVENT_TABLE()
194 wxWindow *mButtons[3];
195 bool mNeedButtonUpdate {
true };
203 std::shared_ptr<TrackPanelNode>
Root()
override;
211 unsigned refreshResult)
override;
215 void CreateOverlays();
218 class TrackPanelGuidelineOverlay;
219 std::shared_ptr<TrackPanelGuidelineOverlay>
mOverlay;
249 std::pair<double, double> mLastDrawnPlayRegion{};
250 bool mLastPlayRegionActive =
false;
251 double mLastDrawnH{};
252 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)
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 void UpdateStatusMessage(const TranslatableString &)=0
virtual void SetFocusedCell()=0
virtual TrackPanelCell * GetFocusedCell()=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.
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.