Ignore:
Timestamp:
Oct 18, 2001, 11:06:02 PM (24 years ago)
Author:
umoeller
Message:

misc changes

File:
1 edited

Legend:

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

    r91 r111  
    677677 *@@changed V0.9.0 [umoeller]: exported gpihIcon2Bitmap function to gpih.c
    678678 *@@changed V0.9.0 [umoeller]: fixed paint errors when SM_SETHANDLE had NULL argument in mp1
     679 *@@changed V0.9.16 (2001-10-15) [umoeller]: now centering icon in static properly
     680 *@@changed V0.9.16 (2001-10-15) [umoeller]: this always used the presparam colors of the parent instead of its own ones
    679681 */
    680682
     
    683685    PANIMATIONDATA pa = (PANIMATIONDATA)WinQueryWindowULong(hwndStatic, QWL_USER);
    684686                // animation data which was stored in window words
     687
    685688    PFNWP   OldStaticProc = NULL;
    686689    MRESULT mrc = NULL;
     
    726729
    727730                LONG lBkgndColor
    728                     = winhQueryPresColor(WinQueryWindow(hwndStatic, QW_PARENT),
     731                    /* = winhQueryPresColor(WinQueryWindow(hwndStatic, QW_PARENT),
    729732                                         PP_BACKGROUNDCOLOR,
    730733                                         FALSE,
     734                                         SYSCLR_DIALOGBACKGROUND); */
     735                    // fixed this... V0.9.16 (2001-10-15) [umoeller]
     736                    = winhQueryPresColor(hwndStatic,
     737                                         PP_BACKGROUNDCOLOR,
     738                                         TRUE,
    731739                                         SYSCLR_DIALOGBACKGROUND);
    732740
     
    792800
    793801                                if (pa->hptr)
     802                                {
     803                                    // center the icon in the bitmap
     804                                    // V0.9.16 (2001-10-15) [umoeller]
     805                                    POINTL ptlOfs;
     806                                    ptlOfs.x = (   (pa->rclIcon.xRight - pa->rclIcon.xLeft)
     807                                                 - pa->lIconSize
     808                                               ) / 2;
     809                                    ptlOfs.y = (   (pa->rclIcon.yTop - pa->rclIcon.yBottom)
     810                                                 - pa->lIconSize
     811                                               ) / 2;
     812
    794813                                    // paint icon into bitmap
    795814                                    gpihIcon2Bitmap(hpsMem,
    796815                                                    pa->hptr,
    797816                                                    lBkgndColor,
    798                                                     WinQuerySysValue(HWND_DESKTOP, SV_CXICON));
     817                                                    &ptlOfs,
     818                                                    pa->lIconSize);
     819                                }
    799820
    800821                            } // end if (pa->ulFlags & ANF_ICON)
     
    933954
    934955/*
     956 *@@ CreateAnimationData:
     957 *
     958 *@@added V0.9.16 (2001-10-15) [umoeller]
     959 */
     960
     961PANIMATIONDATA CreateAnimationData(HWND hwndStatic,
     962                                   USHORT cAnimations)
     963{
     964    PANIMATIONDATA pa = NULL;
     965
     966    if (cAnimations >= 1)
     967    {
     968        // create the ANIMATIONDATA structure,
     969        // initialize some fields,
     970        // and store it in QWL_USER of the static control
     971        ULONG   cbStruct =   sizeof(ANIMATIONDATA)
     972                           + ((cAnimations - 1) * sizeof(HPOINTER));
     973
     974        if (pa = (PANIMATIONDATA)malloc(cbStruct))
     975        {
     976            memset(pa, 0, cbStruct);
     977
     978            WinSetWindowULong(hwndStatic, QWL_USER, (ULONG)pa);
     979
     980            pa->hab = WinQueryAnchorBlock(hwndStatic);
     981            WinQueryWindowRect(hwndStatic, &pa->rclIcon);
     982            pa->OldStaticProc = WinSubclassWindow(hwndStatic, ctl_fnwpBitmapStatic);
     983            pa->lIconSize = WinQuerySysValue(HWND_DESKTOP, SV_CXICON);
     984        }
     985    }
     986
     987    return (pa);
     988}
     989
     990/*
    935991 *@@ ctlPrepareStaticIcon:
    936992 *      turns a static control into one which properly
     
    9711027                                                        // this must be at least 1
    9721028{
    973     PANIMATIONDATA pa = NULL;
    974     PFNWP OldStaticProc = WinSubclassWindow(hwndStatic, ctl_fnwpBitmapStatic);
    975     if (OldStaticProc)
     1029    PANIMATIONDATA pa;
     1030
     1031    if (pa = CreateAnimationData(hwndStatic,
     1032                                 usAnimCount))
    9761033    {
    977         // create the ANIMATIONDATA structure,
    978         // initialize some fields,
    979         // and store it in QWL_USER of the static control
    980         ULONG   cbStruct =   sizeof(ANIMATIONDATA)
    981                            + ((usAnimCount-1) * sizeof(HPOINTER));
    982         pa = (PANIMATIONDATA)malloc(cbStruct);
    983         memset(pa, 0, cbStruct);
    984 
    9851034        // switch static to icon mode
    9861035        pa->ulFlags = ANF_ICON;
    987         pa->OldStaticProc = OldStaticProc;
    988         WinQueryWindowRect(hwndStatic, &(pa->rclIcon));
    989         pa->hab = WinQueryAnchorBlock(hwndStatic);
    990 
    991         WinSetWindowULong(hwndStatic, QWL_USER, (ULONG)pa);
    9921036    }
     1037
    9931038    return (pa);
    9941039}
     
    10571102        paNew->usAniCurrent = 0;
    10581103        paNew->usAniCount = usAnimCount;
    1059         memcpy(&(paNew->ahptrAniIcons), pahptr,
    1060                         (usAnimCount * sizeof(HPOINTER)));
    1061 
    1062         if (fStartAnimation) {
     1104        memcpy(&paNew->ahptrAniIcons,
     1105               pahptr,
     1106               (usAnimCount * sizeof(HPOINTER)));
     1107
     1108        if (fStartAnimation)
     1109        {
    10631110            WinStartTimer(WinQueryAnchorBlock(hwndStatic), hwndStatic,
    10641111                    1, ulDelay);
     
    11551202 *
    11561203 *@@added V0.9.0 [umoeller]
     1204 *@@changed V0.9.16 (2001-10-15) [umoeller]: some cleanup
    11571205 */
    11581206
     
    11601208                                         BOOL fPreserveProportions)
    11611209{
    1162     PANIMATIONDATA pa = NULL;
    1163     PFNWP OldStaticProc = WinSubclassWindow(hwndStatic, ctl_fnwpBitmapStatic);
    1164     if (OldStaticProc)
     1210    PANIMATIONDATA pa;
     1211
     1212    if (pa = CreateAnimationData(hwndStatic, 1))
    11651213    {
    1166         // create the ANIMATIONDATA structure,
    1167         // initialize some fields,
    1168         // and store it in QWL_USER of the static control
    1169         ULONG   cbStruct =   sizeof(ANIMATIONDATA);
    1170         pa = (PANIMATIONDATA)malloc(cbStruct);
    1171         memset(pa, 0, cbStruct);
    1172 
    11731214        // switch static to bitmap mode
    11741215        pa->ulFlags = ANF_BITMAP;
    11751216        if (fPreserveProportions)
    11761217            pa->ulFlags |= ANF_PROPORTIONAL;
    1177 
    1178         pa->OldStaticProc = OldStaticProc;
    1179         WinQueryWindowRect(hwndStatic, &(pa->rclIcon));
    1180         pa->hab = WinQueryAnchorBlock(hwndStatic);
    1181 
    1182         WinSetWindowULong(hwndStatic, QWL_USER, (ULONG)pa);
    11831218    }
     1219
    11841220    return (pa);
    11851221}
Note: See TracChangeset for help on using the changeset viewer.