aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ViewStyle.cxx
diff options
context:
space:
mode:
authorA-R-C-A <unknown>2017-04-06 20:19:23 +1000
committerA-R-C-A <unknown>2017-04-06 20:19:23 +1000
commitdba2fe55b8a4ab4ac34795fe4a4b30a729c77016 (patch)
tree83e69d400b6bde138c940f995e7167d0dc3af765 /src/ViewStyle.cxx
parent84d949ba2662648114028dc3f7470e58064bf25c (diff)
downloadscintilla-mirror-dba2fe55b8a4ab4ac34795fe4a4b30a729c77016.tar.gz
Added a caret line frame as an alternative visual for highlighting the caret line.
Diffstat (limited to 'src/ViewStyle.cxx')
-rw-r--r--src/ViewStyle.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx
index db3ad607b..64f9eee7b 100644
--- a/src/ViewStyle.cxx
+++ b/src/ViewStyle.cxx
@@ -136,6 +136,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
selbarlight = source.selbarlight;
caretcolour = source.caretcolour;
additionalCaretColour = source.additionalCaretColour;
+ caretLineFrame = source.caretLineFrame;
showCaretLineBackground = source.showCaretLineBackground;
alwaysShowCaretLineBackground = source.alwaysShowCaretLineBackground;
caretLineBackground = source.caretLineBackground;
@@ -264,6 +265,7 @@ void ViewStyle::Init(size_t stylesSize_) {
styles[STYLE_LINENUMBER].back = Platform::Chrome();
caretcolour = ColourDesired(0, 0, 0);
additionalCaretColour = ColourDesired(0x7f, 0x7f, 0x7f);
+ caretLineFrame = 0;
showCaretLineBackground = false;
alwaysShowCaretLineBackground = false;
caretLineBackground = ColourDesired(0xff, 0xff, 0);
@@ -479,6 +481,15 @@ void ViewStyle::CalcLargestMarkerHeight() {
}
}
+int ViewStyle::GetFrameWidth() const {
+ return Platform::Clamp(caretLineFrame, 1, lineHeight / 3);
+}
+
+bool ViewStyle::IsLineFrameOpaque(bool caretActive, bool lineContainsCaret) const {
+ return caretLineFrame && (caretActive || alwaysShowCaretLineBackground) && showCaretLineBackground &&
+ (caretLineAlpha == SC_ALPHA_NOALPHA) && lineContainsCaret;
+}
+
// See if something overrides the line background color: Either if caret is on the line
// and background color is set for that, or if a marker is defined that forces its background
// color onto the line, or if a marker is defined but has no selection margin in which to
@@ -487,7 +498,8 @@ void ViewStyle::CalcLargestMarkerHeight() {
// the color for the highest numbered one is used.
ColourOptional ViewStyle::Background(int marksOfLine, bool caretActive, bool lineContainsCaret) const {
ColourOptional background;
- if ((caretActive || alwaysShowCaretLineBackground) && showCaretLineBackground && (caretLineAlpha == SC_ALPHA_NOALPHA) && lineContainsCaret) {
+ if (!caretLineFrame && (caretActive || alwaysShowCaretLineBackground) && showCaretLineBackground &&
+ (caretLineAlpha == SC_ALPHA_NOALPHA) && lineContainsCaret) {
background = ColourOptional(caretLineBackground, true);
}
if (!background.isSet && marksOfLine) {