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

#include <ClipPitchAndSpeedButtonHandle.h>

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

Public Types

enum class  Type { Speed , Pitch }
 
- Public Types inherited from UIHandle
using Result = unsigned
 
using Cell = TrackPanelCell
 

Public Member Functions

 ClipPitchAndSpeedButtonHandle (Type type, const std::shared_ptr< WaveTrack > &track, const std::shared_ptr< WaveTrack::Interval > &clip)
 
- Public Member Functions inherited from HighlitClipButtonHandle
 HighlitClipButtonHandle (ClipButtonId id, std::shared_ptr< WaveTrack > track, std::shared_ptr< WaveTrack::Interval > clip)
 
void Enter (bool forward, AudacityProject *pProject) override
 
void Draw (TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
 
Result Click (const TrackPanelMouseEvent &event, AudacityProject *pProject) override
 
Result Drag (const TrackPanelMouseEvent &event, AudacityProject *pProject) override
 
Result Cancel (AudacityProject *pProject) override
 
std::shared_ptr< const TrackFindTrack () const override
 
Result Release (const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
 
virtual void DoDraw (const wxRect &args, wxDC &dc)=0
 
- 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 DoRelease (const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
 
HitTestPreview Preview (const TrackPanelMouseState &state, AudacityProject *pProject) override
 
void DoDraw (const wxRect &rect, wxDC &dc) override
 

Private Attributes

Type mType
 

Additional Inherited Members

- 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 Member Functions inherited from HighlitClipButtonHandle
virtual Result DoRelease (const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent)=0
 
UIHandle::Result UpdateTrackSelection (const TrackPanelMouseEvent &event, AudacityProject *pProject)
 
UIHandle::Result SelectAt (const TrackPanelMouseEvent &event, AudacityProject *project)
 
- Protected Attributes inherited from HighlitClipButtonHandle
ClipButtonId mButtonId
 
std::shared_ptr< WaveTrackmTrack
 
std::shared_ptr< WaveTrack::IntervalmClip
 
- Protected Attributes inherited from UIHandle
Result mChangeHighlight { 0 }
 

Detailed Description


Audacity: A Digital Audio Editor

ClipPitchAndSpeedButtonHandle.h

Matthieu Hodgkinson

Definition at line 15 of file ClipPitchAndSpeedButtonHandle.h.

Member Enumeration Documentation

◆ Type

Enumerator
Speed 
Pitch 

Definition at line 18 of file ClipPitchAndSpeedButtonHandle.h.

19 {
20 Speed,
21 Pitch
22 };

Constructor & Destructor Documentation

◆ ClipPitchAndSpeedButtonHandle()

ClipPitchAndSpeedButtonHandle::ClipPitchAndSpeedButtonHandle ( Type  type,
const std::shared_ptr< WaveTrack > &  track,
const std::shared_ptr< WaveTrack::Interval > &  clip 
)

Member Function Documentation

◆ DoDraw()

void ClipPitchAndSpeedButtonHandle::DoDraw ( const wxRect &  rect,
wxDC &  dc 
)
overrideprivatevirtual

Implements HighlitClipButtonHandle.

Definition at line 178 of file ClipPitchAndSpeedButtonHandle.cpp.

179{
180 const ClipInterface& clip = *mClip;
181 ClipButtonDrawingArgs args { rect, clip, dc };
182 if (mType == Type::Pitch)
184 else
186}
std::shared_ptr< WaveTrack::Interval > mClip
static void DrawOnClip(ClipButtonDrawingArgs &)

References ClipButtonSpecializations< id >::DrawOnClip(), HighlitClipButtonHandle::mClip, mType, and Pitch.

Here is the call graph for this function:

◆ DoRelease()

UIHandle::Result ClipPitchAndSpeedButtonHandle::DoRelease ( const TrackPanelMouseEvent event,
AudacityProject pProject,
wxWindow *  pParent 
)
overrideprivatevirtual

Implements HighlitClipButtonHandle.

Definition at line 118 of file ClipPitchAndSpeedButtonHandle.cpp.

121{
122 if (event.event.CmdDown())
123 {
124 if (mType == Type::Pitch)
125 {
126 mClip->SetCentShift(0);
128 XO("Reset Clip Pitch"), XO("Reset Clip Pitch"));
129 }
131 {
133 wxWidgetsWindowPlacement { pParent }, XO("Not enough space"),
134 XO("There is not enough space to expand the clip to its original speed."),
135 {});
137 }
138 else
139 {
142 XO("Reset Clip Speed"), XO("Reset Clip Speed"));
143 }
144 }
145 else
146 {
147 const auto focusedGroup = mType == Type::Pitch ?
150 BasicUI::CallAfter([project = pProject->weak_from_this(), track = mTrack,
151 clip = mClip, focusedGroup] {
152 if (auto pProject = project.lock())
153 PitchAndSpeedDialog::Get(*pProject)
154 .Retarget(track, clip)
155 .SetFocus(focusedGroup);
156 });
157 }
159}
XO("Cut/Copy/Paste")
const auto project
std::shared_ptr< WaveTrack > mTrack
void PushState(const TranslatableString &desc, const TranslatableString &shortDesc)
static ProjectHistory & Get(AudacityProject &project)
void CallAfter(Action action)
Schedule an action to be done later, and in the main thread.
Definition: BasicUI.cpp:213
void ShowErrorDialog(const WindowPlacement &placement, const TranslatableString &dlogTitle, const TranslatableString &message, const ManualPageID &helpPage, const ErrorDialogOptions &options={})
Show an error dialog with a link to the manual for further help.
Definition: BasicUI.h:264
WAVE_TRACK_API bool SetClipStretchRatio(const WaveTrack &track, WaveTrack::Interval &interval, double stretchRatio)
void SelectClip(AudacityProject &project, const WaveTrack::Interval &clip)
Window placement information for wxWidgetsBasicUI can be constructed from a wxWindow pointer.

References BasicUI::CallAfter(), TrackPanelMouseEvent::event, ProjectHistory::Get(), HighlitClipButtonHandle::mClip, HighlitClipButtonHandle::mTrack, mType, Pitch, Pitch, project, ProjectHistory::PushState(), RefreshCode::RefreshNone, WaveClipUIUtilities::SelectClip(), TimeStretching::SetClipStretchRatio(), BasicUI::ShowErrorDialog(), Speed, and XO().

Here is the call graph for this function:

◆ Preview()

HitTestPreview ClipPitchAndSpeedButtonHandle::Preview ( const TrackPanelMouseState state,
AudacityProject pProject 
)
overrideprivatevirtual

Implements UIHandle.

Definition at line 161 of file ClipPitchAndSpeedButtonHandle.cpp.

163{
164 const auto ctrlDown = state.state.CmdDown();
165 const bool macOs = wxPlatformInfo::Get().GetOperatingSystemId() & wxOS_MAC;
166 if (mType == Type::Pitch)
167 return { ctrlDown ? XO("Click to reset clip pitch.") :
168 macOs ? XO("Click to change clip pitch, Cmd + click to reset.") :
169 XO("Click to change clip pitch, Ctrl + click to reset."),
170 nullptr };
171 else
172 return { ctrlDown ? XO("Click to reset clip speed.") :
173 macOs ? XO("Click to change clip speed, Cmd + click to reset.") :
174 XO("Click to change clip speed, Ctrl + click to reset."),
175 nullptr };
176}
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:201

References BasicUI::Get(), mType, Pitch, TrackPanelMouseState::state, and XO().

Here is the call graph for this function:

Member Data Documentation

◆ mType

Type ClipPitchAndSpeedButtonHandle::mType
private

Definition at line 38 of file ClipPitchAndSpeedButtonHandle.h.

Referenced by DoDraw(), DoRelease(), and Preview().


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