Audacity  3.0.3
Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Private Attributes | List of all members
WaveTrackSubView Class Referenceabstract

#include <WaveTrackView.h>

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

Public Types

using Display = WaveTrackViewConstants::Display
 
using Type = WaveTrackSubViewType
 
- 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) >
 

Public Member Functions

 WaveTrackSubView (WaveTrackView &waveTrackView)
 
virtual const TypeSubViewType () const =0
 
virtual void CopyToSubView (WaveTrackSubView *destSubView) const
 
std::pair< bool, std::vector< UIHandlePtr > > DoDetailedHitTest (const TrackPanelMouseState &state, const AudacityProject *pProject, int currentTool, bool bMultiTool, const std::shared_ptr< WaveTrack > &wt)
 
- Public Member Functions inherited from CommonTrackView
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
 
- 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)
 

Protected Member Functions

std::weak_ptr< WaveTrackViewGetWaveTrackView () const
 
std::vector< MenuItemGetMenuItems (const wxRect &rect, const wxPoint *pPosition, AudacityProject *pProject) override
 Return a list of items for DoContextMenu() (empties for separators) More...
 
- Protected Member Functions inherited from CommonTrackView
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
 

Static Protected Member Functions

static void DrawBoldBoundaries (TrackPanelDrawingContext &context, const WaveTrack *track, const wxRect &rect)
 

Private Attributes

std::weak_ptr< SubViewCloseHandle > mCloseHandle
 
std::weak_ptr< TrackPanelResizeHandlemResizeHandle
 
std::weak_ptr< SubViewAdjustHandle > mAdjustHandle
 
std::weak_ptr< SubViewRearrangeHandle > mRearrangeHandle
 
std::weak_ptr< WaveClipTrimHandlemClipTrimHandle
 
std::weak_ptr< CutlineHandlemCutlineHandle
 
std::weak_ptr< WaveTrackViewmwWaveTrackView
 

Additional Inherited Members

- 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)
 
- Public Attributes inherited from CommonTrackView
std::weak_ptr< TimeShiftHandlemTimeShiftHandle
 
- Protected Attributes inherited from CommonTrackView
std::weak_ptr< SelectHandlemSelectHandle
 
- Protected Attributes inherited from TrackView
std::shared_ptr< TrackVRulerControlsmpVRulerControls
 

Detailed Description

Definition at line 38 of file WaveTrackView.h.

Member Typedef Documentation

◆ Display

Definition at line 42 of file WaveTrackView.h.

◆ Type

Definition at line 43 of file WaveTrackView.h.

Constructor & Destructor Documentation

◆ WaveTrackSubView()

WaveTrackSubView::WaveTrackSubView ( WaveTrackView waveTrackView)
explicit

Definition at line 866 of file WaveTrackView.cpp.

867  : CommonTrackView( waveTrackView.FindTrack() )
868 {
869  mwWaveTrackView = std::static_pointer_cast<WaveTrackView>(
870  waveTrackView.shared_from_this() );
871 }

References mwWaveTrackView.

Member Function Documentation

◆ CopyToSubView()

void WaveTrackSubView::CopyToSubView ( WaveTrackSubView destSubView) const
virtual

Reimplemented in SpectrumView.

Definition at line 873 of file WaveTrackView.cpp.

873  {
874 
875 }

◆ DoDetailedHitTest()

std::pair< bool, std::vector<UIHandlePtr> > WaveTrackSubView::DoDetailedHitTest ( const TrackPanelMouseState state,
const AudacityProject pProject,
int  currentTool,
bool  bMultiTool,
const std::shared_ptr< WaveTrack > &  wt 
)

Referenced by SpectrumView::DetailedHitTest(), and WaveformView::DetailedHitTest().

Here is the caller graph for this function:

◆ DrawBoldBoundaries()

void WaveTrackSubView::DrawBoldBoundaries ( TrackPanelDrawingContext context,
const WaveTrack track,
const wxRect &  rect 
)
staticprotected

Definition at line 773 of file WaveTrackView.cpp.

776 {
777  auto &dc = context.dc;
778  const auto artist = TrackArtist::Get( context );
779 
780  const auto &zoomInfo = *artist->pZoomInfo;
781 
782 #ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
783  auto target2 = dynamic_cast<CutlineHandle*>(context.target.get());
784 #endif
785  for (const auto loc : track->GetCachedLocations()) {
786  bool highlightLoc = false;
787 #ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
788  highlightLoc =
789  target2 && target2->GetTrack().get() == track &&
790  target2->GetLocation() == loc;
791 #endif
792  const int xx = zoomInfo.TimeToPosition(loc.pos);
793  if (xx >= 0 && xx < rect.width) {
794  dc.SetPen( highlightLoc ? AColor::uglyPen : *wxGREY_PEN );
795  AColor::Line(dc, (int) (rect.x + xx - 1), rect.y, (int) (rect.x + xx - 1), rect.y + rect.height);
796  if (loc.typ == WaveTrackLocation::locationCutLine) {
797  dc.SetPen( highlightLoc ? AColor::uglyPen : *wxRED_PEN );
798  }
799  else {
800 #ifdef EXPERIMENTAL_DA
801  // JKC Black does not show up enough.
802  dc.SetPen(highlightLoc ? AColor::uglyPen : *wxWHITE_PEN);
803 #else
804  dc.SetPen(highlightLoc ? AColor::uglyPen : *wxBLACK_PEN);
805 #endif
806  }
807  AColor::Line(dc, (int) (rect.x + xx), rect.y, (int) (rect.x + xx), rect.y + rect.height);
808  dc.SetPen( highlightLoc ? AColor::uglyPen : *wxGREY_PEN );
809  AColor::Line(dc, (int) (rect.x + xx + 1), rect.y, (int) (rect.x + xx + 1), rect.y + rect.height);
810  }
811  }
812 }

References TrackPanelDrawingContext::dc, TrackArtist::Get(), WaveTrack::GetCachedLocations(), CutlineHandle::GetTrack(), AColor::Line(), WaveTrackLocation::locationCutLine, TrackPanelDrawingContext::target, and AColor::uglyPen.

Referenced by SpectrumView::DoDraw(), and WaveformView::DoDraw().

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

◆ GetMenuItems()

auto WaveTrackSubView::GetMenuItems ( const wxRect &  rect,
const wxPoint *  pPosition,
AudacityProject pProject 
)
overrideprotectedvirtual

Return a list of items for DoContextMenu() (empties for separators)

If the vector is empty (as in the default), there is no context menu.

Commands are invoked with temporary selection fields of CommandContext set to a point selected region at the mouse pick, and the cell's track.

A function may be given, but if it is null, then the command can be found by name in the CommandManager.

An item in the list with no command name marks a menu separator.

The menu item is enabled only if it contains a true flag, but if looked up in the command manager, it must also satisfy the command manager's conditions.

Reimplemented from CommonTrackPanelCell.

Definition at line 819 of file WaveTrackView.cpp.

822 {
823  const WaveClip *pClip = nullptr;
824  auto pTrack = static_cast<WaveTrack*>( FindTrack().get() );
825  double time = 0.0;
826  if ( pTrack && pPosition ) {
827  auto &viewInfo = ViewInfo::Get(*pProject);
828  time = viewInfo.PositionToTime( pPosition->x, rect.x );
829  pClip = pTrack->GetClipAtTime( time );
830  }
831 
832  if (pClip)
833  return {
834  { L"Cut", XO("Cut") },
835  { L"Copy", XO("Copy") },
836  { L"Paste", XO("Paste") },
837  {},
838  { L"Split", XO("Split Clip") },
839  { L"TrackMute", XO("Mute/Unmute Track") },
840  {},
841  { L"RenameClip", XO("Rename clip...") },
842  };
843  else
844  return {
845  { L"Paste", XO("Paste") },
846  {},
847  { L"TrackMute", XO("Mute/Unmute Track") },
848  };
849 }

References anonymous_namespace{TrackPanel.cpp}::FindTrack(), ViewInfo::Get(), and XO.

Here is the call graph for this function:

◆ GetWaveTrackView()

std::weak_ptr< WaveTrackView > WaveTrackSubView::GetWaveTrackView ( ) const
protected

Definition at line 814 of file WaveTrackView.cpp.

815 {
816  return mwWaveTrackView;
817 }

Referenced by SpectrumView::Draw(), and WaveformView::Draw().

Here is the caller graph for this function:

◆ SubViewType()

virtual const Type& WaveTrackSubView::SubViewType ( ) const
pure virtual

Implemented in WaveformView, and SpectrumView.

Referenced by WaveTrackView::DoSetDisplay(), WaveTrackView::GetDisplays(), and WaveTrackView::ToggleSubView().

Here is the caller graph for this function:

Member Data Documentation

◆ mAdjustHandle

std::weak_ptr<SubViewAdjustHandle> WaveTrackSubView::mAdjustHandle
private

Definition at line 76 of file WaveTrackView.h.

◆ mClipTrimHandle

std::weak_ptr<WaveClipTrimHandle> WaveTrackSubView::mClipTrimHandle
private

Definition at line 78 of file WaveTrackView.h.

◆ mCloseHandle

std::weak_ptr<SubViewCloseHandle> WaveTrackSubView::mCloseHandle
private

Definition at line 74 of file WaveTrackView.h.

◆ mCutlineHandle

std::weak_ptr<CutlineHandle> WaveTrackSubView::mCutlineHandle
private

Definition at line 79 of file WaveTrackView.h.

◆ mRearrangeHandle

std::weak_ptr<SubViewRearrangeHandle> WaveTrackSubView::mRearrangeHandle
private

Definition at line 77 of file WaveTrackView.h.

◆ mResizeHandle

std::weak_ptr<TrackPanelResizeHandle> WaveTrackSubView::mResizeHandle
private

Definition at line 75 of file WaveTrackView.h.

◆ mwWaveTrackView

std::weak_ptr<WaveTrackView> WaveTrackSubView::mwWaveTrackView
private

Definition at line 80 of file WaveTrackView.h.

Referenced by WaveTrackSubView().


The documentation for this class was generated from the following files:
ViewInfo::Get
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:241
WaveTrack
A Track that contains audio waveform data.
Definition: WaveTrack.h:69
CommonTrackView
Definition: CommonTrackView.h:20
CutlineHandle
Definition: CutlineHandle.h:22
CommonTrackPanelCell::FindTrack
std::shared_ptr< Track > FindTrack()
Definition: CommonTrackPanelCell.h:46
AColor::Line
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
Definition: AColor.cpp:109
XO
#define XO(s)
Definition: Internat.h:31
TrackPanelDrawingContext::dc
wxDC & dc
Definition: TrackPanelDrawingContext.h:23
WaveTrack::GetCachedLocations
const std::vector< Location > & GetCachedLocations() const
Definition: WaveTrack.h:531
WaveClip
This allows multiple clips to be a part of one WaveTrack.
Definition: WaveClip.h:175
CutlineHandle::GetTrack
std::shared_ptr< WaveTrack > GetTrack()
Definition: CutlineHandle.h:44
TrackArtist::Get
static TrackArtist * Get(TrackPanelDrawingContext &)
Definition: TrackArtist.cpp:79
AColor::uglyPen
static wxPen uglyPen
Definition: AColor.h:130
WaveTrackSubView::mwWaveTrackView
std::weak_ptr< WaveTrackView > mwWaveTrackView
Definition: WaveTrackView.h:80
TrackPanelDrawingContext::target
UIHandlePtr target
Definition: TrackPanelDrawingContext.h:24
WaveTrackLocation::locationCutLine
@ locationCutLine
Definition: WaveTrackLocation.h:17