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 1220 of file TrackPanel.cpp.

Constructor & Destructor Documentation

◆ ChannelStack()

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

Definition at line 1221 of file TrackPanel.cpp.

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

Member Function Documentation

◆ Children()

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

Implements TrackPanelGroup.

Definition at line 1223 of file TrackPanel.cpp.

1224 {
1225 auto rect = rect_;
1226 Refinement refinement;
1227
1228 const auto channels = mpTrack->Channels();
1229 const auto pLast = *channels.rbegin();
1230 wxCoord yy = rect.GetTop();
1231 auto heights = FindAdjustedChannelHeights(*mpTrack);
1232 auto pHeight = heights.begin();
1233 for (auto pChannel : channels) {
1234 auto &view = ChannelView::Get(*pChannel);
1235 if (auto affordance = view.GetAffordanceControls()) {
1236 Refinement hgroup {
1237 std::make_pair(mLeftOffset, affordance)
1238 };
1239 refinement
1240 .emplace_back(yy, std::make_shared<HorizontalGroup>(hgroup));
1242 }
1243
1244 auto height = *pHeight++;
1245 rect.SetTop(yy);
1246 rect.SetHeight(height - kChannelSeparatorThickness);
1247 refinement.emplace_back(yy,
1248 std::make_shared<VRulersAndChannels>(pChannel,
1249 ChannelView::Get(*pChannel).GetSubViews(rect),
1250 mLeftOffset));
1251 if (pChannel != pLast) {
1252 yy += height;
1253 refinement.emplace_back(
1256 .shared_from_this());
1257 }
1258 }
1259
1260 return { Axis::Y, std::move(refinement) };
1261 }
@ 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 1263 of file TrackPanel.cpp.

1265 {
1266 TrackPanelGroup::Draw(context, rect, iPass);
1267 if (iPass == TrackArtist::PassTracks)
1268 {
1269 auto vRulerRect = rect;
1270 vRulerRect.width = mLeftOffset - rect.x;
1271
1272 auto dc = &context.dc;
1273
1274 // Paint the background;
1275 AColor::MediumTrackInfo(dc, mpTrack->GetSelected() );
1276 dc->DrawRectangle( vRulerRect );
1277
1278 const auto channels = mpTrack->Channels();
1279 auto& view = ChannelView::Get(**channels.begin());
1280 if(auto affordance = view.GetAffordanceControls())
1281 {
1282 const auto yy = vRulerRect.y + kAffordancesAreaHeight - 1;
1283 AColor::Dark( dc, false );
1284 AColor::Line( *dc, vRulerRect.GetLeft(), yy, vRulerRect.GetRight(), yy );
1285 }
1286
1287 // Stroke left and right borders
1288 dc->SetPen(*wxBLACK_PEN);
1289
1290 AColor::Line( *dc, vRulerRect.GetLeftTop(), vRulerRect.GetLeftBottom() );
1291 AColor::Line( *dc, vRulerRect.GetRightTop(), vRulerRect.GetRightBottom() );
1292 }
1293 if (iPass == TrackArtist::PassFocus && mpTrack->IsSelected()) {
1294 const auto channels = mpTrack->Channels();
1295 const auto pLast = *channels.rbegin();
1296 wxCoord yy = rect.GetTop();
1297 auto heights = FindAdjustedChannelHeights(*mpTrack);
1298 auto pHeight = heights.begin();
1299 for (auto pChannel : channels) {
1300 auto& view = ChannelView::Get(*pChannel);
1301 auto height = *pHeight++;
1302 if (auto affordance = view.GetAffordanceControls())
1303 height += kAffordancesAreaHeight;
1304 auto trackRect = wxRect(
1306 yy,
1307 rect.GetRight() - mLeftOffset,
1309 TrackArt::DrawCursor(context, trackRect, mpTrack.get());
1310 yy += height;
1311 }
1312 }
1313 }
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
Definition: AColor.cpp:194
static void MediumTrackInfo(wxDC *dc, bool selected)
Definition: AColor.cpp:415
static void Dark(wxDC *dc, bool selected, bool highlight=false)
Definition: AColor.cpp:421
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:756

References AColor::Dark(), TrackPanelDrawingContext::dc, TrackPanelDrawable::Draw(), TrackArt::DrawCursor(), anonymous_namespace{TrackPanel.cpp}::FindAdjustedChannelHeights(), ChannelView::Get(), kAffordancesAreaHeight, kChannelSeparatorThickness, AColor::Line(), AColor::MediumTrackInfo(), TrackArtist::PassFocus, and TrackArtist::PassTracks.

Here is the call graph for this function:

Member Data Documentation

◆ mLeftOffset

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

Definition at line 1316 of file TrackPanel.cpp.

◆ mpTrack

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

Definition at line 1315 of file TrackPanel.cpp.


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