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