Audacity 3.2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
TimeTrackVZoomHandle Class Referencefinal

#include <TimeTrackVZoomHandle.h>

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

Public Member Functions

 TimeTrackVZoomHandle (const std::shared_ptr< TimeTrack > &pTrack, const wxRect &rect, int y)
 
TimeTrackVZoomHandleoperator= (const TimeTrackVZoomHandle &)=default
 
 ~TimeTrackVZoomHandle () override
 
std::shared_ptr< const TrackFindTrack () const override
 
void Enter (bool forward, AudacityProject *) override
 
bool HandlesRightClick () override
 Whether the handle has any special right-button handling. More...
 
Result Click (const TrackPanelMouseEvent &event, AudacityProject *pProject) override
 
Result Drag (const TrackPanelMouseEvent &event, AudacityProject *pProject) override
 
HitTestPreview Preview (const TrackPanelMouseState &state, AudacityProject *pProject) override
 
Result Release (const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
 
Result Cancel (AudacityProject *pProject) override
 
- Public Member Functions inherited from UIHandle
virtual ~UIHandle ()=0
 
virtual void Enter (bool forward, AudacityProject *pProject)
 
virtual bool HasRotation () const
 
virtual bool Rotate (bool forward)
 
virtual bool HasEscape (AudacityProject *pProject) const
 
virtual bool Escape (AudacityProject *pProject)
 
virtual bool HandlesRightClick ()
 Whether the handle has any special right-button handling. More...
 
virtual Result Click (const TrackPanelMouseEvent &event, AudacityProject *pProject)=0
 
virtual Result Drag (const TrackPanelMouseEvent &event, AudacityProject *pProject)=0
 
virtual HitTestPreview Preview (const TrackPanelMouseState &state, AudacityProject *pProject)=0
 
virtual Result Release (const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent)=0
 
virtual Result Cancel (AudacityProject *pProject)=0
 
virtual bool StopsOnKeystroke ()
 
virtual void OnProjectChange (AudacityProject *pProject)
 
virtual std::shared_ptr< const TrackFindTrack () const =0
 
virtual bool IsDragging () const
 
Result GetChangeHighlight () const
 
void SetChangeHighlight (Result val)
 
- Public Member Functions inherited from TrackPanelDrawable
virtual ~TrackPanelDrawable ()=0
 
virtual void Draw (TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass)
 
virtual wxRect DrawingArea (TrackPanelDrawingContext &context, const wxRect &rect, const wxRect &panelRect, unsigned iPass)
 

Private Member Functions

 TimeTrackVZoomHandle (const TimeTrackVZoomHandle &)
 

Private Attributes

std::weak_ptr< TimeTrackmpTrack
 

Additional Inherited Members

- Public Types inherited from UIHandle
using Result = unsigned
 
using Cell = TrackPanelCell
 
- Static Public Member Functions inherited from UIHandle
static UIHandle::Result NeedChangeHighlight (const UIHandle &, const UIHandle &)
 
static std::shared_ptr< const TrackTrackFromChannel (const std::shared_ptr< const Channel > &pChannel)
 A frequent convenience in the definition of UIHandles. More...
 
- Static Public Member Functions inherited from TrackPanelDrawable
static wxRect MaximizeWidth (const wxRect &rect, const wxRect &panelRect)
 
static wxRect MaximizeHeight (const wxRect &rect, const wxRect &panelRect)
 
- Protected Attributes inherited from UIHandle
Result mChangeHighlight { 0 }
 

Detailed Description

Definition at line 18 of file TimeTrackVZoomHandle.h.

Constructor & Destructor Documentation

◆ TimeTrackVZoomHandle() [1/2]

TimeTrackVZoomHandle::TimeTrackVZoomHandle ( const TimeTrackVZoomHandle )
private

◆ TimeTrackVZoomHandle() [2/2]

TimeTrackVZoomHandle::TimeTrackVZoomHandle ( const std::shared_ptr< TimeTrack > &  pTrack,
const wxRect &  rect,
int  y 
)
explicit

Definition at line 23 of file TimeTrackVZoomHandle.cpp.

25 : mpTrack{ pTrack }
26{
27}
std::weak_ptr< TimeTrack > mpTrack

◆ ~TimeTrackVZoomHandle()

TimeTrackVZoomHandle::~TimeTrackVZoomHandle ( )
overridedefault

Member Function Documentation

◆ Cancel()

UIHandle::Result TimeTrackVZoomHandle::Cancel ( AudacityProject pProject)
overridevirtual

Implements UIHandle.

Definition at line 106 of file TimeTrackVZoomHandle.cpp.

107{
108 // Cancel is implemented! And there is no initial state to restore,
109 // so just return a code.
111}

References RefreshCode::RefreshAll.

◆ Click()

UIHandle::Result TimeTrackVZoomHandle::Click ( const TrackPanelMouseEvent event,
AudacityProject pProject 
)
overridevirtual

Implements UIHandle.

Definition at line 48 of file TimeTrackVZoomHandle.cpp.

50{
52}

References RefreshCode::RefreshNone.

◆ Drag()

UIHandle::Result TimeTrackVZoomHandle::Drag ( const TrackPanelMouseEvent event,
AudacityProject pProject 
)
overridevirtual

Implements UIHandle.

Definition at line 54 of file TimeTrackVZoomHandle.cpp.

56{
57 using namespace RefreshCode;
58 auto pTrack = TrackList::Get( *pProject ).Lock(mpTrack);
59 if (!pTrack)
60 return Cancelled;
61 return RefreshNone;
62}
std::shared_ptr< Subclass > Lock(const std::weak_ptr< Subclass > &wTrack)
Definition: Track.h:1079
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:314
Namespace containing an enum 'what to do on a refresh?'.
Definition: RefreshCode.h:16

References Cancelled, TrackList::Get(), TrackList::Lock(), mpTrack, and RefreshCode::RefreshNone.

Here is the call graph for this function:

◆ Enter()

void TimeTrackVZoomHandle::Enter ( bool  forward,
AudacityProject  
)
overridevirtual

Reimplemented from UIHandle.

Definition at line 36 of file TimeTrackVZoomHandle.cpp.

37{
38#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
40#endif
41}
Result mChangeHighlight
Definition: UIHandle.h:152

References UIHandle::mChangeHighlight, and RefreshCode::RefreshCell.

◆ FindTrack()

std::shared_ptr< const Track > TimeTrackVZoomHandle::FindTrack ( ) const
overridevirtual
Returns
pointer to associated track, if any

Implements UIHandle.

Definition at line 31 of file TimeTrackVZoomHandle.cpp.

32{
33 return mpTrack.lock();
34}

References mpTrack.

◆ HandlesRightClick()

bool TimeTrackVZoomHandle::HandlesRightClick ( )
overridevirtual

Whether the handle has any special right-button handling.

If not, then Click() will not be called for right click. Default is always false

Reimplemented from UIHandle.

Definition at line 43 of file TimeTrackVZoomHandle.cpp.

44{
45 return true;
46}

◆ operator=()

TimeTrackVZoomHandle & TimeTrackVZoomHandle::operator= ( const TimeTrackVZoomHandle )
default

◆ Preview()

HitTestPreview TimeTrackVZoomHandle::Preview ( const TrackPanelMouseState state,
AudacityProject pProject 
)
overridevirtual

Implements UIHandle.

Definition at line 64 of file TimeTrackVZoomHandle.cpp.

66{
67 static wxCursor arrowCursor{ wxCURSOR_ARROW };
68
69 return {
70 XO("Right-click for menu."),
71 &arrowCursor
72 // , message
73 };
74}
XO("Cut/Copy/Paste")

References XO().

Here is the call graph for this function:

◆ Release()

UIHandle::Result TimeTrackVZoomHandle::Release ( const TrackPanelMouseEvent event,
AudacityProject pProject,
wxWindow *  pParent 
)
overridevirtual

Implements UIHandle.

Definition at line 76 of file TimeTrackVZoomHandle.cpp.

79{
80 auto pTrack = TrackList::Get( *pProject ).Lock(mpTrack);
81 using namespace RefreshCode;
82 if (!pTrack)
83 return RefreshNone;
84
85 const wxMouseEvent &event = evt.event;
86 const bool shiftDown = event.ShiftDown();
87 const bool rightUp = event.RightUp();
88
89 // Popup menu...
90 if (
91 rightUp &&
92 !(event.ShiftDown() || event.CmdDown()))
93 {
95 *pProject, *pTrack, pParent, RefreshNone
96 };
97
98 auto pMenu = PopupMenuTable::BuildMenu(
100 pMenu->Popup( *pParent, { event.m_x, event.m_y } );
101 }
102
103 return UpdateVRuler | RefreshAll;
104}
static std::unique_ptr< PopupMenu > BuildMenu(PopupMenuTable *pTable, void *pUserData=NULL)
static TimeTrackMenuTable & Instance()

References PopupMenuTable::BuildMenu(), TrackPanelMouseEvent::event, TrackList::Get(), TimeTrackMenuTable::Instance(), TrackList::Lock(), mpTrack, RefreshCode::RefreshAll, RefreshCode::RefreshNone, and RefreshCode::UpdateVRuler.

Here is the call graph for this function:

Member Data Documentation

◆ mpTrack

std::weak_ptr<TimeTrack> TimeTrackVZoomHandle::mpTrack
private

Definition at line 53 of file TimeTrackVZoomHandle.h.

Referenced by Drag(), FindTrack(), and Release().


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