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
This commit is contained in:
harrybharry 2008-05-27 00:47:40 +00:00
parent fdc6f7d8b0
commit b6020b9083
5 changed files with 19 additions and 2 deletions

View File

@ -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, INDIC_ROUNDBOX);
execute(SCI_INDICSETSTYLE, SCE_UNIVERSAL_FOUND_STYLE_INC, 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(); _pParameter = NppParameters::getInstance();
_codepage = ::GetACP(); _codepage = ::GetACP();

View File

@ -248,6 +248,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_INDICGETFORE 2083 #define SCI_INDICGETFORE 2083
#define SCI_INDICSETUNDER 2510 #define SCI_INDICSETUNDER 2510
#define SCI_INDICGETUNDER 2511 #define SCI_INDICGETUNDER 2511
#define SCI_INDICSETALPHA 3097
#define SCI_INDICGETALPHA 3098
#define SCI_SETWHITESPACEFORE 2084 #define SCI_SETWHITESPACEFORE 2084
#define SCI_SETWHITESPACEBACK 2085 #define SCI_SETWHITESPACEBACK 2085
#define SCI_SETSTYLEBITS 2090 #define SCI_SETSTYLEBITS 2090

View File

@ -7222,6 +7222,16 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_INDICGETUNDER: case SCI_INDICGETUNDER:
return (wParam <= INDIC_MAX) ? vs.indicators[wParam].under : 0; 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: case SCI_SETINDICATORCURRENT:
pdoc->decorations.SetCurrentIndicator(wParam); pdoc->decorations.SetCurrentIndicator(wParam);
break; break;

View File

@ -72,7 +72,7 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
rcBox.top = rcLine.top + 1; rcBox.top = rcLine.top + 1;
rcBox.left = rc.left; rcBox.left = rc.left;
rcBox.right = rc.right; 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 } else { // Either INDIC_PLAIN or unknown
surface->MoveTo(rc.left, ymid); surface->MoveTo(rc.left, ymid);
surface->LineTo(rc.right, ymid); surface->LineTo(rc.right, ymid);

View File

@ -17,9 +17,10 @@ namespace Scintilla {
class Indicator { class Indicator {
public: public:
int style; int style;
int alpha;
bool under; bool under;
ColourPair fore; 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); void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine);
}; };