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

Method TrackPanel

src/TrackPanel.cpp:257–350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

255#pragma warning( disable: 4355 )
256#endif
257TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id,
258 const wxPoint & pos,
259 const wxSize & size,
260 const std::shared_ptr<TrackList> &tracks,
261 ViewInfo * viewInfo,
262 AudacityProject * project,
263 AdornedRulerPanel * ruler)
264 : CellularPanel(parent, id, pos, size, viewInfo,
265 wxWANTS_CHARS | wxNO_BORDER),
266 mTracks(tracks),
267 mRuler(ruler),
268 mTrackArtist(nullptr),
269 mRefreshBacking(false),
270 mIsPanning(false),
271 mLastPanX(0)
272#ifndef __WXGTK__ //Get rid if this pragma for gtk
273#pragma warning( default: 4355 )
274#endif
275{
276 SetLayoutDirection(wxLayout_LeftToRight);
277 SetLabel(XO("Track Panel"));
278 SetName(XO("Track Panel"));
279 SetBackgroundStyle(wxBG_STYLE_PAINT);
280
281#if wxUSE_ACCESSIBILITY
282 // Inject finder of track rectangles into the accessibility helper
283 {
284 const auto finder = [
285 weakThis = wxWeakRef<TrackPanel>{ this }
286 ] (const Track &track) -> wxRect {
287 if (weakThis)
288 return weakThis->FindTrackRect(&track);
289 return {};
290 };
291 auto &focus = TrackFocus::Get(*GetProject());
292 auto &viewport = Viewport::Get(*GetProject());
293 TrackPanelAx *pAx{};
294 SetAccessible(pAx =
295 safenew TrackPanelAx{
296 viewport.weak_from_this(), focus.weak_from_this(), finder });
297 focus.SetCallbacks(std::make_unique<TrackPanelAx::Adapter>(pAx));
298 }
299#endif
300
301 mTrackArtist = std::make_unique<TrackArtist>( this );
302
303 mTimeCount = 0;
304 mTimer.parent = this;
305 // Timer is started after the window is visible
306 ProjectWindow::Get( *GetProject() ).Bind(wxEVT_IDLE,
307 &TrackPanel::OnIdle, this);
308
309 // Register for tracklist updates
310 mTrackListSubscription = PendingTracks::Get(*GetProject())
311 .Subscribe([this](const TrackListEvent &event){
312 switch (event.mType) {
313 case TrackListEvent::RESIZING:
314 case TrackListEvent::ADDITION:

Callers

nothing calls this directly

Calls 6

GetFunction · 0.85
FindTrackRectMethod · 0.80
BindMethod · 0.80
GetRulerMethod · 0.80
SetCallbacksMethod · 0.45
SubscribeMethod · 0.45

Tested by

no test coverage detected