Use Windows memory functions.
[wine/testsucceed.git] / programs / notepad / dialog.c
blob9c352d44b17f97f372d393f846913c67b80efacd
1 /*
2 * Notepad (dialog.c)
4 * Copyright 1998,99 Marcel Baur <mbaur@g26.ethz.ch>
5 * Copyright 2002 Sylvain Petreolle <spetreolle@yahoo.fr>
6 * Copyright 2002 Andriy Palamarchuk
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #define UNICODE
25 #include <assert.h>
26 #include <stdio.h>
27 #include <windows.h>
28 #include <commdlg.h>
30 #include "main.h"
31 #include "license.h"
32 #include "dialog.h"
34 static const WCHAR helpfileW[] = { 'n','o','t','e','p','a','d','.','h','l','p',0 };
36 static INT_PTR WINAPI DIALOG_PAGESETUP_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
38 VOID ShowLastError(void)
40 DWORD error = GetLastError();
41 if (error != NO_ERROR)
43 LPWSTR lpMsgBuf;
44 WCHAR szTitle[MAX_STRING_LEN];
46 LoadString(Globals.hInstance, STRING_ERROR, szTitle, SIZEOF(szTitle));
47 FormatMessage(
48 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
49 NULL, error, 0,
50 (LPTSTR) &lpMsgBuf, 0, NULL);
51 MessageBox(NULL, lpMsgBuf, szTitle, MB_OK | MB_ICONERROR);
52 LocalFree(lpMsgBuf);
56 /**
57 * Sets the caption of the main window according to Globals.szFileTitle:
58 * Notepad - (untitled) if no file is open
59 * Notepad - [filename] if a file is given
61 static void UpdateWindowCaption(void)
63 WCHAR szCaption[MAX_STRING_LEN];
64 WCHAR szUntitled[MAX_STRING_LEN];
66 LoadString(Globals.hInstance, STRING_NOTEPAD, szCaption, SIZEOF(szCaption));
68 if (Globals.szFileTitle[0] != '\0') {
69 static const WCHAR bracket_lW[] = { ' ','-',' ','[',0 };
70 static const WCHAR bracket_rW[] = { ']',0 };
71 lstrcat(szCaption, bracket_lW);
72 lstrcat(szCaption, Globals.szFileTitle);
73 lstrcat(szCaption, bracket_rW);
75 else
77 static const WCHAR hyphenW[] = { ' ','-',' ',0 };
78 LoadString(Globals.hInstance, STRING_UNTITLED, szUntitled, SIZEOF(szUntitled));
79 lstrcat(szCaption, hyphenW);
80 lstrcat(szCaption, szUntitled);
83 SetWindowText(Globals.hMainWnd, szCaption);
86 static void AlertFileNotFound(LPCWSTR szFileName)
88 WCHAR szMessage[MAX_STRING_LEN];
89 WCHAR szResource[MAX_STRING_LEN];
91 /* Load and format szMessage */
92 LoadString(Globals.hInstance, STRING_NOTFOUND, szResource, SIZEOF(szResource));
93 wsprintf(szMessage, szResource, szFileName);
95 /* Load szCaption */
96 LoadString(Globals.hInstance, STRING_ERROR, szResource, SIZEOF(szResource));
98 /* Display Modal Dialog */
99 MessageBox(Globals.hMainWnd, szMessage, szResource, MB_ICONEXCLAMATION);
102 static int AlertFileNotSaved(LPCWSTR szFileName)
104 WCHAR szMessage[MAX_STRING_LEN];
105 WCHAR szResource[MAX_STRING_LEN];
106 WCHAR szUntitled[MAX_STRING_LEN];
108 LoadString(Globals.hInstance, STRING_UNTITLED, szUntitled, SIZEOF(szUntitled));
110 /* Load and format Message */
111 LoadString(Globals.hInstance, STRING_NOTSAVED, szResource, SIZEOF(szResource));
112 wsprintf(szMessage, szResource, szFileName[0] ? szFileName : szUntitled);
114 /* Load Caption */
115 LoadString(Globals.hInstance, STRING_ERROR, szResource, SIZEOF(szResource));
117 /* Display modal */
118 return MessageBox(Globals.hMainWnd, szMessage, szResource, MB_ICONEXCLAMATION|MB_YESNOCANCEL);
122 * Returns:
123 * TRUE - if file exists
124 * FALSE - if file does not exist
126 BOOL FileExists(LPCWSTR szFilename)
128 WIN32_FIND_DATA entry;
129 HANDLE hFile;
131 hFile = FindFirstFile(szFilename, &entry);
132 FindClose(hFile);
134 return (hFile != INVALID_HANDLE_VALUE);
138 static VOID DoSaveFile(VOID)
140 HANDLE hFile;
141 DWORD dwNumWrite;
142 LPSTR pTemp;
143 DWORD size;
145 hFile = CreateFile(Globals.szFileName, GENERIC_WRITE, FILE_SHARE_WRITE,
146 NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
147 if(hFile == INVALID_HANDLE_VALUE)
149 ShowLastError();
150 return;
153 size = GetWindowTextLengthA(Globals.hEdit) + 1;
154 pTemp = HeapAlloc(GetProcessHeap(), 0, size);
155 if (!pTemp)
157 CloseHandle(hFile);
158 ShowLastError();
159 return;
161 size = GetWindowTextA(Globals.hEdit, pTemp, size);
163 if (!WriteFile(hFile, pTemp, size, &dwNumWrite, NULL))
164 ShowLastError();
165 else
166 SendMessage(Globals.hEdit, EM_SETMODIFY, FALSE, 0);
168 CloseHandle(hFile);
169 HeapFree(GetProcessHeap(), 0, pTemp);
173 * Returns:
174 * TRUE - User agreed to close (both save/don't save)
175 * FALSE - User cancelled close by selecting "Cancel"
177 BOOL DoCloseFile(void)
179 int nResult;
180 static const WCHAR empty_strW[] = { 0 };
182 if (SendMessage(Globals.hEdit, EM_GETMODIFY, 0, 0))
184 /* prompt user to save changes */
185 nResult = AlertFileNotSaved(Globals.szFileName);
186 switch (nResult) {
187 case IDYES: DIALOG_FileSave();
188 break;
190 case IDNO: break;
192 case IDCANCEL: return(FALSE);
193 break;
195 default: return(FALSE);
196 break;
197 } /* switch */
198 } /* if */
200 SetFileName(empty_strW);
202 UpdateWindowCaption();
203 return(TRUE);
207 void DoOpenFile(LPCWSTR szFileName)
209 HANDLE hFile;
210 LPSTR pTemp;
211 DWORD size;
212 DWORD dwNumRead;
214 /* Close any files and prompt to save changes */
215 if (!DoCloseFile())
216 return;
218 hFile = CreateFile(szFileName, GENERIC_READ, FILE_SHARE_READ, NULL,
219 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
220 if(hFile == INVALID_HANDLE_VALUE)
222 ShowLastError();
223 return;
226 size = GetFileSize(hFile, NULL);
227 if (size == INVALID_FILE_SIZE)
229 CloseHandle(hFile);
230 ShowLastError();
231 return;
233 size++;
235 pTemp = HeapAlloc(GetProcessHeap(), 0, size);
236 if (!pTemp)
238 CloseHandle(hFile);
239 ShowLastError();
240 return;
243 if (!ReadFile(hFile, pTemp, size, &dwNumRead, NULL))
245 CloseHandle(hFile);
246 HeapFree(GetProcessHeap(), 0, pTemp);
247 ShowLastError();
248 return;
251 CloseHandle(hFile);
252 pTemp[dwNumRead] = 0;
254 if (IsTextUnicode(pTemp, dwNumRead, NULL))
256 LPWSTR p = (LPWSTR)pTemp;
257 /* We need to strip BOM Unicode character, SetWindowTextW won't do it for us. */
258 if (*p == 0xFEFF || *p == 0xFFFE) p++;
259 SetWindowTextW(Globals.hEdit, p);
261 else
262 SetWindowTextA(Globals.hEdit, pTemp);
264 HeapFree(GetProcessHeap(), 0, pTemp);
266 SendMessage(Globals.hEdit, EM_SETMODIFY, FALSE, 0);
267 SendMessage(Globals.hEdit, EM_EMPTYUNDOBUFFER, 0, 0);
268 SetFocus(Globals.hEdit);
270 SetFileName(szFileName);
271 UpdateWindowCaption();
274 VOID DIALOG_FileNew(VOID)
276 static const WCHAR empty_strW[] = { 0 };
278 /* Close any files and promt to save changes */
279 if (DoCloseFile()) {
280 SetWindowText(Globals.hEdit, empty_strW);
281 SendMessage(Globals.hEdit, EM_EMPTYUNDOBUFFER, 0, 0);
282 SetFocus(Globals.hEdit);
286 VOID DIALOG_FileOpen(VOID)
288 OPENFILENAME openfilename;
289 WCHAR szPath[MAX_PATH];
290 WCHAR szDir[MAX_PATH];
291 static const WCHAR szDefaultExt[] = { 't','x','t',0 };
292 static const WCHAR txt_files[] = { '*','.','t','x','t',0 };
294 ZeroMemory(&openfilename, sizeof(openfilename));
296 GetCurrentDirectory(SIZEOF(szDir), szDir);
297 lstrcpy(szPath, txt_files);
299 openfilename.lStructSize = sizeof(openfilename);
300 openfilename.hwndOwner = Globals.hMainWnd;
301 openfilename.hInstance = Globals.hInstance;
302 openfilename.lpstrFilter = Globals.szFilter;
303 openfilename.lpstrFile = szPath;
304 openfilename.nMaxFile = SIZEOF(szPath);
305 openfilename.lpstrInitialDir = szDir;
306 openfilename.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST |
307 OFN_HIDEREADONLY;
308 openfilename.lpstrDefExt = szDefaultExt;
311 if (GetOpenFileName(&openfilename)) {
312 if (FileExists(openfilename.lpstrFile))
313 DoOpenFile(openfilename.lpstrFile);
314 else
315 AlertFileNotFound(openfilename.lpstrFile);
320 VOID DIALOG_FileSave(VOID)
322 if (Globals.szFileName[0] == '\0')
323 DIALOG_FileSaveAs();
324 else
325 DoSaveFile();
328 VOID DIALOG_FileSaveAs(VOID)
330 OPENFILENAME saveas;
331 WCHAR szPath[MAX_PATH];
332 WCHAR szDir[MAX_PATH];
333 static const WCHAR szDefaultExt[] = { 't','x','t',0 };
334 static const WCHAR txt_files[] = { '*','.','t','x','t',0 };
336 ZeroMemory(&saveas, sizeof(saveas));
338 GetCurrentDirectory(SIZEOF(szDir), szDir);
339 lstrcpy(szPath, txt_files);
341 saveas.lStructSize = sizeof(OPENFILENAME);
342 saveas.hwndOwner = Globals.hMainWnd;
343 saveas.hInstance = Globals.hInstance;
344 saveas.lpstrFilter = Globals.szFilter;
345 saveas.lpstrFile = szPath;
346 saveas.nMaxFile = SIZEOF(szPath);
347 saveas.lpstrInitialDir = szDir;
348 saveas.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT |
349 OFN_HIDEREADONLY;
350 saveas.lpstrDefExt = szDefaultExt;
352 if (GetSaveFileName(&saveas)) {
353 SetFileName(szPath);
354 UpdateWindowCaption();
355 DoSaveFile();
359 VOID DIALOG_FilePrint(VOID)
361 DOCINFO di;
362 PRINTDLG printer;
363 SIZE szMetric;
364 int cWidthPels, cHeightPels, border;
365 int xLeft, yTop, pagecount, dopage, copycount;
366 unsigned int i;
367 LOGFONT hdrFont;
368 HFONT font, old_font=0;
369 DWORD size;
370 LPWSTR pTemp;
371 static const WCHAR times_new_romanW[] = { 'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n',0 };
373 /* Get a small font and print some header info on each page */
374 hdrFont.lfHeight = 100;
375 hdrFont.lfWidth = 0;
376 hdrFont.lfEscapement = 0;
377 hdrFont.lfOrientation = 0;
378 hdrFont.lfWeight = FW_BOLD;
379 hdrFont.lfItalic = 0;
380 hdrFont.lfUnderline = 0;
381 hdrFont.lfStrikeOut = 0;
382 hdrFont.lfCharSet = ANSI_CHARSET;
383 hdrFont.lfOutPrecision = OUT_DEFAULT_PRECIS;
384 hdrFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
385 hdrFont.lfQuality = PROOF_QUALITY;
386 hdrFont.lfPitchAndFamily = VARIABLE_PITCH | FF_ROMAN;
387 lstrcpy(hdrFont.lfFaceName, times_new_romanW);
389 font = CreateFontIndirect(&hdrFont);
391 /* Get Current Settings */
392 ZeroMemory(&printer, sizeof(printer));
393 printer.lStructSize = sizeof(printer);
394 printer.hwndOwner = Globals.hMainWnd;
395 printer.hInstance = Globals.hInstance;
397 /* Set some default flags */
398 printer.Flags = PD_RETURNDC;
399 printer.nFromPage = 0;
400 printer.nMinPage = 1;
401 /* we really need to calculate number of pages to set nMaxPage and nToPage */
402 printer.nToPage = 0;
403 printer.nMaxPage = -1;
405 /* Let commdlg manage copy settings */
406 printer.nCopies = (WORD)PD_USEDEVMODECOPIES;
408 if (!PrintDlg(&printer)) return;
410 assert(printer.hDC != 0);
412 /* initialize DOCINFO */
413 di.cbSize = sizeof(DOCINFO);
414 di.lpszDocName = Globals.szFileTitle;
415 di.lpszOutput = NULL;
416 di.lpszDatatype = NULL;
417 di.fwType = 0;
419 if (StartDoc(printer.hDC, &di) <= 0) return;
421 /* Get the page dimensions in pixels. */
422 cWidthPels = GetDeviceCaps(printer.hDC, HORZRES);
423 cHeightPels = GetDeviceCaps(printer.hDC, VERTRES);
425 /* Get the file text */
426 size = GetWindowTextLength(Globals.hEdit) + 1;
427 pTemp = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR));
428 if (!pTemp)
430 ShowLastError();
431 return;
433 size = GetWindowText(Globals.hEdit, pTemp, size);
435 border = 150;
436 for (copycount=1; copycount <= printer.nCopies; copycount++) {
437 i = 0;
438 pagecount = 1;
439 do {
440 static const WCHAR letterM[] = { 'M',0 };
442 if (pagecount >= printer.nFromPage &&
443 /* ((printer.Flags & PD_PAGENUMS) == 0 || pagecount <= printer.nToPage))*/
444 pagecount <= printer.nToPage)
445 dopage = 1;
446 else
447 dopage = 0;
449 old_font = SelectObject(printer.hDC, font);
450 GetTextExtentPoint32(printer.hDC, letterM, 1, &szMetric);
452 if (dopage) {
453 if (StartPage(printer.hDC) <= 0) {
454 static const WCHAR failedW[] = { 'S','t','a','r','t','P','a','g','e',' ','f','a','i','l','e','d',0 };
455 static const WCHAR errorW[] = { 'P','r','i','n','t',' ','E','r','r','o','r',0 };
456 MessageBox(Globals.hMainWnd, failedW, errorW, MB_ICONEXCLAMATION);
457 return;
459 /* Write a rectangle and header at the top of each page */
460 Rectangle(printer.hDC, border, border, cWidthPels-border, border+szMetric.cy*2);
461 /* I don't know what's up with this TextOut command. This comes out
462 kind of mangled.
464 TextOut(printer.hDC, border*2, border+szMetric.cy/2, Globals.szFileTitle, lstrlen(Globals.szFileTitle));
467 /* The starting point for the main text */
468 xLeft = border*2;
469 yTop = border+szMetric.cy*4;
471 SelectObject(printer.hDC, old_font);
472 GetTextExtentPoint32(printer.hDC, letterM, 1, &szMetric);
474 /* Since outputting strings is giving me problems, output the main
475 text one character at a time.
477 do {
478 if (pTemp[i] == '\n') {
479 xLeft = border*2;
480 yTop += szMetric.cy;
482 else if (pTemp[i] != '\r') {
483 if (dopage)
484 TextOut(printer.hDC, xLeft, yTop, &pTemp[i], 1);
485 xLeft += szMetric.cx;
487 } while (i++<size && yTop<(cHeightPels-border*2));
489 if (dopage)
490 EndPage(printer.hDC);
491 pagecount++;
492 } while (i<size);
495 EndDoc(printer.hDC);
496 DeleteDC(printer.hDC);
497 HeapFree(GetProcessHeap(), 0, pTemp);
500 VOID DIALOG_FilePrinterSetup(VOID)
502 PRINTDLG printer;
504 ZeroMemory(&printer, sizeof(printer));
505 printer.lStructSize = sizeof(printer);
506 printer.hwndOwner = Globals.hMainWnd;
507 printer.hInstance = Globals.hInstance;
508 printer.Flags = PD_PRINTSETUP;
509 printer.nCopies = 1;
511 PrintDlg(&printer);
514 VOID DIALOG_FileExit(VOID)
516 PostMessage(Globals.hMainWnd, WM_CLOSE, 0, 0l);
519 VOID DIALOG_EditUndo(VOID)
521 SendMessage(Globals.hEdit, EM_UNDO, 0, 0);
524 VOID DIALOG_EditCut(VOID)
526 SendMessage(Globals.hEdit, WM_CUT, 0, 0);
529 VOID DIALOG_EditCopy(VOID)
531 SendMessage(Globals.hEdit, WM_COPY, 0, 0);
534 VOID DIALOG_EditPaste(VOID)
536 SendMessage(Globals.hEdit, WM_PASTE, 0, 0);
539 VOID DIALOG_EditDelete(VOID)
541 SendMessage(Globals.hEdit, WM_CLEAR, 0, 0);
544 VOID DIALOG_EditSelectAll(VOID)
546 SendMessage(Globals.hEdit, EM_SETSEL, 0, (LPARAM)-1);
549 VOID DIALOG_EditTimeDate(VOID)
551 SYSTEMTIME st;
552 WCHAR szDate[MAX_STRING_LEN];
553 static const WCHAR spaceW[] = { ' ',0 };
555 GetLocalTime(&st);
557 GetTimeFormat(LOCALE_USER_DEFAULT, 0, &st, NULL, szDate, MAX_STRING_LEN);
558 SendMessage(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)szDate);
560 SendMessage(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)spaceW);
562 GetDateFormat(LOCALE_USER_DEFAULT, DATE_LONGDATE, &st, NULL, szDate, MAX_STRING_LEN);
563 SendMessage(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)szDate);
566 VOID DIALOG_EditWrap(VOID)
568 Globals.bWrapLongLines = !Globals.bWrapLongLines;
569 CheckMenuItem(GetMenu(Globals.hMainWnd), CMD_WRAP,
570 MF_BYCOMMAND | (Globals.bWrapLongLines ? MF_CHECKED : MF_UNCHECKED));
573 VOID DIALOG_SelectFont(VOID)
575 CHOOSEFONT cf;
576 LOGFONT lf=Globals.lfFont;
578 ZeroMemory( &cf, sizeof(cf) );
579 cf.lStructSize=sizeof(cf);
580 cf.hwndOwner=Globals.hMainWnd;
581 cf.lpLogFont=&lf;
582 cf.Flags=CF_SCREENFONTS;
584 if( ChooseFont(&cf) )
586 HFONT currfont=Globals.hFont;
588 Globals.hFont=CreateFontIndirect( &lf );
589 Globals.lfFont=lf;
590 SendMessage( Globals.hEdit, WM_SETFONT, (WPARAM)Globals.hFont, (LPARAM)TRUE );
591 if( currfont!=NULL )
592 DeleteObject( currfont );
596 VOID DIALOG_Search(VOID)
598 ZeroMemory(&Globals.find, sizeof(Globals.find));
599 Globals.find.lStructSize = sizeof(Globals.find);
600 Globals.find.hwndOwner = Globals.hMainWnd;
601 Globals.find.hInstance = Globals.hInstance;
602 Globals.find.lpstrFindWhat = Globals.szFindText;
603 Globals.find.wFindWhatLen = SIZEOF(Globals.szFindText);
604 Globals.find.Flags = FR_DOWN;
606 /* We only need to create the modal FindReplace dialog which will */
607 /* notify us of incoming events using hMainWnd Window Messages */
609 Globals.hFindReplaceDlg = FindText(&Globals.find);
610 assert(Globals.hFindReplaceDlg !=0);
613 VOID DIALOG_SearchNext(VOID)
615 /* FIXME: Search Next */
616 DIALOG_Search();
619 VOID DIALOG_HelpContents(VOID)
621 WinHelp(Globals.hMainWnd, helpfileW, HELP_INDEX, 0);
624 VOID DIALOG_HelpSearch(VOID)
626 /* Search Help */
629 VOID DIALOG_HelpHelp(VOID)
631 WinHelp(Globals.hMainWnd, helpfileW, HELP_HELPONHELP, 0);
634 VOID DIALOG_HelpLicense(VOID)
636 WineLicense(Globals.hMainWnd);
639 VOID DIALOG_HelpNoWarranty(VOID)
641 WineWarranty(Globals.hMainWnd);
644 VOID DIALOG_HelpAboutWine(VOID)
646 static const WCHAR notepadW[] = { 'N','o','t','e','p','a','d','\n',0 };
647 WCHAR szNotepad[MAX_STRING_LEN];
649 LoadString(Globals.hInstance, STRING_NOTEPAD, szNotepad, SIZEOF(szNotepad));
650 ShellAbout(Globals.hMainWnd, szNotepad, notepadW, 0);
654 /***********************************************************************
656 * DIALOG_FilePageSetup
658 VOID DIALOG_FilePageSetup(void)
660 DialogBox(Globals.hInstance, MAKEINTRESOURCE(DIALOG_PAGESETUP),
661 Globals.hMainWnd, DIALOG_PAGESETUP_DlgProc);
665 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
667 * DIALOG_PAGESETUP_DlgProc
670 static INT_PTR WINAPI DIALOG_PAGESETUP_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
673 switch (msg)
675 case WM_COMMAND:
676 switch (wParam)
678 case IDOK:
679 /* save user input and close dialog */
680 GetDlgItemText(hDlg, 0x141, Globals.szHeader, SIZEOF(Globals.szHeader));
681 GetDlgItemText(hDlg, 0x143, Globals.szFooter, SIZEOF(Globals.szFooter));
682 GetDlgItemText(hDlg, 0x14A, Globals.szMarginTop, SIZEOF(Globals.szMarginTop));
683 GetDlgItemText(hDlg, 0x150, Globals.szMarginBottom, SIZEOF(Globals.szMarginBottom));
684 GetDlgItemText(hDlg, 0x147, Globals.szMarginLeft, SIZEOF(Globals.szMarginLeft));
685 GetDlgItemText(hDlg, 0x14D, Globals.szMarginRight, SIZEOF(Globals.szMarginRight));
686 EndDialog(hDlg, IDOK);
687 return TRUE;
689 case IDCANCEL:
690 /* discard user input and close dialog */
691 EndDialog(hDlg, IDCANCEL);
692 return TRUE;
694 case IDHELP:
696 /* FIXME: Bring this to work */
697 static const WCHAR sorryW[] = { 'S','o','r','r','y',',',' ','n','o',' ','h','e','l','p',' ','a','v','a','i','l','a','b','l','e',0 };
698 static const WCHAR helpW[] = { 'H','e','l','p',0 };
699 MessageBox(Globals.hMainWnd, sorryW, helpW, MB_ICONEXCLAMATION);
700 return TRUE;
703 default:
704 break;
706 break;
708 case WM_INITDIALOG:
709 /* fetch last user input prior to display dialog */
710 SetDlgItemText(hDlg, 0x141, Globals.szHeader);
711 SetDlgItemText(hDlg, 0x143, Globals.szFooter);
712 SetDlgItemText(hDlg, 0x14A, Globals.szMarginTop);
713 SetDlgItemText(hDlg, 0x150, Globals.szMarginBottom);
714 SetDlgItemText(hDlg, 0x147, Globals.szMarginLeft);
715 SetDlgItemText(hDlg, 0x14D, Globals.szMarginRight);
716 break;
719 return FALSE;