Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
AdornedRulerPanel::CommonRulerHandle Class Reference
Inheritance diagram for AdornedRulerPanel::CommonRulerHandle:
[legend]
Collaboration diagram for AdornedRulerPanel::CommonRulerHandle:
[legend]

Public Member Functions

 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)
 

Static Public Member Functions

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

enum class  Button { None , Left , Right }
 

Protected Member Functions

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

wxWeakRef< AdornedRulerPanelmParent
 
wxCoord mX
 
wxCoord mClickedX
 
MenuChoice mChoice
 
Button mClicked { Button::None }
 
- Protected Attributes inherited from UIHandle
Result mChangeHighlight { 0 }
 

Additional Inherited Members

- Public Types inherited from UIHandle
using Result = unsigned
 
using Cell = TrackPanelCell
 

Detailed Description

Definition at line 122 of file AdornedRulerPanel.cpp.

Member Enumeration Documentation

◆ Button

Enumerator
None 
Left 
Right 

Definition at line 212 of file AdornedRulerPanel.cpp.

212{ None, Left, Right };

Constructor & Destructor Documentation

◆ CommonRulerHandle()

AdornedRulerPanel::CommonRulerHandle::CommonRulerHandle ( AdornedRulerPanel pParent,
wxCoord  xx,
MenuChoice  menuChoice 
)
inline

Definition at line 125 of file AdornedRulerPanel.cpp.

127 : mParent(pParent)
128 , mX( xx )
129 , mClickedX( xx )
130 , mChoice( menuChoice )
131 {}
wxWeakRef< AdornedRulerPanel > mParent

Member Function Documentation

◆ Cancel()

Result AdornedRulerPanel::CommonRulerHandle::Cancel ( AudacityProject )
inlineoverrideprotectedvirtual

Implements UIHandle.

Reimplemented in AdornedRulerPanel::PlayRegionAdjustingHandle, and AdornedRulerPanel::ScrubbingHandle.

Definition at line 195 of file AdornedRulerPanel.cpp.

196 {
198 }

References RefreshCode::DrawOverlays.

Referenced by AdornedRulerPanel::PlayRegionAdjustingHandle::Cancel(), and AdornedRulerPanel::ScrubbingHandle::Cancel().

Here is the caller graph for this function:

◆ Click()

Result AdornedRulerPanel::CommonRulerHandle::Click ( const TrackPanelMouseEvent event,
AudacityProject  
)
inlineoverrideprotectedvirtual

Implements UIHandle.

Reimplemented in AdornedRulerPanel::ScrubbingHandle.

Definition at line 149 of file AdornedRulerPanel.cpp.

References RefreshCode::DrawOverlays, Left, mClicked, mClickedX, and Right.

Referenced by AdornedRulerPanel::ScrubbingHandle::Click().

Here is the caller graph for this function:

◆ Clicked()

bool AdornedRulerPanel::CommonRulerHandle::Clicked ( ) const
inline

Definition at line 136 of file AdornedRulerPanel.cpp.

References mClicked, and None.

Referenced by AdornedRulerPanel::TrackPanelGuidelineOverlay::Draw(), and AdornedRulerPanel::PlayRegionAdjustingHandle::Unsnap().

Here is the caller graph for this function:

◆ Drag()

Result AdornedRulerPanel::CommonRulerHandle::Drag ( const TrackPanelMouseEvent ,
AudacityProject  
)
inlineoverrideprotectedvirtual

Implements UIHandle.

Reimplemented in AdornedRulerPanel::PlayRegionAdjustingHandle, and AdornedRulerPanel::ScrubbingHandle.

Definition at line 157 of file AdornedRulerPanel.cpp.

159 {
161 }

References RefreshCode::DrawOverlays.

Referenced by AdornedRulerPanel::PlayRegionAdjustingHandle::Drag(), and AdornedRulerPanel::ScrubbingHandle::Drag().

Here is the caller graph for this function:

◆ Enter()

void AdornedRulerPanel::CommonRulerHandle::Enter ( bool  ,
AudacityProject  
)
inlineoverrideprotectedvirtual

Reimplemented from UIHandle.

Definition at line 200 of file AdornedRulerPanel.cpp.

201 {
203 }
Result mChangeHighlight
Definition: UIHandle.h:152

References RefreshCode::DrawOverlays, and UIHandle::mChangeHighlight.

◆ FindTrack()

std::shared_ptr< const Track > AdornedRulerPanel::CommonRulerHandle::FindTrack ( ) const
inlineoverridevirtual
Returns
pointer to associated track, if any

Implements UIHandle.

Definition at line 133 of file AdornedRulerPanel.cpp.

134 { return nullptr; }

◆ HandlesRightClick()

bool AdornedRulerPanel::CommonRulerHandle::HandlesRightClick ( )
inlineoverrideprotectedvirtual

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

147{ return true; }

◆ NeedChangeHighlight()

static UIHandle::Result AdornedRulerPanel::CommonRulerHandle::NeedChangeHighlight ( const CommonRulerHandle oldState,
const CommonRulerHandle newState 
)
inlinestatic

Definition at line 138 of file AdornedRulerPanel.cpp.

140 {
141 if (oldState.mX != newState.mX)
143 return 0;
144 }

References RefreshCode::DrawOverlays, and mX.

◆ Release()

Result AdornedRulerPanel::CommonRulerHandle::Release ( const TrackPanelMouseEvent event,
AudacityProject ,
wxWindow *   
)
inlineoverrideprotectedvirtual

Implements UIHandle.

Reimplemented in AdornedRulerPanel::PlayRegionAdjustingHandle, and AdornedRulerPanel::ScrubbingHandle.

Definition at line 163 of file AdornedRulerPanel.cpp.

166 {
167 if ( mParent && mClicked == Button::Right ) {
168 const auto pos = event.event.GetPosition();
169 mParent->ShowContextMenu( mChoice, &pos );
170 }
172 }

References RefreshCode::DrawOverlays, mChoice, mClicked, mParent, and Right.

Referenced by AdornedRulerPanel::PlayRegionAdjustingHandle::Release(), and AdornedRulerPanel::ScrubbingHandle::Release().

Here is the caller graph for this function:

◆ StartPlay()

void AdornedRulerPanel::CommonRulerHandle::StartPlay ( AudacityProject project,
const wxMouseEvent &  event 
)
inlineprotected

Definition at line 181 of file AdornedRulerPanel.cpp.

182 {
184
185 // Keep a shared pointer to self. Otherwise *this might get deleted
186 // in HandleQPRelease on Windows! Because there is an event-loop yield
187 // stopping playback, which caused OnCaptureLost to be called, which caused
188 // clearing of CellularPanel targets!
189 auto saveMe = ruler.Target();
190
191 const auto startTime = Time(project);
192 ruler.StartQPPlay(!event.ShiftDown(), false, &startTime);
193 }
const auto project
double Time(AudacityProject &project) const
static AdornedRulerPanel & Get(AudacityProject &project)

References AdornedRulerPanel::Get(), project, anonymous_namespace{TimeTrackVRulerControls.cpp}::ruler(), and Time().

Referenced by AdornedRulerPanel::PlayRegionAdjustingHandle::Release().

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

◆ Time()

double AdornedRulerPanel::CommonRulerHandle::Time ( AudacityProject project) const
inlineprotected

Definition at line 174 of file AdornedRulerPanel.cpp.

175 {
176 auto &viewInfo = ViewInfo::Get(project);
177 return viewInfo.PositionToTime(mX, viewInfo.GetLeftOffset());
178 }
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:235

References ViewInfo::Get(), mX, and project.

Referenced by AdornedRulerPanel::MovePlayRegionHandle::DoStartAdjust(), and StartPlay().

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

Member Data Documentation

◆ mChoice

MenuChoice AdornedRulerPanel::CommonRulerHandle::mChoice
protected

Definition at line 210 of file AdornedRulerPanel.cpp.

Referenced by Release().

◆ mClicked

Button AdornedRulerPanel::CommonRulerHandle::mClicked { Button::None }
protected

◆ mClickedX

wxCoord AdornedRulerPanel::CommonRulerHandle::mClickedX
protected

◆ mParent

wxWeakRef<AdornedRulerPanel> AdornedRulerPanel::CommonRulerHandle::mParent
protected

◆ mX

wxCoord AdornedRulerPanel::CommonRulerHandle::mX
protected

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