mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-28 21:02:59 +08:00
Merge branch 'Dev_RC1' into Dev_DM_STD
This commit is contained in:
commit
168ac3800e
@ -33,7 +33,7 @@ UCD - (UCD)ARDET is an Encoding Detector Library
|
||||
|
||||
|
||||
========================================================
|
||||
Current BETA/RC Version 5.21.506.(build_#) (2021-06-06)
|
||||
Current BETA/RC Version 5.21.511.(build_#) (2021-05-11)
|
||||
========================================================
|
||||
|
||||
--------------------------------------------------------
|
||||
@ -120,6 +120,11 @@ CHANGES:
|
||||
FIXES:
|
||||
--------------------------------------------------------
|
||||
[.###.#]- .
|
||||
[.511.1]- Space-width, avgchar-width and tab-width calculation.
|
||||
[.511.1]- Scintilla missing recalculation of space width (to get correct tab width for indentation).
|
||||
[.511.1]- Revert to Scintilla std tabwidth calculation on font changes.
|
||||
[.511.1]- Preserve "2nd Common Base" styling state across restarts.
|
||||
[.511.1]- Default style settings should not be written to .ini-file.
|
||||
[.429.1]- Handling of "File Vars" vs. "Encoding Tags".
|
||||
[.427.1]- Minor fixes around font redrawing.
|
||||
[.423.1]- Add thread COM initializations.
|
||||
|
||||
@ -1 +1 @@
|
||||
507
|
||||
511
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<assemblyIdentity
|
||||
name="Rizonesoft.Notepad3"
|
||||
processorArchitecture="*"
|
||||
version="5.21.507.1"
|
||||
version="5.21.511.1"
|
||||
type="win32"
|
||||
/>
|
||||
<description>Notepad3 beta</description>
|
||||
|
||||
@ -71,9 +71,9 @@ constexpr bool CheckBuildNumber(DWORD buildNumber)
|
||||
case 18363: // Win10 v1909
|
||||
case 19041: // Win10 v2004
|
||||
case 19042: // Win10 v20H2
|
||||
case 19043: // Win10 v21H1 insider beta [2021-03-15]
|
||||
case 19043: // Win10 v21H1 Insider beta [2021-03-15]
|
||||
// unknown, if working with these version(s) :-O
|
||||
case 21337: // Win10 v21H2 insider dev-preview [2021-03-19]
|
||||
case 21376: // Win10 v21H2 Insider Dev-preview [2021-05-03]
|
||||
return true;
|
||||
default:
|
||||
// not supported
|
||||
|
||||
@ -5372,7 +5372,10 @@ void EditSetSelectionEx(DocPos iAnchorPos, DocPos iCurrentPos, DocPos vSpcAnchor
|
||||
//
|
||||
void EditEnsureConsistentLineEndings(HWND hwnd)
|
||||
{
|
||||
IgnoreNotifyDocChangedEvent(true);
|
||||
SciCall_ConvertEOLs(SciCall_GetEOLMode());
|
||||
ObserveNotifyDocChangedEvent();
|
||||
|
||||
Globals.bDocHasInconsistentEOLs = false;
|
||||
EditFixPositions(hwnd);
|
||||
}
|
||||
|
||||
@ -407,9 +407,12 @@ static __forceinline bool CheckNotifyDocChangedEvent()
|
||||
return (InterlockedOr(&iNotifyChangeStackCounter, 0L) == 0L);
|
||||
}
|
||||
|
||||
void IgnoreNotifyDocChangedEvent()
|
||||
void IgnoreNotifyDocChangedEvent(const bool bStealthMode)
|
||||
{
|
||||
InterlockedIncrement(&iNotifyChangeStackCounter);
|
||||
if (bStealthMode) {
|
||||
SciCall_SetModEventMask(SCI_MODEVENTMASK_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
void ObserveNotifyDocChangedEvent()
|
||||
@ -418,6 +421,7 @@ void ObserveNotifyDocChangedEvent()
|
||||
InterlockedDecrement(&iNotifyChangeStackCounter);
|
||||
}
|
||||
if (CheckNotifyDocChangedEvent()) {
|
||||
SciCall_SetModEventMask(SCI_MODEVENTMASK_FULL);
|
||||
EditUpdateVisibleIndicators();
|
||||
UpdateStatusbar(false);
|
||||
}
|
||||
@ -1905,19 +1909,7 @@ static void _InitializeSciEditCtrl(HWND hwndEditCtrl)
|
||||
//~~~SciCall_SetIdleStyling(SC_IDLESTYLING_AFTERVISIBLE);
|
||||
SciCall_SetIdleStyling(SC_IDLESTYLING_ALL);
|
||||
|
||||
// The possible notification types are the same as the modificationType bit flags used by SCN_MODIFIED:
|
||||
// SC_MOD_INSERTTEXT, SC_MOD_DELETETEXT, SC_MOD_CHANGESTYLE, SC_MOD_CHANGEFOLD, SC_PERFORMED_USER,
|
||||
// SC_PERFORMED_UNDO, SC_PERFORMED_REDO, SC_MULTISTEPUNDOREDO, SC_LASTSTEPINUNDOREDO, SC_MOD_CHANGEMARKER,
|
||||
// SC_MOD_BEFOREINSERT, SC_MOD_BEFOREDELETE, SC_MULTILINEUNDOREDO, and SC_MODEVENTMASKALL.
|
||||
//
|
||||
///~ int const evtMask = SC_MODEVENTMASKALL; (!) - don't listen to all events (SC_MOD_CHANGESTYLE) => RECURSON!
|
||||
///~ SciCall_SetModEventMask(evtMask);
|
||||
///~ Don't use: SC_PERFORMED_USER | SC_MOD_CHANGESTYLE;
|
||||
/// SC_MOD_CHANGESTYLE and SC_MOD_CHANGEINDICATOR needs SCI_SETCOMMANDEVENTS=true
|
||||
//
|
||||
int const evtMask1 = SC_MOD_CONTAINER | SC_PERFORMED_UNDO | SC_PERFORMED_REDO | SC_MULTILINEUNDOREDO;
|
||||
int const evtMask2 = SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT | SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE;
|
||||
SciCall_SetModEventMask(evtMask1 | evtMask2);
|
||||
SciCall_SetModEventMask(SCI_MODEVENTMASK_FULL);
|
||||
SciCall_SetCommandEvents(false); // speedup folding
|
||||
|
||||
SciCall_StyleSetCharacterSet(SC_CHARSET_DEFAULT);
|
||||
@ -2114,17 +2106,17 @@ static bool _EvalTinyExpr(bool qmark)
|
||||
|
||||
// canonicalize fetched line
|
||||
StrDelChrA(lineBuf, chr_currency);
|
||||
const char *pBegin = lineBuf;
|
||||
while (IsBlankCharA(*pBegin)) {
|
||||
++pBegin;
|
||||
const char *p = lineBuf;
|
||||
while (IsBlankCharA(*p)) {
|
||||
++p;
|
||||
}
|
||||
|
||||
double dExprEval = 0.0;
|
||||
te_xint_t exprErr = 1;
|
||||
while (*pBegin && exprErr) {
|
||||
dExprEval = te_interp(pBegin, &exprErr);
|
||||
while (*p && exprErr) {
|
||||
dExprEval = te_interp(p, &exprErr);
|
||||
// proceed to next possible expression
|
||||
while (*pBegin && exprErr && !te_is_op(pBegin++)) {}
|
||||
while (*++p && exprErr && !(te_is_num(p) || te_is_op(p))) {}
|
||||
}
|
||||
FreeMem(lineBuf);
|
||||
|
||||
@ -9708,6 +9700,7 @@ bool FileIO(bool fLoad, LPWSTR pszFileName, EditFileIOStatus *status,
|
||||
|
||||
WCHAR tch[MAX_PATH + 40];
|
||||
FormatLngStringW(tch, COUNTOF(tch), (fLoad) ? IDS_MUI_LOADFILE : IDS_MUI_SAVEFILE, PathFindFileName(pszFileName));
|
||||
|
||||
BeginWaitCursor(true, tch);
|
||||
|
||||
if (fLoad) {
|
||||
@ -10022,7 +10015,9 @@ bool FileLoad(LPCWSTR lpszFile, bool bDontSave, bool bNew, bool bReload,
|
||||
|
||||
if (bCheckEOL && !Style_MaybeBinaryFile(Globals.hwndEdit, szFilePath)) {
|
||||
if (WarnLineEndingDlg(Globals.hwndMain, &fioStatus)) {
|
||||
IgnoreNotifyDocChangedEvent(true);
|
||||
SciCall_ConvertEOLs(fioStatus.iEOLMode);
|
||||
ObserveNotifyDocChangedEvent();
|
||||
Globals.bDocHasInconsistentEOLs = false;
|
||||
}
|
||||
SciCall_SetEOLMode(fioStatus.iEOLMode);
|
||||
|
||||
@ -138,7 +138,7 @@ int BeginUndoAction();
|
||||
void EndUndoAction(int token);
|
||||
bool RestoreAction(int token, DoAction doAct);
|
||||
|
||||
#define UndoTransActionBegin() { int const _token_ = BeginUndoAction(); __try { IgnoreNotifyDocChangedEvent();
|
||||
#define UndoTransActionBegin() { int const _token_ = BeginUndoAction(); __try { IgnoreNotifyDocChangedEvent(false);
|
||||
#define EndUndoTransAction() } __finally { EndUndoAction(_token_); ObserveNotifyDocChangedEvent(); } }
|
||||
|
||||
void HandleDWellStartEnd(const DocPos position, const UINT uid);
|
||||
@ -189,16 +189,17 @@ LRESULT MsgSysCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void IgnoreNotifyDocChangedEvent();
|
||||
void IgnoreNotifyDocChangedEvent(const bool bStealthMode);
|
||||
void ObserveNotifyDocChangedEvent();
|
||||
#define DocChangeTransactionBegin() __try { IgnoreNotifyDocChangedEvent();
|
||||
|
||||
#define DocChangeTransactionBegin() __try { IgnoreNotifyDocChangedEvent(false);
|
||||
#define EndDocChangeTransaction() } __finally { ObserveNotifyDocChangedEvent(); }
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define BeginWaitCursor(cond, text) \
|
||||
__try { \
|
||||
IgnoreNotifyDocChangedEvent(); \
|
||||
IgnoreNotifyDocChangedEvent(true); \
|
||||
if (cond) { \
|
||||
SciCall_SetCursor(SC_CURSORWAIT); \
|
||||
StatusSetText(Globals.hwndStatus, STATUS_HELP, (text)); \
|
||||
@ -206,7 +207,7 @@ void ObserveNotifyDocChangedEvent();
|
||||
|
||||
#define BeginWaitCursorUID(cond, uid) \
|
||||
__try { \
|
||||
IgnoreNotifyDocChangedEvent(); \
|
||||
IgnoreNotifyDocChangedEvent(true); \
|
||||
if (cond) { \
|
||||
SciCall_SetCursor(SC_CURSORWAIT); \
|
||||
StatusSetTextID(Globals.hwndStatus, STATUS_HELP, (uid)); \
|
||||
|
||||
@ -8,7 +8,7 @@ EDITLEXER lexStandard =
|
||||
{
|
||||
SCLEX_NULL, "null", IDS_LEX_DEF_TXT, L"Common Base", L"", L"",
|
||||
&KeyWords_NULL, {
|
||||
/* 0 */ { {STYLE_DEFAULT}, IDS_LEX_STD_STYLE, L"Default Style", L"font:Default", L"" },
|
||||
/* 0 */ { {STYLE_DEFAULT}, IDS_LEX_STD_STYLE, L"Default Style", L"font:$Code", L"" },
|
||||
/* 1 */ { {STYLE_LINENUMBER}, IDS_LEX_STD_MARGIN, L"Margins and Line Numbers", L"size:-2; fore:#008080", L"" },
|
||||
/* 2 */ { {STYLE_BRACELIGHT}, IDS_LEX_STD_BRACE, L"Matching Braces (Indicator)", L"fore:#00FF40; alpha:80; alpha2:80; indic_roundbox", L"" },
|
||||
/* 3 */ { {STYLE_BRACEBAD}, IDS_LEX_STD_BRACE_FAIL, L"Matching Braces Error (Indicator)", L"fore:#FF0080; alpha:140; alpha2:140; indic_roundbox", L"" },
|
||||
@ -62,8 +62,9 @@ EDITLEXER lexTEXT =
|
||||
{
|
||||
SCLEX_NULL, "null", IDS_LEX_TEXT_FILES, L"Text Files", L"txt; text; tmp; log; asc; doc; 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:Lucida Console; size:-2", L"" },
|
||||
{ {STYLE_LINENUMBER}, IDS_LEX_STD_MARGIN, L"Margins and Line Numbers", L"font:Consolas; size:-2", L"" },
|
||||
{ {SCI_SETEXTRAASCENT + SCI_SETEXTRADESCENT}, IDS_LEX_STD_X_SPC, L"Extra Line Spacing (Size)", L"size:-1", L"" },
|
||||
EDITLEXER_SENTINEL
|
||||
}
|
||||
|
||||
154
src/Styles.c
154
src/Styles.c
@ -958,17 +958,18 @@ void Style_FileExtToIniSection(bool bForceAll)
|
||||
|
||||
void Style_ToIniSection(bool bForceAll)
|
||||
{
|
||||
bool const bForceAllNotFromScratch = (bForceAll && !Globals.bIniFileFromScratch);
|
||||
|
||||
// Custom colors
|
||||
const WCHAR* const CustomColors_Section = L"Custom Colors";
|
||||
|
||||
for (int i = 0; i < 16; i++) {
|
||||
WCHAR tch[32] = { L'\0' };
|
||||
StringCchPrintf(tch, COUNTOF(tch), L"%02i", i + 1);
|
||||
if ((g_colorCustom[i] != s_colorDefault[i]) || (bForceAll && !Globals.bIniFileFromScratch)) {
|
||||
if ((g_colorCustom[i] != s_colorDefault[i]) || bForceAllNotFromScratch) {
|
||||
WCHAR wch[32] = { L'\0' };
|
||||
StringCchPrintf(wch, COUNTOF(wch), L"#%02X%02X%02X",
|
||||
(int)GetRValue(g_colorCustom[i]), (int)GetGValue(g_colorCustom[i]), (int)GetBValue(g_colorCustom[i]));
|
||||
|
||||
IniSectionSetString(CustomColors_Section, tch, wch);
|
||||
} else {
|
||||
IniSectionDelete(CustomColors_Section, tch, false);
|
||||
@ -998,28 +999,30 @@ void Style_ToIniSection(bool bForceAll)
|
||||
for (int iLexer = 0; iLexer < COUNTOF(g_pLexArray); iLexer++) {
|
||||
IniSectionSetString(g_pLexArray[iLexer]->pszName, NULL, NULL);
|
||||
}
|
||||
bForceAll = !Globals.bIniFileFromScratch;
|
||||
}
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
WCHAR szTmpStyle[BUFSIZE_STYLE_VALUE] = { L'\0' };
|
||||
WCHAR wchCurrStyle[BUFSIZE_STYLE_VALUE] = { L'\0' };
|
||||
|
||||
for (int iLexer = 0; iLexer < COUNTOF(g_pLexArray); ++iLexer) {
|
||||
|
||||
LPCWSTR const Lexer_Section = g_pLexArray[iLexer]->pszName;
|
||||
|
||||
unsigned i = 0;
|
||||
while (g_pLexArray[iLexer]->Styles[i].iStyle != -1) {
|
||||
// normalize defaults
|
||||
szTmpStyle[0] = L'\0'; // clear
|
||||
Style_CopyStyles_IfNotDefined(g_pLexArray[iLexer]->Styles[i].pszDefault, szTmpStyle, COUNTOF(szTmpStyle));
|
||||
|
||||
if (bForceAll || (StringCchCompareX(g_pLexArray[iLexer]->Styles[i].szValue, szTmpStyle) != 0)) {
|
||||
// normalize value
|
||||
szTmpStyle[0] = L'\0'; // clear
|
||||
Style_CopyStyles_IfNotDefined(g_pLexArray[iLexer]->Styles[i].szValue, szTmpStyle, COUNTOF(szTmpStyle));
|
||||
IniSectionSetString(Lexer_Section, g_pLexArray[iLexer]->Styles[i].pszName, szTmpStyle);
|
||||
LPCWSTR const pszName = g_pLexArray[iLexer]->Styles[i].pszName;
|
||||
LPCWSTR const pszValue = g_pLexArray[iLexer]->Styles[i].szValue;
|
||||
LPCWSTR const pszDefault = g_pLexArray[iLexer]->Styles[i].pszDefault; // normalized by
|
||||
|
||||
// normalize value for comparison
|
||||
wchCurrStyle[0] = L'\0'; // empty
|
||||
Style_CopyStyles_IfNotDefined(pszValue, wchCurrStyle, COUNTOF(wchCurrStyle));
|
||||
|
||||
if (bForceAllNotFromScratch || (StringCchCompareX(wchCurrStyle, pszDefault) != 0)) {
|
||||
IniSectionSetString(Lexer_Section, pszName, wchCurrStyle);
|
||||
} else {
|
||||
IniSectionDelete(Lexer_Section, g_pLexArray[iLexer]->Styles[i].pszName, false);
|
||||
IniSectionDelete(Lexer_Section, pszName, false);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
@ -2675,6 +2678,39 @@ bool Style_GetFileFilterStr(LPWSTR lpszFilter, int cchFilter, LPWSTR lpszDefExt,
|
||||
return true;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
static inline bool GetDefaultCodeFont(LPWSTR pwchFontName, int cchFont) {
|
||||
|
||||
LPCWSTR const FontNamePrioList[] = {
|
||||
L"Cascadia Code",
|
||||
L"Fira Code",
|
||||
L"DejaVu Sans Mono",
|
||||
L"Consolas",
|
||||
L"Lucida Console"
|
||||
};
|
||||
bool found = false;
|
||||
for (int i = 0; i < COUNTOF(FontNamePrioList); ++i) {
|
||||
LPCWSTR const fontName = FontNamePrioList[i];
|
||||
if (IsFontAvailable(fontName)) {
|
||||
StringCchCopy(pwchFontName, cchFont, fontName);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
StringCchCopy(pwchFontName, cchFont, L"Courier New"); // fallback
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
|
||||
static inline unsigned GetDefaultTextFont(LPWSTR pwchFontName) {
|
||||
WORD wSize = (WORD)LF_FACESIZE;
|
||||
GetThemedDialogFont(pwchFontName, &wSize);
|
||||
return wSize;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
@ -2694,47 +2730,22 @@ bool Style_StrGetFontName(LPCWSTR lpszStyle, LPWSTR lpszFont, int cchFont)
|
||||
}
|
||||
TrimSpcW(lpszFont);
|
||||
|
||||
if (StringCchCompareXI(lpszFont, L"Default") == 0) {
|
||||
// Microsoft's Coding Fonts only
|
||||
const WCHAR *const FontPrio[4] = { L"Cascadia Code", L"Cascadia Mono", L"Consolas", L"Lucida Console" };
|
||||
bool found = false;
|
||||
for (int i = 0; i < COUNTOF(FontPrio); ++i) {
|
||||
if (IsFontAvailable(FontPrio[i])) {
|
||||
StringCchCopy(lpszFont, cchFont, FontPrio[i]);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
StringCchCopy(lpszFont, cchFont, L"Courier New");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if ((StringCchCompareXI(lpszFont, L"$Code") == 0) || (StringCchCompareXI(lpszFont, L"Default") == 0)) {
|
||||
|
||||
GetDefaultCodeFont(lpszFont, cchFont);
|
||||
|
||||
} else if (StringCchCompareXI(lpszFont, L"$Text") == 0) {
|
||||
|
||||
GetDefaultTextFont(lpszFont);
|
||||
|
||||
} else if (!IsFontAvailable(lpszFont)) {
|
||||
|
||||
GetDefaultCodeFont(lpszFont, cchFont);
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// Style_StrGetFontStyle()
|
||||
//
|
||||
bool Style_StrGetFontStyle(LPCWSTR lpszStyle, LPWSTR lpszFontStyle, int cchFontStyle)
|
||||
{
|
||||
WCHAR* p = StrStr(lpszStyle, L"fstyle:");
|
||||
if (p) {
|
||||
p += CONSTSTRGLEN(L"fstyle:");
|
||||
while (*p == L' ') {
|
||||
++p;
|
||||
}
|
||||
StringCchCopyN(lpszFontStyle, cchFontStyle, p, cchFontStyle);
|
||||
if ((p = StrChr(lpszFontStyle, L';')) != NULL) {
|
||||
*p = L'\0';
|
||||
}
|
||||
TrimSpcW(lpszFontStyle);
|
||||
return true;
|
||||
return true; // font: defined
|
||||
}
|
||||
return false;
|
||||
return false; // font: not defined
|
||||
}
|
||||
|
||||
|
||||
@ -3135,34 +3146,21 @@ void Style_CopyStyles_IfNotDefined(LPCWSTR lpszStyleSrc, LPWSTR lpszStyleDest, i
|
||||
|
||||
// --------- Font settings ---------
|
||||
|
||||
WCHAR wchDefaultFontName[LF_FULLFACESIZE] = { L'\0' };
|
||||
Style_StrGetFontName(L"font:Default", wchDefaultFontName, COUNTOF(wchDefaultFontName)); // resolve
|
||||
//~WCHAR wchDefaultCodeFontName[LF_FACESIZE] = { L'\0' };
|
||||
//~Style_StrGetFontName(L"font:$Code", wchDefaultCodeFontName, COUNTOF(wchDefaultCodeFontName)); // resolve
|
||||
|
||||
bool bIsFontDefInDestination = false;
|
||||
|
||||
if (Style_StrGetFontName(lpszStyleDest, tch, COUNTOF(tch))) {
|
||||
bIsFontDefInDestination = true;
|
||||
if ((StringCchCompareXI(tch, L"Default") == 0) || (StringCchCompareXI(tch, wchDefaultFontName) == 0)) {
|
||||
AppendStyle(szTmpStyle, COUNTOF(szTmpStyle), L"font:Default");
|
||||
} else {
|
||||
AppendStyle(szTmpStyle, COUNTOF(szTmpStyle), L"font:");
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch);
|
||||
}
|
||||
AppendStyle(szTmpStyle, COUNTOF(szTmpStyle), L"font:");
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch);
|
||||
} else if (Style_StrGetFontName(lpszStyleSrc, tch, COUNTOF(tch))) {
|
||||
if ((StringCchCompareXI(tch, L"Default") == 0) || (StringCchCompareXI(tch, wchDefaultFontName) == 0)) {
|
||||
AppendStyle(szTmpStyle, COUNTOF(szTmpStyle), L"font:Default");
|
||||
} else {
|
||||
AppendStyle(szTmpStyle, COUNTOF(szTmpStyle), L"font:");
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch);
|
||||
}
|
||||
AppendStyle(szTmpStyle, COUNTOF(szTmpStyle), L"font:");
|
||||
StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch);
|
||||
}
|
||||
|
||||
// --------- Font Style ---------
|
||||
//~if (!StrStr(lpszStyleDest, L"fstyle:")) {
|
||||
//~ if (Style_StrGetFontStyle(lpszStyleSrc, tch, COUNTOF(tch))) {
|
||||
//~ StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), L"; fstyle:");
|
||||
//~ StringCchCat(szTmpStyle, COUNTOF(szTmpStyle), tch);
|
||||
//~ }
|
||||
//~}
|
||||
|
||||
const WCHAR *pFontWeight = NULL;
|
||||
for (int idx = FW_IDX_THIN; idx <= FW_IDX_ULTRADARK; ++idx) {
|
||||
@ -3336,34 +3334,30 @@ bool Style_SelectFont(HWND hwnd, LPWSTR lpszStyle, int cchStyle, LPCWSTR sLexerN
|
||||
LPCWSTR sStyleName, bool bGlobalDefaultStyle, bool bCurrentDefaultStyle) {
|
||||
|
||||
// Map lpszStyle to LOGFONT
|
||||
const WCHAR *const defaultFontTemplate = L"font:Default";
|
||||
WCHAR wchDefaultFontName[LF_FULLFACESIZE] = { L'\0' };
|
||||
const WCHAR *const defaultFontTemplate = L"font:$Code";
|
||||
WCHAR wchDefaultFontName[LF_FACESIZE] = { L'\0' };
|
||||
Style_StrGetFontName(defaultFontTemplate, wchDefaultFontName, COUNTOF(wchDefaultFontName));
|
||||
|
||||
// current base style
|
||||
const WCHAR *const lpszBaseStyleDefinition = GetCurrentStdLexer()->Styles[STY_DEFAULT].szValue;
|
||||
|
||||
// current common default font name setting
|
||||
WCHAR wchCurrCommonFontName[LF_FULLFACESIZE] = { L'\0' };
|
||||
WCHAR wchCurrCommonFontName[LF_FACESIZE] = { L'\0' };
|
||||
if (!Style_StrGetFontName(lpszBaseStyleDefinition, wchCurrCommonFontName, COUNTOF(wchCurrCommonFontName))) {
|
||||
StringCchCopy(wchCurrCommonFontName, COUNTOF(wchCurrCommonFontName), wchDefaultFontName);
|
||||
}
|
||||
|
||||
// specified font name
|
||||
WCHAR wchFontName[LF_FULLFACESIZE] = { L'\0' };
|
||||
WCHAR wchFontName[LF_FACESIZE] = { L'\0' };
|
||||
if (!Style_StrGetFontName(lpszStyle, wchFontName, COUNTOF(wchFontName))) {
|
||||
StringCchCopy(wchFontName, COUNTOF(wchFontName), wchCurrCommonFontName);
|
||||
}
|
||||
|
||||
// font style
|
||||
DWORD const flagUseStyle = 0; // = CF_USESTYLE; ~ don't use
|
||||
// NOTE: To globalize your application, you should specify the style by using
|
||||
// the lfWeight and lfItalic members of the LOGFONT structure pointed to by lpLogFont.
|
||||
// The style name may change depending on the system user interface language.
|
||||
//~WCHAR szStyleStrg[LF_FULLFACESIZE] = { L'\0' };
|
||||
//~if (flagUseStyle) {
|
||||
//~ Style_StrGetFontStyle(lpszStyle, szStyleStrg, COUNTOF(szStyleStrg));
|
||||
//~}
|
||||
DWORD const flagUseStyle = 0; // = CF_USESTYLE; ~ don't use
|
||||
|
||||
// Font Weight
|
||||
int iBaseFontWeight = FontWeights[FW_IDX_REGULAR].weight;
|
||||
@ -3646,7 +3640,7 @@ void Style_SetStyles(HWND hwnd, const int iStyle, LPCWSTR lpszStyle)
|
||||
SciCall_StyleSetFont(iStyle, chFontName);
|
||||
}
|
||||
} else if (bIsDefaultStyle) {
|
||||
Style_StrGetFontName(L"font:Default", wchFontName, COUNTOF(wchFontName));
|
||||
Style_StrGetFontName(L"font:$Code", wchFontName, COUNTOF(wchFontName));
|
||||
assert(lstrlen(wchFontName) < LF_FACESIZE);
|
||||
char chFontName[LF_FACESIZE] = { '\0' };
|
||||
WideCharToMultiByte(CP_UTF8, 0, wchFontName, -1, chFontName, (int)COUNTOF(chFontName), NULL, NULL);
|
||||
|
||||
@ -77,7 +77,6 @@ void Style_SetIndentGuides(HWND hwnd,bool);
|
||||
void Style_SetExtraLineSpace(HWND hwnd, LPWSTR lpszStyle, int cch);
|
||||
bool Style_GetFileFilterStr(LPWSTR lpszFilter, int cchFilter, LPWSTR lpszDefExt, int cchExt, bool bSaveAs);
|
||||
bool Style_StrGetFontName(LPCWSTR lpszStyle,LPWSTR lpszFont,int cchFont);
|
||||
bool Style_StrGetFontStyle(LPCWSTR lpszStyle,LPWSTR lpszFontStyle,int cchFontStyle);
|
||||
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);
|
||||
|
||||
@ -734,6 +734,23 @@ typedef struct _themeFiles
|
||||
// don't use 'SCVS_NOWRAPLINESTART'
|
||||
#define NP3_VIRTUAL_SPACE_ACCESS_OPTIONS (Settings2.DenyVirtualSpaceAccess ? SCVS_NONE : SCVS_RECTANGULARSELECTION)
|
||||
|
||||
|
||||
// The possible notification types are the same as the modificationType bit flags used by SCN_MODIFIED:
|
||||
// SC_MOD_INSERTTEXT, SC_MOD_DELETETEXT, SC_MOD_CHANGESTYLE, SC_MOD_CHANGEFOLD, SC_PERFORMED_USER,
|
||||
// SC_PERFORMED_UNDO, SC_PERFORMED_REDO, SC_MULTISTEPUNDOREDO, SC_LASTSTEPINUNDOREDO, SC_MOD_CHANGEMARKER,
|
||||
// SC_MOD_BEFOREINSERT, SC_MOD_BEFOREDELETE, SC_MULTILINEUNDOREDO, and SC_MODEVENTMASKALL.
|
||||
//
|
||||
///~ int const evtMask = SC_MODEVENTMASKALL; (!) - don't listen to all events (SC_MOD_CHANGESTYLE) => RECURSON!
|
||||
///~ SciCall_SetModEventMask(evtMask);
|
||||
///~ Don't use: SC_PERFORMED_USER | SC_MOD_CHANGESTYLE;
|
||||
/// SC_MOD_CHANGESTYLE and SC_MOD_CHANGEINDICATOR needs SCI_SETCOMMANDEVENTS=true
|
||||
//
|
||||
#define SCI_MODEVENTMASK_FULL (SC_MOD_CONTAINER | SC_PERFORMED_UNDO | SC_PERFORMED_REDO | SC_MULTILINEUNDOREDO | \
|
||||
SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT | SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)
|
||||
|
||||
#define SCI_MODEVENTMASK_NONE (SC_MOD_NONE)
|
||||
|
||||
|
||||
// from <wininet.h>
|
||||
#define INTERNET_MAX_PATH_LENGTH 2048
|
||||
#define INTERNET_MAX_SCHEME_LENGTH 32 // longest protocol name length
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
#define SAPPNAME "Notepad3"
|
||||
#define VERSION_MAJOR 5
|
||||
#define VERSION_MINOR 21
|
||||
#define VERSION_REV 507
|
||||
#define VERSION_REV 511
|
||||
#define VERSION_BUILD 1
|
||||
#define SCINTILLA_VER 502
|
||||
#define LEXILLA_VER 502
|
||||
|
||||
@ -50,7 +50,7 @@ extern "C" {
|
||||
|
||||
typedef struct te_expr {
|
||||
int type;
|
||||
union {double value; const double *bound; const void *function;};
|
||||
union {double value; const double * bound; const void * function;};
|
||||
#if defined(TINYEXPR_USE_STATIC_MEMORY)
|
||||
void *parameters[TINYEXPR_MAX_PARAMETERS];
|
||||
#else
|
||||
@ -84,7 +84,7 @@ typedef struct te_variable {
|
||||
/* Cleans internal static memory and supporting variables. */
|
||||
void te_expr_clean_up(void);
|
||||
/* Returns memory usage for static memory test. */
|
||||
void te_expr_memory_usage(unsigned int *count, unsigned int *count_max, unsigned int *free_error_count);
|
||||
void te_expr_memory_usage(unsigned int *count, unsigned int * count_max, unsigned int * free_error_count);
|
||||
#endif
|
||||
|
||||
/* Parses the input expression, evaluates it, and frees it. */
|
||||
@ -93,7 +93,7 @@ double te_interp(const char *expression, te_xint_t* error);
|
||||
|
||||
/* Parses the input expression and binds variables. */
|
||||
/* Returns NULL on error. */
|
||||
te_expr *te_compile(const char *expression, const te_variable *variables, int var_count, te_xint_t* error);
|
||||
te_expr *te_compile(const char * expression, const te_variable * variables, int var_count, te_xint_t * error);
|
||||
|
||||
/* Evaluates the expression. */
|
||||
double te_eval(const te_expr *n);
|
||||
@ -111,12 +111,15 @@ inline unsigned te_cp() { return 1252U; }
|
||||
/* invalid default char for conversion */
|
||||
inline unsigned te_invalid_chr() { return '#'; }
|
||||
|
||||
/* invalid default char for conversion */
|
||||
inline unsigned te_is_num(const char * const pch) { return (pch && (*pch > 47) && (*pch < 58)); }
|
||||
|
||||
/* check for operator or special character. */
|
||||
inline int te_is_op(const char* const expr) {
|
||||
inline int te_is_op(const char * const expr) {
|
||||
if (!expr)
|
||||
return !0;
|
||||
switch (*expr) {
|
||||
case 0:
|
||||
case '\0':
|
||||
case '+':
|
||||
case '-':
|
||||
case '*':
|
||||
|
||||
Loading…
Reference in New Issue
Block a user