From a866900c8d3c16bf354144f6e7f91027bb3567eb Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sun, 1 Sep 2024 20:37:31 +0200 Subject: [PATCH] Make find dlg status msgs color customizable via Style Configurator Fix #5087, close #15597 --- PowerEditor/installer/themes/Bespin.xml | 3 + PowerEditor/installer/themes/Black board.xml | 3 + PowerEditor/installer/themes/Choco.xml | 3 + .../installer/themes/DansLeRuSH-Dark.xml | 3 + .../installer/themes/DarkModeDefault.xml | 3 + PowerEditor/installer/themes/Deep Black.xml | 3 + PowerEditor/installer/themes/Hello Kitty.xml | 3 + .../installer/themes/HotFudgeSundae.xml | 3 + .../installer/themes/Mono Industrial.xml | 3 + PowerEditor/installer/themes/Monokai.xml | 3 + PowerEditor/installer/themes/MossyLawn.xml | 3 + PowerEditor/installer/themes/Navajo.xml | 3 + PowerEditor/installer/themes/Obsidian.xml | 3 + .../installer/themes/Plastic Code Wrap.xml | 3 + PowerEditor/installer/themes/Ruby Blue.xml | 3 + .../installer/themes/Solarized-light.xml | 3 + PowerEditor/installer/themes/Solarized.xml | 3 + PowerEditor/installer/themes/Twilight.xml | 3 + PowerEditor/installer/themes/Vibrant Ink.xml | 3 + PowerEditor/installer/themes/Zenburn.xml | 3 + PowerEditor/installer/themes/khaki.xml | 3 + .../installer/themes/vim Dark Blue.xml | 3 + PowerEditor/src/Notepad_plus.cpp | 2 +- PowerEditor/src/NppBigSwitch.cpp | 2 + PowerEditor/src/NppNotification.cpp | 2 +- PowerEditor/src/Parameters.cpp | 88 ++++++++++++++----- PowerEditor/src/Parameters.h | 29 ++++-- .../src/ScintillaComponent/FindReplaceDlg.cpp | 30 +++---- .../src/ScintillaComponent/FindReplaceDlg.h | 5 -- .../WinControls/ColourPicker/WordStyleDlg.cpp | 59 ++++++++++--- .../WinControls/ColourPicker/WordStyleDlg.h | 13 ++- PowerEditor/src/WinControls/TabBar/TabBar.cpp | 4 +- .../VerticalFileSwitcher.cpp | 2 +- PowerEditor/src/stylers.model.xml | 3 + 34 files changed, 228 insertions(+), 77 deletions(-) diff --git a/PowerEditor/installer/themes/Bespin.xml b/PowerEditor/installer/themes/Bespin.xml index b99e3674804f..f0670605ce2e 100644 --- a/PowerEditor/installer/themes/Bespin.xml +++ b/PowerEditor/installer/themes/Bespin.xml @@ -1008,6 +1008,9 @@ Credits: + + + diff --git a/PowerEditor/installer/themes/Black board.xml b/PowerEditor/installer/themes/Black board.xml index 626ed242959b..f8cef4452c24 100644 --- a/PowerEditor/installer/themes/Black board.xml +++ b/PowerEditor/installer/themes/Black board.xml @@ -1006,6 +1006,9 @@ Credits: + + + diff --git a/PowerEditor/installer/themes/Choco.xml b/PowerEditor/installer/themes/Choco.xml index e2fd25796d48..d1ee9968a2c5 100644 --- a/PowerEditor/installer/themes/Choco.xml +++ b/PowerEditor/installer/themes/Choco.xml @@ -998,6 +998,9 @@ Credits: + + + diff --git a/PowerEditor/installer/themes/DansLeRuSH-Dark.xml b/PowerEditor/installer/themes/DansLeRuSH-Dark.xml index 0867910eb444..08826550a17b 100644 --- a/PowerEditor/installer/themes/DansLeRuSH-Dark.xml +++ b/PowerEditor/installer/themes/DansLeRuSH-Dark.xml @@ -1117,6 +1117,9 @@ Installation : Copy this file to "%APPDATA%\Notepad++\themes" and in a portable + + + diff --git a/PowerEditor/installer/themes/DarkModeDefault.xml b/PowerEditor/installer/themes/DarkModeDefault.xml index 70ffbd65c970..3237722ceb4d 100644 --- a/PowerEditor/installer/themes/DarkModeDefault.xml +++ b/PowerEditor/installer/themes/DarkModeDefault.xml @@ -1730,6 +1730,9 @@ License: GPL2 + + + diff --git a/PowerEditor/installer/themes/Deep Black.xml b/PowerEditor/installer/themes/Deep Black.xml index 89c855a62ada..0546a754de84 100644 --- a/PowerEditor/installer/themes/Deep Black.xml +++ b/PowerEditor/installer/themes/Deep Black.xml @@ -1003,6 +1003,9 @@ https://notepad-plus-plus.org/donate/ + + + diff --git a/PowerEditor/installer/themes/Hello Kitty.xml b/PowerEditor/installer/themes/Hello Kitty.xml index 1dee0f5512bc..a16c05d11a39 100644 --- a/PowerEditor/installer/themes/Hello Kitty.xml +++ b/PowerEditor/installer/themes/Hello Kitty.xml @@ -975,6 +975,9 @@ so your enhanced file can be included in Notepad++ future release. + + + diff --git a/PowerEditor/installer/themes/HotFudgeSundae.xml b/PowerEditor/installer/themes/HotFudgeSundae.xml index db56c7b2e732..9352bab1bb90 100644 --- a/PowerEditor/installer/themes/HotFudgeSundae.xml +++ b/PowerEditor/installer/themes/HotFudgeSundae.xml @@ -1132,6 +1132,9 @@ Installation: + + + diff --git a/PowerEditor/installer/themes/Mono Industrial.xml b/PowerEditor/installer/themes/Mono Industrial.xml index b2dd2656ae80..364ce470dbe3 100644 --- a/PowerEditor/installer/themes/Mono Industrial.xml +++ b/PowerEditor/installer/themes/Mono Industrial.xml @@ -1002,6 +1002,9 @@ Credits: + + + diff --git a/PowerEditor/installer/themes/Monokai.xml b/PowerEditor/installer/themes/Monokai.xml index bd8ae2de2a10..7505bfd29194 100644 --- a/PowerEditor/installer/themes/Monokai.xml +++ b/PowerEditor/installer/themes/Monokai.xml @@ -1018,6 +1018,9 @@ Credits: + + + diff --git a/PowerEditor/installer/themes/MossyLawn.xml b/PowerEditor/installer/themes/MossyLawn.xml index 74b1f8de0933..395c9d723ecd 100644 --- a/PowerEditor/installer/themes/MossyLawn.xml +++ b/PowerEditor/installer/themes/MossyLawn.xml @@ -1132,6 +1132,9 @@ Installation: + + + diff --git a/PowerEditor/installer/themes/Navajo.xml b/PowerEditor/installer/themes/Navajo.xml index 07d69251e92b..6a1586b154db 100644 --- a/PowerEditor/installer/themes/Navajo.xml +++ b/PowerEditor/installer/themes/Navajo.xml @@ -1129,6 +1129,9 @@ Installation: + + + diff --git a/PowerEditor/installer/themes/Obsidian.xml b/PowerEditor/installer/themes/Obsidian.xml index 19598c5c5a24..77472897b200 100644 --- a/PowerEditor/installer/themes/Obsidian.xml +++ b/PowerEditor/installer/themes/Obsidian.xml @@ -1006,6 +1006,9 @@ Notepad++ Custom Style + + + diff --git a/PowerEditor/installer/themes/Plastic Code Wrap.xml b/PowerEditor/installer/themes/Plastic Code Wrap.xml index dcabfc602bb1..ef165ec5eceb 100644 --- a/PowerEditor/installer/themes/Plastic Code Wrap.xml +++ b/PowerEditor/installer/themes/Plastic Code Wrap.xml @@ -1014,6 +1014,9 @@ Credits: + + + diff --git a/PowerEditor/installer/themes/Ruby Blue.xml b/PowerEditor/installer/themes/Ruby Blue.xml index 497567e485b3..80fcdb0a18dc 100644 --- a/PowerEditor/installer/themes/Ruby Blue.xml +++ b/PowerEditor/installer/themes/Ruby Blue.xml @@ -852,6 +852,9 @@ http://sourceforge.net/donate/index.php?group_id=95717 + + + diff --git a/PowerEditor/installer/themes/Solarized-light.xml b/PowerEditor/installer/themes/Solarized-light.xml index 5de556cc38ac..8000b2d2b2f8 100644 --- a/PowerEditor/installer/themes/Solarized-light.xml +++ b/PowerEditor/installer/themes/Solarized-light.xml @@ -1140,6 +1140,9 @@ Installation: + + + diff --git a/PowerEditor/installer/themes/Solarized.xml b/PowerEditor/installer/themes/Solarized.xml index ba5c21db2c72..5b2537a1b8ed 100644 --- a/PowerEditor/installer/themes/Solarized.xml +++ b/PowerEditor/installer/themes/Solarized.xml @@ -1530,6 +1530,9 @@ Installation: + + + diff --git a/PowerEditor/installer/themes/Twilight.xml b/PowerEditor/installer/themes/Twilight.xml index 89373521a300..2b709b9d33d8 100644 --- a/PowerEditor/installer/themes/Twilight.xml +++ b/PowerEditor/installer/themes/Twilight.xml @@ -1003,6 +1003,9 @@ Credits: + + + diff --git a/PowerEditor/installer/themes/Vibrant Ink.xml b/PowerEditor/installer/themes/Vibrant Ink.xml index 1b4ce3874f65..b1bcfe41d534 100644 --- a/PowerEditor/installer/themes/Vibrant Ink.xml +++ b/PowerEditor/installer/themes/Vibrant Ink.xml @@ -974,6 +974,9 @@ http://sourceforge.net/donate/index.php?group_id=95717 + + + diff --git a/PowerEditor/installer/themes/Zenburn.xml b/PowerEditor/installer/themes/Zenburn.xml index 171df63ee00a..e61d36cee9d7 100644 --- a/PowerEditor/installer/themes/Zenburn.xml +++ b/PowerEditor/installer/themes/Zenburn.xml @@ -1698,6 +1698,9 @@ License: GPL2 + + + diff --git a/PowerEditor/installer/themes/khaki.xml b/PowerEditor/installer/themes/khaki.xml index 5e1164636d5a..570118f2436a 100644 --- a/PowerEditor/installer/themes/khaki.xml +++ b/PowerEditor/installer/themes/khaki.xml @@ -1129,6 +1129,9 @@ Installation: + + + diff --git a/PowerEditor/installer/themes/vim Dark Blue.xml b/PowerEditor/installer/themes/vim Dark Blue.xml index 3a731e4ea0c0..637d9f509320 100644 --- a/PowerEditor/installer/themes/vim Dark Blue.xml +++ b/PowerEditor/installer/themes/vim Dark Blue.xml @@ -966,6 +966,9 @@ + + + diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index b025ebb3c441..4ef057bb7526 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -2715,7 +2715,7 @@ void Notepad_plus::setupColorSampleBitmapsOnMainMenuItems() // Adds tab colour icons for (int i = 0; i < 5; ++i) { - COLORREF colour = nppParam.getIndividualTabColour(i, NppDarkMode::isDarkMenuEnabled(), true); + COLORREF colour = nppParam.getIndividualTabColor(i, NppDarkMode::isDarkMenuEnabled(), true); HBITMAP hBitmap = generateSolidColourMenuItemIcon(colour); SetMenuItemBitmaps(_mainMenuHandle, IDM_VIEW_TAB_COLOUR_1 + i, MF_BYCOMMAND, hBitmap, hBitmap); } diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index fca99bfd70fb..3d619df5561e 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -2308,6 +2308,8 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa addHotSpot(& _subEditView); _findReplaceDlg.updateFinderScintilla(); + + _findReplaceDlg.redraw(); drawTabbarColoursFromStylerArray(); diff --git a/PowerEditor/src/NppNotification.cpp b/PowerEditor/src/NppNotification.cpp index a263b008f9d3..be4b697a8699 100644 --- a/PowerEditor/src/NppNotification.cpp +++ b/PowerEditor/src/NppNotification.cpp @@ -581,7 +581,7 @@ BOOL Notepad_plus::notify(SCNotification *notification) // Adds colour icons for (int i = 0; i < 5; ++i) { - COLORREF colour = nppParam.getIndividualTabColour(i, NppDarkMode::isDarkMenuEnabled(), true); + COLORREF colour = nppParam.getIndividualTabColor(i, NppDarkMode::isDarkMenuEnabled(), true); HBITMAP hBitmap = generateSolidColourMenuItemIcon(colour); SetMenuItemBitmaps(_tabPopupMenu.getMenuHandle(), IDM_VIEW_TAB_COLOUR_1 + i, MF_BYCOMMAND, hBitmap, hBitmap); } diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 20603100df97..a7fdb5c74f43 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -8833,82 +8833,82 @@ void NppParameters::initTabCustomColors() { StyleArray& stylers = getMiscStylerArray(); - const Style* pStyle = stylers.findByName(L"Tab color 1"); + const Style* pStyle = stylers.findByName(TABBAR_INDIVIDUALCOLOR_1); if (pStyle) { - individualTabHues[0].changeHLSFrom(pStyle->_bgColor); + individualTabHues[0].loadFromRGB(pStyle->_bgColor); } - pStyle = stylers.findByName(L"Tab color 2"); + pStyle = stylers.findByName(TABBAR_INDIVIDUALCOLOR_2); if (pStyle) { - individualTabHues[1].changeHLSFrom(pStyle->_bgColor); + individualTabHues[1].loadFromRGB(pStyle->_bgColor); } - pStyle = stylers.findByName(L"Tab color 3"); + pStyle = stylers.findByName(TABBAR_INDIVIDUALCOLOR_3); if (pStyle) { - individualTabHues[2].changeHLSFrom(pStyle->_bgColor); + individualTabHues[2].loadFromRGB(pStyle->_bgColor); } - pStyle = stylers.findByName(L"Tab color 4"); + pStyle = stylers.findByName(TABBAR_INDIVIDUALCOLOR_4); if (pStyle) { - individualTabHues[3].changeHLSFrom(pStyle->_bgColor); + individualTabHues[3].loadFromRGB(pStyle->_bgColor); } - pStyle = stylers.findByName(L"Tab color 5"); + pStyle = stylers.findByName(TABBAR_INDIVIDUALCOLOR_5); if (pStyle) { - individualTabHues[4].changeHLSFrom(pStyle->_bgColor); + individualTabHues[4].loadFromRGB(pStyle->_bgColor); } - pStyle = stylers.findByName(L"Tab color dark mode 1"); + pStyle = stylers.findByName(TABBAR_INDIVIDUALCOLOR_DM_1); if (pStyle) { - individualTabHuesFor_Dark[0].changeHLSFrom(pStyle->_bgColor); + individualTabHuesFor_Dark[0].loadFromRGB(pStyle->_bgColor); } - pStyle = stylers.findByName(L"Tab color dark mode 2"); + pStyle = stylers.findByName(TABBAR_INDIVIDUALCOLOR_DM_2); if (pStyle) { - individualTabHuesFor_Dark[1].changeHLSFrom(pStyle->_bgColor); + individualTabHuesFor_Dark[1].loadFromRGB(pStyle->_bgColor); } - pStyle = stylers.findByName(L"Tab color dark mode 3"); + pStyle = stylers.findByName(TABBAR_INDIVIDUALCOLOR_DM_3); if (pStyle) { - individualTabHuesFor_Dark[2].changeHLSFrom(pStyle->_bgColor); + individualTabHuesFor_Dark[2].loadFromRGB(pStyle->_bgColor); } - pStyle = stylers.findByName(L"Tab color dark mode 4"); + pStyle = stylers.findByName(TABBAR_INDIVIDUALCOLOR_DM_4); if (pStyle) { - individualTabHuesFor_Dark[3].changeHLSFrom(pStyle->_bgColor); + individualTabHuesFor_Dark[3].loadFromRGB(pStyle->_bgColor); } - pStyle = stylers.findByName(L"Tab color dark mode 5"); + pStyle = stylers.findByName(TABBAR_INDIVIDUALCOLOR_DM_5); if (pStyle) { - individualTabHuesFor_Dark[4].changeHLSFrom(pStyle->_bgColor); + individualTabHuesFor_Dark[4].loadFromRGB(pStyle->_bgColor); } } -void NppParameters::setIndividualTabColour(COLORREF colour2Set, int colourIndex, bool isDarkMode) +void NppParameters::setIndividualTabColor(COLORREF colour2Set, int colourIndex, bool isDarkMode) { if (colourIndex < 0 || colourIndex > 4) return; if (isDarkMode) - individualTabHuesFor_Dark[colourIndex].changeHLSFrom(colour2Set); + individualTabHuesFor_Dark[colourIndex].loadFromRGB(colour2Set); else - individualTabHues[colourIndex].changeHLSFrom(colour2Set); + individualTabHues[colourIndex].loadFromRGB(colour2Set); return; } -COLORREF NppParameters::getIndividualTabColour(int colourIndex, bool isDarkMode, bool saturated) +COLORREF NppParameters::getIndividualTabColor(int colourIndex, bool isDarkMode, bool saturated) { if (colourIndex < 0 || colourIndex > 4) return {}; @@ -8936,3 +8936,43 @@ COLORREF NppParameters::getIndividualTabColour(int colourIndex, bool isDarkMode, return result.toRGB(); } + +void NppParameters::initFindDlgStatusMsgCustomColors() +{ + StyleArray& stylers = getMiscStylerArray(); + + const Style* pStyle = stylers.findByName(FINDDLG_STAUSNOTFOUND_COLOR); + if (pStyle) + { + findDlgStatusMessageColor[0] = pStyle->_fgColor; + } + + pStyle = stylers.findByName(FINDDLG_STAUSMESSAGE_COLOR); + if (pStyle) + { + findDlgStatusMessageColor[1] = pStyle->_fgColor; + } + + pStyle = stylers.findByName(FINDDLG_STAUSREACHED_COLOR); + if (pStyle) + { + findDlgStatusMessageColor[2] = pStyle->_fgColor; + } + +} + +void NppParameters::setFindDlgStatusMsgIndexColor(COLORREF colour2Set, int colourIndex) +{ + if (colourIndex < 0 || colourIndex > 2) return; + + findDlgStatusMessageColor[colourIndex] = colour2Set; + + return; +} + +COLORREF NppParameters::getFindDlgStatusMsgColor(int colourIndex) +{ + if (colourIndex < 0 || colourIndex > 2) return black; + + return findDlgStatusMessageColor[colourIndex]; +} diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index 6fa1adfd2ab1..c659a0f13a69 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -1390,12 +1390,23 @@ friend class NppParameters; struct HLSColour { - WORD _hue; - WORD _lightness; - WORD _saturation; + WORD _hue = 0; + WORD _lightness = 0; + WORD _saturation = 0; - void changeHLSFrom(COLORREF rgb) { ColorRGBToHLS(rgb, &_hue, &_lightness, &_saturation); } + HLSColour() = default; + HLSColour(WORD hue, WORD lightness, WORD saturation): _hue(hue), _lightness(lightness), _saturation(saturation) {} + HLSColour(COLORREF rgb) { ColorRGBToHLS(rgb, &_hue, &_lightness, &_saturation); } + + void loadFromRGB(COLORREF rgb) { ColorRGBToHLS(rgb, &_hue, &_lightness, &_saturation); } COLORREF toRGB() const { return ColorHLSToRGB(_hue, _lightness, _saturation); } + + COLORREF toRGB4DarkModWithTuning(int lightnessMore, int saturationLess) const { + return ColorHLSToRGB(_hue, + static_cast(static_cast(_lightness) + lightnessMore), + static_cast(static_cast(_saturation) - saturationLess)); + } + COLORREF toRGB4DarkMod() const { return toRGB4DarkModWithTuning(50, 20); } }; struct UdlXmlFileState final { @@ -1919,6 +1930,8 @@ class NppParameters final std::array individualTabHuesFor_Dark{ { HLSColour{37, 60, 60}, HLSColour{70, 60, 60}, HLSColour{144, 70, 60}, HLSColour{255, 60, 60}, HLSColour{195, 60, 60} } }; std::array individualTabHues{ { HLSColour{37, 210, 150}, HLSColour{70, 210, 150}, HLSColour{144, 210, 150}, HLSColour{255, 210, 150}, HLSColour{195, 210, 150}} }; + std::array findDlgStatusMessageColor{ red, blue, darkGreen}; + public: void setShortcutDirty() { _isAnyShortcutModified = true; }; void setAdminMode(bool isAdmin) { _isAdminMode = isAdmin; } @@ -2027,8 +2040,12 @@ class NppParameters final void initTabCustomColors(); - void setIndividualTabColour(COLORREF colour2Set, int colourIndex, bool isDarkMode); - COLORREF getIndividualTabColour(int colourIndex, bool isDarkMode, bool saturated); + void setIndividualTabColor(COLORREF colour2Set, int colourIndex, bool isDarkMode); + COLORREF getIndividualTabColor(int colourIndex, bool isDarkMode, bool saturated); + + void initFindDlgStatusMsgCustomColors(); + void setFindDlgStatusMsgIndexColor(COLORREF colour2Set, int colourIndex); + COLORREF getFindDlgStatusMsgColor(int colourIndex); private: void getLangKeywordsFromXmlTree(); diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp index 513b4d2e105c..1daf275ae058 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp @@ -4955,18 +4955,19 @@ void FindReplaceDlg::drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) //printStr(L"OK")); COLORREF fgColor = black; // black by default PCTSTR ptStr =(PCTSTR)lpDrawItemStruct->itemData; - + NppParameters& nppParamInst = NppParameters::getInstance(); + if (_statusbarFindStatus == FSNotFound) { - fgColor = _FSNotFoundTextColor; + fgColor = nppParamInst.getFindDlgStatusMsgColor(0); } else if (_statusbarFindStatus == FSMessage) { - fgColor = _FSMessageTextColor; + fgColor = nppParamInst.getFindDlgStatusMsgColor(1); } else if (_statusbarFindStatus == FSTopReached || _statusbarFindStatus == FSEndReached) { - fgColor = _FSReachedTextColor; + fgColor = nppParamInst.getFindDlgStatusMsgColor(2); } else if (_statusbarFindStatus == FSNoMessage) { @@ -4979,27 +4980,18 @@ void FindReplaceDlg::drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) if (_statusbarFindStatus == FSNotFound) { - HLSColour hls; - hls.changeHLSFrom(_FSNotFoundTextColor); - hls._lightness += 50; - hls._saturation -= 20; - fgColor = hls.toRGB(); // red + HLSColour hls(nppParamInst.getFindDlgStatusMsgColor(0)); + fgColor = hls.toRGB4DarkMod(); } else if (_statusbarFindStatus == FSMessage) { - HLSColour hls; - hls.changeHLSFrom(_FSMessageTextColor); - hls._lightness += 50; - hls._saturation -= 20; - fgColor = hls.toRGB(); // blue + HLSColour hls(nppParamInst.getFindDlgStatusMsgColor(1)); + fgColor = hls.toRGB4DarkMod(); } else if (_statusbarFindStatus == FSTopReached || _statusbarFindStatus == FSEndReached) { - HLSColour hls; - hls.changeHLSFrom(_FSReachedTextColor); - hls._lightness += 50; - hls._saturation -= 20; - fgColor = hls.toRGB(); // green + HLSColour hls(nppParamInst.getFindDlgStatusMsgColor(2)); + fgColor = hls.toRGB4DarkMod(); } } diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h index 12709c1e6cfe..05cef3caefd9 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h @@ -499,12 +499,7 @@ 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/WinControls/ColourPicker/WordStyleDlg.cpp b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp index da20190081ad..01d96832dae4 100644 --- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp +++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp @@ -360,6 +360,7 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM restoreGlobalOverrideValues(); nppParamInst.initTabCustomColors(); + nppParamInst.initFindDlgStatusMsgCustomColors(); _restoreInvalid = false; _isDirty = false; @@ -540,9 +541,18 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM { TabBarPlus::setColour(_pFgColour->getColour(), (TabBarPlus::tabColourIndex)tabColourIndex, nullptr); } - else if (isDocumentMapStyle()) + else { - ViewZoneDlg::setColour(_pFgColour->getColour(), ViewZoneDlg::ViewZoneColorIndex::focus); + int findDlgStatusMsgIndex = whichFindDlgStatusMsgColourIndex(); + if (findDlgStatusMsgIndex != -1) + { + NppParameters& nppParamInst = NppParameters::getInstance(); + nppParamInst.setFindDlgStatusMsgIndexColor(_pFgColour->getColour(), findDlgStatusMsgIndex); + } + else if (isDocumentMapStyle()) + { + ViewZoneDlg::setColour(_pFgColour->getColour(), ViewZoneDlg::ViewZoneColorIndex::focus); + } } apply(applicationInfo); return TRUE; @@ -572,7 +582,7 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM colourIndex -= TabBarPlus::individualTabColourId::id5; NppParameters& nppParamInst = NppParameters::getInstance(); - nppParamInst.setIndividualTabColour(_pBgColour->getColour(), colourIndex, NppDarkMode::isEnabled()); + nppParamInst.setIndividualTabColor(_pBgColour->getColour(), colourIndex, NppDarkMode::isEnabled()); } } @@ -675,20 +685,19 @@ int WordStyleDlg::getApplicationInfo() const (lstrcmp(styleName, L"Mark Style 3") == 0) || (lstrcmp(styleName, L"Mark Style 4") == 0) || (lstrcmp(styleName, L"Mark Style 5") == 0) || - (lstrcmp(styleName, L"Tab color 1") == 0) || - (lstrcmp(styleName, L"Tab color 2") == 0) || - (lstrcmp(styleName, L"Tab color 3") == 0) || - (lstrcmp(styleName, L"Tab color 4") == 0) || - (lstrcmp(styleName, L"Tab color 5") == 0) || - (lstrcmp(styleName, L"Tab color dark mode 1") == 0) || - (lstrcmp(styleName, L"Tab color dark mode 2") == 0) || - (lstrcmp(styleName, L"Tab color dark mode 3") == 0) || - (lstrcmp(styleName, L"Tab color dark mode 4") == 0) || - (lstrcmp(styleName, L"Tab color dark mode 5") == 0)) + (lstrcmp(styleName, TABBAR_INDIVIDUALCOLOR_1) == 0) || + (lstrcmp(styleName, TABBAR_INDIVIDUALCOLOR_2) == 0) || + (lstrcmp(styleName, TABBAR_INDIVIDUALCOLOR_3) == 0) || + (lstrcmp(styleName, TABBAR_INDIVIDUALCOLOR_4) == 0) || + (lstrcmp(styleName, TABBAR_INDIVIDUALCOLOR_5) == 0) || + (lstrcmp(styleName, TABBAR_INDIVIDUALCOLOR_DM_1) == 0) || + (lstrcmp(styleName, TABBAR_INDIVIDUALCOLOR_DM_2) == 0) || + (lstrcmp(styleName, TABBAR_INDIVIDUALCOLOR_DM_3) == 0) || + (lstrcmp(styleName, TABBAR_INDIVIDUALCOLOR_DM_4) == 0) || + (lstrcmp(styleName, TABBAR_INDIVIDUALCOLOR_DM_5) == 0)) { return (GENERAL_CHANGE | COLOR_CHANGE_4_MENU); } - return GENERAL_CHANGE; } @@ -762,6 +771,28 @@ int WordStyleDlg::whichIndividualTabColourId() return -1; } +int WordStyleDlg::whichFindDlgStatusMsgColourIndex() +{ + constexpr size_t styleNameLen = 128; + wchar_t styleName[styleNameLen + 1] = { '\0' }; + + if (!WordStyleDlg::getStyleName(styleName, styleNameLen)) + { + return -1; + } + + if (lstrcmp(styleName, FINDDLG_STAUSNOTFOUND_COLOR) == 0) + return TabBarPlus::individualTabColourId::id0; + + if (lstrcmp(styleName, FINDDLG_STAUSMESSAGE_COLOR) == 0) + return TabBarPlus::individualTabColourId::id1; + + if (lstrcmp(styleName, FINDDLG_STAUSREACHED_COLOR) == 0) + return TabBarPlus::individualTabColourId::id2; + + return -1; +} + bool WordStyleDlg::isDocumentMapStyle() { constexpr size_t styleNameLen = 128; diff --git a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h index 3035fb0aaad7..b553c1611e06 100644 --- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h +++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h @@ -28,10 +28,14 @@ // The following parameters are for apply() method which will re-initialize the followings GUI with modified styler: // 2 Scintilla edit zones, Search result (displayed by Sintilla), Notepad++ GUI & components concerning theme -#define NO_VISUAL_CHANGE 0x00 // No need to apply visual effect - User ext. -#define GENERAL_CHANGE 0x01 // For Sintilla zones & Notepad++ GUI -#define THEME_CHANGE 0x02 // For the components concerning theme, for example the background color of dockable panels -#define COLOR_CHANGE_4_MENU 0x04 // For the color items displayed on the menu +#define NO_VISUAL_CHANGE 0x00 // No need to apply visual effect - User ext. +#define GENERAL_CHANGE 0x01 // For Sintilla zones & Notepad++ GUI (Tabbar, Find dialog, etc...) +#define THEME_CHANGE 0x02 // For the components concerning theme, for example the background color of dockable panels +#define COLOR_CHANGE_4_MENU 0x04 // For the color items displayed on the menu + +const wchar_t FINDDLG_STAUSNOTFOUND_COLOR[64] = L"Find status: Not found"; +const wchar_t FINDDLG_STAUSMESSAGE_COLOR[64] = L"Find status: Message"; +const wchar_t FINDDLG_STAUSREACHED_COLOR[64] = L"Find status: Search end reached"; enum fontStyleType {BOLD_STATUS, ITALIC_STATUS, UNDERLINE_STATUS}; @@ -127,6 +131,7 @@ private : int whichTabColourIndex() const; int whichIndividualTabColourId(); + int whichFindDlgStatusMsgColourIndex(); void apply(int applicationInfo); int getApplicationInfo() const; bool isDocumentMapStyle(); diff --git a/PowerEditor/src/WinControls/TabBar/TabBar.cpp b/PowerEditor/src/WinControls/TabBar/TabBar.cpp index 60bb920f41a0..4f6e5f23a208 100644 --- a/PowerEditor/src/WinControls/TabBar/TabBar.cpp +++ b/PowerEditor/src/WinControls/TabBar/TabBar.cpp @@ -1280,7 +1280,7 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct, bool isDarkMode) if (individualColourId != -1) { - topBarColour = nppParam.getIndividualTabColour(individualColourId, isDarkMode, isFocused); + topBarColour = nppParam.getIndividualTabColor(individualColourId, isDarkMode, isFocused); } hBrush = ::CreateSolidBrush(topBarColour); @@ -1300,7 +1300,7 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct, bool isDarkMode) } else if (individualColourId != -1) { - brushColour = nppParam.getIndividualTabColour(individualColourId, isDarkMode, false); + brushColour = nppParam.getIndividualTabColor(individualColourId, isDarkMode, false); } else { diff --git a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.cpp b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.cpp index 1cdc13032ae2..c71a9405f193 100644 --- a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.cpp +++ b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcher.cpp @@ -157,7 +157,7 @@ LRESULT VerticalFileSwitcher::listViewNotifyCustomDraw(HWND hWnd, UINT uMsg, WPA if (colorID != -1) { - bgColor = NppParameters::getInstance().getIndividualTabColour(colorID, isThemeDark, false); + bgColor = NppParameters::getInstance().getIndividualTabColor(colorID, isThemeDark, false); applyColor = true; } else if (isThemeDark) diff --git a/PowerEditor/src/stylers.model.xml b/PowerEditor/src/stylers.model.xml index 1e5dd4cb6093..2f2cfbf6f13c 100644 --- a/PowerEditor/src/stylers.model.xml +++ b/PowerEditor/src/stylers.model.xml @@ -1733,6 +1733,9 @@ + + +