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
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
)
44 WCHAR szTitle
[MAX_STRING_LEN
];
46 LoadString(Globals
.hInstance
, STRING_ERROR
, szTitle
, SIZEOF(szTitle
));
48 FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_FROM_SYSTEM
,
50 (LPTSTR
) &lpMsgBuf
, 0, NULL
);
51 MessageBox(NULL
, lpMsgBuf
, szTitle
, MB_OK
| MB_ICONERROR
);
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
);
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
);
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
);
115 LoadString(Globals
.hInstance
, STRING_ERROR
, szResource
, SIZEOF(szResource
));
118 return MessageBox(Globals
.hMainWnd
, szMessage
, szResource
, MB_ICONEXCLAMATION
|MB_YESNOCANCEL
);
123 * TRUE - if file exists
124 * FALSE - if file does not exist
126 BOOL
FileExists(LPCWSTR szFilename
)
128 WIN32_FIND_DATA entry
;
131 hFile
= FindFirstFile(szFilename
, &entry
);
134 return (hFile
!= INVALID_HANDLE_VALUE
);
138 static VOID
DoSaveFile(VOID
)
145 hFile
= CreateFile(Globals
.szFileName
, GENERIC_WRITE
, FILE_SHARE_WRITE
,
146 NULL
, OPEN_ALWAYS
, FILE_ATTRIBUTE_NORMAL
, NULL
);
147 if(hFile
== INVALID_HANDLE_VALUE
)
153 size
= GetWindowTextLengthA(Globals
.hEdit
) + 1;
154 pTemp
= HeapAlloc(GetProcessHeap(), 0, size
);
161 size
= GetWindowTextA(Globals
.hEdit
, pTemp
, size
);
163 if (!WriteFile(hFile
, pTemp
, size
, &dwNumWrite
, NULL
))
166 SendMessage(Globals
.hEdit
, EM_SETMODIFY
, FALSE
, 0);
169 HeapFree(GetProcessHeap(), 0, pTemp
);
174 * TRUE - User agreed to close (both save/don't save)
175 * FALSE - User cancelled close by selecting "Cancel"
177 BOOL
DoCloseFile(void)
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
);
187 case IDYES
: DIALOG_FileSave();
192 case IDCANCEL
: return(FALSE
);
195 default: return(FALSE
);
200 SetFileName(empty_strW
);
202 UpdateWindowCaption();
207 void DoOpenFile(LPCWSTR szFileName
)
209 static const WCHAR dotlog
[] = { '.','L','O','G',0 };
216 /* Close any files and prompt to save changes */
220 hFile
= CreateFile(szFileName
, GENERIC_READ
, FILE_SHARE_READ
, NULL
,
221 OPEN_EXISTING
, FILE_ATTRIBUTE_NORMAL
, NULL
);
222 if(hFile
== INVALID_HANDLE_VALUE
)
228 size
= GetFileSize(hFile
, NULL
);
229 if (size
== INVALID_FILE_SIZE
)
237 pTemp
= HeapAlloc(GetProcessHeap(), 0, size
);
245 if (!ReadFile(hFile
, pTemp
, size
, &dwNumRead
, NULL
))
248 HeapFree(GetProcessHeap(), 0, pTemp
);
254 pTemp
[dwNumRead
] = 0;
256 if (IsTextUnicode(pTemp
, dwNumRead
, NULL
))
258 LPWSTR p
= (LPWSTR
)pTemp
;
259 /* We need to strip BOM Unicode character, SetWindowTextW won't do it for us. */
260 if (*p
== 0xFEFF || *p
== 0xFFFE) p
++;
261 SetWindowTextW(Globals
.hEdit
, p
);
264 SetWindowTextA(Globals
.hEdit
, pTemp
);
266 HeapFree(GetProcessHeap(), 0, pTemp
);
268 SendMessage(Globals
.hEdit
, EM_SETMODIFY
, FALSE
, 0);
269 SendMessage(Globals
.hEdit
, EM_EMPTYUNDOBUFFER
, 0, 0);
270 SetFocus(Globals
.hEdit
);
272 /* If the file starts with .LOG, add a time/date at the end and set cursor after
273 * See http://support.microsoft.com/?kbid=260563
275 if (GetWindowTextW(Globals
.hEdit
, log
, sizeof(log
)/sizeof(log
[0])) && !lstrcmp(log
, dotlog
))
277 static const WCHAR lfW
[] = { '\r','\n',0 };
278 SendMessage(Globals
.hEdit
, EM_SETSEL
, GetWindowTextLength(Globals
.hEdit
), -1);
279 SendMessage(Globals
.hEdit
, EM_REPLACESEL
, TRUE
, (LPARAM
)lfW
);
280 DIALOG_EditTimeDate();
281 SendMessage(Globals
.hEdit
, EM_REPLACESEL
, TRUE
, (LPARAM
)lfW
);
284 SetFileName(szFileName
);
285 UpdateWindowCaption();
288 VOID
DIALOG_FileNew(VOID
)
290 static const WCHAR empty_strW
[] = { 0 };
292 /* Close any files and promt to save changes */
294 SetWindowText(Globals
.hEdit
, empty_strW
);
295 SendMessage(Globals
.hEdit
, EM_EMPTYUNDOBUFFER
, 0, 0);
296 SetFocus(Globals
.hEdit
);
300 VOID
DIALOG_FileOpen(VOID
)
302 OPENFILENAME openfilename
;
303 WCHAR szPath
[MAX_PATH
];
304 WCHAR szDir
[MAX_PATH
];
305 static const WCHAR szDefaultExt
[] = { 't','x','t',0 };
306 static const WCHAR txt_files
[] = { '*','.','t','x','t',0 };
308 ZeroMemory(&openfilename
, sizeof(openfilename
));
310 GetCurrentDirectory(SIZEOF(szDir
), szDir
);
311 lstrcpy(szPath
, txt_files
);
313 openfilename
.lStructSize
= sizeof(openfilename
);
314 openfilename
.hwndOwner
= Globals
.hMainWnd
;
315 openfilename
.hInstance
= Globals
.hInstance
;
316 openfilename
.lpstrFilter
= Globals
.szFilter
;
317 openfilename
.lpstrFile
= szPath
;
318 openfilename
.nMaxFile
= SIZEOF(szPath
);
319 openfilename
.lpstrInitialDir
= szDir
;
320 openfilename
.Flags
= OFN_FILEMUSTEXIST
| OFN_PATHMUSTEXIST
|
322 openfilename
.lpstrDefExt
= szDefaultExt
;
325 if (GetOpenFileName(&openfilename
)) {
326 if (FileExists(openfilename
.lpstrFile
))
327 DoOpenFile(openfilename
.lpstrFile
);
329 AlertFileNotFound(openfilename
.lpstrFile
);
334 VOID
DIALOG_FileSave(VOID
)
336 if (Globals
.szFileName
[0] == '\0')
342 VOID
DIALOG_FileSaveAs(VOID
)
345 WCHAR szPath
[MAX_PATH
];
346 WCHAR szDir
[MAX_PATH
];
347 static const WCHAR szDefaultExt
[] = { 't','x','t',0 };
348 static const WCHAR txt_files
[] = { '*','.','t','x','t',0 };
350 ZeroMemory(&saveas
, sizeof(saveas
));
352 GetCurrentDirectory(SIZEOF(szDir
), szDir
);
353 lstrcpy(szPath
, txt_files
);
355 saveas
.lStructSize
= sizeof(OPENFILENAME
);
356 saveas
.hwndOwner
= Globals
.hMainWnd
;
357 saveas
.hInstance
= Globals
.hInstance
;
358 saveas
.lpstrFilter
= Globals
.szFilter
;
359 saveas
.lpstrFile
= szPath
;
360 saveas
.nMaxFile
= SIZEOF(szPath
);
361 saveas
.lpstrInitialDir
= szDir
;
362 saveas
.Flags
= OFN_PATHMUSTEXIST
| OFN_OVERWRITEPROMPT
|
364 saveas
.lpstrDefExt
= szDefaultExt
;
366 if (GetSaveFileName(&saveas
)) {
368 UpdateWindowCaption();
373 VOID
DIALOG_FilePrint(VOID
)
378 int cWidthPels
, cHeightPels
, border
;
379 int xLeft
, yTop
, pagecount
, dopage
, copycount
;
382 HFONT font
, old_font
=0;
385 static const WCHAR times_new_romanW
[] = { 'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n',0 };
387 /* Get a small font and print some header info on each page */
388 hdrFont
.lfHeight
= 100;
390 hdrFont
.lfEscapement
= 0;
391 hdrFont
.lfOrientation
= 0;
392 hdrFont
.lfWeight
= FW_BOLD
;
393 hdrFont
.lfItalic
= 0;
394 hdrFont
.lfUnderline
= 0;
395 hdrFont
.lfStrikeOut
= 0;
396 hdrFont
.lfCharSet
= ANSI_CHARSET
;
397 hdrFont
.lfOutPrecision
= OUT_DEFAULT_PRECIS
;
398 hdrFont
.lfClipPrecision
= CLIP_DEFAULT_PRECIS
;
399 hdrFont
.lfQuality
= PROOF_QUALITY
;
400 hdrFont
.lfPitchAndFamily
= VARIABLE_PITCH
| FF_ROMAN
;
401 lstrcpy(hdrFont
.lfFaceName
, times_new_romanW
);
403 font
= CreateFontIndirect(&hdrFont
);
405 /* Get Current Settings */
406 ZeroMemory(&printer
, sizeof(printer
));
407 printer
.lStructSize
= sizeof(printer
);
408 printer
.hwndOwner
= Globals
.hMainWnd
;
409 printer
.hInstance
= Globals
.hInstance
;
411 /* Set some default flags */
412 printer
.Flags
= PD_RETURNDC
;
413 printer
.nFromPage
= 0;
414 printer
.nMinPage
= 1;
415 /* we really need to calculate number of pages to set nMaxPage and nToPage */
417 printer
.nMaxPage
= -1;
419 /* Let commdlg manage copy settings */
420 printer
.nCopies
= (WORD
)PD_USEDEVMODECOPIES
;
422 if (!PrintDlg(&printer
)) return;
424 assert(printer
.hDC
!= 0);
426 /* initialize DOCINFO */
427 di
.cbSize
= sizeof(DOCINFO
);
428 di
.lpszDocName
= Globals
.szFileTitle
;
429 di
.lpszOutput
= NULL
;
430 di
.lpszDatatype
= NULL
;
433 if (StartDoc(printer
.hDC
, &di
) <= 0) return;
435 /* Get the page dimensions in pixels. */
436 cWidthPels
= GetDeviceCaps(printer
.hDC
, HORZRES
);
437 cHeightPels
= GetDeviceCaps(printer
.hDC
, VERTRES
);
439 /* Get the file text */
440 size
= GetWindowTextLength(Globals
.hEdit
) + 1;
441 pTemp
= HeapAlloc(GetProcessHeap(), 0, size
* sizeof(WCHAR
));
447 size
= GetWindowText(Globals
.hEdit
, pTemp
, size
);
450 for (copycount
=1; copycount
<= printer
.nCopies
; copycount
++) {
454 static const WCHAR letterM
[] = { 'M',0 };
456 if (pagecount
>= printer
.nFromPage
&&
457 /* ((printer.Flags & PD_PAGENUMS) == 0 || pagecount <= printer.nToPage))*/
458 pagecount
<= printer
.nToPage
)
463 old_font
= SelectObject(printer
.hDC
, font
);
464 GetTextExtentPoint32(printer
.hDC
, letterM
, 1, &szMetric
);
467 if (StartPage(printer
.hDC
) <= 0) {
468 static const WCHAR failedW
[] = { 'S','t','a','r','t','P','a','g','e',' ','f','a','i','l','e','d',0 };
469 static const WCHAR errorW
[] = { 'P','r','i','n','t',' ','E','r','r','o','r',0 };
470 MessageBox(Globals
.hMainWnd
, failedW
, errorW
, MB_ICONEXCLAMATION
);
473 /* Write a rectangle and header at the top of each page */
474 Rectangle(printer
.hDC
, border
, border
, cWidthPels
-border
, border
+szMetric
.cy
*2);
475 /* I don't know what's up with this TextOut command. This comes out
478 TextOut(printer
.hDC
, border
*2, border
+szMetric
.cy
/2, Globals
.szFileTitle
, lstrlen(Globals
.szFileTitle
));
481 /* The starting point for the main text */
483 yTop
= border
+szMetric
.cy
*4;
485 SelectObject(printer
.hDC
, old_font
);
486 GetTextExtentPoint32(printer
.hDC
, letterM
, 1, &szMetric
);
488 /* Since outputting strings is giving me problems, output the main
489 text one character at a time.
492 if (pTemp
[i
] == '\n') {
496 else if (pTemp
[i
] != '\r') {
498 TextOut(printer
.hDC
, xLeft
, yTop
, &pTemp
[i
], 1);
499 xLeft
+= szMetric
.cx
;
501 } while (i
++<size
&& yTop
<(cHeightPels
-border
*2));
504 EndPage(printer
.hDC
);
510 DeleteDC(printer
.hDC
);
511 HeapFree(GetProcessHeap(), 0, pTemp
);
514 VOID
DIALOG_FilePrinterSetup(VOID
)
518 ZeroMemory(&printer
, sizeof(printer
));
519 printer
.lStructSize
= sizeof(printer
);
520 printer
.hwndOwner
= Globals
.hMainWnd
;
521 printer
.hInstance
= Globals
.hInstance
;
522 printer
.Flags
= PD_PRINTSETUP
;
528 VOID
DIALOG_FileExit(VOID
)
530 PostMessage(Globals
.hMainWnd
, WM_CLOSE
, 0, 0l);
533 VOID
DIALOG_EditUndo(VOID
)
535 SendMessage(Globals
.hEdit
, EM_UNDO
, 0, 0);
538 VOID
DIALOG_EditCut(VOID
)
540 SendMessage(Globals
.hEdit
, WM_CUT
, 0, 0);
543 VOID
DIALOG_EditCopy(VOID
)
545 SendMessage(Globals
.hEdit
, WM_COPY
, 0, 0);
548 VOID
DIALOG_EditPaste(VOID
)
550 SendMessage(Globals
.hEdit
, WM_PASTE
, 0, 0);
553 VOID
DIALOG_EditDelete(VOID
)
555 SendMessage(Globals
.hEdit
, WM_CLEAR
, 0, 0);
558 VOID
DIALOG_EditSelectAll(VOID
)
560 SendMessage(Globals
.hEdit
, EM_SETSEL
, 0, (LPARAM
)-1);
563 VOID
DIALOG_EditTimeDate(VOID
)
566 WCHAR szDate
[MAX_STRING_LEN
];
567 static const WCHAR spaceW
[] = { ' ',0 };
571 GetTimeFormat(LOCALE_USER_DEFAULT
, 0, &st
, NULL
, szDate
, MAX_STRING_LEN
);
572 SendMessage(Globals
.hEdit
, EM_REPLACESEL
, TRUE
, (LPARAM
)szDate
);
574 SendMessage(Globals
.hEdit
, EM_REPLACESEL
, TRUE
, (LPARAM
)spaceW
);
576 GetDateFormat(LOCALE_USER_DEFAULT
, DATE_LONGDATE
, &st
, NULL
, szDate
, MAX_STRING_LEN
);
577 SendMessage(Globals
.hEdit
, EM_REPLACESEL
, TRUE
, (LPARAM
)szDate
);
580 VOID
DIALOG_EditWrap(VOID
)
582 static const WCHAR editW
[] = { 'e','d','i','t',0 };
583 DWORD dwStyle
= WS_CHILD
| WS_VISIBLE
| WS_BORDER
| WS_VSCROLL
|
584 ES_AUTOVSCROLL
| ES_MULTILINE
;
589 size
= GetWindowTextLength(Globals
.hEdit
) + 1;
590 pTemp
= HeapAlloc(GetProcessHeap(), 0, size
* sizeof(WCHAR
));
596 GetWindowText(Globals
.hEdit
, pTemp
, size
);
597 DestroyWindow(Globals
.hEdit
);
598 GetClientRect(Globals
.hMainWnd
, &rc
);
599 if( Globals
.bWrapLongLines
) dwStyle
|= WS_HSCROLL
| ES_AUTOHSCROLL
;
600 Globals
.hEdit
= CreateWindowEx(WS_EX_CLIENTEDGE
, editW
, NULL
, dwStyle
,
601 0, 0, rc
.right
, rc
.bottom
, Globals
.hMainWnd
,
602 NULL
, Globals
.hInstance
, NULL
);
603 SendMessage(Globals
.hEdit
, WM_SETFONT
, (WPARAM
)Globals
.hFont
, (LPARAM
)FALSE
);
604 SetWindowTextW(Globals
.hEdit
, pTemp
);
605 SetFocus(Globals
.hEdit
);
606 HeapFree(GetProcessHeap(), 0, pTemp
);
608 Globals
.bWrapLongLines
= !Globals
.bWrapLongLines
;
609 CheckMenuItem(GetMenu(Globals
.hMainWnd
), CMD_WRAP
,
610 MF_BYCOMMAND
| (Globals
.bWrapLongLines
? MF_CHECKED
: MF_UNCHECKED
));
613 VOID
DIALOG_SelectFont(VOID
)
616 LOGFONT lf
=Globals
.lfFont
;
618 ZeroMemory( &cf
, sizeof(cf
) );
619 cf
.lStructSize
=sizeof(cf
);
620 cf
.hwndOwner
=Globals
.hMainWnd
;
622 cf
.Flags
=CF_SCREENFONTS
;
624 if( ChooseFont(&cf
) )
626 HFONT currfont
=Globals
.hFont
;
628 Globals
.hFont
=CreateFontIndirect( &lf
);
630 SendMessage( Globals
.hEdit
, WM_SETFONT
, (WPARAM
)Globals
.hFont
, (LPARAM
)TRUE
);
632 DeleteObject( currfont
);
636 VOID
DIALOG_Search(VOID
)
638 ZeroMemory(&Globals
.find
, sizeof(Globals
.find
));
639 Globals
.find
.lStructSize
= sizeof(Globals
.find
);
640 Globals
.find
.hwndOwner
= Globals
.hMainWnd
;
641 Globals
.find
.hInstance
= Globals
.hInstance
;
642 Globals
.find
.lpstrFindWhat
= Globals
.szFindText
;
643 Globals
.find
.wFindWhatLen
= SIZEOF(Globals
.szFindText
);
644 Globals
.find
.Flags
= FR_DOWN
;
646 /* We only need to create the modal FindReplace dialog which will */
647 /* notify us of incoming events using hMainWnd Window Messages */
649 Globals
.hFindReplaceDlg
= FindText(&Globals
.find
);
650 assert(Globals
.hFindReplaceDlg
!=0);
653 VOID
DIALOG_SearchNext(VOID
)
655 /* FIXME: Search Next */
659 VOID
DIALOG_HelpContents(VOID
)
661 WinHelp(Globals
.hMainWnd
, helpfileW
, HELP_INDEX
, 0);
664 VOID
DIALOG_HelpSearch(VOID
)
669 VOID
DIALOG_HelpHelp(VOID
)
671 WinHelp(Globals
.hMainWnd
, helpfileW
, HELP_HELPONHELP
, 0);
674 VOID
DIALOG_HelpLicense(VOID
)
676 WineLicense(Globals
.hMainWnd
);
679 VOID
DIALOG_HelpNoWarranty(VOID
)
681 WineWarranty(Globals
.hMainWnd
);
684 VOID
DIALOG_HelpAboutWine(VOID
)
686 static const WCHAR notepadW
[] = { 'N','o','t','e','p','a','d','\n',0 };
687 WCHAR szNotepad
[MAX_STRING_LEN
];
689 LoadString(Globals
.hInstance
, STRING_NOTEPAD
, szNotepad
, SIZEOF(szNotepad
));
690 ShellAbout(Globals
.hMainWnd
, szNotepad
, notepadW
, 0);
694 /***********************************************************************
696 * DIALOG_FilePageSetup
698 VOID
DIALOG_FilePageSetup(void)
700 DialogBox(Globals
.hInstance
, MAKEINTRESOURCE(DIALOG_PAGESETUP
),
701 Globals
.hMainWnd
, DIALOG_PAGESETUP_DlgProc
);
705 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
707 * DIALOG_PAGESETUP_DlgProc
710 static INT_PTR WINAPI
DIALOG_PAGESETUP_DlgProc(HWND hDlg
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
719 /* save user input and close dialog */
720 GetDlgItemText(hDlg
, 0x141, Globals
.szHeader
, SIZEOF(Globals
.szHeader
));
721 GetDlgItemText(hDlg
, 0x143, Globals
.szFooter
, SIZEOF(Globals
.szFooter
));
722 GetDlgItemText(hDlg
, 0x14A, Globals
.szMarginTop
, SIZEOF(Globals
.szMarginTop
));
723 GetDlgItemText(hDlg
, 0x150, Globals
.szMarginBottom
, SIZEOF(Globals
.szMarginBottom
));
724 GetDlgItemText(hDlg
, 0x147, Globals
.szMarginLeft
, SIZEOF(Globals
.szMarginLeft
));
725 GetDlgItemText(hDlg
, 0x14D, Globals
.szMarginRight
, SIZEOF(Globals
.szMarginRight
));
726 EndDialog(hDlg
, IDOK
);
730 /* discard user input and close dialog */
731 EndDialog(hDlg
, IDCANCEL
);
736 /* FIXME: Bring this to work */
737 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 };
738 static const WCHAR helpW
[] = { 'H','e','l','p',0 };
739 MessageBox(Globals
.hMainWnd
, sorryW
, helpW
, MB_ICONEXCLAMATION
);
749 /* fetch last user input prior to display dialog */
750 SetDlgItemText(hDlg
, 0x141, Globals
.szHeader
);
751 SetDlgItemText(hDlg
, 0x143, Globals
.szFooter
);
752 SetDlgItemText(hDlg
, 0x14A, Globals
.szMarginTop
);
753 SetDlgItemText(hDlg
, 0x150, Globals
.szMarginBottom
);
754 SetDlgItemText(hDlg
, 0x147, Globals
.szMarginLeft
);
755 SetDlgItemText(hDlg
, 0x14D, Globals
.szMarginRight
);