- Timestamp:
- Jan 11, 2001, 7:05:02 PM (25 years ago)
- Location:
- trunk/src/comdlg32
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comdlg32/comdlg32.cpp
r4858 r4932 1 /* $Id: comdlg32.cpp,v 1.2 7 2000-12-30 13:43:57sandervl Exp $ */1 /* $Id: comdlg32.cpp,v 1.28 2001-01-11 18:05:02 sandervl Exp $ */ 2 2 3 3 /* … … 41 41 a->hwndOwner = Win32ToOS2Handle(a->hwndOwner); 42 42 43 /*****************************************************************************44 * Name :45 * Purpose :46 * Parameters:47 * Variables :48 * Result :49 * Remark :50 * Status :51 *52 * Author : Patrick Haller [Tue, 1998/02/10 01:55]53 *****************************************************************************/54 55 ODINFUNCTION1(BOOL, GetSaveFileNameA,56 LPOPENFILENAMEA, lpofn)57 {58 return GetFileDialog95A(lpofn, SAVE_DIALOG);59 }60 61 62 /*****************************************************************************63 * Name :64 * Purpose :65 * Parameters:66 * Variables :67 * Result :68 * Remark :69 * Status :70 *71 * Author : Patrick Haller [Tue, 1998/02/10 01:55]72 *****************************************************************************/73 74 ODINFUNCTION1(BOOL, GetSaveFileNameW,75 LPOPENFILENAMEW, lpofn)76 {77 return GetFileDialog95W(lpofn, SAVE_DIALOG);78 }79 80 /*****************************************************************************81 * Name :82 * Purpose :83 * Parameters:84 * Variables :85 * Result :86 * Remark :87 * Status :88 *89 * Author : Patrick Haller [Tue, 1998/02/10 01:55]90 *****************************************************************************/91 92 ODINFUNCTION1(BOOL, GetOpenFileNameA,93 LPOPENFILENAMEA, lpofn)94 {95 return GetFileDialog95A(lpofn, OPEN_DIALOG);96 }97 98 /*****************************************************************************99 * Name :100 * Purpose :101 * Parameters:102 * Variables :103 * Result :104 * Remark :105 * Status :106 *107 * Author : Patrick Haller [Tue, 1998/02/10 01:55]108 *****************************************************************************/109 110 ODINFUNCTION1(BOOL, GetOpenFileNameW,111 LPOPENFILENAMEW, lpofn)112 {113 return GetFileDialog95W(lpofn, OPEN_DIALOG);114 }115 116 #if 0117 /*****************************************************************************118 * Name :119 * Purpose :120 * Parameters:121 * Variables :122 * Result :123 * Remark :124 * Status :125 *126 * Author : Patrick Haller [Tue, 1998/02/10 01:55]127 *****************************************************************************/128 129 ODINFUNCTION3(INT16, GetFileTitleA32,130 LPCSTR, lpFile,131 LPSTR, lpTitle,132 UINT, cbBuf)133 {134 return O32_GetFileTitle(lpFile,135 lpTitle,136 cbBuf);137 }138 139 140 /*****************************************************************************141 * Name :142 * Purpose :143 * Parameters:144 * Variables :145 * Result :146 * Remark :147 * Status :148 *149 * Author : Patrick Haller [Tue, 1998/02/10 01:55]150 *****************************************************************************/151 152 ODINFUNCTION1(BOOL, ChooseColorA,153 LPCHOOSECOLORA, lpcc)154 {155 156 COMDLG32_CHECKHOOK(lpcc, CC_ENABLEHOOK, LPCCHOOKPROC)157 158 return O32_ChooseColor(lpcc);159 }160 161 162 /*****************************************************************************163 * Name :164 * Purpose :165 * Parameters:166 * Variables :167 * Result :168 * Remark : casting is a little hot, should work however169 * assuming lpcc->lpTemplateName is READONLY pointer!170 * Status :171 *172 * Author : Patrick Haller [Tue, 1998/02/10 01:55]173 *****************************************************************************/174 175 ODINFUNCTION1(BOOL, ChooseColorW,176 LPCHOOSECOLORW, lpcc)177 {178 BOOL bResult;179 LPCWSTR lpTemplateNameBackup = lpcc->lpTemplateName;180 181 // if no template is to convert, we can take this shortcut182 if (!(lpcc->Flags & CC_ENABLETEMPLATE))183 return O32_ChooseColor( (LPCHOOSECOLORA)lpcc );184 185 186 // convert to ASCII string187 if (lpcc->lpTemplateName != NULL)188 lpcc->lpTemplateName = (LPCWSTR)UnicodeToAsciiString((WCHAR*)lpcc->lpTemplateName);189 190 COMDLG32_CHECKHOOK(lpcc, CC_ENABLEHOOK, LPCCHOOKPROC)191 192 bResult = O32_ChooseColor((LPCHOOSECOLORA)lpcc); // call ASCII version193 194 // free temporary ASCII string and restore UNICODE string195 if (lpcc->lpTemplateName != NULL)196 {197 FreeAsciiString((char*)lpcc->lpTemplateName);198 lpcc->lpTemplateName = lpTemplateNameBackup;199 }200 201 return bResult;202 }203 204 205 /*****************************************************************************206 * Name :207 * Purpose :208 * Parameters:209 * Variables :210 * Result :211 * Remark :212 * Status :213 *214 * Author : Patrick Haller [Tue, 1998/02/10 01:55]215 *****************************************************************************/216 217 ODINFUNCTION1(BOOL, ChooseFontA,218 LPCHOOSEFONTA, lpcf)219 {220 221 COMDLG32_CHECKHOOK(lpcf, CF_ENABLEHOOK, WNDPROC)222 223 return O32_ChooseFont(lpcf);224 }225 226 227 /*****************************************************************************228 * Name :229 * Purpose :230 * Parameters:231 * Variables :232 * Result :233 * Remark : unknown yet, what is INPUT and what is OUTPUT string234 * Status :235 *236 * Author : Patrick Haller [Tue, 1998/02/10 01:55]237 * Edgar Buerkle [Mon, 1999/06/28 19:35]238 *****************************************************************************/239 240 ODINFUNCTION1(BOOL, ChooseFontW,241 LPCHOOSEFONTW, lpcf)242 {243 BOOL bResult;244 CHOOSEFONTA asciicf;245 LOGFONTA asciilf;246 char szAsciiStyle[64];247 248 // NOTE: LOGFONTW/A is NOT converted !249 dprintf(("COMDLG32: ChooseFontW not correctly implemented.\n"));250 251 if (!lpcf)252 {253 SetLastError(ERROR_INVALID_PARAMETER);254 255 return FALSE;256 }257 258 // convert to ASCII string259 memcpy(&asciicf, // make binary copy of CHOOSEFONTW260 lpcf, // to save the flags261 sizeof(asciicf));262 263 memcpy (&asciilf,264 lpcf->lpLogFont,265 sizeof(LOGFONTA));266 267 asciicf.lpLogFont = &asciilf; // update pointer268 269 // lpTemplatenName bug in open32 ? This doesn't work.270 // TODO: CF_ENABLETEMPLATEHANDLE271 if (lpcf->Flags & CF_ENABLETEMPLATE)272 if((int)asciicf.lpTemplateName >> 16 != 0)273 asciicf.lpTemplateName = UnicodeToAsciiString((LPWSTR)lpcf->lpTemplateName);274 275 //CB: NT's clock.exe traps here!276 if (lpcf->lpszStyle)277 {278 UnicodeToAsciiN(lpcf->lpszStyle,279 szAsciiStyle,280 sizeof(szAsciiStyle));281 282 asciicf.lpszStyle = szAsciiStyle;283 }284 285 UnicodeToAsciiN(lpcf->lpLogFont->lfFaceName,286 asciilf.lfFaceName,287 LF_FACESIZE-1);288 289 // LPCFHOOKPROC != WNDPROC ?290 COMDLG32_CHECKHOOK((&asciicf), CF_ENABLEHOOK, WNDPROC)291 292 // switch strings293 bResult = O32_ChooseFont((LPCHOOSEFONTA)&asciicf); // call ASCII version294 295 if (bResult)296 {297 // transfer BACK resulting strings !!!298 AsciiToUnicodeN(asciicf.lpLogFont->lfFaceName,299 lpcf->lpLogFont->lfFaceName,300 LF_FACESIZE-1);301 302 if (lpcf->lpszStyle) AsciiToUnicode(asciicf.lpszStyle,lpcf->lpszStyle);303 }304 305 if (lpcf->Flags & CF_ENABLETEMPLATE)306 if((int)asciicf.lpTemplateName >> 16 != 0)307 FreeAsciiString((char*)asciicf.lpTemplateName);308 309 // copy back fields310 lpcf->Flags = asciicf.Flags;311 312 return bResult;313 }314 315 316 /*****************************************************************************317 * Name :318 * Purpose :319 * Parameters:320 * Variables :321 * Result :322 * Remark :323 * Status :324 *325 * Author : Patrick Haller [Tue, 1998/02/10 01:55]326 *****************************************************************************/327 328 ODINFUNCTION0(DWORD, CommDlgExtendedError32)329 {330 return O32_CommDlgExtendedError();331 }332 333 /*****************************************************************************334 * Name :335 * Purpose :336 * Parameters:337 * Variables :338 * Result :339 * Remark :340 * Status :341 *342 * Author : Patrick Haller [Tue, 1998/02/10 01:55]343 *****************************************************************************/344 345 ODINFUNCTION1(HWND, FindTextA32,346 LPFINDREPLACEA, lpfr)347 {348 349 COMDLG32_CHECKHOOK(lpfr, FR_ENABLEHOOK, WNDPROC)350 351 return O32_FindText(lpfr);352 }353 354 355 /*****************************************************************************356 * Name :357 * Purpose :358 * Parameters:359 * Variables :360 * Result :361 * Remark :362 * Status :363 *364 * Author : Patrick Haller [Tue, 1998/02/10 01:55]365 *****************************************************************************/366 367 ODINFUNCTION1(HWND, FindTextW32,368 LPFINDREPLACEW, lpfr)369 {370 BOOL bResult;371 FINDREPLACEA fr;372 373 memcpy(&fr, // make binary copy first to save all the fields374 lpfr,375 sizeof(fr));376 377 // convert to ASCII string378 if ((lpfr->Flags & FR_ENABLETEMPLATE) &&379 (lpfr->lpTemplateName != NULL))380 fr.lpTemplateName = UnicodeToAsciiString((WCHAR*)lpfr->lpTemplateName);381 else382 fr.lpTemplateName = NULL;383 384 if (lpfr->lpstrFindWhat != NULL)385 fr.lpstrFindWhat = UnicodeToAsciiString((WCHAR*)lpfr->lpstrFindWhat);386 387 if (lpfr->lpstrReplaceWith != NULL)388 fr.lpstrReplaceWith = UnicodeToAsciiString((WCHAR*)lpfr->lpstrReplaceWith);389 390 391 COMDLG32_CHECKHOOK((&fr), FR_ENABLEHOOK, WNDPROC)392 393 bResult = O32_FindText(&fr); // call ASCII version394 395 // @@@PH: Note -- we might have to transfer BACK resulting strings !!!396 // free temporary ASCII string and restore UNICODE string397 if (fr.lpTemplateName != NULL)398 FreeAsciiString((char*)fr.lpTemplateName);399 400 // free temporary ASCII string and restore UNICODE string401 if (fr.lpstrFindWhat != NULL)402 {403 AsciiToUnicode(fr.lpstrFindWhat,404 lpfr->lpstrFindWhat);405 406 FreeAsciiString((char*)fr.lpstrFindWhat);407 }408 409 if (fr.lpstrReplaceWith != NULL)410 {411 AsciiToUnicode(fr.lpstrReplaceWith,412 lpfr->lpstrReplaceWith);413 414 FreeAsciiString((char*)fr.lpstrReplaceWith);415 }416 417 // copy back fields418 lpfr->Flags = fr.Flags;419 420 return bResult;421 }422 423 424 /*****************************************************************************425 * Name :426 * Purpose :427 * Parameters:428 * Variables :429 * Result :430 * Remark :431 * Status :432 *433 * Author : Patrick Haller [Tue, 1998/02/10 01:55]434 *****************************************************************************/435 436 ODINFUNCTION3(INT16, GetFileTitleW32,437 LPCWSTR, lpFile,438 LPWSTR, lpTitle,439 UINT, cbBuf)440 {441 LPSTR lpFileBackup;442 char szTitle[256];443 INT16 iResult;444 445 lpFileBackup = UnicodeToAsciiString((LPWSTR)lpFile);446 iResult = O32_GetFileTitle(lpFileBackup,447 szTitle,448 cbBuf);449 450 FreeAsciiString(lpFileBackup);451 452 // transform result into Unicode453 AsciiToUnicode(szTitle,454 lpTitle);455 456 return iResult;457 }458 #endif459 43 460 44 /***************************************************************************** … … 538 122 539 123 540 #if 0541 /*****************************************************************************542 * Name :543 * Purpose :544 * Parameters:545 * Variables :546 * Result :547 * Remark :548 * Status :549 *550 * Author : Patrick Haller [Tue, 1998/02/10 01:55]551 *****************************************************************************/552 553 ODINFUNCTION1(HWND, ReplaceTextA32,554 LPFINDREPLACEA, lpfr)555 {556 557 COMDLG32_CHECKHOOK(lpfr, FR_ENABLEHOOK, WNDPROC)558 559 return O32_ReplaceText(lpfr);560 }561 562 563 /*****************************************************************************564 * Name :565 * Purpose :566 * Parameters:567 * Variables :568 * Result :569 * Remark :570 * Status :571 *572 * Author : Patrick Haller [Tue, 1998/02/10 01:55]573 *****************************************************************************/574 575 ODINFUNCTION1(HWND, ReplaceTextW32,576 LPFINDREPLACEW, lpfr)577 {578 BOOL bResult;579 FINDREPLACEA fr;580 581 dprintf(("COMDLG32: ReplaceTextW(%08xh)\n",582 lpfr));583 584 memcpy(&fr, // make binary copy first to save all the fields585 lpfr,586 sizeof(fr));587 588 // convert to ASCII string589 if ((lpfr->Flags & FR_ENABLETEMPLATE) &&590 (lpfr->lpTemplateName != NULL))591 fr.lpTemplateName = UnicodeToAsciiString((WCHAR*)lpfr->lpTemplateName);592 else593 fr.lpTemplateName = NULL;594 595 if (lpfr->lpstrFindWhat != NULL)596 fr.lpstrFindWhat = UnicodeToAsciiString((WCHAR*)lpfr->lpstrFindWhat);597 598 if (lpfr->lpstrReplaceWith != NULL)599 fr.lpstrReplaceWith = UnicodeToAsciiString((WCHAR*)lpfr->lpstrReplaceWith);600 601 602 COMDLG32_CHECKHOOK((&fr), FR_ENABLEHOOK, WNDPROC)603 604 bResult = O32_ReplaceText(&fr); // call ASCII version605 606 // @@@PH: Note -- we might have to transfer BACK resulting strings !!!607 // free temporary ASCII string and restore UNICODE string608 if (fr.lpTemplateName != NULL)609 FreeAsciiString((char*)fr.lpTemplateName);610 611 // free temporary ASCII string and restore UNICODE string612 if (fr.lpstrFindWhat != NULL)613 {614 AsciiToUnicode(fr.lpstrFindWhat,615 lpfr->lpstrFindWhat);616 617 FreeAsciiString((char*)fr.lpstrFindWhat);618 }619 620 if (fr.lpstrReplaceWith != NULL)621 {622 AsciiToUnicode(fr.lpstrReplaceWith,623 lpfr->lpstrReplaceWith);624 625 FreeAsciiString((char*)fr.lpstrReplaceWith);626 }627 628 // copy back fields629 lpfr->Flags = fr.Flags;630 631 return bResult;632 }633 #endif634 635 124 /***************************************************************************** 636 125 * Name : -
trunk/src/comdlg32/makefile
r4717 r4932 1 # $Id: makefile,v 1.2 2 2000-12-02 23:37:20 birdExp $1 # $Id: makefile,v 1.23 2001-01-11 18:05:02 sandervl Exp $ 2 2 3 3 # … … 24 24 $(OBJDIR)\filetitle.obj \ 25 25 $(OBJDIR)\finddlg32.obj \ 26 $(OBJDIR)\filedlg.obj \ 26 27 $(OBJDIR)\filedlg95.obj \ 27 28 $(OBJDIR)\comdlg32.obj \
Note:
See TracChangeset
for help on using the changeset viewer.