MSW specific: Fixed settings layout after switching from New to Old layout

(Notebook: Added check of a visibility of just selected tab in notebook)
This commit is contained in:
YuSanka 2021-09-22 15:31:58 +02:00
parent d08f7d9934
commit e477903d3e
2 changed files with 13 additions and 5 deletions

View File

@ -435,8 +435,9 @@ void MainFrame::update_layout()
{
m_plater->Reparent(m_tabpanel);
#ifdef _MSW_DARK_MODE
m_plater->Layout();
if (!wxGetApp().tabs_as_menu())
dynamic_cast<Notebook*>(m_tabpanel)->InsertPage(0, m_plater, _L("Plater"), std::string("plater"));
dynamic_cast<Notebook*>(m_tabpanel)->InsertPage(0, m_plater, _L("Plater"), std::string("plater"), true);
else
#endif
m_tabpanel->InsertPage(0, m_plater, _L("Plater"));
@ -461,7 +462,7 @@ void MainFrame::update_layout()
m_plater_page = new wxPanel(m_tabpanel);
#ifdef _MSW_DARK_MODE
if (!wxGetApp().tabs_as_menu())
dynamic_cast<Notebook*>(m_tabpanel)->InsertPage(0, m_plater_page, _L("Plater"), std::string("plater"));
dynamic_cast<Notebook*>(m_tabpanel)->InsertPage(0, m_plater_page, _L("Plater"), std::string("plater"), true);
else
#endif
m_tabpanel->InsertPage(0, m_plater_page, _L("Plater")); // empty panel just for Plater tab */

View File

@ -165,8 +165,8 @@ public:
GetBtnsListCtrl()->InsertPage(n, text, bSelect, bmp_name);
if (!DoSetSelectionAfterInsertion(n, bSelect))
page->Hide();
if (bSelect)
SetSelection(n);
return true;
}
@ -174,7 +174,14 @@ public:
virtual int SetSelection(size_t n) override
{
GetBtnsListCtrl()->SetSelection(n);
return DoSetSelection(n, SetSelection_SendEvent);
int ret = DoSetSelection(n, SetSelection_SendEvent);
// check that only the selected page is visible and others are hidden:
for (size_t page = 0; page < m_pages.size(); page++)
if (page != n)
m_pages[page]->Hide();
return ret;
}
virtual int ChangeSelection(size_t n) override