mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-24 18:37:39 +00:00
fix: plugin pages removing calibration tab
This commit is contained in:
@@ -1457,6 +1457,7 @@ void MainFrame::show_device(bool should_use_native) {
|
||||
#endif // _MSW_DARK_MODE
|
||||
|
||||
fit_tab_labels(); // ORCA on printer change
|
||||
m_plugin_pages.relayout(); // keep plugin tabs after the native tabs just mutated above
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1545,6 +1546,7 @@ void MainFrame::show_device(bool should_use_native) {
|
||||
}
|
||||
}
|
||||
fit_tab_labels(); // ORCA on printer change
|
||||
m_plugin_pages.relayout(); // keep plugin tabs after the native tabs just mutated above
|
||||
}
|
||||
|
||||
void MainFrame::fit_tab_labels()
|
||||
|
||||
@@ -218,7 +218,6 @@ void PluginPages::initialize(Notebook* parent)
|
||||
return;
|
||||
|
||||
m_visible_page_count = GUI::wxGetApp().app_config->get_plugin_pages_visible_count();
|
||||
m_notebook_base_index = static_cast<size_t>(m_parent->GetPageCount());
|
||||
|
||||
m_image_list = std::make_unique<wxImageList>(20, 20, true, 0);
|
||||
m_parent->SetImageList(m_image_list.get());
|
||||
@@ -238,7 +237,6 @@ void PluginPages::shutdown()
|
||||
m_parent->SetImageList(nullptr);
|
||||
m_image_list.reset();
|
||||
m_parent = nullptr;
|
||||
m_notebook_base_index = 0;
|
||||
}
|
||||
|
||||
void PluginPages::set_visible_page_count(int count)
|
||||
@@ -369,6 +367,10 @@ void PluginPages::remove_page(const PluginCapabilityId& id)
|
||||
}
|
||||
}
|
||||
|
||||
const int idx = m_parent != nullptr ? m_parent->FindPage(page) : wxNOT_FOUND;
|
||||
if (idx != wxNOT_FOUND)
|
||||
m_parent->RemovePage(idx);
|
||||
|
||||
relayout();
|
||||
page->Destroy();
|
||||
}
|
||||
@@ -394,8 +396,11 @@ void PluginPages::relayout()
|
||||
|
||||
wxString id_to_reselect = m_parent->GetSelectedPageName();
|
||||
|
||||
while (m_parent->GetPageCount() > m_notebook_base_index)
|
||||
m_parent->RemovePage(m_parent->GetPageCount() - 1);
|
||||
for (const auto& [id, page] : m_pages) {
|
||||
const int idx = m_parent->FindPage(page);
|
||||
if (idx != wxNOT_FOUND)
|
||||
m_parent->RemovePage(idx);
|
||||
}
|
||||
|
||||
const int visible_slots = std::max(1, m_visible_page_count);
|
||||
const bool need_overflow = static_cast<int>(m_order.size()) > visible_slots;
|
||||
|
||||
@@ -69,19 +69,19 @@ public:
|
||||
int get_visible_page_count() const { return m_visible_page_count; }
|
||||
void set_visible_page_count(int count);
|
||||
|
||||
void relayout();
|
||||
|
||||
private:
|
||||
std::shared_ptr<PagesPluginCapability> get_pages_cap(const PluginCapabilityId& id, bool is_enabled) const;
|
||||
bool create_page(const PluginCapabilityId& id);
|
||||
void remove_page(const PluginCapabilityId& id);
|
||||
|
||||
void relayout();
|
||||
void show_overflow_menu();
|
||||
static wxString page_tab_id(const PluginCapabilityId& id);
|
||||
|
||||
std::map<PluginCapabilityId, PluginPage*> m_pages;
|
||||
std::vector<PluginCapabilityId> m_order;
|
||||
Notebook* m_parent{nullptr};
|
||||
size_t m_notebook_base_index{0};
|
||||
|
||||
std::unique_ptr<wxImageList> m_image_list;
|
||||
int m_visible_page_count{0};
|
||||
|
||||
Reference in New Issue
Block a user