Tech ENABLE_LAYOUT_NO_RESTART set as default

This commit is contained in:
enricoturri1966 2020-08-03 11:08:17 +02:00
parent a29b00a0b4
commit 757572b760
6 changed files with 5 additions and 239 deletions

View file

@ -110,13 +110,8 @@ public:
if (!m_can_rescale)
return;
#if ENABLE_LAYOUT_NO_RESTART
if (m_force_rescale || is_new_scale_factor())
rescale(wxRect());
#else
if (is_new_scale_factor())
rescale(wxRect());
#endif // ENABLE_LAYOUT_NO_RESTART
});
#else
this->Bind(EVT_DPI_CHANGED_SLICER, [this](const DpiChangedEvent& evt) {
@ -127,13 +122,8 @@ public:
if (!m_can_rescale)
return;
#if ENABLE_LAYOUT_NO_RESTART
if (m_force_rescale || is_new_scale_factor())
rescale(evt.rect);
#else
if (is_new_scale_factor())
rescale(evt.rect);
#endif // ENABLE_LAYOUT_NO_RESTART
});
#endif // wxVERSION_EQUAL_OR_GREATER_THAN
@ -175,9 +165,7 @@ public:
int em_unit() const { return m_em_unit; }
// int font_size() const { return m_font_size; }
const wxFont& normal_font() const { return m_normal_font; }
#if ENABLE_LAYOUT_NO_RESTART
void enable_force_rescale() { m_force_rescale = true; }
#endif // ENABLE_LAYOUT_NO_RESTART
protected:
virtual void on_dpi_changed(const wxRect &suggested_rect) = 0;
@ -191,9 +179,7 @@ private:
wxFont m_normal_font;
float m_prev_scale_factor;
bool m_can_rescale{ true };
#if ENABLE_LAYOUT_NO_RESTART
bool m_force_rescale{ false };
#endif // ENABLE_LAYOUT_NO_RESTART
int m_new_font_point_size;
@ -233,17 +219,17 @@ private:
{
this->Freeze();
#if ENABLE_LAYOUT_NO_RESTART && wxVERSION_EQUAL_OR_GREATER_THAN(3,1,3)
#if wxVERSION_EQUAL_OR_GREATER_THAN(3,1,3)
if (m_force_rescale) {
#endif // ENABLE_LAYOUT_NO_RESTART
#endif // wxVERSION_EQUAL_OR_GREATER_THAN
// rescale fonts of all controls
scale_controls_fonts(this, m_new_font_point_size);
// rescale current window font
scale_win_font(this, m_new_font_point_size);
#if ENABLE_LAYOUT_NO_RESTART && wxVERSION_EQUAL_OR_GREATER_THAN(3,1,3)
#if wxVERSION_EQUAL_OR_GREATER_THAN(3,1,3)
m_force_rescale = false;
}
#endif // ENABLE_LAYOUT_NO_RESTART
#endif // wxVERSION_EQUAL_OR_GREATER_THAN
// set normal application font as a current window font
m_normal_font = this->GetFont();