source: trunk/src/comdlg32/comdlg32.cpp@ 1556

Last change on this file since 1556 was 1556, checked in by sandervl, 26 years ago

Wine 991031 update

File size: 24.5 KB
Line 
1/* $Id: comdlg32.cpp,v 1.17 1999-11-02 20:37:42 sandervl Exp $ */
2
3/*
4 * COMDLG32 implementation
5 *
6 * Copyright 1998 Sander van Leeuwen
7 * Copyright 1999 Patrick Haller
8 *
9 * Project Odin Software License can be found in LICENSE.TXT
10 *
11 */
12
13
14/****************************************************************************
15 * Includes *
16 ****************************************************************************/
17
18#include <os2win.h>
19#include <stdarg.h>
20#include <stdlib.h>
21#include <string.h>
22#include <misc.h>
23#include <odinwrap.h>
24#include <wndproc.h>
25#include <win32wnd.h>
26
27ODINDEBUGCHANNEL(COMDLG32)
28
29#if 0
30#define COMDLG32_CHECKHOOK(a,b,c) \
31 if(a->Flags & b) \
32 { \
33 wndproc = CreateWindowProc((WNDPROC)a->lpfnHook);\
34 if(wndproc == NULL) \
35 return(FALSE); \
36 \
37 a->lpfnHook = (c)Win32WindowProc::GetOS2Callback();\
38 } \
39 a->hwndOwner = Win32ToOS2Handle(a->hwndOwner);
40
41#define COMDLG32_CHECKHOOK2(a,b,c,d) \
42 if(a->Flags & b) \
43 { \
44 wndproc = CreateWindowProc((WNDPROC)a->d);\
45 if(wndproc == NULL) \
46 return(FALSE); \
47 \
48 a->d = (c)Win32WindowProc::GetOS2Callback();\
49 } \
50 a->hwndOwner = Win32ToOS2Handle(a->hwndOwner);
51#else
52#define COMDLG32_CHECKHOOK(a,b,c) \
53 if(a->Flags & b) \
54 { \
55 a->lpfnHook = 0; \
56 } \
57 a->hwndOwner = Win32ToOS2Handle(a->hwndOwner);
58
59#define COMDLG32_CHECKHOOK2(a,b,c,d) \
60 if(a->Flags & b) \
61 { \
62 a->d = 0; \
63 } \
64 a->hwndOwner = Win32ToOS2Handle(a->hwndOwner);
65#endif
66/*****************************************************************************
67 * Name :
68 * Purpose :
69 * Parameters:
70 * Variables :
71 * Result :
72 * Remark :
73 * Status :
74 *
75 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
76 *****************************************************************************/
77
78ODINFUNCTION1(BOOL, GetSaveFileNameA,
79 LPOPENFILENAMEA, lpofn)
80{
81 Win32WindowProc *wndproc;
82
83 if(lpofn->Flags & (OFN_ENABLETEMPLATE|OFN_ENABLETEMPLATEHANDLE)) {
84 return GetFileDialog95A(lpofn, SAVE_DIALOG);
85 }
86
87 COMDLG32_CHECKHOOK(lpofn, OFN_ENABLEHOOK, WNDPROC)
88
89 return(O32_GetSaveFileName(lpofn));
90}
91
92/*****************************************************************************
93 * Name :
94 * Purpose :
95 * Parameters:
96 * Variables :
97 * Result :
98 * Remark :
99 * Status :
100 *
101 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
102 *****************************************************************************/
103
104ODINFUNCTION1(BOOL, GetSaveFileNameW,
105 LPOPENFILENAMEW, lpofn)
106{
107 Win32WindowProc *wndproc;
108 OPENFILENAMEA ofn;
109 char* szFile;
110 char* szFileTitle;
111 char* szCustFilter;
112 BOOL bResult;
113
114 if(lpofn->Flags & (OFN_ENABLETEMPLATE|OFN_ENABLETEMPLATEHANDLE)) {
115 return GetFileDialog95W(lpofn, SAVE_DIALOG);
116 }
117
118 memcpy(&ofn, // make binary copy first to save all the fields
119 lpofn,
120 sizeof(ofn));
121
122 // convert to ASCII string
123 if ((lpofn->Flags && OFN_ENABLETEMPLATE) &&
124 (lpofn->lpTemplateName != NULL))
125 ofn.lpTemplateName = UnicodeToAsciiString((WCHAR*)lpofn->lpTemplateName);
126 else
127 ofn.lpTemplateName = NULL;
128
129 if (lpofn->lpstrFilter != NULL)
130 ofn.lpstrFilter = UnicodeToAsciiString((WCHAR*)lpofn->lpstrFilter);
131
132 if (lpofn->lpstrInitialDir != NULL)
133 ofn.lpstrInitialDir = UnicodeToAsciiString((WCHAR*)lpofn->lpstrInitialDir);
134
135 if (lpofn->lpstrTitle != NULL)
136 ofn.lpstrTitle = UnicodeToAsciiString((WCHAR*)lpofn->lpstrTitle);
137
138 if (lpofn->lpstrDefExt != NULL)
139 ofn.lpstrDefExt = UnicodeToAsciiString((WCHAR*)lpofn->lpstrDefExt);
140
141 szFile = (char*)malloc(lpofn->nMaxFile);
142 szFile[0] = 0;
143
144 if (*lpofn->lpstrFile != 0)
145 UnicodeToAscii(lpofn->lpstrFile,
146 szFile);
147
148 if (lpofn->lpstrFileTitle != NULL)
149 {
150 szFileTitle = (char*)malloc(lpofn->nMaxFileTitle);
151 szFileTitle[0] = 0;
152
153 if (*lpofn->lpstrFileTitle != 0)
154 UnicodeToAscii(lpofn->lpstrFileTitle,
155 szFileTitle);
156 }
157 else
158 szFileTitle = NULL;
159
160 if (lpofn->lpstrCustomFilter != NULL)
161 {
162 szCustFilter = (char*)malloc(lpofn->nMaxCustFilter);
163 szCustFilter[0] = 0;
164
165
166 if (*lpofn->lpstrCustomFilter != 0)
167 UnicodeToAscii(lpofn->lpstrCustomFilter,
168 szCustFilter);
169 }
170 else
171 szCustFilter = NULL;
172
173 ofn.lpstrFile = szFile;
174 ofn.lpstrFileTitle = szFileTitle;
175 ofn.lpstrCustomFilter = szCustFilter;
176
177 COMDLG32_CHECKHOOK((&ofn), OFN_ENABLEHOOK, WNDPROC)
178
179 bResult = O32_GetSaveFileName(&ofn);
180
181 if (ofn.lpTemplateName != NULL) FreeAsciiString((char*)ofn.lpTemplateName);
182 if (ofn.lpstrFilter != NULL) FreeAsciiString((char*)ofn.lpstrFilter);
183 if (ofn.lpstrInitialDir != NULL) FreeAsciiString((char*)ofn.lpstrInitialDir);
184 if (ofn.lpstrTitle != NULL) FreeAsciiString((char*)ofn.lpstrTitle);
185 if (ofn.lpstrDefExt != NULL) FreeAsciiString((char*)ofn.lpstrDefExt);
186
187 // transform back the result
188 AsciiToUnicode(ofn.lpstrFile,
189 lpofn->lpstrFile);
190 free(szFile);
191
192 if (lpofn->lpstrFileTitle != NULL)
193 {
194 AsciiToUnicode(ofn.lpstrFileTitle,
195 lpofn->lpstrFileTitle);
196 free(szFileTitle);
197 }
198
199 if (lpofn->lpstrCustomFilter != NULL)
200 {
201 AsciiToUnicode(ofn.lpstrCustomFilter,
202 lpofn->lpstrCustomFilter);
203 free(szCustFilter);
204 }
205
206 // copy over some altered flags
207 lpofn->nFilterIndex = ofn.nFilterIndex;
208 lpofn->Flags = ofn.Flags;
209 lpofn->nFileOffset = ofn.nFileOffset;
210 lpofn->nFileExtension = ofn.nFileExtension;
211
212 return bResult;
213}
214
215/*****************************************************************************
216 * Name :
217 * Purpose :
218 * Parameters:
219 * Variables :
220 * Result :
221 * Remark :
222 * Status :
223 *
224 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
225 *****************************************************************************/
226
227ODINFUNCTION1(BOOL, GetOpenFileNameA,
228 LPOPENFILENAMEA, lpofn)
229{
230 Win32WindowProc *wndproc;
231
232 if(lpofn->Flags & (OFN_ENABLETEMPLATE|OFN_ENABLETEMPLATEHANDLE)) {
233 return GetFileDialog95A(lpofn, OPEN_DIALOG);
234 }
235 COMDLG32_CHECKHOOK(lpofn, OFN_ENABLEHOOK, WNDPROC)
236
237 return(O32_GetOpenFileName(lpofn));
238}
239
240/*****************************************************************************
241 * Name :
242 * Purpose :
243 * Parameters:
244 * Variables :
245 * Result :
246 * Remark :
247 * Status :
248 *
249 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
250 *****************************************************************************/
251
252ODINFUNCTION1(BOOL, GetOpenFileNameW,
253 LPOPENFILENAMEW, lpofn)
254{
255 Win32WindowProc *wndproc;
256 OPENFILENAMEA ofn;
257 char* szFile;
258 char* szFileTitle;
259 char* szCustFilter;
260 BOOL bResult;
261
262 if(lpofn->Flags & (OFN_ENABLETEMPLATE|OFN_ENABLETEMPLATEHANDLE)) {
263 return GetFileDialog95W(lpofn, OPEN_DIALOG);
264 }
265
266 memcpy(&ofn, // make binary copy first to save all the fields
267 lpofn,
268 sizeof(ofn));
269
270 // convert to ASCII string
271 if ((lpofn->Flags && OFN_ENABLETEMPLATE) &&
272 (lpofn->lpTemplateName != NULL))
273 ofn.lpTemplateName = UnicodeToAsciiString((WCHAR*)lpofn->lpTemplateName);
274 else
275 ofn.lpTemplateName = NULL;
276
277 if (lpofn->lpstrFilter != NULL)
278 ofn.lpstrFilter = UnicodeToAsciiString((WCHAR*)lpofn->lpstrFilter);
279
280 if (lpofn->lpstrInitialDir != NULL)
281 ofn.lpstrInitialDir = UnicodeToAsciiString((WCHAR*)lpofn->lpstrInitialDir);
282
283 if (lpofn->lpstrTitle != NULL)
284 ofn.lpstrTitle = UnicodeToAsciiString((WCHAR*)lpofn->lpstrTitle);
285
286 if (lpofn->lpstrDefExt != NULL)
287 ofn.lpstrDefExt = UnicodeToAsciiString((WCHAR*)lpofn->lpstrDefExt);
288
289 szFile = (char*)malloc(lpofn->nMaxFile);
290 szFile[0] = 0;
291
292 if (*lpofn->lpstrFile != 0)
293 UnicodeToAscii(lpofn->lpstrFile,
294 szFile);
295
296 if (lpofn->lpstrFileTitle != NULL)
297 {
298 szFileTitle = (char*)malloc(lpofn->nMaxFileTitle);
299 szFileTitle[0] = 0;
300
301 if (*lpofn->lpstrFileTitle != 0)
302 UnicodeToAscii(lpofn->lpstrFileTitle,
303 szFileTitle);
304 }
305 else
306 szFileTitle = NULL;
307
308 if (lpofn->lpstrCustomFilter != NULL)
309 {
310 szCustFilter = (char*)malloc(lpofn->nMaxCustFilter);
311 szCustFilter[0] = 0;
312
313
314 if (*lpofn->lpstrCustomFilter != 0)
315 UnicodeToAscii(lpofn->lpstrCustomFilter,
316 szCustFilter);
317 }
318 else
319 szCustFilter = NULL;
320
321 ofn.lpstrFile = szFile;
322 ofn.lpstrFileTitle = szFileTitle;
323 ofn.lpstrCustomFilter = szCustFilter;
324
325 COMDLG32_CHECKHOOK((&ofn), OFN_ENABLEHOOK, WNDPROC)
326
327 bResult = O32_GetOpenFileName(&ofn);
328
329 if (ofn.lpTemplateName != NULL) FreeAsciiString((char*)ofn.lpTemplateName);
330 if (ofn.lpstrFilter != NULL) FreeAsciiString((char*)ofn.lpstrFilter);
331 if (ofn.lpstrInitialDir != NULL) FreeAsciiString((char*)ofn.lpstrInitialDir);
332 if (ofn.lpstrTitle != NULL) FreeAsciiString((char*)ofn.lpstrTitle);
333 if (ofn.lpstrDefExt != NULL) FreeAsciiString((char*)ofn.lpstrDefExt);
334
335 // transform back the result
336 AsciiToUnicode(ofn.lpstrFile,
337 lpofn->lpstrFile);
338 free(szFile);
339
340 if (lpofn->lpstrFileTitle != NULL)
341 {
342 AsciiToUnicode(ofn.lpstrFileTitle,
343 lpofn->lpstrFileTitle);
344 free(szFileTitle);
345 }
346
347 if (lpofn->lpstrCustomFilter != NULL)
348 {
349 AsciiToUnicode(ofn.lpstrCustomFilter,
350 lpofn->lpstrCustomFilter);
351 free(szCustFilter);
352 }
353
354 // copy over some altered flags
355 lpofn->nFilterIndex = ofn.nFilterIndex;
356 lpofn->Flags = ofn.Flags;
357 lpofn->nFileOffset = ofn.nFileOffset;
358 lpofn->nFileExtension = ofn.nFileExtension;
359
360 return bResult;
361}
362
363/*****************************************************************************
364 * Name :
365 * Purpose :
366 * Parameters:
367 * Variables :
368 * Result :
369 * Remark :
370 * Status :
371 *
372 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
373 *****************************************************************************/
374
375ODINFUNCTION3(INT16, GetFileTitleA32,
376 LPCSTR, lpFile,
377 LPSTR, lpTitle,
378 UINT, cbBuf)
379{
380 return O32_GetFileTitle(lpFile,
381 lpTitle,
382 cbBuf);
383}
384
385
386/*****************************************************************************
387 * Name :
388 * Purpose :
389 * Parameters:
390 * Variables :
391 * Result :
392 * Remark :
393 * Status :
394 *
395 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
396 *****************************************************************************/
397
398ODINFUNCTION1(BOOL, ChooseColorA,
399 LPCHOOSECOLORA, lpcc)
400{
401 Win32WindowProc *wndproc;
402
403 COMDLG32_CHECKHOOK(lpcc, CC_ENABLEHOOK, LPCCHOOKPROC)
404
405 return O32_ChooseColor(lpcc);
406}
407
408
409/*****************************************************************************
410 * Name :
411 * Purpose :
412 * Parameters:
413 * Variables :
414 * Result :
415 * Remark : casting is a little hot, should work however
416 * assuming lpcc->lpTemplateName is READONLY pointer!
417 * Status :
418 *
419 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
420 *****************************************************************************/
421
422ODINFUNCTION1(BOOL, ChooseColorW,
423 LPCHOOSECOLORW, lpcc)
424{
425 Win32WindowProc *wndproc;
426 BOOL bResult;
427 LPCWSTR lpTemplateNameBackup = lpcc->lpTemplateName;
428
429 // if no template is to convert, we can take this shortcut
430 if (!(lpcc->Flags & CC_ENABLETEMPLATE))
431 return O32_ChooseColor( (LPCHOOSECOLORA)lpcc );
432
433
434 // convert to ASCII string
435 if (lpcc->lpTemplateName != NULL)
436 lpcc->lpTemplateName = (LPCWSTR)UnicodeToAsciiString((WCHAR*)lpcc->lpTemplateName);
437
438 COMDLG32_CHECKHOOK(lpcc, CC_ENABLEHOOK, LPCCHOOKPROC)
439
440 bResult = O32_ChooseColor((LPCHOOSECOLORA)lpcc); // call ASCII version
441
442 // free temporary ASCII string and restore UNICODE string
443 if (lpcc->lpTemplateName != NULL)
444 {
445 FreeAsciiString((char*)lpcc->lpTemplateName);
446 lpcc->lpTemplateName = lpTemplateNameBackup;
447 }
448
449 return bResult;
450}
451
452
453/*****************************************************************************
454 * Name :
455 * Purpose :
456 * Parameters:
457 * Variables :
458 * Result :
459 * Remark :
460 * Status :
461 *
462 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
463 *****************************************************************************/
464
465ODINFUNCTION1(BOOL, ChooseFontA,
466 LPCHOOSEFONTA, lpcf)
467{
468 Win32WindowProc *wndproc;
469
470 COMDLG32_CHECKHOOK(lpcf, CF_ENABLEHOOK, WNDPROC)
471
472 return O32_ChooseFont(lpcf);
473}
474
475
476/*****************************************************************************
477 * Name :
478 * Purpose :
479 * Parameters:
480 * Variables :
481 * Result :
482 * Remark : unknown yet, what is INPUT and what is OUTPUT string
483 * Status :
484 *
485 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
486 * Edgar Buerkle [Mon, 1999/06/28 19:35]
487 *****************************************************************************/
488
489ODINFUNCTION1(BOOL, ChooseFontW,
490 LPCHOOSEFONTW, lpcf)
491{
492 Win32WindowProc *wndproc;
493 BOOL bResult;
494 CHOOSEFONTA asciicf;
495 LOGFONTA asciilf;
496 char szAsciiStyle[64];
497
498 // NOTE: LOGFONTW/A is NOT converted !
499 dprintf(("COMDLG32: ChooseFontW not correctly implemented.\n"));
500
501 if (!lpcf)
502 {
503 SetLastError(ERROR_INVALID_PARAMETER);
504
505 return FALSE;
506 }
507
508 // convert to ASCII string
509 memcpy(&asciicf, // make binary copy of CHOOSEFONTW
510 lpcf, // to save the flags
511 sizeof(asciicf));
512
513 memcpy (&asciilf,
514 lpcf->lpLogFont,
515 sizeof(LOGFONTA));
516
517 asciicf.lpLogFont = &asciilf; // update pointer
518
519 // lpTemplatenName bug in open32 ? This doesn't work.
520 // TODO: CF_ENABLETEMPLATEHANDLE
521 if (lpcf->Flags & CF_ENABLETEMPLATE)
522 if((int)asciicf.lpTemplateName >> 16 != 0)
523 asciicf.lpTemplateName = UnicodeToAsciiString((LPWSTR)lpcf->lpTemplateName);
524
525 //CB: NT's clock.exe traps here!
526 if (lpcf->lpszStyle)
527 {
528 UnicodeToAsciiN(lpcf->lpszStyle,
529 szAsciiStyle,
530 sizeof(szAsciiStyle));
531
532 asciicf.lpszStyle = szAsciiStyle;
533 }
534
535 UnicodeToAsciiN(lpcf->lpLogFont->lfFaceName,
536 asciilf.lfFaceName,
537 LF_FACESIZE-1);
538
539 // LPCFHOOKPROC != WNDPROC ?
540 COMDLG32_CHECKHOOK((&asciicf), CF_ENABLEHOOK, WNDPROC)
541
542 // switch strings
543 bResult = O32_ChooseFont((LPCHOOSEFONTA)&asciicf); // call ASCII version
544
545 if (bResult)
546 {
547 // transfer BACK resulting strings !!!
548 AsciiToUnicodeN(asciicf.lpLogFont->lfFaceName,
549 lpcf->lpLogFont->lfFaceName,
550 LF_FACESIZE-1);
551
552 if (lpcf->lpszStyle) AsciiToUnicode(asciicf.lpszStyle,lpcf->lpszStyle);
553 }
554
555 if (lpcf->Flags & CF_ENABLETEMPLATE)
556 if((int)asciicf.lpTemplateName >> 16 != 0)
557 FreeAsciiString((char*)asciicf.lpTemplateName);
558
559 // copy back fields
560 lpcf->Flags = asciicf.Flags;
561
562 return bResult;
563}
564
565
566/*****************************************************************************
567 * Name :
568 * Purpose :
569 * Parameters:
570 * Variables :
571 * Result :
572 * Remark :
573 * Status :
574 *
575 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
576 *****************************************************************************/
577
578ODINFUNCTION0(DWORD, CommDlgExtendedError32)
579{
580 return O32_CommDlgExtendedError();
581}
582
583
584/*****************************************************************************
585 * Name :
586 * Purpose :
587 * Parameters:
588 * Variables :
589 * Result :
590 * Remark :
591 * Status :
592 *
593 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
594 *****************************************************************************/
595
596ODINFUNCTION1(HWND, FindTextA32,
597 LPFINDREPLACEA, lpfr)
598{
599 Win32WindowProc *wndproc;
600
601 COMDLG32_CHECKHOOK(lpfr, FR_ENABLEHOOK, WNDPROC)
602
603 return O32_FindText(lpfr);
604}
605
606
607/*****************************************************************************
608 * Name :
609 * Purpose :
610 * Parameters:
611 * Variables :
612 * Result :
613 * Remark :
614 * Status :
615 *
616 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
617 *****************************************************************************/
618
619ODINFUNCTION1(HWND, FindTextW32,
620 LPFINDREPLACEW, lpfr)
621{
622 Win32WindowProc *wndproc;
623 BOOL bResult;
624 FINDREPLACEA fr;
625
626 memcpy(&fr, // make binary copy first to save all the fields
627 lpfr,
628 sizeof(fr));
629
630 // convert to ASCII string
631 if ((lpfr->Flags & FR_ENABLETEMPLATE) &&
632 (lpfr->lpTemplateName != NULL))
633 fr.lpTemplateName = UnicodeToAsciiString((WCHAR*)lpfr->lpTemplateName);
634 else
635 fr.lpTemplateName = NULL;
636
637 if (lpfr->lpstrFindWhat != NULL)
638 fr.lpstrFindWhat = UnicodeToAsciiString((WCHAR*)lpfr->lpstrFindWhat);
639
640 if (lpfr->lpstrReplaceWith != NULL)
641 fr.lpstrReplaceWith = UnicodeToAsciiString((WCHAR*)lpfr->lpstrReplaceWith);
642
643
644 COMDLG32_CHECKHOOK((&fr), FR_ENABLEHOOK, WNDPROC)
645
646 bResult = O32_FindText(&fr); // call ASCII version
647
648 // @@@PH: Note -- we might have to transfer BACK resulting strings !!!
649 // free temporary ASCII string and restore UNICODE string
650 if (fr.lpTemplateName != NULL)
651 FreeAsciiString((char*)fr.lpTemplateName);
652
653 // free temporary ASCII string and restore UNICODE string
654 if (fr.lpstrFindWhat != NULL)
655 {
656 AsciiToUnicode(fr.lpstrFindWhat,
657 lpfr->lpstrFindWhat);
658
659 FreeAsciiString((char*)fr.lpstrFindWhat);
660 }
661
662 if (fr.lpstrReplaceWith != NULL)
663 {
664 AsciiToUnicode(fr.lpstrReplaceWith,
665 lpfr->lpstrReplaceWith);
666
667 FreeAsciiString((char*)fr.lpstrReplaceWith);
668 }
669
670 // copy back fields
671 lpfr->Flags = fr.Flags;
672
673 return bResult;
674}
675
676
677/*****************************************************************************
678 * Name :
679 * Purpose :
680 * Parameters:
681 * Variables :
682 * Result :
683 * Remark :
684 * Status :
685 *
686 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
687 *****************************************************************************/
688
689ODINFUNCTION3(INT16, GetFileTitleW32,
690 LPCWSTR, lpFile,
691 LPWSTR, lpTitle,
692 UINT, cbBuf)
693{
694 LPSTR lpFileBackup;
695 char szTitle[256];
696 INT16 iResult;
697
698 lpFileBackup = UnicodeToAsciiString((LPWSTR)lpFile);
699 iResult = O32_GetFileTitle(lpFileBackup,
700 szTitle,
701 cbBuf);
702
703 FreeAsciiString(lpFileBackup);
704
705 // transform result into Unicode
706 AsciiToUnicode(szTitle,
707 lpTitle);
708
709 return iResult;
710}
711
712/*****************************************************************************
713 * Name :
714 * Purpose :
715 * Parameters:
716 * Variables :
717 * Result :
718 * Remark :
719 * Status :
720 *
721 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
722 *****************************************************************************/
723
724ODINFUNCTION1(BOOL, PrintDlgA,
725 LPPRINTDLGA, lppd)
726{
727 Win32WindowProc *wndproc;
728
729 COMDLG32_CHECKHOOK2(lppd, PD_ENABLEPRINTHOOK, LPPRINTHOOKPROC,lpfnPrintHook)
730 COMDLG32_CHECKHOOK2(lppd, PD_ENABLESETUPHOOK, LPSETUPHOOKPROC,lpfnSetupHook)
731
732 return O32_PrintDlg(lppd);
733}
734
735
736/*****************************************************************************
737 * Name :
738 * Purpose :
739 * Parameters:
740 * Variables :
741 * Result :
742 * Remark :
743 * Status :
744 *
745 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
746 *****************************************************************************/
747
748ODINFUNCTION1(BOOL, PrintDlgW,
749 LPPRINTDLGW, lppd)
750{
751 Win32WindowProc *wndproc;
752
753 PRINTDLGA pd;
754 BOOL bResult;
755
756 memcpy(&pd, // make binary copy first to save all the fields
757 lppd,
758 sizeof(pd));
759
760 // convert to ASCII string
761 if ((lppd->Flags & PD_ENABLEPRINTTEMPLATE) &&
762 (lppd->lpPrintTemplateName != NULL))
763 pd.lpPrintTemplateName = UnicodeToAsciiString((WCHAR*)lppd->lpPrintTemplateName);
764 else
765 pd.lpPrintTemplateName = NULL;
766
767 if ((lppd->Flags & PD_ENABLESETUPTEMPLATE) &&
768 (lppd->lpSetupTemplateName != NULL))
769 pd.lpSetupTemplateName = UnicodeToAsciiString((WCHAR*)lppd->lpSetupTemplateName);
770 else
771 pd.lpSetupTemplateName = NULL;
772
773 COMDLG32_CHECKHOOK2((&pd), PD_ENABLEPRINTHOOK, LPPRINTHOOKPROC,lpfnPrintHook)
774 COMDLG32_CHECKHOOK2((&pd), PD_ENABLESETUPHOOK, LPSETUPHOOKPROC,lpfnSetupHook)
775
776 bResult = O32_PrintDlg(&pd); // call ASCII API
777
778 if (pd.lpPrintTemplateName != NULL) FreeAsciiString((char*)pd.lpPrintTemplateName);
779 if (pd.lpSetupTemplateName != NULL) FreeAsciiString((char*)pd.lpSetupTemplateName);
780
781 // copy back result
782 lppd->Flags = pd.Flags;
783 lppd->nFromPage = pd.nFromPage;
784 lppd->nToPage = pd.nToPage;
785 lppd->nMinPage = pd.nMinPage;
786 lppd->nMaxPage = pd.nMaxPage;
787 lppd->nCopies = pd.nCopies;
788 //@@@PH: all pass-back fields ?
789
790 return bResult;
791}
792
793
794/*****************************************************************************
795 * Name :
796 * Purpose :
797 * Parameters:
798 * Variables :
799 * Result :
800 * Remark :
801 * Status :
802 *
803 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
804 *****************************************************************************/
805
806ODINFUNCTION1(HWND, ReplaceTextA32,
807 LPFINDREPLACEA, lpfr)
808{
809 Win32WindowProc *wndproc;
810
811 COMDLG32_CHECKHOOK(lpfr, FR_ENABLEHOOK, WNDPROC)
812
813 return O32_ReplaceText(lpfr);
814}
815
816
817/*****************************************************************************
818 * Name :
819 * Purpose :
820 * Parameters:
821 * Variables :
822 * Result :
823 * Remark :
824 * Status :
825 *
826 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
827 *****************************************************************************/
828
829ODINFUNCTION1(HWND, ReplaceTextW32,
830 LPFINDREPLACEW, lpfr)
831{
832 Win32WindowProc *wndproc;
833 BOOL bResult;
834 FINDREPLACEA fr;
835
836 dprintf(("COMDLG32: ReplaceTextW(%08xh)\n",
837 lpfr));
838
839 memcpy(&fr, // make binary copy first to save all the fields
840 lpfr,
841 sizeof(fr));
842
843 // convert to ASCII string
844 if ((lpfr->Flags & FR_ENABLETEMPLATE) &&
845 (lpfr->lpTemplateName != NULL))
846 fr.lpTemplateName = UnicodeToAsciiString((WCHAR*)lpfr->lpTemplateName);
847 else
848 fr.lpTemplateName = NULL;
849
850 if (lpfr->lpstrFindWhat != NULL)
851 fr.lpstrFindWhat = UnicodeToAsciiString((WCHAR*)lpfr->lpstrFindWhat);
852
853 if (lpfr->lpstrReplaceWith != NULL)
854 fr.lpstrReplaceWith = UnicodeToAsciiString((WCHAR*)lpfr->lpstrReplaceWith);
855
856
857 COMDLG32_CHECKHOOK((&fr), FR_ENABLEHOOK, WNDPROC)
858
859 bResult = O32_ReplaceText(&fr); // call ASCII version
860
861 // @@@PH: Note -- we might have to transfer BACK resulting strings !!!
862 // free temporary ASCII string and restore UNICODE string
863 if (fr.lpTemplateName != NULL)
864 FreeAsciiString((char*)fr.lpTemplateName);
865
866 // free temporary ASCII string and restore UNICODE string
867 if (fr.lpstrFindWhat != NULL)
868 {
869 AsciiToUnicode(fr.lpstrFindWhat,
870 lpfr->lpstrFindWhat);
871
872 FreeAsciiString((char*)fr.lpstrFindWhat);
873 }
874
875 if (fr.lpstrReplaceWith != NULL)
876 {
877 AsciiToUnicode(fr.lpstrReplaceWith,
878 lpfr->lpstrReplaceWith);
879
880 FreeAsciiString((char*)fr.lpstrReplaceWith);
881 }
882
883 // copy back fields
884 lpfr->Flags = fr.Flags;
885
886 return bResult;
887}
888
889
890/*****************************************************************************
891 * Name :
892 * Purpose :
893 * Parameters:
894 * Variables :
895 * Result :
896 * Remark :
897 * Status :
898 *
899 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
900 *****************************************************************************/
901
902ODINFUNCTION1(BOOL, PageSetupDlgA,
903 LPPAGESETUPDLGA, lppsd)
904{
905 Win32WindowProc *wndproc;
906
907 dprintf(("COMDLG32: PageSetupDlgA not implemented.\n"));
908
909 //COMDLG32_CHECKHOOK2(lppsd, PSD_ENABLESETUPHOOK, LPPAGESETUPHOOK, lpfnPageSetupHook)
910
911 return(FALSE);
912}
913
914
915/*****************************************************************************
916 * Name :
917 * Purpose :
918 * Parameters:
919 * Variables :
920 * Result :
921 * Remark :
922 * Status :
923 *
924 * Author : Patrick Haller [Tue, 1998/02/10 01:55]
925 *****************************************************************************/
926
927ODINFUNCTION1(BOOL, PageSetupDlgW,
928 LPPAGESETUPDLGW, lppsd)
929{
930 Win32WindowProc *wndproc;
931
932 dprintf(("COMDLG32: PageSetupDlgW(%08xh) not implemented.\n"));
933
934 //COMDLG32_CHECKHOOK2(lppsd, PSD_ENABLESETUPHOOK, LPPAGESETUPHOOK, lpfnPageSetupHook)
935
936 return(FALSE);
937}
938
Note: See TracBrowser for help on using the repository browser.