Changeset 137


Ignore:
Timestamp:
Feb 4, 2002, 6:32:38 PM (24 years ago)
Author:
umoeller
Message:

Buncha fixes, and fixes for fixes.

Location:
trunk
Files:
9 edited

Legend:

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

    r136 r137  
    6262
    6363    #define SZL_AUTOSIZE                (-1)
    64     #define SZL_LARGEST_ROW_WIDTH       (-2)
    6564
    6665    #define CTL_COMMON_FONT             ((PCSZ)-1)
     
    115114                //    the largest row in the table. This is valid
    116115                //    for the CX field only.
    117                 // This field is IGNORED if the CONTROLDEF appears
    118                 // with a START_NEW_TABLE type in _DLGHITEM.
     116                // If the CONTROLDEF appears with a START_NEW_TABLE
     117                // type in _DLGHITEM (to specify a group table)
     118                // and they are not SZL_AUTOSIZE, they specify the
     119                // table size (to override the automatic formatting).
    119120
    120121        ULONG       ulSpacing;          // spacing around control
     
    242243    #define CONTROLDEF_ENTRYFIELD(pcsz, id, cx, cy) { WC_ENTRYFIELD, pcsz, \
    243244            WS_VISIBLE | WS_TABSTOP | ES_MARGIN | ES_AUTOSCROLL, \
    244             id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING + 5 }
     245            id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
    245246
    246247    #define CONTROLDEF_ENTRYFIELD_RO(pcsz, id, cx, cy) { WC_ENTRYFIELD, pcsz, \
    247248            WS_VISIBLE | WS_TABSTOP | ES_MARGIN | ES_READONLY | ES_AUTOSCROLL, \
    248             id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING + 5 }
     249            id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
    249250
    250251    #define CONTROLDEF_MLE(pcsz, id, cx, cy) { WC_MLE, pcsz, \
     
    252253            id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
    253254
     255    #define CONTROLDEF_LISTBOX(id, cx, cy) { WC_LISTBOX, NULL, \
     256            WS_VISIBLE | WS_TABSTOP | LS_HORZSCROLL | LS_NOADJUSTPOS, \
     257            id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
     258
    254259    #define CONTROLDEF_SPINBUTTON(id, cx, cy) { WC_SPINBUTTON, NULL, \
    255260            WS_VISIBLE | WS_TABSTOP | SPBS_MASTER | SPBS_NUMERICONLY | SPBS_JUSTCENTER | SPBS_FASTSPIN, \
     261            id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
     262
     263    #define CONTROLDEF_CONTAINER(id, cx, cy) { WC_CONTAINER, NULL, \
     264            WS_VISIBLE | WS_TABSTOP | 0, \
    256265            id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
    257266
  • trunk/include/helpers/xstring.h

    r132 r137  
    225225    typedef XSTRENCODE *PXSTRENCODE;
    226226
     227    ULONG XWPENTRY xstrDecode2(PXSTRING pxstr,
     228                               CHAR cKey);
     229
    227230    ULONG XWPENTRY xstrDecode(PXSTRING pxstr);
    228231    typedef ULONG XWPENTRY XSTRDECODE(PXSTRING pxstr);
  • trunk/src/helpers/dialog.c

    r136 r137  
    7373#include "helpers\xstring.h"
    7474
     75#pragma hdrstop
     76
     77// #define DEBUG_DIALOG_WINDOWS 1
     78
    7579/*
    7680 *@@category: Helpers\PM helpers\Dialog templates
     
    109113                                 // created
    110114
    111     const char  *pcszControlsFont;  // from dlghCreateDlg
    112 
    113     // V0.9.14 (2001-08-01) [umoeller]
     115    PCSZ        pcszControlsFont;  // from dlghCreateDlg
     116
     117    // size of the client to be created
     118    SIZEL       szlClient;
     119
     120    // various cached data V0.9.14 (2001-08-01) [umoeller]
    114121    HPS         hps;
    115     const char  *pcszFontLast;
     122    PCSZ        pcszFontLast;
    116123    LONG        lcidLast;
    117124    FONTMETRICS fmLast;
     
    190197typedef struct _TABLEDEF
    191198{
     199    PCOLUMNDEF  pOwningColumn;      // != NULL if this is a nested table
     200
    192201    LINKLIST    llRows;             // contains ROWDEF structs, no auto-free
    193202
     
    205214typedef enum _PROCESSMODE
    206215{
    207     PROCESS_CALC_SIZES,             // step 1
    208     PROCESS_CALC_POSITIONS,         // step 3
    209     PROCESS_CREATE_CONTROLS         // step 4
     216    PROCESS_1_CALC_SIZES,             // step 1
     217    PROCESS_2_CALC_SIZES_FROM_TABLES, // step 2
     218    PROCESS_3_CALC_FINAL_TABLE_SIZES, // step 3
     219    PROCESS_4_CALC_POSITIONS,         // step 4
     220    PROCESS_5_CREATE_CONTROLS         // step 5
    210221} PROCESSMODE;
    211222
     
    217228
    218229#define PM_GROUP_SPACING_X          16
    219 #define PM_GROUP_SPACING_TOP        20
     230#define PM_GROUP_SPACING_TOP        16
    220231
    221232APIRET ProcessTable(PTABLEDEF pTableDef,
     
    293304 *@@changed V0.9.14 (2001-08-01) [umoeller]: now caching fonts, which is significantly faster
    294305 *@@changed V0.9.16 (2001-10-15) [umoeller]: added APIRET
     306 *@@changed V0.9.16 (2002-02-02) [umoeller]: added ulWidth
    295307 */
    296308
    297309APIRET CalcAutoSizeText(PCONTROLDEF pControlDef,
    298310                        BOOL fMultiLine,          // in: if TRUE, multiple lines
     311                        ULONG ulWidth,            // in: proposed width of control
    299312                        PSIZEL pszlAuto,          // out: computed size
    300313                        PDLGPRIVATE pDlgData)
     
    317330        {
    318331            RECTL rcl = {0, 0, 0, 0};
     332            /*
    319333            if (pControlDef->szlControlProposed.cx > 0)
    320334                rcl.xRight = pControlDef->szlControlProposed.cx;   // V0.9.12 (2001-05-31) [umoeller]
    321335            else
    322336                rcl.xRight = winhQueryScreenCX() * 2 / 3;
     337            */
     338            rcl.xRight = ulWidth;
    323339            if (pControlDef->szlControlProposed.cy > 0)
    324340                rcl.yTop = pControlDef->szlControlProposed.cy;   // V0.9.12 (2001-05-31) [umoeller]
     
    358374
    359375APIRET CalcAutoSize(PCONTROLDEF pControlDef,
     376                    ULONG ulWidth,            // in: proposed width of control
    360377                    PSIZEL pszlAuto,          // out: computed size
    361378                    PDLGPRIVATE pDlgData)
     
    372389            if (!(arc = CalcAutoSizeText(pControlDef,
    373390                                         FALSE,         // no multiline
     391                                         ulWidth,
    374392                                         pszlAuto,
    375393                                         pDlgData)))
     
    404422                arc = CalcAutoSizeText(pControlDef,
    405423                                       ((pControlDef->flStyle & DT_WORDBREAK) != 0),
     424                                       ulWidth,
    406425                                       pszlAuto,
    407426                                       pDlgData);
     
    437456            pszlAuto->cy =   pDlgData->fmLast.lMaxBaselineExt
    438457                           + pDlgData->fmLast.lExternalLeading
    439                            + 5;         // some space
     458                           + 7;         // some space
    440459    }
    441460
     
    445464/*
    446465 *@@ ColumnCalcSizes:
    447  *      implementation for PROCESS_CALC_SIZES in
     466 *      implementation for PROCESS_1_CALC_SIZES in
    448467 *      ProcessColumn.
     468 *
     469 *      This gets called a second time for
     470 *      PROCESS_3_CALC_FINAL_TABLE_SIZES (V0.9.16).
    449471 *
    450472 *@@added V0.9.15 (2001-08-26) [umoeller]
     
    455477
    456478APIRET ColumnCalcSizes(PCOLUMNDEF pColumnDef,
     479                       PROCESSMODE ProcessMode,     // in: PROCESS_1_CALC_SIZES or PROCESS_3_CALC_FINAL_TABLE_SIZES
    457480                       PDLGPRIVATE pDlgData)
    458481{
    459482    APIRET arc = NO_ERROR;
    460483
    461     ULONG       ulXSpacing = 0,
    462                 ulYSpacing = 0;
     484    ULONG       ulExtraCX = 0,
     485                ulExtraCY = 0;
    463486    if (pColumnDef->fIsNestedTable)
    464487    {
     
    467490        if (!(arc = ProcessTable(pTableDef,
    468491                                 NULL,
    469                                  PROCESS_CALC_SIZES,
     492                                 ProcessMode,
    470493                                 pDlgData)))
    471494        {
     
    491514
    492515                // in any case, make this wider
    493                 ulXSpacing =    2 * PM_GROUP_SPACING_X;
    494                 ulYSpacing =    // 3 * PM_GROUP_SPACING_X;
    495                             (PM_GROUP_SPACING_X + PM_GROUP_SPACING_TOP);
     516                ulExtraCX =    2 * PM_GROUP_SPACING_X;
     517                ulExtraCY =    (PM_GROUP_SPACING_X + PM_GROUP_SPACING_TOP);
    496518            }
    497519        }
     
    501523        // no nested table, but control:
    502524        PCONTROLDEF pControlDef = (PCONTROLDEF)pColumnDef->pvDefinition;
    503         PSIZEL      pszl = &pControlDef->szlControlProposed;
    504525        SIZEL       szlAuto;
    505526
    506         if (    (pszl->cx < -1)
    507              && (pszl->cx >= -100)
    508            )
    509         {
    510             // other negative CX value:
    511             // this is then a percentage of the row width... ignore for now
    512             // V0.9.16 (2002-02-02) [umoeller]
    513             szlAuto.cx = 0;
    514             szlAuto.cy = 0;
    515         }
    516         else if (    (pszl->cx == -1)
    517                   || (pszl->cy == -1)
    518                 )
    519         {
    520             arc = CalcAutoSize(pControlDef,
    521                                &szlAuto,
    522                                pDlgData);
    523         }
    524 
    525         if (!arc)
    526         {
    527             if (pszl->cx < 0)
    528                 pColumnDef->cpControl.cx = szlAuto.cx;
    529             else
    530                 pColumnDef->cpControl.cx = pszl->cx;
    531 
    532             if (pszl->cy < 0)
    533                 pColumnDef->cpControl.cy = szlAuto.cy;
    534             else
    535                 pColumnDef->cpControl.cy = pszl->cy;
    536 
    537             // @@todo hack sizes
    538 
    539             ulXSpacing
    540             = ulYSpacing
    541             = (2 * pControlDef->ulSpacing);
    542         }
     527        // do auto-size calculations only on the first loop
     528        // V0.9.16 (2002-02-02) [umoeller]
     529        if (ProcessMode == PROCESS_1_CALC_SIZES)
     530        {
     531            if (    (pControlDef->szlControlProposed.cx == -1)
     532                 || (pControlDef->szlControlProposed.cy == -1)
     533               )
     534            {
     535                ULONG ulWidth;
     536                if (pControlDef->szlControlProposed.cx == -1)
     537                    ulWidth = 1000;
     538                else
     539                    ulWidth = pControlDef->szlControlProposed.cx;
     540                arc = CalcAutoSize(pControlDef,
     541                                   ulWidth,
     542                                   &szlAuto,
     543                                   pDlgData);
     544            }
     545
     546            if (    (pControlDef->szlControlProposed.cx < -1)
     547                 && (pControlDef->szlControlProposed.cx >= -100)
     548               )
     549            {
     550                // other negative CX value:
     551                // this is then a percentage of the table width... ignore for now
     552                // V0.9.16 (2002-02-02) [umoeller]
     553                szlAuto.cx = 0;
     554            }
     555
     556            if (    (pControlDef->szlControlProposed.cy < -1)
     557                 && (pControlDef->szlControlProposed.cy >= -100)
     558               )
     559            {
     560                // other negative CY value:
     561                // this is then a percentage of the row height... ignore for now
     562                // V0.9.16 (2002-02-02) [umoeller]
     563                szlAuto.cy = 0;
     564            }
     565
     566            if (!arc)
     567            {
     568                if (pControlDef->szlControlProposed.cx < 0)
     569                    pColumnDef->cpControl.cx = szlAuto.cx;
     570                else
     571                    pColumnDef->cpControl.cx = pControlDef->szlControlProposed.cx;
     572
     573                if (pControlDef->szlControlProposed.cy < 0)
     574                    pColumnDef->cpControl.cy = szlAuto.cy;
     575                else
     576                    pColumnDef->cpControl.cy = pControlDef->szlControlProposed.cy;
     577            }
     578
     579        } // end if (ProcessMode == PROCESS_1_CALC_SIZES)
     580
     581
     582        ulExtraCX
     583        = ulExtraCY
     584        = (2 * pControlDef->ulSpacing);
    543585    }
    544586
    545587    pColumnDef->cpColumn.cx =   pColumnDef->cpControl.cx
    546                                + ulXSpacing;
     588                               + ulExtraCX;
    547589    pColumnDef->cpColumn.cy =   pColumnDef->cpControl.cy
    548                                + ulYSpacing;
     590                               + ulExtraCY;
    549591
    550592    return (arc);
     
    553595/*
    554596 *@@ ColumnCalcPositions:
    555  *      implementation for PROCESS_CALC_POSITIONS in
     597 *      implementation for PROCESS_4_CALC_POSITIONS in
    556598 *      ProcessColumn.
    557599 *
     
    562604APIRET ColumnCalcPositions(PCOLUMNDEF pColumnDef,
    563605                           PROWDEF pOwningRow,          // in: current row from ProcessRow
    564                            PLONG plX,                   // in/out: PROCESS_CALC_POSITIONS only
     606                           PLONG plX,                   // in/out: PROCESS_4_CALC_POSITIONS only
    565607                           PDLGPRIVATE pDlgData)
    566608{
     
    568610
    569611    // calculate column position: this includes spacing
    570     ULONG ulSpacing = 0;
     612    LONG   lSpacingX = 0,
     613           lSpacingY = 0;
    571614
    572615    // column position = *plX on ProcessRow stack
     
    599642        // should we create a PM control around the table?
    600643        if (pTableDef->pCtlDef)
     644        {
    601645            // yes:
    602             ulSpacing = PM_GROUP_SPACING_X / 2;     // V0.9.16 (2001-10-15) [umoeller]
     646            lSpacingX = PM_GROUP_SPACING_X;     // V0.9.16 (2001-10-15) [umoeller]
     647            lSpacingY = PM_GROUP_SPACING_X;     // V0.9.16 (2001-10-15) [umoeller]
     648        }
    603649    }
    604650    else
     
    606652        // no nested table, but control:
    607653        PCONTROLDEF pControlDef = (PCONTROLDEF)pColumnDef->pvDefinition;
    608         ulSpacing = pControlDef->ulSpacing;
     654        lSpacingX = lSpacingY = pControlDef->ulSpacing;
    609655    }
    610656
     
    613659
    614660    // calculate CONTROL pos from COLUMN pos by applying spacing
    615     pColumnDef->cpControl.x =   pColumnDef->cpColumn.x
    616                               + ulSpacing;
    617     pColumnDef->cpControl.y =   pColumnDef->cpColumn.y
    618                               + ulSpacing;
     661    pColumnDef->cpControl.x =   (LONG)pColumnDef->cpColumn.x
     662                              + lSpacingX;
     663    pColumnDef->cpControl.y =   (LONG)pColumnDef->cpColumn.y
     664                              + lSpacingY;
    619665
    620666    if (pColumnDef->fIsNestedTable)
     
    626672        arc = ProcessTable(pTableDef,
    627673                           &pColumnDef->cpControl,   // start pos for new table
    628                            PROCESS_CALC_POSITIONS,
     674                           PROCESS_4_CALC_POSITIONS,
    629675                           pDlgData);
    630676    }
     
    635681/*
    636682 *@@ ColumnCreateControls:
    637  *      implementation for PROCESS_CREATE_CONTROLS in
     683 *      implementation for PROCESS_5_CREATE_CONTROLS in
    638684 *      ProcessColumn.
    639685 *
     
    648694    APIRET      arc = NO_ERROR;
    649695
    650     PCONTROLPOS pcp = NULL;
    651696    PCONTROLDEF pControlDef = NULL;
    652     const char  *pcszTitle = NULL;
     697
     698    PCSZ        pcszClass = NULL;
     699    PCSZ        pcszTitle = NULL;
    653700    ULONG       flStyle = 0;
    654701    LHANDLE     lHandleSet = NULLHANDLE;
     
    665712        if (!(arc = ProcessTable(pTableDef,
    666713                                 NULL,
    667                                  PROCESS_CREATE_CONTROLS,
     714                                 PROCESS_5_CREATE_CONTROLS,
    668715                                 pDlgData)))
    669716        {
     
    674721            {
    675722                // yes:
    676                 pcp  = &pColumnDef->cpColumn;  // !! not control
     723                // pcp  = &pColumnDef->cpColumn;  // !! not control
    677724                pControlDef = pTableDef->pCtlDef;
     725                pcszClass = pControlDef->pcszClass;
    678726                pcszTitle = pControlDef->pcszText;
    679727                flStyle = pControlDef->flStyle;
    680728
    681                 x = pcp->x + pDlgData->ptlTotalOfs.x;
    682                 cx = pcp->cx - PM_GROUP_SPACING_X;
     729                x  =   pColumnDef->cpColumn.x
     730                     + pDlgData->ptlTotalOfs.x
     731                     + PM_GROUP_SPACING_X / 2;
     732                cx =   pColumnDef->cpColumn.cx
     733                     - PM_GROUP_SPACING_X;
    683734                    // note, just one spacing: for the _column_ size,
    684735                    // we have specified 2 X spacings
    685                 y = pcp->y + pDlgData->ptlTotalOfs.y;
     736                y  =   pColumnDef->cpColumn.y
     737                     + pDlgData->ptlTotalOfs.y
     738                     + PM_GROUP_SPACING_X / 2;
    686739                // cy = pcp->cy - PM_GROUP_SPACING_X;
    687                 cy = pcp->cy - /* PM_GROUP_SPACING_X - */ PM_GROUP_SPACING_TOP / 2;
     740                // cy = pcp->cy - /* PM_GROUP_SPACING_X - */ PM_GROUP_SPACING_TOP;
     741                cy =   pColumnDef->cpColumn.cy
     742                     - PM_GROUP_SPACING_X / 2; //  - PM_GROUP_SPACING_TOP / 2;
    688743            }
     744
     745#ifdef DEBUG_DIALOG_WINDOWS
     746            {
     747                HWND hwndDebug;
     748                // debug: create a frame with the exact size
     749                // of the _column_ (not the control), so this
     750                // includes spacing
     751                hwndDebug =
     752                   WinCreateWindow(pDlgData->hwndDlg,   // parent
     753                                WC_STATIC,
     754                                "",
     755                                WS_VISIBLE | SS_FGNDFRAME,
     756                                pTableDef->cpTable.x + pDlgData->ptlTotalOfs.x,
     757                                pTableDef->cpTable.y + pDlgData->ptlTotalOfs.y,
     758                                pTableDef->cpTable.cx,
     759                                pTableDef->cpTable.cy,
     760                                pDlgData->hwndDlg,   // owner
     761                                HWND_BOTTOM,
     762                                -1,
     763                                NULL,
     764                                NULL);
     765                winhSetPresColor(hwndDebug, PP_FOREGROUNDCOLOR, RGBCOL_BLUE);
     766            }
     767#endif
    689768        }
    690769    }
     
    693772        // no nested table, but control:
    694773        pControlDef = (PCONTROLDEF)pColumnDef->pvDefinition;
    695         pcp = &pColumnDef->cpControl;
     774        // pcp = &pColumnDef->cpControl;
     775        pcszClass = pControlDef->pcszClass;
    696776        pcszTitle = pControlDef->pcszText;
    697777        flStyle = pControlDef->flStyle;
    698778
    699         x = pcp->x + pDlgData->ptlTotalOfs.x;
    700         cx = pcp->cx;
    701         y = pcp->y + pDlgData->ptlTotalOfs.y;
    702         cy = pcp->cy;
     779        x  =   pColumnDef->cpControl.x
     780             + pDlgData->ptlTotalOfs.x;
     781        cx =   pColumnDef->cpControl.cx;
     782        y  =   pColumnDef->cpControl.y
     783             + pDlgData->ptlTotalOfs.y;
     784        cy =   pColumnDef->cpControl.cy;
    703785
    704786        // now implement hacks for certain controls
     
    734816
    735817            case 0xffff0006L:   // entry field
     818            case 0xffff000AL:   // MLE:
    736819                // the stupid entry field resizes itself if it has
    737820                // the ES_MARGIN style, so correlate that too... dammit
     
    743826
    744827                    x += cxMargin;
    745                     y += cxMargin;
     828                    y += cyMargin;
     829                    cx -= 2 * cxMargin;
     830                    cy -= 2 * cyMargin;
     831                    // cy -= cxMargin;
    746832                }
    747833            break;
     
    749835    }
    750836
    751     if (pcp && pControlDef)
     837    if (pControlDef)
    752838    {
    753839        // create something:
    754         // PPRESPARAMS ppp = NULL;
    755 
    756         const char  *pcszFont = pControlDef->pcszFont;
     840        PCSZ pcszFont = pControlDef->pcszFont;
    757841                        // can be NULL, or CTL_COMMON_FONT
    758842        if (pcszFont == CTL_COMMON_FONT)
    759843            pcszFont = pDlgData->pcszControlsFont;
    760844
    761         /* if (pcszFont)
    762             winhStorePresParam(&ppp,
    763                                PP_FONTNAMESIZE,
    764                                strlen(pcszFont),
    765                                (PVOID)pcszFont); */
    766 
    767845        if (pColumnDef->hwndControl
    768846            = WinCreateWindow(pDlgData->hwndDlg,   // parent
    769                               (PSZ)pControlDef->pcszClass,
     847                              (PSZ)pcszClass,   // hacked
    770848                              (pcszTitle)   // hacked
    771849                                    ? (PSZ)pcszTitle
     
    782860                              NULL))
    783861        {
     862#ifdef DEBUG_DIALOG_WINDOWS
     863            {
     864                HWND hwndDebug;
     865                // debug: create a frame with the exact size
     866                // of the _column_ (not the control), so this
     867                // includes spacing
     868                hwndDebug =
     869                   WinCreateWindow(pDlgData->hwndDlg,   // parent
     870                                WC_STATIC,
     871                                "",
     872                                WS_VISIBLE | SS_FGNDFRAME,
     873                                pColumnDef->cpColumn.x + pDlgData->ptlTotalOfs.x,
     874                                pColumnDef->cpColumn.y + pDlgData->ptlTotalOfs.y,
     875                                pColumnDef->cpColumn.cx,
     876                                pColumnDef->cpColumn.cy,
     877                                pDlgData->hwndDlg,   // owner
     878                                HWND_BOTTOM,
     879                                -1,
     880                                NULL,
     881                                NULL);
     882                winhSetPresColor(hwndDebug, PP_FOREGROUNDCOLOR, RGBCOL_RED);
     883            }
     884#endif
     885
    784886            if (lHandleSet)
    785887            {
     
    850952 *      This does the following:
    851953 *
    852  *      -- PROCESS_CALC_SIZES: size is taken from control def,
     954 *      -- PROCESS_1_CALC_SIZES: size is taken from control def,
    853955 *         or for tables, this produces a recursive ProcessTable
    854956 *         call.
    855957 *         Preconditions: none.
    856958 *
    857  *      -- PROCESS_CALC_POSITIONS: position of each column
     959 *      -- PROCESS_4_CALC_POSITIONS: position of each column
    858960 *         is taken from *plX, which is increased by the
    859961 *         column width by this call.
     
    865967 *         size here.
    866968 *
    867  *      -- PROCESS_CREATE_CONTROLS: well, creates the controls.
     969 *      -- PROCESS_5_CREATE_CONTROLS: well, creates the controls.
    868970 *
    869971 *         For tables, this recurses again. If the table has
     
    878980                     PROWDEF pOwningRow,          // in: current row from ProcessRow
    879981                     PROCESSMODE ProcessMode,     // in: processing mode (see ProcessAll)
    880                      PLONG plX,                   // in/out: PROCESS_CALC_POSITIONS only
     982                     PLONG plX,                   // in/out: PROCESS_4_CALC_POSITIONS only
    881983                     PDLGPRIVATE pDlgData)
    882984{
     
    888990    {
    889991        /*
    890          * PROCESS_CALC_SIZES:
     992         * PROCESS_1_CALC_SIZES:
    891993         *      step 1.
    892994         */
    893995
    894         case PROCESS_CALC_SIZES:
     996        case PROCESS_1_CALC_SIZES:
    895997            arc = ColumnCalcSizes(pColumnDef,
     998                                  ProcessMode,
    896999                                  pDlgData);
    8971000        break;
    8981001
    8991002        /*
    900          * PROCESS_CALC_POSITIONS:
    901          *      step 2.
     1003         * PROCESS_2_CALC_SIZES_FROM_TABLES:
     1004         *
    9021005         */
    9031006
    904         case PROCESS_CALC_POSITIONS:
     1007        case PROCESS_2_CALC_SIZES_FROM_TABLES:
     1008            if (pColumnDef->fIsNestedTable)
     1009            {
     1010                PTABLEDEF pTableDef = (PTABLEDEF)pColumnDef->pvDefinition;
     1011                if (!(arc = ProcessTable(pTableDef,
     1012                                         NULL,
     1013                                         PROCESS_2_CALC_SIZES_FROM_TABLES,
     1014                                         pDlgData)))
     1015                    ;
     1016            }
     1017            else
     1018            {
     1019                // no nested table, but control:
     1020                PCONTROLDEF pControlDef = (PCONTROLDEF)pColumnDef->pvDefinition;
     1021
     1022                if (    (pControlDef->szlControlProposed.cx < -1)
     1023                     && (pControlDef->szlControlProposed.cx >= -100)
     1024                   )
     1025                {
     1026                    // other negative CX value:
     1027                    // this we ignored during PROCESS_1_CALC_SIZES
     1028                    // (see ColumnCalcSizes); now set it to the
     1029                    // table width!
     1030                    ULONG cxThis = pOwningRow->pOwningTable->cpTable.cx
     1031                                    * -pControlDef->szlControlProposed.cx / 100;
     1032
     1033                    // but the table already has spacing applied,
     1034                    // so reduce that
     1035                    pColumnDef->cpControl.cx = cxThis
     1036                                            - (2 * pControlDef->ulSpacing);
     1037
     1038                    pColumnDef->cpColumn.cx = cxThis;
     1039
     1040                    // now we might have to re-compute auto-size
     1041                    if (pControlDef->szlControlProposed.cy == -1)
     1042                    {
     1043                        SIZEL   szlAuto;
     1044                        if (!(arc = CalcAutoSize(pControlDef,
     1045                                                 // now that we now the width,
     1046                                                 // use that!
     1047                                                 pColumnDef->cpControl.cx,
     1048                                                 &szlAuto,
     1049                                                 pDlgData)))
     1050                        {
     1051                            LONG cyColumnOld = pColumnDef->cpColumn.cy;
     1052                            LONG lDelta;
     1053                            PROWDEF pRowThis;
     1054
     1055                            pColumnDef->cpControl.cy = szlAuto.cy;
     1056                            pColumnDef->cpColumn.cy = szlAuto.cy
     1057                                        + (2 * pControlDef->ulSpacing);
     1058                        }
     1059                    }
     1060                }
     1061
     1062                if (    (pControlDef->szlControlProposed.cy < -1)
     1063                     && (pControlDef->szlControlProposed.cy >= -100)
     1064                   )
     1065                {
     1066                    // same thing for CY, but this time we
     1067                    // take the row height
     1068                    ULONG cyThis = pOwningRow->cpRow.cy
     1069                                    * -pControlDef->szlControlProposed.cy / 100;
     1070
     1071                    // but the table already has spacing applied,
     1072                    // so reduce that
     1073                    pColumnDef->cpControl.cy = cyThis
     1074                                            - (2 * pControlDef->ulSpacing);
     1075
     1076                    pColumnDef->cpColumn.cy = cyThis;
     1077                }
     1078            }
     1079        break;
     1080
     1081        /*
     1082         * PROCESS_3_CALC_FINAL_TABLE_SIZES:
     1083         *
     1084         */
     1085
     1086        case PROCESS_3_CALC_FINAL_TABLE_SIZES:
     1087            // re-run calc sizes since we now know all
     1088            // the auto-size items
     1089            arc = ColumnCalcSizes(pColumnDef,
     1090                                  ProcessMode,
     1091                                  pDlgData);
     1092        break;
     1093
     1094        /*
     1095         * PROCESS_4_CALC_POSITIONS:
     1096         *      step 4.
     1097         */
     1098
     1099        case PROCESS_4_CALC_POSITIONS:
    9051100            arc = ColumnCalcPositions(pColumnDef,
    9061101                                      pOwningRow,
     
    9101105
    9111106        /*
    912          * PROCESS_CREATE_CONTROLS:
    913          *      step 3.
     1107         * PROCESS_5_CREATE_CONTROLS:
     1108         *      step 5.
    9141109         */
    9151110
    916         case PROCESS_CREATE_CONTROLS:
     1111        case PROCESS_5_CREATE_CONTROLS:
    9171112            arc = ColumnCreateControls(pColumnDef,
    9181113                                       pDlgData);
     
    9441139    pRowDef->pOwningTable = pOwningTable;
    9451140
    946     if (ProcessMode == PROCESS_CALC_SIZES)
     1141    if (    (ProcessMode == PROCESS_1_CALC_SIZES)
     1142         || (ProcessMode == PROCESS_3_CALC_FINAL_TABLE_SIZES)
     1143       )
    9471144    {
    9481145        pRowDef->cpRow.cx = 0;
    9491146        pRowDef->cpRow.cy = 0;
    9501147    }
    951     else if (ProcessMode == PROCESS_CALC_POSITIONS)
     1148    else if (ProcessMode == PROCESS_4_CALC_POSITIONS)
    9521149    {
    9531150        // set up x and y so that the columns can
     
    9691166        if (!(arc = ProcessColumn(pColumnDefThis, pRowDef, ProcessMode, &lX, pDlgData)))
    9701167        {
    971             if (ProcessMode == PROCESS_CALC_SIZES)
     1168            if (    (ProcessMode == PROCESS_1_CALC_SIZES)
     1169                 || (ProcessMode == PROCESS_3_CALC_FINAL_TABLE_SIZES)
     1170               )
    9721171            {
    9731172                // row width = sum of all columns
     
    9971196 *      nested table is found in a COLUMNDEF.
    9981197 *
    999  *      With PROCESS_CALC_POSITIONS, pptl must specify
     1198 *      With PROCESS_4_CALC_POSITIONS, pptl must specify
    10001199 *      the lower left corner of the table. For the
    10011200 *      root call, this will be {0, 0}; for nested calls,
     
    10061205
    10071206APIRET ProcessTable(PTABLEDEF pTableDef,
    1008                     const CONTROLPOS *pcpTable,       // in: table position with PROCESS_CALC_POSITIONS
     1207                    const CONTROLPOS *pcpTable,       // in: table position with PROCESS_4_CALC_POSITIONS
    10091208                    PROCESSMODE ProcessMode,          // in: processing mode (see ProcessAll)
    10101209                    PDLGPRIVATE pDlgData)
     
    10141213    PLISTNODE pNode;
    10151214
    1016     if (ProcessMode == PROCESS_CALC_SIZES)
    1017     {
    1018         pTableDef->cpTable.cx = 0;
    1019         pTableDef->cpTable.cy = 0;
    1020     }
    1021     else if (ProcessMode == PROCESS_CALC_POSITIONS)
    1022     {
    1023         pTableDef->cpTable.x = pcpTable->x;
    1024         pTableDef->cpTable.y = pcpTable->y;
    1025 
    1026         // start the rows on top
    1027         lY = pcpTable->y + pTableDef->cpTable.cy;
     1215    switch (ProcessMode)
     1216    {
     1217        case PROCESS_1_CALC_SIZES:
     1218        case PROCESS_3_CALC_FINAL_TABLE_SIZES:
     1219            pTableDef->cpTable.cx = 0;
     1220            pTableDef->cpTable.cy = 0;
     1221        break;
     1222
     1223        case PROCESS_4_CALC_POSITIONS:
     1224            pTableDef->cpTable.x = pcpTable->x;
     1225            pTableDef->cpTable.y = pcpTable->y;
     1226
     1227            // start the rows on top
     1228            lY = pcpTable->y + pTableDef->cpTable.cy;
     1229        break;
    10281230    }
    10291231
     
    10341236        if (!(arc = ProcessRow(pRowDefThis, pTableDef, ProcessMode, &lY, pDlgData)))
    10351237        {
    1036             if (ProcessMode == PROCESS_CALC_SIZES)
     1238            if (    (ProcessMode == PROCESS_1_CALC_SIZES)
     1239                 || (ProcessMode == PROCESS_3_CALC_FINAL_TABLE_SIZES)
     1240               )
    10371241            {
    10381242                // table width = maximum width of a row
     
    10641268 *      following for each call (in this order):
    10651269 *
    1066  *      -- PROCESS_CALC_SIZES: calculates the sizes
    1067  *         of all tables, rows, columns, and controls.
    1068  *
    1069  *         After this first call, we know all the sizes
    1070  *         only and can then calculate the positions.
    1071  *
    1072  *      -- PROCESS_CALC_POSITIONS: calculates the positions
    1073  *         based on the sizes calculated before.
    1074  *
    1075  *      -- PROCESS_CREATE_CONTROLS: creates the controls with the
    1076  *         positions and sizes calculated before.
     1270 *      --  PROCESS_1_CALC_SIZES: calculates the preliminary
     1271 *          sizes of all tables, rows, columns, and controls
     1272 *          except those controls that have specified that
     1273 *          their size should depend on others.
     1274 *
     1275 *      --  PROCESS_2_CALC_SIZES_FROM_TABLES: calculates the
     1276 *          sizes of those controls that want to depend on
     1277 *          others.
     1278 *
     1279 *      --  PROCESS_3_CALC_FINAL_TABLE_SIZES: since the table
     1280 *          and row sizes might have changed during
     1281 *          PROCESS_2_CALC_SIZES_FROM_TABLES, we need to re-run
     1282 *          to re-calculate the size of all rows and tables.
     1283 *          After this first call, we know _all_ the sizes
     1284 *          and can then calculate the positions.
     1285 *
     1286 *      --  PROCESS_4_CALC_POSITIONS: calculates the positions
     1287 *          based on the sizes calculated before.
     1288 *
     1289 *      --  PROCESS_5_CREATE_CONTROLS: creates the controls with the
     1290 *          positions and sizes calculated before.
    10771291 *
    10781292 *      The second trick is the precondition that tables may
     
    10841298
    10851299APIRET ProcessAll(PDLGPRIVATE pDlgData,
    1086                   PSIZEL pszlClient,
    10871300                  PROCESSMODE ProcessMode)
    10881301{
     
    10941307    switch (ProcessMode)
    10951308    {
    1096         case PROCESS_CALC_SIZES:
    1097             pszlClient->cx = 0;
    1098             pszlClient->cy = 0;
     1309        case PROCESS_1_CALC_SIZES:
     1310        case PROCESS_3_CALC_FINAL_TABLE_SIZES:
     1311            pDlgData->szlClient.cx = 0;
     1312            pDlgData->szlClient.cy = 0;
    10991313        break;
    11001314
    1101         case PROCESS_CALC_POSITIONS:
     1315        case PROCESS_4_CALC_POSITIONS:
    11021316            // start with the table on top
    1103             cpTable.y = pszlClient->cy;
     1317            cpTable.y = pDlgData->szlClient.cy;
    11041318        break;
    11051319    }
     
    11091323        PTABLEDEF pTableDefThis = (PTABLEDEF)pNode->pItemData;
    11101324
    1111         if (ProcessMode == PROCESS_CALC_POSITIONS)
     1325        if (ProcessMode == PROCESS_4_CALC_POSITIONS)
    11121326        {
    11131327            cpTable.x = 0;
     
    11201334                                 pDlgData)))
    11211335        {
    1122             if (ProcessMode == PROCESS_CALC_SIZES)
     1336            if (    (ProcessMode == PROCESS_2_CALC_SIZES_FROM_TABLES)
     1337                 || (ProcessMode == PROCESS_3_CALC_FINAL_TABLE_SIZES)
     1338               )
    11231339            {
    11241340                // all sizes have now been computed:
    1125                 pszlClient->cx += pTableDefThis->cpTable.cx;
    1126                 pszlClient->cy += pTableDefThis->cpTable.cy;
     1341                pDlgData->szlClient.cx += pTableDefThis->cpTable.cx;
     1342                pDlgData->szlClient.cy += pTableDefThis->cpTable.cy;
    11271343            }
    11281344        }
     
    13351551                                                 pCurrentTable,
    13361552                                                 &pColumnDef)))
     1553                        {
     1554                            pCurrentTable->pOwningColumn = pColumnDef;
    13371555                            lstAppendItem(&pCurrentRow->llColumns,
    13381556                                          pColumnDef);
     1557                        }
    13391558                    }
    13401559                }
     
    14271646 *@@ Dlg2_CalcSizes:
    14281647 *
     1648 *      After this, DLGPRIVATE.szlClient is valid.
     1649 *
    14291650 *@@added V0.9.15 (2001-08-26) [umoeller]
    14301651 */
    14311652
    1432 APIRET Dlg2_CalcSizes(PDLGPRIVATE pDlgData,
    1433                       PSIZEL pszlClient)          // out: dialog's client size
    1434 {
    1435     APIRET arc = ProcessAll(pDlgData,
    1436                             pszlClient,
    1437                             PROCESS_CALC_SIZES);
     1653APIRET Dlg2_CalcSizes(PDLGPRIVATE pDlgData)
     1654{
     1655    APIRET arc;
     1656
     1657    if (!(arc = ProcessAll(pDlgData,
     1658                           PROCESS_1_CALC_SIZES)))
    14381659                     // this goes into major recursions...
     1660        // run again to compute sizes that depend on tables
     1661        if (!(arc = ProcessAll(pDlgData,
     1662                               PROCESS_2_CALC_SIZES_FROM_TABLES)))
     1663            arc = ProcessAll(pDlgData,
     1664                             PROCESS_3_CALC_FINAL_TABLE_SIZES);
    14391665
    14401666    // free the cached font resources that
     
    14611687
    14621688APIRET Dlg3_PositionAndCreate(PDLGPRIVATE pDlgData,
    1463                               PSIZEL pszlClient,          // in: dialog's client size
    14641689                              HWND *phwndFocusItem)       // out: item to give focus to
    14651690{
     
    14721697
    14731698    ProcessAll(pDlgData,
    1474                pszlClient,
    1475                PROCESS_CALC_POSITIONS);
     1699               PROCESS_4_CALC_POSITIONS);
    14761700
    14771701    /*
     
    14851709
    14861710    ProcessAll(pDlgData,
    1487                pszlClient,
    1488                PROCESS_CREATE_CONTROLS);
     1711               PROCESS_5_CREATE_CONTROLS);
    14891712
    14901713    if (pDlgData->hwndDefPushbutton)
     
    15641787 *      automatically here. Even better, for many controls,
    15651788 *      auto-sizing is supported according to the control's
    1566  *      text (e.g. for statics and checkboxes).
     1789 *      text (e.g. for statics and checkboxes). In a way,
     1790 *      this is a bit similar to HTML tables.
    15671791 *
    15681792 *      A regular standard dialog would use something like
     
    16001824 *      in some table. Tables may also nest (see below).
    16011825 *
    1602  *      The macros are:
     1826 *      The DLGHITEM macros are:
    16031827 *
    16041828 *      --  START_TABLE starts a new table. The tables may nest,
     
    16531877 *          always be a START_ROW first.
    16541878 *
     1879 *      While it is possible to set up the CONTROLDEFs manually
     1880 *      as static structures, I recommend using the bunch of
     1881 *      other macros that were defined in dialog.h for this.
     1882 *      For example, you can use CONTROLDEF_PUSHBUTTON to create
     1883 *      a push button, and many more.
     1884 *
    16551885 *      To create a dialog, set up arrays like the following:
    16561886 *
    16571887 +          // control definitions referenced by DlgTemplate:
    16581888 +          CONTROLDEF
    1659  +      (1)             GroupDef = {
    1660  +                                  WC_STATIC, "", ....,
    1661  +                                  { 0, 0 },       // size, ignored for groups
    1662  +                                  5               // spacing
    1663  +                               },
    1664  +      (2)             CnrDef = {
    1665  +                                  WC_CONTAINER, "", ....,
    1666  +                                  { 50, 50 },     // size
    1667  +                                  5               // spacing
    1668  +                               },
    1669  +      (3)             Static = {
    1670  +                                  WC_STATIC, "Static below cnr", ...,
    1671  +                                  { SZL_AUTOSIZE, SZL_AUTOSIZE },     // size
    1672  +                                  5               // spacing
    1673  +                               },
    1674  +      (4)             OKButton = {
    1675  +                                  WC_STATIC, "~OK", ...,
    1676  +                                  { 100, 30 },    // size
    1677  +                                  5               // spacing
    1678  +                               },
    1679  +      (5)             CancelButton = {
    1680  +                                  WC_STATIC, "~Cancel", ...,
    1681  +                                  { 100, 30 },    // size
    1682  +                                  5               // spacing
    1683  +                               };
     1889 +      (1)             GroupDef = CONTROLDEF_GROUP("Group",
     1890 +                                                  -1,     // ID
     1891 +                                                  SZL_AUTOSIZE,
     1892 +                                                  SZL_AUTOSIZE),
     1893 +      (2)             CnrDef = CONTROLDEF_CONTAINER(-1,   // ID,
     1894 +                                                  50,
     1895 +                                                  50),
     1896 +      (3)             Static = CONTROLDEF_TEXT("Static below cnr",
     1897 +                                                  -1,     // ID
     1898 +                                                  SZL_AUTOSIZE,
     1899 +                                                  SZL_AUTOSIZE),
     1900 +      (4)             OKButton = CONTROLDEF_DEFPUSHBUTTON("~OK",
     1901 +                                                  DID_OK,
     1902 +                                                  SZL_AUTOSIZE,
     1903 +                                                  SZL_AUTOSIZE),
     1904 +      (5)             CancelButton = CONTROLDEF_PUSHBUTTON("~Cancel",
     1905 +                                                  DID_CANCEL,
     1906 +                                                  SZL_AUTOSIZE,
     1907 +                                                  SZL_AUTOSIZE);
    16841908 +
    16851909 +          DLGHITEM DlgTemplate[] =
     
    17231947 +          ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŒ
    17241948 *
    1725  *      <B>Errors:</B>
    1726  *
    1727  *      This does not return a HWND, but an APIRET. This will be
    1728  *      one of the following:
    1729  *
    1730  *      --  NO_ERROR: only in that case, the phwndDlg ptr
    1731  *          receives the HWND of the new dialog, which can
    1732  *          then be given to WinProcessDlg. Don't forget
    1733  *          WinDestroyWindow.
    1734  *
    1735  *      --  ERROR_NOT_ENOUGH_MEMORY
    1736  *
    1737  *      --  DLGERR_ROW_BEFORE_TABLE: a row definition appeared
    1738  *          outside a table definition.
    1739  *
    1740  *      --  DLGERR_CONTROL_BEFORE_ROW: a control definition
    1741  *          appeared right after a table definition. You must
    1742  *          specify a row first.
    1743  *
    1744  *      --  DLGERR_NULL_CTL_DEF: TYPE_END_TABLE was specified,
    1745  *          but the CONTROLDEF ptr was NULL.
    1746  *
    1747  *      --  DLGERR_CANNOT_CREATE_FRAME: unable to create the
    1748  *          WC_FRAME window. Maybe an invalid owner was specified.
    1749  *
    1750  *      --  DLGERR_INVALID_CODE: invalid "Type" field in
    1751  *          DLGHITEM.
    1752  *
    1753  *      --  DLGERR_TABLE_NOT_CLOSED, DLGERR_TOO_MANY_TABLES_CLOSED:
    1754  *          improper nesting of TYPE_START_NEW_TABLE and
    1755  *          TYPE_END_TABLE fields.
    1756  *
    17571949 *      <B>Example:</B>
    17581950 *
     
    17621954 +          if (NO_ERROR == dlghCreateDlg(&hwndDlg,
    17631955 +                                        hwndOwner,
    1764  +                                        FCF_DLGBORDER | FCF_NOBYTEALIGN,
     1956 +                                        FCF_TITLEBAR | FCF_SYSMENU
     1957 +                                           | FCF_DLGBORDER | FCF_NOBYTEALIGN,
    17651958 +                                        fnwpMyDlgProc,
    17661959 +                                        "My Dlg Title",
     
    17731966 +              WinDestroyWindow(hwndDlg);
    17741967 +          }
     1968 *
     1969 *      <B>Errors:</B>
     1970 *
     1971 *      This does not return a HWND, but an APIRET. This will be
     1972 *      one of the following:
     1973 *
     1974 *      --  NO_ERROR: only in that case, the phwndDlg ptr
     1975 *          receives the HWND of the new dialog, which can
     1976 *          then be given to WinProcessDlg. Don't forget
     1977 *          WinDestroyWindow.
     1978 *
     1979 *      --  ERROR_NOT_ENOUGH_MEMORY
     1980 *
     1981 *      --  DLGERR_ROW_BEFORE_TABLE: a row definition appeared
     1982 *          outside a table definition.
     1983 *
     1984 *      --  DLGERR_CONTROL_BEFORE_ROW: a control definition
     1985 *          appeared right after a table definition. You must
     1986 *          specify a row first.
     1987 *
     1988 *      --  DLGERR_NULL_CTL_DEF: TYPE_END_TABLE was specified,
     1989 *          but the CONTROLDEF ptr was NULL.
     1990 *
     1991 *      --  DLGERR_CANNOT_CREATE_FRAME: unable to create the
     1992 *          WC_FRAME window. Maybe an invalid owner was specified.
     1993 *
     1994 *      --  DLGERR_INVALID_CODE: invalid "Type" field in
     1995 *          DLGHITEM.
     1996 *
     1997 *      --  DLGERR_TABLE_NOT_CLOSED, DLGERR_TOO_MANY_TABLES_CLOSED:
     1998 *          improper nesting of TYPE_START_NEW_TABLE and
     1999 *          TYPE_END_TABLE fields.
     2000 *
     2001 *      --  DLGERR_CANNOT_CREATE_CONTROL: creation of some
     2002 *          sub-control failed. Maybe an invalid window class
     2003 *          was specified.
     2004 *
     2005 *      --  DLGERR_INVALID_CONTROL_TITLE: bad window title in
     2006 *          control.
     2007 *
     2008 *      --  DLGERR_INVALID_STATIC_BITMAP: static bitmap contains
     2009 *          an invalid bitmap handle.
    17752010 *
    17762011 *@@changed V0.9.14 (2001-07-07) [umoeller]: fixed disabled mouse with hwndOwner == HWND_DESKTOP
     
    18602095                HWND    hwndDlg = pDlgData->hwndDlg;
    18612096                HWND    hwndFocusItem = NULLHANDLE;
    1862                 SIZEL   szlClient = {0};
    18632097                RECTL   rclClient;
    18642098
     
    18682102                 */
    18692103
    1870                 if (!(arc = Dlg2_CalcSizes(pDlgData,
    1871                                            &szlClient)))
     2104                if (!(arc = Dlg2_CalcSizes(pDlgData)))
    18722105                {
    18732106                    WinSubclassWindow(hwndDlg, pfnwpDialogProc);
     
    18812114                    rclClient.xLeft = 10;
    18822115                    rclClient.yBottom = 10;
    1883                     rclClient.xRight = szlClient.cx + 2 * SPACING;
    1884                     rclClient.yTop = szlClient.cy + 2 * SPACING;
     2116                    rclClient.xRight = pDlgData->szlClient.cx + 2 * SPACING;
     2117                    rclClient.yTop = pDlgData->szlClient.cy + 2 * SPACING;
    18852118                    WinCalcFrameRect(hwndDlg,
    18862119                                     &rclClient,
     
    18962129
    18972130                    arc = Dlg3_PositionAndCreate(pDlgData,
    1898                                                  &szlClient,
    18992131                                                 &hwndFocusItem);
    19002132
     
    20212253             */
    20222254
    2023             Dlg2_CalcSizes(pDlgData,
    2024                            &szlClient);
     2255            Dlg2_CalcSizes(pDlgData);
    20252256
    20262257            // WinSubclassWindow(hwndDlg, pfnwpDialogProc);
     
    20542285            {
    20552286                if (!(arc = Dlg3_PositionAndCreate(pDlgData,
    2056                                                    &szlClient,
    20572287                                                   &hwndFocusItem)))
    20582288                    WinSetFocus(HWND_DESKTOP, hwndFocusItem);
     
    23592589    ULONG flButtons = flFlags & 0xF;        // low nibble contains MB_YESNO etc.
    23602590
    2361     const char  *p0 = "Error",
    2362                 *p1 = NULL,
    2363                 *p2 = NULL;
     2591    PCSZ        p0 = "Error",
     2592                p1 = NULL,
     2593                p2 = NULL;
    23642594
    23652595    Icon.pcszText = (PCSZ)hptrIcon;
     
    26722902                            CTL_COMMON_FONT,
    26732903                            0,
    2674                             { 300, 20 },     // size
     2904                            { 300, SZL_AUTOSIZE },     // size
    26752905                            5               // spacing
    26762906                         },
  • trunk/src/helpers/dosh.c

    r135 r137  
    42424242}
    42434243
    4244 /* ******************************************************************
    4245  *
    4246  *   Testcase
    4247  *
    4248  ********************************************************************/
    4249 
    4250 #ifdef BUILD_MAIN
    4251 
    4252 int main (int argc, char *argv[])
    4253 {
    4254     ULONG ul;
    4255 
    4256             printf("Drive checker ("__DATE__")\n");
    4257             printf("    type   fs      remot fixed parrm bootd       media audio eas   longn\n");
    4258 
    4259     for (ul = 1;
    4260          ul <= 26;
    4261          ul++)
    4262     {
    4263         XDISKINFO xdi;
    4264         APIRET arc = doshGetDriveInfo(ul,
    4265                                       0, // DRVFL_TOUCHFLOPPIES,
    4266                                       &xdi);
    4267 
    4268         printf(" %c: ", xdi.cDriveLetter, ul);
    4269 
    4270         if (!xdi.fPresent)
    4271             printf("not present\n");
    4272         else
    4273         {
    4274             if (arc)
    4275                 printf("error %d (IsFixedDisk: %d, QueryDiskParams %d, QueryMedia %d)\n",
    4276                         arc,
    4277                         xdi.arcIsFixedDisk,
    4278                         xdi.arcQueryDiskParams,
    4279                         xdi.arcQueryMedia);
    4280             else
    4281             {
    4282                 ULONG   aulFlags[] =
    4283                     {
    4284                         DFL_REMOTE,
    4285                         DFL_FIXED,
    4286                         DFL_PARTITIONABLEREMOVEABLE,
    4287                         DFL_BOOTDRIVE,
    4288                         0,
    4289                         DFL_MEDIA_PRESENT,
    4290                         DFL_AUDIO_CD,
    4291                         DFL_SUPPORTS_EAS,
    4292                         DFL_SUPPORTS_LONGNAMES
    4293                     };
    4294                 ULONG ul2;
    4295 
    4296                 PCSZ pcsz = NULL;
    4297 
    4298                 switch (xdi.bType)
    4299                 {
    4300                     case DRVTYPE_HARDDISK:  pcsz = "HDISK ";    break;
    4301                     case DRVTYPE_FLOPPY:    pcsz = "FLOPPY"; break;
    4302                     case DRVTYPE_TAPE:      pcsz = "TAPE  "; break;
    4303                     case DRVTYPE_VDISK:     pcsz = "VDISK "; break;
    4304                     case DRVTYPE_CDROM:     pcsz = "CDROM "; break;
    4305                     case DRVTYPE_LAN:       pcsz = "LAN   "; break;
    4306                     case DRVTYPE_PARTITIONABLEREMOVEABLE:
    4307                                             pcsz = "PRTREM"; break;
    4308                     default:
    4309                                             printf("bType=%d, BPB.bDevType=%d",
    4310                                                     xdi.bType,
    4311                                                     xdi.bpb.bDeviceType);
    4312                                             printf("\n           ");
    4313                 }
    4314 
    4315                 if (pcsz)
    4316                     printf("%s ", pcsz);
    4317 
    4318                 if (xdi.lFileSystem < 0)
    4319                     // negative means error
    4320                     printf("E%3d    ", xdi.lFileSystem); // , xdi.bFileSystem);
    4321                 else
    4322                     printf("%7s ", xdi.szFileSystem); // , xdi.bFileSystem);
    4323 
    4324                 for (ul2 = 0;
    4325                      ul2 < ARRAYITEMCOUNT(aulFlags);
    4326                      ul2++)
    4327                 {
    4328                     if (xdi.flDevice & aulFlags[ul2])
    4329                         printf("  X   ");
    4330                     else
    4331                         if (    (xdi.arcOpenLongnames)
    4332                              && (aulFlags[ul2] == DFL_SUPPORTS_LONGNAMES)
    4333                            )
    4334                             printf(" E%03d ", xdi.arcOpenLongnames);
    4335                         else
    4336                             printf("  -   ");
    4337                 }
    4338                 printf("\n");
    4339             }
    4340         }
    4341     }
    4342 }
    4343 
    4344 #endif
     4244
  • trunk/src/helpers/helpers_pre.in

    r129 r137  
    7171$(OUTPUTDIR)\syssound.obj \
    7272$(OUTPUTDIR)\tmsgfile.obj \
     73$(OUTPUTDIR)\vcard.obj \
    7374$(OUTPUTDIR)\wphandle.obj \
    7475$(OUTPUTDIR)\xprf.obj \
  • trunk/src/helpers/makefile

    r75 r137  
    142142    @echo ----- Leaving $(MAKEDIR)
    143143
     144# "test" target: for test cases
     145TESTCASE_DIR = testcase
     146
     147TESTCASE_CC = icc /c /ti+ /w2 /ss /se /i$(HELPERS_BASE)\include /DDEBUG_DIALOG_WINDOWS /Fo$(TESTCASE_DIR)\$(@B).obj $(@B).c
     148
     149.c.{$(TESTCASE_DIR)}.obj:
     150    @echo $(MAKEDIR)\makefile: Compiling $(@B).c
     151    $(TESTCASE_CC)
     152
     153# testcase executables
     154TESTCASE_TARGETS = \
     155    dosh.exe \
     156    dialog.exe \
     157    vcard.exe \
     158
     159# dosh.exe
     160DOSH_TEST_OBJS = \
     161    $(TESTCASE_DIR)\dosh.obj \
     162    $(TESTCASE_DIR)\_test_dosh.obj
     163
     164dosh.exe: $(DOSH_TEST_OBJS)
     165    ilink /debug /optfunc /pmtype:vio $(DOSH_TEST_OBJS) /o:$@
     166
     167# dialog.exe
     168DIALOG_TEST_OBJS = \
     169    $(TESTCASE_DIR)\dialog.obj \
     170    $(TESTCASE_DIR)\_test_dialog.obj \
     171    $(TESTCASE_DIR)\winh.obj \
     172    $(TESTCASE_DIR)\xstring.obj \
     173    $(TESTCASE_DIR)\linklist.obj \
     174    $(TESTCASE_DIR)\comctl.obj \
     175    $(TESTCASE_DIR)\stringh.obj \
     176    $(TESTCASE_DIR)\dosh.obj \
     177    $(TESTCASE_DIR)\gpih.obj
     178
     179dialog.exe: $(DIALOG_TEST_OBJS)
     180    ilink /debug /optfunc /pmtype:pm $(DIALOG_TEST_OBJS) /o:$@
     181
     182# vcard.exe
     183VCARD_TEST_OBJS = \
     184    $(TESTCASE_DIR)\vcard.obj \
     185    $(TESTCASE_DIR)\_test_vcard.obj \
     186    $(TESTCASE_DIR)\xstring.obj \
     187    $(TESTCASE_DIR)\stringh.obj \
     188    $(TESTCASE_DIR)\linklist.obj \
     189    $(TESTCASE_DIR)\dosh.obj \
     190    $(TESTCASE_DIR)\prfh.obj \
     191    $(TESTCASE_DIR)\nls.obj
     192
     193vcard.exe: $(VCARD_TEST_OBJS)
     194    ilink /debug /pmtype:vio $(VCARD_TEST_OBJS) /o:$@
     195
     196test: $(TESTCASE_TARGETS)
     197
    144198# Define the main dependency between the output HELPERS.LIB and
    145199# all the object files.
  • trunk/src/helpers/textview.c

    r91 r137  
    808808
    809809        case 6:     // A or /A HREF= (link)
    810         {
    811810            // four characters with hex anchor index (>=1)
    812811            // or "####"
     
    825824
    826825            ulSkip = 6;
    827         break; }
     826        break;
    828827
    829828        case 7:     // A NAME= (anchor name)
     
    834833            // only used with TXM_JUMPTOANCHORNAME, which then
    835834            // searches the buffer
    836             PSZ pEnd = strchr((*ppCurrent)+2, 0xFF);
    837             if (pEnd)
     835            PSZ pEnd;
     836            if (pEnd = strchr((*ppCurrent)+2, 0xFF))
    838837            {
    839838                ulSkip = pEnd - *ppCurrent + 1;
     
    844843                fPaintEscapeWord = TRUE;
    845844            }
    846         break; }
     845        }
     846        break;
    847847
    848848        case 0x10:  // relative point size in percent
     
    11551155                    }
    11561156
    1157                     pWord = txvCreateWord(hps,
    1158                                           &pCurrent, // advanced to next word
    1159                                           &flbuf);
    1160                     if (pWord)
     1157                    if (pWord = txvCreateWord(hps,
     1158                                              &pCurrent, // advanced to next word
     1159                                              &flbuf))
    11611160                    {
    11621161                        lstAppendItem(&pxfd->llWords, pWord);
     
    22792278
    22802279            // allocate TEXTVIEWWINDATA for QWL_USER
    2281             ptxvd = (PTEXTVIEWWINDATA)malloc(sizeof(TEXTVIEWWINDATA));
    2282             if (ptxvd)
     2280            if (ptxvd = (PTEXTVIEWWINDATA)malloc(sizeof(TEXTVIEWWINDATA)))
    22832281            {
    22842282                SIZEL   szlPage = {0, 0};
     
    23802378                mrc = (MPARAM)FALSE;        // OK
    23812379            }
    2382         break; }
     2380        }
     2381        break;
    23832382
    23842383        /*
     
    23922391        case WM_SETWINDOWPARAMS:
    23932392        {
    2394             WNDPARAMS *pwndParams = (WNDPARAMS *)mp1;
    2395             if (pwndParams)
     2393            WNDPARAMS *pwndParams;
     2394            if (pwndParams = (WNDPARAMS *)mp1)
    23962395            {
    23972396                if (pwndParams->fsStatus & WPM_TEXT)
     
    24122411                }
    24132412            }
    2414         break; }
     2413        }
     2414        break;
    24152415
    24162416        /*
     
    24422442                }
    24432443            }
    2444         break; }
     2444        }
     2445        break;
    24452446
    24462447        /*
     
    25382539
    25392540            // WinEndPaint(hps);
    2540         break; }
     2541        }
     2542        break;
    25412543
    25422544        /*
     
    25772579
    25782580        case WM_VSCROLL:
    2579         {
    25802581            if (ptxvd->fVScrollVisible)
    25812582            {
     
    25892590                                    mp2);
    25902591            }
    2591         break; }
     2592        break;
    25922593
    25932594        /*
     
    25972598
    25982599        case WM_HSCROLL:
    2599         {
    26002600            if (ptxvd->fHScrollVisible)
    26012601            {
     
    26092609                                    mp2);
    26102610            }
    2611         break; }
     2611        break;
    26122612
    26132613        /*
     
    26242624                           (mp2 != 0));
    26252625            WinReleasePS(hps);
    2626         break; }
     2626        }
     2627        break;
    26272628
    26282629        /*
     
    26332634        case WM_MOUSEMOVE:
    26342635        {
    2635             HWND    hwndOwner = WinQueryWindow(hwndTextView, QW_OWNER);
    2636             if (hwndOwner)
     2636            HWND    hwndOwner;
     2637            if (hwndOwner = WinQueryWindow(hwndTextView, QW_OWNER))
    26372638            {
    26382639                HPOINTER hptrSet
     
    26462647                WinSetPointer(HWND_DESKTOP, hptrSet);
    26472648            }
    2648         break; }
     2649        }
     2650        break;
    26492651
    26502652        /*
     
    26562658        {
    26572659            POINTL ptlPos;
    2658             PLISTNODE pWordNodeClicked = NULL;
     2660            PLISTNODE pWordNodeClicked;
    26592661
    26602662            ptlPos.x = SHORT1FROMMP(mp1) + ptxvd->ulViewXOfs;
     
    26662668            ptxvd->usLastAnchorClicked = 0;
    26672669
    2668             pWordNodeClicked = txvFindWordFromPoint(&ptxvd->xfd,
    2669                                                     &ptlPos);
    2670 
    2671             if (pWordNodeClicked)
     2670            if (pWordNodeClicked = txvFindWordFromPoint(&ptxvd->xfd,
     2671                                                        &ptlPos))
    26722672            {
    26732673                PTXVWORD pWordClicked = (PTXVWORD)pWordNodeClicked->pItemData;
     
    27092709            WinSetCapture(HWND_DESKTOP, hwndTextView);
    27102710            mrc = (MPARAM)TRUE;
    2711         break; }
     2711        }
     2712        break;
    27122713
    27132714        /*
     
    27322733
    27332734                // nofify owner
    2734                 hwndOwner = WinQueryWindow(hwndTextView, QW_OWNER);
    2735                 if (hwndOwner)
     2735                if (hwndOwner = WinQueryWindow(hwndTextView, QW_OWNER))
    27362736                    WinPostMsg(hwndOwner,
    27372737                               WM_CONTROL,
     
    27432743
    27442744            mrc = (MPARAM)TRUE;
    2745         break; }
     2745        }
     2746        break;
    27462747
    27472748        /*
     
    28562857            else
    28572858                mrc = (MPARAM)TRUE;
    2858         break; }
     2859        }
     2860        break;
    28592861
    28602862        /*
     
    28932895                mrc = (MPARAM)TRUE;
    28942896            }
    2895         break; }
     2897        }
     2898        break;
    28962899
    28972900        /*
     
    29422945                mrc = (MPARAM)TRUE;
    29432946            }
    2944         break; }
     2947        }
     2948        break;
    29452949
    29462950        /*
     
    29622966                                  FALSE,
    29632967                                  FALSE);       // quick format
    2964         break; }
     2968        }
     2969        break;
    29652970
    29662971        /*
     
    30203025
    30213026        case TXM_JUMPTOANCHORNAME:
    3022         {
    30233027            if (mp1)
    30243028            {
     
    30583062                }
    30593063            }
    3060         break; }
     3064        break;
    30613065
    30623066        /*
  • trunk/src/helpers/winh.c

    r135 r137  
    39493949 *      in WM_INITDLG of the notebook dlg function if the app
    39503950 *      has determined that it is running on Warp 4.
     3951 *
     3952 *@@changed V0.9.16 (2002-02-02) [umoeller]: fixed entry fields
    39513953 */
    39523954
     
    39933995                if (ulDownUnits)
    39943996                {
     3997                    CHAR szClass[10];
    39953998                    SWP swp;
    3996                     // _Pmpf(("Moving downwards %d pixels", ptl.y));
     3999                    LONG lDeltaX = 0,
     4000                         lDeltaY = 0;
     4001                    // special handling for entry fields
     4002                    // V0.9.16 (2002-02-02) [umoeller]
     4003                    WinQueryClassName(hwndItem, sizeof(szClass), szClass);
     4004                    if (!strcmp(szClass, "#6"))
     4005                    {
     4006                        lDeltaX = 3 * WinQuerySysValue(HWND_DESKTOP, SV_CXBORDER);
     4007                        lDeltaY = 3 * WinQuerySysValue(HWND_DESKTOP, SV_CYBORDER);
     4008                    }
     4009
    39974010                    WinQueryWindowPos(hwndItem, &swp);
    39984011                    WinSetWindowPos(hwndItem, 0,
    3999                                     swp.x,
    4000                                     swp.y - ptl.y,
     4012                                    swp.x + lDeltaX,
     4013                                    swp.y - ptl.y + lDeltaY,
    40014014                                    0, 0,
    40024015                                    SWP_MOVE);
  • trunk/src/helpers/xstring.c

    r132 r137  
    478478PXSTRING xstrCreate(ULONG ulPreAllocate)
    479479{
    480     PXSTRING pxstr = (PXSTRING)malloc(sizeof(XSTRING));
    481     if (pxstr)
     480    PXSTRING pxstr;
     481    if (pxstr = (PXSTRING)malloc(sizeof(XSTRING)))
    482482        xstrInit(pxstr, ulPreAllocate);
    483483
     
    14041404 *@@added V0.9.9 (2001-02-28) [umoeller]
    14051405 *@@changed V0.9.9 (2001-03-06) [lafaix]: removed memory allocation
    1406  */
    1407 
    1408 ULONG xstrDecode(PXSTRING pxstr)       // in/out: string to be decoded
     1406 *@@changed V0.9.16 (2002-02-02) [umoeller]: added cKey
     1407 */
     1408
     1409ULONG xstrDecode2(PXSTRING pxstr,       // in/out: string to be decoded
     1410                  CHAR cKey)            // in: encoding key (normally '%')
    14091411{
    14101412    ULONG   ulrc = 0;
     
    14231425            // pSource points to next char now
    14241426
    1425             if (c == '%')
     1427            if (c == cKey)
    14261428            {
    14271429                static char ach[] = "0123456789ABCDEF";
     
    14531455
    14541456            // not encoding, or null after '%', or invalid encoding:
    1455             // just copy this
     1457            // just leave thisalone
    14561458            *pDest++ = c;
    14571459        } // while ((ch = *pSource++))
     
    14651467
    14661468    return (ulrc);
     1469}
     1470
     1471/*
     1472 *@@ xstrDecode:
     1473 *      added for compatibility with exports.
     1474 *
     1475 *@@added V0.9.16 (2002-02-02) [umoeller]
     1476 */
     1477
     1478ULONG xstrDecode(PXSTRING pxstr)
     1479{
     1480    return (xstrDecode2(pxstr, '%'));
    14671481}
    14681482
Note: See TracChangeset for help on using the changeset viewer.