diff --git a/language/common_res.h b/language/common_res.h index c716ff538..f26fa2025 100644 --- a/language/common_res.h +++ b/language/common_res.h @@ -120,6 +120,8 @@ #define IDS_MUI_TITLE_FIXCUR 15026 #define IDS_MUI_TITLE_RELARB 15027 #define IDS_MUI_TITLE_FIXARB 15028 +#define IDS_MUI_ABOUT_RTF_1 15029 +#define IDS_MUI_ABOUT_RTF_2 15030 #define IDR_MAINWND 16000 #define IDR_MAINWND128 16001 diff --git a/language/np3_af_za/strings_af_za.rc b/language/np3_af_za/strings_af_za.rc index 36f70197c..9f1accb49 100644 Binary files a/language/np3_af_za/strings_af_za.rc and b/language/np3_af_za/strings_af_za.rc differ diff --git a/language/np3_de_de/dialogs_de_de.rc b/language/np3_de_de/dialogs_de_de.rc index 54f9773ec..73529756c 100644 Binary files a/language/np3_de_de/dialogs_de_de.rc and b/language/np3_de_de/dialogs_de_de.rc differ diff --git a/language/np3_de_de/strings_de_de.rc b/language/np3_de_de/strings_de_de.rc index 756309b33..094b40191 100644 Binary files a/language/np3_de_de/strings_de_de.rc and b/language/np3_de_de/strings_de_de.rc differ diff --git a/language/np3_en_uk/strings_en_uk.rc b/language/np3_en_uk/strings_en_uk.rc index cc75f602f..0820b699d 100644 Binary files a/language/np3_en_uk/strings_en_uk.rc and b/language/np3_en_uk/strings_en_uk.rc differ diff --git a/language/np3_en_us/resource.h b/language/np3_en_us/resource.h index 3bea8cc2c..d5b1cf1f8 100644 Binary files a/language/np3_en_us/resource.h and b/language/np3_en_us/resource.h differ diff --git a/language/np3_en_us/strings_en_us.rc b/language/np3_en_us/strings_en_us.rc index 389d44513..0b40cd63d 100644 Binary files a/language/np3_en_us/strings_en_us.rc and b/language/np3_en_us/strings_en_us.rc differ diff --git a/language/np3_es_es/strings_es_es.rc b/language/np3_es_es/strings_es_es.rc index 63fe177b9..515b43dbf 100644 Binary files a/language/np3_es_es/strings_es_es.rc and b/language/np3_es_es/strings_es_es.rc differ diff --git a/language/np3_fr_fr/strings_fr_fr.rc b/language/np3_fr_fr/strings_fr_fr.rc index 1600c2907..334224f23 100644 Binary files a/language/np3_fr_fr/strings_fr_fr.rc and b/language/np3_fr_fr/strings_fr_fr.rc differ diff --git a/language/np3_nl_nl/strings_nl_nl.rc b/language/np3_nl_nl/strings_nl_nl.rc index f269c0f5b..95c9b570c 100644 Binary files a/language/np3_nl_nl/strings_nl_nl.rc and b/language/np3_nl_nl/strings_nl_nl.rc differ diff --git a/src/Dialogs.c b/src/Dialogs.c index 7741194e5..5937df22c 100644 --- a/src/Dialogs.c +++ b/src/Dialogs.c @@ -429,7 +429,7 @@ static DWORD CALLBACK _LoadRtfCallback( // ---------------------------------------------------------------------------- -static char* pAboutInfoResource = ABOUT_INFO_RTF; +static char pAboutResource[8192] = { '\0' }; static char* pAboutInfo; @@ -504,9 +504,19 @@ INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_SETEVENTMASK, 0, (LPARAM)(ENM_LINK)); // link click #if true + + char pAboutRes1[4000]; + GetLngStringA(IDS_MUI_ABOUT_RTF_1, pAboutRes1, COUNTOF(pAboutRes1)); + char pAboutRes2[4000]; + GetLngStringA(IDS_MUI_ABOUT_RTF_2, pAboutRes2, COUNTOF(pAboutRes2)); + + StringCchCopyA(pAboutResource, COUNTOF(pAboutResource), pAboutRes1); + StringCchCatA(pAboutResource, COUNTOF(pAboutResource), pAboutRes2); + EDITSTREAM editStreamIn = { (DWORD_PTR)&pAboutInfo, 0, _LoadRtfCallback }; - pAboutInfo = pAboutInfoResource; + pAboutInfo = pAboutResource; SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_STREAMIN, SF_RTF, (LPARAM)&editStreamIn); + //DWORD dwSize = _LoadStringEx(IDR_ABOUTINFO_RTF, L"RTF", NULL); //if (dwSize != 0) { diff --git a/src/Helpers.c b/src/Helpers.c index 6ac498491..d728c1ccb 100644 --- a/src/Helpers.c +++ b/src/Helpers.c @@ -616,7 +616,7 @@ bool SetWindowTitle(HWND hwnd,UINT uIDAppName,bool bIsElevated,UINT uIDUntitled, } if (bIsElevated) { - FormatLngString(szElevatedAppName,COUNTOF(szElevatedAppName),IDS_MUI_APPTITLE_ELEVATED,szAppName); + FormatLngStringW(szElevatedAppName,COUNTOF(szElevatedAppName),IDS_MUI_APPTITLE_ELEVATED,szAppName); StringCchCopyN(szAppName,COUNTOF(szAppName),szElevatedAppName,COUNTOF(szElevatedAppName)); } @@ -1200,34 +1200,57 @@ bool IsCmdEnabled(HWND hwnd,UINT uId) //============================================================================= // -// LoadLngString() +// LoadLngStringW() // - -int LoadLngString(UINT uID, LPTSTR lpBuffer, int nBufferMax) +int LoadLngStringW(UINT uID, LPTSTR lpBuffer, int nBufferMax) { - const int nLen = LoadString(g_hLngResContainer, uID, lpBuffer, nBufferMax); + const int nLen = LoadStringW(g_hLngResContainer, uID, lpBuffer, nBufferMax); + return (nLen != 0) ? nLen : LoadStringW(g_hInstance, uID, lpBuffer, nBufferMax); +} - return (nLen != 0) ? nLen : LoadString(g_hInstance, uID, lpBuffer, nBufferMax); +//============================================================================= +// +// LoadLngStringA() +// +int LoadLngStringA(UINT uID, LPSTR lpBuffer, int nBufferMax) +{ + const int nLen = LoadStringA(g_hLngResContainer, uID, lpBuffer, nBufferMax); + return (nLen != 0) ? nLen : LoadStringA(g_hInstance, uID, lpBuffer, nBufferMax); } //============================================================================= // -// FormatLngString() +// FormatLngStringW() // -int FormatLngString(LPWSTR lpOutput, int nOutput, UINT uIdFormat, ...) +int FormatLngStringW(LPWSTR lpOutput, int nOutput, UINT uIdFormat, ...) { static WCHAR pBuffer[XHUGE_BUFFER]; pBuffer[0] = L'\0'; - if (LoadLngString(uIdFormat, pBuffer, nOutput)) + if (LoadLngStringW(uIdFormat, pBuffer, nOutput)) { - StringCchVPrintf(lpOutput, nOutput, pBuffer, (LPVOID)((PUINT_PTR)&uIdFormat + 1)); + StringCchVPrintfW(lpOutput, nOutput, pBuffer, (LPVOID)((PUINT_PTR)&uIdFormat + 1)); } - return (int)StringCchLen(lpOutput, nOutput); + return (int)StringCchLenW(lpOutput, nOutput); } +//============================================================================= +// +// FormatLngStringA() +// +int FormatLngStringA(LPSTR lpOutput, int nOutput, UINT uIdFormat, ...) +{ + static CHAR pBuffer[XHUGE_BUFFER]; + pBuffer[0] = L'\0'; + + if (LoadLngStringA(uIdFormat, pBuffer, nOutput)) + { + StringCchVPrintfA(lpOutput, nOutput, pBuffer, (LPVOID)((PUINT_PTR)&uIdFormat + 1)); + } + return (int)StringCchLenA(lpOutput, nOutput); +} //============================================================================= diff --git a/src/Helpers.h b/src/Helpers.h index c44a00432..e62ea9d73 100644 --- a/src/Helpers.h +++ b/src/Helpers.h @@ -191,9 +191,12 @@ bool IsCmdEnabled(HWND, UINT); #define StrEnd(pStart) (pStart + lstrlen(pStart)) -#define GetLngString(id,pb,cb) LoadLngString((id),(pb),(cb)) -int LoadLngString(UINT uID, LPWSTR lpBuffer, int nBufferMax); -int FormatLngString(LPWSTR, int, UINT, ...); +#define GetLngString(id,pb,cb) LoadLngStringW((id),(pb),(cb)) +#define GetLngStringA(id,pb,cb) LoadLngStringA((id),(pb),(cb)) +int LoadLngStringW(UINT uID, LPWSTR lpBuffer, int nBufferMax); +int LoadLngStringA(UINT uID, LPSTR lpBuffer, int nBufferMax); +int FormatLngStringW(LPWSTR, int, UINT, ...); +int FormatLngStringA(LPSTR, int, UINT, ...); bool GetKnownFolderPath(REFKNOWNFOLDERID, LPWSTR, size_t); diff --git a/src/Notepad3.c b/src/Notepad3.c index 1a976826c..ce378ba63 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -7907,7 +7907,7 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw) if ((s_iLnFromPos != iLnFromPos) || (s_iLnCnt != iLnCnt)) { - FormatLngString(tchStatusBar[STATUS_DOCLINE], txtWidth, IDS_STATUS_DOCLINE, g_mxStatusBarPrefix[STATUS_DOCLINE], tchLn, tchLines); + FormatLngStringW(tchStatusBar[STATUS_DOCLINE], txtWidth, IDS_STATUS_DOCLINE, g_mxStatusBarPrefix[STATUS_DOCLINE], tchLn, tchLines); s_iLnFromPos = iLnFromPos; s_iLnCnt = iLnCnt; bIsUpdateNeeded = true; @@ -7931,11 +7931,11 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw) if (bMarkLongLines) { StringCchPrintf(tchCols, COUNTOF(tchCols), L"%td", g_iLongLinesLimit); FormatNumberStr(tchCols); - FormatLngString(tchStatusBar[STATUS_DOCCOLUMN], txtWidth, IDS_STATUS_DOCCOLUMN2, g_mxStatusBarPrefix[STATUS_DOCCOLUMN], tchCol, tchCols); + FormatLngStringW(tchStatusBar[STATUS_DOCCOLUMN], txtWidth, IDS_STATUS_DOCCOLUMN2, g_mxStatusBarPrefix[STATUS_DOCCOLUMN], tchCol, tchCols); } else { tchCols[0] = L'\0'; - FormatLngString(tchStatusBar[STATUS_DOCCOLUMN], txtWidth, IDS_STATUS_DOCCOLUMN, g_mxStatusBarPrefix[STATUS_DOCCOLUMN], tchCol); + FormatLngStringW(tchStatusBar[STATUS_DOCCOLUMN], txtWidth, IDS_STATUS_DOCCOLUMN, g_mxStatusBarPrefix[STATUS_DOCCOLUMN], tchCol); } s_iCol = iCol; s_bmarkLongLines = bMarkLongLines; @@ -7972,8 +7972,8 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw) tchSelB[0] = L'0'; tchSelB[1] = L'\0'; } - FormatLngString(tchStatusBar[STATUS_SELECTION], txtWidth, IDS_STATUS_SELECTION, g_mxStatusBarPrefix[STATUS_SELECTION], tchSel); - FormatLngString(tchStatusBar[STATUS_SELCTBYTES], txtWidth, IDS_STATUS_SELCTBYTES, g_mxStatusBarPrefix[STATUS_SELCTBYTES], tchSelB); + FormatLngStringW(tchStatusBar[STATUS_SELECTION], txtWidth, IDS_STATUS_SELECTION, g_mxStatusBarPrefix[STATUS_SELECTION], tchSel); + FormatLngStringW(tchStatusBar[STATUS_SELCTBYTES], txtWidth, IDS_STATUS_SELCTBYTES, g_mxStatusBarPrefix[STATUS_SELCTBYTES], tchSelB); s_bIsSelCountable = bIsSelCountable; s_iSelStart = iSelStart; @@ -8008,7 +8008,7 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw) FormatNumberStr(tchLinesSelected); } - FormatLngString(tchStatusBar[STATUS_SELCTLINES], txtWidth, IDS_STATUS_SELCTLINES, g_mxStatusBarPrefix[STATUS_SELCTLINES], tchLinesSelected); + FormatLngStringW(tchStatusBar[STATUS_SELCTLINES], txtWidth, IDS_STATUS_SELCTLINES, g_mxStatusBarPrefix[STATUS_SELCTLINES], tchLinesSelected); s_bIsSelectionEmpty = bIsSelectionEmpty; s_iLinesSelected = iLinesSelected; @@ -8042,7 +8042,7 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw) StringCchCopy(tchOcc, COUNTOF(tchOcc), L"--"); } - FormatLngString(tchStatusBar[STATUS_OCCURRENCE], txtWidth, IDS_STATUS_OCCURRENCE, g_mxStatusBarPrefix[STATUS_OCCURRENCE], tchOcc); + FormatLngStringW(tchStatusBar[STATUS_OCCURRENCE], txtWidth, IDS_STATUS_OCCURRENCE, g_mxStatusBarPrefix[STATUS_OCCURRENCE], tchOcc); s_bMOVisible = g_bMarkOccurrencesMatchVisible; s_iMarkOccurrencesCount = g_iMarkOccurrencesCount; @@ -8057,7 +8057,7 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw) DocPos const iTextLength = SciCall_GetTextLength(); if (s_iTextLength != iTextLength) { StrFormatByteSize(iTextLength, tchBytes, COUNTOF(tchBytes)); - FormatLngString(tchStatusBar[STATUS_DOCSIZE], txtWidth, IDS_STATUS_DOCSIZE, g_mxStatusBarPrefix[STATUS_DOCSIZE], tchBytes); + FormatLngStringW(tchStatusBar[STATUS_DOCSIZE], txtWidth, IDS_STATUS_DOCSIZE, g_mxStatusBarPrefix[STATUS_DOCSIZE], tchBytes); s_iTextLength = iTextLength; bIsUpdateNeeded = true; } @@ -8180,7 +8180,7 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw) else StringCchCopy(tchReplOccs, COUNTOF(tchReplOccs), L"--"); - FormatLngString(tchFRStatus, COUNTOF(tchFRStatus), IDS_FR_STATUS_FMT, + FormatLngStringW(tchFRStatus, COUNTOF(tchFRStatus), IDS_FR_STATUS_FMT, tchLn, tchLines, tchCol, tchSel, tchOcc, tchReplOccs, FR_Status[g_FindReplaceMatchFoundState]); SetWindowText(GetDlgItem(g_hwndDlgFindReplace, IDS_FR_STATUS_TEXT), tchFRStatus); @@ -8534,7 +8534,7 @@ bool FileIO(bool fLoad,LPCWSTR pszFileName,bool bSkipUnicodeDetect,bool bSkipANS bool fSuccess; DWORD dwFileAttributes; - FormatLngString(tch,COUNTOF(tch),(fLoad) ? IDS_MUI_LOADFILE : IDS_MUI_SAVEFILE, PathFindFileName(pszFileName)); + FormatLngStringW(tch,COUNTOF(tch),(fLoad) ? IDS_MUI_LOADFILE : IDS_MUI_SAVEFILE, PathFindFileName(pszFileName)); BeginWaitCursor(tch); diff --git a/src/Print.cpp b/src/Print.cpp index b0d1e9650..22fd88103 100644 --- a/src/Print.cpp +++ b/src/Print.cpp @@ -71,7 +71,7 @@ void StatusUpdatePrintPage(int iPageNum) { WCHAR tch[32] = { L'\0' }; - FormatLngString(tch,COUNTOF(tch),IDS_MUI_PRINTFILE,iPageNum); + FormatLngStringW(tch,COUNTOF(tch),IDS_MUI_PRINTFILE,iPageNum); StatusSetText(g_hwndStatus,255,tch); StatusSetSimple(g_hwndStatus,true); diff --git a/src/Styles.c b/src/Styles.c index ff567a9a3..bf8926677 100644 --- a/src/Styles.c +++ b/src/Styles.c @@ -5293,21 +5293,21 @@ bool Style_SelectFont(HWND hwnd,LPWSTR lpszStyle,int cchStyle, LPCWSTR sLexerNam if (bGlobalDefaultStyle) { if (bRelFontSize) - FormatLngString(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_RELBASE, sStyleName); + FormatLngStringW(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_RELBASE, sStyleName); else - FormatLngString(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_FIXBASE, sStyleName); + FormatLngStringW(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_FIXBASE, sStyleName); } else if (bCurrentDefaultStyle) { if (bRelFontSize) - FormatLngString(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_RELCUR, sLexerName, sStyleName); + FormatLngStringW(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_RELCUR, sLexerName, sStyleName); else - FormatLngString(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_FIXCUR, sLexerName, sStyleName); + FormatLngStringW(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_FIXCUR, sLexerName, sStyleName); } else { if (bRelFontSize) - FormatLngString(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_RELARB, sStyleName, sLexerName); + FormatLngStringW(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_RELARB, sStyleName, sLexerName); else - FormatLngString(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_FIXARB, sStyleName, sLexerName); + FormatLngStringW(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_FIXARB, sStyleName, sLexerName); } if (bWithEffects) @@ -6136,7 +6136,7 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam } else { GetLngString(pCurrentLexer->resID, name, COUNTOF(name)); - FormatLngString(label, COUNTOF(label), IDS_MUI_STY_LEXDEF, name); + FormatLngStringW(label, COUNTOF(label), IDS_MUI_STY_LEXDEF, name); } SetDlgItemText(hwnd, IDC_STYLELABEL_ROOT, label); @@ -6149,7 +6149,7 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam { bIsStyleSelected = true; GetLngString(pCurrentStyle->rid, name, COUNTOF(name)); - FormatLngString(label, COUNTOF(label), IDS_MUI_STY_LEXSTYLE, name); + FormatLngStringW(label, COUNTOF(label), IDS_MUI_STY_LEXSTYLE, name); SetDlgItemText(hwnd, IDC_STYLELABEL, label); SetDlgItemText(hwnd, IDC_STYLEEDIT, pCurrentStyle->szValue); } diff --git a/src/Version.h b/src/Version.h index 605c7de97..a14e3ffe2 100644 Binary files a/src/Version.h and b/src/Version.h differ