diff --git a/PowerEditor/installer/themes/DarkModeDefault.xml b/PowerEditor/installer/themes/DarkModeDefault.xml
index 9d5064ef0..71ff64c2c 100644
--- a/PowerEditor/installer/themes/DarkModeDefault.xml
+++ b/PowerEditor/installer/themes/DarkModeDefault.xml
@@ -1444,5 +1444,9 @@ License: GPL2
+
+
+
+
diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp
index 5eba86294..b75ff0128 100644
--- a/PowerEditor/src/Notepad_plus.cpp
+++ b/PowerEditor/src/Notepad_plus.cpp
@@ -368,6 +368,12 @@ LRESULT Notepad_plus::init(HWND hwnd)
TabBarPlus::setVertical((tabBarStatus & TAB_VERTICAL) != 0);
drawTabbarColoursFromStylerArray();
+ // Autocomplete list and calltip
+ drawAutocompleteColoursFromTheme();
+ drawAutocompleteColoursFromStylerArray();
+ AutoCompletion::drawAutocomplete(_pEditView);
+ AutoCompletion::drawAutocomplete(_pNonEditView);
+
// Document Map
drawDocumentMapColoursFromStylerArray();
@@ -5827,6 +5833,85 @@ void Notepad_plus::drawTabbarColoursFromStylerArray()
TabBarPlus::setColour(stInact->_bgColor, TabBarPlus::inactiveBg);
}
+void Notepad_plus::drawAutocompleteColoursFromTheme()
+{
+ // Update default fg/bg colors in Parameters for both internal/plugins docking dialog
+ const Style* pStyle = NppParameters::getInstance().getGlobalStylers().findByID(STYLE_DEFAULT);
+ if (pStyle)
+ {
+ NppParameters::getInstance().setCurrentDefaultFgColor(pStyle->_fgColor);
+ NppParameters::getInstance().setCurrentDefaultBgColor(pStyle->_bgColor);
+
+ int rbv = GetRValue(pStyle->_bgColor);
+ int gbv = GetGValue(pStyle->_bgColor);
+ int bbv = GetBValue(pStyle->_bgColor);
+
+ int rfv = GetRValue(pStyle->_fgColor);
+ int gfv = GetGValue(pStyle->_fgColor);
+ int bfv = GetBValue(pStyle->_fgColor);
+
+ COLORREF bgDarker = RGB(rbv - 20 <= 0 ? 0 : rbv - 20, gbv - 20 <= 0 ? 0 : gbv - 20, bbv - 20 <= 0 ? 0 : bbv - 20);
+ COLORREF fgDarker = RGB(rfv - 20 <= 0 ? 0 : rfv - 20, gfv - 20 <= 0 ? 0 : gfv - 20, bfv - 20 <= 0 ? 0 : bfv - 20);
+ COLORREF fgLigher = RGB(rfv + 20 >= 255 ? 255 : rfv + 20, gfv + 20 >= 255 ? 255 : gfv + 20, bfv + 20 >= 255 ? 255 : bfv + 20);
+
+ AutoCompletion::setColour(bgDarker, AutoCompletion::AutocompleteColorIndex::autocompleteBg);
+ AutoCompletion::setColour(pStyle->_bgColor, AutoCompletion::AutocompleteColorIndex::selectedBg);
+ AutoCompletion::setColour(fgDarker, AutoCompletion::AutocompleteColorIndex::autocompleteText);
+ AutoCompletion::setColour(pStyle->_fgColor, AutoCompletion::AutocompleteColorIndex::selectedText);
+
+ AutoCompletion::setColour(bgDarker, AutoCompletion::AutocompleteColorIndex::calltipBg);
+ AutoCompletion::setColour(fgDarker, AutoCompletion::AutocompleteColorIndex::calltipText);
+ AutoCompletion::setColour(fgLigher, AutoCompletion::AutocompleteColorIndex::calltipHighlight);
+ }
+}
+void Notepad_plus::drawAutocompleteColoursFromStylerArray()
+{
+ Style* stAcList = getStyleFromName(AUTOCOMPLETE_LIST);
+ if (stAcList)
+ {
+ if (static_cast(stAcList->_fgColor) != -1)
+ {
+ AutoCompletion::setColour(stAcList->_fgColor, AutoCompletion::AutocompleteColorIndex::autocompleteText);
+ }
+ if (static_cast(stAcList->_bgColor) != -1)
+ {
+ AutoCompletion::setColour(stAcList->_bgColor, AutoCompletion::AutocompleteColorIndex::autocompleteBg);
+ }
+ }
+
+ Style* stAcSelected = getStyleFromName(AUTOCOMPLETE_SELECT);
+ if (stAcSelected)
+ {
+ if (static_cast(stAcSelected->_fgColor) != -1)
+ {
+ AutoCompletion::setColour(stAcSelected->_fgColor, AutoCompletion::AutocompleteColorIndex::selectedText);
+ }
+ if (static_cast(stAcSelected->_bgColor) != -1)
+ {
+ AutoCompletion::setColour(stAcSelected->_bgColor, AutoCompletion::AutocompleteColorIndex::selectedBg);
+ }
+ }
+
+ Style* stCalltip = getStyleFromName(AUTOCOMPLETE_CALLTIP);
+ if (stCalltip)
+ {
+ if (static_cast(stCalltip->_fgColor) != -1)
+ {
+ AutoCompletion::setColour(stCalltip->_fgColor, AutoCompletion::AutocompleteColorIndex::calltipText);
+ }
+ if (static_cast(stCalltip->_bgColor) != -1)
+ {
+ AutoCompletion::setColour(stCalltip->_bgColor, AutoCompletion::AutocompleteColorIndex::calltipBg);
+ }
+ }
+
+ Style* stCalltipHl = getStyleFromName(AUTOCOMPLETE_CALLTIP_HIGHLIGHT);
+ if (stCalltipHl && static_cast(stCalltipHl->_fgColor) != -1)
+ {
+ AutoCompletion::setColour(stCalltipHl->_fgColor, AutoCompletion::AutocompleteColorIndex::calltipHighlight);
+ }
+}
+
void Notepad_plus::drawDocumentMapColoursFromStylerArray()
{
Style* docMap = getStyleFromName(VIEWZONE_DOCUMENTMAP);
diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h
index be7ef528e..2cc6234de 100644
--- a/PowerEditor/src/Notepad_plus.h
+++ b/PowerEditor/src/Notepad_plus.h
@@ -585,6 +585,8 @@ private:
Style * getStyleFromName(const TCHAR *styleName);
bool dumpFiles(const TCHAR * outdir, const TCHAR * fileprefix = TEXT("")); //helper func
void drawTabbarColoursFromStylerArray();
+ void drawAutocompleteColoursFromTheme();
+ void drawAutocompleteColoursFromStylerArray();
void drawDocumentMapColoursFromStylerArray();
std::vector loadCommandlineParams(const TCHAR * commandLine, const CmdLineParams * pCmdParams) {
diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp
index 246dd244d..f3d06b4b3 100644
--- a/PowerEditor/src/NppBigSwitch.cpp
+++ b/PowerEditor/src/NppBigSwitch.cpp
@@ -1869,6 +1869,11 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
drawDocumentMapColoursFromStylerArray();
+ drawAutocompleteColoursFromTheme();
+ drawAutocompleteColoursFromStylerArray();
+ AutoCompletion::drawAutocomplete(_pEditView);
+ AutoCompletion::drawAutocomplete(_pNonEditView);
+
// Update default fg/bg colors in Parameters for both internal/plugins docking dialog
const Style * pStyle = NppParameters::getInstance().getGlobalStylers().findByID(STYLE_DEFAULT);
if (pStyle)
diff --git a/PowerEditor/src/NppDarkMode.cpp b/PowerEditor/src/NppDarkMode.cpp
index a1568f801..01f57e52c 100644
--- a/PowerEditor/src/NppDarkMode.cpp
+++ b/PowerEditor/src/NppDarkMode.cpp
@@ -1698,6 +1698,27 @@ namespace NppDarkMode
}
}
+ BOOL getAutocompleHandleProc(HWND hwnd, LPARAM /*lParam*/)
+ {
+ constexpr size_t classNameLen = 16;
+ TCHAR className[classNameLen]{};
+ GetClassName(hwnd, className, classNameLen);
+ if ((wcscmp(className, L"ListBoxX") == 0) ||
+ (wcscmp(className, WC_LISTBOX) == 0))
+ {
+ NppDarkMode::setDarkScrollBar(hwnd);
+ ::EnumChildWindows(hwnd, getAutocompleHandleProc, 0);
+ }
+
+ return TRUE;
+ }
+
+ // set dark scrollbar for autocomplete list
+ void setDarkAutoCompletion()
+ {
+ ::EnumThreadWindows(::GetCurrentThreadId(), getAutocompleHandleProc, 0);
+ }
+
LRESULT onCtlColor(HDC hdc)
{
::SetTextColor(hdc, NppDarkMode::getTextColor());
diff --git a/PowerEditor/src/NppDarkMode.h b/PowerEditor/src/NppDarkMode.h
index ef3cf8167..57c25e147 100644
--- a/PowerEditor/src/NppDarkMode.h
+++ b/PowerEditor/src/NppDarkMode.h
@@ -165,6 +165,9 @@ namespace NppDarkMode
void setTreeViewStyle(HWND hwnd);
void setBorder(HWND hwnd, bool border = true);
+ BOOL getAutocompleHandleProc(HWND hwnd, LPARAM lParam);
+ void setDarkAutoCompletion();
+
LRESULT onCtlColor(HDC hdc);
LRESULT onCtlColorSofter(HDC hdc);
LRESULT onCtlColorDarker(HDC hdc);
diff --git a/PowerEditor/src/ScintillaComponent/AutoCompletion.cpp b/PowerEditor/src/ScintillaComponent/AutoCompletion.cpp
index 856075d15..51d059fbf 100644
--- a/PowerEditor/src/ScintillaComponent/AutoCompletion.cpp
+++ b/PowerEditor/src/ScintillaComponent/AutoCompletion.cpp
@@ -1081,5 +1081,75 @@ const TCHAR * AutoCompletion::getApiFileName()
_curLang = L_JS;
return ScintillaEditView::_langNameInfoArray[_curLang]._langName;
-
+}
+
+COLORREF AutoCompletion::_autocompleteText = RGB(0x00, 0x00, 0x00);
+COLORREF AutoCompletion::_autocompleteBg = RGB(0xFF, 0xFF, 0xFF);
+COLORREF AutoCompletion::_selectedText = RGB(0xFF, 0xFF, 0xFF);
+COLORREF AutoCompletion::_selectedBg = RGB(0x00, 0x78, 0xD7);
+COLORREF AutoCompletion::_calltipBg = RGB(0xFF, 0xFF, 0xFF);
+COLORREF AutoCompletion::_calltipText = RGB(0x80, 0x80, 0x80);
+COLORREF AutoCompletion::_calltipHighlight = RGB(0x00, 0x00, 0x80);
+
+void AutoCompletion::setColour(COLORREF colour2Set, AutocompleteColorIndex i)
+{
+ switch (i)
+ {
+ case AutocompleteColorIndex::autocompleteText:
+ {
+ _autocompleteText = colour2Set;
+ break;
+ }
+
+ case AutocompleteColorIndex::autocompleteBg:
+ {
+ _autocompleteBg = colour2Set;
+ break;
+ }
+
+ case AutocompleteColorIndex::selectedText:
+ {
+ _selectedText = colour2Set;
+ break;
+ }
+
+ case AutocompleteColorIndex::selectedBg:
+ {
+ _selectedBg = colour2Set;
+ break;
+ }
+
+ case AutocompleteColorIndex::calltipBg:
+ {
+ _calltipBg = colour2Set;
+ break;
+ }
+
+ case AutocompleteColorIndex::calltipText:
+ {
+ _calltipText = colour2Set;
+ break;
+ }
+
+ case AutocompleteColorIndex::calltipHighlight:
+ {
+ _calltipHighlight = colour2Set;
+ break;
+ }
+
+ default:
+ return;
+ }
+}
+
+void AutoCompletion::drawAutocomplete(ScintillaEditView* pEditView)
+{
+ pEditView->execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_LIST, _autocompleteText);
+ pEditView->execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_LIST_BACK, _autocompleteBg);
+ pEditView->execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_LIST_SELECTED, _selectedText);
+ pEditView->execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_LIST_SELECTED_BACK, _selectedBg);
+
+ pEditView->execute(SCI_CALLTIPSETBACK, _calltipBg);
+ pEditView->execute(SCI_CALLTIPSETFORE, _calltipText);
+ pEditView->execute(SCI_CALLTIPSETFOREHLT, _calltipHighlight);
}
diff --git a/PowerEditor/src/ScintillaComponent/AutoCompletion.h b/PowerEditor/src/ScintillaComponent/AutoCompletion.h
index 44fe75290..ca62cc3fb 100644
--- a/PowerEditor/src/ScintillaComponent/AutoCompletion.h
+++ b/PowerEditor/src/ScintillaComponent/AutoCompletion.h
@@ -24,6 +24,11 @@ const size_t tagMaxLen = 256;
class ScintillaEditView;
+constexpr TCHAR AUTOCOMPLETE_LIST[64] = TEXT("Autocomplete list");
+constexpr TCHAR AUTOCOMPLETE_SELECT[64] = TEXT("Autocomplete selected item");
+constexpr TCHAR AUTOCOMPLETE_CALLTIP[64] = TEXT("Calltip");
+constexpr TCHAR AUTOCOMPLETE_CALLTIP_HIGHLIGHT[64] = TEXT("Calltip highlighted text");
+
struct MatchedCharInserted {
MatchedCharInserted() = delete;
char _c;
@@ -55,6 +60,16 @@ public:
delete _pXmlFile;
};
+ enum class AutocompleteColorIndex {
+ autocompleteText,
+ autocompleteBg,
+ selectedText,
+ selectedBg,
+ calltipBg,
+ calltipText,
+ calltipHighlight
+ };
+
bool setLanguage(LangType language);
//AutoComplete from the list
@@ -73,6 +88,18 @@ public:
void callTipClick(size_t direction);
void getCloseTag(char *closeTag, size_t closeTagLen, size_t caretPos, bool isHTML);
+ static void setColour(COLORREF colour2Set, AutocompleteColorIndex i);
+ static void drawAutocomplete(ScintillaEditView* pEditView);
+
+protected:
+ static COLORREF _autocompleteBg;
+ static COLORREF _autocompleteText;
+ static COLORREF _selectedBg;
+ static COLORREF _selectedText;
+ static COLORREF _calltipBg;
+ static COLORREF _calltipText;
+ static COLORREF _calltipHighlight;
+
private:
bool _funcCompletionActive = false;
ScintillaEditView * _pEditView = nullptr;
@@ -89,7 +116,7 @@ private:
generic_string _keyWords;
size_t _keyWordMaxLen = 0;
- FunctionCallTip _funcCalltip;
+ FunctionCallTip _funcCalltip;
const TCHAR * getApiFileName();
void getWordArray(std::vector & wordArray, TCHAR *beginChars, TCHAR *excludeChars);
diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp
index 74aa47b53..9a322a3e0 100644
--- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp
+++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp
@@ -2388,6 +2388,7 @@ void ScintillaEditView::showAutoComletion(size_t lenEntered, const TCHAR* list)
size_t cp = execute(SCI_GETCODEPAGE);
const char *listA = wmc.wchar2char(list, cp);
execute(SCI_AUTOCSHOW, lenEntered, reinterpret_cast(listA));
+ NppDarkMode::setDarkAutoCompletion();
}
void ScintillaEditView::showCallTip(size_t startPos, const TCHAR * def)
diff --git a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp
index 2904acdc8..8c3486202 100644
--- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp
+++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp
@@ -19,6 +19,7 @@
#include "WordStyleDlg.h"
#include "ScintillaEditView.h"
#include "documentMap.h"
+#include "AutoCompletion.h"
using namespace std;
@@ -510,6 +511,7 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
updateColour(C_FOREGROUND);
notifyDataModified();
int tabColourIndex;
+ int autocompleteColourIndex = -1;
if ((tabColourIndex = whichTabColourIndex()) != -1)
{
TabBarPlus::setColour(_pFgColour->getColour(), (TabBarPlus::tabColourIndex)tabColourIndex);
@@ -518,6 +520,10 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
{
ViewZoneDlg::setColour(_pFgColour->getColour(), ViewZoneDlg::ViewZoneColorIndex::focus);
}
+ else if ((autocompleteColourIndex = whichAutocompleteColourIndex(true)) != -1)
+ {
+ AutoCompletion::setColour(_pFgColour->getColour(), static_cast(autocompleteColourIndex));
+ }
apply();
return TRUE;
}
@@ -526,6 +532,7 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
updateColour(C_BACKGROUND);
notifyDataModified();
int tabColourIndex;
+ int autocompleteColourIndex = -1;
if ((tabColourIndex = whichTabColourIndex()) != -1)
{
tabColourIndex = (tabColourIndex == TabBarPlus::inactiveText ? TabBarPlus::inactiveBg : tabColourIndex);
@@ -535,6 +542,10 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
{
ViewZoneDlg::setColour(_pBgColour->getColour(), ViewZoneDlg::ViewZoneColorIndex::frost);
}
+ else if ((autocompleteColourIndex = whichAutocompleteColourIndex(false)) != -1)
+ {
+ AutoCompletion::setColour(_pBgColour->getColour(), static_cast(autocompleteColourIndex));
+ }
apply();
return TRUE;
}
@@ -599,19 +610,31 @@ void WordStyleDlg::updateThemeName(const generic_string& themeName)
nppGUI._themeName.assign( themeName );
}
-int WordStyleDlg::whichTabColourIndex()
+bool WordStyleDlg::getStyleName(TCHAR *styleName, const size_t styleNameLen)
{
auto i = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETCURSEL, 0, 0);
if (i == LB_ERR)
- return -1;
- const size_t styleNameLen = 128;
- TCHAR styleName[styleNameLen + 1] = { '\0' };
+ return false;
+
auto lbTextLen = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXTLEN, i, 0);
if (static_cast(lbTextLen) > styleNameLen)
- return -1;
+ return false;
::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXT, i, reinterpret_cast(styleName));
+ return true;
+}
+
+int WordStyleDlg::whichTabColourIndex()
+{
+ constexpr size_t styleNameLen = 128;
+ TCHAR styleName[styleNameLen + 1] = { '\0' };
+
+ if (!WordStyleDlg::getStyleName(styleName, styleNameLen))
+ {
+ return -1;
+ }
+
if (lstrcmp(styleName, TABBAR_ACTIVEFOCUSEDINDCATOR) == 0)
return TabBarPlus::activeFocusedTop;
@@ -627,21 +650,56 @@ int WordStyleDlg::whichTabColourIndex()
return -1;
}
-bool WordStyleDlg::isDocumentMapStyle()
+int WordStyleDlg::whichAutocompleteColourIndex(bool isText)
{
- const auto i = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETCURSEL, 0, 0);
- if (i == LB_ERR)
- return false;
-
constexpr size_t styleNameLen = 128;
TCHAR styleName[styleNameLen + 1] = { '\0' };
- const auto lbTextLen = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXTLEN, i, 0);
- if (static_cast(lbTextLen) > styleNameLen)
- return false;
- ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXT, i, reinterpret_cast(styleName));
+ if (!WordStyleDlg::getStyleName(styleName, styleNameLen))
+ {
+ return -1;
+ }
- return (lstrcmp(styleName, VIEWZONE_DOCUMENTMAP) == 0);
+ if (lstrcmp(styleName, AUTOCOMPLETE_LIST) == 0)
+ {
+ if (isText)
+ {
+ return static_cast(AutoCompletion::AutocompleteColorIndex::autocompleteText);
+ }
+ return static_cast(AutoCompletion::AutocompleteColorIndex::autocompleteBg);
+ }
+
+ if (lstrcmp(styleName, AUTOCOMPLETE_SELECT) == 0)
+ {
+ if (isText)
+ {
+ return static_cast(AutoCompletion::AutocompleteColorIndex::selectedText);
+ }
+ return static_cast(AutoCompletion::AutocompleteColorIndex::selectedBg);
+ }
+
+ if (lstrcmp(styleName, AUTOCOMPLETE_CALLTIP) == 0)
+ {
+ if (isText)
+ {
+ return static_cast(AutoCompletion::AutocompleteColorIndex::calltipText);
+ }
+ return static_cast(AutoCompletion::AutocompleteColorIndex::calltipBg);
+ }
+
+
+ if ((lstrcmp(styleName, AUTOCOMPLETE_CALLTIP_HIGHLIGHT) == 0) && isText)
+ return static_cast(AutoCompletion::AutocompleteColorIndex::calltipHighlight);
+
+ return -1;
+}
+
+bool WordStyleDlg::isDocumentMapStyle()
+{
+ constexpr size_t styleNameLen = 128;
+ TCHAR styleName[styleNameLen + 1] = { '\0' };
+
+ return (WordStyleDlg::getStyleName(styleName, styleNameLen) && (lstrcmp(styleName, VIEWZONE_DOCUMENTMAP) == 0));
}
void WordStyleDlg::updateColour(bool which)
diff --git a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h
index fdfe9569f..4415e196c 100644
--- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h
+++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h
@@ -163,7 +163,10 @@ private :
}
};
+ bool getStyleName(TCHAR *styleName, const size_t styleNameLen);
+
int whichTabColourIndex();
+ int whichAutocompleteColourIndex(bool isText);
bool isDocumentMapStyle();
void move2CtrlRight(int ctrlID, HWND handle2Move, int handle2MoveWidth, int handle2MoveHeight);
void updateColour(bool which);
diff --git a/PowerEditor/src/stylers.model.xml b/PowerEditor/src/stylers.model.xml
index 5ff2e84c5..10911c6c1 100644
--- a/PowerEditor/src/stylers.model.xml
+++ b/PowerEditor/src/stylers.model.xml
@@ -1433,5 +1433,9 @@
+
+
+
+