Audacity 3.2.0
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
WaveChannelView Class Referencefinal

#include <WaveChannelView.h>

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

Public Types

using Display = WaveChannelViewConstants::Display
 
- Public Types inherited from ChannelView
enum  : unsigned { DefaultHeight = 150 }
 
using Refinement = std::vector< std::pair< wxCoord, std::shared_ptr< ChannelView > > >
 
- Public Types inherited from ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >
using DataType = ClientData
 
using DataPointer = Pointer< ClientData >
 
using DataFactory = std::function< DataPointer(Host &) >
 Type of function from which RegisteredFactory is constructed; it builds attachments. More...
 

Public Member Functions

 ~WaveChannelView () override
 
std::shared_ptr< WaveChannelFindWaveChannel ()
 
void CopyTo (Track &track, size_t iChannel) const override
 Copy state, for undo/redo purposes. More...
 
std::shared_ptr< ChannelVRulerControlsDoGetVRulerControls () override
 
void Reparent (const std::shared_ptr< Track > &parent, size_t iChannel) override
 Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
 
std::vector< WaveChannelSubView::TypeGetDisplays () const
 
void SetDisplay (Display display, bool exclusive=true)
 
const WaveChannelSubViewPlacementsSavePlacements () const
 
void RestorePlacements (const WaveChannelSubViewPlacements &placements)
 
bool ToggleSubView (Display id)
 
std::vector< std::shared_ptr< WaveChannelSubView > > GetAllSubViews ()
 
wxCoord GetLastHeight () const
 
bool GetMultiView () const
 
void SetMultiView (bool value)
 
WaveTrack::IntervalHolder GetSelectedClip ()
 
Refinement GetSubViews (const wxRect *rect=nullptr)
 
unsigned CaptureKey (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project) override
 
unsigned KeyDown (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project) override
 
unsigned Char (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project) override
 
unsigned LoseFocus (AudacityProject *project) override
 
bool CutSelectedText (AudacityProject &project)
 
bool CopySelectedText (AudacityProject &project)
 
bool PasteText (AudacityProject &project)
 
bool SelectAllText (AudacityProject &project)
 
std::shared_ptr< CommonTrackCellGetAffordanceControls () override
 
- Public Member Functions inherited from CommonChannelView
std::shared_ptr< TrackPanelCellContextMenuDelegate () override
 
std::vector< UIHandlePtrHitTest (const TrackPanelMouseState &, const AudacityProject *pProject) final
 
void TimeShiftHitTest ()
 
virtual int GetMinimizedHeight () const override
 
 ChannelView (const std::shared_ptr< Channel > &pChannel)
 
- Public Member Functions inherited from ChannelView
 ChannelView (const std::shared_ptr< Channel > &pChannel)
 
virtual ~ChannelView ()=0
 
void Reparent (const std::shared_ptr< Track > &parent, size_t iChannel) override
 Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
 
void CopyTo (Track &track, size_t iChannel) const override
 Copy state, for undo/redo purposes. More...
 
bool GetMinimized () const
 
void SetMinimized (bool minimized)
 
int GetCumulativeHeightBefore () const
 
int GetExpandedHeight () const
 
virtual int GetMinimizedHeight () const =0
 
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< ChannelVRulerControlsGetVRulerControls ()
 
std::shared_ptr< const ChannelVRulerControlsGetVRulerControls () const
 
virtual std::shared_ptr< CommonTrackCellGetAffordanceControls ()
 
void WriteXMLAttributes (XMLWriter &writer, size_t iChannel) const override
 Serialize persistent attributes. More...
 
bool HandleXMLAttribute (const std::string_view &attr, const XMLAttributeValueView &valueView, size_t iChannel) override
 Deserialize an attribute, returning true if recognized. More...
 
virtual Refinement GetSubViews (const wxRect &rect)
 
virtual bool IsSpectral () const
 
virtual void DoSetMinimized (bool isMinimized)
 
- Public Member Functions inherited from CommonChannelCell
 CommonChannelCell (const std::shared_ptr< Channel > &pChannel)
 Construct from a channel. More...
 
 ~CommonChannelCell ()
 
std::shared_ptr< TrackDoFindTrack () override
 
void Reparent (const std::shared_ptr< Track > &parent, size_t iChannel) override
 Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
 
template<typename Subtype = Channel>
auto FindChannel () -> std::shared_ptr< Subtype >
 May return null. More...
 
template<typename Subtype = const Channel>
auto FindChannel () const -> std::enable_if_t< std::is_const_v< Subtype >, std::shared_ptr< Subtype > >
 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 ChannelAttachment
virtual ~ChannelAttachment ()
 
virtual void CopyTo (Track &track, size_t iChannel) const
 Copy state, for undo/redo purposes. More...
 
virtual void Reparent (const std::shared_ptr< Track > &parent, size_t iChannel)
 Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
 
virtual void WriteXMLAttributes (XMLWriter &writer, size_t iChannel) const
 Serialize persistent attributes. More...
 
virtual bool HandleXMLAttribute (const std::string_view &attr, const XMLAttributeValueView &valueView, size_t iChannel)
 Deserialize an attribute, returning true if recognized. More...
 
- Public Member Functions inherited from ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >
 ~Site ()
 
 Site ()
 
 Site (const Site &other)
 
Siteoperator= (const Site &other)
 
 Site (Site &&other)
 
Siteoperator= (Site &&other)
 
size_t size () const
 How many attachment pointers are in the Site. More...
 
template<typename Subclass = ClientData>
Subclass & Get (const RegisteredFactory &key)
 Get reference to an attachment, creating on demand if not present, down-cast it to Subclass. More...
 
template<typename Subclass = const ClientData>
auto Get (const RegisteredFactory &key) const -> std::enable_if_t< std::is_const< Subclass >::value, Subclass & >
 Get reference to an attachment, creating on demand if not present, down-cast it to Subclass. More...
 
template<typename Subclass = ClientData>
Subclass * Find (const RegisteredFactory &key)
 Get a (bare) pointer to an attachment, or null, down-cast it to Subclass *; will not create on demand. More...
 
template<typename Subclass = const ClientData>
auto Find (const RegisteredFactory &key) const -> std::enable_if_t< std::is_const< Subclass >::value, Subclass * >
 Get a (bare) pointer to an attachment, or null, down-cast it to Subclass *; will not create on demand. More...
 
template<typename ReplacementPointer >
void Assign (const RegisteredFactory &key, ReplacementPointer &&replacement)
 Reassign Site's pointer to ClientData. More...
 

Static Public Member Functions

static WaveChannelViewGet (WaveChannel &channel)
 
static const WaveChannelViewGet (const WaveChannel &channel)
 
static WaveChannelViewFind (WaveChannel *pChannel)
 
static const WaveChannelViewFind (const WaveChannel *pChannel)
 
static WaveChannelViewGetFirst (WaveTrack &wt)
 Get the view of the first channel. More...
 
static const WaveChannelViewGetFirst (const WaveTrack &wt)
 Get the view of the first channel. More...
 
static WaveChannelViewFindFirst (WaveTrack *pWt)
 If pWt is not null, return a pointer to the view of the first channel. More...
 
static const WaveChannelViewFindFirst (const WaveTrack *pWt)
 If pWt is not null, return a pointer to the view of the first channel. More...
 
static std::pair< bool, std::vector< UIHandlePtr > > DoDetailedHitTest (const TrackPanelMouseState &state, const AudacityProject *pProject, int currentTool, bool bMultiTool, const std::shared_ptr< WaveChannel > &wt, CommonChannelView &view)
 
static bool ClipDetailsVisible (const ClipTimes &clip, const ZoomInfo &zoomInfo, const wxRect &viewRect)
 
static wxRect ClipHitTestArea (const ClipTimes &clip, const ZoomInfo &zoomInfo, const wxRect &viewRect)
 
static bool HitTest (const ClipTimes &clip, const ZoomInfo &zoomInfo, const wxRect &rect, const wxPoint &pos)
 
- Static Public Member Functions inherited from CommonChannelView
static void GetEnvelopeValues (const Envelope &env, double aligned_time, double sampleDur, double *buffer, int bufferLen, int leftOffset, const ZoomInfo &zoomInfo)
 Get many envelope points for pixel columns at once, but don't assume uniform time per pixel. More...
 
- Static Public Member Functions inherited from ChannelView
static ChannelViewGet (Channel &channel)
 
static const ChannelViewGet (const Channel &channel)
 
static ChannelViewFind (Channel *pChannel)
 
static const ChannelViewFind (const Channel *pChannel)
 
static int GetChannelGroupHeight (const Track *pTrack)
 
static int GetCumulativeHeight (const Channel *pChannel)
 
static int GetCumulativeHeight (const Track *pTrack)
 
static int GetTotalHeight (const TrackList &list)
 
- 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)
 
- Static Public Member Functions inherited from ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >
static size_t numFactories ()
 How many static factories have been registered with this specialization of Site. More...
 

Static Public Attributes

static constexpr int kChannelSeparatorThickness { 8 }
 

Private Member Functions

 WaveChannelView (const WaveChannelView &)=delete
 
WaveChannelViewoperator= (const WaveChannelView &)=delete
 
void BuildSubViews () const
 
void DoSetDisplay (Display display, bool exclusive=true)
 
bool SelectNextClip (ViewInfo &viewInfo, AudacityProject *project, bool forward)
 
void Draw (TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
 
std::vector< UIHandlePtrDetailedHitTest (const TrackPanelMouseState &state, const AudacityProject *pProject, int currentTool, bool bMultiTool) override
 
Refinement GetSubViews (const wxRect &rect) override
 
void DoSetMinimized (bool minimized) override
 
WaveChannelSubViewPlacementsDoGetPlacements ()
 
const WaveChannelSubViewPlacementsDoGetPlacements () const
 
bool & DoGetMultiView ()
 
bool DoGetMultiView () const
 
std::shared_ptr< CommonTrackCellDoGetAffordance (Track &track)
 

Private Attributes

wxCoord mLastHeight {}
 
std::shared_ptr< CommonTrackCellmpAffordanceCellControl
 
std::weak_ptr< TrackPanelCellmKeyEventDelegate
 
std::weak_ptr< WaveTrackAffordanceHandlemAffordanceHandle
 

Additional Inherited Members

- Public Attributes inherited from CommonChannelView
std::weak_ptr< TimeShiftHandlemTimeShiftHandle
 
- Public Attributes inherited from ChannelView
std::pair< int, int > vrulerSize
 
virtual std::vector< UIHandlePtrDetailedHitTest (const TrackPanelMouseState &, const AudacityProject *pProject, int currentTool, bool bMultiTool)=0
 
virtual std::shared_ptr< ChannelVRulerControlsDoGetVRulerControls ()=0
 
- 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 Member Functions inherited from ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >
template<typename Function >
void ForEach (const Function &function)
 Invoke function on each ClientData object that has been created in this. More...
 
template<typename Function >
void ForEach (const Function &function) const
 Invoke function on each ClientData object that has been created in this. More...
 
template<typename Function >
void ForCorresponding (Site &other, const Function &function, bool create=true)
 
template<typename Function >
ClientData * FindIf (const Function &function)
 Return pointer to first attachment in this that is not null and satisfies a predicate, or nullptr. More...
 
template<typename Function >
const ClientData * FindIf (const Function &function) const
 Return pointer to first attachment in this that is not null and satisfies a predicate, or nullptr. More...
 
template<typename Function >
void EraseIf (const Function &function)
 Erase attached objects satisfying a predicate. More...
 
void BuildAll ()
 For each RegisteredFactory, if the corresponding attachment is absent in this, build and store it. More...
 
- Protected Attributes inherited from CommonChannelView
std::weak_ptr< SelectHandlemSelectHandle
 
- Protected Attributes inherited from ChannelView
std::shared_ptr< ChannelVRulerControlsmpVRulerControls
 

Detailed Description

Definition at line 97 of file WaveChannelView.h.

Member Typedef Documentation

◆ Display

Definition at line 107 of file WaveChannelView.h.

Constructor & Destructor Documentation

◆ WaveChannelView()

WaveChannelView::WaveChannelView ( const WaveChannelView )
privatedelete

◆ ~WaveChannelView()

WaveChannelView::~WaveChannelView ( )
override

Definition at line 970 of file WaveChannelView.cpp.

971{
972}

Member Function Documentation

◆ BuildSubViews()

void WaveChannelView::BuildSubViews ( ) const
private

Definition at line 1609 of file WaveChannelView.cpp.

1610{
1611 if (WaveChannelSubViews::size() == 0) {
1612 // On-demand steps that can't happen in the constructor
1613 auto pThis = const_cast<WaveChannelView*>(this);
1614 pThis->BuildAll();
1615 bool minimized = GetMinimized();
1616 pThis->WaveChannelSubViews::ForEach([&](WaveChannelSubView &subView){
1617 subView.DoSetMinimized(minimized);
1618 });
1619
1620 auto &placements = pThis->DoGetPlacements();
1621 if (placements.empty()) {
1622 placements.resize(WaveChannelSubViews::size());
1623
1624 auto display = TracksPrefs::ViewModeChoice();
1625 bool multi = (display == WaveChannelViewConstants::MultiView);
1626 if (multi) {
1627 pThis->SetMultiView( true );
1629 }
1630
1631 pThis->DoSetDisplay( display, !multi );
1632 }
1633 }
1634}
bool GetMinimized() const
Definition: ChannelView.h:69
virtual void DoSetMinimized(bool isMinimized)
size_t size() const
How many attachment pointers are in the Site.
Definition: ClientData.h:260
void BuildAll()
For each RegisteredFactory, if the corresponding attachment is absent in this, build and store it.
Definition: ClientData.h:546
static WaveChannelViewConstants::Display ViewModeChoice()
@ MultiView
"Multi" is special, not really a view type on par with the others.
static Display Default()
Return a preferred type.

References ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::BuildAll(), WaveChannelSubViewType::Default(), ChannelView::DoSetMinimized(), ChannelView::GetMinimized(), WaveChannelViewConstants::MultiView, ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::size(), and TracksPrefs::ViewModeChoice().

Referenced by DoSetMinimized(), GetAllSubViews(), GetDisplays(), and SetDisplay().

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

◆ CaptureKey()

unsigned WaveChannelView::CaptureKey ( wxKeyEvent &  event,
ViewInfo viewInfo,
wxWindow *  pParent,
AudacityProject project 
)
overridevirtual

Reimplemented from TrackPanelCell.

Definition at line 1339 of file WaveChannelView.cpp.

1342{
1343 unsigned result{ RefreshCode::RefreshNone };
1344 const auto pChannel = FindWaveChannel();
1345 if (!pChannel)
1346 return result;
1347 auto &track = pChannel->GetTrack();
1348 for (auto pChannel : track.Channels()) {
1349 event.Skip(false);
1350 auto &waveChannelView = WaveChannelView::Get(*pChannel);
1351 // Give sub-views first chance to handle the event
1352 for (auto &subView : waveChannelView.GetSubViews()) {
1353 // Event defaults in skipped state which must be turned off explicitly
1354 wxASSERT(!event.GetSkipped());
1355 result |= subView.second->CaptureKey(event, viewInfo, pParent, project);
1356 if (!event.GetSkipped()) {
1357 // sub view wants it
1358 mKeyEventDelegate = subView.second;
1359 return result;
1360 }
1361 else
1362 event.Skip(false);
1363 }
1364
1365 if (auto affordance = waveChannelView.GetAffordanceControls()) {
1366 result |= affordance->CaptureKey(event, viewInfo, pParent, project);
1367 if (!event.GetSkipped()) {
1368 mKeyEventDelegate = affordance;
1369 return result;
1370 }
1371 }
1372
1373 event.Skip(false);
1374 }
1375 switch (event.GetKeyCode())
1376 {
1377 case WXK_TAB:
1378 break;
1379 default:
1381 event, viewInfo, pParent, project);
1382 break;
1383 };
1384 if (!event.GetSkipped()) {
1385 mKeyEventDelegate = shared_from_this();
1386 }
1387
1388 return result;
1389}
const auto project
virtual unsigned CaptureKey(wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
std::shared_ptr< WaveChannel > FindWaveChannel()
std::weak_ptr< TrackPanelCell > mKeyEventDelegate
static WaveChannelView & Get(WaveChannel &channel)

References TrackPanelCell::CaptureKey(), FindWaveChannel(), Get(), mKeyEventDelegate, project, and RefreshCode::RefreshNone.

Here is the call graph for this function:

◆ Char()

unsigned WaveChannelView::Char ( wxKeyEvent &  event,
ViewInfo viewInfo,
wxWindow *  pParent,
AudacityProject project 
)
overridevirtual

Reimplemented from TrackPanelCell.

Definition at line 1418 of file WaveChannelView.cpp.

1421{
1422 unsigned result{ RefreshCode::RefreshNone };
1423 if (auto delegate = mKeyEventDelegate.lock()) {
1424 if (auto pWaveChannelView =
1425 dynamic_cast<WaveChannelView*>(delegate.get()))
1426 result |= pWaveChannelView->CommonChannelView::Char(
1427 event, viewInfo, pParent, project);
1428 else
1429 result |= delegate->Char(event, viewInfo, pParent, project);
1430 }
1431 else
1432 event.Skip();
1433
1434 return result;
1435}

References mKeyEventDelegate, project, and RefreshCode::RefreshNone.

◆ ClipDetailsVisible()

bool WaveChannelView::ClipDetailsVisible ( const ClipTimes clip,
const ZoomInfo zoomInfo,
const wxRect &  viewRect 
)
static

Definition at line 1480 of file WaveChannelView.cpp.

1482{
1483 //Do not fold clips to line at sample zoom level, as
1484 //it may become impossible to 'unfold' it when clip is trimmed
1485 //to a single sample
1486 bool showSamples{ false };
1487 auto clipRect = ClipParameters::GetClipRect(clip, zoomInfo, viewRect, &showSamples);
1488 return showSamples || clipRect.width >= kClipDetailedViewMinimumWidth;
1489}
constexpr int kClipDetailedViewMinimumWidth
static wxRect GetClipRect(const ClipTimes &clip, const ZoomInfo &zoomInfo, const wxRect &viewRect, bool *outShowSamples=nullptr)

References ClipParameters::GetClipRect(), and kClipDetailedViewMinimumWidth.

Referenced by WaveTrackAffordanceHandle::Click(), DoDetailedHitTest(), WaveTrackAffordanceControls::Draw(), anonymous_namespace{SpectrumView.cpp}::DrawClipSpectrum(), anonymous_namespace{WaveformView.cpp}::DrawClipWaveform(), and WaveClipAdjustBorderHandle::HitAnywhere().

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

◆ ClipHitTestArea()

wxRect WaveChannelView::ClipHitTestArea ( const ClipTimes clip,
const ZoomInfo zoomInfo,
const wxRect &  viewRect 
)
static

Definition at line 1491 of file WaveChannelView.cpp.

1493{
1494 bool showSamples{ false };
1495 auto clipRect = ClipParameters::GetClipRect(clip, zoomInfo, viewRect, &showSamples);
1496 if (showSamples || clipRect.width >= kClipDetailedViewMinimumWidth)
1497 return clipRect;
1498
1499 return clipRect.Inflate(2, 0);
1500}

References ClipParameters::GetClipRect(), and kClipDetailedViewMinimumWidth.

Referenced by HitTest().

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

◆ CopySelectedText()

bool WaveChannelView::CopySelectedText ( AudacityProject project)

Definition at line 1474 of file WaveChannelView.cpp.

1475{
1476 return
1478}
bool OnTextCopy(AudacityProject &project)
bool AnyAffordance(AudacityProject &project, WaveChannelView &view, PMF pmf)

References anonymous_namespace{WaveChannelView.cpp}::AnyAffordance(), WaveTrackAffordanceControls::OnTextCopy(), and project.

Here is the call graph for this function:

◆ CopyTo()

void WaveChannelView::CopyTo ( Track track,
size_t  iChannel 
) const
overridevirtual

Copy state, for undo/redo purposes.

Parameters
iChannelposition of the attachment's channel in the group The default does nothing

Reimplemented from ChannelAttachment.

Definition at line 979 of file WaveChannelView.cpp.

980{
982 auto &other = ChannelView::Get(*track.GetChannel(0));
983 if (const auto pOther = dynamic_cast<WaveChannelView*>(&other)) {
984 // only these fields are important to preserve in undo/redo history
985 pOther->RestorePlacements( SavePlacements() );
986 pOther->DoGetMultiView() = DoGetMultiView();
987
988 auto srcSubViewsPtrs =
989 const_cast<WaveChannelView*>(this)->GetAllSubViews();
990 auto destSubViewsPtrs =
991 const_cast<WaveChannelView*>(pOther)->GetAllSubViews();
992 wxASSERT(srcSubViewsPtrs.size() == destSubViewsPtrs.size());
993
994 for(auto i = 0; i != srcSubViewsPtrs.size(); i++){
995 srcSubViewsPtrs[i]->CopyToSubView(destSubViewsPtrs[i].get());
996 }
997 }
998}
std::shared_ptr< ChannelType > GetChannel(size_t iChannel)
Retrieve a channel, cast to the given type.
Definition: Channel.h:323
static ChannelView & Get(Channel &channel)
void CopyTo(Track &track, size_t iChannel) const override
Copy state, for undo/redo purposes.
Definition: ChannelView.cpp:67
std::vector< std::shared_ptr< WaveChannelSubView > > GetAllSubViews()
const WaveChannelSubViewPlacements & SavePlacements() const

References ChannelView::CopyTo(), DoGetMultiView(), ChannelView::Get(), GetAllSubViews(), ChannelGroup::GetChannel(), anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel, and SavePlacements().

Here is the call graph for this function:

◆ CutSelectedText()

bool WaveChannelView::CutSelectedText ( AudacityProject project)

Definition at line 1468 of file WaveChannelView.cpp.

1469{
1470 return
1472}
bool OnTextCut(AudacityProject &project)

References anonymous_namespace{WaveChannelView.cpp}::AnyAffordance(), WaveTrackAffordanceControls::OnTextCut(), and project.

Here is the call graph for this function:

◆ DetailedHitTest()

std::vector< UIHandlePtr > WaveChannelView::DetailedHitTest ( const TrackPanelMouseState state,
const AudacityProject pProject,
int  currentTool,
bool  bMultiTool 
)
overrideprivatevirtual

Implements CommonChannelView.

Definition at line 1000 of file WaveChannelView.cpp.

1003{
1004 // should not come here any more, delegation to sub-view instead
1005 wxASSERT( false );
1006 return {};
1007}

◆ DoDetailedHitTest()

std::pair< bool, std::vector< UIHandlePtr > > WaveChannelView::DoDetailedHitTest ( const TrackPanelMouseState state,
const AudacityProject pProject,
int  currentTool,
bool  bMultiTool,
const std::shared_ptr< WaveChannel > &  wt,
CommonChannelView view 
)
static

Definition at line 1010 of file WaveChannelView.cpp.

1015{
1016 // common hit-testing for different sub-view types, to help implement their
1017 // DetailedHitTest()
1018
1019 // This is the only override of Track::DetailedHitTest that still
1020 // depends on the state of the Tools toolbar.
1021 // If that toolbar were eliminated, this could simplify to a sequence of
1022 // hit test routines describable by a table.
1023
1024 std::vector<UIHandlePtr> results;
1025
1026 const auto& viewInfo = ViewInfo::Get(*pProject);
1027 const auto pTrack = pChannel->GetTrack().SharedPointer<WaveTrack>();
1028
1029 for (const auto &clip : pChannel->Intervals())
1030 {
1031 if (!WaveChannelView::ClipDetailsVisible(*clip, viewInfo, st.rect)
1032 && HitTest(*clip, viewInfo, st.rect, st.state.GetPosition()))
1033 {
1034 auto &waveChannelView = WaveChannelView::Get(*pChannel);
1035 results.push_back(
1037 waveChannelView.mAffordanceHandle,
1038 std::make_shared<WaveTrackAffordanceHandle>(pTrack, clip)
1039 )
1040 );
1041 }
1042 }
1043
1044 if (bMultiTool && st.state.CmdDown()) {
1045 // Ctrl modifier key in multi-tool overrides everything else
1046 // (But this does not do the time shift constrained to the vertical only,
1047 // which is what happens when you hold Ctrl in the Time Shift tool mode)
1049 pTrack, false);
1050 if (result)
1051 results.push_back(result);
1052 return { true, results };
1053 }
1054
1055 return { false, results };
1056}
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
Definition: UIHandle.h:164
std::weak_ptr< TimeShiftHandle > mTimeShiftHandle
static UIHandlePtr HitAnywhere(std::weak_ptr< TimeShiftHandle > &holder, const std::shared_ptr< Track > &pTrack, bool gripHit)
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:235
static bool ClipDetailsVisible(const ClipTimes &clip, const ZoomInfo &zoomInfo, const wxRect &viewRect)
static bool HitTest(const ClipTimes &clip, const ZoomInfo &zoomInfo, const wxRect &rect, const wxPoint &pos)
A Track that contains audio waveform data.
Definition: WaveTrack.h:203

References AssignUIHandlePtr(), ClipDetailsVisible(), ViewInfo::Get(), Get(), TimeShiftHandle::HitAnywhere(), HitTest(), CommonChannelView::mTimeShiftHandle, TrackPanelMouseState::rect, and TrackPanelMouseState::state.

Referenced by WaveChannelSubView::DoDetailedHitTest().

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

◆ DoGetAffordance()

std::shared_ptr< CommonTrackCell > WaveChannelView::DoGetAffordance ( Track track)
private

Definition at line 1557 of file WaveChannelView.cpp.

1558{
1559 if (mpAffordanceCellControl == nullptr)
1561 std::make_shared<WaveTrackAffordanceControls>(track.SharedPointer());
1563}
std::shared_ptr< Subclass > SharedPointer()
Definition: Track.h:146
std::shared_ptr< CommonTrackCell > mpAffordanceCellControl

References mpAffordanceCellControl, and Track::SharedPointer().

Referenced by GetAffordanceControls().

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

◆ DoGetMultiView() [1/2]

bool & WaveChannelView::DoGetMultiView ( )
private

Definition at line 95 of file WaveChannelView.cpp.

96{
97 auto &waveTrack = FindWaveChannel()->GetTrack();
98 return PlacementArray::Get(waveTrack).mMultiView;
99}
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:202

References FindWaveChannel(), and BasicUI::Get().

Referenced by CopyTo(), and DoGetMultiView().

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

◆ DoGetMultiView() [2/2]

bool WaveChannelView::DoGetMultiView ( ) const
private

Definition at line 101 of file WaveChannelView.cpp.

102{
103 return const_cast<WaveChannelView&>(*this).DoGetMultiView();
104}

References DoGetMultiView().

Here is the call graph for this function:

◆ DoGetPlacements() [1/2]

WaveChannelSubViewPlacements & WaveChannelView::DoGetPlacements ( )
private

Definition at line 84 of file WaveChannelView.cpp.

85{
86 auto &waveChannel = *FindWaveChannel();
87 return PlacementArray::Get(waveChannel.GetTrack()).mPlacements;
88}

References FindWaveChannel(), and BasicUI::Get().

Referenced by DoGetPlacements(), DoSetDisplay(), GetDisplays(), and ToggleSubView().

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

◆ DoGetPlacements() [2/2]

const WaveChannelSubViewPlacements & WaveChannelView::DoGetPlacements ( ) const
private

Definition at line 90 of file WaveChannelView.cpp.

91{
92 return const_cast<WaveChannelView&>(*this).DoGetPlacements();
93}
WaveChannelSubViewPlacements & DoGetPlacements()

References DoGetPlacements().

Here is the call graph for this function:

◆ DoGetVRulerControls()

std::shared_ptr< ChannelVRulerControls > WaveChannelView::DoGetVRulerControls ( )
overridevirtual

Implements ChannelView.

Definition at line 1576 of file WaveChannelView.cpp.

1577{
1578 return {};
1579}

◆ DoSetDisplay()

void WaveChannelView::DoSetDisplay ( Display  display,
bool  exclusive = true 
)
private

Definition at line 1146 of file WaveChannelView.cpp.

1147{
1148 // Some generality here anticipating more than two views.
1149 // The order of sub-views in the array is not specified, so make it definite
1150 // by sorting by the view type constants.
1151 size_t ii = 0;
1152 std::vector<std::pair<WaveChannelViewConstants::Display, size_t>> pairs;
1153 WaveChannelSubViews::ForEach([&pairs, &ii](WaveChannelSubView &subView){
1154 pairs.push_back({ subView.SubViewType().id, ii++ });
1155 });
1156 std::sort( pairs.begin(), pairs.end() );
1157
1158 int jj = 1;
1159 auto &placements = DoGetPlacements();
1160 for ( const auto &pair : pairs ) {
1161 auto &placement = placements[ pair.second ];
1162 if (pair.first == display) {
1163 // 0 for first view
1164 placement = { 0, 1.0 };
1165 }
1166 else if( exclusive )
1167 // -1 for not displayed
1168 placement = { -1, 0.0 };
1169 else
1170 // positions other than the first.
1171 // (Note that the fractions in the placement don't need to be
1172 // denominated to 1. Just make them all equal to get an equal
1173 // partitioning of the sub-views.)
1174 placement = { jj++, 1.0 };
1175 }
1176}
void ForEach(const Function &function)
Invoke function on each ClientData object that has been created in this.
Definition: ClientData.h:389
virtual const Type & SubViewType() const =0

References DoGetPlacements(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::ForEach(), and WaveChannelSubView::SubViewType().

Referenced by SetDisplay().

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

◆ DoSetMinimized()

void WaveChannelView::DoSetMinimized ( bool  minimized)
overrideprivatevirtual

Reimplemented from ChannelView.

Definition at line 1545 of file WaveChannelView.cpp.

1546{
1547 BuildSubViews();
1548
1549 // May come here. Invoke also on sub-views.
1550 ChannelView::DoSetMinimized(minimized);
1551 WaveChannelSubViews::ForEach([minimized](WaveChannelSubView &subView) {
1552 subView.DoSetMinimized(minimized);
1553 });
1554}
void BuildSubViews() const

References BuildSubViews(), ChannelView::DoSetMinimized(), and ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::ForEach().

Here is the call graph for this function:

◆ Draw()

void WaveChannelView::Draw ( TrackPanelDrawingContext context,
const wxRect &  rect,
unsigned  iPass 
)
overrideprivatevirtual

Reimplemented from TrackPanelDrawable.

Definition at line 1636 of file WaveChannelView.cpp.

1639{
1640 // Should not come here, drawing is now delegated to sub-views
1641 wxASSERT( false );
1642
1643 CommonChannelView::Draw(context, rect, iPass);
1644}
virtual void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass)

References TrackPanelDrawable::Draw().

Here is the call graph for this function:

◆ Find() [1/2]

const WaveChannelView * WaveChannelView::Find ( const WaveChannel pChannel)
static

Definition at line 928 of file WaveChannelView.cpp.

929{
930 return Find(const_cast<WaveChannel*>(pChannel));
931}
static WaveChannelView * Find(WaveChannel *pChannel)

References Find().

Here is the call graph for this function:

◆ Find() [2/2]

WaveChannelView * WaveChannelView::Find ( WaveChannel pChannel)
static

Definition at line 923 of file WaveChannelView.cpp.

924{
925 return static_cast<WaveChannelView*>(ChannelView::Find(pChannel));
926}
static ChannelView * Find(Channel *pChannel)

References ChannelView::Find().

Referenced by Find().

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

◆ FindFirst() [1/2]

const WaveChannelView * WaveChannelView::FindFirst ( const WaveTrack pWt)
static

If pWt is not null, return a pointer to the view of the first channel.

Definition at line 949 of file WaveChannelView.cpp.

950{
951 return pWt ? &GetFirst(*pWt): nullptr;
952}
static WaveChannelView & GetFirst(WaveTrack &wt)
Get the view of the first channel.

References GetFirst().

Here is the call graph for this function:

◆ FindFirst() [2/2]

WaveChannelView * WaveChannelView::FindFirst ( WaveTrack pWt)
static

If pWt is not null, return a pointer to the view of the first channel.

Definition at line 944 of file WaveChannelView.cpp.

945{
946 return pWt ? &GetFirst(*pWt): nullptr;
947}

References GetFirst().

Here is the call graph for this function:

◆ FindWaveChannel()

std::shared_ptr< WaveChannel > WaveChannelView::FindWaveChannel ( )

Definition at line 974 of file WaveChannelView.cpp.

975{
976 return FindChannel<WaveChannel>();
977}

Referenced by anonymous_namespace{WaveChannelView.cpp}::AnyAffordance(), CaptureKey(), DoGetMultiView(), DoGetPlacements(), GetAffordanceControls(), GetSelectedClip(), WaveClipAdjustBorderHandle::HitTest(), and SelectNextClip().

Here is the caller graph for this function:

◆ Get() [1/2]

const WaveChannelView & WaveChannelView::Get ( const WaveChannel channel)
static

Definition at line 918 of file WaveChannelView.cpp.

919{
920 return Get(const_cast<WaveChannel&>(channel));
921}

References Get().

Here is the call graph for this function:

◆ Get() [2/2]

WaveChannelView & WaveChannelView::Get ( WaveChannel channel)
static

Definition at line 913 of file WaveChannelView.cpp.

914{
915 return static_cast<WaveChannelView&>(ChannelView::Get(channel));
916}

References ChannelView::Get().

Referenced by SetTrackVisualsCommand::ApplyInner(), CaptureKey(), WaveformPrefs::Commit(), DoDetailedHitTest(), Get(), GetFirst(), GetSelectedClip(), SpectrumPrefs::Rollback(), SpectrumPrefs::SpectrumPrefs(), and SubViewAdjuster::UpdateViews().

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

◆ GetAffordanceControls()

std::shared_ptr< CommonTrackCell > WaveChannelView::GetAffordanceControls ( )
overridevirtual

Reimplemented from ChannelView.

Definition at line 1533 of file WaveChannelView.cpp.

1534{
1535 auto pChannel = FindWaveChannel();
1536 if (pChannel) {
1537 auto &track = pChannel->GetTrack();
1538 if (pChannel == *track.Channels().begin()) {
1539 return DoGetAffordance(track);
1540 }
1541 }
1542 return {};
1543}
std::shared_ptr< CommonTrackCell > DoGetAffordance(Track &track)

References DoGetAffordance(), and FindWaveChannel().

Here is the call graph for this function:

◆ GetAllSubViews()

std::vector< std::shared_ptr< WaveChannelSubView > > WaveChannelView::GetAllSubViews ( )

Definition at line 1521 of file WaveChannelView.cpp.

1522{
1523 BuildSubViews();
1524
1525 std::vector<std::shared_ptr<WaveChannelSubView>> results;
1527 results.push_back(std::static_pointer_cast<WaveChannelSubView>(
1528 subView.shared_from_this()));
1529 });
1530 return results;
1531}

References BuildSubViews(), and ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::ForEach().

Referenced by CopyTo(), and SubViewAdjuster::SubViewAdjuster().

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

◆ GetDisplays()

auto WaveChannelView::GetDisplays ( ) const

Definition at line 1058 of file WaveChannelView.cpp.

1060{
1061 BuildSubViews();
1062
1063 // Collect the display types of visible views and sort them by position
1064 using Pair = std::pair<int, WaveChannelSubView::Type>;
1065 std::vector< Pair > pairs;
1066 size_t ii = 0;
1067 const auto &placements = DoGetPlacements();
1069 auto &placement = placements[ii];
1070 if (placement.fraction > 0)
1071 pairs.emplace_back(placement.index, subView.SubViewType());
1072 ++ii;
1073 } );
1074 std::sort( pairs.begin(), pairs.end() );
1075 std::vector<WaveChannelSubView::Type> results;
1076 for (const auto &pair : pairs)
1077 results.push_back(pair.second);
1078 return results;
1079}
std::pair< const char *, const char * > Pair

References BuildSubViews(), DoGetPlacements(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::ForEach(), and WaveChannelSubView::SubViewType().

Referenced by anonymous_namespace{SpectrumView.cpp}::DoNextPeakFrequency(), and ToggleSubView().

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

◆ GetFirst() [1/2]

const WaveChannelView & WaveChannelView::GetFirst ( const WaveTrack wt)
static

Get the view of the first channel.

Definition at line 939 of file WaveChannelView.cpp.

940{
941 return GetFirst(const_cast<WaveTrack&>(wt));
942}

References GetFirst().

Here is the call graph for this function:

◆ GetFirst() [2/2]

WaveChannelView & WaveChannelView::GetFirst ( WaveTrack wt)
static

Get the view of the first channel.

Definition at line 933 of file WaveChannelView.cpp.

934{
935 assert(wt.Channels().size() > 0);
936 return Get(**wt.Channels().begin());
937}
auto Channels()
Definition: WaveTrack.h:263

References WaveTrack::Channels(), and Get().

Referenced by Append(), anonymous_namespace{SpectrumView.cpp}::DoNextPeakFrequency(), anonymous_namespace{EditMenus.cpp}::DoPasteText(), anonymous_namespace{WaveTrackAffordanceControls.cpp}::FindAffordance(), FindFirst(), for(), GetFirst(), WaveTrackAffordanceControls::HitTest(), anonymous_namespace{EditMenus.cpp}::OnCopy(), anonymous_namespace{EditMenus.cpp}::OnCut(), WaveTrackMenuTable::OnMergeStereo(), WaveTrackMenuTable::OnMultiView(), SelectActions::Handler::OnSelectAll(), and WaveTrackMenuTable::OnSetDisplay().

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

◆ GetLastHeight()

wxCoord WaveChannelView::GetLastHeight ( ) const
inline

Definition at line 166 of file WaveChannelView.h.

166{ return mLastHeight; }

Referenced by SubViewAdjustHandle::HitTest(), and SubViewRearrangeHandle::HitTest().

Here is the caller graph for this function:

◆ GetMultiView()

bool WaveChannelView::GetMultiView ( ) const
inline

Definition at line 168 of file WaveChannelView.h.

168{ return DoGetMultiView(); }

Referenced by SubViewAdjustHandle::HitTest(), and SubViewRearrangeHandle::HitTest().

Here is the caller graph for this function:

◆ GetSelectedClip()

WaveTrack::IntervalHolder WaveChannelView::GetSelectedClip ( )

Definition at line 1594 of file WaveChannelView.cpp.

1595{
1596 const auto pChannel = FindWaveChannel();
1597 if (!pChannel)
1598 return {};
1599 auto &track = pChannel->GetTrack();
1600 auto &topmostView = Get(**track.Channels().begin());
1601 if (auto affordance = std::dynamic_pointer_cast<WaveTrackAffordanceControls>(
1602 topmostView.GetAffordanceControls()))
1603 {
1604 return *affordance->GetSelectedInterval();
1605 }
1606 return {};
1607}

References FindWaveChannel(), and Get().

Here is the call graph for this function:

◆ GetSubViews() [1/2]

auto WaveChannelView::GetSubViews ( const wxRect &  rect)
overrideprivatevirtual

Reimplemented from ChannelView.

Definition at line 1265 of file WaveChannelView.cpp.

1266{
1267 return GetSubViews(&rect);
1268}
Refinement GetSubViews(const wxRect *rect=nullptr)

◆ GetSubViews() [2/2]

auto WaveChannelView::GetSubViews ( const wxRect *  rect = nullptr)

Definition at line 1270 of file WaveChannelView.cpp.

1271{
1272 BuildSubViews();
1273
1274 // Collect the visible views in the right sequence
1275 struct Item {
1276 int index; float fraction; std::shared_ptr<ChannelView> pView;
1277 };
1278 std::vector< Item > items;
1279 size_t ii = 0;
1280 float total = 0;
1281 const auto &placements = DoGetPlacements();
1283 auto& placement = placements[ii];
1284 auto index = placement.index;
1285 auto fraction = placement.fraction;
1286 if (index >= 0 && fraction > 0.0)
1287 total += fraction,
1288 items.push_back({ index, fraction, subView.shared_from_this() });
1289 ++ii;
1290 });
1291 std::sort(items.begin(), items.end(), [](const Item& a, const Item& b) {
1292 return a.index < b.index;
1293 });
1294
1295 // Remove views we don't need
1296 auto begin = items.begin(), end = items.end(),
1297 newEnd = std::remove_if(begin, end,
1298 [](const Item& item) { return !item.pView; });
1299 items.erase(newEnd, end);
1300
1301 Refinement results;
1302
1303 if (rect != nullptr)
1304 {
1305 // Assign coordinates, redenominating to the total height,
1306 // storing integer values
1307 results.reserve(items.size());
1308 const auto top = rect->GetTop();
1309 const auto height = rect->GetHeight();
1310 float partial = 0;
1311 wxCoord lastCoord = 0;
1312 for (const auto& item : items) {
1313 wxCoord newCoord = top + (partial / total) * height;
1314 results.emplace_back(newCoord, item.pView);
1315 partial += item.fraction;
1316 }
1317
1318 // Cache for the use of sub-view dragging
1319 mLastHeight = height;
1320 }
1321 else
1322 {
1323 std::transform(items.begin(), items.end(), std::back_inserter(results), [](const auto& item) {
1324 return std::make_pair(0, item.pView);
1325 });
1326 }
1327
1328 return results;
1329}
std::vector< std::pair< wxCoord, std::shared_ptr< ChannelView > > > Refinement
Definition: ChannelView.h:121
const char * end(const char *str) noexcept
Definition: StringUtils.h:106
const char * begin(const char *str) noexcept
Definition: StringUtils.h:101

References details::begin(), details::end(), and ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::ForEach().

Here is the call graph for this function:

◆ HitTest()

bool WaveChannelView::HitTest ( const ClipTimes clip,
const ZoomInfo zoomInfo,
const wxRect &  rect,
const wxPoint &  pos 
)
static

Definition at line 1502 of file WaveChannelView.cpp.

1504{
1505 return ClipHitTestArea(clip, viewInfo, viewRect).Contains(pos);
1506}
static wxRect ClipHitTestArea(const ClipTimes &clip, const ZoomInfo &zoomInfo, const wxRect &viewRect)

References ClipHitTestArea().

Referenced by DoDetailedHitTest(), WaveTrackAffordanceControls::HitTest(), WaveTrackShifter::HitTest(), and SubViewAdjustHandle::HitTest().

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

◆ KeyDown()

unsigned WaveChannelView::KeyDown ( wxKeyEvent &  event,
ViewInfo viewInfo,
wxWindow *  pParent,
AudacityProject project 
)
overridevirtual

Reimplemented from TrackPanelCell.

Definition at line 1391 of file WaveChannelView.cpp.

1394{
1395 unsigned result{ RefreshCode::RefreshNone };
1396 if (auto delegate = mKeyEventDelegate.lock()) {
1397 if (auto pWaveChannelView =
1398 dynamic_cast<WaveChannelView*>(delegate.get()))
1399 {
1400 if (event.GetKeyCode() == WXK_TAB)
1401 {
1402 SelectNextClip(viewInfo, project, event.GetModifiers() != wxMOD_SHIFT);
1403 result |= RefreshCode::RefreshCell;
1404 }
1405 else
1406 result |= pWaveChannelView->CommonChannelView::KeyDown(
1407 event, viewInfo, pParent, project);
1408 }
1409 else
1410 result |= delegate->KeyDown(event, viewInfo, pParent, project);
1411 }
1412 else
1413 event.Skip();
1414
1415 return result;
1416}
bool SelectNextClip(ViewInfo &viewInfo, AudacityProject *project, bool forward)

References mKeyEventDelegate, project, RefreshCode::RefreshCell, RefreshCode::RefreshNone, and SelectNextClip().

Here is the call graph for this function:

◆ LoseFocus()

unsigned WaveChannelView::LoseFocus ( AudacityProject project)
overridevirtual

Reimplemented from TrackPanelCell.

Definition at line 1437 of file WaveChannelView.cpp.

1438{
1439 unsigned result = RefreshCode::RefreshNone;
1440 if (auto delegate = mKeyEventDelegate.lock()) {
1441 if (auto pWaveChannelView =
1442 dynamic_cast<WaveChannelView*>(delegate.get()))
1443 result = pWaveChannelView->CommonChannelView::LoseFocus(project);
1444 else
1445 result = delegate->LoseFocus(project);
1446 mKeyEventDelegate.reset();
1447 }
1448 return result;
1449}

References mKeyEventDelegate, project, and RefreshCode::RefreshNone.

◆ operator=()

WaveChannelView & WaveChannelView::operator= ( const WaveChannelView )
privatedelete

◆ PasteText()

bool WaveChannelView::PasteText ( AudacityProject project)

Definition at line 1508 of file WaveChannelView.cpp.

1509{
1510 return
1512}
bool OnTextPaste(AudacityProject &project)

References anonymous_namespace{WaveChannelView.cpp}::AnyAffordance(), WaveTrackAffordanceControls::OnTextPaste(), and project.

Here is the call graph for this function:

◆ Reparent()

void WaveChannelView::Reparent ( const std::shared_ptr< Track > &  parent,
size_t  iChannel 
)
overridevirtual

Object may be shared among tracks but hold a special back-pointer to one of them; reassign it.

Parameters
iChannelposition of the attachment's channel in the group The default does nothing

Reimplemented from ChannelAttachment.

Definition at line 1581 of file WaveChannelView.cpp.

1583{
1584 // BuildSubViews(); // not really needed
1587 {
1588 subView.Reparent(parent, iChannel);
1589 });
1591 mpAffordanceCellControl->Reparent(parent);
1592}
void Reparent(const std::shared_ptr< Track > &parent, size_t iChannel) override
Object may be shared among tracks but hold a special back-pointer to one of them; reassign it.
Definition: ChannelView.cpp:31

References ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::ForEach(), anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel, mpAffordanceCellControl, and ChannelView::Reparent().

Here is the call graph for this function:

◆ RestorePlacements()

void WaveChannelView::RestorePlacements ( const WaveChannelSubViewPlacements placements)
inline

Definition at line 154 of file WaveChannelView.h.

155 { DoGetPlacements() = placements; }

Referenced by SpectrumPrefs::Rollback(), and SubViewAdjuster::UpdateViews().

Here is the caller graph for this function:

◆ SavePlacements()

const WaveChannelSubViewPlacements & WaveChannelView::SavePlacements ( ) const
inline

Definition at line 152 of file WaveChannelView.h.

153 { return DoGetPlacements(); }

Referenced by CopyTo(), SpectrumPrefs::SpectrumPrefs(), and SubViewAdjuster::SubViewAdjuster().

Here is the caller graph for this function:

◆ SelectAllText()

bool WaveChannelView::SelectAllText ( AudacityProject project)

Definition at line 1514 of file WaveChannelView.cpp.

1515{
1516 return
1518}
bool OnTextSelect(AudacityProject &project)

References anonymous_namespace{WaveChannelView.cpp}::AnyAffordance(), WaveTrackAffordanceControls::OnTextSelect(), and project.

Here is the call graph for this function:

◆ SelectNextClip()

bool WaveChannelView::SelectNextClip ( ViewInfo viewInfo,
AudacityProject project,
bool  forward 
)
private

Definition at line 1207 of file WaveChannelView.cpp.

1209{
1210 //Iterates through clips in a looped manner
1211 const auto pChannel = FindWaveChannel();
1212 if (!pChannel)
1213 return false;
1214 auto clips = WaveChannelUtilities::SortedClipArray(*pChannel);
1215 if (clips.empty())
1216 return false;
1217
1218 std::shared_ptr<WaveChannelInterval> clip{};
1219 if (forward)
1220 {
1221 clip = NextClipLooped(viewInfo, clips.begin(), clips.end(),
1222 [&](const auto &other) {
1223 return other->GetPlayStartTime() >= viewInfo.selectedRegion.t1();
1224 });
1225 }
1226 else
1227 {
1228 clip = NextClipLooped(viewInfo, clips.rbegin(), clips.rend(),
1229 [&](const auto &other) {
1230 return other->GetPlayStartTime() <= viewInfo.selectedRegion.t0();
1231 });
1232 }
1233
1234 viewInfo.selectedRegion.setTimes(clip->GetPlayStartTime(), clip->GetPlayEndTime());
1235 ProjectHistory::Get(*project).ModifyState(false);
1236
1237 // create and send message to screen reader
1238 auto it = std::find(clips.begin(), clips.end(), clip);
1239 auto index = std::distance(clips.begin(), it);
1240
1241 auto &waveTrack = pChannel->GetTrack();
1242 auto wideClipIt = waveTrack.Intervals().first;
1243 std::advance(wideClipIt, waveTrack.GetClipIndex(clip->GetClip()));
1245 .Retarget(waveTrack.SharedPointer<WaveTrack>(), *wideClipIt);
1246
1247 auto message = XP(
1248 /* i18n-hint:
1249 string is the name of a clip
1250 first number is the position of that clip in a sequence of clips,
1251 second number counts the clips */
1252 "%s, %d of %d clip",
1253 "%s, %d of %d clips",
1254 2
1255 )(
1256 clip->GetClip().GetName(),
1257 static_cast<int>(index + 1),
1258 static_cast<int>(clips.size())
1259 );
1260
1261 TrackFocus::Get(*project).MessageForScreenReader(message);
1262 return true;
1263}
#define XP(sing, plur, n)
Definition: Internat.h:94
bool setTimes(double t0, double t1)
Definition: ViewInfo.cpp:51
static PitchAndSpeedDialog & Get(AudacityProject &project)
PitchAndSpeedDialog & Retarget(const std::shared_ptr< WaveTrack > &track, const WaveTrack::IntervalHolder &wideClip)
void ModifyState(bool bWantsAutoSave)
static ProjectHistory & Get(AudacityProject &project)
Track * Get()
Definition: TrackFocus.cpp:156
NotifyingSelectedRegion selectedRegion
Definition: ViewInfo.h:216
WAVE_TRACK_API ClipPointers SortedClipArray(WaveChannel &channel)
Get clips sorted by play start time.
std::shared_ptr< WaveChannelInterval > NextClipLooped(ViewInfo &viewInfo, Iter begin, Iter end, Comp comp)

References FindWaveChannel(), forward, TrackFocus::Get(), ProjectHistory::Get(), PitchAndSpeedDialog::Get(), ProjectHistory::ModifyState(), anonymous_namespace{WaveChannelView.cpp}::NextClipLooped(), project, PitchAndSpeedDialog::Retarget(), ViewInfo::selectedRegion, NotifyingSelectedRegion::setTimes(), WaveChannelUtilities::SortedClipArray(), and XP.

Referenced by KeyDown().

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

◆ SetDisplay()

void WaveChannelView::SetDisplay ( Display  display,
bool  exclusive = true 
)

Definition at line 1081 of file WaveChannelView.cpp.

1082{
1083 BuildSubViews();
1084 DoSetDisplay( display, exclusive );
1085}
void DoSetDisplay(Display display, bool exclusive=true)

References BuildSubViews(), and DoSetDisplay().

Referenced by WaveformPrefs::Commit(), and WaveTrackMenuTable::OnSetDisplay().

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

◆ SetMultiView()

void WaveChannelView::SetMultiView ( bool  value)
inline

Definition at line 169 of file WaveChannelView.h.

169{ DoGetMultiView() = value; }

◆ ToggleSubView()

bool WaveChannelView::ToggleSubView ( Display  id)

Definition at line 1087 of file WaveChannelView.cpp.

1088{
1089 size_t ii = 0;
1090 size_t found = 0;
1091 if (WaveChannelSubViews::FindIf([&](const WaveChannelSubView &subView) {
1092 if (subView.SubViewType().id == display) {
1093 found = ii;
1094 return true;
1095 }
1096 ++ii;
1097 return false;
1098 })) {
1099 auto &placements = DoGetPlacements();
1100 auto &foundPlacement = placements[found];
1101 if ( foundPlacement.fraction > 0.0 ) {
1102 // Toggle off
1103
1104 if (GetDisplays().size() < 2)
1105 // refuse to do it
1106 return false;
1107
1108 auto index = foundPlacement.index;
1109 foundPlacement = { -1, 0.0 };
1110 if (index >= 0) {
1111 for ( auto &placement : placements ) {
1112 if ( placement.index > index )
1113 --placement.index;
1114 }
1115 }
1116
1117 return true;
1118 }
1119 else {
1120 // Toggle on
1121 float total = 0;
1122 int greatest = -1;
1123 unsigned nn = 0;
1124 for ( const auto &placement : placements ) {
1125 if ( placement.fraction > 0.0 && placement.index >= 0 ) {
1126 total += placement.fraction;
1127 greatest = std::max( greatest, placement.index );
1128 ++nn;
1129 }
1130 }
1131 // Turn on the sub-view, putting it lowest, and with average of the
1132 // heights of the other sub-views
1133 foundPlacement = { greatest + 1, total / nn };
1134
1135 return true;
1136 }
1137 }
1138 else
1139 // unknown sub-view
1140 return false;
1141}
ClientData * FindIf(const Function &function)
Return pointer to first attachment in this that is not null and satisfies a predicate,...
Definition: ClientData.h:497
std::vector< WaveChannelSubView::Type > GetDisplays() const

References DoGetPlacements(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::FindIf(), GetDisplays(), WaveChannelSubViewType::id, ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::size(), and WaveChannelSubView::SubViewType().

Here is the call graph for this function:

Member Data Documentation

◆ kChannelSeparatorThickness

constexpr int WaveChannelView::kChannelSeparatorThickness { 8 }
staticconstexpr

Definition at line 105 of file WaveChannelView.h.

Referenced by WaveChannelSubView::DoDetailedHitTest().

◆ mAffordanceHandle

std::weak_ptr<WaveTrackAffordanceHandle> WaveChannelView::mAffordanceHandle
private

Definition at line 251 of file WaveChannelView.h.

◆ mKeyEventDelegate

std::weak_ptr<TrackPanelCell> WaveChannelView::mKeyEventDelegate
private

Definition at line 249 of file WaveChannelView.h.

Referenced by CaptureKey(), Char(), KeyDown(), and LoseFocus().

◆ mLastHeight

wxCoord WaveChannelView::mLastHeight {}
mutableprivate

Definition at line 240 of file WaveChannelView.h.

◆ mpAffordanceCellControl

std::shared_ptr<CommonTrackCell> WaveChannelView::mpAffordanceCellControl
private

Definition at line 247 of file WaveChannelView.h.

Referenced by DoGetAffordance(), and Reparent().


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