From cd4ad5e78b7b3477b589de13b40a2c945e01aaec Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Sun, 13 Sep 2020 02:19:36 +0200 Subject: [PATCH] Introduce ConfigOptionDef::is_code to select code_font() --- src/libslic3r/Config.hpp | 2 ++ src/slic3r/GUI/Field.cpp | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/Config.hpp b/src/libslic3r/Config.hpp index 87e020898..c6b7c7728 100644 --- a/src/libslic3r/Config.hpp +++ b/src/libslic3r/Config.hpp @@ -1413,6 +1413,8 @@ public: bool multiline = false; // For text input: If true, the GUI text box spans the complete page width. bool full_width = false; + // For text input: If true, the GUI formats text as code (fixed-width) + bool is_code = false; // Not editable. Currently only used for the display of the number of threads. bool readonly = false; // Height of a multiline GUI text box. diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index a21826205..44bb22e8d 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -373,7 +373,9 @@ 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->SetFont(Slic3r::GUI::wxGetApp().normal_font()); + temp->SetFont(m_opt.is_code ? + Slic3r::GUI::wxGetApp().code_font(): + Slic3r::GUI::wxGetApp().normal_font()); if (! m_opt.multiline && !wxOSX) // Only disable background refresh for single line input fields, as they are completely painted over by the edit control.