From 835c24cfc1bd034e0bf5f5285568e56641600f44 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 23 Apr 2024 12:44:30 +0200 Subject: [PATCH] Insert "Connect" tab to position next to "Printer" tab --- src/slic3r/GUI/MainFrame.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index a3725ba8c3..462d7de4c9 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -742,10 +742,12 @@ void MainFrame::add_connect_webview_tab() { if (m_connect_webview_added) { return; - } // parameters of InsertNewPage (to prevent ambigous overloaded function) - // insert to positon 4, if physical printer is already added, it moves to 5 + } + // parameters of InsertNewPage (to prevent ambigous overloaded function) + // insert "Connect" tab to position next to "Printer" tab // order of tabs: Plater - Print Settings - Filaments - Printers - Prusa Connect - Prusa Link - size_t n = 4; + + int n = m_tabpanel->FindPage(wxGetApp().get_tab(Preset::TYPE_PRINTER)) + 1; wxWindow* page = m_connect_webview; const wxString text(L"Prusa Connect"); const std::string bmp_name = ""; @@ -759,10 +761,10 @@ void MainFrame::remove_connect_webview_tab() if (!m_connect_webview_added) { return; } - // connect tab should always be at position 4 - if (m_tabpanel->GetSelection() == 4) + int n = m_tabpanel->FindPage(m_connect_webview); + if (m_tabpanel->GetSelection() == n) m_tabpanel->SetSelection(0); - m_tabpanel->RemovePage(4); + m_tabpanel->RemovePage(size_t(n)); m_connect_webview_added = false; m_connect_webview->logout(); }