void LoadTerrain() { wxBusyInfo busy (_("Loading terrain groups")); DeleteAllPages(); m_TerrainGroups.Clear(); // Get the list of terrain groups from the engine AtlasMessage::qGetTerrainGroups qry; qry.Post(); std::vector<std::wstring> groupnames = *qry.groupNames; for (std::vector<std::wstring>::iterator it = groupnames.begin(); it != groupnames.end(); ++it) m_TerrainGroups.Add(it->c_str()); for (size_t i = 0; i < m_TerrainGroups.GetCount(); ++i) { wxString visibleName = m_TerrainGroups[i]; // Format name slightly if (visibleName.Len()) visibleName[0] = wxToupper(visibleName[0]); visibleName.Replace(_T("_"), _T(" ")); AddPage(new TextureNotebookPage(m_ScenarioEditor, this, m_TerrainGroups[i]), visibleName); } // On some platforms (wxOSX) there is no initial OnPageChanged event, so it loads with a blank page // and setting selection to 0 won't trigger it either, so just force first page to display // (this is safe because the sidebar has already been displayed) if (GetPageCount() > 0) { static_cast<TextureNotebookPage*>(GetPage(0))->OnDisplay(); } }
void LoadTerrain() { wxBusyInfo busy (_("Loading terrain groups")); DeleteAllPages(); m_TerrainGroups.Clear(); // Get the list of terrain groups from the engine AtlasMessage::qGetTerrainGroups qry; qry.Post(); std::vector<std::wstring> groupnames = *qry.groupNames; for (std::vector<std::wstring>::iterator it = groupnames.begin(); it != groupnames.end(); ++it) m_TerrainGroups.Add(it->c_str()); for (size_t i = 0; i < m_TerrainGroups.GetCount(); ++i) { wxString visibleName = m_TerrainGroups[i]; if (visibleName.Len()) visibleName[0] = wxToupper(visibleName[0]); AddPage(new TextureNotebookPage(m_ScenarioEditor, this, m_TerrainGroups[i]), visibleName); } }