From 896d898124d71d4dac5bac9d86be78c41a83ae65 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Thu, 28 Jun 2018 17:52:20 +0200 Subject: [PATCH] Resizing panel to 1 px --- xs/src/slic3r/GUI/Tab.cpp | 33 +++++++++++++++++---------------- xs/src/slic3r/GUI/Tab.hpp | 7 ++++--- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/xs/src/slic3r/GUI/Tab.cpp b/xs/src/slic3r/GUI/Tab.cpp index 4186cd8db..e8323ded3 100644 --- a/xs/src/slic3r/GUI/Tab.cpp +++ b/xs/src/slic3r/GUI/Tab.cpp @@ -40,7 +40,7 @@ void Tab::create_preset_tab(PresetBundle *preset_bundle) m_preset_bundle = preset_bundle; // Vertical sizer to hold the choice menu and the rest of the page. -#ifdef __WXOSX__ +//#ifdef __WXOSX__ auto *main_sizer = new wxBoxSizer(wxVERTICAL); main_sizer->SetSizeHints(this); this->SetSizer(main_sizer); @@ -54,12 +54,12 @@ void Tab::create_preset_tab(PresetBundle *preset_bundle) m_tmp_panel->Layout(); main_sizer->Add(m_tmp_panel, 1, wxEXPAND | wxALL, 0); -#else - Tab *panel = this; - auto *sizer = new wxBoxSizer(wxVERTICAL); - sizer->SetSizeHints(panel); - panel->SetSizer(sizer); -#endif //__WXOSX__ +// #else +// Tab *panel = this; +// auto *sizer = new wxBoxSizer(wxVERTICAL); +// sizer->SetSizeHints(panel); +// panel->SetSizer(sizer); +// #endif //__WXOSX__ // preset chooser m_presets_choice = new wxBitmapComboBox(panel, wxID_ANY, "", wxDefaultPosition, wxSize(270, -1), 0, 0,wxCB_READONLY); @@ -295,11 +295,11 @@ PageShp Tab::add_options_page(const wxString& title, const std::string& icon, bo } } // Initialize the page. -#ifdef __WXOSX__ +//#ifdef __WXOSX__ auto panel = m_tmp_panel; -#else - auto panel = this; -#endif +// #else +// auto panel = this; +// #endif PageShp page(new Page(panel, title, icon_idx)); page->SetScrollbars(1, 1, 1, 1); page->Hide(); @@ -313,12 +313,13 @@ PageShp Tab::add_options_page(const wxString& title, const std::string& icon, bo void Tab::OnActivate() { -#ifdef __WXOSX__ +// #ifdef __WXOSX__ wxWindowUpdateLocker noUpdates(this); - auto sizer = GetSizer(); - m_tmp_panel->GetSizer()->SetMinSize(sizer->GetSize()); - /*m_tmp_panel->*/Fit(); + auto size = GetSizer()->GetSize(); + m_tmp_panel->GetSizer()->SetMinSize(size.x + m_size_move, size.y); + Fit(); + m_size_move *= -1; // Page* page = nullptr; // auto selection = m_treectrl->GetItemText(m_treectrl->GetSelection()); @@ -332,7 +333,7 @@ void Tab::OnActivate() // page->Fit(); // m_hsizer->Layout(); // Refresh(); -#endif // __WXOSX__ +// #endif // __WXOSX__ } void Tab::update_labels_colour() diff --git a/xs/src/slic3r/GUI/Tab.hpp b/xs/src/slic3r/GUI/Tab.hpp index 82670121c..4d14f9de1 100644 --- a/xs/src/slic3r/GUI/Tab.hpp +++ b/xs/src/slic3r/GUI/Tab.hpp @@ -102,6 +102,10 @@ using PageShp = std::shared_ptr; class Tab: public wxPanel { wxNotebook* m_parent; +//#ifdef __WXOSX__ + wxPanel* m_tmp_panel; + int m_size_move = -1; +//#endif // __WXOSX__ protected: std::string m_name; const wxString m_title; @@ -118,9 +122,6 @@ protected: wxButton* m_undo_btn; wxButton* m_undo_to_sys_btn; wxButton* m_question_btn; -#ifdef __WXOSX__ - wxPanel* m_tmp_panel; -#endif // __WXOSX__ wxComboCtrl* m_cc_presets_choice; wxDataViewTreeCtrl* m_presetctrl; wxImageList* m_preset_icons;