Ignore:
Timestamp:
Mar 13, 2001, 9:56:01 AM (24 years ago)
Author:
umoeller
Message:

Mistc. updates for WarpIN, new features.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/winh.c

    r45 r46  
    5252#define INCL_WINRECTANGLES
    5353#define INCL_WINSHELLDATA
     54#define INCL_WINTIMER
    5455#define INCL_WINSYS
    5556#define INCL_WINHELP
     
    332333                    {
    333334                        // now copy all the items in the submenu
    334                         SHORT cMenuItems = (SHORT)WinSendMsg(mi.hwndSubMenu,
     335                        SHORT cMenuItems = SHORT1FROMMR(WinSendMsg(mi.hwndSubMenu,
    335336                                                             MM_QUERYITEMCOUNT,
    336                                                              0, 0);
     337                                                             0, 0));
    337338                        // loop through all entries in the original submenu
    338339                        ULONG i;
     
    342343                        {
    343344                            CHAR szItemText[100];
    344                             SHORT id = (SHORT)WinSendMsg(mi.hwndSubMenu,
     345                            SHORT id = SHORT1FROMMR(WinSendMsg(mi.hwndSubMenu,
    345346                                                         MM_ITEMIDFROMPOSITION,
    346347                                                         MPFROMSHORT(i),
    347                                                          0);
     348                                                         0));
    348349                            // recurse
    349350                            winhCopyMenuItem(hwndSubMenu,
     
    361362                        {
    362363                            // get the original default item
    363                             SHORT sDefID = (SHORT)WinSendMsg(mi.hwndSubMenu,
     364                            SHORT sDefID = SHORT1FROMMR(WinSendMsg(mi.hwndSubMenu,
    364365                                                             MM_QUERYDEFAULTITEMID,
    365                                                              0, 0);
     366                                                             0, 0));
    366367                            // set "conditional cascade style" on target too
    367368                            WinSetWindowBits(hwndSubMenu,
     
    383384                    SHORT s;
    384385                    mi.iPosition = sTargetPosition;
    385                     s = (SHORT)WinSendMsg(hmenuTarget,
     386                    s = SHORT1FROMMR(WinSendMsg(hmenuTarget,
    386387                                          MM_INSERTITEM,
    387388                                          MPFROMP(&mi),
    388                                           MPFROMP(pszSource));
     389                                          MPFROMP(pszSource)));
    389390                    if (s != MIT_MEMERROR && s != MIT_ERROR)
    390391                        brc = TRUE;
     
    447448        {
    448449            int i;
    449             SHORT cMenuItems = (SHORT)WinSendMsg(hmenuSource,
     450            SHORT cMenuItems = SHORT1FROMMR(WinSendMsg(hmenuSource,
    450451                                                 MM_QUERYITEMCOUNT,
    451                                                  0, 0);
     452                                                 0, 0));
    452453
    453454            // loop through all entries in the original menu
    454455            for (i = 0; i < cMenuItems; i++)
    455456            {
    456                 SHORT id = (SHORT)WinSendMsg(hmenuSource,
     457                SHORT id = SHORT1FROMMR(WinSendMsg(hmenuSource,
    457458                                             MM_ITEMIDFROMPOSITION,
    458459                                             MPFROMSHORT(i),
    459                                              0);
     460                                             0));
    460461                winhCopyMenuItem(hwndNewSubmenu,
    461462                                 hmenuSource,
     
    481482 *      not found.
    482483 *
    483  *      Returns NULL on error. Use winhFree()
     484 *      Returns NULL on error. Use free()
    484485 *      to free the return value.
    485486 *
     
    11711172 *      buffer.
    11721173 *
    1173  *      Returns NULL on error. Use winhFree()
     1174 *      Returns NULL on error. Use fre()
    11741175 *      to free the return value.
    11751176 *
     
    16501651 *      -- "End": scroll rightmost.
    16511652 *      -- "Ctrl+ End": scroll bottommost.
    1652  *      -- "Ctrl + page up, down": scroll topmost or bottommost.
    1653  *
    1654  *      This is roughly CUA behavior.
     1653 *      -- "Ctrl + page up, down": scroll one screen left or right.
     1654 *
     1655 *      This is CUA behavior.
    16551656 *
    16561657 *      Returns TRUE if the message has been
     
    16581659 *
    16591660 *@@added V0.9.3 (2000-04-29) [umoeller]
     1661 *@@changed V0.9.9 (2001-02-01) [lafaix]: Ctrl+PgUp/Dn now do one screen left/right
    16601662 */
    16611663
     
    17051707
    17061708            case VK_PAGEUP:
    1707                 ulMsg = WM_VSCROLL;
    17081709                if (usFlags & KC_CTRL)
    1709                 {
    1710                     sPos = 0;
    1711                     usCmd = SB_SLIDERPOSITION;
    1712                 }
     1710                    ulMsg = WM_HSCROLL;
     1711                 else
     1712                    ulMsg = WM_VSCROLL;
     1713                usCmd = SB_PAGEUP;
     1714            break;
     1715
     1716            case VK_PAGEDOWN:
     1717                if (usFlags & KC_CTRL)
     1718                    ulMsg = WM_HSCROLL;
    17131719                else
    1714                     usCmd = SB_PAGEUP;
    1715             break;
    1716 
    1717             case VK_PAGEDOWN:
    1718                 ulMsg = WM_VSCROLL;
    1719                 if (usFlags & KC_CTRL)
    1720                 {
    1721                     sPos = ulVertMax;
    1722                     usCmd = SB_SLIDERPOSITION;
    1723                 }
    1724                 else
    1725                     usCmd = SB_PAGEDOWN;
     1720                    ulMsg = WM_VSCROLL;
     1721                usCmd = SB_PAGEDOWN;
    17261722            break;
    17271723
     
    22552251 *      in a newly allocated buffer.
    22562252 *
    2257  *      Returns NULL on error. Use winhFree()
     2253 *      Returns NULL on error. Use free()
    22582254 *      to free the return value.
    22592255 *
     
    32533249 *      without blocking the message queue.
    32543250 *
     3251 *      NOTE: This function is a bit expensive because
     3252 *      it creates a temporary object window. If you
     3253 *      need to sleep several times, you should rather
     3254 *      use a private timer.
     3255 *
    32553256 *@@added V0.9.4 (2000-07-11) [umoeller]
    3256  */
    3257 
    3258 VOID winhSleep(HAB hab,
    3259                ULONG ulSleep)    // in: sleep time in milliseconds
    3260 {
    3261     ULONG ul = 0;
    3262     QMSG qmsg;
    3263     for (ul = 0;
    3264          ul < (ulSleep / 50);
    3265          ul++)
    3266     {
    3267         DosSleep(50);
    3268         while (WinPeekMsg(hab,
    3269                           &qmsg, 0, 0, 0,
    3270                           PM_REMOVE))
    3271             WinDispatchMsg(hab, &qmsg);
    3272 
    3273     }
     3257 *@@changed V0.9.9 (2001-03-11) [umoeller]: rewritten
     3258 */
     3259
     3260VOID winhSleep(ULONG ulSleep)    // in: sleep time in milliseconds
     3261{
     3262    HWND hwnd = winhCreateObjectWindow(WC_STATIC, NULL);
     3263    if (hwnd)
     3264    {
     3265        QMSG qmsg;
     3266        HAB hab = WinQueryAnchorBlock(hwnd);
     3267        if (WinStartTimer(hab,
     3268                          hwnd,
     3269                          1,
     3270                          ulSleep))
     3271        {
     3272            while (WinGetMsg(hab, &qmsg, NULLHANDLE, 0, 0))
     3273            {
     3274                if (    (qmsg.hwnd == hwnd)
     3275                     && (qmsg.msg == WM_TIMER)
     3276                     && (qmsg.mp1 == (MPARAM)1)     // timer ID
     3277                   )
     3278                    break;
     3279
     3280                WinDispatchMsg(hab, &qmsg);
     3281            }
     3282            WinStopTimer(hab,
     3283                         hwnd,
     3284                         1);
     3285        }
     3286        else
     3287            // timer creation failed:
     3288            DosSleep(ulSleep);
     3289
     3290        WinDestroyWindow(hwnd);
     3291    }
     3292    else
     3293        DosSleep(ulSleep);
    32743294}
    32753295
     
    34153435 *      HWND in a newly allocated buffer.
    34163436 *
    3417  *      Returns NULL on error. Use winhFree()
     3437 *      Returns NULL on error. Use free()
    34183438 *      to free the return value.
    34193439 */
     
    35323552 *      positioned automatically, using a given
    35333553 *      SWP structure (*pswpFrame).
     3554 *
     3555 *      The frame is created with the specified parent
     3556 *      (usually HWND_DESKTOP), but no owner.
    35343557 *
    35353558 *      The client window is created with the frame as
     
    40524075 *
    40534076 *      Returns NULL on errors. Use
    4054  *      winhFree to free the return value.
     4077 *      free() to free the return value.
    40554078 *
    40564079 *@@added V0.9.7 (2000-12-06) [umoeller]
     
    42854308 *      See WinEnumObjectClasses() for details.
    42864309 *
    4287  *      Returns NULL on error. Use winhFree()
     4310 *      Returns NULL on error. Use free()
    42884311 *      to free the return value.
    42894312 *
Note: See TracChangeset for help on using the changeset viewer.