Merge branch 'master' of https://github.com/prusa3d/Slic3r into et_copy_and_paste

This commit is contained in:
Enrico Turri 2019-04-26 13:39:52 +02:00
commit e3b5885a3c
4 changed files with 34 additions and 8 deletions

View File

@ -505,6 +505,11 @@ void SpinCtrl::BUILD() {
else tmp_value = -9999; else tmp_value = -9999;
#ifdef __WXOSX__ #ifdef __WXOSX__
propagate_value(); 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<wxSpinCtrl*>(window)->SetValue(tmp_value);
#endif #endif
}), temp->GetId()); }), temp->GetId());

View File

@ -797,10 +797,15 @@ bool GLCanvas3D::WarningTexture::_generate(const std::string& msg_utf8, const GL
wxString msg = GUI::from_u8(msg_utf8); wxString msg = GUI::from_u8(msg_utf8);
wxMemoryDC memDC; wxMemoryDC memDC;
#ifdef __WXMSW__
// set scaled application normal font as default font
wxFont font = wxGetApp().normal_font();
#else
// select default font // select default font
const float scale = canvas.get_canvas_size().get_scale_factor(); const float scale = canvas.get_canvas_size().get_scale_factor();
// wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Scale(scale); wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Scale(scale);
wxFont font = wxGetApp().normal_font();//! #ys_FIXME_experiment #endif
font.MakeLarger(); font.MakeLarger();
font.MakeBold(); font.MakeBold();
@ -902,7 +907,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()) if (m_msg_text.empty())
return; return;
@ -979,14 +984,16 @@ bool GLCanvas3D::LegendTexture::generate(const GCodePreviewData& preview_data, c
const int scaled_square_contour = Px_Square_Contour * scale; const int scaled_square_contour = Px_Square_Contour * scale;
const int scaled_border = Px_Border * 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__ #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. // Disabling ClearType works, but the font returned is very different (much thicker) from the default.
// msw_disable_cleartype(font); // msw_disable_cleartype(font);
bool cleartype = is_font_cleartype(font); bool cleartype = is_font_cleartype(font);
#else #else
// select default font
wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Scale(scale_gl);
bool cleartype = false; bool cleartype = false;
#endif /* __WXMSW__ */ #endif /* __WXMSW__ */
@ -3293,7 +3300,7 @@ void GLCanvas3D::set_cursor(ECursorType type)
void GLCanvas3D::msw_rescale() void GLCanvas3D::msw_rescale()
{ {
m_warning_texture.rescale(*this); m_warning_texture.msw_rescale(*this);
} }
bool GLCanvas3D::_is_shown_on_screen() const bool GLCanvas3D::_is_shown_on_screen() const

View File

@ -353,7 +353,7 @@ class GLCanvas3D
void render(const GLCanvas3D& canvas) const; void render(const GLCanvas3D& canvas) const;
// function used to get an information for rescaling of the warning // function used to get an information for rescaling of the warning
void rescale(const GLCanvas3D& canvas); void msw_rescale(const GLCanvas3D& canvas);
private: private:
static const unsigned char Background_Color[3]; static const unsigned char Background_Color[3];

View File

@ -276,12 +276,26 @@ void MainFrame::on_dpi_changed(const wxRect &suggested_rect)
for (auto tab : wxGetApp().tabs_list) for (auto tab : wxGetApp().tabs_list)
tab->msw_rescale(); 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) /* To correct window rendering (especially redraw of a status bar)
* we should imitate window resizing. * we should imitate window resizing.
*/ */
const wxSize& sz = this->GetSize(); const wxSize& sz = this->GetSize();
this->SetSize(sz.x + 1, sz.y + 1); this->SetSize(sz.x + 1, sz.y + 1);
this->SetSize(sz); this->SetSize(sz);
this->Maximize(is_maximized);
} }
void MainFrame::init_menubar() void MainFrame::init_menubar()