mirror of
https://github.com/reactos/reactos.git
synced 2024-06-17 10:01:58 +00:00
[NOTEPAD] Improve UTF-8 encoding support and improve status bar (#4649)
- Add write support for UTF-8 without BOM. - Add "UTF-8 with BOM" encoding to the "Save As" dialog. - Show line endings and encoding on the status bar (like Notepad in Windows 10). - Remove ignored WS_EX_STATICEDGE - Add grip to the status window. Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
This commit is contained in:
parent
6b70fff808
commit
d73b6cedf2
|
@ -33,6 +33,27 @@ static const TCHAR empty_str[] = _T("");
|
|||
static const TCHAR szDefaultExt[] = _T("txt");
|
||||
static const TCHAR txt_files[] = _T("*.txt");
|
||||
|
||||
/* Status bar parts index */
|
||||
#define SBPART_CURPOS 0
|
||||
#define SBPART_EOLN 1
|
||||
#define SBPART_ENCODING 2
|
||||
|
||||
/* Line endings - string resource ID mapping table */
|
||||
static UINT EolnToStrId[] = {
|
||||
STRING_CRLF,
|
||||
STRING_LF,
|
||||
STRING_CR
|
||||
};
|
||||
|
||||
/* Encoding - string resource ID mapping table */
|
||||
static UINT EncToStrId[] = {
|
||||
STRING_ANSI,
|
||||
STRING_UNICODE,
|
||||
STRING_UNICODE_BE,
|
||||
STRING_UTF8,
|
||||
STRING_UTF8_BOM
|
||||
};
|
||||
|
||||
static UINT_PTR CALLBACK DIALOG_PAGESETUP_Hook(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
VOID ShowLastError(VOID)
|
||||
|
@ -104,6 +125,45 @@ void UpdateWindowCaption(BOOL clearModifyAlert)
|
|||
SetWindowText(Globals.hMainWnd, szCaption);
|
||||
}
|
||||
|
||||
VOID DIALOG_StatusBarAlignParts(VOID)
|
||||
{
|
||||
static const int defaultWidths[] = {120, 120, 120};
|
||||
RECT rcStatusBar;
|
||||
int parts[3];
|
||||
|
||||
GetClientRect(Globals.hStatusBar, &rcStatusBar);
|
||||
|
||||
parts[0] = rcStatusBar.right - (defaultWidths[1] + defaultWidths[2]);
|
||||
parts[1] = rcStatusBar.right - defaultWidths[2];
|
||||
parts[2] = -1; // the right edge of the status bar
|
||||
|
||||
parts[0] = max(parts[0], defaultWidths[0]);
|
||||
parts[1] = max(parts[1], defaultWidths[0] + defaultWidths[1]);
|
||||
|
||||
SendMessageW(Globals.hStatusBar, SB_SETPARTS, (WPARAM)ARRAY_SIZE(parts), (LPARAM)parts);
|
||||
}
|
||||
|
||||
static VOID DIALOG_StatusBarUpdateLineEndings(VOID)
|
||||
{
|
||||
WCHAR szText[128];
|
||||
|
||||
LoadStringW(Globals.hInstance, EolnToStrId[Globals.iEoln], szText, ARRAY_SIZE(szText));
|
||||
|
||||
SendMessageW(Globals.hStatusBar, SB_SETTEXTW, SBPART_EOLN, (LPARAM)szText);
|
||||
}
|
||||
|
||||
static VOID DIALOG_StatusBarUpdateEncoding(VOID)
|
||||
{
|
||||
WCHAR szText[128] = L"";
|
||||
|
||||
if (Globals.encFile != ENCODING_AUTO)
|
||||
{
|
||||
LoadStringW(Globals.hInstance, EncToStrId[Globals.encFile], szText, ARRAY_SIZE(szText));
|
||||
}
|
||||
|
||||
SendMessageW(Globals.hStatusBar, SB_SETTEXTW, SBPART_ENCODING, (LPARAM)szText);
|
||||
}
|
||||
|
||||
int DIALOG_StringMsgBox(HWND hParent, int formatId, LPCTSTR szString, DWORD dwFlags)
|
||||
{
|
||||
TCHAR szMessage[MAX_STRING_LEN];
|
||||
|
@ -403,6 +463,11 @@ VOID DoOpenFile(LPCTSTR szFileName)
|
|||
SetFileName(szFileName);
|
||||
UpdateWindowCaption(TRUE);
|
||||
NOTEPAD_EnableSearchMenu();
|
||||
|
||||
/* Update line endings and encoding on the status bar */
|
||||
DIALOG_StatusBarUpdateLineEndings();
|
||||
DIALOG_StatusBarUpdateEncoding();
|
||||
|
||||
done:
|
||||
if (hFile != INVALID_HANDLE_VALUE)
|
||||
CloseHandle(hFile);
|
||||
|
@ -497,6 +562,9 @@ DIALOG_FileSaveAs_Hook(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
LoadString(Globals.hInstance, STRING_UTF8, szText, ARRAY_SIZE(szText));
|
||||
SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM) szText);
|
||||
|
||||
LoadString(Globals.hInstance, STRING_UTF8_BOM, szText, ARRAY_SIZE(szText));
|
||||
SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM) szText);
|
||||
|
||||
SendMessage(hCombo, CB_SETCURSEL, Globals.encFile, 0);
|
||||
|
||||
hCombo = GetDlgItem(hDlg, ID_EOLN);
|
||||
|
@ -562,6 +630,11 @@ BOOL DIALOG_FileSaveAs(VOID)
|
|||
if (DoSaveFile())
|
||||
{
|
||||
UpdateWindowCaption(TRUE);
|
||||
|
||||
/* Update line endings and encoding on the status bar */
|
||||
DIALOG_StatusBarUpdateLineEndings();
|
||||
DIALOG_StatusBarUpdateEncoding();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
|
@ -852,7 +925,7 @@ VOID DoCreateStatusBar(VOID)
|
|||
if (Globals.hStatusBar == NULL)
|
||||
{
|
||||
/* Try to create the status bar */
|
||||
Globals.hStatusBar = CreateStatusWindow(WS_CHILD | WS_VISIBLE | WS_EX_STATICEDGE,
|
||||
Globals.hStatusBar = CreateStatusWindow(WS_CHILD | WS_VISIBLE | CCS_BOTTOM | SBARS_SIZEGRIP,
|
||||
NULL,
|
||||
Globals.hMainWnd,
|
||||
CMD_STATUSBAR_WND_ID);
|
||||
|
@ -865,9 +938,6 @@ VOID DoCreateStatusBar(VOID)
|
|||
|
||||
/* Load the string for formatting column/row text output */
|
||||
LoadString(Globals.hInstance, STRING_LINE_COLUMN, Globals.szStatusBarLineCol, MAX_PATH - 1);
|
||||
|
||||
/* Set the status bar for single-text output */
|
||||
SendMessage(Globals.hStatusBar, SB_SIMPLE, (WPARAM)TRUE, (LPARAM)0);
|
||||
}
|
||||
|
||||
/* Set status bar visiblity according to the settings. */
|
||||
|
@ -916,8 +986,15 @@ VOID DoCreateStatusBar(VOID)
|
|||
TRUE);
|
||||
}
|
||||
|
||||
/* Set the status bar for multiple-text output */
|
||||
DIALOG_StatusBarAlignParts();
|
||||
|
||||
/* Update content with current row/column text */
|
||||
DIALOG_StatusBarUpdateCaretPos();
|
||||
|
||||
/* Update line endings and encoding on the status bar */
|
||||
DIALOG_StatusBarUpdateLineEndings();
|
||||
DIALOG_StatusBarUpdateEncoding();
|
||||
}
|
||||
|
||||
VOID DoCreateEditWindow(VOID)
|
||||
|
@ -1195,7 +1272,7 @@ VOID DIALOG_StatusBarUpdateCaretPos(VOID)
|
|||
col = dwStart - SendMessage(Globals.hEdit, EM_LINEINDEX, (WPARAM)line, 0);
|
||||
|
||||
_stprintf(buff, Globals.szStatusBarLineCol, line + 1, col + 1);
|
||||
SendMessage(Globals.hStatusBar, SB_SETTEXT, SB_SIMPLEID, (LPARAM)buff);
|
||||
SendMessage(Globals.hStatusBar, SB_SETTEXT, SBPART_CURPOS, (LPARAM)buff);
|
||||
}
|
||||
|
||||
VOID DIALOG_ViewStatusBar(VOID)
|
||||
|
|
|
@ -46,6 +46,7 @@ VOID DIALOG_GoTo(VOID);
|
|||
VOID DIALOG_SelectFont(VOID);
|
||||
|
||||
VOID DIALOG_ViewStatusBar(VOID);
|
||||
VOID DIALOG_StatusBarAlignParts(VOID);
|
||||
VOID DIALOG_StatusBarUpdateCaretPos(VOID);
|
||||
|
||||
VOID DIALOG_HelpContents(VOID);
|
||||
|
|
|
@ -160,6 +160,7 @@ BEGIN
|
|||
STRING_UNICODE "Уникод"
|
||||
STRING_UNICODE_BE "Уникод (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Уьиндоуьс (CR + LF)"
|
||||
STRING_LF "Юникс (LF)"
|
||||
STRING_CR "Мак (CR)"
|
||||
|
|
|
@ -161,6 +161,7 @@ paměti."
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -161,6 +161,7 @@ hukommelse, og prøv så igen."
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -162,6 +162,7 @@ um diese Funktion\nabzuschließen. Beenden Sie eine oder mehrere \
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (Big-Endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -161,6 +161,7 @@ BEGIN
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -160,6 +160,7 @@ task.\nClose one or more applications to increase the amount of\nfree memory."
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -163,6 +163,7 @@ aumentar la cantidad\nde memoria libre."
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -168,6 +168,7 @@ käsu lõpetamiseks.\nSulge üks või enam rakendust, et suurendada\nvaba mälu
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -161,6 +161,7 @@ memoria librearen\nkopurua handitzeko."
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -161,6 +161,7 @@ muistia."
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -161,6 +161,7 @@ de la mémoire."
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -163,6 +163,7 @@ task.\nClose one or more applications to increase the amount of\nfree memory."
|
|||
STRING_UNICODE "יוניקוד"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "חלונות (CR + LF)"
|
||||
STRING_LF "יוניקס (LF)"
|
||||
STRING_CR "מקינטוש (CR)"
|
||||
|
|
|
@ -167,6 +167,7 @@ BEGIN
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -167,6 +167,7 @@ zadatak.\nZatvorite jednu ili više aplikacija da povećate\nslobodnu memoriju."
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -161,6 +161,7 @@ Szeretné menteni a változásokat?"
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -160,6 +160,7 @@ Would you like to save the changes ?"
|
|||
STRING_UNICODE "Յունիկոդ"
|
||||
STRING_UNICODE_BE "Յունիկոդ (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Պատւոհաններ (CR + LF)"
|
||||
STRING_LF "Յունիքս (LF)"
|
||||
STRING_CR "Մակինտոշ (CR)"
|
||||
|
|
|
@ -161,6 +161,7 @@ bebas."
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -161,6 +161,7 @@ di memoria libera."
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -161,6 +161,7 @@ BEGIN
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -160,6 +160,7 @@ Ar norite išsaugoti pakeitimus?"
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -162,6 +162,7 @@ tugas ini.\nTutup satu atau lebih aplikasi untuk menambah jumlah\ningatan kosong
|
|||
STRING_UNICODE "Unikod"
|
||||
STRING_UNICODE_BE "Unikod (endian besar)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -160,6 +160,7 @@ Wilt u de wijzigingen opslaan?"
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -161,6 +161,7 @@ minne."
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -155,6 +155,7 @@ BEGIN
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -160,6 +160,7 @@ tarefa.\nFeche uma ou mais aplicações para aumentar a quantidade de memória l
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -160,6 +160,7 @@ tarefa.\nFeche uma ou mais aplicações para aumentar a quantidade de memória l
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -165,6 +165,7 @@ Păstrați modificările aduse?"
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -160,6 +160,7 @@ BEGIN
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (Big Endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Macintosh (CR)"
|
||||
|
|
|
@ -168,6 +168,7 @@ alebo viac aplikácií, aby sa uvoľnila pamäť a skúste to znova."
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (veľký indián)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -160,6 +160,7 @@ operacijo.\nÈe ga želite sprostiti, konèajte enega ali veè programov in posk
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -164,6 +164,7 @@ detyrë.\nMbyll nje ose me shume programe te rrisesh shumën e\nmemories."
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -160,6 +160,7 @@ den här åtgärden.\nAvsluta ett eller flera program för att frigöra mer minn
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -155,6 +155,7 @@ BEGIN
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 (มี BOM)"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -158,6 +158,7 @@ BEGIN
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (Büyük Sonlu)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -160,6 +160,7 @@ BEGIN
|
|||
STRING_UNICODE "Юнікод"
|
||||
STRING_UNICODE_BE "Юнікод (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -160,6 +160,7 @@ O‘zgarishlarni saqlashni istaysizmi?"
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Macintosh (CR)"
|
||||
|
|
|
@ -168,6 +168,7 @@ BEGIN
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode(大端)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows(CR + LF)"
|
||||
STRING_LF "Unix(LF)"
|
||||
STRING_CR "Mac(CR)"
|
||||
|
|
|
@ -168,6 +168,7 @@ BEGIN
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode(大端序)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -168,6 +168,7 @@ BEGIN
|
|||
STRING_UNICODE "Unicode"
|
||||
STRING_UNICODE_BE "Unicode (big endian)"
|
||||
STRING_UTF8 "UTF-8"
|
||||
STRING_UTF8_BOM "UTF-8 with BOM"
|
||||
STRING_CRLF "Windows (CR + LF)"
|
||||
STRING_LF "Unix (LF)"
|
||||
STRING_CR "Mac (CR)"
|
||||
|
|
|
@ -427,8 +427,13 @@ NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
LOWORD(wParam),
|
||||
SWP_NOZORDER);
|
||||
|
||||
if (hdwp != NULL)
|
||||
EndDeferWindowPos(hdwp);
|
||||
if (hdwp == NULL)
|
||||
break;
|
||||
|
||||
EndDeferWindowPos(hdwp);
|
||||
|
||||
/* Align status bar parts, only if the status bar resize operation succeeds */
|
||||
DIALOG_StatusBarAlignParts();
|
||||
}
|
||||
else
|
||||
SetWindowPos(Globals.hEdit,
|
||||
|
|
|
@ -40,7 +40,8 @@ typedef enum
|
|||
ENCODING_ANSI = 0,
|
||||
ENCODING_UTF16LE = 1,
|
||||
ENCODING_UTF16BE = 2,
|
||||
ENCODING_UTF8 = 3
|
||||
ENCODING_UTF8 = 3,
|
||||
ENCODING_UTF8BOM = 4
|
||||
} ENCODING;
|
||||
|
||||
// #define MIN_ENCODING 0
|
||||
|
|
|
@ -88,17 +88,18 @@
|
|||
#define STRING_OUT_OF_MEMORY 0x17C
|
||||
#define STRING_CANNOTFIND 0x17D
|
||||
|
||||
#define STRING_ANSI 0x17E
|
||||
#define STRING_UNICODE 0x17F
|
||||
#define STRING_UNICODE_BE 0x180
|
||||
#define STRING_UTF8 0x181
|
||||
#define STRING_ANSI 0x180
|
||||
#define STRING_UNICODE 0x181
|
||||
#define STRING_UNICODE_BE 0x182
|
||||
#define STRING_UTF8 0x183
|
||||
#define STRING_UTF8_BOM 0x184
|
||||
|
||||
#define STRING_CRLF 0x182
|
||||
#define STRING_LF 0x183
|
||||
#define STRING_CR 0x184
|
||||
#define STRING_CRLF 0x185
|
||||
#define STRING_LF 0x186
|
||||
#define STRING_CR 0x187
|
||||
|
||||
#define STRING_LINE_COLUMN 0x186
|
||||
#define STRING_PRINTERROR 0x187
|
||||
#define STRING_LINE_COLUMN 0x188
|
||||
#define STRING_PRINTERROR 0x189
|
||||
|
||||
#define STRING_TEXT_DOCUMENT 0x200
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ ReadText(HANDLE hFile, LPWSTR *ppszText, DWORD *pdwTextLen, ENCODING *pencFile,
|
|||
}
|
||||
else if ((dwSize >= 3) && (pBytes[0] == 0xEF) && (pBytes[1] == 0xBB) && (pBytes[2] == 0xBF))
|
||||
{
|
||||
encFile = ENCODING_UTF8;
|
||||
encFile = ENCODING_UTF8BOM;
|
||||
dwPos += 3;
|
||||
}
|
||||
else
|
||||
|
@ -166,10 +166,11 @@ ReadText(HANDLE hFile, LPWSTR *ppszText, DWORD *pdwTextLen, ENCODING *pencFile,
|
|||
|
||||
case ENCODING_ANSI:
|
||||
case ENCODING_UTF8:
|
||||
if (encFile == ENCODING_ANSI)
|
||||
iCodePage = CP_ACP;
|
||||
else if (encFile == ENCODING_UTF8)
|
||||
case ENCODING_UTF8BOM:
|
||||
if (encFile == ENCODING_UTF8 || encFile == ENCODING_UTF8BOM)
|
||||
iCodePage = CP_UTF8;
|
||||
else
|
||||
iCodePage = CP_ACP;
|
||||
|
||||
if ((dwSize - dwPos) > 0)
|
||||
{
|
||||
|
@ -312,10 +313,11 @@ static BOOL WriteEncodedText(HANDLE hFile, LPCWSTR pszText, DWORD dwTextLen, ENC
|
|||
|
||||
case ENCODING_ANSI:
|
||||
case ENCODING_UTF8:
|
||||
if (encFile == ENCODING_ANSI)
|
||||
iCodePage = CP_ACP;
|
||||
else if (encFile == ENCODING_UTF8)
|
||||
case ENCODING_UTF8BOM:
|
||||
if (encFile == ENCODING_UTF8 || encFile == ENCODING_UTF8BOM)
|
||||
iCodePage = CP_UTF8;
|
||||
else
|
||||
iCodePage = CP_ACP;
|
||||
|
||||
iRequiredBytes = WideCharToMultiByte(iCodePage, 0, &pszText[dwPos], dwTextLen - dwPos, NULL, 0, NULL, NULL);
|
||||
if (iRequiredBytes <= 0)
|
||||
|
@ -371,8 +373,8 @@ BOOL WriteText(HANDLE hFile, LPCWSTR pszText, DWORD dwTextLen, ENCODING encFile,
|
|||
LPCWSTR pszLF = L"\n";
|
||||
DWORD dwPos, dwNext;
|
||||
|
||||
/* Write the proper byte order marks if not ANSI */
|
||||
if (encFile != ENCODING_ANSI)
|
||||
/* Write the proper byte order marks if not ANSI or UTF-8 without BOM */
|
||||
if (encFile != ENCODING_ANSI && encFile != ENCODING_UTF8)
|
||||
{
|
||||
wcBom = 0xFEFF;
|
||||
if (!WriteEncodedText(hFile, &wcBom, 1, encFile))
|
||||
|
|
Loading…
Reference in a new issue