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 (const std::shared_ptr< Track > &pTrack, size_t channel)
 Construct a view of one channel. More...
 
 ~WaveChannelView () override
 
void CopyTo (Track &track) const override
 Copy state, for undo/redo purposes. More...
 
std::shared_ptr< ChannelVRulerControlsDoGetVRulerControls () override
 
void Reparent (const std::shared_ptr< Track > &parent) 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)
 
std::weak_ptr< WaveClipGetSelectedClip ()
 
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)
 
- 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< Track > &pTrack, size_t iChannel)
 Construct from a track and a channel index. More...
 
- Public Member Functions inherited from ChannelView
 ChannelView (const std::shared_ptr< Track > &pTrack, size_t iChannel)
 Construct from a track and a channel index. More...
 
virtual ~ChannelView ()=0
 
void CopyTo (Track &track) 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 &) const override
 Serialize persistent attributes. More...
 
bool HandleXMLAttribute (const std::string_view &attr, const XMLAttributeValueView &valueView) 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 CommonTrackCell
 CommonTrackCell (const std::shared_ptr< Track > &pTrack, size_t iChannel)
 Construct from a track and a channel index. More...
 
 CommonTrackCell (ChannelGroup &group, size_t iChannel)
 Construct from a channel group and a channel index. More...
 
 ~CommonTrackCell ()
 
std::shared_ptr< TrackDoFindTrack () override
 
void Reparent (const std::shared_ptr< Track > &parent) override
 Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
 
size_t GetChannelIndex () const
 
std::shared_ptr< ChannelFindChannel ()
 May return null. More...
 
std::shared_ptr< const ChannelFindChannel () const
 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 TrackAttachment
virtual ~TrackAttachment ()
 
virtual void CopyTo (Track &track) const
 Copy state, for undo/redo purposes. More...
 
virtual void Reparent (const std::shared_ptr< Track > &parent)
 Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
 
virtual void WriteXMLAttributes (XMLWriter &) const
 Serialize persistent attributes. More...
 
virtual bool HandleXMLAttribute (const std::string_view &attr, const XMLAttributeValueView &valueView)
 Deserialize an attribute, returning true if recognized. More...
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 
- 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 std::pair< bool, std::vector< UIHandlePtr > > DoDetailedHitTest (const TrackPanelMouseState &state, const AudacityProject *pProject, int currentTool, bool bMultiTool, const std::shared_ptr< WaveTrack > &wt, CommonChannelView &view)
 
static bool ClipDetailsVisible (const ClipTimes &clip, const ZoomInfo &zoomInfo, const wxRect &viewRect)
 
static wxRect ClipHitTestArea (const WaveClip &clip, const ZoomInfo &zoomInfo, const wxRect &viewRect)
 
static bool HitTest (const WaveClip &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
 
std::shared_ptr< CommonTrackCellGetAffordanceControls () override
 
void DoSetMinimized (bool minimized) override
 
WaveChannelSubViewPlacementsDoGetPlacements ()
 
const WaveChannelSubViewPlacementsDoGetPlacements () const
 
bool & DoGetMultiView ()
 
bool DoGetMultiView () const
 
std::shared_ptr< CommonTrackCellDoGetAffordance (const std::shared_ptr< 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 >
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...
 
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() [1/2]

WaveChannelView::WaveChannelView ( const WaveChannelView )
privatedelete

◆ WaveChannelView() [2/2]

WaveChannelView::WaveChannelView ( const std::shared_ptr< Track > &  pTrack,
size_t  channel 
)

Construct a view of one channel.

Parameters
channelwhich channel of a possibly wide wave track

Definition at line 926 of file WaveChannelView.cpp.

928 : CommonChannelView{ pTrack, channel }
929{
930}
Implements some hit-testing shared by many ChannelView subtypes.

◆ ~WaveChannelView()

WaveChannelView::~WaveChannelView ( )
override

Definition at line 944 of file WaveChannelView.cpp.

945{
946}

Member Function Documentation

◆ BuildSubViews()

void WaveChannelView::BuildSubViews ( ) const
private

Definition at line 1715 of file WaveChannelView.cpp.

1716{
1717 if (WaveChannelSubViews::size() == 0) {
1718 // On-demand steps that can't happen in the constructor
1719 auto pThis = const_cast<WaveChannelView*>(this);
1720 pThis->BuildAll();
1721 bool minimized = GetMinimized();
1722 pThis->WaveChannelSubViews::ForEach([&](WaveChannelSubView &subView){
1723 subView.DoSetMinimized(minimized);
1724 });
1725
1726 auto &placements = pThis->DoGetPlacements();
1727 if (placements.empty()) {
1728 placements.resize(WaveChannelSubViews::size());
1729
1730 auto pTrack = pThis->FindTrack();
1731 auto display = TracksPrefs::ViewModeChoice();
1732 bool multi = (display == WaveChannelViewConstants::MultiView);
1733 if (multi) {
1734 pThis->SetMultiView( true );
1736 }
1737
1738 pThis->DoSetDisplay( display, !multi );
1739 }
1740 }
1741}
bool GetMinimized() const
Definition: ChannelView.h:68
virtual void DoSetMinimized(bool isMinimized)
size_t size() const
How many attachment pointers are in the Site.
Definition: ClientData.h:259
void BuildAll()
For each RegisteredFactory, if the corresponding attachment is absent in this, build and store it.
Definition: ClientData.h:449
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 1286 of file WaveChannelView.cpp.

1289{
1290 unsigned result{ RefreshCode::RefreshNone };
1291 auto pTrack = static_cast<WaveTrack*>(FindTrack().get());
1292 for (auto pChannel : pTrack->Channels()) {
1293 event.Skip(false);
1294 auto &waveChannelView = WaveChannelView::Get(*pChannel);
1295 // Give sub-views first chance to handle the event
1296 for (auto &subView : waveChannelView.GetSubViews()) {
1297 // Event defaults in skipped state which must be turned off explicitly
1298 wxASSERT(!event.GetSkipped());
1299 result |= subView.second->CaptureKey(event, viewInfo, pParent, project);
1300 if (!event.GetSkipped()) {
1301 // sub view wants it
1302 mKeyEventDelegate = subView.second;
1303 return result;
1304 }
1305 else
1306 event.Skip(false);
1307 }
1308
1309 if (auto affordance = waveChannelView.GetAffordanceControls()) {
1310 result |= affordance->CaptureKey(event, viewInfo, pParent, project);
1311 if (!event.GetSkipped()) {
1312 mKeyEventDelegate = affordance;
1313 return result;
1314 }
1315 }
1316
1317 event.Skip(false);
1318 }
1319 switch (event.GetKeyCode())
1320 {
1321 case WXK_TAB:
1322 break;
1323 default:
1325 event, viewInfo, pParent, project);
1326 break;
1327 };
1328 if (!event.GetSkipped()) {
1329 mKeyEventDelegate = shared_from_this();
1330 }
1331
1332 return result;
1333}
const auto project
std::shared_ptr< Track > FindTrack()
virtual unsigned CaptureKey(wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
std::weak_ptr< TrackPanelCell > mKeyEventDelegate
static WaveChannelView & Get(WaveChannel &channel)
A Track that contains audio waveform data.
Definition: WaveTrack.h:222

References TrackPanelCell::CaptureKey(), CommonTrackPanelCell::FindTrack(), 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 1362 of file WaveChannelView.cpp.

1365{
1366 unsigned result{ RefreshCode::RefreshNone };
1367 if (auto delegate = mKeyEventDelegate.lock()) {
1368 if (auto pWaveChannelView =
1369 dynamic_cast<WaveChannelView*>(delegate.get()))
1370 result |= pWaveChannelView->CommonChannelView::Char(
1371 event, viewInfo, pParent, project);
1372 else
1373 result |= delegate->Char(event, viewInfo, pParent, project);
1374 }
1375 else
1376 event.Skip();
1377
1378 return result;
1379}

References mKeyEventDelegate, project, and RefreshCode::RefreshNone.

◆ ClipDetailsVisible()

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

Definition at line 1424 of file WaveChannelView.cpp.

1426{
1427 //Do not fold clips to line at sample zoom level, as
1428 //it may become impossible to 'unfold' it when clip is trimmed
1429 //to a single sample
1430 bool showSamples{ false };
1431 auto clipRect = ClipParameters::GetClipRect(clip, zoomInfo, viewRect, &showSamples);
1432 return showSamples || clipRect.width >= kClipDetailedViewMinimumWidth;
1433}
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 WaveClip clip,
const ZoomInfo zoomInfo,
const wxRect &  viewRect 
)
static

Definition at line 1435 of file WaveChannelView.cpp.

1437{
1438 bool showSamples{ false };
1439 auto clipRect = ClipParameters::GetClipRect(clip, zoomInfo, viewRect, &showSamples);
1440 if (showSamples || clipRect.width >= kClipDetailedViewMinimumWidth)
1441 return clipRect;
1442
1443 return clipRect.Inflate(2, 0);
1444}

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 1418 of file WaveChannelView.cpp.

1419{
1420 return
1422}
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) const
overridevirtual

Copy state, for undo/redo purposes.

Reimplemented from TrackAttachment.

Definition at line 948 of file WaveChannelView.cpp.

949{
950 ChannelView::CopyTo(track);
951 auto &other = ChannelView::Get(*track.GetChannel(0));
952 if (const auto pOther = dynamic_cast<WaveChannelView*>(&other)) {
953 // only these fields are important to preserve in undo/redo history
954 pOther->RestorePlacements( SavePlacements() );
955 pOther->DoGetMultiView() = DoGetMultiView();
956
957 auto srcSubViewsPtrs =
958 const_cast<WaveChannelView*>(this)->GetAllSubViews();
959 auto destSubViewsPtrs =
960 const_cast<WaveChannelView*>(pOther)->GetAllSubViews();
961 wxASSERT(srcSubViewsPtrs.size() == destSubViewsPtrs.size());
962
963 for(auto i = 0; i != srcSubViewsPtrs.size(); i++){
964 srcSubViewsPtrs[i]->CopyToSubView(destSubViewsPtrs[i].get());
965 }
966 }
967}
std::shared_ptr< ChannelType > GetChannel(size_t iChannel)
Retrieve a channel, cast to the given type.
Definition: Channel.h:344
static ChannelView & Get(Channel &channel)
void CopyTo(Track &track) const override
Copy state, for undo/redo purposes.
Definition: ChannelView.cpp:60
std::vector< std::shared_ptr< WaveChannelSubView > > GetAllSubViews()
const WaveChannelSubViewPlacements & SavePlacements() const

References ChannelView::CopyTo(), DoGetMultiView(), ChannelView::Get(), GetAllSubViews(), ChannelGroup::GetChannel(), and SavePlacements().

Here is the call graph for this function:

◆ CutSelectedText()

bool WaveChannelView::CutSelectedText ( AudacityProject project)

Definition at line 1412 of file WaveChannelView.cpp.

1413{
1414 return
1416}
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 969 of file WaveChannelView.cpp.

972{
973 // should not come here any more, delegation to sub-view instead
974 wxASSERT( false );
975 return {};
976}

◆ DoDetailedHitTest()

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

Definition at line 979 of file WaveChannelView.cpp.

984{
985 // common hit-testing for different sub-view types, to help implement their
986 // DetailedHitTest()
987
988 // This is the only override of Track::DetailedHitTest that still
989 // depends on the state of the Tools toolbar.
990 // If that toolbar were eliminated, this could simplify to a sequence of
991 // hit test routines describable by a table.
992
993 std::vector<UIHandlePtr> results;
994
995 const auto& viewInfo = ViewInfo::Get(*pProject);
996
997 for (auto& clip : pTrack->GetClips())
998 {
999 if (!WaveChannelView::ClipDetailsVisible(*clip, viewInfo, st.rect)
1000 && HitTest(*clip, viewInfo, st.rect, st.state.GetPosition()))
1001 {
1002 auto &waveChannelView = WaveChannelView::Get(*pTrack);
1003 results.push_back(
1005 waveChannelView.mAffordanceHandle,
1006 std::make_shared<WaveTrackAffordanceHandle>(pTrack, clip)
1007 )
1008 );
1009 }
1010 }
1011
1012 if (bMultiTool && st.state.CmdDown()) {
1013 // Ctrl modifier key in multi-tool overrides everything else
1014 // (But this does not do the time shift constrained to the vertical only,
1015 // which is what happens when you hold Ctrl in the Time Shift tool mode)
1016 auto result = TimeShiftHandle::HitAnywhere(
1017 view.mTimeShiftHandle, pTrack, false);
1018 if (result)
1019 results.push_back(result);
1020 return { true, results };
1021 }
1022
1023 return { false, results };
1024}
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
Definition: UIHandle.h:159
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 WaveClip &clip, const ZoomInfo &zoomInfo, const wxRect &rect, const wxPoint &pos)

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 ( const std::shared_ptr< Track > &  track)
private

Definition at line 1497 of file WaveChannelView.cpp.

1498{
1499 if (mpAffordanceCellControl == nullptr)
1500 mpAffordanceCellControl = std::make_shared<WaveTrackAffordanceControls>(track);
1502}
std::shared_ptr< CommonTrackCell > mpAffordanceCellControl

References mpAffordanceCellControl.

Referenced by GetAffordanceControls().

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 = *std::dynamic_pointer_cast<WaveTrack>(FindTrack());
98 return PlacementArray::Get(waveTrack).mMultiView;
99}
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:196

References CommonTrackPanelCell::FindTrack(), 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 &waveTrack = *std::dynamic_pointer_cast<WaveTrack>(FindTrack());
87 return PlacementArray::Get(waveTrack).mPlacements;
88}

References CommonTrackPanelCell::FindTrack(), 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 1512 of file WaveChannelView.cpp.

1513{
1514 // This should never be called because of delegation to the spectrum or
1515 // waveform sub-view
1516 wxASSERT( false );
1517 return {};
1518}

◆ DoSetDisplay()

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

Definition at line 1114 of file WaveChannelView.cpp.

1115{
1116 // Some generality here anticipating more than two views.
1117 // The order of sub-views in the array is not specified, so make it definite
1118 // by sorting by the view type constants.
1119 size_t ii = 0;
1120 std::vector<std::pair<WaveChannelViewConstants::Display, size_t>> pairs;
1121 WaveChannelSubViews::ForEach([&pairs, &ii](WaveChannelSubView &subView){
1122 pairs.push_back({ subView.SubViewType().id, ii++ });
1123 });
1124 std::sort( pairs.begin(), pairs.end() );
1125
1126 int jj = 1;
1127 auto &placements = DoGetPlacements();
1128 for ( const auto &pair : pairs ) {
1129 auto &placement = placements[ pair.second ];
1130 if (pair.first == display) {
1131 // 0 for first view
1132 placement = { 0, 1.0 };
1133 }
1134 else if( exclusive )
1135 // -1 for not displayed
1136 placement = { -1, 0.0 };
1137 else
1138 // positions other than the first.
1139 // (Note that the fractions in the placement don't need to be
1140 // denominated to 1. Just make them all equal to get an equal
1141 // partitioning of the sub-views.)
1142 placement = { jj++, 1.0 };
1143 }
1144}
void ForEach(const Function &function)
Invoke function on each ClientData object that has been created in this.
Definition: ClientData.h:388
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 1485 of file WaveChannelView.cpp.

1486{
1487 BuildSubViews();
1488
1489 // May come here. Invoke also on sub-views.
1490 ChannelView::DoSetMinimized(minimized);
1491 WaveChannelSubViews::ForEach([minimized](WaveChannelSubView &subView) {
1492 subView.DoSetMinimized(minimized);
1493 });
1494}
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 1743 of file WaveChannelView.cpp.

1746{
1747 // Should not come here, drawing is now delegated to sub-views
1748 wxASSERT( false );
1749
1750 CommonChannelView::Draw(context, rect, iPass);
1751}
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 921 of file WaveChannelView.cpp.

922{
923 return Find(const_cast<WaveChannel*>(pChannel));
924}
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 916 of file WaveChannelView.cpp.

917{
918 return static_cast<WaveChannelView*>(ChannelView::Find(pChannel));
919}
static ChannelView * Find(Channel *pChannel)

References ChannelView::Find().

Referenced by Find(), NyquistEffect::Init(), and NyquistEffect::ProcessOne().

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

◆ Get() [1/2]

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

Definition at line 911 of file WaveChannelView.cpp.

912{
913 return Get(const_cast<WaveChannel&>(channel));
914}

References Get().

Here is the call graph for this function:

◆ Get() [2/2]

WaveChannelView & WaveChannelView::Get ( WaveChannel channel)
static

Definition at line 906 of file WaveChannelView.cpp.

907{
908 return static_cast<WaveChannelView&>(ChannelView::Get(channel));
909}

References ChannelView::Get().

Referenced by Append(), SetTrackVisualsCommand::ApplyInner(), CaptureKey(), WaveformPrefs::Commit(), DoDetailedHitTest(), anonymous_namespace{EditMenus.cpp}::DoPasteText(), for(), Get(), anonymous_namespace{EditMenus.cpp}::OnCopy(), anonymous_namespace{EditMenus.cpp}::OnCut(), WaveTrackMenuTable::OnMergeStereo(), WaveTrackMenuTable::OnMultiView(), SelectActions::Handler::OnSelectAll(), WaveTrackMenuTable::OnSetDisplay(), 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 ( )
overrideprivatevirtual

Reimplemented from ChannelView.

Definition at line 1477 of file WaveChannelView.cpp.

1478{
1479 auto track = FindTrack();
1480 if (track->IsLeader())
1481 return DoGetAffordance(track);
1482 return {};
1483}
std::shared_ptr< CommonTrackCell > DoGetAffordance(const std::shared_ptr< Track > &track)

References DoGetAffordance(), and CommonTrackPanelCell::FindTrack().

Referenced by GetSelectedClip().

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

◆ GetAllSubViews()

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

Definition at line 1465 of file WaveChannelView.cpp.

1466{
1467 BuildSubViews();
1468
1469 std::vector<std::shared_ptr<WaveChannelSubView>> results;
1471 results.push_back(std::static_pointer_cast<WaveChannelSubView>(
1472 subView.shared_from_this()));
1473 });
1474 return results;
1475}

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 1026 of file WaveChannelView.cpp.

1028{
1029 BuildSubViews();
1030
1031 // Collect the display types of visible views and sort them by position
1032 using Pair = std::pair<int, WaveChannelSubView::Type>;
1033 std::vector< Pair > pairs;
1034 size_t ii = 0;
1035 const auto &placements = DoGetPlacements();
1037 auto &placement = placements[ii];
1038 if (placement.fraction > 0)
1039 pairs.emplace_back(placement.index, subView.SubViewType());
1040 ++ii;
1041 } );
1042 std::sort( pairs.begin(), pairs.end() );
1043 std::vector<WaveChannelSubView::Type> results;
1044 for (const auto &pair : pairs)
1045 results.push_back(pair.second);
1046 return results;
1047}
std::pair< const char *, const char * > Pair

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

Referenced by ToggleSubView().

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 155 of file WaveChannelView.h.

155{ 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 157 of file WaveChannelView.h.

157{ return DoGetMultiView(); }

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

Here is the caller graph for this function:

◆ GetSelectedClip()

std::weak_ptr< WaveClip > WaveChannelView::GetSelectedClip ( )

Definition at line 1702 of file WaveChannelView.cpp.

1703{
1704 if (auto affordance = std::dynamic_pointer_cast<WaveTrackAffordanceControls>(GetAffordanceControls()))
1705 {
1706 assert(GetChannelIndex() == 0);
1707 if(auto interval = *affordance->GetSelectedInterval())
1708 {
1709 return interval->GetClip(0);
1710 }
1711 }
1712 return {};
1713}
size_t GetChannelIndex() const
std::shared_ptr< CommonTrackCell > GetAffordanceControls() override

References GetAffordanceControls(), and CommonTrackCell::GetChannelIndex().

Here is the call graph for this function:

◆ GetSubViews() [1/2]

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

Reimplemented from ChannelView.

Definition at line 1212 of file WaveChannelView.cpp.

1213{
1214 return GetSubViews(&rect);
1215}
Refinement GetSubViews(const wxRect *rect=nullptr)

◆ GetSubViews() [2/2]

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

Definition at line 1217 of file WaveChannelView.cpp.

1218{
1219 BuildSubViews();
1220
1221 // Collect the visible views in the right sequence
1222 struct Item {
1223 int index; float fraction; std::shared_ptr<ChannelView> pView;
1224 };
1225 std::vector< Item > items;
1226 size_t ii = 0;
1227 float total = 0;
1228 const auto &placements = DoGetPlacements();
1230 auto& placement = placements[ii];
1231 auto index = placement.index;
1232 auto fraction = placement.fraction;
1233 if (index >= 0 && fraction > 0.0)
1234 total += fraction,
1235 items.push_back({ index, fraction, subView.shared_from_this() });
1236 ++ii;
1237 });
1238 std::sort(items.begin(), items.end(), [](const Item& a, const Item& b) {
1239 return a.index < b.index;
1240 });
1241
1242 // Remove views we don't need
1243 auto begin = items.begin(), end = items.end(),
1244 newEnd = std::remove_if(begin, end,
1245 [](const Item& item) { return !item.pView; });
1246 items.erase(newEnd, end);
1247
1248 Refinement results;
1249
1250 if (rect != nullptr)
1251 {
1252 // Assign coordinates, redenominating to the total height,
1253 // storing integer values
1254 results.reserve(items.size());
1255 const auto top = rect->GetTop();
1256 const auto height = rect->GetHeight();
1257 float partial = 0;
1258 wxCoord lastCoord = 0;
1259 for (const auto& item : items) {
1260 wxCoord newCoord = top + (partial / total) * height;
1261 results.emplace_back(newCoord, item.pView);
1262 partial += item.fraction;
1263 }
1264
1265 // Cache for the use of sub-view dragging
1266 mLastHeight = height;
1267 }
1268 else
1269 {
1270 std::transform(items.begin(), items.end(), std::back_inserter(results), [](const auto& item) {
1271 return std::make_pair(0, item.pView);
1272 });
1273 }
1274
1275 return results;
1276}
std::vector< std::pair< wxCoord, std::shared_ptr< ChannelView > > > Refinement
Definition: ChannelView.h:120
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:159
auto begin(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:150

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

Here is the call graph for this function:

◆ HitTest()

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

Definition at line 1446 of file WaveChannelView.cpp.

1448{
1449 return ClipHitTestArea(clip, viewInfo, viewRect).Contains(pos);
1450}
static wxRect ClipHitTestArea(const WaveClip &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 1335 of file WaveChannelView.cpp.

1338{
1339 unsigned result{ RefreshCode::RefreshNone };
1340 if (auto delegate = mKeyEventDelegate.lock()) {
1341 if (auto pWaveChannelView =
1342 dynamic_cast<WaveChannelView*>(delegate.get()))
1343 {
1344 if (event.GetKeyCode() == WXK_TAB)
1345 {
1346 SelectNextClip(viewInfo, project, event.GetModifiers() != wxMOD_SHIFT);
1347 result |= RefreshCode::RefreshCell;
1348 }
1349 else
1350 result |= pWaveChannelView->CommonChannelView::KeyDown(
1351 event, viewInfo, pParent, project);
1352 }
1353 else
1354 result |= delegate->KeyDown(event, viewInfo, pParent, project);
1355 }
1356 else
1357 event.Skip();
1358
1359 return result;
1360}
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 1381 of file WaveChannelView.cpp.

1382{
1383 unsigned result = RefreshCode::RefreshNone;
1384 if (auto delegate = mKeyEventDelegate.lock()) {
1385 if (auto pWaveChannelView =
1386 dynamic_cast<WaveChannelView*>(delegate.get()))
1387 result = pWaveChannelView->CommonChannelView::LoseFocus(project);
1388 else
1389 result = delegate->LoseFocus(project);
1390 mKeyEventDelegate.reset();
1391 }
1392 return result;
1393}

References mKeyEventDelegate, project, and RefreshCode::RefreshNone.

◆ operator=()

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

◆ PasteText()

bool WaveChannelView::PasteText ( AudacityProject project)

Definition at line 1452 of file WaveChannelView.cpp.

1453{
1454 return
1456}
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)
overridevirtual

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

default does nothing

Reimplemented from TrackAttachment.

Definition at line 1691 of file WaveChannelView.cpp.

1692{
1693 // BuildSubViews(); // not really needed
1696 subView.Reparent(parent);
1697 });
1699 mpAffordanceCellControl->Reparent(parent);
1700}
void Reparent(const std::shared_ptr< Track > &parent) override
Object may be shared among tracks but hold a special back-pointer to one of them; reassign it.

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

Here is the call graph for this function:

◆ RestorePlacements()

void WaveChannelView::RestorePlacements ( const WaveChannelSubViewPlacements placements)
inline

Definition at line 143 of file WaveChannelView.h.

144 { 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 141 of file WaveChannelView.h.

142 { 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 1458 of file WaveChannelView.cpp.

1459{
1460 return
1462}
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 1162 of file WaveChannelView.cpp.

1164{
1165 //Iterates through clips in a looped manner
1166 auto waveTrack = std::dynamic_pointer_cast<WaveTrack>(FindTrack());
1167 if (!waveTrack)
1168 return false;
1169 auto clips = waveTrack->SortedClipArray();
1170 if (clips.empty())
1171 return false;
1172
1173 const WaveClip* clip{ };
1174 if (forward)
1175 {
1176 clip = NextClipLooped(viewInfo, clips.begin(), clips.end(), [&](const WaveClip* other) {
1177 return other->GetPlayStartTime() >= viewInfo.selectedRegion.t1();
1178 });
1179 }
1180 else
1181 {
1182 clip = NextClipLooped(viewInfo, clips.rbegin(), clips.rend(), [&](const WaveClip* other) {
1183 return other->GetPlayStartTime() <= viewInfo.selectedRegion.t0();
1184 });
1185 }
1186
1187 viewInfo.selectedRegion.setTimes(clip->GetPlayStartTime(), clip->GetPlayEndTime());
1188 ProjectHistory::Get(*project).ModifyState(false);
1189
1190 // create and send message to screen reader
1191 auto it = std::find(clips.begin(), clips.end(), clip);
1192 auto index = std::distance(clips.begin(), it);
1193
1194 auto message = XP(
1195 /* i18n-hint:
1196 string is the name of a clip
1197 first number is the position of that clip in a sequence of clips,
1198 second number counts the clips */
1199 "%s, %d of %d clip",
1200 "%s, %d of %d clips",
1201 2
1202 )(
1203 clip->GetName(),
1204 static_cast<int>(index + 1),
1205 static_cast<int>(clips.size())
1206 );
1207
1208 TrackFocus::Get(*project).MessageForScreenReader(message);
1209 return true;
1210}
#define XP(sing, plur, n)
Definition: Internat.h:94
bool setTimes(double t0, double t1)
Definition: ViewInfo.cpp:51
void ModifyState(bool bWantsAutoSave)
static ProjectHistory & Get(AudacityProject &project)
Track * Get()
Definition: TrackFocus.cpp:156
NotifyingSelectedRegion selectedRegion
Definition: ViewInfo.h:215
This allows multiple clips to be a part of one WaveTrack.
Definition: WaveClip.h:103
const WaveClip * NextClipLooped(ViewInfo &viewInfo, Iter begin, Iter end, Comp comp)

References CommonTrackPanelCell::FindTrack(), forward, TrackFocus::Get(), ProjectHistory::Get(), ProjectHistory::ModifyState(), anonymous_namespace{WaveChannelView.cpp}::NextClipLooped(), ViewInfo::selectedRegion, NotifyingSelectedRegion::setTimes(), 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 1049 of file WaveChannelView.cpp.

1050{
1051 BuildSubViews();
1052 DoSetDisplay( display, exclusive );
1053}
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 158 of file WaveChannelView.h.

158{ DoGetMultiView() = value; }

◆ ToggleSubView()

bool WaveChannelView::ToggleSubView ( Display  id)

Definition at line 1055 of file WaveChannelView.cpp.

1056{
1057 size_t ii = 0;
1058 size_t found = 0;
1059 if (WaveChannelSubViews::FindIf([&](const WaveChannelSubView &subView) {
1060 if (subView.SubViewType().id == display) {
1061 found = ii;
1062 return true;
1063 }
1064 ++ii;
1065 return false;
1066 })) {
1067 auto &placements = DoGetPlacements();
1068 auto &foundPlacement = placements[found];
1069 if ( foundPlacement.fraction > 0.0 ) {
1070 // Toggle off
1071
1072 if (GetDisplays().size() < 2)
1073 // refuse to do it
1074 return false;
1075
1076 auto index = foundPlacement.index;
1077 foundPlacement = { -1, 0.0 };
1078 if (index >= 0) {
1079 for ( auto &placement : placements ) {
1080 if ( placement.index > index )
1081 --placement.index;
1082 }
1083 }
1084
1085 return true;
1086 }
1087 else {
1088 // Toggle on
1089 float total = 0;
1090 int greatest = -1;
1091 unsigned nn = 0;
1092 for ( const auto &placement : placements ) {
1093 if ( placement.fraction > 0.0 && placement.index >= 0 ) {
1094 total += placement.fraction;
1095 greatest = std::max( greatest, placement.index );
1096 ++nn;
1097 }
1098 }
1099 // Turn on the sub-view, putting it lowest, and with average of the
1100 // heights of the other sub-views
1101 foundPlacement = { greatest + 1, total / nn };
1102
1103 return true;
1104 }
1105 }
1106 else
1107 // unknown sub-view
1108 return false;
1109}
ClientData * FindIf(const Function &function)
Return pointer to first attachment in this that is not null and satisfies a predicate,...
Definition: ClientData.h:420
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 239 of file WaveChannelView.h.

◆ mKeyEventDelegate

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

Definition at line 237 of file WaveChannelView.h.

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

◆ mLastHeight

wxCoord WaveChannelView::mLastHeight {}
mutableprivate

Definition at line 228 of file WaveChannelView.h.

◆ mpAffordanceCellControl

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

Definition at line 235 of file WaveChannelView.h.

Referenced by DoGetAffordance(), and Reparent().


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