From 534a2f5d33674bd477fc0b0a2aee6dc24ddad573 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Thu, 22 Oct 2020 13:02:17 +0200 Subject: [PATCH] Custom control : Fixed color of the colored label, associated with option, which doesn't have a corresponded field --- src/slic3r/GUI/OG_CustomCtrl.cpp | 19 +++++++++++-------- src/slic3r/GUI/OG_CustomCtrl.hpp | 1 - src/slic3r/GUI/OptionsGroup.hpp | 2 +- src/slic3r/GUI/Tab.cpp | 27 ++++++++++++++++++++++----- src/slic3r/GUI/Tab.hpp | 4 ++++ 5 files changed, 38 insertions(+), 15 deletions(-) diff --git a/src/slic3r/GUI/OG_CustomCtrl.cpp b/src/slic3r/GUI/OG_CustomCtrl.cpp index f66f07018..6f6bc98ef 100644 --- a/src/slic3r/GUI/OG_CustomCtrl.cpp +++ b/src/slic3r/GUI/OG_CustomCtrl.cpp @@ -32,7 +32,6 @@ OG_CustomCtrl::OG_CustomCtrl( wxWindow* parent, m_bmp_mode_expert = ScalableBitmap(this, "mode_expert" , wxOSX ? 10 : 12); m_bmp_blinking = ScalableBitmap(this, "search_blink"); - m_border = lround(0.2 * wxGetApp().em_unit()); m_v_gap = lround(1.0 * wxGetApp().em_unit()); m_h_gap = lround(0.2 * wxGetApp().em_unit()); @@ -115,7 +114,7 @@ wxPoint OG_CustomCtrl::get_pos(const Line& line, Field* field_in/* = nullptr*/) wxString label = line.label; if (m_og->label_width != 0 && !label.IsEmpty()) - h_pos += m_og->label_width * wxGetApp().em_unit(); + h_pos += m_og->label_width * wxGetApp().em_unit() + m_h_gap; if (line.widget) break; @@ -140,7 +139,9 @@ wxPoint OG_CustomCtrl::get_pos(const Line& line, Field* field_in/* = nullptr*/) _CTX(option.label, "Layers") : _(option.label); label += ":"; - h_pos += GetTextExtent(label).x + m_h_gap; + wxPaintDC dc(this); + dc.SetFont(m_font); + h_pos += dc.GetMultiLineTextExtent(label).x + m_h_gap; } h_pos += 3 * (m_bmp_blinking.bmp().GetWidth() + m_h_gap); @@ -153,7 +154,7 @@ wxPoint OG_CustomCtrl::get_pos(const Line& line, Field* field_in/* = nullptr*/) // add sidetext if any if (!option.sidetext.empty() || m_og->sidetext_width > 0) - h_pos += m_og->sidetext_width * wxGetApp().em_unit(); + h_pos += m_og->sidetext_width * wxGetApp().em_unit() + m_h_gap; if (opt.opt_id != option_set.back().opt_id) //! istead of (opt != option_set.back()) h_pos += lround(0.6 * wxGetApp().em_unit()); @@ -255,8 +256,10 @@ void OG_CustomCtrl::CtrlLine::render(wxDC& dc, wxCoord v_pos) const std::vector