Fix for #10746 - drop box in filament settings to small

This commit is contained in:
YuSanka 2023-06-07 12:24:25 +02:00
parent b9df1deb0e
commit 23ffd34471
2 changed files with 21 additions and 21 deletions

View File

@ -216,10 +216,10 @@ void Tab::create_preset_tab()
m_mode_sizer = new ModeSizer(panel, int (0.5*em_unit(this))); m_mode_sizer = new ModeSizer(panel, int (0.5*em_unit(this)));
const float scale_factor = em_unit(this)*0.1;// GetContentScaleFactor(); const float scale_factor = em_unit(this)*0.1;// GetContentScaleFactor();
m_hsizer = new wxBoxSizer(wxHORIZONTAL); m_top_hsizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(m_hsizer, 0, wxEXPAND | wxBOTTOM, 3); sizer->Add(m_top_hsizer, 0, wxEXPAND | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 3);
m_hsizer->Add(m_presets_choice, 0, wxLEFT | wxRIGHT | wxTOP | wxALIGN_CENTER_VERTICAL, 3); m_top_hsizer->Add(m_presets_choice, 0, wxLEFT | wxRIGHT | wxTOP | wxALIGN_CENTER_VERTICAL, 3);
m_hsizer->AddSpacer(int(4*scale_factor)); m_top_hsizer->AddSpacer(int(4*scale_factor));
m_h_buttons_sizer = new wxBoxSizer(wxHORIZONTAL); m_h_buttons_sizer = new wxBoxSizer(wxHORIZONTAL);
m_h_buttons_sizer->Add(m_btn_save_preset, 0, wxALIGN_CENTER_VERTICAL); 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->AddSpacer(int(8*scale_factor));
m_h_buttons_sizer->Add(m_btn_compare_preset, 0, wxALIGN_CENTER_VERTICAL); m_h_buttons_sizer->Add(m_btn_compare_preset, 0, wxALIGN_CENTER_VERTICAL);
m_hsizer->Add(m_h_buttons_sizer, 1, wxEXPAND); m_top_hsizer->Add(m_h_buttons_sizer, 1, wxEXPAND | wxALIGN_CENTRE_VERTICAL);
m_hsizer->AddSpacer(int(16*scale_factor)); m_top_hsizer->AddSpacer(int(16*scale_factor));
// m_hsizer->AddStretchSpacer(32);
// StretchSpacer has a strange behavior under OSX, so // StretchSpacer has a strange behavior under OSX, so
// There is used just additional sizer for m_mode_sizer with right alignment // There is used just additional sizer for m_mode_sizer with right alignment
if (m_mode_sizer) { 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 // 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. // to wrong vertical size assigned to wxBitmapComboBoxes, see GH issue #7176.
mode_sizer->Add(m_mode_sizer, 0, wxALIGN_RIGHT); 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. //Horizontal sizer to hold the tree and the selected page.
m_hsizer = new wxBoxSizer(wxHORIZONTAL); m_hsizer = new wxBoxSizer(wxHORIZONTAL);
@ -461,20 +462,15 @@ void Tab::OnActivate()
activate_selected_page([](){}); activate_selected_page([](){});
m_hsizer->Layout(); m_hsizer->Layout();
#ifdef _MSW_DARK_MODE if (m_presets_choice->IsShown())
// Because of DarkMode we use our own Notebook (inherited from wxSiplebook) instead of wxNotebook Refresh(); // Just refresh page, if m_presets_choice is already shown
// And it looks like first Layout of the page doesn't update a size of the m_presets_choice else {
// So we have to set correct size explicitely // on first OnActivate call show top sizer
if (wxSize ok_sz = wxSize(35 * m_em_unit, m_presets_choice->GetBestSize().y); m_top_hsizer->ShowItems(true);
ok_sz != m_presets_choice->GetSize()) { if (TabFilament* tab = dynamic_cast<TabFilament*>(this))
m_presets_choice->SetMinSize(ok_sz); tab->update_extruder_combobox();
m_presets_choice->SetSize(ok_sz); Layout();
GetSizer()->GetItem(size_t(0))->GetSizer()->Layout();
if (wxGetApp().tabs_as_menu())
m_presets_choice->update();
} }
#endif // _MSW_DARK_MODE
Refresh();
} }
void Tab::update_label_colours() void Tab::update_label_colours()
@ -1950,6 +1946,9 @@ void TabFilament::create_extruder_combobox()
void TabFilament::update_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<const ConfigOptionFloats*>(m_preset_bundle->printers.get_edited_preset().config.option("nozzle_diameter"))->values.size(); const size_t extruder_cnt = static_cast<const ConfigOptionFloats*>(m_preset_bundle->printers.get_edited_preset().config.option("nozzle_diameter"))->values.size();
m_extruders_cb->Show(extruder_cnt > 1); m_extruders_cb->Show(extruder_cnt > 1);

View File

@ -172,6 +172,7 @@ protected:
ScalableButton* m_btn_delete_preset; ScalableButton* m_btn_delete_preset;
ScalableButton* m_btn_edit_ph_printer {nullptr}; ScalableButton* m_btn_edit_ph_printer {nullptr};
ScalableButton* m_btn_hide_incompatible_presets; ScalableButton* m_btn_hide_incompatible_presets;
wxBoxSizer* m_top_hsizer;
wxBoxSizer* m_hsizer; wxBoxSizer* m_hsizer;
wxBoxSizer* m_h_buttons_sizer; wxBoxSizer* m_h_buttons_sizer;
wxBoxSizer* m_left_sizer; wxBoxSizer* m_left_sizer;