| 524 | } |
| 525 | |
| 526 | ProjectWindow::ProjectWindow(wxWindow * parent, wxWindowID id, |
| 527 | const wxPoint & pos, |
| 528 | const wxSize & size, AudacityProject &project |
| 529 | ) : ProjectWindowBase{ parent, id, pos, size, project } |
| 530 | , mViewportSubscription{ |
| 531 | Viewport::Get(project) |
| 532 | .Subscribe(*this, &ProjectWindow::OnViewportMessage) } |
| 533 | { |
| 534 | Viewport::Get(project).SetCallbacks(std::make_unique<Adapter>(*this)); |
| 535 | |
| 536 | mNextWindowID = NextID; |
| 537 | |
| 538 | constexpr auto EffectsPanelMaxWidth { 500 }; |
| 539 | constexpr auto TrackPanelMinWidth { 250 }; |
| 540 | |
| 541 | // Two sub-windows need to be made before Init(), |
| 542 | // so that this constructor can complete, and then TrackPanel and |
| 543 | // AdornedRulerPanel can retrieve those windows from this in their |
| 544 | // factory functions |
| 545 | |
| 546 | // PRL: this panel groups the top tool dock and the ruler into one |
| 547 | // tab cycle. |
| 548 | // Must create it with non-default width equal to the main window width, |
| 549 | // or else the device toolbar doesn't make initial widths of the choice |
| 550 | // controls correct. |
| 551 | mTopPanel = safenew wxPanelWrapper { |
| 552 | this, wxID_ANY, wxDefaultPosition, |
| 553 | wxSize{ this->GetSize().GetWidth(), -1 } |
| 554 | }; |
| 555 | mTopPanel->SetLabel( "Top Panel" );// Not localised |
| 556 | mTopPanel->SetLayoutDirection(wxLayout_LeftToRight); |
| 557 | mTopPanel->SetAutoLayout(true); |
| 558 | |
| 559 | auto container = safenew wxSplitterWindow(this, wxID_ANY, |
| 560 | wxDefaultPosition, |
| 561 | wxDefaultSize, |
| 562 | wxNO_BORDER | wxSP_LIVE_UPDATE | wxSP_THIN_SASH); |
| 563 | container->Bind(wxEVT_SPLITTER_DOUBLECLICKED, [](wxSplitterEvent& event){ |
| 564 | //"The default behaviour is to unsplit the window" |
| 565 | event.Veto();//do noting instead |
| 566 | }); |
| 567 | container->Bind(wxEVT_SPLITTER_SASH_POS_CHANGING, [=](wxSplitterEvent& event){ |
| 568 | if(event.GetSashPosition() > EffectsPanelMaxWidth) |
| 569 | //Prevents left panel from expanding further |
| 570 | event.SetSashPosition(-1); |
| 571 | }); |
| 572 | mContainerWindow = container; |
| 573 | |
| 574 | mTrackListWindow = safenew wxPanelWrapper(mContainerWindow, wxID_ANY, |
| 575 | wxDefaultPosition, |
| 576 | wxDefaultSize, |
| 577 | wxNO_BORDER); |
| 578 | mTrackListWindow->SetMinSize({TrackPanelMinWidth, -1}); |
| 579 | mTrackListWindow->SetSizer( safenew wxBoxSizer(wxVERTICAL) ); |
| 580 | mTrackListWindow->SetLabel("Main Panel");// Not localized. |
| 581 | mTrackListWindow->SetLayoutDirection(wxLayout_LeftToRight); |
| 582 | |
| 583 | mContainerWindow->Initialize(mTrackListWindow); |
nothing calls this directly
no test coverage detected