Changeset 108 for trunk/src/helpers/dialog.c
- Timestamp:
- Oct 13, 2001, 7:57:58 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/dialog.c
r106 r108 227 227 228 228 /* 229 *@@ CalcAutoSizeText: 230 * 231 *@@changed V0.9.12 (2001-05-31) [umoeller]: fixed various things with statics 232 *@@changed V0.9.12 (2001-05-31) [umoeller]: fixed broken fonts 233 *@@changed V0.9.14 (2001-08-01) [umoeller]: now caching fonts, which is significantly faster 234 */ 235 236 VOID CalcAutoSizeText(PCONTROLDEF pControlDef, 237 BOOL fMultiLine, // in: if TRUE, multiple lines 238 PSIZEL pszlAuto, // out: computed size 239 PDLGPRIVATE pDlgData) 240 { 229 *@@ SetDlgFont: 230 * 231 *@@added V0.9.16 (2001-10-11) [umoeller] 232 */ 233 234 VOID SetDlgFont(PCONTROLDEF pControlDef, 235 PDLGPRIVATE pDlgData) 236 { 237 LONG lPointSize = 0; 241 238 const char *pcszFontThis = pControlDef->pcszFont; 242 239 // can be NULL, … … 249 246 pDlgData->hps = WinGetPS(pDlgData->hwndDlg); 250 247 251 if (pcszFontThis) 252 { 253 LONG lPointSize = 0; 254 255 // check if we can reuse font data from last time 256 // V0.9.14 (2001-08-01) [umoeller] 257 if (strhcmp(pcszFontThis, 258 pDlgData->pcszFontLast)) 259 { 260 // different font than last time: 261 262 // delete old font? 263 if (pDlgData->lcidLast) 264 { 265 GpiSetCharSet(pDlgData->hps, LCID_DEFAULT); 266 GpiDeleteSetId(pDlgData->hps, pDlgData->lcidLast); 267 } 268 248 // check if we can reuse font data from last time 249 // V0.9.14 (2001-08-01) [umoeller] 250 if (strhcmp(pcszFontThis, // can be NULL! 251 pDlgData->pcszFontLast)) 252 { 253 // different font than last time: 254 255 // delete old font? 256 if (pDlgData->lcidLast) 257 { 258 GpiSetCharSet(pDlgData->hps, LCID_DEFAULT); // LCID_DEFAULT == 0 259 GpiDeleteSetId(pDlgData->hps, pDlgData->lcidLast); 260 } 261 262 if (pcszFontThis) 263 { 269 264 // create new font 270 265 pDlgData->lcidLast = gpihFindPresFont(NULLHANDLE, // no window yet … … 278 273 if (pDlgData->fmLast.fsDefn & FM_DEFN_OUTLINE) 279 274 gpihSetPointSize(pDlgData->hps, lPointSize); 280 281 pDlgData->pcszFontLast = pcszFontThis; 282 } 283 284 pszlAuto->cy = pDlgData->fmLast.lMaxBaselineExt 285 + pDlgData->fmLast.lExternalLeading; 286 } 275 } 276 else 277 { 278 // use default font: 279 // @@todo handle presparams, maybe inherited? 280 GpiSetCharSet(pDlgData->hps, LCID_DEFAULT); 281 GpiQueryFontMetrics(pDlgData->hps, 282 sizeof(pDlgData->fmLast), 283 &pDlgData->fmLast); 284 } 285 286 pDlgData->pcszFontLast = pcszFontThis; // can be NULL 287 } 288 } 289 290 /* 291 *@@ CalcAutoSizeText: 292 * 293 *@@changed V0.9.12 (2001-05-31) [umoeller]: fixed various things with statics 294 *@@changed V0.9.12 (2001-05-31) [umoeller]: fixed broken fonts 295 *@@changed V0.9.14 (2001-08-01) [umoeller]: now caching fonts, which is significantly faster 296 */ 297 298 VOID CalcAutoSizeText(PCONTROLDEF pControlDef, 299 BOOL fMultiLine, // in: if TRUE, multiple lines 300 PSIZEL pszlAuto, // out: computed size 301 PDLGPRIVATE pDlgData) 302 { 303 SetDlgFont(pControlDef, pDlgData); 304 305 pszlAuto->cy = pDlgData->fmLast.lMaxBaselineExt 306 + pDlgData->fmLast.lExternalLeading; 287 307 288 308 // ok, we FINALLY have a font now... … … 396 416 } 397 417 break; 418 419 default: 420 // any other control (just to be safe): 421 SetDlgFont(pControlDef, pDlgData); 422 pszlAuto->cx = 50; 423 pszlAuto->cy = pDlgData->fmLast.lMaxBaselineExt 424 + pDlgData->fmLast.lExternalLeading 425 + 5; // some space 398 426 } 399 427 } … … 566 594 LHANDLE lHandleSet = NULLHANDLE; 567 595 ULONG flOld = 0; 596 597 LONG y, cy; // for combo box hacks 568 598 569 599 if (pColumnDef->fIsNestedTable) … … 588 618 pcszTitle = pControlDef->pcszText; 589 619 flStyle = pControlDef->flStyle; 620 621 y = pcp->y + pDlgData->ptlTotalOfs.y; 622 cy = pcp->cy; 590 623 } 591 624 } … … 598 631 pcszTitle = pControlDef->pcszText; 599 632 flStyle = pControlDef->flStyle; 633 634 y = pcp->y + pDlgData->ptlTotalOfs.y; 635 cy = pcp->cy; 600 636 601 637 // change the title if this is a static with SS_BITMAP; … … 613 649 pcszTitle = ""; 614 650 lHandleSet = (LHANDLE)pControlDef->pcszText; 651 } 652 // hack the stupid drop-down combobox which doesn't 653 // expand otherwise (the size of the drop-down is 654 // the full size of the control... duh) 655 else if ( ((ULONG)pControlDef->pcszClass == 0xffff0002L) 656 && (flStyle & (CBS_DROPDOWN | CBS_DROPDOWNLIST)) 657 ) 658 { 659 y -= 100; 660 cy += 100; 615 661 } 616 662 } … … 640 686 flStyle, // hacked 641 687 pcp->x + pDlgData->ptlTotalOfs.x, 642 pcp->y + pDlgData->ptlTotalOfs.y,688 y, 643 689 pcp->cx, 644 pcp->cy,690 cy, 645 691 pDlgData->hwndDlg, // owner 646 692 HWND_BOTTOM,
Note:
See TracChangeset
for help on using the changeset viewer.