Make multi-select background & caret colour customizable

Fix #14302, close #14350
pull/14355/head
Don Ho 1 year ago
parent c7e1162f23
commit 812745d850

@ -3081,7 +3081,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
_subEditView.setCRLF();
return TRUE;
}
case NPPM_INTERNAL_NPCFORMCHANGED:
{
_mainEditView.setNpcAndCcUniEOL();

@ -2868,25 +2868,45 @@ void ScintillaEditView::performGlobalStyles()
selectColorBack = pStyle->_bgColor;
selectColorFore = pStyle->_fgColor;
}
execute(SCI_SETSELBACK, 1, selectColorBack);
execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_SELECTION_INACTIVE_BACK, selectColorBack);
//execute(SCI_SETSELBACK, 1, selectColorBack);
execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_SELECTION_BACK, selectColorBack | 0xFF000000); // SCI_SETSELBACK is deprecated
execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_SELECTION_INACTIVE_BACK, selectColorBack | 0xFF000000);
if (nppParams.isSelectFgColorEnabled())
COLORREF selectMultiSelectColorBack = liteGrey;
pStyle = stylers.findByName(TEXT("Multi-selected text color"));
if (pStyle)
{
execute(SCI_SETSELFORE, 1, selectColorFore);
selectMultiSelectColorBack = pStyle->_bgColor;
}
execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_SELECTION_ADDITIONAL_BACK, selectMultiSelectColorBack | 0xFF000000);
if (nppParams.isSelectFgColorEnabled())
{
long alphaSelectColorFore = selectColorFore;
alphaSelectColorFore |= 0xFF000000; // add alpha color to make DirectWrite mode work
//execute(SCI_SETSELFORE, 1, selectColorFore);
execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_SELECTION_TEXT, alphaSelectColorFore); // SCI_SETSELFORE is deprecated
execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_SELECTION_INACTIVE_TEXT, alphaSelectColorFore);
execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_SELECTION_ADDITIONAL_TEXT, alphaSelectColorFore);
}
COLORREF caretColor = black;
pStyle = stylers.findByID(SCI_SETCARETFORE);
pStyle = stylers.findByName(L"Caret colour");
if (pStyle)
{
caretColor = pStyle->_fgColor;
}
execute(SCI_SETCARETFORE, caretColor);
//execute(SCI_SETCARETFORE, caretColor);
execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_CARET, caretColor | 0xFF000000); // SCI_SETCARETFORE is deprecated
COLORREF multiEditCaretColor = darkGrey;
pStyle = stylers.findByName(L"Multi-edit carets color");
if (pStyle)
multiEditCaretColor = pStyle->_fgColor;
execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_CARET_ADDITIONAL, multiEditCaretColor | 0xFF000000);
COLORREF edgeColor = liteGrey;
pStyle = stylers.findByName(TEXT("Edge colour"));

@ -422,11 +422,6 @@ public:
static UserDefineDialog * getUserDefineDlg() {return &_userDefineDlg;};
void setCaretColorWidth(int color, int width = 1) const {
execute(SCI_SETCARETFORE, color);
execute(SCI_SETCARETWIDTH, width);
};
void beSwitched() {
_userDefineDlg.setScintilla(this);
};

@ -1493,7 +1493,9 @@
<WidgetStyle name="Current line background colour" styleID="0" bgColor="E8E8FF" />
<!-- In below rule 'fgColor' attribute for 'Selected text colour' can be unlocked with a enableSelectFgColor.xml file -->
<WidgetStyle name="Selected text colour" styleID="0" bgColor="C0C0C0" fgColor="000000" />
<WidgetStyle name="Caret colour" styleID="2069" fgColor="8000FF" />
<WidgetStyle name="Multi-selected text color" styleID="0" bgColor="C0C0C0" />
<WidgetStyle name="Caret colour" styleID="0" fgColor="8000FF" />
<WidgetStyle name="Multi-edit carets color" styleID="0" fgColor="404040" />
<WidgetStyle name="Edge colour" styleID="0" fgColor="80FFFF" />
<WidgetStyle name="Line number margin" styleID="33" fgColor="808080" bgColor="E4E4E4" fontName="" fontStyle="0" fontSize="" />
<WidgetStyle name="Bookmark margin" styleID="0" bgColor="E0E0E0" />

Loading…
Cancel
Save