mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-14 21:09:05 +08:00
Merge pull request #4442 from RaiKoHoff/Dev_Master
Fixes and minor design change for Margin and Bookmark handling
This commit is contained in:
commit
619b7989ae
@ -30,7 +30,7 @@ Whitespace (Colors, Size 0-12)=fore:#F2460D
|
||||
Current Line Background (Color)=size:2; fore:#606060; back:#F2F20D; alpha:50
|
||||
Long Line Marker (Colors)=fore:#F2B50D
|
||||
Extra Line Spacing (Size)=size:2
|
||||
Bookmarks and Folding (Colors, Size)=size:+2; fore:#DEDEDE; back:#0CE50B; alpha:100
|
||||
Bookmarks and Folding (Colors, Size)=size:+2; fore:#0CE50B; alpha:100
|
||||
Mark Occurrences (Indicator)=fore:#589FE2; alpha:60; alpha2:60; indic_roundbox
|
||||
Hyperlink Hotspots=fore:#8C99ED; back:#A1D8F2; indic_plain
|
||||
Unicode-Point Hover=fore:#0BCF0A; alpha:60; alpha2:180; indic_compositionthick
|
||||
@ -51,7 +51,7 @@ Inline-IME Color=fore:#4EF64D
|
||||
2nd Whitespace (Colors, Size 0-12)=fore:#F2460D
|
||||
2nd Current Line Background (Color)=size:2; fore:#A1B7F2; back:#F2F20D; alpha:50
|
||||
2nd Long Line Marker (Colors)=fore:#F2B50D
|
||||
2nd Bookmarks and Folding (Colors, Size)=size:+2; charset:2; fore:#DEDEDE; back:#0CE50B; case:U; alpha:100
|
||||
2nd Bookmarks and Folding (Colors, Size)=size:+2; charset:2; fore:#0CE50B; case:U; alpha:100
|
||||
2nd Mark Occurrences (Indicator)=fore:#7B83E9; alpha:60; alpha2:60; indic_box
|
||||
2nd Hyperlink Hotspots=fore:#1EF31D; back:#57F655; alpha:180; indic_compositionthin
|
||||
2nd Unicode-Point Hover=fore:#7D86EA; alpha:60; alpha2:180; indic_compositionthick
|
||||
|
||||
@ -4525,7 +4525,6 @@ static void _ApplyChangeHistoryMode()
|
||||
else {
|
||||
SciCall_SetChangeHistory(Settings.ChangeHistoryMode);
|
||||
}
|
||||
Style_UpdateChangeHistoryMargin(Globals.hwndEdit);
|
||||
UpdateMargins(true);
|
||||
}
|
||||
|
||||
@ -10334,35 +10333,10 @@ static void _UpdateStatusbarDelayed(bool bForceRedraw)
|
||||
//
|
||||
void UpdateMargins(const bool bForce)
|
||||
{
|
||||
static bool bShowLnNums = false;
|
||||
static DocLn prevLineCount = -1LL;
|
||||
|
||||
DocLn const currLineCount = SciCall_GetLineCount();
|
||||
|
||||
if (!bForce && (currLineCount == prevLineCount) && (bShowLnNums == Settings.ShowLineNumbers)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Settings.ShowLineNumbers) {
|
||||
static char chLines[32] = { '\0' };
|
||||
StringCchPrintfA(chLines, COUNTOF(chLines), "_%td", (size_t)currLineCount);
|
||||
int const iLineMarginWidthFit = SciCall_TextWidth(STYLE_LINENUMBER, chLines);
|
||||
int const iLineMarginWidthNow = SciCall_GetMarginWidthN(MARGIN_SCI_LINENUM);
|
||||
if (iLineMarginWidthNow != iLineMarginWidthFit) {
|
||||
SciCall_SetMarginWidthN(MARGIN_SCI_LINENUM, iLineMarginWidthFit);
|
||||
}
|
||||
} else {
|
||||
SciCall_SetMarginWidthN(MARGIN_SCI_LINENUM, 0);
|
||||
}
|
||||
Style_UpdateBookmarkMargin(Globals.hwndEdit);
|
||||
Style_UpdateChangeHistoryMargin(Globals.hwndEdit);
|
||||
Style_UpdateFoldingMargin(Globals.hwndEdit, (FocusedView.CodeFoldingAvailable && FocusedView.ShowCodeFolding));
|
||||
bShowLnNums = Settings.ShowLineNumbers;
|
||||
prevLineCount = currLineCount;
|
||||
Style_UpdateAllMargins(Globals.hwndEdit, bForce);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// UpdateSaveSettingsCmds()
|
||||
|
||||
@ -20,7 +20,7 @@ EDITLEXER lexStandard =
|
||||
/* 9 */ { {_STYLE_GETSTYLEID(STY_CARET)}, IDS_LEX_STD_CARET, L"Caret (Color, Size 1-3)", L"", L"" },
|
||||
/* 10 */ { {_STYLE_GETSTYLEID(STY_LONG_LN_MRK)}, IDS_LEX_STD_LONG_LN, L"Long Line Marker (Colors)", L"fore:#FFC000", L"" },
|
||||
/* 11 */ { {_STYLE_GETSTYLEID(STY_X_LN_SPACE)}, IDS_LEX_STD_X_SPC, L"Extra Line Spacing (Size)", L"size:2", L"" },
|
||||
/* 12 */ { {_STYLE_GETSTYLEID(STY_BOOK_MARK)}, IDS_LEX_STD_BKMRK, L"Bookmarks and Folding (Colors, Size)", L"fore:#000000; back:#00DC00; alpha:100", L"" },
|
||||
/* 12 */ { {_STYLE_GETSTYLEID(STY_BOOK_MARK)}, IDS_LEX_STD_BKMRK, L"Bookmarks and Folding (Colors, Size)", L"fore:#00DC00; alpha:100", L"" },
|
||||
/* 13 */ { {_STYLE_GETSTYLEID(STY_MARK_OCC)}, IDS_LEX_STR_63262, L"Mark Occurrences (Indicator)", L"fore:#3399FF; alpha:60; alpha2:60; indic_roundbox", L"" },
|
||||
/* 14 */ { {_STYLE_GETSTYLEID(STY_URL_HOTSPOT)}, IDS_LEX_STR_63264, L"Hyperlink Hotspots", L"fore:#0000E0; back:#0060B0; indic_plain", L"" },
|
||||
/* 15 */ { {_STYLE_GETSTYLEID(STY_UNICODE_HOTSPOT)}, IDS_LEX_STR_63367, L"Unicode-Point Hover", L"fore:#00FA00; alpha:60; alpha2:180; indic_compositionthick", L""},
|
||||
@ -50,7 +50,7 @@ EDITLEXER lexStandard2nd =
|
||||
/* 9 */ { {_STYLE_GETSTYLEID(STY_CARET)}, IDS_LEX_2ND_CARET, L"2nd Caret (Color, Size 1-3)", L"", L"" },
|
||||
/* 10 */ { {_STYLE_GETSTYLEID(STY_LONG_LN_MRK)}, IDS_LEX_2ND_LONG_LN, L"2nd Long Line Marker (Colors)", L"fore:#FFC000", L"" },
|
||||
/* 11 */ { {_STYLE_GETSTYLEID(STY_X_LN_SPACE)}, IDS_LEX_2ND_X_SPC, L"2nd Extra Line Spacing (Size)", L"", L"" },
|
||||
/* 12 */ { {_STYLE_GETSTYLEID(STY_BOOK_MARK)}, IDS_LEX_2ND_BKMRK, L"2nd Bookmarks and Folding (Colors, Size)", L"charset:2; fore:#000000; back:#00DC00; case:U; alpha:100", L"" },
|
||||
/* 12 */ { {_STYLE_GETSTYLEID(STY_BOOK_MARK)}, IDS_LEX_2ND_BKMRK, L"2nd Bookmarks and Folding (Colors, Size)", L"charset:2; fore:#00DC00; case:U; alpha:100", L"" },
|
||||
/* 13 */ { {_STYLE_GETSTYLEID(STY_MARK_OCC)}, IDS_LEX_STR_63263, L"2nd Mark Occurrences (Indicator)", L"fore:#0000FF; alpha:60; alpha2:60; indic_box", L"" },
|
||||
/* 14 */ { {_STYLE_GETSTYLEID(STY_URL_HOTSPOT)}, IDS_LEX_STR_63265, L"2nd Hyperlink Hotspots", L"fore:#00D000; back:#009C00; alpha:180; indic_compositionthin", L"" },
|
||||
/* 15 */ { {_STYLE_GETSTYLEID(STY_UNICODE_HOTSPOT)}, IDS_LEX_STR_63368, L"2nd Unicode-Point Hover", L"fore:#0000FA; alpha:60; alpha2:180; indic_compositionthick", L""},
|
||||
|
||||
163
src/Styles.c
163
src/Styles.c
@ -652,7 +652,7 @@ float Style_GetCurrentLexerFontSize()
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// Style_RgbAlpha()
|
||||
// Style_RgbAlpha() - Simulate Translucency
|
||||
//
|
||||
int Style_RgbAlpha(int rgbFore, int rgbBack, int alpha)
|
||||
{
|
||||
@ -1527,6 +1527,7 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
|
||||
iValue = clampi(iValue, 1, 12);
|
||||
StringCchPrintf(wchSpecificStyle, COUNTOF(wchSpecificStyle), L"size:%i", iValue);
|
||||
}
|
||||
//@@@SciCall_SetWhiteSpaceSize(MulDiv(iValue, SciCall_GetZoom(), 100)); // needs update on zoom
|
||||
SciCall_SetWhiteSpaceSize(iValue);
|
||||
|
||||
// whitespace colors
|
||||
@ -1576,12 +1577,6 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
|
||||
// current line background
|
||||
Style_HighlightCurrentLine(hwnd, Settings.HighlightCurrentLine);
|
||||
|
||||
// bookmark line or marker
|
||||
Style_UpdateBookmarkMargin(hwnd);
|
||||
|
||||
// Change History
|
||||
Style_UpdateChangeHistoryMargin(Globals.hwndEdit);
|
||||
|
||||
// Hyperlink (URL) indicators
|
||||
Style_SetUrlHotSpot(hwnd);
|
||||
|
||||
@ -1720,10 +1715,10 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
|
||||
}
|
||||
|
||||
if (bFocusedView) {
|
||||
EditToggleView(Globals.hwndEdit);
|
||||
EditToggleView(hwnd);
|
||||
}
|
||||
|
||||
UpdateMargins(true);
|
||||
Style_UpdateAllMargins(hwnd, true);
|
||||
|
||||
EndWaitCursor();
|
||||
|
||||
@ -2015,41 +2010,58 @@ void Style_HighlightCurrentLine(HWND hwnd, int iHiLitCurLn)
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// _GetMarkerMarginWidth()
|
||||
// Style_UpdateLineNumberMargin()
|
||||
//
|
||||
static int _GetMarkerMarginWidth(HWND hwnd, const float scale)
|
||||
void Style_UpdateLineNumberMargin(const bool bForce)
|
||||
{
|
||||
float ftotal = 0.0f;
|
||||
float const fbase = Style_GetBaseFontSize();
|
||||
static bool bShowLnNums = false;
|
||||
static DocLn prevLineCount = -1LL;
|
||||
|
||||
float fSize = fbase;
|
||||
Style_StrGetSizeFloatEx(GetCurrentStdLexer()->Styles[STY_MARGIN].szValue, &fSize); // linenumber
|
||||
ftotal += fSize;
|
||||
DocLn const currLineCount = SciCall_GetLineCount();
|
||||
|
||||
fSize = fbase;
|
||||
Style_StrGetSizeFloatEx(GetCurrentStdLexer()->Styles[STY_BOOK_MARK].szValue, &fSize); // settings
|
||||
ftotal += fSize;
|
||||
if (!bForce && (currLineCount == prevLineCount) && (bShowLnNums == Settings.ShowLineNumbers)) {
|
||||
return;
|
||||
}
|
||||
|
||||
float const zoomPercent = (float)SciCall_GetZoom();
|
||||
return ScaleFloatToDPI(hwnd, (ftotal * zoomPercent * scale) / 100.0f);
|
||||
if (Settings.ShowLineNumbers) {
|
||||
static char chLines[32] = { '\0' };
|
||||
StringCchPrintfA(chLines, COUNTOF(chLines), "_%td", (size_t)currLineCount);
|
||||
int const iLineMarginWidthFit = SciCall_TextWidth(STYLE_LINENUMBER, chLines);
|
||||
int const iLineMarginWidthNow = SciCall_GetMarginWidthN(MARGIN_SCI_LINENUM);
|
||||
if (iLineMarginWidthNow != iLineMarginWidthFit) {
|
||||
SciCall_SetMarginWidthN(MARGIN_SCI_LINENUM, iLineMarginWidthFit);
|
||||
}
|
||||
}
|
||||
else {
|
||||
SciCall_SetMarginWidthN(MARGIN_SCI_LINENUM, 0);
|
||||
}
|
||||
|
||||
bShowLnNums = Settings.ShowLineNumbers;
|
||||
prevLineCount = currLineCount;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// Style_UpdateFoldingMargin()
|
||||
// _GetMarkerMarginWidth()
|
||||
//
|
||||
void Style_UpdateFoldingMargin(HWND hwnd, bool bShowMargin)
|
||||
static int _GetMarkerMarginWidth(HWND hwnd, LPCWSTR styleStrg, const float fScale)
|
||||
{
|
||||
SciCall_SetMarginWidthN(MARGIN_SCI_FOLDING, (bShowMargin ? _GetMarkerMarginWidth(hwnd, 0.5f) : 0));
|
||||
UNREFERENCED_PARAMETER(hwnd);
|
||||
float fSize = (float)SciCall_TextWidth(STYLE_LINENUMBER, "__"); // 2x underscore
|
||||
Style_StrGetSizeFloatEx(styleStrg, &fSize);
|
||||
return lroundf(fSize * fScale);
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// Style_UpdateBookmarkMargin()
|
||||
//
|
||||
void Style_UpdateBookmarkMargin(HWND hwnd)
|
||||
{
|
||||
SciCall_SetMarginWidthN(MARGIN_SCI_BOOKMRK, (Settings.ShowBookmarkMargin ? _GetMarkerMarginWidth(hwnd, 0.7f) : 0));
|
||||
int const size = _GetMarkerMarginWidth(hwnd, GetCurrentStdLexer()->Styles[STY_BOOK_MARK].szValue, 1.0f);
|
||||
SciCall_SetMarginWidthN(MARGIN_SCI_BOOKMRK, (Settings.ShowBookmarkMargin ? size : 0));
|
||||
}
|
||||
|
||||
|
||||
@ -2059,8 +2071,36 @@ void Style_UpdateBookmarkMargin(HWND hwnd)
|
||||
//
|
||||
void Style_UpdateChangeHistoryMargin(HWND hwnd)
|
||||
{
|
||||
int const size = _GetMarkerMarginWidth(hwnd, GetCurrentStdLexer()->Styles[STY_BOOK_MARK].szValue, 1.0f);
|
||||
bool const bShowMargin = (Settings.ChangeHistoryMode & SC_CHANGE_HISTORY_MARKERS);
|
||||
SciCall_SetMarginWidthN(MARGIN_SCI_CHGHIST, (bShowMargin ? _GetMarkerMarginWidth(hwnd, 0.7f) : 0));
|
||||
SciCall_SetMarginWidthN(MARGIN_SCI_CHGHIST, (bShowMargin ? size : 0));
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// Style_UpdateFoldingMargin()
|
||||
//
|
||||
void Style_UpdateFoldingMargin(HWND hwnd, bool bShowMargin)
|
||||
{
|
||||
int const size = _GetMarkerMarginWidth(hwnd, GetCurrentStdLexer()->Styles[STY_BOOK_MARK].szValue, 0.8f);
|
||||
SciCall_SetMarginWidthN(MARGIN_SCI_FOLDING, (bShowMargin ? size : 0));
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// UpdateMargins()
|
||||
//
|
||||
//
|
||||
void Style_UpdateAllMargins(HWND hwnd, const bool bForce)
|
||||
{
|
||||
Style_UpdateLineNumberMargin(bForce);
|
||||
if (bForce) {
|
||||
Style_UpdateBookmarkMargin(hwnd);
|
||||
Style_UpdateChangeHistoryMargin(hwnd);
|
||||
Style_UpdateFoldingMargin(hwnd, (FocusedView.CodeFoldingAvailable && FocusedView.ShowCodeFolding));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2072,6 +2112,7 @@ void Style_SetMargin(HWND hwnd, LPCWSTR lpszStyle) /// iStyle == STYLE_LINENUMBE
|
||||
{
|
||||
Style_SetStyles(hwnd, STYLE_LINENUMBER, lpszStyle, Style_GetBaseFontSize()); // line numbers
|
||||
|
||||
int alpha;
|
||||
COLORREF colorRead;
|
||||
|
||||
// foreground
|
||||
@ -2087,15 +2128,6 @@ void Style_SetMargin(HWND hwnd, LPCWSTR lpszStyle) /// iStyle == STYLE_LINENUMBE
|
||||
}
|
||||
COLORREF const clrMarginBack = colorRead;
|
||||
|
||||
COLORREF fldHiLight = clrLineNumFore;
|
||||
const WCHAR* wchHighlightStyleStrg = GetCurrentStdLexer()->Styles[STY_SEL_TXT].szValue;
|
||||
Style_StrGetColor(wchHighlightStyleStrg, FOREGROUND_LAYER, &fldHiLight, NULL, true);
|
||||
|
||||
COLORREF clrFoldMarginBack = clrMarginBack;
|
||||
const WCHAR* wchDefaultStyleStrg = GetCurrentStdLexer()->Styles[STY_DEFAULT].szValue;
|
||||
Style_StrGetColor(wchDefaultStyleStrg, BACKGROUND_LAYER, &clrFoldMarginBack, NULL, true);
|
||||
|
||||
|
||||
// --- Line Numbers ---
|
||||
SciCall_StyleSetBack(STYLE_LINENUMBER, clrMarginBack);
|
||||
SciCall_SetMarginBackN(MARGIN_SCI_LINENUM, clrMarginBack);
|
||||
@ -2112,17 +2144,19 @@ void Style_SetMargin(HWND hwnd, LPCWSTR lpszStyle) /// iStyle == STYLE_LINENUMBE
|
||||
// --- Bookmarks ---
|
||||
LPCWSTR const wchBookMarkStyleStrg = GetCurrentStdLexer()->Styles[STY_BOOK_MARK].szValue;
|
||||
|
||||
colorRead = clrLineNumFore;
|
||||
colorRead = clrLineNumFore; // bookmark
|
||||
Style_StrGetColor(wchBookMarkStyleStrg, FOREGROUND_LAYER, &colorRead, NULL, false);
|
||||
|
||||
COLORREF const clrBookMarkFore = colorRead;
|
||||
|
||||
colorRead = clrMarginBack;
|
||||
Style_StrGetColor(wchBookMarkStyleStrg, BACKGROUND_LAYER, &colorRead, NULL, false);
|
||||
// adjust background color by alpha in case of show margin
|
||||
int alpha;
|
||||
Style_StrGetAlpha(wchBookMarkStyleStrg, &alpha, SC_ALPHA_OPAQUE, true);
|
||||
COLORREF const clrBookMarkBack = Style_RgbAlpha(colorRead, clrMarginBack, alpha);
|
||||
int const bookmarkAlpha = alpha;
|
||||
|
||||
colorRead = clrMarginBack; // folding signs
|
||||
// document background as default:
|
||||
Style_StrGetColor(GetCurrentStdLexer()->Styles[STY_DEFAULT].szValue, BACKGROUND_LAYER, &colorRead, NULL, true);
|
||||
// if defined, use bookmark background color
|
||||
Style_StrGetColor(wchBookMarkStyleStrg, BACKGROUND_LAYER, &colorRead, NULL, false);
|
||||
COLORREF const clrFoldMarginBack = colorRead;
|
||||
|
||||
int strokeWidth = FW_DONTCARE;
|
||||
if (!Style_StrGetWeightValue(lpszStyle, &strokeWidth)) {
|
||||
@ -2132,8 +2166,10 @@ void Style_SetMargin(HWND hwnd, LPCWSTR lpszStyle) /// iStyle == STYLE_LINENUMBE
|
||||
|
||||
SciCall_MarkerDefine(MARKER_NP3_BOOKMARK, SC_MARK_VERTICALBOOKMARK); // SC_MARK_BOOKMARK/SC_MARK_SHORTARROW
|
||||
SciCall_MarkerSetStrokeWidth(MARKER_NP3_BOOKMARK, strokeWidth);
|
||||
SciCall_MarkerSetForeTranslucent(MARKER_NP3_BOOKMARK, RGBxA(clrBookMarkFore, SC_ALPHA_OPAQUE));
|
||||
SciCall_MarkerSetBackTranslucent(MARKER_NP3_BOOKMARK, RGBxA(clrBookMarkBack, alpha));
|
||||
SciCall_MarkerSetAlpha(MARKER_NP3_BOOKMARK, bookmarkAlpha); // if drawn in content area
|
||||
SciCall_MarkerSetForeTranslucent(MARKER_NP3_BOOKMARK, RGBxA(clrLineNumFore, bookmarkAlpha)); //~clrBookMarkFore
|
||||
//~SciCall_MarkerSetBack(MARKER_NP3_BOOKMARK, Style_RgbAlpha(clrBookMarkFore, clrMarginBack, bookmarkAlpha));
|
||||
SciCall_MarkerSetBackTranslucent(MARKER_NP3_BOOKMARK, RGBxA(clrBookMarkFore, bookmarkAlpha));
|
||||
|
||||
// occurrence bookmarker
|
||||
bool const visible = Settings.MarkOccurrencesBookmark;
|
||||
@ -2149,8 +2185,9 @@ void Style_SetMargin(HWND hwnd, LPCWSTR lpszStyle) /// iStyle == STYLE_LINENUMBE
|
||||
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, NULL, true);
|
||||
SciCall_MarkerSetAlpha(m, bookmarkAlpha); // if drawn in content area
|
||||
SciCall_MarkerSetForeTranslucent(m, RGBxA(color, SC_ALPHA_OPAQUE));
|
||||
SciCall_MarkerSetBackTranslucent(m, RGBxA(color, alpha)); // 'alpha' no meaning for SC_MARK_BACKGROUND
|
||||
SciCall_MarkerSetBackTranslucent(m, RGBxA(color, bookmarkAlpha)); // 'alpha' no meaning for SC_MARK_BACKGROUND
|
||||
}
|
||||
|
||||
SciCall_SetMarginBackN(MARGIN_SCI_BOOKMRK, clrMarginBack);
|
||||
@ -2163,7 +2200,7 @@ void Style_SetMargin(HWND hwnd, LPCWSTR lpszStyle) /// iStyle == STYLE_LINENUMBE
|
||||
SciCall_SetMarginSensitiveN(MARGIN_SCI_CHGHIST, true);
|
||||
|
||||
const WCHAR* const wchChgHistMrkModifiedStyleStrg = GetCurrentStdLexer()->Styles[STY_CHGHIST_MODIFIED].szValue;
|
||||
colorRead = clrBookMarkFore;
|
||||
colorRead = clrLineNumFore;
|
||||
if (Style_StrGetColor(wchChgHistMrkModifiedStyleStrg, FOREGROUND_LAYER, &colorRead, NULL, false)) {
|
||||
SciCall_MarkerSetFore(SC_MARKNUM_HISTORY_MODIFIED, colorRead);
|
||||
}
|
||||
@ -2174,11 +2211,11 @@ void Style_SetMargin(HWND hwnd, LPCWSTR lpszStyle) /// iStyle == STYLE_LINENUMBE
|
||||
|
||||
// TODO: alpha/translucent/layer in print mode ?
|
||||
//Style_StrGetAlpha(wchChgHistMrkModifiedStyleStrg, &alpha, SC_ALPHA_OPAQUE, true);
|
||||
//COLORREF const rgbAlpha = Style_RgbAlpha(colorRead, clrMarginBack, alpha);
|
||||
//SciCall_MarkerSetAlpha(SC_MARKNUM_HISTORY_MODIFIED, alpha);
|
||||
// COLORREF const rgbAlpha = Style_RgbAlpha(colorRead, clrMarginBack, alpha);
|
||||
|
||||
const WCHAR* const wchChgHistMrkSavedStyleStrg = GetCurrentStdLexer()->Styles[STY_CHGHIST_SAVED].szValue;
|
||||
colorRead = clrBookMarkFore;
|
||||
colorRead = clrLineNumFore;
|
||||
if (Style_StrGetColor(wchChgHistMrkSavedStyleStrg, FOREGROUND_LAYER, &colorRead, NULL, false)) {
|
||||
SciCall_MarkerSetFore(SC_MARKNUM_HISTORY_SAVED, colorRead);
|
||||
}
|
||||
@ -2186,9 +2223,10 @@ void Style_SetMargin(HWND hwnd, LPCWSTR lpszStyle) /// iStyle == STYLE_LINENUMBE
|
||||
if (Style_StrGetColor(wchChgHistMrkSavedStyleStrg, BACKGROUND_LAYER, &colorRead, NULL, false)) {
|
||||
SciCall_MarkerSetBack(SC_MARKNUM_HISTORY_SAVED, colorRead);
|
||||
}
|
||||
//SciCall_MarkerSetStrokeWidth(SC_MARKNUM_HISTORY_SAVED, strokeWidth);
|
||||
|
||||
const WCHAR* const wchChgHistMrkRev2OrgStyleStrg = GetCurrentStdLexer()->Styles[STY_CHGHIST_REV_TO_ORG].szValue;
|
||||
colorRead = clrBookMarkFore;
|
||||
colorRead = clrLineNumFore;
|
||||
if (Style_StrGetColor(wchChgHistMrkRev2OrgStyleStrg, FOREGROUND_LAYER, &colorRead, NULL, false)) {
|
||||
SciCall_MarkerSetFore(SC_MARKNUM_HISTORY_REVERTED_TO_ORIGIN, colorRead);
|
||||
}
|
||||
@ -2196,9 +2234,10 @@ void Style_SetMargin(HWND hwnd, LPCWSTR lpszStyle) /// iStyle == STYLE_LINENUMBE
|
||||
if (Style_StrGetColor(wchChgHistMrkRev2OrgStyleStrg, BACKGROUND_LAYER, &colorRead, NULL, false)) {
|
||||
SciCall_MarkerSetBack(SC_MARKNUM_HISTORY_REVERTED_TO_ORIGIN, colorRead);
|
||||
}
|
||||
//SciCall_MarkerSetStrokeWidth(SC_MARKNUM_HISTORY_REVERTED_TO_ORIGIN, strokeWidth);
|
||||
|
||||
const WCHAR* const wchChgHistMrkRev2ModStyleStrg = GetCurrentStdLexer()->Styles[STY_CHGHIST_REV_TO_MOD].szValue;
|
||||
colorRead = clrBookMarkFore;
|
||||
colorRead = clrLineNumFore;
|
||||
if (Style_StrGetColor(wchChgHistMrkRev2ModStyleStrg, FOREGROUND_LAYER, &colorRead, NULL, false)) {
|
||||
SciCall_MarkerSetFore(SC_MARKNUM_HISTORY_REVERTED_TO_MODIFIED, colorRead);
|
||||
}
|
||||
@ -2206,16 +2245,12 @@ void Style_SetMargin(HWND hwnd, LPCWSTR lpszStyle) /// iStyle == STYLE_LINENUMBE
|
||||
if (Style_StrGetColor(wchChgHistMrkRev2ModStyleStrg, BACKGROUND_LAYER, &colorRead, NULL, false)) {
|
||||
SciCall_MarkerSetBack(SC_MARKNUM_HISTORY_REVERTED_TO_MODIFIED, colorRead);
|
||||
}
|
||||
|
||||
Style_UpdateChangeHistoryMargin(Globals.hwndEdit);
|
||||
|
||||
//SciCall_MarkerSetStrokeWidth(SC_MARKNUM_HISTORY_REVERTED_TO_MODIFIED, strokeWidth);
|
||||
|
||||
// --- Code folding ---
|
||||
|
||||
SciCall_SetMarginBackN(MARGIN_SCI_FOLDING, clrMarginBack);
|
||||
SciCall_SetMarginSensitiveN(MARGIN_SCI_FOLDING, true);
|
||||
|
||||
|
||||
int fldStyleMrk = SC_CASE_LOWER;
|
||||
Style_StrGetCase(wchBookMarkStyleStrg, &fldStyleMrk);
|
||||
if (fldStyleMrk == SC_CASE_UPPER) { // circle style
|
||||
@ -2235,7 +2270,6 @@ void Style_SetMargin(HWND hwnd, LPCWSTR lpszStyle) /// iStyle == STYLE_LINENUMBE
|
||||
SciCall_MarkerDefine(SC_MARKNUM_FOLDEROPENMID, SC_MARK_BOXMINUSCONNECTED);
|
||||
SciCall_MarkerDefine(SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_TCORNER);
|
||||
}
|
||||
|
||||
static const int FoldMarkerID[] = {
|
||||
SC_MARKNUM_FOLDEROPEN,
|
||||
SC_MARKNUM_FOLDER,
|
||||
@ -2246,16 +2280,24 @@ void Style_SetMargin(HWND hwnd, LPCWSTR lpszStyle) /// iStyle == STYLE_LINENUMBE
|
||||
SC_MARKNUM_FOLDERMIDTAIL
|
||||
};
|
||||
|
||||
colorRead = clrLineNumFore;
|
||||
const WCHAR* wchHighlightStyleStrg = GetCurrentStdLexer()->Styles[STY_SEL_TXT].szValue;
|
||||
Style_StrGetColor(wchHighlightStyleStrg, FOREGROUND_LAYER, &colorRead, NULL, true);
|
||||
COLORREF const fldHiLight = colorRead;
|
||||
|
||||
for (int i = 0; i < COUNTOF(FoldMarkerID); ++i) {
|
||||
SciCall_MarkerSetFore(FoldMarkerID[i], clrBookMarkBack); // (!)
|
||||
SciCall_MarkerSetBack(FoldMarkerID[i], clrBookMarkFore); // (!)
|
||||
SciCall_MarkerSetForeTranslucent(FoldMarkerID[i], RGBxA(clrFoldMarginBack, SC_ALPHA_OPAQUE)); // (!)
|
||||
SciCall_MarkerSetBackTranslucent(FoldMarkerID[i], RGBxA(clrLineNumFore, SC_ALPHA_OPAQUE)); // (!) //~clrBookMarkForeAlpha
|
||||
SciCall_MarkerSetBackSelected(FoldMarkerID[i], fldHiLight);
|
||||
SciCall_MarkerSetStrokeWidth(FoldMarkerID[i], strokeWidth);
|
||||
}
|
||||
SciCall_MarkerEnableHighlight(true); // highlight folding block
|
||||
|
||||
// background
|
||||
SciCall_SetFoldMarginColour(true, clrFoldMarginBack); // background
|
||||
//~SciCall_SetMarginBackN(MARGIN_SCI_FOLDING, clrMarginBack); // no effect
|
||||
SciCall_SetFoldMarginColour(true, clrFoldMarginBack); // background
|
||||
SciCall_SetFoldMarginHiColour(true, clrFoldMarginBack); // (!)
|
||||
|
||||
//SciCall_FoldDisplayTextSetStyle(SC_FOLDDISPLAYTEXT_BOXED);
|
||||
//SciCall_SetDefaultFoldDisplayText("...");
|
||||
|
||||
@ -2278,8 +2320,7 @@ void Style_SetMargin(HWND hwnd, LPCWSTR lpszStyle) /// iStyle == STYLE_LINENUMBE
|
||||
}
|
||||
|
||||
// set width
|
||||
Style_UpdateBookmarkMargin(hwnd);
|
||||
Style_UpdateFoldingMargin(hwnd, (FocusedView.CodeFoldingAvailable && FocusedView.ShowCodeFolding));
|
||||
Style_UpdateAllMargins(hwnd, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -63,9 +63,11 @@ void Style_SetUrlHotSpot(HWND hwnd);
|
||||
void Style_SetInvisible(HWND hwnd, bool);
|
||||
//void Style_SetReadonly(HWND hwnd, bool);
|
||||
void Style_HighlightCurrentLine(HWND hwnd, int);
|
||||
void Style_UpdateFoldingMargin(HWND hwnd, bool bShowMargin);
|
||||
void Style_UpdateLineNumberMargin(const bool bForce);
|
||||
void Style_UpdateBookmarkMargin(HWND hwnd);
|
||||
void Style_UpdateChangeHistoryMargin(HWND hwnd);
|
||||
void Style_UpdateFoldingMargin(HWND hwnd, bool bShowMargin);
|
||||
void Style_UpdateAllMargins(HWND hwnd, const bool bForce);
|
||||
void Style_SetMargin(HWND hwnd, LPCWSTR lpszStyle);
|
||||
bool Style_SetLexerFromFile(HWND hwnd,const HPATHL hpath);
|
||||
bool Style_MaybeBinaryFile(HWND hwnd, const HPATHL hpath);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user