Changeset 159


Ignore:
Timestamp:
Apr 25, 2002, 7:25:16 PM (23 years ago)
Author:
umoeller
Message:

Lots of dialog rework, plus other fixes.

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/helpers/comctl.h

    r145 r159  
    979979        MRESULT ctlDrawCheckBoxRecord(MPARAM mp2);
    980980
     981        ULONG ctlQueryCheckboxSize(VOID);
     982
    981983        VOID ctlInitCheckboxContainer(HWND hwndCnr);
    982984
  • trunk/include/helpers/dialog.h

    r157 r159  
    106106                // @@todo not implemented yet
    107107
    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:
    111117                // -- SZL_AUTOSIZE (-1): determine size automatically.
    112118                //    Works only for statics with SS_TEXT and
     
    122128                // size of the inner table of the group (to override
    123129                // 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]
    130144
    131145        PVOID       pvCtlData;          // for WinCreateWindow
     
    205219    #define LOAD_STRING     ((PCSZ)-1)
    206220
    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
    211262
    212263    // the following require INCL_WINSTATICS
     
    214265    #define CONTROLDEF_GROUP(pcsz, id, cx, cy) { WC_STATIC, pcsz, \
    215266            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)
    219270
    220271    #define CONTROLDEF_TEXT(pcsz, id, cx, cy) { WC_STATIC, pcsz, \
     
    222273            id, CTL_COMMON_FONT,  0, {cx, cy}, COMMON_SPACING }
    223274
     275    #define LOADDEF_TEXT(id) CONTROLDEF_TEXT(LOAD_STRING, id, SZL_AUTOSIZE, SZL_AUTOSIZE)
     276
    224277    #define CONTROLDEF_TEXT_CENTER(pcsz, id, cx, cy) { WC_STATIC, pcsz, \
    225278            WS_VISIBLE | SS_TEXT | DT_CENTER | DT_VCENTER | DT_MNEMONIC, \
     
    228281    #define CONTROLDEF_TEXT_WORDBREAK(pcsz, id, cx) { WC_STATIC, pcsz, \
    229282            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 }
    231284
    232285    #define CONTROLDEF_ICON(hptr, id) { WC_STATIC, (PCSZ)(hptr), \
    233286            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 }
    235288
    236289    #define CONTROLDEF_BITMAP(hbm, id) { WC_STATIC, (PCSZ)(hbm), \
    237290            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 }
    239292
    240293    // the following require INCL_WINBUTTONS
     
    244297            id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
    245298
     299    #define LOADDEF_DEFPUSHBUTTON(id) CONTROLDEF_DEFPUSHBUTTON(LOAD_STRING, id, STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT)
     300
    246301    #define CONTROLDEF_PUSHBUTTON(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
    247302            WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON, \
    248303            id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
    249304
     305    #define LOADDEF_PUSHBUTTON(id) CONTROLDEF_PUSHBUTTON(LOAD_STRING, id, STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT)
     306
    250307    #define CONTROLDEF_DEFNOFOCUSBUTTON(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
    251308            WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON | BS_DEFAULT | BS_NOPOINTERFOCUS, \
     
    257314
    258315    #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)
    261320
    262321    #define CONTROLDEF_AUTOCHECKBOX(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
     
    264323            id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
    265324
    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)
    267326
    268327    #define CONTROLDEF_FIRST_AUTORADIO(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
     
    270329            id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
    271330
     331    #define LOADDEF_FIRST_AUTORADIO(id) CONTROLDEF_FIRST_AUTORADIO(LOAD_STRING, id, SZL_AUTOSIZE, SZL_AUTOSIZE)
     332
    272333    #define CONTROLDEF_NEXT_AUTORADIO(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
    273334            WS_VISIBLE | WS_TABSTOP | BS_AUTORADIOBUTTON, \
    274335            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)
    275338
    276339    // the following require INCL_WINENTRYFIELDS
     
    425488                        *pcszRetry,         // "~Retry"
    426489                        *pcszIgnore,        // "~Ignore"
    427                         *pcszEnter,
    428                         *pcszYesToAll;      // "Yes to ~all"
     490                        *pcszEnter,         // "~Help"
     491                        *pcszYesToAll,      // "Yes to ~all"
     492                        *pcszHelp;          // "~Help"
    429493    } MSGBOXSTRINGS, *PMSGBOXSTRINGS;
    430494
     
    455519    #define MBID_YES2ALL               10
    456520
     521    typedef VOID APIENTRY FNHELP(HWND hwndDlg);
     522    typedef FNHELP *PFNHELP;
     523
    457524    APIRET dlghCreateMessageBox(HWND *phwndDlg,
    458525                                HWND hwndOwner,
     
    460527                                PCSZ pcszTitle,
    461528                                PCSZ pcszMessage,
     529                                PFNHELP pfnHelp,
    462530                                ULONG flFlags,
    463531                                PCSZ pcszFont,
     
    469537                         PCSZ pcszTitle,
    470538                         PCSZ pcszMessage,
     539                         PFNHELP pfnHelp,
    471540                         ULONG flFlags,
    472541                         PCSZ pcszFont,
  • trunk/include/helpers/dosh.h

    r153 r159  
    644644                         PULONG pulDirs,
    645645                         PULONG pulFiles);
     646
     647    APIRET doshCanonicalize(PCSZ pcszFileIn,
     648                            PSZ pszFileOut,
     649                            ULONG cbFileOut);
    646650
    647651    /* ******************************************************************
  • trunk/include/helpers/undoc.h

    r127 r159  
    5757     *      folder Details views.
    5858     */
    59 
     59/*
    6060    #define WPSORTKEY_REALNAME      0x00000005
    6161    #define WPSORTKEY_SIZE          0x00000006
     
    6969    #define WPSORTKEY_NAME          0xFFFFFFFE
    7070    #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*/
    8072
    8173    /*
     
    8375     *
    8476     */
     77
     78    /*
    8579
    8680    #define ID_WPMI_PASTE                  0x2CB
     
    113107    #define ID_WPMI_REFRESH                0x1F7
    114108
     109    */
     110
    115111#endif
    116112
  • trunk/include/helpers/winh.h

    r156 r159  
    828828
    829829    BOOL XWPENTRY winhAssertWarp4Notebook(HWND hwndDlg,
    830                                  USHORT usIdThreshold,
    831                                  ULONG ulDownUnits);
     830                                          USHORT usIdThreshold);
    832831
    833832    ULONG XWPENTRY winhDrawFormattedText(HPS hps, PRECTL prcl, const char *pcszText, ULONG flCmd);
  • trunk/src/helpers/cctl_checkcnr.c

    r147 r159  
    677677
    678678/*
    679  *@@ ctlInitCheckboxContainer:
    680  *
    681  *@@added V0.9.18 (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
     684ULONG ctlQueryCheckboxSize(VOID)
    685685{
    686686    if (G_hbmCheckboxes == NULLHANDLE)
     
    692692                                          SBMP_CHECKBOXES);
    693693
    694         // _Pmpf(("hbmCheckboxes: 0x%lX", G_hbmCheckboxes));
    695 
    696694        // and compute size of one checkbox
    697695        // (4 columns, 3 rows)
     696        bmih.cbFix = sizeof(bmih);      // V0.9.19 (2002-04-24) [umoeller]
    698697        GpiQueryBitmapParameters(G_hbmCheckboxes,
    699698                                 &bmih);
    700699        G_cxCheckbox = bmih.cx / 4;
    701700    }
     701
     702    return G_cxCheckbox;
     703}
     704
     705/*
     706 *@@ ctlInitCheckboxContainer:
     707 *
     708 *@@added V0.9.18 (2002-03-03) [umoeller]
     709 */
     710
     711VOID ctlInitCheckboxContainer(HWND hwndCnr)
     712{
     713    ctlQueryCheckboxSize();
    702714
    703715    BEGIN_CNRINFO()
  • trunk/src/helpers/dialog.c

    r156 r159  
    1111 *      dialog behavior in regular window procs (see
    1212 *      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.
    1317 *
    1418 *      Usage: All PM programs.
     
    4246    // as unsigned char
    4347
     48#define INCL_DOSPROCESS
     49#define INCL_DOSEXCEPTIONS
    4450#define INCL_DOSERRORS
    4551
     
    5258#define INCL_WINBUTTONS
    5359#define INCL_WINENTRYFIELDS
     60#define INCL_WINSTDCNR
    5461#define INCL_WINSYS
    5562
     
    6269#include <string.h>
    6370#include <stdio.h>
     71#include <setjmp.h>
    6472
    6573#include "setup.h"                      // code generation and debugging options
     
    6775#include "helpers\comctl.h"
    6876#include "helpers\dialog.h"
     77#include "helpers\except.h"
    6978#include "helpers\gpih.h"
    7079#include "helpers\linklist.h"
     
    128137                cyBorder;           // cached now V0.9.19 (2002-04-17) [umoeller]
    129138
     139    double      dFactorX,           // correlation factors for dialog units
     140                dFactorY;           // V0.9.19 (2002-04-24) [umoeller]
     141
    130142} 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
    131151
    132152typedef struct _COLUMNDEF *PCOLUMNDEF;
     
    167187    PVOID       pvDefinition;       // either a PTABLEDEF or a PCONTROLDEF
    168188
    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
    171203
    172204    HWND        hwndControl;        // created control; NULLHANDLE for tables always
     
    338370            */
    339371            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]
    342375            else
    343376                rcl.yTop = winhQueryScreenCY() * 2 / 3;
     
    402435                {
    403436                    // 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;
    405439                    // and height
    406440                    pszlAuto->cy += 2;
     
    476510 *@@changed V0.9.16 (2002-02-02) [umoeller]: added support for explicit group size
    477511 *@@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
    478514 */
    479515
     
    484520    APIRET      arc = NO_ERROR;
    485521    PCONTROLDEF pControlDef = NULL;
    486     ULONG       ulExtraCX = 0,
    487                 ulExtraCY = 0;
     522    ULONG       xExtraColumn = 0,
     523                yExtraColumn = 0;
    488524
    489525    if (pColumnDef->fIsNestedTable)
     
    501537
    502538            // should we create a PM control around the table?
    503             if (pTableDef->pCtlDef)
     539            if (pControlDef = pTableDef->pCtlDef)
    504540            {
    505541                // yes:
     542                LONG cxCalc = pControlDef->szlDlgUnits.cx * FACTOR_X,
     543                     cyCalc = pControlDef->szlDlgUnits.cy * FACTOR_Y;
    506544
    507545                // check if maybe an explicit size was specified
    508                 // for the group; if that is larger than what
     546                // for the group; only if that is larger than what
    509547                // we've calculated above, use it instead
    510                 if (pTableDef->pCtlDef->szlControlProposed.cx > pColumnDef->cpControl.cx)
     548                if (cxCalc > pColumnDef->cpControl.cx)
    511549                        // 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)
    515553                        // 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;
    521568            }
    522569        }
     
    533580        if (ProcessMode == PROCESS_1_CALC_SIZES)
    534581        {
    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)
    537588               )
    538589            {
    539590                ULONG ulWidth;
    540                 if (pControlDef->szlControlProposed.cx == -1)
     591                if (pControlDef->szlDlgUnits.cx == -1)
    541592                    ulWidth = 1000;
    542593                else
    543                     ulWidth = pControlDef->szlControlProposed.cx;
     594                    ulWidth = cxCalc;
    544595                arc = CalcAutoSize(pControlDef,
    545596                                   ulWidth,
     
    548599            }
    549600
    550             if (    (pControlDef->szlControlProposed.cx < -1)
    551                  && (pControlDef->szlControlProposed.cx >= -100)
     601            if (    (pControlDef->szlDlgUnits.cx < -1)
     602                 && (pControlDef->szlDlgUnits.cx >= -100)
    552603               )
    553604            {
     
    558609            }
    559610
    560             if (    (pControlDef->szlControlProposed.cy < -1)
    561                  && (pControlDef->szlControlProposed.cy >= -100)
     611            if (    (pControlDef->szlDlgUnits.cy < -1)
     612                 && (pControlDef->szlDlgUnits.cy >= -100)
    562613               )
    563614            {
     
    570621            if (!arc)
    571622            {
    572                 if (pControlDef->szlControlProposed.cx < 0)
     623                if (pControlDef->szlDlgUnits.cx < 0)
     624                    // this was autosize:
    573625                    pColumnDef->cpControl.cx = szlAuto.cx;
    574626                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:
    578633                    pColumnDef->cpControl.cy = szlAuto.cy;
    579634                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;
    581638            }
    582639
    583640        } // end if (ProcessMode == PROCESS_1_CALC_SIZES)
    584641
    585         ulExtraCX
    586         = ulExtraCY
    587         = (2 * pControlDef->ulSpacing);
     642        xExtraColumn = 2 * (pControlDef->duSpacing * FACTOR_X);
     643        yExtraColumn = 2 * (pControlDef->duSpacing * FACTOR_Y);
    588644    }
    589645
    590646    pColumnDef->cpColumn.cx =   pColumnDef->cpControl.cx
    591                                + ulExtraCX;
     647                              + xExtraColumn;
    592648    pColumnDef->cpColumn.cy =   pColumnDef->cpControl.cy
    593                                + ulExtraCY;
     649                              + yExtraColumn;
    594650
    595651    if (    (pControlDef)
     
    614670                  + pDlgData->fmLast.lExternalLeading
    615671                  + 2 * cyMargin
    616                   + ulExtraCY;
     672                  + yExtraColumn;
    617673        }
    618674    }
     
    628684 *@@added V0.9.15 (2001-08-26) [umoeller]
    629685 *@@changed V0.9.16 (2001-10-15) [umoeller]: added APIRET
     686 *@@changed V0.9.19 (2002-04-24) [umoeller]: fixed PM groups alignment
    630687 */
    631688
     
    638695
    639696    // calculate column position: this includes spacing
    640     LONG   lSpacingX = 0,
    641            lSpacingY = 0;
     697    LONG   xSpacingControl = 0,
     698           ySpacingControl = 0;
    642699
    643700    // column position = *plX on ProcessRow stack
     
    672729        {
    673730            // 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;
    676739        }
    677740    }
     
    680743        // no nested table, but control:
    681744        PCONTROLDEF pControlDef = (PCONTROLDEF)pColumnDef->pvDefinition;
    682         lSpacingX = lSpacingY = pControlDef->ulSpacing;
     745        xSpacingControl = pControlDef->duSpacing * FACTOR_X;
     746        ySpacingControl = pControlDef->duSpacing * FACTOR_Y;
    683747    }
    684748
     
    688752    // calculate CONTROL pos from COLUMN pos by applying spacing
    689753    pColumnDef->cpControl.x =   (LONG)pColumnDef->cpColumn.x
    690                               + lSpacingX;
     754                              + xSpacingControl;
    691755    pColumnDef->cpControl.y =   (LONG)pColumnDef->cpColumn.y
    692                               + lSpacingY;
     756                              + ySpacingControl;
    693757
    694758    if (pColumnDef->fIsNestedTable)
     
    716780 *@@changed V0.9.16 (2001-12-08) [umoeller]: fixed entry field ES_MARGIN positioning
    717781 *@@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
    718783 */
    719784
     
    747812            // (do this AFTER the other controls from recursing,
    748813            // otherwise the stupid container doesn't show up)
    749             if (pTableDef->pCtlDef)
     814            if (pControlDef = pTableDef->pCtlDef)
    750815            {
    751816                // yes:
    752817                // pcp  = &pColumnDef->cpColumn;  // !! not control
    753                 pControlDef = pTableDef->pCtlDef;
    754818                pcszClass = pControlDef->pcszClass;
    755819                pcszTitle = pControlDef->pcszText;
    756820                flStyle = pControlDef->flStyle;
    757821
    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
    759834                     + pDlgData->ptlTotalOfs.x
    760                      + PM_GROUP_SPACING_X / 2;
    761                 cx =   pColumnDef->cpColumn.cx
    762                      - PM_GROUP_SPACING_X;
    763                     // note, just one spacing: for the _column_ size,
    764                     // we have specified 2 X spacings
    765                 y  =   pColumnDef->cpColumn.y
     835                     - (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
    766841                     + 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                     ;
    772849            }
    773850
     
    848925                            pColumnDef->cpControl.cy));
    849926                    _Pmpf(("   cyDelta = %d", cyDelta));
    850                     y -= cyDelta + 3 * pDlgData->cyBorder + pControlDef->ulSpacing;
     927                    y -=   cyDelta
     928                         + 3 * pDlgData->cyBorder
     929                         + pControlDef->duSpacing * FACTOR_Y;
    851930                    // cy += cyDelta;
    852931                }
     
    9211000                winhSetPresColor(hwndDebug, PP_FOREGROUNDCOLOR, RGBCOL_DARKGREEN);
    9221001
    923                 /*
    9241002                // and another one for the control size
    9251003                hwndDebug =
     
    9381016                                NULL);
    9391017                winhSetPresColor(hwndDebug, PP_FOREGROUNDCOLOR, RGBCOL_RED);
    940                 */
    9411018            }
    9421019#endif
     
    10811158                PCONTROLDEF pControlDef = (PCONTROLDEF)pColumnDef->pvDefinition;
    10821159
    1083                 if (    (pControlDef->szlControlProposed.cx < -1)
    1084                      && (pControlDef->szlControlProposed.cx >= -100)
     1160                if (    (pControlDef->szlDlgUnits.cx < -1)
     1161                     && (pControlDef->szlDlgUnits.cx >= -100)
    10851162                   )
    10861163                {
     
    10881165                    // this we ignored during PROCESS_1_CALC_SIZES
    10891166                    // (see ColumnCalcSizes); now set it to the
    1090                     // table width!
     1167                    // percentage of the table width!
    10911168                    ULONG cxThis = pOwningRow->pOwningTable->cpTable.cx
    1092                                     * -pControlDef->szlControlProposed.cx / 100;
     1169                                    * -pControlDef->szlDlgUnits.cx
     1170                                    / 100;
    10931171
    10941172                    // but the table already has spacing applied,
    10951173                    // so reduce that
    10961174                    pColumnDef->cpControl.cx = cxThis
    1097                                             - (2 * pControlDef->ulSpacing);
     1175                                            - (2 * (pControlDef->duSpacing * FACTOR_X));
    10981176
    10991177                    pColumnDef->cpColumn.cx = cxThis;
    11001178
    11011179                    // now we might have to re-compute auto-size
    1102                     if (pControlDef->szlControlProposed.cy == -1)
     1180                    if (pControlDef->szlDlgUnits.cy == -1)
    11031181                    {
    11041182                        SIZEL   szlAuto;
     
    11151193
    11161194                            pColumnDef->cpControl.cy = szlAuto.cy;
    1117                             pColumnDef->cpColumn.cy = szlAuto.cy
    1118                                         + (2 * pControlDef->ulSpacing);
     1195                            pColumnDef->cpColumn.cy =   szlAuto.cy
     1196                                                      + (2 * (pControlDef->duSpacing * FACTOR_Y));
    11191197                        }
    11201198                    }
    11211199                }
    11221200
    1123                 if (    (pControlDef->szlControlProposed.cy < -1)
    1124                      && (pControlDef->szlControlProposed.cy >= -100)
     1201                if (    (pControlDef->szlDlgUnits.cy < -1)
     1202                     && (pControlDef->szlDlgUnits.cy >= -100)
    11251203                   )
    11261204                {
    11271205                    // same thing for CY, but this time we
    1128                     // take the row height
     1206                    // take the percentage of the row height
    11291207                    ULONG cyThis = pOwningRow->cpRow.cy
    1130                                     * -pControlDef->szlControlProposed.cy / 100;
     1208                                    * -pControlDef->szlDlgUnits.cy
     1209                                    / 100;
    11311210
    11321211                    // but the table already has spacing applied,
    11331212                    // so reduce that
    1134                     pColumnDef->cpControl.cy = cyThis
    1135                                             - (2 * pControlDef->ulSpacing);
     1213                    pColumnDef->cpControl.cy =   cyThis
     1214                                               - (2 * (pControlDef->duSpacing * FACTOR_Y));
    11361215
    11371216                    pColumnDef->cpColumn.cy = cyThis;
     
    15101589} STACKITEM, *PSTACKITEM;
    15111590
    1512 #define SPACING     10
    1513 
    15141591/*
    15151592 *@@ Dlg0_Init:
    15161593 *
    15171594 *@@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
    15191597 */
    15201598
     
    15231601                        PLINKLIST pllControls)
    15241602{
    1525     PDLGPRIVATE pDlgData;
     1603    PDLGPRIVATE     pDlgData;
     1604    POINTL          ptl = {100, 100};
     1605
    15261606    if (!(pDlgData = NEW(DLGPRIVATE)))
    15271607        return (ERROR_NOT_ENOUGH_MEMORY);
     
    15371617    pDlgData->cxBorder = WinQuerySysValue(HWND_DESKTOP, SV_CXBORDER);
    15381618    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    }
    15391642
    15401643    *ppDlgData = pDlgData;
     
    17771880     */
    17781881
    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;
    17821884
    17831885    ProcessAll(pDlgData,
     
    20882190 *@@changed V0.9.14 (2001-08-21) [umoeller]: fixed default push button problems
    20892191 *@@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
    20902193 */
    20912194
     
    21022205    APIRET      arc = NO_ERROR;
    21032206
    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)))
    21702228            {
    2171                 HWND    hwndDlg = pDlgData->hwndDlg;
    2172                 HWND    hwndFocusItem = NULLHANDLE;
    2173                 RECTL   rclClient;
    2174 
    21752229                /*
    2176                  *  3) compute size of all controls
     2230                 *  2) create empty dialog frame
    21772231                 *
    21782232                 */
    21792233
    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
    21812275                {
    2182                     WinSubclassWindow(hwndDlg, pfnwpDialogProc);
     2276                    HWND    hwndDlg = pDlgData->hwndDlg;
     2277                    HWND    hwndFocusItem = NULLHANDLE;
     2278                    RECTL   rclClient;
    21832279
    21842280                    /*
    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
    22112282                     *
    22122283                     */
    22132284
    2214                     if (!WinSendMsg(pDlgData->hwndDlg,
    2215                                     WM_INITDLG,
    2216                                     (MPARAM)hwndFocusItem,
    2217                                     (MPARAM)pCreateParams))
     2285                    if (!(arc = Dlg2_CalcSizes(pDlgData)))
    22182286                    {
    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                        }
    22232331                    }
    22242332                }
    22252333            }
    2226         }
    2227 
    2228         if (arc)
    2229         {
    2230             // error: clean up
    2231             if (pDlgData->hwndDlg)
     2334
     2335            if (arc)
    22322336            {
    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                }
    22352343            }
    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();
    22432355
    22442356    if (arc)
     
    22872399 *@@added V0.9.16 (2001-09-29) [umoeller]
    22882400 *@@changed V0.9.18 (2002-03-03) [umoeller]: added pszlClient, fixed output
     2401 *@@changed V0.9.19 (2002-04-24) [umoeller]: added excpt handling
    22892402 */
    22902403
     
    22992412    APIRET      arc = NO_ERROR;
    23002413
    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)))
    23392436            {
    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                }
    23422467            }
    23432468
    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();
    23542476
    23552477    if (arc)
     
    24702592 +                       fnwpMyDialogProc,
    24712593 +                       "Title",
    2472  +                       pArray->paDialogItems,     // dialog array!
     2594 +                       pArray->paDlgItems,        // dialog array!
    24732595 +                       pArray->cDlgItemsNow,      // real count of items!
    24742596 +                       NULL,
     
    25882710
    25892711/*
     2712 *@@ fnwpMessageBox:
     2713 *
     2714 *@@added V0.9.19 (2002-04-24) [umoeller]
     2715 */
     2716
     2717MRESULT 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/*
    25902735 *@@ dlghCreateMessageBox:
    25912736 *
    25922737 *@@added V0.9.13 (2001-06-21) [umoeller]
    25932738 *@@changed V0.9.14 (2001-07-26) [umoeller]: fixed missing focus on buttons
     2739 *@@changed V0.9.19 (2002-04-24) [umoeller]: added pfnHelp
    25942740 */
    25952741
     
    25992745                            PCSZ pcszTitle,
    26002746                            PCSZ pcszMessage,
     2747                            PFNHELP pfnHelp,           // in: help callback or NULL
    26012748                            ULONG flFlags,
    26022749                            PCSZ pcszFont,
     
    26042751                            PULONG pulAlarmFlag)      // out: alarm sound to be played
    26052752{
     2753    APIRET arc;
     2754
    26062755    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                {
    26632769                    START_TABLE,
    26642770                        START_ROW(ROW_VALIGN_CENTER),
     
    26662772                        START_TABLE,
    26672773                            START_ROW(ROW_VALIGN_CENTER),
     2774                                CONTROL_DEF(&Spacing),
     2775                            START_ROW(ROW_VALIGN_CENTER),
    26682776                                CONTROL_DEF(&InfoText),
     2777                            START_ROW(ROW_VALIGN_CENTER),
     2778                                CONTROL_DEF(&Spacing),
    26692779                            START_ROW(ROW_VALIGN_CENTER),
    26702780                                CONTROL_DEF(&Buttons[0]),
    26712781                                CONTROL_DEF(&Buttons[1]),
    26722782                                CONTROL_DEF(&Buttons[2]),
     2783                },
     2784            MessageBoxHelp[] =
     2785                {
     2786                                CONTROL_DEF(&Buttons[3]),
     2787                },
     2788            MessageBoxTail[] =
     2789                {
    26732790                        END_TABLE,
    26742791                    END_TABLE
    2675                  };
     2792                };
    26762793
    26772794    ULONG flButtons = flFlags & 0xF;        // low nibble contains MB_YESNO etc.
     2795    PDLGARRAY pArrayBox;
    26782796
    26792797    PCSZ        p0 = "Error",
     
    27642882        *pulAlarmFlag = WA_WARNING;
    27652883
    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;
    27752922}
    27762923
     
    28853032 *      -- MB_ICONEXCLAMATION
    28863033 *
     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 *
    28873038 *      Returns MBID_* codes like WinMessageBox.
    28883039 *
    28893040 *@@added V0.9.13 (2001-06-21) [umoeller]
     3041 *@@changed V0.9.19 (2002-04-24) [umoeller]: added pfnHelp
    28903042 */
    28913043
    28923044ULONG dlghMessageBox(HWND hwndOwner,            // in: owner for msg box
    28933045                     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
    28963049                     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")
    28983051                     const MSGBOXSTRINGS *pStrings) // in: strings array
    28993052{
     
    29053058                                      pcszTitle,
    29063059                                      pcszMessage,
     3060                                      pfnHelp,
    29073061                                      flFlags,
    29083062                                      pcszFont,
     
    29803134                            CTL_COMMON_FONT,
    29813135                            0,
    2982                             { 300, SZL_AUTOSIZE },     // size
     3136                            { 150, SZL_AUTOSIZE },     // size
    29833137                            5               // spacing
    29843138                         },
     
    29903144                            CTL_COMMON_FONT,
    29913145                            0,
    2992                             { 300, SZL_AUTOSIZE },     // size
     3146                            { 150, SZL_AUTOSIZE },     // size
    29933147                            5               // spacing
    29943148                         },
     
    30003154                            CTL_COMMON_FONT,
    30013155                            0,
    3002                             { 100, 30 },    // size
     3156                            { STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT },    // size
    30033157                            5               // spacing
    30043158                         },
     
    30103164                            CTL_COMMON_FONT,
    30113165                            0,
    3012                             { 100, 30 },    // size
     3166                            { STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT },    // size
    30133167                            5               // spacing
    30143168                         };
  • trunk/src/helpers/dosh.c

    r154 r159  
    19421942 *
    19431943 *      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.
    19461947 *
    19471948 *@@added V0.9.6 (2000-10-16) [umoeller]
     
    20082009    CHAR szName[5];
    20092010
    2010     APIRET rc              = NO_ERROR; // return code
     2011    APIRET arc;
    20112012    BYTE   fsqBuffer[sizeof(FSQBUFFER2) + (3 * CCHMAXPATH)] = {0};
    20122013    ULONG  cbBuffer   = sizeof(fsqBuffer);        // Buffer length)
     
    20172018    szName[2] = '\0';
    20182019
    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
    20262025    {
    20272026        // The data for the last three fields in the FSQBUFFER2
     
    34343433
    34353434/*
     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
     3451APIRET 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/*
    34363496 *@@category: Helpers\Control program helpers\Module handling
    34373497 *      helpers for importing functions from a module (DLL).
  • trunk/src/helpers/makefile

    r153 r159  
    145145TESTCASE_DIR = testcase
    146146
    147 TESTCASE_CC = icc /c /ti+ /w2 /ss /se /i$(HELPERS_BASE)\include /DDEBUG_DIALOG_WINDOWS /Fo$(TESTCASE_DIR)\$(@B).obj $(@B).c
     147TESTCASE_CC = icc /c /ti+ /w2 /ss /se /i$(HELPERS_BASE)\include /Fo$(TESTCASE_DIR)\$(@B).obj $(@B).c
    148148
    149149.c.{$(TESTCASE_DIR)}.obj:
     
    165165dosh.exe: $(DOSH_TEST_OBJS)
    166166    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
    167170
    168171# dialog.exe
     
    173176    $(TESTCASE_DIR)\xstring.obj \
    174177    $(TESTCASE_DIR)\linklist.obj \
     178    $(TESTCASE_DIR)\cctl_checkcnr.obj \
     179    $(TESTCASE_DIR)\cnrh.obj \
    175180    $(TESTCASE_DIR)\comctl.obj \
    176181    $(TESTCASE_DIR)\stringh.obj \
    177182    $(TESTCASE_DIR)\dosh.obj \
     183    $(TESTCASE_DIR)\except.obj \
     184    $(TESTCASE_DIR)\debug.obj \
    178185    $(TESTCASE_DIR)\gpih.obj
    179186
  • trunk/src/helpers/stringh.c

    r153 r159  
    10631063
    10641064    while(*p)
    1065         if (   (*p == '\r')
    1066             || (*p == '\n')
     1065        if (    (*p == '\r')
     1066             || (*p == '\n')
    10671067           )
    10681068        {
  • trunk/src/helpers/winh.c

    r158 r159  
    40314031 *      controls which should be moved such an ID.
    40324032 *
    4033  *      You can also specify how many dialog units
    4034  *      all the other controls will be moved downward in
    4035  *      ulDownUnits; this is useful to fill up the space
    4036  *      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).
    40384038 *
    40394039 *      This function is useful if you wish to create
     
    40444044 *
    40454045 *@@changed V0.9.16 (2002-02-02) [umoeller]: fixed entry fields
     4046 *@@changed V0.9.19 (2002-04-24) [umoeller]: removed ulDownUnits
    40464047 */
    40474048
    40484049BOOL winhAssertWarp4Notebook(HWND hwndDlg,
    4049                              USHORT usIdThreshold,    // in: ID threshold
    4050                              ULONG ulDownUnits)       // in: dialog units or 0
     4050                             USHORT usIdThreshold)  // in: ID threshold
    40514051{
    40524052    BOOL brc = FALSE;
     
    40544054    if (doshIsWarp4())
    40554055    {
    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))
    40624071        {
    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)))
    40774077            {
    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)
    40894081                {
     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:
    40904091                    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
    40944098                    // special handling for entry fields
    40954099                    // V0.9.16 (2002-02-02) [umoeller]
     
    40974101                    if (!strcmp(szClass, "#6"))
    40984102                    {
    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);
    41014105                    }
    41024106
    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;
    41094110                }
     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);
    41104131        }
    4111         WinEndEnumWindows(henum);
    41124132
    41134133        if (fIsVisible)
Note: See TracChangeset for help on using the changeset viewer.