From 21e5350f900d91806ae0acdbf8ec4ff02ad282e1 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sat, 31 Aug 2024 15:00:11 +0200 Subject: [PATCH] Refactoring for Find dlg Status messge color --- .../src/ScintillaComponent/FindReplaceDlg.cpp | 26 ++++++++++++++----- .../src/ScintillaComponent/FindReplaceDlg.h | 5 ++++ PowerEditor/src/ScintillaComponent/colors.h | 1 - 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp index efd464dec207..513b4d2e105c 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp @@ -4953,20 +4953,20 @@ void FindReplaceDlg::combo2ExtendedMode(int comboID) void FindReplaceDlg::drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { //printStr(L"OK")); - COLORREF fgColor = RGB(0, 0, 0); // black by default + COLORREF fgColor = black; // black by default PCTSTR ptStr =(PCTSTR)lpDrawItemStruct->itemData; if (_statusbarFindStatus == FSNotFound) { - fgColor = RGB(0xFF, 00, 00); // red + fgColor = _FSNotFoundTextColor; } else if (_statusbarFindStatus == FSMessage) { - fgColor = RGB(0, 0, 0xFF); // blue + fgColor = _FSMessageTextColor; } else if (_statusbarFindStatus == FSTopReached || _statusbarFindStatus == FSEndReached) { - fgColor = RGB(0, 166, 0); // green + fgColor = _FSReachedTextColor; } else if (_statusbarFindStatus == FSNoMessage) { @@ -4979,15 +4979,27 @@ void FindReplaceDlg::drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) if (_statusbarFindStatus == FSNotFound) { - fgColor = RGB(0xFF, 0x50, 0x50); // red + HLSColour hls; + hls.changeHLSFrom(_FSNotFoundTextColor); + hls._lightness += 50; + hls._saturation -= 20; + fgColor = hls.toRGB(); // red } else if (_statusbarFindStatus == FSMessage) { - fgColor = RGB(0x70, 0x70, 0xFF); // blue + HLSColour hls; + hls.changeHLSFrom(_FSMessageTextColor); + hls._lightness += 50; + hls._saturation -= 20; + fgColor = hls.toRGB(); // blue } else if (_statusbarFindStatus == FSTopReached || _statusbarFindStatus == FSEndReached) { - fgColor = RGB(0x50, 0xFF, 0x50); // green + HLSColour hls; + hls.changeHLSFrom(_FSReachedTextColor); + hls._lightness += 50; + hls._saturation -= 20; + fgColor = hls.toRGB(); // green } } diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h index 05cef3caefd9..12709c1e6cfe 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h @@ -499,7 +499,12 @@ protected : static const int FR_OP_GLOBAL = 8; static const int FR_OP_FIP = 16; void saveInMacro(size_t cmd, int cmdType); + + COLORREF _FSNotFoundTextColor = red; + COLORREF _FSMessageTextColor = blue; + COLORREF _FSReachedTextColor = darkGreen; void drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); + bool replaceInFilesConfirmCheck(const std::wstring& directory, const std::wstring& fileTypes); bool replaceInProjectsConfirmCheck(); bool replaceInOpenDocsConfirmCheck(void); diff --git a/PowerEditor/src/ScintillaComponent/colors.h b/PowerEditor/src/ScintillaComponent/colors.h index e85407394901..ecf4153bc9d3 100644 --- a/PowerEditor/src/ScintillaComponent/colors.h +++ b/PowerEditor/src/ScintillaComponent/colors.h @@ -39,7 +39,6 @@ const COLORREF grey = RGB(128, 128, 128); const COLORREF liteGrey = RGB(192, 192, 192); const COLORREF veryLiteGrey = RGB(224, 224, 224); const COLORREF brown = RGB(128, 64, 0); -//const COLORREF greenBlue = RGB(192, 128, 64); const COLORREF darkYellow = RGB(0xFF, 0xC0, 0); const COLORREF yellow = RGB(0xFF, 0xFF, 0); const COLORREF lightYellow = RGB(0xFF, 0xFF, 0xD5);