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

#include <ChannelView.h>

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

Public Types

enum  : unsigned { DefaultHeight = 150 }
 
using Refinement = std::vector< std::pair< wxCoord, std::shared_ptr< ChannelView > > >
 

Public Member Functions

 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...
 

Static Public Member Functions

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)
 

Public Attributes

std::pair< int, int > vrulerSize
 

Protected Member Functions

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 Attributes

std::shared_ptr< ChannelVRulerControlsmpVRulerControls
 

Private Member Functions

 ChannelView (const ChannelView &)=delete
 
ChannelViewoperator= (const ChannelView &)=delete
 
void AdjustPositions ()
 
void DoSetY (int y)
 
void DoSetHeight (int h)
 

Static Private Member Functions

static ChannelViewGetFromChannelGroup (ChannelGroup &group, size_t iChannel)
 
static ChannelViewFindFromChannelGroup (ChannelGroup *pGroup, size_t iChannel=0)
 

Private Attributes

bool mMinimized { false }
 
int mY { 0 }
 
int mHeight { DefaultHeight }
 

Detailed Description

Definition at line 23 of file ChannelView.h.

Member Typedef Documentation

◆ Refinement

using ChannelView::Refinement = std::vector< std::pair<wxCoord, std::shared_ptr<ChannelView> > >

Definition at line 119 of file ChannelView.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum : unsigned
Enumerator
DefaultHeight 

Definition at line 30 of file ChannelView.h.

30: unsigned { DefaultHeight = 150 };

Constructor & Destructor Documentation

◆ ChannelView() [1/2]

ChannelView::ChannelView ( const ChannelView )
privatedelete

◆ ChannelView() [2/2]

ChannelView::ChannelView ( const std::shared_ptr< Channel > &  pChannel)
explicit

Definition at line 21 of file ChannelView.cpp.

22 : CommonChannelCell{ pChannel }
23{
25}
static Return Call(This &obj, Arguments ...arguments)
Invoke the method – but only after static initialization time.
void DoSetHeight(int h)

References AttachedVirtualFunction< Tag, Return, This, Arguments >::Call(), and DoSetHeight().

Here is the call graph for this function:

◆ ~ChannelView()

ChannelView::~ChannelView ( )
pure virtual

Definition at line 27 of file ChannelView.cpp.

28{
29}

Member Function Documentation

◆ AdjustPositions()

void ChannelView::AdjustPositions ( )
private

Definition at line 113 of file ChannelView.cpp.

114{
115 // Update positions and heights starting from the first track in the group,
116 // causing TrackList events
117 if (const auto pTrack = FindTrack())
118 pTrack->AdjustPositions();
119}
std::shared_ptr< Track > FindTrack()

References CommonTrackPanelCell::FindTrack().

Referenced by SetExpandedHeight(), and SetMinimized().

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

◆ CopyTo()

void ChannelView::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 67 of file ChannelView.cpp.

68{
69 auto &other = GetFromChannelGroup(track, index);
70
71 other.mMinimized = mMinimized;
72 other.vrulerSize = vrulerSize;
73
74 // Let mY remain 0 -- TrackPositioner corrects it later
75 other.mY = 0;
76 other.mHeight = mHeight;
77}
bool mMinimized
Definition: ChannelView.h:158
static ChannelView & GetFromChannelGroup(ChannelGroup &group, size_t iChannel)
Definition: ChannelView.cpp:92
std::pair< int, int > vrulerSize
Definition: ChannelView.h:129

References GetFromChannelGroup(), mHeight, mMinimized, and vrulerSize.

Referenced by LabelTrackView::CopyTo(), and WaveChannelView::CopyTo().

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

◆ DoGetVRulerControls()

virtual std::shared_ptr< ChannelVRulerControls > ChannelView::DoGetVRulerControls ( )
protectedpure virtual

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

Referenced by GetVRulerControls().

Here is the caller graph for this function:

◆ DoSetHeight()

void ChannelView::DoSetHeight ( int  h)
private

Definition at line 213 of file ChannelView.cpp.

214{
215 mHeight = h;
216}

References mHeight.

Referenced by ChannelView(), and SetExpandedHeight().

Here is the caller graph for this function:

◆ DoSetMinimized()

void ChannelView::DoSetMinimized ( bool  isMinimized)
virtual

Reimplemented in SpectrumView, WaveChannelView, and WaveformView.

Definition at line 175 of file ChannelView.cpp.

176{
177 mMinimized = isMinimized;
178}

References mMinimized.

Referenced by WaveChannelView::BuildSubViews(), SpectrumView::DoSetMinimized(), WaveChannelView::DoSetMinimized(), WaveformView::DoSetMinimized(), and SetMinimized().

Here is the caller graph for this function:

◆ DoSetY()

void ChannelView::DoSetY ( int  y)
private

Definition at line 194 of file ChannelView.cpp.

195{
196 mY = y;
197}

References mY.

◆ Find() [1/2]

ChannelView * ChannelView::Find ( Channel pChannel)
static
Precondition
!pChannel || dynamic_cast<Track*>(&pChannel->GetChannelGroup()) != nullptr

Definition at line 234 of file ChannelView.cpp.

235{
236 if (!pChannel)
237 return nullptr;
239 &pChannel->GetChannelGroup(), pChannel->GetChannelIndex());
240}
ChannelGroup & GetChannelGroup()
Channel object's lifetime is assumed to be nested in its Track's.
Definition: Channel.cpp:43
size_t GetChannelIndex() const
Definition: Channel.cpp:25
static ChannelView * FindFromChannelGroup(ChannelGroup *pGroup, size_t iChannel=0)
Definition: ChannelView.cpp:99

References FindFromChannelGroup(), Channel::GetChannelGroup(), and Channel::GetChannelIndex().

Referenced by Find(), and WaveChannelView::Find().

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

◆ Find() [2/2]

const ChannelView * ChannelView::Find ( const Channel pChannel)
static

Definition at line 242 of file ChannelView.cpp.

243{
244 return Find(const_cast<Channel*>(pChannel));
245}
static ChannelView * Find(Channel *pChannel)

References Find().

Here is the call graph for this function:

◆ FindFromChannelGroup()

ChannelView * ChannelView::FindFromChannelGroup ( ChannelGroup pGroup,
size_t  iChannel = 0 
)
staticprivate
Precondition
!pGroup || iChannel < pGroup->NChannels()

Definition at line 99 of file ChannelView.cpp.

101{
103 keyC, static_cast<Track*>(pGroup), iChannel);
104}
static const AttachedTrackObjects::RegisteredFactory keyC
Definition: ChannelView.cpp:81
static Attachment * Find(const AttachedTrackObjects::RegisteredFactory &key, Track *pTrack, size_t iChannel)
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:110

References ChannelAttachments< Attachment >::Find(), anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel, and keyC.

Referenced by Find().

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

◆ Get() [1/2]

ChannelView & ChannelView::Get ( Channel channel)
static
Precondition
dynamic_cast<Track*>(&channel.GetChannelGroup()) != nullptr

Definition at line 223 of file ChannelView.cpp.

224{
225 return
227}

References Channel::GetChannelGroup(), Channel::GetChannelIndex(), and GetFromChannelGroup().

Referenced by anonymous_namespace{WaveChannelView.cpp}::AnyAffordance(), SetTrackVisualsCommand::ApplyInner(), TrackPanelResizeHandle::Cancel(), anonymous_namespace{TrackPanel.cpp}::Subgroup::Children(), anonymous_namespace{TrackPanel.cpp}::ChannelStack::Children(), TrackPanelResizeHandle::Click(), LabelDefaultClickHandle::Click(), CommonTrackInfo::CloseTitleDrawFunction(), MinimizeButtonHandle::CommitChanges(), LabelTrackView::CopyTo(), WaveChannelView::CopyTo(), ProjectAudioManager::DoRecord(), SpectrumVRulerControls::DoUpdateVRuler(), WaveformVRulerControls::DoUpdateVRuler(), TrackPanelResizeHandle::Drag(), anonymous_namespace{TrackPanel.cpp}::ChannelStack::Draw(), TimeTrackVRulerControls::Draw(), anonymous_namespace{TrackPanel.cpp}::FindAdjustedChannelHeights(), anonymous_namespace{SpectralDataManager.cpp}::FindSpectralData(), SpectrumView::ForAll(), Get(), LabelTrackView::Get(), WaveChannelView::Get(), GetChannelGroupHeight(), TrackPanel::GetFocusedCell(), NoteTrackAffordanceControls::HitTest(), ProjectWindow::IsTrackMinimized(), WaveTrackMenuTable::OnMergeStereo(), SelectHandle::TimerHandler::OnTimer(), TrackPanel::OnTrackMenu(), anonymous_namespace{ChannelView.cpp}::TrackPositioner::OnUpdate(), SpectralDataManager::ProcessTracks(), TrackPanel::RefreshTrack(), ProjectWindow::SetChannelHeights(), ProjectWindow::SetMinimized(), WaveTrackMenuTable::SplitStereo(), MinimizeButtonHandle::Tip(), TrackPanelResizeHandle::TrackPanelResizeHandle(), NoteTrackVRulerControls::UpdateRuler(), TimeTrackVRulerControls::UpdateRuler(), TrackPanel::UpdateTrackVRuler(), and TrackPanel::UpdateVRulerSize().

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

◆ Get() [2/2]

const ChannelView & ChannelView::Get ( const Channel channel)
static

Precondition
dynamic_cast<Track*>(&channel.GetChannelGroup()) != nullptr

Definition at line 229 of file ChannelView.cpp.

230{
231 return Get(const_cast<Channel&>(channel));
232}
static ChannelView & Get(Channel &channel)

References Get().

Here is the call graph for this function:

◆ GetAffordanceControls()

std::shared_ptr< CommonTrackCell > ChannelView::GetAffordanceControls ( )
virtual

Reimplemented in NoteTrackView, and WaveChannelView.

Definition at line 218 of file ChannelView.cpp.

219{
220 return {};
221}

◆ GetChannelGroupHeight()

int ChannelView::GetChannelGroupHeight ( const Track pTrack)
static

Definition at line 39 of file ChannelView.cpp.

40{
41 const auto GetChannelHeight = [](const auto &pChannel) -> int {
42 return pChannel ? Get(*pChannel).GetHeight() : 0;
43 };
44 return pTrack ? pTrack->Channels().sum(GetChannelHeight) : 0;
45}
IteratorRange< ChannelIterator< ChannelType > > Channels()
Get range of channels with mutative access.
Definition: Channel.h:384
int GetHeight() const

References ChannelGroup::Channels(), Get(), and GetHeight().

Referenced by TrackSelectHandle::CalculateRearrangingThresholds(), ProjectWindow::GetTrackHeight(), and TrackPanel::RefreshTrack().

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

◆ GetCumulativeHeight() [1/2]

int ChannelView::GetCumulativeHeight ( const Channel pChannel)
static

Definition at line 47 of file ChannelView.cpp.

48{
49 if (!pChannel)
50 return 0;
51 auto &view = ChannelView::Get(*pChannel);
52 return view.GetCumulativeHeightBefore() + view.GetHeight();
53}

Referenced by GetCumulativeHeight(), GetTotalHeight(), and anonymous_namespace{ChannelView.cpp}::TrackPositioner::OnUpdate().

Here is the caller graph for this function:

◆ GetCumulativeHeight() [2/2]

int ChannelView::GetCumulativeHeight ( const Track pTrack)
static

Definition at line 55 of file ChannelView.cpp.

56{
57 if (!pTrack)
58 return 0;
59 return GetCumulativeHeight((*pTrack->Channels().rbegin()).get());
60}
static int GetCumulativeHeight(const Channel *pChannel)
Definition: ChannelView.cpp:47

References ChannelGroup::Channels(), and GetCumulativeHeight().

Here is the call graph for this function:

◆ GetCumulativeHeightBefore()

int ChannelView::GetCumulativeHeightBefore ( ) const
inline
Returns
cached sum of GetHeight() of all preceding tracks

Definition at line 73 of file ChannelView.h.

73{ return mY; }

◆ GetExpandedHeight()

int ChannelView::GetExpandedHeight ( ) const
inline
Returns
height of the track when expanded

See other comments for GetHeight

Definition at line 77 of file ChannelView.h.

77{ return mHeight; }

Referenced by WriteXMLAttributes().

Here is the caller graph for this function:

◆ GetFromChannelGroup()

ChannelView & ChannelView::GetFromChannelGroup ( ChannelGroup group,
size_t  iChannel 
)
staticprivate
Precondition
iChannel < group.NChannels()

Definition at line 92 of file ChannelView.cpp.

94{
95 auto &track = static_cast<Track&>(group);
97}
static Attachment & Get(const AttachedTrackObjects::RegisteredFactory &key, Track &track, size_t iChannel)

References ChannelAttachments< Attachment >::Get(), anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel, and keyC.

Referenced by CopyTo(), and Get().

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

◆ GetHeight()

int ChannelView::GetHeight ( ) const
Returns
height of the track as it now appears, expanded or collapsed

Total "height" of channels of a track includes padding areas above and below it, and is pixel-accurate for the channel group. The "heights" of channels within a group determine the proportions of heights of the track data shown – but the actual total pixel heights may differ when other fixed-height adornments and paddings are added, according to other rules for allocation of height.

Definition at line 199 of file ChannelView.cpp.

200{
201 if ( GetMinimized() )
202 return GetMinimizedHeight();
203
204 return mHeight;
205}
virtual int GetMinimizedHeight() const =0
bool GetMinimized() const
Definition: ChannelView.h:69

References GetMinimized(), GetMinimizedHeight(), and mHeight.

Referenced by TrackPanelResizeHandle::Click(), GetChannelGroupHeight(), and WaveTrackMenuTable::OnMergeStereo().

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

◆ GetMinimized()

bool ChannelView::GetMinimized ( ) const
inline

Definition at line 69 of file ChannelView.h.

69{ return mMinimized; }

Referenced by WaveChannelView::BuildSubViews(), CommonTrackInfo::CloseTitleDrawFunction(), MinimizeButtonHandle::CommitChanges(), GetHeight(), ProjectWindow::IsTrackMinimized(), WaveTrackMenuTable::OnMergeStereo(), MinimizeButtonHandle::Tip(), and WriteXMLAttributes().

Here is the caller graph for this function:

◆ GetMinimizedHeight()

virtual int ChannelView::GetMinimizedHeight ( ) const
pure virtual
Returns
height of the track when collapsed

See other comments for GetHeight

Implemented in CommonChannelView.

Referenced by GetHeight().

Here is the caller graph for this function:

◆ GetSubViews()

auto ChannelView::GetSubViews ( const wxRect &  rect)
virtual

Reimplemented in WaveChannelView.

Definition at line 165 of file ChannelView.cpp.

166{
167 return { { rect.GetTop(), shared_from_this() } };
168}

Referenced by anonymous_namespace{TrackPanel.cpp}::ChannelStack::Children().

Here is the caller graph for this function:

◆ GetTotalHeight()

int ChannelView::GetTotalHeight ( const TrackList list)
static

Definition at line 62 of file ChannelView.cpp.

63{
64 return GetCumulativeHeight(*list.rbegin());
65}
reverse_iterator rbegin()
Definition: Track.h:915

References GetCumulativeHeight(), and TrackList::rbegin().

Referenced by ProjectWindow::GetTotalHeight().

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

◆ GetVRulerControls() [1/2]

std::shared_ptr< ChannelVRulerControls > ChannelView::GetVRulerControls ( )

Definition at line 180 of file ChannelView.cpp.

181{
182 if (!mpVRulerControls)
183 // create on demand
185 return mpVRulerControls;
186}
virtual std::shared_ptr< ChannelVRulerControls > DoGetVRulerControls()=0
std::shared_ptr< ChannelVRulerControls > mpVRulerControls
Definition: ChannelView.h:144

References DoGetVRulerControls(), and mpVRulerControls.

Referenced by ChannelVRulerControls::Get(), and GetVRulerControls().

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

◆ GetVRulerControls() [2/2]

std::shared_ptr< const ChannelVRulerControls > ChannelView::GetVRulerControls ( ) const

Definition at line 189 of file ChannelView.cpp.

190{
191 return const_cast<ChannelView*>(this)->GetVRulerControls();
192}
std::shared_ptr< ChannelVRulerControls > GetVRulerControls()

References GetVRulerControls().

Here is the call graph for this function:

◆ HandleXMLAttribute()

bool ChannelView::HandleXMLAttribute ( const std::string_view &  attr,
const XMLAttributeValueView valueView,
size_t  iChannel 
)
overridevirtual

Deserialize an attribute, returning true if recognized.

default recognizes no attributes, and returns false

Reimplemented from ChannelAttachment.

Definition at line 143 of file ChannelView.cpp.

146{
147 long nValue;
148
149 if (attr == HeightAttributeName(index) && valueView.TryGet(nValue)) {
150 // Bug 2803: Extreme values for track height (caused by integer overflow)
151 // will stall Audacity as it tries to create an enormous vertical ruler.
152 // So clamp to reasonable values.
153 nValue = std::max( 40l, std::min( nValue, 1000l ));
154 SetExpandedHeight(nValue);
155 return true;
156 }
157 else if (attr == MinimizedAttributeName(index) && valueView.TryGet(nValue)) {
158 SetMinimized(nValue != 0);
159 return true;
160 }
161 else
162 return false;
163}
int min(int a, int b)
void SetMinimized(bool minimized)
void SetExpandedHeight(int height)
bool TryGet(bool &value) const noexcept
Try to get a boolean value from the view.
std::string MinimizedAttributeName(size_t index)
std::string HeightAttributeName(size_t index)

References anonymous_namespace{ChannelView.cpp}::HeightAttributeName(), min(), anonymous_namespace{ChannelView.cpp}::MinimizedAttributeName(), SetExpandedHeight(), SetMinimized(), and XMLAttributeValueView::TryGet().

Here is the call graph for this function:

◆ IsSpectral()

bool ChannelView::IsSpectral ( ) const
virtual

Reimplemented in SpectrumView.

Definition at line 170 of file ChannelView.cpp.

171{
172 return false;
173}

Referenced by anonymous_namespace{SelectHandle.cpp}::isSpectralSelectionView(), and anonymous_namespace{BrushHandle.cpp}::isSpectralSelectionView().

Here is the caller graph for this function:

◆ operator=()

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

◆ Reparent()

void ChannelView::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 31 of file ChannelView.cpp.

33{
36 mpVRulerControls->Reparent(parent, iChannel);
37}
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.

References anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel, mpVRulerControls, and CommonChannelCell::Reparent().

Referenced by LabelTrackView::Reparent(), and WaveChannelView::Reparent().

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

◆ SetCumulativeHeightBefore()

void ChannelView::SetCumulativeHeightBefore ( int  y)
inline

Set cached value dependent on position within the track list.

Definition at line 95 of file ChannelView.h.

95{ DoSetY( y ); }
void DoSetY(int y)

◆ SetExpandedHeight()

void ChannelView::SetExpandedHeight ( int  height)

Sets height for expanded state. Does not expand a track if it is now collapsed. See other comments for GetHeight

Definition at line 207 of file ChannelView.cpp.

208{
209 DoSetHeight(h);
211}
void AdjustPositions()

References AdjustPositions(), and DoSetHeight().

Referenced by SetTrackVisualsCommand::ApplyInner(), TrackPanelResizeHandle::Click(), HandleXMLAttribute(), ProjectWindow::SetChannelHeights(), and WaveTrackMenuTable::SplitStereo().

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

◆ SetMinimized()

void ChannelView::SetMinimized ( bool  minimized)

Definition at line 106 of file ChannelView.cpp.

107{
108 // Do special changes appropriate to subclass
109 DoSetMinimized(isMinimized);
111}
virtual void DoSetMinimized(bool isMinimized)

References AdjustPositions(), and DoSetMinimized().

Referenced by MinimizeButtonHandle::CommitChanges(), ProjectAudioManager::DoRecord(), HandleXMLAttribute(), and ProjectWindow::SetMinimized().

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

◆ WriteXMLAttributes()

void ChannelView::WriteXMLAttributes ( XMLWriter writer,
size_t  iChannel 
) const
overridevirtual

Serialize persistent attributes.

default does nothing

Reimplemented from ChannelAttachment.

Definition at line 137 of file ChannelView.cpp.

138{
139 xmlFile.WriteAttr(HeightAttributeName(index), GetExpandedHeight());
140 xmlFile.WriteAttr(MinimizedAttributeName(index), GetMinimized());
141}
int GetExpandedHeight() const
Definition: ChannelView.h:77

References GetExpandedHeight(), GetMinimized(), anonymous_namespace{ChannelView.cpp}::HeightAttributeName(), anonymous_namespace{ChannelView.cpp}::MinimizedAttributeName(), and XMLWriter::WriteAttr().

Here is the call graph for this function:

Member Data Documentation

◆ mHeight

int ChannelView::mHeight { DefaultHeight }
private

Definition at line 160 of file ChannelView.h.

Referenced by CopyTo(), DoSetHeight(), and GetHeight().

◆ mMinimized

bool ChannelView::mMinimized { false }
private

Definition at line 158 of file ChannelView.h.

Referenced by CopyTo(), and DoSetMinimized().

◆ mpVRulerControls

std::shared_ptr<ChannelVRulerControls> ChannelView::mpVRulerControls
protected

Definition at line 144 of file ChannelView.h.

Referenced by GetVRulerControls(), and Reparent().

◆ mY

int ChannelView::mY { 0 }
private

Definition at line 159 of file ChannelView.h.

Referenced by DoSetY().

◆ vrulerSize

std::pair<int, int> ChannelView::vrulerSize
mutable

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