Changeset 218


Ignore:
Timestamp:
Aug 31, 2002, 4:19:50 PM (23 years ago)
Author:
umoeller
Message:

Misc changes.

Location:
trunk
Files:
3 edited

Legend:

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

    r217 r218  
    320320    typedef WINHMERGEMENUS *PWINHMERGEMENUS;
    321321
     322    ULONG XWPENTRY winhClearMenu(HWND hwndMenu);
     323
    322324    PSZ XWPENTRY winhQueryMenuItemText(HWND hwndMenu,
    323325                                       USHORT usItemID);
     
    925927    #define FID_STATUSBAR           0x8100
    926928
     929    VOID winhCalcExtFrameRect(MPARAM mp1,
     930                              MPARAM mp2,
     931                              LONG lStatusBarHeight);
     932
    927933    /*
    928934     *@@ EXTFRAMECDATA:
     
    933939    typedef struct _EXTFRAMECDATA
    934940    {
    935         PSWP        pswpFrame;            // in: frame wnd pos
    936         ULONG       flFrameCreateFlags;  // in: FCF_* flags
    937         ULONG       flExtFlags;          // in: XFCF_* flags
    938         ULONG       ulFrameStyle;        // in: WS_* flags (e.g. WS_VISIBLE, WS_ANIMATE)
    939         const char  *pcszFrameTitle; // in: frame title (title bar)
    940         ULONG       ulResourcesID;       // in: according to FCF_* flags
    941         const char  *pcszClassClient; // in: client class name
    942         ULONG       flStyleClient;       // in: client style
    943         ULONG       ulID;                // in: frame window ID
    944         PVOID       pClientCtlData;      // in: pCtlData structure pointer for client
     941        PSWP        pswpFrame;          // in: frame wnd pos
     942        ULONG       flFrameCreateFlags; // in: FCF_* flags
     943        ULONG       flExtFlags;         // in: XFCF_* flags
     944        ULONG       ulFrameStyle;       // in: WS_* flags (e.g. WS_VISIBLE, WS_ANIMATE)
     945        const char  *pcszFrameTitle;    // in: frame title (title bar)
     946        ULONG       ulResourcesID;      // in: according to FCF_* flags
     947        const char  *pcszClassClient;   // in: client class name
     948        ULONG       flStyleClient;      // in: client style
     949        ULONG       ulID;               // in: frame window ID
     950        PVOID       pClientCtlData;     // in: pCtlData structure pointer for client
    945951    } EXTFRAMECDATA, *PEXTFRAMECDATA;
    946952
  • trunk/src/helpers/procstat.c

    r217 r218  
    558558 *
    559559 *@@added V0.9.2 (2000-03-05) [umoeller]
     560 *@@changed V0.9.21 (2002-08-16) [pr]: optimized
    560561 */
    561562
     
    566567    while (pProcThis && pProcThis->ulRecType == 1)
    567568    {
    568         int i;
    569569        PQTHREAD32  t = pProcThis->pThreads;
    570570        PQMODULE32  pModule;
     
    589589        // the next process block comes after the
    590590        // threads
    591         for (i=0;
    592              i < pProcThis->usThreadCount;
    593              i++,t++)
    594             ;
    595 
     591        t += pProcThis->usThreadCount;
    596592        pProcThis = (PQPROCESS32)t;
    597593    }
     
    607603 *
    608604 *@@added V0.9.21 (2002-08-12) [umoeller]
     605 *@@changed V0.9.21 (2002-08-16) [pr]: optimized
    609606 */
    610607
     
    615612    while (pProcThis && pProcThis->ulRecType == 1)
    616613    {
    617         int i;
    618614        PQTHREAD32  t = pProcThis->pThreads;
    619615
     
    624620        // the next process block comes after the
    625621        // threads
    626         for (i=0;
    627              i < pProcThis->usThreadCount;
    628              i++, t++)
    629             ;
    630 
     622        t += pProcThis->usThreadCount;
    631623        pProcThis = (PQPROCESS32)t;
    632624    }
  • trunk/src/helpers/winh.c

    r217 r218  
    283283ULONG winhQueryWindowStyle(HWND hwnd)
    284284{
    285     return (WinQueryWindowULong(hwnd, QWL_STYLE));
     285    return WinQueryWindowULong(hwnd, QWL_STYLE);
    286286}
    287287
     
    296296                       BOOL fEnable)
    297297{
    298     return (WinEnableWindow(WinWindowFromID(hwndDlg, id), fEnable));
     298    return WinEnableWindow(WinWindowFromID(hwndDlg, id), fEnable);
    299299}
    300300
     
    308308                          SHORT id)
    309309{
    310     return (WinIsWindowEnabled(WinWindowFromID(hwndDlg, id)));
     310    return WinIsWindowEnabled(WinWindowFromID(hwndDlg, id));
    311311}
    312312
     
    334334                       PMENUITEM pmi)           // out: MENUITEM data
    335335{
    336     return ((BOOL)WinSendMsg(hwndMenu,
    337                              MM_QUERYITEM,
    338                              MPFROM2SHORT(usItemID, fSearchSubmenus),
    339                              (MPARAM)pmi));
     336    return (BOOL)WinSendMsg(hwndMenu,
     337                            MM_QUERYITEM,
     338                            MPFROM2SHORT(usItemID, fSearchSubmenus),
     339                            (MPARAM)pmi);
    340340}
    341341
     
    427427{
    428428    MENUITEM mi;
    429     SHORT    src = MIT_ERROR;
    430429
    431430    mi.iPosition = iPosition;
     
    435434    mi.hwndSubMenu = 0;
    436435    mi.hItem = 0;
    437     src = SHORT1FROMMR(WinSendMsg(hwndMenu,
    438                                   MM_INSERTITEM,
    439                                   (MPARAM)&mi,
    440                                   (MPARAM)pcszItemTitle));
    441     return (src);
     436
     437    return SHORT1FROMMR(WinSendMsg(hwndMenu,
     438                                   MM_INSERTITEM,
     439                                   (MPARAM)&mi,
     440                                   (MPARAM)pcszItemTitle));
    442441}
    443442
     
    511510        }
    512511    }
    513     return (hwndNewMenu);
     512    return hwndNewMenu;
    514513}
    515514
     
    621620    mi.hItem = 0;
    622621
    623     return (SHORT1FROMMR(WinSendMsg(hMenu,
    624                                     MM_INSERTITEM,
    625                                     (MPARAM)&mi,
    626                                     (MPARAM)"")));
     622    return SHORT1FROMMR(WinSendMsg(hMenu,
     623                                   MM_INSERTITEM,
     624                                   (MPARAM)&mi,
     625                                   (MPARAM)""));
    627626}
    628627
     
    856855    }
    857856
    858     return (hwndNewSubmenu);
     857    return hwndNewSubmenu;
    859858}
    860859
     
    892891        SHORT id = SHORT1FROMMR(WinSendMsg(hmenuSource,
    893892                                           MM_ITEMIDFROMPOSITION,
    894                                            MPFROMSHORT(i),
     893                                           MPFROM2SHORT(i, 0),
    895894                                           0));
    896895        winhCopyMenuItem2(hmenuTarget,
     
    905904
    906905/*
     906 *@@ winhClearMenu:
     907 *      removes all menu items from the given (sub)menu.
     908 *      The menu itself is not destroyed, but is empty
     909 *      after calling this function.
     910 *
     911 *@@added V0.9.21 (2002-08-31) [umoeller]
     912 */
     913
     914ULONG winhClearMenu(HWND hwndMenu)
     915{
     916    ULONG   cDeleted = 0;
     917    SHORT   sID;
     918
     919    // what we do is getting the menu item count
     920    // and then delete the first item in the menu
     921    // x times because there is no "delete menu item
     922    // from position" message, and there might be
     923    // duplicate IDs in the menu... this should
     924    // work always
     925
     926    SHORT   cMenuItems = SHORT1FROMMR(WinSendMsg(hwndMenu,
     927                                                 MM_QUERYITEMCOUNT,
     928                                                 0,
     929                                                 0));
     930    while (cMenuItems-- > 0)
     931    {
     932        sID = (SHORT)WinSendMsg(hwndMenu,
     933                                MM_ITEMIDFROMPOSITION,
     934                                MPFROMSHORT(0),
     935                                MPNULL);
     936
     937        WinSendMsg(hwndMenu,
     938                   MM_DELETEITEM,
     939                   MPFROM2SHORT(sID, FALSE),
     940                   0);
     941
     942        ++cDeleted;
     943    }
     944
     945    return cDeleted;
     946}
     947
     948/*
    907949 *@@ winhQueryMenuItemText:
    908950 *      this returns a menu item text as a PSZ
     
    940982    }
    941983
    942     return (prc);
     984    return prc;
    943985}
    944986
     
    10361078                   (MPARAM)prtlItem);
    10371079        if (WinPtInRect(habDesktop, prtlItem, pptlMouse))
    1038             return (sItemId);
     1080            return sItemId;
    10391081    }
    10401082    /* sItemId = (SHORT)WinSendMsg(hwndMenu, MM_ITEMIDFROMPOSITION, (MPARAM)(sItemCount-1), MPNULL);
    10411083    return (sItemId); */
    1042     return (-1); // error: no valid menu item
     1084
     1085    return -1; // error: no valid menu item
    10431086}
    10441087
     
    12181261    }
    12191262
    1220     return (hwndSlider);
     1263    return hwndSlider;
    12211264}
    12221265
     
    14821525    }
    14831526
    1484     return (hwndSlider);
     1527    return hwndSlider;
    14851528}
    14861529
     
    16191662                   MPNULL);
    16201663    }
    1621     return (lValue);
     1664    return lValue;
    16221665}
    16231666
     
    16621705    }
    16631706
    1664     return (pszReturn);
     1707    return pszReturn;
    16651708}
    16661709
     
    17501793    }
    17511794
    1752     return (lItemCount);
     1795    return lItemCount;
    17531796}
    17541797
     
    17791822            if (ulHandle == winhQueryLboxItemHandle(hwndListBox,
    17801823                                                    ul))
    1781                 return (ul);
     1824                return ul;
    17821825        }
    17831826    }
    17841827
    1785     return (-1);
     1828    return -1;
    17861829}
    17871830
     
    21192162    // _Pmpf(("End of winhHandleScrollMsg"));
    21202163
    2121     return (TRUE);
     2164    return TRUE;
    21222165}
    21232166
     
    22742317    // _Pmpf(("End of  winhProcessScrollChars"));
    22752318
    2276     return (fProcessed);
     2319    return fProcessed;
    22772320}
    22782321
     
    27122755    ulReply = WinProcessDlg(hwndDlg);
    27132756    WinDestroyWindow(hwndDlg);
    2714     return (ulReply);
     2757    return ulReply;
    27152758}
    27162759
     
    28182861    }
    28192862
    2820     return (hwnd);
     2863    return hwnd;
    28212864}
    28222865
     
    28532896                      QPF_NOINHERIT);
    28542897    if (szNewFont[0] != 0)
    2855         return (strdup(szNewFont));
     2898        return strdup(szNewFont);
    28562899
    28572900    return NULL;
     
    28882931        strhncpy0(szFont, pcszFont, sizeof(szFont));
    28892932
    2890     return (WinSetPresParam(hwnd,
    2891                             PP_FONTNAMESIZE,
    2892                             strlen(szFont)+1,
    2893                             szFont));
     2933    return WinSetPresParam(hwnd,
     2934                           PP_FONTNAMESIZE,
     2935                           strlen(szFont)+1,
     2936                           szFont);
    28942937}
    28952938
     
    29282971    else
    29292972        strhncpy0(szFont, pcszFont, sizeof(szFont));
    2930     cbFont = strlen(szFont)+1;
     2973
     2974    cbFont = strlen(szFont) + 1;
    29312975
    29322976    // set font for all the dialog controls
     
    29462990    }
    29472991    WinEndEnumWindows(henum);
    2948     return (ulrc);
     2992
     2993    return ulrc;
    29492994}
    29502995
     
    31903235                      LONG lColor)
    31913236{
    3192     return (WinSetPresParam(hwnd,
    3193                             ulIndex,
    3194                             sizeof(LONG),
    3195                             &lColor));
     3237    return WinSetPresParam(hwnd,
     3238                           ulIndex,
     3239                           sizeof(LONG),
     3240                           &lColor);
    31963241}
    31973242
     
    32773322    }
    32783323
    3279     return (hwndHelp);
     3324    return hwndHelp;
    32803325}
    32813326
     
    32973342                           ULONG ulHelpPanel)       // in: help panel ID
    32983343{
    3299     return (ULONG)(WinSendMsg(hwndHelpInstance,
    3300                               HM_DISPLAY_HELP,
    3301                               (MPARAM)ulHelpPanel,
    3302                               (MPARAM)(    (ulHelpPanel != 0)
    3303                                            ? HM_RESOURCEID
    3304                                            : 0)));
     3344    return (ULONG)WinSendMsg(hwndHelpInstance,
     3345                             HM_DISPLAY_HELP,
     3346                             (MPARAM)ulHelpPanel,
     3347                             (MPARAM)(    (ulHelpPanel != 0)
     3348                                          ? HM_RESOURCEID
     3349                                          : 0));
    33053350}
    33063351
     
    33713416        // semapore created: this doesn't happen if the semaphore
    33723417        // exists already, so no other instance is running
    3373         return (FALSE);
     3418        return FALSE;
    33743419
    33753420    // else: instance running
     
    33993444    }
    34003445
    3401     return (TRUE);      // another instance exists
     3446    return TRUE;      // another instance exists
    34023447}
    34033448
     
    34383483                   NULL);
    34393484
    3440     return (hswitch);
     3485    return hswitch;
    34413486}
    34423487
     
    34813526    }
    34823527
    3483     return (hab);
     3528    return hab;
    34843529}
    34853530
     
    36763721        strcpy(pszFile, fd.szFullFile);
    36773722
    3678         return (TRUE);
    3679     }
    3680 
    3681     return (FALSE);
     3723        return TRUE;
     3724    }
     3725
     3726    return FALSE;
    36823727}
    36833728
     
    37003745                                     SPTR_WAIT,
    37013746                                     FALSE));   // no copy
    3702     return (hptr);
     3747    return hptr;
    37033748}
    37043749
     
    37243769                               pszText);
    37253770    }
    3726     return (pszText);
     3771    return pszText;
    37273772}
    37283773
     
    37493794    va_end(args);
    37503795
    3751     return (WinSetWindowText(hwnd,
    3752                              szBuf));
     3796    return WinSetWindowText(hwnd,
     3797                            szBuf);
    37533798}
    37543799
     
    38413886    }
    38423887    WinEndEnumWindows(henum1);
    3843     return (ulCount);
     3888
     3889    return ulCount;
    38443890}
    38453891
     
    39724018        }
    39734019    }
    3974     return (hwndFrame);
     4020
     4021    return hwndFrame;
    39754022}
    39764023
     
    39924039                            PVOID pvCreateParam)            // in: create param
    39934040{
    3994     return (WinCreateWindow(HWND_OBJECT,
    3995                             (PSZ)pcszWindowClass,
    3996                             (PSZ)"",
    3997                             0,
    3998                             0,0,0,0,
    3999                             0,
    4000                             HWND_BOTTOM,
    4001                             0,
    4002                             pvCreateParam,
    4003                             NULL));
     4041    return WinCreateWindow(HWND_OBJECT,
     4042                           (PSZ)pcszWindowClass,
     4043                           (PSZ)"",
     4044                           0,
     4045                           0,0,0,0,
     4046                           0,
     4047                           HWND_BOTTOM,
     4048                           0,
     4049                           pvCreateParam,
     4050                           NULL);
    40044051}
    40054052
     
    40964143    WinEndEnumWindows(henum);
    40974144
    4098     return (rc);
     4145    return rc;
    40994146}
    41004147
     
    42204267    background.rgb.bRed  = (CHAR3FROMMP(lDesktopColor));
    42214268
    4222     return (WinCreateWindow(HWND_DESKTOP,  // parent window
    4223                             WC_FRAME,      // class name
    4224                             "",            // window text
    4225                             WS_VISIBLE,    // window style
    4226                             0, 0,          // position and size
    4227                             WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN),
    4228                             WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN),
    4229                             NULLHANDLE,    // owner window
    4230                             hwndSibling,   // sibling window
    4231                             1,             // window id
    4232                             NULL,          // control data
    4233                             &background)); // presentation parms
     4269    return WinCreateWindow(HWND_DESKTOP,  // parent window
     4270                           WC_FRAME,      // class name
     4271                           "",            // window text
     4272                           WS_VISIBLE,    // window style
     4273                           0, 0,          // position and size
     4274                           WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN),
     4275                           WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN),
     4276                           NULLHANDLE,    // owner window
     4277                           hwndSibling,   // sibling window
     4278                           1,             // window id
     4279                           NULL,          // control data
     4280                           &background); // presentation parms
    42344281}
    42354282
     
    44524499    prcl->yTop = lOrigYTop;
    44534500
    4454     return (lLineCount);
     4501    return lLineCount;
    44554502}
    44564503
     
    44874534    }
    44884535
    4489     return (pSwBlock);
     4536    return pSwBlock;
    44904537}
    44914538
     
    45274574{
    45284575    SWBLOCK  swblock;
    4529     // HWND     hwndTasklist = winhQueryTasklistWindow();
     4576
    45304577    // the tasklist has entry #0 in the SWBLOCK
    45314578    WinQuerySwitchList(NULLHANDLE, &swblock, sizeof(SWBLOCK));
    4532     return (swblock.aswentry[0].swctl.hwnd);
     4579
     4580    return swblock.aswentry[0].swctl.hwnd;
    45334581}
    45344582
     
    46384686    } // end if Q level given
    46394687
    4640     return (ulTotalJobCount);
     4688    return ulTotalJobCount;
    46414689}
    46424690
     
    47604808
    47614809/*
     4810 *@@ winhCalcExtFrameRect:
     4811 *      implementation for WM_CALCFRAMERECT in fnwpSubclExtFrame.
     4812 *      This is exported so it can be used independently
     4813 *      (XWorkplace status bars).
     4814 *
     4815 *@@added V0.9.21 (2002-08-28) [umoeller]
     4816 */
     4817
     4818VOID winhCalcExtFrameRect(MPARAM mp1,
     4819                          MPARAM mp2,
     4820                          LONG lStatusBarHeight)
     4821{
     4822    PRECTL prclPassed = (PRECTL)mp1;
     4823
     4824    // mp2 == TRUE:  Frame rectangle provided, calculate client
     4825    // mp2 == FALSE: Client area rectangle provided, calculate frame
     4826    if (mp2)
     4827    {
     4828        //  TRUE: calculate the rectl of the client;
     4829        //  call default window procedure to subtract child frame
     4830        //  controls from the rectangle's height
     4831        LONG lClientHeight;
     4832
     4833        //  position the static text frame extension below the client
     4834        lClientHeight = prclPassed->yTop - prclPassed->yBottom;
     4835        if (lStatusBarHeight > lClientHeight)
     4836            // extension is taller than client, so set client height to 0
     4837            prclPassed->yTop = prclPassed->yBottom;
     4838        else
     4839        {
     4840            //  set the origin of the client and shrink it based upon the
     4841            //  static text control's height
     4842            prclPassed->yBottom += lStatusBarHeight;
     4843            prclPassed->yTop -= lStatusBarHeight;
     4844        }
     4845    }
     4846    else
     4847    {
     4848        //  FALSE: calculate the rectl of the frame;
     4849        //  call default window procedure to subtract child frame
     4850        //  controls from the rectangle's height;
     4851        //  set the origin of the frame and increase it based upon the
     4852        //  static text control's height
     4853        prclPassed->yBottom -= lStatusBarHeight;
     4854        prclPassed->yTop += lStatusBarHeight;
     4855    }
     4856}
     4857
     4858#define STATUS_BAR_HEIGHT       20
     4859
     4860/*
    47624861 *@@ fnwpSubclExtFrame:
    47634862 *      subclassed frame window proc.
     
    47984897            for (ul = 0; ul < ulCount; ul++)
    47994898            {
    4800                 if (WinQueryWindowUShort( swpArr[ul].hwnd, QWS_ID ) == 0x8008 )
     4899                if (WinQueryWindowUShort(swpArr[ul].hwnd, QWS_ID) == 0x8008)
    48014900                                                                 // FID_CLIENT
    48024901                {
    48034902                    POINTL      ptlBorderSizes;
    4804                     ULONG       ulStatusBarHeight = 20;
    48054903                    WinSendMsg(hwndFrame,
    48064904                               WM_QUERYBORDERSIZE,
     
    48174915                    swpArr[ulCount].y  = ptlBorderSizes.y;
    48184916                    swpArr[ulCount].cx = swpArr[ul].cx;  // same as cnr's width
    4819                     swpArr[ulCount].cy = ulStatusBarHeight;
     4917                    swpArr[ulCount].cy = STATUS_BAR_HEIGHT;
    48204918                    swpArr[ulCount].hwndInsertBehind = HWND_BOTTOM; // HWND_TOP;
    48214919                    swpArr[ulCount].hwnd = WinWindowFromID(hwndFrame, FID_STATUSBAR);
     
    48354933
    48364934        case WM_CALCFRAMERECT:
    4837         {
    48384935            mrc = pData->pfnwpOrig(hwndFrame, msg, mp1, mp2);
    48394936
    48404937            // we have a status bar: calculate its rectangle
    4841             // CalcFrameRect(mp1, mp2);
    4842         }
     4938            winhCalcExtFrameRect(mp1,
     4939                                 mp2,
     4940                                 STATUS_BAR_HEIGHT);
    48434941        break;
    48444942
     
    48764974    HWND        hwndReturn = NULLHANDLE;
    48774975    PPRESPARAMS ppp = NULL;
    4878     winhStorePresParam(&ppp, PP_FONTNAMESIZE, strlen(pcszFont)+1, (PVOID)pcszFont);
    4879     lColor = WinQuerySysColor(HWND_DESKTOP, SYSCLR_DIALOGBACKGROUND, 0);
    4880     winhStorePresParam(&ppp, PP_BACKGROUNDCOLOR, sizeof(lColor), &lColor);
     4976
     4977    winhStorePresParam(&ppp,
     4978                       PP_FONTNAMESIZE,
     4979                       strlen(pcszFont) + 1,
     4980                       (PVOID)pcszFont);
     4981
     4982    lColor = WinQuerySysColor(HWND_DESKTOP,
     4983                              SYSCLR_DIALOGBACKGROUND,
     4984                              0);
     4985    winhStorePresParam(&ppp,
     4986                       PP_BACKGROUNDCOLOR,
     4987                       sizeof(lColor),
     4988                       &lColor);
     4989
    48814990    lColor = CLR_BLACK;
    4882     winhStorePresParam(&ppp, PP_FOREGROUNDCOLOR, sizeof(lColor), &lColor);
     4991    winhStorePresParam(&ppp,
     4992                       PP_FOREGROUNDCOLOR,
     4993                       sizeof(lColor),
     4994                       &lColor);
     4995
    48834996    hwndReturn = WinCreateWindow(hwndFrame,
    48844997                                 WC_STATIC,
     
    48925005                                 ppp);
    48935006    free(ppp);
    4894     return (hwndReturn);
     5007
     5008    return hwndReturn;
    48955009}
    48965010
     
    49585072    }
    49595073
    4960     return (hwndFrame);
     5074    return hwndFrame;
    49615075}
    49625076
     
    50515165    } // end while (pocThis)
    50525166
    5053     return (pbReturn);
     5167    return pbReturn;
    50545168}
    50555169
     
    52155329        ulrc = 4;
    52165330
    5217     return (ulrc);
    5218 }
     5331    return ulrc;
     5332}
Note: See TracChangeset for help on using the changeset viewer.