diff --git a/build/premake/premake.lua b/build/premake/premake.lua index 4081cc49ce..00955b91bb 100644 --- a/build/premake/premake.lua +++ b/build/premake/premake.lua @@ -765,6 +765,7 @@ function setup_atlas_packages() "" },{ -- include },{ -- extern_libs + "boost", "libxml2", "spidermonkey", "wxwidgets" @@ -1039,6 +1040,7 @@ function setup_tests() tinsert(links, "test_gen") if options["atlas"] then tinsert(links, "AtlasObject") + package_add_extern_libs({"wxwidgets"}) end extra_params = { extra_files = { "test_root.cpp", "test_setup.cpp" }, diff --git a/source/graphics/LOSTexture.cpp b/source/graphics/LOSTexture.cpp index e4e8deffdd..655cb6857c 100644 --- a/source/graphics/LOSTexture.cpp +++ b/source/graphics/LOSTexture.cpp @@ -156,7 +156,7 @@ void CLOSTexture::RecomputeTexture(int unit) if (m_Texture) { CmpPtr cmpTerrain(m_Simulation, SYSTEM_ENTITY); - if (!cmpTerrain.null() && m_MapSize != cmpTerrain->GetVerticesPerSide()) + if (!cmpTerrain.null() && m_MapSize != (ssize_t)cmpTerrain->GetVerticesPerSide()) DeleteTexture(); } diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Map/Map.cpp b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Map/Map.cpp index d11248b96f..18f2eedbbf 100644 --- a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Map/Map.cpp +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Map/Map.cpp @@ -149,15 +149,15 @@ void MapSettings::CreateWidgets() gameTypes.Add(_T("conquest")); gameTypes.Add(_T("endless")); - wxFlexGridSizer* gridSizer = new wxFlexGridSizer(2); + wxFlexGridSizer* gridSizer = new wxFlexGridSizer(2, 2); gridSizer->Add(new wxStaticText(this, wxID_ANY, _("Reveal map")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT)); gridSizer->Add(new wxCheckBox(this, ID_MapReveal, wxEmptyString)); gridSizer->Add(new wxStaticText(this, wxID_ANY, _("Game type")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT)); gridSizer->Add(new wxChoice(this, ID_MapType, wxDefaultPosition, wxDefaultSize, gameTypes)); gridSizer->Add(new wxStaticText(this, wxID_ANY, _("Num players")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT)); wxSpinCtrl* numPlayersSpin = new wxSpinCtrl(this, ID_MapNumPlayers, wxEmptyString, wxDefaultPosition, wxSize(40, -1)); - numPlayersSpin->SetRange(1, MAX_NUM_PLAYERS); numPlayersSpin->SetValue(MAX_NUM_PLAYERS); + numPlayersSpin->SetRange(1, MAX_NUM_PLAYERS); gridSizer->Add(numPlayersSpin); sizer->Add(gridSizer); @@ -177,13 +177,14 @@ void MapSettings::CreateWidgets() wxCollapsiblePane* playersPane = new wxCollapsiblePane(this, wxID_ANY, _("Player settings"), wxDefaultPosition, wxDefaultSize, wxCP_NO_TLW_RESIZE); wxFlexGridSizer* playersPaneSizer = new wxFlexGridSizer(2); + playersPaneSizer->AddGrowableCol(1); playersPaneSizer->Add(new wxStaticText(playersPane->GetPane(), wxID_ANY, _T(""))); playersPaneSizer->Add(new wxStaticText(playersPane->GetPane(), wxID_ANY, _("Civ"))); for (size_t i = 0; i < MAX_NUM_PLAYERS; ++i) { wxString idStr; idStr << (i+1); - playersPaneSizer->Add(new wxStaticText(playersPane->GetPane(), wxID_ANY, idStr), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT)); + playersPaneSizer->Add(new wxStaticText(playersPane->GetPane(), wxID_ANY, idStr), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT).Border(wxRIGHT, 2)); wxChoice* civChoice = new wxChoice(playersPane->GetPane(), wxID_ANY); for (size_t j = 0; j < civNames.Count(); ++j) civChoice->Append(civNames[j], new wxStringClientData(civCodes[j])); @@ -197,7 +198,7 @@ void MapSettings::CreateWidgets() sizer->Add(playersPane, wxSizerFlags().Expand()); wxStaticBoxSizer* keywordsSizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Keywords")); - wxFlexGridSizer* kwGridSizer = new wxFlexGridSizer(2); + wxFlexGridSizer* kwGridSizer = new wxFlexGridSizer(2, 2); kwGridSizer->Add(new wxStaticText(this, wxID_ANY, _("Demo")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT)); kwGridSizer->Add(new wxCheckBox(this, ID_MapKW_Demo, wxEmptyString)); kwGridSizer->Add(new wxStaticText(this, wxID_ANY, _("Hidden")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT)); @@ -222,7 +223,10 @@ void MapSettings::ReadFromEngine() wxDynamicCast(FindWindow(ID_MapReveal), wxCheckBox)->SetValue(wxString(m_MapSettings["RevealMap"]) == L"true"); - wxDynamicCast(FindWindow(ID_MapType), wxChoice)->SetStringSelection(wxString(m_MapSettings["GameType"])); + if (m_MapSettings["GameType"].defined()) + wxDynamicCast(FindWindow(ID_MapType), wxChoice)->SetStringSelection(wxString(m_MapSettings["GameType"])); + else + wxDynamicCast(FindWindow(ID_MapType), wxChoice)->SetSelection(0); size_t numPlayers = m_MapSettings["PlayerData"]["item"].count(); wxDynamicCast(FindWindow(ID_MapNumPlayers), wxSpinCtrl)->SetValue(numPlayers); @@ -331,7 +335,7 @@ MapSidebar::MapSidebar(ScenarioEditor& scenarioEditor, wxWindow* sidebarContaine sizer->Add(new wxChoice(this, ID_RandomScript), wxSizerFlags().Expand()); - wxFlexGridSizer* gridSizer = new wxFlexGridSizer(2); + wxFlexGridSizer* gridSizer = new wxFlexGridSizer(2, 2); gridSizer->AddGrowableCol(1); wxChoice* sizeChoice = new wxChoice(this, ID_RandomSize); @@ -373,9 +377,15 @@ MapSidebar::MapSidebar(ScenarioEditor& scenarioEditor, wxWindow* sidebarContaine void MapSidebar::OnCollapse(wxCollapsiblePaneEvent& WXUNUSED(evt)) { + Freeze(); + // Toggling the collapsing doesn't seem to update the sidebar layout // automatically, so do it explicitly here Layout(); + + Refresh(); // fixes repaint glitch on Windows + + Thaw(); } void MapSidebar::OnFirstDisplay() @@ -398,6 +408,8 @@ void MapSidebar::OnFirstDisplay() scriptChoice->Append(name, new AtObjClientData(*data["settings"])); } scriptChoice->SetSelection(0); + + Layout(); } void MapSidebar::OnMapReload() diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Object/Object.cpp b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Object/Object.cpp index 7bb02f58bf..878742f1bd 100644 --- a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Object/Object.cpp +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Object/Object.cpp @@ -109,6 +109,7 @@ ObjectSidebar::ObjectSidebar(ScenarioEditor& scenarioEditor, wxWindow* sidebarCo strings.Add(_("Entities")); strings.Add(_("Actors (all)")); wxChoice* objectType = new wxChoice(this, ID_ObjectType, wxDefaultPosition, wxDefaultSize, strings); + objectType->SetSelection(0); m_MainSizer->Add(objectType, wxSizerFlags().Expand()); p->m_ObjectListBox = new wxListBox(this, ID_SelectObject, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE|wxLB_HSCROLL); @@ -281,6 +282,7 @@ ObjectBottomBar::ObjectBottomBar(wxWindow* parent, Observable& o _T("gather_rock"), _T("gather_ore"), _T("gather_ruins"), _T("gather_treasure") }; // TODO: this list should come from the actor wxChoice* viewerAnimSelector = new wxChoice(m_ViewerPanel, ID_ViewerAnimation, wxDefaultPosition, wxDefaultSize, sizeof(animChoices)/sizeof(animChoices[0]), animChoices); + viewerAnimSelector->SetSelection(0); viewerAnimSizer->Add(viewerAnimSelector, wxSizerFlags().Expand()); wxSizer* viewerAnimSpeedSizer = new wxBoxSizer(wxHORIZONTAL); diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Terrain/Terrain.cpp b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Terrain/Terrain.cpp index 91c72d5ea4..ca05aa9d8e 100644 --- a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Terrain/Terrain.cpp +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Terrain/Terrain.cpp @@ -91,6 +91,7 @@ TerrainSidebar::TerrainSidebar(ScenarioEditor& scenarioEditor, wxWindow* sidebar wxArrayString defaultChoices; defaultChoices.Add(_("(none)")); m_PassabilityChoice = new wxChoice(this, ID_Passability, wxDefaultPosition, wxDefaultSize, defaultChoices); + m_PassabilityChoice->SetSelection(0); visSizer->Add(new wxStaticText(this, wxID_ANY, _("Passability")), wxSizerFlags().Right()); visSizer->Add(m_PassabilityChoice); @@ -245,9 +246,10 @@ public: wxSizer* imageSizer = new wxBoxSizer(wxVERTICAL); imageSizer->Add(button, wxSizerFlags().Center()); imageSizer->Add(label, wxSizerFlags().Proportion(1).Center()); - m_ScrolledPanel->GetSizer()->Add(imageSizer, wxSizerFlags().Expand().Center()); + m_ItemSizer->Add(imageSizer, wxSizerFlags().Expand().Center()); } + m_ScrolledPanel->Fit(); Layout(); Thaw(); diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/Tools/ActorViewerTool.cpp b/source/tools/atlas/AtlasUI/ScenarioEditor/Tools/ActorViewerTool.cpp index ee2c16efa4..d4d7fd9b30 100644 --- a/source/tools/atlas/AtlasUI/ScenarioEditor/Tools/ActorViewerTool.cpp +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Tools/ActorViewerTool.cpp @@ -45,7 +45,7 @@ class ActorViewerTool : public StateDrivenTool public: ActorViewerTool() : - m_Distance(20.f), m_Angle(0.f), m_Elevation(M_PI / 6.f), + m_Distance(20.f), m_Angle(0.f), m_Elevation((float)M_PI / 6.f), m_LastIsValid(false) { }