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

Last change on this file since 583 was 583, checked in by cbratschi, 26 years ago

added ODINWRAP support

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