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:
SoftFever
2026-08-19 00:27:48 +08:00
parent 6c0f5eee55
commit ffee402494
2 changed files with 7 additions and 2 deletions
+3 -2
View File
@@ -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)"));
}