From 4756a44dbde1cf471e4a1dc6ae7516539c9626a0 Mon Sep 17 00:00:00 2001 From: Eran Ifrah Date: Mon, 13 Jan 2025 01:25:15 +0200 Subject: [PATCH] Windows: find dialog: use monospaced font Signed-off-by: Eran Ifrah --- LiteEditor/quickfindbar.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/LiteEditor/quickfindbar.cpp b/LiteEditor/quickfindbar.cpp index aaf5df2a7a..b357370b16 100644 --- a/LiteEditor/quickfindbar.cpp +++ b/LiteEditor/quickfindbar.cpp @@ -25,6 +25,7 @@ ////////////////////////////////////////////////////////////////////////////// #include "quickfindbar.h" +#include "ColoursAndFontsManager.h" #include "Keyboard/clKeyboardManager.h" #include "bitmap_loader.h" #include "bookmark_manager.h" @@ -213,11 +214,24 @@ QuickFindBar::QuickFindBar(wxWindow* parent, wxWindowID id) m_highlightMatches = clConfig::Get().Read("FindBar/HighlightOccurences", false); SetBackgroundColour(clSystemSettings::GetDefaultPanelColour()); - EventNotifier::Get()->Bind(wxEVT_SYS_COLOURS_CHANGED, [this](clCommandEvent& e) { + +#ifdef __WXMSW__ + auto set_font_cb = [this]() { + auto lexer = ColoursAndFontsManager::Get().GetLexer("text"); + if (lexer) { + auto font = lexer->GetFontForStyle(0, this); + font.SetFractionalPointSize(font.GetFractionalPointSize() * 0.8); + m_textCtrlFind->SetFont(font); + m_textCtrlReplace->SetFont(font); + } + }; + set_font_cb(); + + EventNotifier::Get()->Bind(wxEVT_CMD_COLOURS_FONTS_UPDATED, [this, set_font_cb](clCommandEvent& e) { e.Skip(); - SetBackgroundColour(clSystemSettings::GetDefaultPanelColour()); - Refresh(); + set_font_cb(); }); +#endif EventNotifier::Get()->Bind(wxEVT_STC_GOT_FOCUS, &QuickFindBar::OnFocusGained, this); EventNotifier::Get()->Bind(wxEVT_STC_LOST_FOCUS, &QuickFindBar::OnFocusLost, this);