mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
+chg: Lexer TEXT using own Default,
This commit is contained in:
parent
5cdcddb075
commit
36b6f0c5f3
@ -62,12 +62,13 @@ Inline-IME Color=fore:#4EF64D
|
||||
2nd Change History Marker Reverted to Origin=fore:#40A0BF; back:#40A0BF
|
||||
2nd Inline-IME Color=fore:#F20C0D
|
||||
[Text Files]
|
||||
Margins and Line Numbers=font:Consolas; size:-2; fore:#DEDEDE; back:#454545
|
||||
Extra Line Spacing (Size)=size:-1
|
||||
Default=font:$Text; size:11
|
||||
Margins and Line Numbers=font:Consolas; size:-1; fore:#DEDEDE; back:#454545
|
||||
Extra Line Spacing (Size)=size:+1
|
||||
[ANSI Art]
|
||||
Default=font:Lucida Console; thin; size:11; smoothing:aliased
|
||||
Margins and Line Numbers=font:Lucida Console; size:-2; fore:#DEDEDE; back:#454545
|
||||
Extra Line Spacing (Size)=size:-1
|
||||
Extra Line Spacing (Size)=size:-2
|
||||
[Apache Config Files]
|
||||
Comment=fore:#DBF873
|
||||
String=fore:#F651F6
|
||||
|
||||
@ -406,7 +406,7 @@ void ViewStyle::Refresh(Surface &surface, int tabInChars) {
|
||||
maxDescent = std::max(0.0, maxDescent + extraDescent);
|
||||
lineHeight = static_cast<int>(std::lround(maxAscent + maxDescent));
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
lineOverlap = std::clamp(lineHeight / 10, 2, lineHeight);
|
||||
lineOverlap = std::clamp(lineHeight / 10, 1, std::max(1, lineHeight));
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
|
||||
someStylesProtected = std::any_of(styles.cbegin(), styles.cend(),
|
||||
|
||||
@ -49,7 +49,7 @@ EDITLEXER lexStandard2nd =
|
||||
/* 8 */ { {_STYLE_GETSTYLEID(STY_CUR_LN)}, IDS_LEX_2ND_LN_BACKGR, L"2nd Current Line Background (Color)", L"size:2; fore:#0000B0; back:#FFFF00; alpha:50", L"" },
|
||||
/* 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"" },
|
||||
/* 11 */ { {_STYLE_GETSTYLEID(STY_X_LN_SPACE)}, IDS_LEX_2ND_X_SPC, L"2nd Extra Line Spacing (Size)", L"size:2", 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"" },
|
||||
@ -69,10 +69,9 @@ EDITLEXER lexTEXT =
|
||||
{
|
||||
SCLEX_NULL, "null", IDS_LEX_TEXT_FILES, L"Text Files", L"txt; text; tmp; log; asc; doc; scp; wtx", L"",
|
||||
&KeyWords_NULL,{
|
||||
//~{ {STYLE_DEFAULT}, IDS_LEX_STR_63126, L"Default", L"font:$Text", L"" },
|
||||
{ {STYLE_DEFAULT}, IDS_LEX_STR_63126, L"Default", L"", L"" },
|
||||
{ {STYLE_LINENUMBER}, IDS_LEX_STD_MARGIN, L"Margins and Line Numbers", L"font:Consolas; size:-2", L"" },
|
||||
{ {STYLE_BRACELIGHT}, IDS_LEX_STD_X_SPC, L"Extra Line Spacing (Size)", L"size:-1", L"" },
|
||||
{ {STYLE_DEFAULT}, IDS_LEX_STR_63126, L"Default", L"font:$Text; size:11", L"" },
|
||||
{ {STYLE_LINENUMBER}, IDS_LEX_STD_MARGIN, L"Margins and Line Numbers", L"font:Consolas; size:-1", L"" },
|
||||
{ {STYLE_BRACELIGHT}, IDS_LEX_STD_X_SPC, L"Extra Line Spacing (Size)", L"size:+1", L"" },
|
||||
EDITLEXER_SENTINEL
|
||||
}
|
||||
};
|
||||
@ -86,7 +85,7 @@ EDITLEXER lexANSI =
|
||||
{ {STYLE_LINENUMBER}, IDS_LEX_STD_MARGIN, L"Margins and Line Numbers", L"font:Lucida Console; size:-2", L"" },
|
||||
{ {STYLE_BRACELIGHT}, IDS_LEX_STD_BRACE, L"Matching Braces", L"", L"" },
|
||||
{ {STYLE_BRACEBAD}, IDS_LEX_STD_BRACE_FAIL, L"Matching Braces Error", L"", L"" },
|
||||
{ {STYLE_CONTROLCHAR}, IDS_LEX_STD_X_SPC, L"Extra Line Spacing (Size)", L"size:-1", L"" },
|
||||
{ {STYLE_CONTROLCHAR}, IDS_LEX_STD_X_SPC, L"Extra Line Spacing (Size)", L"size:0", L"" },
|
||||
EDITLEXER_SENTINEL
|
||||
}
|
||||
};
|
||||
|
||||
70
src/Styles.c
70
src/Styles.c
@ -1657,8 +1657,7 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
|
||||
size_t const cnt = ReadVectorFromString(Globals.fvCurFile.wchMultiEdgeLines, edgeColumns, COUNTOF(edgeColumns), 0, LONG_LINES_MARKER_LIMIT, 0, true);
|
||||
Style_SetMultiEdgeLine(edgeColumns, cnt);
|
||||
|
||||
Style_SetExtraLineSpace(hwnd, pCurrentStandard->Styles[STY_X_LN_SPACE].szValue,
|
||||
COUNTOF(pCurrentStandard->Styles[STY_X_LN_SPACE].szValue));
|
||||
Style_SetExtraLineSpace(hwnd, pCurrentStandard->Styles[STY_X_LN_SPACE].szValue, 0);
|
||||
|
||||
if (SciCall_GetIndentationGuides() != SC_IV_NONE) {
|
||||
Style_SetIndentGuides(hwnd, true);
|
||||
@ -1682,8 +1681,7 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
|
||||
pCurrentStandard->Styles[STY_BRACE_BAD].szValue, fBaseFontSize);
|
||||
}
|
||||
|
||||
Style_SetExtraLineSpace(hwnd, s_pLexCurrent->Styles[STY_CTRL_CHR].szValue,
|
||||
COUNTOF(s_pLexCurrent->Styles[STY_CTRL_CHR].szValue));
|
||||
Style_SetExtraLineSpace(hwnd, s_pLexCurrent->Styles[STY_CTRL_CHR].szValue, 0);
|
||||
|
||||
}
|
||||
else if (s_pLexCurrent == &lexTEXT) {
|
||||
@ -1691,8 +1689,8 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
|
||||
// margin (line number, bookmarks, folding) style
|
||||
Style_SetMargin(hwnd, s_pLexCurrent->Styles[STY_MARGIN].szValue);
|
||||
|
||||
Style_SetExtraLineSpace(hwnd, s_pLexCurrent->Styles[STY_BRACE_OK].szValue,
|
||||
COUNTOF(s_pLexCurrent->Styles[STY_BRACE_OK].szValue));
|
||||
int const curSpc = (SciCall_GetExtraAscent() + SciCall_GetExtraDescent()) >> 1;
|
||||
Style_SetExtraLineSpace(hwnd, s_pLexCurrent->Styles[STY_BRACE_OK].szValue, curSpc);
|
||||
|
||||
} else if (s_pLexCurrent->lexerID != SCLEX_NULL) {
|
||||
|
||||
@ -2834,23 +2832,18 @@ void Style_SetIndentGuides(HWND hwnd,bool bShow)
|
||||
//
|
||||
// Style_SetExtraLineSpace()
|
||||
//
|
||||
void Style_SetExtraLineSpace(HWND hwnd, LPWSTR lpszStyle, int cch)
|
||||
void Style_SetExtraLineSpace(HWND hwnd, LPWSTR lpszStyle, int iValue)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(hwnd);
|
||||
|
||||
int iValue = 0, iAscent = 0, iDescent = 0;
|
||||
if (Style_StrGetSizeInt(lpszStyle, &iValue)) {
|
||||
const int iCurFontSizeDbl = f2int(Style_GetCurrentLexerFontSize() * 2.0f);
|
||||
int iValAdj = clampi(iValue, (0 - iCurFontSizeDbl), 256 * iCurFontSizeDbl);
|
||||
if ((iValAdj != iValue) && (cch > 10)) {
|
||||
StringCchPrintf(lpszStyle, cch, L"size:%i", iValAdj);
|
||||
}
|
||||
if ((iValAdj % 2) != 0) {
|
||||
int iAscent = 0, iDescent = 0;
|
||||
if (Style_StrGetSizeIntEx(lpszStyle, &iValue)) {
|
||||
if ((iValue % 2) != 0) {
|
||||
iAscent++;
|
||||
iValAdj--;
|
||||
iValue--;
|
||||
}
|
||||
iAscent += (iValAdj >> 1);
|
||||
iDescent += (iValAdj >> 1);
|
||||
iAscent += (iValue >> 1);
|
||||
iDescent += (iValue >> 1);
|
||||
}
|
||||
SciCall_SetExtraAscent(iAscent);
|
||||
SciCall_SetExtraDescent(iDescent);
|
||||
@ -3115,6 +3108,47 @@ bool Style_StrGetSizeInt(LPCWSTR lpszStyle, int* i)
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// Style_StrGetSizeIntEx()
|
||||
//
|
||||
bool Style_StrGetSizeIntEx(LPCWSTR lpszStyle, int* i)
|
||||
{
|
||||
WCHAR* p = StrStr(lpszStyle, L"size:");
|
||||
if (p) {
|
||||
int iSign = 0;
|
||||
WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' };
|
||||
StringCchCopy(tch, COUNTOF(tch), p + CONSTSTRGLEN(L"size:"));
|
||||
if (tch[0] == L'+') {
|
||||
iSign = 1;
|
||||
tch[0] = L' ';
|
||||
}
|
||||
else if (tch[0] == L'-') {
|
||||
iSign = -1;
|
||||
tch[0] = L' ';
|
||||
}
|
||||
p = StrChr(tch, L';');
|
||||
if (p) {
|
||||
*p = L'\0';
|
||||
}
|
||||
TrimSpcW(tch);
|
||||
|
||||
int iValue = 0;
|
||||
if (Char2Int(tch, &iValue)) {
|
||||
if (iSign == 0) {
|
||||
*i = iValue;
|
||||
}
|
||||
else { // iSign: relative value
|
||||
iValue = (iSign * iValue); // can be negative
|
||||
*i += iValue;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// Style_StrGetSizeFloat()
|
||||
|
||||
@ -82,12 +82,13 @@ void Style_ToggleUse2ndDefault(HWND hwnd);
|
||||
bool Style_GetUse2ndDefault();
|
||||
void Style_SetUse2ndDefault(bool);
|
||||
void Style_SetIndentGuides(HWND hwnd,bool);
|
||||
void Style_SetExtraLineSpace(HWND hwnd, LPWSTR lpszStyle, int cch);
|
||||
void Style_SetExtraLineSpace(HWND hwnd, LPWSTR lpszStyle, int iValue);
|
||||
bool Style_GetFileFilterStr(LPWSTR lpszFilter, int cchFilter, LPWSTR lpszDefExt, int cchExt, bool bSaveAs);
|
||||
bool Style_StrGetFontName(LPCWSTR lpszStyle,LPWSTR lpszFont,int cchFont);
|
||||
bool Style_StrGetFontQuality(LPCWSTR lpszStyle, LPWSTR lpszQuality, int cchQuality, int* iSciQuality_out);
|
||||
bool Style_StrGetCharSet(LPCWSTR lpszStyle,int* i);
|
||||
bool Style_StrGetSizeInt(LPCWSTR lpszStyle, int* i);
|
||||
bool Style_StrGetSizeIntEx(LPCWSTR lpszStyle, int* i);
|
||||
bool Style_StrGetSizeFloat(LPCWSTR lpszStyle, float* f);
|
||||
bool Style_StrGetSizeFloatEx(LPCWSTR lpszStyle,float* f);
|
||||
bool Style_StrGetSizeStr(LPCWSTR lpszStyle,LPWSTR lpszSize,int cchSize);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user