Audacity  3.0.3
Classes | Public Member Functions | Static 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

virtual const TCPLinesGetTCPLines () const
 
 TrackControls (std::shared_ptr< Track > pTrack)
 
- Public Member Functions inherited from TrackControls
 TrackControls (std::shared_ptr< Track > pTrack)
 
virtual ~TrackControls ()=0
 
- Public Member Functions inherited from CommonTrackCell
 CommonTrackCell (const std::shared_ptr< Track > &pTrack)
 
 ~CommonTrackCell ()
 
virtual void CopyTo (Track &track) const
 
std::shared_ptr< TrackDoFindTrack () override
 
virtual void Reparent (const std::shared_ptr< Track > &parent)
 
virtual void WriteXMLAttributes (XMLWriter &) const
 
virtual bool HandleXMLAttribute (const wxChar *attr, const wxChar *value)
 
- 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 &) PROHIBITED
 
TrackPanelCelloperator= (const TrackPanelCell &) PROHIBITED
 
virtual ~TrackPanelCell ()=0
 
virtual std::shared_ptr< TrackPanelCellContextMenuDelegate ()
 
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
 

Static Public Member Functions

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

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
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

- Public Types inherited from CommonTrackPanelCell
using Hook = std::function< unsigned(const TrackPanelMouseEvent &evt, AudacityProject *pProject) >
 

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

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

References PopupMenuTable::BuildMenu(), PopupMenuTable::ExtendMenu(), CommonTrackPanelCell::FindTrack(), GetMenuExtension(), TrackInfo::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 354 of file CommonTrackControls.cpp.

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

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

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

References TrackArtist::PassControls.

◆ GetMenuExtension()

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

Implemented in TimeTrackControls, WaveTrackControls, NoteTrackControls, and LabelTrackControls.

Referenced by DoContextMenu().

Here is the caller graph for this function:

◆ GetTCPLines()

const TCPLines & CommonTrackControls::GetTCPLines ( ) const
virtual

Reimplemented in WaveTrackControls, and NoteTrackControls.

Definition at line 190 of file TrackInfo.cpp.

191 {
192  return commonTrackTCPLines();
193 }

References commonTrackTCPLines().

Referenced by TrackInfo::DrawItems().

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

◆ HitTest()

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

Implements TrackPanelCell.

Implemented in TimeTrackControls, WaveTrackControls, NoteTrackControls, and LabelTrackControls.

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 }

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:

◆ StaticTCPLines()

const TCPLines & CommonTrackControls::StaticTCPLines ( )
static

Definition at line 122 of file TrackInfo.cpp.

123 {
124  return commonTrackTCPLines();
125 }

References commonTrackTCPLines().

Referenced by NoteTrackTCPLines::NoteTrackTCPLines(), and PlayableTrackControls::StaticTCPLines().

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

◆ TrackControls()

TrackControls::TrackControls
explicit

Definition at line 26 of file TrackControls.cpp.

17  : CommonTrackCell{ pTrack }
18 {
19 }

References AttachedVirtualFunction< Tag, Return, This, Arguments >::Call(), Track::GetTrackControls(), and Track::SetTrackControls().

Here is the call graph for this function:

Member Data Documentation

◆ mCloseHandle

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

Definition at line 70 of file CommonTrackControls.h.

Referenced by HitTest().

◆ mMenuHandle

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

Definition at line 71 of file CommonTrackControls.h.

Referenced by HitTest().

◆ mMinimizeHandle

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

Definition at line 72 of file CommonTrackControls.h.

Referenced by HitTest().

◆ mSelectButtonHandle

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

Definition at line 73 of file CommonTrackControls.h.

Referenced by HitTest().

◆ mSelectHandle

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

Definition at line 74 of file CommonTrackControls.h.

Referenced by HitTest().


The documentation for this class was generated from the following files:
CommonTrackControls::mMinimizeHandle
std::weak_ptr< MinimizeButtonHandle > mMinimizeHandle
Definition: CommonTrackControls.h:72
MenuButtonHandle::HitTest
static UIHandlePtr HitTest(std::weak_ptr< MenuButtonHandle > &holder, const wxMouseState &state, const wxRect &rect, const std::shared_ptr< TrackPanelCell > &pCell)
Definition: TrackButtonHandles.cpp:250
CommonTrackControls::mMenuHandle
std::weak_ptr< MenuButtonHandle > mMenuHandle
Definition: CommonTrackControls.h:71
TrackMenuTable::Instance
static TrackMenuTable & Instance()
Definition: CommonTrackControls.cpp:109
RefreshCode::RefreshNone
@ RefreshNone
Definition: RefreshCode.h:21
CommonTrackControls::mSelectHandle
std::weak_ptr< TrackSelectHandle > mSelectHandle
Definition: CommonTrackControls.h:74
CommonTrackControls::mSelectButtonHandle
std::weak_ptr< SelectButtonHandle > mSelectButtonHandle
Definition: CommonTrackControls.h:73
PopupMenuTable
Definition: PopupMenuTable.h:115
CommonTrackPanelCell::FindTrack
std::shared_ptr< Track > FindTrack()
Definition: CommonTrackPanelCell.h:46
TrackPanelDrawingContext::dc
wxDC & dc
Definition: TrackPanelDrawingContext.h:23
AColor::BevelTrackInfo
static void BevelTrackInfo(wxDC &dc, bool up, const wxRect &r, bool highlight=false)
Definition: AColor.cpp:248
TrackInfo::DrawItems
AUDACITY_DLL_API void DrawItems(TrackPanelDrawingContext &context, const wxRect &rect, const Track &track)
Definition: TrackInfo.cpp:217
TrackInfo::GetTitleBarRect
AUDACITY_DLL_API void GetTitleBarRect(const wxRect &rect, wxRect &dest)
Definition: TrackInfo.cpp:479
CommonTrackControls::mCloseHandle
std::weak_ptr< CloseButtonHandle > mCloseHandle
Definition: CommonTrackControls.h:70
CloseButtonHandle::HitTest
static UIHandlePtr HitTest(std::weak_ptr< CloseButtonHandle > &holder, const wxMouseState &state, const wxRect &rect, TrackPanelCell *pCell)
Definition: TrackButtonHandles.cpp:190
TrackSelectHandle::HitAnywhere
static UIHandlePtr HitAnywhere(std::weak_ptr< TrackSelectHandle > &holder, const std::shared_ptr< Track > &pTrack)
Definition: TrackSelectHandle.cpp:56
UIHandlePtr
std::shared_ptr< UIHandle > UIHandlePtr
Definition: CellularPanel.h:28
TrackArtist::PassControls
@ PassControls
Definition: TrackArtist.h:84
AColor::MediumTrackInfo
static void MediumTrackInfo(wxDC *dc, bool selected)
Definition: AColor.cpp:341
SelectButtonHandle::HitTest
static UIHandlePtr HitTest(std::weak_ptr< SelectButtonHandle > &holder, const wxMouseState &state, const wxRect &rect, TrackPanelCell *pCell)
Definition: TrackButtonHandles.cpp:124
commonTrackTCPLines
static const TCPLines & commonTrackTCPLines()
Definition: TrackInfo.cpp:103
PopupMenuTable::ExtendMenu
static void ExtendMenu(PopupMenu &menu, PopupMenuTable &otherTable)
Definition: PopupMenuTable.cpp:147
PopupMenuTable::BuildMenu
static std::unique_ptr< PopupMenu > BuildMenu(PopupMenuTable *pTable, void *pUserData=NULL)
Definition: PopupMenuTable.cpp:190
MinimizeButtonHandle::HitTest
static UIHandlePtr HitTest(std::weak_ptr< MinimizeButtonHandle > &holder, const wxMouseState &state, const wxRect &rect, TrackPanelCell *pCell)
Definition: TrackButtonHandles.cpp:69
TrackArtist::PassMargins
@ PassMargins
Definition: TrackArtist.h:82
RefreshCode
Namespace containing an enum 'what to do on a refresh?'.
Definition: RefreshCode.h:16
CommonTrackControls::GetMenuExtension
virtual PopupMenuTable * GetMenuExtension(Track *pTrack)=0
TrackPanelMouseState::state
wxMouseState & state
Definition: TrackPanelMouseEvent.h:38
CommonTrackCell
Definition: CommonTrackPanelCell.h:99