From 90ae982fc2bfdf2f4c049db747ce9516debb148a Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Tue, 17 Mar 2015 14:13:59 -0400 Subject: Map editor now assumes a reasonable amount of screen real estate --- tools/mapedit/src/frame.cpp | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/tools/mapedit/src/frame.cpp b/tools/mapedit/src/frame.cpp index 3646d4e..2a553b6 100644 --- a/tools/mapedit/src/frame.cpp +++ b/tools/mapedit/src/frame.cpp @@ -66,8 +66,34 @@ wxBEGIN_EVENT_TABLE(MapeditFrame, wxFrame) EVT_BUTTON(CANCEL_STARTPOS_BUTTON, MapeditFrame::OnCancelSetStartpos) wxEND_EVENT_TABLE() -MapeditFrame::MapeditFrame(std::unique_ptr world) : wxFrame(NULL, wxID_ANY, "Map Editor", wxDefaultPosition, wxSize(GAME_WIDTH*2+TILE_WIDTH*6*6+10+10+150, GAME_HEIGHT*3)) +MapeditFrame::MapeditFrame(std::unique_ptr world) : wxFrame(NULL, wxID_ANY, "Map Editor") { + int screenWidth = wxSystemSettings::GetMetric(wxSYS_SCREEN_X); + int screenHeight = wxSystemSettings::GetMetric(wxSYS_SCREEN_Y); + bool setSize = false; + wxSize toSetSize = GetSize(); + if (screenWidth > 1280) + { + setSize = true; + toSetSize.SetWidth(1280); + } + + if (screenHeight > 800) + { + setSize = true; + toSetSize.SetHeight(800); + } + + if (setSize) + { + SetSize(toSetSize); + + int numClosers = openWindows.size() - 1; + SetPosition({GetPosition().x + numClosers*20, GetPosition().y + numClosers*20}); + } else { + Maximize(); + } + this->world = std::move(world); this->world->setParent(this); currentMap = this->world->getLastMap(); @@ -228,8 +254,6 @@ MapeditFrame::MapeditFrame(std::unique_ptr world) : wxFrame(NULL, wxID_AN dontSelectMap = true; mapTree->SelectItem(currentMap->getTreeItemId()); dontSelectMap = false; - - Maximize(true); } void MapeditFrame::OnExit(wxCloseEvent& event) -- cgit 1.4.1