Audacity 3.2.0
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
AdornedRulerPanel Class Referencefinal

This is an Audacity Specific ruler panel which additionally has border, selection markers, play marker. More...

#include <AdornedRulerPanel.h>

Inheritance diagram for AdornedRulerPanel:
[legend]
Collaboration diagram for AdornedRulerPanel:
[legend]

Classes

class  CommonCell
 
class  CommonRulerHandle
 
struct  MainGroup
 
class  MovePlayRegionHandle
 
class  NewPlayRegionHandle
 
class  PlayRegionAdjustingHandle
 
class  QPCell
 
struct  Resetter
 
class  ResizePlayRegionHandle
 
class  ScrubbingCell
 
class  ScrubbingHandle
 
class  ScrubbingRulerOverlay
 
struct  Subgroup
 
class  TrackPanelGuidelineOverlay
 

Public Member Functions

 AdornedRulerPanel (AudacityProject *project, wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, ViewInfo *viewinfo=NULL)
 
 ~AdornedRulerPanel ()
 
void Refresh (bool eraseBackground=true, const wxRect *rect=(const wxRect *) NULL) override
 
bool AcceptsFocus () const override
 
bool AcceptsFocusFromKeyboard () const override
 
void SetFocusFromKbd () override
 
int GetRulerHeight ()
 
wxRect GetInnerRect () const
 
void SetLeftOffset (int offset)
 
void DrawSelection ()
 
void SetPlayRegion (double playRegionStart, double playRegionEnd)
 
void ClearPlayRegion ()
 
void TogglePinnedHead ()
 
void GetMaxSize (wxCoord *width, wxCoord *height)
 
void InvalidateRuler ()
 
void UpdatePrefs () override
 
void ReCreateButtons ()
 
void UpdateQuickPlayPos (wxCoord &mousePosX)
 
bool ShowingScrubRuler () const
 
bool SetPanelSize ()
 
void DrawBothOverlays ()
 
void DoDrawScrubIndicator (wxDC *dc, wxCoord xx, int width, bool scrub, bool seek)
 
void UpdateButtonStates ()
 
void SetNumGuides (size_t nn)
 
AudacityProjectGetProject () const override
 
TimeDisplayMode GetTimeDisplayMode () const
 
void SetTimeDisplayMode (TimeDisplayMode rulerType)
 
- Public Member Functions inherited from CellularPanel
 CellularPanel (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, ViewInfo *viewInfo, long style=wxTAB_TRAVERSAL|wxNO_BORDER)
 
 ~CellularPanel () override
 
virtual AudacityProjectGetProject () const =0
 
virtual std::shared_ptr< TrackPanelNodeRoot ()=0
 
virtual std::shared_ptr< TrackPanelCellGetFocusedCell ()=0
 
virtual void SetFocusedCell ()=0
 
virtual void ProcessUIHandleResult (TrackPanelCell *pClickedCell, TrackPanelCell *pLatestCell, unsigned refreshResult)=0
 
virtual void UpdateStatusMessage (const TranslatableString &)=0
 
void Visit (Visitor &visitor)
 
void VisitCells (const SimpleCellVisitor &visitor)
 
void VisitPreorder (const SimpleNodeVisitor &visitor)
 
void VisitPostorder (const SimpleNodeVisitor &visitor)
 
FoundCell FindCell (int mouseX, int mouseY)
 
wxRect FindRect (const TrackPanelCell &cell)
 
wxRect FindRect (const std::function< bool(TrackPanelNode &) > &pred)
 
UIHandlePtr Target ()
 
std::shared_ptr< TrackPanelCellLastCell () const
 
bool IsMouseCaptured ()
 Determines if a modal tool is active. More...
 
wxCoord MostRecentXCoord () const
 
void HandleCursorForPresentMouseState (bool doHit=true)
 
void Draw (TrackPanelDrawingContext &context, unsigned nPasses)
 
- Public Member Functions inherited from OverlayPanel
 OverlayPanel (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style=wxTAB_TRAVERSAL|wxNO_BORDER)
 
void AddOverlay (const std::weak_ptr< Overlay > &pOverlay)
 
void ClearOverlays ()
 
void DrawOverlays (bool repaint_all, wxDC *pDC=nullptr)
 
- Public Member Functions inherited from BackedPanel
 BackedPanel (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style)
 
 ~BackedPanel ()
 
wxDC & GetBackingDC ()
 
wxDC & GetBackingDCForRepaint ()
 
void ResizeBacking ()
 
void RepairBitmap (wxDC &dc, wxCoord x, wxCoord y, wxCoord width, wxCoord height)
 
void DisplayBitmap (wxDC &dc)
 
void OnSize (wxSizeEvent &event)
 
- Public Member Functions inherited from wxPanelWrapper
 wxPanelWrapper ()
 
 wxPanelWrapper (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
bool Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
void SetLabel (const TranslatableString &label)
 
void SetName (const TranslatableString &name)
 
void SetToolTip (const TranslatableString &toolTip)
 
void SetName ()
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxPanel >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Static Public Member Functions

static AdornedRulerPanelGet (AudacityProject &project)
 
static const AdornedRulerPanelGet (const AudacityProject &project)
 
static void Destroy (AudacityProject &project)
 
static int GetRulerHeight (bool showScrubBar)
 
static TempAllowFocus TemporarilyAllowFocus ()
 

Private Types

enum class  MenuChoice { QuickPlay , Scrub }
 
enum  MouseEventState {
  mesNone , mesDraggingPlayRegionStart , mesDraggingPlayRegionEnd , mesSelectingPlayRegionClick ,
  mesSelectingPlayRegionRange
}
 
using TempAllowFocus = std::unique_ptr< bool, Resetter >
 

Private Member Functions

void DoIdle ()
 
void OnIdle (wxIdleEvent &evt)
 
void OnAudioStartStop (AudioIOEvent)
 
void OnPaint (wxPaintEvent &evt)
 
void OnSize (wxSizeEvent &evt)
 
void OnLeave (wxMouseEvent &evt)
 
void OnThemeChange (struct ThemeChangeMessage)
 
void OnSelectionChange (Observer::Message)
 
void DoSelectionChange (const SelectedRegion &selectedRegion)
 
bool UpdateRects ()
 
void HandleQPClick (wxMouseEvent &event, wxCoord mousePosX)
 
void HandleQPDrag (wxMouseEvent &event, wxCoord mousePosX)
 
void HandleQPRelease (wxMouseEvent &event)
 
void StartQPPlay (bool newDefault, bool cutPreview, const double *pStartTime=nullptr)
 
void DoDrawBackground (wxDC *dc)
 
void DoDrawEdge (wxDC *dc)
 
void DoDrawMarks (wxDC *dc, bool)
 
wxRect RegionRectangle (double t0, double t1) const
 
wxRect PlayRegionRectangle () const
 
wxRect SelectedRegionRectangle () const
 
void DoDrawPlayRegion (wxDC *dc, const wxRect &rectP, const wxRect &rectL, const wxRect &rectR)
 
void DoDrawPlayRegionLimits (wxDC *dc, const wxRect &rect)
 
void DoDrawOverlap (wxDC *dc, const wxRect &rect)
 
void DoDrawSelection (wxDC *dc, const wxRect &rectS, const wxRect &rectL, const wxRect &rectR)
 
void ShowContextMenu (MenuChoice choice, const wxPoint *pPosition)
 
double Pos2Time (int p, bool ignoreFisheye=false) const
 
int Time2Pos (double t, bool ignoreFisheye=false) const
 
bool IsWithinMarker (int mousePosX, double markerTime)
 
void ShowMenu (const wxPoint &pos)
 
void ShowScrubMenu (const wxPoint &pos)
 
void HandleSnapping (size_t index)
 
void OnTimelineFormatChange (wxCommandEvent &evt)
 
void OnSyncSelToQuickPlay (wxCommandEvent &evt)
 
void OnAutoScroll (wxCommandEvent &evt)
 
void OnTogglePlayRegion (wxCommandEvent &evt)
 
void OnClearPlayRegion (wxCommandEvent &evt)
 
void OnSetPlayRegionToSelection (wxCommandEvent &evt)
 
void OnPinnedButton (wxCommandEvent &event)
 
void OnTogglePinnedState (wxCommandEvent &event)
 
std::shared_ptr< TrackPanelNodeRoot () override
 
std::shared_ptr< TrackPanelCellGetFocusedCell () override
 
void SetFocusedCell () override
 
void ProcessUIHandleResult (TrackPanelCell *pClickedTrack, TrackPanelCell *pLatestCell, unsigned refreshResult) override
 
void UpdateStatusMessage (const TranslatableString &) override
 
void CreateOverlays ()
 
- Private Member Functions inherited from PrefsListener
 PrefsListener ()
 
virtual ~PrefsListener ()
 
virtual void UpdatePrefs ()=0
 
virtual void UpdateSelectedPrefs (int id)
 

Static Private Member Functions

static void DragSelection (AudacityProject &project)
 
- Static Private Member Functions inherited from PrefsListener
static void Broadcast (int id=0)
 Call this static function to notify all PrefsListener objects. More...
 

Private Attributes

AudacityProject *const mProject
 
LinearUpdatermUpdater
 
RulermRuler
 
TrackListmTracks
 
wxRect mOuter
 
wxRect mScrubZone
 
wxRect mInner
 
int mLeftOffset
 
double mIndTime
 
double mQuickPlayOffset [MAX_GUIDES] {}
 
double mQuickPlayPosUnsnapped [MAX_GUIDES] {}
 
double mQuickPlayPos [MAX_GUIDES] {}
 
bool mIsSnapped [MAX_GUIDES] {}
 
size_t mNumGuides { 1 }
 
PlayRegion mOldPlayRegion
 
bool mIsRecording
 
bool mPlayRegionDragsSelection
 
MouseEventState mMouseEventState
 
double mLeftDownClickUnsnapped
 
double mLeftDownClick
 
bool mIsDragging
 
wxWindow * mButtons [3]
 
bool mNeedButtonUpdate { true }
 
std::shared_ptr< TrackPanelGuidelineOverlaymOverlay
 
std::shared_ptr< QPCellmQPCell
 
std::shared_ptr< ScrubbingCellmScrubbingCell
 
Observer::Subscription mAudioIOSubscription
 
Observer::Subscription mPlayRegionSubscription
 
Observer::Subscription mThemeChangeSubscription
 
Observer::Subscription mRulerInvalidatedSubscription
 
SelectedRegion mLastDrawnSelectedRegion
 
std::pair< double, double > mLastDrawnPlayRegion {}
 
bool mLastPlayRegionActive = false
 
double mLastDrawnH {}
 
double mLastDrawnZoom {}
 
TimeDisplayMode mTimeDisplayMode
 

Static Private Attributes

static bool s_AcceptsFocus { false }
 
static constexpr size_t MAX_GUIDES = 2
 

Additional Inherited Members

- Public Types inherited from CellularPanel
using SimpleCellVisitor = std::function< void(const wxRect &rect, TrackPanelCell &cell) >
 
using SimpleNodeVisitor = std::function< void(const wxRect &rect, TrackPanelNode &node) >
 
- Protected Member Functions inherited from CellularPanel
bool HasEscape ()
 
bool CancelDragging (bool escaping)
 
void DoContextMenu (std::shared_ptr< TrackPanelCell > pCell)
 
void ClearTargets ()
 
- Protected Attributes inherited from CellularPanel
ViewInfomViewInfo
 
wxMouseState mLastMouseState
 

Detailed Description

This is an Audacity Specific ruler panel which additionally has border, selection markers, play marker.

Once TrackPanel uses wxSizers, we will derive it from some wxWindow and the GetSize and SetSize functions will then be wxWidgets functions instead.

Definition at line 29 of file AdornedRulerPanel.h.

Member Typedef Documentation

◆ TempAllowFocus

using AdornedRulerPanel::TempAllowFocus = std::unique_ptr<bool, Resetter>
private

Definition at line 121 of file AdornedRulerPanel.h.

Member Enumeration Documentation

◆ MenuChoice

enum class AdornedRulerPanel::MenuChoice
strongprivate
Enumerator
QuickPlay 
Scrub 

Definition at line 129 of file AdornedRulerPanel.h.

129{ QuickPlay, Scrub };

◆ MouseEventState

Enumerator
mesNone 
mesDraggingPlayRegionStart 
mesDraggingPlayRegionEnd 
mesSelectingPlayRegionClick 
mesSelectingPlayRegionRange 

Definition at line 184 of file AdornedRulerPanel.h.

Constructor & Destructor Documentation

◆ AdornedRulerPanel()

AdornedRulerPanel::AdornedRulerPanel ( AudacityProject project,
wxWindow *  parent,
wxWindowID  id,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
ViewInfo viewinfo = NULL 
)

Definition at line 1285 of file AdornedRulerPanel.cpp.

1291 : CellularPanel(parent, id, pos, size, viewinfo)
1292 , mProject { project }
1293 , mUpdater { ProjectTimeRuler::Get(*project).GetUpdater() }
1294 , mRuler { ProjectTimeRuler::Get(*project).GetRuler() }
1295{
1296 SetLayoutDirection(wxLayout_LeftToRight);
1297
1298 mQPCell = std::make_shared<QPCell>( this );
1299 mScrubbingCell = std::make_shared<ScrubbingCell>( this );
1300
1301 for (auto &button : mButtons)
1302 button = nullptr;
1303
1304 SetLabel( XO("Timeline") );
1305 SetName();
1306 SetBackgroundStyle(wxBG_STYLE_PAINT);
1307
1308 mLeftOffset = 0;
1309 mIndTime = -1;
1310
1311 mLeftDownClick = -1;
1313 mIsDragging = false;
1314
1315 mOuter = GetClientRect();
1316
1318
1320
1321 mRuler.SetLabelEdges( false );
1322
1324
1325 mIsRecording = false;
1326
1327 mPlayRegionDragsSelection = (gPrefs->Read(wxT("/QuickPlay/DragSelection"), 0L) == 1)? true : false;
1328
1329#if wxUSE_TOOLTIPS
1330 wxToolTip::Enable(true);
1331#endif
1332
1335
1336 // Delay until after CommandManager has been populated:
1338
1341
1342 // Bind event that updates the play region
1345
1347 mRuler.Subscribe([this](auto) { Refresh(); });
1348
1349 // And call it once to initialize it
1351}
wxT("CloseDown"))
XO("Cut/Copy/Paste")
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
const auto project
THEME_API Theme theTheme
Definition: Theme.cpp:82
TimeDisplayModeSetting TimeDisplayModePreference
void OnSelectionChange(Observer::Message)
void UpdatePrefs() override
void OnAudioStartStop(AudioIOEvent)
std::shared_ptr< ScrubbingCell > mScrubbingCell
Observer::Subscription mAudioIOSubscription
LinearUpdater & mUpdater
void DoSelectionChange(const SelectedRegion &selectedRegion)
wxWindow * mButtons[3]
AudacityProject *const mProject
void Refresh(bool eraseBackground=true, const wxRect *rect=(const wxRect *) NULL) override
Observer::Subscription mPlayRegionSubscription
Observer::Subscription mRulerInvalidatedSubscription
TimeDisplayMode mTimeDisplayMode
Observer::Subscription mThemeChangeSubscription
MouseEventState mMouseEventState
std::shared_ptr< QPCell > mQPCell
void OnThemeChange(struct ThemeChangeMessage)
static AudioIO * Get()
Definition: AudioIO.cpp:126
ViewInfo * mViewInfo
CellularPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, ViewInfo *viewInfo, long style=wxTAB_TRAVERSAL|wxNO_BORDER)
Enum ReadEnum() const
Definition: Prefs.h:534
void SetData(const ZoomInfo *pZoomInfo=nullptr, int leftOffset=0)
Definition: LinearUpdater.h:33
Subscription Subscribe(Callback callback)
Connect a callback to the Publisher; later-connected are called earlier.
Definition: Observer.h:199
LinearUpdater & GetUpdater()
static ProjectTimeRuler & Get(AudacityProject &project)
void SetLabelEdges(bool labelEdges)
Definition: Ruler.cpp:179
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:314
NotifyingSelectedRegion selectedRegion
Definition: ViewInfo.h:215
virtual bool Read(const wxString &key, bool *value) const =0
void SetLabel(const TranslatableString &label)
void CallAfter(Action action)
Schedule an action to be done later, and in the main thread.
Definition: BasicUI.cpp:208

References BasicUI::CallAfter(), DoSelectionChange(), AudioIO::Get(), TrackList::Get(), gPrefs, mAudioIOSubscription, mButtons, mesNone, mIndTime, mIsDragging, mIsRecording, mLeftDownClick, mLeftOffset, mMouseEventState, mOuter, mPlayRegionDragsSelection, mPlayRegionSubscription, mQPCell, mRuler, mRulerInvalidatedSubscription, mScrubbingCell, mThemeChangeSubscription, mTimeDisplayMode, mTracks, mUpdater, CellularPanel::mViewInfo, OnAudioStartStop(), OnSelectionChange(), OnThemeChange(), project, audacity::BasicSettings::Read(), EnumSetting< Enum >::ReadEnum(), Refresh(), ViewInfo::selectedRegion, LinearUpdater::SetData(), wxPanelWrapper::SetLabel(), Ruler::SetLabelEdges(), wxPanelWrapper::SetName(), Observer::Publisher< Message, NotifyAll >::Subscribe(), theTheme, TimeDisplayModePreference, UpdatePrefs(), wxT(), and XO().

Here is the call graph for this function:

◆ ~AdornedRulerPanel()

AdornedRulerPanel::~AdornedRulerPanel ( )

Definition at line 1353 of file AdornedRulerPanel.cpp.

1354{
1355}

Member Function Documentation

◆ AcceptsFocus()

bool AdornedRulerPanel::AcceptsFocus ( ) const
inlineoverride

Definition at line 51 of file AdornedRulerPanel.h.

51{ return s_AcceptsFocus; }
static bool s_AcceptsFocus

◆ AcceptsFocusFromKeyboard()

bool AdornedRulerPanel::AcceptsFocusFromKeyboard ( ) const
inlineoverride

Definition at line 52 of file AdornedRulerPanel.h.

52{ return true; }

◆ ClearPlayRegion()

void AdornedRulerPanel::ClearPlayRegion ( )

Definition at line 2685 of file AdornedRulerPanel.cpp.

2686{
2687 ProjectAudioManager::Get( *mProject ).Stop();
2688
2689 auto &viewInfo = ViewInfo::Get( *GetProject() );
2690 auto &playRegion = viewInfo.playRegion;
2691 playRegion.Clear();
2692
2693 Refresh();
2694}
AudacityProject * GetProject() const override
void Stop(bool stopStream=true)
static ProjectAudioManager & Get(AudacityProject &project)
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:235

References ViewInfo::Get(), ProjectAudioManager::Get(), GetProject(), Refresh(), and ProjectAudioManager::Stop().

Here is the call graph for this function:

◆ CreateOverlays()

void AdornedRulerPanel::CreateOverlays ( )
private

Definition at line 2802 of file AdornedRulerPanel.cpp.

2803{
2804 if (!mOverlay) {
2805 mOverlay =
2806 std::make_shared<TrackPanelGuidelineOverlay>( mProject );
2807 auto pCellularPanel =
2808 dynamic_cast<CellularPanel*>( &GetProjectPanel( *GetProject() ) );
2809 if ( !pCellularPanel ) {
2810 wxASSERT( false );
2811 }
2812 else
2813 pCellularPanel->AddOverlay( mOverlay );
2814 this->AddOverlay( mOverlay->mPartner );
2815 }
2816}
AUDACITY_DLL_API wxWindow & GetProjectPanel(AudacityProject &project)
Get the main sub-window of the project frame that displays track data.
std::shared_ptr< TrackPanelGuidelineOverlay > mOverlay
Formerly part of TrackPanel, this abstract base class has no special knowledge of Track objects and i...
Definition: CellularPanel.h:34
void AddOverlay(const std::weak_ptr< Overlay > &pOverlay)

References OverlayPanel::AddOverlay(), GetProject(), GetProjectPanel(), mOverlay, and mProject.

Here is the call graph for this function:

◆ Destroy()

void AdornedRulerPanel::Destroy ( AudacityProject project)
static

Definition at line 1276 of file AdornedRulerPanel.cpp.

1277{
1278 auto *pPanel = GetAttachedWindows(project).Find( sKey );
1279 if (pPanel) {
1280 pPanel->wxWindow::Destroy();
1282 }
1283}
AUDACITY_DLL_API AttachedWindows & GetAttachedWindows(AudacityProject &project)
Subclass * Find(const RegisteredFactory &key)
Get a (bare) pointer to an attachment, or null, down-cast it to Subclass *; will not create on demand...
Definition: ClientData.h:342
void Assign(const RegisteredFactory &key, ReplacementPointer &&replacement)
Reassign Site's pointer to ClientData.
Definition: ClientData.h:364
AttachedWindows::RegisteredFactory sKey

References ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Assign(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Find(), GetAttachedWindows(), project, and anonymous_namespace{AdornedRulerPanel.cpp}::sKey.

Referenced by ProjectManager::OnCloseWindow().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DoDrawBackground()

void AdornedRulerPanel::DoDrawBackground ( wxDC *  dc)
private

Definition at line 2429 of file AdornedRulerPanel.cpp.

2430{
2431 // Draw AdornedRulerPanel border
2433 dc->DrawRectangle( mInner );
2434
2435 if (ShowingScrubRuler()) {
2436 // Let's distinguish the scrubbing area by using a themable
2437 // colour and a line to set it off.
2438 AColor::UseThemeColour(dc, clrScrubRuler, TimelineTextColor() );
2439 wxRect ScrubRect = mScrubZone;
2440 ScrubRect.Inflate( 1,0 );
2441 dc->DrawRectangle(ScrubRect);
2442 }
2443}
ColorId TimelineBackgroundColor()
ColorId TimelineTextColor()
static void UseThemeColour(wxDC *dc, int iBrush, int iPen=-1, int alpha=255)
Definition: AColor.cpp:368
bool ShowingScrubRuler() const

References mInner, mScrubZone, ShowingScrubRuler(), TimelineBackgroundColor(), TimelineTextColor(), and AColor::UseThemeColour().

Referenced by OnPaint().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DoDrawEdge()

void AdornedRulerPanel::DoDrawEdge ( wxDC *  dc)
private

Definition at line 2445 of file AdornedRulerPanel.cpp.

2446{
2447 wxRect r = mOuter;
2448 r.width -= RightMargin;
2449 r.height -= BottomMargin;
2450 AColor::BevelTrackInfo( *dc, true, r );
2451
2452 // Black stroke at bottom
2453 dc->SetPen( *wxBLACK_PEN );
2454 AColor::Line( *dc, mOuter.x,
2455 mOuter.y + mOuter.height - 1,
2456 mOuter.x + mOuter.width - 1 ,
2457 mOuter.y + mOuter.height - 1 );
2458}
@ RightMargin
@ BottomMargin
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
Definition: AColor.cpp:187
static void BevelTrackInfo(wxDC &dc, bool up, const wxRect &r, bool highlight=false)
Definition: AColor.cpp:340

References AColor::BevelTrackInfo(), BottomMargin, AColor::Line(), mOuter, and RightMargin.

Referenced by OnPaint().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DoDrawMarks()

void AdornedRulerPanel::DoDrawMarks ( wxDC *  dc,
bool   
)
private

Definition at line 2460 of file AdornedRulerPanel.cpp.

2461{
2462 const double min = Pos2Time(0);
2463 const double hiddenMin = Pos2Time(0, true);
2464 const double max = Pos2Time(mInner.width);
2465 const double hiddenMax = Pos2Time(mInner.width, true);
2466
2468 mRuler.SetRange( min, max, hiddenMin, hiddenMax );
2470 {
2471 mRuler.SetTickLengths({ 5, 3, 1 });
2472 }
2474 {
2475 mRuler.SetTickLengths({ 4, 2, 2 });
2476 }
2477 mRuler.Draw( *dc );
2478}
int min(int a, int b)
double Pos2Time(int p, bool ignoreFisheye=false) const
void SetTickColour(const wxColour &colour)
Definition: Ruler.h:135
void Draw(wxDC &dc) const
Definition: Ruler.cpp:441
void SetTickLengths(const TickLengths &tLengths)
Definition: Ruler.cpp:255
void SetRange(double min, double max)
Definition: Ruler.cpp:152
wxColour & Colour(int iIndex)

References BeatsAndMeasures, ThemeBase::Colour(), Ruler::Draw(), min(), mInner, MinutesAndSeconds, mRuler, mTimeDisplayMode, Pos2Time(), Ruler::SetRange(), Ruler::SetTickColour(), Ruler::SetTickLengths(), theTheme, and TimelineTextColor().

Referenced by OnPaint().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DoDrawOverlap()

void AdornedRulerPanel::DoDrawOverlap ( wxDC *  dc,
const wxRect &  rect 
)
private

Definition at line 2576 of file AdornedRulerPanel.cpp.

2577{
2578 dc->SetBrush( wxBrush{ AlphaBlend(
2580 SelectionOpacity) } );
2581 dc->SetPen( *wxTRANSPARENT_PEN );
2582 dc->DrawRectangle( rect );
2583}
ColorId TimelineLimitsColor()
ColorId TimelineLoopRegionColor(bool isActive)
static wxColour AlphaBlend(ColorId fg, ColorId bg, double alpha)
constexpr double SelectionOpacity

References AlphaBlend(), mLastPlayRegionActive, SelectionOpacity, TimelineLimitsColor(), and TimelineLoopRegionColor().

Referenced by OnPaint().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DoDrawPlayRegion()

void AdornedRulerPanel::DoDrawPlayRegion ( wxDC *  dc,
const wxRect &  rectP,
const wxRect &  rectL,
const wxRect &  rectR 
)
private

Definition at line 2517 of file AdornedRulerPanel.cpp.

2519{
2520 const auto &viewInfo = ViewInfo::Get(*mProject);
2521 const auto& playRegion = viewInfo.playRegion;
2522
2523 const bool isActive = (mLastPlayRegionActive = playRegion.Active());
2524
2525 if (playRegion.IsLastActiveRegionClear())
2526 return;
2527
2528 // Paint the selected region bolder if independently varying, else dim
2529 const auto color = TimelineLoopRegionColor(isActive);
2530 dc->SetBrush( wxBrush( theTheme.Colour( color )) );
2531 dc->SetPen( wxPen( theTheme.Colour( color )) );
2532
2533 dc->DrawRectangle( rectP.Intersect(rectL) );
2534 dc->DrawRectangle( rectP.Intersect(rectR) );
2535}

References ThemeBase::Colour(), ViewInfo::Get(), mLastPlayRegionActive, mProject, theTheme, and TimelineLoopRegionColor().

Referenced by OnPaint().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DoDrawPlayRegionLimits()

void AdornedRulerPanel::DoDrawPlayRegionLimits ( wxDC *  dc,
const wxRect &  rect 
)
private

Definition at line 2537 of file AdornedRulerPanel.cpp.

2538{
2539 // Color the edges of the play region like the ticks and numbers
2540 ADCChanger cleanup( dc );
2541 const auto edgeColour = theTheme.Colour(TimelineLimitsColor());
2542 dc->SetPen( { edgeColour } );
2543 dc->SetBrush( { edgeColour } );
2544
2545 constexpr int side = 7;
2546 constexpr int sideLessOne = side - 1;
2547
2548 // Paint two shapes, each a line plus triangle at bottom
2549 const auto left = rect.GetLeft(),
2550 right = rect.GetRight(),
2551 bottom = rect.GetBottom(),
2552 top = rect.GetTop();
2553 {
2554 wxPoint points[]{
2555 {left, bottom - sideLessOne},
2556 {left - sideLessOne, bottom},
2557 {left, bottom},
2558 {left, top},
2559 };
2560 dc->DrawPolygon( 4, points );
2561 }
2562
2563 {
2564 wxPoint points[]{
2565 {right, top},
2566 {right, bottom},
2567 {right + sideLessOne, bottom},
2568 {right, bottom - sideLessOne},
2569 };
2570 dc->DrawPolygon( 4, points );
2571 }
2572}
Makes temporary drawing context changes that you back out of, RAII style.
Definition: OverlayPanel.h:72

References ThemeBase::Colour(), theTheme, and TimelineLimitsColor().

Referenced by OnPaint().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DoDrawScrubIndicator()

void AdornedRulerPanel::DoDrawScrubIndicator ( wxDC *  dc,
wxCoord  xx,
int  width,
bool  scrub,
bool  seek 
)

Definition at line 2610 of file AdornedRulerPanel.cpp.

2612{
2613 ADCChanger changer(dc); // Undo pen and brush changes at function exit
2614
2615 wxPoint tri[ 3 ];
2616 if (seek) {
2617 auto height = IndicatorHeightForWidth(width);
2618 // Make four triangles
2619 const int TriangleWidth = width * 3 / 8;
2620
2621 // Double-double headed, left-right
2622 auto yy = ShowingScrubRuler()
2623 ? mScrubZone.y
2624 : (mInner.GetBottom() + 1) - 1 /* bevel */ - height;
2625 tri[ 0 ].x = xx - IndicatorOffset;
2626 tri[ 0 ].y = yy;
2627 tri[ 1 ].x = xx - IndicatorOffset;
2628 tri[ 1 ].y = yy + height;
2629 tri[ 2 ].x = xx - TriangleWidth;
2630 tri[ 2 ].y = yy + height / 2;
2631 dc->DrawPolygon( 3, tri );
2632
2633 tri[ 0 ].x -= TriangleWidth;
2634 tri[ 1 ].x -= TriangleWidth;
2635 tri[ 2 ].x -= TriangleWidth;
2636 dc->DrawPolygon( 3, tri );
2637
2638 tri[ 0 ].x = tri[ 1 ].x = xx + IndicatorOffset;
2639 tri[ 2 ].x = xx + TriangleWidth;
2640 dc->DrawPolygon( 3, tri );
2641
2642
2643 tri[ 0 ].x += TriangleWidth;
2644 tri[ 1 ].x += TriangleWidth;
2645 tri[ 2 ].x += TriangleWidth;
2646 dc->DrawPolygon( 3, tri );
2647 }
2648 else if (scrub) {
2649 auto height = IndicatorHeightForWidth(width);
2650 const int IndicatorHalfWidth = width / 2;
2651
2652 // Double headed, left-right
2653 auto yy = ShowingScrubRuler()
2654 ? mScrubZone.y
2655 : (mInner.GetBottom() + 1) - 1 /* bevel */ - height;
2656 tri[ 0 ].x = xx - IndicatorOffset;
2657 tri[ 0 ].y = yy;
2658 tri[ 1 ].x = xx - IndicatorOffset;
2659 tri[ 1 ].y = yy + height;
2660 tri[ 2 ].x = xx - IndicatorHalfWidth;
2661 tri[ 2 ].y = yy + height / 2;
2662 dc->DrawPolygon( 3, tri );
2663 tri[ 0 ].x = tri[ 1 ].x = xx + IndicatorOffset;
2664 tri[ 2 ].x = xx + IndicatorHalfWidth;
2665 dc->DrawPolygon( 3, tri );
2666 }
2667}
@ IndicatorOffset
int IndicatorHeightForWidth(int width)

References IndicatorHeightForWidth(), IndicatorOffset, mInner, mScrubZone, and ShowingScrubRuler().

Here is the call graph for this function:

◆ DoDrawSelection()

void AdornedRulerPanel::DoDrawSelection ( wxDC *  dc,
const wxRect &  rectS,
const wxRect &  rectL,
const wxRect &  rectR 
)
private

Definition at line 2585 of file AdornedRulerPanel.cpp.

2587{
2588 dc->SetBrush( wxBrush{ AlphaBlend(
2590 dc->SetPen( *wxTRANSPARENT_PEN );
2591 dc->DrawRectangle( rectS.Intersect(rectL) );
2592 dc->DrawRectangle( rectS.Intersect(rectR) );
2593}

References AlphaBlend(), SelectionOpacity, TimelineBackgroundColor(), and TimelineLimitsColor().

Referenced by OnPaint().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DoIdle()

void AdornedRulerPanel::DoIdle ( )
private

Definition at line 1505 of file AdornedRulerPanel.cpp.

1506{
1507 bool changed = UpdateRects();
1508 changed = SetPanelSize() || changed;
1509
1510 auto &project = *mProject;
1511 auto &viewInfo = ViewInfo::Get( project );
1512 const auto &selectedRegion = viewInfo.selectedRegion;
1513 const auto &playRegion = viewInfo.playRegion;
1514
1515 changed = changed
1516 || mLastDrawnSelectedRegion != selectedRegion
1517 || mLastDrawnPlayRegion != std::pair{
1518 playRegion.GetLastActiveStart(), playRegion.GetLastActiveEnd() }
1519 || mLastDrawnH != viewInfo.hpos
1520 || mLastDrawnZoom != viewInfo.GetZoom()
1521 || mLastPlayRegionActive != viewInfo.playRegion.Active()
1522 ;
1523 if (changed)
1524 // Cause ruler redraw anyway, because we may be zooming or scrolling,
1525 // showing or hiding the scrub bar, etc.
1526 Refresh();
1527}
std::pair< double, double > mLastDrawnPlayRegion
SelectedRegion mLastDrawnSelectedRegion

References ViewInfo::Get(), mLastDrawnH, mLastDrawnPlayRegion, mLastDrawnSelectedRegion, mLastDrawnZoom, mLastPlayRegionActive, mProject, project, Refresh(), SetPanelSize(), and UpdateRects().

Referenced by OnIdle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DoSelectionChange()

void AdornedRulerPanel::DoSelectionChange ( const SelectedRegion selectedRegion)
private

Definition at line 1640 of file AdornedRulerPanel.cpp.

1642{
1643
1644 auto gAudioIO = AudioIOBase::Get();
1645 if ( !ViewInfo::Get( *mProject ).playRegion.Active() ) {
1646 // "Inactivated" play region follows the selection.
1647 SetPlayRegion( selectedRegion.t0(), selectedRegion.t1() );
1648 }
1649}
void SetPlayRegion(double playRegionStart, double playRegionEnd)
static AudioIOBase * Get()
Definition: AudioIOBase.cpp:94
bool Active() const
Definition: ViewInfo.h:124
double t1() const
double t0() const
PlayRegion playRegion
Definition: ViewInfo.h:216

References PlayRegion::Active(), AudioIOBase::Get(), ViewInfo::Get(), ViewInfo::playRegion, SetPlayRegion(), SelectedRegion::t0(), and SelectedRegion::t1().

Referenced by AdornedRulerPanel(), OnAudioStartStop(), and OnSelectionChange().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DragSelection()

void AdornedRulerPanel::DragSelection ( AudacityProject project)
staticprivate

Definition at line 2290 of file AdornedRulerPanel.cpp.

2291{
2292 auto &viewInfo = ViewInfo::Get( project );
2293 const auto &playRegion = viewInfo.playRegion;
2294 auto &selectedRegion = viewInfo.selectedRegion;
2295 selectedRegion.setT0(playRegion.GetStart(), false);
2296 selectedRegion.setT1(playRegion.GetEnd(), true);
2297}

References ViewInfo::Get(), and project.

Referenced by AdornedRulerPanel::PlayRegionAdjustingHandle::Drag().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DrawBothOverlays()

void AdornedRulerPanel::DrawBothOverlays ( )

Definition at line 2155 of file AdornedRulerPanel.cpp.

2156{
2157 auto pCellularPanel =
2158 dynamic_cast<CellularPanel*>( &GetProjectPanel( *GetProject() ) );
2159 if ( !pCellularPanel ) {
2160 wxASSERT( false );
2161 }
2162 else
2163 pCellularPanel->DrawOverlays( false );
2164 DrawOverlays( false );
2165}
void DrawOverlays(bool repaint_all, wxDC *pDC=nullptr)

References OverlayPanel::DrawOverlays(), GetProject(), and GetProjectPanel().

Referenced by OnLeave(), and ProcessUIHandleResult().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DrawSelection()

void AdornedRulerPanel::DrawSelection ( )

Definition at line 2480 of file AdornedRulerPanel.cpp.

2481{
2482 Refresh();
2483}

References Refresh().

Referenced by TrackPanel::UpdateSelectionDisplay().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Get() [1/2]

AdornedRulerPanel & AdornedRulerPanel::Get ( AudacityProject project)
static

Definition at line 1265 of file AdornedRulerPanel.cpp.

1266{
1268}
This is an Audacity Specific ruler panel which additionally has border, selection markers,...
Subclass & Get(const RegisteredFactory &key)
Get reference to an attachment, creating on demand if not present, down-cast it to Subclass.
Definition: ClientData.h:318

References ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), GetAttachedWindows(), project, and anonymous_namespace{AdornedRulerPanel.cpp}::sKey.

Referenced by AdornedRulerPanel::PlayRegionAdjustingHandle::Drag(), AdornedRulerPanel::TrackPanelGuidelineOverlay::Draw(), EditCursorOverlay::Draw(), PlayIndicatorOverlayBase::Draw(), Get(), anonymous_namespace{PlayIndicatorOverlay.cpp}::GetIndicatorBitmap(), AdornedRulerPanel::ScrubbingRulerOverlay::GetRuler(), anonymous_namespace{TimelineMenus.cpp}::GetTimeDisplayMode(), AdornedRulerPanel::PlayRegionAdjustingHandle::HasEscape(), InitProjectWindow(), anonymous_namespace{SelectMenus.cpp}::MoveWhenAudioInactive(), anonymous_namespace{EditMenus.cpp}::OnCut(), PlayIndicatorOverlay::OnTimer(), ScrubbingOverlay::OnTimer(), anonymous_namespace{AdornedRulerPanel.cpp}::OnTogglePinnedHead(), AudacityMirProject::ReconfigureMusicGrid(), ScrubForwarder::ScrubForwarder(), anonymous_namespace{TimelineMenus.cpp}::SetTimeDisplayMode(), AdornedRulerPanel::PlayRegionAdjustingHandle::SnappedTime(), AdornedRulerPanel::PlayRegionAdjustingHandle::SnappedTimes(), AdornedRulerPanel::CommonRulerHandle::StartPlay(), AdornedRulerPanel::PlayRegionAdjustingHandle::Unsnap(), AdornedRulerPanel::TrackPanelGuidelineOverlay::Update(), and AudacityMirProject::ViewIsBeatsAndMeasures().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Get() [2/2]

const AdornedRulerPanel & AdornedRulerPanel::Get ( const AudacityProject project)
static

Definition at line 1270 of file AdornedRulerPanel.cpp.

1272{
1273 return Get( const_cast< AudacityProject & >( project ) );
1274}
static AdornedRulerPanel & Get(AudacityProject &project)
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90

References Get(), and project.

Here is the call graph for this function:

◆ GetFocusedCell()

std::shared_ptr< TrackPanelCell > AdornedRulerPanel::GetFocusedCell ( )
overrideprivatevirtual

Implements CellularPanel.

Definition at line 2778 of file AdornedRulerPanel.cpp.

2779{
2780 // No switching of focus yet to the other, scrub zone
2781 return mQPCell;
2782}

References mQPCell.

◆ GetInnerRect()

wxRect AdornedRulerPanel::GetInnerRect ( ) const
inline

Definition at line 58 of file AdornedRulerPanel.h.

58{ return mInner; }

Referenced by anonymous_namespace{PlayIndicatorOverlay.cpp}::GetIndicatorBitmap().

Here is the caller graph for this function:

◆ GetMaxSize()

void AdornedRulerPanel::GetMaxSize ( wxCoord *  width,
wxCoord *  height 
)

Definition at line 2696 of file AdornedRulerPanel.cpp.

2697{
2698 mRuler.GetMaxSize(width, height);
2699}
void GetMaxSize(wxCoord *width, wxCoord *height)
Definition: Ruler.cpp:612

References Ruler::GetMaxSize(), and mRuler.

Here is the call graph for this function:

◆ GetProject()

AudacityProject * AdornedRulerPanel::GetProject ( ) const
overridevirtual

Implements CellularPanel.

Definition at line 2773 of file AdornedRulerPanel.cpp.

2774{
2775 return mProject;
2776}

References mProject.

Referenced by ClearPlayRegion(), CreateOverlays(), DrawBothOverlays(), HandleSnapping(), OnPaint(), SetPlayRegion(), ShowingScrubRuler(), ShowMenu(), and UpdateStatusMessage().

Here is the caller graph for this function:

◆ GetRulerHeight() [1/2]

int AdornedRulerPanel::GetRulerHeight ( )
inline

Definition at line 56 of file AdornedRulerPanel.h.

References GetRulerHeight().

Referenced by GetRulerHeight(), ReCreateButtons(), and SetPanelSize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetRulerHeight() [2/2]

int AdornedRulerPanel::GetRulerHeight ( bool  showScrubBar)
static

Definition at line 2595 of file AdornedRulerPanel.cpp.

2596{
2597 return ProperRulerHeight + (showScrubBar ? ScrubHeight : 0);
2598}
@ ProperRulerHeight
@ ScrubHeight

References ProperRulerHeight, and ScrubHeight.

◆ GetTimeDisplayMode()

TimeDisplayMode AdornedRulerPanel::GetTimeDisplayMode ( ) const

Definition at line 2833 of file AdornedRulerPanel.cpp.

2834{
2835 return mTimeDisplayMode;
2836}

References mTimeDisplayMode.

Referenced by AudacityMirProject::ViewIsBeatsAndMeasures().

Here is the caller graph for this function:

◆ HandleQPClick()

void AdornedRulerPanel::HandleQPClick ( wxMouseEvent &  event,
wxCoord  mousePosX 
)
private

◆ HandleQPDrag()

void AdornedRulerPanel::HandleQPDrag ( wxMouseEvent &  event,
wxCoord  mousePosX 
)
private

◆ HandleQPRelease()

void AdornedRulerPanel::HandleQPRelease ( wxMouseEvent &  event)
private

◆ HandleSnapping()

void AdornedRulerPanel::HandleSnapping ( size_t  index)
private

Definition at line 2299 of file AdornedRulerPanel.cpp.

2300{
2301 // Play region dragging can snap to selection boundaries
2302 const auto &selectedRegion = ViewInfo::Get(*GetProject()).selectedRegion;
2303 SnapPointArray candidates;
2305 candidates = {
2306 SnapPoint{ selectedRegion.t0() },
2307 SnapPoint{ selectedRegion.t1() },
2308 };
2309 SnapManager snapManager{ *mProject, *mTracks, *mViewInfo, move(candidates) };
2310 auto results = snapManager.Snap(nullptr, mQuickPlayPos[index], false);
2311 mQuickPlayPos[index] = results.outTime;
2312 mIsSnapped[index] = results.Snapped();
2313}
std::vector< SnapPoint > SnapPointArray
Definition: Snap.h:43
bool mIsSnapped[MAX_GUIDES]
double mQuickPlayPos[MAX_GUIDES]
Definition: Snap.h:31

References ViewInfo::Get(), GetProject(), mIsSnapped, mPlayRegionDragsSelection, mProject, mQuickPlayPos, mTracks, CellularPanel::mViewInfo, and ViewInfo::selectedRegion.

Referenced by UpdateQuickPlayPos().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InvalidateRuler()

void AdornedRulerPanel::InvalidateRuler ( )

Definition at line 1428 of file AdornedRulerPanel.cpp.

1429{
1431}
void Invalidate()
Definition: Ruler.cpp:317

References Ruler::Invalidate(), and mRuler.

Here is the call graph for this function:

◆ IsWithinMarker()

bool AdornedRulerPanel::IsWithinMarker ( int  mousePosX,
double  markerTime 
)
private

Definition at line 1718 of file AdornedRulerPanel.cpp.

1719{
1720 if (markerTime < 0)
1721 return false;
1722
1723 int pixelPos = Time2Pos(markerTime);
1724 int boundLeft = pixelPos - SELECT_TOLERANCE_PIXEL;
1725 int boundRight = pixelPos + SELECT_TOLERANCE_PIXEL;
1726
1727 return mousePosX >= boundLeft && mousePosX < boundRight;
1728}
#define SELECT_TOLERANCE_PIXEL
int Time2Pos(double t, bool ignoreFisheye=false) const

References SELECT_TOLERANCE_PIXEL, and Time2Pos().

Here is the call graph for this function:

◆ OnAudioStartStop()

void AdornedRulerPanel::OnAudioStartStop ( AudioIOEvent  evt)
private

Definition at line 1529 of file AdornedRulerPanel.cpp.

1530{
1531 if (evt.type == AudioIOEvent::MONITOR)
1532 return;
1533 if ( evt.type == AudioIOEvent::CAPTURE ) {
1534 if (evt.on)
1535 {
1536 mIsRecording = true;
1537 this->CellularPanel::CancelDragging( false );
1539
1541 }
1542 else {
1543 mIsRecording = false;
1545 }
1546 }
1547
1548 if ( !evt.on )
1549 // So that the play region is updated
1551}
bool CancelDragging(bool escaping)
bool on
Definition: AudioIO.h:66
enum AudioIOEvent::Type type

References CellularPanel::CancelDragging(), AudioIOEvent::CAPTURE, CellularPanel::ClearTargets(), DoSelectionChange(), mIsRecording, AudioIOEvent::MONITOR, CellularPanel::mViewInfo, AudioIOEvent::on, ViewInfo::selectedRegion, AudioIOEvent::type, and UpdateButtonStates().

Referenced by AdornedRulerPanel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnAutoScroll()

void AdornedRulerPanel::OnAutoScroll ( wxCommandEvent &  evt)
private

Definition at line 2336 of file AdornedRulerPanel.cpp.

2337{
2339 gPrefs->Write(wxT("/GUI/AutoScroll"), false);
2340 else
2341 gPrefs->Write(wxT("/GUI/AutoScroll"), true);
2342
2343 gPrefs->Flush();
2344
2346}
static void Broadcast(int id=0)
Call this static function to notify all PrefsListener objects.
Definition: Prefs.cpp:128
bool bUpdateTrackIndicator
Definition: ViewInfo.h:226
static int UpdateScrollPrefsID()
Definition: ViewInfo.cpp:304
virtual bool Flush() noexcept=0
virtual bool Write(const wxString &key, bool value)=0

References PrefsListener::Broadcast(), ViewInfo::bUpdateTrackIndicator, audacity::BasicSettings::Flush(), gPrefs, CellularPanel::mViewInfo, ViewInfo::UpdateScrollPrefsID(), audacity::BasicSettings::Write(), and wxT().

Here is the call graph for this function:

◆ OnClearPlayRegion()

void AdornedRulerPanel::OnClearPlayRegion ( wxCommandEvent &  evt)
private

Definition at line 2354 of file AdornedRulerPanel.cpp.

2355{
2357}
void ClearPlayRegion(AudacityProject &project)

References SelectUtilities::ClearPlayRegion(), and mProject.

Here is the call graph for this function:

◆ OnIdle()

void AdornedRulerPanel::OnIdle ( wxIdleEvent &  evt)
private

Definition at line 1499 of file AdornedRulerPanel.cpp.

1500{
1501 evt.Skip();
1502 DoIdle();
1503}

References DoIdle().

Here is the call graph for this function:

◆ OnLeave()

void AdornedRulerPanel::OnLeave ( wxMouseEvent &  evt)
private

Definition at line 1619 of file AdornedRulerPanel.cpp.

1620{
1621 evt.Skip();
1622 CallAfter([this]{
1624 });
1625}

References BasicUI::CallAfter(), and DrawBothOverlays().

Here is the call graph for this function:

◆ OnPaint()

void AdornedRulerPanel::OnPaint ( wxPaintEvent &  evt)
private

Definition at line 1553 of file AdornedRulerPanel.cpp.

1554{
1555 const auto &viewInfo = ViewInfo::Get( *GetProject() );
1556 const auto &playRegion = viewInfo.playRegion;
1557 const auto playRegionBounds = std::pair{
1558 playRegion.GetLastActiveStart(), playRegion.GetLastActiveEnd() };
1559 mLastDrawnH = viewInfo.hpos;
1560 mLastDrawnZoom = viewInfo.GetZoom();
1561 mLastDrawnPlayRegion = playRegionBounds;
1562 mLastDrawnSelectedRegion = viewInfo.selectedRegion;
1563 // To do, note other fisheye state when we have that
1564
1565 wxPaintDC dc(this);
1566
1567 auto &backDC = GetBackingDCForRepaint();
1568
1569 DoDrawBackground(&backDC);
1570
1571 // Find play region rectangle, selected rectangle, and their overlap
1572 const auto rectP = PlayRegionRectangle(),
1573 rectS = SelectedRegionRectangle(),
1574 rectO = rectP.Intersect(rectS);
1575
1576 // What's left and right of the overlap? Assume same tops and bottoms
1577 const auto top = rectP.GetTop(),
1578 bottom = rectP.GetBottom();
1579 wxRect rectL{
1580 wxPoint{ 0, top }, wxPoint{ this->GetSize().GetWidth() - 1, bottom } };
1581 wxRect rectR = {};
1582 if (!rectO.IsEmpty()) {
1583 rectR = { wxPoint{ rectO.GetRight() + 1, top }, rectL.GetBottomRight() };
1584 rectL = { rectL.GetTopLeft(), wxPoint{ rectO.GetLeft() - 1, bottom } };
1585 }
1586
1587 DoDrawPlayRegion(&backDC, rectP, rectL, rectR);
1588 DoDrawOverlap(&backDC, rectO);
1589 DoDrawSelection(&backDC, rectS, rectL, rectR);
1590
1591 DoDrawPlayRegionLimits(&backDC, rectP);
1592
1593 DoDrawMarks(&backDC, true);
1594
1595 DoDrawEdge(&backDC);
1596
1597 DisplayBitmap(dc);
1598
1599 // Stroke extras direct to the client area,
1600 // maybe outside of the damaged area
1601 // As with TrackPanel, do not make a NEW wxClientDC or else Mac flashes badly!
1602 dc.DestroyClippingRegion();
1603 DrawOverlays(true, &dc);
1604}
wxRect PlayRegionRectangle() const
void DoDrawOverlap(wxDC *dc, const wxRect &rect)
wxRect SelectedRegionRectangle() const
void DoDrawMarks(wxDC *dc, bool)
void DoDrawPlayRegion(wxDC *dc, const wxRect &rectP, const wxRect &rectL, const wxRect &rectR)
void DoDrawSelection(wxDC *dc, const wxRect &rectS, const wxRect &rectL, const wxRect &rectR)
void DoDrawBackground(wxDC *dc)
void DoDrawPlayRegionLimits(wxDC *dc, const wxRect &rect)
void DoDrawEdge(wxDC *dc)
wxDC & GetBackingDCForRepaint()
Definition: BackedPanel.cpp:35
void DisplayBitmap(wxDC &dc)
Definition: BackedPanel.cpp:65

References BackedPanel::DisplayBitmap(), DoDrawBackground(), DoDrawEdge(), DoDrawMarks(), DoDrawOverlap(), DoDrawPlayRegion(), DoDrawPlayRegionLimits(), DoDrawSelection(), OverlayPanel::DrawOverlays(), ViewInfo::Get(), BackedPanel::GetBackingDCForRepaint(), GetProject(), mLastDrawnH, mLastDrawnPlayRegion, mLastDrawnSelectedRegion, mLastDrawnZoom, PlayRegionRectangle(), and SelectedRegionRectangle().

Here is the call graph for this function:

◆ OnPinnedButton()

void AdornedRulerPanel::OnPinnedButton ( wxCommandEvent &  event)
private

Definition at line 2188 of file AdornedRulerPanel.cpp.

2189{
2191}
void ShowContextMenu(MenuChoice choice, const wxPoint *pPosition)

References QuickPlay, and ShowContextMenu().

Here is the call graph for this function:

◆ OnSelectionChange()

void AdornedRulerPanel::OnSelectionChange ( Observer::Message  )
private

Definition at line 1634 of file AdornedRulerPanel.cpp.

1635{
1636 auto &selectedRegion = mViewInfo->selectedRegion;
1637 DoSelectionChange( selectedRegion );
1638}

References DoSelectionChange(), CellularPanel::mViewInfo, and ViewInfo::selectedRegion.

Referenced by AdornedRulerPanel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnSetPlayRegionToSelection()

void AdornedRulerPanel::OnSetPlayRegionToSelection ( wxCommandEvent &  evt)
private

Definition at line 2359 of file AdornedRulerPanel.cpp.

2360{
2362}
void SetPlayRegionToSelection(AudacityProject &project)

References mProject, and SelectUtilities::SetPlayRegionToSelection().

Here is the call graph for this function:

◆ OnSize()

void AdornedRulerPanel::OnSize ( wxSizeEvent &  evt)
private

Definition at line 1606 of file AdornedRulerPanel.cpp.

1607{
1608 mOuter = GetClientRect();
1609 if (mOuter.GetWidth() == 0 || mOuter.GetHeight() == 0)
1610 {
1611 return;
1612 }
1613
1614 UpdateRects();
1615
1617}
void OnSize(wxSizeEvent &event)
Definition: BackedPanel.cpp:71

References mOuter, BackedPanel::OnSize(), and UpdateRects().

Here is the call graph for this function:

◆ OnSyncSelToQuickPlay()

void AdornedRulerPanel::OnSyncSelToQuickPlay ( wxCommandEvent &  evt)
private

Definition at line 2329 of file AdornedRulerPanel.cpp.

2330{
2332 gPrefs->Write(wxT("/QuickPlay/DragSelection"), mPlayRegionDragsSelection);
2333 gPrefs->Flush();
2334}

References audacity::BasicSettings::Flush(), gPrefs, mPlayRegionDragsSelection, audacity::BasicSettings::Write(), and wxT().

Here is the call graph for this function:

◆ OnThemeChange()

void AdornedRulerPanel::OnThemeChange ( struct ThemeChangeMessage  message)
private

Definition at line 1627 of file AdornedRulerPanel.cpp.

1628{
1629 if (message.appearance)
1630 return;
1632}
std::optional< PreferredSystemAppearance > appearance
Definition: Theme.h:112

References ThemeChangeMessage::appearance, and ReCreateButtons().

Referenced by AdornedRulerPanel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnTimelineFormatChange()

void AdornedRulerPanel::OnTimelineFormatChange ( wxCommandEvent &  evt)
private

Definition at line 2315 of file AdornedRulerPanel.cpp.

2316{
2317 int id = event.GetId();
2318 TimeDisplayMode changeFlag = mTimeDisplayMode;
2319 wxASSERT(id == OnMinutesAndSecondsID || id == OnBeatsAndMeasuresID);
2322
2324
2325 if (changeFlag != mTimeDisplayMode)
2326 Refresh();
2327}
@ OnBeatsAndMeasuresID
@ OnMinutesAndSecondsID
TimeDisplayMode
bool WriteEnum(TimeDisplayMode value)

References BeatsAndMeasures, MinutesAndSeconds, mTimeDisplayMode, OnBeatsAndMeasuresID, OnMinutesAndSecondsID, Refresh(), TimeDisplayModePreference, and TimeDisplayModeSetting::WriteEnum().

Here is the call graph for this function:

◆ OnTogglePinnedState()

void AdornedRulerPanel::OnTogglePinnedState ( wxCommandEvent &  event)
private

Definition at line 2193 of file AdornedRulerPanel.cpp.

2194{
2197}

References TogglePinnedHead(), and UpdateButtonStates().

Here is the call graph for this function:

◆ OnTogglePlayRegion()

void AdornedRulerPanel::OnTogglePlayRegion ( wxCommandEvent &  evt)
private

Definition at line 2349 of file AdornedRulerPanel.cpp.

2350{
2352}
void TogglePlayRegion(AudacityProject &project)

References mProject, and SelectUtilities::TogglePlayRegion().

Here is the call graph for this function:

◆ PlayRegionRectangle()

wxRect AdornedRulerPanel::PlayRegionRectangle ( ) const
private

Definition at line 2485 of file AdornedRulerPanel.cpp.

2486{
2487 const auto &viewInfo = ViewInfo::Get(*mProject);
2488 const auto &playRegion = viewInfo.playRegion;
2489 const auto t0 = playRegion.GetLastActiveStart(),
2490 t1 = playRegion.GetLastActiveEnd();
2491 return RegionRectangle(t0, t1);
2492}
wxRect RegionRectangle(double t0, double t1) const

References ViewInfo::Get(), mProject, and RegionRectangle().

Referenced by OnPaint().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pos2Time()

double AdornedRulerPanel::Pos2Time ( int  p,
bool  ignoreFisheye = false 
) const
private

Definition at line 1704 of file AdornedRulerPanel.cpp.

1705{
1707 , ignoreFisheye
1708 );
1709}
double PositionToTime(int64 position, int64 origin=0, bool ignoreFisheye=false) const
Definition: ZoomInfo.cpp:34

References mLeftOffset, CellularPanel::mViewInfo, and ZoomInfo::PositionToTime().

Referenced by DoDrawMarks(), and UpdateQuickPlayPos().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProcessUIHandleResult()

void AdornedRulerPanel::ProcessUIHandleResult ( TrackPanelCell pClickedTrack,
TrackPanelCell pLatestCell,
unsigned  refreshResult 
)
overrideprivatevirtual

Implements CellularPanel.

Definition at line 2788 of file AdornedRulerPanel.cpp.

2790{
2791 if (refreshResult & RefreshCode::RefreshAll)
2792 Refresh(); // Overlays will be repainted too
2793 else if (refreshResult & RefreshCode::DrawOverlays)
2794 DrawBothOverlays(); // cheaper redrawing of guidelines only
2795}

References DrawBothOverlays(), RefreshCode::DrawOverlays, Refresh(), and RefreshCode::RefreshAll.

Here is the call graph for this function:

◆ ReCreateButtons()

void AdornedRulerPanel::ReCreateButtons ( )

Definition at line 1381 of file AdornedRulerPanel.cpp.

1382{
1383 // TODO: Should we do this to destroy the grabber??
1384 // Get rid of any children we may have
1385 // DestroyChildren();
1386
1388 SetBackgroundColour(theTheme.Colour( clrMedium ));
1389
1390 for (auto & button : mButtons) {
1391 if (button)
1392 button->Destroy();
1393 button = nullptr;
1394 }
1395
1396 size_t iButton = 0;
1397 // Make the short row of time ruler push buttons.
1398 // Don't bother with sizers. Their sizes and positions are fixed.
1399 // Add a grabber converted to a spacer.
1400 // This makes it visually clearer that the button is a button.
1401
1402 wxPoint position( 1, 0 );
1403
1404 Grabber * pGrabber = safenew Grabber(this, {});
1405 pGrabber->SetAsSpacer( true );
1406 //pGrabber->SetSize( 10, 27 ); // default is 10,27
1407 pGrabber->SetPosition( position );
1408
1409 position.x = 12;
1410
1411 auto size = theTheme.ImageSize( bmpRecoloredUpSmall );
1412 size.y = std::min(size.y, GetRulerHeight(false));
1413
1414 const auto button = ToolBar::MakeButton(
1415 this,
1416 bmpRecoloredUpSmall, bmpRecoloredDownSmall,
1417 bmpRecoloredUpHiliteSmall, bmpRecoloredHiliteSmall,
1418 bmpCogwheel, bmpCogwheel, bmpCogwheel,
1419 OnTogglePinnedStateID, position, true, size
1420 );
1421
1422 position.x += size.GetWidth();
1423 mButtons[iButton++] = button;
1424
1426}
@ OnTogglePinnedStateID
#define safenew
Definition: MemoryX.h:9
The widget to the left of a ToolBar that allows it to be dragged around to NEW positions.
Definition: Grabber.h:107
void SetAsSpacer(bool bIsSpacer)
Definition: Grabber.cpp:99
wxSize ImageSize(int iIndex)
static AButton * MakeButton(wxWindow *parent, teBmps eUp, teBmps eDown, teBmps eHilite, teBmps eDownHi, teBmps eStandardUp, teBmps eStandardDown, teBmps eDisabled, wxWindowID id, wxPoint placement, bool processdownevents, wxSize size)
Definition: ToolBar.cpp:875
static void MakeButtonBackgroundsSmall()
Definition: ToolBar.cpp:837

References ThemeBase::Colour(), GetRulerHeight(), ThemeBase::ImageSize(), ToolBar::MakeButton(), ToolBar::MakeButtonBackgroundsSmall(), mButtons, min(), OnTogglePinnedStateID, safenew, Grabber::SetAsSpacer(), size, theTheme, and UpdateButtonStates().

Referenced by OnThemeChange(), and UpdatePrefs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Refresh()

void AdornedRulerPanel::Refresh ( bool  eraseBackground = true,
const wxRect *  rect = (const wxRect *) NULL 
)
override

Definition at line 1357 of file AdornedRulerPanel.cpp.

1358{
1359 CellularPanel::Refresh( eraseBackground, rect );
1361}
void HandleCursorForPresentMouseState(bool doHit=true)

References BasicUI::CallAfter(), and CellularPanel::HandleCursorForPresentMouseState().

Referenced by AdornedRulerPanel(), ClearPlayRegion(), DoIdle(), DrawSelection(), OnTimelineFormatChange(), ProcessUIHandleResult(), SetPlayRegion(), SetTimeDisplayMode(), UpdatePrefs(), and TrackPanel::UpdateVRulerSize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RegionRectangle()

wxRect AdornedRulerPanel::RegionRectangle ( double  t0,
double  t1 
) const
private

Definition at line 2502 of file AdornedRulerPanel.cpp.

2503{
2504 int p0 = -1, p1 = -1;
2505 if (t0 == t1)
2506 // Make the rectangle off-screen horizontally, but set the height
2507 ;
2508 else {
2509 p0 = max(1, Time2Pos(t0));
2510 p1 = min(mInner.width, Time2Pos(t1));
2511 }
2512
2513 const int left = p0, top = mInner.y, right = p1, bottom = mInner.GetBottom();
2514 return { wxPoint{left, top}, wxPoint{right, bottom} };
2515}

References min(), mInner, and Time2Pos().

Referenced by PlayRegionRectangle(), and SelectedRegionRectangle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Root()

std::shared_ptr< TrackPanelNode > AdornedRulerPanel::Root ( )
overrideprivatevirtual

Implements CellularPanel.

Definition at line 2767 of file AdornedRulerPanel.cpp.

2768{
2769 // Root is a throwaway object
2770 return std::make_shared< MainGroup >( *this );
2771}

◆ SelectedRegionRectangle()

wxRect AdornedRulerPanel::SelectedRegionRectangle ( ) const
private

Definition at line 2494 of file AdornedRulerPanel.cpp.

2495{
2496 const auto &viewInfo = ViewInfo::Get(*mProject);
2497 const auto &selectedRegion = viewInfo.selectedRegion;
2498 const auto t0 = selectedRegion.t0(), t1 = selectedRegion.t1();
2499 return RegionRectangle(t0, t1);
2500}

References ViewInfo::Get(), mProject, and RegionRectangle().

Referenced by OnPaint().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetFocusedCell()

void AdornedRulerPanel::SetFocusedCell ( )
overrideprivatevirtual

Implements CellularPanel.

Definition at line 2784 of file AdornedRulerPanel.cpp.

2785{
2786}

◆ SetFocusFromKbd()

void AdornedRulerPanel::SetFocusFromKbd ( )
override

Definition at line 2721 of file AdornedRulerPanel.cpp.

2722{
2723 auto temp = TemporarilyAllowFocus();
2724 SetFocus();
2725}
static TempAllowFocus TemporarilyAllowFocus()
void SetFocus(const WindowPlacement &focus)
Set the window that accepts keyboard input.
Definition: BasicUI.h:384

References BasicUI::SetFocus(), and TemporarilyAllowFocus().

Here is the call graph for this function:

◆ SetLeftOffset()

void AdornedRulerPanel::SetLeftOffset ( int  offset)

Definition at line 2600 of file AdornedRulerPanel.cpp.

2601{
2602 if (mLeftOffset != offset) {
2603 mLeftOffset = offset;
2604 mUpdater.SetData(mViewInfo, offset);
2606 }
2607}

References Ruler::Invalidate(), mLeftOffset, mRuler, mUpdater, CellularPanel::mViewInfo, and LinearUpdater::SetData().

Referenced by TrackPanel::UpdateVRulerSize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetNumGuides()

void AdornedRulerPanel::SetNumGuides ( size_t  nn)

Definition at line 2708 of file AdornedRulerPanel.cpp.

2709{
2710 nn = std::min(nn, MAX_GUIDES);
2711 // If increasing the number of guides, reinitialize newer ones
2712 for (size_t ii = mNumGuides; ii < nn; ++ii) {
2713 mQuickPlayOffset[ii] = 0;
2714 mQuickPlayPosUnsnapped[ii] = 0;
2715 mQuickPlayPos[ii] = 0;
2716 mIsSnapped[ii] = false;
2717 }
2718 mNumGuides = nn;
2719}
double mQuickPlayOffset[MAX_GUIDES]
static constexpr size_t MAX_GUIDES
double mQuickPlayPosUnsnapped[MAX_GUIDES]

References MAX_GUIDES, min(), mIsSnapped, mNumGuides, mQuickPlayOffset, mQuickPlayPos, and mQuickPlayPosUnsnapped.

Here is the call graph for this function:

◆ SetPanelSize()

bool AdornedRulerPanel::SetPanelSize ( )

Definition at line 2141 of file AdornedRulerPanel.cpp.

2142{
2143 const auto oldSize = GetSize();
2144 wxSize size { oldSize.GetWidth(), GetRulerHeight(ShowingScrubRuler()) };
2145 if ( size != oldSize ) {
2146 SetSize(size);
2147 SetMinSize(size);
2148 PostSizeEventToParent();
2149 return true;
2150 }
2151 else
2152 return false;
2153}

References GetRulerHeight(), ShowingScrubRuler(), and size.

Referenced by DoIdle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetPlayRegion()

void AdornedRulerPanel::SetPlayRegion ( double  playRegionStart,
double  playRegionEnd 
)

Definition at line 2669 of file AdornedRulerPanel.cpp.

2671{
2672 // This is called by AudacityProject to make the play region follow
2673 // the current selection. But while the user is selecting a play region
2674 // with the mouse directly in the ruler, changes from outside are blocked.
2676 return;
2677
2678 auto &viewInfo = ViewInfo::Get( *GetProject() );
2679 auto &playRegion = viewInfo.playRegion;
2680 playRegion.SetTimes( playRegionStart, playRegionEnd );
2681
2682 Refresh();
2683}

References ViewInfo::Get(), GetProject(), mesNone, mMouseEventState, and Refresh().

Referenced by DoSelectionChange().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetTimeDisplayMode()

void AdornedRulerPanel::SetTimeDisplayMode ( TimeDisplayMode  rulerType)

Definition at line 2838 of file AdornedRulerPanel.cpp.

2839{
2840 if (mTimeDisplayMode == type)
2841 return;
2842
2843 mTimeDisplayMode = type;
2845 Refresh();
2846}

References mTimeDisplayMode, Refresh(), TimeDisplayModePreference, and TimeDisplayModeSetting::WriteEnum().

Referenced by AudacityMirProject::ReconfigureMusicGrid().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ShowContextMenu()

void AdornedRulerPanel::ShowContextMenu ( MenuChoice  choice,
const wxPoint *  pPosition 
)
private

Definition at line 2365 of file AdornedRulerPanel.cpp.

2367{
2368 wxPoint position;
2369 if(pPosition)
2370 position = *pPosition;
2371 else
2372 {
2373 auto rect = GetRect();
2374 //Old code put menu too low down. y position applied twice.
2375 //position = { rect.GetLeft() + 1, rect.GetBottom() + 1 };
2376
2377 // The cell does not pass in the mouse or button position.
2378 // We happen to know this is the pin/unpin button
2379 // so these magic values 'fix a bug' - but really the cell should
2380 // pass more information to work with in.
2381 position = { rect.GetLeft() + 38, rect.GetHeight()/2 + 1 };
2382 }
2383
2384 switch (choice) {
2386 ShowMenu(position);
2388 break;
2389 case MenuChoice::Scrub:
2390 ShowScrubMenu(position); break;
2391 default:
2392 return;
2393 }
2394}
void ShowScrubMenu(const wxPoint &pos)
void ShowMenu(const wxPoint &pos)

References QuickPlay, Scrub, ShowMenu(), ShowScrubMenu(), and UpdateButtonStates().

Referenced by OnPinnedButton().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ShowingScrubRuler()

bool AdornedRulerPanel::ShowingScrubRuler ( ) const

Definition at line 2760 of file AdornedRulerPanel.cpp.

2761{
2762 auto &scrubber = Scrubber::Get( *GetProject() );
2763 return scrubber.ShowsBar();
2764}
static Scrubber & Get(AudacityProject &project)
Definition: Scrubbing.cpp:186

References Scrubber::Get(), and GetProject().

Referenced by AdornedRulerPanel::Subgroup::Children(), DoDrawBackground(), DoDrawScrubIndicator(), SetPanelSize(), and UpdateRects().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ShowMenu()

void AdornedRulerPanel::ShowMenu ( const wxPoint &  pos)
private

Definition at line 2221 of file AdornedRulerPanel.cpp.

2222{
2223 const auto &viewInfo = ViewInfo::Get( *GetProject() );
2224 const auto &playRegion = viewInfo.playRegion;
2225 wxMenu rulerMenu;
2226
2227 {
2228 auto item = rulerMenu.AppendRadioItem(OnMinutesAndSecondsID,
2229 _("Minutes and Seconds"));
2231 }
2232
2233 {
2234 auto item = rulerMenu.AppendRadioItem(OnBeatsAndMeasuresID,
2235 _("Beats and Measures"));
2237 }
2238
2239 rulerMenu.AppendSeparator();
2240
2241 auto pDrag = rulerMenu.AppendCheckItem(OnSyncQuickPlaySelID, _("Setting a loop region also makes an audio selection"));
2242 pDrag->Check(mPlayRegionDragsSelection && playRegion.Active());
2243 pDrag->Enable(playRegion.Active());
2244
2245 {
2246 auto item = rulerMenu.AppendCheckItem(OnTogglePlayRegionID,
2248 item->Check(playRegion.Active());
2249 }
2250
2251 {
2252 auto item = rulerMenu.Append(OnClearPlayRegionID,
2253 /* i18n-hint Clear is a verb */
2254 _("Clear Loop"));
2255 }
2256
2257 {
2258 auto item = rulerMenu.Append(OnSetPlayRegionToSelectionID,
2259 _("Set Loop To Selection"));
2260 }
2261
2262 rulerMenu.AppendSeparator();
2263
2264 rulerMenu.AppendCheckItem(OnAutoScrollID, _("Scroll view to playhead"))->
2266
2267 rulerMenu.AppendCheckItem(OnTogglePinnedStateID, _("Continuous scrolling"))->
2269
2270 BasicMenu::Handle{ &rulerMenu }.Popup(
2272 { pos.x, pos.y }
2273 );
2274}
@ OnSetPlayRegionToSelectionID
@ OnClearPlayRegionID
@ OnAutoScrollID
@ OnTogglePlayRegionID
@ OnSyncQuickPlaySelID
#define _(s)
Definition: Internat.h:73
const TranslatableString LoopToggleText
Definition: ViewInfo.cpp:227
void Popup(const BasicUI::WindowPlacement &window, const Point &pos={})
Display the menu at pos, invoke at most one action, then hide it.
Definition: BasicMenu.cpp:209
static bool GetPinnedHeadPreference()
wxString Translation() const
TranslatableString Stripped(unsigned options=MenuCodes) const
non-mutating, constructs another TranslatableString object
Window placement information for wxWidgetsBasicUI can be constructed from a wxWindow pointer.

References _, BeatsAndMeasures, ViewInfo::bUpdateTrackIndicator, ViewInfo::Get(), TracksPrefs::GetPinnedHeadPreference(), GetProject(), LoopToggleText, MinutesAndSeconds, mPlayRegionDragsSelection, mTimeDisplayMode, CellularPanel::mViewInfo, OnAutoScrollID, OnBeatsAndMeasuresID, OnClearPlayRegionID, OnMinutesAndSecondsID, OnSetPlayRegionToSelectionID, OnSyncQuickPlaySelID, OnTogglePinnedStateID, OnTogglePlayRegionID, BasicMenu::Handle::Popup(), TranslatableString::Stripped(), and TranslatableString::Translation().

Referenced by ShowContextMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ShowScrubMenu()

void AdornedRulerPanel::ShowScrubMenu ( const wxPoint &  pos)
private

Definition at line 2276 of file AdornedRulerPanel.cpp.

2277{
2278 auto &scrubber = Scrubber::Get( *mProject );
2279 PushEventHandler(&scrubber);
2280 auto cleanup = finally([this]{ PopEventHandler(); });
2281
2282 wxMenu rulerMenu;
2283 scrubber.PopulatePopupMenu(rulerMenu);
2284 BasicMenu::Handle{ &rulerMenu }.Popup(
2286 { pos.x, pos.y }
2287 );
2288}

References Scrubber::Get(), mProject, and BasicMenu::Handle::Popup().

Referenced by ShowContextMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ StartQPPlay()

void AdornedRulerPanel::StartQPPlay ( bool  newDefault,
bool  cutPreview,
const double *  pStartTime = nullptr 
)
private

Definition at line 2059 of file AdornedRulerPanel.cpp.

2061{
2062 const double t0 = mTracks->GetStartTime();
2063 const double t1 = mTracks->GetEndTime();
2064 auto &viewInfo = ViewInfo::Get( *mProject );
2065 const auto &playRegion = viewInfo.playRegion;
2066 const auto &selectedRegion = viewInfo.selectedRegion;
2067 const double sel0 = selectedRegion.t0();
2068 const double sel1 = selectedRegion.t1();
2069
2070 // Start / Restart playback on left click.
2071 bool startPlaying = true; // = (playRegion.GetStart() >= 0);
2072
2073 if (startPlaying) {
2074 bool loopEnabled = true;
2075 auto oldStart = std::max(0.0, playRegion.GetStart());
2076 double start = oldStart, end = 0;
2077
2078 if (playRegion.Empty()) {
2079 // Play either a selection or the project.
2080 if (oldStart > sel0 && oldStart < sel1) {
2081 // we are in a selection, so use the selection
2082 start = sel0;
2083 end = sel1;
2084 } // not in a selection, so use the project
2085 else {
2086 start = t0;
2087 end = t1;
2088 }
2089 }
2090 else
2091 end = std::max(start, playRegion.GetEnd());
2092
2093 // Looping a tiny selection may freeze, so just play it once.
2094 loopEnabled = ((end - start) > 0.001)? true : false;
2095
2096 newDefault = (loopEnabled && newDefault);
2097 if (newDefault)
2098 cutPreview = false;
2099 auto options = ProjectAudioIO::GetDefaultOptions(*mProject, newDefault);
2100
2101 if (!cutPreview) {
2102 if (pStartTime)
2103 options.pStartTime.emplace(*pStartTime);
2104 }
2105 else
2106 options.envelope = nullptr;
2107
2108 auto mode =
2109 cutPreview ? PlayMode::cutPreviewPlay
2110 : newDefault ? PlayMode::loopedPlay
2112
2113 // Stop only after deciding where to start again, because an event
2114 // callback may change the play region back to the selection
2115 auto &projectAudioManager = ProjectAudioManager::Get( *mProject );
2116 projectAudioManager.Stop();
2117
2118 // Don't change play region, assume caller set it as needed
2119 // playRegion.SetTimes( start, end );
2120 // Refresh();
2121
2122 projectAudioManager.PlayPlayRegion((SelectedRegion(start, end)),
2123 options, mode,
2124 false);
2125
2126 }
2127}
@ cutPreviewPlay
static AudioIOStartStreamOptions GetDefaultOptions(AudacityProject &project, bool newDefaults=false)
Invoke the global hook, supplying a default argument.
Defines a selected portion of a project.
double GetEndTime() const
Return the greatest end time of the tracks, or 0 when no tracks.
Definition: Track.cpp:784
double GetStartTime() const
Return the least start time of the tracks, or 0 when no tracks.
Definition: Track.cpp:778
const char * end(const char *str) noexcept
Definition: StringUtils.h:106

References cutPreviewPlay, details::end(), ViewInfo::Get(), ProjectAudioManager::Get(), ProjectAudioIO::GetDefaultOptions(), TrackList::GetEndTime(), TrackList::GetStartTime(), loopedPlay, mProject, mTracks, and normalPlay.

Here is the call graph for this function:

◆ TemporarilyAllowFocus()

auto AdornedRulerPanel::TemporarilyAllowFocus ( )
static

Definition at line 2703 of file AdornedRulerPanel.cpp.

2703 {
2704 s_AcceptsFocus = true;
2705 return TempAllowFocus{ &s_AcceptsFocus };
2706}
std::unique_ptr< bool, Resetter > TempAllowFocus

Referenced by SetFocusFromKbd().

Here is the caller graph for this function:

◆ Time2Pos()

int AdornedRulerPanel::Time2Pos ( double  t,
bool  ignoreFisheye = false 
) const
private

Definition at line 1711 of file AdornedRulerPanel.cpp.

1712{
1714 , ignoreFisheye
1715 );
1716}
int64 TimeToPosition(double time, int64 origin=0, bool ignoreFisheye=false) const
STM: Converts a project time to screen x position.
Definition: ZoomInfo.cpp:44

References mLeftOffset, CellularPanel::mViewInfo, and ZoomInfo::TimeToPosition().

Referenced by IsWithinMarker(), and RegionRectangle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TogglePinnedHead()

void AdornedRulerPanel::TogglePinnedHead ( )

Definition at line 2818 of file AdornedRulerPanel.cpp.

2819{
2823
2824 auto &project = *mProject;
2825 // Update button image
2827
2828 auto &scrubber = Scrubber::Get( project );
2829 if (scrubber.HasMark())
2830 scrubber.SetScrollScrubbing(value);
2831}
static void ModifyAllProjectToolbarMenus()
static void SetPinnedHeadPreference(bool value, bool flush=false)

References Scrubber::Get(), TracksPrefs::GetPinnedHeadPreference(), ToolManager::ModifyAllProjectToolbarMenus(), mProject, project, TracksPrefs::SetPinnedHeadPreference(), and UpdateButtonStates().

Referenced by anonymous_namespace{AdornedRulerPanel.cpp}::OnTogglePinnedHead(), and OnTogglePinnedState().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdateButtonStates()

void AdornedRulerPanel::UpdateButtonStates ( )

Definition at line 2167 of file AdornedRulerPanel.cpp.

2168{
2169 auto common = [this](
2170 AButton &button, const CommandID &commandName, const TranslatableString &label) {
2171 ComponentInterfaceSymbol command{ commandName, label };
2172 ToolBar::SetButtonToolTip( *mProject, button, &command, 1u );
2173 button.SetLabel( Verbatim( button.GetToolTipText() ) );
2174
2175 button.UpdateStatus();
2176 };
2177
2178 {
2179 auto timelineOptionsButton = static_cast<AButton*>(FindWindow(OnTogglePinnedStateID));
2180 timelineOptionsButton->PopUp();
2181 // Bug 1584: Tooltip now shows what clicking will do.
2182 // Bug 2357: Action of button (and hence tooltip wording) updated.
2183 const auto label = XO("Timeline Options");
2184 common(*timelineOptionsButton, wxT("PinnedHead"), label);
2185 }
2186}
TranslatableString label
Definition: TagsEditor.cpp:165
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
A wxButton with mouse-over behaviour.
Definition: AButton.h:104
void UpdateStatus()
Definition: AButton.cpp:455
void PopUp()
Definition: AButton.cpp:585
void SetLabel(const TranslatableString &label)
Definition: AButton.cpp:189
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
static void SetButtonToolTip(AudacityProject &project, AButton &button, const ComponentInterfaceSymbol commands[], size_t nCommands)
Definition: ToolBar.cpp:970
Holds a msgid for the translation catalog; may also bind format arguments.

References label, mProject, OnTogglePinnedStateID, AButton::PopUp(), ToolBar::SetButtonToolTip(), AButton::SetLabel(), AButton::UpdateStatus(), Verbatim(), wxT(), and XO().

Referenced by OnAudioStartStop(), OnTogglePinnedState(), ReCreateButtons(), ShowContextMenu(), TogglePinnedHead(), and UpdatePrefs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdatePrefs()

void AdornedRulerPanel::UpdatePrefs ( )
overridevirtual

Implements PrefsListener.

Definition at line 1363 of file AdornedRulerPanel.cpp.

1364{
1365 if (mNeedButtonUpdate) {
1366 // Visit this block once only in the lifetime of this panel
1367 mNeedButtonUpdate = false;
1368 // Do this first time setting of button status texts
1369 // when we are sure the CommandManager is initialized.
1371 }
1372
1373 // Update button texts for language change
1375
1377 Refresh();
1378 // Update();
1379}

References mNeedButtonUpdate, mTimeDisplayMode, EnumSetting< Enum >::ReadEnum(), ReCreateButtons(), Refresh(), TimeDisplayModePreference, and UpdateButtonStates().

Referenced by AdornedRulerPanel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdateQuickPlayPos()

void AdornedRulerPanel::UpdateQuickPlayPos ( wxCoord &  mousePosX)

Definition at line 2199 of file AdornedRulerPanel.cpp.

2200{
2201 // Invoked for mouse-over preview events, or dragging, or scrub position
2202 // polling updates. Remember x coordinates, converted to times, for
2203 // drawing of guides.
2204
2205 // Keep Quick-Play within usable track area. (Dependent on zoom)
2206 const auto &viewInfo = ViewInfo::Get( *mProject );
2207 auto width = viewInfo.GetTracksUsableWidth();
2208 mousePosX = std::max(mousePosX, viewInfo.GetLeftOffset());
2209 mousePosX = std::min(mousePosX, viewInfo.GetLeftOffset() + width - 1);
2210 const auto time = Pos2Time(mousePosX);
2211
2212 for (size_t ii = 0; ii < mNumGuides; ++ii) {
2214 time + mQuickPlayOffset[ii];
2215 HandleSnapping(ii);
2216 }
2217}
void HandleSnapping(size_t index)

References ViewInfo::Get(), HandleSnapping(), min(), mNumGuides, mProject, mQuickPlayOffset, mQuickPlayPos, mQuickPlayPosUnsnapped, and Pos2Time().

Here is the call graph for this function:

◆ UpdateRects()

bool AdornedRulerPanel::UpdateRects ( )
private

Definition at line 1651 of file AdornedRulerPanel.cpp.

1652{
1653 auto inner = mOuter;
1654 wxRect scrubZone;
1655 inner.x += LeftMargin;
1656 inner.width -= (LeftMargin + RightMargin);
1657
1658 auto top = &inner;
1659 auto bottom = &inner;
1660
1661 if (ShowingScrubRuler()) {
1662 scrubZone = inner;
1663 auto scrubHeight = std::min(scrubZone.height, (int)(ScrubHeight));
1664
1665 int topHeight;
1666#ifdef SCRUB_ABOVE
1667 top = &scrubZone, topHeight = scrubHeight;
1668#else
1669 auto qpHeight = scrubZone.height - scrubHeight;
1670 bottom = &scrubZone, topHeight = qpHeight;
1671 // Increase scrub zone height so that hit testing finds it and
1672 // not QP region, when on bottom 'edge'.
1673 scrubZone.height+=BottomMargin;
1674#endif
1675
1676 top->height = topHeight;
1677 bottom->height -= topHeight;
1678 bottom->y += topHeight;
1679 }
1680
1681 top->y += TopMargin;
1682 top->height -= TopMargin;
1683
1684 bottom->height -= BottomMargin;
1685
1686 if (!ShowingScrubRuler())
1687 scrubZone = inner;
1688
1689 if ( inner == mInner && scrubZone == mScrubZone )
1690 // no changes
1691 return false;
1692
1693 mInner = inner;
1694 mScrubZone = scrubZone;
1695
1696 mRuler.SetBounds(mInner.GetLeft(),
1697 mInner.GetTop(),
1698 mInner.GetRight(),
1699 mInner.GetBottom());
1700
1701 return true;
1702}
@ LeftMargin
@ TopMargin
void SetBounds(int left, int top, int right, int bottom)
Definition: Ruler.cpp:304

References BottomMargin, LeftMargin, min(), mInner, mOuter, mRuler, mScrubZone, RightMargin, ScrubHeight, Ruler::SetBounds(), ShowingScrubRuler(), and TopMargin.

Referenced by DoIdle(), and OnSize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdateStatusMessage()

void AdornedRulerPanel::UpdateStatusMessage ( const TranslatableString message)
overrideprivatevirtual

Implements CellularPanel.

Definition at line 2797 of file AdornedRulerPanel.cpp.

2798{
2799 ProjectStatus::Get( *GetProject() ).Set(message);
2800}
static ProjectStatus & Get(AudacityProject &project)
void Set(const TranslatableString &msg, StatusBarField field=MainStatusBarField())

References ProjectStatus::Get(), GetProject(), and ProjectStatus::Set().

Here is the call graph for this function:

Member Data Documentation

◆ mAudioIOSubscription

Observer::Subscription AdornedRulerPanel::mAudioIOSubscription
private

Definition at line 245 of file AdornedRulerPanel.h.

Referenced by AdornedRulerPanel().

◆ MAX_GUIDES

constexpr size_t AdornedRulerPanel::MAX_GUIDES = 2
staticconstexprprivate

Definition at line 154 of file AdornedRulerPanel.h.

Referenced by SetNumGuides().

◆ mButtons

wxWindow* AdornedRulerPanel::mButtons[3]
private

Definition at line 199 of file AdornedRulerPanel.h.

Referenced by AdornedRulerPanel(), and ReCreateButtons().

◆ mIndTime

double AdornedRulerPanel::mIndTime
private

Definition at line 152 of file AdornedRulerPanel.h.

Referenced by AdornedRulerPanel().

◆ mInner

wxRect AdornedRulerPanel::mInner
private

◆ mIsDragging

bool AdornedRulerPanel::mIsDragging
private

Definition at line 195 of file AdornedRulerPanel.h.

Referenced by AdornedRulerPanel().

◆ mIsRecording

bool AdornedRulerPanel::mIsRecording
private

Definition at line 163 of file AdornedRulerPanel.h.

Referenced by AdornedRulerPanel(), and OnAudioStartStop().

◆ mIsSnapped

bool AdornedRulerPanel::mIsSnapped[MAX_GUIDES] {}
private

Definition at line 158 of file AdornedRulerPanel.h.

Referenced by HandleSnapping(), and SetNumGuides().

◆ mLastDrawnH

double AdornedRulerPanel::mLastDrawnH {}
private

Definition at line 257 of file AdornedRulerPanel.h.

Referenced by DoIdle(), and OnPaint().

◆ mLastDrawnPlayRegion

std::pair<double, double> AdornedRulerPanel::mLastDrawnPlayRegion {}
private

Definition at line 255 of file AdornedRulerPanel.h.

Referenced by DoIdle(), and OnPaint().

◆ mLastDrawnSelectedRegion

SelectedRegion AdornedRulerPanel::mLastDrawnSelectedRegion
private

Definition at line 254 of file AdornedRulerPanel.h.

Referenced by DoIdle(), and OnPaint().

◆ mLastDrawnZoom

double AdornedRulerPanel::mLastDrawnZoom {}
private

Definition at line 258 of file AdornedRulerPanel.h.

Referenced by DoIdle(), and OnPaint().

◆ mLastPlayRegionActive

bool AdornedRulerPanel::mLastPlayRegionActive = false
private

Definition at line 256 of file AdornedRulerPanel.h.

Referenced by DoDrawOverlap(), DoDrawPlayRegion(), and DoIdle().

◆ mLeftDownClick

double AdornedRulerPanel::mLeftDownClick
private

Definition at line 194 of file AdornedRulerPanel.h.

Referenced by AdornedRulerPanel().

◆ mLeftDownClickUnsnapped

double AdornedRulerPanel::mLeftDownClickUnsnapped
private

Definition at line 193 of file AdornedRulerPanel.h.

◆ mLeftOffset

int AdornedRulerPanel::mLeftOffset
private

Definition at line 149 of file AdornedRulerPanel.h.

Referenced by AdornedRulerPanel(), Pos2Time(), SetLeftOffset(), and Time2Pos().

◆ mMouseEventState

MouseEventState AdornedRulerPanel::mMouseEventState
private

Definition at line 192 of file AdornedRulerPanel.h.

Referenced by AdornedRulerPanel(), and SetPlayRegion().

◆ mNeedButtonUpdate

bool AdornedRulerPanel::mNeedButtonUpdate { true }
private

Definition at line 200 of file AdornedRulerPanel.h.

Referenced by UpdatePrefs().

◆ mNumGuides

size_t AdornedRulerPanel::mNumGuides { 1 }
private

Definition at line 159 of file AdornedRulerPanel.h.

Referenced by SetNumGuides(), and UpdateQuickPlayPos().

◆ mOldPlayRegion

PlayRegion AdornedRulerPanel::mOldPlayRegion
private

Definition at line 161 of file AdornedRulerPanel.h.

◆ mOuter

wxRect AdornedRulerPanel::mOuter
private

Definition at line 145 of file AdornedRulerPanel.h.

Referenced by AdornedRulerPanel(), DoDrawEdge(), OnSize(), and UpdateRects().

◆ mOverlay

std::shared_ptr<TrackPanelGuidelineOverlay> AdornedRulerPanel::mOverlay
private

Definition at line 224 of file AdornedRulerPanel.h.

Referenced by CreateOverlays().

◆ mPlayRegionDragsSelection

bool AdornedRulerPanel::mPlayRegionDragsSelection
private

◆ mPlayRegionSubscription

Observer::Subscription AdornedRulerPanel::mPlayRegionSubscription
private

Definition at line 246 of file AdornedRulerPanel.h.

Referenced by AdornedRulerPanel().

◆ mProject

AudacityProject* const AdornedRulerPanel::mProject
private

◆ mQPCell

std::shared_ptr<QPCell> AdornedRulerPanel::mQPCell
private

◆ mQuickPlayOffset

double AdornedRulerPanel::mQuickPlayOffset[MAX_GUIDES] {}
private

Definition at line 155 of file AdornedRulerPanel.h.

Referenced by SetNumGuides(), and UpdateQuickPlayPos().

◆ mQuickPlayPos

double AdornedRulerPanel::mQuickPlayPos[MAX_GUIDES] {}
private

Definition at line 157 of file AdornedRulerPanel.h.

Referenced by HandleSnapping(), SetNumGuides(), and UpdateQuickPlayPos().

◆ mQuickPlayPosUnsnapped

double AdornedRulerPanel::mQuickPlayPosUnsnapped[MAX_GUIDES] {}
private

Definition at line 156 of file AdornedRulerPanel.h.

Referenced by SetNumGuides(), and UpdateQuickPlayPos().

◆ mRuler

Ruler& AdornedRulerPanel::mRuler
private

◆ mRulerInvalidatedSubscription

Observer::Subscription AdornedRulerPanel::mRulerInvalidatedSubscription
private

Definition at line 248 of file AdornedRulerPanel.h.

Referenced by AdornedRulerPanel().

◆ mScrubbingCell

std::shared_ptr<ScrubbingCell> AdornedRulerPanel::mScrubbingCell
private

◆ mScrubZone

wxRect AdornedRulerPanel::mScrubZone
private

◆ mThemeChangeSubscription

Observer::Subscription AdornedRulerPanel::mThemeChangeSubscription
private

Definition at line 247 of file AdornedRulerPanel.h.

Referenced by AdornedRulerPanel().

◆ mTimeDisplayMode

TimeDisplayMode AdornedRulerPanel::mTimeDisplayMode
private

◆ mTracks

TrackList* AdornedRulerPanel::mTracks
private

Definition at line 143 of file AdornedRulerPanel.h.

Referenced by AdornedRulerPanel(), HandleSnapping(), and StartQPPlay().

◆ mUpdater

LinearUpdater& AdornedRulerPanel::mUpdater
private

Definition at line 140 of file AdornedRulerPanel.h.

Referenced by AdornedRulerPanel(), and SetLeftOffset().

◆ s_AcceptsFocus

bool AdornedRulerPanel::s_AcceptsFocus { false }
staticprivate

Definition at line 119 of file AdornedRulerPanel.h.


The documentation for this class was generated from the following files: