From 4918c4d6439ad317d5f6ce218503f6922a1d7fae Mon Sep 17 00:00:00 2001 From: tao wang Date: Thu, 13 Oct 2022 18:27:35 +0800 Subject: [PATCH] FIX:fixed some issues about text 1.part cooling cross the border 2.the text on the upper-right menu is not clear Change-Id: I41e07053d7a4b9d3dc574d380a1af7808362d276 --- src/slic3r/GUI/StatusPanel.cpp | 4 ++-- src/slic3r/GUI/Widgets/SideButton.cpp | 13 ++++++++----- src/slic3r/GUI/Widgets/SideButton.hpp | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/slic3r/GUI/StatusPanel.cpp b/src/slic3r/GUI/StatusPanel.cpp index 74342bc473..dea23ea1f9 100644 --- a/src/slic3r/GUI/StatusPanel.cpp +++ b/src/slic3r/GUI/StatusPanel.cpp @@ -742,7 +742,7 @@ wxBoxSizer *StatusBasePanel::create_misc_control(wxWindow *parent) m_switch_nozzle_fan->SetLabels(_L("Part Cooling"), _L("Part Cooling")); m_switch_nozzle_fan->SetPadding(FromDIP(3)); m_switch_nozzle_fan->SetBorderWidth(FromDIP(2)); - m_switch_nozzle_fan->SetFont(SWITCH_FONT); + m_switch_nozzle_fan->SetFont(::Label::Body_10); m_switch_nozzle_fan->SetTextColor(StateColor(std::make_pair(DISCONNECT_TEXT_COL, (int) StateColor::Disabled), std::make_pair(NORMAL_FAN_TEXT_COL, (int) StateColor::Normal))); line_sizer->Add(m_switch_nozzle_fan, 1, wxALIGN_CENTER | wxALL, 0); @@ -755,7 +755,7 @@ wxBoxSizer *StatusBasePanel::create_misc_control(wxWindow *parent) m_switch_printing_fan->SetMinSize(MISC_BUTTON_SIZE); m_switch_printing_fan->SetPadding(FromDIP(3)); m_switch_printing_fan->SetBorderWidth(FromDIP(2)); - m_switch_printing_fan->SetFont(SWITCH_FONT); + m_switch_printing_fan->SetFont(::Label::Body_10); m_switch_printing_fan->SetLabels(_L("Aux Cooling"), _L("Aux Cooling")); m_switch_printing_fan->SetTextColor( StateColor(std::make_pair(DISCONNECT_TEXT_COL, (int) StateColor::Disabled), std::make_pair(NORMAL_FAN_TEXT_COL, (int) StateColor::Normal))); diff --git a/src/slic3r/GUI/Widgets/SideButton.cpp b/src/slic3r/GUI/Widgets/SideButton.cpp index eb6b57e5d3..b69a42f2f3 100644 --- a/src/slic3r/GUI/Widgets/SideButton.cpp +++ b/src/slic3r/GUI/Widgets/SideButton.cpp @@ -171,7 +171,9 @@ void SideButton::paintEvent(wxPaintEvent& evt) #else wxDC & dc2(dc); #endif - render(dc2); + + wxDC & dctext(dc); + dorender(dc2, dctext); } /* @@ -179,7 +181,7 @@ void SideButton::paintEvent(wxPaintEvent& evt) * method so that it can work no matter what type of DC * (e.g. wxPaintDC or wxClientDC) is used. */ -void SideButton::render(wxDC& dc) +void SideButton::dorender(wxDC& dc, wxDC& text_dc) { wxSize size = GetSize(); @@ -266,9 +268,10 @@ void SideButton::render(wxDC& dc) auto text = GetLabel(); if (!text.IsEmpty()) { pt.y += (rcContent.height - textSize.y) / 2; - dc.SetFont(GetFont()); - dc.SetTextForeground(text_color.colorForStates(states)); - dc.DrawText(text, pt); + + text_dc.SetFont(GetFont()); + text_dc.SetTextForeground(text_color.colorForStates(states)); + text_dc.DrawText(text, pt); } } diff --git a/src/slic3r/GUI/Widgets/SideButton.hpp b/src/slic3r/GUI/Widgets/SideButton.hpp index b7b4fe03fe..4f8d893f93 100644 --- a/src/slic3r/GUI/Widgets/SideButton.hpp +++ b/src/slic3r/GUI/Widgets/SideButton.hpp @@ -79,7 +79,7 @@ private: void paintEvent(wxPaintEvent& evt); - void render(wxDC& dc); + void dorender(wxDC& dc, wxDC& text_dc); void messureSize();