Changeset 146
- Timestamp:
- Mar 6, 2002, 6:34:48 PM (23 years ago)
- Location:
- trunk/src/helpers
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/cctl_checkcnr.c
r142 r146 187 187 188 188 /* 189 *@@ CHECKBOXCNROWNER:190 *191 *192 *@@added V0.9.0 (99-11-28) [umoeller]193 */194 195 typedef struct _CHECKBOXCNROWNER196 {197 HWND hwndCnr; // container window handle198 USHORT usCnrID; // container item ID199 HWND hwndOwner; // owner of that container200 PFNWP pfnwpCnrOrig; // original window proc of hwndCnr201 PFNWP pfnwpOwnerOrig; // original window proc of hwndOwner202 203 HAB habCnr;204 205 PCHECKBOXRECORDCORE preccClicked; // != NULL if mb1 is currently down on recc206 PCHECKBOXRECORDCORE preccSpace; // != NULL if space key is down with recc207 RECTL rclReccClicked; // rectangle of that record208 } CHECKBOXCNROWNER, *PCHECKBOXCNROWNER;209 210 /*211 189 *@@ CnrCheckboxClicked: 212 190 * … … 249 227 250 228 /* 251 *@@ ctl_fnwpSubclCheckboxCnr: 229 *@@ ctlDrawCheckBoxRecord: 230 * 231 *@@added V0.9.18 (2002-03-03) [umoeller] 232 */ 233 234 MRESULT ctlDrawCheckBoxRecord(MPARAM mp2) 235 { 236 MRESULT mrc = 0; 237 238 // get generic DRAWITEM structure 239 POWNERITEM poi = (POWNERITEM)mp2; 240 241 // _Pmpf(("WM_DRAWITEM poi->idItem %d", poi->idItem)); 242 243 // check if we're to draw the icon 244 // (and not the text) 245 if (poi->idItem == CMA_ICON) 246 { 247 PCNRDRAWITEMINFO pcdi = (PCNRDRAWITEMINFO)poi->hItem; 248 PCHECKBOXRECORDCORE precc = (PCHECKBOXRECORDCORE)pcdi->pRecord; 249 250 if (precc->ulStyle & WS_VISIBLE) 251 { 252 USHORT usRow, 253 usColumn; 254 255 switch (precc->usCheckState) 256 { 257 case 0: // unchecked 258 usRow = 2; 259 usColumn = 0; 260 break; 261 262 case 1: // checked 263 usRow = 2; 264 usColumn = 1; 265 break; 266 267 case 2: // indeterminate 268 usRow = 0; 269 usColumn = 1; 270 break; 271 } 272 273 if (precc->ulStyle & BS_BITMAP) 274 // button currently depressed: 275 // add two to column 276 usColumn += 2; 277 278 ctlDrawCheckbox(poi->hps, 279 poi->rclItem.xLeft, 280 poi->rclItem.yBottom, 281 usRow, 282 usColumn, 283 // halftoned? 284 ((precc->recc.flRecordAttr & CRA_DISABLED) != 0)); 285 mrc = (MPARAM)FALSE; 286 // we still need the cnr to draw the 287 // emphasis 288 } 289 else 290 mrc = (MPARAM)TRUE; // tell cnr that we've drawn the item; 291 // don't even draw emphasis 292 } 293 else if (poi->idItem == CMA_TEXT) 294 { 295 // for text, buttons etc.: 296 PCNRDRAWITEMINFO pcdi = (PCNRDRAWITEMINFO)poi->hItem; 297 PCHECKBOXRECORDCORE precc = (PCHECKBOXRECORDCORE)pcdi->pRecord; 298 if (precc->recc.flRecordAttr & CRA_DISABLED) 299 { 300 RECTL rcl2; 301 LONG lBackground, lForeground; 302 ULONG flCmd = DT_LEFT | DT_TOP | DT_ERASERECT; 303 if ((pcdi->pRecord->flRecordAttr) & CRA_SELECTED) 304 { 305 // disabled and selected: 306 lBackground = WinQuerySysColor(HWND_DESKTOP, 307 SYSCLR_SHADOWTEXT, 0); 308 lForeground = winhQueryPresColor(poi->hwnd, 309 PP_BACKGROUNDCOLOR, 310 FALSE, // no inherit 311 SYSCLR_WINDOW); 312 } 313 else 314 { 315 // disabled and not selected: 316 lBackground = winhQueryPresColor(poi->hwnd, 317 PP_BACKGROUNDCOLOR, 318 FALSE, 319 SYSCLR_WINDOW); 320 lForeground = winhQueryPresColor(poi->hwnd, 321 PP_FOREGROUNDCOLOR, 322 FALSE, // no inherit 323 SYSCLR_WINDOWTEXT); 324 flCmd |= DT_HALFTONE; 325 } 326 327 // _Pmpf(("back: 0x%lX, fore: 0x%lX", lBackground, lForeground)); 328 329 GpiCreateLogColorTable(poi->hps, 0, LCOLF_RGB, 0, 0, NULL); 330 GpiSetBackColor(poi->hps, lBackground); 331 GpiSetColor(poi->hps, lForeground); 332 333 memcpy(&rcl2, &(poi->rclItem), sizeof(rcl2)); 334 335 winhDrawFormattedText(poi->hps, 336 &rcl2, 337 precc->recc.pszTree, 338 flCmd); 339 mrc = (MPARAM)TRUE; 340 } 341 else 342 // tell cnr to draw the item 343 mrc = (MPARAM)FALSE; 344 } 345 else 346 // tell cnr to draw the item 347 mrc = (MPARAM)FALSE; 348 349 return mrc; 350 } 351 352 /* 353 *@@ fnwpSubclCheckboxCnr: 252 354 * window proc for subclassed containers. 253 355 * See ctlMakeCheckboxContainer for details. 254 356 * 255 357 *@@added V0.9.0 (99-11-29) [umoeller] 256 */ 257 258 MRESULT EXPENTRY ctl_fnwpSubclCheckboxCnr(HWND hwndCnr, ULONG msg, MPARAM mp1, MPARAM mp2) 358 *@@changed V0.9.18 (2002-03-03) [umoeller]: fixed bad orig win msg, other optimizations 359 */ 360 361 static MRESULT EXPENTRY fnwpSubclCheckboxCnr(HWND hwndCnr, ULONG msg, MPARAM mp1, MPARAM mp2) 259 362 { 260 363 MRESULT mrc = 0; … … 270 373 if (pcbco->hwndCnr == hwndCnr) 271 374 { 272 pfnwpOrig = pcbco->pfnwp OwnerOrig;375 pfnwpOrig = pcbco->pfnwpCnrOrig; // fixed V0.9.18 (2002-03-03) [umoeller] 273 376 break; 274 377 } … … 314 417 mrc = pfnwpOrig(hwndCnr, msg, mp1, mp2); 315 418 // apperently, the cnr captures the mouse 316 break; } 419 } 420 break; 317 421 318 422 case WM_MOUSEMOVE: … … 438 542 439 543 mrc = pfnwpOrig(hwndCnr, msg, mp1, mp2); 440 break; } 544 } 545 break; 441 546 442 547 /* … … 452 557 if (WinRequestMutexSem(G_hmtxCnrOwnersList, 5000) == NO_ERROR) 453 558 { 559 if (WinIsWindow(pcbco->habCnr, 560 pcbco->hwndOwner)) 561 // un-subclass the owner 562 WinSubclassWindow(pcbco->hwndOwner, 563 pcbco->pfnwpOwnerOrig); 564 454 565 lstRemoveItem(G_pllCnrOwners, pcbco); 566 455 567 if (lstCountItems(G_pllCnrOwners) == 0) 456 568 { … … 475 587 476 588 /* 477 *@@ ctl_fnwpSubclCheckboxCnrOwner:589 *@@ fnwpSubclCheckboxCnrOwner: 478 590 * window proc for subclassed container owners. 479 591 * See ctlMakeCheckboxContainer for details. … … 482 594 */ 483 595 484 MRESULT EXPENTRY ctl_fnwpSubclCheckboxCnrOwner(HWND hwndOwner, ULONG msg, MPARAM mp1, MPARAM mp2)596 static MRESULT EXPENTRY fnwpSubclCheckboxCnrOwner(HWND hwndOwner, ULONG msg, MPARAM mp1, MPARAM mp2) 485 597 { 486 598 MRESULT mrc = 0; … … 531 643 precc, 532 644 TRUE); 533 break; } 645 } 646 break; 534 647 } 535 648 } 536 649 537 650 mrc = pfnwpOrig(hwndOwner, msg, mp1, mp2); 538 break; } 651 } 652 break; 539 653 540 654 /* … … 546 660 case WM_DRAWITEM: 547 661 { 548 USHORT usID = SHORT1FROMMP(mp1); 549 if (usID == pcbco->usCnrID) 550 { 551 // get generic DRAWITEM structure 552 POWNERITEM poi = (POWNERITEM)mp2; 553 554 // _Pmpf(("WM_DRAWITEM poi->idItem %d", poi->idItem)); 555 556 // check if we're to draw the icon 557 // (and not the text) 558 if (poi->idItem == CMA_ICON) 559 { 560 PCNRDRAWITEMINFO pcdi = (PCNRDRAWITEMINFO)poi->hItem; 561 PCHECKBOXRECORDCORE precc = (PCHECKBOXRECORDCORE)pcdi->pRecord; 562 563 if (precc->ulStyle & WS_VISIBLE) 564 { 565 USHORT usRow, 566 usColumn; 567 568 switch (precc->usCheckState) 569 { 570 case 0: // unchecked 571 usRow = 2; 572 usColumn = 0; 573 break; 574 575 case 1: // checked 576 usRow = 2; 577 usColumn = 1; 578 break; 579 580 case 2: // indeterminate 581 usRow = 0; 582 usColumn = 1; 583 break; 584 } 585 586 if (precc->ulStyle & BS_BITMAP) 587 // button currently depressed: 588 // add two to column 589 usColumn += 2; 590 591 ctlDrawCheckbox(poi->hps, 592 poi->rclItem.xLeft, 593 poi->rclItem.yBottom, 594 usRow, 595 usColumn, 596 // halftoned? 597 ((precc->recc.flRecordAttr & CRA_DISABLED) != 0)); 598 mrc = (MPARAM)FALSE; 599 // we still need the cnr to draw the 600 // emphasis 601 } 602 else 603 mrc = (MPARAM)TRUE; // tell cnr that we've drawn the item; 604 // don't even draw emphasis 605 } 606 else if (poi->idItem == CMA_TEXT) 607 { 608 // for text, buttons etc.: 609 PCNRDRAWITEMINFO pcdi = (PCNRDRAWITEMINFO)poi->hItem; 610 PCHECKBOXRECORDCORE precc = (PCHECKBOXRECORDCORE)pcdi->pRecord; 611 if (precc->recc.flRecordAttr & CRA_DISABLED) 612 { 613 RECTL rcl2; 614 LONG lBackground, lForeground; 615 ULONG flCmd = DT_LEFT | DT_TOP | DT_ERASERECT; 616 if ((pcdi->pRecord->flRecordAttr) & CRA_SELECTED) 617 { 618 // disabled and selected: 619 lBackground = WinQuerySysColor(HWND_DESKTOP, 620 SYSCLR_SHADOWTEXT, 0); 621 lForeground = winhQueryPresColor(poi->hwnd, 622 PP_BACKGROUNDCOLOR, 623 FALSE, // no inherit 624 SYSCLR_WINDOW); 625 } 626 else 627 { 628 // disabled and not selected: 629 lBackground = winhQueryPresColor(poi->hwnd, 630 PP_BACKGROUNDCOLOR, 631 FALSE, 632 SYSCLR_WINDOW); 633 lForeground = winhQueryPresColor(poi->hwnd, 634 PP_FOREGROUNDCOLOR, 635 FALSE, // no inherit 636 SYSCLR_WINDOWTEXT); 637 flCmd |= DT_HALFTONE; 638 } 639 640 // _Pmpf(("back: 0x%lX, fore: 0x%lX", lBackground, lForeground)); 641 642 GpiCreateLogColorTable(poi->hps, 0, LCOLF_RGB, 0, 0, NULL); 643 GpiSetBackColor(poi->hps, lBackground); 644 GpiSetColor(poi->hps, lForeground); 645 646 memcpy(&rcl2, &(poi->rclItem), sizeof(rcl2)); 647 648 winhDrawFormattedText(poi->hps, 649 &rcl2, 650 precc->recc.pszTree, 651 flCmd); 652 mrc = (MPARAM)TRUE; 653 } 654 else 655 // tell cnr to draw the item 656 mrc = (MPARAM)FALSE; 657 } 658 else 659 // tell cnr to draw the item 660 mrc = (MPARAM)FALSE; 661 } 662 if (SHORT1FROMMP(mp1) == pcbco->usCnrID) 663 mrc = ctlDrawCheckBoxRecord(mp2); 662 664 else 663 665 mrc = pfnwpOrig(hwndOwner, msg, mp1, mp2); 664 break; } 666 } 667 break; 665 668 666 669 default: … … 672 675 673 676 return (mrc); 677 } 678 679 /* 680 *@@ ctlInitCheckboxContainer: 681 * 682 *@@added V0.9.18 (2002-03-03) [umoeller] 683 */ 684 685 VOID ctlInitCheckboxContainer(HWND hwndCnr) 686 { 687 if (G_hbmCheckboxes == NULLHANDLE) 688 { 689 // first call: 690 BITMAPINFOHEADER bmih; 691 // load checkboxes bitmap 692 G_hbmCheckboxes = WinGetSysBitmap(HWND_DESKTOP, 693 SBMP_CHECKBOXES); 694 695 // _Pmpf(("hbmCheckboxes: 0x%lX", G_hbmCheckboxes)); 696 697 // and compute size of one checkbox 698 // (4 columns, 3 rows) 699 GpiQueryBitmapParameters(G_hbmCheckboxes, 700 &bmih); 701 G_cxCheckbox = bmih.cx / 4; 702 } 703 704 BEGIN_CNRINFO() 705 { 706 cnrhSetView(CV_TREE | CV_ICON | CA_TREELINE | CA_OWNERDRAW | CV_MINI); 707 cnrhSetTreeIndent(20); 708 cnrhSetBmpOrIconSize(G_cxCheckbox, G_cxCheckbox); 709 } END_CNRINFO(hwndCnr); 710 } 711 712 /* 713 *@@ ctlSubclassCheckboxContainer: 714 * 715 *@@added V0.9.18 (2002-03-03) [umoeller] 716 */ 717 718 PCHECKBOXCNROWNER ctlSubclassCheckboxContainer(HWND hwndCnr) 719 { 720 PFNWP pfnwpCnrOrig; 721 if (pfnwpCnrOrig = WinSubclassWindow(hwndCnr, fnwpSubclCheckboxCnr)) 722 { 723 // cnr successfully subclassed: 724 // create storage for both subclassed cnr and owner 725 PCHECKBOXCNROWNER pcbco; 726 if (pcbco = (PCHECKBOXCNROWNER)malloc(sizeof(CHECKBOXCNROWNER))) 727 { 728 memset(pcbco, 0, sizeof(CHECKBOXCNROWNER)); 729 pcbco->hwndCnr = hwndCnr; 730 pcbco->usCnrID = WinQueryWindowUShort(hwndCnr, QWS_ID); 731 pcbco->hwndOwner = WinQueryWindow(hwndCnr, QW_OWNER); 732 pcbco->pfnwpCnrOrig = pfnwpCnrOrig; 733 734 pcbco->habCnr = WinQueryAnchorBlock(hwndCnr); 735 736 return (pcbco); 737 } 738 } 739 740 return NULL; 674 741 } 675 742 … … 749 816 if (hwndCnr) 750 817 { 751 if (G_hbmCheckboxes == NULLHANDLE) 752 { 753 // first call: 754 BITMAPINFOHEADER bmih; 755 // load checkboxes bitmap 756 G_hbmCheckboxes = WinGetSysBitmap(HWND_DESKTOP, 757 SBMP_CHECKBOXES); 758 759 // _Pmpf(("hbmCheckboxes: 0x%lX", G_hbmCheckboxes)); 760 761 // and compute size of one checkbox 762 // (4 columns, 3 rows) 763 GpiQueryBitmapParameters(G_hbmCheckboxes, 764 &bmih); 765 G_cxCheckbox = bmih.cx / 4; 766 } 767 768 BEGIN_CNRINFO() 769 { 770 cnrhSetView(CV_TREE | CV_ICON | CA_TREELINE | CA_OWNERDRAW | CV_MINI); 771 cnrhSetTreeIndent(20); 772 cnrhSetBmpOrIconSize(G_cxCheckbox, G_cxCheckbox); 773 // cnrhSetSortFunc(fnCompareName); 774 } END_CNRINFO(hwndCnr); 818 ctlInitCheckboxContainer(hwndCnr); 775 819 776 820 if ( (hwndCnrOwner) … … 779 823 { 780 824 // subclass container owner 781 PFNWP pfnwpOwnerOrig = WinSubclassWindow(hwndCnrOwner, ctl_fnwpSubclCheckboxCnrOwner);825 PFNWP pfnwpOwnerOrig = WinSubclassWindow(hwndCnrOwner, fnwpSubclCheckboxCnrOwner); 782 826 /* _Pmpf(("Subclassed hwnd 0x%lX: orig 0x%lX", 783 827 hwndCnrOwner, pfnwpOwnerOrig)); */ … … 786 830 // owner successfully subclassed: 787 831 // subclass container too 788 P FNWP pfnwpCnrOrig = WinSubclassWindow(hwndCnr, ctl_fnwpSubclCheckboxCnr);789 if (p fnwpCnrOrig)832 PCHECKBOXCNROWNER pcbco; 833 if (pcbco = ctlSubclassCheckboxContainer(hwndCnr)) 790 834 { 791 // cnr successfully subclassed: 792 // create storage for both subclassed cnr and owner 793 PCHECKBOXCNROWNER pcbco = (PCHECKBOXCNROWNER)malloc(sizeof(CHECKBOXCNROWNER)); 794 if (pcbco) 835 if (WinRequestMutexSem(G_hmtxCnrOwnersList, 5000) == NO_ERROR) 795 836 { 796 memset(pcbco, 0, sizeof(CHECKBOXCNROWNER)); 797 pcbco->hwndCnr = hwndCnr; 798 pcbco->usCnrID = usCnrID; 799 pcbco->hwndOwner = hwndCnrOwner; 800 pcbco->pfnwpCnrOrig = pfnwpCnrOrig; 837 lstAppendItem(G_pllCnrOwners, pcbco); 838 DosReleaseMutexSem(G_hmtxCnrOwnersList); 839 brc = TRUE; 840 801 841 pcbco->pfnwpOwnerOrig = pfnwpOwnerOrig; 802 803 pcbco->habCnr = WinQueryAnchorBlock(hwndCnr);804 805 if (WinRequestMutexSem(G_hmtxCnrOwnersList, 5000) == NO_ERROR)806 {807 lstAppendItem(G_pllCnrOwners, pcbco);808 DosReleaseMutexSem(G_hmtxCnrOwnersList);809 brc = TRUE;810 }811 842 } 812 813 if (!brc)814 // failed: unsubclass cnr815 WinSubclassWindow(hwndCnr, pfnwpCnrOrig);816 843 } 817 818 if (!brc)819 // failed: unsubclass owner820 WinSubclassWindow(hwndCnrOwner, pfnwpOwnerOrig);821 844 } 822 845 } … … 956 979 * ID and updates that record enablement. If 957 980 * the record is disabled, it's painted halftoned 958 * by ctl_fnwpSubclCheckboxCnr.981 * by fnwpSubclCheckboxCnr. 959 982 * 960 983 *@@added V0.9.1 (99-12-03) [umoeller] -
trunk/src/helpers/dialog.c
r142 r146 109 109 POINTL ptlTotalOfs; 110 110 111 LINKLIST llControls; // linked list of all PCOLUMNDEF structs,112 // in the order in which windows were113 // created111 PLINKLIST pllControls; // linked list of HWNDs in the order 112 // in which controls were created; 113 // ptr can be NULL 114 114 115 115 PCSZ pcszControlsFont; // from dlghCreateDlg … … 910 910 pcszFont); 911 911 912 lstAppendItem(&pDlgData->llControls, 913 pColumnDef); 912 // append window that was created 913 // V0.9.18 (2002-03-03) [umoeller] 914 if (pDlgData->pllControls) 915 lstAppendItem(pDlgData->pllControls, 916 (PVOID)pColumnDef->hwndControl); 914 917 915 918 // if this is the first control with WS_TABSTOP, … … 1455 1458 * 1456 1459 *@@added V0.9.15 (2001-08-26) [umoeller] 1460 *@@changed V0.9.18 (2002-03-03) [umoeller]: aded pllWindows 1457 1461 */ 1458 1462 1459 1463 static APIRET Dlg0_Init(PDLGPRIVATE *ppDlgData, 1460 PCSZ pcszControlsFont) 1464 PCSZ pcszControlsFont, 1465 PLINKLIST pllControls) 1461 1466 { 1462 1467 PDLGPRIVATE pDlgData; … … 1465 1470 ZERO(pDlgData); 1466 1471 lstInit(&pDlgData->llTables, FALSE); 1467 lstInit(&pDlgData->llControls, FALSE); 1472 1473 if (pllControls) 1474 pDlgData->pllControls = pllControls; 1468 1475 1469 1476 pDlgData->pcszControlsFont = pcszControlsFont; … … 1756 1763 1757 1764 lstClear(&pDlgData->llTables); 1758 lstClear(&pDlgData->llControls);1759 1765 1760 1766 free(pDlgData); … … 2040 2046 2041 2047 if (!(arc = Dlg0_Init(&pDlgData, 2042 pcszControlsFont))) 2048 pcszControlsFont, 2049 NULL))) 2043 2050 { 2044 2051 if (!(arc = Dlg1_ParseTables(pDlgData, … … 2204 2211 * except that the frame is already created. 2205 2212 * 2206 * -- DFFL_RESIZEFRAME: hwndDlg should be resized so 2207 * that it will properly surround the controls. 2208 * 2209 * This can only be used in conjunction with 2210 * DFFL_RESIZEFRAME. 2213 * If pszlClient is specified, it receives the required 2214 * size of the client to surround all controls properly. 2215 * You can then use dlghResizeFrame to resize the frame 2216 * with a bit of spacing, if desired. 2211 2217 * 2212 2218 *@@added V0.9.16 (2001-09-29) [umoeller] 2219 *@@changed V0.9.18 (2002-03-03) [umoeller]: added pszlClient, fixed output 2213 2220 */ 2214 2221 … … 2217 2224 ULONG cDlgItems, // in: array item count (NOT array size) 2218 2225 PCSZ pcszControlsFont, // in: font for ctls with CTL_COMMON_FONT 2219 ULONG flFlags) // in: DFFL_* flags 2226 ULONG flFlags, // in: DFFL_* flags 2227 PSIZEL pszlClient, // out: size of all controls (ptr can be NULL) 2228 PVOID *ppllControls) // out: new LINKLIST receiving HWNDs of created controls (ptr can be NULL) 2220 2229 { 2221 2230 APIRET arc = NO_ERROR; … … 2224 2233 2225 2234 PDLGPRIVATE pDlgData = NULL; 2235 PLINKLIST pllControls = NULL; 2226 2236 2227 2237 /* … … 2230 2240 */ 2231 2241 2242 if (ppllControls) 2243 pllControls = *(PLINKLIST*)ppllControls = lstCreate(FALSE); 2244 2232 2245 if (!(arc = Dlg0_Init(&pDlgData, 2233 pcszControlsFont))) 2246 pcszControlsFont, 2247 pllControls))) 2234 2248 { 2235 2249 if (!(arc = Dlg1_ParseTables(pDlgData, … … 2237 2251 cDlgItems))) 2238 2252 { 2253 HWND hwndFocusItem; 2254 2239 2255 /* 2240 2256 * 2) create empty dialog frame … … 2242 2258 */ 2243 2259 2244 HWND hwndFocusItem = NULLHANDLE;2245 SIZEL szlClient = {0};2246 RECTL rclClient;2247 2248 2260 pDlgData->hwndDlg = hwndDlg; 2249 2261 … … 2255 2267 Dlg2_CalcSizes(pDlgData); 2256 2268 2257 // WinSubclassWindow(hwndDlg, pfnwpDialogProc); 2258 2259 /* 2260 * 4) compute size of dialog client from total 2261 * size of all controls 2262 */ 2263 2264 if (flFlags & DFFL_RESIZEFRAME) 2269 if (pszlClient) 2265 2270 { 2266 // calculate the frame size from the client size 2267 rclClient.xLeft = 10; 2268 rclClient.yBottom = 10; 2269 rclClient.xRight = szlClient.cx + 2 * SPACING; 2270 rclClient.yTop = szlClient.cy + 2 * SPACING; 2271 WinCalcFrameRect(hwndDlg, 2272 &rclClient, 2273 FALSE); // frame from client 2274 2275 WinSetWindowPos(hwndDlg, 2276 0, 2277 10, 2278 10, 2279 rclClient.xRight, 2280 rclClient.yTop, 2281 SWP_MOVE | SWP_SIZE | SWP_NOADJUST); 2271 pszlClient->cx = pDlgData->szlClient.cx + 2 * SPACING; 2272 pszlClient->cy = pDlgData->szlClient.cy + 2 * SPACING; 2282 2273 } 2283 2274 … … 2303 2294 2304 2295 return (arc); 2296 } 2297 2298 /* 2299 *@@ dlghResizeFrame: 2300 * 2301 *@@added V0.9.18 (2002-03-03) [umoeller] 2302 */ 2303 2304 VOID dlghResizeFrame(HWND hwndDlg, 2305 PSIZEL pszlClient) 2306 { 2307 // calculate the frame size from the client size 2308 RECTL rclClient; 2309 rclClient.xLeft = 10; 2310 rclClient.yBottom = 10; 2311 rclClient.xRight = pszlClient->cx; 2312 rclClient.yTop = pszlClient->cy; 2313 WinCalcFrameRect(hwndDlg, 2314 &rclClient, 2315 FALSE); // frame from client 2316 2317 WinSetWindowPos(hwndDlg, 2318 0, 2319 10, 2320 10, 2321 rclClient.xRight, 2322 rclClient.yTop, 2323 SWP_MOVE | SWP_SIZE | SWP_NOADJUST); 2305 2324 } 2306 2325 -
trunk/src/helpers/dosh.c
r142 r146 2916 2916 * is _not_ converted WRT the line format. 2917 2917 * 2918 * If CTRL-Z (ASCII 26) is encountered in the 2919 * content, it is set to the null character 2920 * instead (V0.9.18). 2921 * 2918 2922 * This returns the APIRET of DosOpen and DosRead. 2919 2923 * If any error occured, no buffer was allocated. … … 2924 2928 *@@changed V0.9.16 (2002-01-05) [umoeller]: added pcbRead 2925 2929 *@@changed V0.9.16 (2002-01-05) [umoeller]: rewritten using doshOpen 2930 *@@changed V0.9.18 (2002-03-08) [umoeller]: fixed ctrl-z (EOF) bug 2926 2931 */ 2927 2932 … … 2955 2960 else 2956 2961 { 2962 PSZ p; 2957 2963 pszContent[cbRead] = '\0'; 2964 2965 // check if we have a ctrl-z (EOF) marker 2966 // this is present, for example, in config.sys 2967 // after install 2968 // V0.9.18 (2002-03-08) [umoeller] 2969 if (p = strchr(pszContent, '\26')) 2970 { 2971 *p = '\0'; 2972 cbRead = p - pszContent; 2973 } 2974 2958 2975 *ppszContent = pszContent; 2959 2976 if (pcbRead) … … 2968 2985 doshClose(&pFile); 2969 2986 } 2970 2971 /*2972 ULONG ulSize,2973 ulBytesRead = 0,2974 ulAction, ulLocal;2975 HFILE hFile;2976 PSZ pszContent = NULL;2977 2978 APIRET arc;2979 2980 *ppszContent = 0;2981 2982 if (!(arc = DosOpen((PSZ)pcszFile,2983 &hFile,2984 &ulAction, // action taken2985 5000L, // primary allocation size2986 FILE_ARCHIVED | FILE_NORMAL, // file attribute2987 OPEN_ACTION_OPEN_IF_EXISTS, // open flags2988 OPEN_FLAGS_NOINHERIT2989 | OPEN_SHARE_DENYNONE2990 | OPEN_ACCESS_READONLY, // read-only mode2991 NULL))) // no EAs2992 {2993 if (!(arc = doshQueryFileSize(hFile, &ulSize)))2994 {2995 pszContent = (PSZ)malloc(ulSize+1);2996 2997 if (!(arc = DosSetFilePtr(hFile,2998 0L,2999 FILE_BEGIN,3000 &ulLocal)))3001 if (!(arc = DosRead(hFile,3002 pszContent,3003 ulSize,3004 &ulBytesRead)))3005 {3006 *(pszContent+ulBytesRead) = 0;3007 // set output buffer pointer3008 *ppszContent = pszContent;3009 3010 if (pcbRead)3011 *pcbRead = ulBytesRead + 1;3012 }3013 3014 if (arc)3015 free(pszContent);3016 }3017 DosClose(hFile);3018 }3019 */3020 2987 3021 2988 return (arc); -
trunk/src/helpers/winh.c
r137 r146 2390 2390 ul++) 2391 2391 { 2392 HWND hwndThis = WinWindowFromID(hwndDlg, SHORT1FROMMP(*pmpThis));2393 if (hwndThis )2392 HWND hwndThis; 2393 if (hwndThis = WinWindowFromID(hwndDlg, SHORT1FROMMP(*pmpThis))) 2394 2394 { 2395 2395 WinQueryWindowPos(hwndThis, pswpThis); … … 3591 3591 3592 3592 HWND winhCreateStdWindow(HWND hwndFrameParent, // in: normally HWND_DESKTOP 3593 PSWP pswpFrame, // in: frame wnd pos 3593 PSWP pswpFrame, // in: frame wnd pos (ptr can be NULL) 3594 3594 ULONG flFrameCreateFlags, // in: FCF_* flags 3595 3595 ULONG ulFrameStyle, // in: WS_* flags (e.g. WS_VISIBLE, WS_ANIMATE)
Note:
See TracChangeset
for help on using the changeset viewer.