From 6373ee2b85b757b3320f9290dce0ed1fdbe4f242 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Fri, 26 Apr 2019 12:29:34 +0200 Subject: [PATCH 1/3] Rescale under MSW : fixed rendering of MainFrame, if it was maximized during moving --- src/slic3r/GUI/MainFrame.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 5a63bedaa..571b57235 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -276,12 +276,26 @@ void MainFrame::on_dpi_changed(const wxRect &suggested_rect) for (auto tab : wxGetApp().tabs_list) tab->msw_rescale(); + // Workarounds for correct Window rendering after rescale + + /* Even if Window is maximized during moving, + * first of all we should imitate Window resizing. So: + * 1. cancel maximization, if it was set + * 2. imitate resizing + * 3. set maximization, if it was set + */ + const bool is_maximized = this->IsMaximized(); + if (is_maximized) + this->Maximize(false); + /* To correct window rendering (especially redraw of a status bar) * we should imitate window resizing. */ const wxSize& sz = this->GetSize(); this->SetSize(sz.x + 1, sz.y + 1); this->SetSize(sz); + + this->Maximize(is_maximized); } void MainFrame::init_menubar() From 046466164fb4989cb701e694feb3d188c0426bac Mon Sep 17 00:00:00 2001 From: YuSanka Date: Fri, 26 Apr 2019 13:05:43 +0200 Subject: [PATCH 2/3] OSX: Forced set the input value for SpinControl, since the value inserted from the clipboard is not updated --- src/slic3r/GUI/Field.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 88ed7a445..655a81ce4 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -505,6 +505,11 @@ void SpinCtrl::BUILD() { else tmp_value = -9999; #ifdef __WXOSX__ propagate_value(); + + // Forcibly set the input value for SpinControl, since the value + // inserted from the clipboard is not updated under OSX + if (tmp_value > -9999) + dynamic_cast(window)->SetValue(tmp_value); #endif }), temp->GetId()); From 127a78d953bcfcc5d617a42520eae9dc68db96ac Mon Sep 17 00:00:00 2001 From: YuSanka Date: Fri, 26 Apr 2019 13:07:31 +0200 Subject: [PATCH 3/3] Fixed default font for legends in respect to the OS --- src/slic3r/GUI/GLCanvas3D.cpp | 21 ++++++++++++++------- src/slic3r/GUI/GLCanvas3D.hpp | 2 +- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 649302341..bfa4a8ed6 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -794,10 +794,15 @@ bool GLCanvas3D::WarningTexture::_generate(const std::string& msg_utf8, const GL wxString msg = GUI::from_u8(msg_utf8); wxMemoryDC memDC; + +#ifdef __WXMSW__ + // set scaled application normal font as default font + wxFont font = wxGetApp().normal_font(); +#else // select default font const float scale = canvas.get_canvas_size().get_scale_factor(); -// wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Scale(scale); - wxFont font = wxGetApp().normal_font();//! #ys_FIXME_experiment + wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Scale(scale); +#endif font.MakeLarger(); font.MakeBold(); @@ -899,7 +904,7 @@ void GLCanvas3D::WarningTexture::render(const GLCanvas3D& canvas) const } } -void GLCanvas3D::WarningTexture::rescale(const GLCanvas3D& canvas) +void GLCanvas3D::WarningTexture::msw_rescale(const GLCanvas3D& canvas) { if (m_msg_text.empty()) return; @@ -976,14 +981,16 @@ bool GLCanvas3D::LegendTexture::generate(const GCodePreviewData& preview_data, c const int scaled_square_contour = Px_Square_Contour * scale; const int scaled_border = Px_Border * scale; - // select default font -// wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Scale(scale_gl); - wxFont font = wxGetApp().normal_font();//! #ys_FIXME_experiment #ifdef __WXMSW__ + // set scaled application normal font as default font + wxFont font = wxGetApp().normal_font(); + // Disabling ClearType works, but the font returned is very different (much thicker) from the default. // msw_disable_cleartype(font); bool cleartype = is_font_cleartype(font); #else + // select default font + wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Scale(scale_gl); bool cleartype = false; #endif /* __WXMSW__ */ @@ -3190,7 +3197,7 @@ double GLCanvas3D::get_size_proportional_to_max_bed_size(double factor) const void GLCanvas3D::msw_rescale() { - m_warning_texture.rescale(*this); + m_warning_texture.msw_rescale(*this); } bool GLCanvas3D::_is_shown_on_screen() const diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 45b5a58e7..8abc0378e 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -354,7 +354,7 @@ private: void render(const GLCanvas3D& canvas) const; // function used to get an information for rescaling of the warning - void rescale(const GLCanvas3D& canvas); + void msw_rescale(const GLCanvas3D& canvas); private: static const unsigned char Background_Color[3];