From b6020b908311ce90dcd7b60071f1c0528d035b2b Mon Sep 17 00:00:00 2001 From: harrybharry Date: Tue, 27 May 2008 00:47:40 +0000 Subject: [PATCH] Add indicator transparency option. Set it to 100 (out of 255) for better visibility. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@209 f5eea248-9336-0410-98b8-ebc06183d4e3 --- .../src/ScitillaComponent/ScintillaEditView.cpp | 4 ++++ scintilla/include/Scintilla.h | 2 ++ scintilla/src/Editor.cxx | 10 ++++++++++ scintilla/src/Indicator.cxx | 2 +- scintilla/src/Indicator.h | 3 ++- 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index afd6b4419..1dbfeb6cd 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -171,6 +171,10 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere) execute(SCI_INDICSETSTYLE, SCE_UNIVERSAL_FOUND_STYLE, INDIC_ROUNDBOX); execute(SCI_INDICSETSTYLE, SCE_UNIVERSAL_FOUND_STYLE_INC, INDIC_ROUNDBOX); + execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_FOUND_STYLE_2, 100); + execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_FOUND_STYLE, 100); + execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_FOUND_STYLE_INC, 100); + _pParameter = NppParameters::getInstance(); _codepage = ::GetACP(); diff --git a/scintilla/include/Scintilla.h b/scintilla/include/Scintilla.h index 03fb201fa..3c5aab5e7 100644 --- a/scintilla/include/Scintilla.h +++ b/scintilla/include/Scintilla.h @@ -248,6 +248,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_INDICGETFORE 2083 #define SCI_INDICSETUNDER 2510 #define SCI_INDICGETUNDER 2511 +#define SCI_INDICSETALPHA 3097 +#define SCI_INDICGETALPHA 3098 #define SCI_SETWHITESPACEFORE 2084 #define SCI_SETWHITESPACEBACK 2085 #define SCI_SETSTYLEBITS 2090 diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx index 8213debf2..9afaaa5d1 100644 --- a/scintilla/src/Editor.cxx +++ b/scintilla/src/Editor.cxx @@ -7222,6 +7222,16 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_INDICGETUNDER: return (wParam <= INDIC_MAX) ? vs.indicators[wParam].under : 0; + case SCI_INDICSETALPHA: + if (wParam <= INDIC_MAX && lParam <= SC_ALPHA_OPAQUE && lParam > 0) { + vs.indicators[wParam].alpha = lParam; + InvalidateStyleRedraw(); + } + break; + + case SCI_INDICGETALPHA: + return (wParam <= INDIC_MAX) ? vs.indicators[wParam].alpha : 0; + case SCI_SETINDICATORCURRENT: pdoc->decorations.SetCurrentIndicator(wParam); break; diff --git a/scintilla/src/Indicator.cxx b/scintilla/src/Indicator.cxx index 89afb7890..e059f150d 100644 --- a/scintilla/src/Indicator.cxx +++ b/scintilla/src/Indicator.cxx @@ -72,7 +72,7 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r rcBox.top = rcLine.top + 1; rcBox.left = rc.left; rcBox.right = rc.right; - surface->AlphaRectangle(rcBox, 1, fore.allocated, 30, fore.allocated, 50, 0); + surface->AlphaRectangle(rcBox, 1, fore.allocated, alpha, fore.allocated, ((alpha>SC_ALPHA_OPAQUE-20)?SC_ALPHA_OPAQUE:(alpha+20)), 0); } else { // Either INDIC_PLAIN or unknown surface->MoveTo(rc.left, ymid); surface->LineTo(rc.right, ymid); diff --git a/scintilla/src/Indicator.h b/scintilla/src/Indicator.h index 015a1a23d..765a416bc 100644 --- a/scintilla/src/Indicator.h +++ b/scintilla/src/Indicator.h @@ -17,9 +17,10 @@ namespace Scintilla { class Indicator { public: int style; + int alpha; bool under; ColourPair fore; - Indicator() : style(INDIC_PLAIN), under(false), fore(ColourDesired(0,0,0)) { + Indicator() : style(INDIC_PLAIN), alpha(30), under(false), fore(ColourDesired(0,0,0)) { } void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine); };