Annotation of mstools/ole20/samples/bttncur/changes.txt, revision 1.1.1.1

1.1       root        1: Changes in BTTNCUR.DLL Source Code and Documentation from Version 1.00b
                      2: to Version 1.1.  See also below for 1.00 to 1.00b changes.
                      3: 
                      4: BTTNCUR.DLL version 1.1 is now fully compatible and tested under Windows
                      5: 3.0.  Previously the demo application crashed under Windows 3.0 on calls
                      6: to the non-existent MoveToEx (Win32 compatible).  Version 1.1 only
                      7: uses MoveToEx for builds where the symbol WINVER < 0x030a.
                      8: 
                      9: The images have been updated slightly and are now provided for 72dpi
                     10: (ega), 96dpi (vga), and 120dpi (super vga)
                     11: 
                     12: Version 1.1 completely handles system color changes unlike version 1.00x.
                     13: This new version will dynamically convert black, light gray, dark gray,
                     14: and white pixels in the image bitmap into system colors set for the
                     15: button text, button shadow, button face, and button highlight, respectively.
                     16: If you have blue, red, yellow, and green button colors, BTTNCUR.DLL will
                     17: now work perfectly with all of them.
                     18: 
                     19: BTTNCUR.DLL Version 1.1 also supports color images better by allowing
                     20: you to control which colors in the image bitmap are converted to system
                     21: colors.  By default, any black, gray, or white colors are converted
                     22: into system button colors as decribed in the last paragraph.  BTTNCUR.H
                     23: defines new PRESERVE_* flags for each of the four colors that are liable
                     24: to be converted.  By specifing one or more flags you prevent BTTNCUR
                     25: from changing that color to a system color.  For example, if you
                     26: want to preserve all black pixels in your image, specify PRESERVE_BLACK
                     27: when calling UIToolButtonDraw.
                     28: 
                     29: Applications should obtain configuration data for the current display
                     30: through UIToolConfigureForDisplay.  With this data the application can
                     31: configure itself for the correct toolbar size and button sizes and load
                     32: the appropriate application supplied bitmaps.
                     33: 
                     34: Applications using UIToolConfigureForDisplay should now use
                     35: UIToolButtonDrawTDD instead of UIToolButtonDraw, passing one extra
                     36: parameter, a pointer to the TOOLDISPLAYDATA.  Applications that
                     37: still call UIToolButtonDraw will always use 96dpi.
                     38: 
                     39: NOTE:  BTTNCUR.WRI has not been updated to reflect the new APIs.
                     40: 
                     41: 
                     42: ------------------------
                     43: BTTNCUR.H changes
                     44:     Added PRESERVE_ flags to allow application to control color conversions
                     45:     from black, dark gray, light gray, and white into the
                     46:     file compatible with C++.
                     47: 
                     48:     Added prototype for UIToolConfigureForDisplay, TOOLDISPLAYDATA structure,
                     49:     and definitions for button and image sizes on 72dpi, 96dpi, and 120dpi.
                     50: 
                     51: ------------------------
                     52: BTTNCUR.RCV version changes
                     53:     FILEVERSION and PRODUCTVERSION changed from 1,0,0,2 to 1,0,1,0
                     54: 
                     55:     VALUE "FileVersion" and VALUE "ProductVersion" changed from
                     56:         "1.00b\0","\0" to "1.1\0","\0"
                     57: 
                     58: 
                     59: ------------------------
                     60: BTTNCURI.H changes
                     61:     Defined STDCOLOR_* values as indices into an array in BTTNCUR.C
                     62:     that holds hard-coded default button color that never change
                     63:     regardless of the system colors.  Also defined SYSCOLOR_*
                     64:     flags that matched STDCOLOR_* flags for uniform array indices.
                     65: 
                     66:     Removed NEAR, FAR, and PASCAL from any function that didn't need it
                     67:     so we can port to Windows NT cleanly.
                     68: 
                     69: ------------------------
                     70: BTTNCUR.C source code changes.  There are significant modifications.
                     71: 
                     72: Overall:
                     73:     Updated header comment
                     74: 
                     75:     Removed NEAR, FAR, and PASCAL from any function that didn't need it
                     76:     so we can port to Windows NT cleanly.
                     77: 
                     78:     #define STRICT at top of file
                     79: 
                     80: Globals:
                     81:     Eliminated the COLORREFs prefixed with RGB.  Only a few are needed
                     82:     statically and were moved to HBrushDitherCreate.
                     83: 
                     84:     Also added an array of standard colors used in the standard images:
                     85: 
                     86:     static const
                     87:     COLORREF crStandard[4]={ RGB(0, 0, 0)         //STDCOLOR_BLACK
                     88:                            , RGB(128, 128, 128)   //STDCOLOR_DKGRAY
                     89:                            , RGB(192, 192, 192)   //STDCOLOR_LTGRAY
                     90:                            , RGB(255, 255, 255)}; //STDCOLOR_WHITE
                     91: 
                     92:     Added an array of standard images instead of just 96dpi versions.
                     93: 
                     94: UIToolConfigureForDisplay:
                     95:     Added function to return the resolution of the display and
                     96:     size information about button and image sizes.
                     97: 
                     98: 
                     99: ToolButtonInit():
                    100:     Call to CreatePatternBrush moved into HBrushDitherCreate.
                    101:     Conditionally sets the highlight color for HDitherBrushCreate
                    102:     depending on Windows 3.x or Windows 3.0 (3.0 did not support
                    103:     COLOR_BTNHIGHLIGHT).
                    104: 
                    105: 
                    106: ToolButtonFree():
                    107:     Removed some old debug output no longer useful.
                    108: 
                    109: 
                    110: HDitherBitmapCreate()
                    111:     Renamed to HBrushDitherCreate.
                    112:     Moved CreatePatterBrush code from ToolButtonInit into this
                    113:     function.
                    114: 
                    115:     To support changing system colors, this function maintains
                    116:     static variables for the face and highlight colors that we
                    117:     use to create the brush.  If the function is called and the
                    118:     current colors in the global hBrushDither are different than
                    119:     the system colors, we recreate the brush and update the global
                    120:     hBrushDither, deleting the old brush.  Otherwise we just return
                    121:     hBrushDither.
                    122: 
                    123:     Note that if we fail to create the new brush we just maintain
                    124:     the old.  We'll paint something, albeit not in the right colors,
                    125:     but something nontheless.
                    126: 
                    127: 
                    128: UIToolButtonDraw():
                    129:     Calls UIToolButtonDrawTDD with default display configuration.
                    130: 
                    131: UIToolButtonDrawTDD():
                    132:     This is the function that was overhauled the most, specifically
                    133:     to handle variable colors.
                    134: 
                    135:     First, we added several local variables of which two are important.
                    136:     crSys is an array of system colors for the text, shadow, face,
                    137:     highlight, and frame, declared as static to keep references to
                    138:     it off DS instead of SS; if it's in SS things will crash.  The second
                    139:     important variable is uColor, which receives the color preservation
                    140:     flags passed in the hibyte of the uState parameter to UIToolButtonDraw.
                    141: 
                    142:     All the code to draw a blank button outline was moved into a separate
                    143:     function DrawBlankButton.  Since this procedure needs all the system
                    144:     colors to do it's thing, I've set it up to take an array of five
                    145:     COLORREFs (exactly crSys) in which it stores those color (it also
                    146:     uses it as its color variables).  This way we only have to call
                    147:     GetSysColor once for each system color.
                    148: 
                    149:     Anything dealing with the dithered brush is moved to the
                    150:     BUTTONGROUP_LIGHTFACE case where we just get the current brush
                    151:     by calling HBrushDitherCreate, passing it the current face
                    152:     and highlight colors.  Remember that is these colors match those
                    153:     used in the currently held global hBrushDither, this function just
                    154:     returns that global, so it's quite fast.  We have to be very careful
                    155:     not to delete this brush where we're done with it since it is global.
                    156: 
                    157:     The largest amount of new code is under the line:
                    158: 
                    159:     if ((uState & BUTTONGROUP_ACTIVE) && !(uState & BUTTONGROUP_BLANK))
                    160: 
                    161:     This has changed from a single BitBlt call to a much more complex
                    162:     operation to handle specific color conversions and preservations.
                    163:     A little optimization was done to detect when the system colors
                    164:     for buttons match the defaults, that is, black, dark gray, light gray,
                    165:     and white for text, shadow, face, and highlight.  If these colors
                    166:     all match, or if the caller requested preservation of all colors,
                    167:     the we just do the single BitBlt of old.
                    168: 
                    169:     Otherwise we loop through each of the black/white/gray colors
                    170:     that need possible conversion.  For each one we create a mask
                    171:     that contains 1's where the converting color exists in the image
                    172:     and 0's everywhere else.  For each color then we BitBlt the
                    173:     mask, a brush matching the system color we're converting to,
                    174:     and the destination bitmap (which we initialize with the unmodified
                    175:     image itself) using ROP_DSPDxax.  This leaves any color but the
                    176:     one under conversion alone and replaces the converted color with
                    177:     the system color.
                    178: 
                    179:     If the caller set a specific flag to preserve one or more specific
                    180:     colors, then we replace the standard color with the standard color,
                    181:     resulting in a no-op.
                    182: 
                    183:     Finally, to reduce flicker for this four Blt operation we create
                    184:     and build the final image in a temporary bitmap, making it 6 total
                    185:     Blts to handle the color changes.  But since we optimized for the
                    186:     99% case where the system colors are the standard colors, this isn't
                    187:     too much of a consideration.
                    188: 
                    189:     color conversions.
                    190: 
                    191: 
                    192: DrawBlankButton():
                    193:     New internal function.  Moved code from UIToolButtonDraw here.
                    194: 
                    195: 
                    196: 
                    197: 
                    198: ------------------------
                    199: CURSORS.C
                    200:     Updated header comment
                    201:     #define STRICT at top of file
                    202: 
                    203:     Removed PASCAL on both internal functions.
                    204: 
                    205: 
                    206:     CursorsFree
                    207:         Eliminated all the code inside this function as it was unnecessary.
                    208: 
                    209:     UICursorLoad
                    210:         Eliminated code to revalidate a cursor in the array.  Unnecessary.
                    211: 
                    212: 
                    213: ------------------------
                    214: BCDEMO.C
                    215: 
                    216:     Tested for running under Windows 3.0 and avoided MoveToEx calls,
                    217:     using MoveTo instead.  Calling MoveToEx in a Windows 3.1 app
                    218:     marked as 3.0 compatible under 3.0 causes an unknown GP fault.
                    219: 
                    220:     Uses UIToolButtonConfigureForDisplay and UIToolButtonDrawTDD.
                    221: 
                    222: 
                    223: ------------------------
                    224: BTTNCUR.WRI
                    225:     Updated to document PRESERVE_ flags and new capabilities of the library
                    226:     with the exception of display configuration (no time).
                    227:     Corrected two typos.
                    228: 
                    229: 
                    230: 
                    231: ------------------------------------------------------------------------------
                    232: 
                    233: Changes in BTTNCUR.DLL Source Code and Documentation from Version 1.00
                    234: to Version 1.00b
                    235: 
                    236: ------------------------
                    237: BTTNCUR.H changes
                    238:     Added #ifdef __cplusplus to include extern "C" making the
                    239:     file compatible with C++.
                    240: 
                    241: 
                    242: ------------------------
                    243: BTTNCURI.H changes
                    244:     Added #ifdef __cplusplus to include extern "C" making the
                    245:     file compatible with C++.
                    246: 
                    247:     Removed code contained between a #ifdef NEVER that is unused.
                    248: 
                    249: 
                    250: ------------------------
                    251: BTTNCUR.RCV version changes
                    252:     FILEVERSION and PRODUCTVERSION changed from 1,0,0,0 to 1,0,0,2
                    253: 
                    254:     VALUE "FileVersion" and VALUE "ProductVersion" changed from
                    255:         "1.00\0","\0" to "1.00b\0","\0"
                    256: 
                    257: 
                    258: ------------------------
                    259: BTTNCUR.C source code changes.
                    260: 
                    261:     Added a global for the frame color
                    262:     static COLORREF rgbFrame   =RGB(0, 0, 0);
                    263: 
                    264: WEP():
                    265:     Added comment about resource cleanup messages in DEBUG mode.
                    266: 
                    267: 
                    268: ToolButtonInit():
                    269:     Added the line below just before the assignment of hDCGlyphs:
                    270: 
                    271:         rgbFrame=GetSysColor(COLOR_WINDOWFRAME);
                    272: 
                    273:     This insures that the frame color is properly shown on plasma
                    274:     displays.
                    275: 
                    276: 
                    277: ToolButtonFree():
                    278:     Added the following lines just before return:
                    279: 
                    280:         if (NULL!=hBmpStandardImages)
                    281:             DeleteObject(hBmpStandardImages);
                    282:         hBmpStandardImages=NULL;
                    283: 
                    284: 
                    285: UIToolButtonDraw():
                    286:     The image centering is one too high.  The line 
                    287: 
                    288:         yOffsetGlyph=((dy-bmy) >> 1)-1;
                    289: 
                    290:     now reads:
                    291:    
                    292:         yOffsetGlyph=(dy-bmy) >> 1;
                    293: 
                    294: 
                    295:     The declaration HBITMAP hBmp; now read HBITMAP hBmp=NULL;
                    296: 
                    297:     The line hBmpT=SelectObject(hDCGlyphs, hBmp); is now two:
                    298: 
                    299:         if (NULL!=hBmp)
                    300:             SelectObject(hDCGlyphs, hBmp);
                    301: 
                    302:     The line SelectObject(hDCGlyphs, hBmpT); is now two:
                    303: 
                    304:         if (NULL!=hBmpT)
                    305:             SelectObject(hDCGlyphs, hBmpT);
                    306: 
                    307: 
                    308: 
                    309: ------------------------
                    310: BTTNCUR.BMP
                    311:     Fixed the images to be 16*15 (the standard) instead of 16*16
                    312:     as they originally were.  Changed the label "16x16" to "16x15".
                    313: 
                    314:     Copied an image of the disabled state of Context-Sensitive Help
                    315:     to this bitmap as it was previously missing.
                    316: 
                    317: 
                    318: ------------------------
                    319: BTTNCUR.WRI
                    320:     Corrected a few typos.  Added comment about application termination
                    321:     and erroneous debug warnings.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.