mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 12:19:49 +00:00
Fix some confusion between number of bitmaps and number of buttons in
TOOLBAR_ReplaceBitmap().
This commit is contained in:
parent
4a8e33954e
commit
7f7cde0eee
1 changed files with 13 additions and 7 deletions
|
@ -3801,7 +3801,8 @@ TOOLBAR_PressButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME: there might still be some confusion her between number of buttons
|
||||||
|
* and number of bitmaps */
|
||||||
static LRESULT
|
static LRESULT
|
||||||
TOOLBAR_ReplaceBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
TOOLBAR_ReplaceBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
@ -3809,6 +3810,7 @@ TOOLBAR_ReplaceBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
LPTBREPLACEBITMAP lpReplace = (LPTBREPLACEBITMAP) lParam;
|
LPTBREPLACEBITMAP lpReplace = (LPTBREPLACEBITMAP) lParam;
|
||||||
HBITMAP hBitmap;
|
HBITMAP hBitmap;
|
||||||
int i = 0, nOldButtons = 0, pos = 0;
|
int i = 0, nOldButtons = 0, pos = 0;
|
||||||
|
int nOldBitmaps, nNewBitmaps;
|
||||||
HIMAGELIST himlDef = 0;
|
HIMAGELIST himlDef = 0;
|
||||||
|
|
||||||
TRACE("hInstOld %p nIDOld %x hInstNew %p nIDNew %x nButtons %x\n",
|
TRACE("hInstOld %p nIDOld %x hInstNew %p nIDNew %x nButtons %x\n",
|
||||||
|
@ -3852,16 +3854,14 @@ TOOLBAR_ReplaceBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
WARN("No hinst/bitmap found! hInst %p nID %x\n", lpReplace->hInstOld, lpReplace->nIDOld);
|
WARN("No hinst/bitmap found! hInst %p nID %x\n", lpReplace->hInstOld, lpReplace->nIDOld);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
infoPtr->nNumBitmaps = infoPtr->nNumBitmaps - nOldButtons + lpReplace->nButtons;
|
himlDef = GETDEFIMAGELIST(infoPtr, 0); /* fixme: correct? */
|
||||||
|
nOldBitmaps = ImageList_GetImageCount(himlDef);
|
||||||
|
|
||||||
/* ImageList_Replace(GETDEFIMAGELIST(), pos, hBitmap, NULL); */
|
/* ImageList_Replace(GETDEFIMAGELIST(), pos, hBitmap, NULL); */
|
||||||
|
|
||||||
|
for (i = pos + nOldBitmaps - 1; i >= pos; i--)
|
||||||
himlDef = GETDEFIMAGELIST(infoPtr, 0);
|
|
||||||
for (i = pos + nOldButtons - 1; i >= pos; i--) {
|
|
||||||
ImageList_Remove(himlDef, i);
|
ImageList_Remove(himlDef, i);
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
BITMAP bmp;
|
BITMAP bmp;
|
||||||
|
@ -3891,9 +3891,15 @@ TOOLBAR_ReplaceBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
DeleteDC (hdcBitmap);
|
DeleteDC (hdcBitmap);
|
||||||
|
|
||||||
ImageList_AddMasked (himlDef, hbmLoad, CLR_DEFAULT);
|
ImageList_AddMasked (himlDef, hbmLoad, CLR_DEFAULT);
|
||||||
|
nNewBitmaps = ImageList_GetImageCount(himlDef);
|
||||||
DeleteObject (hbmLoad);
|
DeleteObject (hbmLoad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
infoPtr->nNumBitmaps = infoPtr->nNumBitmaps - nOldBitmaps + nNewBitmaps;
|
||||||
|
|
||||||
|
TRACE(" pos %d %d old bitmaps replaced by %d new ones.\n",
|
||||||
|
pos, nOldBitmaps, nNewBitmaps);
|
||||||
|
|
||||||
InvalidateRect(hwnd, NULL, FALSE);
|
InvalidateRect(hwnd, NULL, FALSE);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
Loading…
Reference in a new issue