Changeset 95


Ignore:
Timestamp:
Aug 7, 2001, 11:34:30 PM (24 years ago)
Author:
umoeller
Message:

Lafaix and Ratcliffe updates.

Location:
trunk
Files:
5 edited

Legend:

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

    r85 r95  
    5050    #define DLGERR_TABLE_NOT_CLOSED             (DLGERR_FIRST + 5)
    5151    #define DLGERR_TOO_MANY_TABLES_CLOSED       (DLGERR_FIRST + 6)
     52    #define DLGERR_CANNOT_CREATE_CONTROL        (DLGERR_FIRST + 7)
    5253
    5354    /* ******************************************************************
     
    172173                // -- with TYPE_CONTROL_DEF: _CONTROLDEF pointer to a control definition
    173174    } DLGHITEM, *PDLGHITEM;
     175
     176    /* ******************************************************************
     177     *
     178     *   Macros
     179     *
     180     ********************************************************************/
     181
     182    #define CONTROLDEF_GROUP(pcsz, id) { WC_STATIC, pcsz, \
     183            WS_VISIBLE | SS_GROUPBOX | DT_MNEMONIC, \
     184            id, CTL_COMMON_FONT, 0, { -1, -1 }, 0 }
     185
     186    #define CONTROLDEF_TEXT(pcsz, id, cx, cy) { WC_STATIC, pcsz, \
     187            WS_VISIBLE | SS_TEXT | DT_LEFT | DT_VCENTER | DT_MNEMONIC, \
     188            id, CTL_COMMON_FONT,  0, {cx, cy}, 5 }
     189
     190    #define CONTROLDEF_DEFPUSHBUTTON(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
     191            WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON | BS_DEFAULT, \
     192            id, CTL_COMMON_FONT, 0, {cx, cy}, 5 }
     193
     194    #define CONTROLDEF_PUSHBUTTON(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
     195            WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON, \
     196            id, CTL_COMMON_FONT, 0, {cx, cy}, 5 }
     197
     198    #define CONTROLDEF_AUTOCHECKBOX(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
     199            WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX, \
     200            id, CTL_COMMON_FONT, 0, { cx, cy }, 5 }
     201
     202    #define CONTROLDEF_FIRST_AUTORADIO(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
     203            WS_VISIBLE | WS_TABSTOP | BS_AUTORADIOBUTTON | WS_GROUP, \
     204            id, CTL_COMMON_FONT, 0, { cx, cy }, 5 }
     205
     206    #define CONTROLDEF_NEXT_AUTORADIO(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
     207            WS_VISIBLE | WS_TABSTOP | BS_AUTORADIOBUTTON, \
     208            id, CTL_COMMON_FONT, 0, { cx, cy }, 5 }
     209
     210    #define CONTROLDEF_ENTRYFIELD(pcsz, id, cx, cy) { WC_ENTRYFIELD, pcsz, \
     211            WS_VISIBLE | WS_TABSTOP | ES_MARGIN, \
     212            id, CTL_COMMON_FONT, 0, { cx, cy }, 5 }
     213
     214    #define CONTROLDEF_SPINBUTTON(id, cx, cy) { WC_SPINBUTTON, NULL, \
     215            WS_VISIBLE | WS_TABSTOP | SPBS_MASTER | SPBS_NUMERICONLY | SPBS_JUSTCENTER | SPBS_FASTSPIN, \
     216            id, CTL_COMMON_FONT, 0, {cx, cy}, 5 }
    174217
    175218    /* ******************************************************************
  • trunk/src/helpers/apps.c

    r91 r95  
    570570 *@@added V0.9.9 (2001-03-07) [umoeller]
    571571 *@@changed V0.9.12 (2001-05-27) [umoeller]: moved from winh.c to apps.c
     572 *@@changed V0.9.14 (2001-08-07) [pr]: use FAPPTYP_* constants
    572573 */
    573574
     
    583584        if (_ulDosAppType == 0)
    584585            *pulWinAppType = PROG_FULLSCREEN;
    585         else if (_ulDosAppType & 0x40)
     586        else if (_ulDosAppType & FAPPTYP_PHYSDRV)       // 0x40
    586587            *pulWinAppType = PROG_PDD;
    587         else if (_ulDosAppType & 0x80)
     588        else if (_ulDosAppType & FAPPTYP_VIRTDRV)       // 0x80)
    588589            *pulWinAppType = PROG_VDD;
    589         else if ((_ulDosAppType & 0xF0) == 0x10)
     590        else if ((_ulDosAppType & 0xF0) == FAPPTYP_DLL) // 0x10)
    590591            // DLL bit set
    591592            *pulWinAppType = PROG_XWP_DLL;
    592         else if (_ulDosAppType & 0x20)
     593        else if (_ulDosAppType & FAPPTYP_DOS)           // 0x20)
    593594            // DOS bit set?
    594595            *pulWinAppType = PROG_WINDOWEDVDM;
    595         else if ((_ulDosAppType & 0x0003) == 0x0003) // "Window-API" == PM
     596        else if ((_ulDosAppType & FAPPTYP_WINDOWAPI) == FAPPTYP_WINDOWAPI) // 0x0003) // "Window-API" == PM
    596597            *pulWinAppType = PROG_PM;
    597         else if (   ((_ulDosAppType & 0xFFFF) == 0x1000) // windows program (?!?)
    598                  || ((_ulDosAppType & 0xFFFF) == 0x0400) // windows program (?!?)
     598        else if (   ((_ulDosAppType & 0xFFFF) == FAPPTYP_WINDOWSPROT31) // 0x1000) // windows program (?!?)
     599                 || ((_ulDosAppType & 0xFFFF) == FAPPTYP_WINDOWSPROT) // ) // windows program (?!?)
    599600                )
    600             *pulWinAppType = PROG_31_ENH;
     601            *pulWinAppType = PROG_31_ENHSEAMLESSCOMMON;  // PROG_31_ENH;
    601602            // *pulWinAppType = PROG_31_ENHSEAMLESSVDM;
    602         else if ((_ulDosAppType & 0x03) == 0x02)
     603        else if ((_ulDosAppType & FAPPTYP_WINDOWAPI /* 0x03 */ ) == FAPPTYP_WINDOWCOMPAT) // 0x02)
    603604            *pulWinAppType = PROG_WINDOWABLEVIO;
    604         else if ((_ulDosAppType & 0x03) == 0x01)
     605        else if ((_ulDosAppType & FAPPTYP_WINDOWAPI /* 0x03 */ ) == FAPPTYP_NOTWINDOWCOMPAT) // 0x01)
    605606            *pulWinAppType = PROG_FULLSCREEN;
    606607    }
     
    762763 *@@changed V0.9.12 (2001-05-26) [umoeller]: fixed PROG_DEFAULT
    763764 *@@changed V0.9.12 (2001-05-27) [umoeller]: moved from winh.c to apps.c
     765 *@@changed V0.9.14 (2001-08-07) [pr]: removed some env. strings for Win. apps.
    764766 */
    765767
     
    931933                                     "KBD_CTRL_BYPASS=CTRL_ESC",
    932934                                     FALSE);        // add last
     935                /*
     936                 * These should be set by the default environment. It is
     937                 * not our business to override them really. V0.9.14
     938                 *
    933939                appSetEnvironmentVar(&Env,
    934940                                     "KBD_ALTHOME_BYPASS=1",
     
    952958                                     "VIDEO_8514A_XGA_IOTRAP=0",
    953959                                     FALSE);        // add last
     960                 */
    954961
    955962                if (!appConvertEnvironment(&Env,
  • trunk/src/helpers/cctl_chart.c

    r91 r95  
    5050 *      against the sum of all values. In other words,
    5151 *
    52  +          (dValue / dTotal) == (sizeSlize / sizeTotal).
     52 +          (dValue / dTotal) == (sizeSlice / sizeTotal).
    5353 *
    5454 *      The display depends on whether the chart control operates in
     
    651651        //    specified with GpiPartialArc (while GpiFullArc
    652652        //    uses the current pen position...
    653         //    Who created these APIs?!? This might be a most
    654         //    flexible way to do things, but where's the
    655         //    simple stuff?!?)
     653        //    Who created these APIs?!?)
    656654        ap.lP = ptlCenter.x;        // X-axis X
    657655        ap.lS = 0;                  // X-axis Y
  • trunk/src/helpers/dialog.c

    r91 r95  
    218218#define PM_GROUP_SPACING_TOP        20
    219219
    220 VOID ProcessTable(PTABLEDEF pTableDef,
    221                   const CONTROLPOS *pcpTable,
    222                   PROCESSMODE ProcessMode,
    223                   PDLGPRIVATE pDlgData);
     220APIRET ProcessTable(PTABLEDEF pTableDef,
     221                    const CONTROLPOS *pcpTable,
     222                    PROCESSMODE ProcessMode,
     223                    PDLGPRIVATE pDlgData);
    224224
    225225/*
     
    436436 */
    437437
    438 VOID ProcessColumn(PCOLUMNDEF pColumnDef,
    439                    PROWDEF pOwningRow,          // in: current row from ProcessRow
    440                    PROCESSMODE ProcessMode,     // in: processing mode (see ProcessAll)
    441                    PLONG plX,                   // in/out: PROCESS_CALC_POSITIONS only
    442                    PDLGPRIVATE pDlgData)
    443 {
     438APIRET ProcessColumn(PCOLUMNDEF pColumnDef,
     439                     PROWDEF pOwningRow,          // in: current row from ProcessRow
     440                     PROCESSMODE ProcessMode,     // in: processing mode (see ProcessAll)
     441                     PLONG plX,                   // in/out: PROCESS_CALC_POSITIONS only
     442                     PDLGPRIVATE pDlgData)
     443{
     444    APIRET arc = NO_ERROR;
     445
    444446    pColumnDef->pOwningRow = pOwningRow;
    445447
     
    604606
    605607                // recurse!!
    606                 ProcessTable(pTableDef,
    607                              NULL,
    608                              ProcessMode,
    609                              pDlgData);
    610 
    611                 // should we create a PM control around the table?
    612                 // (do this AFTER the other controls from recursing,
    613                 // otherwise the stupid container doesn't show up)
    614                 if (pTableDef->pCtlDef)
     608                if (!(arc = ProcessTable(pTableDef,
     609                                         NULL,
     610                                         ProcessMode,
     611                                         pDlgData)))
    615612                {
    616                     // yes:
    617                     pcp  = &pColumnDef->cpColumn;  // !! not control
    618                     pControlDef = pTableDef->pCtlDef;
    619                     pcszTitle = pControlDef->pcszText;
    620                     flStyle = pControlDef->flStyle;
     613                    // should we create a PM control around the table?
     614                    // (do this AFTER the other controls from recursing,
     615                    // otherwise the stupid container doesn't show up)
     616                    if (pTableDef->pCtlDef)
     617                    {
     618                        // yes:
     619                        pcp  = &pColumnDef->cpColumn;  // !! not control
     620                        pControlDef = pTableDef->pCtlDef;
     621                        pcszTitle = pControlDef->pcszText;
     622                        flStyle = pControlDef->flStyle;
     623                    }
    621624                }
     625                else
     626                    break;
    622627            }
    623628            else
     
    662667                                       (PVOID)pcszFont); */
    663668
    664                 pColumnDef->hwndControl
     669                if (pColumnDef->hwndControl
    665670                    = WinCreateWindow(pDlgData->hwndDlg,   // parent
    666671                                      (PSZ)pControlDef->pcszClass,
     
    677682                                      pControlDef->usID,
    678683                                      pControlDef->pvCtlData,
    679                                       NULL); // ppp);
    680 
    681                 if ((pColumnDef->hwndControl) && (lHandleSet))
     684                                      NULL))
    682685                {
    683                     // subclass the damn static
    684                     if ((flOld & 0x0F) == SS_ICON)
    685                         // this was a static:
    686                         ctlPrepareStaticIcon(pColumnDef->hwndControl,
    687                                              1);
     686                    if (lHandleSet)
     687                    {
     688                        // subclass the damn static
     689                        if ((flOld & 0x0F) == SS_ICON)
     690                            // this was a static:
     691                            ctlPrepareStaticIcon(pColumnDef->hwndControl,
     692                                                 1);
     693                        else
     694                            // this was a bitmap:
     695                            ctlPrepareStretchedBitmap(pColumnDef->hwndControl,
     696                                                      TRUE);
     697
     698                        WinSendMsg(pColumnDef->hwndControl,
     699                                   SM_SETHANDLE,
     700                                   (MPARAM)lHandleSet,
     701                                   0);
     702                    }
    688703                    else
    689                         // this was a bitmap:
    690                         ctlPrepareStretchedBitmap(pColumnDef->hwndControl,
    691                                                   TRUE);
    692 
    693                     WinSendMsg(pColumnDef->hwndControl,
    694                                SM_SETHANDLE,
    695                                (MPARAM)lHandleSet,
    696                                0);
    697                 }
    698                 else
    699                     if (pcszFont)
    700                         // we must set the font explicitly here...
    701                         // doesn't always work with WinCreateWindow
    702                         // presparams parameter, for some reason
    703                         // V0.9.12 (2001-05-31) [umoeller]
    704                         winhSetWindowFont(pColumnDef->hwndControl,
    705                                           pcszFont);
    706 
    707                 if (pColumnDef->hwndControl)
    708                 {
     704                        if (pcszFont)
     705                            // we must set the font explicitly here...
     706                            // doesn't always work with WinCreateWindow
     707                            // presparams parameter, for some reason
     708                            // V0.9.12 (2001-05-31) [umoeller]
     709                            winhSetWindowFont(pColumnDef->hwndControl,
     710                                              pcszFont);
     711
    709712                    lstAppendItem(&pDlgData->llControls,
    710713                                  pColumnDef);
     
    717720                        pDlgData->hwndFirstFocus = pColumnDef->hwndControl;
    718721                }
     722                else
     723                    // V0.9.14 (2001-08-03) [umoeller]
     724                    arc = DLGERR_CANNOT_CREATE_CONTROL;
    719725            }
    720726        break; }
    721727    }
    722728
     729    return (arc);
    723730}
    724731
     
    732739 */
    733740
    734 VOID ProcessRow(PROWDEF pRowDef,
    735                 PTABLEDEF pOwningTable,     // in: current table from ProcessTable
    736                 PROCESSMODE ProcessMode,    // in: processing mode (see ProcessAll)
    737                 PLONG plY,                  // in/out: current y position (decremented)
    738                 PDLGPRIVATE pDlgData)
    739 {
    740     // ULONG   ul;
     741APIRET ProcessRow(PROWDEF pRowDef,
     742                  PTABLEDEF pOwningTable,     // in: current table from ProcessTable
     743                  PROCESSMODE ProcessMode,    // in: processing mode (see ProcessAll)
     744                  PLONG plY,                  // in/out: current y position (decremented)
     745                  PDLGPRIVATE pDlgData)
     746{
     747    APIRET  arc = NO_ERROR;
    741748    LONG    lX;
    742749    PLISTNODE pNode;
     
    767774        PCOLUMNDEF  pColumnDefThis = (PCOLUMNDEF)pNode->pItemData;
    768775
    769         ProcessColumn(pColumnDefThis, pRowDef, ProcessMode, &lX, pDlgData);
    770 
    771         if (ProcessMode == PROCESS_CALC_SIZES)
    772         {
    773             // row width = sum of all columns
    774             pRowDef->cpRow.cx += pColumnDefThis->cpColumn.cx;
    775 
    776             // row height = maximum height of a column
    777             if (pRowDef->cpRow.cy < pColumnDefThis->cpColumn.cy)
    778                 pRowDef->cpRow.cy = pColumnDefThis->cpColumn.cy;
    779         }
    780     }
     776        if (!(arc = ProcessColumn(pColumnDefThis, pRowDef, ProcessMode, &lX, pDlgData)))
     777        {
     778            if (ProcessMode == PROCESS_CALC_SIZES)
     779            {
     780                // row width = sum of all columns
     781                pRowDef->cpRow.cx += pColumnDefThis->cpColumn.cx;
     782
     783                // row height = maximum height of a column
     784                if (pRowDef->cpRow.cy < pColumnDefThis->cpColumn.cy)
     785                    pRowDef->cpRow.cy = pColumnDefThis->cpColumn.cy;
     786            }
     787        }
     788    }
     789
     790    return (arc);
    781791}
    782792
     
    802812 */
    803813
    804 VOID ProcessTable(PTABLEDEF pTableDef,
    805                   const CONTROLPOS *pcpTable,       // in: table position with PROCESS_CALC_POSITIONS
    806                   PROCESSMODE ProcessMode,          // in: processing mode (see ProcessAll)
    807                   PDLGPRIVATE pDlgData)
    808 {
    809     // ULONG   ul;
     814APIRET ProcessTable(PTABLEDEF pTableDef,
     815                    const CONTROLPOS *pcpTable,       // in: table position with PROCESS_CALC_POSITIONS
     816                    PROCESSMODE ProcessMode,          // in: processing mode (see ProcessAll)
     817                    PDLGPRIVATE pDlgData)
     818{
     819    APIRET  arc = NO_ERROR;
    810820    LONG    lY;
    811821    PLISTNODE pNode;
     
    829839        PROWDEF pRowDefThis = (PROWDEF)pNode->pItemData;
    830840
    831         ProcessRow(pRowDefThis, pTableDef, ProcessMode, &lY, pDlgData);
    832 
    833         if (ProcessMode == PROCESS_CALC_SIZES)
    834         {
    835             // table width = maximum width of a row
    836             if (pTableDef->cpTable.cx < pRowDefThis->cpRow.cx)
    837                 pTableDef->cpTable.cx = pRowDefThis->cpRow.cx;
    838 
    839             // table height = sum of all rows
    840             pTableDef->cpTable.cy += pRowDefThis->cpRow.cy;
    841         }
    842     }
     841        if (!(arc = ProcessRow(pRowDefThis, pTableDef, ProcessMode, &lY, pDlgData)))
     842        {
     843            if (ProcessMode == PROCESS_CALC_SIZES)
     844            {
     845                // table width = maximum width of a row
     846                if (pTableDef->cpTable.cx < pRowDefThis->cpRow.cx)
     847                    pTableDef->cpTable.cx = pRowDefThis->cpRow.cx;
     848
     849                // table height = sum of all rows
     850                pTableDef->cpTable.cy += pRowDefThis->cpRow.cy;
     851            }
     852        }
     853        else
     854            break;
     855    }
     856
     857    return (arc);
    843858}
    844859
     
    876891 */
    877892
    878 VOID ProcessAll(PDLGPRIVATE pDlgData,
    879                 PSIZEL pszlClient,
    880                 PROCESSMODE ProcessMode)
    881 {
    882     // ULONG ul;
     893APIRET ProcessAll(PDLGPRIVATE pDlgData,
     894                  PSIZEL pszlClient,
     895                  PROCESSMODE ProcessMode)
     896{
     897    APIRET arc = NO_ERROR;
    883898    PLISTNODE pNode;
    884899    CONTROLPOS cpTable;
     
    908923        }
    909924
    910         ProcessTable(pTableDefThis,
    911                      &cpTable,      // start pos
    912                      ProcessMode,
    913                      pDlgData);
    914 
    915         if (ProcessMode == PROCESS_CALC_SIZES)
    916         {
    917             pszlClient->cx += pTableDefThis->cpTable.cx;
    918             pszlClient->cy += pTableDefThis->cpTable.cy;
    919         }
    920     }
     925        if (!(arc = ProcessTable(pTableDefThis,
     926                                 &cpTable,      // start pos
     927                                 ProcessMode,
     928                                 pDlgData)))
     929        {
     930            if (ProcessMode == PROCESS_CALC_SIZES)
     931            {
     932                pszlClient->cx += pTableDefThis->cpTable.cx;
     933                pszlClient->cy += pTableDefThis->cpTable.cy;
     934            }
     935        }
     936    }
     937
     938    return (arc);
    921939}
    922940
  • trunk/src/helpers/winh.c

    r91 r95  
    13621362 *      this func after you have received SPBN_UP/DOWNARROW,
    13631363 *      the spin button's value will always in/decrease
    1364  *      in steps of 100.
     1364 *      so that the spin button's value is a multiple of 100.
     1365 *
     1366 *      By contrast, if (lGrid < 0), this will not really
     1367 *      snap the value to a multiple of -lGrid, but instead
     1368 *      in/decrease the value by -lGrid. The value will not
     1369 *      necessarily be a multiple of the grid. (0.9.14)
    13651370 *
    13661371 *      This returns the "snapped" value to which the spin
     
    13681373 *
    13691374 *      If you specify lGrid == 0, this returns the spin
    1370  *      button's value only (V0.9.0).
     1375 *      button's value only without snapping (V0.9.0).
    13711376 *
    13721377 *@@changed V0.9.0 [umoeller]: added check for lGrid == 0 (caused division by zero previously)
     1378 *@@changed V0.9.14 (2001-08-03) [umoeller]: added fixes for age-old problems with wrap around
     1379 *@@changed V0.9.14 (2001-08-03) [umoeller]: added lGrid < 0 mode
    13731380 */
    13741381
     
    13801387    HWND hwndSpin = WinWindowFromID(hwndDlg, usItemID);
    13811388    LONG lBottom, lTop, lValue;
     1389
    13821390    // get value, which has already increased /
    13831391    // decreased by 1
     
    13971405        // manually enters something (SPBN_CHANGE),
    13981406        // we'll accept that value
    1399         lValue = (lValue / lGrid) * lGrid;
    1400         // add /subtract grid
    1401         if (usNotifyCode == SPBN_UPARROW)
    1402             lValue += lGrid;
    1403         // else we'll have -= lGrid already
     1407        LONG lChanged = (usNotifyCode == SPBN_UPARROW)
     1408                            // if the spin button went up, subtract 1
     1409                            ? -1
     1410                            : +1;
     1411        LONG lPrev  = lValue + lChanged;
     1412
     1413        // if grid is negative, it is assumed to
     1414        // not be a "real" grid but jump in those
     1415        // steps only
     1416        if (lGrid < 0)
     1417        {
     1418            // add /subtract grid
     1419            if (usNotifyCode == SPBN_UPARROW)
     1420                lValue = lPrev - lGrid;
     1421            else
     1422                lValue = lPrev + lGrid;
     1423
     1424            // lValue = (lValue / lGrid) * lGrid;
     1425        }
     1426        else
     1427        {
     1428            // add /subtract grid
     1429            if (usNotifyCode == SPBN_UPARROW)
     1430                lValue = lPrev + lGrid;
     1431            else
     1432                lValue = lPrev - lGrid;
     1433
     1434            lValue = (lValue / lGrid) * lGrid;
     1435        }
    14041436
    14051437        // balance with spin button limits
Note: See TracChangeset for help on using the changeset viewer.