diff --git a/src/SciCall.h b/src/SciCall.h index f8602356b..7d897190a 100644 --- a/src/SciCall.h +++ b/src/SciCall.h @@ -553,37 +553,45 @@ DeclareSciCallV2(SetMarginBackN, SETMARGINBACKN, uintptr_t, margin, COLORREF, co DeclareSciCallV2(SetMarginCursorN, SETMARGINCURSORN, uintptr_t, margin, int, cursor); DeclareSciCallV2(SetFoldMarginColour, SETFOLDMARGINCOLOUR, bool, useSetting, COLORREF, colour); DeclareSciCallV2(SetFoldMarginHiColour, SETFOLDMARGINHICOLOUR, bool, useSetting, COLORREF, colour); -DeclareSciCallV1(MarkerEnableHighlight, MARKERENABLEHIGHLIGHT, bool, flag); -DeclareSciCallR2(MarkerNumberFromLine, MARKERNUMBERFROMLINE, int, DocLn, line, int, which); -DeclareSciCallR2(MarkerHandleFromLine, MARKERHANDLEFROMLINE, int, DocLn, line, int, which); -DeclareSciCallR2(TextWidth, TEXTWIDTH, int, int, styleNumber, const char*, text); +DeclareSciCallR2(TextWidth, TEXTWIDTH, int, int, styleNumber, const char *, text); //============================================================================= // // Markers // DeclareSciCallR1(MarkerGet, MARKERGET, int, DocLn, line); -DeclareSciCallV2(MarkerDefine, MARKERDEFINE, int, markerNumber, int, markerSymbols); -DeclareSciCallV2(MarkerSetFore, MARKERSETFORE, int, markerNumber, COLORREF, colour); -DeclareSciCallV2(MarkerSetBack, MARKERSETBACK, int, markerNumber, COLORREF, colour); -DeclareSciCallV2(MarkerSetAlpha, MARKERSETALPHA, int, markerNumber, int, alpha); -DeclareSciCallR2(MarkerAdd, MARKERADD, int, DocLn, line, int, markerNumber); +DeclareSciCallV2(MarkerDefine, MARKERDEFINE, int, markerID, int, markerSymbols); +DeclareSciCallV2(MarkerSetFore, MARKERSETFORE, int, markerID, COLORREF, colour); +DeclareSciCallV2(MarkerSetForeTranslucent, MARKERSETFORETRANSLUCENT, int, markerID, COLORALPHAREF, colouralpha); +DeclareSciCallV2(MarkerSetBack, MARKERSETBACK, int, markerID, COLORREF, colour); +DeclareSciCallV2(MarkerSetBackTranslucent, MARKERSETBACKTRANSLUCENT, int, markerID, COLORALPHAREF, colouralpha); +DeclareSciCallV2(MarkerSetBackSelected, MARKERSETBACKSELECTED, int, markerID, COLORREF, colour); +DeclareSciCallV2(MarkerSetBackSelectedTranslucent, MARKERSETBACKSELECTEDTRANSLUCENT, int, markerID, COLORALPHAREF, colouralpha); +DeclareSciCallV2(MarkerSetStrokeWidth, MARKERSETSTROKEWIDTH, int, markerID, int, hundredths); +DeclareSciCallV1(MarkerEnableHighlight, MARKERENABLEHIGHLIGHT, bool, flag); +//~DeclareSciCallV2(MarkerSetAlpha, MARKERSETALPHA, int, markerID, int, alpha); // deprecated w/ v5.0.1 ? +DeclareSciCallR2(MarkerAdd, MARKERADD, int, DocLn, line, int, markerID); DeclareSciCallV2(MarkerAddSet, MARKERADDSET, DocLn, line, int, markerMask); -DeclareSciCallV2(MarkerDelete, MARKERDELETE, DocLn, line, int, markerNumber); -DeclareSciCallV1(MarkerDeleteAll, MARKERDELETEALL, int, markerNumber); -DeclareSciCallV2(MarkerSetBackSelected, MARKERSETBACKSELECTED, int, markerNumber, int, colour); +DeclareSciCallV2(MarkerDelete, MARKERDELETE, DocLn, line, int, markerID); +DeclareSciCallV1(MarkerDeleteAll, MARKERDELETEALL, int, markerID); DeclareSciCallR2(MarkerNext, MARKERNEXT, DocLn, DocLn, start, int, markerMask); DeclareSciCallR2(MarkerPrevious, MARKERPREVIOUS, DocLn, DocLn, start, int, markerMask); +DeclareSciCallR2(MarkerNumberFromLine, MARKERNUMBERFROMLINE, int, DocLn, line, int, which); +DeclareSciCallR2(MarkerHandleFromLine, MARKERHANDLEFROMLINE, int, DocLn, line, int, which); //============================================================================= // // Indicators // DeclareSciCallV2(IndicSetStyle, INDICSETSTYLE, int, indicID, int, style); -DeclareSciCallR1(IndicGetFore, INDICGETFORE, COLORREF, int, indicID); +DeclareSciCallR1(IndicGetStyle, INDICGETSTYLE, int, int, indicID); DeclareSciCallV2(IndicSetFore, INDICSETFORE, int, indicID, COLORREF, colour); +DeclareSciCallR1(IndicGetFore, INDICGETFORE, COLORREF, int, indicID); +DeclareSciCallV2(IndicSetStrokeWidth, INDICSETSTROKEWIDTH, int, indicID, int, hundredths); +DeclareSciCallR1(IndicGetStrokeWidth, INDICGETSTROKEWIDTH, int, int, indicID); DeclareSciCallV2(IndicSetUnder, INDICSETUNDER, int, indicID, bool, under); +DeclareSciCallR1(IndicGetUnder, INDICGETUNDER, bool, int, indicID); DeclareSciCallV2(IndicSetHoverStyle, INDICSETHOVERSTYLE, int, indicID, int, style); DeclareSciCallV2(IndicSetHoverFore, INDICSETHOVERFORE, int, indicID, COLORREF, colour); DeclareSciCallV2(IndicSetAlpha, INDICSETALPHA, int, indicID, int, alpha); @@ -689,7 +697,7 @@ DeclareSciCallR0(IsSelectionRectangle, SELECTIONISRECTANGLE, bool); //~#define Sci_GetDocEndPosition() (SciCall_GetTextLength() - 1) #define Sci_GetDocEndPosition() SciCall_PositionAfter(SciCall_GetTextLength() - 1) -#define Sci_ClampAlpha(alpha) clampi((alpha), SC_ALPHA_TRANSPARENT, /*SC_ALPHA_OPAQUE*/SC_ALPHA_NOALPHA) +#define Sci_ClampAlpha(alpha) clampi((alpha), SC_ALPHA_TRANSPARENT, SC_ALPHA_OPAQUE) //~SC_ALPHA_NOALPHA // max. line length in range (incl. line-breaks) inline DocPos Sci_GetRangeMaxLineLength(DocLn iBeginLine, DocLn iEndLine) diff --git a/src/Styles.c b/src/Styles.c index 8afee774a..8af7d8efb 100644 --- a/src/Styles.c +++ b/src/Styles.c @@ -1305,6 +1305,8 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew) } Style_SetStyles(hwnd, pCurrentStandard->Styles[STY_INDENT_GUIDE].iStyle, pCurrentStandard->Styles[STY_INDENT_GUIDE].szValue, false); // indent guide + // TODO: @@@ DirectFunction instead of SendMsg + if (Style_StrGetColor(pCurrentStandard->Styles[STY_SEL_TXT].szValue, FOREGROUND_LAYER, &rgb, false)) { // selection fore SendMessage(hwnd, SCI_SETSELFORE, true, rgb); SendMessage(hwnd, SCI_SETADDITIONALSELFORE, rgb, 0); @@ -1882,25 +1884,32 @@ void Style_SetMargin(HWND hwnd, LPCWSTR lpszStyle) // iStyle = STYLE_LINENUMBER Style_StrGetColor(lpszStyle, BACKGROUND_LAYER, &bckgrnd, true); bmkBack = Style_RgbAlpha(bmkBack, bckgrnd, alpha); + int strokeWidth = FW_NORMAL; + if (!Style_StrGetWeightValue(lpszStyle, &strokeWidth)) { + strokeWidth = FW_NORMAL; + } + strokeWidth >>= 2; + SciCall_MarkerDefine(MARKER_NP3_BOOKMARK, SC_MARK_VERTICALBOOKMARK); // SC_MARK_BOOKMARK/SC_MARK_SHORTARROW - SciCall_MarkerSetFore(MARKER_NP3_BOOKMARK, bmkFore); - SciCall_MarkerSetBack(MARKER_NP3_BOOKMARK, bmkBack); - SciCall_MarkerSetAlpha(MARKER_NP3_BOOKMARK, alpha); // no margin or SC_MARK_BACKGROUND or SC_MARK_UNDERLINE + SciCall_MarkerSetStrokeWidth(MARKER_NP3_BOOKMARK, strokeWidth); + SciCall_MarkerSetForeTranslucent(MARKER_NP3_BOOKMARK, RGBxA(bmkFore, SC_ALPHA_OPAQUE)); + SciCall_MarkerSetBackTranslucent(MARKER_NP3_BOOKMARK, RGBxA(bmkBack, alpha)); // occurrence bookmarker bool const visible = Settings.MarkOccurrencesBookmark; SciCall_MarkerDefine(MARKER_NP3_OCCURRENCE, visible ? SC_MARK_ARROWS : SC_MARK_BACKGROUND); - SciCall_MarkerSetFore(MARKER_NP3_OCCURRENCE, CalcContrastColor(clrBack, 100)); - SciCall_MarkerSetAlpha(MARKER_NP3_OCCURRENCE, SC_ALPHA_TRANSPARENT); + SciCall_MarkerSetStrokeWidth(MARKER_NP3_OCCURRENCE, strokeWidth); + SciCall_MarkerSetForeTranslucent(MARKER_NP3_OCCURRENCE, RGBxA(CalcContrastColor(clrBack, 100), SC_ALPHA_OPAQUE)); + SciCall_MarkerSetBackTranslucent(MARKER_NP3_OCCURRENCE, RGBxA(clrBack, SC_ALPHA_TRANSPARENT)); + //~SciCall_MarkerSetForeSelected(MARKER_NP3_OCCURRENCE, RGB(0,0,220)); // --- WordBookMarks --- COLORREF color; for (int m = MARKER_NP3_1; m < MARKER_NP3_BOOKMARK; ++m) { SciCall_MarkerDefine(m, (Settings.FocusViewMarkerMode & FVMM_LN_BACKGR) ? SC_MARK_BACKGROUND : SC_MARK_BOOKMARK); Style_StrGetColor(WordBookMarks[m], BACKGROUND_LAYER, &color, true); - SciCall_MarkerSetFore(m, color); - SciCall_MarkerSetBack(m, color); - SciCall_MarkerSetAlpha(m, alpha); // no margin or SC_MARK_BACKGROUND or SC_MARK_UNDERLINE + SciCall_MarkerSetForeTranslucent(m, RGBxA(color, SC_ALPHA_OPAQUE)); + SciCall_MarkerSetBackTranslucent(m, RGBxA(color, alpha)); // 'alpha' no meaning for SC_MARK_BACKGROUND } SciCall_SetMarginBackN(MARGIN_SCI_BOOKMRK, clrBack); @@ -1909,7 +1918,6 @@ void Style_SetMargin(HWND hwnd, LPCWSTR lpszStyle) // iStyle = STYLE_LINENUMBER // --- Code folding --- - COLORREF fldHiLight = clrFore; const WCHAR* wchHighlightStyleStrg = GetCurrentStdLexer()->Styles[STY_SEL_TXT].szValue; Style_StrGetColor(wchHighlightStyleStrg, FOREGROUND_LAYER, &fldHiLight, true); diff --git a/src/TypeDefs.h b/src/TypeDefs.h index 8f5a3cbc0..6206e6e00 100644 --- a/src/TypeDefs.h +++ b/src/TypeDefs.h @@ -95,6 +95,16 @@ inline void RectFromWinInfo(const WININFO* const pWinInfo, LPRECT pRect) // ---------------------------------------------------------------------------- +typedef int COLORALPHAREF; +#define RGBA(r, g, b, a) ((COLORALPHAREF)(((BYTE)(r) | ((WORD)((BYTE)(g)) << 8)) | (((DWORD)(BYTE)(b)) << 16) | (((DWORD)(BYTE)(a)) << 24))) +#define RGBxA(rgb, a) ((COLORALPHAREF)(((DWORD)(rgb)&0xffffff) | (((DWORD)(BYTE)(a)) << 24))) +#define GetRedValue(rgba) (LOBYTE(rgba)) +#define GetGreenValue(rgba) (LOBYTE(((WORD)(rgba)) >> 8)) +#define GetBlueValue(rgba) (LOBYTE((rgba) >> 16)) +#define GetAlphaValue(rgba) (LOBYTE((rgba) >> 24)) + +// ---------------------------------------------------------------------------- + typedef enum { BACKGROUND_LAYER = 0, FOREGROUND_LAYER = 1 } COLOR_LAYER; // Style_GetColor() typedef enum { OPEN_WITH_BROWSER = 1, OPEN_WITH_NOTEPAD3 = 2, COPY_HYPERLINK = 4, SELECT_HYPERLINK = 8 } HYPERLINK_OPS; // Hyperlink Operations typedef enum { FWM_NO_INIT = -1, FWM_DONT_CARE = 0, FWM_MSGBOX = 1, FWM_AUTORELOAD = 2, FWM_EXCLUSIVELOCK = 3 } FILE_WATCHING_MODE;