| 575 | |
| 576 | |
| 577 | void 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 |
no test coverage detected