mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-23 01:49:17 +00:00
Give the printer-agents web Device tab its own page id
In printer-agents mode the legacy web page was appended under Notebook::PAGE_MONITOR, which resolves to the same "monitor" id as the native Device tab. FindPageByName returns the first match, so PluginPages::relayout() — which saves the selection by name and restores it after rebuilding the tab strip — moved the user off the web tab onto the native one. The tab also disagreed with its own label, being created as "Device (legacy)" and renamed to "Device (Web)" on the next show_device() call.
This commit is contained in:
@@ -1385,7 +1385,7 @@ void MainFrame::show_device(bool should_use_native) {
|
||||
// The web page is appended when printer agents are enabled. Remove that
|
||||
// extra page before switching back to the normal native/Web layout.
|
||||
if (!use_printer_agents) {
|
||||
if ((idx = m_tabpanel->FindPage(m_printer_view)) != wxNOT_FOUND && idx != m_tabpanel->FindPageByName(TAB_ID_MONITOR)) {
|
||||
if ((idx = m_tabpanel->FindPageByName(TAB_ID_MONITOR_WEB)) != wxNOT_FOUND) {
|
||||
m_printer_view->Show(false);
|
||||
m_tabpanel->RemovePage(idx);
|
||||
}
|
||||
@@ -1447,7 +1447,8 @@ void MainFrame::show_device(bool should_use_native) {
|
||||
|
||||
if ((idx = m_tabpanel->FindPage(m_printer_view)) == wxNOT_FOUND) {
|
||||
m_printer_view->Show(false);
|
||||
m_tabpanel->AddPage(m_printer_view, _L("Device (legacy)"), false, Notebook::PAGE_MONITOR);
|
||||
m_tabpanel->InsertPage(m_tabpanel->GetPageCount(), TAB_ID_MONITOR_WEB, m_printer_view,
|
||||
_L("Device (Web)"), "tab_monitor_active", false);
|
||||
} else {
|
||||
m_tabpanel->SetPageText(idx, _L("Device (Web)"));
|
||||
}
|
||||
|
||||
@@ -43,6 +43,10 @@
|
||||
#define TAB_ID_PREPARE "prepare"
|
||||
#define TAB_ID_PREVIEW "preview"
|
||||
#define TAB_ID_MONITOR "monitor"
|
||||
// Printer-agents mode shows the legacy web page alongside the native Device tab, so it needs an
|
||||
// id of its own: sharing TAB_ID_MONITOR makes every name lookup resolve to whichever of the two
|
||||
// comes first, which silently defeats PluginPages' selection round-trip across a tab relayout.
|
||||
#define TAB_ID_MONITOR_WEB "monitor_web"
|
||||
#define TAB_ID_MULTI_DEVICE "multi_device"
|
||||
#define TAB_ID_PROJECT "project"
|
||||
#define TAB_ID_CALIBRATION "calibration"
|
||||
|
||||
Reference in New Issue
Block a user