MCPcopy Create free account
hub / github.com/audacity/audacity / Draw

Method Draw

src/TrackPanel.cpp:1280–1330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1278 }
1279
1280 void Draw(TrackPanelDrawingContext& context,
1281 const wxRect& rect, unsigned iPass) override
1282 {
1283 TrackPanelGroup::Draw(context, rect, iPass);
1284 if (iPass == TrackArtist::PassTracks)
1285 {
1286 auto vRulerRect = rect;
1287 vRulerRect.width = mLeftOffset - rect.x;
1288
1289 auto dc = &context.dc;
1290
1291 // Paint the background;
1292 AColor::MediumTrackInfo(dc, mpTrack->GetSelected() );
1293 dc->DrawRectangle( vRulerRect );
1294
1295 const auto channels = mpTrack->Channels();
1296 auto& view = ChannelView::Get(**channels.begin());
1297 if(auto affordance = view.GetAffordanceControls())
1298 {
1299 const auto yy = vRulerRect.y + kAffordancesAreaHeight - 1;
1300 AColor::Dark( dc, false );
1301 AColor::Line( *dc, vRulerRect.GetLeft(), yy, vRulerRect.GetRight(), yy );
1302 }
1303
1304 // Stroke left and right borders
1305 dc->SetPen(*wxBLACK_PEN);
1306
1307 AColor::Line( *dc, vRulerRect.GetLeftTop(), vRulerRect.GetLeftBottom() );
1308 AColor::Line( *dc, vRulerRect.GetRightTop(), vRulerRect.GetRightBottom() );
1309 }
1310 if (iPass == TrackArtist::PassFocus && mpTrack->IsSelected()) {
1311 const auto channels = mpTrack->Channels();
1312 const auto pLast = *channels.rbegin();
1313 wxCoord yy = rect.GetTop();
1314 auto heights = FindAdjustedChannelHeights(*mpTrack);
1315 auto pHeight = heights.begin();
1316 for (auto pChannel : channels) {
1317 auto& view = ChannelView::Get(*pChannel);
1318 auto height = *pHeight++;
1319 if (auto affordance = view.GetAffordanceControls())
1320 height += kAffordancesAreaHeight;
1321 auto trackRect = wxRect(
1322 mLeftOffset,
1323 yy,
1324 rect.GetRight() - mLeftOffset,
1325 height - kChannelSeparatorThickness);
1326 TrackArt::DrawCursor(context, trackRect, mpTrack.get());
1327 yy += height;
1328 }
1329 }
1330 }
1331
1332 const std::shared_ptr<Track> mpTrack;
1333 wxCoord mLeftOffset;

Callers

nothing calls this directly

Calls 11

GetFunction · 0.85
ChannelsMethod · 0.80
GetRightMethod · 0.80
wxRectClass · 0.70
GetSelectedMethod · 0.45
beginMethod · 0.45
GetAffordanceControlsMethod · 0.45
IsSelectedMethod · 0.45
rbeginMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected