Changeset 79
- Timestamp:
- May 31, 2001, 9:13:25 PM (24 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/helpers/dialog.h
r61 r79 72 72 * DLGHITEM. 73 73 * 74 *@@changed V0.9.12 (2001-05-31) [umoeller]: added control data 74 75 */ 75 76 … … 107 108 108 109 ULONG ulSpacing; // spacing around control 110 111 PVOID pvCtlData; // for WinCreateWindow 109 112 110 113 } CONTROLDEF, *PCONTROLDEF; -
trunk/src/helpers/dialog.c
r74 r79 103 103 104 104 HPS hps; 105 const char *pcszFontLast;106 LONG lcidLast; 105 /* const char *pcszFontLast; 106 LONG lcidLast; */ 107 107 } DLGPRIVATE, *PDLGPRIVATE; 108 108 … … 215 215 *@@ CalcAutoSizeText: 216 216 * 217 *@@changed V0.9.12 (2001-05-31) [umoeller]: fixed various things with statics 218 *@@changed V0.9.12 (2001-05-31) [umoeller]: fixed broken fonts 217 219 */ 218 220 … … 222 224 PDLGPRIVATE pDlgData) 223 225 { 224 BOOL fFind = TRUE;226 BOOL fFind = FALSE; 225 227 RECTL rclText; 228 LONG lcid = 0; 226 229 227 230 const char *pcszFontThis = pControlDef->pcszFont; … … 233 236 234 237 if (!pDlgData->hps) 235 {236 // first call: get a PS237 238 pDlgData->hps = WinGetPS(pDlgData->hwndDlg); 238 fFind = TRUE; 239 } 240 else 241 if (strhcmp(pcszFontThis, pDlgData->pcszFontLast)) 242 fFind = TRUE; 243 244 if (fFind) 239 240 if (pcszFontThis) 245 241 { 246 242 FONTMETRICS fm; 247 LONG lcid;248 243 LONG lPointSize = 0; 249 if (pDlgData->lcidLast)250 {251 // delete old font252 GpiSetCharSet(pDlgData->hps, LCID_DEFAULT);253 GpiDeleteSetId(pDlgData->hps, pDlgData->lcidLast);254 }255 244 256 245 // create new font 257 pDlgData->lcidLast= gpihFindPresFont(NULLHANDLE, // no window yet258 259 260 261 262 263 GpiSetCharSet(pDlgData->hps, pDlgData->lcidLast);246 lcid = gpihFindPresFont(NULLHANDLE, // no window yet 247 FALSE, 248 pDlgData->hps, 249 pcszFontThis, 250 &fm, 251 &lPointSize); 252 GpiSetCharSet(pDlgData->hps, lcid); 264 253 if (fm.fsDefn & FM_DEFN_OUTLINE) 265 254 gpihSetPointSize(pDlgData->hps, lPointSize); … … 275 264 if (fMultiLine) 276 265 { 277 RECTL rcl = {0, 0, 1000, 1000}; 266 RECTL rcl = {0, 0, 0, 0}; 267 if (pControlDef->szlControlProposed.cx != -1) 268 rcl.xRight = pControlDef->szlControlProposed.cx; // V0.9.12 (2001-05-31) [umoeller] 269 else 270 rcl.xRight = winhQueryScreenCX() * 2 / 3; 271 if (pControlDef->szlControlProposed.cy != -1) 272 rcl.yTop = pControlDef->szlControlProposed.cy; // V0.9.12 (2001-05-31) [umoeller] 273 else 274 rcl.yTop = winhQueryScreenCY() * 2 / 3; 275 278 276 winhDrawFormattedText(pDlgData->hps, 279 277 &rcl, … … 294 292 } 295 293 } 294 295 /* if (lcid) 296 { 297 GpiSetCharSet(pDlgData->hps, LCID_DEFAULT); 298 GpiDeleteSetId(pDlgData->hps, lcid); 299 } */ 300 296 301 } 297 302 … … 299 304 *@@ CalcAutoSize: 300 305 * 306 *@@changed V0.9.12 (2001-05-31) [umoeller]: fixed various things with statics 301 307 */ 302 308 … … 336 342 337 343 case 0xffff0005L: // WC_STATIC: 338 if ( pControlDef->flStyle &SS_TEXT)344 if ((pControlDef->flStyle & 0x0F) == SS_TEXT) 339 345 CalcAutoSizeText(pControlDef, 340 346 ((pControlDef->flStyle & DT_WORDBREAK) != 0), 341 347 pszlAuto, 342 348 pDlgData); 343 else if ( pControlDef->flStyle &SS_BITMAP)349 else if ((pControlDef->flStyle & 0x0F) == SS_BITMAP) 344 350 { 345 351 HBITMAP hbm = (HBITMAP)pControlDef->pcszText; … … 357 363 } 358 364 } 365 else if ((pControlDef->flStyle & 0x0F) == SS_ICON) 366 { 367 pszlAuto->cx = WinQuerySysValue(HWND_DESKTOP, SV_CXICON); 368 pszlAuto->cy = WinQuerySysValue(HWND_DESKTOP, SV_CYICON); 369 } 359 370 break; 360 371 } … … 397 408 * after the recursion. 398 409 * 410 *@@changed V0.9.12 (2001-05-31) [umoeller]: added control data 411 *@@changed V0.9.12 (2001-05-31) [umoeller]: fixed font problems 399 412 */ 400 413 … … 559 572 ULONG flStyle = 0; 560 573 LHANDLE lHandleSet = NULLHANDLE; 574 ULONG flOld = 0; 561 575 562 576 if (pColumnDef->fIsNestedTable) … … 594 608 // we have used a HBITMAP in there! 595 609 if ( ((ULONG)pControlDef->pcszClass == 0xffff0005L) // WC_STATIC: 596 && (flStyle & SS_BITMAP) 610 && ( ((flStyle & 0x0F) == SS_BITMAP) 611 || ((flStyle & 0x0F) == SS_ICON) 612 ) 597 613 ) 598 614 { 599 // change style flag to not use SS_BITMAP ;615 // change style flag to not use SS_BITMAP nor SS_ICON; 600 616 // control creation fails otherwise (stupid, stupid PM) 601 flStyle = ((flStyle & ~SS_BITMAP) | SS_FGNDFRAME); 617 flOld = flStyle; 618 flStyle = ((flStyle & ~0x0F) | SS_FGNDFRAME); 602 619 pcszTitle = ""; 603 620 lHandleSet = (LHANDLE)pControlDef->pcszText; … … 608 625 { 609 626 // create something: 610 PPRESPARAMS ppp = NULL;627 // PPRESPARAMS ppp = NULL; 611 628 612 629 const char *pcszFont = pControlDef->pcszFont; … … 615 632 pcszFont = pDlgData->pcszControlsFont; 616 633 617 if (pcszFont)634 /* if (pcszFont) 618 635 winhStorePresParam(&ppp, 619 636 PP_FONTNAMESIZE, 620 637 strlen(pcszFont), 621 (PVOID)pcszFont); 638 (PVOID)pcszFont); */ 622 639 623 640 pColumnDef->hwndControl … … 635 652 HWND_BOTTOM, 636 653 pControlDef->usID, 637 NULL, // @@todo control data638 ppp);639 640 if ( pColumnDef->hwndControl && lHandleSet)654 pControlDef->pvCtlData, 655 NULL); // ppp); 656 657 if ((pColumnDef->hwndControl) && (lHandleSet)) 641 658 { 642 659 // subclass the damn static 643 ctlPrepareStretchedBitmap(pColumnDef->hwndControl, 644 TRUE); 660 if ((flOld & 0x0F) == SS_ICON) 661 // this was a static: 662 ctlPrepareStaticIcon(pColumnDef->hwndControl, 663 1); 664 else 665 // this was a bitmap: 666 ctlPrepareStretchedBitmap(pColumnDef->hwndControl, 667 TRUE); 645 668 646 669 WinSendMsg(pColumnDef->hwndControl, … … 649 672 0); 650 673 } 651 652 if (ppp) 653 free(ppp); 674 else 675 if (pcszFont) 676 // we must set the font explicitly here... 677 // doesn't always work with WinCreateWindow 678 // presparams parameter, for some reason 679 // V0.9.12 (2001-05-31) [umoeller] 680 winhSetWindowFont(pColumnDef->hwndControl, 681 pcszFont); 654 682 655 683 if (pColumnDef->hwndControl) … … 1323 1351 1324 1352 FRAMECDATA fcData = {0}; 1353 ULONG flStyle = 0; 1325 1354 1326 1355 #define FCF_DIALOGBOX 0x40000000L … … 1328 1357 fcData.cb = sizeof(FRAMECDATA); 1329 1358 fcData.flCreateFlags = flCreateFlags | FCF_DIALOGBOX; 1359 1360 if (flCreateFlags & FCF_SIZEBORDER) 1361 // dialog has size border: 1362 // add "clip siblings" style 1363 flStyle |= WS_CLIPSIBLINGS; 1330 1364 1331 1365 pDlgData->hwndDlg = WinCreateWindow(HWND_DESKTOP, 1332 1366 WC_FRAME, 1333 1367 (PSZ)pcszDlgTitle, 1334 0,// style; invisible for now1368 flStyle, // style; invisible for now 1335 1369 0, 0, 0, 0, 1336 1370 hwndOwner, 1337 1371 HWND_TOP, 1338 0, 1372 0, // ID 1339 1373 &fcData, 1340 NULL); 1374 NULL); // presparams 1341 1375 1342 1376 if (!pDlgData->hwndDlg) … … 1357 1391 PROCESS_CALC_SIZES); 1358 1392 1359 // this might have created a HPS and a font in dlgdata1360 // for auto-sizing controls1361 1393 if (pDlgData->hps) 1362 {1363 if (pDlgData->lcidLast)1364 {1365 // delete old font1366 GpiSetCharSet(pDlgData->hps, LCID_DEFAULT);1367 GpiDeleteSetId(pDlgData->hps, pDlgData->lcidLast);1368 pDlgData->lcidLast = 0;1369 }1370 1371 1394 WinReleasePS(pDlgData->hps); 1372 pDlgData->hps = NULLHANDLE;1373 }1374 1395 1375 1396 WinSubclassWindow(pDlgData->hwndDlg, pfnwpDialogProc); … … 1649 1670 // control 1650 1671 1651 _Pmpf((__FUNCTION__ ": hwnd 0x%lX", hwnd));1672 // _Pmpf((__FUNCTION__ ": hwnd 0x%lX", hwnd)); 1652 1673 1653 1674 // check if this is a focusable control … … 1702 1723 if (!strcmp(szClass, "#3")) // button 1703 1724 { 1704 _Pmpf((__FUNCTION__ ": found button"));1725 // _Pmpf((__FUNCTION__ ": found button")); 1705 1726 if ( (WinQueryWindowULong(hwnd, QWL_STYLE) & (BS_PUSHBUTTON | BS_DEFAULT)) 1706 1727 == (BS_PUSHBUTTON | BS_DEFAULT) 1707 1728 ) 1708 1729 { 1709 _Pmpf((" is default!"));1730 // _Pmpf((" is default!")); 1710 1731 WinPostMsg(hwnd, 1711 1732 BM_CLICK, -
trunk/src/helpers/gpih.c
r70 r79 650 650 * See gpihLockLCIDs for how to serialize this. 651 651 * 652 * Code was extensively re-tested, works (V0.9.12 (2001-05-31) [umoeller]). 653 * 652 654 *@@added V0.9.3 (2000-05-06) [umoeller] 653 655 *@@changed V0.9.9 (2001-04-01) [umoeller]: removed all those sick sub-allocs … … 664 666 // of objects for which information 665 667 // can be returned 668 669 // _Pmpf((__FUNCTION__ ": Entering")); 670 666 671 if (lCount == 0) 672 { 667 673 // none in use yet: 668 lcidNext = 1; 674 lcidNext = 15; 675 676 // _Pmpf((" no lcids in use")); 677 } 669 678 else 670 679 { … … 688 697 // FINALLY we have all the lcids in use. 689 698 BOOL fContinue = TRUE; 690 lcidNext = 1; 699 lcidNext = 15; 700 701 // _Pmpf((" %d fonts in use, browsing...", lCount)); 691 702 692 703 // now, check if this lcid is in use already: … … 711 722 // lcid found: 712 723 // try next higher one 724 725 // _Pmpf((" %d is busy...", lcidNext)); 726 713 727 lcidNext++; 714 728 fContinue = TRUE; 715 729 } 716 // else: return that one 730 // else 731 // else: return that one 732 // _Pmpf((" %d is free", lcidNext)); 717 733 } 718 734 } … … 815 831 */ 816 832 } 833 834 // _Pmpf((__FUNCTION__ ": Returning lcid %d", lcidNext)); 817 835 818 836 return (lcidNext); … … 1189 1207 } 1190 1208 1209 _Pmpf((__FUNCTION__ ": returning lcid %d", lLCIDReturn)); 1210 1191 1211 return (lLCIDReturn); 1192 1212 } … … 1274 1294 } 1275 1295 } 1296 1276 1297 return (0); 1277 1298 }
Note:
See TracChangeset
for help on using the changeset viewer.