Make all SCI_SETELEMENTCOLOUR message use 32 bits color

pull/14384/head
Don Ho 2023-11-20 04:59:40 +01:00
parent b24734df8f
commit 0917875034
5 changed files with 18 additions and 19 deletions

View File

@ -4039,8 +4039,8 @@ void Notepad_plus::command(int id)
if (svp._currentLineHiliteMode != LINEHILITE_NONE) if (svp._currentLineHiliteMode != LINEHILITE_NONE)
{ {
_mainEditView.execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_CARET_LINE_BACK, bgColour); _mainEditView.setElementColour(SC_ELEMENT_CARET_LINE_BACK, bgColour);
_subEditView.execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_CARET_LINE_BACK, bgColour); _subEditView.setElementColour(SC_ELEMENT_CARET_LINE_BACK, bgColour);
} }
else else
{ {

View File

@ -1299,10 +1299,10 @@ void AutoCompletion::setColour(COLORREF colour2Set, AutocompleteColorIndex i)
void AutoCompletion::drawAutocomplete(ScintillaEditView* pEditView) void AutoCompletion::drawAutocomplete(ScintillaEditView* pEditView)
{ {
pEditView->execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_LIST, _autocompleteText); pEditView->setElementColour(SC_ELEMENT_LIST, _autocompleteText);
pEditView->execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_LIST_BACK, _autocompleteBg); pEditView->setElementColour(SC_ELEMENT_LIST_BACK, _autocompleteBg);
pEditView->execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_LIST_SELECTED, _selectedText); pEditView->setElementColour(SC_ELEMENT_LIST_SELECTED, _selectedText);
pEditView->execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_LIST_SELECTED_BACK, _selectedBg); pEditView->setElementColour(SC_ELEMENT_LIST_SELECTED_BACK, _selectedBg);
pEditView->execute(SCI_CALLTIPSETBACK, _calltipBg); pEditView->execute(SCI_CALLTIPSETBACK, _calltipBg);
pEditView->execute(SCI_CALLTIPSETFORE, _calltipText); pEditView->execute(SCI_CALLTIPSETFORE, _calltipText);

View File

@ -5004,7 +5004,7 @@ void Finder::setFinderStyle()
const Style * pStyle = pStyler->findByID(SCE_SEARCHRESULT_CURRENT_LINE); const Style * pStyle = pStyler->findByID(SCE_SEARCHRESULT_CURRENT_LINE);
if (pStyle) if (pStyle)
{ {
_scintView.execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_CARET_LINE_BACK, pStyle->_bgColor); _scintView.setElementColour(SC_ELEMENT_CARET_LINE_BACK, pStyle->_bgColor);
_scintView.execute(SCI_SETCARETLINEFRAME, 0); _scintView.execute(SCI_SETCARETLINEFRAME, 0);
_scintView.execute(SCI_SETCARETLINEVISIBLEALWAYS, true); _scintView.execute(SCI_SETCARETLINEVISIBLEALWAYS, true);
} }

View File

@ -252,7 +252,7 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere)
const COLORREF hiddenLinesGreen = RGB(0x77, 0xCC, 0x77); const COLORREF hiddenLinesGreen = RGB(0x77, 0xCC, 0x77);
long hiddenLinesGreenWithAlpha = hiddenLinesGreen | 0xFF000000; long hiddenLinesGreenWithAlpha = hiddenLinesGreen | 0xFF000000;
execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_HIDDEN_LINE, hiddenLinesGreenWithAlpha); setElementColour(SC_ELEMENT_HIDDEN_LINE, hiddenLinesGreenWithAlpha);
if (NppParameters::getInstance()._dpiManager.scaleX(100) >= 150) if (NppParameters::getInstance()._dpiManager.scaleX(100) >= 150)
{ {
@ -2888,7 +2888,7 @@ void ScintillaEditView::performGlobalStyles()
pStyle = stylers.findByName(TEXT("Current line background colour")); pStyle = stylers.findByName(TEXT("Current line background colour"));
if (pStyle) if (pStyle)
{ {
execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_CARET_LINE_BACK, pStyle->_bgColor); setElementColour(SC_ELEMENT_CARET_LINE_BACK, pStyle->_bgColor);
} }
} }
@ -2903,8 +2903,8 @@ void ScintillaEditView::performGlobalStyles()
selectColorFore = pStyle->_fgColor; selectColorFore = pStyle->_fgColor;
} }
//execute(SCI_SETSELBACK, 1, selectColorBack); //execute(SCI_SETSELBACK, 1, selectColorBack);
execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_SELECTION_BACK, selectColorBack | 0xFF000000); // SCI_SETSELBACK is deprecated setElementColour(SC_ELEMENT_SELECTION_BACK, selectColorBack); // SCI_SETSELBACK is deprecated
execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_SELECTION_INACTIVE_BACK, selectColorBack | 0xFF000000); setElementColour(SC_ELEMENT_SELECTION_INACTIVE_BACK, selectColorBack);
COLORREF selectMultiSelectColorBack = liteGrey; COLORREF selectMultiSelectColorBack = liteGrey;
@ -2913,16 +2913,14 @@ void ScintillaEditView::performGlobalStyles()
{ {
selectMultiSelectColorBack = pStyle->_bgColor; selectMultiSelectColorBack = pStyle->_bgColor;
} }
execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_SELECTION_ADDITIONAL_BACK, selectMultiSelectColorBack | 0xFF000000); setElementColour(SC_ELEMENT_SELECTION_ADDITIONAL_BACK, selectMultiSelectColorBack);
if (nppParams.isSelectFgColorEnabled()) if (nppParams.isSelectFgColorEnabled())
{ {
long alphaSelectColorFore = selectColorFore;
alphaSelectColorFore |= 0xFF000000; // add alpha color to make DirectWrite mode work
//execute(SCI_SETSELFORE, 1, selectColorFore); //execute(SCI_SETSELFORE, 1, selectColorFore);
execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_SELECTION_TEXT, alphaSelectColorFore); // SCI_SETSELFORE is deprecated setElementColour(SC_ELEMENT_SELECTION_TEXT, selectColorFore); // SCI_SETSELFORE is deprecated
execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_SELECTION_INACTIVE_TEXT, alphaSelectColorFore); setElementColour(SC_ELEMENT_SELECTION_INACTIVE_TEXT, selectColorFore);
execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_SELECTION_ADDITIONAL_TEXT, alphaSelectColorFore); setElementColour(SC_ELEMENT_SELECTION_ADDITIONAL_TEXT, selectColorFore);
} }
COLORREF caretColor = black; COLORREF caretColor = black;
@ -2932,7 +2930,7 @@ void ScintillaEditView::performGlobalStyles()
caretColor = pStyle->_fgColor; caretColor = pStyle->_fgColor;
} }
//execute(SCI_SETCARETFORE, caretColor); //execute(SCI_SETCARETFORE, caretColor);
execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_CARET, caretColor | 0xFF000000); // SCI_SETCARETFORE is deprecated setElementColour(SC_ELEMENT_CARET, caretColor); // SCI_SETCARETFORE is deprecated
COLORREF multiEditCaretColor = darkGrey; COLORREF multiEditCaretColor = darkGrey;
pStyle = stylers.findByName(L"Multi-edit carets color"); pStyle = stylers.findByName(L"Multi-edit carets color");
@ -2940,7 +2938,7 @@ void ScintillaEditView::performGlobalStyles()
if (pStyle) if (pStyle)
multiEditCaretColor = pStyle->_fgColor; multiEditCaretColor = pStyle->_fgColor;
execute(SCI_SETELEMENTCOLOUR, SC_ELEMENT_CARET_ADDITIONAL, multiEditCaretColor | 0xFF000000); setElementColour(SC_ELEMENT_CARET_ADDITIONAL, multiEditCaretColor);
COLORREF edgeColor = liteGrey; COLORREF edgeColor = liteGrey;
pStyle = stylers.findByName(TEXT("Edge colour")); pStyle = stylers.findByName(TEXT("Edge colour"));

View File

@ -773,6 +773,7 @@ public:
void removeAnyDuplicateLines(); void removeAnyDuplicateLines();
bool expandWordSelection(); bool expandWordSelection();
bool pasteToMultiSelection() const; bool pasteToMultiSelection() const;
void setElementColour(int element, COLORREF color) const { execute(SCI_SETELEMENTCOLOUR, element, color | 0xFF000000); };
protected: protected:
static bool _SciInit; static bool _SciInit;