Keep Slice and Print Visible When Plugin Page Tabs Overflow (#16541)

This commit is contained in:
HanifKoh
2026-10-16 15:39:02 +08:00
committed by GitHub
parent 8b6c074c69
commit 29b6bbb8c9
3 changed files with 11 additions and 0 deletions
+3
View File
@@ -1739,6 +1739,9 @@ void MainFrame::fit_tab_labels()
for (size_t i = count - 1; i >= 1; --i) {
int right = ScreenToClient(m_slice_option_btn->ClientToScreen({})).x;
int left = sizer->GetSize().GetWidth();
// The overflow button sits between the tab buttons and the side tools, so it is not free space.
if (const wxWindow* overflow = ctrl->GetOverflowButton())
left += overflow->GetSize().GetWidth();
if (right - left - FromDIP(15) > 0) return;
ctrl->SetCompact(i, true);
m_tabpanel->Refresh();
+1
View File
@@ -57,6 +57,7 @@ public:
// ORCA: a companion widget shown right after the tab buttons (before any side_tools), e.g.
// an overflow indicator. Pass nullptr to remove it; ownership stays with the caller.
void SetOverflowButton(wxWindow* button);
wxWindow* GetOverflowButton() const { return m_overflow_button; }
private:
wxFlexGridSizer* m_buttons_sizer;
+7
View File
@@ -4,6 +4,7 @@
#include "slic3r/GUI/GUI.hpp"
#include "slic3r/GUI/Notebook.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "slic3r/GUI/MainFrame.hpp"
#include "slic3r/GUI/Widgets/Button.hpp"
#include "slic3r/GUI/wxExtensions.hpp"
#include "slic3r/plugin/PluginManager.hpp"
@@ -382,6 +383,7 @@ void PluginPages::relayout()
m_parent->SelectPageByName(id_to_reselect);
}
const bool overflow_changed = need_overflow != (m_overflow_button != nullptr);
if (need_overflow) {
if (m_overflow_button == nullptr) {
auto* btn = new Button(m_parent->GetBtnsListCtrl(), wxString(L"\u25BE"), wxString(), wxNO_BORDER);
@@ -398,6 +400,11 @@ void PluginPages::relayout()
m_overflow_button->Destroy();
m_overflow_button = nullptr;
}
// The tab strip changed width; compact the labels again so the side tools stay visible.
if ((!up_to_date || overflow_changed) && !GUI::wxGetApp().is_closing())
if (GUI::MainFrame* mainframe = GUI::wxGetApp().mainframe)
mainframe->fit_tab_labels();
}
void PluginPages::select_page(const PluginCapabilityId& id)