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

Method Draw

src/TrackPanelResizerCell.cpp:44–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44void TrackPanelResizerCell::Draw(
45 TrackPanelDrawingContext &context,
46 const wxRect &rect, unsigned iPass )
47{
48 if (iPass == TrackArtist::PassMargins) {
49 if (const auto pChannel = FindChannel()) {
50 const auto pTrack =
51 dynamic_cast<Track *>(&pChannel->GetChannelGroup());
52 if (!pTrack)
53 return;
54 auto dc = &context.dc;
55 const auto &channels = pTrack->Channels();
56 const bool last = (pChannel == *channels.rbegin());
57 if (last) {
58 // Fill in separator area below a track
59 AColor::TrackPanelBackground( dc, false );
60 dc->DrawRectangle( rect );
61 }
62 else {
63 // Area between channels of a group
64 // Paint the channel separator over (what would be) the lower border
65 // of this channel, down to and including the upper border of the
66 // next channel
67
68 ADCChanger cleanup{ dc };
69
70 // Paint the left part of the background
71 const auto artist = TrackArtist::Get(context);
72 auto labelw = artist->pZoomInfo->GetLeftOffset() - 1;
73 AColor::Dark(dc, false);
74 dc->DrawRectangle(
75 rect.GetX(), rect.GetY(), labelw, rect.GetHeight() );
76
77 // Stroke the left border
78 dc->SetPen(*wxBLACK_PEN);
79 {
80 const auto left = rect.GetLeft();
81 AColor::Line( *dc, left, rect.GetTop(), left, rect.GetBottom() );
82 }
83
84 AColor::TrackPanelBackground(dc, false);
85
86 wxRect rec{ rect };
87 rec.width -= labelw - rec.x;
88 rec.x = labelw;
89
90 dc->DrawRectangle( wxRect( rec ).Inflate( 0, -kBorderThickness ) );
91
92 // These lines stroke over what is otherwise "border" of each
93 // channel
94 dc->SetBrush(*wxTRANSPARENT_BRUSH);
95 dc->SetPen(*wxBLACK_PEN);
96 const auto left = rec.GetLeft();
97 const auto right = rec.GetRight();
98 const auto top = rec.GetTop();
99 const auto bottom = rec.GetBottom();
100 AColor::Line( *dc, left, top, right, top );
101 AColor::Line( *dc, left, bottom, right, bottom );

Callers

nothing calls this directly

Calls 9

FindChannelFunction · 0.85
GetFunction · 0.85
ChannelsMethod · 0.80
GetLeftOffsetMethod · 0.80
GetHeightMethod · 0.80
GetRightMethod · 0.80
wxRectClass · 0.70
GetChannelGroupMethod · 0.45
rbeginMethod · 0.45

Tested by

no test coverage detected