Audacity 3.2.0
Public Member Functions | Private Member Functions | List of all members
AdornedRulerPanel::ScrubbingHandle Class Referencefinal
Inheritance diagram for AdornedRulerPanel::ScrubbingHandle:
[legend]
Collaboration diagram for AdornedRulerPanel::ScrubbingHandle:
[legend]

Public Member Functions

 ScrubbingHandle (AdornedRulerPanel *pParent, wxCoord xx)
 
- Public Member Functions inherited from AdornedRulerPanel::CommonRulerHandle
 CommonRulerHandle (AdornedRulerPanel *pParent, wxCoord xx, MenuChoice menuChoice)
 
std::shared_ptr< const TrackFindTrack () const override
 
bool Clicked () 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 Member Functions

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
 

Additional Inherited Members

- Public Types inherited from UIHandle
using Result = unsigned
 
using Cell = TrackPanelCell
 
- Static Public Member Functions inherited from AdornedRulerPanel::CommonRulerHandle
static UIHandle::Result NeedChangeHighlight (const CommonRulerHandle &oldState, const CommonRulerHandle &newState)
 
- 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 Types inherited from AdornedRulerPanel::CommonRulerHandle
enum class  Button { None , Left , Right }
 
- Protected Member Functions inherited from AdornedRulerPanel::CommonRulerHandle
bool HandlesRightClick () override
 Whether the handle has any special right-button handling. More...
 
Result Click (const TrackPanelMouseEvent &event, AudacityProject *) override
 
Result Drag (const TrackPanelMouseEvent &, AudacityProject *) override
 
Result Release (const TrackPanelMouseEvent &event, AudacityProject *, wxWindow *) override
 
double Time (AudacityProject &project) const
 
void StartPlay (AudacityProject &project, const wxMouseEvent &event)
 
Result Cancel (AudacityProject *) override
 
void Enter (bool, AudacityProject *) override
 
- Protected Attributes inherited from AdornedRulerPanel::CommonRulerHandle
wxWeakRef< AdornedRulerPanelmParent
 
wxCoord mX
 
wxCoord mClickedX
 
MenuChoice mChoice
 
Button mClicked { Button::None }
 
- Protected Attributes inherited from UIHandle
Result mChangeHighlight { 0 }
 

Detailed Description

Definition at line 1125 of file AdornedRulerPanel.cpp.

Constructor & Destructor Documentation

◆ ScrubbingHandle()

AdornedRulerPanel::ScrubbingHandle::ScrubbingHandle ( AdornedRulerPanel pParent,
wxCoord  xx 
)
inlineexplicit

Definition at line 1129 of file AdornedRulerPanel.cpp.

1130 : CommonRulerHandle( pParent, xx, MenuChoice::Scrub )
1131 {
1132 }
CommonRulerHandle(AdornedRulerPanel *pParent, wxCoord xx, MenuChoice menuChoice)

Member Function Documentation

◆ Cancel()

Result AdornedRulerPanel::ScrubbingHandle::Cancel ( AudacityProject pProject)
inlineoverrideprivatevirtual

Reimplemented from AdornedRulerPanel::CommonRulerHandle.

Definition at line 1187 of file AdornedRulerPanel.cpp.

1188 {
1189 auto result = CommonRulerHandle::Cancel(pProject);
1190
1191 if (mClicked == Button::Left) {
1192 auto &scrubber = Scrubber::Get( *pProject );
1193 scrubber.Cancel();
1194
1195 ProjectAudioManager::Get( *pProject ).Stop();
1196 }
1197
1198 return result;
1199 }
Result Cancel(AudacityProject *) override
void Stop(bool stopStream=true)
static ProjectAudioManager & Get(AudacityProject &project)
static Scrubber & Get(AudacityProject &project)
Definition: Scrubbing.cpp:186

References AdornedRulerPanel::CommonRulerHandle::Cancel(), ProjectAudioManager::Get(), Scrubber::Get(), AdornedRulerPanel::CommonRulerHandle::Left, AdornedRulerPanel::CommonRulerHandle::mClicked, and ProjectAudioManager::Stop().

Here is the call graph for this function:

◆ Click()

Result AdornedRulerPanel::ScrubbingHandle::Click ( const TrackPanelMouseEvent event,
AudacityProject pProject 
)
inlineoverrideprivatevirtual

Reimplemented from AdornedRulerPanel::CommonRulerHandle.

Definition at line 1135 of file AdornedRulerPanel.cpp.

1137 {
1138 auto result = CommonRulerHandle::Click(event, pProject);
1139 if (!( result & RefreshCode::Cancelled )) {
1140 if (mClicked == Button::Left) {
1141 auto &scrubber = Scrubber::Get( *pProject );
1142 // only if scrubbing is allowed now
1143 bool canScrub =
1144 scrubber.CanScrub() &&
1145 mParent &&
1146 mParent->ShowingScrubRuler();
1147
1148 if (!canScrub)
1150 if (!scrubber.HasMark()) {
1151 // Asynchronous scrub poller gets activated here
1152 scrubber.MarkScrubStart(
1153 event.event.m_x, Scrubber::ShouldScrubPinned(), false);
1154 }
1155 }
1156 }
1157 return result;
1158 }
Result Click(const TrackPanelMouseEvent &event, AudacityProject *) override
wxWeakRef< AdornedRulerPanel > mParent
static bool ShouldScrubPinned()
Definition: Scrubbing.cpp:149

References RefreshCode::Cancelled, AdornedRulerPanel::CommonRulerHandle::Click(), TrackPanelMouseEvent::event, Scrubber::Get(), AdornedRulerPanel::CommonRulerHandle::Left, AdornedRulerPanel::CommonRulerHandle::mClicked, AdornedRulerPanel::CommonRulerHandle::mParent, and Scrubber::ShouldScrubPinned().

Here is the call graph for this function:

◆ Drag()

Result AdornedRulerPanel::ScrubbingHandle::Drag ( const TrackPanelMouseEvent event,
AudacityProject pProject 
)
inlineoverrideprivatevirtual

Reimplemented from AdornedRulerPanel::CommonRulerHandle.

Definition at line 1160 of file AdornedRulerPanel.cpp.

1162 {
1163 auto result = CommonRulerHandle::Drag(event, pProject);
1164 if (!( result & RefreshCode::Cancelled )) {
1165 // Nothing needed here. The scrubber works by polling mouse state
1166 // after the start has been marked.
1167 }
1168 return result;
1169 }
Result Drag(const TrackPanelMouseEvent &, AudacityProject *) override

References RefreshCode::Cancelled, and AdornedRulerPanel::CommonRulerHandle::Drag().

Here is the call graph for this function:

◆ Preview()

auto AdornedRulerPanel::ScrubbingHandle::Preview ( const TrackPanelMouseState state,
AudacityProject pProject 
)
overrideprivatevirtual

Implements UIHandle.

Definition at line 1891 of file AdornedRulerPanel.cpp.

1894{
1895 auto &scrubber = Scrubber::Get( *pProject );
1896 auto message = ScrubbingMessage(scrubber, mClicked == Button::Left);
1897
1898 mParent->SetNumGuides(1);
1899 return {
1900 message,
1901 {},
1902 // Tooltip is same as status message, or blank
1903 mParent ? message : TranslatableString{},
1904 };
1905}
Holds a msgid for the translation catalog; may also bind format arguments.
const TranslatableString ScrubbingMessage(const Scrubber &scrubber, bool clicked)

References Scrubber::Get(), and anonymous_namespace{AdornedRulerPanel.cpp}::ScrubbingMessage().

Here is the call graph for this function:

◆ Release()

Result AdornedRulerPanel::ScrubbingHandle::Release ( const TrackPanelMouseEvent event,
AudacityProject pProject,
wxWindow *  pParent 
)
inlineoverrideprivatevirtual

Reimplemented from AdornedRulerPanel::CommonRulerHandle.

Definition at line 1175 of file AdornedRulerPanel.cpp.

1177 {
1178 auto result = CommonRulerHandle::Release(event, pProject, pParent);
1179 if (!( result & RefreshCode::Cancelled )) {
1180 // Nothing needed here either. The scrub poller may have decided to
1181 // seek because a drag happened before button up, or it may decide
1182 // to start a scrub, as it watches mouse movement after the button up.
1183 }
1184 return result;
1185 }
Result Release(const TrackPanelMouseEvent &event, AudacityProject *, wxWindow *) override

References RefreshCode::Cancelled, and AdornedRulerPanel::CommonRulerHandle::Release().

Here is the call graph for this function:

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