Changeset 159
- Timestamp:
- Apr 25, 2002, 7:25:16 PM (23 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/helpers/comctl.h
r145 r159 979 979 MRESULT ctlDrawCheckBoxRecord(MPARAM mp2); 980 980 981 ULONG ctlQueryCheckboxSize(VOID); 982 981 983 VOID ctlInitCheckboxContainer(HWND hwndCnr); 982 984 -
trunk/include/helpers/dialog.h
r157 r159 106 106 // @@todo not implemented yet 107 107 108 SIZEL szlControlProposed; 109 // proposed size; a number of special flags are 110 // available (per cx, cy field): 108 SIZEL szlDlgUnits; 109 // proposed size for the control. Note that starting 110 // with V0.9.19, these are now dialog units to 111 // finally fix the bad alignment problems with 112 // lower resolutions. The dialog formatter applies 113 // an internal factor to these things based on 114 // what WinMapDlgPoints gives us. 115 // A number of special flags are available per 116 // cx and cy field: 111 117 // -- SZL_AUTOSIZE (-1): determine size automatically. 112 118 // Works only for statics with SS_TEXT and … … 122 128 // size of the inner table of the group (to override 123 129 // the automatic formatting). Note that the dialog 124 // formatter adds COMMON_SPACING to both the left and 125 // the right of the table to center the table in the 126 // PM group control, so the actual group size will 127 // be the specified size + (2 * COMMON_SPACING). 128 129 ULONG ulSpacing; // spacing around control 130 // adds extra spacing to this size: 131 // -- the group control's cx will be 132 // 2 * szlControlProposed.cx 133 // + 2 * ulSpacing 134 // + 2 * GROUP_INNER_SPACING_X 135 // -- the group control's cy will be 136 // 2 * szlControlProposed.cy 137 // + 2 * ulSpacing 138 // + GROUP_INNER_SPACING_Y 139 // + GROUP_INNER_SPACING_TOP 140 141 ULONG duSpacing; 142 // spacing around control; this is now in dialog 143 // units too V0.9.19 (2002-04-24) [umoeller] 130 144 131 145 PVOID pvCtlData; // for WinCreateWindow … … 205 219 #define LOAD_STRING ((PCSZ)-1) 206 220 207 #define COMMON_SPACING 3 208 209 #define PM_GROUP_SPACING_X 16 210 #define PM_GROUP_SPACING_TOP 16 221 // if the following is defined, we ignore the Y factor 222 // when scaling dialog units to pixels but use the X 223 // factor twice. This will result in something specified 224 // to be 10x10 units to be square, but will result in 225 // problems because dialog units are based on the 226 // system default fonts and x is different from y then. 227 // #define USE_SQUARE_CORRELATION 228 229 // if you still want something to be vaguely square, 230 // try the following macro to calculate the CY from a CX 231 #ifdef USE_SQUARE_CORRELATION 232 #define MAKE_SQUARE_CY(cx) (cx) 233 #else 234 #define MAKE_SQUARE_CY(cx) (cx * 200 / 250) 235 #endif 236 237 #define DLG_OUTER_SPACING_X 4 238 // outer spacing applied around entire dialog; 239 // we now use 4 to match the spacing in Warp 4 240 // notebook pages V0.9.19 (2002-04-24) [umoeller] 241 #define DLG_OUTER_SPACING_Y 3 242 243 #define COMMON_SPACING 1 244 245 #define GROUP_INNER_SPACING_X 3 246 #define GROUP_OUTER_SPACING_BOTTOM 1 247 #define GROUP_INNER_SPACING_BOTTOM 3 248 #define GROUP_INNER_SPACING_TOP 8 249 #define GROUP_OUTER_SPACING_TOP 0 250 251 #define STD_BUTTON_WIDTH 50 252 253 #ifdef USE_SQUARE_CORRELATION 254 #define STD_BUTTON_HEIGHT 15 255 #define STD_SPIN_HEIGHT 10 256 #else 257 #define STD_BUTTON_HEIGHT 12 258 #define STD_SPIN_HEIGHT 8 259 #endif 260 261 #define DEFAULT_TABLE_WIDTH 150 211 262 212 263 // the following require INCL_WINSTATICS … … 214 265 #define CONTROLDEF_GROUP(pcsz, id, cx, cy) { WC_STATIC, pcsz, \ 215 266 WS_VISIBLE | SS_GROUPBOX | DT_MNEMONIC, \ 216 id, CTL_COMMON_FONT, 0, { cx, cy }, 0}217 218 #define CDEF_GROUP_AUTO(id) CONTROLDEF_GROUP(LOAD_STRING, id, -1, -1)267 id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING } 268 269 #define LOADDEF_GROUP(id, cx) CONTROLDEF_GROUP(LOAD_STRING, id, cx, SZL_AUTOSIZE) 219 270 220 271 #define CONTROLDEF_TEXT(pcsz, id, cx, cy) { WC_STATIC, pcsz, \ … … 222 273 id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING } 223 274 275 #define LOADDEF_TEXT(id) CONTROLDEF_TEXT(LOAD_STRING, id, SZL_AUTOSIZE, SZL_AUTOSIZE) 276 224 277 #define CONTROLDEF_TEXT_CENTER(pcsz, id, cx, cy) { WC_STATIC, pcsz, \ 225 278 WS_VISIBLE | SS_TEXT | DT_CENTER | DT_VCENTER | DT_MNEMONIC, \ … … 228 281 #define CONTROLDEF_TEXT_WORDBREAK(pcsz, id, cx) { WC_STATIC, pcsz, \ 229 282 WS_VISIBLE | SS_TEXT | DT_LEFT | DT_TOP | DT_WORDBREAK, \ 230 id, CTL_COMMON_FONT, 0, {cx, -1}, COMMON_SPACING }283 id, CTL_COMMON_FONT, 0, {cx, SZL_AUTOSIZE}, COMMON_SPACING } 231 284 232 285 #define CONTROLDEF_ICON(hptr, id) { WC_STATIC, (PCSZ)(hptr), \ 233 286 WS_VISIBLE | SS_ICON | DT_LEFT | DT_VCENTER, \ 234 id, CTL_COMMON_FONT, 0, { -1, -1}, COMMON_SPACING }287 id, CTL_COMMON_FONT, 0, {SZL_AUTOSIZE, SZL_AUTOSIZE}, COMMON_SPACING } 235 288 236 289 #define CONTROLDEF_BITMAP(hbm, id) { WC_STATIC, (PCSZ)(hbm), \ 237 290 WS_VISIBLE | SS_BITMAP | DT_LEFT | DT_VCENTER, \ 238 id, CTL_COMMON_FONT, 0, { -1, -1}, COMMON_SPACING }291 id, CTL_COMMON_FONT, 0, {SZL_AUTOSIZE, SZL_AUTOSIZE}, COMMON_SPACING } 239 292 240 293 // the following require INCL_WINBUTTONS … … 244 297 id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING } 245 298 299 #define LOADDEF_DEFPUSHBUTTON(id) CONTROLDEF_DEFPUSHBUTTON(LOAD_STRING, id, STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT) 300 246 301 #define CONTROLDEF_PUSHBUTTON(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \ 247 302 WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON, \ 248 303 id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING } 249 304 305 #define LOADDEF_PUSHBUTTON(id) CONTROLDEF_PUSHBUTTON(LOAD_STRING, id, STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT) 306 250 307 #define CONTROLDEF_DEFNOFOCUSBUTTON(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \ 251 308 WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON | BS_DEFAULT | BS_NOPOINTERFOCUS, \ … … 257 314 258 315 #define CONTROLDEF_HELPPUSHBUTTON(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \ 259 WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON | BS_HELP, \ 260 id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING } 316 WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON | BS_HELP | BS_NOPOINTERFOCUS, \ 317 id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING } 318 319 #define LOADDEF_HELPPUSHBUTTON(id) CONTROLDEF_HELPPUSHBUTTON(LOAD_STRING, id, STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT) 261 320 262 321 #define CONTROLDEF_AUTOCHECKBOX(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \ … … 264 323 id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING } 265 324 266 #define CDEF_AUTOCB_AUTO(id) CONTROLDEF_AUTOCHECKBOX(LOAD_STRING, id, -1, -1)325 #define LOADDEF_AUTOCHECKBOX(id) CONTROLDEF_AUTOCHECKBOX(LOAD_STRING, id, SZL_AUTOSIZE, SZL_AUTOSIZE) 267 326 268 327 #define CONTROLDEF_FIRST_AUTORADIO(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \ … … 270 329 id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING } 271 330 331 #define LOADDEF_FIRST_AUTORADIO(id) CONTROLDEF_FIRST_AUTORADIO(LOAD_STRING, id, SZL_AUTOSIZE, SZL_AUTOSIZE) 332 272 333 #define CONTROLDEF_NEXT_AUTORADIO(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \ 273 334 WS_VISIBLE | WS_TABSTOP | BS_AUTORADIOBUTTON, \ 274 335 id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING } 336 337 #define LOADDEF_NEXT_AUTORADIO(id) CONTROLDEF_NEXT_AUTORADIO(LOAD_STRING, id, SZL_AUTOSIZE, SZL_AUTOSIZE) 275 338 276 339 // the following require INCL_WINENTRYFIELDS … … 425 488 *pcszRetry, // "~Retry" 426 489 *pcszIgnore, // "~Ignore" 427 *pcszEnter, 428 *pcszYesToAll; // "Yes to ~all" 490 *pcszEnter, // "~Help" 491 *pcszYesToAll, // "Yes to ~all" 492 *pcszHelp; // "~Help" 429 493 } MSGBOXSTRINGS, *PMSGBOXSTRINGS; 430 494 … … 455 519 #define MBID_YES2ALL 10 456 520 521 typedef VOID APIENTRY FNHELP(HWND hwndDlg); 522 typedef FNHELP *PFNHELP; 523 457 524 APIRET dlghCreateMessageBox(HWND *phwndDlg, 458 525 HWND hwndOwner, … … 460 527 PCSZ pcszTitle, 461 528 PCSZ pcszMessage, 529 PFNHELP pfnHelp, 462 530 ULONG flFlags, 463 531 PCSZ pcszFont, … … 469 537 PCSZ pcszTitle, 470 538 PCSZ pcszMessage, 539 PFNHELP pfnHelp, 471 540 ULONG flFlags, 472 541 PCSZ pcszFont, -
trunk/include/helpers/dosh.h
r153 r159 644 644 PULONG pulDirs, 645 645 PULONG pulFiles); 646 647 APIRET doshCanonicalize(PCSZ pcszFileIn, 648 PSZ pszFileOut, 649 ULONG cbFileOut); 646 650 647 651 /* ****************************************************************** -
trunk/include/helpers/undoc.h
r127 r159 57 57 * folder Details views. 58 58 */ 59 59 /* 60 60 #define WPSORTKEY_REALNAME 0x00000005 61 61 #define WPSORTKEY_SIZE 0x00000006 … … 69 69 #define WPSORTKEY_NAME 0xFFFFFFFE 70 70 #define WPSORTKEY_TYPE 0xFFFFFFFF 71 72 /* 73 * WPS object styles 74 * V0.9.7 (2000-12-10) [umoeller] 75 */ 76 77 #ifndef OBJSTYLE_LOCKEDINPLACE 78 #define OBJSTYLE_LOCKEDINPLACE 0x00020000 79 #endif 71 */ 80 72 81 73 /* … … 83 75 * 84 76 */ 77 78 /* 85 79 86 80 #define ID_WPMI_PASTE 0x2CB … … 113 107 #define ID_WPMI_REFRESH 0x1F7 114 108 109 */ 110 115 111 #endif 116 112 -
trunk/include/helpers/winh.h
r156 r159 828 828 829 829 BOOL XWPENTRY winhAssertWarp4Notebook(HWND hwndDlg, 830 USHORT usIdThreshold, 831 ULONG ulDownUnits); 830 USHORT usIdThreshold); 832 831 833 832 ULONG XWPENTRY winhDrawFormattedText(HPS hps, PRECTL prcl, const char *pcszText, ULONG flCmd); -
trunk/src/helpers/cctl_checkcnr.c
r147 r159 677 677 678 678 /* 679 *@@ ctl InitCheckboxContainer:680 * 681 *@@added V0.9.1 8 (2002-03-03) [umoeller]682 */ 683 684 VOID ctlInitCheckboxContainer(HWND hwndCnr)679 *@@ ctlQueryCheckboxSize: 680 * 681 *@@added V0.9.19 (2002-04-24) [umoeller] 682 */ 683 684 ULONG ctlQueryCheckboxSize(VOID) 685 685 { 686 686 if (G_hbmCheckboxes == NULLHANDLE) … … 692 692 SBMP_CHECKBOXES); 693 693 694 // _Pmpf(("hbmCheckboxes: 0x%lX", G_hbmCheckboxes));695 696 694 // and compute size of one checkbox 697 695 // (4 columns, 3 rows) 696 bmih.cbFix = sizeof(bmih); // V0.9.19 (2002-04-24) [umoeller] 698 697 GpiQueryBitmapParameters(G_hbmCheckboxes, 699 698 &bmih); 700 699 G_cxCheckbox = bmih.cx / 4; 701 700 } 701 702 return G_cxCheckbox; 703 } 704 705 /* 706 *@@ ctlInitCheckboxContainer: 707 * 708 *@@added V0.9.18 (2002-03-03) [umoeller] 709 */ 710 711 VOID ctlInitCheckboxContainer(HWND hwndCnr) 712 { 713 ctlQueryCheckboxSize(); 702 714 703 715 BEGIN_CNRINFO() -
trunk/src/helpers/dialog.c
r156 r159 11 11 * dialog behavior in regular window procs (see 12 12 * dlghSetPrevFocus and others). 13 * 14 * If you are out to find all workarounds to get certain 15 * buggy PM controls aligned right, this file is definitely 16 * the place. 13 17 * 14 18 * Usage: All PM programs. … … 42 46 // as unsigned char 43 47 48 #define INCL_DOSPROCESS 49 #define INCL_DOSEXCEPTIONS 44 50 #define INCL_DOSERRORS 45 51 … … 52 58 #define INCL_WINBUTTONS 53 59 #define INCL_WINENTRYFIELDS 60 #define INCL_WINSTDCNR 54 61 #define INCL_WINSYS 55 62 … … 62 69 #include <string.h> 63 70 #include <stdio.h> 71 #include <setjmp.h> 64 72 65 73 #include "setup.h" // code generation and debugging options … … 67 75 #include "helpers\comctl.h" 68 76 #include "helpers\dialog.h" 77 #include "helpers\except.h" 69 78 #include "helpers\gpih.h" 70 79 #include "helpers\linklist.h" … … 128 137 cyBorder; // cached now V0.9.19 (2002-04-17) [umoeller] 129 138 139 double dFactorX, // correlation factors for dialog units 140 dFactorY; // V0.9.19 (2002-04-24) [umoeller] 141 130 142 } DLGPRIVATE, *PDLGPRIVATE; 143 144 // macros for the dlg units conversion; 145 #define FACTOR_X (pDlgData->dFactorX) 146 #ifdef USE_SQUARE_CORRELATION 147 #define FACTOR_Y (pDlgData->dFactorX) 148 #else 149 #define FACTOR_Y (pDlgData->dFactorY) 150 #endif 131 151 132 152 typedef struct _COLUMNDEF *PCOLUMNDEF; … … 167 187 PVOID pvDefinition; // either a PTABLEDEF or a PCONTROLDEF 168 188 169 CONTROLPOS cpControl, // real pos and size of control 170 cpColumn; // pos and size of column; can be wider, spacings applied 189 CONTROLPOS cpControl, // real pos and size of control; if the control is 190 // a subtable, this receives the size of the table 191 // without spacings 192 cpColumn; // pos and size of column; this is the size of the 193 // column plus the spacing from the CONTROLDEF 194 // applied 195 // For PM group controls around tables, this is 196 // receives the following spacings: 197 // x += GROUP_INNER_SPACING_X + CONTROLDEF.ulSpacing 198 // y += GROUP_INNER_SPACING_Y + CONTROLDEF.ulSpacing 199 // cx += 2 * GROUP_INNER_SPACING_X + 2 * CONTROLDEF.ulSpacing 200 // cy += 2 * GROUP_INNER_SPACING_Y 201 // + GROUP_INNER_SPACING_EXTRA_TOP 202 // + 2 * CONTROLDEF.duSpacing 171 203 172 204 HWND hwndControl; // created control; NULLHANDLE for tables always … … 338 370 */ 339 371 rcl.xRight = ulWidth; 340 if (pControlDef->szlControlProposed.cy > 0) 341 rcl.yTop = pControlDef->szlControlProposed.cy; // V0.9.12 (2001-05-31) [umoeller] 372 if (pControlDef->szlDlgUnits.cy > 0) 373 rcl.yTop = pControlDef->szlDlgUnits.cy * FACTOR_Y; 374 // V0.9.12 (2001-05-31) [umoeller] 342 375 else 343 376 rcl.yTop = winhQueryScreenCY() * 2 / 3; … … 402 435 { 403 436 // give a little extra width for the box bitmap 404 pszlAuto->cx += 20; // @@todo 437 // V0.9.19 (2002-04-24) [umoeller] 438 pszlAuto->cx += ctlQueryCheckboxSize() + 4; 405 439 // and height 406 440 pszlAuto->cy += 2; … … 476 510 *@@changed V0.9.16 (2002-02-02) [umoeller]: added support for explicit group size 477 511 *@@changed V0.9.19 (2002-04-17) [umoeller]: fixes for the STUPID drop-down comboboxes 512 *@@changed V0.9.19 (2002-04-24) [umoeller]: fixed PM groups alignment 513 *@@changed V0.9.19 (2002-04-24) [umoeller]: added resolution correlation 478 514 */ 479 515 … … 484 520 APIRET arc = NO_ERROR; 485 521 PCONTROLDEF pControlDef = NULL; 486 ULONG ulExtraCX= 0,487 ulExtraCY= 0;522 ULONG xExtraColumn = 0, 523 yExtraColumn = 0; 488 524 489 525 if (pColumnDef->fIsNestedTable) … … 501 537 502 538 // should we create a PM control around the table? 503 if (p TableDef->pCtlDef)539 if (pControlDef = pTableDef->pCtlDef) 504 540 { 505 541 // yes: 542 LONG cxCalc = pControlDef->szlDlgUnits.cx * FACTOR_X, 543 cyCalc = pControlDef->szlDlgUnits.cy * FACTOR_Y; 506 544 507 545 // check if maybe an explicit size was specified 508 // for the group; if that is larger than what546 // for the group; only if that is larger than what 509 547 // we've calculated above, use it instead 510 if ( pTableDef->pCtlDef->szlControlProposed.cx> pColumnDef->cpControl.cx)548 if (cxCalc > pColumnDef->cpControl.cx) 511 549 // should be -1 for auto-size 512 pColumnDef->cpControl.cx = pTableDef->pCtlDef->szlControlProposed.cx;513 514 if ( pTableDef->pCtlDef->szlControlProposed.cy> pColumnDef->cpControl.cy)550 pColumnDef->cpControl.cx = cxCalc; 551 552 if (cyCalc > pColumnDef->cpControl.cy) 515 553 // should be -1 for auto-size 516 pColumnDef->cpControl.cy = pTableDef->pCtlDef->szlControlProposed.cy; 517 518 // in any case, make this wider 519 ulExtraCX = 2 * PM_GROUP_SPACING_X; 520 ulExtraCY = (PM_GROUP_SPACING_X + PM_GROUP_SPACING_TOP); 554 pColumnDef->cpControl.cy = cyCalc; 555 556 // in any case, add the inner spacing so that the group 557 // will be large enough 558 // fixed V0.9.19 (2002-04-24) [umoeller] 559 xExtraColumn = ( (2 * pControlDef->duSpacing) 560 + 2 * GROUP_INNER_SPACING_X 561 ) * FACTOR_X; 562 yExtraColumn = ( (2 * pControlDef->duSpacing) 563 + GROUP_OUTER_SPACING_BOTTOM 564 + GROUP_INNER_SPACING_BOTTOM 565 + GROUP_INNER_SPACING_TOP 566 + GROUP_OUTER_SPACING_TOP 567 ) * FACTOR_Y; 521 568 } 522 569 } … … 533 580 if (ProcessMode == PROCESS_1_CALC_SIZES) 534 581 { 535 if ( (pControlDef->szlControlProposed.cx == -1) 536 || (pControlDef->szlControlProposed.cy == -1) 582 // V0.9.19 (2002-04-24) [umoeller]: added resolution correlation 583 LONG cxCalc = pControlDef->szlDlgUnits.cx * FACTOR_X, 584 cyCalc = pControlDef->szlDlgUnits.cy * FACTOR_Y; 585 586 if ( (pControlDef->szlDlgUnits.cx == -1) 587 || (pControlDef->szlDlgUnits.cy == -1) 537 588 ) 538 589 { 539 590 ULONG ulWidth; 540 if (pControlDef->szl ControlProposed.cx == -1)591 if (pControlDef->szlDlgUnits.cx == -1) 541 592 ulWidth = 1000; 542 593 else 543 ulWidth = pControlDef->szlControlProposed.cx;594 ulWidth = cxCalc; 544 595 arc = CalcAutoSize(pControlDef, 545 596 ulWidth, … … 548 599 } 549 600 550 if ( (pControlDef->szl ControlProposed.cx < -1)551 && (pControlDef->szl ControlProposed.cx >= -100)601 if ( (pControlDef->szlDlgUnits.cx < -1) 602 && (pControlDef->szlDlgUnits.cx >= -100) 552 603 ) 553 604 { … … 558 609 } 559 610 560 if ( (pControlDef->szl ControlProposed.cy < -1)561 && (pControlDef->szl ControlProposed.cy >= -100)611 if ( (pControlDef->szlDlgUnits.cy < -1) 612 && (pControlDef->szlDlgUnits.cy >= -100) 562 613 ) 563 614 { … … 570 621 if (!arc) 571 622 { 572 if (pControlDef->szlControlProposed.cx < 0) 623 if (pControlDef->szlDlgUnits.cx < 0) 624 // this was autosize: 573 625 pColumnDef->cpControl.cx = szlAuto.cx; 574 626 else 575 pColumnDef->cpControl.cx = pControlDef->szlControlProposed.cx; 576 577 if (pControlDef->szlControlProposed.cy < 0) 627 // this was explicit: use converted size 628 // V0.9.19 (2002-04-24) [umoeller] 629 pColumnDef->cpControl.cx = cxCalc; 630 631 if (pControlDef->szlDlgUnits.cy < 0) 632 // this was autosize: 578 633 pColumnDef->cpControl.cy = szlAuto.cy; 579 634 else 580 pColumnDef->cpControl.cy = pControlDef->szlControlProposed.cy; 635 // this was explicit: use converted size 636 // V0.9.19 (2002-04-24) [umoeller] 637 pColumnDef->cpControl.cy = cyCalc; 581 638 } 582 639 583 640 } // end if (ProcessMode == PROCESS_1_CALC_SIZES) 584 641 585 ulExtraCX 586 = ulExtraCY 587 = (2 * pControlDef->ulSpacing); 642 xExtraColumn = 2 * (pControlDef->duSpacing * FACTOR_X); 643 yExtraColumn = 2 * (pControlDef->duSpacing * FACTOR_Y); 588 644 } 589 645 590 646 pColumnDef->cpColumn.cx = pColumnDef->cpControl.cx 591 + ulExtraCX;647 + xExtraColumn; 592 648 pColumnDef->cpColumn.cy = pColumnDef->cpControl.cy 593 + ulExtraCY;649 + yExtraColumn; 594 650 595 651 if ( (pControlDef) … … 614 670 + pDlgData->fmLast.lExternalLeading 615 671 + 2 * cyMargin 616 + ulExtraCY;672 + yExtraColumn; 617 673 } 618 674 } … … 628 684 *@@added V0.9.15 (2001-08-26) [umoeller] 629 685 *@@changed V0.9.16 (2001-10-15) [umoeller]: added APIRET 686 *@@changed V0.9.19 (2002-04-24) [umoeller]: fixed PM groups alignment 630 687 */ 631 688 … … 638 695 639 696 // calculate column position: this includes spacing 640 LONG lSpacingX= 0,641 lSpacingY= 0;697 LONG xSpacingControl = 0, 698 ySpacingControl = 0; 642 699 643 700 // column position = *plX on ProcessRow stack … … 672 729 { 673 730 // yes: 674 lSpacingX = PM_GROUP_SPACING_X; // V0.9.16 (2001-10-15) [umoeller] 675 lSpacingY = PM_GROUP_SPACING_X; // V0.9.16 (2001-10-15) [umoeller] 731 // V0.9.19 (2002-04-24) [umoeller] 732 xSpacingControl = ( pTableDef->pCtlDef->duSpacing 733 + GROUP_INNER_SPACING_X 734 ) * FACTOR_X; 735 ySpacingControl = ( pTableDef->pCtlDef->duSpacing 736 + GROUP_OUTER_SPACING_BOTTOM 737 + GROUP_INNER_SPACING_BOTTOM 738 ) * FACTOR_Y; 676 739 } 677 740 } … … 680 743 // no nested table, but control: 681 744 PCONTROLDEF pControlDef = (PCONTROLDEF)pColumnDef->pvDefinition; 682 lSpacingX = lSpacingY = pControlDef->ulSpacing; 745 xSpacingControl = pControlDef->duSpacing * FACTOR_X; 746 ySpacingControl = pControlDef->duSpacing * FACTOR_Y; 683 747 } 684 748 … … 688 752 // calculate CONTROL pos from COLUMN pos by applying spacing 689 753 pColumnDef->cpControl.x = (LONG)pColumnDef->cpColumn.x 690 + lSpacingX;754 + xSpacingControl; 691 755 pColumnDef->cpControl.y = (LONG)pColumnDef->cpColumn.y 692 + lSpacingY;756 + ySpacingControl; 693 757 694 758 if (pColumnDef->fIsNestedTable) … … 716 780 *@@changed V0.9.16 (2001-12-08) [umoeller]: fixed entry field ES_MARGIN positioning 717 781 *@@changed V0.9.19 (2002-04-17) [umoeller]: fixes for the STUPID drop-down comboboxes 782 *@@changed V0.9.19 (2002-04-24) [umoeller]: fixed PM groups alignment 718 783 */ 719 784 … … 747 812 // (do this AFTER the other controls from recursing, 748 813 // otherwise the stupid container doesn't show up) 749 if (p TableDef->pCtlDef)814 if (pControlDef = pTableDef->pCtlDef) 750 815 { 751 816 // yes: 752 817 // pcp = &pColumnDef->cpColumn; // !! not control 753 pControlDef = pTableDef->pCtlDef;754 818 pcszClass = pControlDef->pcszClass; 755 819 pcszTitle = pControlDef->pcszText; 756 820 flStyle = pControlDef->flStyle; 757 821 758 x = pColumnDef->cpColumn.x 822 // note: we do use cpControl, which is cpColumn plus 823 // spacings applied. But for groups, this is the 824 // following (see ColumnCalcPositions): 825 // V0.9.19 (2002-04-24) [umoeller] 826 // x is cpColumn.x plus GROUP_INNER_SPACING_X plus group control spacing 827 // y is cpColumn.y plus GROUP_INNER_SPACING_Y plus group control spacing 828 // cx is cpColumn.cx plus 2 * GROUP_INNER_SPACING_Y plus 2 * group control spacing 829 // cy is cpColumn.cy plus 2 * GROUP_INNER_SPACING_Y 830 // plus GROUP_INNER_SPACING_TOP 831 // plus 2 * group control spacing 832 // so this needs some hacks again 833 x = pColumnDef->cpControl.x 759 834 + pDlgData->ptlTotalOfs.x 760 + PM_GROUP_SPACING_X / 2;761 cx = pColumnDef->cpColumn.cx762 - PM_GROUP_SPACING_X;763 // note, just one spacing: for the _column_ size,764 // we have specified 2 X spacings765 y = pColumnDef->cpCo lumn.y835 - (GROUP_INNER_SPACING_X * FACTOR_X); 836 ; 837 cx = pColumnDef->cpControl.cx 838 + (2 * (GROUP_INNER_SPACING_X * FACTOR_X)); 839 ; 840 y = pColumnDef->cpControl.y 766 841 + pDlgData->ptlTotalOfs.y 767 + PM_GROUP_SPACING_X / 2; 768 // cy = pcp->cy - PM_GROUP_SPACING_X; 769 // cy = pcp->cy - /* PM_GROUP_SPACING_X - */ PM_GROUP_SPACING_TOP; 770 cy = pColumnDef->cpColumn.cy 771 - PM_GROUP_SPACING_X / 2; // - PM_GROUP_SPACING_TOP / 2; 842 - (GROUP_INNER_SPACING_BOTTOM * FACTOR_Y); 843 ; 844 cy = pColumnDef->cpControl.cy 845 + ( ( GROUP_INNER_SPACING_BOTTOM 846 + GROUP_INNER_SPACING_TOP 847 ) * FACTOR_Y); 848 ; 772 849 } 773 850 … … 848 925 pColumnDef->cpControl.cy)); 849 926 _Pmpf((" cyDelta = %d", cyDelta)); 850 y -= cyDelta + 3 * pDlgData->cyBorder + pControlDef->ulSpacing; 927 y -= cyDelta 928 + 3 * pDlgData->cyBorder 929 + pControlDef->duSpacing * FACTOR_Y; 851 930 // cy += cyDelta; 852 931 } … … 921 1000 winhSetPresColor(hwndDebug, PP_FOREGROUNDCOLOR, RGBCOL_DARKGREEN); 922 1001 923 /*924 1002 // and another one for the control size 925 1003 hwndDebug = … … 938 1016 NULL); 939 1017 winhSetPresColor(hwndDebug, PP_FOREGROUNDCOLOR, RGBCOL_RED); 940 */941 1018 } 942 1019 #endif … … 1081 1158 PCONTROLDEF pControlDef = (PCONTROLDEF)pColumnDef->pvDefinition; 1082 1159 1083 if ( (pControlDef->szl ControlProposed.cx < -1)1084 && (pControlDef->szl ControlProposed.cx >= -100)1160 if ( (pControlDef->szlDlgUnits.cx < -1) 1161 && (pControlDef->szlDlgUnits.cx >= -100) 1085 1162 ) 1086 1163 { … … 1088 1165 // this we ignored during PROCESS_1_CALC_SIZES 1089 1166 // (see ColumnCalcSizes); now set it to the 1090 // table width!1167 // percentage of the table width! 1091 1168 ULONG cxThis = pOwningRow->pOwningTable->cpTable.cx 1092 * -pControlDef->szlControlProposed.cx / 100; 1169 * -pControlDef->szlDlgUnits.cx 1170 / 100; 1093 1171 1094 1172 // but the table already has spacing applied, 1095 1173 // so reduce that 1096 1174 pColumnDef->cpControl.cx = cxThis 1097 - (2 * pControlDef->ulSpacing);1175 - (2 * (pControlDef->duSpacing * FACTOR_X)); 1098 1176 1099 1177 pColumnDef->cpColumn.cx = cxThis; 1100 1178 1101 1179 // now we might have to re-compute auto-size 1102 if (pControlDef->szl ControlProposed.cy == -1)1180 if (pControlDef->szlDlgUnits.cy == -1) 1103 1181 { 1104 1182 SIZEL szlAuto; … … 1115 1193 1116 1194 pColumnDef->cpControl.cy = szlAuto.cy; 1117 pColumnDef->cpColumn.cy = szlAuto.cy1118 + (2 * pControlDef->ulSpacing);1195 pColumnDef->cpColumn.cy = szlAuto.cy 1196 + (2 * (pControlDef->duSpacing * FACTOR_Y)); 1119 1197 } 1120 1198 } 1121 1199 } 1122 1200 1123 if ( (pControlDef->szl ControlProposed.cy < -1)1124 && (pControlDef->szl ControlProposed.cy >= -100)1201 if ( (pControlDef->szlDlgUnits.cy < -1) 1202 && (pControlDef->szlDlgUnits.cy >= -100) 1125 1203 ) 1126 1204 { 1127 1205 // same thing for CY, but this time we 1128 // take the row height1206 // take the percentage of the row height 1129 1207 ULONG cyThis = pOwningRow->cpRow.cy 1130 * -pControlDef->szlControlProposed.cy / 100; 1208 * -pControlDef->szlDlgUnits.cy 1209 / 100; 1131 1210 1132 1211 // but the table already has spacing applied, 1133 1212 // so reduce that 1134 pColumnDef->cpControl.cy = cyThis1135 - (2 * pControlDef->ulSpacing);1213 pColumnDef->cpControl.cy = cyThis 1214 - (2 * (pControlDef->duSpacing * FACTOR_Y)); 1136 1215 1137 1216 pColumnDef->cpColumn.cy = cyThis; … … 1510 1589 } STACKITEM, *PSTACKITEM; 1511 1590 1512 #define SPACING 101513 1514 1591 /* 1515 1592 *@@ Dlg0_Init: 1516 1593 * 1517 1594 *@@added V0.9.15 (2001-08-26) [umoeller] 1518 *@@changed V0.9.18 (2002-03-03) [umoeller]: aded pllWindows 1595 *@@changed V0.9.18 (2002-03-03) [umoeller]: added pllWindows 1596 *@@changed V0.9.19 (2002-04-24) [umoeller]: added resolution correlation 1519 1597 */ 1520 1598 … … 1523 1601 PLINKLIST pllControls) 1524 1602 { 1525 PDLGPRIVATE pDlgData; 1603 PDLGPRIVATE pDlgData; 1604 POINTL ptl = {100, 100}; 1605 1526 1606 if (!(pDlgData = NEW(DLGPRIVATE))) 1527 1607 return (ERROR_NOT_ENOUGH_MEMORY); … … 1537 1617 pDlgData->cxBorder = WinQuerySysValue(HWND_DESKTOP, SV_CXBORDER); 1538 1618 pDlgData->cyBorder = WinQuerySysValue(HWND_DESKTOP, SV_CYBORDER); 1619 1620 // check how many pixels we get out of the 1621 // dlgunits (100/100) for mapping all sizes 1622 // V0.9.19 (2002-04-24) [umoeller] 1623 if (WinMapDlgPoints(NULLHANDLE, 1624 &ptl, 1625 1, 1626 TRUE)) 1627 { 1628 // this worked: 1629 // for 1024x768, I get 200/250 out of the above, 1630 // so calculate a factor from that; we multiply 1631 // szlDlgUnits with this factor when calculating 1632 // the sizes 1633 pDlgData->dFactorX = (double)ptl.x / (double)100; // 2 on 1024x768 1634 pDlgData->dFactorY = (double)ptl.y / (double)100; // 2.5 on 1024x768 1635 } 1636 else 1637 { 1638 // didn't work: 1639 pDlgData->dFactorX = 2; 1640 pDlgData->dFactorY = 2.5; 1641 } 1539 1642 1540 1643 *ppDlgData = pDlgData; … … 1777 1880 */ 1778 1881 1779 pDlgData->ptlTotalOfs.x 1780 = pDlgData->ptlTotalOfs.y 1781 = SPACING; 1882 pDlgData->ptlTotalOfs.x = DLG_OUTER_SPACING_X * FACTOR_X; 1883 pDlgData->ptlTotalOfs.y = DLG_OUTER_SPACING_Y * FACTOR_Y; 1782 1884 1783 1885 ProcessAll(pDlgData, … … 2088 2190 *@@changed V0.9.14 (2001-08-21) [umoeller]: fixed default push button problems 2089 2191 *@@changed V0.9.16 (2001-12-06) [umoeller]: fixed bad owner if not direct desktop child 2192 *@@changed V0.9.19 (2002-04-24) [umoeller]: added excpt handling 2090 2193 */ 2091 2194 … … 2102 2205 APIRET arc = NO_ERROR; 2103 2206 2104 ULONG ul; 2105 2106 PDLGPRIVATE pDlgData = NULL; 2107 2108 HWND hwndDesktop = WinQueryDesktopWindow(NULLHANDLE, NULLHANDLE); 2109 // works with a null HAB 2110 2111 /* 2112 * 1) parse the table and create structures from it 2113 * 2114 */ 2115 2116 if (!(arc = Dlg0_Init(&pDlgData, 2117 pcszControlsFont, 2118 NULL))) 2119 { 2120 if (!(arc = Dlg1_ParseTables(pDlgData, 2121 paDlgItems, 2122 cDlgItems))) 2123 { 2124 /* 2125 * 2) create empty dialog frame 2126 * 2127 */ 2128 2129 FRAMECDATA fcData = {0}; 2130 ULONG flStyle = 0; 2131 HWND hwndOwnersParent; 2132 2133 fcData.cb = sizeof(FRAMECDATA); 2134 fcData.flCreateFlags = flCreateFlags | 0x40000000L; 2135 2136 if (flCreateFlags & FCF_SIZEBORDER) 2137 // dialog has size border: 2138 // add "clip siblings" style 2139 flStyle |= WS_CLIPSIBLINGS; 2140 2141 if (hwndOwner == HWND_DESKTOP) 2142 // there's some dumb XWorkplace code left 2143 // which uses this, and this disables the 2144 // mouse for some reason 2145 // V0.9.14 (2001-07-07) [umoeller] 2146 hwndOwner = NULLHANDLE; 2147 2148 // now, make sure the owner window is child of 2149 // HWND_DESKTOP... if it is not, we'll only disable 2150 // some dumb child window, which is not sufficient 2151 // V0.9.16 (2001-12-06) [umoeller] 2152 while ( (hwndOwner) 2153 && (hwndOwnersParent = WinQueryWindow(hwndOwner, QW_PARENT)) 2154 && (hwndOwnersParent != hwndDesktop) 2155 ) 2156 hwndOwner = hwndOwnersParent; 2157 2158 if (!(pDlgData->hwndDlg = WinCreateWindow(HWND_DESKTOP, 2159 WC_FRAME, 2160 (PSZ)pcszDlgTitle, 2161 flStyle, // style; invisible for now 2162 0, 0, 0, 0, 2163 hwndOwner, 2164 HWND_TOP, 2165 0, // ID 2166 &fcData, 2167 NULL))) // presparams 2168 arc = DLGERR_CANNOT_CREATE_FRAME; 2169 else 2207 TRY_LOUD(excpt1) 2208 { 2209 ULONG ul; 2210 2211 PDLGPRIVATE pDlgData = NULL; 2212 2213 HWND hwndDesktop = WinQueryDesktopWindow(NULLHANDLE, NULLHANDLE); 2214 // works with a null HAB 2215 2216 /* 2217 * 1) parse the table and create structures from it 2218 * 2219 */ 2220 2221 if (!(arc = Dlg0_Init(&pDlgData, 2222 pcszControlsFont, 2223 NULL))) 2224 { 2225 if (!(arc = Dlg1_ParseTables(pDlgData, 2226 paDlgItems, 2227 cDlgItems))) 2170 2228 { 2171 HWND hwndDlg = pDlgData->hwndDlg;2172 HWND hwndFocusItem = NULLHANDLE;2173 RECTL rclClient;2174 2175 2229 /* 2176 * 3) compute size of all controls2230 * 2) create empty dialog frame 2177 2231 * 2178 2232 */ 2179 2233 2180 if (!(arc = Dlg2_CalcSizes(pDlgData))) 2234 FRAMECDATA fcData = {0}; 2235 ULONG flStyle = 0; 2236 HWND hwndOwnersParent; 2237 2238 fcData.cb = sizeof(FRAMECDATA); 2239 fcData.flCreateFlags = flCreateFlags | 0x40000000L; 2240 2241 if (flCreateFlags & FCF_SIZEBORDER) 2242 // dialog has size border: 2243 // add "clip siblings" style 2244 flStyle |= WS_CLIPSIBLINGS; 2245 2246 if (hwndOwner == HWND_DESKTOP) 2247 // there's some dumb XWorkplace code left 2248 // which uses this, and this disables the 2249 // mouse for some reason 2250 // V0.9.14 (2001-07-07) [umoeller] 2251 hwndOwner = NULLHANDLE; 2252 2253 // now, make sure the owner window is child of 2254 // HWND_DESKTOP... if it is not, we'll only disable 2255 // some dumb child window, which is not sufficient 2256 // V0.9.16 (2001-12-06) [umoeller] 2257 while ( (hwndOwner) 2258 && (hwndOwnersParent = WinQueryWindow(hwndOwner, QW_PARENT)) 2259 && (hwndOwnersParent != hwndDesktop) 2260 ) 2261 hwndOwner = hwndOwnersParent; 2262 2263 if (!(pDlgData->hwndDlg = WinCreateWindow(HWND_DESKTOP, 2264 WC_FRAME, 2265 (PSZ)pcszDlgTitle, 2266 flStyle, // style; invisible for now 2267 0, 0, 0, 0, 2268 hwndOwner, 2269 HWND_TOP, 2270 0, // ID 2271 &fcData, 2272 NULL))) // presparams 2273 arc = DLGERR_CANNOT_CREATE_FRAME; 2274 else 2181 2275 { 2182 WinSubclassWindow(hwndDlg, pfnwpDialogProc); 2276 HWND hwndDlg = pDlgData->hwndDlg; 2277 HWND hwndFocusItem = NULLHANDLE; 2278 RECTL rclClient; 2183 2279 2184 2280 /* 2185 * 4) compute size of dialog client from total 2186 * size of all controls 2187 */ 2188 2189 // calculate the frame size from the client size 2190 rclClient.xLeft = 10; 2191 rclClient.yBottom = 10; 2192 rclClient.xRight = pDlgData->szlClient.cx + 2 * SPACING; 2193 rclClient.yTop = pDlgData->szlClient.cy + 2 * SPACING; 2194 WinCalcFrameRect(hwndDlg, 2195 &rclClient, 2196 FALSE); // frame from client 2197 2198 WinSetWindowPos(hwndDlg, 2199 0, 2200 10, 2201 10, 2202 rclClient.xRight, 2203 rclClient.yTop, 2204 SWP_MOVE | SWP_SIZE | SWP_NOADJUST); 2205 2206 arc = Dlg3_PositionAndCreate(pDlgData, 2207 &hwndFocusItem); 2208 2209 /* 2210 * 7) WM_INITDLG, set focus 2281 * 3) compute size of all controls 2211 2282 * 2212 2283 */ 2213 2284 2214 if (!WinSendMsg(pDlgData->hwndDlg, 2215 WM_INITDLG, 2216 (MPARAM)hwndFocusItem, 2217 (MPARAM)pCreateParams)) 2285 if (!(arc = Dlg2_CalcSizes(pDlgData))) 2218 2286 { 2219 // if WM_INITDLG returns FALSE, this means 2220 // the dlg proc has not changed the focus; 2221 // we must then set the focus here 2222 WinSetFocus(HWND_DESKTOP, hwndFocusItem); 2287 WinSubclassWindow(hwndDlg, pfnwpDialogProc); 2288 2289 /* 2290 * 4) compute size of dialog client from total 2291 * size of all controls 2292 */ 2293 2294 // calculate the frame size from the client size 2295 rclClient.xLeft = 10; 2296 rclClient.yBottom = 10; 2297 rclClient.xRight = pDlgData->szlClient.cx 2298 + 2 * (DLG_OUTER_SPACING_X * FACTOR_X); 2299 rclClient.yTop = pDlgData->szlClient.cy 2300 + 2 * (DLG_OUTER_SPACING_Y * FACTOR_Y); 2301 WinCalcFrameRect(hwndDlg, 2302 &rclClient, 2303 FALSE); // frame from client 2304 2305 WinSetWindowPos(hwndDlg, 2306 0, 2307 10, 2308 10, 2309 rclClient.xRight, 2310 rclClient.yTop, 2311 SWP_MOVE | SWP_SIZE | SWP_NOADJUST); 2312 2313 arc = Dlg3_PositionAndCreate(pDlgData, 2314 &hwndFocusItem); 2315 2316 /* 2317 * 7) WM_INITDLG, set focus 2318 * 2319 */ 2320 2321 if (!WinSendMsg(pDlgData->hwndDlg, 2322 WM_INITDLG, 2323 (MPARAM)hwndFocusItem, 2324 (MPARAM)pCreateParams)) 2325 { 2326 // if WM_INITDLG returns FALSE, this means 2327 // the dlg proc has not changed the focus; 2328 // we must then set the focus here 2329 WinSetFocus(HWND_DESKTOP, hwndFocusItem); 2330 } 2223 2331 } 2224 2332 } 2225 2333 } 2226 } 2227 2228 if (arc) 2229 { 2230 // error: clean up 2231 if (pDlgData->hwndDlg) 2334 2335 if (arc) 2232 2336 { 2233 WinDestroyWindow(pDlgData->hwndDlg); 2234 pDlgData->hwndDlg = NULLHANDLE; 2337 // error: clean up 2338 if (pDlgData->hwndDlg) 2339 { 2340 WinDestroyWindow(pDlgData->hwndDlg); 2341 pDlgData->hwndDlg = NULLHANDLE; 2342 } 2235 2343 } 2236 } 2237 else 2238 // no error: output dialog 2239 *phwndDlg = pDlgData->hwndDlg; 2240 2241 Dlg9_Cleanup(&pDlgData); 2242 } 2344 else 2345 // no error: output dialog 2346 *phwndDlg = pDlgData->hwndDlg; 2347 2348 Dlg9_Cleanup(&pDlgData); 2349 } 2350 } 2351 CATCH(excpt1) 2352 { 2353 arc = ERROR_PROTECTION_VIOLATION; 2354 } END_CATCH(); 2243 2355 2244 2356 if (arc) … … 2287 2399 *@@added V0.9.16 (2001-09-29) [umoeller] 2288 2400 *@@changed V0.9.18 (2002-03-03) [umoeller]: added pszlClient, fixed output 2401 *@@changed V0.9.19 (2002-04-24) [umoeller]: added excpt handling 2289 2402 */ 2290 2403 … … 2299 2412 APIRET arc = NO_ERROR; 2300 2413 2301 ULONG ul; 2302 2303 PDLGPRIVATE pDlgData = NULL; 2304 PLINKLIST pllControls = NULL; 2305 2306 /* 2307 * 1) parse the table and create structures from it 2308 * 2309 */ 2310 2311 if (ppllControls) 2312 pllControls = *(PLINKLIST*)ppllControls = lstCreate(FALSE); 2313 2314 if (!(arc = Dlg0_Init(&pDlgData, 2315 pcszControlsFont, 2316 pllControls))) 2317 { 2318 if (!(arc = Dlg1_ParseTables(pDlgData, 2319 paDlgItems, 2320 cDlgItems))) 2321 { 2322 HWND hwndFocusItem; 2323 2324 /* 2325 * 2) create empty dialog frame 2326 * 2327 */ 2328 2329 pDlgData->hwndDlg = hwndDlg; 2330 2331 /* 2332 * 3) compute size of all controls 2333 * 2334 */ 2335 2336 Dlg2_CalcSizes(pDlgData); 2337 2338 if (pszlClient) 2414 TRY_LOUD(excpt1) 2415 { 2416 ULONG ul; 2417 2418 PDLGPRIVATE pDlgData = NULL; 2419 PLINKLIST pllControls = NULL; 2420 2421 /* 2422 * 1) parse the table and create structures from it 2423 * 2424 */ 2425 2426 if (ppllControls) 2427 pllControls = *(PLINKLIST*)ppllControls = lstCreate(FALSE); 2428 2429 if (!(arc = Dlg0_Init(&pDlgData, 2430 pcszControlsFont, 2431 pllControls))) 2432 { 2433 if (!(arc = Dlg1_ParseTables(pDlgData, 2434 paDlgItems, 2435 cDlgItems))) 2339 2436 { 2340 pszlClient->cx = pDlgData->szlClient.cx + 2 * SPACING; 2341 pszlClient->cy = pDlgData->szlClient.cy + 2 * SPACING; 2437 HWND hwndFocusItem; 2438 2439 /* 2440 * 2) create empty dialog frame 2441 * 2442 */ 2443 2444 pDlgData->hwndDlg = hwndDlg; 2445 2446 /* 2447 * 3) compute size of all controls 2448 * 2449 */ 2450 2451 Dlg2_CalcSizes(pDlgData); 2452 2453 if (pszlClient) 2454 { 2455 pszlClient->cx = pDlgData->szlClient.cx 2456 + 2 * (DLG_OUTER_SPACING_X * FACTOR_X); 2457 pszlClient->cy = pDlgData->szlClient.cy 2458 + 2 * (DLG_OUTER_SPACING_Y * FACTOR_Y); 2459 } 2460 2461 if (flFlags & DFFL_CREATECONTROLS) 2462 { 2463 if (!(arc = Dlg3_PositionAndCreate(pDlgData, 2464 &hwndFocusItem))) 2465 WinSetFocus(HWND_DESKTOP, hwndFocusItem); 2466 } 2342 2467 } 2343 2468 2344 if (flFlags & DFFL_CREATECONTROLS) 2345 { 2346 if (!(arc = Dlg3_PositionAndCreate(pDlgData, 2347 &hwndFocusItem))) 2348 WinSetFocus(HWND_DESKTOP, hwndFocusItem); 2349 } 2350 } 2351 2352 Dlg9_Cleanup(&pDlgData); 2353 } 2469 Dlg9_Cleanup(&pDlgData); 2470 } 2471 } 2472 CATCH(excpt1) 2473 { 2474 arc = ERROR_PROTECTION_VIOLATION; 2475 } END_CATCH(); 2354 2476 2355 2477 if (arc) … … 2470 2592 + fnwpMyDialogProc, 2471 2593 + "Title", 2472 + pArray->paD ialogItems,// dialog array!2594 + pArray->paDlgItems, // dialog array! 2473 2595 + pArray->cDlgItemsNow, // real count of items! 2474 2596 + NULL, … … 2588 2710 2589 2711 /* 2712 *@@ fnwpMessageBox: 2713 * 2714 *@@added V0.9.19 (2002-04-24) [umoeller] 2715 */ 2716 2717 MRESULT EXPENTRY fnwpMessageBox(HWND hwndBox, ULONG msg, MPARAM mp1, MPARAM mp2) 2718 { 2719 switch (msg) 2720 { 2721 case WM_HELP: 2722 { 2723 PFNHELP pfnHelp; 2724 if (pfnHelp = (PFNHELP)WinQueryWindowPtr(hwndBox, QWL_USER)) 2725 pfnHelp(hwndBox); 2726 2727 return 0; 2728 } 2729 } 2730 2731 return WinDefDlgProc(hwndBox, msg, mp1, mp2); 2732 } 2733 2734 /* 2590 2735 *@@ dlghCreateMessageBox: 2591 2736 * 2592 2737 *@@added V0.9.13 (2001-06-21) [umoeller] 2593 2738 *@@changed V0.9.14 (2001-07-26) [umoeller]: fixed missing focus on buttons 2739 *@@changed V0.9.19 (2002-04-24) [umoeller]: added pfnHelp 2594 2740 */ 2595 2741 … … 2599 2745 PCSZ pcszTitle, 2600 2746 PCSZ pcszMessage, 2747 PFNHELP pfnHelp, // in: help callback or NULL 2601 2748 ULONG flFlags, 2602 2749 PCSZ pcszFont, … … 2604 2751 PULONG pulAlarmFlag) // out: alarm sound to be played 2605 2752 { 2753 APIRET arc; 2754 2606 2755 CONTROLDEF 2607 Icon = { 2608 WC_STATIC, 2609 NULL, // text, set below 2610 WS_VISIBLE | SS_ICON, 2611 0, // ID 2612 NULL, // no font 2613 0, 2614 { SZL_AUTOSIZE, SZL_AUTOSIZE }, 2615 5 2616 }, 2617 InfoText = 2618 { 2619 WC_STATIC, 2620 NULL, // text, set below 2621 WS_VISIBLE | SS_TEXT | DT_WORDBREAK | DT_LEFT | DT_TOP, 2622 10, // ID 2623 CTL_COMMON_FONT, 2624 0, 2625 { 400, SZL_AUTOSIZE }, 2626 5 2627 }, 2628 Buttons[] = { 2629 { 2630 WC_BUTTON, 2631 NULL, // text, set below 2632 WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON, 2633 1, // ID 2634 CTL_COMMON_FONT, // no font 2635 0, 2636 { 100, 30 }, 2637 5 2638 }, 2639 { 2640 WC_BUTTON, 2641 NULL, // text, set below 2642 WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON, 2643 2, // ID 2644 CTL_COMMON_FONT, // no font 2645 0, 2646 { 100, 30 }, 2647 5 2648 }, 2649 { 2650 WC_BUTTON, 2651 NULL, // text, set below 2652 WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON, 2653 3, // ID 2654 CTL_COMMON_FONT, // no font 2655 0, 2656 { 100, 30 }, 2657 5 2658 } 2659 }; 2660 2661 DLGHITEM MessageBox[] = 2662 { 2756 Icon = CONTROLDEF_ICON(NULLHANDLE, 0), 2757 Spacing = CONTROLDEF_TEXT(NULL, 0, 1, 1), 2758 InfoText = CONTROLDEF_TEXT_WORDBREAK(NULL, 10, 200), 2759 Buttons[] = 2760 { 2761 CONTROLDEF_PUSHBUTTON(NULL, 1, STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT), 2762 CONTROLDEF_PUSHBUTTON(NULL, 2, STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT), 2763 CONTROLDEF_PUSHBUTTON(NULL, 3, STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT), 2764 CONTROLDEF_HELPPUSHBUTTON(NULL, 4, STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT) 2765 }; 2766 2767 DLGHITEM MessageBoxFront[] = 2768 { 2663 2769 START_TABLE, 2664 2770 START_ROW(ROW_VALIGN_CENTER), … … 2666 2772 START_TABLE, 2667 2773 START_ROW(ROW_VALIGN_CENTER), 2774 CONTROL_DEF(&Spacing), 2775 START_ROW(ROW_VALIGN_CENTER), 2668 2776 CONTROL_DEF(&InfoText), 2777 START_ROW(ROW_VALIGN_CENTER), 2778 CONTROL_DEF(&Spacing), 2669 2779 START_ROW(ROW_VALIGN_CENTER), 2670 2780 CONTROL_DEF(&Buttons[0]), 2671 2781 CONTROL_DEF(&Buttons[1]), 2672 2782 CONTROL_DEF(&Buttons[2]), 2783 }, 2784 MessageBoxHelp[] = 2785 { 2786 CONTROL_DEF(&Buttons[3]), 2787 }, 2788 MessageBoxTail[] = 2789 { 2673 2790 END_TABLE, 2674 2791 END_TABLE 2675 2792 }; 2676 2793 2677 2794 ULONG flButtons = flFlags & 0xF; // low nibble contains MB_YESNO etc. 2795 PDLGARRAY pArrayBox; 2678 2796 2679 2797 PCSZ p0 = "Error", … … 2764 2882 *pulAlarmFlag = WA_WARNING; 2765 2883 2766 return (dlghCreateDlg(phwndDlg, 2767 hwndOwner, 2768 FCF_TITLEBAR | FCF_SYSMENU | FCF_DLGBORDER | FCF_NOBYTEALIGN, 2769 WinDefDlgProc, 2770 pcszTitle, 2771 MessageBox, 2772 ARRAYITEMCOUNT(MessageBox), 2773 NULL, 2774 pcszFont)); 2884 if (pfnHelp) 2885 Buttons[3].pcszText = pStrings->pcszHelp; 2886 2887 if (!(arc = dlghCreateArray( ARRAYITEMCOUNT(MessageBoxFront) 2888 + ARRAYITEMCOUNT(MessageBoxHelp) 2889 + ARRAYITEMCOUNT(MessageBoxTail), 2890 &pArrayBox))) 2891 { 2892 if ( (!(arc = dlghAppendToArray(pArrayBox, 2893 MessageBoxFront, 2894 ARRAYITEMCOUNT(MessageBoxFront)))) 2895 && ( (!pfnHelp) 2896 || (!(arc = dlghAppendToArray(pArrayBox, 2897 MessageBoxHelp, 2898 ARRAYITEMCOUNT(MessageBoxHelp)))) 2899 ) 2900 && (!(arc = dlghAppendToArray(pArrayBox, 2901 MessageBoxTail, 2902 ARRAYITEMCOUNT(MessageBoxTail)))) 2903 ) 2904 { 2905 if (!(arc = dlghCreateDlg(phwndDlg, 2906 hwndOwner, 2907 FCF_TITLEBAR | FCF_SYSMENU | FCF_DLGBORDER | FCF_NOBYTEALIGN, 2908 fnwpMessageBox, 2909 pcszTitle, 2910 pArrayBox->paDlgItems, 2911 pArrayBox->cDlgItemsNow, 2912 NULL, 2913 pcszFont))) 2914 // added help callback V0.9.19 (2002-04-24) [umoeller] 2915 WinSetWindowPtr(*phwndDlg, QWL_USER, (PVOID)pfnHelp); 2916 } 2917 2918 dlghFreeArray(&pArrayBox); 2919 } 2920 2921 return arc; 2775 2922 } 2776 2923 … … 2885 3032 * -- MB_ICONEXCLAMATION 2886 3033 * 3034 * If (pfnHelp != NULL), a "Help" button is also added and 3035 * pfnHelp gets called when the user presses it or the F1 3036 * key. 3037 * 2887 3038 * Returns MBID_* codes like WinMessageBox. 2888 3039 * 2889 3040 *@@added V0.9.13 (2001-06-21) [umoeller] 3041 *@@changed V0.9.19 (2002-04-24) [umoeller]: added pfnHelp 2890 3042 */ 2891 3043 2892 3044 ULONG dlghMessageBox(HWND hwndOwner, // in: owner for msg box 2893 3045 HPOINTER hptrIcon, // in: icon to display 2894 PCSZ pcszTitle, // in: title 2895 PCSZ pcszMessage, // in: message 3046 PCSZ pcszTitle, // in: title 3047 PCSZ pcszMessage, // in: message 3048 PFNHELP pfnHelp, // in: help callback or NULL 2896 3049 ULONG flFlags, // in: standard message box flags 2897 PCSZ pcszFont, // in: font (e.g. "9.WarpSans")3050 PCSZ pcszFont, // in: font (e.g. "9.WarpSans") 2898 3051 const MSGBOXSTRINGS *pStrings) // in: strings array 2899 3052 { … … 2905 3058 pcszTitle, 2906 3059 pcszMessage, 3060 pfnHelp, 2907 3061 flFlags, 2908 3062 pcszFont, … … 2980 3134 CTL_COMMON_FONT, 2981 3135 0, 2982 { 300, SZL_AUTOSIZE }, // size3136 { 150, SZL_AUTOSIZE }, // size 2983 3137 5 // spacing 2984 3138 }, … … 2990 3144 CTL_COMMON_FONT, 2991 3145 0, 2992 { 300, SZL_AUTOSIZE }, // size3146 { 150, SZL_AUTOSIZE }, // size 2993 3147 5 // spacing 2994 3148 }, … … 3000 3154 CTL_COMMON_FONT, 3001 3155 0, 3002 { 100, 30}, // size3156 { STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT }, // size 3003 3157 5 // spacing 3004 3158 }, … … 3010 3164 CTL_COMMON_FONT, 3011 3165 0, 3012 { 100, 30}, // size3166 { STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT }, // size 3013 3167 5 // spacing 3014 3168 }; -
trunk/src/helpers/dosh.c
r154 r159 1942 1942 * 1943 1943 * In the pathological case of a dot in the path 1944 * but not in the filename itself, this correctly 1945 * returns NULL. 1944 * but not in the filename itself (e.g. 1945 * "C:\files.new\readme"), this correctly returns 1946 * NULL. 1946 1947 * 1947 1948 *@@added V0.9.6 (2000-10-16) [umoeller] … … 2008 2009 CHAR szName[5]; 2009 2010 2010 APIRET rc = NO_ERROR; // return code2011 APIRET arc; 2011 2012 BYTE fsqBuffer[sizeof(FSQBUFFER2) + (3 * CCHMAXPATH)] = {0}; 2012 2013 ULONG cbBuffer = sizeof(fsqBuffer); // Buffer length) … … 2017 2018 szName[2] = '\0'; 2018 2019 2019 rc = DosQueryFSAttach(szName, // logical drive of attached FS 2020 0, // ulOrdinal, ignored for FSAIL_QUERYNAME 2021 FSAIL_QUERYNAME, // return data for a Drive or Device 2022 pfsqBuffer, // returned data 2023 &cbBuffer); // returned data length 2024 2025 if (rc == NO_ERROR) 2020 if (!(arc = DosQueryFSAttach(szName, // logical drive of attached FS 2021 0, // ulOrdinal, ignored for FSAIL_QUERYNAME 2022 FSAIL_QUERYNAME, // return data for a Drive or Device 2023 pfsqBuffer, // returned data 2024 &cbBuffer))) // returned data length 2026 2025 { 2027 2026 // The data for the last three fields in the FSQBUFFER2 … … 3434 3433 3435 3434 /* 3435 *@@ doshCanonicalize: 3436 * simplifies path specifications to remove '.' 3437 * and '..' entries and generates a fully 3438 * qualified path name where possible. 3439 * File specifications are left unchanged. 3440 * 3441 * This returns: 3442 * 3443 * -- NO_ERROR: the buffers were valid. 3444 * 3445 * -- ERROR_INVALID_PARAMETER: the buffers 3446 * were invalid. 3447 * 3448 *@@added V0.9.19 (2002-04-22) [pr] 3449 */ 3450 3451 APIRET doshCanonicalize(PCSZ pcszFileIn, // in: path to canonicalize 3452 PSZ pszFileOut, // out: canonicalized path if NO_ERROR 3453 ULONG cbFileOut) // in: size of pszFileOut buffer 3454 { 3455 APIRET ulrc = NO_ERROR; 3456 CHAR szFileTemp[CCHMAXPATH]; 3457 3458 if (pcszFileIn && pszFileOut && cbFileOut) 3459 { 3460 strncpy(szFileTemp, pcszFileIn, sizeof(szFileTemp) - 1); 3461 szFileTemp[sizeof(szFileTemp) - 1] = 0; 3462 if ( strchr(szFileTemp, '\\') 3463 || strchr(szFileTemp, ':') 3464 ) 3465 { 3466 ULONG cbFileTemp = strlen(szFileTemp); 3467 3468 if ( (cbFileTemp > 3) 3469 && (szFileTemp[cbFileTemp - 1] == '\\') 3470 ) 3471 { 3472 szFileTemp[cbFileTemp - 1] = 0; 3473 } 3474 3475 if (DosQueryPathInfo(szFileTemp, 3476 FIL_QUERYFULLNAME, 3477 pszFileOut, 3478 cbFileOut)) 3479 { 3480 pszFileOut[0] = 0; 3481 } 3482 } 3483 else 3484 { 3485 strncpy(pszFileOut, pcszFileIn, cbFileOut - 1); 3486 pszFileOut[cbFileOut - 1] = 0; 3487 } 3488 } 3489 else 3490 ulrc = ERROR_INVALID_PARAMETER; 3491 3492 return(ulrc); 3493 } 3494 3495 /* 3436 3496 *@@category: Helpers\Control program helpers\Module handling 3437 3497 * helpers for importing functions from a module (DLL). -
trunk/src/helpers/makefile
r153 r159 145 145 TESTCASE_DIR = testcase 146 146 147 TESTCASE_CC = icc /c /ti+ /w2 /ss /se /i$(HELPERS_BASE)\include / DDEBUG_DIALOG_WINDOWS /Fo$(TESTCASE_DIR)\$(@B).obj $(@B).c147 TESTCASE_CC = icc /c /ti+ /w2 /ss /se /i$(HELPERS_BASE)\include /Fo$(TESTCASE_DIR)\$(@B).obj $(@B).c 148 148 149 149 .c.{$(TESTCASE_DIR)}.obj: … … 165 165 dosh.exe: $(DOSH_TEST_OBJS) 166 166 ilink /debug /optfunc /pmtype:vio $(DOSH_TEST_OBJS) /o:$@ 167 168 $(TESTCASE_DIR)\dialog.obj: ..\..\include\helpers\dialog.h 169 $(TESTCASE_DIR)\_test_dialog.obj: ..\..\include\helpers\dialog.h 167 170 168 171 # dialog.exe … … 173 176 $(TESTCASE_DIR)\xstring.obj \ 174 177 $(TESTCASE_DIR)\linklist.obj \ 178 $(TESTCASE_DIR)\cctl_checkcnr.obj \ 179 $(TESTCASE_DIR)\cnrh.obj \ 175 180 $(TESTCASE_DIR)\comctl.obj \ 176 181 $(TESTCASE_DIR)\stringh.obj \ 177 182 $(TESTCASE_DIR)\dosh.obj \ 183 $(TESTCASE_DIR)\except.obj \ 184 $(TESTCASE_DIR)\debug.obj \ 178 185 $(TESTCASE_DIR)\gpih.obj 179 186 -
trunk/src/helpers/stringh.c
r153 r159 1063 1063 1064 1064 while(*p) 1065 if ( (*p == '\r')1066 || (*p == '\n')1065 if ( (*p == '\r') 1066 || (*p == '\n') 1067 1067 ) 1068 1068 { -
trunk/src/helpers/winh.c
r158 r159 4031 4031 * controls which should be moved such an ID. 4032 4032 * 4033 * You can also specify how many dialog units4034 * all the other controls will be moved downward in4035 * ulDownUnits; this is useful to fill up the space4036 * which was used by the buttons before moving them.4037 * Returns TRUE if anything was changed.4033 * Note that this function will now automatically 4034 * find out the lowest y coordinate that was used 4035 * for a non-notebook button and move all controls 4036 * down accordingly. As a result, ulDownUnit must 4037 * no longer be specified (V0.9.19). 4038 4038 * 4039 4039 * This function is useful if you wish to create … … 4044 4044 * 4045 4045 *@@changed V0.9.16 (2002-02-02) [umoeller]: fixed entry fields 4046 *@@changed V0.9.19 (2002-04-24) [umoeller]: removed ulDownUnits 4046 4047 */ 4047 4048 4048 4049 BOOL winhAssertWarp4Notebook(HWND hwndDlg, 4049 USHORT usIdThreshold, // in: ID threshold 4050 ULONG ulDownUnits) // in: dialog units or 0 4050 USHORT usIdThreshold) // in: ID threshold 4051 4051 { 4052 4052 BOOL brc = FALSE; … … 4054 4054 if (doshIsWarp4()) 4055 4055 { 4056 POINTL ptl; 4057 HWND hwndItem; 4058 HENUM henum = 0; 4059 4060 BOOL fIsVisible = WinIsWindowVisible(hwndDlg); 4061 if (ulDownUnits) 4056 LONG yLowest = 10000; 4057 HWND hwndItem; 4058 HENUM henum = 0; 4059 PSWP paswp, 4060 pswpThis; 4061 ULONG cWindows = 0, 4062 ul; 4063 4064 BOOL fIsVisible; 4065 4066 if (fIsVisible = WinIsWindowVisible(hwndDlg)) 4067 // avoid flicker 4068 WinEnableWindowUpdate(hwndDlg, FALSE); 4069 4070 if (paswp = (PSWP)malloc(sizeof(SWP) * 100)) 4062 4071 { 4063 ptl.x = 0; 4064 ptl.y = ulDownUnits; 4065 WinMapDlgPoints(hwndDlg, &ptl, 1, TRUE); 4066 } 4067 4068 if (fIsVisible) 4069 WinEnableWindowUpdate(hwndDlg, FALSE); 4070 4071 henum = WinBeginEnumWindows(hwndDlg); 4072 while ((hwndItem = WinGetNextWindow(henum))) 4073 { 4074 USHORT usId = WinQueryWindowUShort(hwndItem, QWS_ID); 4075 // _Pmpf(("hwndItem: 0x%lX, ID: 0x%lX", hwndItem, usId)); 4076 if (usId <= usIdThreshold) 4072 pswpThis = paswp; 4073 4074 // loop 1: set notebook buttons, find lowest y used 4075 henum = WinBeginEnumWindows(hwndDlg); 4076 while ((hwndItem = WinGetNextWindow(henum))) 4077 4077 { 4078 // pushbutton to change: 4079 // _Pmpf((" Setting bit")); 4080 WinSetWindowBits(hwndItem, 4081 QWL_STYLE, 4082 BS_NOTEBOOKBUTTON, BS_NOTEBOOKBUTTON); 4083 brc = TRUE; 4084 } 4085 else 4086 // no pushbutton to change: move downwards 4087 // if desired 4088 if (ulDownUnits) 4078 USHORT usId = WinQueryWindowUShort(hwndItem, QWS_ID); 4079 // _Pmpf(("hwndItem: 0x%lX, ID: 0x%lX", hwndItem, usId)); 4080 if (usId <= usIdThreshold) 4089 4081 { 4082 // pushbutton to change: 4083 WinSetWindowBits(hwndItem, 4084 QWL_STYLE, 4085 BS_NOTEBOOKBUTTON, BS_NOTEBOOKBUTTON); 4086 brc = TRUE; 4087 } 4088 else 4089 { 4090 // no pushbutton to change: 4090 4091 CHAR szClass[10]; 4091 SWP swp; 4092 LONG lDeltaX = 0, 4093 lDeltaY = 0; 4092 4093 // check lowest y 4094 WinQueryWindowPos(hwndItem, pswpThis); 4095 if (pswpThis->y < yLowest) 4096 yLowest = pswpThis->y ; 4097 4094 4098 // special handling for entry fields 4095 4099 // V0.9.16 (2002-02-02) [umoeller] … … 4097 4101 if (!strcmp(szClass, "#6")) 4098 4102 { 4099 lDeltaX= 3 * WinQuerySysValue(HWND_DESKTOP, SV_CXBORDER);4100 lDeltaY= 3 * WinQuerySysValue(HWND_DESKTOP, SV_CYBORDER);4103 pswpThis->x += 3 * WinQuerySysValue(HWND_DESKTOP, SV_CXBORDER); 4104 pswpThis->y += 3 * WinQuerySysValue(HWND_DESKTOP, SV_CYBORDER); 4101 4105 } 4102 4106 4103 WinQueryWindowPos(hwndItem, &swp); 4104 WinSetWindowPos(hwndItem, 0, 4105 swp.x + lDeltaX, 4106 swp.y - ptl.y + lDeltaY, 4107 0, 0, 4108 SWP_MOVE); 4107 ++pswpThis; 4108 if (++cWindows == 100) 4109 break; 4109 4110 } 4111 } // end while ((hwndItem = WinGetNextWindow(henum))) 4112 WinEndEnumWindows(henum); 4113 4114 // now adjust window positions 4115 pswpThis = paswp; 4116 for (ul = 0; 4117 ul < cWindows; 4118 ++ul, ++pswpThis) 4119 { 4120 pswpThis->y -= (yLowest - 8); 4121 // 8 is magic to match the lower border of the 4122 // standard WPS notebook pages V0.9.19 (2002-04-24) [umoeller] 4123 pswpThis->fl = SWP_MOVE; 4124 } 4125 4126 WinSetMultWindowPos(WinQueryAnchorBlock(hwndDlg), 4127 paswp, 4128 cWindows); 4129 4130 free(paswp); 4110 4131 } 4111 WinEndEnumWindows(henum);4112 4132 4113 4133 if (fIsVisible)
Note:
See TracChangeset
for help on using the changeset viewer.