Changeset 137
- Timestamp:
- Feb 4, 2002, 6:32:38 PM (24 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/helpers/dialog.h
r136 r137 62 62 63 63 #define SZL_AUTOSIZE (-1) 64 #define SZL_LARGEST_ROW_WIDTH (-2)65 64 66 65 #define CTL_COMMON_FONT ((PCSZ)-1) … … 115 114 // the largest row in the table. This is valid 116 115 // for the CX field only. 117 // This field is IGNORED if the CONTROLDEF appears 118 // with a START_NEW_TABLE type in _DLGHITEM. 116 // If the CONTROLDEF appears with a START_NEW_TABLE 117 // type in _DLGHITEM (to specify a group table) 118 // and they are not SZL_AUTOSIZE, they specify the 119 // table size (to override the automatic formatting). 119 120 120 121 ULONG ulSpacing; // spacing around control … … 242 243 #define CONTROLDEF_ENTRYFIELD(pcsz, id, cx, cy) { WC_ENTRYFIELD, pcsz, \ 243 244 WS_VISIBLE | WS_TABSTOP | ES_MARGIN | ES_AUTOSCROLL, \ 244 id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING + 5}245 id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING } 245 246 246 247 #define CONTROLDEF_ENTRYFIELD_RO(pcsz, id, cx, cy) { WC_ENTRYFIELD, pcsz, \ 247 248 WS_VISIBLE | WS_TABSTOP | ES_MARGIN | ES_READONLY | ES_AUTOSCROLL, \ 248 id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING + 5}249 id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING } 249 250 250 251 #define CONTROLDEF_MLE(pcsz, id, cx, cy) { WC_MLE, pcsz, \ … … 252 253 id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING } 253 254 255 #define CONTROLDEF_LISTBOX(id, cx, cy) { WC_LISTBOX, NULL, \ 256 WS_VISIBLE | WS_TABSTOP | LS_HORZSCROLL | LS_NOADJUSTPOS, \ 257 id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING } 258 254 259 #define CONTROLDEF_SPINBUTTON(id, cx, cy) { WC_SPINBUTTON, NULL, \ 255 260 WS_VISIBLE | WS_TABSTOP | SPBS_MASTER | SPBS_NUMERICONLY | SPBS_JUSTCENTER | SPBS_FASTSPIN, \ 261 id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING } 262 263 #define CONTROLDEF_CONTAINER(id, cx, cy) { WC_CONTAINER, NULL, \ 264 WS_VISIBLE | WS_TABSTOP | 0, \ 256 265 id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING } 257 266 -
trunk/include/helpers/xstring.h
r132 r137 225 225 typedef XSTRENCODE *PXSTRENCODE; 226 226 227 ULONG XWPENTRY xstrDecode2(PXSTRING pxstr, 228 CHAR cKey); 229 227 230 ULONG XWPENTRY xstrDecode(PXSTRING pxstr); 228 231 typedef ULONG XWPENTRY XSTRDECODE(PXSTRING pxstr); -
trunk/src/helpers/dialog.c
r136 r137 73 73 #include "helpers\xstring.h" 74 74 75 #pragma hdrstop 76 77 // #define DEBUG_DIALOG_WINDOWS 1 78 75 79 /* 76 80 *@@category: Helpers\PM helpers\Dialog templates … … 109 113 // created 110 114 111 const char *pcszControlsFont; // from dlghCreateDlg 112 113 // V0.9.14 (2001-08-01) [umoeller] 115 PCSZ pcszControlsFont; // from dlghCreateDlg 116 117 // size of the client to be created 118 SIZEL szlClient; 119 120 // various cached data V0.9.14 (2001-08-01) [umoeller] 114 121 HPS hps; 115 const char *pcszFontLast;122 PCSZ pcszFontLast; 116 123 LONG lcidLast; 117 124 FONTMETRICS fmLast; … … 190 197 typedef struct _TABLEDEF 191 198 { 199 PCOLUMNDEF pOwningColumn; // != NULL if this is a nested table 200 192 201 LINKLIST llRows; // contains ROWDEF structs, no auto-free 193 202 … … 205 214 typedef enum _PROCESSMODE 206 215 { 207 PROCESS_CALC_SIZES, // step 1 208 PROCESS_CALC_POSITIONS, // step 3 209 PROCESS_CREATE_CONTROLS // step 4 216 PROCESS_1_CALC_SIZES, // step 1 217 PROCESS_2_CALC_SIZES_FROM_TABLES, // step 2 218 PROCESS_3_CALC_FINAL_TABLE_SIZES, // step 3 219 PROCESS_4_CALC_POSITIONS, // step 4 220 PROCESS_5_CREATE_CONTROLS // step 5 210 221 } PROCESSMODE; 211 222 … … 217 228 218 229 #define PM_GROUP_SPACING_X 16 219 #define PM_GROUP_SPACING_TOP 20230 #define PM_GROUP_SPACING_TOP 16 220 231 221 232 APIRET ProcessTable(PTABLEDEF pTableDef, … … 293 304 *@@changed V0.9.14 (2001-08-01) [umoeller]: now caching fonts, which is significantly faster 294 305 *@@changed V0.9.16 (2001-10-15) [umoeller]: added APIRET 306 *@@changed V0.9.16 (2002-02-02) [umoeller]: added ulWidth 295 307 */ 296 308 297 309 APIRET CalcAutoSizeText(PCONTROLDEF pControlDef, 298 310 BOOL fMultiLine, // in: if TRUE, multiple lines 311 ULONG ulWidth, // in: proposed width of control 299 312 PSIZEL pszlAuto, // out: computed size 300 313 PDLGPRIVATE pDlgData) … … 317 330 { 318 331 RECTL rcl = {0, 0, 0, 0}; 332 /* 319 333 if (pControlDef->szlControlProposed.cx > 0) 320 334 rcl.xRight = pControlDef->szlControlProposed.cx; // V0.9.12 (2001-05-31) [umoeller] 321 335 else 322 336 rcl.xRight = winhQueryScreenCX() * 2 / 3; 337 */ 338 rcl.xRight = ulWidth; 323 339 if (pControlDef->szlControlProposed.cy > 0) 324 340 rcl.yTop = pControlDef->szlControlProposed.cy; // V0.9.12 (2001-05-31) [umoeller] … … 358 374 359 375 APIRET CalcAutoSize(PCONTROLDEF pControlDef, 376 ULONG ulWidth, // in: proposed width of control 360 377 PSIZEL pszlAuto, // out: computed size 361 378 PDLGPRIVATE pDlgData) … … 372 389 if (!(arc = CalcAutoSizeText(pControlDef, 373 390 FALSE, // no multiline 391 ulWidth, 374 392 pszlAuto, 375 393 pDlgData))) … … 404 422 arc = CalcAutoSizeText(pControlDef, 405 423 ((pControlDef->flStyle & DT_WORDBREAK) != 0), 424 ulWidth, 406 425 pszlAuto, 407 426 pDlgData); … … 437 456 pszlAuto->cy = pDlgData->fmLast.lMaxBaselineExt 438 457 + pDlgData->fmLast.lExternalLeading 439 + 5; // some space458 + 7; // some space 440 459 } 441 460 … … 445 464 /* 446 465 *@@ ColumnCalcSizes: 447 * implementation for PROCESS_ CALC_SIZES in466 * implementation for PROCESS_1_CALC_SIZES in 448 467 * ProcessColumn. 468 * 469 * This gets called a second time for 470 * PROCESS_3_CALC_FINAL_TABLE_SIZES (V0.9.16). 449 471 * 450 472 *@@added V0.9.15 (2001-08-26) [umoeller] … … 455 477 456 478 APIRET ColumnCalcSizes(PCOLUMNDEF pColumnDef, 479 PROCESSMODE ProcessMode, // in: PROCESS_1_CALC_SIZES or PROCESS_3_CALC_FINAL_TABLE_SIZES 457 480 PDLGPRIVATE pDlgData) 458 481 { 459 482 APIRET arc = NO_ERROR; 460 483 461 ULONG ul XSpacing= 0,462 ul YSpacing= 0;484 ULONG ulExtraCX = 0, 485 ulExtraCY = 0; 463 486 if (pColumnDef->fIsNestedTable) 464 487 { … … 467 490 if (!(arc = ProcessTable(pTableDef, 468 491 NULL, 469 P ROCESS_CALC_SIZES,492 ProcessMode, 470 493 pDlgData))) 471 494 { … … 491 514 492 515 // in any case, make this wider 493 ulXSpacing = 2 * PM_GROUP_SPACING_X; 494 ulYSpacing = // 3 * PM_GROUP_SPACING_X; 495 (PM_GROUP_SPACING_X + PM_GROUP_SPACING_TOP); 516 ulExtraCX = 2 * PM_GROUP_SPACING_X; 517 ulExtraCY = (PM_GROUP_SPACING_X + PM_GROUP_SPACING_TOP); 496 518 } 497 519 } … … 501 523 // no nested table, but control: 502 524 PCONTROLDEF pControlDef = (PCONTROLDEF)pColumnDef->pvDefinition; 503 PSIZEL pszl = &pControlDef->szlControlProposed;504 525 SIZEL szlAuto; 505 526 506 if ( (pszl->cx < -1) 507 && (pszl->cx >= -100) 508 ) 509 { 510 // other negative CX value: 511 // this is then a percentage of the row width... ignore for now 512 // V0.9.16 (2002-02-02) [umoeller] 513 szlAuto.cx = 0; 514 szlAuto.cy = 0; 515 } 516 else if ( (pszl->cx == -1) 517 || (pszl->cy == -1) 518 ) 519 { 520 arc = CalcAutoSize(pControlDef, 521 &szlAuto, 522 pDlgData); 523 } 524 525 if (!arc) 526 { 527 if (pszl->cx < 0) 528 pColumnDef->cpControl.cx = szlAuto.cx; 529 else 530 pColumnDef->cpControl.cx = pszl->cx; 531 532 if (pszl->cy < 0) 533 pColumnDef->cpControl.cy = szlAuto.cy; 534 else 535 pColumnDef->cpControl.cy = pszl->cy; 536 537 // @@todo hack sizes 538 539 ulXSpacing 540 = ulYSpacing 541 = (2 * pControlDef->ulSpacing); 542 } 527 // do auto-size calculations only on the first loop 528 // V0.9.16 (2002-02-02) [umoeller] 529 if (ProcessMode == PROCESS_1_CALC_SIZES) 530 { 531 if ( (pControlDef->szlControlProposed.cx == -1) 532 || (pControlDef->szlControlProposed.cy == -1) 533 ) 534 { 535 ULONG ulWidth; 536 if (pControlDef->szlControlProposed.cx == -1) 537 ulWidth = 1000; 538 else 539 ulWidth = pControlDef->szlControlProposed.cx; 540 arc = CalcAutoSize(pControlDef, 541 ulWidth, 542 &szlAuto, 543 pDlgData); 544 } 545 546 if ( (pControlDef->szlControlProposed.cx < -1) 547 && (pControlDef->szlControlProposed.cx >= -100) 548 ) 549 { 550 // other negative CX value: 551 // this is then a percentage of the table width... ignore for now 552 // V0.9.16 (2002-02-02) [umoeller] 553 szlAuto.cx = 0; 554 } 555 556 if ( (pControlDef->szlControlProposed.cy < -1) 557 && (pControlDef->szlControlProposed.cy >= -100) 558 ) 559 { 560 // other negative CY value: 561 // this is then a percentage of the row height... ignore for now 562 // V0.9.16 (2002-02-02) [umoeller] 563 szlAuto.cy = 0; 564 } 565 566 if (!arc) 567 { 568 if (pControlDef->szlControlProposed.cx < 0) 569 pColumnDef->cpControl.cx = szlAuto.cx; 570 else 571 pColumnDef->cpControl.cx = pControlDef->szlControlProposed.cx; 572 573 if (pControlDef->szlControlProposed.cy < 0) 574 pColumnDef->cpControl.cy = szlAuto.cy; 575 else 576 pColumnDef->cpControl.cy = pControlDef->szlControlProposed.cy; 577 } 578 579 } // end if (ProcessMode == PROCESS_1_CALC_SIZES) 580 581 582 ulExtraCX 583 = ulExtraCY 584 = (2 * pControlDef->ulSpacing); 543 585 } 544 586 545 587 pColumnDef->cpColumn.cx = pColumnDef->cpControl.cx 546 + ul XSpacing;588 + ulExtraCX; 547 589 pColumnDef->cpColumn.cy = pColumnDef->cpControl.cy 548 + ul YSpacing;590 + ulExtraCY; 549 591 550 592 return (arc); … … 553 595 /* 554 596 *@@ ColumnCalcPositions: 555 * implementation for PROCESS_ CALC_POSITIONS in597 * implementation for PROCESS_4_CALC_POSITIONS in 556 598 * ProcessColumn. 557 599 * … … 562 604 APIRET ColumnCalcPositions(PCOLUMNDEF pColumnDef, 563 605 PROWDEF pOwningRow, // in: current row from ProcessRow 564 PLONG plX, // in/out: PROCESS_ CALC_POSITIONS only606 PLONG plX, // in/out: PROCESS_4_CALC_POSITIONS only 565 607 PDLGPRIVATE pDlgData) 566 608 { … … 568 610 569 611 // calculate column position: this includes spacing 570 ULONG ulSpacing = 0; 612 LONG lSpacingX = 0, 613 lSpacingY = 0; 571 614 572 615 // column position = *plX on ProcessRow stack … … 599 642 // should we create a PM control around the table? 600 643 if (pTableDef->pCtlDef) 644 { 601 645 // yes: 602 ulSpacing = PM_GROUP_SPACING_X / 2; // V0.9.16 (2001-10-15) [umoeller] 646 lSpacingX = PM_GROUP_SPACING_X; // V0.9.16 (2001-10-15) [umoeller] 647 lSpacingY = PM_GROUP_SPACING_X; // V0.9.16 (2001-10-15) [umoeller] 648 } 603 649 } 604 650 else … … 606 652 // no nested table, but control: 607 653 PCONTROLDEF pControlDef = (PCONTROLDEF)pColumnDef->pvDefinition; 608 ulSpacing= pControlDef->ulSpacing;654 lSpacingX = lSpacingY = pControlDef->ulSpacing; 609 655 } 610 656 … … 613 659 614 660 // calculate CONTROL pos from COLUMN pos by applying spacing 615 pColumnDef->cpControl.x = pColumnDef->cpColumn.x616 + ulSpacing;617 pColumnDef->cpControl.y = pColumnDef->cpColumn.y618 + ulSpacing;661 pColumnDef->cpControl.x = (LONG)pColumnDef->cpColumn.x 662 + lSpacingX; 663 pColumnDef->cpControl.y = (LONG)pColumnDef->cpColumn.y 664 + lSpacingY; 619 665 620 666 if (pColumnDef->fIsNestedTable) … … 626 672 arc = ProcessTable(pTableDef, 627 673 &pColumnDef->cpControl, // start pos for new table 628 PROCESS_ CALC_POSITIONS,674 PROCESS_4_CALC_POSITIONS, 629 675 pDlgData); 630 676 } … … 635 681 /* 636 682 *@@ ColumnCreateControls: 637 * implementation for PROCESS_ CREATE_CONTROLS in683 * implementation for PROCESS_5_CREATE_CONTROLS in 638 684 * ProcessColumn. 639 685 * … … 648 694 APIRET arc = NO_ERROR; 649 695 650 PCONTROLPOS pcp = NULL;651 696 PCONTROLDEF pControlDef = NULL; 652 const char *pcszTitle = NULL; 697 698 PCSZ pcszClass = NULL; 699 PCSZ pcszTitle = NULL; 653 700 ULONG flStyle = 0; 654 701 LHANDLE lHandleSet = NULLHANDLE; … … 665 712 if (!(arc = ProcessTable(pTableDef, 666 713 NULL, 667 PROCESS_ CREATE_CONTROLS,714 PROCESS_5_CREATE_CONTROLS, 668 715 pDlgData))) 669 716 { … … 674 721 { 675 722 // yes: 676 pcp = &pColumnDef->cpColumn; // !! not control723 // pcp = &pColumnDef->cpColumn; // !! not control 677 724 pControlDef = pTableDef->pCtlDef; 725 pcszClass = pControlDef->pcszClass; 678 726 pcszTitle = pControlDef->pcszText; 679 727 flStyle = pControlDef->flStyle; 680 728 681 x = pcp->x + pDlgData->ptlTotalOfs.x; 682 cx = pcp->cx - PM_GROUP_SPACING_X; 729 x = pColumnDef->cpColumn.x 730 + pDlgData->ptlTotalOfs.x 731 + PM_GROUP_SPACING_X / 2; 732 cx = pColumnDef->cpColumn.cx 733 - PM_GROUP_SPACING_X; 683 734 // note, just one spacing: for the _column_ size, 684 735 // we have specified 2 X spacings 685 y = pcp->y + pDlgData->ptlTotalOfs.y; 736 y = pColumnDef->cpColumn.y 737 + pDlgData->ptlTotalOfs.y 738 + PM_GROUP_SPACING_X / 2; 686 739 // cy = pcp->cy - PM_GROUP_SPACING_X; 687 cy = pcp->cy - /* PM_GROUP_SPACING_X - */ PM_GROUP_SPACING_TOP / 2; 740 // cy = pcp->cy - /* PM_GROUP_SPACING_X - */ PM_GROUP_SPACING_TOP; 741 cy = pColumnDef->cpColumn.cy 742 - PM_GROUP_SPACING_X / 2; // - PM_GROUP_SPACING_TOP / 2; 688 743 } 744 745 #ifdef DEBUG_DIALOG_WINDOWS 746 { 747 HWND hwndDebug; 748 // debug: create a frame with the exact size 749 // of the _column_ (not the control), so this 750 // includes spacing 751 hwndDebug = 752 WinCreateWindow(pDlgData->hwndDlg, // parent 753 WC_STATIC, 754 "", 755 WS_VISIBLE | SS_FGNDFRAME, 756 pTableDef->cpTable.x + pDlgData->ptlTotalOfs.x, 757 pTableDef->cpTable.y + pDlgData->ptlTotalOfs.y, 758 pTableDef->cpTable.cx, 759 pTableDef->cpTable.cy, 760 pDlgData->hwndDlg, // owner 761 HWND_BOTTOM, 762 -1, 763 NULL, 764 NULL); 765 winhSetPresColor(hwndDebug, PP_FOREGROUNDCOLOR, RGBCOL_BLUE); 766 } 767 #endif 689 768 } 690 769 } … … 693 772 // no nested table, but control: 694 773 pControlDef = (PCONTROLDEF)pColumnDef->pvDefinition; 695 pcp = &pColumnDef->cpControl; 774 // pcp = &pColumnDef->cpControl; 775 pcszClass = pControlDef->pcszClass; 696 776 pcszTitle = pControlDef->pcszText; 697 777 flStyle = pControlDef->flStyle; 698 778 699 x = pcp->x + pDlgData->ptlTotalOfs.x; 700 cx = pcp->cx; 701 y = pcp->y + pDlgData->ptlTotalOfs.y; 702 cy = pcp->cy; 779 x = pColumnDef->cpControl.x 780 + pDlgData->ptlTotalOfs.x; 781 cx = pColumnDef->cpControl.cx; 782 y = pColumnDef->cpControl.y 783 + pDlgData->ptlTotalOfs.y; 784 cy = pColumnDef->cpControl.cy; 703 785 704 786 // now implement hacks for certain controls … … 734 816 735 817 case 0xffff0006L: // entry field 818 case 0xffff000AL: // MLE: 736 819 // the stupid entry field resizes itself if it has 737 820 // the ES_MARGIN style, so correlate that too... dammit … … 743 826 744 827 x += cxMargin; 745 y += cxMargin; 828 y += cyMargin; 829 cx -= 2 * cxMargin; 830 cy -= 2 * cyMargin; 831 // cy -= cxMargin; 746 832 } 747 833 break; … … 749 835 } 750 836 751 if (p cp && pControlDef)837 if (pControlDef) 752 838 { 753 839 // create something: 754 // PPRESPARAMS ppp = NULL; 755 756 const char *pcszFont = pControlDef->pcszFont; 840 PCSZ pcszFont = pControlDef->pcszFont; 757 841 // can be NULL, or CTL_COMMON_FONT 758 842 if (pcszFont == CTL_COMMON_FONT) 759 843 pcszFont = pDlgData->pcszControlsFont; 760 844 761 /* if (pcszFont)762 winhStorePresParam(&ppp,763 PP_FONTNAMESIZE,764 strlen(pcszFont),765 (PVOID)pcszFont); */766 767 845 if (pColumnDef->hwndControl 768 846 = WinCreateWindow(pDlgData->hwndDlg, // parent 769 (PSZ)p ControlDef->pcszClass,847 (PSZ)pcszClass, // hacked 770 848 (pcszTitle) // hacked 771 849 ? (PSZ)pcszTitle … … 782 860 NULL)) 783 861 { 862 #ifdef DEBUG_DIALOG_WINDOWS 863 { 864 HWND hwndDebug; 865 // debug: create a frame with the exact size 866 // of the _column_ (not the control), so this 867 // includes spacing 868 hwndDebug = 869 WinCreateWindow(pDlgData->hwndDlg, // parent 870 WC_STATIC, 871 "", 872 WS_VISIBLE | SS_FGNDFRAME, 873 pColumnDef->cpColumn.x + pDlgData->ptlTotalOfs.x, 874 pColumnDef->cpColumn.y + pDlgData->ptlTotalOfs.y, 875 pColumnDef->cpColumn.cx, 876 pColumnDef->cpColumn.cy, 877 pDlgData->hwndDlg, // owner 878 HWND_BOTTOM, 879 -1, 880 NULL, 881 NULL); 882 winhSetPresColor(hwndDebug, PP_FOREGROUNDCOLOR, RGBCOL_RED); 883 } 884 #endif 885 784 886 if (lHandleSet) 785 887 { … … 850 952 * This does the following: 851 953 * 852 * -- PROCESS_ CALC_SIZES: size is taken from control def,954 * -- PROCESS_1_CALC_SIZES: size is taken from control def, 853 955 * or for tables, this produces a recursive ProcessTable 854 956 * call. 855 957 * Preconditions: none. 856 958 * 857 * -- PROCESS_ CALC_POSITIONS: position of each column959 * -- PROCESS_4_CALC_POSITIONS: position of each column 858 960 * is taken from *plX, which is increased by the 859 961 * column width by this call. … … 865 967 * size here. 866 968 * 867 * -- PROCESS_ CREATE_CONTROLS: well, creates the controls.969 * -- PROCESS_5_CREATE_CONTROLS: well, creates the controls. 868 970 * 869 971 * For tables, this recurses again. If the table has … … 878 980 PROWDEF pOwningRow, // in: current row from ProcessRow 879 981 PROCESSMODE ProcessMode, // in: processing mode (see ProcessAll) 880 PLONG plX, // in/out: PROCESS_ CALC_POSITIONS only982 PLONG plX, // in/out: PROCESS_4_CALC_POSITIONS only 881 983 PDLGPRIVATE pDlgData) 882 984 { … … 888 990 { 889 991 /* 890 * PROCESS_ CALC_SIZES:992 * PROCESS_1_CALC_SIZES: 891 993 * step 1. 892 994 */ 893 995 894 case PROCESS_ CALC_SIZES:996 case PROCESS_1_CALC_SIZES: 895 997 arc = ColumnCalcSizes(pColumnDef, 998 ProcessMode, 896 999 pDlgData); 897 1000 break; 898 1001 899 1002 /* 900 * PROCESS_ CALC_POSITIONS:901 * step 2.1003 * PROCESS_2_CALC_SIZES_FROM_TABLES: 1004 * 902 1005 */ 903 1006 904 case PROCESS_CALC_POSITIONS: 1007 case PROCESS_2_CALC_SIZES_FROM_TABLES: 1008 if (pColumnDef->fIsNestedTable) 1009 { 1010 PTABLEDEF pTableDef = (PTABLEDEF)pColumnDef->pvDefinition; 1011 if (!(arc = ProcessTable(pTableDef, 1012 NULL, 1013 PROCESS_2_CALC_SIZES_FROM_TABLES, 1014 pDlgData))) 1015 ; 1016 } 1017 else 1018 { 1019 // no nested table, but control: 1020 PCONTROLDEF pControlDef = (PCONTROLDEF)pColumnDef->pvDefinition; 1021 1022 if ( (pControlDef->szlControlProposed.cx < -1) 1023 && (pControlDef->szlControlProposed.cx >= -100) 1024 ) 1025 { 1026 // other negative CX value: 1027 // this we ignored during PROCESS_1_CALC_SIZES 1028 // (see ColumnCalcSizes); now set it to the 1029 // table width! 1030 ULONG cxThis = pOwningRow->pOwningTable->cpTable.cx 1031 * -pControlDef->szlControlProposed.cx / 100; 1032 1033 // but the table already has spacing applied, 1034 // so reduce that 1035 pColumnDef->cpControl.cx = cxThis 1036 - (2 * pControlDef->ulSpacing); 1037 1038 pColumnDef->cpColumn.cx = cxThis; 1039 1040 // now we might have to re-compute auto-size 1041 if (pControlDef->szlControlProposed.cy == -1) 1042 { 1043 SIZEL szlAuto; 1044 if (!(arc = CalcAutoSize(pControlDef, 1045 // now that we now the width, 1046 // use that! 1047 pColumnDef->cpControl.cx, 1048 &szlAuto, 1049 pDlgData))) 1050 { 1051 LONG cyColumnOld = pColumnDef->cpColumn.cy; 1052 LONG lDelta; 1053 PROWDEF pRowThis; 1054 1055 pColumnDef->cpControl.cy = szlAuto.cy; 1056 pColumnDef->cpColumn.cy = szlAuto.cy 1057 + (2 * pControlDef->ulSpacing); 1058 } 1059 } 1060 } 1061 1062 if ( (pControlDef->szlControlProposed.cy < -1) 1063 && (pControlDef->szlControlProposed.cy >= -100) 1064 ) 1065 { 1066 // same thing for CY, but this time we 1067 // take the row height 1068 ULONG cyThis = pOwningRow->cpRow.cy 1069 * -pControlDef->szlControlProposed.cy / 100; 1070 1071 // but the table already has spacing applied, 1072 // so reduce that 1073 pColumnDef->cpControl.cy = cyThis 1074 - (2 * pControlDef->ulSpacing); 1075 1076 pColumnDef->cpColumn.cy = cyThis; 1077 } 1078 } 1079 break; 1080 1081 /* 1082 * PROCESS_3_CALC_FINAL_TABLE_SIZES: 1083 * 1084 */ 1085 1086 case PROCESS_3_CALC_FINAL_TABLE_SIZES: 1087 // re-run calc sizes since we now know all 1088 // the auto-size items 1089 arc = ColumnCalcSizes(pColumnDef, 1090 ProcessMode, 1091 pDlgData); 1092 break; 1093 1094 /* 1095 * PROCESS_4_CALC_POSITIONS: 1096 * step 4. 1097 */ 1098 1099 case PROCESS_4_CALC_POSITIONS: 905 1100 arc = ColumnCalcPositions(pColumnDef, 906 1101 pOwningRow, … … 910 1105 911 1106 /* 912 * PROCESS_ CREATE_CONTROLS:913 * step 3.1107 * PROCESS_5_CREATE_CONTROLS: 1108 * step 5. 914 1109 */ 915 1110 916 case PROCESS_ CREATE_CONTROLS:1111 case PROCESS_5_CREATE_CONTROLS: 917 1112 arc = ColumnCreateControls(pColumnDef, 918 1113 pDlgData); … … 944 1139 pRowDef->pOwningTable = pOwningTable; 945 1140 946 if (ProcessMode == PROCESS_CALC_SIZES) 1141 if ( (ProcessMode == PROCESS_1_CALC_SIZES) 1142 || (ProcessMode == PROCESS_3_CALC_FINAL_TABLE_SIZES) 1143 ) 947 1144 { 948 1145 pRowDef->cpRow.cx = 0; 949 1146 pRowDef->cpRow.cy = 0; 950 1147 } 951 else if (ProcessMode == PROCESS_ CALC_POSITIONS)1148 else if (ProcessMode == PROCESS_4_CALC_POSITIONS) 952 1149 { 953 1150 // set up x and y so that the columns can … … 969 1166 if (!(arc = ProcessColumn(pColumnDefThis, pRowDef, ProcessMode, &lX, pDlgData))) 970 1167 { 971 if (ProcessMode == PROCESS_CALC_SIZES) 1168 if ( (ProcessMode == PROCESS_1_CALC_SIZES) 1169 || (ProcessMode == PROCESS_3_CALC_FINAL_TABLE_SIZES) 1170 ) 972 1171 { 973 1172 // row width = sum of all columns … … 997 1196 * nested table is found in a COLUMNDEF. 998 1197 * 999 * With PROCESS_ CALC_POSITIONS, pptl must specify1198 * With PROCESS_4_CALC_POSITIONS, pptl must specify 1000 1199 * the lower left corner of the table. For the 1001 1200 * root call, this will be {0, 0}; for nested calls, … … 1006 1205 1007 1206 APIRET ProcessTable(PTABLEDEF pTableDef, 1008 const CONTROLPOS *pcpTable, // in: table position with PROCESS_ CALC_POSITIONS1207 const CONTROLPOS *pcpTable, // in: table position with PROCESS_4_CALC_POSITIONS 1009 1208 PROCESSMODE ProcessMode, // in: processing mode (see ProcessAll) 1010 1209 PDLGPRIVATE pDlgData) … … 1014 1213 PLISTNODE pNode; 1015 1214 1016 if (ProcessMode == PROCESS_CALC_SIZES) 1017 { 1018 pTableDef->cpTable.cx = 0; 1019 pTableDef->cpTable.cy = 0; 1020 } 1021 else if (ProcessMode == PROCESS_CALC_POSITIONS) 1022 { 1023 pTableDef->cpTable.x = pcpTable->x; 1024 pTableDef->cpTable.y = pcpTable->y; 1025 1026 // start the rows on top 1027 lY = pcpTable->y + pTableDef->cpTable.cy; 1215 switch (ProcessMode) 1216 { 1217 case PROCESS_1_CALC_SIZES: 1218 case PROCESS_3_CALC_FINAL_TABLE_SIZES: 1219 pTableDef->cpTable.cx = 0; 1220 pTableDef->cpTable.cy = 0; 1221 break; 1222 1223 case PROCESS_4_CALC_POSITIONS: 1224 pTableDef->cpTable.x = pcpTable->x; 1225 pTableDef->cpTable.y = pcpTable->y; 1226 1227 // start the rows on top 1228 lY = pcpTable->y + pTableDef->cpTable.cy; 1229 break; 1028 1230 } 1029 1231 … … 1034 1236 if (!(arc = ProcessRow(pRowDefThis, pTableDef, ProcessMode, &lY, pDlgData))) 1035 1237 { 1036 if (ProcessMode == PROCESS_CALC_SIZES) 1238 if ( (ProcessMode == PROCESS_1_CALC_SIZES) 1239 || (ProcessMode == PROCESS_3_CALC_FINAL_TABLE_SIZES) 1240 ) 1037 1241 { 1038 1242 // table width = maximum width of a row … … 1064 1268 * following for each call (in this order): 1065 1269 * 1066 * -- PROCESS_CALC_SIZES: calculates the sizes 1067 * of all tables, rows, columns, and controls. 1068 * 1069 * After this first call, we know all the sizes 1070 * only and can then calculate the positions. 1071 * 1072 * -- PROCESS_CALC_POSITIONS: calculates the positions 1073 * based on the sizes calculated before. 1074 * 1075 * -- PROCESS_CREATE_CONTROLS: creates the controls with the 1076 * positions and sizes calculated before. 1270 * -- PROCESS_1_CALC_SIZES: calculates the preliminary 1271 * sizes of all tables, rows, columns, and controls 1272 * except those controls that have specified that 1273 * their size should depend on others. 1274 * 1275 * -- PROCESS_2_CALC_SIZES_FROM_TABLES: calculates the 1276 * sizes of those controls that want to depend on 1277 * others. 1278 * 1279 * -- PROCESS_3_CALC_FINAL_TABLE_SIZES: since the table 1280 * and row sizes might have changed during 1281 * PROCESS_2_CALC_SIZES_FROM_TABLES, we need to re-run 1282 * to re-calculate the size of all rows and tables. 1283 * After this first call, we know _all_ the sizes 1284 * and can then calculate the positions. 1285 * 1286 * -- PROCESS_4_CALC_POSITIONS: calculates the positions 1287 * based on the sizes calculated before. 1288 * 1289 * -- PROCESS_5_CREATE_CONTROLS: creates the controls with the 1290 * positions and sizes calculated before. 1077 1291 * 1078 1292 * The second trick is the precondition that tables may … … 1084 1298 1085 1299 APIRET ProcessAll(PDLGPRIVATE pDlgData, 1086 PSIZEL pszlClient,1087 1300 PROCESSMODE ProcessMode) 1088 1301 { … … 1094 1307 switch (ProcessMode) 1095 1308 { 1096 case PROCESS_CALC_SIZES: 1097 pszlClient->cx = 0; 1098 pszlClient->cy = 0; 1309 case PROCESS_1_CALC_SIZES: 1310 case PROCESS_3_CALC_FINAL_TABLE_SIZES: 1311 pDlgData->szlClient.cx = 0; 1312 pDlgData->szlClient.cy = 0; 1099 1313 break; 1100 1314 1101 case PROCESS_ CALC_POSITIONS:1315 case PROCESS_4_CALC_POSITIONS: 1102 1316 // start with the table on top 1103 cpTable.y = p szlClient->cy;1317 cpTable.y = pDlgData->szlClient.cy; 1104 1318 break; 1105 1319 } … … 1109 1323 PTABLEDEF pTableDefThis = (PTABLEDEF)pNode->pItemData; 1110 1324 1111 if (ProcessMode == PROCESS_ CALC_POSITIONS)1325 if (ProcessMode == PROCESS_4_CALC_POSITIONS) 1112 1326 { 1113 1327 cpTable.x = 0; … … 1120 1334 pDlgData))) 1121 1335 { 1122 if (ProcessMode == PROCESS_CALC_SIZES) 1336 if ( (ProcessMode == PROCESS_2_CALC_SIZES_FROM_TABLES) 1337 || (ProcessMode == PROCESS_3_CALC_FINAL_TABLE_SIZES) 1338 ) 1123 1339 { 1124 1340 // all sizes have now been computed: 1125 p szlClient->cx += pTableDefThis->cpTable.cx;1126 p szlClient->cy += pTableDefThis->cpTable.cy;1341 pDlgData->szlClient.cx += pTableDefThis->cpTable.cx; 1342 pDlgData->szlClient.cy += pTableDefThis->cpTable.cy; 1127 1343 } 1128 1344 } … … 1335 1551 pCurrentTable, 1336 1552 &pColumnDef))) 1553 { 1554 pCurrentTable->pOwningColumn = pColumnDef; 1337 1555 lstAppendItem(&pCurrentRow->llColumns, 1338 1556 pColumnDef); 1557 } 1339 1558 } 1340 1559 } … … 1427 1646 *@@ Dlg2_CalcSizes: 1428 1647 * 1648 * After this, DLGPRIVATE.szlClient is valid. 1649 * 1429 1650 *@@added V0.9.15 (2001-08-26) [umoeller] 1430 1651 */ 1431 1652 1432 APIRET Dlg2_CalcSizes(PDLGPRIVATE pDlgData ,1433 PSIZEL pszlClient) // out: dialog's client size 1434 { 1435 APIRET arc = ProcessAll(pDlgData, 1436 pszlClient,1437 PROCESS_CALC_SIZES);1653 APIRET Dlg2_CalcSizes(PDLGPRIVATE pDlgData) 1654 { 1655 APIRET arc; 1656 1657 if (!(arc = ProcessAll(pDlgData, 1658 PROCESS_1_CALC_SIZES))) 1438 1659 // this goes into major recursions... 1660 // run again to compute sizes that depend on tables 1661 if (!(arc = ProcessAll(pDlgData, 1662 PROCESS_2_CALC_SIZES_FROM_TABLES))) 1663 arc = ProcessAll(pDlgData, 1664 PROCESS_3_CALC_FINAL_TABLE_SIZES); 1439 1665 1440 1666 // free the cached font resources that … … 1461 1687 1462 1688 APIRET Dlg3_PositionAndCreate(PDLGPRIVATE pDlgData, 1463 PSIZEL pszlClient, // in: dialog's client size1464 1689 HWND *phwndFocusItem) // out: item to give focus to 1465 1690 { … … 1472 1697 1473 1698 ProcessAll(pDlgData, 1474 pszlClient, 1475 PROCESS_CALC_POSITIONS); 1699 PROCESS_4_CALC_POSITIONS); 1476 1700 1477 1701 /* … … 1485 1709 1486 1710 ProcessAll(pDlgData, 1487 pszlClient, 1488 PROCESS_CREATE_CONTROLS); 1711 PROCESS_5_CREATE_CONTROLS); 1489 1712 1490 1713 if (pDlgData->hwndDefPushbutton) … … 1564 1787 * automatically here. Even better, for many controls, 1565 1788 * auto-sizing is supported according to the control's 1566 * text (e.g. for statics and checkboxes). 1789 * text (e.g. for statics and checkboxes). In a way, 1790 * this is a bit similar to HTML tables. 1567 1791 * 1568 1792 * A regular standard dialog would use something like … … 1600 1824 * in some table. Tables may also nest (see below). 1601 1825 * 1602 * The macros are:1826 * The DLGHITEM macros are: 1603 1827 * 1604 1828 * -- START_TABLE starts a new table. The tables may nest, … … 1653 1877 * always be a START_ROW first. 1654 1878 * 1879 * While it is possible to set up the CONTROLDEFs manually 1880 * as static structures, I recommend using the bunch of 1881 * other macros that were defined in dialog.h for this. 1882 * For example, you can use CONTROLDEF_PUSHBUTTON to create 1883 * a push button, and many more. 1884 * 1655 1885 * To create a dialog, set up arrays like the following: 1656 1886 * 1657 1887 + // control definitions referenced by DlgTemplate: 1658 1888 + CONTROLDEF 1659 + (1) GroupDef = { 1660 + WC_STATIC, "", ...., 1661 + { 0, 0 }, // size, ignored for groups 1662 + 5 // spacing 1663 + }, 1664 + (2) CnrDef = { 1665 + WC_CONTAINER, "", ...., 1666 + { 50, 50 }, // size 1667 + 5 // spacing 1668 + }, 1669 + (3) Static = { 1670 + WC_STATIC, "Static below cnr", ..., 1671 + { SZL_AUTOSIZE, SZL_AUTOSIZE }, // size 1672 + 5 // spacing 1673 + }, 1674 + (4) OKButton = { 1675 + WC_STATIC, "~OK", ..., 1676 + { 100, 30 }, // size 1677 + 5 // spacing 1678 + }, 1679 + (5) CancelButton = { 1680 + WC_STATIC, "~Cancel", ..., 1681 + { 100, 30 }, // size 1682 + 5 // spacing 1683 + }; 1889 + (1) GroupDef = CONTROLDEF_GROUP("Group", 1890 + -1, // ID 1891 + SZL_AUTOSIZE, 1892 + SZL_AUTOSIZE), 1893 + (2) CnrDef = CONTROLDEF_CONTAINER(-1, // ID, 1894 + 50, 1895 + 50), 1896 + (3) Static = CONTROLDEF_TEXT("Static below cnr", 1897 + -1, // ID 1898 + SZL_AUTOSIZE, 1899 + SZL_AUTOSIZE), 1900 + (4) OKButton = CONTROLDEF_DEFPUSHBUTTON("~OK", 1901 + DID_OK, 1902 + SZL_AUTOSIZE, 1903 + SZL_AUTOSIZE), 1904 + (5) CancelButton = CONTROLDEF_PUSHBUTTON("~Cancel", 1905 + DID_CANCEL, 1906 + SZL_AUTOSIZE, 1907 + SZL_AUTOSIZE); 1684 1908 + 1685 1909 + DLGHITEM DlgTemplate[] = … … 1723 1947 + ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŒ 1724 1948 * 1725 * <B>Errors:</B>1726 *1727 * This does not return a HWND, but an APIRET. This will be1728 * one of the following:1729 *1730 * -- NO_ERROR: only in that case, the phwndDlg ptr1731 * receives the HWND of the new dialog, which can1732 * then be given to WinProcessDlg. Don't forget1733 * WinDestroyWindow.1734 *1735 * -- ERROR_NOT_ENOUGH_MEMORY1736 *1737 * -- DLGERR_ROW_BEFORE_TABLE: a row definition appeared1738 * outside a table definition.1739 *1740 * -- DLGERR_CONTROL_BEFORE_ROW: a control definition1741 * appeared right after a table definition. You must1742 * specify a row first.1743 *1744 * -- DLGERR_NULL_CTL_DEF: TYPE_END_TABLE was specified,1745 * but the CONTROLDEF ptr was NULL.1746 *1747 * -- DLGERR_CANNOT_CREATE_FRAME: unable to create the1748 * WC_FRAME window. Maybe an invalid owner was specified.1749 *1750 * -- DLGERR_INVALID_CODE: invalid "Type" field in1751 * DLGHITEM.1752 *1753 * -- DLGERR_TABLE_NOT_CLOSED, DLGERR_TOO_MANY_TABLES_CLOSED:1754 * improper nesting of TYPE_START_NEW_TABLE and1755 * TYPE_END_TABLE fields.1756 *1757 1949 * <B>Example:</B> 1758 1950 * … … 1762 1954 + if (NO_ERROR == dlghCreateDlg(&hwndDlg, 1763 1955 + hwndOwner, 1764 + FCF_DLGBORDER | FCF_NOBYTEALIGN, 1956 + FCF_TITLEBAR | FCF_SYSMENU 1957 + | FCF_DLGBORDER | FCF_NOBYTEALIGN, 1765 1958 + fnwpMyDlgProc, 1766 1959 + "My Dlg Title", … … 1773 1966 + WinDestroyWindow(hwndDlg); 1774 1967 + } 1968 * 1969 * <B>Errors:</B> 1970 * 1971 * This does not return a HWND, but an APIRET. This will be 1972 * one of the following: 1973 * 1974 * -- NO_ERROR: only in that case, the phwndDlg ptr 1975 * receives the HWND of the new dialog, which can 1976 * then be given to WinProcessDlg. Don't forget 1977 * WinDestroyWindow. 1978 * 1979 * -- ERROR_NOT_ENOUGH_MEMORY 1980 * 1981 * -- DLGERR_ROW_BEFORE_TABLE: a row definition appeared 1982 * outside a table definition. 1983 * 1984 * -- DLGERR_CONTROL_BEFORE_ROW: a control definition 1985 * appeared right after a table definition. You must 1986 * specify a row first. 1987 * 1988 * -- DLGERR_NULL_CTL_DEF: TYPE_END_TABLE was specified, 1989 * but the CONTROLDEF ptr was NULL. 1990 * 1991 * -- DLGERR_CANNOT_CREATE_FRAME: unable to create the 1992 * WC_FRAME window. Maybe an invalid owner was specified. 1993 * 1994 * -- DLGERR_INVALID_CODE: invalid "Type" field in 1995 * DLGHITEM. 1996 * 1997 * -- DLGERR_TABLE_NOT_CLOSED, DLGERR_TOO_MANY_TABLES_CLOSED: 1998 * improper nesting of TYPE_START_NEW_TABLE and 1999 * TYPE_END_TABLE fields. 2000 * 2001 * -- DLGERR_CANNOT_CREATE_CONTROL: creation of some 2002 * sub-control failed. Maybe an invalid window class 2003 * was specified. 2004 * 2005 * -- DLGERR_INVALID_CONTROL_TITLE: bad window title in 2006 * control. 2007 * 2008 * -- DLGERR_INVALID_STATIC_BITMAP: static bitmap contains 2009 * an invalid bitmap handle. 1775 2010 * 1776 2011 *@@changed V0.9.14 (2001-07-07) [umoeller]: fixed disabled mouse with hwndOwner == HWND_DESKTOP … … 1860 2095 HWND hwndDlg = pDlgData->hwndDlg; 1861 2096 HWND hwndFocusItem = NULLHANDLE; 1862 SIZEL szlClient = {0};1863 2097 RECTL rclClient; 1864 2098 … … 1868 2102 */ 1869 2103 1870 if (!(arc = Dlg2_CalcSizes(pDlgData, 1871 &szlClient))) 2104 if (!(arc = Dlg2_CalcSizes(pDlgData))) 1872 2105 { 1873 2106 WinSubclassWindow(hwndDlg, pfnwpDialogProc); … … 1881 2114 rclClient.xLeft = 10; 1882 2115 rclClient.yBottom = 10; 1883 rclClient.xRight = szlClient.cx + 2 * SPACING;1884 rclClient.yTop = szlClient.cy + 2 * SPACING;2116 rclClient.xRight = pDlgData->szlClient.cx + 2 * SPACING; 2117 rclClient.yTop = pDlgData->szlClient.cy + 2 * SPACING; 1885 2118 WinCalcFrameRect(hwndDlg, 1886 2119 &rclClient, … … 1896 2129 1897 2130 arc = Dlg3_PositionAndCreate(pDlgData, 1898 &szlClient,1899 2131 &hwndFocusItem); 1900 2132 … … 2021 2253 */ 2022 2254 2023 Dlg2_CalcSizes(pDlgData, 2024 &szlClient); 2255 Dlg2_CalcSizes(pDlgData); 2025 2256 2026 2257 // WinSubclassWindow(hwndDlg, pfnwpDialogProc); … … 2054 2285 { 2055 2286 if (!(arc = Dlg3_PositionAndCreate(pDlgData, 2056 &szlClient,2057 2287 &hwndFocusItem))) 2058 2288 WinSetFocus(HWND_DESKTOP, hwndFocusItem); … … 2359 2589 ULONG flButtons = flFlags & 0xF; // low nibble contains MB_YESNO etc. 2360 2590 2361 const char *p0 = "Error",2362 *p1 = NULL,2363 *p2 = NULL;2591 PCSZ p0 = "Error", 2592 p1 = NULL, 2593 p2 = NULL; 2364 2594 2365 2595 Icon.pcszText = (PCSZ)hptrIcon; … … 2672 2902 CTL_COMMON_FONT, 2673 2903 0, 2674 { 300, 20}, // size2904 { 300, SZL_AUTOSIZE }, // size 2675 2905 5 // spacing 2676 2906 }, -
trunk/src/helpers/dosh.c
r135 r137 4242 4242 } 4243 4243 4244 /* ****************************************************************** 4245 * 4246 * Testcase 4247 * 4248 ********************************************************************/ 4249 4250 #ifdef BUILD_MAIN 4251 4252 int main (int argc, char *argv[]) 4253 { 4254 ULONG ul; 4255 4256 printf("Drive checker ("__DATE__")\n"); 4257 printf(" type fs remot fixed parrm bootd media audio eas longn\n"); 4258 4259 for (ul = 1; 4260 ul <= 26; 4261 ul++) 4262 { 4263 XDISKINFO xdi; 4264 APIRET arc = doshGetDriveInfo(ul, 4265 0, // DRVFL_TOUCHFLOPPIES, 4266 &xdi); 4267 4268 printf(" %c: ", xdi.cDriveLetter, ul); 4269 4270 if (!xdi.fPresent) 4271 printf("not present\n"); 4272 else 4273 { 4274 if (arc) 4275 printf("error %d (IsFixedDisk: %d, QueryDiskParams %d, QueryMedia %d)\n", 4276 arc, 4277 xdi.arcIsFixedDisk, 4278 xdi.arcQueryDiskParams, 4279 xdi.arcQueryMedia); 4280 else 4281 { 4282 ULONG aulFlags[] = 4283 { 4284 DFL_REMOTE, 4285 DFL_FIXED, 4286 DFL_PARTITIONABLEREMOVEABLE, 4287 DFL_BOOTDRIVE, 4288 0, 4289 DFL_MEDIA_PRESENT, 4290 DFL_AUDIO_CD, 4291 DFL_SUPPORTS_EAS, 4292 DFL_SUPPORTS_LONGNAMES 4293 }; 4294 ULONG ul2; 4295 4296 PCSZ pcsz = NULL; 4297 4298 switch (xdi.bType) 4299 { 4300 case DRVTYPE_HARDDISK: pcsz = "HDISK "; break; 4301 case DRVTYPE_FLOPPY: pcsz = "FLOPPY"; break; 4302 case DRVTYPE_TAPE: pcsz = "TAPE "; break; 4303 case DRVTYPE_VDISK: pcsz = "VDISK "; break; 4304 case DRVTYPE_CDROM: pcsz = "CDROM "; break; 4305 case DRVTYPE_LAN: pcsz = "LAN "; break; 4306 case DRVTYPE_PARTITIONABLEREMOVEABLE: 4307 pcsz = "PRTREM"; break; 4308 default: 4309 printf("bType=%d, BPB.bDevType=%d", 4310 xdi.bType, 4311 xdi.bpb.bDeviceType); 4312 printf("\n "); 4313 } 4314 4315 if (pcsz) 4316 printf("%s ", pcsz); 4317 4318 if (xdi.lFileSystem < 0) 4319 // negative means error 4320 printf("E%3d ", xdi.lFileSystem); // , xdi.bFileSystem); 4321 else 4322 printf("%7s ", xdi.szFileSystem); // , xdi.bFileSystem); 4323 4324 for (ul2 = 0; 4325 ul2 < ARRAYITEMCOUNT(aulFlags); 4326 ul2++) 4327 { 4328 if (xdi.flDevice & aulFlags[ul2]) 4329 printf(" X "); 4330 else 4331 if ( (xdi.arcOpenLongnames) 4332 && (aulFlags[ul2] == DFL_SUPPORTS_LONGNAMES) 4333 ) 4334 printf(" E%03d ", xdi.arcOpenLongnames); 4335 else 4336 printf(" - "); 4337 } 4338 printf("\n"); 4339 } 4340 } 4341 } 4342 } 4343 4344 #endif 4244 -
trunk/src/helpers/helpers_pre.in
r129 r137 71 71 $(OUTPUTDIR)\syssound.obj \ 72 72 $(OUTPUTDIR)\tmsgfile.obj \ 73 $(OUTPUTDIR)\vcard.obj \ 73 74 $(OUTPUTDIR)\wphandle.obj \ 74 75 $(OUTPUTDIR)\xprf.obj \ -
trunk/src/helpers/makefile
r75 r137 142 142 @echo ----- Leaving $(MAKEDIR) 143 143 144 # "test" target: for test cases 145 TESTCASE_DIR = testcase 146 147 TESTCASE_CC = icc /c /ti+ /w2 /ss /se /i$(HELPERS_BASE)\include /DDEBUG_DIALOG_WINDOWS /Fo$(TESTCASE_DIR)\$(@B).obj $(@B).c 148 149 .c.{$(TESTCASE_DIR)}.obj: 150 @echo $(MAKEDIR)\makefile: Compiling $(@B).c 151 $(TESTCASE_CC) 152 153 # testcase executables 154 TESTCASE_TARGETS = \ 155 dosh.exe \ 156 dialog.exe \ 157 vcard.exe \ 158 159 # dosh.exe 160 DOSH_TEST_OBJS = \ 161 $(TESTCASE_DIR)\dosh.obj \ 162 $(TESTCASE_DIR)\_test_dosh.obj 163 164 dosh.exe: $(DOSH_TEST_OBJS) 165 ilink /debug /optfunc /pmtype:vio $(DOSH_TEST_OBJS) /o:$@ 166 167 # dialog.exe 168 DIALOG_TEST_OBJS = \ 169 $(TESTCASE_DIR)\dialog.obj \ 170 $(TESTCASE_DIR)\_test_dialog.obj \ 171 $(TESTCASE_DIR)\winh.obj \ 172 $(TESTCASE_DIR)\xstring.obj \ 173 $(TESTCASE_DIR)\linklist.obj \ 174 $(TESTCASE_DIR)\comctl.obj \ 175 $(TESTCASE_DIR)\stringh.obj \ 176 $(TESTCASE_DIR)\dosh.obj \ 177 $(TESTCASE_DIR)\gpih.obj 178 179 dialog.exe: $(DIALOG_TEST_OBJS) 180 ilink /debug /optfunc /pmtype:pm $(DIALOG_TEST_OBJS) /o:$@ 181 182 # vcard.exe 183 VCARD_TEST_OBJS = \ 184 $(TESTCASE_DIR)\vcard.obj \ 185 $(TESTCASE_DIR)\_test_vcard.obj \ 186 $(TESTCASE_DIR)\xstring.obj \ 187 $(TESTCASE_DIR)\stringh.obj \ 188 $(TESTCASE_DIR)\linklist.obj \ 189 $(TESTCASE_DIR)\dosh.obj \ 190 $(TESTCASE_DIR)\prfh.obj \ 191 $(TESTCASE_DIR)\nls.obj 192 193 vcard.exe: $(VCARD_TEST_OBJS) 194 ilink /debug /pmtype:vio $(VCARD_TEST_OBJS) /o:$@ 195 196 test: $(TESTCASE_TARGETS) 197 144 198 # Define the main dependency between the output HELPERS.LIB and 145 199 # all the object files. -
trunk/src/helpers/textview.c
r91 r137 808 808 809 809 case 6: // A or /A HREF= (link) 810 {811 810 // four characters with hex anchor index (>=1) 812 811 // or "####" … … 825 824 826 825 ulSkip = 6; 827 break; }826 break; 828 827 829 828 case 7: // A NAME= (anchor name) … … 834 833 // only used with TXM_JUMPTOANCHORNAME, which then 835 834 // searches the buffer 836 PSZ pEnd = strchr((*ppCurrent)+2, 0xFF);837 if (pEnd )835 PSZ pEnd; 836 if (pEnd = strchr((*ppCurrent)+2, 0xFF)) 838 837 { 839 838 ulSkip = pEnd - *ppCurrent + 1; … … 844 843 fPaintEscapeWord = TRUE; 845 844 } 846 break; } 845 } 846 break; 847 847 848 848 case 0x10: // relative point size in percent … … 1155 1155 } 1156 1156 1157 pWord = txvCreateWord(hps, 1158 &pCurrent, // advanced to next word 1159 &flbuf); 1160 if (pWord) 1157 if (pWord = txvCreateWord(hps, 1158 &pCurrent, // advanced to next word 1159 &flbuf)) 1161 1160 { 1162 1161 lstAppendItem(&pxfd->llWords, pWord); … … 2279 2278 2280 2279 // allocate TEXTVIEWWINDATA for QWL_USER 2281 ptxvd = (PTEXTVIEWWINDATA)malloc(sizeof(TEXTVIEWWINDATA)); 2282 if (ptxvd) 2280 if (ptxvd = (PTEXTVIEWWINDATA)malloc(sizeof(TEXTVIEWWINDATA))) 2283 2281 { 2284 2282 SIZEL szlPage = {0, 0}; … … 2380 2378 mrc = (MPARAM)FALSE; // OK 2381 2379 } 2382 break; } 2380 } 2381 break; 2383 2382 2384 2383 /* … … 2392 2391 case WM_SETWINDOWPARAMS: 2393 2392 { 2394 WNDPARAMS *pwndParams = (WNDPARAMS *)mp1;2395 if (pwndParams )2393 WNDPARAMS *pwndParams; 2394 if (pwndParams = (WNDPARAMS *)mp1) 2396 2395 { 2397 2396 if (pwndParams->fsStatus & WPM_TEXT) … … 2412 2411 } 2413 2412 } 2414 break; } 2413 } 2414 break; 2415 2415 2416 2416 /* … … 2442 2442 } 2443 2443 } 2444 break; } 2444 } 2445 break; 2445 2446 2446 2447 /* … … 2538 2539 2539 2540 // WinEndPaint(hps); 2540 break; } 2541 } 2542 break; 2541 2543 2542 2544 /* … … 2577 2579 2578 2580 case WM_VSCROLL: 2579 {2580 2581 if (ptxvd->fVScrollVisible) 2581 2582 { … … 2589 2590 mp2); 2590 2591 } 2591 break; }2592 break; 2592 2593 2593 2594 /* … … 2597 2598 2598 2599 case WM_HSCROLL: 2599 {2600 2600 if (ptxvd->fHScrollVisible) 2601 2601 { … … 2609 2609 mp2); 2610 2610 } 2611 break; }2611 break; 2612 2612 2613 2613 /* … … 2624 2624 (mp2 != 0)); 2625 2625 WinReleasePS(hps); 2626 break; } 2626 } 2627 break; 2627 2628 2628 2629 /* … … 2633 2634 case WM_MOUSEMOVE: 2634 2635 { 2635 HWND hwndOwner = WinQueryWindow(hwndTextView, QW_OWNER);2636 if (hwndOwner )2636 HWND hwndOwner; 2637 if (hwndOwner = WinQueryWindow(hwndTextView, QW_OWNER)) 2637 2638 { 2638 2639 HPOINTER hptrSet … … 2646 2647 WinSetPointer(HWND_DESKTOP, hptrSet); 2647 2648 } 2648 break; } 2649 } 2650 break; 2649 2651 2650 2652 /* … … 2656 2658 { 2657 2659 POINTL ptlPos; 2658 PLISTNODE pWordNodeClicked = NULL;2660 PLISTNODE pWordNodeClicked; 2659 2661 2660 2662 ptlPos.x = SHORT1FROMMP(mp1) + ptxvd->ulViewXOfs; … … 2666 2668 ptxvd->usLastAnchorClicked = 0; 2667 2669 2668 pWordNodeClicked = txvFindWordFromPoint(&ptxvd->xfd, 2669 &ptlPos); 2670 2671 if (pWordNodeClicked) 2670 if (pWordNodeClicked = txvFindWordFromPoint(&ptxvd->xfd, 2671 &ptlPos)) 2672 2672 { 2673 2673 PTXVWORD pWordClicked = (PTXVWORD)pWordNodeClicked->pItemData; … … 2709 2709 WinSetCapture(HWND_DESKTOP, hwndTextView); 2710 2710 mrc = (MPARAM)TRUE; 2711 break; } 2711 } 2712 break; 2712 2713 2713 2714 /* … … 2732 2733 2733 2734 // nofify owner 2734 hwndOwner = WinQueryWindow(hwndTextView, QW_OWNER); 2735 if (hwndOwner) 2735 if (hwndOwner = WinQueryWindow(hwndTextView, QW_OWNER)) 2736 2736 WinPostMsg(hwndOwner, 2737 2737 WM_CONTROL, … … 2743 2743 2744 2744 mrc = (MPARAM)TRUE; 2745 break; } 2745 } 2746 break; 2746 2747 2747 2748 /* … … 2856 2857 else 2857 2858 mrc = (MPARAM)TRUE; 2858 break; } 2859 } 2860 break; 2859 2861 2860 2862 /* … … 2893 2895 mrc = (MPARAM)TRUE; 2894 2896 } 2895 break; } 2897 } 2898 break; 2896 2899 2897 2900 /* … … 2942 2945 mrc = (MPARAM)TRUE; 2943 2946 } 2944 break; } 2947 } 2948 break; 2945 2949 2946 2950 /* … … 2962 2966 FALSE, 2963 2967 FALSE); // quick format 2964 break; } 2968 } 2969 break; 2965 2970 2966 2971 /* … … 3020 3025 3021 3026 case TXM_JUMPTOANCHORNAME: 3022 {3023 3027 if (mp1) 3024 3028 { … … 3058 3062 } 3059 3063 } 3060 break; }3064 break; 3061 3065 3062 3066 /* -
trunk/src/helpers/winh.c
r135 r137 3949 3949 * in WM_INITDLG of the notebook dlg function if the app 3950 3950 * has determined that it is running on Warp 4. 3951 * 3952 *@@changed V0.9.16 (2002-02-02) [umoeller]: fixed entry fields 3951 3953 */ 3952 3954 … … 3993 3995 if (ulDownUnits) 3994 3996 { 3997 CHAR szClass[10]; 3995 3998 SWP swp; 3996 // _Pmpf(("Moving downwards %d pixels", ptl.y)); 3999 LONG lDeltaX = 0, 4000 lDeltaY = 0; 4001 // special handling for entry fields 4002 // V0.9.16 (2002-02-02) [umoeller] 4003 WinQueryClassName(hwndItem, sizeof(szClass), szClass); 4004 if (!strcmp(szClass, "#6")) 4005 { 4006 lDeltaX = 3 * WinQuerySysValue(HWND_DESKTOP, SV_CXBORDER); 4007 lDeltaY = 3 * WinQuerySysValue(HWND_DESKTOP, SV_CYBORDER); 4008 } 4009 3997 4010 WinQueryWindowPos(hwndItem, &swp); 3998 4011 WinSetWindowPos(hwndItem, 0, 3999 swp.x ,4000 swp.y - ptl.y ,4012 swp.x + lDeltaX, 4013 swp.y - ptl.y + lDeltaY, 4001 4014 0, 0, 4002 4015 SWP_MOVE); -
trunk/src/helpers/xstring.c
r132 r137 478 478 PXSTRING xstrCreate(ULONG ulPreAllocate) 479 479 { 480 PXSTRING pxstr = (PXSTRING)malloc(sizeof(XSTRING));481 if (pxstr )480 PXSTRING pxstr; 481 if (pxstr = (PXSTRING)malloc(sizeof(XSTRING))) 482 482 xstrInit(pxstr, ulPreAllocate); 483 483 … … 1404 1404 *@@added V0.9.9 (2001-02-28) [umoeller] 1405 1405 *@@changed V0.9.9 (2001-03-06) [lafaix]: removed memory allocation 1406 */ 1407 1408 ULONG xstrDecode(PXSTRING pxstr) // in/out: string to be decoded 1406 *@@changed V0.9.16 (2002-02-02) [umoeller]: added cKey 1407 */ 1408 1409 ULONG xstrDecode2(PXSTRING pxstr, // in/out: string to be decoded 1410 CHAR cKey) // in: encoding key (normally '%') 1409 1411 { 1410 1412 ULONG ulrc = 0; … … 1423 1425 // pSource points to next char now 1424 1426 1425 if (c == '%')1427 if (c == cKey) 1426 1428 { 1427 1429 static char ach[] = "0123456789ABCDEF"; … … 1453 1455 1454 1456 // not encoding, or null after '%', or invalid encoding: 1455 // just copy this1457 // just leave thisalone 1456 1458 *pDest++ = c; 1457 1459 } // while ((ch = *pSource++)) … … 1465 1467 1466 1468 return (ulrc); 1469 } 1470 1471 /* 1472 *@@ xstrDecode: 1473 * added for compatibility with exports. 1474 * 1475 *@@added V0.9.16 (2002-02-02) [umoeller] 1476 */ 1477 1478 ULONG xstrDecode(PXSTRING pxstr) 1479 { 1480 return (xstrDecode2(pxstr, '%')); 1467 1481 } 1468 1482
Note:
See TracChangeset
for help on using the changeset viewer.