diff options
author | Neil <nyamatongwe@gmail.com> | 2021-05-11 08:36:14 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2021-05-11 08:36:14 +1000 |
commit | a2eaf21d3ce1010aa32bb09b409fc6b019b31732 (patch) | |
tree | c09b0b996948d4eb88bd459bd4917dea4f7ab9eb /src | |
parent | 7b98798ee4047aec150927d3b5fc6a75f78e0273 (diff) | |
download | scintilla-mirror-a2eaf21d3ce1010aa32bb09b409fc6b019b31732.tar.gz |
Add tests for element APIs. Fix SCI_GETELEMENTCOLOUR to return value including
alpha. Set selection and caret elements as allowing translucency.
Diffstat (limited to 'src')
-rw-r--r-- | src/Editor.cxx | 2 | ||||
-rw-r--r-- | src/Geometry.h | 4 | ||||
-rw-r--r-- | src/ViewStyle.cxx | 16 |
3 files changed, 21 insertions, 1 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index e6a31f11a..17749d799 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -7200,7 +7200,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { break; case SCI_GETELEMENTCOLOUR: - return vs.ElementColour(static_cast<int>(wParam)).value_or(ColourAlpha()).OpaqueRGB(); + return vs.ElementColour(static_cast<int>(wParam)).value_or(ColourAlpha()).AsInteger(); case SCI_RESETELEMENTCOLOUR: vs.ResetElement(static_cast<int>(wParam)); diff --git a/src/Geometry.h b/src/Geometry.h index e9cb5a6c8..01af92969 100644 --- a/src/Geometry.h +++ b/src/Geometry.h @@ -187,6 +187,10 @@ public: return ColourAlpha(co | (0xffu << 24)); } + constexpr int AsInteger() const noexcept { + return co; + } + constexpr int OpaqueRGB() const noexcept { return co & 0xffffff; } diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index ed08ad6ce..4d555b1c2 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -206,6 +206,17 @@ void ViewStyle::Init(size_t stylesSize_) { elementBaseColours[SC_ELEMENT_SELECTION_ADDITIONAL_BACK] = ColourAlpha(0xd7, 0xd7, 0xd7, 0xff); elementBaseColours[SC_ELEMENT_SELECTION_SECONDARY_BACK] = ColourAlpha(0xb0, 0xb0, 0xb0, 0xff); elementBaseColours[SC_ELEMENT_SELECTION_NO_FOCUS_BACK] = ColourAlpha(0x80, 0x80, 0x80, 0x3f); + elementAllowsTranslucent.insert({ + SC_ELEMENT_SELECTION_TEXT, + SC_ELEMENT_SELECTION_BACK, + SC_ELEMENT_SELECTION_ADDITIONAL_TEXT, + SC_ELEMENT_SELECTION_ADDITIONAL_BACK, + SC_ELEMENT_SELECTION_SECONDARY_TEXT, + SC_ELEMENT_SELECTION_SECONDARY_BACK, + SC_ELEMENT_SELECTION_NO_FOCUS_TEXT, + SC_ELEMENT_SELECTION_BACK, + SC_ELEMENT_SELECTION_NO_FOCUS_BACK, + }); selection.layer = Layer::base; selection.eolFilled = false; @@ -224,6 +235,11 @@ void ViewStyle::Init(size_t stylesSize_) { elementBaseColours[SC_ELEMENT_CARET] = ColourAlpha(0, 0, 0); elementBaseColours[SC_ELEMENT_CARET_ADDITIONAL] = ColourAlpha(0x7f, 0x7f, 0x7f); elementBaseColours[SC_ELEMENT_CARET_SECONDARY] = ColourAlpha(0, 0, 0, 0x40); + elementAllowsTranslucent.insert({ + SC_ELEMENT_CARET, + SC_ELEMENT_CARET_ADDITIONAL, + SC_ELEMENT_CARET_SECONDARY, + }); caret.style = CARETSTYLE_LINE; caret.width = 1; |