Changeset 195


Ignore:
Timestamp:
Aug 5, 2002, 8:57:15 PM (23 years ago)
Author:
umoeller
Message:

Misc fixes.

Location:
trunk
Files:
7 edited

Legend:

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

    r188 r195  
    403403            id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
    404404
     405    #define CONTROLDEF_CONTAINER_EXTSEL(id, cx, cy) { WC_CONTAINER, NULL, \
     406            WS_VISIBLE | WS_TABSTOP | CCS_EXTENDSEL, \
     407            id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
     408
    405409    // the following require INCL_WINSTDSLIDER
    406410
  • trunk/include/helpers/gpih.h

    r190 r195  
    349349                                  ULONG ulIconSize); */
    350350
    351     BOOL gpihDrawPointer(HPS hps,
    352                          LONG x,
    353                          LONG y,
    354                          HPOINTER hptr,
    355                          PSIZEL pszlIcon,
    356                          PRECTL prclClip,
    357                          ULONG fl);
     351    BOOL XWPENTRY gpihDrawPointer(HPS hps,
     352                                  LONG x,
     353                                  LONG y,
     354                                  HPOINTER hptr,
     355                                  PSIZEL pszlIcon,
     356                                  PRECTL prclClip,
     357                                  ULONG fl);
     358    typedef BOOL XWPENTRY GPIHDRAWPOINTER(HPS hps,
     359                                          LONG x,
     360                                          LONG y,
     361                                          HPOINTER hptr,
     362                                          PSIZEL pszlIcon,
     363                                          PRECTL prclClip,
     364                                          ULONG fl);
     365    typedef GPIHDRAWPOINTER *PGPIHDRAWPOINTER;
    358366
    359367    /* ******************************************************************
  • trunk/include/helpers/winh.h

    r166 r195  
    715715    typedef WINHQUERYPRESCOLOR *PWINHQUERYPRESCOLOR;
    716716
     717    LONG XWPENTRY winhQueryPresColor2(HWND hwnd,
     718                                      ULONG ulppRGB,
     719                                      ULONG ulppIndex,
     720                                      BOOL fInherit,
     721                                      LONG lSysColor);
     722
    717723    BOOL XWPENTRY winhSetPresColor(HWND hwnd, ULONG ulIndex, LONG lColor);
    718724
  • trunk/src/helpers/comctl.c

    r184 r195  
    136136 *@@changed V0.9.16 (2001-10-24) [umoeller]: fixed wrong hatch color and paint offset
    137137 *@@changed V0.9.16 (2001-10-28) [umoeller]: added bitmap support, fixed bad clip rectangle
     138 *@@changed V0.9.20 (2002-08-04) [umoeller]: fixed button offset, depressed color
    138139 */
    139140
     
    147148            ulOfs = 0;
    148149    LONG    lLeft,
    149             lRight;
     150            lRight,
     151            lColorMiddle = pxbd->lMiddle;
    150152    RECTL   rclWin;
     153
    151154    memcpy(&rclWin, &pxbd->rcl, sizeof(RECTL));
    152155
     
    165168        if (ulBorder == 0)
    166169            ulBorder = 1;
     170
     171        // make the depressed color darker
     172        // V0.9.20 (2002-07-31) [umoeller]
     173        gpihManipulateRGB(&lColorMiddle,
     174                          .95);
    167175    }
    168176    else
     
    196204        WinFillRect(hps,
    197205                    &rclWin,        // exclusive
    198                     pxbd->lMiddle);
     206                    lColorMiddle);
    199207
    200208    // get icon
     
    254262            WinDrawPointer(hps,
    255263                           // center this in remaining rectl
    256                            ptl.x + ulOfs,
    257                            ptl.y - ulOfs,
     264                           ptl.x, // + ulOfs,
     265                           ptl.y, // - ulOfs,
    258266                           pxbd->hptr,
    259267                           DP_MINI);
  • trunk/src/helpers/gpih.c

    r191 r195  
    25072507 *      replacement for WinDrawPointer that can do clipping.
    25082508 *
    2509  *      To do clipping with WinDrawPointer, one has to
    2510  *      alter the clip rectangle for the current HPS,
    2511  *      which involves creating regions and is thus quite
    2512  *      some overhead.
    2513  *
    2514  *      Instead, this function  allows for specifying a clip
    2515  *      rectangle directly. Besides, since it uses GpiWCBitBlt,
    2516  *      it should probably work with all types of device contexts.
     2509 *      Normally, to do clipping with WinDrawPointer, one
     2510 *      would have to alter the clip rectangle for the current
     2511 *      HPS, which requires creating regions and is thus quite
     2512 *      expensive.
     2513 *
     2514 *      Instead, this function allows for specifying a clip
     2515 *      rectangle directly. It blits the icon bitmaps directly
     2516 *      without calling WinDrawPointer.
     2517 *      Besides, since it uses GpiWCBitBlt, it should probably
     2518 *      work with all types of device contexts.
    25172519 *
    25182520 *      This also replaces gpihIcon2Bitmap, which wasn't quite
     
    25222524 *      If you don't need clipping and are drawing to the
    25232525 *      screen only, this function has no advantage over
    2524  *      WinDrawPointer because it's presumably slower.
     2526 *      WinDrawPointer because it's presumably a bit slower.
    25252527 *
    25262528 *      Flags presently supported in fl:
     
    25282530 *      --  DP_MINI (not DP_MINIICON, as stated in PMREF):
    25292531 *          use mini-icon.
     2532 *
     2533 *      --  DP_HALFTONED (V0.9.20)
    25302534 *
    25312535 *      Preconditions:
     
    25402544 *
    25412545 *@@added V0.9.19 (2002-06-18) [umoeller]
     2546 *@@changed V0.9.20 (2002-07-31) [umoeller]: optimized, saved one GpiQueryBitmapInfoHeader
     2547 *@@changed V0.9.20 (2002-08-04) [umoeller]: added DP_HALFTONED
    25422548 */
    25432549
     
    25592565        POINTL  aptl[4];
    25602566        HBITMAP hbmThis;
    2561         BITMAPINFOHEADER2 bmi;
     2567        BITMAPINFOHEADER2 bmiAndXor,
     2568                          bmiColor;
    25622569
    25632570        // A HPOINTER really consists of two bitmaps,
     
    26452652            GpiSetBackColor(hps, RGBCOL_BLACK);
    26462653
     2654            if (fl & DP_HALFTONED) // V0.9.20 (2002-08-04) [umoeller]
     2655                GpiSetPattern(hps, PATSYM_HALFTONE);
     2656
    26472657            /*
    26482658             * 1)   work on the AND image
     
    26562666               )
    26572667            {
    2658                 bmi.cbFix = sizeof(bmi);
    2659                 GpiQueryBitmapInfoHeader(hbmThis, &bmi);
     2668                bmiAndXor.cbFix = sizeof(bmiAndXor);
     2669                GpiQueryBitmapInfoHeader(hbmThis, &bmiAndXor);
    26602670
    26612671                // use only half the bitmap height
    2662                 cySrc = bmi.cy / 2;
     2672                cySrc = bmiAndXor.cy / 2;
    26632673
    26642674                // aptl[2]: source bottom-left
    26652675                aptl[2].x =   0
    2666                             + lClipLeft   * bmi.cx / cxIcon;
     2676                            + lClipLeft   * bmiAndXor.cx / cxIcon;
    26672677                aptl[2].y =   cySrc
    26682678                            + lClipBottom * cySrc / cyIcon;
    26692679
    26702680                // aptl[3]: source top-right (exclusive!)
    2671                 aptl[3].x =   bmi.cx
    2672                             - lClipRight  * bmi.cx / cxIcon;
    2673                 aptl[3].y =   bmi.cy
     2681                aptl[3].x =   bmiAndXor.cx
     2682                            - lClipRight  * bmiAndXor.cx / cxIcon;
     2683                aptl[3].y =   bmiAndXor.cy
    26742684                            - lClipTop    * cySrc / cyIcon;
    26752685
     
    26932703               )
    26942704            {
    2695                 bmi.cbFix = sizeof(bmi);
    2696                 GpiQueryBitmapInfoHeader(hbmThis, &bmi);
     2705                bmiColor.cbFix = sizeof(bmiColor);
     2706                GpiQueryBitmapInfoHeader(hbmThis, &bmiColor);
    26972707
    26982708                // aptl[2]: source bottom-left
    26992709                aptl[2].x =   0
    2700                             + lClipLeft   * bmi.cx / cxIcon;
     2710                            + lClipLeft   * bmiColor.cx / cxIcon;
    27012711                aptl[2].y =   0
    2702                             + lClipBottom * bmi.cy / cyIcon;
     2712                            + lClipBottom * bmiColor.cy / cyIcon;
    27032713
    27042714                // aptl[3]: source top-right (exclusive!)
    2705                 aptl[3].x =   bmi.cx
    2706                             - lClipRight  * bmi.cx / cxIcon;
    2707                 aptl[3].y =   bmi.cy
    2708                             - lClipTop    * bmi.cy / cyIcon;
     2715                aptl[3].x =   bmiColor.cx
     2716                            - lClipRight  * bmiColor.cx / cxIcon;
     2717                aptl[3].y =   bmiColor.cy
     2718                            - lClipTop    * bmiColor.cy / cyIcon;
    27092719
    27102720                GpiWCBitBlt(hps,        // target
     
    27272737               )
    27282738            {
    2729                 bmi.cbFix = sizeof(bmi);
    2730                 GpiQueryBitmapInfoHeader(hbmThis, &bmi);
     2739                /*  we queried this one above V0.9.20 (2002-07-31) [umoeller]
     2740                bmiAndXor.cbFix = sizeof(bmiAndXor);
     2741                GpiQueryBitmapInfoHeader(hbmThis, &bmiAndXor);
     2742                */
    27312743
    27322744                // use only half the bitmap height
    2733                 cySrc = bmi.cy / 2;
     2745                cySrc = bmiAndXor.cy / 2;
    27342746
    27352747                // aptl[2]: source bottom-left
    27362748                aptl[2].x =   0
    2737                             + lClipLeft   * bmi.cx / cxIcon;
     2749                            + lClipLeft   * bmiAndXor.cx / cxIcon;
    27382750                aptl[2].y =   0
    27392751                            + lClipBottom * cySrc / cyIcon;
    27402752
    27412753                // aptl[3]: source top-right (exclusive!)
    2742                 aptl[3].x =   bmi.cx
    2743                             - lClipRight  * bmi.cx / cxIcon;
     2754                aptl[3].x =   bmiAndXor.cx
     2755                            - lClipRight  * bmiAndXor.cx / cxIcon;
    27442756                aptl[3].y =   cySrc
    27452757                            - lClipTop    * cySrc / cyIcon;
  • trunk/src/helpers/winh.c

    r169 r195  
    28882888
    28892889/*
    2890  *@@ winhQueryPresColor:
     2890 *@@ winhQueryPresColor2:
    28912891 *      returns the specified color. This is queried in the
    28922892 *      following order:
     
    29662966 *@@changed V0.9.0 [umoeller]: added fInherit parameter
    29672967 *@@changed V0.9.7 (2000-12-02) [umoeller]: added lSysColor == -1 support
    2968  */
    2969 
    2970 LONG winhQueryPresColor(HWND    hwnd,       // in: window to query
    2971                         ULONG   ulPP,       // in: PP_* index
    2972                         BOOL    fInherit,   // in: search parent windows too?
    2973                         LONG    lSysColor)  // in: SYSCLR_* index or -1
     2968 *@@changed V0.9.20 (2002-08-04) [umoeller]: added ulPPIndex, renamed func
     2969 */
     2970
     2971LONG winhQueryPresColor2(HWND hwnd,          // in: window to query
     2972                         ULONG ulppRGB,      // in: PP_* index for RGB color
     2973                         ULONG ulppIndex,    // in: PP_* index for color _index_ (can be null)
     2974                         BOOL fInherit,      // in: search parent windows too?
     2975                         LONG lSysColor)     // in: SYSCLR_* index or -1
    29742976{
    29752977    ULONG   ul,
    2976             attrFound,
    2977             abValue[32];
    2978 
    2979     if (ulPP != (ULONG)-1)
     2978            attrFound;
     2979    LONG    lColorFound;
     2980
     2981    if (ulppRGB != (ULONG)-1)
     2982    {
     2983        ULONG fl = 0;
     2984        if (!fInherit)
     2985            fl = QPF_NOINHERIT;
     2986        if (ulppIndex)
     2987            fl |= QPF_ID2COLORINDEX;            // convert indexed color 2 to RGB V0.9.20 (2002-08-04) [umoeller]
     2988
    29802989        if ((ul = WinQueryPresParam(hwnd,
    2981                                     ulPP,
    2982                                     0,
     2990                                    ulppRGB,
     2991                                    ulppIndex,
    29832992                                    &attrFound,
    2984                                     (ULONG)sizeof(abValue),
    2985                                     (PVOID)&abValue,
    2986                                     (fInherit)
    2987                                          ? 0
    2988                                          : QPF_NOINHERIT)))
    2989             return (abValue[0]);
     2993                                    sizeof(lColorFound),
     2994                                    &lColorFound,
     2995                                    fl)))
     2996            return lColorFound;
     2997    }
    29902998
    29912999    // not found: get system color
    29923000    if (lSysColor != -1)
    2993         return (WinQuerySysColor(HWND_DESKTOP, lSysColor, 0));
     3001        return WinQuerySysColor(HWND_DESKTOP, lSysColor, 0);
    29943002
    29953003    return -1;
     3004}
     3005
     3006/*
     3007 *@@ winhQueryPresColor:
     3008 *      compatibility function because this one was
     3009 *      exported.
     3010 *
     3011 *@@added V0.9.20 (2002-08-04) [umoeller]
     3012 */
     3013
     3014LONG XWPENTRY winhQueryPresColor(HWND hwnd,
     3015                                 ULONG ulPP,
     3016                                 BOOL fInherit,
     3017                                 LONG lSysColor)
     3018{
     3019    return winhQueryPresColor2(hwnd,
     3020                               ulPP,
     3021                               0,
     3022                               fInherit,
     3023                               lSysColor);
    29963024}
    29973025
     
    33393367VOID winhSleep(ULONG ulSleep)    // in: sleep time in milliseconds
    33403368{
    3341     HWND hwnd;
     3369    HWND    hwnd;
     3370
    33423371    if (hwnd = winhCreateObjectWindow(WC_STATIC, NULL))
    33433372    {
    3344         QMSG qmsg;
    3345         HAB hab = WinQueryAnchorBlock(hwnd);
    3346         if (WinStartTimer(hab,
    3347                           hwnd,
    3348                           1,
    3349                           ulSleep))
     3373        QMSG    qmsg;
     3374        HAB     hab;
     3375
     3376        if (    (hab = WinQueryAnchorBlock(hwnd))
     3377             && (WinStartTimer(hab,
     3378                               hwnd,
     3379                               1,
     3380                               ulSleep))
     3381           )
    33503382        {
    33513383            while (WinGetMsg(hab, &qmsg, NULLHANDLE, 0, 0))
  • trunk/src/helpers/wphandle.c

    r180 r195  
    116116    }
    117117
    118     return (ERROR_WPH_NO_ACTIVEHANDLES_DATA);
     118    return ERROR_WPH_NO_ACTIVEHANDLES_DATA;
    119119}
    120120
Note: See TracChangeset for help on using the changeset viewer.