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

Public Member Functions

 QPCell (AdornedRulerPanel *parent)
 
std::vector< UIHandlePtrHitTest (const TrackPanelMouseState &state, const AudacityProject *pProject) override
 
std::shared_ptr< TrackPanelCellContextMenuDelegate () override
 
bool Clicked () const
 
- Public Member Functions inherited from AdornedRulerPanel::CommonCell
 CommonCell (AdornedRulerPanel *parent, MenuChoice menuChoice)
 
HitTestPreview DefaultPreview (const TrackPanelMouseState &, const AudacityProject *) override
 
unsigned DoContextMenu (const wxRect &, wxWindow *, const wxPoint *pPosition, AudacityProject *) final
 
- Public Member Functions inherited from TrackPanelCell
 TrackPanelCell ()=default
 
 TrackPanelCell (const TrackPanelCell &)=delete
 
TrackPanelCelloperator= (const TrackPanelCell &)=delete
 
virtual ~TrackPanelCell ()=0
 
virtual HitTestPreview DefaultPreview (const TrackPanelMouseState &state, const AudacityProject *pProject)
 
virtual std::vector< UIHandlePtrHitTest (const TrackPanelMouseState &state, const AudacityProject *pProject)=0
 
virtual unsigned HandleWheelRotation (const TrackPanelMouseEvent &event, AudacityProject *pProject)
 
virtual std::shared_ptr< TrackPanelCellContextMenuDelegate ()
 
virtual unsigned DoContextMenu (const wxRect &rect, wxWindow *pParent, const wxPoint *pPosition, AudacityProject *pProject)
 
virtual unsigned CaptureKey (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
 
virtual unsigned KeyDown (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
 
virtual unsigned KeyUp (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
 
virtual unsigned Char (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
 
virtual unsigned LoseFocus (AudacityProject *project)
 
- Public Member Functions inherited from TrackPanelNode
 TrackPanelNode ()
 
virtual ~TrackPanelNode ()=0
 
- 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)
 

Public Attributes

std::weak_ptr< ResizePlayRegionHandlemResizePlayRegionHolder
 
std::weak_ptr< MovePlayRegionHandlemMovePlayRegionHolder
 
std::weak_ptr< NewPlayRegionHandlemNewPlayRegionHolder
 
std::weak_ptr< PlayheadHandle > mPlayheadHolder
 

Additional Inherited Members

- 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 AdornedRulerPanel::CommonCell
AdornedRulerPanelmParent
 
const MenuChoice mMenuChoice
 

Detailed Description

Definition at line 1023 of file AdornedRulerPanel.cpp.

Constructor & Destructor Documentation

◆ QPCell()

AdornedRulerPanel::QPCell::QPCell ( AdornedRulerPanel parent)
inlineexplicit

Member Function Documentation

◆ Clicked()

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

Definition at line 1039 of file AdornedRulerPanel.cpp.

1039 {
1040#ifdef QUICK_PLAY_HANDLE
1041 if (auto ptr = mHolder.lock())
1042 return ptr->Clicked();
1043#endif
1044 return false;
1045 }

◆ ContextMenuDelegate()

std::shared_ptr< TrackPanelCell > AdornedRulerPanel::QPCell::ContextMenuDelegate ( )
inlineoverridevirtual

Reimplemented from TrackPanelCell.

Definition at line 1036 of file AdornedRulerPanel.cpp.

1037 { return mParent->mQPCell; }
std::shared_ptr< QPCell > mQPCell

References AdornedRulerPanel::CommonCell::mParent, and AdornedRulerPanel::mQPCell.

◆ HitTest()

std::vector< UIHandlePtr > AdornedRulerPanel::QPCell::HitTest ( const TrackPanelMouseState state,
const AudacityProject pProject 
)
overridevirtual

Implements TrackPanelCell.

Definition at line 1057 of file AdornedRulerPanel.cpp.

1060{
1061 // Creation of overlays on demand here -- constructor of AdornedRulerPanel
1062 // is too early to do it
1064
1065 std::vector<UIHandlePtr> results;
1066 auto xx = state.state.m_x;
1067
1068 {
1069 // Allow click and drag on the play head even while recording
1070 // Make this handle more prominent then the quick play handle
1071 auto result = PlayheadHandle::HitTest( pProject, *mParent, xx );
1072 if (result) {
1073 result = AssignUIHandlePtr( mPlayheadHolder, result );
1074 results.push_back( result );
1075 }
1076 }
1077
1078 // Disable mouse actions on Timeline while recording.
1079 if (!mParent->mIsRecording) {
1081
1082 #if 0
1083 auto result = std::make_shared<QPHandle>( mParent, xx );
1084 result = AssignUIHandlePtr( mHolder, result );
1085 results.push_back( result );
1086 #endif
1087 }
1088
1089 // High priority hit is a handle to change the existing play region
1090 bool hitLeft = false;
1091 const auto &playRegion = ViewInfo::Get(*pProject).playRegion;
1092 if ((hitLeft =
1093 mParent->IsWithinMarker(xx, playRegion.GetLastActiveStart())) ||
1094 mParent->IsWithinMarker(xx, playRegion.GetLastActiveEnd()))
1095 {
1096 auto result =
1097 std::make_shared<ResizePlayRegionHandle>( mParent, xx, hitLeft );
1098 result = AssignUIHandlePtr( mResizePlayRegionHolder, result );
1099 results.push_back(result);
1100 }
1101
1102 // Middle priority hit is a handle to change the existing play region at
1103 // both ends, but only when the play region is active
1104 if (auto time = mParent->Pos2Time(xx);
1105 playRegion.Active() &&
1106 time >= playRegion.GetStart() &&
1107 time <= playRegion.GetEnd())
1108 {
1109 auto result =
1110 std::make_shared<MovePlayRegionHandle>( mParent, xx );
1111 result = AssignUIHandlePtr( mMovePlayRegionHolder, result );
1112 results.push_back(result);
1113 }
1114
1115 // Lowest priority hit is a handle to drag a completely new play region
1116 {
1117 auto result = std::make_shared<NewPlayRegionHandle>( mParent, xx );
1118 result = AssignUIHandlePtr( mNewPlayRegionHolder, result );
1119 results.push_back(result);
1120 }
1121
1122 return results;
1123}
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
Definition: UIHandle.h:164
std::weak_ptr< NewPlayRegionHandle > mNewPlayRegionHolder
std::weak_ptr< PlayheadHandle > mPlayheadHolder
std::weak_ptr< ResizePlayRegionHandle > mResizePlayRegionHolder
std::weak_ptr< MovePlayRegionHandle > mMovePlayRegionHolder
bool IsWithinMarker(int mousePosX, double markerTime)
void UpdateQuickPlayPos(wxCoord &mousePosX)
double Pos2Time(int p, bool ignoreFisheye=false) const
PlayRegion playRegion
Definition: ViewInfo.h:216
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:235
bool HitTest(const RectangleArgs &args, const wxPoint &mousePos)

References AssignUIHandlePtr(), ViewInfo::Get(), LowlitClipButton::HitTest(), ViewInfo::playRegion, and TrackPanelMouseState::state.

Here is the call graph for this function:

Member Data Documentation

◆ mMovePlayRegionHolder

std::weak_ptr<MovePlayRegionHandle> AdornedRulerPanel::QPCell::mMovePlayRegionHolder

Definition at line 1052 of file AdornedRulerPanel.cpp.

◆ mNewPlayRegionHolder

std::weak_ptr<NewPlayRegionHandle> AdornedRulerPanel::QPCell::mNewPlayRegionHolder

Definition at line 1053 of file AdornedRulerPanel.cpp.

◆ mPlayheadHolder

std::weak_ptr<PlayheadHandle> AdornedRulerPanel::QPCell::mPlayheadHolder

Definition at line 1054 of file AdornedRulerPanel.cpp.

◆ mResizePlayRegionHolder

std::weak_ptr<ResizePlayRegionHandle> AdornedRulerPanel::QPCell::mResizePlayRegionHolder

Definition at line 1051 of file AdornedRulerPanel.cpp.


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