Skip to content

Commit

Permalink
Windows: find dialog: use monospaced font
Browse files Browse the repository at this point in the history
Signed-off-by: Eran Ifrah <[email protected]>
  • Loading branch information
eranif committed Jan 12, 2025
1 parent c3e69a5 commit 4756a44
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions LiteEditor/quickfindbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
//////////////////////////////////////////////////////////////////////////////
#include "quickfindbar.h"

#include "ColoursAndFontsManager.h"
#include "Keyboard/clKeyboardManager.h"
#include "bitmap_loader.h"
#include "bookmark_manager.h"
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 4756a44

Please sign in to comment.