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
)
151 hFile
= CreateFile(Globals
.szFileName
, GENERIC_WRITE
, FILE_SHARE_WRITE
,
152 NULL
, CREATE_ALWAYS
, FILE_ATTRIBUTE_NORMAL
, NULL
);
153 if(hFile
== INVALID_HANDLE_VALUE
)
159 size
= GetWindowTextLengthW(Globals
.hEdit
) + 1;
160 pTemp
= HeapAlloc(GetProcessHeap(), 0, size
* sizeof(*pTemp
));
167 size
= GetWindowTextW(Globals
.hEdit
, pTemp
, size
);
169 switch(Globals
.iEncoding
)
175 case ENCODING_UNICODE
:
182 case ENCODING_UNICODE_BE
:
188 /* flip the endianness */
189 for (i
= 0; i
< size
; i
++)
191 pTemp
[i
] = ((pTemp
[i
] & 0x00FF) << 8)
192 | ((pTemp
[i
] & 0xFF00) >> 8);
207 iNewSize
= WideCharToMultiByte(iCodePage
, 0, pTemp
, size
, NULL
, 0, NULL
, NULL
);
208 pConverted
= HeapAlloc(GetProcessHeap(), 0, iNewSize
);
211 HeapFree(GetProcessHeap(), 0, pTemp
);
216 WideCharToMultiByte(iCodePage
, 0, pTemp
, size
, pConverted
, iNewSize
, NULL
, NULL
);
220 iNewSize
= size
* sizeof(WCHAR
);
223 if ((iBomSize
> 0) && !WriteFile(hFile
, bom
, iBomSize
, &dwNumWrite
, NULL
))
225 else if (!WriteFile(hFile
, pConverted
, iNewSize
, &dwNumWrite
, NULL
))
228 SendMessage(Globals
.hEdit
, EM_SETMODIFY
, FALSE
, 0);
231 HeapFree(GetProcessHeap(), 0, pTemp
);
234 HeapFree(GetProcessHeap(), 0, pConverted
);
239 * TRUE - User agreed to close (both save/don't save)
240 * FALSE - User cancelled close by selecting "Cancel"
242 BOOL
DoCloseFile(void)
245 static const WCHAR empty_strW
[] = { 0 };
247 if (SendMessage(Globals
.hEdit
, EM_GETMODIFY
, 0, 0))
249 /* prompt user to save changes */
250 nResult
= AlertFileNotSaved(Globals
.szFileName
);
252 case IDYES
: DIALOG_FileSave();
257 case IDCANCEL
: return(FALSE
);
260 default: return(FALSE
);
265 SetFileName(empty_strW
);
267 UpdateWindowCaption();
272 void DoOpenFile(LPCWSTR szFileName
)
276 LPWSTR pTemp2
= NULL
;
284 /* Close any files and prompt to save changes */
288 hFile
= CreateFile(szFileName
, GENERIC_READ
, FILE_SHARE_READ
, NULL
,
289 OPEN_ALWAYS
, FILE_ATTRIBUTE_NORMAL
, NULL
);
290 if(hFile
== INVALID_HANDLE_VALUE
)
296 size
= GetFileSize(hFile
, NULL
);
297 if (size
== INVALID_FILE_SIZE
)
304 pTemp
= HeapAlloc(GetProcessHeap(), 0, size
+ sizeof(WCHAR
));
312 if (!ReadFile(hFile
, pTemp
, size
, &dwNumRead
, NULL
))
315 HeapFree(GetProcessHeap(), 0, pTemp
);
321 pTemp
[dwNumRead
] = 0;
323 if (IsTextUnicode(pTemp
, dwNumRead
, NULL
))
326 p
[dwNumRead
/ 2] = 0;
328 /* We need to strip BOM Unicode character, SetWindowTextW won't do it for us. */
331 Globals
.iEncoding
= ENCODING_UNICODE_BE
;
334 else if (*p
== 0xFFFE)
336 Globals
.iEncoding
= ENCODING_UNICODE
;
343 if ((p2
[0] == 0xEF) && (p2
[1] == 0xBB) && (p2
[2] == 0xBF))
346 Globals
.iEncoding
= ENCODING_UTF8
;
353 Globals
.iEncoding
= ENCODING_ANSI
;
356 iNewSize
= MultiByteToWideChar(iCodePage
, 0, p2
, dwNumRead
, NULL
, 0);
357 pTemp2
= HeapAlloc(GetProcessHeap(), 0, (iNewSize
+ 1) * sizeof(*pTemp2
));
361 HeapFree(GetProcessHeap(), 0, pTemp
);
365 MultiByteToWideChar(iCodePage
, 0, p2
, dwNumRead
, pTemp2
, iNewSize
);
366 pTemp2
[iNewSize
] = 0;
369 SetWindowTextW(Globals
.hEdit
, p
);
371 HeapFree(GetProcessHeap(), 0, pTemp
);
373 HeapFree(GetProcessHeap(), 0, pTemp2
);
375 SendMessage(Globals
.hEdit
, EM_SETMODIFY
, FALSE
, 0);
376 SendMessage(Globals
.hEdit
, EM_EMPTYUNDOBUFFER
, 0, 0);
377 SetFocus(Globals
.hEdit
);
379 SetFileName(szFileName
);
380 UpdateWindowCaption();
383 VOID
DIALOG_FileNew(VOID
)
385 static const WCHAR empty_strW
[] = { 0 };
387 /* Close any files and promt to save changes */
389 SetWindowText(Globals
.hEdit
, empty_strW
);
390 SendMessage(Globals
.hEdit
, EM_EMPTYUNDOBUFFER
, 0, 0);
391 SetFocus(Globals
.hEdit
);
395 VOID
DIALOG_FileOpen(VOID
)
397 OPENFILENAME openfilename
;
398 WCHAR szDir
[MAX_PATH
];
399 WCHAR szPath
[MAX_PATH
];
400 static const WCHAR szDefaultExt
[] = { 't','x','t',0 };
401 static const WCHAR txt_files
[] = { '*','.','t','x','t',0 };
403 ZeroMemory(&openfilename
, sizeof(openfilename
));
405 GetCurrentDirectory(SIZEOF(szDir
), szDir
);
406 if (Globals
.szFileName
[0] == 0)
407 lstrcpy(szPath
, txt_files
);
409 lstrcpy(szPath
, Globals
.szFileName
);
411 openfilename
.lStructSize
= sizeof(openfilename
);
412 openfilename
.hwndOwner
= Globals
.hMainWnd
;
413 openfilename
.hInstance
= Globals
.hInstance
;
414 openfilename
.lpstrFilter
= Globals
.szFilter
;
415 openfilename
.lpstrFile
= szPath
;
416 openfilename
.nMaxFile
= SIZEOF(szPath
);
417 openfilename
.lpstrInitialDir
= szDir
;
418 openfilename
.Flags
= OFN_FILEMUSTEXIST
| OFN_PATHMUSTEXIST
|
420 openfilename
.lpstrDefExt
= szDefaultExt
;
423 if (GetOpenFileName(&openfilename
)) {
424 if (FileExists(openfilename
.lpstrFile
))
425 DoOpenFile(openfilename
.lpstrFile
);
427 AlertFileNotFound(openfilename
.lpstrFile
);
432 VOID
DIALOG_FileSave(VOID
)
434 if (Globals
.szFileName
[0] == '\0')
440 static UINT_PTR CALLBACK
DIALOG_FileSaveAs_Hook(HWND hDlg
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
449 hCombo
= GetDlgItem(hDlg
, ID_ENCODING
);
451 LoadString(Globals
.hInstance
, STRING_ANSI
, szText
, SIZEOF(szText
));
452 SendMessage(hCombo
, CB_ADDSTRING
, 0, (LPARAM
) szText
);
454 LoadString(Globals
.hInstance
, STRING_UNICODE
, szText
, SIZEOF(szText
));
455 SendMessage(hCombo
, CB_ADDSTRING
, 0, (LPARAM
) szText
);
457 LoadString(Globals
.hInstance
, STRING_UNICODE_BE
, szText
, SIZEOF(szText
));
458 SendMessage(hCombo
, CB_ADDSTRING
, 0, (LPARAM
) szText
);
460 LoadString(Globals
.hInstance
, STRING_UTF8
, szText
, SIZEOF(szText
));
461 SendMessage(hCombo
, CB_ADDSTRING
, 0, (LPARAM
) szText
);
463 SendMessage(hCombo
, CB_SETCURSEL
, Globals
.iEncoding
, 0);
467 if (((NMHDR
*) lParam
)->code
== CDN_FILEOK
)
469 pNotify
= (OFNOTIFY
*) lParam
;
470 hCombo
= GetDlgItem(hDlg
, ID_ENCODING
);
471 Globals
.iEncoding
= SendMessage(hCombo
, CB_GETCURSEL
, 0, 0);
478 VOID
DIALOG_FileSaveAs(VOID
)
481 WCHAR szDir
[MAX_PATH
];
482 WCHAR szPath
[MAX_PATH
];
483 static const WCHAR szDefaultExt
[] = { 't','x','t',0 };
484 static const WCHAR txt_files
[] = { '*','.','t','x','t',0 };
486 ZeroMemory(&saveas
, sizeof(saveas
));
488 GetCurrentDirectory(SIZEOF(szDir
), szDir
);
489 if (Globals
.szFileName
[0] == 0)
490 lstrcpy(szPath
, txt_files
);
492 lstrcpy(szPath
, Globals
.szFileName
);
494 saveas
.lStructSize
= sizeof(OPENFILENAME
);
495 saveas
.hwndOwner
= Globals
.hMainWnd
;
496 saveas
.hInstance
= Globals
.hInstance
;
497 saveas
.lpstrFilter
= Globals
.szFilter
;
498 saveas
.lpstrFile
= szPath
;
499 saveas
.nMaxFile
= SIZEOF(szPath
);
500 saveas
.lpstrInitialDir
= szDir
;
501 saveas
.Flags
= OFN_PATHMUSTEXIST
| OFN_OVERWRITEPROMPT
|
502 OFN_HIDEREADONLY
| OFN_EXPLORER
| OFN_ENABLETEMPLATE
| OFN_ENABLEHOOK
;
503 saveas
.lpstrDefExt
= szDefaultExt
;
504 saveas
.lpTemplateName
= MAKEINTRESOURCE(DIALOG_ENCODING
);
505 saveas
.lpfnHook
= DIALOG_FileSaveAs_Hook
;
507 if (GetSaveFileName(&saveas
)) {
509 UpdateWindowCaption();
514 VOID
DIALOG_FilePrint(VOID
)
519 int cWidthPels
, cHeightPels
, border
;
520 int xLeft
, yTop
, pagecount
, dopage
, copycount
;
523 HFONT font
, old_font
=0;
526 static const WCHAR times_new_romanW
[] = { 'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n',0 };
528 /* Get a small font and print some header info on each page */
529 hdrFont
.lfHeight
= 100;
531 hdrFont
.lfEscapement
= 0;
532 hdrFont
.lfOrientation
= 0;
533 hdrFont
.lfWeight
= FW_BOLD
;
534 hdrFont
.lfItalic
= 0;
535 hdrFont
.lfUnderline
= 0;
536 hdrFont
.lfStrikeOut
= 0;
537 hdrFont
.lfCharSet
= ANSI_CHARSET
;
538 hdrFont
.lfOutPrecision
= OUT_DEFAULT_PRECIS
;
539 hdrFont
.lfClipPrecision
= CLIP_DEFAULT_PRECIS
;
540 hdrFont
.lfQuality
= PROOF_QUALITY
;
541 hdrFont
.lfPitchAndFamily
= VARIABLE_PITCH
| FF_ROMAN
;
542 lstrcpy(hdrFont
.lfFaceName
, times_new_romanW
);
544 font
= CreateFontIndirect(&hdrFont
);
546 /* Get Current Settings */
547 ZeroMemory(&printer
, sizeof(printer
));
548 printer
.lStructSize
= sizeof(printer
);
549 printer
.hwndOwner
= Globals
.hMainWnd
;
550 printer
.hInstance
= Globals
.hInstance
;
552 /* Set some default flags */
553 printer
.Flags
= PD_RETURNDC
;
554 printer
.nFromPage
= 0;
555 printer
.nMinPage
= 1;
556 /* we really need to calculate number of pages to set nMaxPage and nToPage */
558 printer
.nMaxPage
= -1;
560 /* Let commdlg manage copy settings */
561 printer
.nCopies
= (WORD
)PD_USEDEVMODECOPIES
;
563 if (!PrintDlg(&printer
)) return;
565 assert(printer
.hDC
!= 0);
567 /* initialize DOCINFO */
568 di
.cbSize
= sizeof(DOCINFO
);
569 di
.lpszDocName
= Globals
.szFileTitle
;
570 di
.lpszOutput
= NULL
;
571 di
.lpszDatatype
= NULL
;
574 if (StartDoc(printer
.hDC
, &di
) <= 0) return;
576 /* Get the page dimensions in pixels. */
577 cWidthPels
= GetDeviceCaps(printer
.hDC
, HORZRES
);
578 cHeightPels
= GetDeviceCaps(printer
.hDC
, VERTRES
);
580 /* Get the file text */
581 size
= GetWindowTextLengthW(Globals
.hEdit
) + 1;
582 pTemp
= HeapAlloc(GetProcessHeap(), 0, size
* sizeof(WCHAR
));
588 size
= GetWindowTextW(Globals
.hEdit
, pTemp
, size
);
591 for (copycount
=1; copycount
<= printer
.nCopies
; copycount
++) {
595 static const WCHAR letterM
[] = { 'M',0 };
597 if (pagecount
>= printer
.nFromPage
&&
598 /* ((printer.Flags & PD_PAGENUMS) == 0 || pagecount <= printer.nToPage))*/
599 pagecount
<= printer
.nToPage
)
604 old_font
= SelectObject(printer
.hDC
, font
);
605 GetTextExtentPoint32(printer
.hDC
, letterM
, 1, &szMetric
);
608 if (StartPage(printer
.hDC
) <= 0) {
609 static const WCHAR failedW
[] = { 'S','t','a','r','t','P','a','g','e',' ','f','a','i','l','e','d',0 };
610 static const WCHAR errorW
[] = { 'P','r','i','n','t',' ','E','r','r','o','r',0 };
611 MessageBox(Globals
.hMainWnd
, failedW
, errorW
, MB_ICONEXCLAMATION
);
614 /* Write a rectangle and header at the top of each page */
615 Rectangle(printer
.hDC
, border
, border
, cWidthPels
-border
, border
+szMetric
.cy
*2);
616 /* I don't know what's up with this TextOut command. This comes out
619 TextOut(printer
.hDC
, border
*2, border
+szMetric
.cy
/2, Globals
.szFileTitle
, lstrlen(Globals
.szFileTitle
));
622 /* The starting point for the main text */
624 yTop
= border
+szMetric
.cy
*4;
626 SelectObject(printer
.hDC
, old_font
);
627 GetTextExtentPoint32(printer
.hDC
, letterM
, 1, &szMetric
);
629 /* Since outputting strings is giving me problems, output the main
630 text one character at a time.
633 if (pTemp
[i
] == '\n') {
637 else if (pTemp
[i
] != '\r') {
639 TextOut(printer
.hDC
, xLeft
, yTop
, &pTemp
[i
], 1);
640 xLeft
+= szMetric
.cx
;
642 } while (i
++<size
&& yTop
<(cHeightPels
-border
*2));
645 EndPage(printer
.hDC
);
651 DeleteDC(printer
.hDC
);
652 HeapFree(GetProcessHeap(), 0, pTemp
);
655 VOID
DIALOG_FilePrinterSetup(VOID
)
659 ZeroMemory(&printer
, sizeof(printer
));
660 printer
.lStructSize
= sizeof(printer
);
661 printer
.hwndOwner
= Globals
.hMainWnd
;
662 printer
.hInstance
= Globals
.hInstance
;
663 printer
.Flags
= PD_PRINTSETUP
;
669 VOID
DIALOG_FileExit(VOID
)
671 PostMessage(Globals
.hMainWnd
, WM_CLOSE
, 0, 0l);
674 VOID
DIALOG_EditUndo(VOID
)
676 SendMessage(Globals
.hEdit
, EM_UNDO
, 0, 0);
679 VOID
DIALOG_EditCut(VOID
)
681 SendMessage(Globals
.hEdit
, WM_CUT
, 0, 0);
684 VOID
DIALOG_EditCopy(VOID
)
686 SendMessage(Globals
.hEdit
, WM_COPY
, 0, 0);
689 VOID
DIALOG_EditPaste(VOID
)
691 SendMessage(Globals
.hEdit
, WM_PASTE
, 0, 0);
694 VOID
DIALOG_EditDelete(VOID
)
696 SendMessage(Globals
.hEdit
, WM_CLEAR
, 0, 0);
699 VOID
DIALOG_EditSelectAll(VOID
)
701 SendMessage(Globals
.hEdit
, EM_SETSEL
, 0, (LPARAM
)-1);
704 VOID
DIALOG_EditTimeDate(VOID
)
707 WCHAR szDate
[MAX_STRING_LEN
];
708 static const WCHAR spaceW
[] = { ' ',0 };
712 GetTimeFormat(LOCALE_USER_DEFAULT
, 0, &st
, NULL
, szDate
, MAX_STRING_LEN
);
713 SendMessage(Globals
.hEdit
, EM_REPLACESEL
, TRUE
, (LPARAM
)szDate
);
715 SendMessage(Globals
.hEdit
, EM_REPLACESEL
, TRUE
, (LPARAM
)spaceW
);
717 GetDateFormat(LOCALE_USER_DEFAULT
, DATE_LONGDATE
, &st
, NULL
, szDate
, MAX_STRING_LEN
);
718 SendMessage(Globals
.hEdit
, EM_REPLACESEL
, TRUE
, (LPARAM
)szDate
);
721 VOID
DIALOG_EditWrap(VOID
)
723 Globals
.bWrapLongLines
= !Globals
.bWrapLongLines
;
724 CheckMenuItem(GetMenu(Globals
.hMainWnd
), CMD_WRAP
,
725 MF_BYCOMMAND
| (Globals
.bWrapLongLines
? MF_CHECKED
: MF_UNCHECKED
));
728 VOID
DIALOG_SelectFont(VOID
)
731 LOGFONT lf
=Globals
.lfFont
;
733 ZeroMemory( &cf
, sizeof(cf
) );
734 cf
.lStructSize
=sizeof(cf
);
735 cf
.hwndOwner
=Globals
.hMainWnd
;
737 cf
.Flags
=CF_SCREENFONTS
;
739 if( ChooseFont(&cf
) )
741 HFONT currfont
=Globals
.hFont
;
743 Globals
.hFont
=CreateFontIndirect( &lf
);
745 SendMessage( Globals
.hEdit
, WM_SETFONT
, (WPARAM
)Globals
.hFont
, (LPARAM
)TRUE
);
747 DeleteObject( currfont
);
751 VOID
DIALOG_Search(VOID
)
753 ZeroMemory(&Globals
.find
, sizeof(Globals
.find
));
754 Globals
.find
.lStructSize
= sizeof(Globals
.find
);
755 Globals
.find
.hwndOwner
= Globals
.hMainWnd
;
756 Globals
.find
.hInstance
= Globals
.hInstance
;
757 Globals
.find
.lpstrFindWhat
= Globals
.szFindText
;
758 Globals
.find
.wFindWhatLen
= SIZEOF(Globals
.szFindText
);
759 Globals
.find
.Flags
= FR_DOWN
;
761 /* We only need to create the modal FindReplace dialog which will */
762 /* notify us of incoming events using hMainWnd Window Messages */
764 Globals
.hFindReplaceDlg
= FindText(&Globals
.find
);
765 assert(Globals
.hFindReplaceDlg
!=0);
768 VOID
DIALOG_SearchNext(VOID
)
770 /* FIXME: Search Next */
774 VOID
DIALOG_HelpContents(VOID
)
776 WinHelp(Globals
.hMainWnd
, helpfileW
, HELP_INDEX
, 0);
779 VOID
DIALOG_HelpSearch(VOID
)
784 VOID
DIALOG_HelpHelp(VOID
)
786 WinHelp(Globals
.hMainWnd
, helpfileW
, HELP_HELPONHELP
, 0);
789 VOID
DIALOG_HelpLicense(VOID
)
791 WineLicense(Globals
.hMainWnd
);
794 VOID
DIALOG_HelpNoWarranty(VOID
)
796 WineWarranty(Globals
.hMainWnd
);
799 VOID
DIALOG_HelpAboutWine(VOID
)
801 static const WCHAR notepadW
[] = { 'N','o','t','e','p','a','d','\n',0 };
802 WCHAR szNotepad
[MAX_STRING_LEN
];
804 LoadString(Globals
.hInstance
, STRING_NOTEPAD
, szNotepad
, SIZEOF(szNotepad
));
805 ShellAbout(Globals
.hMainWnd
, szNotepad
, notepadW
, 0);
809 /***********************************************************************
811 * DIALOG_FilePageSetup
813 VOID
DIALOG_FilePageSetup(void)
815 DialogBox(Globals
.hInstance
, MAKEINTRESOURCE(DIALOG_PAGESETUP
),
816 Globals
.hMainWnd
, DIALOG_PAGESETUP_DlgProc
);
820 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
822 * DIALOG_PAGESETUP_DlgProc
825 static INT_PTR WINAPI
DIALOG_PAGESETUP_DlgProc(HWND hDlg
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
834 /* save user input and close dialog */
835 GetDlgItemText(hDlg
, 0x141, Globals
.szHeader
, SIZEOF(Globals
.szHeader
));
836 GetDlgItemText(hDlg
, 0x143, Globals
.szFooter
, SIZEOF(Globals
.szFooter
));
837 GetDlgItemText(hDlg
, 0x14A, Globals
.szMarginTop
, SIZEOF(Globals
.szMarginTop
));
838 GetDlgItemText(hDlg
, 0x150, Globals
.szMarginBottom
, SIZEOF(Globals
.szMarginBottom
));
839 GetDlgItemText(hDlg
, 0x147, Globals
.szMarginLeft
, SIZEOF(Globals
.szMarginLeft
));
840 GetDlgItemText(hDlg
, 0x14D, Globals
.szMarginRight
, SIZEOF(Globals
.szMarginRight
));
841 EndDialog(hDlg
, IDOK
);
845 /* discard user input and close dialog */
846 EndDialog(hDlg
, IDCANCEL
);
851 /* FIXME: Bring this to work */
852 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 };
853 static const WCHAR helpW
[] = { 'H','e','l','p',0 };
854 MessageBox(Globals
.hMainWnd
, sorryW
, helpW
, MB_ICONEXCLAMATION
);
864 /* fetch last user input prior to display dialog */
865 SetDlgItemText(hDlg
, 0x141, Globals
.szHeader
);
866 SetDlgItemText(hDlg
, 0x143, Globals
.szFooter
);
867 SetDlgItemText(hDlg
, 0x14A, Globals
.szMarginTop
);
868 SetDlgItemText(hDlg
, 0x150, Globals
.szMarginBottom
);
869 SetDlgItemText(hDlg
, 0x147, Globals
.szMarginLeft
);
870 SetDlgItemText(hDlg
, 0x14D, Globals
.szMarginRight
);