Audacity  3.0.3
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
CommonTrackView Class Referenceabstract

#include <CommonTrackView.h>

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

Public Member Functions

std::shared_ptr< TrackPanelCellContextMenuDelegate () override
 
std::vector< UIHandlePtrHitTest (const TrackPanelMouseState &, const AudacityProject *pProject) final override
 
void TimeShiftHitTest ()
 
virtual int GetMinimizedHeight () const override
 
 TrackView (const std::shared_ptr< Track > &pTrack)
 
- Public Member Functions inherited from TrackView
 TrackView (const std::shared_ptr< Track > &pTrack)
 
virtual ~TrackView ()=0
 
void CopyTo (Track &track) const override
 
bool GetMinimized () const
 
void SetMinimized (bool minimized)
 
int GetY () const
 
int GetActualHeight () const
 
int GetHeight () const
 
void SetY (int y)
 
void SetHeight (int height)
 
std::shared_ptr< TrackVRulerControlsGetVRulerControls ()
 
std::shared_ptr< const TrackVRulerControlsGetVRulerControls () const
 
void WriteXMLAttributes (XMLWriter &) const override
 
bool HandleXMLAttribute (const wxChar *attr, const wxChar *value) override
 
virtual Refinement GetSubViews (const wxRect &rect)
 
virtual bool IsSpectral () const
 
virtual void DoSetMinimized (bool isMinimized)
 
- Public Member Functions inherited from CommonTrackCell
 CommonTrackCell (const std::shared_ptr< Track > &pTrack)
 
 ~CommonTrackCell ()
 
std::shared_ptr< TrackDoFindTrack () override
 
virtual void Reparent (const std::shared_ptr< Track > &parent)
 
- 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
 
- Public Member Functions inherited from TrackPanelCell
 TrackPanelCell ()=default
 
 TrackPanelCell (const TrackPanelCell &) PROHIBITED
 
TrackPanelCelloperator= (const TrackPanelCell &) PROHIBITED
 
virtual ~TrackPanelCell ()=0
 
virtual unsigned DoContextMenu (const wxRect &rect, wxWindow *pParent, 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)
 
- 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< TimeShiftHandlemTimeShiftHandle
 

Protected Member Functions

virtual std::vector< UIHandlePtrDetailedHitTest (const TrackPanelMouseState &, const AudacityProject *pProject, int currentTool, bool bMultiTool)=0
 
- Protected Member Functions inherited from TrackView
void DoSetY (int y)
 
void DoSetHeight (int h)
 
virtual std::shared_ptr< TrackVRulerControlsDoGetVRulerControls ()=0
 
- Protected Member Functions inherited from CommonTrackPanelCell
unsigned HandleWheelRotation (const TrackPanelMouseEvent &event, AudacityProject *pProject) override
 

Protected Attributes

std::weak_ptr< SelectHandlemSelectHandle
 
- Protected Attributes inherited from TrackView
std::shared_ptr< TrackVRulerControlsmpVRulerControls
 

Additional Inherited Members

- Public Types inherited from TrackView
enum  : unsigned { DefaultHeight = 150 }
 
using Refinement = std::vector< std::pair< wxCoord, std::shared_ptr< TrackView > > >
 
- Public Types inherited from CommonTrackPanelCell
using Hook = std::function< unsigned(const TrackPanelMouseEvent &evt, AudacityProject *pProject) >
 
- Static Public Member Functions inherited from TrackView
static int GetTrackHeight (const Track *pTrack)
 
static int GetChannelGroupHeight (const Track *pTrack)
 
static int GetCumulativeHeight (const Track *pTrack)
 
static int GetTotalHeight (const TrackList &list)
 
static TrackViewGet (Track &)
 
static const TrackViewGet (const 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)
 

Detailed Description

Definition at line 19 of file CommonTrackView.h.

Member Function Documentation

◆ ContextMenuDelegate()

std::shared_ptr< TrackPanelCell > CommonTrackView::ContextMenuDelegate ( )
overridevirtual

Reimplemented from TrackPanelCell.

Definition at line 83 of file CommonTrackView.cpp.

84 {
85  return TrackControls::Get( *FindTrack() ).shared_from_this();
86 }

References CommonTrackPanelCell::FindTrack(), and TrackControls::Get().

Here is the call graph for this function:

◆ DetailedHitTest()

virtual std::vector<UIHandlePtr> CommonTrackView::DetailedHitTest ( const TrackPanelMouseState ,
const AudacityProject pProject,
int  currentTool,
bool  bMultiTool 
)
protectedpure virtual

Implemented in TimeTrackView, WaveTrackView, WaveformView, SpectrumView, NoteTrackView, and LabelTrackView.

Referenced by HitTest().

Here is the caller graph for this function:

◆ GetMinimizedHeight()

int CommonTrackView::GetMinimizedHeight ( ) const
overridevirtual

Implements TrackView.

Definition at line 88 of file CommonTrackView.cpp.

89 {
90  auto height = TrackInfo::MinimumTrackHeight();
91  const auto pTrack = FindTrack();
92  auto channels = TrackList::Channels(pTrack->SubstituteOriginalTrack().get());
93  auto nChannels = channels.size();
94  auto begin = channels.begin();
95  auto index =
96  std::distance(begin, std::find(begin, channels.end(), pTrack.get()));
97  return (height * (index + 1) / nChannels) - (height * index / nChannels);
98 }

References TrackList::Channels(), CommonTrackPanelCell::FindTrack(), and TrackInfo::MinimumTrackHeight().

Here is the call graph for this function:

◆ HitTest()

std::vector< UIHandlePtr > CommonTrackView::HitTest ( const TrackPanelMouseState st,
const AudacityProject pProject 
)
finaloverridevirtual

Implements TrackPanelCell.

Definition at line 29 of file CommonTrackView.cpp.

32 {
33  UIHandlePtr result;
34  using namespace ToolCodes;
35  std::vector<UIHandlePtr> results;
36  const auto &settings = ProjectSettings::Get( *pProject );
37  const auto currentTool = settings.GetTool();
38  const bool isMultiTool = ( currentTool == multiTool );
39 
40  if ( !isMultiTool && currentTool == zoomTool ) {
41  // Zoom tool is a non-selecting tool that takes precedence in all tracks
42  // over all other tools, no matter what detail you point at.
43  result = ZoomHandle::HitAnywhere(
44  BackgroundCell::Get( *pProject ).mZoomHandle );
45  results.push_back(result);
46  return results;
47  }
48 
49  // In other tools, let subclasses determine detailed hits.
50  results =
51  DetailedHitTest( st, pProject, currentTool, isMultiTool );
52 
53  // There are still some general cases.
54 
55  // Sliding applies in more than one track type.
56  if ( !isMultiTool && currentTool == slideTool ) {
58  mTimeShiftHandle, FindTrack(), false);
59  if (result)
60  results.push_back(result);
61  }
62 
63  // Let the multi-tool right-click handler apply only in default of all
64  // other detailed hits.
65  if ( isMultiTool ) {
66  result = ZoomHandle::HitTest(
67  BackgroundCell::Get( *pProject ).mZoomHandle, st.state);
68  if (result)
69  results.push_back(result);
70  }
71 
72  // Finally, default of all is adjustment of the selection box.
73  if ( isMultiTool || currentTool == selectTool ) {
74  result = SelectHandle::HitTest(
75  mSelectHandle, st, pProject, shared_from_this() );
76  if (result)
77  results.push_back(result);
78  }
79 
80  return results;
81 }

References DetailedHitTest(), CommonTrackPanelCell::FindTrack(), ProjectSettings::Get(), BackgroundCell::Get(), TimeShiftHandle::HitAnywhere(), ZoomHandle::HitAnywhere(), SelectHandle::HitTest(), ZoomHandle::HitTest(), mSelectHandle, mTimeShiftHandle, ToolCodes::multiTool, BackgroundCell::mZoomHandle, ToolCodes::selectTool, settings(), ToolCodes::slideTool, TrackPanelMouseState::state, and ToolCodes::zoomTool.

Referenced by anonymous_namespace{WaveTrackView.cpp}::SubViewAdjustHandle::HitTest().

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

◆ TimeShiftHitTest()

void CommonTrackView::TimeShiftHitTest ( )

◆ TrackView()

TrackView::TrackView
explicit

Definition at line 32 of file TrackView.cpp.

20  : CommonTrackCell{ pTrack }
21 {
23 }

Member Data Documentation

◆ mSelectHandle

std::weak_ptr<SelectHandle> CommonTrackView::mSelectHandle
protected

Definition at line 45 of file CommonTrackView.h.

Referenced by HitTest().

◆ mTimeShiftHandle

std::weak_ptr<TimeShiftHandle> CommonTrackView::mTimeShiftHandle

Definition at line 48 of file CommonTrackView.h.

Referenced by WaveTrackView::DoDetailedHitTest(), and HitTest().


The documentation for this class was generated from the following files:
TrackView::DoSetHeight
void DoSetHeight(int h)
Definition: TrackView.cpp:163
ToolCodes::selectTool
@ selectTool
Definition: ProjectSettings.h:35
ToolCodes
Definition: ProjectSettings.h:33
AttachedVirtualFunction::Call
static Return Call(This &obj, Arguments &&...arguments)
Invoke the method – but only after static initialization time.
Definition: AttachedVirtualFunction.h:229
CommonTrackView::mTimeShiftHandle
std::weak_ptr< TimeShiftHandle > mTimeShiftHandle
Definition: CommonTrackView.h:48
TrackInfo::MinimumTrackHeight
AUDACITY_DLL_API unsigned MinimumTrackHeight()
Definition: TrackInfo.cpp:196
TrackControls::Get
static TrackControls & Get(Track &track)
Definition: TrackControls.cpp:25
ToolCodes::zoomTool
@ zoomTool
Definition: ProjectSettings.h:38
CommonTrackPanelCell::FindTrack
std::shared_ptr< Track > FindTrack()
Definition: CommonTrackPanelCell.h:44
TrackList::Channels
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
Definition: Track.h:1467
ProjectSettings::Get
static ProjectSettings & Get(AudacityProject &project)
Definition: ProjectSettings.cpp:40
BackgroundCell::mZoomHandle
std::weak_ptr< ZoomHandle > mZoomHandle
Definition: BackgroundCell.h:63
ZoomHandle::HitAnywhere
static UIHandlePtr HitAnywhere(std::weak_ptr< ZoomHandle > &holder)
Definition: ZoomHandle.cpp:65
CommonTrackView::mSelectHandle
std::weak_ptr< SelectHandle > mSelectHandle
Definition: CommonTrackView.h:45
ToolCodes::multiTool
@ multiTool
Definition: ProjectSettings.h:40
ZoomHandle::HitTest
static UIHandlePtr HitTest(std::weak_ptr< ZoomHandle > &holder, const wxMouseState &state)
Definition: ZoomHandle.cpp:73
BackgroundCell::Get
static BackgroundCell & Get(AudacityProject &project)
Definition: BackgroundCell.cpp:93
UIHandlePtr
std::shared_ptr< UIHandle > UIHandlePtr
Definition: CellularPanel.h:28
ToolCodes::slideTool
@ slideTool
Definition: ProjectSettings.h:39
SelectHandle::HitTest
static UIHandlePtr HitTest(std::weak_ptr< SelectHandle > &holder, const TrackPanelMouseState &state, const AudacityProject *pProject, const std::shared_ptr< TrackView > &pTrackView)
Definition: SelectHandle.cpp:362
CommonTrackView::DetailedHitTest
virtual std::vector< UIHandlePtr > DetailedHitTest(const TrackPanelMouseState &, const AudacityProject *pProject, int currentTool, bool bMultiTool)=0
settings
static Settings & settings()
Definition: TrackInfo.cpp:87
TimeShiftHandle::HitAnywhere
static UIHandlePtr HitAnywhere(std::weak_ptr< TimeShiftHandle > &holder, const std::shared_ptr< Track > &pTrack, bool gripHit)
Definition: TimeShiftHandle.cpp:65
TrackPanelMouseState::state
wxMouseState & state
Definition: TrackPanelMouseEvent.h:38
CommonTrackCell
Definition: CommonTrackPanelCell.h:59