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

Method Draw

src/tracks/timetrack/ui/TimeTrackView.cpp:157–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157void TimeTrackView::Draw(
158 TrackPanelDrawingContext &context,
159 const wxRect &rect, unsigned iPass )
160{
161 if ( iPass == TrackArtist::PassTracks ) {
162 const auto artist = TrackArtist::Get(context);
163 const auto &pendingTracks = *artist->pPendingTracks;
164 const auto pChannel = FindChannel();
165 if (!pChannel)
166 return;
167 const auto pList =
168 static_cast<const TimeTrack*>(pChannel.get())->GetOwner();
169 if (!pList)
170 // Track isn't owned by a list. Can't proceed!
171 return;
172 const auto pProject = pList->GetOwner();
173 if (!pProject)
174 // List isn't owned by a project. Can't proceed!
175 // But this shouldn't happen when drawing it
176 return;
177
178 auto &zoomInfo = ViewInfo::Get(*pProject);
179 LinearUpdater updater;
180 updater.SetData(&zoomInfo);
181
182 // Just using a stack-local Ruler object. Observe the "Invalidate"
183 // call above which has long been done with every redraw.
184 // Avoiding invalidation with every draw, and making the ruler persistent
185 // between drawings, would require that it be invalidated whenever the
186 // user drags points, or the time selection changes -- really too much
187 // work.
188 Ruler ruler{ updater, TimeFormat::Instance() };
189 ruler.SetLabelEdges(false);
190
191 const auto &tt = static_cast<const TimeTrack&>(
192 pendingTracks.SubstitutePendingChangedChannel(*pChannel));
193 DrawTimeTrack(context, tt, ruler, rect);
194 }
195 CommonChannelView::Draw(context, rect, iPass);
196}

Callers 1

DrawHorzRulerAndCurveFunction · 0.45

Calls 7

GetFunction · 0.85
FindChannelFunction · 0.85
DrawTimeTrackFunction · 0.85
SetLabelEdgesMethod · 0.80
InstanceClass · 0.50
getMethod · 0.45
SetDataMethod · 0.45

Tested by

no test coverage detected