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:
Collaboration diagram for CommonTrackView:

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 GetCumulativeHeightBefore () const
int GetExpandedHeight () const
int GetHeight () const
void SetCumulativeHeightBefore (int y)
 Set cached value dependent on position within the track list. More...
void SetExpandedHeight (int height)
std::shared_ptr< TrackVRulerControlsGetVRulerControls ()
std::shared_ptr< const TrackVRulerControlsGetVRulerControls () const
virtual std::shared_ptr< CommonTrackCellGetAffordanceControls ()
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
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 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< TimeShiftHandlemTimeShiftHandle

Protected Member Functions

virtual std::vector< UIHandlePtrDetailedHitTest (const TrackPanelMouseState &, const AudacityProject *pProject, int currentTool, bool bMultiTool)=0
- Protected Member Functions inherited from TrackView
virtual std::shared_ptr< TrackVRulerControlsDoGetVRulerControls ()=0
- 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< 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 ( )

Reimplemented from TrackPanelCell.

Definition at line 85 of file CommonTrackView.cpp.

86 {
87  return TrackControls::Get( *FindTrack() ).shared_from_this();
88 }

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
height of the track when collapsed

See other comments for GetHeight

Implements TrackView.

Definition at line 90 of file CommonTrackView.cpp.

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

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 

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 );
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  }
49  // In other tools, let subclasses determine detailed hits.
50  results =
51  DetailedHitTest( st, pProject, currentTool, isMultiTool );
53  // There are still some general cases.
55  #if 0
56  // Sliding applies in more than one track type.
57  if ( !isMultiTool && currentTool == slideTool ) {
59  mTimeShiftHandle, FindTrack(), false);
60  if (result)
61  results.push_back(result);
62  }
63  #endif
65  // Let the multi-tool right-click handler apply only in default of all
66  // other detailed hits.
67  if ( isMultiTool ) {
68  result = ZoomHandle::HitTest(
69  BackgroundCell::Get( *pProject ).mZoomHandle, st.state);
70  if (result)
71  results.push_back(result);
72  }
74  // Finally, default of all is adjustment of the selection box.
75  if ( isMultiTool || currentTool == selectTool ) {
76  result = SelectHandle::HitTest(
77  mSelectHandle, st, pProject, shared_from_this() );
78  if (result)
79  results.push_back(result);
80  }
82  return results;
83 }

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(), 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()


Definition at line 32 of file TrackView.cpp.

20  : CommonTrackCell{ pTrack }
21 {
23 }

Member Data Documentation

◆ mSelectHandle

std::weak_ptr<SelectHandle> CommonTrackView::mSelectHandle

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:
void DoSetHeight(int h)
Definition: TrackView.cpp:163
@ selectTool
Definition: ProjectSettings.h:40
Definition: ProjectSettings.h:36
static Return Call(This &obj, Arguments &&...arguments)
Invoke the method – but only after static initialization time.
Definition: AttachedVirtualFunction.h:223
std::weak_ptr< TimeShiftHandle > mTimeShiftHandle
Definition: CommonTrackView.h:48
AUDACITY_DLL_API unsigned MinimumTrackHeight()
Definition: TrackInfo.cpp:195
static TrackControls & Get(Track &track)
Definition: TrackControls.cpp:25
@ zoomTool
Definition: ProjectSettings.h:43
std::shared_ptr< Track > FindTrack()
Definition: CommonTrackPanelCell.h:46
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
Definition: Track.h:1484
static ProjectSettings & Get(AudacityProject &project)
Definition: ProjectSettings.cpp:44
std::weak_ptr< ZoomHandle > mZoomHandle
Definition: BackgroundCell.h:67
static UIHandlePtr HitAnywhere(std::weak_ptr< ZoomHandle > &holder)
Definition: ZoomHandle.cpp:65
std::weak_ptr< SelectHandle > mSelectHandle
Definition: CommonTrackView.h:45
@ multiTool
Definition: ProjectSettings.h:44
static UIHandlePtr HitTest(std::weak_ptr< ZoomHandle > &holder, const wxMouseState &state)
Definition: ZoomHandle.cpp:73
static BackgroundCell & Get(AudacityProject &project)
Definition: BackgroundCell.cpp:97
std::shared_ptr< UIHandle > UIHandlePtr
Definition: CellularPanel.h:28
static UIHandlePtr HitTest(std::weak_ptr< SelectHandle > &holder, const TrackPanelMouseState &state, const AudacityProject *pProject, const std::shared_ptr< TrackView > &pTrackView)
Definition: SelectHandle.cpp:362
virtual std::vector< UIHandlePtr > DetailedHitTest(const TrackPanelMouseState &, const AudacityProject *pProject, int currentTool, bool bMultiTool)=0
static Settings & settings()
Definition: TrackInfo.cpp:86
static UIHandlePtr HitAnywhere(std::weak_ptr< TimeShiftHandle > &holder, const std::shared_ptr< Track > &pTrack, bool gripHit)
Definition: TimeShiftHandle.cpp:80
wxMouseState & state
Definition: TrackPanelMouseEvent.h:38
Definition: CommonTrackPanelCell.h:99