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

Method Reset

src/toolbars/ToolManager.cpp:577–681  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

575
576
577void ToolManager::Reset()
578{
579 // Disconnect all docked bars
580 for ( const auto &entry : DefaultConfigTable )
581 {
582 const auto &ndx = entry.barID;
583 ToolBar *bar = GetToolBar(ndx);
584 if (!bar)
585 continue;
586
587 ToolBarConfiguration::Position position {
588 (entry.rightOf == Identifier{}) ? nullptr : GetToolBar(entry.rightOf),
589 (entry.below == Identifier{}) ? nullptr : GetToolBar(entry.below)
590 };
591
592 bar->SetSize( 20,20 );
593
594 wxWindow *floater;
595 ToolDock *dock;
596 bool expose = true;
597
598 // Disconnect the bar
599 if( bar->IsDocked() )
600 {
601 bar->GetDock()->Undock( bar );
602 floater = NULL;
603 }
604 else
605 {
606 floater = bar->GetParent();
607 }
608
609 // Decide which dock.
610 dock = (bar->DefaultDockID() == ToolBar::TopDockID)
611 ? mTopDock : mBotDock;
612
613 // PRL: Destroy the tool frame before recreating buttons.
614 // This fixes some subtle sizing problems on macOs.
615 bar->Reparent( dock );
616 //OK (and good) to DELETE floater, as bar is no longer in it.
617 if( floater )
618 floater->Destroy();
619
620 // Recreate bar buttons (and resize it)
621 bar->SetToDefaultSize();
622 bar->ReCreateButtons();
623 bar->EnableDisableButtons();
624
625#if 0
626 if( bar->IsResizable() )
627 {
628 bar->SetSize(bar->GetBestFittingSize());
629 }
630#endif
631
632 // Hide some bars.
633 expose = bar->ShownByDefault() || bar->HideAfterReset();
634

Callers 6

SubscribeMethod · 0.45
DestroyMethod · 0.45
OnResetToolBarsMethod · 0.45
ReadConfigMethod · 0.45
SetDevicesMethod · 0.45
SetDevicesMethod · 0.45

Calls 15

ToolFrameClass · 0.85
ForEachFunction · 0.85
UndockMethod · 0.80
GetDockMethod · 0.80
IsResizableMethod · 0.80
DockMethod · 0.80
GetSectionMethod · 0.80
GetIndexMethod · 0.80
MoveMethod · 0.80
wxPointClass · 0.70
SetSizeMethod · 0.45
IsDockedMethod · 0.45

Tested by

no test coverage detected