From cf53604ae8899c3165d7d819979c981281505bff Mon Sep 17 00:00:00 2001 From: bubnikv Date: Mon, 18 Mar 2019 12:48:39 +0100 Subject: Moved the Fileds from the Page object to the respective OptionGroups for performance reasons. Disabled clearing of background for most of the static texts and Fields stored into OptionGrops. --- src/slic3r/GUI/Field.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/slic3r/GUI/Field.cpp') diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index dc0550b3b..c9eb9282e 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -36,7 +36,9 @@ void Field::PostInitialize() m_Undo_to_sys_btn = new MyButton(m_parent, wxID_ANY, "", wxDefaultPosition,wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER); if (wxMSW) { m_Undo_btn->SetBackgroundColour(color); + m_Undo_btn->SetBackgroundStyle(wxBG_STYLE_PAINT); m_Undo_to_sys_btn->SetBackgroundColour(color); + m_Undo_to_sys_btn->SetBackgroundStyle(wxBG_STYLE_PAINT); } m_Undo_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_back_to_initial_value(); })); m_Undo_to_sys_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_back_to_sys_value(); })); @@ -257,6 +259,7 @@ void TextCtrl::BUILD() { const long style = m_opt.multiline ? wxTE_MULTILINE : wxTE_PROCESS_ENTER/*0*/; auto temp = new wxTextCtrl(m_parent, wxID_ANY, text_value, wxDefaultPosition, size, style); + temp->SetBackgroundStyle(wxBG_STYLE_PAINT); #ifdef __WXOSX__ temp->OSXDisableAllSmartSubstitutions(); #endif // __WXOSX__ @@ -372,6 +375,7 @@ void CheckBox::BUILD() { false; auto temp = new wxCheckBox(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size); + temp->SetBackgroundStyle(wxBG_STYLE_PAINT); temp->SetValue(check_value); if (m_opt.readonly) temp->Disable(); @@ -429,6 +433,7 @@ void SpinCtrl::BUILD() { auto temp = new wxSpinCtrl(m_parent, wxID_ANY, text_value, wxDefaultPosition, size, 0|wxTE_PROCESS_ENTER, min_val, max_val, default_value); + temp->SetBackgroundStyle(wxBG_STYLE_PAINT); #ifndef __WXOSX__ // #ys_FIXME_KILL_FOCUS @@ -502,6 +507,7 @@ void Choice::BUILD() { temp = new wxComboBox(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size); else temp = new wxComboBox(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, NULL, wxCB_READONLY); + temp->SetBackgroundStyle(wxBG_STYLE_PAINT); // recast as a wxWindow to fit the calling convention window = dynamic_cast(temp); @@ -774,6 +780,7 @@ void ColourPicker::BUILD() } auto temp = new wxColourPickerCtrl(m_parent, wxID_ANY, clr, wxDefaultPosition, size); + temp->SetBackgroundStyle(wxBG_STYLE_PAINT); // // recast as a wxWindow to fit the calling convention window = dynamic_cast(temp); @@ -808,10 +815,17 @@ void PointCtrl::BUILD() x_textctrl = new wxTextCtrl(m_parent, wxID_ANY, X, wxDefaultPosition, field_size, wxTE_PROCESS_ENTER); y_textctrl = new wxTextCtrl(m_parent, wxID_ANY, Y, wxDefaultPosition, field_size, wxTE_PROCESS_ENTER); + x_textctrl->SetBackgroundStyle(wxBG_STYLE_PAINT); + y_textctrl->SetBackgroundStyle(wxBG_STYLE_PAINT); - temp->Add(new wxStaticText(m_parent, wxID_ANY, "x : "), 0, wxALIGN_CENTER_VERTICAL, 0); + auto static_text_x = new wxStaticText(m_parent, wxID_ANY, "x : "); + auto static_text_y = new wxStaticText(m_parent, wxID_ANY, " y : "); + static_text_x->SetBackgroundStyle(wxBG_STYLE_PAINT); + static_text_y->SetBackgroundStyle(wxBG_STYLE_PAINT); + + temp->Add(static_text_x, 0, wxALIGN_CENTER_VERTICAL, 0); temp->Add(x_textctrl); - temp->Add(new wxStaticText(m_parent, wxID_ANY, " y : "), 0, wxALIGN_CENTER_VERTICAL, 0); + temp->Add(static_text_y, 0, wxALIGN_CENTER_VERTICAL, 0); temp->Add(y_textctrl); // x_textctrl->Bind(wxEVT_TEXT, ([this](wxCommandEvent e) { on_change_field(); }), x_textctrl->GetId()); @@ -880,6 +894,7 @@ void StaticText::BUILD() const wxString legend(static_cast(m_opt.default_value)->value); auto temp = new wxStaticText(m_parent, wxID_ANY, legend, wxDefaultPosition, size, wxST_ELLIPSIZE_MIDDLE); + temp->SetBackgroundStyle(wxBG_STYLE_PAINT); temp->SetFont(wxGetApp().bold_font()); // // recast as a wxWindow to fit the calling convention @@ -903,10 +918,12 @@ void SliderCtrl::BUILD() m_slider = new wxSlider(m_parent, wxID_ANY, def_val * m_scale, min * m_scale, max * m_scale, wxDefaultPosition, size); + m_slider->SetBackgroundStyle(wxBG_STYLE_PAINT); wxSize field_size(40, -1); m_textctrl = new wxTextCtrl(m_parent, wxID_ANY, wxString::Format("%d", m_slider->GetValue()/m_scale), wxDefaultPosition, field_size); + m_textctrl->SetBackgroundStyle(wxBG_STYLE_PAINT); temp->Add(m_slider, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL, 0); temp->Add(m_textctrl, 0, wxALIGN_CENTER_VERTICAL, 0); -- cgit v1.2.3 From a90d5c8a286dc687dd1139351cbe5d18edadfc74 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Mon, 18 Mar 2019 20:54:01 +0100 Subject: Performance fix of rendering of the parameter tabs on Windows: Disabled Windows Vista themes for the wxNotebook. --- src/slic3r/GUI/Field.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/slic3r/GUI/Field.cpp') diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index c9eb9282e..f691a8065 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -259,7 +259,12 @@ void TextCtrl::BUILD() { const long style = m_opt.multiline ? wxTE_MULTILINE : wxTE_PROCESS_ENTER/*0*/; auto temp = new wxTextCtrl(m_parent, wxID_ANY, text_value, wxDefaultPosition, size, style); - temp->SetBackgroundStyle(wxBG_STYLE_PAINT); + temp->SetFont(Slic3r::GUI::wxGetApp().normal_font()); + + if (! m_opt.multiline) + // Only disable background refresh for single line input fields, as they are completely painted over by the edit control. + // This does not apply to the multi-line edit field, where the last line and a narrow frame around the text is not cleared. + temp->SetBackgroundStyle(wxBG_STYLE_PAINT); #ifdef __WXOSX__ temp->OSXDisableAllSmartSubstitutions(); #endif // __WXOSX__ @@ -375,6 +380,7 @@ void CheckBox::BUILD() { false; auto temp = new wxCheckBox(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size); + temp->SetFont(Slic3r::GUI::wxGetApp().normal_font()); temp->SetBackgroundStyle(wxBG_STYLE_PAINT); temp->SetValue(check_value); if (m_opt.readonly) temp->Disable(); @@ -433,6 +439,7 @@ void SpinCtrl::BUILD() { auto temp = new wxSpinCtrl(m_parent, wxID_ANY, text_value, wxDefaultPosition, size, 0|wxTE_PROCESS_ENTER, min_val, max_val, default_value); + temp->SetFont(Slic3r::GUI::wxGetApp().normal_font()); temp->SetBackgroundStyle(wxBG_STYLE_PAINT); #ifndef __WXOSX__ @@ -507,6 +514,7 @@ void Choice::BUILD() { temp = new wxComboBox(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size); else temp = new wxComboBox(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, NULL, wxCB_READONLY); + temp->SetFont(Slic3r::GUI::wxGetApp().normal_font()); temp->SetBackgroundStyle(wxBG_STYLE_PAINT); // recast as a wxWindow to fit the calling convention @@ -815,12 +823,16 @@ void PointCtrl::BUILD() x_textctrl = new wxTextCtrl(m_parent, wxID_ANY, X, wxDefaultPosition, field_size, wxTE_PROCESS_ENTER); y_textctrl = new wxTextCtrl(m_parent, wxID_ANY, Y, wxDefaultPosition, field_size, wxTE_PROCESS_ENTER); + x_textctrl->SetFont(Slic3r::GUI::wxGetApp().normal_font()); x_textctrl->SetBackgroundStyle(wxBG_STYLE_PAINT); + y_textctrl->SetFont(Slic3r::GUI::wxGetApp().normal_font()); y_textctrl->SetBackgroundStyle(wxBG_STYLE_PAINT); auto static_text_x = new wxStaticText(m_parent, wxID_ANY, "x : "); auto static_text_y = new wxStaticText(m_parent, wxID_ANY, " y : "); + static_text_x->SetFont(Slic3r::GUI::wxGetApp().normal_font()); static_text_x->SetBackgroundStyle(wxBG_STYLE_PAINT); + static_text_y->SetFont(Slic3r::GUI::wxGetApp().normal_font()); static_text_y->SetBackgroundStyle(wxBG_STYLE_PAINT); temp->Add(static_text_x, 0, wxALIGN_CENTER_VERTICAL, 0); @@ -894,6 +906,7 @@ void StaticText::BUILD() const wxString legend(static_cast(m_opt.default_value)->value); auto temp = new wxStaticText(m_parent, wxID_ANY, legend, wxDefaultPosition, size, wxST_ELLIPSIZE_MIDDLE); + temp->SetFont(Slic3r::GUI::wxGetApp().normal_font()); temp->SetBackgroundStyle(wxBG_STYLE_PAINT); temp->SetFont(wxGetApp().bold_font()); @@ -918,11 +931,13 @@ void SliderCtrl::BUILD() m_slider = new wxSlider(m_parent, wxID_ANY, def_val * m_scale, min * m_scale, max * m_scale, wxDefaultPosition, size); + m_slider->SetFont(Slic3r::GUI::wxGetApp().normal_font()); m_slider->SetBackgroundStyle(wxBG_STYLE_PAINT); wxSize field_size(40, -1); m_textctrl = new wxTextCtrl(m_parent, wxID_ANY, wxString::Format("%d", m_slider->GetValue()/m_scale), wxDefaultPosition, field_size); + m_textctrl->SetFont(Slic3r::GUI::wxGetApp().normal_font()); m_textctrl->SetBackgroundStyle(wxBG_STYLE_PAINT); temp->Add(m_slider, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL, 0); -- cgit v1.2.3