Browse Source

[SCINTILLA_NEW_FEATURE] Add the capacity of keeping line highlighting even when it loss its focus.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@142 f5eea248-9336-0410-98b8-ebc06183d4e3
pull/343/head^2
donho 17 years ago
parent
commit
7d950fe5d8
  1. 2
      scintilla/include/Scintilla.h
  2. 12
      scintilla/src/Editor.cxx
  3. 2
      scintilla/src/ViewStyle.cxx
  4. 1
      scintilla/src/ViewStyle.h

2
scintilla/include/Scintilla.h

@ -257,6 +257,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETMAXLINESTATE 2094
#define SCI_GETCARETLINEVISIBLE 2095
#define SCI_SETCARETLINEVISIBLE 2096
#define SCI_GETCARETLINEVISIBLEALWAYS 3095
#define SCI_SETCARETLINEVISIBLEALWAYS 3096
#define SCI_GETCARETLINEBACK 2097
#define SCI_SETCARETLINEBACK 2098
#define SCI_STYLESETCHANGEABLE 2099

12
scintilla/src/Editor.cxx

@ -2247,7 +2247,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
// the color for the highest numbered one is used.
bool overrideBackground = false;
ColourAllocated background;
if (caret.active && vsDraw.showCaretLineBackground && (vsDraw.caretLineAlpha == SC_ALPHA_NOALPHA) && ll->containsCaret) {
if ((caret.active || vsDraw.showCaretLineBackgroundAlways) && vsDraw.showCaretLineBackground && (vsDraw.caretLineAlpha == SC_ALPHA_NOALPHA) && ll->containsCaret) {
overrideBackground = true;
background = vsDraw.caretLineBackground.allocated;
}
@ -2630,7 +2630,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
// Draw any translucent whole line states
rcSegment.left = xStart;
rcSegment.right = rcLine.right - 1;
if (caret.active && vsDraw.showCaretLineBackground && ll->containsCaret) {
if ((caret.active || vsDraw.showCaretLineBackgroundAlways) && vsDraw.showCaretLineBackground && ll->containsCaret) {
SimpleAlphaRectangle(surface, rcSegment, vsDraw.caretLineBackground.allocated, vsDraw.caretLineAlpha);
}
int marks = pdoc->GetMark(line);
@ -3174,6 +3174,7 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
vsPrint.whitespaceBackgroundSet = false;
vsPrint.whitespaceForegroundSet = false;
vsPrint.showCaretLineBackground = false;
vsPrint.showCaretLineBackgroundAlways = false;
// Set colours for printing according to users settings
for (size_t sty = 0;sty < vsPrint.stylesSize;sty++) {
@ -6983,6 +6984,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
vs.showCaretLineBackground = wParam != 0;
InvalidateStyleRedraw();
break;
case SCI_GETCARETLINEVISIBLEALWAYS:
return vs.showCaretLineBackgroundAlways;
case SCI_SETCARETLINEVISIBLEALWAYS:
vs.showCaretLineBackgroundAlways = wParam != 0;
InvalidateStyleRedraw();
break;
case SCI_GETCARETLINEBACK:
return vs.caretLineBackground.desired.AsLong();
case SCI_SETCARETLINEBACK:

2
scintilla/src/ViewStyle.cxx

@ -118,6 +118,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
selbarlight.desired = source.selbarlight.desired;
caretcolour.desired = source.caretcolour.desired;
showCaretLineBackground = source.showCaretLineBackground;
showCaretLineBackgroundAlways = source.showCaretLineBackgroundAlways;
caretLineBackground.desired = source.caretLineBackground.desired;
caretLineAlpha = source.caretLineAlpha;
edgecolour.desired = source.edgecolour.desired;
@ -192,6 +193,7 @@ void ViewStyle::Init(size_t stylesSize_) {
styles[STYLE_LINENUMBER].back.desired = Platform::Chrome();
caretcolour.desired = ColourDesired(0, 0, 0);
showCaretLineBackground = false;
showCaretLineBackgroundAlways = false;
caretLineBackground.desired = ColourDesired(0xff, 0xff, 0);
caretLineAlpha = SC_ALPHA_NOALPHA;
edgecolour.desired = ColourDesired(0xc0, 0xc0, 0xc0);

1
scintilla/src/ViewStyle.h

@ -94,6 +94,7 @@ public:
bool showMarkedLines;
ColourPair caretcolour;
bool showCaretLineBackground;
bool showCaretLineBackgroundAlways;
ColourPair caretLineBackground;
int caretLineAlpha;
ColourPair edgecolour;

Loading…
Cancel
Save