OSX specific, related to the wxWidgets 3.1.4: Fixed wrong UI-scaling

(wxWidgets 3.1.4 can binding of wxEVT_DPI_CHANGED now, so it was called msw_rescale() for most of the controls redundantly)

+ Fixed update of the DoubleSlider after changing of the system color
This commit is contained in:
YuSanka 2021-01-22 21:44:15 +01:00
parent eef800b5c4
commit 79b7ccbb79
7 changed files with 34 additions and 1 deletions

View File

@ -160,6 +160,26 @@ void Control::msw_rescale()
GetParent()->Layout();
}
void Control::sys_color_changed()
{
m_bmp_add_tick_on .msw_rescale();
m_bmp_add_tick_off.msw_rescale();
m_bmp_del_tick_on .msw_rescale();
m_bmp_del_tick_off.msw_rescale();
m_tick_icon_dim = m_bmp_add_tick_on.GetBmpWidth();
m_bmp_one_layer_lock_on .msw_rescale();
m_bmp_one_layer_lock_off .msw_rescale();
m_bmp_one_layer_unlock_on .msw_rescale();
m_bmp_one_layer_unlock_off.msw_rescale();
m_lock_icon_dim = m_bmp_one_layer_lock_on.GetBmpWidth();
m_bmp_revert.msw_rescale();
m_revert_icon_dim = m_bmp_revert.GetBmpWidth();
m_bmp_cog.msw_rescale();
m_cog_icon_dim = m_bmp_cog.GetBmpWidth();
}
int Control::GetActiveValue() const
{
return m_selection == ssLower ?

View File

@ -192,6 +192,7 @@ public:
~Control() {}
void msw_rescale();
void sys_color_changed();
int GetMinValue() const { return m_min_value; }
int GetMaxValue() const { return m_max_value; }

View File

@ -410,6 +410,12 @@ void Preview::msw_rescale()
refresh_print();
}
void Preview::sys_color_changed()
{
if (m_layers_slider != nullptr)
m_layers_slider->sys_color_changed();
}
void Preview::jump_layers_slider(wxKeyEvent& evt)
{
if (m_layers_slider) m_layers_slider->OnChar(evt);

View File

@ -150,6 +150,7 @@ public:
void refresh_print();
void msw_rescale();
void sys_color_changed();
void jump_layers_slider(wxKeyEvent& evt);
void move_layers_slider(wxKeyEvent& evt);
void edit_layers_slider(wxKeyEvent& evt);

View File

@ -108,6 +108,7 @@ public:
// recalc_font();
#ifndef __WXOSX__
#if wxVERSION_EQUAL_OR_GREATER_THAN(3,1,3)
this->Bind(wxEVT_DPI_CHANGED, [this](wxDPIChangedEvent& evt) {
m_scale_factor = (float)evt.GetNewDPI().x / (float)DPI_DEFAULT;
@ -128,6 +129,7 @@ public:
rescale(evt.rect);
});
#endif // wxVERSION_EQUAL_OR_GREATER_THAN
#endif // no __WXOSX__
this->Bind(wxEVT_MOVE_START, [this](wxMoveEvent& event)
{

View File

@ -360,6 +360,9 @@ void OG_CustomCtrl::correct_widgets_position(wxSizer* widget, const Line& line,
void OG_CustomCtrl::msw_rescale()
{
#ifdef __WXOSX__
return;
#endif
m_font = wxGetApp().normal_font();
m_em_unit = em_unit(m_parent);
m_v_gap = lround(1.0 * m_em_unit);
@ -381,7 +384,6 @@ void OG_CustomCtrl::msw_rescale()
void OG_CustomCtrl::sys_color_changed()
{
msw_rescale();
}
OG_CustomCtrl::CtrlLine::CtrlLine( wxCoord height,

View File

@ -6209,6 +6209,7 @@ void Plater::msw_rescale()
void Plater::sys_color_changed()
{
p->preview->sys_color_changed();
p->sidebar->sys_color_changed();
// msw_rescale_menu updates just icons, so use it