PreferencesDialog: Fix for rescale.

+ Fixed CheckBox::msw_rescale
This commit is contained in:
YuSanka 2022-11-23 12:05:37 +01:00
parent dbd5e4d999
commit d20131de49
6 changed files with 18 additions and 11 deletions

View File

@ -743,9 +743,7 @@ boost::any& CheckBox::get_value()
void CheckBox::msw_rescale()
{
Field::msw_rescale();
wxCheckBox* field = dynamic_cast<wxCheckBox*>(window);
field->SetMinSize(wxSize(-1, int(1.5f*field->GetFont().GetPixelSize().y +0.5f)));
window->SetInitialSize(window->GetBestSize());
}

View File

@ -1409,7 +1409,7 @@ void ObjectManipulation::msw_rescale()
editor->msw_rescale();
// rescale "inches" checkbox
m_check_inch->SetMinSize(wxSize(-1, int(1.5f * m_check_inch->GetFont().GetPixelSize().y + 0.5f)));
m_check_inch->SetInitialSize(m_check_inch->GetBestSize());
get_og()->msw_rescale();
}

View File

@ -386,6 +386,8 @@ void OG_CustomCtrl::correct_widgets_position(wxSizer* widget, const Line& line,
void OG_CustomCtrl::init_max_win_width()
{
m_max_win_width = 0;
if (opt_group->ctrl_horiz_alignment == wxALIGN_RIGHT && m_max_win_width == 0)
for (CtrlLine& line : ctrl_lines) {
if (int max_win_width = line.get_max_win_width();
@ -419,7 +421,7 @@ void OG_CustomCtrl::msw_rescale()
m_bmp_mode_sz = get_bitmap_size(get_bmp_bundle("mode_simple", wxOSX ? 10 : 12), this);
m_bmp_blinking_sz = get_bitmap_size(get_bmp_bundle("search_blink"), this);
m_max_win_width = 0;
init_max_win_width();
wxCoord v_pos = 0;
for (CtrlLine& line : ctrl_lines) {

View File

@ -756,12 +756,8 @@ void PreferencesDialog::msw_rescale()
{
for (ConfigOptionsGroup* og : this->optgroups())
og->msw_rescale();
#ifdef _WIN32
m_optgroup_dark_mode->msw_rescale();
#endif //_WIN32
#if ENABLE_ENVIRONMENT_MAP
m_optgroup_render->msw_rescale();
#endif // ENABLE_ENVIRONMENT_MAP
update_ctrls_alignment();
msw_buttons_rescale(this, em_unit(), { wxID_OK, wxID_CANCEL });

View File

@ -2156,6 +2156,16 @@ void TabFilament::clear_pages()
m_cooling_description_line = nullptr;
}
void TabFilament::msw_rescale()
{
for (const auto& over_opt : m_overrides_options) {
wxWindow* win = over_opt.second;
win->SetInitialSize(win->GetBestSize());
}
Tab::msw_rescale();
}
wxSizer* Tab::description_line_widget(wxWindow* parent, ogStaticText* *StaticText, wxString text /*= wxEmptyString*/)
{
*StaticText = new ogStaticText(parent, text);

View File

@ -449,6 +449,7 @@ public:
void toggle_options() override;
void update() override;
void clear_pages() override;
void msw_rescale() override;
bool supports_printer_technology(const PrinterTechnology tech) const override { return tech == ptFFF; }
};