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 ChannelFindChannel () 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 ChannelFindChannel () 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 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 1127 of file AdornedRulerPanel.cpp.

Constructor & Destructor Documentation

◆ ScrubbingHandle()

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

Definition at line 1131 of file AdornedRulerPanel.cpp.

1132 : CommonRulerHandle( pParent, xx, MenuChoice::Scrub )
1133 {
1134 }
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 1189 of file AdornedRulerPanel.cpp.

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

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 1137 of file AdornedRulerPanel.cpp.

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

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 1162 of file AdornedRulerPanel.cpp.

1164 {
1165 auto result = CommonRulerHandle::Drag(event, pProject);
1166 if (!( result & RefreshCode::Cancelled )) {
1167 // Nothing needed here. The scrubber works by polling mouse state
1168 // after the start has been marked.
1169 }
1170 return result;
1171 }
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 1898 of file AdornedRulerPanel.cpp.

1901{
1902 auto &scrubber = Scrubber::Get( *pProject );
1903 auto message = ScrubbingMessage(scrubber, mClicked == Button::Left);
1904
1905 mParent->SetNumGuides(1);
1906 return {
1907 message,
1908 {},
1909 // Tooltip is same as status message, or blank
1910 mParent ? message : TranslatableString{},
1911 };
1912}
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 1177 of file AdornedRulerPanel.cpp.

1179 {
1180 auto result = CommonRulerHandle::Release(event, pProject, pParent);
1181 if (!( result & RefreshCode::Cancelled )) {
1182 // Nothing needed here either. The scrub poller may have decided to
1183 // seek because a drag happened before button up, or it may decide
1184 // to start a scrub, as it watches mouse movement after the button up.
1185 }
1186 return result;
1187 }
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: