Audacity  2.3.1
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | 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:
CellularPanel OverlayPanel BackedPanel wxPanelWrapper wxTabTraversalWrapper< wxPanel >

Classes

class  CommonRulerHandle
 
struct  MainGroup
 
class  QPCell
 
class  QPHandle
 
class  QuickPlayIndicatorOverlay
 
class  QuickPlayRulerOverlay
 
class  ScrubbingCell
 
class  ScrubbingHandle
 
struct  Subgroup
 

Public Member Functions

 AdornedRulerPanel (AudacityProject *project, wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, ViewInfo *viewinfo=NULL)
 
 ~AdornedRulerPanel ()
 
int GetRulerHeight ()
 
wxRect GetInnerRect () const
 
void SetLeftOffset (int offset)
 
void DrawSelection ()
 
void SetPlayRegion (double playRegionStart, double playRegionEnd)
 
void ClearPlayRegion ()
 
void GetPlayRegion (double *playRegionStart, double *playRegionEnd)
 
void GetMaxSize (wxCoord *width, wxCoord *height)
 
void InvalidateRuler ()
 
void UpdatePrefs ()
 
void ReCreateButtons ()
 
void RegenerateTooltips ()
 
void UpdateQuickPlayPos (wxCoord &mousePosX, bool shiftDown)
 
bool ShowingScrubRuler () const
 
void OnToggleScrubRuler ()
 
void OnToggleScrubRulerFromMenu (wxCommandEvent &)
 
void SetPanelSize ()
 
void DrawBothOverlays ()
 
void DoDrawIndicator (wxDC *dc, wxCoord xx, bool playing, int width, bool scrub, bool seek)
 
void UpdateButtonStates ()
 
AudacityProjectGetProject () const override
 
- 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
 
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)
 
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)
 
- 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 (Overlay *pOverlay)
 
bool RemoveOverlay (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 wxString &name=_("Panel"))
 
bool Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const wxString &name=_("Panel"))
 
- 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 int GetRulerHeight (bool showScrubBar)
 

Private Types

enum  MenuChoice { MenuChoice::QuickPlay, MenuChoice::Scrub }
 
enum  MouseEventState {
  mesNone, mesDraggingPlayRegionStart, mesDraggingPlayRegionEnd, mesSelectingPlayRegionClick,
  mesSelectingPlayRegionRange
}
 

Private Member Functions

void OnRecordStartStop (wxCommandEvent &evt)
 
void OnPaint (wxPaintEvent &evt)
 
void OnSize (wxSizeEvent &evt)
 
void UpdateRects ()
 
void HandleQPClick (wxMouseEvent &event, wxCoord mousePosX)
 
void HandleQPDrag (wxMouseEvent &event, wxCoord mousePosX)
 
void HandleQPRelease (wxMouseEvent &event)
 
void StartQPPlay (bool looped, bool cutPreview)
 
void DoDrawBackground (wxDC *dc)
 
void DoDrawEdge (wxDC *dc)
 
void DoDrawMarks (wxDC *dc, bool)
 
void DoDrawSelection (wxDC *dc)
 
void DoDrawPlayRegion (wxDC *dc)
 
void ShowContextMenu (MenuChoice choice, const wxPoint *pPosition)
 
double Pos2Time (int p, bool ignoreFisheye=false)
 
int Time2Pos (double t, bool ignoreFisheye=false)
 
bool IsWithinMarker (int mousePosX, double markerTime)
 
void ShowMenu (const wxPoint &pos)
 
void ShowScrubMenu (const wxPoint &pos)
 
void DragSelection ()
 
void HandleSnapping ()
 
void OnToggleQuickPlay (wxCommandEvent &evt)
 
void OnSyncSelToQuickPlay (wxCommandEvent &evt)
 
void OnTimelineToolTips (wxCommandEvent &evt)
 
void OnAutoScroll (wxCommandEvent &evt)
 
void OnLockPlayRegion (wxCommandEvent &evt)
 
void OnTogglePinnedState (wxCommandEvent &event)
 
std::shared_ptr< TrackPanelNodeRoot () override
 
TrackPanelCellGetFocusedCell () override
 
void SetFocusedCell () override
 
void ProcessUIHandleResult (TrackPanelCell *pClickedTrack, TrackPanelCell *pLatestCell, unsigned refreshResult) override
 
void UpdateStatusMessage (const wxString &) override
 
bool TakesFocus () const override
 
void CreateOverlays ()
 

Private Attributes

Ruler mRuler
 
AudacityProject *const mProject
 
TrackListmTracks
 
wxRect mOuter
 
wxRect mScrubZone
 
wxRect mInner
 
int mLeftOffset
 
double mIndTime
 
double mQuickPlayPosUnsnapped
 
double mQuickPlayPos
 
bool mIsSnapped
 
bool mPlayRegionLock
 
double mPlayRegionStart
 
double mPlayRegionEnd
 
double mOldPlayRegionStart
 
double mOldPlayRegionEnd
 
bool mIsRecording
 
bool mPlayRegionDragsSelection
 
bool mTimelineToolTip
 
bool mQuickPlayEnabled
 
MouseEventState mMouseEventState
 
double mLeftDownClickUnsnapped
 
double mLeftDownClick
 
bool mIsDragging
 
bool mShowScrubbing { false }
 
wxWindow * mButtons [3]
 
bool mNeedButtonUpdate { true }
 
std::unique_ptr
< QuickPlayIndicatorOverlay
mOverlay
 
std::shared_ptr< QPCellmQPCell
 
std::shared_ptr< ScrubbingCellmScrubbingCell
 

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 (TrackPanelCell *pCell=nullptr)
 
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 32 of file AdornedRulerPanel.h.

Member Enumeration Documentation

enum AdornedRulerPanel::MenuChoice
strongprivate
Enumerator
QuickPlay 
Scrub 

Definition at line 98 of file AdornedRulerPanel.h.

98 { QuickPlay, Scrub };

Constructor & Destructor Documentation

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

Definition at line 840 of file AdornedRulerPanel.cpp.

References _(), AudacityProject::GetTracks(), gPrefs, mButtons, mesNone, mIndTime, mIsDragging, mIsRecording, mIsSnapped, mLeftDownClick, mLeftOffset, mMouseEventState, mOldPlayRegionEnd, mOldPlayRegionStart, mOuter, mPlayRegionDragsSelection, mPlayRegionEnd, mPlayRegionLock, mPlayRegionStart, mQPCell, mQuickPlayEnabled, mRuler, mScrubbingCell, mTimelineToolTip, mTracks, CellularPanel::mViewInfo, OnRecordStartStop(), Ruler::SetFormat(), Ruler::SetLabelEdges(), Ruler::SetUseZoomInfo(), and Ruler::TimeFormat.

846 : CellularPanel(parent, id, pos, size, viewinfo)
847 , mProject(project)
848 {
849  mQPCell = std::make_shared<QPCell>( this );
850  mScrubbingCell = std::make_shared<ScrubbingCell>( this );
851 
852  for (auto &button : mButtons)
853  button = nullptr;
854 
855  SetLabel( _("Timeline") );
856  SetName(GetLabel());
857  SetBackgroundStyle(wxBG_STYLE_PAINT);
858 
859  mLeftOffset = 0;
860  mIndTime = -1;
861 
862  mPlayRegionStart = -1;
863  mPlayRegionLock = false;
864  mPlayRegionEnd = -1;
865  mOldPlayRegionStart = -1;
866  mOldPlayRegionEnd = -1;
867  mLeftDownClick = -1;
869  mIsDragging = false;
870 
871  mOuter = GetClientRect();
872 
874  mRuler.SetLabelEdges( false );
876 
877  mTracks = project->GetTracks();
878 
879  mIsSnapped = false;
880 
881  mIsRecording = false;
882 
883  mTimelineToolTip = !!gPrefs->Read(wxT("/QuickPlay/ToolTips"), 1L);
884  mPlayRegionDragsSelection = (gPrefs->Read(wxT("/QuickPlay/DragSelection"), 0L) == 1)? true : false;
885  mQuickPlayEnabled = !!gPrefs->Read(wxT("/QuickPlay/QuickPlayEnabled"), 1L);
886 
887 #if wxUSE_TOOLTIPS
888  wxToolTip::Enable(true);
889 #endif
890 
891  wxTheApp->Bind(EVT_AUDIOIO_CAPTURE,
893  this);
894 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
ViewInfo * mViewInfo
std::shared_ptr< ScrubbingCell > mScrubbingCell
MouseEventState mMouseEventState
CellularPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, ViewInfo *viewInfo, long style=wxTAB_TRAVERSAL|wxNO_BORDER)
void SetLabelEdges(bool labelEdges)
Definition: Ruler.cpp:230
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
AudacityProject *const mProject
void SetFormat(RulerFormat format)
Definition: Ruler.cpp:144
void OnRecordStartStop(wxCommandEvent &evt)
void SetUseZoomInfo(int leftOffset, const ZoomInfo *zoomInfo)
Definition: Ruler.cpp:1568
wxWindow * mButtons[3]
TrackList * GetTracks()
Definition: Project.h:209
std::shared_ptr< QPCell > mQPCell
AdornedRulerPanel::~AdornedRulerPanel ( )

Definition at line 896 of file AdornedRulerPanel.cpp.

897 {
898 }

Member Function Documentation

void AdornedRulerPanel::ClearPlayRegion ( )

Definition at line 2066 of file AdornedRulerPanel.cpp.

References AudacityProject::GetControlToolBar(), mPlayRegionEnd, mPlayRegionStart, mProject, and ControlToolBar::StopPlaying().

Referenced by HandleQPRelease().

2067 {
2069  ctb->StopPlaying();
2070 
2071  mPlayRegionStart = -1;
2072  mPlayRegionEnd = -1;
2073 
2074  Refresh();
2075 }
A ToolBar that has the main Transport buttons.
void StopPlaying(bool stopStream=true)
AudacityProject *const mProject
ControlToolBar * GetControlToolBar()
Definition: Project.cpp:4824
void AdornedRulerPanel::CreateOverlays ( )
private

Definition at line 2176 of file AdornedRulerPanel.cpp.

References mOverlay, and mProject.

Referenced by AdornedRulerPanel::QPCell::HitTest(), and AdornedRulerPanel::ScrubbingCell::HitTest().

2177 {
2178  if (!mOverlay)
2179  mOverlay =
2180  std::make_unique<QuickPlayIndicatorOverlay>( mProject );
2181 }
std::unique_ptr< QuickPlayIndicatorOverlay > mOverlay
AudacityProject *const mProject
void AdornedRulerPanel::DoDrawBackground ( wxDC *  dc)
private

Definition at line 1891 of file AdornedRulerPanel.cpp.

References mInner, mScrubZone, mShowScrubbing, and AColor::UseThemeColour().

Referenced by OnPaint().

1892 {
1893  // Draw AdornedRulerPanel border
1894  AColor::UseThemeColour( dc, clrTrackInfo );
1895  dc->DrawRectangle( mInner );
1896 
1897  if (mShowScrubbing) {
1898  // Let's distinguish the scrubbing area by using a themable
1899  // colour and a line to set it off.
1900  AColor::UseThemeColour(dc, clrScrubRuler, clrTrackPanelText );
1901  wxRect ScrubRect = mScrubZone;
1902  ScrubRect.Inflate( 1,0 );
1903  dc->DrawRectangle(ScrubRect);
1904  }
1905 }
static void UseThemeColour(wxDC *dc, int iBrush, int iPen=-1)
Definition: AColor.cpp:289
void AdornedRulerPanel::DoDrawEdge ( wxDC *  dc)
private

Definition at line 1907 of file AdornedRulerPanel.cpp.

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

Referenced by OnPaint().

1908 {
1909  wxRect r = mOuter;
1910  r.width -= RightMargin;
1911  r.height -= BottomMargin;
1912  AColor::BevelTrackInfo( *dc, true, r );
1913 
1914  // Black stroke at bottom
1915  dc->SetPen( *wxBLACK_PEN );
1916  dc->DrawLine( mOuter.x,
1917  mOuter.y + mOuter.height - 1,
1918  mOuter.x + mOuter.width,
1919  mOuter.y + mOuter.height - 1 );
1920 }
static void BevelTrackInfo(wxDC &dc, bool up, const wxRect &r, bool highlight=false)
Definition: AColor.cpp:262
void AdornedRulerPanel::DoDrawIndicator ( wxDC *  dc,
wxCoord  xx,
bool  playing,
int  width,
bool  scrub,
bool  seek 
)

Definition at line 1969 of file AdornedRulerPanel.cpp.

References ThemeBase::Bitmap(), AColor::IndicatorColor(), IndicatorHeightForWidth(), IndicatorOffset, ControlToolBar::IsTransportingPinned(), and theTheme.

1970 {
1971  ADCChanger changer(dc); // Undo pen and brush changes at function exit
1972 
1973  AColor::IndicatorColor( dc, playing );
1974 
1975  wxPoint tri[ 3 ];
1976  if (seek) {
1977  auto height = IndicatorHeightForWidth(width);
1978  // Make four triangles
1979  const int TriangleWidth = width * 3 / 8;
1980 
1981  // Double-double headed, left-right
1982  auto yy = mShowScrubbing
1983  ? mScrubZone.y
1984  : (mInner.GetBottom() + 1) - 1 /* bevel */ - height;
1985  tri[ 0 ].x = xx - IndicatorOffset;
1986  tri[ 0 ].y = yy;
1987  tri[ 1 ].x = xx - IndicatorOffset;
1988  tri[ 1 ].y = yy + height;
1989  tri[ 2 ].x = xx - TriangleWidth;
1990  tri[ 2 ].y = yy + height / 2;
1991  dc->DrawPolygon( 3, tri );
1992 
1993  tri[ 0 ].x -= TriangleWidth;
1994  tri[ 1 ].x -= TriangleWidth;
1995  tri[ 2 ].x -= TriangleWidth;
1996  dc->DrawPolygon( 3, tri );
1997 
1998  tri[ 0 ].x = tri[ 1 ].x = xx + IndicatorOffset;
1999  tri[ 2 ].x = xx + TriangleWidth;
2000  dc->DrawPolygon( 3, tri );
2001 
2002 
2003  tri[ 0 ].x += TriangleWidth;
2004  tri[ 1 ].x += TriangleWidth;
2005  tri[ 2 ].x += TriangleWidth;
2006  dc->DrawPolygon( 3, tri );
2007  }
2008  else if (scrub) {
2009  auto height = IndicatorHeightForWidth(width);
2010  const int IndicatorHalfWidth = width / 2;
2011 
2012  // Double headed, left-right
2013  auto yy = mShowScrubbing
2014  ? mScrubZone.y
2015  : (mInner.GetBottom() + 1) - 1 /* bevel */ - height;
2016  tri[ 0 ].x = xx - IndicatorOffset;
2017  tri[ 0 ].y = yy;
2018  tri[ 1 ].x = xx - IndicatorOffset;
2019  tri[ 1 ].y = yy + height;
2020  tri[ 2 ].x = xx - IndicatorHalfWidth;
2021  tri[ 2 ].y = yy + height / 2;
2022  dc->DrawPolygon( 3, tri );
2023  tri[ 0 ].x = tri[ 1 ].x = xx + IndicatorOffset;
2024  tri[ 2 ].x = xx + IndicatorHalfWidth;
2025  dc->DrawPolygon( 3, tri );
2026  }
2027  else {
2028  bool pinned = ControlToolBar::IsTransportingPinned();
2029  wxBitmap & bmp = theTheme.Bitmap( pinned ?
2030  (playing ? bmpPlayPointerPinned : bmpRecordPointerPinned) :
2031  (playing ? bmpPlayPointer : bmpRecordPointer)
2032  );
2033  const int IndicatorHalfWidth = bmp.GetWidth() / 2;
2034  dc->DrawBitmap( bmp, xx - IndicatorHalfWidth -1, mInner.y );
2035 #if 0
2036 
2037  // Down pointing triangle
2038  auto height = IndicatorHeightForWidth(width);
2039  const int IndicatorHalfWidth = width / 2;
2040  tri[ 0 ].x = xx - IndicatorHalfWidth;
2041  tri[ 0 ].y = mInner.y;
2042  tri[ 1 ].x = xx + IndicatorHalfWidth;
2043  tri[ 1 ].y = mInner.y;
2044  tri[ 2 ].x = xx;
2045  tri[ 2 ].y = mInner.y + height;
2046  dc->DrawPolygon( 3, tri );
2047 #endif
2048  }
2049 }
int IndicatorHeightForWidth(int width)
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:209
static void IndicatorColor(wxDC *dc, bool bIsNotRecording)
Definition: AColor.cpp:367
wxBitmap & Bitmap(int iIndex)
Definition: Theme.cpp:1244
Makes temporary drawing context changes that you back out of, RAII style.
Definition: AColor.h:42
static bool IsTransportingPinned()
void AdornedRulerPanel::DoDrawMarks ( wxDC *  dc,
bool   
)
private

Definition at line 1922 of file AdornedRulerPanel.cpp.

References ThemeBase::Colour(), Ruler::Draw(), min(), mInner, mRuler, Pos2Time(), Ruler::SetRange(), Ruler::SetTickColour(), and theTheme.

Referenced by OnPaint().

1923 {
1924  const double min = Pos2Time(0);
1925  const double hiddenMin = Pos2Time(0, true);
1926  const double max = Pos2Time(mInner.width);
1927  const double hiddenMax = Pos2Time(mInner.width, true);
1928 
1929  mRuler.SetTickColour( theTheme.Colour( clrTrackPanelText ) );
1930  mRuler.SetRange( min, max, hiddenMin, hiddenMax );
1931  mRuler.Draw( *dc );
1932 }
void Draw(wxDC &dc)
Definition: Ruler.cpp:1285
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:209
int min(int a, int b)
void SetRange(double min, double max)
Definition: Ruler.cpp:192
void SetTickColour(const wxColour &colour)
Definition: Ruler.h:149
wxColour & Colour(int iIndex)
Definition: Theme.cpp:1225
double Pos2Time(int p, bool ignoreFisheye=false)
void AdornedRulerPanel::DoDrawPlayRegion ( wxDC *  dc)
private

Definition at line 1814 of file AdornedRulerPanel.cpp.

References GetPlayRegion(), AudacityProject::IsPlayRegionLocked(), mInner, mProject, PLAY_REGION_GLOBAL_OFFSET_Y, PLAY_REGION_RECT_HEIGHT, PLAY_REGION_RECT_WIDTH, PLAY_REGION_TRIANGLE_SIZE, AColor::PlayRegionColor(), Time2Pos(), and TopMargin.

Referenced by OnPaint().

1815 {
1816  double start, end;
1817  GetPlayRegion(&start, &end);
1818 
1819  if (start >= 0)
1820  {
1821  const int x1 = Time2Pos(start);
1822  const int x2 = Time2Pos(end)-2;
1823  int y = mInner.y - TopMargin + mInner.height/2;
1824 
1825  bool isLocked = mProject->IsPlayRegionLocked();
1826  AColor::PlayRegionColor(dc, isLocked);
1827 
1828  wxPoint tri[3];
1829  wxRect r;
1830 
1831  tri[0].x = x1;
1832  tri[0].y = y + PLAY_REGION_GLOBAL_OFFSET_Y;
1833  tri[1].x = x1 + PLAY_REGION_TRIANGLE_SIZE;
1834  tri[1].y = y - PLAY_REGION_TRIANGLE_SIZE + PLAY_REGION_GLOBAL_OFFSET_Y;
1835  tri[2].x = x1 + PLAY_REGION_TRIANGLE_SIZE;
1836  tri[2].y = y + PLAY_REGION_TRIANGLE_SIZE + PLAY_REGION_GLOBAL_OFFSET_Y;
1837  dc->DrawPolygon(3, tri);
1838 
1839  r.x = x1;
1840  r.y = y - PLAY_REGION_TRIANGLE_SIZE + PLAY_REGION_GLOBAL_OFFSET_Y;
1841  r.width = PLAY_REGION_RECT_WIDTH;
1842  r.height = PLAY_REGION_TRIANGLE_SIZE*2 + 1;
1843  dc->DrawRectangle(r);
1844 
1845  if (end != start)
1846  {
1847  tri[0].x = x2;
1848  tri[0].y = y + PLAY_REGION_GLOBAL_OFFSET_Y;
1849  tri[1].x = x2 - PLAY_REGION_TRIANGLE_SIZE;
1850  tri[1].y = y - PLAY_REGION_TRIANGLE_SIZE + PLAY_REGION_GLOBAL_OFFSET_Y;
1851  tri[2].x = x2 - PLAY_REGION_TRIANGLE_SIZE;
1852  tri[2].y = y + PLAY_REGION_TRIANGLE_SIZE + PLAY_REGION_GLOBAL_OFFSET_Y;
1853  dc->DrawPolygon(3, tri);
1854 
1855  r.x = x2 - PLAY_REGION_RECT_WIDTH + 1;
1856  r.y = y - PLAY_REGION_TRIANGLE_SIZE + PLAY_REGION_GLOBAL_OFFSET_Y;
1857  r.width = PLAY_REGION_RECT_WIDTH;
1858  r.height = PLAY_REGION_TRIANGLE_SIZE*2 + 1;
1859  dc->DrawRectangle(r);
1860 
1861  r.x = x1 + PLAY_REGION_TRIANGLE_SIZE;
1863  r.width = std::max(0, x2-x1 - PLAY_REGION_TRIANGLE_SIZE*2);
1864  r.height = PLAY_REGION_RECT_HEIGHT;
1865  dc->DrawRectangle(r);
1866  }
1867  }
1868 }
static void PlayRegionColor(wxDC *dc, bool locked)
Definition: AColor.cpp:376
#define PLAY_REGION_RECT_HEIGHT
#define PLAY_REGION_TRIANGLE_SIZE
#define PLAY_REGION_RECT_WIDTH
int Time2Pos(double t, bool ignoreFisheye=false)
AudacityProject *const mProject
#define PLAY_REGION_GLOBAL_OFFSET_Y
bool IsPlayRegionLocked()
Definition: Project.h:228
void GetPlayRegion(double *playRegionStart, double *playRegionEnd)
void AdornedRulerPanel::DoDrawSelection ( wxDC *  dc)
private

Definition at line 1939 of file AdornedRulerPanel.cpp.

References ThemeBase::Colour(), min(), mInner, CellularPanel::mViewInfo, ViewInfo::selectedRegion, SelectedRegion::t0(), SelectedRegion::t1(), theTheme, and Time2Pos().

Referenced by OnPaint().

1940 {
1941  // Draw selection
1942  const int p0 = max(1, Time2Pos(mViewInfo->selectedRegion.t0()));
1943  const int p1 = min(mInner.width, Time2Pos(mViewInfo->selectedRegion.t1()));
1944 
1945  dc->SetBrush( wxBrush( theTheme.Colour( clrRulerBackground )) );
1946  dc->SetPen( wxPen( theTheme.Colour( clrRulerBackground )) );
1947 
1948  wxRect r;
1949  r.x = p0;
1950  r.y = mInner.y;
1951  r.width = p1 - p0 - 1;
1952  r.height = mInner.height;
1953  dc->DrawRectangle( r );
1954 }
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:209
ViewInfo * mViewInfo
double t0() const
SelectedRegion selectedRegion
Definition: ViewInfo.h:162
double t1() const
int min(int a, int b)
int Time2Pos(double t, bool ignoreFisheye=false)
wxColour & Colour(int iIndex)
Definition: Theme.cpp:1225
void AdornedRulerPanel::DragSelection ( )
private

Definition at line 1765 of file AdornedRulerPanel.cpp.

References mPlayRegionEnd, mPlayRegionStart, CellularPanel::mViewInfo, ViewInfo::selectedRegion, SelectedRegion::setT0(), and SelectedRegion::setT1().

Referenced by HandleQPDrag().

1766 {
1769 }
ViewInfo * mViewInfo
SelectedRegion selectedRegion
Definition: ViewInfo.h:162
bool setT1(double t, bool maySwap=true)
bool setT0(double t, bool maySwap=true)
void AdornedRulerPanel::DrawBothOverlays ( )

Definition at line 1631 of file AdornedRulerPanel.cpp.

References OverlayPanel::DrawOverlays(), AudacityProject::GetTrackPanel(), and mProject.

Referenced by ControlToolBar::PlayPlayRegion(), ProcessUIHandleResult(), and Scrubber::StopScrubbing().

1632 {
1633  mProject->GetTrackPanel()->DrawOverlays( false );
1634  DrawOverlays( false );
1635 }
void DrawOverlays(bool repaint_all, wxDC *pDC=nullptr)
AudacityProject *const mProject
TrackPanel * GetTrackPanel()
Definition: Project.h:324
void AdornedRulerPanel::DrawSelection ( )

Definition at line 1934 of file AdornedRulerPanel.cpp.

Referenced by TrackPanel::UpdateSelectionDisplay().

1935 {
1936  Refresh();
1937 }
TrackPanelCell * AdornedRulerPanel::GetFocusedCell ( )
overrideprivatevirtual

Implements CellularPanel.

Definition at line 2144 of file AdornedRulerPanel.cpp.

References mQPCell.

2145 {
2146  // No switching of focus yet to the other, scrub zone
2147  return mQPCell.get();
2148 }
std::shared_ptr< QPCell > mQPCell
wxRect AdornedRulerPanel::GetInnerRect ( ) const
inline

Definition at line 47 of file AdornedRulerPanel.h.

47 { return mInner; }
void AdornedRulerPanel::GetMaxSize ( wxCoord *  width,
wxCoord *  height 
)

Definition at line 2093 of file AdornedRulerPanel.cpp.

References Ruler::GetMaxSize(), and mRuler.

2094 {
2095  mRuler.GetMaxSize(width, height);
2096 }
void GetMaxSize(wxCoord *width, wxCoord *height)
Definition: Ruler.cpp:1511
void AdornedRulerPanel::GetPlayRegion ( double *  playRegionStart,
double *  playRegionEnd 
)

Definition at line 2077 of file AdornedRulerPanel.cpp.

References mPlayRegionEnd, and mPlayRegionStart.

Referenced by DoDrawPlayRegion(), and AudacityProject::GetPlayRegion().

2079 {
2080  if (mPlayRegionStart >= 0 && mPlayRegionEnd >= 0 &&
2082  {
2083  // swap values to make sure end > start
2084  *playRegionStart = mPlayRegionEnd;
2085  *playRegionEnd = mPlayRegionStart;
2086  } else
2087  {
2088  *playRegionStart = mPlayRegionStart;
2089  *playRegionEnd = mPlayRegionEnd;
2090  }
2091 }
AudacityProject * AdornedRulerPanel::GetProject ( ) const
overridevirtual

Implements CellularPanel.

Definition at line 2138 of file AdornedRulerPanel.cpp.

References mProject.

Referenced by UpdateStatusMessage().

2139 {
2140  return mProject;
2141 }
AudacityProject *const mProject
int AdornedRulerPanel::GetRulerHeight ( )
inline
int AdornedRulerPanel::GetRulerHeight ( bool  showScrubBar)
static

Definition at line 1956 of file AdornedRulerPanel.cpp.

References ProperRulerHeight, and ScrubHeight.

1957 {
1958  return ProperRulerHeight + (showScrubBar ? ScrubHeight : 0);
1959 }
void AdornedRulerPanel::HandleQPClick ( wxMouseEvent &  event,
wxCoord  mousePosX 
)
private

Definition at line 1255 of file AdornedRulerPanel.cpp.

References TransportActions::DoUnlockPlayRegion(), IsWithinMarker(), mesDraggingPlayRegionEnd, mesDraggingPlayRegionStart, mesSelectingPlayRegionClick, mLeftDownClick, mLeftDownClickUnsnapped, mMouseEventState, mOldPlayRegionEnd, mOldPlayRegionStart, mPlayRegionEnd, mPlayRegionLock, mPlayRegionStart, mProject, mQuickPlayPos, mQuickPlayPosUnsnapped, and Time2Pos().

Referenced by AdornedRulerPanel::QPHandle::Click().

1256 {
1257  // Temporarily unlock locked play region
1258  if (mPlayRegionLock && evt.LeftDown()) {
1259  //mPlayRegionLock = true;
1261  }
1262 
1265  bool isWithinStart = IsWithinMarker(mousePosX, mOldPlayRegionStart);
1266  bool isWithinEnd = IsWithinMarker(mousePosX, mOldPlayRegionEnd);
1267 
1268  if (isWithinStart || isWithinEnd) {
1269  // If Quick-Play is playing from a point, we need to treat it as a click
1270  // not as dragging.
1273  // otherwise check which marker is nearer
1274  else {
1275  // Don't compare times, compare positions.
1276  //if (fabs(mQuickPlayPos - mPlayRegionStart) < fabs(mQuickPlayPos - mPlayRegionEnd))
1280  else
1282  }
1283  }
1284  else {
1285  // Clicked but not yet dragging
1287  }
1288 }
void DoUnlockPlayRegion(AudacityProject &project)
MouseEventState mMouseEventState
bool IsWithinMarker(int mousePosX, double markerTime)
int Time2Pos(double t, bool ignoreFisheye=false)
AudacityProject *const mProject
void AdornedRulerPanel::HandleQPDrag ( wxMouseEvent &  event,
wxCoord  mousePosX 
)
private

Definition at line 1306 of file AdornedRulerPanel.cpp.

References DragSelection(), IsWithinMarker(), mesDraggingPlayRegionEnd, mesDraggingPlayRegionStart, mesNone, mesSelectingPlayRegionClick, mesSelectingPlayRegionRange, mIsDragging, mLeftDownClick, mLeftDownClickUnsnapped, mMouseEventState, mOldPlayRegionEnd, mOldPlayRegionStart, mPlayRegionDragsSelection, mPlayRegionEnd, mPlayRegionLock, mPlayRegionStart, and mQuickPlayPos.

Referenced by AdornedRulerPanel::QPHandle::Click(), and AdornedRulerPanel::QPHandle::Drag().

1307 {
1308  bool isWithinClick =
1309  (mLeftDownClickUnsnapped >= 0) &&
1311  bool isWithinStart = IsWithinMarker(mousePosX, mOldPlayRegionStart);
1312  bool isWithinEnd = IsWithinMarker(mousePosX, mOldPlayRegionEnd);
1313  bool canDragSel = !mPlayRegionLock && mPlayRegionDragsSelection;
1314 
1315  switch (mMouseEventState)
1316  {
1317  case mesNone:
1318  // If close to either end of play region, snap to closest
1319  if (isWithinStart || isWithinEnd) {
1322  else
1324  }
1325  break;
1327  // Don't start dragging until beyond tolerance initial playback start
1328  if (!mIsDragging && isWithinStart)
1330  else
1331  mIsDragging = true;
1332  // avoid accidental tiny selection
1333  if (isWithinEnd)
1336  if (canDragSel) {
1337  DragSelection();
1338  }
1339  break;
1341  if (!mIsDragging && isWithinEnd) {
1343  }
1344  else
1345  mIsDragging = true;
1346  if (isWithinStart) {
1348  }
1350  if (canDragSel) {
1351  DragSelection();
1352  }
1353  break;
1355 
1356  // Don't start dragging until mouse is beyond tolerance of initial click.
1357  if (isWithinClick || mLeftDownClick == -1) {
1361  }
1362  else {
1364  }
1365  break;
1367  if (isWithinClick) {
1369  }
1370 
1371  if (mQuickPlayPos < mLeftDownClick) {
1374  }
1375  else {
1378  }
1379  if (canDragSel) {
1380  DragSelection();
1381  }
1382  break;
1383  }
1384  Refresh();
1385  Update();
1386 }
MouseEventState mMouseEventState
bool IsWithinMarker(int mousePosX, double markerTime)
void AdornedRulerPanel::HandleQPRelease ( wxMouseEvent &  event)
private

Definition at line 1468 of file AdornedRulerPanel.cpp.

References ClearPlayRegion(), TransportActions::DoLockPlayRegion(), TrackList::GetEndTime(), AudacityProject::GetSel0(), AudacityProject::GetSel1(), TrackList::GetStartTime(), mesNone, mIsDragging, mLeftDownClick, mMouseEventState, mOldPlayRegionEnd, mOldPlayRegionStart, mPlayRegionEnd, mPlayRegionLock, mPlayRegionStart, mProject, mTracks, SetPlayRegion(), and StartQPPlay().

Referenced by AdornedRulerPanel::QPHandle::Release().

1469 {
1471  // Swap values to ensure mPlayRegionStart < mPlayRegionEnd
1472  double tmp = mPlayRegionStart;
1474  mPlayRegionEnd = tmp;
1475  }
1476 
1477  const double t0 = mTracks->GetStartTime();
1478  const double t1 = mTracks->GetEndTime();
1479  const double sel0 = mProject->GetSel0();
1480  const double sel1 = mProject->GetSel1();
1481 
1482  // We want some audio in the selection, but we allow a dragged
1483  // region to include selected white-space and space before audio start.
1484  if (evt.ShiftDown() && (mPlayRegionStart == mPlayRegionEnd)) {
1485  // Looping the selection or project.
1486  // Disable if track selection is in white-space beyond end of tracks and
1487  // play position is outside of track contents.
1488  if (((sel1 < t0) || (sel0 > t1)) &&
1489  ((mPlayRegionStart < t0) || (mPlayRegionStart > t1))) {
1490  ClearPlayRegion();
1491  }
1492  }
1493  // Disable if beyond end.
1494  else if (mPlayRegionStart >= t1) {
1495  ClearPlayRegion();
1496  }
1497  // Disable if empty selection before start.
1498  // (allow Quick-Play region to include 'pre-roll' white space)
1499  else if (((mPlayRegionEnd - mPlayRegionStart) > 0.0) && (mPlayRegionEnd < t0)) {
1500  ClearPlayRegion();
1501  }
1502 
1504  mIsDragging = false;
1505  mLeftDownClick = -1;
1506 
1507  auto cleanup = finally( [&] {
1508  if (mPlayRegionLock) {
1509  // Restore Locked Play region
1512  // and release local lock
1513  mPlayRegionLock = false;
1514  }
1515  } );
1516 
1517  StartQPPlay(evt.ShiftDown(), evt.ControlDown());
1518 }
double GetSel0() const
Definition: Project.h:221
double GetStartTime() const
Definition: Track.cpp:1226
double GetEndTime() const
Definition: Track.cpp:1231
MouseEventState mMouseEventState
void StartQPPlay(bool looped, bool cutPreview)
void SetPlayRegion(double playRegionStart, double playRegionEnd)
void DoLockPlayRegion(AudacityProject &project)
AudacityProject *const mProject
double GetSel1() const
Definition: Project.h:222
void AdornedRulerPanel::HandleSnapping ( )
private

Definition at line 1771 of file AdornedRulerPanel.cpp.

References mIsSnapped, mQPCell, mQuickPlayPos, mTracks, and CellularPanel::mViewInfo.

Referenced by UpdateQuickPlayPos().

1772 {
1773  auto handle = mQPCell->mHolder.lock();
1774  if (handle) {
1775  auto &pSnapManager = handle->mSnapManager;
1776  if (! pSnapManager)
1777  pSnapManager = std::make_unique<SnapManager>(mTracks, mViewInfo);
1778 
1779  auto results = pSnapManager->Snap(NULL, mQuickPlayPos, false);
1780  mQuickPlayPos = results.outTime;
1781  mIsSnapped = results.Snapped();
1782  }
1783 }
ViewInfo * mViewInfo
std::shared_ptr< QPCell > mQPCell
void AdornedRulerPanel::InvalidateRuler ( )

Definition at line 1017 of file AdornedRulerPanel.cpp.

References Ruler::Invalidate(), and mRuler.

1018 {
1019  mRuler.Invalidate();
1020 }
void Invalidate()
Definition: Ruler.cpp:327
bool AdornedRulerPanel::IsWithinMarker ( int  mousePosX,
double  markerTime 
)
private

Definition at line 1211 of file AdornedRulerPanel.cpp.

References SELECT_TOLERANCE_PIXEL, and Time2Pos().

Referenced by HandleQPClick(), HandleQPDrag(), and AdornedRulerPanel::QPHandle::Preview().

1212 {
1213  if (markerTime < 0)
1214  return false;
1215 
1216  int pixelPos = Time2Pos(markerTime);
1217  int boundLeft = pixelPos - SELECT_TOLERANCE_PIXEL;
1218  int boundRight = pixelPos + SELECT_TOLERANCE_PIXEL;
1219 
1220  return mousePosX >= boundLeft && mousePosX < boundRight;
1221 }
#define SELECT_TOLERANCE_PIXEL
int Time2Pos(double t, bool ignoreFisheye=false)
void AdornedRulerPanel::OnAutoScroll ( wxCommandEvent &  evt)
private

Definition at line 1793 of file AdornedRulerPanel.cpp.

References ViewInfo::bUpdateTrackIndicator, gPrefs, mProject, CellularPanel::mViewInfo, and AudacityProject::UpdatePrefs().

1794 {
1796  gPrefs->Write(wxT("/GUI/AutoScroll"), false);
1797  else
1798  gPrefs->Write(wxT("/GUI/AutoScroll"), true);
1799  mProject->UpdatePrefs();
1800  gPrefs->Flush();
1801 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
ViewInfo * mViewInfo
bool bUpdateTrackIndicator
Definition: ViewInfo.h:184
void UpdatePrefs()
Definition: Project.cpp:1427
AudacityProject *const mProject
void AdornedRulerPanel::OnLockPlayRegion ( wxCommandEvent &  evt)
private

Definition at line 1804 of file AdornedRulerPanel.cpp.

References TransportActions::DoLockPlayRegion(), TransportActions::DoUnlockPlayRegion(), AudacityProject::IsPlayRegionLocked(), and mProject.

1805 {
1808  else
1810 }
void DoUnlockPlayRegion(AudacityProject &project)
void DoLockPlayRegion(AudacityProject &project)
AudacityProject *const mProject
bool IsPlayRegionLocked()
Definition: Project.h:228
void AdornedRulerPanel::OnPaint ( wxPaintEvent &  evt)
private

Definition at line 1101 of file AdornedRulerPanel.cpp.

References BackedPanel::DisplayBitmap(), DoDrawBackground(), DoDrawEdge(), DoDrawMarks(), DoDrawPlayRegion(), DoDrawSelection(), OverlayPanel::DrawOverlays(), BackedPanel::GetBackingDCForRepaint(), SelectedRegion::isPoint(), mNeedButtonUpdate, CellularPanel::mViewInfo, ReCreateButtons(), ViewInfo::selectedRegion, and UpdatePrefs().

1102 {
1103  if (mNeedButtonUpdate) {
1104  // Visit this block once only in the lifetime of this panel
1105  mNeedButtonUpdate = false;
1106  // Do this first time setting of button status texts
1107  // when we are sure the CommandManager is initialized.
1108  ReCreateButtons();
1109  // Sends a resize event, which will cause a second paint.
1110  UpdatePrefs();
1111  }
1112 
1113  wxPaintDC dc(this);
1114 
1115  auto &backDC = GetBackingDCForRepaint();
1116 
1117  DoDrawBackground(&backDC);
1118 
1120  {
1121  DoDrawSelection(&backDC);
1122  }
1123 
1124  DoDrawMarks(&backDC, true);
1125 
1126  DoDrawPlayRegion(&backDC);
1127 
1128  DoDrawEdge(&backDC);
1129 
1130  DisplayBitmap(dc);
1131 
1132  // Stroke extras direct to the client area,
1133  // maybe outside of the damaged area
1134  // As with TrackPanel, do not make a NEW wxClientDC or else Mac flashes badly!
1135  dc.DestroyClippingRegion();
1136  DrawOverlays(true, &dc);
1137 }
ViewInfo * mViewInfo
bool isPoint() const
SelectedRegion selectedRegion
Definition: ViewInfo.h:162
void DoDrawEdge(wxDC *dc)
void DoDrawMarks(wxDC *dc, bool)
void DoDrawBackground(wxDC *dc)
void DisplayBitmap(wxDC &dc)
Definition: BackedPanel.cpp:65
void DrawOverlays(bool repaint_all, wxDC *pDC=nullptr)
wxDC & GetBackingDCForRepaint()
Definition: BackedPanel.cpp:35
void DoDrawPlayRegion(wxDC *dc)
void DoDrawSelection(wxDC *dc)
void AdornedRulerPanel::OnRecordStartStop ( wxCommandEvent &  evt)
private

Definition at line 1081 of file AdornedRulerPanel.cpp.

References CellularPanel::CancelDragging(), CellularPanel::ClearTargets(), mIsRecording, RegenerateTooltips(), and UpdateButtonStates().

Referenced by AdornedRulerPanel().

1082 {
1083  evt.Skip();
1084 
1085  if (evt.GetInt() != 0)
1086  {
1087  mIsRecording = true;
1088  this->CellularPanel::CancelDragging( false );
1090 
1092  }
1093  else {
1094  mIsRecording = false;
1096  }
1097 
1099 }
bool CancelDragging(bool escaping)
void AdornedRulerPanel::OnSize ( wxSizeEvent &  evt)
private

Definition at line 1139 of file AdornedRulerPanel.cpp.

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

1140 {
1141  mOuter = GetClientRect();
1142  if (mOuter.GetWidth() == 0 || mOuter.GetHeight() == 0)
1143  {
1144  return;
1145  }
1146 
1147  UpdateRects();
1148 
1149  OverlayPanel::OnSize(evt);
1150 }
void OnSize(wxSizeEvent &event)
Definition: BackedPanel.cpp:71
void AdornedRulerPanel::OnSyncSelToQuickPlay ( wxCommandEvent &  evt)
private

Definition at line 1758 of file AdornedRulerPanel.cpp.

References gPrefs, and mPlayRegionDragsSelection.

1759 {
1761  gPrefs->Write(wxT("/QuickPlay/DragSelection"), mPlayRegionDragsSelection);
1762  gPrefs->Flush();
1763 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
void AdornedRulerPanel::OnTimelineToolTips ( wxCommandEvent &  evt)
private

Definition at line 1785 of file AdornedRulerPanel.cpp.

References gPrefs, mTimelineToolTip, and RegenerateTooltips().

1786 {
1787  mTimelineToolTip = (mTimelineToolTip)? false : true;
1788  gPrefs->Write(wxT("/QuickPlay/ToolTips"), mTimelineToolTip);
1789  gPrefs->Flush();
1791 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
void AdornedRulerPanel::OnTogglePinnedState ( wxCommandEvent &  event)
private

Definition at line 1667 of file AdornedRulerPanel.cpp.

References TransportActions::DoTogglePinnedHead(), mProject, and UpdateButtonStates().

1668 {
1671 }
AudacityProject *const mProject
void DoTogglePinnedHead(AudacityProject &project)
void AdornedRulerPanel::OnToggleQuickPlay ( wxCommandEvent &  evt)
private

Definition at line 1750 of file AdornedRulerPanel.cpp.

References gPrefs, mQuickPlayEnabled, and RegenerateTooltips().

1751 {
1752  mQuickPlayEnabled = (mQuickPlayEnabled)? false : true;
1753  gPrefs->Write(wxT("/QuickPlay/QuickPlayEnabled"), mQuickPlayEnabled);
1754  gPrefs->Flush();
1756 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
void AdornedRulerPanel::OnToggleScrubRuler ( )

Definition at line 1615 of file AdornedRulerPanel.cpp.

References gPrefs, mShowScrubbing, and SetPanelSize().

Referenced by Scrubber::OnToggleScrubRuler().

1616 {
1618  WriteScrubEnabledPref(mShowScrubbing);
1619  gPrefs->Flush();
1620  SetPanelSize();
1621 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
void AdornedRulerPanel::OnToggleScrubRulerFromMenu ( wxCommandEvent &  )

Definition at line 1609 of file AdornedRulerPanel.cpp.

References AudacityProject::GetScrubber(), mProject, and Scrubber::OnToggleScrubRuler().

1610 {
1611  auto &scrubber = mProject->GetScrubber();
1612  scrubber.OnToggleScrubRuler(*mProject);
1613 }
Scrubber & GetScrubber()
Definition: Project.h:786
void OnToggleScrubRuler(const CommandContext &)
Definition: Scrubbing.cpp:1081
AudacityProject *const mProject
double AdornedRulerPanel::Pos2Time ( int  p,
bool  ignoreFisheye = false 
)
private

Definition at line 1196 of file AdornedRulerPanel.cpp.

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

Referenced by DoDrawMarks(), and UpdateQuickPlayPos().

1197 {
1199  , ignoreFisheye
1200  );
1201 }
ViewInfo * mViewInfo
double PositionToTime(wxInt64 position, wxInt64 origin=0, bool ignoreFisheye=false) const
Definition: ViewInfo.cpp:49
void AdornedRulerPanel::ProcessUIHandleResult ( TrackPanelCell pClickedTrack,
TrackPanelCell pLatestCell,
unsigned  refreshResult 
)
overrideprivatevirtual

Implements CellularPanel.

Definition at line 2157 of file AdornedRulerPanel.cpp.

References DrawBothOverlays(), and RefreshCode::DrawOverlays.

2159 {
2160  (void)pLatestCell;// Compiler food
2161  (void)pClickedTrack;// Compiler food
2162  if (refreshResult & RefreshCode::DrawOverlays)
2163  DrawBothOverlays();
2164 }
void AdornedRulerPanel::ReCreateButtons ( )

Definition at line 943 of file AdornedRulerPanel.cpp.

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

Referenced by Theme::ApplyUpdatedImages(), and OnPaint().

944 {
945  // TODO: Should we do this to destroy the grabber??
946  // Get rid of any children we may have
947  // DestroyChildren();
948 
949  SetBackgroundColour(theTheme.Colour( clrMedium ));
950 
951  for (auto & button : mButtons) {
952  if (button)
953  button->Destroy();
954  button = nullptr;
955  }
956 
957  size_t iButton = 0;
958  // Make the short row of time ruler pushbottons.
959  // Don't bother with sizers. Their sizes and positions are fixed.
960  // Add a grabber converted to a spacer.
961  // This makes it visually clearer that the button is a button.
962 
963  wxPoint position( 1, 0 );
964 
965  Grabber * pGrabber = safenew Grabber(this, this->GetId());
966  pGrabber->SetAsSpacer( true );
967  //pGrabber->SetSize( 10, 27 ); // default is 10,27
968  pGrabber->SetPosition( position );
969 
970  position.x = 12;
971 
972  auto size = theTheme.ImageSize( bmpRecoloredUpSmall );
973  size.y = std::min(size.y, GetRulerHeight(false));
974 
975  auto buttonMaker = [&]
976  (wxWindowID id, teBmps bitmap, bool toggle)
977  {
978  const auto button =
980  this,
981  bmpRecoloredUpSmall, bmpRecoloredDownSmall,
982  bmpRecoloredUpHiliteSmall, bmpRecoloredHiliteSmall,
983  bitmap, bitmap, bitmap,
984  id, position, toggle, size
985  );
986 
987  position.x += size.GetWidth();
988  mButtons[iButton++] = button;
989  return button;
990  };
991  auto button = buttonMaker(OnTogglePinnedStateID, bmpPlayPointerPinned, true);
993  *button, 3,
994  bmpRecoloredUpSmall, bmpRecoloredDownSmall,
995  bmpRecoloredUpHiliteSmall, bmpRecoloredHiliteSmall,
996  //bmpUnpinnedPlayHead, bmpUnpinnedPlayHead, bmpUnpinnedPlayHead,
997  bmpRecordPointer, bmpRecordPointer, bmpRecordPointer,
998  size);
1000  *button, 2,
1001  bmpRecoloredUpSmall, bmpRecoloredDownSmall,
1002  bmpRecoloredUpHiliteSmall, bmpRecoloredHiliteSmall,
1003  //bmpUnpinnedPlayHead, bmpUnpinnedPlayHead, bmpUnpinnedPlayHead,
1004  bmpRecordPointerPinned, bmpRecordPointerPinned, bmpRecordPointerPinned,
1005  size);
1007  *button, 1,
1008  bmpRecoloredUpSmall, bmpRecoloredDownSmall,
1009  bmpRecoloredUpHiliteSmall, bmpRecoloredHiliteSmall,
1010  //bmpUnpinnedPlayHead, bmpUnpinnedPlayHead, bmpUnpinnedPlayHead,
1011  bmpPlayPointer, bmpPlayPointer, bmpPlayPointer,
1012  size);
1013 
1015 }
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:209
int teBmps
Definition: Theme.h:28
wxSize ImageSize(int iIndex)
Definition: Theme.cpp:1257
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:785
#define safenew
Definition: Audacity.h:230
int min(int a, int b)
static void MakeAlternateImages(AButton &button, int idx, teBmps eUp, teBmps eDown, teBmps eHilite, teBmps eDownHi, teBmps eStandardUp, teBmps eStandardDown, teBmps eDisabled, wxSize size)
Definition: ToolBar.cpp:818
void SetAsSpacer(bool bIsSpacer)
Definition: Grabber.cpp:101
The widget to the left of a ToolBar that allows it to be dragged around to NEW positions.
Definition: Grabber.h:104
wxWindow * mButtons[3]
wxColour & Colour(int iIndex)
Definition: Theme.cpp:1225
void AdornedRulerPanel::RegenerateTooltips ( )

Definition at line 1076 of file AdornedRulerPanel.cpp.

References CellularPanel::HandleCursorForPresentMouseState().

Referenced by OnRecordStartStop(), OnTimelineToolTips(), OnToggleQuickPlay(), and UpdatePrefs().

1077 {
1078  CallAfter( [this]{ HandleCursorForPresentMouseState(); } );
1079 }
void HandleCursorForPresentMouseState(bool doHit=true)
std::shared_ptr< TrackPanelNode > AdornedRulerPanel::Root ( )
overrideprivatevirtual

Implements CellularPanel.

Definition at line 2132 of file AdornedRulerPanel.cpp.

2133 {
2134  // Root is a throwaway object
2135  return std::make_shared< MainGroup >( *this );
2136 }
void AdornedRulerPanel::SetFocusedCell ( )
overrideprivatevirtual

Implements CellularPanel.

Definition at line 2151 of file AdornedRulerPanel.cpp.

2152 {
2153 }
void AdornedRulerPanel::SetLeftOffset ( int  offset)

Definition at line 1961 of file AdornedRulerPanel.cpp.

References mLeftOffset, mRuler, CellularPanel::mViewInfo, and Ruler::SetUseZoomInfo().

Referenced by TrackPanel::UpdateVRulerSize().

1962 {
1963  mLeftOffset = offset;
1964  mRuler.SetUseZoomInfo(offset, mViewInfo);
1965 }
ViewInfo * mViewInfo
void SetUseZoomInfo(int leftOffset, const ZoomInfo *zoomInfo)
Definition: Ruler.cpp:1568
void AdornedRulerPanel::SetPanelSize ( )

Definition at line 1623 of file AdornedRulerPanel.cpp.

References GetRulerHeight(), and mShowScrubbing.

Referenced by OnToggleScrubRuler(), and UpdatePrefs().

1624 {
1625  wxSize size { GetSize().GetWidth(), GetRulerHeight(mShowScrubbing) };
1626  SetSize(size);
1627  SetMinSize(size);
1628  GetParent()->PostSizeEventToParent();
1629 }
void AdornedRulerPanel::SetPlayRegion ( double  playRegionStart,
double  playRegionEnd 
)

Definition at line 2051 of file AdornedRulerPanel.cpp.

References mesNone, mMouseEventState, mPlayRegionEnd, and mPlayRegionStart.

Referenced by AdornedRulerPanel::QPHandle::Cancel(), HandleQPRelease(), and AudacityProject::TP_DisplaySelection().

2053 {
2054  // This is called by AudacityProject to make the play region follow
2055  // the current selection. But while the user is selecting a play region
2056  // with the mouse directly in the ruler, changes from outside are blocked.
2057  if (mMouseEventState != mesNone)
2058  return;
2059 
2060  mPlayRegionStart = playRegionStart;
2061  mPlayRegionEnd = playRegionEnd;
2062 
2063  Refresh();
2064 }
MouseEventState mMouseEventState
void AdornedRulerPanel::ShowContextMenu ( MenuChoice  choice,
const wxPoint *  pPosition 
)
private

Definition at line 1870 of file AdornedRulerPanel.cpp.

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

Referenced by DoContextMenu().

1871 {
1872  wxPoint position;
1873  if(pPosition)
1874  position = *pPosition;
1875  else
1876  {
1877  auto rect = GetRect();
1878  position = { rect.GetLeft() + 1, rect.GetBottom() + 1 };
1879  }
1880 
1881  switch (choice) {
1882  case MenuChoice::QuickPlay:
1883  ShowMenu(position); break;
1884  case MenuChoice::Scrub:
1885  ShowScrubMenu(position); break;
1886  default:
1887  return;
1888  }
1889 }
void ShowScrubMenu(const wxPoint &pos)
void ShowMenu(const wxPoint &pos)
bool AdornedRulerPanel::ShowingScrubRuler ( ) const
inline

Definition at line 68 of file AdornedRulerPanel.h.

Referenced by ScrubbingToolBar::EnableDisableButtons(), and Scrubber::ShowsBar().

68 { return mShowScrubbing; }
void AdornedRulerPanel::ShowMenu ( const wxPoint &  pos)
private

Definition at line 1695 of file AdornedRulerPanel.cpp.

References _(), ViewInfo::bUpdateTrackIndicator, AudacityProject::IsPlayRegionLocked(), mPlayRegionDragsSelection, mPlayRegionEnd, mPlayRegionStart, mProject, mQuickPlayEnabled, mShowScrubbing, mTimelineToolTip, and CellularPanel::mViewInfo.

Referenced by ShowContextMenu().

1696 {
1697  wxMenu rulerMenu;
1698 
1699  if (mQuickPlayEnabled)
1700  rulerMenu.Append(OnToggleQuickPlayID, _("Disable Quick-Play"));
1701  else
1702  rulerMenu.Append(OnToggleQuickPlayID, _("Enable Quick-Play"));
1703 
1704  wxMenuItem *dragitem;
1706  dragitem = rulerMenu.Append(OnSyncQuickPlaySelID, _("Disable dragging selection"));
1707  else
1708  dragitem = rulerMenu.Append(OnSyncQuickPlaySelID, _("Enable dragging selection"));
1709  dragitem->Enable(mQuickPlayEnabled && !mProject->IsPlayRegionLocked());
1710 
1711 #if wxUSE_TOOLTIPS
1712  if (mTimelineToolTip)
1713  rulerMenu.Append(OnTimelineToolTipID, _("Disable Timeline Tooltips"));
1714  else
1715  rulerMenu.Append(OnTimelineToolTipID, _("Enable Timeline Tooltips"));
1716 #endif
1717 
1719  rulerMenu.Append(OnAutoScrollID, _("Do not scroll while playing"));
1720  else
1721  rulerMenu.Append(OnAutoScrollID, _("Update display while playing"));
1722 
1723  wxMenuItem *prlitem;
1724  if (!mProject->IsPlayRegionLocked())
1725  prlitem = rulerMenu.Append(OnLockPlayRegionID, _("Lock Play Region"));
1726  else
1727  prlitem = rulerMenu.Append(OnLockPlayRegionID, _("Unlock Play Region"));
1728  prlitem->Enable(mProject->IsPlayRegionLocked() || (mPlayRegionStart != mPlayRegionEnd));
1729 
1730  wxMenuItem *ruleritem;
1731  if (mShowScrubbing)
1732  ruleritem = rulerMenu.Append(OnScrubRulerID, _("Disable Scrub Ruler"));
1733  else
1734  ruleritem = rulerMenu.Append(OnScrubRulerID, _("Enable Scrub Ruler"));
1735 
1736  PopupMenu(&rulerMenu, pos);
1737 }
ViewInfo * mViewInfo
bool bUpdateTrackIndicator
Definition: ViewInfo.h:184
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
AudacityProject *const mProject
bool IsPlayRegionLocked()
Definition: Project.h:228
void AdornedRulerPanel::ShowScrubMenu ( const wxPoint &  pos)
private

Definition at line 1739 of file AdornedRulerPanel.cpp.

References AudacityProject::GetScrubber(), mProject, and Scrubber::PopulatePopupMenu().

Referenced by ShowContextMenu().

1740 {
1741  auto &scrubber = mProject->GetScrubber();
1742  PushEventHandler(&scrubber);
1743  auto cleanup = finally([this]{ PopEventHandler(); });
1744 
1745  wxMenu rulerMenu;
1746  mProject->GetScrubber().PopulatePopupMenu(rulerMenu);
1747  PopupMenu(&rulerMenu, pos);
1748 }
Scrubber & GetScrubber()
Definition: Project.h:786
AudacityProject *const mProject
void PopulatePopupMenu(wxMenu &menu)
Definition: Scrubbing.cpp:1180
void AdornedRulerPanel::StartQPPlay ( bool  looped,
bool  cutPreview 
)
private

Definition at line 1543 of file AdornedRulerPanel.cpp.

References ControlToolBar::CutPreview, AudacityProject::GetControlToolBar(), AudacityProject::GetDefaultPlayOptions(), TrackList::GetEndTime(), AudacityProject::GetSel0(), AudacityProject::GetSel1(), TrackList::GetStartTime(), ControlToolBar::Looped, mPlayRegionEnd, mPlayRegionStart, mProject, mTracks, normalPlay, AudioIOStartStreamOptions::playLooped, ControlToolBar::PlayPlayRegion(), ControlToolBar::StopPlaying(), and ControlToolBar::Straight.

Referenced by HandleQPRelease().

1544 {
1545  const double t0 = mTracks->GetStartTime();
1546  const double t1 = mTracks->GetEndTime();
1547  const double sel0 = mProject->GetSel0();
1548  const double sel1 = mProject->GetSel1();
1549 
1550  // Start / Restart playback on left click.
1551  bool startPlaying = (mPlayRegionStart >= 0);
1552 
1553  if (startPlaying) {
1555  ctb->StopPlaying();
1556 
1557  bool loopEnabled = true;
1558  double start, end;
1559 
1560  if ((mPlayRegionEnd - mPlayRegionStart == 0.0) && looped) {
1561  // Loop play a point will loop either a selection or the project.
1562  if ((mPlayRegionStart > sel0) && (mPlayRegionStart < sel1)) {
1563  // we are in a selection, so use the selection
1564  start = sel0;
1565  end = sel1;
1566  } // not in a selection, so use the project
1567  else {
1568  start = t0;
1569  end = t1;
1570  }
1571  }
1572  else {
1573  start = mPlayRegionStart;
1574  end = mPlayRegionEnd;
1575  }
1576  // Looping a tiny selection may freeze, so just play it once.
1577  loopEnabled = ((end - start) > 0.001)? true : false;
1578 
1580  options.playLooped = (loopEnabled && looped);
1581 
1582  auto oldStart = mPlayRegionStart;
1583  if (!cutPreview)
1584  options.pStartTime = &oldStart;
1585  else
1586  options.timeTrack = NULL;
1587 
1588  ControlToolBar::PlayAppearance appearance =
1590  : options.playLooped ? ControlToolBar::PlayAppearance::Looped
1592 
1593  mPlayRegionStart = start;
1594  mPlayRegionEnd = end;
1595  Refresh();
1596 
1597  ctb->PlayPlayRegion((SelectedRegion(start, end)),
1598  options, PlayMode::normalPlay,
1599  appearance,
1600  false,
1601  true);
1602 
1603  }
1604 }
A ToolBar that has the main Transport buttons.
AudioIOStartStreamOptions GetDefaultPlayOptions()
Definition: Project.cpp:1366
double GetSel0() const
Definition: Project.h:221
double GetStartTime() const
Definition: Track.cpp:1226
double GetEndTime() const
Definition: Track.cpp:1231
void StopPlaying(bool stopStream=true)
Defines a selected portion of a project.
struct holding stream options, including a pointer to the TimeTrack and AudioIOListener and whether t...
Definition: AudioIO.h:124
AudacityProject *const mProject
int PlayPlayRegion(const SelectedRegion &selectedRegion, const AudioIOStartStreamOptions &options, PlayMode playMode, PlayAppearance appearance=PlayAppearance::Straight, bool backwards=false, bool playWhiteSpace=false)
ControlToolBar * GetControlToolBar()
Definition: Project.cpp:4824
double GetSel1() const
Definition: Project.h:222
bool AdornedRulerPanel::TakesFocus ( ) const
overrideprivatevirtual

Implements CellularPanel.

Definition at line 2171 of file AdornedRulerPanel.cpp.

2172 {
2173  return false;
2174 }
int AdornedRulerPanel::Time2Pos ( double  t,
bool  ignoreFisheye = false 
)
private

Definition at line 1203 of file AdornedRulerPanel.cpp.

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

Referenced by DoDrawPlayRegion(), DoDrawSelection(), HandleQPClick(), and IsWithinMarker().

1204 {
1206  , ignoreFisheye
1207  );
1208 }
ViewInfo * mViewInfo
wxInt64 TimeToPosition(double time, wxInt64 origin=0, bool ignoreFisheye=false) const
STM: Converts a project time to screen x position.
Definition: ViewInfo.cpp:59
void AdornedRulerPanel::UpdateButtonStates ( )

Definition at line 1637 of file AdornedRulerPanel.cpp.

References _(), gAudioIO, TracksPrefs::GetPinnedHeadPreference(), AudioIO::IsCapturing(), label, AButton::PopUp(), ToolBar::SetButtonToolTip(), and AButton::UpdateStatus().

Referenced by TransportActions::DoTogglePinnedHead(), PlayIndicatorOverlayBase::Draw(), OnRecordStartStop(), Scrubber::OnScrubOrSeek(), OnTogglePinnedState(), ReCreateButtons(), and UpdatePrefs().

1638 {
1639  auto common = [this]
1640  (AButton &button, const wxString &commandName, const wxString &label) {
1641  TranslatedInternalString command{ commandName, label };
1642  ToolBar::SetButtonToolTip( button, &command, 1u );
1643  button.SetLabel(button.GetToolTipText());
1644 
1645  button.UpdateStatus();
1646  };
1647 
1648  {
1649  // The button always reflects the pinned head preference, even though
1650  // there is also a Playback preference that may overrule it for scrubbing
1651  bool state = TracksPrefs::GetPinnedHeadPreference();
1652  auto pinButton = static_cast<AButton*>(FindWindow(OnTogglePinnedStateID));
1653  if( !state )
1654  pinButton->PopUp();
1655  else
1656  pinButton->PushDown();
1657  pinButton->SetAlternateIdx(
1658  (gAudioIO->IsCapturing() ? 2 : 0) + (state ? 0 : 1));
1659  // Bug 1584: Toltip now shows what clicking will do.
1660  const auto label = state
1661  ? _("Click to unpin")
1662  : _("Click to pin");
1663  common(*pinButton, wxT("PinnedHead"), label);
1664  }
1665 }
void PopUp()
Definition: AButton.cpp:525
bool IsCapturing() const
Definition: AudioIO.cpp:5790
wxString label
Definition: Tags.cpp:733
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
AudioIO * gAudioIO
Definition: AudioIO.cpp:491
static bool GetPinnedHeadPreference()
static void SetButtonToolTip(AButton &button, const TranslatedInternalString commands[], size_t nCommands)
Definition: ToolBar.cpp:843
A wxButton with mouse-over behaviour.
Definition: AButton.h:28
void UpdateStatus()
Definition: AButton.cpp:421
void AdornedRulerPanel::UpdatePrefs ( )

Definition at line 919 of file AdornedRulerPanel.cpp.

References gPrefs, mRuler, mShowScrubbing, RegenerateTooltips(), TracksBehaviorsPrefs::ScrollingPreferenceDefault(), TracksBehaviorsPrefs::ScrollingPreferenceKey(), SetPanelSize(), Ruler::SetTwoTone(), UpdateButtonStates(), and UpdateRects().

Referenced by OnPaint(), and AudacityProject::UpdatePrefs().

920 {
921  // Update button texts for language change
923 
924 #ifdef EXPERIMENTAL_SCROLLING_LIMITS
925 #ifdef EXPERIMENTAL_TWO_TONE_TIME_RULER
926  {
927  bool scrollBeyondZero = false;
928  gPrefs->Read(TracksBehaviorsPrefs::ScrollingPreferenceKey(), &scrollBeyondZero,
930  mRuler.SetTwoTone(scrollBeyondZero);
931  }
932 #endif
933 #endif
934 
935  mShowScrubbing = ReadScrubEnabledPref();
936  // Affected by the last
937  UpdateRects();
938  SetPanelSize();
939 
941 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
static const wxChar * ScrollingPreferenceKey()
void SetTwoTone(bool twoTone)
Definition: Ruler.cpp:139
static bool ScrollingPreferenceDefault()
void AdornedRulerPanel::UpdateQuickPlayPos ( wxCoord &  mousePosX,
bool  shiftDown 
)

Definition at line 1673 of file AdornedRulerPanel.cpp.

References TrackList::GetEndTime(), TrackPanel::GetLeftOffset(), AudacityProject::GetTrackPanel(), TrackPanel::GetTracksUsableArea(), HandleSnapping(), CellularPanel::LastCell(), min(), mProject, mQPCell, mQuickPlayPos, mQuickPlayPosUnsnapped, mTracks, and Pos2Time().

Referenced by AdornedRulerPanel::QPHandle::Drag(), AdornedRulerPanel::QPCell::HitTest(), and AdornedRulerPanel::ScrubbingCell::HitTest().

1674 {
1675  // Keep Quick-Play within usable track area.
1677  int width;
1678  tp->GetTracksUsableArea(&width, NULL);
1679  mousePosX = std::max(mousePosX, tp->GetLeftOffset());
1680  mousePosX = std::min(mousePosX, tp->GetLeftOffset() + width - 1);
1681 
1683 
1684  HandleSnapping();
1685 
1686  // If not looping, restrict selection to end of project
1687  if ((LastCell() == mQPCell || mQPCell->Clicked()) && !shiftDown) {
1688  const double t1 = mTracks->GetEndTime();
1690  }
1691 }
double GetEndTime() const
Definition: Track.cpp:1231
std::shared_ptr< TrackPanelCell > LastCell() const
void GetTracksUsableArea(int *width, int *height) const
Definition: TrackPanel.cpp:328
The TrackPanel class coordinates updates and operations on the main part of the screen which contains...
Definition: TrackPanel.h:248
int min(int a, int b)
AudacityProject *const mProject
TrackPanel * GetTrackPanel()
Definition: Project.h:324
int GetLeftOffset() const
Definition: TrackPanel.h:279
double Pos2Time(int p, bool ignoreFisheye=false)
std::shared_ptr< QPCell > mQPCell
void AdornedRulerPanel::UpdateRects ( )
private

Definition at line 1152 of file AdornedRulerPanel.cpp.

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

Referenced by OnSize(), and UpdatePrefs().

1153 {
1154  mInner = mOuter;
1155  mInner.x += LeftMargin;
1156  mInner.width -= (LeftMargin + RightMargin);
1157 
1158  auto top = &mInner;
1159  auto bottom = &mInner;
1160 
1161  if (mShowScrubbing) {
1162  mScrubZone = mInner;
1163  auto scrubHeight = std::min(mScrubZone.height, (int)(ScrubHeight));
1164 
1165  int topHeight;
1166 #ifdef SCRUB_ABOVE
1167  top = &mScrubZone, topHeight = scrubHeight;
1168 #else
1169  auto qpHeight = mScrubZone.height - scrubHeight;
1170  bottom = &mScrubZone, topHeight = qpHeight;
1171  // Increase scrub zone height so that hit testing finds it and
1172  // not QP region, when on bottom 'edge'.
1173  mScrubZone.height+=BottomMargin;
1174 #endif
1175 
1176  top->height = topHeight;
1177  bottom->height -= topHeight;
1178  bottom->y += topHeight;
1179  }
1180 
1181  top->y += TopMargin;
1182  top->height -= TopMargin;
1183 
1184  bottom->height -= BottomMargin;
1185 
1186  if (!mShowScrubbing)
1187  mScrubZone = mInner;
1188 
1189  mRuler.SetBounds(mInner.GetLeft(),
1190  mInner.GetTop(),
1191  mInner.GetRight(),
1192  mInner.GetBottom());
1193 
1194 }
void SetBounds(int left, int top, int right, int bottom)
Definition: Ruler.cpp:314
int min(int a, int b)
void AdornedRulerPanel::UpdateStatusMessage ( const wxString &  message)
overrideprivatevirtual

Implements CellularPanel.

Definition at line 2166 of file AdornedRulerPanel.cpp.

References GetProject(), and AudacityProject::TP_DisplayStatusMessage().

2167 {
2168  GetProject()->TP_DisplayStatusMessage(message);
2169 }
AudacityProject * GetProject() const override
void TP_DisplayStatusMessage(const wxString &msg) override
Definition: Project.cpp:5007

Member Data Documentation

wxWindow* AdornedRulerPanel::mButtons[3]
private

Definition at line 169 of file AdornedRulerPanel.h.

Referenced by AdornedRulerPanel(), and ReCreateButtons().

double AdornedRulerPanel::mIndTime
private

Definition at line 119 of file AdornedRulerPanel.h.

Referenced by AdornedRulerPanel().

wxRect AdornedRulerPanel::mInner
private
bool AdornedRulerPanel::mIsDragging
private

Definition at line 163 of file AdornedRulerPanel.h.

Referenced by AdornedRulerPanel(), HandleQPDrag(), and HandleQPRelease().

bool AdornedRulerPanel::mIsRecording
private
bool AdornedRulerPanel::mIsSnapped
private

Definition at line 123 of file AdornedRulerPanel.h.

Referenced by AdornedRulerPanel(), and HandleSnapping().

double AdornedRulerPanel::mLeftDownClick
private
double AdornedRulerPanel::mLeftDownClickUnsnapped
private

Definition at line 161 of file AdornedRulerPanel.h.

Referenced by HandleQPClick(), and HandleQPDrag().

int AdornedRulerPanel::mLeftOffset
private

Definition at line 116 of file AdornedRulerPanel.h.

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

MouseEventState AdornedRulerPanel::mMouseEventState
private
bool AdornedRulerPanel::mNeedButtonUpdate { true }
private

Definition at line 170 of file AdornedRulerPanel.h.

Referenced by OnPaint().

double AdornedRulerPanel::mOldPlayRegionEnd
private
double AdornedRulerPanel::mOldPlayRegionStart
private
wxRect AdornedRulerPanel::mOuter
private

Definition at line 112 of file AdornedRulerPanel.h.

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

std::unique_ptr<QuickPlayIndicatorOverlay> AdornedRulerPanel::mOverlay
private

Definition at line 195 of file AdornedRulerPanel.h.

Referenced by CreateOverlays().

bool AdornedRulerPanel::mPlayRegionDragsSelection
private
double AdornedRulerPanel::mPlayRegionEnd
private
bool AdornedRulerPanel::mPlayRegionLock
private
double AdornedRulerPanel::mPlayRegionStart
private
AudacityProject* const AdornedRulerPanel::mProject
private
std::shared_ptr<QPCell> AdornedRulerPanel::mQPCell
private
bool AdornedRulerPanel::mQuickPlayEnabled
private
double AdornedRulerPanel::mQuickPlayPos
private
double AdornedRulerPanel::mQuickPlayPosUnsnapped
private

Definition at line 120 of file AdornedRulerPanel.h.

Referenced by HandleQPClick(), and UpdateQuickPlayPos().

Ruler AdornedRulerPanel::mRuler
private
std::shared_ptr<ScrubbingCell> AdornedRulerPanel::mScrubbingCell
private
wxRect AdornedRulerPanel::mScrubZone
private
bool AdornedRulerPanel::mShowScrubbing { false }
private
bool AdornedRulerPanel::mTimelineToolTip
private
TrackList* AdornedRulerPanel::mTracks
private

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