Audacity  3.0.3
Public Member Functions | Protected Member Functions | Static Private Member Functions | List of all members
AffordanceHandle Class Referenceabstract

#include <AffordanceHandle.h>

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

Public Member Functions

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 Release (const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
 
- Public Member Functions inherited from TimeShiftHandle
 TimeShiftHandle (const std::shared_ptr< Track > &pTrack, bool gripHit)
 
TimeShiftHandleoperator= (TimeShiftHandle &&)=default
 
bool IsGripHit () const
 
virtual ~TimeShiftHandle ()
 
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
 
- Public Member Functions inherited from UIHandle
virtual ~UIHandle ()=0
 
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 void OnProjectChange (AudacityProject *pProject)
 
Result GetChangeHighlight () const
 
void SetChangeHighlight (Result val)
 
- Public Member Functions inherited from TrackPanelDrawable
virtual ~TrackPanelDrawable ()=0
 

Protected Member Functions

virtual Result SelectAt (const TrackPanelMouseEvent &event, AudacityProject *pProject)=0
 
- Protected Member Functions inherited from TimeShiftHandle
std::shared_ptr< TrackGetTrack () const
 
bool WasMoved () const
 

Static Private Member Functions

static HitTestPreview HitPreview (const AudacityProject *, bool unsafe, bool moving)
 

Additional Inherited Members

- Public Types inherited from UIHandle
using Result = unsigned
 
using Cell = TrackPanelCell
 
- Static Public Member Functions inherited from TimeShiftHandle
static bool DoSlideVertical (ViewInfo &viewInfo, wxCoord xx, ClipMoveState &state, TrackList &trackList, Track &dstTrack, double &desiredSlideAmount)
 
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 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


Audacity: A Digital Audio Editor

AffordanceHandle.h

Vitaly Sverchinsky

Definition at line 15 of file AffordanceHandle.h.

Constructor & Destructor Documentation

◆ AffordanceHandle()

AffordanceHandle::AffordanceHandle ( const std::shared_ptr< Track > &  track)

Definition at line 56 of file AffordanceHandle.cpp.

57  : TimeShiftHandle(track, false)
58 {
59 }

Member Function Documentation

◆ Click()

UIHandle::Result AffordanceHandle::Click ( const TrackPanelMouseEvent evt,
AudacityProject pProject 
)
overridevirtual

Implements UIHandle.

Definition at line 61 of file AffordanceHandle.cpp.

62 {
63  auto result = TimeShiftHandle::Click(evt, pProject);
64  return result | RefreshCode::RefreshCell;
65 }

References TimeShiftHandle::Click(), and RefreshCode::RefreshCell.

Referenced by WaveTrackAffordanceHandle::Click().

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

◆ Enter()

void AffordanceHandle::Enter ( bool  forward,
AudacityProject pProject 
)
overridevirtual

Reimplemented from UIHandle.

Definition at line 44 of file AffordanceHandle.cpp.

References TimeShiftHandle::Enter(), RefreshCode::RefreshCell, RefreshCode::RefreshLatestCell, and UIHandle::SetChangeHighlight().

Here is the call graph for this function:

◆ HitPreview()

HitTestPreview AffordanceHandle::HitPreview ( const AudacityProject ,
bool  unsafe,
bool  moving 
)
staticprivate

Audacity: A Digital Audio Editor

AffordanceHandle.cpp

Vitaly Sverchinsky

Definition at line 22 of file AffordanceHandle.cpp.

23 {
24  static auto disabledCursor =
25  MakeCursor(wxCURSOR_NO_ENTRY, DisabledCursorXpm, 16, 16);
26  static auto handOpenCursor =
27  MakeCursor(wxCURSOR_HAND, RearrangeCursorXpm, 16, 16);
28  static auto handClosedCursor =
29  MakeCursor(wxCURSOR_HAND, RearrangingCursorXpm, 16, 16);
30  // i18n-hint Appears on hovering mouse over clip affordance
31  auto message = XO("Drag clips to reposition them."\
32  " Hold Shift and drag to move all clips on the same track.");
33 
34  if (unsafe)
35  return { message, &*disabledCursor };
36  return {
37  message,
38  (moving
39  ? &*handClosedCursor
40  : &*handOpenCursor)
41  };
42 }

References handOpenCursor, MakeCursor(), and XO.

Referenced by Preview().

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

◆ Preview()

HitTestPreview AffordanceHandle::Preview ( const TrackPanelMouseState mouseState,
AudacityProject pProject 
)
overridevirtual

Implements UIHandle.

Definition at line 50 of file AffordanceHandle.cpp.

51 {
52  const bool unsafe = ProjectAudioIO::Get(*pProject).IsAudioActive();
53  return HitPreview(pProject, unsafe, Clicked());
54 }

References TimeShiftHandle::Clicked(), ProjectAudioIO::Get(), HitPreview(), and ProjectAudioIO::IsAudioActive().

Here is the call graph for this function:

◆ Release()

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

Implements UIHandle.

Definition at line 67 of file AffordanceHandle.cpp.

68 {
69  auto result = TimeShiftHandle::Release(event, pProject, pParent);
70  if (!WasMoved())
71  {
72  auto& trackList = TrackList::Get(*pProject);
73  if(const auto track = trackList.Lock<Track>(GetTrack()))
74  {
75  auto& selectionState = SelectionState::Get(*pProject);
76  selectionState.SelectNone(trackList);
77  selectionState.SelectTrack(*track, true, true);
78 
79  result |= SelectAt(event, pProject);
80  }
81  }
82  return result;
83 }

References TrackList::Get(), SelectionState::Get(), TimeShiftHandle::GetTrack(), TimeShiftHandle::Release(), SelectAt(), and TimeShiftHandle::WasMoved().

Here is the call graph for this function:

◆ SelectAt()

virtual Result AffordanceHandle::SelectAt ( const TrackPanelMouseEvent event,
AudacityProject pProject 
)
protectedpure virtual

Implemented in WaveTrackAffordanceHandle, and NoteTrackAffordanceHandle.

Referenced by Release().

Here is the caller graph for this function:

The documentation for this class was generated from the following files:
TimeShiftHandle::TimeShiftHandle
TimeShiftHandle(const TimeShiftHandle &)=delete
TimeShiftHandle::WasMoved
bool WasMoved() const
Definition: TimeShiftHandle.cpp:43
MakeCursor
std::unique_ptr< wxCursor > MakeCursor(int WXUNUSED(CursorId), const char *const pXpm[36], int HotX, int HotY)
Definition: TrackPanel.cpp:182
XO
#define XO(s)
Definition: Internat.h:31
ProjectAudioIO::Get
static ProjectAudioIO & Get(AudacityProject &project)
Definition: ProjectAudioIO.cpp:22
ProjectAudioIO::IsAudioActive
bool IsAudioActive() const
Definition: ProjectAudioIO.cpp:51
UIHandle::SetChangeHighlight
void SetChangeHighlight(Result val)
Definition: UIHandle.h:123
AffordanceHandle::SelectAt
virtual Result SelectAt(const TrackPanelMouseEvent &event, AudacityProject *pProject)=0
TimeShiftHandle::Clicked
bool Clicked() const
Definition: TimeShiftHandle.cpp:48
TimeShiftHandle::Enter
void Enter(bool forward, AudacityProject *) override
Definition: TimeShiftHandle.cpp:53
TimeShiftHandle::Release
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
Definition: TimeShiftHandle.cpp:956
AffordanceHandle::HitPreview
static HitTestPreview HitPreview(const AudacityProject *, bool unsafe, bool moving)
Definition: AffordanceHandle.cpp:22
RefreshCode::RefreshCell
@ RefreshCell
Definition: RefreshCode.h:24
RefreshCode::RefreshLatestCell
@ RefreshLatestCell
Definition: RefreshCode.h:25
SelectionState::Get
static SelectionState & Get(AudacityProject &project)
Definition: SelectionState.cpp:21
handOpenCursor
static auto handOpenCursor
Definition: AdornedRulerPanel.cpp:754
TrackList::Get
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:383
Track
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:224
TimeShiftHandle::GetTrack
std::shared_ptr< Track > GetTrack() const
Definition: TimeShiftHandle.cpp:38
TimeShiftHandle::Click
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Definition: TimeShiftHandle.cpp:496