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

Implements some features which are specific to Wave Clips. More...

#include <WaveTrackAffordanceHandle.h>

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

Public Member Functions

 WaveTrackAffordanceHandle (const std::shared_ptr< Track > &track, const std::shared_ptr< ClipTimes > &target)
 
Result Click (const TrackPanelMouseEvent &event, AudacityProject *project) override
 
UIHandle::Result SelectAt (const TrackPanelMouseEvent &event, AudacityProject *project) override
 
bool HandlesRightClick () override
 Whether the handle has any special right-button handling. More...
 
UIHandle::Result Release (const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
 
- Public Member Functions inherited from AffordanceHandle
void Enter (bool forward, AudacityProject *pProject) override
 
HitTestPreview Preview (const TrackPanelMouseState &mouseState, AudacityProject *pProject) override
 
 AffordanceHandle (const std::shared_ptr< Track > &track)
 
Result Click (const TrackPanelMouseEvent &evt, AudacityProject *pProject) override
 
Result Drag (const TrackPanelMouseEvent &event, AudacityProject *pProject) override
 
Result Release (const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
 
- Public Member Functions inherited from TimeShiftHandle
 TimeShiftHandle (std::shared_ptr< Track > pTrack, bool gripHit)
 
TimeShiftHandleoperator= (TimeShiftHandle &&)=default
 
bool IsGripHit () const
 
virtual ~TimeShiftHandle ()
 
std::shared_ptr< const TrackFindTrack () const override
 
void Enter (bool forward, AudacityProject *) override
 
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
 
bool StopsOnKeystroke () override
 
bool Clicked () const
 
std::shared_ptr< TrackGetTrack () const
 
- 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 Attributes

std::shared_ptr< ClipTimesmTarget
 

Additional Inherited Members

- Public Types inherited from UIHandle
using Result = unsigned
 
using Cell = TrackPanelCell
 
- Static Public Member Functions inherited from TimeShiftHandle
static UIHandlePtr HitAnywhere (std::weak_ptr< TimeShiftHandle > &holder, const std::shared_ptr< Track > &pTrack, bool gripHit)
 
static UIHandlePtr HitTest (std::weak_ptr< TimeShiftHandle > &holder, const wxMouseState &state, const wxRect &rect, const std::shared_ptr< Track > &pTrack)
 
- 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)
 
virtual Result SelectAt (const TrackPanelMouseEvent &event, AudacityProject *pProject)=0
 
- Protected Member Functions inherited from TimeShiftHandle
bool WasMoved () const
 
- Protected Attributes inherited from UIHandle
Result mChangeHighlight { 0 }
 

Detailed Description

Implements some features which are specific to Wave Clips.

Definition at line 18 of file WaveTrackAffordanceHandle.h.

Constructor & Destructor Documentation

◆ WaveTrackAffordanceHandle()

WaveTrackAffordanceHandle::WaveTrackAffordanceHandle ( const std::shared_ptr< Track > &  track,
const std::shared_ptr< ClipTimes > &  target 
)

Definition at line 24 of file WaveTrackAffordanceHandle.cpp.

25 : AffordanceHandle(track), mTarget(target)
26{ }
AffordanceHandle(const std::shared_ptr< Track > &track)
std::shared_ptr< ClipTimes > mTarget

Member Function Documentation

◆ Click()

UIHandle::Result WaveTrackAffordanceHandle::Click ( const TrackPanelMouseEvent event,
AudacityProject project 
)
overridevirtual

Implements UIHandle.

Definition at line 28 of file WaveTrackAffordanceHandle.cpp.

29{
30 // We only care about left clicks here,
31 // however we need to intercept Release events for right clicks later
32 if (event.event.GetButton() != wxMOUSE_BTN_LEFT)
34
36
38 {
39 auto affordanceControl = std::dynamic_pointer_cast<WaveTrackAffordanceControls>(event.pCell);
40
41 if (affordanceControl)
42 {
43 result |= affordanceControl->OnAffordanceClick(event, project);
44 if (!event.event.GetSkipped())//event is "consumed"
45 return result | RefreshCode::Cancelled;
46 event.event.Skip(false);
47 }
48 }
49 return result | AffordanceHandle::Click(event, project);
50}
const auto project
Result Click(const TrackPanelMouseEvent &evt, AudacityProject *pProject) override
unsigned Result
Definition: UIHandle.h:40
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:235
static bool ClipDetailsVisible(const ClipTimes &clip, const ZoomInfo &zoomInfo, const wxRect &viewRect)
std::shared_ptr< TrackPanelCell > pCell

References RefreshCode::Cancelled, AffordanceHandle::Click(), WaveChannelView::ClipDetailsVisible(), TrackPanelMouseEvent::event, ViewInfo::Get(), mTarget, TrackPanelMouseEvent::pCell, project, TrackPanelMouseEvent::rect, and RefreshCode::RefreshNone.

Here is the call graph for this function:

◆ HandlesRightClick()

bool WaveTrackAffordanceHandle::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 62 of file WaveTrackAffordanceHandle.cpp.

63{
64 return true;
65}

◆ Release()

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

Implements UIHandle.

Definition at line 67 of file WaveTrackAffordanceHandle.cpp.

68{
69 auto result = AffordanceHandle::Release(event, pProject, pParent);
70 PitchAndSpeedDialog::Get(*pProject).TryRetarget(event);
71
72 if (event.event.RightUp())
73 result |= event.pCell->DoContextMenu(event.rect, pParent, nullptr, pProject);
74
75 return result;
76}
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
static PitchAndSpeedDialog & Get(AudacityProject &project)
void TryRetarget(const TrackPanelMouseEvent &event)

References TrackPanelMouseEvent::event, PitchAndSpeedDialog::Get(), TrackPanelMouseEvent::rect, AffordanceHandle::Release(), and PitchAndSpeedDialog::TryRetarget().

Here is the call graph for this function:

◆ SelectAt()

UIHandle::Result WaveTrackAffordanceHandle::SelectAt ( const TrackPanelMouseEvent event,
AudacityProject project 
)
overridevirtual

Implements AffordanceHandle.

Definition at line 52 of file WaveTrackAffordanceHandle.cpp.

53{
54 auto& viewInfo = ViewInfo::Get(*project);
55 viewInfo.selectedRegion.setTimes(mTarget->GetPlayStartTime(), mTarget->GetPlayEndTime());
56
57 ProjectHistory::Get(*project).ModifyState(false);
58
60}
void ModifyState(bool bWantsAutoSave)
static ProjectHistory & Get(AudacityProject &project)

References RefreshCode::Cancelled, ProjectHistory::Get(), ViewInfo::Get(), ProjectHistory::ModifyState(), mTarget, project, and RefreshCode::RefreshAll.

Here is the call graph for this function:

Member Data Documentation

◆ mTarget

std::shared_ptr<ClipTimes> WaveTrackAffordanceHandle::mTarget
private

Definition at line 20 of file WaveTrackAffordanceHandle.h.

Referenced by Click(), and SelectAt().


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