- Clean up the mask drawing code.
- Improve bitmap not found message.
This commit is contained in:
parent
f3b681a2ad
commit
5c5a0608e5
|
@ -407,7 +407,7 @@ TOOLBAR_GetImageListForDrawing (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, IMA
|
|||
|
||||
if (!TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) {
|
||||
if (btnPtr->iBitmap == I_IMAGENONE) return NULL;
|
||||
ERR("index %d,%d is not valid, max %d\n",
|
||||
ERR("bitmap for ID %d, index %d is not valid, number of bitmaps in imagelist: %d\n",
|
||||
HIWORD(btnPtr->iBitmap), LOWORD(btnPtr->iBitmap), infoPtr->nNumBitmaps);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -641,14 +641,7 @@ TOOLBAR_DrawPattern (LPRECT lpRect, NMTBCUSTOMDRAW *tbcd)
|
|||
}
|
||||
|
||||
|
||||
static void TOOLBAR_DrawMasked(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr,
|
||||
HDC hdc, INT x, INT y)
|
||||
{
|
||||
int index;
|
||||
HIMAGELIST himl =
|
||||
TOOLBAR_GetImageListForDrawing(infoPtr, btnPtr, IMAGE_LIST_DEFAULT, &index);
|
||||
|
||||
if (himl)
|
||||
static void TOOLBAR_DrawMasked(HIMAGELIST himl, int index, HDC hdc, INT x, INT y, UINT draw_flags)
|
||||
{
|
||||
INT cx, cy;
|
||||
HBITMAP hbmMask, hbmImage;
|
||||
|
@ -662,7 +655,7 @@ static void TOOLBAR_DrawMasked(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr,
|
|||
GetDeviceCaps(hdc,BITSPIXEL), NULL);
|
||||
SelectObject(hdcImage, hbmImage);
|
||||
ImageList_DrawEx(himl, index, hdcImage, 0, 0, cx, cy,
|
||||
RGB(0xff, 0xff, 0xff), RGB(0,0,0), ILD_NORMAL);
|
||||
RGB(0xff, 0xff, 0xff), RGB(0,0,0), draw_flags);
|
||||
|
||||
/* Create Mask */
|
||||
hdcMask = CreateCompatibleDC(0);
|
||||
|
@ -689,7 +682,6 @@ static void TOOLBAR_DrawMasked(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr,
|
|||
DeleteObject (hbmMask);
|
||||
DeleteDC(hdcMask);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static UINT
|
||||
|
@ -721,8 +713,11 @@ TOOLBAR_DrawImage(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, INT left, INT top
|
|||
{
|
||||
himl = TOOLBAR_GetImageListForDrawing(infoPtr, btnPtr, IMAGE_LIST_DISABLED, &index);
|
||||
if (!himl)
|
||||
{
|
||||
himl = TOOLBAR_GetImageListForDrawing(infoPtr, btnPtr, IMAGE_LIST_DEFAULT, &index);
|
||||
draw_masked = TRUE;
|
||||
}
|
||||
}
|
||||
else if ((tbcd->nmcd.uItemState & CDIS_HOT) && (infoPtr->dwStyle & TBSTYLE_FLAT))
|
||||
{
|
||||
/* if hot, attempt to draw with hot image list, if fails,
|
||||
|
@ -734,6 +729,9 @@ TOOLBAR_DrawImage(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, INT left, INT top
|
|||
else
|
||||
himl = TOOLBAR_GetImageListForDrawing(infoPtr, btnPtr, IMAGE_LIST_DEFAULT, &index);
|
||||
|
||||
if (!himl)
|
||||
return;
|
||||
|
||||
if (!(infoPtr->dwItemCDFlag & TBCDRF_NOOFFSET) &&
|
||||
(tbcd->nmcd.uItemState & (CDIS_SELECTED | CDIS_CHECKED)))
|
||||
offset = 1;
|
||||
|
@ -746,8 +744,8 @@ TOOLBAR_DrawImage(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, INT left, INT top
|
|||
index, himl, left, top, offset);
|
||||
|
||||
if (draw_masked)
|
||||
TOOLBAR_DrawMasked (infoPtr, btnPtr, tbcd->nmcd.hdc, left + offset, top + offset);
|
||||
else if (himl)
|
||||
TOOLBAR_DrawMasked (himl, index, tbcd->nmcd.hdc, left + offset, top + offset, draw_flags);
|
||||
else
|
||||
ImageList_Draw (himl, index, tbcd->nmcd.hdc, left + offset, top + offset, draw_flags);
|
||||
}
|
||||
|
||||
|
@ -5313,6 +5311,8 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|||
NMTOOLBARA nmtb;
|
||||
BOOL bDragKeyPressed;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (infoPtr->dwStyle & TBSTYLE_ALTDRAG)
|
||||
bDragKeyPressed = (GetKeyState(VK_MENU) < 0);
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue