- Timestamp:
- Apr 17, 2002, 10:11:38 PM (23 years ago)
- Location:
- trunk/src/helpers
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/dialog.c
r153 r155 46 46 #define INCL_WINWINDOWMGR 47 47 #define INCL_WINFRAMEMGR 48 #define INCL_WINPOINTERS 49 #define INCL_WININPUT 48 50 #define INCL_WINDIALOGS 49 #define INCL_WININPUT50 51 #define INCL_WINSTATICS 51 52 #define INCL_WINBUTTONS … … 123 124 LONG lcidLast; 124 125 FONTMETRICS fmLast; 126 127 LONG cxBorder, 128 cyBorder; // cached now V0.9.19 (2002-04-17) [umoeller] 125 129 126 130 } DLGPRIVATE, *PDLGPRIVATE; … … 409 413 else if (!(pControlDef->flStyle & BS_USERBUTTON)) 410 414 { 411 pszlAuto->cx += (2 * WinQuerySysValue(HWND_DESKTOP, SV_CXBORDER)+ 15);412 pszlAuto->cy += (2 * WinQuerySysValue(HWND_DESKTOP, SV_CYBORDER)+ 15);415 pszlAuto->cx += (2 * pDlgData->cxBorder + 15); 416 pszlAuto->cy += (2 * pDlgData->cyBorder + 15); 413 417 } 414 418 } … … 477 481 PDLGPRIVATE pDlgData) 478 482 { 479 APIRET arc = NO_ERROR;480 483 APIRET arc = NO_ERROR; 484 PCONTROLDEF pControlDef = NULL; 481 485 ULONG ulExtraCX = 0, 482 486 ulExtraCY = 0; 487 483 488 if (pColumnDef->fIsNestedTable) 484 489 { … … 519 524 { 520 525 // no nested table, but control: 521 PCONTROLDEF pControlDef = (PCONTROLDEF)pColumnDef->pvDefinition;522 526 SIZEL szlAuto; 527 528 pControlDef = (PCONTROLDEF)pColumnDef->pvDefinition; 523 529 524 530 // do auto-size calculations only on the first loop … … 576 582 } // end if (ProcessMode == PROCESS_1_CALC_SIZES) 577 583 578 579 584 ulExtraCX 580 585 = ulExtraCY … … 586 591 pColumnDef->cpColumn.cy = pColumnDef->cpControl.cy 587 592 + ulExtraCY; 593 594 if ( (pControlDef) 595 && ((ULONG)pControlDef->pcszClass == 0xffff0002L) 596 ) 597 { 598 // hack the stupid drop-down combobox where the 599 // size of the drop-down is the full size of the 600 // control: when creating the control, we _do_ 601 // specify the full size, but for the column, 602 // we must rather use a single line with 603 // the current font 604 // V0.9.19 (2002-04-17) [umoeller] 605 if (pControlDef->flStyle & (CBS_DROPDOWN | CBS_DROPDOWNLIST)) 606 { 607 LONG cyMargin = 3 * pDlgData->cyBorder; 608 609 SetDlgFont(pControlDef, pDlgData); 610 611 pColumnDef->cpColumn.cy 612 = pDlgData->fmLast.lMaxBaselineExt 613 + pDlgData->fmLast.lExternalLeading 614 + 2 * cyMargin 615 + ulExtraCY; 616 } 617 } 588 618 589 619 return (arc); … … 802 832 803 833 case 0xffff0002L: // combobox 804 // hack the stupid drop-down combobox which doesn't 805 // expand otherwise (the size of the drop-down is 806 // the full size of the control... duh) 834 { 807 835 if (flStyle & (CBS_DROPDOWN | CBS_DROPDOWNLIST)) 808 836 { 809 y -= 100; 810 cy += 100; 837 // in ColumnCalcSizes, we have set pColumnDef->cpColumn.cy 838 // to the height of a single line to get the position 839 // calculations right... 840 // present cy is pColumnDef->cpControl.cy, 841 // the user-specified size of the expanded combo 842 // present y is the bottom of the combo's entry field 843 ULONG cyDelta = pColumnDef->cpControl.cy - pColumnDef->cpColumn.cy; 844 _Pmpf((__FUNCTION__ ": combo cpColumn.cy = %d, cpControl.cy = %d", 845 pColumnDef->cpColumn.cy, 846 pColumnDef->cpControl.cy)); 847 _Pmpf((" cyDelta = %d", cyDelta)); 848 y -= cyDelta + 3 * pDlgData->cyBorder + pControlDef->ulSpacing; 849 // cy += cyDelta; 811 850 } 851 } 812 852 break; 813 853 … … 819 859 if (flStyle & ES_MARGIN) 820 860 { 821 LONG cxMargin = 3 * WinQuerySysValue(HWND_DESKTOP, SV_CXBORDER);822 LONG cyMargin = 3 * WinQuerySysValue(HWND_DESKTOP, SV_CYBORDER);861 LONG cxMargin = 3 * pDlgData->cxBorder; 862 LONG cyMargin = 3 * pDlgData->cyBorder; 823 863 824 864 x += cxMargin; … … 877 917 NULL, 878 918 NULL); 919 winhSetPresColor(hwndDebug, PP_FOREGROUNDCOLOR, RGBCOL_DARKGREEN); 920 921 /* 922 // and another one for the control size 923 hwndDebug = 924 WinCreateWindow(pDlgData->hwndDlg, // parent 925 WC_STATIC, 926 "", 927 WS_VISIBLE | SS_FGNDFRAME, 928 pColumnDef->cpControl.x + pDlgData->ptlTotalOfs.x, 929 pColumnDef->cpControl.y + pDlgData->ptlTotalOfs.y, 930 pColumnDef->cpControl.cx, 931 pColumnDef->cpControl.cy, 932 pDlgData->hwndDlg, // owner 933 HWND_BOTTOM, 934 -1, 935 NULL, 936 NULL); 879 937 winhSetPresColor(hwndDebug, PP_FOREGROUNDCOLOR, RGBCOL_RED); 938 */ 880 939 } 881 940 #endif … … 1472 1531 1473 1532 pDlgData->pcszControlsFont = pcszControlsFont; 1533 1534 // cache these now too V0.9.19 (2002-04-17) [umoeller] 1535 pDlgData->cxBorder = WinQuerySysValue(HWND_DESKTOP, SV_CXBORDER); 1536 pDlgData->cyBorder = WinQuerySysValue(HWND_DESKTOP, SV_CYBORDER); 1474 1537 1475 1538 *ppDlgData = pDlgData; … … 1799 1862 * A regular standard dialog would use something like 1800 1863 * 1801 + FCF_TITLEBAR | FCF_SYSMENU | FCF_DLGBORDER | FCF_NOBYTEALIGN 1864 + FCF_TITLEBAR | FCF_SYSMENU | FCF_DLGBORDER | FCF_NOBYTEALIGN | FCF_CLOSEBUTTON 1802 1865 * 1803 1866 * for flCreateFlags. To make the dlg sizeable, specify 1804 1867 * FCF_SIZEBORDER instead of FCF_DLGBORDER. 1868 * 1869 * dialog.h defines FCF_FIXED_DLG and FCF_SIZEABLE_DLG 1870 * to make this more handy. 1805 1871 * 1806 1872 * <B>Usage:</B> -
trunk/src/helpers/encodings.c
r154 r155 44 44 45 45 #pragma hdrstop 46 47 /* 48 *@@category: Helpers\National Language Support\Encodings 49 * See encodings.c. 50 */ 46 51 47 52 /* -
trunk/src/helpers/helpers_pre.in
r137 r155 43 43 $(OUTPUTDIR)\linklist.obj \ 44 44 $(OUTPUTDIR)\math.obj \ 45 $(OUTPUTDIR)\regexp.obj \ 45 46 $(OUTPUTDIR)\tree.obj \ 46 47 $(OUTPUTDIR)\xml.obj \ -
trunk/src/helpers/nls.c
r147 r155 66 66 67 67 /* 68 *@@category: Helpers\ C helpers\National Language Support69 * See stringh.c and xstring.c.68 *@@category: Helpers\National Language Support 69 * See nls.c. 70 70 */ 71 71 -
trunk/src/helpers/prfh.c
r153 r155 89 89 * 90 90 *@@changed V0.9.12 (2001-05-12) [umoeller]: changed prototypes to return APIRET now 91 *@@changed V0.9.19 (2002-04-11) [pr]: Fixed app. with no keys 91 92 */ 92 93 … … 100 101 101 102 // get size of keys list for pszApp 102 if ( (!PrfQueryProfileSize(hIni, (PSZ)pcszApp, NULL, &ulSizeOfKeysList)) 103 || (ulSizeOfKeysList == 0) 104 ) 103 if (!PrfQueryProfileSize(hIni, (PSZ)pcszApp, NULL, &ulSizeOfKeysList)) 105 104 arc = PRFERR_KEYSLIST; 106 105 else 107 106 { 108 pKeys = (PSZ)malloc(ulSizeOfKeysList); 109 if (!pKeys) 107 if (ulSizeOfKeysList == 0) 108 ulSizeOfKeysList = 1; // V0.9.19 (2002-04-11) [pr] 109 110 if (!(pKeys = (PSZ)malloc(ulSizeOfKeysList))) 110 111 arc = ERROR_NOT_ENOUGH_MEMORY; 111 112 else 113 { 114 *pKeys = 0; 112 115 if (!PrfQueryProfileData(hIni, (PSZ)pcszApp, NULL, pKeys, &ulSizeOfKeysList)) 113 116 arc = PRFERR_KEYSLIST; 117 } 114 118 } 115 119 -
trunk/src/helpers/winh.c
r154 r155 2563 2563 2564 2564 /* 2565 *@@ winhPlaceBesides: 2566 * attempts to place hwnd somewhere besides 2567 * hwndRelative. 2568 * 2569 * fl is presently ignored, but should be 2570 * PLF_SMART for future extensions. 2571 * 2572 * Works only if hwnd is a desktop child. 2573 * 2574 *@@added V0.9.19 (2002-04-17) [umoeller] 2575 */ 2576 2577 BOOL winhPlaceBesides(HWND hwnd, 2578 HWND hwndRelative, 2579 ULONG fl) 2580 { 2581 BOOL brc = FALSE; 2582 2583 SWP swpRel, 2584 swpThis; 2585 LONG xNew, yNew; 2586 2587 if ( (WinQueryWindowPos(hwndRelative, &swpRel)) 2588 && (WinQueryWindowPos(hwnd, &swpThis)) 2589 ) 2590 { 2591 HWND hwndRelParent, 2592 hwndThisParent; 2593 POINTL ptlRel = {swpRel.x, swpRel.y}; 2594 if ( (hwndRelParent = WinQueryWindow(hwndRelative, QW_PARENT)) 2595 && (hwndThisParent = WinQueryWindow(hwnd, QW_PARENT)) 2596 && (hwndRelParent != hwndThisParent) 2597 ) 2598 { 2599 WinMapWindowPoints(hwndRelParent, 2600 hwndThisParent, 2601 &ptlRel, 2602 1); 2603 } 2604 2605 // place right first 2606 xNew = ptlRel.x + swpRel.cx; 2607 // center vertically 2608 yNew = ptlRel.y + ((swpRel.cy - swpThis.cy) / 2); 2609 2610 if (xNew + swpThis.cy > WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN)) 2611 { 2612 // place left then 2613 xNew = ptlRel.x - swpThis.cx; 2614 2615 if (xNew < 0) 2616 { 2617 // center then 2618 winhCenterWindow(hwnd); 2619 brc = TRUE; 2620 } 2621 } 2622 2623 if (!brc) 2624 brc = WinSetWindowPos(hwnd, 2625 0, 2626 xNew, 2627 yNew, 2628 0, 2629 0, 2630 SWP_MOVE); 2631 } 2632 2633 return brc; 2634 } 2635 2636 /* 2565 2637 *@@ winhFindWindowBelow: 2566 2638 * finds the window with the same parent
Note:
See TracChangeset
for help on using the changeset viewer.