4 * Copyright 1998 Marcel Baur <mbaur@g26.ethz.ch>
24 static LRESULT
DIALOG_PAGESETUP_DlgProc(HWND hDlg
, UINT msg
, WPARAM wParam
, LPARAM lParam
);
27 int AlertIDS(UINT ids_message
, UINT ids_caption
, WORD type
) {
29 * Given some ids strings, this acts as a language-aware wrapper for
32 CHAR szMessage
[MAX_STRING_LEN
];
33 CHAR szCaption
[MAX_STRING_LEN
];
35 LoadString(Globals
.hInstance
, ids_message
, szMessage
, sizeof(szMessage
));
36 LoadString(Globals
.hInstance
, ids_caption
, szCaption
, sizeof(szCaption
));
38 return (MessageBox(Globals
.hMainWnd
, szMessage
, szCaption
, type
));
41 void AlertFileNotFound(LPCSTR szFilename
) {
45 nResult
= AlertIDS(IDS_NOTFOUND
, IDS_ERROR
, 0);
49 VOID
AlertOutOfMemory(void) {
53 nResult
= AlertIDS(IDS_OUT_OF_MEMORY
, IDS_ERROR
, 0);
58 BOOL
ExistFile(LPCSTR szFilename
) {
60 * Returns: TRUE - if "szFileName" exists
61 * FALSE - if it does not
63 WIN32_FIND_DATA32A entry
;
66 handle
= FindFirstFile32A(szFilename
, &entry
);
68 return (handle
!=INVALID_HANDLE_VALUE32
);
71 VOID
DoSaveFile(VOID
) {
72 // Really Save the file
74 // ... (Globals.szFileName);
78 BOOL
DoCloseFile(void) {
79 // Return value: TRUE - User agreed to close (both save/don't save)
80 // FALSE - User cancelled close by selecting "Cancel"
82 CHAR szMessage
[MAX_STRING_LEN
];
83 CHAR szCaption
[MAX_STRING_LEN
];
87 if (strlen(Globals
.szFileName
)>0) {
89 // prompt user to save changes
91 // FIXME: The following resources are not yet in the .rc files
92 // szMessage, szCaption show up random values. Please keep these lines!
94 // LoadString(Globals.hInstance, ids_savechanges, szMessage, sizeof(szMessage));
95 // LoadString(Globals.hInstance, ids_savetitle, szCaption, sizeof(szCaption));
97 nResult
= MessageBox(Globals
.hMainWnd
, szMessage
, szCaption
, MB_YESNOCANCEL
);
100 case IDYES
: DoSaveFile();
103 case IDCANCEL
: return(FALSE
);
106 default: return(FALSE
);
115 lstrcpyn(Globals
.szFileName
, "\0", 1);
116 LANGUAGE_UpdateWindowCaption();
123 void DoOpenFile(LPCSTR szFileName
) {
125 // Close any files and prompt to save changes
129 lstrcpyn(Globals
.szFileName
, szFileName
, strlen(szFileName
)+1);
130 LANGUAGE_UpdateWindowCaption();
136 VOID
DIALOG_FileNew(VOID
)
138 // Close any files and promt to save changes
147 VOID
DIALOG_FileOpen(VOID
)
150 OPENFILENAME openfilename
;
151 CHAR szPath
[MAX_PATHNAME_LEN
];
152 CHAR szDir
[MAX_PATHNAME_LEN
];
153 CHAR szzFilter
[2 * MAX_STRING_LEN
+ 100];
156 LoadString(Globals
.hInstance
, IDS_TEXT_FILES_TXT
, p
, MAX_STRING_LEN
);
160 LoadString(Globals
.hInstance
, IDS_ALL_FILES
, p
, MAX_STRING_LEN
);
166 GetWindowsDirectory(szDir
, sizeof(szDir
));
168 openfilename
.lStructSize
= sizeof(openfilename
);
169 openfilename
.hwndOwner
= Globals
.hMainWnd
;
170 openfilename
.hInstance
= Globals
.hInstance
;
171 openfilename
.lpstrFilter
= szzFilter
;
172 openfilename
.lpstrCustomFilter
= 0;
173 openfilename
.nMaxCustFilter
= 0;
174 openfilename
.nFilterIndex
= 0;
175 openfilename
.lpstrFile
= szPath
;
176 openfilename
.nMaxFile
= sizeof(szPath
);
177 openfilename
.lpstrFileTitle
= 0;
178 openfilename
.nMaxFileTitle
= 0;
179 openfilename
.lpstrInitialDir
= szDir
;
180 openfilename
.lpstrTitle
= 0;
181 openfilename
.Flags
= 0;
182 openfilename
.nFileOffset
= 0;
183 openfilename
.nFileExtension
= 0;
184 openfilename
.lpstrDefExt
= 0;
185 openfilename
.lCustData
= 0;
186 openfilename
.lpfnHook
= 0;
187 openfilename
.lpTemplateName
= 0;
189 if (GetOpenFileName(&openfilename
)) {
191 if (ExistFile(openfilename
.lpstrFile
))
192 DoOpenFile(openfilename
.lpstrFile
);
194 AlertFileNotFound(openfilename
.lpstrFile
);
200 VOID
DIALOG_FileSave(VOID
)
202 fprintf(stderr
, "FileSave()\n");
205 VOID
DIALOG_FileSaveAs(VOID
)
208 CHAR szPath
[MAX_PATHNAME_LEN
];
209 CHAR szDir
[MAX_PATHNAME_LEN
];
210 CHAR szzFilter
[2 * MAX_STRING_LEN
+ 100];
213 LoadString(Globals
.hInstance
, IDS_TEXT_FILES_TXT
, p
, MAX_STRING_LEN
);
217 LoadString(Globals
.hInstance
, IDS_ALL_FILES
, p
, MAX_STRING_LEN
);
223 GetWindowsDirectory(szDir
, sizeof(szDir
));
225 saveas
.lStructSize
= 0;
226 saveas
.hwndOwner
= Globals
.hMainWnd
;
227 saveas
.hInstance
= Globals
.hInstance
;
228 saveas
.lpstrFilter
= szzFilter
;
229 saveas
.lpstrCustomFilter
= 0;
230 saveas
.nMaxCustFilter
= 0;
231 saveas
.nFilterIndex
= 0;
232 saveas
.lpstrFile
= szPath
;
233 saveas
.nMaxFile
= sizeof(szPath
);
234 saveas
.lpstrFileTitle
= 0;
235 saveas
.nMaxFileTitle
= 0;
236 saveas
.lpstrInitialDir
= szDir
;
237 saveas
.lpstrTitle
= 0;
239 saveas
.nFileOffset
= 0;
240 saveas
.nFileExtension
= 0;
241 saveas
.lpstrDefExt
= 0;
242 saveas
.lCustData
= 0;
244 saveas
.lpTemplateName
= 0;
246 if (GetSaveFileName(&saveas
)) {
247 lstrcpyn(Globals
.szFileName
, saveas
.lpstrFile
,
248 strlen(saveas
.lpstrFile
)+1);
249 LANGUAGE_UpdateWindowCaption();
254 VOID
DIALOG_FilePrint(VOID
)
257 printer
.lStructSize
= sizeof(printer
);
258 printer
.hwndOwner
= Globals
.hMainWnd
;
259 printer
.hInstance
= Globals
.hInstance
;
260 printer
.hDevMode
= 0;
261 printer
.hDevNames
= 0;
264 printer
.nFromPage
= 0;
266 printer
.nMinPage
= 0;
267 printer
.nMaxPage
= 0;
269 printer
.lCustData
= 0;
270 printer
.lpfnPrintHook
= 0;
271 printer
.lpfnSetupHook
= 0;
272 printer
.lpPrintTemplateName
= 0;
273 printer
.lpSetupTemplateName
= 0;
274 printer
.hPrintTemplate
= 0;
275 printer
.hSetupTemplate
= 0;
277 if (PrintDlg16(&printer
)) {
282 VOID
DIALOG_FilePageSetup(VOID
)
287 VOID
DIALOG_FilePrinterSetup(VOID
)
289 fprintf(stderr
, "FilePrinterSetup()\n");
292 VOID
DIALOG_FileExit(VOID
)
299 VOID
DIALOG_EditUndo(VOID
)
301 fprintf(stderr
, "EditUndo()\n");
304 VOID
DIALOG_EditCut(VOID
)
306 fprintf(stderr
, "EditCut()\n");
309 VOID
DIALOG_EditCopy(VOID
)
311 fprintf(stderr
, "EditCopy()\n");
314 VOID
DIALOG_EditPaste(VOID
)
316 fprintf(stderr
, "EditPaste()\n");
319 VOID
DIALOG_EditDelete(VOID
)
321 fprintf(stderr
, "EditDelete()\n");
324 VOID
DIALOG_EditSelectAll(VOID
)
326 fprintf(stderr
, "EditSelectAll()\n");
329 VOID
DIALOG_EditTimeDate(VOID
)
334 VOID
DIALOG_EditWrap(VOID
)
336 Globals
.bWrapLongLines
= !Globals
.bWrapLongLines
;
337 CheckMenuItem(Globals
.hEditMenu
, NP_EDIT_WRAP
, MF_BYCOMMAND
|
338 (Globals
.bWrapLongLines
? MF_CHECKED
: MF_UNCHECKED
));
341 VOID
DIALOG_Search(VOID
)
344 CHAR szFind
[MAX_PATHNAME_LEN
];
346 lstrcpyn(szFind
, Globals
.szFindText
, strlen(Globals
.szFindText
)+1);
348 find
.lStructSize
= sizeof(find
);
349 find
.hwndOwner
= Globals
.hMainWnd
;
350 find
.hInstance
= Globals
.hInstance
;
351 find
.lpstrFindWhat
= szFind
;
352 find
.wFindWhatLen
= sizeof(szFind
);
356 find
.lpTemplateName
= 0;
358 if (FindText(&find
)) {
359 lstrcpyn(Globals
.szFindText
, szFind
, strlen(szFind
)+1);
367 VOID
DIALOG_SearchNext(VOID
)
369 fprintf(stderr
, "SearchNext()\n");
372 VOID
DIALOG_HelpContents(VOID
)
374 WinHelp(Globals
.hMainWnd
, HELPFILE
, HELP_INDEX
, 0);
377 VOID
DIALOG_HelpSearch(VOID
)
379 fprintf(stderr
, "HelpSearch()\n");
382 VOID
DIALOG_HelpHelp(VOID
)
384 WinHelp(Globals
.hMainWnd
, HELPFILE
, HELP_HELPONHELP
, 0);
387 VOID
DIALOG_HelpLicense(VOID
)
389 WineLicense(Globals
.hMainWnd
, Globals
.lpszLanguage
);
392 VOID
DIALOG_HelpNoWarranty(VOID
)
394 WineWarranty(Globals
.hMainWnd
, Globals
.lpszLanguage
);
397 VOID
DIALOG_HelpAboutWine(VOID
)
399 ShellAbout(Globals
.hMainWnd
, "Notepad", "Notepad\n" WINE_RELEASE_INFO
, 0);
402 /***********************************************************************
407 VOID
DIALOG_PageSetup(VOID
)
409 WNDPROC lpfnDlg
= MakeProcInstance(DIALOG_PAGESETUP_DlgProc
, Globals
.hInstance
);
410 DialogBox(Globals
.hInstance
, STRING_PAGESETUP_Xx
, Globals
.hMainWnd
, lpfnDlg
);
411 FreeProcInstance(lpfnDlg
);
414 /***********************************************************************
419 VOID
DIALOG_TimeDate(VOID
)
421 // uses [KERNEL32.310] (ole2nls.c)
424 LPSYSTEMTIME lpst
= &st
;
425 CHAR szDate
[MAX_STRING_LEN
];
429 GetDateFormat(LOCALE_USER_DEFAULT
, LOCALE_SLONGDATE
, lpst
, NULL
, date
, MAX_STRING_LEN
);
431 printf("Date: %s\n", date
);
433 GetTimeFormat(LOCALE_USER_DEFAULT
, LOCALE_STIMEFORMAT
, lpst
, NULL
, date
, MAX_STRING_LEN
);
435 printf("Time: %s\n", date
);
439 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
441 * DIALOG_PAGESETUP_DlgProc
444 static LRESULT
DIALOG_PAGESETUP_DlgProc(HWND hDlg
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
452 EndDialog(hDlg
, IDOK
);
456 EndDialog(hDlg
, IDCANCEL
);
463 /* Local Variables: */
464 /* c-file-style: "GNU" */