Audacity 3.2.0
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CommonTrackControls Class Referenceabstract

#include <CommonTrackControls.h>

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

Classes

struct  InitMenuData
 

Public Member Functions

const TCPLinesGetTCPLines () const override
 
 TrackControls (std::shared_ptr< Track > pTrack)
 
- Public Member Functions inherited from TrackControls
 TrackControls (std::shared_ptr< Track > pTrack)
 
virtual ~TrackControls ()=0
 
virtual const TrackInfo::TCPLinesGetTCPLines () const =0
 
- Public Member Functions inherited from CommonTrackCell
 CommonTrackCell (const std::shared_ptr< Track > &pTrack)
 Construct from a track. More...
 
 ~CommonTrackCell ()
 
std::shared_ptr< TrackDoFindTrack () override
 
void Reparent (const std::shared_ptr< Track > &parent) override
 Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
 
- Public Member Functions inherited from CommonTrackPanelCell
 CommonTrackPanelCell ()
 
virtual ~CommonTrackPanelCell ()=0
 
HitTestPreview DefaultPreview (const TrackPanelMouseState &, const AudacityProject *) override
 
std::shared_ptr< TrackFindTrack ()
 
std::shared_ptr< const TrackFindTrack () const
 
virtual std::vector< MenuItemGetMenuItems (const wxRect &rect, const wxPoint *pPosition, AudacityProject *pProject)
 Return a list of items for DoContextMenu() (empties for separators) More...
 
- 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 Member Functions inherited from TrackAttachment
virtual ~TrackAttachment ()
 
virtual void CopyTo (Track &track) const
 Copy state, for undo/redo purposes. More...
 
virtual void Reparent (const std::shared_ptr< Track > &parent)
 Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
 
virtual void WriteXMLAttributes (XMLWriter &) const
 Serialize persistent attributes. More...
 
virtual bool HandleXMLAttribute (const std::string_view &attr, const XMLAttributeValueView &valueView)
 Deserialize an attribute, returning true if recognized. More...
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 

Protected Member Functions

virtual std::vector< UIHandlePtrHitTest (const TrackPanelMouseState &state, const AudacityProject *) override=0
 
unsigned DoContextMenu (const wxRect &rect, wxWindow *pParent, const wxPoint *pPosition, AudacityProject *pProject) override
 
virtual PopupMenuTableGetMenuExtension (Track *pTrack)=0
 
void Draw (TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
 
wxRect DrawingArea (TrackPanelDrawingContext &, const wxRect &rect, const wxRect &panelRect, unsigned iPass) override
 
- Protected Member Functions inherited from CommonTrackPanelCell
virtual std::shared_ptr< TrackDoFindTrack ()=0
 
unsigned DoContextMenu (const wxRect &rect, wxWindow *pParent, const wxPoint *pPosition, AudacityProject *pProject) override
 
unsigned HandleWheelRotation (const TrackPanelMouseEvent &event, AudacityProject *pProject) override
 

Protected Attributes

std::weak_ptr< CloseButtonHandlemCloseHandle
 
std::weak_ptr< MenuButtonHandlemMenuHandle
 
std::weak_ptr< MinimizeButtonHandlemMinimizeHandle
 
std::weak_ptr< TrackSelectHandlemSelectHandle
 

Additional Inherited Members

- Static Public Member Functions inherited from TrackControls
static TrackControlsGet (Track &track)
 
static const TrackControlsGet (const Track &track)
 
- 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)
 

Detailed Description

Definition at line 25 of file CommonTrackControls.h.

Member Function Documentation

◆ DoContextMenu()

unsigned CommonTrackControls::DoContextMenu ( const wxRect &  rect,
wxWindow *  pParent,
const wxPoint *  pPosition,
AudacityProject pProject 
)
overrideprotectedvirtual

Reimplemented from TrackPanelCell.

Definition at line 264 of file CommonTrackControls.cpp.

267{
268 using namespace RefreshCode;
269 wxRect buttonRect;
271
272 auto track = FindTrack();
273 if (!track)
274 return RefreshNone;
275
276 InitMenuData data{ *pProject, *track, pParent, RefreshNone };
277
278 const auto pTable = &TrackMenuTable::Instance();
279 auto pMenu = PopupMenuTable::BuildMenu(pTable, &data);
280
281 PopupMenuTable *const pExtension = GetMenuExtension(track.get());
282 if (pExtension)
283 PopupMenuTable::ExtendMenu( *pMenu, *pExtension );
284
285 pMenu->Popup( *pParent,
286 { buttonRect.x + 1, buttonRect.y + buttonRect.height + 1 } );
287
288 return data.result;
289}
virtual PopupMenuTable * GetMenuExtension(Track *pTrack)=0
std::shared_ptr< Track > FindTrack()
static void ExtendMenu(PopupMenu &menu, PopupMenuTable &otherTable)
static std::unique_ptr< PopupMenu > BuildMenu(PopupMenuTable *pTable, void *pUserData=NULL)
static TrackMenuTable & Instance()
AUDACITY_DLL_API void GetTrackMenuButtonRect(const wxRect &rect, wxRect &dest)
Namespace containing an enum 'what to do on a refresh?'.
Definition: RefreshCode.h:16

References PopupMenuTable::BuildMenu(), PopupMenuTable::ExtendMenu(), CommonTrackPanelCell::FindTrack(), GetMenuExtension(), CommonTrackInfo::GetTrackMenuButtonRect(), TrackMenuTable::Instance(), and RefreshCode::RefreshNone.

Here is the call graph for this function:

◆ Draw()

void CommonTrackControls::Draw ( TrackPanelDrawingContext context,
const wxRect &  rect,
unsigned  iPass 
)
overrideprotectedvirtual

Reimplemented from TrackPanelDrawable.

Definition at line 345 of file CommonTrackControls.cpp.

348{
349 if ( iPass == TrackArtist::PassMargins ) {
350 // fill in label
351 auto dc = &context.dc;
352 const auto pTrack = FindTrack();
353 AColor::MediumTrackInfo( dc, pTrack && pTrack->GetSelected() );
354 dc->DrawRectangle( rect_ );
355 }
356
357 if ( iPass == TrackArtist::PassControls ) {
358 // Given rectangle excludes left and right margins, and encompasses a
359 // channel group of tracks, plus the resizer area below
360 auto pTrack = FindTrack();
361
362 // Vaughan, 2010-08-24: No longer doing this.
363 // Draw sync-lock tiles in ruler area.
364 //if (SyncLock::IsSyncLockSelected(t)) {
365 // wxRect tileFill = rect;
366 // tileFill.x = mViewInfo->GetVRulerOffset();
367 // tileFill.width = mViewInfo->GetVRulerWidth();
368 // TrackArt::DrawSyncLockTiles(dc, tileFill);
369 //}
370
371 if (pTrack)
372 // Draw things within the track control panel
373 CommonTrackInfo::DrawItems( context, rect_, *pTrack );
374 }
375}
static void MediumTrackInfo(wxDC *dc, bool selected)
Definition: AColor.cpp:419
AUDACITY_DLL_API void DrawItems(TrackPanelDrawingContext &context, const wxRect &rect, const Track &track)

References TrackPanelDrawingContext::dc, CommonTrackInfo::DrawItems(), CommonTrackPanelCell::FindTrack(), AColor::MediumTrackInfo(), TrackArtist::PassControls, and TrackArtist::PassMargins.

Here is the call graph for this function:

◆ DrawingArea()

wxRect CommonTrackControls::DrawingArea ( TrackPanelDrawingContext ,
const wxRect &  rect,
const wxRect &  panelRect,
unsigned  iPass 
)
overrideprotectedvirtual

Reimplemented from TrackPanelDrawable.

Definition at line 377 of file CommonTrackControls.cpp.

379{
380 return rect;
381}

◆ GetMenuExtension()

virtual PopupMenuTable * CommonTrackControls::GetMenuExtension ( Track pTrack)
protectedpure virtual

Implemented in LabelTrackControls, NoteTrackControls, WaveTrackControls, and TimeTrackControls.

Referenced by DoContextMenu().

Here is the caller graph for this function:

◆ GetTCPLines()

const TCPLines & CommonTrackControls::GetTCPLines ( ) const
overridevirtual

Implements TrackControls.

Definition at line 383 of file CommonTrackControls.cpp.

384{
386}
AUDACITY_DLL_API const TCPLines & StaticTCPLines()

References CommonTrackInfo::StaticTCPLines().

Here is the call graph for this function:

◆ HitTest()

std::vector< UIHandlePtr > CommonTrackControls::HitTest ( const TrackPanelMouseState state,
const AudacityProject  
)
overrideprotectedpure virtual

Implements TrackPanelCell.

Implemented in LabelTrackControls, NoteTrackControls, WaveTrackControls, and TimeTrackControls.

Definition at line 35 of file CommonTrackControls.cpp.

38{
39 // Hits are mutually exclusive, results single
40
41 const wxMouseState &state = st.state;
42 const wxRect &rect = st.rect;
43 UIHandlePtr result;
44 std::vector<UIHandlePtr> results;
45
46 auto sThis = shared_from_this();
47
48 if (NULL != (result = CloseButtonHandle::HitTest(
49 mCloseHandle, state, rect, this)))
50 results.push_back(result);
51
52 if (NULL != (result = MenuButtonHandle::HitTest(
53 mMenuHandle, state, rect, sThis)))
54 results.push_back(result);
55
56 if (NULL != (result = MinimizeButtonHandle::HitTest(
57 mMinimizeHandle, state, rect, this)))
58 results.push_back(result);
59
60 if (results.empty()) {
61 if (NULL != (result = TrackSelectHandle::HitAnywhere(
63 results.push_back(result);
64 }
65
66 return results;
67}
std::shared_ptr< UIHandle > UIHandlePtr
Definition: CellularPanel.h:28
static UIHandlePtr HitTest(std::weak_ptr< CloseButtonHandle > &holder, const wxMouseState &state, const wxRect &rect, TrackPanelCell *pCell)
std::weak_ptr< TrackSelectHandle > mSelectHandle
std::weak_ptr< MenuButtonHandle > mMenuHandle
std::weak_ptr< CloseButtonHandle > mCloseHandle
std::weak_ptr< MinimizeButtonHandle > mMinimizeHandle
static UIHandlePtr HitTest(std::weak_ptr< MenuButtonHandle > &holder, const wxMouseState &state, const wxRect &rect, const std::shared_ptr< TrackPanelCell > &pCell)
static UIHandlePtr HitTest(std::weak_ptr< MinimizeButtonHandle > &holder, const wxMouseState &state, const wxRect &rect, TrackPanelCell *pCell)
static UIHandlePtr HitAnywhere(std::weak_ptr< TrackSelectHandle > &holder, const std::shared_ptr< Track > &pTrack)

References CommonTrackPanelCell::FindTrack(), TrackSelectHandle::HitAnywhere(), CloseButtonHandle::HitTest(), MenuButtonHandle::HitTest(), MinimizeButtonHandle::HitTest(), mCloseHandle, mMenuHandle, mMinimizeHandle, mSelectHandle, TrackPanelMouseState::rect, and TrackPanelMouseState::state.

Referenced by LabelTrackControls::HitTest(), NoteTrackControls::HitTest(), WaveTrackControls::HitTest(), and TimeTrackControls::HitTest().

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

◆ TrackControls()

TrackControls::TrackControls ( std::shared_ptr< Track pTrack)
explicit

Definition at line 27 of file TrackControls.cpp.

17 : CommonTrackCell{ pTrack }
18{
19}

Member Data Documentation

◆ mCloseHandle

std::weak_ptr<CloseButtonHandle> CommonTrackControls::mCloseHandle
protected

Definition at line 64 of file CommonTrackControls.h.

Referenced by HitTest().

◆ mMenuHandle

std::weak_ptr<MenuButtonHandle> CommonTrackControls::mMenuHandle
protected

Definition at line 65 of file CommonTrackControls.h.

Referenced by HitTest().

◆ mMinimizeHandle

std::weak_ptr<MinimizeButtonHandle> CommonTrackControls::mMinimizeHandle
protected

Definition at line 66 of file CommonTrackControls.h.

Referenced by HitTest().

◆ mSelectHandle

std::weak_ptr<TrackSelectHandle> CommonTrackControls::mSelectHandle
protected

Definition at line 67 of file CommonTrackControls.h.

Referenced by HitTest().


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