mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-16 12:21:11 +00:00
Keep Slice and Print Visible When Plugin Page Tabs Overflow (#16541)
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user