Audacity 3.2.0
Public Member Functions | Public Attributes | List of all members
anonymous_namespace{TrackPanel.cpp}::ChannelStack Struct Referencefinal
Inheritance diagram for anonymous_namespace{TrackPanel.cpp}::ChannelStack:
[legend]
Collaboration diagram for anonymous_namespace{TrackPanel.cpp}::ChannelStack:
[legend]

Public Member Functions

 ChannelStack (const std::shared_ptr< Track > &pTrack, wxCoord leftOffset)
 
Subdivision Children (const wxRect &rect_) override
 
void Draw (TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
 
- Public Member Functions inherited from TrackPanelGroup
 TrackPanelGroup ()
 
virtual ~TrackPanelGroup ()
 
virtual Subdivision Children (const wxRect &rect)=0
 
- Public Member Functions inherited from TrackPanelNode
 TrackPanelNode ()
 
virtual ~TrackPanelNode ()=0
 
- Public Member Functions inherited from TrackPanelDrawable
virtual ~TrackPanelDrawable ()=0
 
virtual void Draw (TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass)
 
virtual wxRect DrawingArea (TrackPanelDrawingContext &context, const wxRect &rect, const wxRect &panelRect, unsigned iPass)
 

Public Attributes

const std::shared_ptr< TrackmpTrack
 
wxCoord mLeftOffset
 

Additional Inherited Members

- Public Types inherited from TrackPanelGroup
enum class  Axis { X , Y }
 
using Child = std::pair< wxCoord, std::shared_ptr< TrackPanelNode > >
 
using Refinement = std::vector< Child >
 
using Subdivision = std::pair< Axis, Refinement >
 
- Static Public Member Functions inherited from TrackPanelDrawable
static wxRect MaximizeWidth (const wxRect &rect, const wxRect &panelRect)
 
static wxRect MaximizeHeight (const wxRect &rect, const wxRect &panelRect)
 

Detailed Description

Definition at line 1362 of file TrackPanel.cpp.

Constructor & Destructor Documentation

◆ ChannelStack()

anonymous_namespace{TrackPanel.cpp}::ChannelStack::ChannelStack ( const std::shared_ptr< Track > &  pTrack,
wxCoord  leftOffset 
)
inline
Precondition
pTrack->IsLeader()

Definition at line 1366 of file TrackPanel.cpp.

1367 : mpTrack{ pTrack }, mLeftOffset{ leftOffset } {}

Member Function Documentation

◆ Children()

Subdivision anonymous_namespace{TrackPanel.cpp}::ChannelStack::Children ( const wxRect &  rect_)
inlineoverridevirtual

Implements TrackPanelGroup.

Definition at line 1368 of file TrackPanel.cpp.

1369 {
1370 auto rect = rect_;
1371 Refinement refinement;
1372
1373 const auto channels = mpTrack->Channels();
1374 const auto pLast = *channels.rbegin();
1375 wxCoord yy = rect.GetTop();
1376 auto heights = FindAdjustedChannelHeights(*mpTrack);
1377 auto pHeight = heights.begin();
1378 for (auto pChannel : channels) {
1379 auto &view = ChannelView::Get(*pChannel);
1380 if (auto affordance = view.GetAffordanceControls()) {
1381 auto panelRect = std::make_shared<EmptyPanelRect>(pChannel,
1382 mpTrack->GetSelected()
1383 ? clrTrackInfoSelected : clrTrackInfo);
1384 Refinement hgroup {
1385 std::make_pair(rect.GetLeft() + 1, panelRect),
1386 std::make_pair(mLeftOffset, affordance)
1387 };
1388 refinement
1389 .emplace_back(yy, std::make_shared<HorizontalGroup>(hgroup));
1391 }
1392
1393 auto height = *pHeight++;
1394 rect.SetTop(yy);
1395 rect.SetHeight(height - kChannelSeparatorThickness);
1396 refinement.emplace_back(yy,
1397 std::make_shared<VRulersAndChannels>(pChannel,
1398 ChannelView::Get(*pChannel).GetSubViews(rect),
1399 mLeftOffset));
1400 if (pChannel != pLast) {
1401 yy += height;
1402 refinement.emplace_back(
1405 .shared_from_this());
1406 }
1407 }
1408
1409 return { Axis::Y, std::move(refinement) };
1410 }
@ kChannelSeparatorThickness
@ kAffordancesAreaHeight
static ChannelView & Get(Channel &channel)
virtual Refinement GetSubViews(const wxRect &rect)
std::vector< Child > Refinement
static TrackPanelResizerCell & Get(Channel &channel)
std::vector< int > FindAdjustedChannelHeights(Track &t)
Definition: TrackPanel.cpp:896

References anonymous_namespace{TrackPanel.cpp}::FindAdjustedChannelHeights(), TrackPanelResizerCell::Get(), ChannelView::Get(), ChannelView::GetSubViews(), kAffordancesAreaHeight, and kChannelSeparatorThickness.

Here is the call graph for this function:

◆ Draw()

void anonymous_namespace{TrackPanel.cpp}::ChannelStack::Draw ( TrackPanelDrawingContext context,
const wxRect &  rect,
unsigned  iPass 
)
inlineoverridevirtual

Reimplemented from TrackPanelDrawable.

Definition at line 1412 of file TrackPanel.cpp.

1414 {
1415 TrackPanelGroup::Draw(context, rect, iPass);
1416 if (iPass == TrackArtist::PassFocus && mpTrack->IsSelected()) {
1417 const auto channels = mpTrack->Channels();
1418 const auto pLast = *channels.rbegin();
1419 wxCoord yy = rect.GetTop();
1420 assert(mpTrack->IsLeader()); // by construction
1421 auto heights = FindAdjustedChannelHeights(*mpTrack);
1422 auto pHeight = heights.begin();
1423 for (auto pChannel : channels) {
1424 auto& view = ChannelView::Get(*pChannel);
1425 auto height = *pHeight++;
1426 if (auto affordance = view.GetAffordanceControls())
1427 height += kAffordancesAreaHeight;
1428 auto trackRect = wxRect(
1430 yy,
1431 rect.GetRight() - mLeftOffset,
1433 TrackArt::DrawCursor(context, trackRect, mpTrack.get());
1434 yy += height;
1435 }
1436 }
1437 }
virtual void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass)
AUDACITY_DLL_API void DrawCursor(TrackPanelDrawingContext &context, const wxRect &rect, const Track *track)
Definition: TrackArt.cpp:749

References TrackPanelDrawable::Draw(), TrackArt::DrawCursor(), anonymous_namespace{TrackPanel.cpp}::FindAdjustedChannelHeights(), ChannelView::Get(), kAffordancesAreaHeight, kChannelSeparatorThickness, and TrackArtist::PassFocus.

Here is the call graph for this function:

Member Data Documentation

◆ mLeftOffset

wxCoord anonymous_namespace{TrackPanel.cpp}::ChannelStack::mLeftOffset

Definition at line 1440 of file TrackPanel.cpp.

◆ mpTrack

const std::shared_ptr<Track> anonymous_namespace{TrackPanel.cpp}::ChannelStack::mpTrack

Definition at line 1439 of file TrackPanel.cpp.


The documentation for this struct was generated from the following file: