mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-23 13:54:54 +02:00
Add dark mode support for autocomplete list & calltip
Fix fix #11522, close #11523
This commit is contained in:
parent
4ffd1e9858
commit
3f1a582a36
@ -1444,5 +1444,9 @@ License: GPL2
|
|||||||
<WidgetStyle name="Inactive tabs" styleID="0" fgColor="808080" bgColor="C0C0C0" />
|
<WidgetStyle name="Inactive tabs" styleID="0" fgColor="808080" bgColor="C0C0C0" />
|
||||||
<WidgetStyle name="URL hovered" styleID="0" fgColor="A3DCA3" />
|
<WidgetStyle name="URL hovered" styleID="0" fgColor="A3DCA3" />
|
||||||
<WidgetStyle name="Document map" styleID="0" fgColor="000000" bgColor="FFFFFF" />
|
<WidgetStyle name="Document map" styleID="0" fgColor="000000" bgColor="FFFFFF" />
|
||||||
|
<WidgetStyle name="Autocomplete list" styleID="0" fgColor="C0C0C0" bgColor="202020" fontStyle="0" />
|
||||||
|
<WidgetStyle name="Autocomplete selected item" styleID="0" fgColor="E0E0E0" bgColor="404040" fontStyle="0" />
|
||||||
|
<WidgetStyle name="Calltip" styleID="0" fgColor="808080" bgColor="202020" fontStyle="0" />
|
||||||
|
<WidgetStyle name="Calltip highlighted text" styleID="0" fgColor="E0E0E0" fontStyle="0" />
|
||||||
</GlobalStyles>
|
</GlobalStyles>
|
||||||
</NotepadPlus>
|
</NotepadPlus>
|
||||||
|
@ -368,6 +368,12 @@ LRESULT Notepad_plus::init(HWND hwnd)
|
|||||||
TabBarPlus::setVertical((tabBarStatus & TAB_VERTICAL) != 0);
|
TabBarPlus::setVertical((tabBarStatus & TAB_VERTICAL) != 0);
|
||||||
drawTabbarColoursFromStylerArray();
|
drawTabbarColoursFromStylerArray();
|
||||||
|
|
||||||
|
// Autocomplete list and calltip
|
||||||
|
drawAutocompleteColoursFromTheme();
|
||||||
|
drawAutocompleteColoursFromStylerArray();
|
||||||
|
AutoCompletion::drawAutocomplete(_pEditView);
|
||||||
|
AutoCompletion::drawAutocomplete(_pNonEditView);
|
||||||
|
|
||||||
// Document Map
|
// Document Map
|
||||||
drawDocumentMapColoursFromStylerArray();
|
drawDocumentMapColoursFromStylerArray();
|
||||||
|
|
||||||
@ -5827,6 +5833,85 @@ void Notepad_plus::drawTabbarColoursFromStylerArray()
|
|||||||
TabBarPlus::setColour(stInact->_bgColor, TabBarPlus::inactiveBg);
|
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<long>(stAcList->_fgColor) != -1)
|
||||||
|
{
|
||||||
|
AutoCompletion::setColour(stAcList->_fgColor, AutoCompletion::AutocompleteColorIndex::autocompleteText);
|
||||||
|
}
|
||||||
|
if (static_cast<long>(stAcList->_bgColor) != -1)
|
||||||
|
{
|
||||||
|
AutoCompletion::setColour(stAcList->_bgColor, AutoCompletion::AutocompleteColorIndex::autocompleteBg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Style* stAcSelected = getStyleFromName(AUTOCOMPLETE_SELECT);
|
||||||
|
if (stAcSelected)
|
||||||
|
{
|
||||||
|
if (static_cast<long>(stAcSelected->_fgColor) != -1)
|
||||||
|
{
|
||||||
|
AutoCompletion::setColour(stAcSelected->_fgColor, AutoCompletion::AutocompleteColorIndex::selectedText);
|
||||||
|
}
|
||||||
|
if (static_cast<long>(stAcSelected->_bgColor) != -1)
|
||||||
|
{
|
||||||
|
AutoCompletion::setColour(stAcSelected->_bgColor, AutoCompletion::AutocompleteColorIndex::selectedBg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Style* stCalltip = getStyleFromName(AUTOCOMPLETE_CALLTIP);
|
||||||
|
if (stCalltip)
|
||||||
|
{
|
||||||
|
if (static_cast<long>(stCalltip->_fgColor) != -1)
|
||||||
|
{
|
||||||
|
AutoCompletion::setColour(stCalltip->_fgColor, AutoCompletion::AutocompleteColorIndex::calltipText);
|
||||||
|
}
|
||||||
|
if (static_cast<long>(stCalltip->_bgColor) != -1)
|
||||||
|
{
|
||||||
|
AutoCompletion::setColour(stCalltip->_bgColor, AutoCompletion::AutocompleteColorIndex::calltipBg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Style* stCalltipHl = getStyleFromName(AUTOCOMPLETE_CALLTIP_HIGHLIGHT);
|
||||||
|
if (stCalltipHl && static_cast<long>(stCalltipHl->_fgColor) != -1)
|
||||||
|
{
|
||||||
|
AutoCompletion::setColour(stCalltipHl->_fgColor, AutoCompletion::AutocompleteColorIndex::calltipHighlight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Notepad_plus::drawDocumentMapColoursFromStylerArray()
|
void Notepad_plus::drawDocumentMapColoursFromStylerArray()
|
||||||
{
|
{
|
||||||
Style* docMap = getStyleFromName(VIEWZONE_DOCUMENTMAP);
|
Style* docMap = getStyleFromName(VIEWZONE_DOCUMENTMAP);
|
||||||
|
@ -585,6 +585,8 @@ private:
|
|||||||
Style * getStyleFromName(const TCHAR *styleName);
|
Style * getStyleFromName(const TCHAR *styleName);
|
||||||
bool dumpFiles(const TCHAR * outdir, const TCHAR * fileprefix = TEXT("")); //helper func
|
bool dumpFiles(const TCHAR * outdir, const TCHAR * fileprefix = TEXT("")); //helper func
|
||||||
void drawTabbarColoursFromStylerArray();
|
void drawTabbarColoursFromStylerArray();
|
||||||
|
void drawAutocompleteColoursFromTheme();
|
||||||
|
void drawAutocompleteColoursFromStylerArray();
|
||||||
void drawDocumentMapColoursFromStylerArray();
|
void drawDocumentMapColoursFromStylerArray();
|
||||||
|
|
||||||
std::vector<generic_string> loadCommandlineParams(const TCHAR * commandLine, const CmdLineParams * pCmdParams) {
|
std::vector<generic_string> loadCommandlineParams(const TCHAR * commandLine, const CmdLineParams * pCmdParams) {
|
||||||
|
@ -1869,6 +1869,11 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
drawDocumentMapColoursFromStylerArray();
|
drawDocumentMapColoursFromStylerArray();
|
||||||
|
|
||||||
|
drawAutocompleteColoursFromTheme();
|
||||||
|
drawAutocompleteColoursFromStylerArray();
|
||||||
|
AutoCompletion::drawAutocomplete(_pEditView);
|
||||||
|
AutoCompletion::drawAutocomplete(_pNonEditView);
|
||||||
|
|
||||||
// Update default fg/bg colors in Parameters for both internal/plugins docking dialog
|
// Update default fg/bg colors in Parameters for both internal/plugins docking dialog
|
||||||
const Style * pStyle = NppParameters::getInstance().getGlobalStylers().findByID(STYLE_DEFAULT);
|
const Style * pStyle = NppParameters::getInstance().getGlobalStylers().findByID(STYLE_DEFAULT);
|
||||||
if (pStyle)
|
if (pStyle)
|
||||||
|
@ -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)
|
LRESULT onCtlColor(HDC hdc)
|
||||||
{
|
{
|
||||||
::SetTextColor(hdc, NppDarkMode::getTextColor());
|
::SetTextColor(hdc, NppDarkMode::getTextColor());
|
||||||
|
@ -165,6 +165,9 @@ namespace NppDarkMode
|
|||||||
void setTreeViewStyle(HWND hwnd);
|
void setTreeViewStyle(HWND hwnd);
|
||||||
void setBorder(HWND hwnd, bool border = true);
|
void setBorder(HWND hwnd, bool border = true);
|
||||||
|
|
||||||
|
BOOL getAutocompleHandleProc(HWND hwnd, LPARAM lParam);
|
||||||
|
void setDarkAutoCompletion();
|
||||||
|
|
||||||
LRESULT onCtlColor(HDC hdc);
|
LRESULT onCtlColor(HDC hdc);
|
||||||
LRESULT onCtlColorSofter(HDC hdc);
|
LRESULT onCtlColorSofter(HDC hdc);
|
||||||
LRESULT onCtlColorDarker(HDC hdc);
|
LRESULT onCtlColorDarker(HDC hdc);
|
||||||
|
@ -1081,5 +1081,75 @@ const TCHAR * AutoCompletion::getApiFileName()
|
|||||||
_curLang = L_JS;
|
_curLang = L_JS;
|
||||||
|
|
||||||
return ScintillaEditView::_langNameInfoArray[_curLang]._langName;
|
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);
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,11 @@ const size_t tagMaxLen = 256;
|
|||||||
|
|
||||||
class ScintillaEditView;
|
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 {
|
struct MatchedCharInserted {
|
||||||
MatchedCharInserted() = delete;
|
MatchedCharInserted() = delete;
|
||||||
char _c;
|
char _c;
|
||||||
@ -55,6 +60,16 @@ public:
|
|||||||
delete _pXmlFile;
|
delete _pXmlFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class AutocompleteColorIndex {
|
||||||
|
autocompleteText,
|
||||||
|
autocompleteBg,
|
||||||
|
selectedText,
|
||||||
|
selectedBg,
|
||||||
|
calltipBg,
|
||||||
|
calltipText,
|
||||||
|
calltipHighlight
|
||||||
|
};
|
||||||
|
|
||||||
bool setLanguage(LangType language);
|
bool setLanguage(LangType language);
|
||||||
|
|
||||||
//AutoComplete from the list
|
//AutoComplete from the list
|
||||||
@ -73,6 +88,18 @@ public:
|
|||||||
void callTipClick(size_t direction);
|
void callTipClick(size_t direction);
|
||||||
void getCloseTag(char *closeTag, size_t closeTagLen, size_t caretPos, bool isHTML);
|
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:
|
private:
|
||||||
bool _funcCompletionActive = false;
|
bool _funcCompletionActive = false;
|
||||||
ScintillaEditView * _pEditView = nullptr;
|
ScintillaEditView * _pEditView = nullptr;
|
||||||
@ -89,7 +116,7 @@ private:
|
|||||||
generic_string _keyWords;
|
generic_string _keyWords;
|
||||||
size_t _keyWordMaxLen = 0;
|
size_t _keyWordMaxLen = 0;
|
||||||
|
|
||||||
FunctionCallTip _funcCalltip;
|
FunctionCallTip _funcCalltip;
|
||||||
|
|
||||||
const TCHAR * getApiFileName();
|
const TCHAR * getApiFileName();
|
||||||
void getWordArray(std::vector<generic_string> & wordArray, TCHAR *beginChars, TCHAR *excludeChars);
|
void getWordArray(std::vector<generic_string> & wordArray, TCHAR *beginChars, TCHAR *excludeChars);
|
||||||
|
@ -2388,6 +2388,7 @@ void ScintillaEditView::showAutoComletion(size_t lenEntered, const TCHAR* list)
|
|||||||
size_t cp = execute(SCI_GETCODEPAGE);
|
size_t cp = execute(SCI_GETCODEPAGE);
|
||||||
const char *listA = wmc.wchar2char(list, cp);
|
const char *listA = wmc.wchar2char(list, cp);
|
||||||
execute(SCI_AUTOCSHOW, lenEntered, reinterpret_cast<LPARAM>(listA));
|
execute(SCI_AUTOCSHOW, lenEntered, reinterpret_cast<LPARAM>(listA));
|
||||||
|
NppDarkMode::setDarkAutoCompletion();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScintillaEditView::showCallTip(size_t startPos, const TCHAR * def)
|
void ScintillaEditView::showCallTip(size_t startPos, const TCHAR * def)
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "WordStyleDlg.h"
|
#include "WordStyleDlg.h"
|
||||||
#include "ScintillaEditView.h"
|
#include "ScintillaEditView.h"
|
||||||
#include "documentMap.h"
|
#include "documentMap.h"
|
||||||
|
#include "AutoCompletion.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -510,6 +511,7 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
|
|||||||
updateColour(C_FOREGROUND);
|
updateColour(C_FOREGROUND);
|
||||||
notifyDataModified();
|
notifyDataModified();
|
||||||
int tabColourIndex;
|
int tabColourIndex;
|
||||||
|
int autocompleteColourIndex = -1;
|
||||||
if ((tabColourIndex = whichTabColourIndex()) != -1)
|
if ((tabColourIndex = whichTabColourIndex()) != -1)
|
||||||
{
|
{
|
||||||
TabBarPlus::setColour(_pFgColour->getColour(), (TabBarPlus::tabColourIndex)tabColourIndex);
|
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);
|
ViewZoneDlg::setColour(_pFgColour->getColour(), ViewZoneDlg::ViewZoneColorIndex::focus);
|
||||||
}
|
}
|
||||||
|
else if ((autocompleteColourIndex = whichAutocompleteColourIndex(true)) != -1)
|
||||||
|
{
|
||||||
|
AutoCompletion::setColour(_pFgColour->getColour(), static_cast<AutoCompletion::AutocompleteColorIndex>(autocompleteColourIndex));
|
||||||
|
}
|
||||||
apply();
|
apply();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -526,6 +532,7 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
|
|||||||
updateColour(C_BACKGROUND);
|
updateColour(C_BACKGROUND);
|
||||||
notifyDataModified();
|
notifyDataModified();
|
||||||
int tabColourIndex;
|
int tabColourIndex;
|
||||||
|
int autocompleteColourIndex = -1;
|
||||||
if ((tabColourIndex = whichTabColourIndex()) != -1)
|
if ((tabColourIndex = whichTabColourIndex()) != -1)
|
||||||
{
|
{
|
||||||
tabColourIndex = (tabColourIndex == TabBarPlus::inactiveText ? TabBarPlus::inactiveBg : tabColourIndex);
|
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);
|
ViewZoneDlg::setColour(_pBgColour->getColour(), ViewZoneDlg::ViewZoneColorIndex::frost);
|
||||||
}
|
}
|
||||||
|
else if ((autocompleteColourIndex = whichAutocompleteColourIndex(false)) != -1)
|
||||||
|
{
|
||||||
|
AutoCompletion::setColour(_pBgColour->getColour(), static_cast<AutoCompletion::AutocompleteColorIndex>(autocompleteColourIndex));
|
||||||
|
}
|
||||||
apply();
|
apply();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -599,19 +610,31 @@ void WordStyleDlg::updateThemeName(const generic_string& themeName)
|
|||||||
nppGUI._themeName.assign( 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);
|
auto i = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETCURSEL, 0, 0);
|
||||||
if (i == LB_ERR)
|
if (i == LB_ERR)
|
||||||
return -1;
|
return false;
|
||||||
const size_t styleNameLen = 128;
|
|
||||||
TCHAR styleName[styleNameLen + 1] = { '\0' };
|
|
||||||
auto lbTextLen = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXTLEN, i, 0);
|
auto lbTextLen = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXTLEN, i, 0);
|
||||||
if (static_cast<size_t>(lbTextLen) > styleNameLen)
|
if (static_cast<size_t>(lbTextLen) > styleNameLen)
|
||||||
return -1;
|
return false;
|
||||||
|
|
||||||
::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXT, i, reinterpret_cast<LPARAM>(styleName));
|
::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXT, i, reinterpret_cast<LPARAM>(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)
|
if (lstrcmp(styleName, TABBAR_ACTIVEFOCUSEDINDCATOR) == 0)
|
||||||
return TabBarPlus::activeFocusedTop;
|
return TabBarPlus::activeFocusedTop;
|
||||||
|
|
||||||
@ -627,21 +650,56 @@ int WordStyleDlg::whichTabColourIndex()
|
|||||||
return -1;
|
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;
|
constexpr size_t styleNameLen = 128;
|
||||||
TCHAR styleName[styleNameLen + 1] = { '\0' };
|
TCHAR styleName[styleNameLen + 1] = { '\0' };
|
||||||
const auto lbTextLen = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXTLEN, i, 0);
|
|
||||||
if (static_cast<size_t>(lbTextLen) > styleNameLen)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXT, i, reinterpret_cast<LPARAM>(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<int>(AutoCompletion::AutocompleteColorIndex::autocompleteText);
|
||||||
|
}
|
||||||
|
return static_cast<int>(AutoCompletion::AutocompleteColorIndex::autocompleteBg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lstrcmp(styleName, AUTOCOMPLETE_SELECT) == 0)
|
||||||
|
{
|
||||||
|
if (isText)
|
||||||
|
{
|
||||||
|
return static_cast<int>(AutoCompletion::AutocompleteColorIndex::selectedText);
|
||||||
|
}
|
||||||
|
return static_cast<int>(AutoCompletion::AutocompleteColorIndex::selectedBg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lstrcmp(styleName, AUTOCOMPLETE_CALLTIP) == 0)
|
||||||
|
{
|
||||||
|
if (isText)
|
||||||
|
{
|
||||||
|
return static_cast<int>(AutoCompletion::AutocompleteColorIndex::calltipText);
|
||||||
|
}
|
||||||
|
return static_cast<int>(AutoCompletion::AutocompleteColorIndex::calltipBg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ((lstrcmp(styleName, AUTOCOMPLETE_CALLTIP_HIGHLIGHT) == 0) && isText)
|
||||||
|
return static_cast<int>(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)
|
void WordStyleDlg::updateColour(bool which)
|
||||||
|
@ -163,7 +163,10 @@ private :
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool getStyleName(TCHAR *styleName, const size_t styleNameLen);
|
||||||
|
|
||||||
int whichTabColourIndex();
|
int whichTabColourIndex();
|
||||||
|
int whichAutocompleteColourIndex(bool isText);
|
||||||
bool isDocumentMapStyle();
|
bool isDocumentMapStyle();
|
||||||
void move2CtrlRight(int ctrlID, HWND handle2Move, int handle2MoveWidth, int handle2MoveHeight);
|
void move2CtrlRight(int ctrlID, HWND handle2Move, int handle2MoveWidth, int handle2MoveHeight);
|
||||||
void updateColour(bool which);
|
void updateColour(bool which);
|
||||||
|
@ -1433,5 +1433,9 @@
|
|||||||
<WidgetStyle name="Inactive tabs" styleID="0" fgColor="808080" bgColor="C0C0C0" />
|
<WidgetStyle name="Inactive tabs" styleID="0" fgColor="808080" bgColor="C0C0C0" />
|
||||||
<WidgetStyle name="URL hovered" styleID="0" fgColor="0000FF" />
|
<WidgetStyle name="URL hovered" styleID="0" fgColor="0000FF" />
|
||||||
<WidgetStyle name="Document map" styleID="0" fgColor="FF8000" bgColor="FFFFFF" />
|
<WidgetStyle name="Document map" styleID="0" fgColor="FF8000" bgColor="FFFFFF" />
|
||||||
|
<WidgetStyle name="Autocomplete list" styleID="0" fgColor="000000" bgColor="FFFFFF" fontStyle="0" />
|
||||||
|
<WidgetStyle name="Autocomplete selected item" styleID="0" fgColor="FFFFFF" bgColor="0078D7" fontStyle="0" />
|
||||||
|
<WidgetStyle name="Calltip" styleID="0" fgColor="808080" bgColor="FFFFFF" fontStyle="0" />
|
||||||
|
<WidgetStyle name="Calltip highlighted text" styleID="0" fgColor="000080" fontStyle="0" />
|
||||||
</GlobalStyles>
|
</GlobalStyles>
|
||||||
</NotepadPlus>
|
</NotepadPlus>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user