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

Method CreateWindows

src/toolbars/ToolManager.cpp:420–479  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

418}
419
420void ToolManager::CreateWindows()
421{
422 auto parent = mParent;
423 auto &window = GetProjectFrame( *parent );
424
425 // Hook the parents mouse events...using the parent helps greatly
426 // under GTK
427 window.Bind( wxEVT_LEFT_UP,
428 &ToolManager::OnMouse,
429 this );
430 window.Bind( wxEVT_MOTION,
431 &ToolManager::OnMouse,
432 this );
433 window.Bind( wxEVT_MOUSE_CAPTURE_LOST,
434 &ToolManager::OnCaptureLost,
435 this );
436
437 wxWindow *topDockParent = TopPanelHook::Call( window );
438 wxASSERT(topDockParent);
439
440 // Create the top and bottom docks
441 mTopDock = safenew ToolDock( this, topDockParent, TopDockID );
442 mBotDock = safenew ToolDock( this, &window, BotDockID );
443
444 // Create all of the toolbars
445 // All have the project as parent window
446 wxASSERT(parent);
447
448 for (const auto &factory : RegisteredToolbarFactory::GetFactories()) {
449 if (factory) {
450 auto bar = factory( *parent );
451 if (bar) {
452 auto &slot = mBars[bar->GetSection()];
453 if (slot) {
454 // Oh no, name collision of registered toolbars
455 assert(false);
456 bar->Destroy();
457 continue;
458 }
459 slot = std::move(bar);
460 }
461 }
462 else
463 wxASSERT( false );
464 }
465
466 //! Assign (non-persistent!) sequential ids to the toolbars
467 ForEach([ii = 0](ToolBar *bar) mutable { bar->SetIndex(ii++); });
468
469 // We own the timer
470 mTimer.SetOwner( this );
471
472 // Process the toolbar config settings
473 ReadConfig();
474
475 wxEvtHandler::AddFilter(this);
476
477 mMenuManagerSubscription = CommandManager::Get(*mParent)

Callers 1

InitProjectWindowFunction · 0.80

Calls 10

CallClass · 0.85
moveFunction · 0.85
ForEachFunction · 0.85
GetFunction · 0.85
BindMethod · 0.80
GetSectionMethod · 0.80
SetOwnerMethod · 0.80
ToolDockClass · 0.70
DestroyMethod · 0.45
SubscribeMethod · 0.45

Tested by

no test coverage detected