mirror of
git://source.winehq.org/git/wine.git
synced 2024-08-31 13:04:24 +00:00
notepad: Use the explicit W-form of the types.
This commit is contained in:
parent
4bc8e87ab6
commit
3e7647ad72
|
@ -50,8 +50,7 @@ VOID ShowLastError(void)
|
||||||
LoadString(Globals.hInstance, STRING_ERROR, szTitle, SIZEOF(szTitle));
|
LoadString(Globals.hInstance, STRING_ERROR, szTitle, SIZEOF(szTitle));
|
||||||
FormatMessage(
|
FormatMessage(
|
||||||
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||||
NULL, error, 0,
|
NULL, error, 0, (LPWSTR)&lpMsgBuf, 0, NULL);
|
||||||
(LPTSTR) &lpMsgBuf, 0, NULL);
|
|
||||||
MessageBox(NULL, lpMsgBuf, szTitle, MB_OK | MB_ICONERROR);
|
MessageBox(NULL, lpMsgBuf, szTitle, MB_OK | MB_ICONERROR);
|
||||||
LocalFree(lpMsgBuf);
|
LocalFree(lpMsgBuf);
|
||||||
}
|
}
|
||||||
|
@ -122,7 +121,7 @@ static int AlertFileNotSaved(LPCWSTR szFileName)
|
||||||
*/
|
*/
|
||||||
BOOL FileExists(LPCWSTR szFilename)
|
BOOL FileExists(LPCWSTR szFilename)
|
||||||
{
|
{
|
||||||
WIN32_FIND_DATA entry;
|
WIN32_FIND_DATAW entry;
|
||||||
HANDLE hFile;
|
HANDLE hFile;
|
||||||
|
|
||||||
hFile = FindFirstFile(szFilename, &entry);
|
hFile = FindFirstFile(szFilename, &entry);
|
||||||
|
@ -287,7 +286,7 @@ VOID DIALOG_FileNew(VOID)
|
||||||
|
|
||||||
VOID DIALOG_FileOpen(VOID)
|
VOID DIALOG_FileOpen(VOID)
|
||||||
{
|
{
|
||||||
OPENFILENAME openfilename;
|
OPENFILENAMEW openfilename;
|
||||||
WCHAR szPath[MAX_PATH];
|
WCHAR szPath[MAX_PATH];
|
||||||
WCHAR szDir[MAX_PATH];
|
WCHAR szDir[MAX_PATH];
|
||||||
static const WCHAR szDefaultExt[] = { 't','x','t',0 };
|
static const WCHAR szDefaultExt[] = { 't','x','t',0 };
|
||||||
|
@ -326,7 +325,7 @@ BOOL DIALOG_FileSave(VOID)
|
||||||
|
|
||||||
BOOL DIALOG_FileSaveAs(VOID)
|
BOOL DIALOG_FileSaveAs(VOID)
|
||||||
{
|
{
|
||||||
OPENFILENAME saveas;
|
OPENFILENAMEW saveas;
|
||||||
WCHAR szPath[MAX_PATH];
|
WCHAR szPath[MAX_PATH];
|
||||||
WCHAR szDir[MAX_PATH];
|
WCHAR szDir[MAX_PATH];
|
||||||
static const WCHAR szDefaultExt[] = { 't','x','t',0 };
|
static const WCHAR szDefaultExt[] = { 't','x','t',0 };
|
||||||
|
@ -337,7 +336,7 @@ BOOL DIALOG_FileSaveAs(VOID)
|
||||||
GetCurrentDirectory(SIZEOF(szDir), szDir);
|
GetCurrentDirectory(SIZEOF(szDir), szDir);
|
||||||
lstrcpy(szPath, txt_files);
|
lstrcpy(szPath, txt_files);
|
||||||
|
|
||||||
saveas.lStructSize = sizeof(OPENFILENAME);
|
saveas.lStructSize = sizeof(OPENFILENAMEW);
|
||||||
saveas.hwndOwner = Globals.hMainWnd;
|
saveas.hwndOwner = Globals.hMainWnd;
|
||||||
saveas.hInstance = Globals.hInstance;
|
saveas.hInstance = Globals.hInstance;
|
||||||
saveas.lpstrFilter = Globals.szFilter;
|
saveas.lpstrFilter = Globals.szFilter;
|
||||||
|
@ -384,7 +383,7 @@ static int notepad_print_header(HDC hdc, RECT *rc, BOOL dopage, BOOL header, int
|
||||||
static BOOL notepad_print_page(HDC hdc, RECT *rc, BOOL dopage, int page, LPTEXTINFO tInfo)
|
static BOOL notepad_print_page(HDC hdc, RECT *rc, BOOL dopage, int page, LPTEXTINFO tInfo)
|
||||||
{
|
{
|
||||||
int b, y;
|
int b, y;
|
||||||
TEXTMETRIC tm;
|
TEXTMETRICW tm;
|
||||||
SIZE szMetrics;
|
SIZE szMetrics;
|
||||||
|
|
||||||
if (dopage)
|
if (dopage)
|
||||||
|
@ -478,10 +477,10 @@ static BOOL notepad_print_page(HDC hdc, RECT *rc, BOOL dopage, int page, LPTEXTI
|
||||||
|
|
||||||
VOID DIALOG_FilePrint(VOID)
|
VOID DIALOG_FilePrint(VOID)
|
||||||
{
|
{
|
||||||
DOCINFO di;
|
DOCINFOW di;
|
||||||
PRINTDLG printer;
|
PRINTDLGW printer;
|
||||||
int page, dopage, copy;
|
int page, dopage, copy;
|
||||||
LOGFONT lfFont;
|
LOGFONTW lfFont;
|
||||||
HFONT hTextFont, old_font = 0;
|
HFONT hTextFont, old_font = 0;
|
||||||
DWORD size;
|
DWORD size;
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
|
@ -516,7 +515,7 @@ VOID DIALOG_FilePrint(VOID)
|
||||||
SetMapMode(printer.hDC, MM_TEXT);
|
SetMapMode(printer.hDC, MM_TEXT);
|
||||||
|
|
||||||
/* initialize DOCINFO */
|
/* initialize DOCINFO */
|
||||||
di.cbSize = sizeof(DOCINFO);
|
di.cbSize = sizeof(DOCINFOW);
|
||||||
di.lpszDocName = Globals.szFileTitle;
|
di.lpszDocName = Globals.szFileTitle;
|
||||||
di.lpszOutput = NULL;
|
di.lpszOutput = NULL;
|
||||||
di.lpszDatatype = NULL;
|
di.lpszDatatype = NULL;
|
||||||
|
@ -594,7 +593,7 @@ VOID DIALOG_FilePrint(VOID)
|
||||||
|
|
||||||
VOID DIALOG_FilePrinterSetup(VOID)
|
VOID DIALOG_FilePrinterSetup(VOID)
|
||||||
{
|
{
|
||||||
PRINTDLG printer;
|
PRINTDLGW printer;
|
||||||
|
|
||||||
ZeroMemory(&printer, sizeof(printer));
|
ZeroMemory(&printer, sizeof(printer));
|
||||||
printer.lStructSize = sizeof(printer);
|
printer.lStructSize = sizeof(printer);
|
||||||
|
@ -701,8 +700,8 @@ VOID DIALOG_EditWrap(VOID)
|
||||||
|
|
||||||
VOID DIALOG_SelectFont(VOID)
|
VOID DIALOG_SelectFont(VOID)
|
||||||
{
|
{
|
||||||
CHOOSEFONT cf;
|
CHOOSEFONTW cf;
|
||||||
LOGFONT lf=Globals.lfFont;
|
LOGFONTW lf=Globals.lfFont;
|
||||||
|
|
||||||
ZeroMemory( &cf, sizeof(cf) );
|
ZeroMemory( &cf, sizeof(cf) );
|
||||||
cf.lStructSize=sizeof(cf);
|
cf.lStructSize=sizeof(cf);
|
||||||
|
|
|
@ -356,7 +356,7 @@ static VOID NOTEPAD_InitMenuPopup(HMENU menu, int index)
|
||||||
GetWindowTextLength(Globals.hEdit) ? MF_ENABLED : MF_GRAYED);
|
GetWindowTextLength(Globals.hEdit) ? MF_ENABLED : MF_GRAYED);
|
||||||
}
|
}
|
||||||
|
|
||||||
static LPTSTR NOTEPAD_StrRStr(LPTSTR pszSource, LPTSTR pszLast, LPTSTR pszSrch)
|
static LPWSTR NOTEPAD_StrRStr(LPWSTR pszSource, LPWSTR pszLast, LPWSTR pszSrch)
|
||||||
{
|
{
|
||||||
int len = lstrlen(pszSrch);
|
int len = lstrlen(pszSrch);
|
||||||
pszLast--;
|
pszLast--;
|
||||||
|
@ -372,16 +372,16 @@ static LPTSTR NOTEPAD_StrRStr(LPTSTR pszSource, LPTSTR pszLast, LPTSTR pszSrch)
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* The user activated the Find dialog
|
* The user activated the Find dialog
|
||||||
*/
|
*/
|
||||||
void NOTEPAD_DoFind(FINDREPLACE *fr)
|
void NOTEPAD_DoFind(FINDREPLACEW *fr)
|
||||||
{
|
{
|
||||||
LPTSTR content;
|
LPWSTR content;
|
||||||
LPTSTR found;
|
LPWSTR found;
|
||||||
int len = lstrlen(fr->lpstrFindWhat);
|
int len = lstrlen(fr->lpstrFindWhat);
|
||||||
int fileLen;
|
int fileLen;
|
||||||
DWORD pos;
|
DWORD pos;
|
||||||
|
|
||||||
fileLen = GetWindowTextLength(Globals.hEdit) + 1;
|
fileLen = GetWindowTextLength(Globals.hEdit) + 1;
|
||||||
content = HeapAlloc(GetProcessHeap(), 0, fileLen * sizeof(TCHAR));
|
content = HeapAlloc(GetProcessHeap(), 0, fileLen * sizeof(WCHAR));
|
||||||
if (!content) return;
|
if (!content) return;
|
||||||
GetWindowText(Globals.hEdit, content, fileLen);
|
GetWindowText(Globals.hEdit, content, fileLen);
|
||||||
|
|
||||||
|
@ -415,16 +415,16 @@ void NOTEPAD_DoFind(FINDREPLACE *fr)
|
||||||
SendMessageW(Globals.hEdit, EM_SETSEL, found - content, found - content + len);
|
SendMessageW(Globals.hEdit, EM_SETSEL, found - content, found - content + len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void NOTEPAD_DoReplace(FINDREPLACE *fr)
|
static void NOTEPAD_DoReplace(FINDREPLACEW *fr)
|
||||||
{
|
{
|
||||||
LPTSTR content;
|
LPWSTR content;
|
||||||
int len = lstrlen(fr->lpstrFindWhat);
|
int len = lstrlen(fr->lpstrFindWhat);
|
||||||
int fileLen;
|
int fileLen;
|
||||||
DWORD pos;
|
DWORD pos;
|
||||||
DWORD pos_start;
|
DWORD pos_start;
|
||||||
|
|
||||||
fileLen = GetWindowTextLength(Globals.hEdit) + 1;
|
fileLen = GetWindowTextLength(Globals.hEdit) + 1;
|
||||||
content = HeapAlloc(GetProcessHeap(), 0, fileLen * sizeof(TCHAR));
|
content = HeapAlloc(GetProcessHeap(), 0, fileLen * sizeof(WCHAR));
|
||||||
if (!content) return;
|
if (!content) return;
|
||||||
GetWindowText(Globals.hEdit, content, fileLen);
|
GetWindowText(Globals.hEdit, content, fileLen);
|
||||||
|
|
||||||
|
@ -447,10 +447,10 @@ static void NOTEPAD_DoReplace(FINDREPLACE *fr)
|
||||||
NOTEPAD_DoFind(fr);
|
NOTEPAD_DoFind(fr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void NOTEPAD_DoReplaceAll(FINDREPLACE *fr)
|
static void NOTEPAD_DoReplaceAll(FINDREPLACEW *fr)
|
||||||
{
|
{
|
||||||
LPTSTR content;
|
LPWSTR content;
|
||||||
LPTSTR found;
|
LPWSTR found;
|
||||||
int len = lstrlen(fr->lpstrFindWhat);
|
int len = lstrlen(fr->lpstrFindWhat);
|
||||||
int fileLen;
|
int fileLen;
|
||||||
DWORD pos;
|
DWORD pos;
|
||||||
|
@ -458,7 +458,7 @@ static void NOTEPAD_DoReplaceAll(FINDREPLACE *fr)
|
||||||
SendMessageW(Globals.hEdit, EM_SETSEL, 0, 0);
|
SendMessageW(Globals.hEdit, EM_SETSEL, 0, 0);
|
||||||
while(TRUE){
|
while(TRUE){
|
||||||
fileLen = GetWindowTextLength(Globals.hEdit) + 1;
|
fileLen = GetWindowTextLength(Globals.hEdit) + 1;
|
||||||
content = HeapAlloc(GetProcessHeap(), 0, fileLen * sizeof(TCHAR));
|
content = HeapAlloc(GetProcessHeap(), 0, fileLen * sizeof(WCHAR));
|
||||||
if (!content) return;
|
if (!content) return;
|
||||||
GetWindowText(Globals.hEdit, content, fileLen);
|
GetWindowText(Globals.hEdit, content, fileLen);
|
||||||
|
|
||||||
|
@ -495,7 +495,7 @@ static LRESULT WINAPI NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam,
|
||||||
{
|
{
|
||||||
if (msg == aFINDMSGSTRING) /* not a constant so can't be used in switch */
|
if (msg == aFINDMSGSTRING) /* not a constant so can't be used in switch */
|
||||||
{
|
{
|
||||||
FINDREPLACE *fr = (FINDREPLACE *)lParam;
|
FINDREPLACEW *fr = (FINDREPLACEW *)lParam;
|
||||||
|
|
||||||
if (fr->Flags & FR_DIALOGTERM)
|
if (fr->Flags & FR_DIALOGTERM)
|
||||||
Globals.hFindReplaceDlg = NULL;
|
Globals.hFindReplaceDlg = NULL;
|
||||||
|
@ -719,7 +719,7 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
|
||||||
{
|
{
|
||||||
MSG msg;
|
MSG msg;
|
||||||
HACCEL hAccel;
|
HACCEL hAccel;
|
||||||
WNDCLASSEX class;
|
WNDCLASSEXW class;
|
||||||
HMONITOR monitor;
|
HMONITOR monitor;
|
||||||
MONITORINFO info;
|
MONITORINFO info;
|
||||||
INT x, y;
|
INT x, y;
|
||||||
|
|
|
@ -32,7 +32,7 @@ typedef struct
|
||||||
HWND hFindReplaceDlg;
|
HWND hFindReplaceDlg;
|
||||||
HWND hEdit;
|
HWND hEdit;
|
||||||
HFONT hFont; /* Font used by the edit control */
|
HFONT hFont; /* Font used by the edit control */
|
||||||
LOGFONT lfFont;
|
LOGFONTW lfFont;
|
||||||
BOOL bWrapLongLines;
|
BOOL bWrapLongLines;
|
||||||
WCHAR szFindText[MAX_PATH];
|
WCHAR szFindText[MAX_PATH];
|
||||||
WCHAR szReplaceText[MAX_PATH];
|
WCHAR szReplaceText[MAX_PATH];
|
||||||
|
@ -46,8 +46,8 @@ typedef struct
|
||||||
WCHAR szHeader[MAX_PATH];
|
WCHAR szHeader[MAX_PATH];
|
||||||
WCHAR szFooter[MAX_PATH];
|
WCHAR szFooter[MAX_PATH];
|
||||||
|
|
||||||
FINDREPLACE find;
|
FINDREPLACEW find;
|
||||||
FINDREPLACE lastFind;
|
FINDREPLACEW lastFind;
|
||||||
HGLOBAL hDevMode; /* printer mode */
|
HGLOBAL hDevMode; /* printer mode */
|
||||||
HGLOBAL hDevNames; /* printer names */
|
HGLOBAL hDevNames; /* printer names */
|
||||||
} NOTEPAD_GLOBALS;
|
} NOTEPAD_GLOBALS;
|
||||||
|
@ -55,5 +55,5 @@ typedef struct
|
||||||
extern NOTEPAD_GLOBALS Globals;
|
extern NOTEPAD_GLOBALS Globals;
|
||||||
|
|
||||||
VOID SetFileName(LPCWSTR szFileName);
|
VOID SetFileName(LPCWSTR szFileName);
|
||||||
void NOTEPAD_DoFind(FINDREPLACE *fr);
|
void NOTEPAD_DoFind(FINDREPLACEW *fr);
|
||||||
DWORD get_dpi(void);
|
DWORD get_dpi(void);
|
||||||
|
|
Loading…
Reference in a new issue