Changeset 82


Ignore:
Timestamp:
Jun 25, 2001, 9:06:00 PM (24 years ago)
Author:
umoeller
Message:

Updates to XCenter and help management.

Location:
trunk
Files:
1 added
5 edited

Legend:

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

    r79 r82  
    189189                         const char *pcszControlsFont);
    190190
     191    /*
     192     *@@ MSGBOXSTRINGS:
     193     *
     194     *@@added V0.9.13 (2001-06-21) [umoeller]
     195     */
     196
     197    typedef struct _MSGBOXSTRINGS
     198    {
     199        const char      *pcszYes,           // "~Yes"
     200                        *pcszNo,            // "~No"
     201                        *pcszOK,            // "~OK"
     202                        *pcszCancel,        // "~Cancel"
     203                        *pcszAbort,         // "~Abort"
     204                        *pcszRetry,         // "~Retry"
     205                        *pcszIgnore,        // "~Ignore"
     206                        *pcszEnter,
     207                        *pcszYesToAll;      // "Yes to ~all"
     208    } MSGBOXSTRINGS, *PMSGBOXSTRINGS;
     209
     210    /* the following are in os2.h somewhere:
     211    #define MB_OK                      0x0000
     212    #define MB_OKCANCEL                0x0001
     213    #define MB_RETRYCANCEL             0x0002
     214    #define MB_ABORTRETRYIGNORE        0x0003
     215    #define MB_YESNO                   0x0004
     216    #define MB_YESNOCANCEL             0x0005
     217    #define MB_CANCEL                  0x0006
     218    #define MB_ENTER                   0x0007
     219    #define MB_ENTERCANCEL             0x0008 */
     220    // we add:
     221    #define MB_YES_YES2ALL_NO          0x0009
     222
     223    /* the following are in os2.h somewhere:
     224    #define MBID_OK                    1
     225    #define MBID_CANCEL                2
     226    #define MBID_ABORT                 3
     227    #define MBID_RETRY                 4
     228    #define MBID_IGNORE                5
     229    #define MBID_YES                   6
     230    #define MBID_NO                    7
     231    #define MBID_HELP                  8
     232    #define MBID_ENTER                 9 */
     233    // we add:
     234    #define MBID_YES2ALL               10
     235
     236    APIRET dlghCreateMessageBox(HWND *phwndDlg,
     237                                HWND hwndOwner,
     238                                HPOINTER hptrIcon,
     239                                const char *pcszTitle,
     240                                const char *pcszMessage,
     241                                ULONG flFlags,
     242                                const char *pcszFont,
     243                                const MSGBOXSTRINGS *pStrings,
     244                                PULONG pulAlarmFlag);
     245
     246    ULONG dlghMessageBox(HWND hwndOwner,
     247                         HPOINTER hptrIcon,
     248                         const char *pcszTitle,
     249                         const char *pcszMessage,
     250                         ULONG flFlags,
     251                         const char *pcszFont,
     252                         const MSGBOXSTRINGS *pStrings);
     253
    191254    VOID dlghSetPrevFocus(PVOID pvllWindows);
    192255
  • trunk/src/helpers/cctl_tooltip.c

    r81 r82  
    359359    HWND        hwndOwner;          // from WM_CREATE
    360360    HAB         hab;                // from WM_CREATE
    361     ULONG       ulTooltipID;        // from WM_CREATE
     361    USHORT      usTooltipID;        // from WM_CREATE
    362362
    363363    LONG        cxScreen,
     
    455455        pttd->hwndOwner = pcs->hwndOwner;
    456456        pttd->hab = WinQueryAnchorBlock(hwndTooltip);
    457         pttd->ulTooltipID = pcs->id;
     457        pttd->usTooltipID = pcs->id;
    458458
    459459        pttd->cxScreen = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN);
     
    922922        // compose values for that msg
    923923        TOOLTIPTEXT ttt = {0};
    924         // _Pmpf(("TTM_GETTEXT: PSZ_TEXTCALLBACK... sending TTN_NEEDTEXT"));
    925924        ttt.hwndTooltip = hwndTooltip;
    926925        ttt.hwndTool = pti->hwndTool;
    927926        WinSendMsg(pti->hwndToolOwner,
    928927                   WM_CONTROL,
    929                    MPFROM2SHORT(pttd->ulTooltipID,  // tooltip control wnd ID
     928                   MPFROM2SHORT(pttd->usTooltipID,  // tooltip control wnd ID
    930929                                TTN_NEEDTEXT),
    931930                   &ttt);
     
    12661265                WinSendMsg(pttd->hwndOwner,
    12671266                           WM_CONTROL,
    1268                            MPFROM2SHORT(pttd->ulTooltipID,  // tooltip control wnd ID
     1267                           MPFROM2SHORT(pttd->usTooltipID,  // tooltip control wnd ID
    12691268                                        TTN_SHOW),
    12701269                           pttd->ptiMouseOver);
     
    12931292            WinSendMsg(pttd->hwndOwner,
    12941293                       WM_CONTROL,
    1295                        MPFROM2SHORT(pttd->ulTooltipID,  // tooltip control wnd ID
     1294                       MPFROM2SHORT(pttd->usTooltipID,  // tooltip control wnd ID
    12961295                                    TTN_POP),
    12971296                       pttd->ptiMouseOver);
  • trunk/src/helpers/dialog.c

    r81 r82  
    15251525
    15261526/*
     1527 *@@ dlghCreateMessageBox:
     1528 *
     1529 *@@added V0.9.13 (2001-06-21) [umoeller]
     1530 */
     1531
     1532APIRET dlghCreateMessageBox(HWND *phwndDlg,
     1533                            HWND hwndOwner,
     1534                            HPOINTER hptrIcon,
     1535                            const char *pcszTitle,
     1536                            const char *pcszMessage,
     1537                            ULONG flFlags,
     1538                            const char *pcszFont,
     1539                            const MSGBOXSTRINGS *pStrings,
     1540                            PULONG pulAlarmFlag)      // out: alarm sound to be played
     1541{
     1542    CONTROLDEF
     1543        Icon = {
     1544                        WC_STATIC,
     1545                        NULL,           // text, set below
     1546                        WS_VISIBLE | SS_ICON,
     1547                        0,          // ID
     1548                        NULL,       // no font
     1549                        0,
     1550                        { SZL_AUTOSIZE, SZL_AUTOSIZE },
     1551                        5
     1552                    },
     1553        InfoText =
     1554                    {
     1555                        WC_STATIC,
     1556                        NULL,       // text, set below
     1557                        WS_VISIBLE | SS_TEXT | DT_WORDBREAK | DT_LEFT | DT_TOP,
     1558                        10,          // ID
     1559                        CTL_COMMON_FONT,
     1560                        0,
     1561                        { 400, SZL_AUTOSIZE },
     1562                        5
     1563                    },
     1564        Buttons[] = {
     1565                        {
     1566                            WC_BUTTON,
     1567                            NULL,       // text, set below
     1568                            WS_VISIBLE | BS_PUSHBUTTON,
     1569                            1,          // ID
     1570                            CTL_COMMON_FONT,  // no font
     1571                            0,
     1572                            { 100, 30 },
     1573                            5
     1574                        },
     1575                        {
     1576                            WC_BUTTON,
     1577                            NULL,       // text, set below
     1578                            WS_VISIBLE | BS_PUSHBUTTON,
     1579                            2,          // ID
     1580                            CTL_COMMON_FONT,  // no font
     1581                            0,
     1582                            { 100, 30 },
     1583                            5
     1584                        },
     1585                        {
     1586                            WC_BUTTON,
     1587                            NULL,       // text, set below
     1588                            WS_VISIBLE | BS_PUSHBUTTON,
     1589                            3,          // ID
     1590                            CTL_COMMON_FONT,  // no font
     1591                            0,
     1592                            { 100, 30 },
     1593                            5
     1594                        }
     1595                    };
     1596
     1597    DLGHITEM MessageBox[] =
     1598                 {
     1599                    START_TABLE,
     1600                        START_ROW(ROW_VALIGN_CENTER),
     1601                            CONTROL_DEF(&Icon),
     1602                        START_TABLE,
     1603                            START_ROW(ROW_VALIGN_CENTER),
     1604                                CONTROL_DEF(&InfoText),
     1605                            START_ROW(ROW_VALIGN_CENTER),
     1606                                CONTROL_DEF(&Buttons[0]),
     1607                                CONTROL_DEF(&Buttons[1]),
     1608                                CONTROL_DEF(&Buttons[2]),
     1609                        END_TABLE,
     1610                    END_TABLE
     1611                 };
     1612
     1613    ULONG flButtons = flFlags & 0xF;        // low nibble contains MB_YESNO etc.
     1614
     1615    const char  *p0 = "Error",
     1616                *p1 = NULL,
     1617                *p2 = NULL;
     1618
     1619    Icon.pcszText = (const char *)hptrIcon;
     1620    InfoText.pcszText = pcszMessage;
     1621
     1622    // now work on the three buttons of the dlg template:
     1623    // give them proper titles or hide them
     1624    if (flButtons == MB_OK)
     1625    {
     1626        p0 = pStrings->pcszOK;
     1627    }
     1628    else if (flButtons == MB_OKCANCEL)
     1629    {
     1630        p0 = pStrings->pcszOK;
     1631        p1 = pStrings->pcszCancel;
     1632    }
     1633    else if (flButtons == MB_RETRYCANCEL)
     1634    {
     1635        p0 = pStrings->pcszRetry;
     1636        p1 = pStrings->pcszCancel;
     1637    }
     1638    else if (flButtons == MB_ABORTRETRYIGNORE)
     1639    {
     1640        p0 = pStrings->pcszAbort;
     1641        p1 = pStrings->pcszRetry;
     1642        p2 = pStrings->pcszIgnore;
     1643    }
     1644    else if (flButtons == MB_YESNO)
     1645    {
     1646        p0 = pStrings->pcszYes;
     1647        p1 = pStrings->pcszNo;
     1648    }
     1649    else if (flButtons == MB_YESNOCANCEL)
     1650    {
     1651        p0 = pStrings->pcszYes;
     1652        p1 = pStrings->pcszNo;
     1653        p2 = pStrings->pcszCancel;
     1654    }
     1655    else if (flButtons == MB_CANCEL)
     1656    {
     1657        p0 = pStrings->pcszCancel;
     1658    }
     1659    else if (flButtons == MB_ENTER)
     1660    {
     1661        p0 = pStrings->pcszEnter;
     1662    }
     1663    else if (flButtons == MB_ENTERCANCEL)
     1664    {
     1665        p0 = pStrings->pcszEnter;
     1666        p1 = pStrings->pcszCancel;
     1667    }
     1668    else if (flButtons == MB_YES_YES2ALL_NO)
     1669    {
     1670        p0 = pStrings->pcszYes;
     1671        p1 = pStrings->pcszYesToAll;
     1672        p2 = pStrings->pcszNo;
     1673    }
     1674
     1675    // now set strings and hide empty buttons
     1676    Buttons[0].pcszText = p0;
     1677
     1678    if (p1)
     1679        Buttons[1].pcszText = p1;
     1680    else
     1681        Buttons[1].flStyle &= ~WS_VISIBLE;
     1682
     1683    if (p2)
     1684        Buttons[2].pcszText = p2;
     1685    else
     1686        Buttons[2].flStyle &= ~WS_VISIBLE;
     1687
     1688    // query default button IDs
     1689    if (flFlags & MB_DEFBUTTON2)
     1690        Buttons[1].flStyle |= BS_DEFAULT;
     1691    else if (flFlags & MB_DEFBUTTON3)
     1692        Buttons[2].flStyle |= BS_DEFAULT;
     1693    else
     1694        Buttons[0].flStyle |= BS_DEFAULT;
     1695
     1696    *pulAlarmFlag = WA_NOTE;
     1697    if (flFlags & (MB_ICONHAND | MB_ERROR))
     1698        *pulAlarmFlag = WA_ERROR;
     1699    else if (flFlags & (MB_ICONEXCLAMATION | MB_WARNING))
     1700        *pulAlarmFlag = WA_WARNING;
     1701
     1702    return (dlghCreateDlg(phwndDlg,
     1703                          hwndOwner,
     1704                          FCF_TITLEBAR | FCF_SYSMENU | FCF_DLGBORDER | FCF_NOBYTEALIGN,
     1705                          WinDefDlgProc,
     1706                          pcszTitle,
     1707                          MessageBox,
     1708                          ARRAYITEMCOUNT(MessageBox),
     1709                          NULL,
     1710                          pcszFont));
     1711}
     1712
     1713/*
     1714 *@@ dlghProcessMessageBox:
     1715 *
     1716 *@@added V0.9.13 (2001-06-21) [umoeller]
     1717 */
     1718
     1719ULONG dlghProcessMessageBox(HWND hwndDlg,
     1720                            ULONG ulAlarmFlag,
     1721                            ULONG flFlags)
     1722{
     1723    ULONG ulrcDlg;
     1724    ULONG flButtons = flFlags & 0xF;        // low nibble contains MB_YESNO etc.
     1725
     1726    winhCenterWindow(hwndDlg);
     1727
     1728    if (flFlags & MB_SYSTEMMODAL)
     1729        WinSetSysModalWindow(HWND_DESKTOP, hwndDlg);
     1730
     1731    if (ulAlarmFlag)
     1732        WinAlarm(HWND_DESKTOP, ulAlarmFlag);
     1733
     1734    ulrcDlg = WinProcessDlg(hwndDlg);
     1735
     1736    WinDestroyWindow(hwndDlg);
     1737
     1738    if (flButtons == MB_OK)
     1739        return MBID_OK;
     1740    else if (flButtons == MB_OKCANCEL)
     1741        switch (ulrcDlg)
     1742        {
     1743            case 1:     return MBID_OK;
     1744            default:    return MBID_CANCEL;
     1745        }
     1746    else if (flButtons == MB_RETRYCANCEL)
     1747        switch (ulrcDlg)
     1748        {
     1749            case 1:     return MBID_RETRY;
     1750            default:    return MBID_CANCEL;
     1751        }
     1752    else if (flButtons == MB_ABORTRETRYIGNORE)
     1753        switch (ulrcDlg)
     1754        {
     1755            case 2:     return MBID_RETRY;
     1756            case 3:     return MBID_IGNORE;
     1757            default:    return MBID_ABORT;
     1758        }
     1759    else if (flButtons == MB_YESNO)
     1760        switch (ulrcDlg)
     1761        {
     1762            case 1:     return MBID_YES;
     1763            default:    return MBID_NO;
     1764        }
     1765    else if (flButtons == MB_YESNOCANCEL)
     1766        switch (ulrcDlg)
     1767        {
     1768            case 1:     return MBID_YES;
     1769            case 2:     return MBID_NO;
     1770            default:    return MBID_CANCEL;
     1771        }
     1772    else if (flButtons == MB_CANCEL)
     1773        return MBID_CANCEL;
     1774    else if (flButtons == MB_ENTER)
     1775        return MBID_ENTER;
     1776    else if (flButtons == MB_ENTERCANCEL)
     1777        switch (ulrcDlg)
     1778        {
     1779            case 1:     return MBID_ENTER;
     1780            default:    return MBID_CANCEL;
     1781        }
     1782    else if (flButtons == MB_YES_YES2ALL_NO)
     1783        switch (ulrcDlg)
     1784        {
     1785            case 1:     return MBID_YES;
     1786            case 2:     return MBID_YES2ALL;
     1787            default:    return MBID_NO;
     1788        }
     1789
     1790    return (MBID_CANCEL);
     1791}
     1792
     1793/*
     1794 *@@ dlghMessageBox:
     1795 *      WinMessageBox replacement.
     1796 *
     1797 *      This has all the flags of the standard call,
     1798 *      but looks much prettier. Besides, it allows
     1799 *      you to specify any icon to be displayed.
     1800 *
     1801 *      Currently the following flStyle's are supported:
     1802 *
     1803 *      -- MB_OK                      0x0000
     1804 *      -- MB_OKCANCEL                0x0001
     1805 *      -- MB_RETRYCANCEL             0x0002
     1806 *      -- MB_ABORTRETRYIGNORE        0x0003
     1807 *      -- MB_YESNO                   0x0004
     1808 *      -- MB_YESNOCANCEL             0x0005
     1809 *      -- MB_CANCEL                  0x0006
     1810 *      -- MB_ENTER                   0x0007 (not implemented yet)
     1811 *      -- MB_ENTERCANCEL             0x0008 (not implemented yet)
     1812 *
     1813 *      -- MB_YES_YES2ALL_NO          0x0009
     1814 *          This is new: this has three buttons called "Yes"
     1815 *          (MBID_YES), "Yes to all" (MBID_YES2ALL), "No" (MBID_NO).
     1816 *
     1817 *      -- MB_DEFBUTTON2            (for two-button styles)
     1818 *      -- MB_DEFBUTTON3            (for three-button styles)
     1819 *
     1820 *      -- MB_ICONHAND
     1821 *      -- MB_ICONEXCLAMATION
     1822 *
     1823 *      Returns MBID_* codes like WinMessageBox.
     1824 *
     1825 *@@added V0.9.13 (2001-06-21) [umoeller]
     1826 */
     1827
     1828ULONG dlghMessageBox(HWND hwndOwner,            // in: owner for msg box
     1829                     HPOINTER hptrIcon,         // in: icon to display
     1830                     const char *pcszTitle,     // in: title
     1831                     const char *pcszMessage,   // in: message
     1832                     ULONG flFlags,             // in: standard message box flags
     1833                     const char *pcszFont,      // in: font (e.g. "9.WarpSans")
     1834                     const MSGBOXSTRINGS *pStrings) // in: strings array
     1835{
     1836    HWND hwndDlg;
     1837    ULONG ulAlarmFlag;
     1838    APIRET arc = dlghCreateMessageBox(&hwndDlg,
     1839                                      hwndOwner,
     1840                                      hptrIcon,
     1841                                      pcszTitle,
     1842                                      pcszMessage,
     1843                                      flFlags,
     1844                                      pcszFont,
     1845                                      pStrings,
     1846                                      &ulAlarmFlag);
     1847
     1848    if (!arc && hwndDlg)
     1849    {
     1850        // SHOW DIALOG
     1851        return (dlghProcessMessageBox(hwndDlg,
     1852                                      ulAlarmFlag,
     1853                                      flFlags));
     1854    }
     1855    else
     1856    {
     1857        CHAR szMsg[100];
     1858        sprintf(szMsg, "dlghCreateMessageBox reported error %u.", arc);
     1859        WinMessageBox(HWND_DESKTOP,
     1860                      NULLHANDLE,
     1861                      "Error",
     1862                      szMsg,
     1863                      0,
     1864                      MB_CANCEL | MB_MOVEABLE);
     1865    }
     1866
     1867    return (DID_CANCEL);
     1868}
     1869
     1870/*
    15271871 *@@ dlghSetPrevFocus:
    15281872 *      "backward" function for rotating the focus
  • trunk/src/helpers/dosh.c

    r81 r82  
    476476                           pdp,   sizeof(BIOSPARAMETERBLOCK));
    477477
    478         if (!arc)
     478        /* if (!arc)
    479479        {
    480480            _Pmpf(("      bDeviceType: %d", pdp->bDeviceType));
    481481            _Pmpf(("      bytes per sector: %d", pdp->usBytesPerSector));
    482482            _Pmpf(("      sectors per track: %d", pdp->usSectorsPerTrack));
    483         }
     483        } */
    484484    }
    485485
     
    691691                          &fFixed);    // V0.9.13 (2001-06-14) [umoeller]
    692692
    693     _Pmpf((__FUNCTION__ ": doshIsFixedDisk returned %d for disk %d", arc, ulLogicalDrive));
    694     _Pmpf(("   fFixed is %d", fFixed));
     693    // _Pmpf((__FUNCTION__ ": doshIsFixedDisk returned %d for disk %d", arc, ulLogicalDrive));
     694    // _Pmpf(("   fFixed is %d", fFixed));
    695695
    696696    if (!arc)
     
    702702            arc = doshQueryDiskParams(ulLogicalDrive,
    703703                                      &bpb);
    704             _Pmpf(("   doshQueryDiskParams returned %d", arc));
     704            // _Pmpf(("   doshQueryDiskParams returned %d", arc));
    705705
    706706            if (    (!arc)
     
    708708               )
    709709            {
    710                 _Pmpf(("   --> is CD-ROM"));
     710                // _Pmpf(("   --> is CD-ROM"));
    711711                fCDROM = TRUE;
    712712            }
     
    731731                      NULL);
    732732
    733         _Pmpf(("   DosOpen(OPEN_FLAGS_DASD) returned %d", arc));
     733        // _Pmpf(("   DosOpen(OPEN_FLAGS_DASD) returned %d", arc));
    734734
    735735        // this still returns NO_ERROR for audio CDs in a
     
    808808                        }
    809809
    810                         _Pmpf(("   got %d audio, %d data tracks",
    811                                     ulAudioTracks, ulDataTracks));
     810                        // _Pmpf(("   got %d audio, %d data tracks",
     811                        //             ulAudioTracks, ulDataTracks));
    812812
    813813                        if (!ulDataTracks)
     
    818818                        // not audio disk:
    819819                        // go on then
    820                         _Pmpf(("   CDROMAUDIO_GETAUDIODISK returned %d", arc));
     820                        // _Pmpf(("   CDROMAUDIO_GETAUDIODISK returned %d", arc));
    821821                        arc = NO_ERROR;
    822822                    }
     
    826826            {
    827827                // not CD-ROM: go on then
    828                 _Pmpf(("   CDROMDISK_GETDRIVER returned %d", arc));
     828                // _Pmpf(("   CDROMDISK_GETDRIVER returned %d", arc));
    829829                arc = NO_ERROR;
    830830            }
     
    862862                                     &fsa,
    863863                                     sizeof(fsa));
    864                 _Pmpf(("   re-checked, DosQueryFSInfo returned %d", arc));
     864                // _Pmpf(("   re-checked, DosQueryFSInfo returned %d", arc));
    865865            }
    866866        break;
  • trunk/src/helpers/textv_html.c

    r21 r82  
    14161416 *      character for the given escape sequence (pszTag).
    14171417 *
    1418  *      pszTag contains the stuff between "&" and ";".
     1418 *      pszTag must be null-terminated and contain only
     1419 *      the stuff between "&" and ";".
    14191420 *
    14201421 *      This is really ugly spaghetti, but it's the fastest
Note: See TracChangeset for help on using the changeset viewer.