diff --git a/reactos/base/applications/notepad/ChangeLog b/reactos/base/applications/notepad/ChangeLog deleted file mode 100644 index cd50462ca74..00000000000 --- a/reactos/base/applications/notepad/ChangeLog +++ /dev/null @@ -1,56 +0,0 @@ - *** This file is obsolete. Changes are listed in the main - *** ChangeLog now. Please do not edit. - -Fri Jun 12 23:29:44 1998 Marcel Baur - - Fixed GetDateFormat()->GetTimeFormat() for locale time. - -Mon May 25 14:30:00 1998 Henrik Olsen - * [Da.rc] - - Added Danish language support. - -Fri May 15 23:59:22 1998 Marcel Baur - - Date/Time now uses locale-specific formats - - Language-specific window caption, displays file being edited. - - Started with parsing of command line settings - - Started with DoOpenFile, DoCloseFile, DoSaveFile logics - - Prompt user to save settings when closing a file - -> Introduced a new message box (not yet finished) - - Fixed minor features (missing IDS in main.h, ...) - -Sun Mar 29 20:29:41 1998 Laurent Buffler - * [Fr.rc] - - Added French language support. - -Fri Feb 27 21:03:37 1998 Karl Backstrm - - Fixed some minor features. - -Sat Feb 14 17:42:29 1998 Karl Backstrm - * NEW [language.c] [language.h] - - Takes care of all language related stuff. - - A new [programs] in .winerc is in use. - -Tue Feb 10 23:34:08 1998 Marcel Baur - - Fixed broken language menus - -Fri Feb 06 23.54.35 1998 Karl Backstrm - * [main.c] [main.h] [notepad.rc] - - Fixed language support for menus. - * NEW [dialog.c] [dialog.h] - - Moved all menu and dialog related stuff here. - -Sun Jan 18 23:05:04 1998 Karl Backstrm - * [Sw.rc] - - Added/updated Swedish language support. - -Tue Dec 23 23:35:04 1997 Marcel Baur - - Fixed lots of bugs w/ resources in *.rc - - moved [notepad.c] into [main.c] - - moved [notepad.h] into [main.h] - -Fri Dec 05 20:51:55 1997 Marcel Baur - * [notepad.c] [notepad.h] [notepad.rc] [En.rc] [De.rc] - [license.c] [license.h] [License_En.c] - [README] [TODO] [ChangeLog] - - Originals by Marcel Baur - - diff --git a/reactos/base/applications/notepad/dialog.c b/reactos/base/applications/notepad/dialog.c index 9d7b979b331..d9299a9f89c 100644 --- a/reactos/base/applications/notepad/dialog.c +++ b/reactos/base/applications/notepad/dialog.c @@ -35,67 +35,6 @@ static const TCHAR txt_files[] = _T("*.txt"); static UINT_PTR CALLBACK DIALOG_PAGESETUP_Hook(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam); -#ifndef UNICODE -static LPSTR ConvertToASCII(LPSTR pszText) -{ - int sz; - LPWSTR pszTextW = (LPWSTR)pszText; - - /* default return value */ - pszText = NULL; - do { - /* query about requested size for conversion */ - sz = WideCharToMultiByte(CP_ACP, 0, pszTextW, -1, NULL, 0, NULL, NULL); - if (!sz) - break; - - /* get space for ASCII buffer */ - pszText = (LPSTR)HeapAlloc(GetProcessHeap(), 0, sz); - if (pszText == NULL) - break; - - /* if previous diagnostic call worked fine, - * then this one will work too, - * so no need to test return value here - */ - WideCharToMultiByte(CP_ACP, 0, pszTextW, -1, pszText, sz, NULL, NULL); - } while (0); - - HeapFree(GetProcessHeap(), 0, pszTextW); - return pszText; -} - -static LPWSTR ConvertToUNICODE(LPSTR pszText, DWORD *pdwSize) -{ - int sz; - LPWSTR pszTextW = NULL; - - do { - /* query about requested size for conversion */ - sz = MultiByteToWideChar(CP_ACP, 0, pszText, -1, NULL, 0); - if (!sz) - break; - - /* get space for UNICODE buffer */ - pszTextW = HeapAlloc(GetProcessHeap(), 0, sz * sizeof(WCHAR)); - if (pszText == NULL) - break; - - /* if previous diagnostic call worked fine, - * then this one will work too, - * so no need to test return value here - */ - MultiByteToWideChar(CP_ACP, 0, pszText, -1, pszTextW, sz); - - /* report the new size of the text to the caller */ - *pdwSize = sz; - } while (0); - - HeapFree(GetProcessHeap(), 0, pszText); - return pszTextW; -} -#endif - VOID ShowLastError(VOID) { DWORD error = GetLastError(); @@ -104,7 +43,7 @@ VOID ShowLastError(VOID) LPTSTR lpMsgBuf = NULL; TCHAR szTitle[MAX_STRING_LEN]; - LoadString(Globals.hInstance, STRING_ERROR, szTitle, SIZEOF(szTitle)); + LoadString(Globals.hInstance, STRING_ERROR, szTitle, ARRAY_SIZE(szTitle)); FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, @@ -129,74 +68,68 @@ static void UpdateWindowCaption(void) TCHAR szCaption[MAX_STRING_LEN]; TCHAR szNotepad[MAX_STRING_LEN]; - LoadString(Globals.hInstance, STRING_NOTEPAD, szNotepad, SIZEOF(szNotepad)); + LoadString(Globals.hInstance, STRING_NOTEPAD, szNotepad, ARRAY_SIZE(szNotepad)); if (Globals.szFileTitle[0] != 0) { - StringCchCopy(szCaption, SIZEOF(szCaption), Globals.szFileTitle); + StringCchCopy(szCaption, ARRAY_SIZE(szCaption), Globals.szFileTitle); } else { - LoadString(Globals.hInstance, STRING_UNTITLED, szCaption, SIZEOF(szCaption)); + LoadString(Globals.hInstance, STRING_UNTITLED, szCaption, ARRAY_SIZE(szCaption)); } - StringCchCat(szCaption, SIZEOF(szCaption), _T(" - ")); - StringCchCat(szCaption, SIZEOF(szCaption), szNotepad); + StringCchCat(szCaption, ARRAY_SIZE(szCaption), _T(" - ")); + StringCchCat(szCaption, ARRAY_SIZE(szCaption), szNotepad); SetWindowText(Globals.hMainWnd, szCaption); } -static void AlertFileNotFound(LPCTSTR szFileName) +int DIALOG_StringMsgBox(HWND hParent, int formatId, LPCTSTR szString, DWORD dwFlags) { TCHAR szMessage[MAX_STRING_LEN]; TCHAR szResource[MAX_STRING_LEN]; /* Load and format szMessage */ - LoadString(Globals.hInstance, STRING_NOTFOUND, szResource, SIZEOF(szResource)); - wsprintf(szMessage, szResource, szFileName); + LoadString(Globals.hInstance, formatId, szResource, ARRAY_SIZE(szResource)); + _sntprintf(szMessage, ARRAY_SIZE(szMessage), szResource, szString); /* Load szCaption */ - LoadString(Globals.hInstance, STRING_NOTEPAD, szResource, SIZEOF(szResource)); + if ((dwFlags & MB_ICONMASK) == MB_ICONEXCLAMATION) + LoadString(Globals.hInstance, STRING_ERROR, szResource, ARRAY_SIZE(szResource)); + else + LoadString(Globals.hInstance, STRING_NOTEPAD, szResource, ARRAY_SIZE(szResource)); /* Display Modal Dialog */ - MessageBox(Globals.hMainWnd, szMessage, szResource, MB_ICONEXCLAMATION); + // if (hParent == NULL) + // hParent = Globals.hMainWnd; + return MessageBox(hParent, szMessage, szResource, dwFlags); +} + +static void AlertFileNotFound(LPCTSTR szFileName) +{ + DIALOG_StringMsgBox(Globals.hMainWnd, STRING_NOTFOUND, szFileName, MB_ICONEXCLAMATION | MB_OK); } static int AlertFileNotSaved(LPCTSTR szFileName) { - TCHAR szMessage[MAX_STRING_LEN]; - TCHAR szResource[MAX_STRING_LEN]; TCHAR szUntitled[MAX_STRING_LEN]; - LoadString(Globals.hInstance, STRING_UNTITLED, szUntitled, SIZEOF(szUntitled)); + LoadString(Globals.hInstance, STRING_UNTITLED, szUntitled, ARRAY_SIZE(szUntitled)); - /* Load and format Message */ - LoadString(Globals.hInstance, STRING_NOTSAVED, szResource, SIZEOF(szResource)); - wsprintf(szMessage, szResource, szFileName[0] ? szFileName : szUntitled); - - /* Load Caption */ - LoadString(Globals.hInstance, STRING_NOTEPAD, szResource, SIZEOF(szResource)); - - /* Display modal */ - return MessageBox(Globals.hMainWnd, szMessage, szResource, MB_ICONEXCLAMATION|MB_YESNOCANCEL); + return DIALOG_StringMsgBox(Globals.hMainWnd, STRING_NOTSAVED, + szFileName[0] ? szFileName : szUntitled, + MB_ICONQUESTION | MB_YESNOCANCEL); } static void AlertPrintError(void) { - TCHAR szMessage[MAX_STRING_LEN]; - TCHAR szResource[MAX_STRING_LEN]; TCHAR szUntitled[MAX_STRING_LEN]; - LoadString(Globals.hInstance, STRING_UNTITLED, szUntitled, SIZEOF(szUntitled)); + LoadString(Globals.hInstance, STRING_UNTITLED, szUntitled, ARRAY_SIZE(szUntitled)); - /* Load and format Message */ - LoadString(Globals.hInstance, STRING_PRINTERROR, szResource, SIZEOF(szResource)); - wsprintf(szMessage, szResource, Globals.szFileName[0] ? Globals.szFileName : szUntitled); - - /* Load Caption */ - LoadString(Globals.hInstance, STRING_NOTEPAD, szResource, SIZEOF(szResource)); - - /* Display modal */ - MessageBox(Globals.hMainWnd, szMessage, szResource, MB_ICONEXCLAMATION); + DIALOG_StringMsgBox(Globals.hMainWnd, STRING_NOTSAVED, + Globals.szFileName[0] ? Globals.szFileName : szUntitled, + MB_ICONEXCLAMATION | MB_OK); } /** @@ -317,20 +250,9 @@ static BOOL DoSaveFile(VOID) } size = GetWindowText(Globals.hEdit, pTemp, size); -#ifndef UNICODE - pTemp = (LPTSTR)ConvertToUNICODE(pTemp, &size); - if (!pTemp) - { - /* original "pTemp" already freed */ - CloseHandle(hFile); - ShowLastError(); - return FALSE; - } -#endif - if (size) { - if (!WriteText(hFile, (LPWSTR)pTemp, size, Globals.iEncoding, Globals.iEoln)) + if (!WriteText(hFile, (LPWSTR)pTemp, size, Globals.encFile, Globals.iEoln)) { ShowLastError(); bRet = FALSE; @@ -404,18 +326,11 @@ VOID DoOpenFile(LPCTSTR szFileName) goto done; } - if (!ReadText(hFile, (LPWSTR *)&pszText, &dwTextLen, &Globals.iEncoding, &Globals.iEoln)) + if (!ReadText(hFile, (LPWSTR *)&pszText, &dwTextLen, &Globals.encFile, &Globals.iEoln)) { ShowLastError(); goto done; } -#ifndef UNICODE - pszText = ConvertToASCII(pszText); - if (pszText == NULL) { - ShowLastError(); - goto done; - } -#endif SetWindowText(Globals.hEdit, pszText); SendMessage(Globals.hEdit, EM_SETMODIFY, FALSE, 0); @@ -425,7 +340,7 @@ VOID DoOpenFile(LPCTSTR szFileName) /* If the file starts with .LOG, add a time/date at the end and set cursor after * See http://support.microsoft.com/?kbid=260563 */ - if (GetWindowText(Globals.hEdit, log, SIZEOF(log)) && !_tcscmp(log, dotlog)) + if (GetWindowText(Globals.hEdit, log, ARRAY_SIZE(log)) && !_tcscmp(log, dotlog)) { static const TCHAR lf[] = _T("\r\n"); SendMessage(Globals.hEdit, EM_SETSEL, GetWindowTextLength(Globals.hEdit), -1); @@ -463,7 +378,7 @@ VOID DIALOG_FileOpen(VOID) ZeroMemory(&openfilename, sizeof(openfilename)); - GetCurrentDirectory(SIZEOF(szDir), szDir); + GetCurrentDirectory(ARRAY_SIZE(szDir), szDir); if (Globals.szFileName[0] == 0) _tcscpy(szPath, txt_files); else @@ -474,7 +389,7 @@ VOID DIALOG_FileOpen(VOID) openfilename.hInstance = Globals.hInstance; openfilename.lpstrFilter = Globals.szFilter; openfilename.lpstrFile = szPath; - openfilename.nMaxFile = SIZEOF(szPath); + openfilename.nMaxFile = ARRAY_SIZE(szPath); openfilename.lpstrInitialDir = szDir; openfilename.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY; openfilename.lpstrDefExt = szDefaultExt; @@ -509,29 +424,29 @@ DIALOG_FileSaveAs_Hook(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) case WM_INITDIALOG: hCombo = GetDlgItem(hDlg, ID_ENCODING); - LoadString(Globals.hInstance, STRING_ANSI, szText, SIZEOF(szText)); + LoadString(Globals.hInstance, STRING_ANSI, szText, ARRAY_SIZE(szText)); SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM) szText); - LoadString(Globals.hInstance, STRING_UNICODE, szText, SIZEOF(szText)); + LoadString(Globals.hInstance, STRING_UNICODE, szText, ARRAY_SIZE(szText)); SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM) szText); - LoadString(Globals.hInstance, STRING_UNICODE_BE, szText, SIZEOF(szText)); + LoadString(Globals.hInstance, STRING_UNICODE_BE, szText, ARRAY_SIZE(szText)); SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM) szText); - LoadString(Globals.hInstance, STRING_UTF8, szText, SIZEOF(szText)); + LoadString(Globals.hInstance, STRING_UTF8, szText, ARRAY_SIZE(szText)); SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM) szText); - SendMessage(hCombo, CB_SETCURSEL, Globals.iEncoding, 0); + SendMessage(hCombo, CB_SETCURSEL, Globals.encFile, 0); hCombo = GetDlgItem(hDlg, ID_EOLN); - LoadString(Globals.hInstance, STRING_CRLF, szText, SIZEOF(szText)); + LoadString(Globals.hInstance, STRING_CRLF, szText, ARRAY_SIZE(szText)); SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM) szText); - LoadString(Globals.hInstance, STRING_LF, szText, SIZEOF(szText)); + LoadString(Globals.hInstance, STRING_LF, szText, ARRAY_SIZE(szText)); SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM) szText); - LoadString(Globals.hInstance, STRING_CR, szText, SIZEOF(szText)); + LoadString(Globals.hInstance, STRING_CR, szText, ARRAY_SIZE(szText)); SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM) szText); SendMessage(hCombo, CB_SETCURSEL, Globals.iEoln, 0); @@ -542,7 +457,7 @@ DIALOG_FileSaveAs_Hook(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { hCombo = GetDlgItem(hDlg, ID_ENCODING); if (hCombo) - Globals.iEncoding = (int) SendMessage(hCombo, CB_GETCURSEL, 0, 0); + Globals.encFile = (int) SendMessage(hCombo, CB_GETCURSEL, 0, 0); hCombo = GetDlgItem(hDlg, ID_EOLN); if (hCombo) @@ -561,7 +476,7 @@ BOOL DIALOG_FileSaveAs(VOID) ZeroMemory(&saveas, sizeof(saveas)); - GetCurrentDirectory(SIZEOF(szDir), szDir); + GetCurrentDirectory(ARRAY_SIZE(szDir), szDir); if (Globals.szFileName[0] == 0) _tcscpy(szPath, txt_files); else @@ -572,7 +487,7 @@ BOOL DIALOG_FileSaveAs(VOID) saveas.hInstance = Globals.hInstance; saveas.lpstrFilter = Globals.szFilter; saveas.lpstrFile = szPath; - saveas.nMaxFile = SIZEOF(szPath); + saveas.nMaxFile = ARRAY_SIZE(szPath); saveas.lpstrInitialDir = szDir; saveas.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_EXPLORER | OFN_ENABLETEMPLATE | OFN_ENABLEHOOK; @@ -1056,9 +971,9 @@ static VOID DIALOG_SearchDialog(FINDPROC pfnProc) Globals.find.hwndOwner = Globals.hMainWnd; Globals.find.hInstance = Globals.hInstance; Globals.find.lpstrFindWhat = Globals.szFindText; - Globals.find.wFindWhatLen = SIZEOF(Globals.szFindText); + Globals.find.wFindWhatLen = ARRAY_SIZE(Globals.szFindText); Globals.find.lpstrReplaceWith = Globals.szReplaceText; - Globals.find.wReplaceWithLen = SIZEOF(Globals.szReplaceText); + Globals.find.wReplaceWithLen = ARRAY_SIZE(Globals.szReplaceText); Globals.find.Flags = FR_DOWN; /* We only need to create the modal FindReplace dialog which will */ @@ -1097,7 +1012,7 @@ DIALOG_GoTo_DialogProc(HWND hwndDialog, UINT uMsg, WPARAM wParam, LPARAM lParam) switch(uMsg) { case WM_INITDIALOG: hTextBox = GetDlgItem(hwndDialog, ID_LINENUMBER); - _sntprintf(szText, SIZEOF(szText), _T("%ld"), lParam); + _sntprintf(szText, ARRAY_SIZE(szText), _T("%ld"), lParam); SetWindowText(hTextBox, szText); break; case WM_COMMAND: @@ -1106,7 +1021,7 @@ DIALOG_GoTo_DialogProc(HWND hwndDialog, UINT uMsg, WPARAM wParam, LPARAM lParam) if (LOWORD(wParam) == IDOK) { hTextBox = GetDlgItem(hwndDialog, ID_LINENUMBER); - GetWindowText(hTextBox, szText, SIZEOF(szText)); + GetWindowText(hTextBox, szText, ARRAY_SIZE(szText)); EndDialog(hwndDialog, _ttoi(szText)); bResult = TRUE; } @@ -1200,9 +1115,16 @@ VOID DIALOG_HelpHelp(VOID) WinHelp(Globals.hMainWnd, helpfile, HELP_HELPONHELP, 0); } -#ifdef _MSC_VER -#pragma warning(disable : 4100) -#endif +VOID DIALOG_HelpAboutNotepad(VOID) +{ + TCHAR szNotepad[MAX_STRING_LEN]; + HICON notepadIcon = LoadIcon(Globals.hInstance, MAKEINTRESOURCE(IDI_NPICON)); + + LoadString(Globals.hInstance, STRING_NOTEPAD, szNotepad, ARRAY_SIZE(szNotepad)); + ShellAbout(Globals.hMainWnd, szNotepad, 0, notepadIcon); + DeleteObject(notepadIcon); +} + INT_PTR CALLBACK AboutDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) @@ -1238,16 +1160,6 @@ AboutDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) return 0; } -VOID DIALOG_HelpAboutWine(VOID) -{ - TCHAR szNotepad[MAX_STRING_LEN]; - HICON notepadIcon = LoadIcon(Globals.hInstance, MAKEINTRESOURCE(IDI_NPICON)); - - LoadString(Globals.hInstance, STRING_NOTEPAD, szNotepad, SIZEOF(szNotepad)); - ShellAbout(Globals.hMainWnd, szNotepad, 0, notepadIcon); - DeleteObject(notepadIcon); -} - /*********************************************************************** * * DIALOG_FilePageSetup @@ -1296,8 +1208,8 @@ static UINT_PTR CALLBACK DIALOG_PAGESETUP_Hook(HWND hDlg, UINT msg, WPARAM wPara { case IDOK: /* save user input and close dialog */ - GetDlgItemText(hDlg, 0x141, Globals.szHeader, SIZEOF(Globals.szHeader)); - GetDlgItemText(hDlg, 0x143, Globals.szFooter, SIZEOF(Globals.szFooter)); + GetDlgItemText(hDlg, 0x141, Globals.szHeader, ARRAY_SIZE(Globals.szHeader)); + GetDlgItemText(hDlg, 0x143, Globals.szFooter, ARRAY_SIZE(Globals.szFooter)); return FALSE; case IDCANCEL: diff --git a/reactos/base/applications/notepad/dialog.h b/reactos/base/applications/notepad/dialog.h index 8978991bb90..c2ef5851ca1 100644 --- a/reactos/base/applications/notepad/dialog.h +++ b/reactos/base/applications/notepad/dialog.h @@ -52,10 +52,12 @@ VOID DIALOG_HelpSearch(VOID); VOID DIALOG_HelpHelp(VOID); VOID DIALOG_HelpLicense(VOID); VOID DIALOG_HelpNoWarranty(VOID); -VOID DIALOG_HelpAboutWine(VOID); +VOID DIALOG_HelpAboutNotepad(VOID); VOID DIALOG_TimeDate(VOID); +int DIALOG_StringMsgBox(HWND hParent, int formatId, LPCTSTR szString, DWORD dwFlags); + INT_PTR CALLBACK AboutDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); /* utility functions */ diff --git a/reactos/base/applications/notepad/lang/bg-BG.rc b/reactos/base/applications/notepad/lang/bg-BG.rc index 699c0c3e41a..10647c36a20 100644 --- a/reactos/base/applications/notepad/lang/bg-BG.rc +++ b/reactos/base/applications/notepad/lang/bg-BG.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "&Помощ за помощта", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "&За", CMD_ABOUT - MENUITEM "С&ведения", CMD_ABOUT_WINE + MENUITEM "С&ведения", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/cs-CZ.rc b/reactos/base/applications/notepad/lang/cs-CZ.rc index 6f50812f49e..c1d0463c301 100644 --- a/reactos/base/applications/notepad/lang/cs-CZ.rc +++ b/reactos/base/applications/notepad/lang/cs-CZ.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "Pomoc k ná&povědě", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "&O programu...", CMD_ABOUT - MENUITEM "In&fo...", CMD_ABOUT_WINE + MENUITEM "In&fo...", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/da-DK.rc b/reactos/base/applications/notepad/lang/da-DK.rc index bfe1291b539..451c335dd42 100644 --- a/reactos/base/applications/notepad/lang/da-DK.rc +++ b/reactos/base/applications/notepad/lang/da-DK.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "&Brug af Hjælp", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "&About", CMD_ABOUT - MENUITEM "&Om Notesblok", CMD_ABOUT_WINE + MENUITEM "&Om Notesblok", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/de-DE.rc b/reactos/base/applications/notepad/lang/de-DE.rc index 1eb974eff84..1ec6149de14 100644 --- a/reactos/base/applications/notepad/lang/de-DE.rc +++ b/reactos/base/applications/notepad/lang/de-DE.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "&Hilfe benutzen", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "&Über", CMD_ABOUT - MENUITEM "Inf&o", CMD_ABOUT_WINE + MENUITEM "Inf&o", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/el-GR.rc b/reactos/base/applications/notepad/lang/el-GR.rc index d3280b64f57..6770445c5a4 100644 --- a/reactos/base/applications/notepad/lang/el-GR.rc +++ b/reactos/base/applications/notepad/lang/el-GR.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "&Βοήθεια στη βοήθεια", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "&About", CMD_ABOUT - MENUITEM "Πληρο&φορίες", CMD_ABOUT_WINE + MENUITEM "Πληρο&φορίες", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/en-US.rc b/reactos/base/applications/notepad/lang/en-US.rc index 7f44dd29c47..b7a568fcc55 100644 --- a/reactos/base/applications/notepad/lang/en-US.rc +++ b/reactos/base/applications/notepad/lang/en-US.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "&Help on help", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "&About", CMD_ABOUT - MENUITEM "Inf&o", CMD_ABOUT_WINE + MENUITEM "Inf&o", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/es-ES.rc b/reactos/base/applications/notepad/lang/es-ES.rc index 552f873ed71..6ec08f4400c 100644 --- a/reactos/base/applications/notepad/lang/es-ES.rc +++ b/reactos/base/applications/notepad/lang/es-ES.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "A&yuda sobre la ayuda", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "&Acerca de", CMD_ABOUT - MENUITEM "&Información...", CMD_ABOUT_WINE + MENUITEM "&Información...", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/eu-ES.rc b/reactos/base/applications/notepad/lang/eu-ES.rc index 671da4b0675..9e4fd76ab1a 100644 --- a/reactos/base/applications/notepad/lang/eu-ES.rc +++ b/reactos/base/applications/notepad/lang/eu-ES.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "Laguntzari buruz laguntza", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "&Ohar-blokari buruz", CMD_ABOUT - MENUITEM "&Informazioa...", CMD_ABOUT_WINE + MENUITEM "&Informazioa...", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/fi-FI.rc b/reactos/base/applications/notepad/lang/fi-FI.rc index 1a422e10f7c..bc51b0bbd20 100644 --- a/reactos/base/applications/notepad/lang/fi-FI.rc +++ b/reactos/base/applications/notepad/lang/fi-FI.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "Apua &Opastuksesta", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "&About", CMD_ABOUT - MENUITEM "Inf&o...", CMD_ABOUT_WINE + MENUITEM "Inf&o...", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/fr-FR.rc b/reactos/base/applications/notepad/lang/fr-FR.rc index af7fa0d3462..bf1fcbf66fd 100644 --- a/reactos/base/applications/notepad/lang/fr-FR.rc +++ b/reactos/base/applications/notepad/lang/fr-FR.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "&Utiliser l'aide", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "&À propos", CMD_ABOUT - MENUITEM "Inf&o...", CMD_ABOUT_WINE + MENUITEM "Inf&o...", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/he-IL.rc b/reactos/base/applications/notepad/lang/he-IL.rc index 874afe7318e..819bbcfee2d 100644 --- a/reactos/base/applications/notepad/lang/he-IL.rc +++ b/reactos/base/applications/notepad/lang/he-IL.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "עזרה בעזרה", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "אודות", CMD_ABOUT - MENUITEM "מידע", CMD_ABOUT_WINE + MENUITEM "מידע", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/hu-HU.rc b/reactos/base/applications/notepad/lang/hu-HU.rc index 708e067c29e..c4315910bbf 100644 --- a/reactos/base/applications/notepad/lang/hu-HU.rc +++ b/reactos/base/applications/notepad/lang/hu-HU.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "&Használat", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "&About", CMD_ABOUT - MENUITEM "Inf&ormáció...", CMD_ABOUT_WINE + MENUITEM "Inf&ormáció...", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/hy-AM.rc b/reactos/base/applications/notepad/lang/hy-AM.rc index 28a2dd2c8e8..4ebb5b7c469 100644 --- a/reactos/base/applications/notepad/lang/hy-AM.rc +++ b/reactos/base/applications/notepad/lang/hy-AM.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "&Օգնությոն օգտագործում", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "&Ծրագրի մասին", CMD_ABOUT - MENUITEM "&Տեղեկություն...", CMD_ABOUT_WINE + MENUITEM "&Տեղեկություն...", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/id-ID.rc b/reactos/base/applications/notepad/lang/id-ID.rc index c5662363453..3e7523500dc 100644 --- a/reactos/base/applications/notepad/lang/id-ID.rc +++ b/reactos/base/applications/notepad/lang/id-ID.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "&Bantuan pada bantuan", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "&Tentang", CMD_ABOUT - MENUITEM "Inf&o", CMD_ABOUT_WINE + MENUITEM "Inf&o", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/it-IT.rc b/reactos/base/applications/notepad/lang/it-IT.rc index 5d1944260c5..cb821b82ff4 100644 --- a/reactos/base/applications/notepad/lang/it-IT.rc +++ b/reactos/base/applications/notepad/lang/it-IT.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "&Aiuto sulla Guida", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "Informazioni &su blocco note", CMD_ABOUT - MENUITEM "Inf&o...", CMD_ABOUT_WINE + MENUITEM "Inf&o...", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/ja-JP.rc b/reactos/base/applications/notepad/lang/ja-JP.rc index addf4a22ad0..c8e8b474b60 100644 --- a/reactos/base/applications/notepad/lang/ja-JP.rc +++ b/reactos/base/applications/notepad/lang/ja-JP.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "ヘルプの使い方(&H)", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "バージョン情報(&A)", CMD_ABOUT - MENUITEM "情報(&O)", CMD_ABOUT_WINE + MENUITEM "情報(&O)", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/lt-LT.rc b/reactos/base/applications/notepad/lang/lt-LT.rc index 302cffc389e..9a685562f77 100644 --- a/reactos/base/applications/notepad/lang/lt-LT.rc +++ b/reactos/base/applications/notepad/lang/lt-LT.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "&Pagalba", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "&Apie Notepad", CMD_ABOUT - MENUITEM "Apie &ReactOS", CMD_ABOUT_WINE + MENUITEM "Apie &ReactOS", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/nl-NL.rc b/reactos/base/applications/notepad/lang/nl-NL.rc index 5cacae3f968..c536f187725 100644 --- a/reactos/base/applications/notepad/lang/nl-NL.rc +++ b/reactos/base/applications/notepad/lang/nl-NL.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "&Hulp bij Help", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "&About", CMD_ABOUT - MENUITEM "Inf&o...", CMD_ABOUT_WINE + MENUITEM "Inf&o...", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/no-NO.rc b/reactos/base/applications/notepad/lang/no-NO.rc index b4986778ed4..96eeb8c35ef 100644 --- a/reactos/base/applications/notepad/lang/no-NO.rc +++ b/reactos/base/applications/notepad/lang/no-NO.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "&Hjelp om hjelp", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "&Om", CMD_ABOUT - MENUITEM "&Infomasjon", CMD_ABOUT_WINE + MENUITEM "&Infomasjon", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/pl-PL.rc b/reactos/base/applications/notepad/lang/pl-PL.rc index 98d1345c990..b7ee06918b1 100644 --- a/reactos/base/applications/notepad/lang/pl-PL.rc +++ b/reactos/base/applications/notepad/lang/pl-PL.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "Pomo&c", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "&Notatnik - informacje", CMD_ABOUT - MENUITEM "&ReactOS - informacje", CMD_ABOUT_WINE + MENUITEM "&ReactOS - informacje", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/pt-BR.rc b/reactos/base/applications/notepad/lang/pt-BR.rc index 99c7fb7b97f..cf84833633f 100644 --- a/reactos/base/applications/notepad/lang/pt-BR.rc +++ b/reactos/base/applications/notepad/lang/pt-BR.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "&Ajuda na ajuda", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "&Sobre", CMD_ABOUT - MENUITEM "&Informações...", CMD_ABOUT_WINE + MENUITEM "&Informações...", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/pt-PT.rc b/reactos/base/applications/notepad/lang/pt-PT.rc index 99c7fb7b97f..cf84833633f 100644 --- a/reactos/base/applications/notepad/lang/pt-PT.rc +++ b/reactos/base/applications/notepad/lang/pt-PT.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "&Ajuda na ajuda", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "&Sobre", CMD_ABOUT - MENUITEM "&Informações...", CMD_ABOUT_WINE + MENUITEM "&Informações...", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/ro-RO.rc b/reactos/base/applications/notepad/lang/ro-RO.rc index 7fbcbb30a2f..b7f0c4b6c4b 100644 --- a/reactos/base/applications/notepad/lang/ro-RO.rc +++ b/reactos/base/applications/notepad/lang/ro-RO.rc @@ -70,7 +70,7 @@ BEGIN MENUITEM "M&anualul manualului", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "&Despre…", CMD_ABOUT - MENUITEM "&Info…", CMD_ABOUT_WINE + MENUITEM "&Info…", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/ru-RU.rc b/reactos/base/applications/notepad/lang/ru-RU.rc index 198eda4e613..6195db420d0 100644 --- a/reactos/base/applications/notepad/lang/ru-RU.rc +++ b/reactos/base/applications/notepad/lang/ru-RU.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "&Использование справки", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "&О программе", CMD_ABOUT - MENUITEM "&Сведения...", CMD_ABOUT_WINE + MENUITEM "&Сведения...", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/sk-SK.rc b/reactos/base/applications/notepad/lang/sk-SK.rc index 68ebaa72675..acf647fbd46 100644 --- a/reactos/base/applications/notepad/lang/sk-SK.rc +++ b/reactos/base/applications/notepad/lang/sk-SK.rc @@ -73,7 +73,7 @@ BEGIN MENUITEM "&Pomoc", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "Č&o je Poznámkový blok", CMD_ABOUT - MENUITEM "Čo je &Víno (Wine)", CMD_ABOUT_WINE + MENUITEM "Čo je &Víno (Wine)", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/sl-SI.rc b/reactos/base/applications/notepad/lang/sl-SI.rc index 165c3fd4e67..d2ca5357aec 100644 --- a/reactos/base/applications/notepad/lang/sl-SI.rc +++ b/reactos/base/applications/notepad/lang/sl-SI.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "&O pomoèi", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "&About", CMD_ABOUT - MENUITEM "Inf&ormacije ...", CMD_ABOUT_WINE + MENUITEM "Inf&ormacije ...", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/sq-AL.rc b/reactos/base/applications/notepad/lang/sq-AL.rc index 95f3136e57c..362c67a88a5 100644 --- a/reactos/base/applications/notepad/lang/sq-AL.rc +++ b/reactos/base/applications/notepad/lang/sq-AL.rc @@ -69,7 +69,7 @@ BEGIN MENUITEM "Ndihmë për ndihmë", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "Rreth", CMD_ABOUT - MENUITEM "Inf&o", CMD_ABOUT_WINE + MENUITEM "Inf&o", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/sv-SE.rc b/reactos/base/applications/notepad/lang/sv-SE.rc index a81ef71b0ab..c5bc772f4fe 100644 --- a/reactos/base/applications/notepad/lang/sv-SE.rc +++ b/reactos/base/applications/notepad/lang/sv-SE.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "Anvisningar för hjälpen", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "Om &Anteckningar", CMD_ABOUT - MENUITEM "Inf&ormation...", CMD_ABOUT_WINE + MENUITEM "Inf&ormation...", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/th-TH.rc b/reactos/base/applications/notepad/lang/th-TH.rc index a101a21d132..238d6c16403 100644 --- a/reactos/base/applications/notepad/lang/th-TH.rc +++ b/reactos/base/applications/notepad/lang/th-TH.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "เกี่ยวกับช่วยเหลีอ", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "&About", CMD_ABOUT - MENUITEM "รายละเอียด...", CMD_ABOUT_WINE + MENUITEM "รายละเอียด...", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/tr-TR.rc b/reactos/base/applications/notepad/lang/tr-TR.rc index 4368207b988..6bc2cc54d4c 100644 --- a/reactos/base/applications/notepad/lang/tr-TR.rc +++ b/reactos/base/applications/notepad/lang/tr-TR.rc @@ -67,7 +67,7 @@ BEGIN MENUITEM "&Yardım İçin Yardım", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "&Bilgi...", CMD_ABOUT - MENUITEM "&Üzerine...", CMD_ABOUT_WINE + MENUITEM "&Üzerine...", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/uk-UA.rc b/reactos/base/applications/notepad/lang/uk-UA.rc index 82a8162e4d1..f90835732ec 100644 --- a/reactos/base/applications/notepad/lang/uk-UA.rc +++ b/reactos/base/applications/notepad/lang/uk-UA.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "Використ&ання довідки", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "&Про", CMD_ABOUT - MENUITEM "Про програм&у", CMD_ABOUT_WINE + MENUITEM "Про програм&у", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/uz-UZ.rc b/reactos/base/applications/notepad/lang/uz-UZ.rc index d9443f2c5cd..8db2a6e56cb 100644 --- a/reactos/base/applications/notepad/lang/uz-UZ.rc +++ b/reactos/base/applications/notepad/lang/uz-UZ.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "&Использование справки", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "Bloknot h&aqida", CMD_ABOUT - MENUITEM "&Сведения...", CMD_ABOUT_WINE + MENUITEM "&Сведения...", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/lang/zh-CN.rc b/reactos/base/applications/notepad/lang/zh-CN.rc index 128c4fb6f67..23e56673887 100644 --- a/reactos/base/applications/notepad/lang/zh-CN.rc +++ b/reactos/base/applications/notepad/lang/zh-CN.rc @@ -65,7 +65,7 @@ BEGIN MENUITEM "如何使用帮助(&H)", CMD_HELP_ON_HELP MENUITEM SEPARATOR MENUITEM "关于(&A)", CMD_ABOUT - MENUITEM "资料信息(&O)...", CMD_ABOUT_WINE + MENUITEM "资料信息(&O)...", CMD_HELP_ABOUT_NOTEPAD END END diff --git a/reactos/base/applications/notepad/main.c b/reactos/base/applications/notepad/main.c index c73d7611dcc..46235a35278 100644 --- a/reactos/base/applications/notepad/main.c +++ b/reactos/base/applications/notepad/main.c @@ -45,9 +45,9 @@ VOID NOTEPAD_EnableSearchMenu() */ VOID SetFileName(LPCTSTR szFileName) { - StringCchCopy(Globals.szFileName, SIZEOF(Globals.szFileName), szFileName); + StringCchCopy(Globals.szFileName, ARRAY_SIZE(Globals.szFileName), szFileName); Globals.szFileTitle[0] = 0; - GetFileTitle(szFileName, Globals.szFileTitle, SIZEOF(Globals.szFileTitle)); + GetFileTitle(szFileName, Globals.szFileTitle, ARRAY_SIZE(Globals.szFileTitle)); } /*********************************************************************** @@ -60,26 +60,26 @@ static int NOTEPAD_MenuCommand(WPARAM wParam) { switch (wParam) { - case CMD_NEW: DIALOG_FileNew(); break; - case CMD_OPEN: DIALOG_FileOpen(); break; - case CMD_SAVE: DIALOG_FileSave(); break; - case CMD_SAVE_AS: DIALOG_FileSaveAs(); break; - case CMD_PRINT: DIALOG_FilePrint(); break; + case CMD_NEW: DIALOG_FileNew(); break; + case CMD_OPEN: DIALOG_FileOpen(); break; + case CMD_SAVE: DIALOG_FileSave(); break; + case CMD_SAVE_AS: DIALOG_FileSaveAs(); break; + case CMD_PRINT: DIALOG_FilePrint(); break; case CMD_PAGE_SETUP: DIALOG_FilePageSetup(); break; - case CMD_EXIT: DIALOG_FileExit(); break; + case CMD_EXIT: DIALOG_FileExit(); break; - case CMD_UNDO: DIALOG_EditUndo(); break; - case CMD_CUT: DIALOG_EditCut(); break; - case CMD_COPY: DIALOG_EditCopy(); break; - case CMD_PASTE: DIALOG_EditPaste(); break; - case CMD_DELETE: DIALOG_EditDelete(); break; + case CMD_UNDO: DIALOG_EditUndo(); break; + case CMD_CUT: DIALOG_EditCut(); break; + case CMD_COPY: DIALOG_EditCopy(); break; + case CMD_PASTE: DIALOG_EditPaste(); break; + case CMD_DELETE: DIALOG_EditDelete(); break; case CMD_SELECT_ALL: DIALOG_EditSelectAll(); break; - case CMD_TIME_DATE: DIALOG_EditTimeDate(); break; + case CMD_TIME_DATE: DIALOG_EditTimeDate(); break; - case CMD_SEARCH: DIALOG_Search(); break; + case CMD_SEARCH: DIALOG_Search(); break; case CMD_SEARCH_NEXT: DIALOG_SearchNext(); break; - case CMD_REPLACE: DIALOG_Replace(); break; - case CMD_GOTO: DIALOG_GoTo(); break; + case CMD_REPLACE: DIALOG_Replace(); break; + case CMD_GOTO: DIALOG_GoTo(); break; case CMD_WRAP: DIALOG_EditWrap(); break; case CMD_FONT: DIALOG_SelectFont(); break; @@ -87,8 +87,8 @@ static int NOTEPAD_MenuCommand(WPARAM wParam) case CMD_STATUSBAR: DIALOG_ViewStatusBar(); break; case CMD_HELP_CONTENTS: DIALOG_HelpContents(); break; - case CMD_HELP_SEARCH: DIALOG_HelpSearch(); break; - case CMD_HELP_ON_HELP: DIALOG_HelpHelp(); break; + case CMD_HELP_SEARCH: DIALOG_HelpSearch(); break; + case CMD_HELP_ON_HELP: DIALOG_HelpHelp(); break; case CMD_ABOUT: DialogBox(GetModuleHandle(NULL), @@ -97,7 +97,7 @@ static int NOTEPAD_MenuCommand(WPARAM wParam) AboutDialogProc); break; - case CMD_ABOUT_WINE: DIALOG_HelpAboutWine(); break; + case CMD_HELP_ABOUT_NOTEPAD: DIALOG_HelpAboutNotepad(); break; default: break; @@ -217,9 +217,9 @@ BOOL NOTEPAD_FindNext(FINDREPLACE *pFindReplace, BOOL bReplace, BOOL bShowAlert) /* Can't find target */ if (bShowAlert) { - LoadString(Globals.hInstance, STRING_CANNOTFIND, szResource, SIZEOF(szResource)); - _sntprintf(szText, SIZEOF(szText), szResource, pFindReplace->lpstrFindWhat); - LoadString(Globals.hInstance, STRING_NOTEPAD, szResource, SIZEOF(szResource)); + LoadString(Globals.hInstance, STRING_CANNOTFIND, szResource, ARRAY_SIZE(szResource)); + _sntprintf(szText, ARRAY_SIZE(szText), szResource, pFindReplace->lpstrFindWhat); + LoadString(Globals.hInstance, STRING_NOTEPAD, szResource, ARRAY_SIZE(szResource)); MessageBox(Globals.hFindReplaceDlg, szText, szResource, MB_OK); } bSuccess = FALSE; @@ -268,13 +268,16 @@ static VOID NOTEPAD_InitData(VOID) p += LoadString(Globals.hInstance, STRING_TEXT_FILES_TXT, p, MAX_STRING_LEN) + 1; _tcscpy(p, txt_files); - p += SIZEOF(txt_files); + p += ARRAY_SIZE(txt_files); p += LoadString(Globals.hInstance, STRING_ALL_FILES, p, MAX_STRING_LEN) + 1; _tcscpy(p, all_files); - p += SIZEOF(all_files); + p += ARRAY_SIZE(all_files); *p = '\0'; Globals.find.lpstrFindWhat = NULL; + + Globals.hDevMode = NULL; + Globals.hDevNames = NULL; } /*********************************************************************** @@ -288,7 +291,7 @@ static VOID NOTEPAD_InitMenuPopup(HMENU menu, LPARAM index) CheckMenuItem(GetMenu(Globals.hMainWnd), CMD_WRAP, MF_BYCOMMAND | (Globals.bWrapLongLines ? MF_CHECKED : MF_UNCHECKED)); - if ( !Globals.bWrapLongLines ) + if (!Globals.bWrapLongLines) { CheckMenuItem(GetMenu(Globals.hMainWnd), CMD_STATUSBAR, MF_BYCOMMAND | (Globals.bShowStatusBar ? MF_CHECKED : MF_UNCHECKED)); @@ -381,7 +384,7 @@ NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_DESTROY: SetWindowLongPtr(Globals.hEdit, GWLP_WNDPROC, (LONG_PTR)Globals.EditProc); - SaveSettings(); + NOTEPAD_SaveSettingsToRegistry(); PostQuitMessage(0); break; @@ -450,7 +453,7 @@ NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) TCHAR szFileName[MAX_PATH]; HDROP hDrop = (HDROP) wParam; - DragQueryFile(hDrop, 0, szFileName, SIZEOF(szFileName)); + DragQueryFile(hDrop, 0, szFileName, ARRAY_SIZE(szFileName)); DragFinish(hDrop); DoOpenFile(szFileName); break; @@ -483,21 +486,9 @@ NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) static int AlertFileDoesNotExist(LPCTSTR szFileName) { - int nResult; - TCHAR szMessage[MAX_STRING_LEN]; - TCHAR szResource[MAX_STRING_LEN]; - - LoadString(Globals.hInstance, STRING_DOESNOTEXIST, szResource, SIZEOF(szResource)); - wsprintf(szMessage, szResource, szFileName); - - LoadString(Globals.hInstance, STRING_NOTEPAD, szResource, SIZEOF(szResource)); - - nResult = MessageBox(Globals.hMainWnd, - szMessage, - szResource, - MB_ICONEXCLAMATION | MB_YESNO); - - return(nResult); + return DIALOG_StringMsgBox(Globals.hMainWnd, STRING_DOESNOTEXIST, + szFileName, + MB_ICONEXCLAMATION | MB_YESNO); } static BOOL HandleCommandLine(LPTSTR cmdline) @@ -617,7 +608,7 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE prev, LPTSTR cmdline, int sh ZeroMemory(&Globals, sizeof(Globals)); Globals.hInstance = hInstance; - LoadSettings(); + NOTEPAD_LoadSettingsFromRegistry(); ZeroMemory(&wndclass, sizeof(wndclass)); wndclass.cbSize = sizeof(wndclass); diff --git a/reactos/base/applications/notepad/main.h b/reactos/base/applications/notepad/main.h index 8f9abd6ec4a..d76a34dc18e 100644 --- a/reactos/base/applications/notepad/main.h +++ b/reactos/base/applications/notepad/main.h @@ -21,7 +21,7 @@ #pragma once -#define SIZEOF(a) (sizeof(a)/sizeof((a)[0])) +#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) #include "notepad_res.h" @@ -33,10 +33,22 @@ #define MAX_STRING_LEN 255 -#define ENCODING_ANSI 0 +/* Values are indexes of the items in the Encoding combobox. */ +typedef enum +{ + ENCODING_AUTO = -1, + ENCODING_ANSI = 0, + ENCODING_UTF16LE = 1, + ENCODING_UTF16BE = 2, + ENCODING_UTF8 = 3 +} ENCODING; +// #define ENCODING_ANSI 0 #define ENCODING_UNICODE 1 #define ENCODING_UNICODE_BE 2 -#define ENCODING_UTF8 3 +// #define ENCODING_UTF8 3 + +// #define MIN_ENCODING 0 +// #define MAX_ENCODING 3 #define EOLN_CRLF 0 #define EOLN_LF 1 @@ -68,7 +80,8 @@ typedef struct TCHAR szHeader[MAX_PATH]; TCHAR szFooter[MAX_PATH]; TCHAR szStatusBarLineCol[MAX_PATH]; - int iEncoding; + + ENCODING encFile; int iEoln; FINDREPLACE find; @@ -81,12 +94,12 @@ extern NOTEPAD_GLOBALS Globals; VOID SetFileName(LPCTSTR szFileName); /* from text.c */ -BOOL ReadText(HANDLE hFile, LPWSTR *ppszText, DWORD *pdwTextLen, int *piEncoding, int *piEoln); -BOOL WriteText(HANDLE hFile, LPCWSTR pszText, DWORD dwTextLen, int iEncoding, int iEoln); +BOOL ReadText(HANDLE hFile, LPWSTR *ppszText, DWORD *pdwTextLen, int *pencFile, int *piEoln); +BOOL WriteText(HANDLE hFile, LPCWSTR pszText, DWORD dwTextLen, int encFile, int iEoln); /* from settings.c */ -void LoadSettings(void); -void SaveSettings(void); +void NOTEPAD_LoadSettingsFromRegistry(void); +void NOTEPAD_SaveSettingsToRegistry(void); /* from main.c */ BOOL NOTEPAD_FindNext(FINDREPLACE *, BOOL , BOOL ); diff --git a/reactos/base/applications/notepad/notepad_res.h b/reactos/base/applications/notepad/notepad_res.h index 27a6f4b7477..e166eab36e8 100644 --- a/reactos/base/applications/notepad/notepad_res.h +++ b/reactos/base/applications/notepad/notepad_res.h @@ -65,7 +65,7 @@ #define CMD_HELP_SEARCH 0x131 #define CMD_HELP_ON_HELP 0x132 #define CMD_ABOUT 0x135 -#define CMD_ABOUT_WINE 0x137 +#define CMD_HELP_ABOUT_NOTEPAD 0x137 /* Strings */ #define STRING_PAGESETUP_HEADERVALUE 0x160 diff --git a/reactos/base/applications/notepad/settings.c b/reactos/base/applications/notepad/settings.c index 0cb8c07fc90..5391440bade 100644 --- a/reactos/base/applications/notepad/settings.c +++ b/reactos/base/applications/notepad/settings.c @@ -105,7 +105,13 @@ static BOOL QueryString(HKEY hKey, LPCTSTR pszValueName, LPTSTR pszResult, DWORD return QueryGeneric(hKey, pszValueName, REG_SZ, pszResult, dwResultSize * sizeof(TCHAR)); } -void LoadSettings(void) +/*********************************************************************** + * + * NOTEPAD_LoadSettingsFromRegistry + * + * Load settings from registry HKCU\Software\Microsoft\Notepad. + */ +void NOTEPAD_LoadSettingsFromRegistry(void) { HKEY hKey = NULL; HFONT hFont; @@ -124,7 +130,7 @@ void LoadSettings(void) QueryByte(hKey, _T("lfCharSet"), &Globals.lfFont.lfCharSet); QueryByte(hKey, _T("lfClipPrecision"), &Globals.lfFont.lfClipPrecision); QueryDword(hKey, _T("lfEscapement"), (DWORD*)&Globals.lfFont.lfEscapement); - QueryString(hKey, _T("lfFaceName"), Globals.lfFont.lfFaceName, sizeof(Globals.lfFont.lfFaceName) / sizeof(Globals.lfFont.lfFaceName[0])); + QueryString(hKey, _T("lfFaceName"), Globals.lfFont.lfFaceName, ARRAY_SIZE(Globals.lfFont.lfFaceName)); QueryByte(hKey, _T("lfItalic"), &Globals.lfFont.lfItalic); QueryDword(hKey, _T("lfOrientation"), (DWORD*)&Globals.lfFont.lfOrientation); QueryByte(hKey, _T("lfOutPrecision"), &Globals.lfFont.lfOutPrecision); @@ -136,8 +142,8 @@ void LoadSettings(void) QueryDword(hKey, _T("iPointSize"), &dwPointSize); QueryBool(hKey, _T("fWrap"), &Globals.bWrapLongLines); QueryBool(hKey, _T("fStatusBar"), &Globals.bShowStatusBar); - QueryString(hKey, _T("szHeader"), Globals.szHeader, sizeof(Globals.szHeader) / sizeof(Globals.szHeader[0])); - QueryString(hKey, _T("szTrailer"), Globals.szFooter, sizeof(Globals.szFooter) / sizeof(Globals.szFooter[0])); + QueryString(hKey, _T("szHeader"), Globals.szHeader, ARRAY_SIZE(Globals.szHeader)); + QueryString(hKey, _T("szTrailer"), Globals.szFooter, ARRAY_SIZE(Globals.szFooter)); QueryDword(hKey, _T("iMarginLeft"), (DWORD*)&Globals.lMarginLeft); QueryDword(hKey, _T("iMarginTop"), (DWORD*)&Globals.lMarginTop); QueryDword(hKey, _T("iMarginRight"), (DWORD*)&Globals.lMarginRight); @@ -179,15 +185,22 @@ static BOOL SaveString(HKEY hKey, LPCTSTR pszValueNameT, LPCTSTR pszValue) return RegSetValueEx(hKey, pszValueNameT, 0, REG_SZ, (LPBYTE) pszValue, (DWORD) _tcslen(pszValue) * sizeof(*pszValue)) == ERROR_SUCCESS; } -void SaveSettings(void) +/*********************************************************************** + * + * NOTEPAD_SaveSettingsToRegistry + * + * Save settings to registry HKCU\Software\Microsoft\Notepad. + */ +void NOTEPAD_SaveSettingsToRegistry(void) { HKEY hKey; DWORD dwDisposition; GetWindowRect(Globals.hMainWnd, &Globals.main_rect); - if (RegCreateKeyEx(HKEY_CURRENT_USER, s_szRegistryKey, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hKey, &dwDisposition) - == ERROR_SUCCESS) + if (RegCreateKeyEx(HKEY_CURRENT_USER, s_szRegistryKey, + 0, NULL, 0, KEY_ALL_ACCESS, NULL, + &hKey, &dwDisposition) == ERROR_SUCCESS) { SaveDword(hKey, _T("lfCharSet"), Globals.lfFont.lfCharSet); SaveDword(hKey, _T("lfClipPrecision"), Globals.lfFont.lfClipPrecision); @@ -214,6 +227,7 @@ void SaveSettings(void) SaveDword(hKey, _T("iWindowPosY"), Globals.main_rect.top); SaveDword(hKey, _T("iWindowPosDX"), Globals.main_rect.right - Globals.main_rect.left); SaveDword(hKey, _T("iWindowPosDY"), Globals.main_rect.bottom - Globals.main_rect.top); + RegCloseKey(hKey); } } diff --git a/reactos/base/applications/notepad/text.c b/reactos/base/applications/notepad/text.c index 716b3729225..be7a76446a6 100644 --- a/reactos/base/applications/notepad/text.c +++ b/reactos/base/applications/notepad/text.c @@ -48,7 +48,7 @@ static BOOL Append(LPWSTR *ppszText, DWORD *pdwTextLen, LPCWSTR pszAppendText, D } BOOL -ReadText(HANDLE hFile, LPWSTR *ppszText, DWORD *pdwTextLen, int *piEncoding, int *piEoln) +ReadText(HANDLE hFile, LPWSTR *ppszText, DWORD *pdwTextLen, int *pencFile, int *piEoln) { DWORD dwSize; LPBYTE pBytes = NULL; @@ -58,7 +58,7 @@ ReadText(HANDLE hFile, LPWSTR *ppszText, DWORD *pdwTextLen, int *piEncoding, int DWORD dwCharCount; BOOL bSuccess = FALSE; BYTE b = 0; - int iEncoding = ENCODING_ANSI; + int encFile = ENCODING_ANSI; int iCodePage = 0; WCHAR szCrlf[2] = {'\r', '\n'}; DWORD adwEolnCount[3] = {0, 0, 0}; @@ -85,21 +85,21 @@ ReadText(HANDLE hFile, LPWSTR *ppszText, DWORD *pdwTextLen, int *piEncoding, int /* Look for Byte Order Marks */ if ((dwSize >= 2) && (pBytes[0] == 0xFF) && (pBytes[1] == 0xFE)) { - iEncoding = ENCODING_UNICODE; + encFile = ENCODING_UNICODE; dwPos += 2; } else if ((dwSize >= 2) && (pBytes[0] == 0xFE) && (pBytes[1] == 0xFF)) { - iEncoding = ENCODING_UNICODE_BE; + encFile = ENCODING_UNICODE_BE; dwPos += 2; } else if ((dwSize >= 3) && (pBytes[0] == 0xEF) && (pBytes[1] == 0xBB) && (pBytes[2] == 0xBF)) { - iEncoding = ENCODING_UTF8; + encFile = ENCODING_UTF8; dwPos += 3; } - switch(iEncoding) + switch(encFile) { case ENCODING_UNICODE_BE: for (i = dwPos; i < dwSize-1; i += 2) @@ -117,9 +117,9 @@ ReadText(HANDLE hFile, LPWSTR *ppszText, DWORD *pdwTextLen, int *piEncoding, int case ENCODING_ANSI: case ENCODING_UTF8: - if (iEncoding == ENCODING_ANSI) + if (encFile == ENCODING_ANSI) iCodePage = CP_ACP; - else if (iEncoding == ENCODING_UTF8) + else if (encFile == ENCODING_UTF8) iCodePage = CP_UTF8; if ((dwSize - dwPos) > 0) @@ -166,7 +166,7 @@ ReadText(HANDLE hFile, LPWSTR *ppszText, DWORD *pdwTextLen, int *piEncoding, int case '\n': if (!Append(ppszText, pdwTextLen, &pszText[dwPos], i - dwPos)) return FALSE; - if (!Append(ppszText, pdwTextLen, szCrlf, sizeof(szCrlf) / sizeof(szCrlf[0]))) + if (!Append(ppszText, pdwTextLen, szCrlf, ARRAY_SIZE(szCrlf))) return FALSE; dwPos = i + 1; @@ -202,7 +202,7 @@ ReadText(HANDLE hFile, LPWSTR *ppszText, DWORD *pdwTextLen, int *piEncoding, int *piEoln = EOLN_LF; if (adwEolnCount[EOLN_CR] > adwEolnCount[*piEoln]) *piEoln = EOLN_CR; - *piEncoding = iEncoding; + *pencFile = encFile; bSuccess = TRUE; @@ -221,7 +221,7 @@ done: return bSuccess; } -static BOOL WriteEncodedText(HANDLE hFile, LPCWSTR pszText, DWORD dwTextLen, int iEncoding) +static BOOL WriteEncodedText(HANDLE hFile, LPCWSTR pszText, DWORD dwTextLen, int encFile) { LPBYTE pBytes = NULL; LPBYTE pAllocBuffer = NULL; @@ -236,7 +236,7 @@ static BOOL WriteEncodedText(HANDLE hFile, LPCWSTR pszText, DWORD dwTextLen, int while(dwPos < dwTextLen) { - switch(iEncoding) + switch(encFile) { case ENCODING_UNICODE: pBytes = (LPBYTE) &pszText[dwPos]; @@ -262,9 +262,9 @@ static BOOL WriteEncodedText(HANDLE hFile, LPCWSTR pszText, DWORD dwTextLen, int case ENCODING_ANSI: case ENCODING_UTF8: - if (iEncoding == ENCODING_ANSI) + if (encFile == ENCODING_ANSI) iCodePage = CP_ACP; - else if (iEncoding == ENCODING_UTF8) + else if (encFile == ENCODING_UTF8) iCodePage = CP_UTF8; iRequiredBytes = WideCharToMultiByte(iCodePage, 0, &pszText[dwPos], dwTextLen - dwPos, NULL, 0, NULL, NULL); @@ -315,17 +315,17 @@ done: return bSuccess; } -BOOL WriteText(HANDLE hFile, LPCWSTR pszText, DWORD dwTextLen, int iEncoding, int iEoln) +BOOL WriteText(HANDLE hFile, LPCWSTR pszText, DWORD dwTextLen, int encFile, int iEoln) { WCHAR wcBom; LPCWSTR pszLF = L"\n"; DWORD dwPos, dwNext; /* Write the proper byte order marks if not ANSI */ - if (iEncoding != ENCODING_ANSI) + if (encFile != ENCODING_ANSI) { wcBom = 0xFEFF; - if (!WriteEncodedText(hFile, &wcBom, 1, iEncoding)) + if (!WriteEncodedText(hFile, &wcBom, 1, encFile)) return FALSE; } @@ -350,20 +350,20 @@ BOOL WriteText(HANDLE hFile, LPCWSTR pszText, DWORD dwTextLen, int iEncoding, in { case EOLN_LF: /* Write text (without eoln) */ - if (!WriteEncodedText(hFile, &pszText[dwPos], dwNext - dwPos, iEncoding)) + if (!WriteEncodedText(hFile, &pszText[dwPos], dwNext - dwPos, encFile)) return FALSE; /* Write eoln */ - if (!WriteEncodedText(hFile, pszLF, 1, iEncoding)) + if (!WriteEncodedText(hFile, pszLF, 1, encFile)) return FALSE; break; case EOLN_CR: /* Write text (including \r as eoln) */ - if (!WriteEncodedText(hFile, &pszText[dwPos], dwNext - dwPos + 1, iEncoding)) + if (!WriteEncodedText(hFile, &pszText[dwPos], dwNext - dwPos + 1, encFile)) return FALSE; break; case EOLN_CRLF: /* Write text (including \r\n as eoln) */ - if (!WriteEncodedText(hFile, &pszText[dwPos], dwNext - dwPos + 2, iEncoding)) + if (!WriteEncodedText(hFile, &pszText[dwPos], dwNext - dwPos + 2, encFile)) return FALSE; break; default: @@ -373,7 +373,7 @@ BOOL WriteText(HANDLE hFile, LPCWSTR pszText, DWORD dwTextLen, int iEncoding, in else { /* Write text (without eoln, since this is the end of the file) */ - if (!WriteEncodedText(hFile, &pszText[dwPos], dwNext - dwPos, iEncoding)) + if (!WriteEncodedText(hFile, &pszText[dwPos], dwNext - dwPos, encFile)) return FALSE; }