Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set Max Size of Window Based on Display Size #2412 #4466

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 14 additions & 6 deletions xLights/sequencer/tabSequencer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <wx/utils.h>
#include <wx/tokenzr.h>
#include <wx/clipbrd.h>
#include <wx/display.h>
#include <wx/filename.h>
#include <wx/filepicker.h>
#include <wx/fontpicker.h>
Expand Down Expand Up @@ -89,15 +90,21 @@ void xLightsFrame::CreateSequencer()
logger_base.debug(" Set dock size constraints.");
m_mgr->SetDockSizeConstraint(0.25, 0.15);

const auto maxHeight = std::max(1, wxDisplay().GetGeometry().GetHeight() - 100);
const auto maxWidth = std::max(1, wxDisplay().GetGeometry().GetWidth());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would this work for those of us that are using multiple displays, possibly/likely at different resolutions? I'd honestly prefer NOT setting any sort of MaxHeight on anything so that the windows can easily be moved to different displays and still be maximized.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it goes off the screen you cant get to the bottom. The double click still maximizes it. The original code was setting the max off your screen. GetHeight should return the largest your monitor can handle. Not sure how it handles resolutions and such though. This code is similar to code used in Audacity.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But that's part of the problem.... My "main" monitor has a height of 1620 (logical size), but if the window appears on notebook screen, it has a max of 1329 and it gets cut off.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current code is hard coded to 1050. This is better than hard coded arbitrary value. Is there an even better way? If you dont have it set, you end up having to resize the box every time.

logger_base.debug(" Model preview.");
_modelPreviewPanel = new ModelPreview(PanelSequencer, this);
m_mgr->AddPane(_modelPreviewPanel, wxAuiPaneInfo().Name(wxT("ModelPreview")).Caption(wxT("Model Preview")).
Left().Layer(1).PaneBorder(true).BestSize(250,250).MaximizeButton(true).Dockable(IsDockable("MP")));
Left().Layer(1).PaneBorder(true).MaxSize(wxSize(-1, maxHeight)).
BestSize(maxWidth*.5, maxHeight*.5).MaximizeButton(true).
Dockable(IsDockable("MP")));

logger_base.debug(" House preview.");
_housePreviewPanel = new HousePreviewPanel(PanelSequencer, this, _playControlsOnPreview, PreviewModels, LayoutGroups, false, 0, true);
m_mgr->AddPane(_housePreviewPanel, wxAuiPaneInfo().Name(wxT("HousePreview")).Caption(wxT("House Preview")).
Left().Layer(1).BestSize(250, 250).MaximizeButton(true).Dockable(IsDockable("HP")));
Left().Layer(1).MaxSize(wxSize(-1, maxHeight)).
BestSize(maxWidth*.5, maxHeight*.5).MaximizeButton(true).
Dockable(IsDockable("HP")));

logger_base.debug(" Effects.");
effectsPnl = new TopEffectsPanel(PanelSequencer);
Expand Down Expand Up @@ -159,10 +166,10 @@ void xLightsFrame::CreateSequencer()
.Float().MaximizeButton(true));
// Hide the panel on start.
wxAuiPaneInfo & info = m_mgr->GetPane("DisplayElements");
info.BestSize(wxSize(750, 1050));
info.BestSize(wxSize(750, maxHeight));
int w, h;
displayElementsPanel->GetSize(&w, &h);
info.FloatingSize(std::max(750, w), std::max(1050, h));
info.FloatingSize(std::max(750, w), std::max(maxHeight, h));
info.Hide();

m_mgr->AddPane(perspectivePanel,wxAuiPaneInfo().Name(wxT("Perspectives")).Caption(wxT("Perspectives")).Left().Layer(1).Hide());
Expand Down Expand Up @@ -3086,10 +3093,11 @@ void xLightsFrame::ShowHideDisplayElementsWindow(wxCommandEvent& event)
if (visible) {
info.Hide();
} else {
info.BestSize(wxSize(750, 1050));
const auto maxHeight = std::max(1, wxDisplay().GetGeometry().GetHeight() - 100);
info.BestSize(wxSize(750, maxHeight));
int w, h;
displayElementsPanel->GetSize(&w, &h);
info.FloatingSize(std::max(750, w), std::max(1050, h));
info.FloatingSize(std::max(750, w), std::max(maxHeight, h));
info.Show();
}
m_mgr->Update();
Expand Down