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);
170 HeapFree(GetProcessHeap(), 0, pTemp
);
175 * TRUE - User agreed to close (both save/don't save)
176 * FALSE - User cancelled close by selecting "Cancel"
178 BOOL
DoCloseFile(void)
181 static const WCHAR empty_strW
[] = { 0 };
183 if (SendMessage(Globals
.hEdit
, EM_GETMODIFY
, 0, 0))
185 /* prompt user to save changes */
186 nResult
= AlertFileNotSaved(Globals
.szFileName
);
188 case IDYES
: DIALOG_FileSave();
193 case IDCANCEL
: return(FALSE
);
196 default: return(FALSE
);
201 SetFileName(empty_strW
);
203 UpdateWindowCaption();
208 void DoOpenFile(LPCWSTR szFileName
)
210 static const WCHAR dotlog
[] = { '.','L','O','G',0 };
217 /* Close any files and prompt to save changes */
221 hFile
= CreateFile(szFileName
, GENERIC_READ
, FILE_SHARE_READ
, NULL
,
222 OPEN_EXISTING
, FILE_ATTRIBUTE_NORMAL
, NULL
);
223 if(hFile
== INVALID_HANDLE_VALUE
)
229 size
= GetFileSize(hFile
, NULL
);
230 if (size
== INVALID_FILE_SIZE
)
238 pTemp
= HeapAlloc(GetProcessHeap(), 0, size
);
246 if (!ReadFile(hFile
, pTemp
, size
, &dwNumRead
, NULL
))
249 HeapFree(GetProcessHeap(), 0, pTemp
);
255 pTemp
[dwNumRead
] = 0;
257 if (IsTextUnicode(pTemp
, dwNumRead
, NULL
))
259 LPWSTR p
= (LPWSTR
)pTemp
;
260 /* We need to strip BOM Unicode character, SetWindowTextW won't do it for us. */
261 if (*p
== 0xFEFF || *p
== 0xFFFE) p
++;
262 SetWindowTextW(Globals
.hEdit
, p
);
265 SetWindowTextA(Globals
.hEdit
, pTemp
);
267 HeapFree(GetProcessHeap(), 0, pTemp
);
269 SendMessage(Globals
.hEdit
, EM_SETMODIFY
, FALSE
, 0);
270 SendMessage(Globals
.hEdit
, EM_EMPTYUNDOBUFFER
, 0, 0);
271 SetFocus(Globals
.hEdit
);
273 /* If the file starts with .LOG, add a time/date at the end and set cursor after
274 * See http://support.microsoft.com/?kbid=260563
276 if (GetWindowTextW(Globals
.hEdit
, log
, sizeof(log
)/sizeof(log
[0])) && !lstrcmp(log
, dotlog
))
278 static const WCHAR lfW
[] = { '\r','\n',0 };
279 SendMessage(Globals
.hEdit
, EM_SETSEL
, GetWindowTextLength(Globals
.hEdit
), -1);
280 SendMessage(Globals
.hEdit
, EM_REPLACESEL
, TRUE
, (LPARAM
)lfW
);
281 DIALOG_EditTimeDate();
282 SendMessage(Globals
.hEdit
, EM_REPLACESEL
, TRUE
, (LPARAM
)lfW
);
285 SetFileName(szFileName
);
286 UpdateWindowCaption();
289 VOID
DIALOG_FileNew(VOID
)
291 static const WCHAR empty_strW
[] = { 0 };
293 /* Close any files and promt to save changes */
295 SetWindowText(Globals
.hEdit
, empty_strW
);
296 SendMessage(Globals
.hEdit
, EM_EMPTYUNDOBUFFER
, 0, 0);
297 SetFocus(Globals
.hEdit
);
301 VOID
DIALOG_FileOpen(VOID
)
303 OPENFILENAME openfilename
;
304 WCHAR szPath
[MAX_PATH
];
305 WCHAR szDir
[MAX_PATH
];
306 static const WCHAR szDefaultExt
[] = { 't','x','t',0 };
307 static const WCHAR txt_files
[] = { '*','.','t','x','t',0 };
309 ZeroMemory(&openfilename
, sizeof(openfilename
));
311 GetCurrentDirectory(SIZEOF(szDir
), szDir
);
312 lstrcpy(szPath
, txt_files
);
314 openfilename
.lStructSize
= sizeof(openfilename
);
315 openfilename
.hwndOwner
= Globals
.hMainWnd
;
316 openfilename
.hInstance
= Globals
.hInstance
;
317 openfilename
.lpstrFilter
= Globals
.szFilter
;
318 openfilename
.lpstrFile
= szPath
;
319 openfilename
.nMaxFile
= SIZEOF(szPath
);
320 openfilename
.lpstrInitialDir
= szDir
;
321 openfilename
.Flags
= OFN_FILEMUSTEXIST
| OFN_PATHMUSTEXIST
|
323 openfilename
.lpstrDefExt
= szDefaultExt
;
326 if (GetOpenFileName(&openfilename
)) {
327 if (FileExists(openfilename
.lpstrFile
))
328 DoOpenFile(openfilename
.lpstrFile
);
330 AlertFileNotFound(openfilename
.lpstrFile
);
335 VOID
DIALOG_FileSave(VOID
)
337 if (Globals
.szFileName
[0] == '\0')
343 VOID
DIALOG_FileSaveAs(VOID
)
346 WCHAR szPath
[MAX_PATH
];
347 WCHAR szDir
[MAX_PATH
];
348 static const WCHAR szDefaultExt
[] = { 't','x','t',0 };
349 static const WCHAR txt_files
[] = { '*','.','t','x','t',0 };
351 ZeroMemory(&saveas
, sizeof(saveas
));
353 GetCurrentDirectory(SIZEOF(szDir
), szDir
);
354 lstrcpy(szPath
, txt_files
);
356 saveas
.lStructSize
= sizeof(OPENFILENAME
);
357 saveas
.hwndOwner
= Globals
.hMainWnd
;
358 saveas
.hInstance
= Globals
.hInstance
;
359 saveas
.lpstrFilter
= Globals
.szFilter
;
360 saveas
.lpstrFile
= szPath
;
361 saveas
.nMaxFile
= SIZEOF(szPath
);
362 saveas
.lpstrInitialDir
= szDir
;
363 saveas
.Flags
= OFN_PATHMUSTEXIST
| OFN_OVERWRITEPROMPT
|
365 saveas
.lpstrDefExt
= szDefaultExt
;
367 if (GetSaveFileName(&saveas
)) {
369 UpdateWindowCaption();
374 VOID
DIALOG_FilePrint(VOID
)
379 int cWidthPels
, cHeightPels
, border
;
380 int xLeft
, yTop
, pagecount
, dopage
, copycount
;
383 HFONT font
, old_font
=0;
386 static const WCHAR times_new_romanW
[] = { 'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n',0 };
388 /* Get a small font and print some header info on each page */
389 hdrFont
.lfHeight
= 100;
391 hdrFont
.lfEscapement
= 0;
392 hdrFont
.lfOrientation
= 0;
393 hdrFont
.lfWeight
= FW_BOLD
;
394 hdrFont
.lfItalic
= 0;
395 hdrFont
.lfUnderline
= 0;
396 hdrFont
.lfStrikeOut
= 0;
397 hdrFont
.lfCharSet
= ANSI_CHARSET
;
398 hdrFont
.lfOutPrecision
= OUT_DEFAULT_PRECIS
;
399 hdrFont
.lfClipPrecision
= CLIP_DEFAULT_PRECIS
;
400 hdrFont
.lfQuality
= PROOF_QUALITY
;
401 hdrFont
.lfPitchAndFamily
= VARIABLE_PITCH
| FF_ROMAN
;
402 lstrcpy(hdrFont
.lfFaceName
, times_new_romanW
);
404 font
= CreateFontIndirect(&hdrFont
);
406 /* Get Current Settings */
407 ZeroMemory(&printer
, sizeof(printer
));
408 printer
.lStructSize
= sizeof(printer
);
409 printer
.hwndOwner
= Globals
.hMainWnd
;
410 printer
.hInstance
= Globals
.hInstance
;
412 /* Set some default flags */
413 printer
.Flags
= PD_RETURNDC
;
414 printer
.nFromPage
= 0;
415 printer
.nMinPage
= 1;
416 /* we really need to calculate number of pages to set nMaxPage and nToPage */
418 printer
.nMaxPage
= -1;
420 /* Let commdlg manage copy settings */
421 printer
.nCopies
= (WORD
)PD_USEDEVMODECOPIES
;
423 if (!PrintDlg(&printer
)) return;
425 assert(printer
.hDC
!= 0);
427 /* initialize DOCINFO */
428 di
.cbSize
= sizeof(DOCINFO
);
429 di
.lpszDocName
= Globals
.szFileTitle
;
430 di
.lpszOutput
= NULL
;
431 di
.lpszDatatype
= NULL
;
434 if (StartDoc(printer
.hDC
, &di
) <= 0) return;
436 /* Get the page dimensions in pixels. */
437 cWidthPels
= GetDeviceCaps(printer
.hDC
, HORZRES
);
438 cHeightPels
= GetDeviceCaps(printer
.hDC
, VERTRES
);
440 /* Get the file text */
441 size
= GetWindowTextLength(Globals
.hEdit
) + 1;
442 pTemp
= HeapAlloc(GetProcessHeap(), 0, size
* sizeof(WCHAR
));
448 size
= GetWindowText(Globals
.hEdit
, pTemp
, size
);
451 for (copycount
=1; copycount
<= printer
.nCopies
; copycount
++) {
455 static const WCHAR letterM
[] = { 'M',0 };
457 if (pagecount
>= printer
.nFromPage
&&
458 /* ((printer.Flags & PD_PAGENUMS) == 0 || pagecount <= printer.nToPage))*/
459 pagecount
<= printer
.nToPage
)
464 old_font
= SelectObject(printer
.hDC
, font
);
465 GetTextExtentPoint32(printer
.hDC
, letterM
, 1, &szMetric
);
468 if (StartPage(printer
.hDC
) <= 0) {
469 static const WCHAR failedW
[] = { 'S','t','a','r','t','P','a','g','e',' ','f','a','i','l','e','d',0 };
470 static const WCHAR errorW
[] = { 'P','r','i','n','t',' ','E','r','r','o','r',0 };
471 MessageBox(Globals
.hMainWnd
, failedW
, errorW
, MB_ICONEXCLAMATION
);
474 /* Write a rectangle and header at the top of each page */
475 Rectangle(printer
.hDC
, border
, border
, cWidthPels
-border
, border
+szMetric
.cy
*2);
476 /* I don't know what's up with this TextOut command. This comes out
479 TextOut(printer
.hDC
, border
*2, border
+szMetric
.cy
/2, Globals
.szFileTitle
, lstrlen(Globals
.szFileTitle
));
482 /* The starting point for the main text */
484 yTop
= border
+szMetric
.cy
*4;
486 SelectObject(printer
.hDC
, old_font
);
487 GetTextExtentPoint32(printer
.hDC
, letterM
, 1, &szMetric
);
489 /* Since outputting strings is giving me problems, output the main
490 text one character at a time.
493 if (pTemp
[i
] == '\n') {
497 else if (pTemp
[i
] != '\r') {
499 TextOut(printer
.hDC
, xLeft
, yTop
, &pTemp
[i
], 1);
500 xLeft
+= szMetric
.cx
;
502 } while (i
++<size
&& yTop
<(cHeightPels
-border
*2));
505 EndPage(printer
.hDC
);
511 DeleteDC(printer
.hDC
);
512 HeapFree(GetProcessHeap(), 0, pTemp
);
515 VOID
DIALOG_FilePrinterSetup(VOID
)
519 ZeroMemory(&printer
, sizeof(printer
));
520 printer
.lStructSize
= sizeof(printer
);
521 printer
.hwndOwner
= Globals
.hMainWnd
;
522 printer
.hInstance
= Globals
.hInstance
;
523 printer
.Flags
= PD_PRINTSETUP
;
529 VOID
DIALOG_FileExit(VOID
)
531 PostMessage(Globals
.hMainWnd
, WM_CLOSE
, 0, 0l);
534 VOID
DIALOG_EditUndo(VOID
)
536 SendMessage(Globals
.hEdit
, EM_UNDO
, 0, 0);
539 VOID
DIALOG_EditCut(VOID
)
541 SendMessage(Globals
.hEdit
, WM_CUT
, 0, 0);
544 VOID
DIALOG_EditCopy(VOID
)
546 SendMessage(Globals
.hEdit
, WM_COPY
, 0, 0);
549 VOID
DIALOG_EditPaste(VOID
)
551 SendMessage(Globals
.hEdit
, WM_PASTE
, 0, 0);
554 VOID
DIALOG_EditDelete(VOID
)
556 SendMessage(Globals
.hEdit
, WM_CLEAR
, 0, 0);
559 VOID
DIALOG_EditSelectAll(VOID
)
561 SendMessage(Globals
.hEdit
, EM_SETSEL
, 0, (LPARAM
)-1);
564 VOID
DIALOG_EditTimeDate(VOID
)
567 WCHAR szDate
[MAX_STRING_LEN
];
568 static const WCHAR spaceW
[] = { ' ',0 };
572 GetTimeFormat(LOCALE_USER_DEFAULT
, 0, &st
, NULL
, szDate
, MAX_STRING_LEN
);
573 SendMessage(Globals
.hEdit
, EM_REPLACESEL
, TRUE
, (LPARAM
)szDate
);
575 SendMessage(Globals
.hEdit
, EM_REPLACESEL
, TRUE
, (LPARAM
)spaceW
);
577 GetDateFormat(LOCALE_USER_DEFAULT
, DATE_LONGDATE
, &st
, NULL
, szDate
, MAX_STRING_LEN
);
578 SendMessage(Globals
.hEdit
, EM_REPLACESEL
, TRUE
, (LPARAM
)szDate
);
581 VOID
DIALOG_EditWrap(VOID
)
583 static const WCHAR editW
[] = { 'e','d','i','t',0 };
584 DWORD dwStyle
= WS_CHILD
| WS_VISIBLE
| WS_BORDER
| WS_VSCROLL
|
585 ES_AUTOVSCROLL
| ES_MULTILINE
;
590 size
= GetWindowTextLength(Globals
.hEdit
) + 1;
591 pTemp
= HeapAlloc(GetProcessHeap(), 0, size
* sizeof(WCHAR
));
597 GetWindowText(Globals
.hEdit
, pTemp
, size
);
598 DestroyWindow(Globals
.hEdit
);
599 GetClientRect(Globals
.hMainWnd
, &rc
);
600 if( Globals
.bWrapLongLines
) dwStyle
|= WS_HSCROLL
| ES_AUTOHSCROLL
;
601 Globals
.hEdit
= CreateWindowEx(WS_EX_CLIENTEDGE
, editW
, NULL
, dwStyle
,
602 0, 0, rc
.right
, rc
.bottom
, Globals
.hMainWnd
,
603 NULL
, Globals
.hInstance
, NULL
);
604 SendMessage(Globals
.hEdit
, WM_SETFONT
, (WPARAM
)Globals
.hFont
, (LPARAM
)FALSE
);
605 SetWindowTextW(Globals
.hEdit
, pTemp
);
606 SetFocus(Globals
.hEdit
);
607 HeapFree(GetProcessHeap(), 0, pTemp
);
609 Globals
.bWrapLongLines
= !Globals
.bWrapLongLines
;
610 CheckMenuItem(GetMenu(Globals
.hMainWnd
), CMD_WRAP
,
611 MF_BYCOMMAND
| (Globals
.bWrapLongLines
? MF_CHECKED
: MF_UNCHECKED
));
614 VOID
DIALOG_SelectFont(VOID
)
617 LOGFONT lf
=Globals
.lfFont
;
619 ZeroMemory( &cf
, sizeof(cf
) );
620 cf
.lStructSize
=sizeof(cf
);
621 cf
.hwndOwner
=Globals
.hMainWnd
;
623 cf
.Flags
=CF_SCREENFONTS
;
625 if( ChooseFont(&cf
) )
627 HFONT currfont
=Globals
.hFont
;
629 Globals
.hFont
=CreateFontIndirect( &lf
);
631 SendMessage( Globals
.hEdit
, WM_SETFONT
, (WPARAM
)Globals
.hFont
, (LPARAM
)TRUE
);
633 DeleteObject( currfont
);
637 VOID
DIALOG_Search(VOID
)
639 ZeroMemory(&Globals
.find
, sizeof(Globals
.find
));
640 Globals
.find
.lStructSize
= sizeof(Globals
.find
);
641 Globals
.find
.hwndOwner
= Globals
.hMainWnd
;
642 Globals
.find
.hInstance
= Globals
.hInstance
;
643 Globals
.find
.lpstrFindWhat
= Globals
.szFindText
;
644 Globals
.find
.wFindWhatLen
= SIZEOF(Globals
.szFindText
);
645 Globals
.find
.Flags
= FR_DOWN
;
647 /* We only need to create the modal FindReplace dialog which will */
648 /* notify us of incoming events using hMainWnd Window Messages */
650 Globals
.hFindReplaceDlg
= FindText(&Globals
.find
);
651 assert(Globals
.hFindReplaceDlg
!=0);
654 VOID
DIALOG_SearchNext(VOID
)
656 /* FIXME: Search Next */
660 VOID
DIALOG_HelpContents(VOID
)
662 WinHelp(Globals
.hMainWnd
, helpfileW
, HELP_INDEX
, 0);
665 VOID
DIALOG_HelpSearch(VOID
)
670 VOID
DIALOG_HelpHelp(VOID
)
672 WinHelp(Globals
.hMainWnd
, helpfileW
, HELP_HELPONHELP
, 0);
675 VOID
DIALOG_HelpLicense(VOID
)
677 WineLicense(Globals
.hMainWnd
);
680 VOID
DIALOG_HelpNoWarranty(VOID
)
682 WineWarranty(Globals
.hMainWnd
);
685 VOID
DIALOG_HelpAboutWine(VOID
)
687 static const WCHAR notepadW
[] = { 'N','o','t','e','p','a','d','\n',0 };
688 WCHAR szNotepad
[MAX_STRING_LEN
];
690 LoadString(Globals
.hInstance
, STRING_NOTEPAD
, szNotepad
, SIZEOF(szNotepad
));
691 ShellAbout(Globals
.hMainWnd
, szNotepad
, notepadW
, 0);
695 /***********************************************************************
697 * DIALOG_FilePageSetup
699 VOID
DIALOG_FilePageSetup(void)
701 DialogBox(Globals
.hInstance
, MAKEINTRESOURCE(DIALOG_PAGESETUP
),
702 Globals
.hMainWnd
, DIALOG_PAGESETUP_DlgProc
);
706 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
708 * DIALOG_PAGESETUP_DlgProc
711 static INT_PTR WINAPI
DIALOG_PAGESETUP_DlgProc(HWND hDlg
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
720 /* save user input and close dialog */
721 GetDlgItemText(hDlg
, 0x141, Globals
.szHeader
, SIZEOF(Globals
.szHeader
));
722 GetDlgItemText(hDlg
, 0x143, Globals
.szFooter
, SIZEOF(Globals
.szFooter
));
723 GetDlgItemText(hDlg
, 0x14A, Globals
.szMarginTop
, SIZEOF(Globals
.szMarginTop
));
724 GetDlgItemText(hDlg
, 0x150, Globals
.szMarginBottom
, SIZEOF(Globals
.szMarginBottom
));
725 GetDlgItemText(hDlg
, 0x147, Globals
.szMarginLeft
, SIZEOF(Globals
.szMarginLeft
));
726 GetDlgItemText(hDlg
, 0x14D, Globals
.szMarginRight
, SIZEOF(Globals
.szMarginRight
));
727 EndDialog(hDlg
, IDOK
);
731 /* discard user input and close dialog */
732 EndDialog(hDlg
, IDCANCEL
);
737 /* FIXME: Bring this to work */
738 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 };
739 static const WCHAR helpW
[] = { 'H','e','l','p',0 };
740 MessageBox(Globals
.hMainWnd
, sorryW
, helpW
, MB_ICONEXCLAMATION
);
750 /* fetch last user input prior to display dialog */
751 SetDlgItemText(hDlg
, 0x141, Globals
.szHeader
);
752 SetDlgItemText(hDlg
, 0x143, Globals
.szFooter
);
753 SetDlgItemText(hDlg
, 0x14A, Globals
.szMarginTop
);
754 SetDlgItemText(hDlg
, 0x150, Globals
.szMarginBottom
);
755 SetDlgItemText(hDlg
, 0x147, Globals
.szMarginLeft
);
756 SetDlgItemText(hDlg
, 0x14D, Globals
.szMarginRight
);