diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 93017714e..184b8af70 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -216,10 +216,10 @@ void Tab::create_preset_tab() m_mode_sizer = new ModeSizer(panel, int (0.5*em_unit(this))); const float scale_factor = em_unit(this)*0.1;// GetContentScaleFactor(); - m_hsizer = new wxBoxSizer(wxHORIZONTAL); - sizer->Add(m_hsizer, 0, wxEXPAND | wxBOTTOM, 3); - m_hsizer->Add(m_presets_choice, 0, wxLEFT | wxRIGHT | wxTOP | wxALIGN_CENTER_VERTICAL, 3); - m_hsizer->AddSpacer(int(4*scale_factor)); + m_top_hsizer = new wxBoxSizer(wxHORIZONTAL); + sizer->Add(m_top_hsizer, 0, wxEXPAND | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 3); + m_top_hsizer->Add(m_presets_choice, 0, wxLEFT | wxRIGHT | wxTOP | wxALIGN_CENTER_VERTICAL, 3); + m_top_hsizer->AddSpacer(int(4*scale_factor)); m_h_buttons_sizer = new wxBoxSizer(wxHORIZONTAL); m_h_buttons_sizer->Add(m_btn_save_preset, 0, wxALIGN_CENTER_VERTICAL); @@ -243,9 +243,8 @@ void Tab::create_preset_tab() m_h_buttons_sizer->AddSpacer(int(8*scale_factor)); m_h_buttons_sizer->Add(m_btn_compare_preset, 0, wxALIGN_CENTER_VERTICAL); - m_hsizer->Add(m_h_buttons_sizer, 1, wxEXPAND); - m_hsizer->AddSpacer(int(16*scale_factor)); - // m_hsizer->AddStretchSpacer(32); + m_top_hsizer->Add(m_h_buttons_sizer, 1, wxEXPAND | wxALIGN_CENTRE_VERTICAL); + m_top_hsizer->AddSpacer(int(16*scale_factor)); // StretchSpacer has a strange behavior under OSX, so // There is used just additional sizer for m_mode_sizer with right alignment if (m_mode_sizer) { @@ -253,8 +252,10 @@ void Tab::create_preset_tab() // Don't set the 2nd parameter to 1, making the sizer rubbery scalable in Y axis may lead // to wrong vertical size assigned to wxBitmapComboBoxes, see GH issue #7176. mode_sizer->Add(m_mode_sizer, 0, wxALIGN_RIGHT); - m_hsizer->Add(mode_sizer, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT, wxOSX ? 15 : 10); + m_top_hsizer->Add(mode_sizer, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT, wxOSX ? 15 : 10); } + // hide whole top sizer to correct layout later + m_top_hsizer->ShowItems(false); //Horizontal sizer to hold the tree and the selected page. m_hsizer = new wxBoxSizer(wxHORIZONTAL); @@ -461,20 +462,15 @@ void Tab::OnActivate() activate_selected_page([](){}); m_hsizer->Layout(); -#ifdef _MSW_DARK_MODE - // Because of DarkMode we use our own Notebook (inherited from wxSiplebook) instead of wxNotebook - // And it looks like first Layout of the page doesn't update a size of the m_presets_choice - // So we have to set correct size explicitely - if (wxSize ok_sz = wxSize(35 * m_em_unit, m_presets_choice->GetBestSize().y); - ok_sz != m_presets_choice->GetSize()) { - m_presets_choice->SetMinSize(ok_sz); - m_presets_choice->SetSize(ok_sz); - GetSizer()->GetItem(size_t(0))->GetSizer()->Layout(); - if (wxGetApp().tabs_as_menu()) - m_presets_choice->update(); + if (m_presets_choice->IsShown()) + Refresh(); // Just refresh page, if m_presets_choice is already shown + else { + // on first OnActivate call show top sizer + m_top_hsizer->ShowItems(true); + if (TabFilament* tab = dynamic_cast(this)) + tab->update_extruder_combobox(); + Layout(); } -#endif // _MSW_DARK_MODE - Refresh(); } void Tab::update_label_colours() @@ -1950,6 +1946,9 @@ void TabFilament::create_extruder_combobox() void TabFilament::update_extruder_combobox() { + if (!m_presets_choice->IsShown()) + return; // it will be updated later, on OnActive() + const size_t extruder_cnt = static_cast(m_preset_bundle->printers.get_edited_preset().config.option("nozzle_diameter"))->values.size(); m_extruders_cb->Show(extruder_cnt > 1); diff --git a/src/slic3r/GUI/Tab.hpp b/src/slic3r/GUI/Tab.hpp index bbe1d1b17..81344c615 100644 --- a/src/slic3r/GUI/Tab.hpp +++ b/src/slic3r/GUI/Tab.hpp @@ -172,6 +172,7 @@ protected: ScalableButton* m_btn_delete_preset; ScalableButton* m_btn_edit_ph_printer {nullptr}; ScalableButton* m_btn_hide_incompatible_presets; + wxBoxSizer* m_top_hsizer; wxBoxSizer* m_hsizer; wxBoxSizer* m_h_buttons_sizer; wxBoxSizer* m_left_sizer;