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, size_t iChannel)
 Construct from a track and a channel index. More...
 
 CommonTrackCell (ChannelGroup &group, size_t iChannel)
 Construct from a channel group and a channel index. 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...
 
size_t GetChannelIndex () const
 
std::shared_ptr< ChannelFindChannel ()
 May return null. More...
 
std::shared_ptr< const ChannelFindChannel () const
 May return null. 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< SelectButtonHandlemSelectButtonHandle
 
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 26 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 271 of file CommonTrackControls.cpp.

274{
275 using namespace RefreshCode;
276 wxRect buttonRect;
277 CommonTrackInfo::GetTitleBarRect(rect, buttonRect);
278
279 auto track = FindTrack();
280 if (!track)
281 return RefreshNone;
282
283 InitMenuData data{ *pProject, track.get(), pParent, RefreshNone };
284
285 const auto pTable = &TrackMenuTable::Instance();
286 auto pMenu = PopupMenuTable::BuildMenu(pTable, &data);
287
288 PopupMenuTable *const pExtension = GetMenuExtension(track.get());
289 if (pExtension)
290 PopupMenuTable::ExtendMenu( *pMenu, *pExtension );
291
292 pMenu->Popup( *pParent,
293 { buttonRect.x + 1, buttonRect.y + buttonRect.height + 1 } );
294
295 return data.result;
296}
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 GetTitleBarRect(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::GetTitleBarRect(), 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 352 of file CommonTrackControls.cpp.

355{
356 if ( iPass == TrackArtist::PassMargins ) {
357 // fill in label
358 auto dc = &context.dc;
359 const auto pTrack = FindTrack();
360 AColor::MediumTrackInfo( dc, pTrack && pTrack->GetSelected() );
361 dc->DrawRectangle( rect_ );
362 }
363
364 if ( iPass == TrackArtist::PassControls ) {
365 // Given rectangle excludes left and right margins, and encompasses a
366 // channel group of tracks, plus the resizer area below
367 auto pTrack = FindTrack();
368 // First counteract DrawingArea() correction
369 wxRect rect{ rect_.x, rect_.y, rect_.width - 1, rect_.height };
370
371 // Vaughan, 2010-08-24: No longer doing this.
372 // Draw sync-lock tiles in ruler area.
373 //if (SyncLock::IsSyncLockSelected(t)) {
374 // wxRect tileFill = rect;
375 // tileFill.x = mViewInfo->GetVRulerOffset();
376 // tileFill.width = mViewInfo->GetVRulerWidth();
377 // TrackArt::DrawSyncLockTiles(dc, tileFill);
378 //}
379
380 if (pTrack)
381 // Draw things within the track control panel
382 CommonTrackInfo::DrawItems( context, rect, *pTrack );
383
384 //mTrackInfo.DrawBordersWithin( dc, rect, *t );
385 }
386
387 // Some old cut-and-paste legacy from TrackPanel.cpp here:
388#undef USE_BEVELS
389#ifdef USE_BEVELS
390 // This branch is not now used
391 // PRL: todo: banish magic numbers.
392 // PRL: vrul was the x coordinate of left edge of the vertical ruler.
393 // PRL: bHasMuteSolo was true iff the track was WaveTrack.
394 if( bHasMuteSolo )
395 {
396 int ylast = rect.height-20;
397 int ybutton = wxMin(32,ylast-17);
398 int ybuttonEnd = 67;
399
400 fill=wxRect( rect.x+1, rect.y+17, vrul-6, ybutton);
401 AColor::BevelTrackInfo( *dc, true, fill );
402
403 if( ybuttonEnd < ylast ){
404 fill=wxRect( rect.x+1, rect.y+ybuttonEnd, fill.width, ylast - ybuttonEnd);
405 AColor::BevelTrackInfo( *dc, true, fill );
406 }
407 }
408 else
409 {
410 fill=wxRect( rect.x+1, rect.y+17, vrul-6, rect.height-37);
411 AColor::BevelTrackInfo( *dc, true, fill );
412 }
413#endif
414
415}
static void MediumTrackInfo(wxDC *dc, bool selected)
Definition: AColor.cpp:433
static void BevelTrackInfo(wxDC &dc, bool up, const wxRect &r, bool highlight=false)
Definition: AColor.cpp:340
AUDACITY_DLL_API void DrawItems(TrackPanelDrawingContext &context, const wxRect &rect, const Track &track)

References AColor::BevelTrackInfo(), 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 417 of file CommonTrackControls.cpp.

420{
421 if ( iPass == TrackArtist::PassControls )
422 // Some bevels spill out right
423 return { rect.x, rect.y, rect.width + 1, rect.height };
424 else
425 return rect;
426}

References TrackArtist::PassControls.

◆ 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 428 of file CommonTrackControls.cpp.

429{
431}
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 (NULL != (result = SelectButtonHandle::HitTest(
61 mSelectButtonHandle, state, rect, this)))
62 results.push_back(result);
63
64 if (results.empty()) {
65 if (NULL != (result = TrackSelectHandle::HitAnywhere(
67 results.push_back(result);
68 }
69
70 return results;
71}
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< SelectButtonHandle > mSelectButtonHandle
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 HitTest(std::weak_ptr< SelectButtonHandle > &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(), SelectButtonHandle::HitTest(), mCloseHandle, mMenuHandle, mMinimizeHandle, mSelectButtonHandle, 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, 0 }
18{
19}

Member Data Documentation

◆ mCloseHandle

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

Definition at line 65 of file CommonTrackControls.h.

Referenced by HitTest().

◆ mMenuHandle

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

Definition at line 66 of file CommonTrackControls.h.

Referenced by HitTest().

◆ mMinimizeHandle

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

Definition at line 67 of file CommonTrackControls.h.

Referenced by HitTest().

◆ mSelectButtonHandle

std::weak_ptr<SelectButtonHandle> CommonTrackControls::mSelectButtonHandle
protected

Definition at line 68 of file CommonTrackControls.h.

Referenced by HitTest().

◆ mSelectHandle

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

Definition at line 69 of file CommonTrackControls.h.

Referenced by HitTest().


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