diff --git a/reactos/dll/win32/comctl32/animate.c b/reactos/dll/win32/comctl32/animate.c
index 5e3ffb1570c..a567cb34858 100644
--- a/reactos/dll/win32/comctl32/animate.c
+++ b/reactos/dll/win32/comctl32/animate.c
@@ -85,7 +85,7 @@ typedef struct
int nToFrame;
int nLoop;
int currFrame;
- /* tranparency info*/
+ /* transparency info*/
COLORREF transparentColor;
HBRUSH hbrushBG;
HBITMAP hbmPrevFrame;
@@ -95,7 +95,7 @@ typedef struct
static void ANIMATE_Notify(const ANIMATE_INFO *infoPtr, UINT notif)
{
- SendMessageW(infoPtr->hwndNotify, WM_COMMAND,
+ PostMessageW(infoPtr->hwndNotify, WM_COMMAND,
MAKEWPARAM(GetDlgCtrlID(infoPtr->hwndSelf), notif),
(LPARAM)infoPtr->hwndSelf);
}
@@ -145,6 +145,8 @@ static BOOL ANIMATE_LoadFileW(ANIMATE_INFO *infoPtr, LPWSTR lpName)
static BOOL ANIMATE_DoStop(ANIMATE_INFO *infoPtr)
{
+ BOOL stopped = FALSE;
+
EnterCriticalSection(&infoPtr->cs);
/* should stop playing */
@@ -167,15 +169,18 @@ static BOOL ANIMATE_DoStop(ANIMATE_INFO *infoPtr)
CloseHandle( handle );
CloseHandle( infoPtr->hStopEvent );
infoPtr->hStopEvent = 0;
+ stopped = TRUE;
}
if (infoPtr->uTimer) {
KillTimer(infoPtr->hwndSelf, infoPtr->uTimer);
infoPtr->uTimer = 0;
+ stopped = TRUE;
}
LeaveCriticalSection(&infoPtr->cs);
- ANIMATE_Notify(infoPtr, ACN_STOP);
+ if (stopped)
+ ANIMATE_Notify(infoPtr, ACN_STOP);
return TRUE;
}
@@ -340,10 +345,8 @@ static BOOL ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
return TRUE;
}
-static BOOL ANIMATE_DrawFrame(ANIMATE_INFO *infoPtr)
+static BOOL ANIMATE_DrawFrame(ANIMATE_INFO *infoPtr, HDC hDC)
{
- HDC hDC;
-
TRACE("Drawing frame %d (loop %d)\n", infoPtr->currFrame, infoPtr->nLoop);
mmioSeek(infoPtr->hMMio, infoPtr->lpIndex[infoPtr->currFrame], SEEK_SET);
@@ -356,10 +359,7 @@ static BOOL ANIMATE_DrawFrame(ANIMATE_INFO *infoPtr)
return FALSE;
}
- if ((hDC = GetDC(infoPtr->hwndSelf)) != 0) {
- ANIMATE_PaintFrame(infoPtr, hDC);
- ReleaseDC(infoPtr->hwndSelf, hDC);
- }
+ ANIMATE_PaintFrame(infoPtr, hDC);
if (infoPtr->currFrame++ >= infoPtr->nToFrame) {
infoPtr->currFrame = infoPtr->nFromFrame;
@@ -375,14 +375,16 @@ static BOOL ANIMATE_DrawFrame(ANIMATE_INFO *infoPtr)
static LRESULT ANIMATE_Timer(ANIMATE_INFO *infoPtr)
{
- /* FIXME: we should pass the hDC instead of 0 to WM_CTLCOLORSTATIC */
- if (infoPtr->dwStyle & ACS_TRANSPARENT)
- infoPtr->hbrushBG = (HBRUSH)SendMessageW(infoPtr->hwndNotify,
- WM_CTLCOLORSTATIC,
- 0, (LPARAM)infoPtr->hwndSelf);
- EnterCriticalSection(&infoPtr->cs);
- ANIMATE_DrawFrame(infoPtr);
- LeaveCriticalSection(&infoPtr->cs);
+ HDC hDC;
+
+ if ((hDC = GetDC(infoPtr->hwndSelf)) != 0)
+ {
+ EnterCriticalSection(&infoPtr->cs);
+ ANIMATE_DrawFrame(infoPtr, hDC);
+ LeaveCriticalSection(&infoPtr->cs);
+
+ ReleaseDC(infoPtr->hwndSelf, hDC);
+ }
return 0;
}
@@ -395,12 +397,16 @@ static DWORD CALLBACK ANIMATE_AnimationThread(LPVOID ptr_)
while(1)
{
+ HDC hDC = GetDC(infoPtr->hwndSelf);
+
EnterCriticalSection(&infoPtr->cs);
- ANIMATE_DrawFrame(infoPtr);
+ ANIMATE_DrawFrame(infoPtr, hDC);
timeout = infoPtr->mah.dwMicroSecPerFrame;
event = infoPtr->hStopEvent;
LeaveCriticalSection(&infoPtr->cs);
+ ReleaseDC(infoPtr->hwndSelf, hDC);
+
/* time is in microseconds, we should convert it to milliseconds */
if ((event == 0) || WaitForSingleObject( event, (timeout+500)/1000) == WAIT_OBJECT_0)
break;
@@ -429,12 +435,31 @@ static LRESULT ANIMATE_Play(ANIMATE_INFO *infoPtr, UINT cRepeat, WORD wFrom, WOR
TRACE("(repeat=%d from=%d to=%d);\n",
infoPtr->nLoop, infoPtr->nFromFrame, infoPtr->nToFrame);
- if (infoPtr->nFromFrame >= infoPtr->nToFrame ||
+ if (infoPtr->nFromFrame >= infoPtr->mah.dwTotalFrames &&
+ (SHORT)infoPtr->nFromFrame < 0)
+ infoPtr->nFromFrame = 0;
+
+ if (infoPtr->nFromFrame > infoPtr->nToFrame ||
infoPtr->nToFrame >= infoPtr->mah.dwTotalFrames)
return FALSE;
infoPtr->currFrame = infoPtr->nFromFrame;
+ /* seek - doesn't need to start a thread or set a timer and neither
+ * does it send a notification */
+ if (infoPtr->nFromFrame == infoPtr->nToFrame)
+ {
+ HDC hDC;
+
+ if ((hDC = GetDC(infoPtr->hwndSelf)) != 0)
+ {
+ ANIMATE_DrawFrame(infoPtr, hDC);
+
+ ReleaseDC(infoPtr->hwndSelf, hDC);
+ }
+ return TRUE;
+ }
+
if (infoPtr->dwStyle & ACS_TIMER)
{
TRACE("Using a timer\n");
@@ -444,11 +469,6 @@ static LRESULT ANIMATE_Play(ANIMATE_INFO *infoPtr, UINT cRepeat, WORD wFrom, WOR
}
else
{
- if(infoPtr->dwStyle & ACS_TRANSPARENT)
- infoPtr->hbrushBG = (HBRUSH)SendMessageW(infoPtr->hwndNotify,
- WM_CTLCOLORSTATIC, 0,
- (LPARAM)infoPtr->hwndSelf);
-
TRACE("Using an animation thread\n");
infoPtr->hStopEvent = CreateEventW( NULL, TRUE, FALSE, NULL );
infoPtr->hThread = CreateThread(0, 0, ANIMATE_AnimationThread,
@@ -681,6 +701,8 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
static BOOL ANIMATE_OpenW(ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPWSTR lpszName)
{
+ HDC hdc;
+
ANIMATE_Free(infoPtr);
if (!lpszName)
@@ -730,6 +752,12 @@ static BOOL ANIMATE_OpenW(ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPWSTR lps
return FALSE;
}
+ hdc = GetDC(infoPtr->hwndSelf);
+ /* native looks at the top left pixel of the first frame here too. */
+ infoPtr->hbrushBG = (HBRUSH)SendMessageW(infoPtr->hwndNotify, WM_CTLCOLORSTATIC,
+ (WPARAM)hdc, (LPARAM)infoPtr->hwndSelf);
+ ReleaseDC(infoPtr->hwndSelf, hdc);
+
if (!(infoPtr->dwStyle & ACS_CENTER))
SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, infoPtr->mah.dwWidth, infoPtr->mah.dwHeight,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
@@ -828,14 +856,10 @@ static LRESULT ANIMATE_Destroy(ANIMATE_INFO *infoPtr)
static BOOL ANIMATE_EraseBackground(ANIMATE_INFO const *infoPtr, HDC hdc)
{
RECT rect;
- HBRUSH hBrush = 0;
-
- if(infoPtr->dwStyle & ACS_TRANSPARENT)
- {
- hBrush = (HBRUSH)SendMessageW(infoPtr->hwndNotify, WM_CTLCOLORSTATIC,
- (WPARAM)hdc, (LPARAM)infoPtr->hwndSelf);
- }
+ HBRUSH hBrush;
+ hBrush = (HBRUSH)SendMessageW(infoPtr->hwndNotify, WM_CTLCOLORSTATIC,
+ (WPARAM)hdc, (LPARAM)infoPtr->hwndSelf);
GetClientRect(infoPtr->hwndSelf, &rect);
FillRect(hdc, &rect, hBrush ? hBrush : GetCurrentObject(hdc, OBJ_BRUSH));
@@ -903,21 +927,15 @@ static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
case WM_PRINTCLIENT:
case WM_PAINT:
{
- /* the animation isn't playing, or has not decompressed
+ /* the animation has not decompressed
* (and displayed) the first frame yet, don't paint
*/
- if ((!infoPtr->uTimer && !infoPtr->hThread) ||
- !infoPtr->hbmPrevFrame)
+ if (!infoPtr->hbmPrevFrame)
{
/* default paint handling */
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
}
- if (infoPtr->dwStyle & ACS_TRANSPARENT)
- infoPtr->hbrushBG = (HBRUSH)SendMessageW(infoPtr->hwndNotify,
- WM_CTLCOLORSTATIC,
- wParam, (LPARAM)infoPtr->hwndSelf);
-
if (wParam)
{
EnterCriticalSection(&infoPtr->cs);
diff --git a/reactos/dll/win32/comctl32/comboex.c b/reactos/dll/win32/comctl32/comboex.c
index 55e530866e2..a98243d1472 100644
--- a/reactos/dll/win32/comctl32/comboex.c
+++ b/reactos/dll/win32/comctl32/comboex.c
@@ -243,7 +243,7 @@ static INT COMBOEX_NotifyEndEdit (COMBOEX_INFO *infoPtr, NMCBEENDEDITW *neew, LP
} else {
NMCBEENDEDITA neea;
- memcpy (&neea.hdr, &neew->hdr, sizeof(NMHDR));
+ neea.hdr = neew->hdr;
neea.fChanged = neew->fChanged;
neea.iNewSelection = neew->iNewSelection;
WideCharToMultiByte (CP_ACP, 0, wstr, -1, neea.szText, CBEMAXSTRLEN, 0, 0);
@@ -412,8 +412,8 @@ static void COMBOEX_AdjustEditPos (COMBOEX_INFO *infoPtr)
h = mysize.cy + 1;
y = rect.bottom - h - 1;
- TRACE("Combo client (%d,%d)-(%d,%d), setting Edit to (%d,%d)-(%d,%d)\n",
- rect.left, rect.top, rect.right, rect.bottom, x, y, x + w, y + h);
+ TRACE("Combo client (%s), setting Edit to (%d,%d)-(%d,%d)\n",
+ wine_dbgstr_rect(&rect), x, y, x + w, y + h);
SetWindowPos(infoPtr->hwndEdit, HWND_TOP, x, y, w, h,
SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER);
}
@@ -952,12 +952,10 @@ static INT COMBOEX_SetItemHeight (COMBOEX_INFO const *infoPtr, INT index, UINT h
height = cb_wrect.bottom-cb_wrect.top
+ cbx_wrect.bottom-cbx_wrect.top
- (cbx_crect.bottom-cbx_crect.top);
- TRACE("EX window=(%d,%d)-(%d,%d), client=(%d,%d)-(%d,%d)\n",
- cbx_wrect.left, cbx_wrect.top, cbx_wrect.right, cbx_wrect.bottom,
- cbx_crect.left, cbx_crect.top, cbx_crect.right, cbx_crect.bottom);
- TRACE("CB window=(%d,%d)-(%d,%d), EX setting=(0,0)-(%d,%d)\n",
- cb_wrect.left, cb_wrect.top, cb_wrect.right, cb_wrect.bottom,
- cbx_wrect.right-cbx_wrect.left, height);
+ TRACE("EX window=(%s), client=(%s)\n",
+ wine_dbgstr_rect(&cbx_wrect), wine_dbgstr_rect(&cbx_crect));
+ TRACE("CB window=(%s), EX setting=(0,0)-(%d,%d)\n",
+ wine_dbgstr_rect(&cbx_wrect), cbx_wrect.right-cbx_wrect.left, height);
SetWindowPos (infoPtr->hwndSelf, HWND_TOP, 0, 0,
cbx_wrect.right-cbx_wrect.left, height,
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
@@ -1004,9 +1002,8 @@ static LRESULT COMBOEX_Create (HWND hwnd, CREATESTRUCTA const *cs)
/* create combo box */
GetWindowRect(hwnd, &wnrc1);
GetClientRect(hwnd, &clrc1);
- TRACE("EX window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d)\n",
- wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,
- clrc1.left, clrc1.top, clrc1.right, clrc1.bottom);
+ TRACE("EX window=(%s), client=(%s)\n",
+ wine_dbgstr_rect(&wnrc1), wine_dbgstr_rect(&clrc1));
/* Native version of ComboEx creates the ComboBox with DROPDOWNLIST */
/* specified. It then creates it's own version of the EDIT control */
@@ -1095,17 +1092,15 @@ static LRESULT COMBOEX_Create (HWND hwnd, CREATESTRUCTA const *cs)
GetWindowRect(hwnd, &wnrc1);
GetClientRect(hwnd, &clrc1);
GetWindowRect(infoPtr->hwndCombo, &cmbwrc);
- TRACE("EX window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d) CB wnd=(%d,%d)-(%d,%d)\n",
- wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,
- clrc1.left, clrc1.top, clrc1.right, clrc1.bottom,
- cmbwrc.left, cmbwrc.top, cmbwrc.right, cmbwrc.bottom);
+ TRACE("EX window=(%s) client=(%s) CB wnd=(%s)\n",
+ wine_dbgstr_rect(&wnrc1), wine_dbgstr_rect(&clrc1),
+ wine_dbgstr_rect(&cmbwrc));
SetWindowPos(infoPtr->hwndCombo, HWND_TOP,
0, 0, wnrc1.right-wnrc1.left, wnrc1.bottom-wnrc1.top,
SWP_NOACTIVATE | SWP_NOREDRAW);
GetWindowRect(infoPtr->hwndCombo, &cmbwrc);
- TRACE("CB window=(%d,%d)-(%d,%d)\n",
- cmbwrc.left, cmbwrc.top, cmbwrc.right, cmbwrc.bottom);
+ TRACE("CB window=(%s)\n", wine_dbgstr_rect(&cmbwrc));
SetWindowPos(hwnd, HWND_TOP,
0, 0, cmbwrc.right-cmbwrc.left, cmbwrc.bottom-cmbwrc.top,
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
@@ -1354,10 +1349,8 @@ static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT const *di
dis->CtlType, dis->CtlID);
TRACE("itemID=0x%08x itemAction=0x%08x itemState=0x%08x\n",
dis->itemID, dis->itemAction, dis->itemState);
- TRACE("hWnd=%p hDC=%p (%d,%d)-(%d,%d) itemData=0x%08lx\n",
- dis->hwndItem, dis->hDC, dis->rcItem.left,
- dis->rcItem.top, dis->rcItem.right, dis->rcItem.bottom,
- dis->itemData);
+ TRACE("hWnd=%p hDC=%p (%s) itemData=0x%08lx\n",
+ dis->hwndItem, dis->hDC, wine_dbgstr_rect(&dis->rcItem), dis->itemData);
/* MSDN says: */
/* "itemID - Specifies the menu item identifier for a menu */
@@ -1374,9 +1367,8 @@ static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT const *di
if ( ( (dis->itemAction & ODA_FOCUS) && (dis->itemState & ODS_SELECTED)) ||
( (dis->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)) && (dis->itemState & ODS_FOCUS) ) ) {
- TRACE("drawing item -1 special focus, rect=(%d,%d)-(%d,%d)\n",
- dis->rcItem.left, dis->rcItem.top,
- dis->rcItem.right, dis->rcItem.bottom);
+ TRACE("drawing item -1 special focus, rect=(%s)\n",
+ wine_dbgstr_rect(&dis->rcItem));
}
else if ((dis->CtlType == ODT_COMBOBOX) &&
(dis->itemAction == ODA_DRAWENTIRE)) {
@@ -1390,17 +1382,15 @@ static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT const *di
edrc.left=edrc.top=edrc.right=edrc.bottom=-1;
if (infoPtr->hwndEdit)
GetWindowRect (infoPtr->hwndEdit, &edrc);
- TRACE("window rects ex=(%d,%d)-(%d,%d), cb=(%d,%d)-(%d,%d), ed=(%d,%d)-(%d,%d)\n",
- exrc.left, exrc.top, exrc.right, exrc.bottom,
- cbrc.left, cbrc.top, cbrc.right, cbrc.bottom,
- edrc.left, edrc.top, edrc.right, edrc.bottom);
+ TRACE("window rects ex=(%s), cb=(%s), ed=(%s)\n",
+ wine_dbgstr_rect(&exrc), wine_dbgstr_rect(&cbrc),
+ wine_dbgstr_rect(&edrc));
}
}
else {
- ERR("NOT drawing item -1 special focus, rect=(%d,%d)-(%d,%d), action=%08x, state=%08x\n",
- dis->rcItem.left, dis->rcItem.top,
- dis->rcItem.right, dis->rcItem.bottom,
- dis->itemAction, dis->itemState);
+ ERR("NOT drawing item -1 special focus, rect=(%s), action=%08x, state=%08x\n",
+ wine_dbgstr_rect(&dis->rcItem),
+ dis->itemAction, dis->itemState);
return 0;
}
}
@@ -1557,8 +1547,8 @@ static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT const *di
rect.right = x + txtsize.cx;
rect.top = dis->rcItem.top + 1;
rect.bottom = dis->rcItem.bottom - 1;
- TRACE("drawing item %d text, rect=(%d,%d)-(%d,%d)\n",
- dis->itemID, rect.left, rect.top, rect.right, rect.bottom);
+ TRACE("drawing item %d text, rect=(%s)\n",
+ dis->itemID, wine_dbgstr_rect(&rect));
ExtTextOutW (dis->hDC, x, y, ETO_OPAQUE | ETO_CLIPPED,
&rect, str, len, 0);
SetBkColor (dis->hDC, bkc);
@@ -1692,12 +1682,10 @@ static LRESULT COMBOEX_WindowPosChanging (COMBOEX_INFO *infoPtr, WINDOWPOS *wp)
TRACE("winpos=(%d,%d %dx%d) flags=0x%08x\n",
wp->x, wp->y, wp->cx, wp->cy, wp->flags);
- TRACE("EX window=(%d,%d)-(%d,%d), client=(%d,%d)-(%d,%d)\n",
- cbx_wrect.left, cbx_wrect.top, cbx_wrect.right, cbx_wrect.bottom,
- cbx_crect.left, cbx_crect.top, cbx_crect.right, cbx_crect.bottom);
- TRACE("CB window=(%d,%d)-(%d,%d), EX setting=(0,0)-(%d,%d)\n",
- cb_wrect.left, cb_wrect.top, cb_wrect.right, cb_wrect.bottom,
- width, cb_wrect.bottom-cb_wrect.top);
+ TRACE("EX window=(%s), client=(%s)\n",
+ wine_dbgstr_rect(&cbx_wrect), wine_dbgstr_rect(&cbx_crect));
+ TRACE("CB window=(%s), EX setting=(0,0)-(%d,%d)\n",
+ wine_dbgstr_rect(&cbx_wrect), width, cb_wrect.bottom-cb_wrect.top);
if (width) SetWindowPos (infoPtr->hwndCombo, HWND_TOP, 0, 0,
width,
@@ -1753,8 +1741,7 @@ COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
hDC = (HDC) wParam;
obkc = SetBkColor (hDC, GetSysColor (COLOR_WINDOW));
GetClientRect (hwnd, &rect);
- TRACE("erasing (%d,%d)-(%d,%d)\n",
- rect.left, rect.top, rect.right, rect.bottom);
+ TRACE("erasing (%s)\n", wine_dbgstr_rect(&rect));
ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0);
SetBkColor (hDC, obkc);
return CallWindowProcW (infoPtr->prevEditWndProc,
@@ -1957,8 +1944,7 @@ COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
hDC = (HDC) wParam;
obkc = SetBkColor (hDC, GetSysColor (COLOR_WINDOW));
GetClientRect (hwnd, &rect);
- TRACE("erasing (%d,%d)-(%d,%d)\n",
- rect.left, rect.top, rect.right, rect.bottom);
+ TRACE("erasing (%s)\n", wine_dbgstr_rect(&rect));
ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0);
SetBkColor (hDC, obkc);
return CallWindowProcW (infoPtr->prevComboWndProc,
diff --git a/reactos/dll/win32/comctl32/comctl32.h b/reactos/dll/win32/comctl32/comctl32.h
index 5e74a1600b6..51320e658cc 100644
--- a/reactos/dll/win32/comctl32/comctl32.h
+++ b/reactos/dll/win32/comctl32/comctl32.h
@@ -128,6 +128,7 @@ typedef struct
COLORREF clrBtnFace; /* COLOR_BTNFACE */
COLORREF clrHighlight; /* COLOR_HIGHLIGHT */
COLORREF clrHighlightText; /* COLOR_HIGHLIGHTTEXT */
+ COLORREF clrHotTrackingColor; /* COLOR_HOTLIGHT */
COLORREF clr3dHilight; /* COLOR_3DHILIGHT */
COLORREF clr3dShadow; /* COLOR_3DSHADOW */
COLORREF clr3dDkShadow; /* COLOR_3DDKSHADOW */
diff --git a/reactos/dll/win32/comctl32/comctl32.rbuild b/reactos/dll/win32/comctl32/comctl32.rbuild
index 871eb1fa76c..95259d9bb07 100644
--- a/reactos/dll/win32/comctl32/comctl32.rbuild
+++ b/reactos/dll/win32/comctl32/comctl32.rbuild
@@ -9,14 +9,6 @@
0x600
0x600
- wine
- user32
- gdi32
- advapi32
- kernel32
- winmm
- uxtheme
- ntdll
animate.c
comboex.c
comctl32undoc.c
@@ -54,5 +46,13 @@
updown.c
rsrc.rc
comctl32.spec
+ wine
+ user32
+ gdi32
+ advapi32
+ kernel32
+ winmm
+ uxtheme
+ ntdll
diff --git a/reactos/dll/win32/comctl32/comctl32_ros.diff b/reactos/dll/win32/comctl32/comctl32_ros.diff
index 9d53a97dcdb..2adfdd721ea 100644
--- a/reactos/dll/win32/comctl32/comctl32_ros.diff
+++ b/reactos/dll/win32/comctl32/comctl32_ros.diff
@@ -2,7 +2,7 @@ Index: propsheet.c
===================================================================
--- propsheet.c (revision 25766)
+++ propsheet.c (working copy)
-@@ -2434,6 +2434,28 @@
+@@ -2431,6 +2431,28 @@
return FALSE;
}
@@ -31,7 +31,7 @@ Index: propsheet.c
/******************************************************************************
* PROPSHEET_SetWizButtons
*
-@@ -2456,17 +2478,6 @@
+@@ -2453,17 +2475,6 @@
EnableWindow(hwndNext, FALSE);
EnableWindow(hwndFinish, FALSE);
@@ -49,7 +49,7 @@ Index: propsheet.c
if (dwFlags & PSWIZB_BACK)
EnableWindow(hwndBack, TRUE);
-@@ -2496,6 +2507,32 @@
+@@ -2493,6 +2504,32 @@
}
else if (!(dwFlags & PSWIZB_DISABLEDFINISH))
EnableWindow(hwndFinish, TRUE);
@@ -86,7 +86,7 @@ Index: tooltips.c
===================================================================
--- tooltips.c (revision 25790)
+++ tooltips.c (working copy)
-@@ -2433,7 +2433,34 @@
+@@ -2486,7 +2486,34 @@
TOOLTIPS_NotifyFormat (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
FIXME ("hwnd=%p wParam=%lx lParam=%lx\n", hwnd, wParam, lParam);
@@ -125,7 +125,7 @@ Index: treeview.c
===================================================================
--- treeview.c (revision 27134)
+++ treeview.c (working copy)
-@@ -2834,8 +2834,6 @@
+@@ -2826,8 +2826,6 @@
}
}
diff --git a/reactos/dll/win32/comctl32/comctl32undoc.c b/reactos/dll/win32/comctl32/comctl32undoc.c
index 8ada7825bb7..418e87cac79 100644
--- a/reactos/dll/win32/comctl32/comctl32undoc.c
+++ b/reactos/dll/win32/comctl32/comctl32undoc.c
@@ -812,7 +812,7 @@ HANDLE WINAPI CreateMRUListA (const CREATEMRULISTA *lpcml)
/**************************************************************************
* EnumMRUListW [COMCTL32.403]
*
- * Enumerate item in a most-recenty-used list
+ * Enumerate item in a most-recently-used list
*
* PARAMS
* hList [I] list handle
diff --git a/reactos/dll/win32/comctl32/comctl_El.rc b/reactos/dll/win32/comctl32/comctl_El.rc
index a226e3798ab..2e151563f33 100644
--- a/reactos/dll/win32/comctl32/comctl_El.rc
+++ b/reactos/dll/win32/comctl32/comctl_El.rc
@@ -24,7 +24,7 @@ CAPTION "
FONT 8, "MS Shell Dlg"
BEGIN
DEFPUSHBUTTON "OK", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP
- PUSHBUTTON "Áêýñùóç", IDCANCEL,58,122,50,14
+ PUSHBUTTON "¶êõñï", IDCANCEL,58,122,50,14
PUSHBUTTON "&ÅöáñìïãÞ", IDC_APPLY_BUTTON,112,122,50,14,WS_DISABLED
PUSHBUTTON "ÂïÞèåéá", IDHELP,166,122,50,14,WS_TABSTOP|WS_GROUP
CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS|WS_GROUP|WS_TABSTOP|TCS_MULTILINE,4,4,212,114
@@ -36,10 +36,10 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
CAPTION "Âïçèüò"
FONT 8, "MS Shell Dlg"
BEGIN
- PUSHBUTTON "< &Ðñïçãïýìåíï", IDC_BACK_BUTTON,71,138,50,14
- DEFPUSHBUTTON "&Åðüìåíï >", IDC_NEXT_BUTTON,121,138,50,14
+ PUSHBUTTON "< &Ðñïçãïýìåíï", IDC_BACK_BUTTON,66,138,55,14
+ DEFPUSHBUTTON "&Åðüìåíï >", IDC_NEXT_BUTTON,121,138,55,14
DEFPUSHBUTTON "ÏëïêëÞñùóç", IDC_FINISH_BUTTON,121,138,50,14
- PUSHBUTTON "Áêýñùóç", IDCANCEL,178,138,50,14
+ PUSHBUTTON "¶êõñï", IDCANCEL,178,138,50,14
PUSHBUTTON "ÂïÞèåéá", IDHELP,235,138,50,14,WS_GROUP
LTEXT "", IDC_SUNKEN_LINE,7,129,278,1,SS_SUNKEN
CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS | WS_DISABLED,7,7,258,5
diff --git a/reactos/dll/win32/comctl32/comctl_Ro.rc b/reactos/dll/win32/comctl32/comctl_Ro.rc
new file mode 100644
index 00000000000..0581d0dadbd
--- /dev/null
+++ b/reactos/dll/win32/comctl32/comctl_Ro.rc
@@ -0,0 +1,92 @@
+/*
+ * Copyright 1999 Eric Kohl
+ * Copyright 2008 Michael Stefaniuc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
+
+#pragma code_page(65001)
+
+IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140
+STYLE DS_CONTEXTHELP | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
+CAPTION "Proprietăți pentru %s"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ DEFPUSHBUTTON "&OK", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP
+ PUSHBUTTON "&Renunță", IDCANCEL,58,122,50,14
+ PUSHBUTTON "A&plică", IDC_APPLY_BUTTON,112,122,50,14,WS_DISABLED
+ PUSHBUTTON "&Ajutor", IDHELP,166,122,50,14,WS_TABSTOP|WS_GROUP
+ CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS|WS_GROUP|WS_TABSTOP|TCS_MULTILINE,4,4,212,114
+END
+
+
+IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
+CAPTION "Expert"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ PUSHBUTTON "< &ÃŽnapoi", IDC_BACK_BUTTON,71,138,50,14
+ DEFPUSHBUTTON "&Următor >", IDC_NEXT_BUTTON,121,138,50,14
+ DEFPUSHBUTTON "&Termină", IDC_FINISH_BUTTON,121,138,50,14
+ PUSHBUTTON "&Renunță", IDCANCEL,178,138,50,14
+ PUSHBUTTON "&Ajutor", IDHELP,235,138,50,14,WS_GROUP
+ LTEXT "", IDC_SUNKEN_LINE,7,129,278,1,SS_SUNKEN
+ CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS | WS_DISABLED,7,7,258,5
+ LTEXT "", IDC_SUNKEN_LINEHEADER,0,35,290,1,SS_LEFT | SS_SUNKEN | WS_CHILD | WS_VISIBLE
+END
+
+
+IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125
+STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "Personalizare toolbar"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ DEFPUSHBUTTON "&ÃŽnchide", IDCANCEL,308,6,44,14
+ PUSHBUTTON "&Resetează", IDC_RESET_BTN,308,23,44,14
+ PUSHBUTTON "&Ajutor", IDC_HELP_BTN,308,40,44,14
+ PUSHBUTTON "Mută în &sus", IDC_MOVEUP_BTN,308,74,44,14
+ PUSHBUTTON "Mută în &jos", IDC_MOVEDN_BTN,308,91,44,14
+ LTEXT "&Butoane disponibile:", -1,4,5,84,10
+ LISTBOX IDC_AVAILBTN_LBOX,4,17,120,100, LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
+ PUSHBUTTON "A&daugă ->", IDOK, 131, 42, 44, 14
+ PUSHBUTTON "<- &Șterge", IDC_REMOVE_BTN,131,62,44,14
+ LTEXT "Butoane &toolbar:", -1,182,5,78,10
+ LISTBOX IDC_TOOLBARBTN_LBOX, 182,17,120,100,LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
+END
+
+STRINGTABLE DISCARDABLE
+{
+ IDS_CLOSE "ÃŽnchide"
+}
+
+STRINGTABLE DISCARDABLE
+{
+ IDM_TODAY "Azi:"
+ IDM_GOTODAY "Mergi la Azi"
+}
+
+STRINGTABLE DISCARDABLE
+{
+ IDS_SEPARATOR "Separator"
+}
+
+STRINGTABLE DISCARDABLE
+{
+ HKY_NONE "Nimic"
+}
+
+#pragma code_page(default)
diff --git a/reactos/dll/win32/comctl32/commctrl.c b/reactos/dll/win32/comctl32/commctrl.c
index 2c2cd1ac85f..554eb4dde9f 100644
--- a/reactos/dll/win32/comctl32/commctrl.c
+++ b/reactos/dll/win32/comctl32/commctrl.c
@@ -714,7 +714,7 @@ InitCommonControls (void)
* Failure: FALSE
*
* NOTES
- * Probaly all versions of comctl32 initializes the Win95 controls in DllMain
+ * Probably all versions of comctl32 initializes the Win95 controls in DllMain
* during DLL initialization. Starting from comctl32 v5.82 all the controls
* are initialized there. We follow this behaviour and this function is just
* a dummy.
@@ -1091,7 +1091,7 @@ VOID WINAPI InitMUILanguage (LANGID uiLang)
* BUGS
* If an application manually subclasses a window after subclassing it with
* this API and then with this API again, then none of the previous
- * subclasses get called or the origional window procedure.
+ * subclasses get called or the original window procedure.
*/
BOOL WINAPI SetWindowSubclass (HWND hWnd, SUBCLASSPROC pfnSubclass,
@@ -1257,7 +1257,7 @@ BOOL WINAPI RemoveWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR u
if (!stack->SubclassProcs && !stack->running) {
TRACE("Last Subclass removed, cleaning up\n");
- /* clean up our heap and reset the origional window procedure */
+ /* clean up our heap and reset the original window procedure */
if (IsWindowUnicode (hWnd))
SetWindowLongPtrW (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc);
else
@@ -1299,7 +1299,7 @@ LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
if (!stack->SubclassProcs && !stack->running) {
TRACE("Last Subclass removed, cleaning up\n");
- /* clean up our heap and reset the origional window procedure */
+ /* clean up our heap and reset the original window procedure */
if (IsWindowUnicode (hWnd))
SetWindowLongPtrW (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc);
else
@@ -1425,6 +1425,7 @@ COMCTL32_RefreshSysColors(void)
comctl32_color.clrBtnFace = GetSysColor (COLOR_BTNFACE);
comctl32_color.clrHighlight = GetSysColor (COLOR_HIGHLIGHT);
comctl32_color.clrHighlightText = GetSysColor (COLOR_HIGHLIGHTTEXT);
+ comctl32_color.clrHotTrackingColor = GetSysColor (COLOR_HOTLIGHT);
comctl32_color.clr3dHilight = GetSysColor (COLOR_3DHILIGHT);
comctl32_color.clr3dShadow = GetSysColor (COLOR_3DSHADOW);
comctl32_color.clr3dDkShadow = GetSysColor (COLOR_3DDKSHADOW);
diff --git a/reactos/dll/win32/comctl32/datetime.c b/reactos/dll/win32/comctl32/datetime.c
index 100cd746e03..b46c4956cb8 100644
--- a/reactos/dll/win32/comctl32/datetime.c
+++ b/reactos/dll/win32/comctl32/datetime.c
@@ -133,8 +133,8 @@ extern int MONTHCAL_MonthLength(int month, int year);
static BOOL DATETIME_SendSimpleNotify (const DATETIME_INFO *infoPtr, UINT code);
static BOOL DATETIME_SendDateTimeChangeNotify (const DATETIME_INFO *infoPtr);
extern void MONTHCAL_CopyTime(const SYSTEMTIME *from, SYSTEMTIME *to);
-static const WCHAR allowedformatchars[] = {'d', 'h', 'H', 'm', 'M', 's', 't', 'y', 'X', '\'', 0};
-static const int maxrepetition [] = {4,2,2,2,4,2,2,4,-1,-1};
+static const WCHAR allowedformatchars[] = {'d', 'h', 'H', 'm', 'M', 's', 't', 'y', 'X', 0};
+static const int maxrepetition [] = {4,2,2,2,4,2,2,4,-1};
static DWORD
@@ -205,6 +205,7 @@ DATETIME_UseFormat (DATETIME_INFO *infoPtr, LPCWSTR formattxt)
{
unsigned int i;
int j, k, len;
+ BOOL inside_literal = FALSE; /* inside '...' */
int *nrFields = &infoPtr->nrFields;
*nrFields = 0;
@@ -214,27 +215,37 @@ DATETIME_UseFormat (DATETIME_INFO *infoPtr, LPCWSTR formattxt)
for (i = 0; formattxt[i]; i++) {
TRACE ("\n%d %c:", i, formattxt[i]);
- for (j = 0; j < len; j++) {
- if (allowedformatchars[j]==formattxt[i]) {
- TRACE ("%c[%d,%x]", allowedformatchars[j], *nrFields, infoPtr->fieldspec[*nrFields]);
- if ((*nrFields==0) && (infoPtr->fieldspec[*nrFields]==0)) {
- infoPtr->fieldspec[*nrFields] = (j<<4) + 1;
- break;
- }
- if (infoPtr->fieldspec[*nrFields] >> 4 != j) {
- (*nrFields)++;
- infoPtr->fieldspec[*nrFields] = (j<<4) + 1;
- break;
- }
- if ((infoPtr->fieldspec[*nrFields] & 0x0f) == maxrepetition[j]) {
- (*nrFields)++;
- infoPtr->fieldspec[*nrFields] = (j<<4) + 1;
- break;
- }
- infoPtr->fieldspec[*nrFields]++;
- break;
- } /* if allowedformatchar */
- } /* for j */
+ if (!inside_literal) {
+ for (j = 0; j < len; j++) {
+ if (allowedformatchars[j]==formattxt[i]) {
+ TRACE ("%c[%d,%x]", allowedformatchars[j], *nrFields, infoPtr->fieldspec[*nrFields]);
+ if ((*nrFields==0) && (infoPtr->fieldspec[*nrFields]==0)) {
+ infoPtr->fieldspec[*nrFields] = (j<<4) + 1;
+ break;
+ }
+ if (infoPtr->fieldspec[*nrFields] >> 4 != j) {
+ (*nrFields)++;
+ infoPtr->fieldspec[*nrFields] = (j<<4) + 1;
+ break;
+ }
+ if ((infoPtr->fieldspec[*nrFields] & 0x0f) == maxrepetition[j]) {
+ (*nrFields)++;
+ infoPtr->fieldspec[*nrFields] = (j<<4) + 1;
+ break;
+ }
+ infoPtr->fieldspec[*nrFields]++;
+ break;
+ } /* if allowedformatchar */
+ } /* for j */
+ }
+ else
+ j = len;
+
+ if (formattxt[i] == '\'')
+ {
+ inside_literal = !inside_literal;
+ continue;
+ }
/* char is not a specifier: handle char like a string */
if (j == len) {
diff --git a/reactos/dll/win32/comctl32/imagelist.h b/reactos/dll/win32/comctl32/imagelist.h
index cd72f3846f3..73ccd8a376c 100644
--- a/reactos/dll/win32/comctl32/imagelist.h
+++ b/reactos/dll/win32/comctl32/imagelist.h
@@ -39,7 +39,7 @@ struct _IMAGELIST
DWORD x4;
UINT flags; /* 1c: flags */
COLORREF clrFg; /* 20: foreground color */
- COLORREF clrBk; /* 24: backgournd color */
+ COLORREF clrBk; /* 24: background color */
HBITMAP hbmImage; /* 30: images Bitmap */
diff --git a/reactos/dll/win32/comctl32/listview.c b/reactos/dll/win32/comctl32/listview.c
index 3abdd234b11..abe1470e9b5 100644
--- a/reactos/dll/win32/comctl32/listview.c
+++ b/reactos/dll/win32/comctl32/listview.c
@@ -371,7 +371,7 @@ typedef struct tagLISTVIEW_INFO
/* Size of "line" scroll for V & H scrolls */
#define LISTVIEW_SCROLL_ICON_LINE_SIZE 37
-/* Padding betwen image and label */
+/* Padding between image and label */
#define IMAGE_PADDING 2
/* Padding behind the label */
@@ -611,7 +611,7 @@ static const char* debugnmlistview(const NMLISTVIEW *plvnm)
{
if (!plvnm) return "(null)";
return wine_dbg_sprintf("iItem=%d, iSubItem=%d, uNewState=0x%x,"
- " uOldState=0x%x, uChanged=0x%x, ptAction=%s, lParam=%ld\n",
+ " uOldState=0x%x, uChanged=0x%x, ptAction=%s, lParam=%ld",
plvnm->iItem, plvnm->iSubItem, plvnm->uNewState, plvnm->uOldState,
plvnm->uChanged, wine_dbgstr_point(&plvnm->ptAction), plvnm->lParam);
}
@@ -950,7 +950,7 @@ static void prepaint_setup (const LISTVIEW_INFO *infoPtr, HDC hdc, NMLVCUSTOMDRA
if (lpnmlvcd->clrText == CLR_DEFAULT)
lpnmlvcd->clrText = comctl32_color.clrWindowText;
- /* apprently, for selected items, we have to override the returned values */
+ /* apparently, for selected items, we have to override the returned values */
if (!SubItem)
{
if (lpnmlvcd->nmcd.uItemState & CDIS_SELECTED)
@@ -1010,7 +1010,7 @@ static inline BOOL ranges_delitem(RANGES ranges, INT nItem)
* ITERATOR DOCUMENTATION
*
* The iterator functions allow for easy, and convenient iteration
- * over items of iterest in the list. Typically, you create a
+ * over items of interest in the list. Typically, you create a
* iterator, use it, and destroy it, as such:
* ITERATOR i;
*
@@ -1353,6 +1353,19 @@ static inline BOOL is_autoarrange(const LISTVIEW_INFO *infoPtr)
(uView == LVS_ICON || uView == LVS_SMALLICON);
}
+static void toggle_checkbox_state(LISTVIEW_INFO *infoPtr, INT nItem)
+{
+ DWORD state = STATEIMAGEINDEX(LISTVIEW_GetItemState(infoPtr, nItem, LVIS_STATEIMAGEMASK));
+ if(state == 1 || state == 2)
+ {
+ LVITEMW lvitem;
+ state ^= 3;
+ lvitem.state = INDEXTOSTATEIMAGEMASK(state);
+ lvitem.stateMask = LVIS_STATEIMAGEMASK;
+ LISTVIEW_SetItemState(infoPtr, nItem, &lvitem);
+ }
+}
+
/******** Internal API functions ************************************/
static inline COLUMN_INFO * LISTVIEW_GetColumnInfo(const LISTVIEW_INFO *infoPtr, INT nSubItem)
@@ -1496,7 +1509,7 @@ static inline INT LISTVIEW_GetCountPerColumn(const LISTVIEW_INFO *infoPtr)
* BUGS
*
* - The current implementation has a list of characters it will
- * accept and it ignores averything else. In particular it will
+ * accept and it ignores everything else. In particular it will
* ignore accentuated characters which seems to match what
* Windows does. But I'm not sure it makes sense to follow
* Windows there.
@@ -1826,9 +1839,9 @@ static void LISTVIEW_InvalidateSelectedItems(const LISTVIEW_INFO *infoPtr)
* Computes an item's (left,top) corner, relative to rcView.
* That is, the position has NOT been made relative to the Origin.
* This is deliberate, to avoid computing the Origin over, and
- * over again, when this function is call in a loop. Instead,
- * one ca factor the computation of the Origin before the loop,
- * and offset the value retured by this function, on every iteration.
+ * over again, when this function is called in a loop. Instead,
+ * one can factor the computation of the Origin before the loop,
+ * and offset the value returned by this function, on every iteration.
*
* PARAMETER(S):
* [I] infoPtr : valid pointer to the listview structure
@@ -1866,15 +1879,15 @@ static void LISTVIEW_GetItemOrigin(const LISTVIEW_INFO *infoPtr, INT nItem, LPPO
* DESCRIPTION: [INTERNAL]
* Compute the rectangles of an item. This is to localize all
* the computations in one place. If you are not interested in some
- * of these values, simply pass in a NULL -- the fucntion is smart
+ * of these values, simply pass in a NULL -- the function is smart
* enough to compute only what's necessary. The function computes
* the standard rectangles (BOUNDS, ICON, LABEL) plus a non-standard
* one, the BOX rectangle. This rectangle is very cheap to compute,
* and is guaranteed to contain all the other rectangles. Computing
- * the ICON rect is also cheap, but all the others are potentaily
+ * the ICON rect is also cheap, but all the others are potentially
* expensive. This gives an easy and effective optimization when
* searching (like point inclusion, or rectangle intersection):
- * first test against the BOX, and if TRUE, test agains the desired
+ * first test against the BOX, and if TRUE, test against the desired
* rectangle.
* If the function does not have all the necessary information
* to computed the requested rectangles, will crash with a
@@ -1884,7 +1897,7 @@ static void LISTVIEW_GetItemOrigin(const LISTVIEW_INFO *infoPtr, INT nItem, LPPO
* We have the following 'special' meanings for a few fields:
* * If LVIS_FOCUSED is set, we assume the item has the focus
* This is important in ICON mode, where it might get a larger
- * then usual rectange
+ * then usual rectangle
*
* Please note that subitem support works only in REPORT mode.
*
@@ -2009,7 +2022,7 @@ static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW
/************************************************************/
if (doLabel)
{
- /* calculate how far to the right can the label strech */
+ /* calculate how far to the right can the label stretch */
Label.right = Box.right;
if (uView == LVS_REPORT)
{
@@ -2760,7 +2773,7 @@ static BOOL ranges_add(RANGES ranges, RANGE range)
TRACE("New range %s @%d\n", debugrange(chkrgn), index);
- /* merge now common anges */
+ /* merge now common ranges */
fromindex = 0;
srchrgn.lower = chkrgn->lower - 1;
srchrgn.upper = chkrgn->upper + 1;
@@ -3349,7 +3362,7 @@ static LRESULT LISTVIEW_MouseMove(LISTVIEW_INFO *infoPtr, WORD fwKeys, INT x, IN
/***
- * Tests wheather the item is assignable to a list with style lStyle
+ * Tests whether the item is assignable to a list with style lStyle
*/
static inline BOOL is_assignable_item(const LVITEMW *lpLVItem, LONG lStyle)
{
@@ -3367,7 +3380,7 @@ static inline BOOL is_assignable_item(const LVITEMW *lpLVItem, LONG lStyle)
*
* PARAMETER(S):
* [I] infoPtr : valid pointer to the listview structure
- * [I] lpLVItem : valid pointer to new item atttributes
+ * [I] lpLVItem : valid pointer to new item attributes
* [I] isNew : the item being set is being inserted
* [I] isW : TRUE if lpLVItem is Unicode, FALSE if it's ANSI
* [O] bChanged : will be set to TRUE if the item really changed
@@ -3392,7 +3405,7 @@ static BOOL set_main_item(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL
if (infoPtr->dwStyle & LVS_OWNERDATA)
{
- /* a virtual listview we stores only selection and focus */
+ /* a virtual listview only stores selection and focus */
if (lpLVItem->mask & ~LVIF_STATE)
return FALSE;
lpItem = NULL;
@@ -3442,7 +3455,7 @@ static BOOL set_main_item(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL
nmlv.lParam = item.lParam;
/* send LVN_ITEMCHANGING notification, if the item is not being inserted */
- /* and we are _NOT_ virtual (LVS_OWERNDATA), and change notifications */
+ /* and we are _NOT_ virtual (LVS_OWNERDATA), and change notifications */
/* are enabled */
if(lpItem && !isNew && infoPtr->bDoChangeNotify)
{
@@ -3512,7 +3525,7 @@ static BOOL set_main_item(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL
*
* PARAMETER(S):
* [I] infoPtr : valid pointer to the listview structure
- * [I] lpLVItem : valid pointer to new subitem atttributes
+ * [I] lpLVItem : valid pointer to new subitem attributes
* [I] isW : TRUE if lpLVItem is Unicode, FALSE if it's ANSI
* [O] bChanged : will be set to TRUE if the item really changed
*
@@ -3590,7 +3603,7 @@ static BOOL set_sub_item(const LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem,
*
* PARAMETER(S):
* [I] infoPtr : valid pointer to the listview structure
- * [I] lpLVItem : new item atttributes
+ * [I] lpLVItem : new item attributes
* [I] isW : TRUE if lpLVItem is Unicode, FALSE if it's ANSI
*
* RETURN:
@@ -4425,7 +4438,7 @@ static void LISTVIEW_ScrollColumns(LISTVIEW_INFO *infoPtr, INT nColumn, INT dx)
if (nColumn >= DPA_GetPtrCount(infoPtr->hdpaColumns))
rcCol.left = rcCol.right;
- /* ajust the other columns */
+ /* adjust the other columns */
for (nCol = nColumn; nCol < DPA_GetPtrCount(infoPtr->hdpaColumns); nCol++)
{
lpColumnInfo = LISTVIEW_GetColumnInfo(infoPtr, nCol);
@@ -4436,7 +4449,7 @@ static void LISTVIEW_ScrollColumns(LISTVIEW_INFO *infoPtr, INT nColumn, INT dx)
/* do not update screen if not in report mode */
if (!is_redrawing(infoPtr) || (infoPtr->dwStyle & LVS_TYPEMASK) != LVS_REPORT) return;
- /* if we have a focus, must first erase the focus rect */
+ /* if we have a focus, we must first erase the focus rect */
if (infoPtr->bFocus) LISTVIEW_ShowFocusRect(infoPtr, FALSE);
/* Need to reset the item width when inserting a new column */
@@ -4629,8 +4642,9 @@ static void LISTVIEW_ScrollOnInsert(LISTVIEW_INFO *infoPtr, INT nItem, INT dir)
*/
static BOOL LISTVIEW_DeleteItem(LISTVIEW_INFO *infoPtr, INT nItem)
{
- UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
LVITEMW item;
+ const UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
+ const BOOL is_icon = (uView == LVS_SMALLICON || uView == LVS_ICON);
TRACE("(nItem=%d)\n", nItem);
@@ -4645,7 +4659,7 @@ static BOOL LISTVIEW_DeleteItem(LISTVIEW_INFO *infoPtr, INT nItem)
if (!notify_deleteitem(infoPtr, nItem)) return FALSE;
/* we need to do this here, because we'll be deleting stuff */
- if (uView == LVS_SMALLICON || uView == LVS_ICON)
+ if (is_icon)
LISTVIEW_InvalidateItem(infoPtr, nItem);
if (!(infoPtr->dwStyle & LVS_OWNERDATA))
@@ -4664,7 +4678,7 @@ static BOOL LISTVIEW_DeleteItem(LISTVIEW_INFO *infoPtr, INT nItem)
DPA_Destroy(hdpaSubItems);
}
- if (uView == LVS_SMALLICON || uView == LVS_ICON)
+ if (is_icon)
{
DPA_DeletePtr(infoPtr->hdpaPosX, nItem);
DPA_DeletePtr(infoPtr->hdpaPosY, nItem);
@@ -4674,7 +4688,8 @@ static BOOL LISTVIEW_DeleteItem(LISTVIEW_INFO *infoPtr, INT nItem)
LISTVIEW_ShiftIndices(infoPtr, nItem, -1);
/* now is the invalidation fun */
- LISTVIEW_ScrollOnInsert(infoPtr, nItem, -1);
+ if (!is_icon)
+ LISTVIEW_ScrollOnInsert(infoPtr, nItem, -1);
return TRUE;
}
@@ -6243,7 +6258,10 @@ static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht,
if (uView == LVS_REPORT)
rcBounds = rcBox;
else
- UnionRect(&rcBounds, &rcIcon, &rcLabel);
+ {
+ UnionRect(&rcBounds, &rcIcon, &rcLabel);
+ UnionRect(&rcBounds, &rcBounds, &rcState);
+ }
TRACE("rcBounds=%s\n", wine_dbgstr_rect(&rcBounds));
if (!PtInRect(&rcBounds, opt)) return -1;
@@ -6497,7 +6515,7 @@ static BOOL LISTVIEW_RedrawItems(const LISTVIEW_INFO *infoPtr, INT nFirst, INT n
* is 16 and an 8 is passed, the list will be scrolled by 16. If a 7
* is passed, then the scroll will be 0. (per MSDN 7/2002)
*
- * For: (per experimentaion with native control and CSpy ListView)
+ * For: (per experimentation with native control and CSpy ListView)
* LVS_ICON dy=1 = 1 pixel (vertical only)
* dx ignored
* LVS_SMALLICON dy=1 = 1 pixel (vertical only)
@@ -6985,17 +7003,17 @@ static HIMAGELIST LISTVIEW_CreateCheckBoxIL(const LISTVIEW_INFO *infoPtr)
* SUCCESS : previous style
* FAILURE : 0
*/
-static DWORD LISTVIEW_SetExtendedListViewStyle(LISTVIEW_INFO *infoPtr, DWORD dwMask, DWORD dwStyle)
+static DWORD LISTVIEW_SetExtendedListViewStyle(LISTVIEW_INFO *infoPtr, DWORD dwMask, DWORD dwExStyle)
{
- DWORD dwOldStyle = infoPtr->dwLvExStyle;
+ DWORD dwOldExStyle = infoPtr->dwLvExStyle;
/* set new style */
if (dwMask)
- infoPtr->dwLvExStyle = (dwOldStyle & ~dwMask) | (dwStyle & dwMask);
+ infoPtr->dwLvExStyle = (dwOldExStyle & ~dwMask) | (dwExStyle & dwMask);
else
- infoPtr->dwLvExStyle = dwStyle;
+ infoPtr->dwLvExStyle = dwExStyle;
- if((infoPtr->dwLvExStyle ^ dwOldStyle) & LVS_EX_CHECKBOXES)
+ if((infoPtr->dwLvExStyle ^ dwOldExStyle) & LVS_EX_CHECKBOXES)
{
HIMAGELIST himl = 0;
if(infoPtr->dwLvExStyle & LVS_EX_CHECKBOXES)
@@ -7011,7 +7029,7 @@ static DWORD LISTVIEW_SetExtendedListViewStyle(LISTVIEW_INFO *infoPtr, DWORD dwM
LISTVIEW_SetImageList(infoPtr, LVSIL_STATE, himl);
}
- if((infoPtr->dwLvExStyle ^ dwOldStyle) & LVS_EX_HEADERDRAGDROP)
+ if((infoPtr->dwLvExStyle ^ dwOldExStyle) & LVS_EX_HEADERDRAGDROP)
{
DWORD dwStyle = GetWindowLongW(infoPtr->hwndHeader, GWL_STYLE);
if (infoPtr->dwLvExStyle & LVS_EX_HEADERDRAGDROP)
@@ -7021,7 +7039,8 @@ static DWORD LISTVIEW_SetExtendedListViewStyle(LISTVIEW_INFO *infoPtr, DWORD dwM
SetWindowLongW(infoPtr->hwndHeader, GWL_STYLE, dwStyle);
}
- return dwOldStyle;
+ LISTVIEW_InvalidateList(infoPtr);
+ return dwOldExStyle;
}
/***
@@ -7596,7 +7615,7 @@ static INT WINAPI LISTVIEW_CallBackCompare(LPVOID first, LPVOID second, LPARAM l
* PARAMETER(S):
* [I] infoPtr : valid pointer to the listview structure
* [I] pfnCompare : application-defined value
- * [I] lParamSort : pointer to comparision callback
+ * [I] lParamSort : pointer to comparison callback
*
* RETURN:
* SUCCESS : TRUE
@@ -7763,7 +7782,7 @@ static BOOL LISTVIEW_DrawTrackLine(const LISTVIEW_INFO *infoPtr)
* RETURN:
* None.
*/
-static CALLBACK VOID LISTVIEW_DelayedEditItem(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
+static VOID CALLBACK LISTVIEW_DelayedEditItem(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
DELAYED_ITEM_EDIT *editItem = (DELAYED_ITEM_EDIT *)idEvent;
LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongPtrW(hwnd, 0);
@@ -8283,6 +8302,8 @@ static LRESULT LISTVIEW_KeyDown(LISTVIEW_INFO *infoPtr, INT nVirtualKey, LONG lK
{
case VK_SPACE:
nItem = infoPtr->nFocusedItem;
+ if (infoPtr->dwLvExStyle & LVS_EX_CHECKBOXES)
+ toggle_checkbox_state(infoPtr, infoPtr->nFocusedItem);
break;
case VK_RETURN:
@@ -8475,15 +8496,7 @@ static LRESULT LISTVIEW_LButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, IN
{
if ((infoPtr->dwLvExStyle & LVS_EX_CHECKBOXES) && (lvHitTestInfo.flags & LVHT_ONITEMSTATEICON))
{
- DWORD state = STATEIMAGEINDEX(LISTVIEW_GetItemState(infoPtr, nItem, LVIS_STATEIMAGEMASK));
- if(state == 1 || state == 2)
- {
- LVITEMW lvitem;
- state ^= 3;
- lvitem.state = INDEXTOSTATEIMAGEMASK(state);
- lvitem.stateMask = LVIS_STATEIMAGEMASK;
- LISTVIEW_SetItemState(infoPtr, nItem, &lvitem);
- }
+ toggle_checkbox_state(infoPtr, nItem);
return 0;
}
@@ -10116,7 +10129,7 @@ static LRESULT CALLBACK EditLblWndProcA(HWND hwnd, UINT uMsg, WPARAM wParam, LPA
/***
* DESCRIPTION:
- * Creates a subclassed edit cotrol
+ * Creates a subclassed edit control
*
* PARAMETER(S):
* [I] infoPtr : valid pointer to the listview structure
diff --git a/reactos/dll/win32/comctl32/monthcal.c b/reactos/dll/win32/comctl32/monthcal.c
index ccc1abe536a..1c325de4508 100644
--- a/reactos/dll/win32/comctl32/monthcal.c
+++ b/reactos/dll/win32/comctl32/monthcal.c
@@ -333,7 +333,7 @@ static void MONTHCAL_DrawDay(const MONTHCAL_INFO *infoPtr, HDC hdc, int day, int
wsprintfW(buf, fmtW, day);
/* No need to check styles: when selection is not valid, it is set to zero.
- * 1minSel.wDay, infoPtr->maxSel.wDay);
- TRACE("%d %d %d %d\n", r.left, r.top, r.right, r.bottom);
+ TRACE("%s\n", wine_dbgstr_rect(&r));
oldCol = SetTextColor(hdc, infoPtr->monthbk);
oldBk = SetBkColor(hdc, infoPtr->trailingtxt);
hbr = GetSysColorBrush(COLOR_GRAYTEXT);
@@ -516,7 +516,7 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTSTRUCT
DeleteObject(hbr);
}
-/* draw line under day abbreviatons */
+/* draw line under day abbreviations */
MoveToEx(hdc, infoPtr->days.left + 3, title->bottom + textHeight + 1, NULL);
LineTo(hdc, infoPtr->days.right - 3, title->bottom + textHeight + 1);
diff --git a/reactos/dll/win32/comctl32/pager.c b/reactos/dll/win32/comctl32/pager.c
index bcad6ea732a..2150c438d57 100644
--- a/reactos/dll/win32/comctl32/pager.c
+++ b/reactos/dll/win32/comctl32/pager.c
@@ -1008,9 +1008,8 @@ PAGER_MouseMove (PAGER_INFO* infoPtr, INT keys, INT x, INT y)
/* If in one of the buttons the capture and draw buttons */
if (btnrect)
{
- TRACE("[%p] draw btn (%d,%d)-(%d,%d), Capture %s, style %08x\n",
- infoPtr->hwndSelf, btnrect->left, btnrect->top,
- btnrect->right, btnrect->bottom,
+ TRACE("[%p] draw btn (%s), Capture %s, style %08x\n",
+ infoPtr->hwndSelf, wine_dbgstr_rect(btnrect),
(infoPtr->bCapture) ? "TRUE" : "FALSE",
infoPtr->dwStyle);
if (!infoPtr->bCapture)
diff --git a/reactos/dll/win32/comctl32/propsheet.c b/reactos/dll/win32/comctl32/propsheet.c
index 068e9d0aad7..80afe83be94 100644
--- a/reactos/dll/win32/comctl32/propsheet.c
+++ b/reactos/dll/win32/comctl32/propsheet.c
@@ -555,7 +555,7 @@ static BOOL PROPSHEET_CollectPageInfo(LPCPROPSHEETPAGEW lppsp,
if ( !HIWORD( lppsp->pszTitle ) )
{
- if (!LoadStringW( lppsp->hInstance, (DWORD_PTR)lppsp->pszTitle,szTitle,sizeof(szTitle) ))
+ if (!LoadStringW( lppsp->hInstance, (DWORD_PTR)lppsp->pszTitle,szTitle,sizeof(szTitle)/sizeof(szTitle[0]) ))
{
pTitle = pszNull;
FIXME("Could not load resource #%04x?\n",LOWORD(lppsp->pszTitle));
@@ -709,8 +709,7 @@ static BOOL PROPSHEET_SizeMismatch(HWND hwndDlg, const PropSheetInfo* psInfo)
* Original tab size.
*/
GetClientRect(hwndTabCtrl, &rcOrigTab);
- TRACE("orig tab %d %d %d %d\n", rcOrigTab.left, rcOrigTab.top,
- rcOrigTab.right, rcOrigTab.bottom);
+ TRACE("orig tab %s\n", wine_dbgstr_rect(&rcOrigTab));
/*
* Biggest page size.
@@ -721,8 +720,7 @@ static BOOL PROPSHEET_SizeMismatch(HWND hwndDlg, const PropSheetInfo* psInfo)
rcPage.bottom = psInfo->height;
MapDialogRect(hwndDlg, &rcPage);
- TRACE("biggest page %d %d %d %d\n", rcPage.left, rcPage.top,
- rcPage.right, rcPage.bottom);
+ TRACE("biggest page %s\n", wine_dbgstr_rect(&rcPage));
if ( (rcPage.right - rcPage.left) != (rcOrigTab.right - rcOrigTab.left) )
return TRUE;
@@ -798,8 +796,7 @@ static BOOL PROPSHEET_AdjustSize(HWND hwndDlg, PropSheetInfo* psInfo)
GetClientRect(hwndTabCtrl, &rc);
- TRACE("tab client rc %d %d %d %d\n",
- rc.left, rc.top, rc.right, rc.bottom);
+ TRACE("tab client rc %s\n", wine_dbgstr_rect(&rc));
rc.right += ((padding.x * 2) + tabOffsetX);
rc.bottom += (buttonHeight + (3 * padding.y) + tabOffsetY);
@@ -831,7 +828,7 @@ static BOOL PROPSHEET_AdjustSizeWizard(HWND hwndDlg, const PropSheetInfo* psInfo
rc.bottom = psInfo->height;
MapDialogRect(hwndDlg, &rc);
- TRACE("Biggest page %d %d %d %d\n", rc.left, rc.top, rc.right, rc.bottom);
+ TRACE("Biggest page %s\n", wine_dbgstr_rect(&rc));
/* Add space for the buttons row */
GetWindowRect(hwndLine, &lineRect);
@@ -1218,7 +1215,7 @@ static BOOL PROPSHEET_CreateTabControl(HWND hwndParent,
/******************************************************************************
* PROPSHEET_WizardSubclassProc
*
- * Subclassing window procedure for wizard extrior pages to prevent drawing
+ * Subclassing window procedure for wizard exterior pages to prevent drawing
* background and so drawing above the watermark.
*/
static LRESULT CALLBACK
@@ -2052,8 +2049,8 @@ static BOOL PROPSHEET_SetCurSel(HWND hwndDlg,
* NOTE: The resizing happens every time the page is selected and
* not only when it's created (some applications depend on it). */
PROPSHEET_GetPageRect(psInfo, hwndDlg, &rc, ppshpage);
- TRACE("setting page %p, rc (%d,%d)-(%d,%d) w=%d, h=%d\n",
- psInfo->proppage[index].hwndPage, rc.left, rc.top, rc.right, rc.bottom,
+ TRACE("setting page %p, rc (%s) w=%d, h=%d\n",
+ psInfo->proppage[index].hwndPage, wine_dbgstr_rect(&rc),
rc.right - rc.left, rc.bottom - rc.top);
SetWindowPos(psInfo->proppage[index].hwndPage, HWND_TOP,
rc.left, rc.top,
@@ -2163,7 +2160,7 @@ static void PROPSHEET_SetTitleW(HWND hwndDlg, DWORD dwStyle, LPCWSTR lpszText)
TRACE("%s (style %08x)\n", debugstr_w(lpszText), dwStyle);
if (HIWORD(lpszText) == 0) {
if (!LoadStringW(psInfo->ppshheader.hInstance,
- LOWORD(lpszText), szTitle, sizeof(szTitle)-sizeof(WCHAR)))
+ LOWORD(lpszText), szTitle, sizeof(szTitle)/sizeof(szTitle[0])))
return;
lpszText = szTitle;
}
@@ -2938,7 +2935,6 @@ INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
static LPWSTR load_string( HINSTANCE instance, LPCWSTR str )
{
LPWSTR ret;
- UINT len;
if (IS_INTRESOURCE(str))
{
@@ -2946,6 +2942,7 @@ static LPWSTR load_string( HINSTANCE instance, LPCWSTR str )
HGLOBAL hmem;
WCHAR *ptr;
WORD i, id = LOWORD(str);
+ UINT len;
if (!(hrsrc = FindResourceW( instance, MAKEINTRESOURCEW((id >> 4) + 1), (LPWSTR)RT_STRING )))
return NULL;
@@ -3676,7 +3673,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
HWND hwndCancel = GetDlgItem(hwnd, IDCANCEL);
EnableWindow(hwndCancel, FALSE);
- if (LoadStringW(COMCTL32_hModule, IDS_CLOSE, buf, sizeof(buf)))
+ if (LoadStringW(COMCTL32_hModule, IDS_CLOSE, buf, sizeof(buf)/sizeof(buf[0])))
SetWindowTextW(hwndOK, buf);
return FALSE;
diff --git a/reactos/dll/win32/comctl32/rebar.c b/reactos/dll/win32/comctl32/rebar.c
index 31d83dee0cb..033b47489bb 100644
--- a/reactos/dll/win32/comctl32/rebar.c
+++ b/reactos/dll/win32/comctl32/rebar.c
@@ -2,6 +2,7 @@
* Rebar control
*
* Copyright 1998, 1999 Eric Kohl
+ * Copyright 2007, 2008 Mikolaj Zalewski
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -32,7 +33,6 @@
* - RBS_FIXEDORDER
* - RBS_REGISTERDROP
* - RBS_TOOLTIPS
- * - RBS_AUTOSIZE
* Messages:
* - RB_BEGINDRAG
* - RB_DRAGMOVE
@@ -74,7 +74,7 @@
/*
* 3. REBAR_MoveChildWindows should have a loop because more than
- * one pass is made (together with the RBN_CHILDSIZEs) is made on
+ * one pass (together with the RBN_CHILDSIZEs) is made on
* at least RB_INSERTBAND
*/
@@ -116,10 +116,12 @@ typedef struct
LPARAM lParam;
UINT cxHeader;
- INT cxEffective; /* current cx for band */
- UINT lcx; /* minimum cx for band */
- UINT lcy; /* minimum cy for band */
+ INT cxEffective; /* current cx for band */
+ UINT cyHeader; /* the height of the header */
+ UINT cxMinBand; /* minimum cx for band */
+ UINT cyMinBand; /* minimum cy for band */
+ UINT cyRowSoFar; /* for RBS_VARHEIGHT - the height of the row if it would break on this band (set by _Layout) */
INT iRow; /* zero-based index of the row this band assigned to */
UINT fStatus; /* status flags, reset only by _Validate */
UINT fDraw; /* drawing flags, reset only by _Layout */
@@ -167,7 +169,7 @@ typedef struct
DWORD orgStyle; /* original style (dwStyle may change) */
SIZE calcSize; /* calculated rebar size - coordinates swapped for CCS_VERT */
BOOL bUnicode; /* TRUE if parent wants notify in W format */
- BOOL DoRedraw; /* TRUE to acutally draw bands */
+ BOOL DoRedraw; /* TRUE to actually draw bands */
UINT fStatus; /* Status flags (see below) */
HCURSOR hcurArrow; /* handle to the arrow cursor */
HCURSOR hcurHorz; /* handle to the EW cursor */
@@ -186,7 +188,7 @@ typedef struct
/* fStatus flags */
#define BEGIN_DRAG_ISSUED 0x00000001
-#define AUTO_RESIZE 0x00000002
+#define SELF_RESIZE 0x00000002
#define BAND_NEEDS_REDRAW 0x00000020
/* used by Windows to mark that the header size has been set by the user and shouldn't be changed */
@@ -233,7 +235,7 @@ typedef struct
/* height of a rebar without a child */
#define REBAR_NO_CHILD_HEIGHT 4
-/* minimium vertical height of a normal bar */
+/* minimum vertical height of a normal bar */
/* or minimum width of a CCS_VERT bar - from experiment on Win2k */
#define REBAR_MINSIZE 23
@@ -252,7 +254,7 @@ typedef struct
#define REBAR_GetInfoPtr(wndPtr) ((REBAR_INFO *)GetWindowLongPtrW (hwnd, 0))
static LRESULT REBAR_NotifyFormat(REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam);
-
+static void REBAR_AutoSize(REBAR_INFO *infoPtr, BOOL needsLayout);
/* "constant values" retrieved when DLL was initialized */
/* FIXME we do this when the classes are registered. */
@@ -407,17 +409,14 @@ REBAR_DumpBand (const REBAR_INFO *iP)
if (pB->fMask & RBBIM_TEXT)
TRACE("band # %u: text=%s\n",
i, (pB->lpText) ? debugstr_w(pB->lpText) : "(null)");
- TRACE("band # %u: lcx=%u, cxEffective=%u, lcy=%u\n",
- i, pB->lcx, pB->cxEffective, pB->lcy);
- TRACE("band # %u: fStatus=%08x, fDraw=%08x, Band=(%d,%d)-(%d,%d), Grip=(%d,%d)-(%d,%d)\n",
- i, pB->fStatus, pB->fDraw,
- pB->rcBand.left, pB->rcBand.top, pB->rcBand.right, pB->rcBand.bottom,
- pB->rcGripper.left, pB->rcGripper.top, pB->rcGripper.right, pB->rcGripper.bottom);
- TRACE("band # %u: Img=(%d,%d)-(%d,%d), Txt=(%d,%d)-(%d,%d), Child=(%d,%d)-(%d,%d)\n",
- i,
- pB->rcCapImage.left, pB->rcCapImage.top, pB->rcCapImage.right, pB->rcCapImage.bottom,
- pB->rcCapText.left, pB->rcCapText.top, pB->rcCapText.right, pB->rcCapText.bottom,
- pB->rcChild.left, pB->rcChild.top, pB->rcChild.right, pB->rcChild.bottom);
+ TRACE("band # %u: cxMinBand=%u, cxEffective=%u, cyMinBand=%u\n",
+ i, pB->cxMinBand, pB->cxEffective, pB->cyMinBand);
+ TRACE("band # %u: fStatus=%08x, fDraw=%08x, Band=(%s), Grip=(%s)\n",
+ i, pB->fStatus, pB->fDraw, wine_dbgstr_rect(&pB->rcBand),
+ wine_dbgstr_rect(&pB->rcGripper));
+ TRACE("band # %u: Img=(%s), Txt=(%s), Child=(%s)\n",
+ i, wine_dbgstr_rect(&pB->rcCapImage),
+ wine_dbgstr_rect(&pB->rcCapText), wine_dbgstr_rect(&pB->rcChild));
}
}
@@ -453,15 +452,21 @@ static int get_rect_cy(const REBAR_INFO *infoPtr, const RECT *lpRect)
return lpRect->bottom - lpRect->top;
}
-static void round_child_height(REBAR_BAND *lpBand, int cyHeight)
+static int round_child_height(REBAR_BAND *lpBand, int cyHeight)
{
int cy = 0;
if (lpBand->cyIntegral == 0)
- return;
+ return cyHeight;
cy = max(cyHeight - (int)lpBand->cyMinChild, 0);
cy = lpBand->cyMinChild + (cy/lpBand->cyIntegral) * lpBand->cyIntegral;
cy = min(cy, lpBand->cyMaxChild);
- lpBand->cyChild = cy;
+ return cy;
+}
+
+static void update_min_band_height(const REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
+{
+ lpBand->cyMinBand = max(lpBand->cyHeader,
+ (lpBand->hwndChild ? lpBand->cyChild + REBARSPACE(lpBand) : REBAR_NO_CHILD_HEIGHT));
}
static void
@@ -790,6 +795,7 @@ REBAR_CalcHorzBand (const REBAR_INFO *infoPtr, UINT rstart, UINT rend)
work.right += SEP_WIDTH;
work.bottom += SEP_WIDTH;
InvalidateRect(infoPtr->hwndSelf, &work, TRUE);
+ InvalidateRect(lpBand->hwndChild, NULL, TRUE);
}
}
@@ -910,6 +916,7 @@ REBAR_CalcVertBand (const REBAR_INFO *infoPtr, UINT rstart, UINT rend)
work.bottom += SEP_WIDTH;
work.right += SEP_WIDTH;
InvalidateRect(infoPtr->hwndSelf, &work, TRUE);
+ InvalidateRect(lpBand->hwndChild, NULL, TRUE);
}
}
@@ -976,12 +983,12 @@ REBAR_ForceResize (REBAR_INFO *infoPtr)
infoPtr->hwndSelf, infoPtr->dwStyle, x, y, width, height);
/* Set flag to ignore next WM_SIZE message and resize the window */
- infoPtr->fStatus |= AUTO_RESIZE;
+ infoPtr->fStatus |= SELF_RESIZE;
if ((infoPtr->dwStyle & CCS_VERT) == 0)
SetWindowPos(infoPtr->hwndSelf, 0, x, y, width, height, SWP_NOZORDER);
else
SetWindowPos(infoPtr->hwndSelf, 0, y, x, height, width, SWP_NOZORDER);
- infoPtr->fStatus &= ~AUTO_RESIZE;
+ infoPtr->fStatus &= ~SELF_RESIZE;
}
@@ -1005,7 +1012,7 @@ REBAR_MoveChildWindows (const REBAR_INFO *infoPtr, UINT start, UINT endplus)
if (lpBand->hwndChild) {
TRACE("hwndChild = %p\n", lpBand->hwndChild);
- /* Always geterate the RBN_CHILDSIZE even it child
+ /* Always generate the RBN_CHILDSIZE even if child
did not change */
rbcz.uBand = i;
rbcz.wID = lpBand->wID;
@@ -1018,11 +1025,9 @@ REBAR_MoveChildWindows (const REBAR_INFO *infoPtr, UINT start, UINT endplus)
REBAR_Notify ((NMHDR *)&rbcz, infoPtr, RBN_CHILDSIZE);
if (!EqualRect (&lpBand->rcChild, &rbcz.rcChild)) {
TRACE("Child rect changed by NOTIFY for band %u\n", i);
- TRACE(" from (%d,%d)-(%d,%d) to (%d,%d)-(%d,%d)\n",
- lpBand->rcChild.left, lpBand->rcChild.top,
- lpBand->rcChild.right, lpBand->rcChild.bottom,
- rbcz.rcChild.left, rbcz.rcChild.top,
- rbcz.rcChild.right, rbcz.rcChild.bottom);
+ TRACE(" from (%s) to (%s)\n",
+ wine_dbgstr_rect(&lpBand->rcChild),
+ wine_dbgstr_rect(&rbcz.rcChild));
lpBand->rcChild = rbcz.rcChild; /* *** ??? */
}
@@ -1096,7 +1101,9 @@ REBAR_MoveChildWindows (const REBAR_INFO *infoPtr, UINT start, UINT endplus)
}
-static int next_band(const REBAR_INFO *infoPtr, int i)
+/* Returns the next visible band (the first visible band in [i+1; infoPtr->uNumBands) )
+ * or infoPtr->uNumBands if none */
+static int next_visible(const REBAR_INFO *infoPtr, int i)
{
int n;
for (n = i + 1; n < infoPtr->uNumBands; n++)
@@ -1105,7 +1112,9 @@ static int next_band(const REBAR_INFO *infoPtr, int i)
return n;
}
-static int prev_band(const REBAR_INFO *infoPtr, int i)
+/* Returns the previous visible band (the last visible band in [0; i) )
+ * or -1 if none */
+static int prev_visible(const REBAR_INFO *infoPtr, int i)
{
int n;
for (n = i - 1; n >= 0; n--)
@@ -1114,11 +1123,18 @@ static int prev_band(const REBAR_INFO *infoPtr, int i)
return n;
}
+/* Returns the first visible band or infoPtr->uNumBands if none */
+static int first_visible(const REBAR_INFO *infoPtr)
+{
+ return next_visible(infoPtr, -1); /* this works*/
+}
+
+/* Returns the first visible band for the given row (or iBand if none) */
static int get_row_begin_for_band(const REBAR_INFO *infoPtr, INT iBand)
{
int iLastBand = iBand;
int iRow = infoPtr->bands[iBand].iRow;
- while ((iBand = prev_band(infoPtr, iBand)) >= 0) {
+ while ((iBand = prev_visible(infoPtr, iBand)) >= 0) {
if (infoPtr->bands[iBand].iRow != iRow)
break;
else
@@ -1127,19 +1143,22 @@ static int get_row_begin_for_band(const REBAR_INFO *infoPtr, INT iBand)
return iLastBand;
}
+/* Returns the first visible band for the next row (or infoPtr->uNumBands if none) */
static int get_row_end_for_band(const REBAR_INFO *infoPtr, INT iBand)
{
int iRow = infoPtr->bands[iBand].iRow;
- while ((iBand = next_band(infoPtr, iBand)) < infoPtr->uNumBands)
+ while ((iBand = next_visible(infoPtr, iBand)) < infoPtr->uNumBands)
if (infoPtr->bands[iBand].iRow != iRow)
break;
return iBand;
}
+/* Compute the rcBand.{left,right} from the cxEffective bands widths computed earlier.
+ * iBeginBand must be visible */
static void REBAR_SetRowRectsX(const REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBand)
{
int xPos = 0, i;
- for (i = iBeginBand; i < iEndBand; i = next_band(infoPtr, i))
+ for (i = iBeginBand; i < iEndBand; i = next_visible(infoPtr, i))
{
REBAR_BAND *lpBand = &infoPtr->bands[i];
@@ -1162,34 +1181,35 @@ static void REBAR_SetRowRectsX(const REBAR_INFO *infoPtr, INT iBeginBand, INT iE
*/
static REBAR_BAND *REBAR_FindBandToGrow(const REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBand)
{
- INT iLcx = 0, i;
+ INT cxMinFirstBand = 0, i;
- iLcx = infoPtr->bands[iBeginBand].lcx;
+ cxMinFirstBand = infoPtr->bands[iBeginBand].cxMinBand;
- for (i = prev_band(infoPtr, iEndBand); i >= iBeginBand; i = prev_band(infoPtr, i))
- if (infoPtr->bands[i].cxEffective > iLcx && !(infoPtr->bands[i].fStyle&RBBS_FIXEDSIZE))
+ for (i = prev_visible(infoPtr, iEndBand); i >= iBeginBand; i = prev_visible(infoPtr, i))
+ if (infoPtr->bands[i].cxEffective > cxMinFirstBand && !(infoPtr->bands[i].fStyle&RBBS_FIXEDSIZE))
break;
if (i < iBeginBand)
- for (i = prev_band(infoPtr, iEndBand); i >= iBeginBand; i = prev_band(infoPtr, i))
- if (infoPtr->bands[i].lcx == iLcx)
+ for (i = prev_visible(infoPtr, iEndBand); i >= iBeginBand; i = prev_visible(infoPtr, i))
+ if (infoPtr->bands[i].cxMinBand == cxMinFirstBand)
break;
TRACE("Extra space for row [%d..%d) should be added to band %d\n", iBeginBand, iEndBand, i);
return &infoPtr->bands[i];
}
+/* Try to shrink the visible bands in [iBeginBand; iEndBand) by cxShrink, starting from the right */
static int REBAR_ShrinkBandsRTL(const REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBand, INT cxShrink, BOOL bEnforce)
{
REBAR_BAND *lpBand;
INT width, i;
TRACE("Shrinking bands [%d..%d) by %d, right-to-left\n", iBeginBand, iEndBand, cxShrink);
- for (i = prev_band(infoPtr, iEndBand); i >= iBeginBand; i = prev_band(infoPtr, i))
+ for (i = prev_visible(infoPtr, iEndBand); i >= iBeginBand; i = prev_visible(infoPtr, i))
{
lpBand = &infoPtr->bands[i];
- width = max(lpBand->cxEffective - cxShrink, (int)lpBand->lcx);
+ width = max(lpBand->cxEffective - cxShrink, (int)lpBand->cxMinBand);
cxShrink -= lpBand->cxEffective - width;
lpBand->cxEffective = width;
if (bEnforce && lpBand->cx > lpBand->cxEffective)
@@ -1201,17 +1221,19 @@ static int REBAR_ShrinkBandsRTL(const REBAR_INFO *infoPtr, INT iBeginBand, INT i
}
+/* Try to shrink the visible bands in [iBeginBand; iEndBand) by cxShrink, starting from the left.
+ * iBeginBand must be visible */
static int REBAR_ShrinkBandsLTR(const REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBand, INT cxShrink, BOOL bEnforce)
{
REBAR_BAND *lpBand;
INT width, i;
TRACE("Shrinking bands [%d..%d) by %d, left-to-right\n", iBeginBand, iEndBand, cxShrink);
- for (i = iBeginBand; i < iEndBand; i = next_band(infoPtr, i))
+ for (i = iBeginBand; i < iEndBand; i = next_visible(infoPtr, i))
{
lpBand = &infoPtr->bands[i];
- width = max(lpBand->cxEffective - cxShrink, (int)lpBand->lcx);
+ width = max(lpBand->cxEffective - cxShrink, (int)lpBand->cxMinBand);
cxShrink -= lpBand->cxEffective - width;
lpBand->cxEffective = width;
if (bEnforce)
@@ -1222,6 +1244,7 @@ static int REBAR_ShrinkBandsLTR(const REBAR_INFO *infoPtr, INT iBeginBand, INT i
return cxShrink;
}
+/* Set the heights of the visible bands in [iBeginBand; iEndBand) to the max height. iBeginBand must be visible */
static int REBAR_SetBandsHeight(const REBAR_INFO *infoPtr, INT iBeginBand, INT iEndBand, INT yStart)
{
REBAR_BAND *lpBand;
@@ -1229,14 +1252,15 @@ static int REBAR_SetBandsHeight(const REBAR_INFO *infoPtr, INT iBeginBand, INT i
int yPos = yStart;
int row = infoPtr->bands[iBeginBand].iRow;
int i;
- for (i = iBeginBand; i < iEndBand; i = next_band(infoPtr, i))
+ for (i = iBeginBand; i < iEndBand; i = next_visible(infoPtr, i))
{
lpBand = &infoPtr->bands[i];
- yMaxHeight = max(yMaxHeight, lpBand->lcy);
+ lpBand->cyRowSoFar = yMaxHeight;
+ yMaxHeight = max(yMaxHeight, lpBand->cyMinBand);
}
TRACE("Bands [%d; %d) height: %d\n", iBeginBand, iEndBand, yMaxHeight);
- for (i = iBeginBand; i < iEndBand; i = next_band(infoPtr, i))
+ for (i = iBeginBand; i < iEndBand; i = next_visible(infoPtr, i))
{
lpBand = &infoPtr->bands[i];
/* we may be called for multiple rows if RBS_VARHEIGHT not set */
@@ -1255,6 +1279,7 @@ static int REBAR_SetBandsHeight(const REBAR_INFO *infoPtr, INT iBeginBand, INT i
return yPos + yMaxHeight;
}
+/* Layout the row [iBeginBand; iEndBand). iBeginBand must be visible */
static void REBAR_LayoutRow(const REBAR_INFO *infoPtr, int iBeginBand, int iEndBand, int cx, int *piRow, int *pyPos)
{
REBAR_BAND *lpBand;
@@ -1266,12 +1291,12 @@ static void REBAR_LayoutRow(const REBAR_INFO *infoPtr, int iBeginBand, int iEndB
infoPtr->bands[i].iRow = *piRow;
/* compute the extra space */
- for (i = iBeginBand; i < iEndBand; i = next_band(infoPtr, i))
+ for (i = iBeginBand; i < iEndBand; i = next_visible(infoPtr, i))
{
lpBand = &infoPtr->bands[i];
if (i > iBeginBand)
width += SEP_WIDTH;
- lpBand->cxEffective = max(lpBand->lcx, lpBand->cx);
+ lpBand->cxEffective = max(lpBand->cxMinBand, lpBand->cx);
width += lpBand->cxEffective;
}
@@ -1279,7 +1304,7 @@ static void REBAR_LayoutRow(const REBAR_INFO *infoPtr, int iBeginBand, int iEndB
TRACE("Extra space: %d\n", extra);
if (extra < 0) {
int ret = REBAR_ShrinkBandsRTL(infoPtr, iBeginBand, iEndBand, -extra, FALSE);
- if (ret > 0 && next_band(infoPtr, iBeginBand) != iEndBand) /* one band may be longer than expected... */
+ if (ret > 0 && next_visible(infoPtr, iBeginBand) != iEndBand) /* one band may be longer than expected... */
ERR("Error layouting row %d - couldn't shrink for %d pixels (%d total shrink)\n", *piRow, ret, -extra);
} else
if (extra > 0) {
@@ -1298,30 +1323,23 @@ static void REBAR_LayoutRow(const REBAR_INFO *infoPtr, int iBeginBand, int iEndB
}
static VOID
-REBAR_Layout(REBAR_INFO *infoPtr, const RECT *lpRect)
+REBAR_Layout(REBAR_INFO *infoPtr)
{
REBAR_BAND *lpBand;
RECT rcAdj;
SIZE oldSize;
- INT adjcx, adjcy, i;
- INT rowstart = 0;
+ INT adjcx, i;
+ INT rowstart;
INT row = 0;
INT xMin, yPos;
- INT cyTarget;
- const INT yInit = 0;
- cyTarget = 0;
- if (lpRect) {
- rcAdj = *lpRect;
- cyTarget = get_rect_cy(infoPtr, lpRect);
- } else if (infoPtr->dwStyle & (CCS_NORESIZE | CCS_NOPARENTALIGN) || GetParent(infoPtr->hwndSelf) == NULL)
+ if (infoPtr->dwStyle & (CCS_NORESIZE | CCS_NOPARENTALIGN) || GetParent(infoPtr->hwndSelf) == NULL)
GetClientRect(infoPtr->hwndSelf, &rcAdj);
else
GetClientRect(GetParent(infoPtr->hwndSelf), &rcAdj);
- TRACE("adjustment rect is (%d,%d)-(%d,%d)\n", rcAdj.left, rcAdj.top, rcAdj.right, rcAdj.bottom);
+ TRACE("adjustment rect is (%s)\n", wine_dbgstr_rect(&rcAdj));
adjcx = get_rect_cx(infoPtr, &rcAdj);
- adjcy = get_rect_cy(infoPtr, &rcAdj);
if (infoPtr->uNumBands == 0) {
TRACE("No bands - setting size to (0,%d), vert: %lx\n", adjcx, infoPtr->dwStyle & CCS_VERT);
@@ -1332,16 +1350,15 @@ REBAR_Layout(REBAR_INFO *infoPtr, const RECT *lpRect)
return;
}
- yPos = yInit;
+ yPos = 0;
xMin = 0;
+ rowstart = first_visible(infoPtr);
/* divide rows */
- i = 0;
- for (i = 0; i < infoPtr->uNumBands; i++)
+ for (i = rowstart; i < infoPtr->uNumBands; i = next_visible(infoPtr, i))
{
lpBand = &infoPtr->bands[i];
- if (HIDDENBAND(lpBand)) continue;
- if (i > rowstart && (lpBand->fStyle & RBBS_BREAK || xMin + lpBand->lcx > adjcx)) {
+ if (i > rowstart && (lpBand->fStyle & RBBS_BREAK || xMin + lpBand->cxMinBand > adjcx)) {
TRACE("%s break on band %d\n", (lpBand->fStyle & RBBS_BREAK ? "Hard" : "Soft"), i - 1);
REBAR_LayoutRow(infoPtr, rowstart, i, adjcx, &row, &yPos);
rowstart = i;
@@ -1350,12 +1367,12 @@ REBAR_Layout(REBAR_INFO *infoPtr, const RECT *lpRect)
else
xMin += SEP_WIDTH;
- xMin += lpBand->lcx;
+ xMin += lpBand->cxMinBand;
}
REBAR_LayoutRow(infoPtr, rowstart, infoPtr->uNumBands, adjcx, &row, &yPos);
if (!(infoPtr->dwStyle & RBS_VARHEIGHT))
- yPos = REBAR_SetBandsHeight(infoPtr, 0, infoPtr->uNumBands, yInit);
+ yPos = REBAR_SetBandsHeight(infoPtr, first_visible(infoPtr), infoPtr->uNumBands, 0);
infoPtr->uNumRows = row;
@@ -1382,24 +1399,150 @@ REBAR_Layout(REBAR_INFO *infoPtr, const RECT *lpRect)
{
NMHDR heightchange;
REBAR_Notify(&heightchange, infoPtr, RBN_HEIGHTCHANGE);
+ REBAR_AutoSize(infoPtr, FALSE);
}
}
+/* iBeginBand must be visible */
+static int
+REBAR_SizeChildrenToHeight(const REBAR_INFO *infoPtr, int iBeginBand, int iEndBand, int extra, BOOL *fChanged)
+{
+ int cyBandsOld;
+ int cyBandsNew = 0;
+ int i;
+
+ TRACE("[%d;%d) by %d\n", iBeginBand, iEndBand, extra);
+
+ cyBandsOld = infoPtr->bands[iBeginBand].rcBand.bottom - infoPtr->bands[iBeginBand].rcBand.top;
+ for (i = iBeginBand; i < iEndBand; i = next_visible(infoPtr, i))
+ {
+ REBAR_BAND *lpBand = &infoPtr->bands[i];
+ int cyMaxChild = cyBandsOld - REBARSPACE(lpBand) + extra;
+ int cyChild = round_child_height(lpBand, cyMaxChild);
+
+ if (lpBand->hwndChild && cyChild != lpBand->cyChild && (lpBand->fStyle & RBBS_VARIABLEHEIGHT))
+ {
+ TRACE("Resizing %d: %d -> %d [%d]\n", i, lpBand->cyChild, cyChild, lpBand->cyMaxChild);
+ *fChanged = TRUE;
+ lpBand->cyChild = cyChild;
+ lpBand->fDraw |= NTF_INVALIDATE;
+ update_min_band_height(infoPtr, lpBand);
+ }
+ cyBandsNew = max(cyBandsNew, lpBand->cyMinBand);
+ }
+ return cyBandsNew - cyBandsOld;
+}
+
+/* worker function for RB_SIZETORECT and RBS_AUTOSIZE */
+static VOID
+REBAR_SizeToHeight(REBAR_INFO *infoPtr, int height)
+{
+ int extra = height - infoPtr->calcSize.cy; /* may be negative */
+ BOOL fChanged = FALSE;
+ UINT uNumRows = infoPtr->uNumRows;
+ int i;
+
+ if (uNumRows == 0) /* avoid division by 0 */
+ return;
+
+ /* That's not exactly what Windows does but should be similar */
+
+ /* Pass one: break-up/glue rows */
+ if (extra > 0)
+ {
+ for (i = prev_visible(infoPtr, infoPtr->uNumBands); i > 0; i = prev_visible(infoPtr, i))
+ {
+ REBAR_BAND *lpBand = &infoPtr->bands[i];
+ int height = lpBand->rcBand.bottom - lpBand->rcBand.top;
+ int cyBreakExtra; /* additional cy for the rebar after a RBBS_BREAK on this band */
+
+ if (infoPtr->dwStyle & RBS_VARHEIGHT)
+ cyBreakExtra = lpBand->cyRowSoFar; /* 'height' => 'lpBand->cyRowSoFar' + 'height'*/
+ else
+ cyBreakExtra = height; /* 'height' => 'height' + 'height'*/
+ cyBreakExtra += SEP_WIDTH;
+
+ if (extra <= cyBreakExtra / 2)
+ break;
+
+ if (!(lpBand->fStyle & RBBS_BREAK))
+ {
+ TRACE("Adding break on band %d - extra %d -> %d\n", i, extra, extra - cyBreakExtra);
+ lpBand->fStyle |= RBBS_BREAK;
+ lpBand->fDraw |= NTF_INVALIDATE;
+ fChanged = TRUE;
+ extra -= cyBreakExtra;
+ uNumRows++;
+ /* temporary change for _SizeControlsToHeight. The true values will be computed in _Layout */
+ if (infoPtr->dwStyle & RBS_VARHEIGHT)
+ lpBand->rcBand.bottom = lpBand->rcBand.top + lpBand->cyMinBand;
+ }
+ }
+ }
+ /* TODO: else if (extra < 0) { try to remove some RBBS_BREAKs } */
+
+ /* Pass two: increase/decrease control height */
+ if (infoPtr->dwStyle & RBS_VARHEIGHT)
+ {
+ int i = first_visible(infoPtr);
+ int iRow = 0;
+ while (i < infoPtr->uNumBands)
+ {
+ REBAR_BAND *lpBand = &infoPtr->bands[i];
+ int extraForRow = extra / (int)(uNumRows - iRow);
+ int rowEnd;
+
+ /* we can't use get_row_end_for_band as we might have added RBBS_BREAK in the first phase */
+ for (rowEnd = next_visible(infoPtr, i); rowEnd < infoPtr->uNumBands; rowEnd = next_visible(infoPtr, rowEnd))
+ if (infoPtr->bands[rowEnd].iRow != lpBand->iRow || (infoPtr->bands[rowEnd].fStyle & RBBS_BREAK))
+ break;
+
+ extra -= REBAR_SizeChildrenToHeight(infoPtr, i, rowEnd, extraForRow, &fChanged);
+ TRACE("extra = %d\n", extra);
+ i = rowEnd;
+ iRow++;
+ }
+ }
+ else
+ extra -= REBAR_SizeChildrenToHeight(infoPtr, first_visible(infoPtr), infoPtr->uNumBands, extra / infoPtr->uNumRows, &fChanged);
+
+ if (fChanged)
+ REBAR_Layout(infoPtr);
+}
+
+static VOID
+REBAR_AutoSize(REBAR_INFO *infoPtr, BOOL needsLayout)
+{
+ RECT rc, rcNew;
+ NMRBAUTOSIZE autosize;
+
+ if (needsLayout)
+ REBAR_Layout(infoPtr);
+ GetClientRect(infoPtr->hwndSelf, &rc);
+ REBAR_SizeToHeight(infoPtr, get_rect_cy(infoPtr, &rc));
+ GetClientRect(infoPtr->hwndSelf, &rcNew);
+
+ GetClientRect(infoPtr->hwndSelf, &autosize.rcTarget);
+ autosize.fChanged = (memcmp(&rc, &rcNew, sizeof(RECT)) == 0);
+ autosize.rcTarget = rc;
+ autosize.rcActual = rcNew;
+ REBAR_Notify((NMHDR *)&autosize, infoPtr, RBN_AUTOSIZE);
+}
static VOID
REBAR_ValidateBand (const REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
/* Function: This routine evaluates the band specs supplied */
/* by the user and updates the following 5 fields in */
- /* the internal band structure: cxHeader, lcx, lcy, hcx, hcy*/
+ /* the internal band structure: cxHeader, cyHeader, cxMinBand, cyMinBand, fStatus */
{
UINT header=0;
- UINT textheight=0;
+ UINT textheight=0, imageheight = 0;
UINT i, nonfixed;
REBAR_BAND *tBand;
lpBand->fStatus = 0;
- lpBand->lcx = 0;
- lpBand->lcy = 0;
+ lpBand->cxMinBand = 0;
+ lpBand->cyMinBand = 0;
/* Data coming in from users into the cx... and cy... fields */
/* may be bad, just garbage, because the user never clears */
@@ -1452,15 +1595,15 @@ REBAR_ValidateBand (const REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
}
/* image is visible */
- if ((lpBand->fMask & RBBIM_IMAGE) && (infoPtr->himl)) {
+ if (lpBand->iImage != -1 && (infoPtr->himl)) {
lpBand->fStatus |= HAS_IMAGE;
if (infoPtr->dwStyle & CCS_VERT) {
header += (infoPtr->imageSize.cy + REBAR_POST_IMAGE);
- lpBand->lcy = infoPtr->imageSize.cx + 2;
+ imageheight = infoPtr->imageSize.cx + 4;
}
else {
header += (infoPtr->imageSize.cx + REBAR_POST_IMAGE);
- lpBand->lcy = infoPtr->imageSize.cy + 2;
+ imageheight = infoPtr->imageSize.cy + 4;
}
}
@@ -1490,21 +1633,14 @@ REBAR_ValidateBand (const REBAR_INFO *infoPtr, REBAR_BAND *lpBand)
/* check if user overrode the header value */
if (!(lpBand->fStyle & RBBS_UNDOC_FIXEDHEADER))
lpBand->cxHeader = header;
-
+ lpBand->cyHeader = max(textheight, imageheight);
/* Now compute minimum size of child window */
- lpBand->lcy = textheight;
- if (lpBand->hwndChild != NULL) {
- /* Set the .cy values for CHILDSIZE case */
- lpBand->lcy = max(lpBand->lcy, lpBand->cyChild + REBARSPACE(lpBand));
- TRACE("_CHILDSIZE\n");
- }
- else
- lpBand->lcy = max(lpBand->lcy, REBAR_NO_CHILD_HEIGHT);
+ update_min_band_height(infoPtr, lpBand); /* update lpBand->cyMinBand from cyHeader and cyChild*/
- lpBand->lcx = lpBand->cxMinChild + lpBand->cxHeader + REBAR_POST_CHILD;
+ lpBand->cxMinBand = lpBand->cxMinChild + lpBand->cxHeader + REBAR_POST_CHILD;
if (lpBand->fStyle & RBBS_USECHEVRON && lpBand->cxMinChild < lpBand->cxIdeal)
- lpBand->lcx += CHEVRON_WIDTH;
+ lpBand->cxMinBand += CHEVRON_WIDTH;
}
static BOOL
@@ -1579,8 +1715,7 @@ REBAR_CommonSetupBand(HWND hwnd, const REBARBANDINFOW *lprbbi, REBAR_BAND *lpBan
lpBand->cyMaxChild = lprbbi->cyMaxChild;
lpBand->cyIntegral = lprbbi->cyIntegral;
- lpBand->cyChild = lpBand->cyMinChild;
- round_child_height(lpBand, lprbbi->cyChild); /* try to increase cyChild */
+ lpBand->cyChild = round_child_height(lpBand, lprbbi->cyChild); /* make (cyChild - cyMinChild) a multiple of cyIntergral */
}
else {
lpBand->cyChild = lpBand->cyMinChild;
@@ -1685,9 +1820,8 @@ REBAR_InternalEraseBkGnd (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lPara
else
DrawEdge (hdc, &rcRowSep, EDGE_ETCHED, BF_BOTTOM);
}
- TRACE ("drawing band separator bottom (%d,%d)-(%d,%d)\n",
- rcRowSep.left, rcRowSep.top,
- rcRowSep.right, rcRowSep.bottom);
+ TRACE ("drawing band separator bottom (%s)\n",
+ wine_dbgstr_rect(&rcRowSep));
}
}
@@ -1711,8 +1845,8 @@ REBAR_InternalEraseBkGnd (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lPara
else
DrawEdge (hdc, &rcSep, EDGE_ETCHED, BF_RIGHT);
}
- TRACE("drawing band separator right (%d,%d)-(%d,%d)\n",
- rcSep.left, rcSep.top, rcSep.right, rcSep.bottom);
+ TRACE("drawing band separator right (%s)\n",
+ wine_dbgstr_rect(&rcSep));
}
/* draw the actual background */
@@ -1882,7 +2016,7 @@ REBAR_HandleLRDrag (REBAR_INFO *infoPtr, const POINT *ptsmove)
hitBand->cx = hitBand->cxEffective;
} else if (movement > 0) {
int cxLeft = REBAR_ShrinkBandsLTR(infoPtr, iHitBand, iRowEnd, movement, TRUE);
- REBAR_BAND *lpPrev = &infoPtr->bands[prev_band(infoPtr, iHitBand)];
+ REBAR_BAND *lpPrev = &infoPtr->bands[prev_visible(infoPtr, iHitBand)];
lpPrev->cxEffective += movement - cxLeft;
lpPrev->cx = lpPrev->cxEffective;
}
@@ -1929,7 +2063,7 @@ REBAR_DeleteBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
if (infoPtr->uNumBands == 1)
REBAR_ValidateBand (infoPtr, &infoPtr->bands[0]);
- REBAR_Layout(infoPtr, NULL);
+ REBAR_Layout(infoPtr);
return TRUE;
}
@@ -2142,11 +2276,10 @@ REBAR_GetRect (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
return FALSE;
lpBand = &infoPtr->bands[iBand];
- /* For CCS_VERT the coordintes will be swapped - like on Windows */
+ /* For CCS_VERT the coordinates will be swapped - like on Windows */
CopyRect (lprc, &lpBand->rcBand);
- TRACE("band %d, (%d,%d)-(%d,%d)\n", iBand,
- lprc->left, lprc->top, lprc->right, lprc->bottom);
+ TRACE("band %d, (%s)\n", iBand, wine_dbgstr_rect(lprc));
return TRUE;
}
@@ -2303,7 +2436,7 @@ REBAR_InsertBandT(REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnico
REBAR_DumpBand (infoPtr);
- REBAR_Layout(infoPtr, NULL);
+ REBAR_Layout(infoPtr);
InvalidateRect(infoPtr->hwndSelf, 0, TRUE);
return TRUE;
@@ -2330,6 +2463,13 @@ REBAR_MaximizeBand (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
lpBand = &infoPtr->bands[uBand];
+ if (lpBand->fStyle & RBBS_HIDDEN)
+ {
+ /* Windows is buggy and creates a hole */
+ WARN("Ignoring maximize request on a hidden band (%d)\n", uBand);
+ return FALSE;
+ }
+
cxIdealBand = lpBand->cxIdeal + lpBand->cxHeader + REBAR_POST_CHILD;
if (lParam && (lpBand->cxEffective < cxIdealBand))
cxDesired = cxIdealBand;
@@ -2342,7 +2482,7 @@ REBAR_MaximizeBand (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
if (extra > 0)
extra = REBAR_ShrinkBandsRTL(infoPtr, iRowBegin, uBand, extra, TRUE);
if (extra > 0)
- extra = REBAR_ShrinkBandsLTR(infoPtr, next_band(infoPtr, uBand), iRowEnd, extra, TRUE);
+ extra = REBAR_ShrinkBandsLTR(infoPtr, next_visible(infoPtr, uBand), iRowEnd, extra, TRUE);
lpBand->cxEffective += extraOrig - extra;
lpBand->cx = lpBand->cxEffective;
TRACE("(%ld, %ld): Wanted size %d, obtained %d (shrink %d, %d)\n", wParam, lParam, cxDesired, lpBand->cx, extraOrig, extra);
@@ -2381,10 +2521,18 @@ REBAR_MinimizeBand (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
/* compute amount of movement and validate */
lpBand = &infoPtr->bands[uBand];
- iPrev = prev_band(infoPtr, uBand);
+
+ if (lpBand->fStyle & RBBS_HIDDEN)
+ {
+ /* Windows is buggy and creates a hole/overlap */
+ WARN("Ignoring minimize request on a hidden band (%d)\n", uBand);
+ return FALSE;
+ }
+
+ iPrev = prev_visible(infoPtr, uBand);
/* if first band in row */
if (iPrev < 0 || infoPtr->bands[iPrev].iRow != lpBand->iRow) {
- int iNext = next_band(infoPtr, uBand);
+ int iNext = next_visible(infoPtr, uBand);
if (iNext < infoPtr->uNumBands && infoPtr->bands[iNext].iRow == lpBand->iRow) {
TRACE("(%ld): Minimizing the first band in row is by maximizing the second\n", wParam);
REBAR_MaximizeBand(infoPtr, iNext, FALSE);
@@ -2394,9 +2542,9 @@ REBAR_MinimizeBand (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
return TRUE;
}
- infoPtr->bands[iPrev].cxEffective += lpBand->cxEffective - lpBand->lcx;
+ infoPtr->bands[iPrev].cxEffective += lpBand->cxEffective - lpBand->cxMinBand;
infoPtr->bands[iPrev].cx = infoPtr->bands[iPrev].cxEffective;
- lpBand->cx = lpBand->cxEffective = lpBand->lcx;
+ lpBand->cx = lpBand->cxEffective = lpBand->cxMinBand;
iRowBegin = get_row_begin_for_band(infoPtr, uBand);
iRowEnd = get_row_end_for_band(infoPtr, uBand);
@@ -2430,7 +2578,7 @@ REBAR_MoveBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
}
/* save one to be moved */
- memcpy (&holder, &oldBands[uFrom], sizeof(REBAR_BAND));
+ holder = oldBands[uFrom];
/* close up rest of bands (pseudo delete) */
if (uFrom < infoPtr->uNumBands - 1) {
@@ -2449,7 +2597,7 @@ REBAR_MoveBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
}
/* set moved band */
- memcpy (&infoPtr->bands[uTo], &holder, sizeof(REBAR_BAND));
+ infoPtr->bands[uTo] = holder;
/* post copy */
if (uTo < infoPtr->uNumBands - 1) {
@@ -2523,8 +2671,8 @@ REBAR_SetBandInfoT(REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnic
REBAR_DumpBand (infoPtr);
- if (bChanged && (lprbbi->fMask & (RBBIM_CHILDSIZE | RBBIM_SIZE | RBBIM_STYLE))) {
- REBAR_Layout(infoPtr, NULL);
+ if (bChanged && (lprbbi->fMask & (RBBIM_CHILDSIZE | RBBIM_SIZE | RBBIM_STYLE | RBBIM_IMAGE))) {
+ REBAR_Layout(infoPtr);
InvalidateRect(infoPtr->hwndSelf, 0, 1);
}
@@ -2673,7 +2821,7 @@ REBAR_ShowBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
ShowWindow (lpBand->hwndChild, SW_HIDE);
}
- REBAR_Layout(infoPtr, NULL);
+ REBAR_Layout(infoPtr);
InvalidateRect(infoPtr->hwndSelf, 0, 1);
return TRUE;
@@ -2684,25 +2832,12 @@ static LRESULT
REBAR_SizeToRect (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
{
LPRECT lpRect = (LPRECT)lParam;
- RECT t1;
if (lpRect == NULL)
return FALSE;
- TRACE("[%d %d %d %d]\n",
- lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
-
- /* what is going on???? */
- GetWindowRect(infoPtr->hwndSelf, &t1);
- TRACE("window rect [%d %d %d %d]\n",
- t1.left, t1.top, t1.right, t1.bottom);
- GetClientRect(infoPtr->hwndSelf, &t1);
- TRACE("client rect [%d %d %d %d]\n",
- t1.left, t1.top, t1.right, t1.bottom);
-
- /* force full _Layout processing */
- REBAR_Layout(infoPtr, lpRect);
- InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
+ TRACE("[%s]\n", wine_dbgstr_rect(lpRect));
+ REBAR_SizeToHeight(infoPtr, get_rect_cy(infoPtr, lpRect));
return TRUE;
}
@@ -2718,9 +2853,8 @@ REBAR_Create (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
if (TRACE_ON(rebar)) {
GetWindowRect(infoPtr->hwndSelf, &wnrc1);
GetClientRect(infoPtr->hwndSelf, &clrc1);
- TRACE("window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d) cs=(%d,%d %dx%d)\n",
- wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,
- clrc1.left, clrc1.top, clrc1.right, clrc1.bottom,
+ TRACE("window=(%s) client=(%s) cs=(%d,%d %dx%d)\n",
+ wine_dbgstr_rect(&wnrc1), wine_dbgstr_rect(&clrc1),
cs->x, cs->y, cs->cx, cs->cy);
}
@@ -3016,7 +3150,7 @@ REBAR_NCCalcSize (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
/* FIXME: should use GetThemeInt */
rect->top = min(rect->top + 1, rect->bottom);
}
- TRACE("new client=(%d,%d)-(%d,%d)\n", rect->left, rect->top, rect->right, rect->bottom);
+ TRACE("new client=(%s)\n", wine_dbgstr_rect(rect));
return 0;
}
@@ -3038,9 +3172,8 @@ REBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (TRACE_ON(rebar)) {
GetWindowRect(hwnd, &wnrc1);
GetClientRect(hwnd, &clrc1);
- TRACE("window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d) cs=(%d,%d %dx%d)\n",
- wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,
- clrc1.left, clrc1.top, clrc1.right, clrc1.bottom,
+ TRACE("window=(%s) client=(%s) cs=(%d,%d %dx%d)\n",
+ wine_dbgstr_rect(&wnrc1), wine_dbgstr_rect(&clrc1),
cs->x, cs->y, cs->cx, cs->cy);
}
@@ -3167,9 +3300,7 @@ REBAR_NCPaint (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
return 0;
GetWindowRect (infoPtr->hwndSelf, &rcWindow);
OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top);
- TRACE("rect (%d,%d)-(%d,%d)\n",
- rcWindow.left, rcWindow.top,
- rcWindow.right, rcWindow.bottom);
+ TRACE("rect (%s)\n", wine_dbgstr_rect(&rcWindow));
DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_RECT);
ReleaseDC( infoPtr->hwndSelf, hdc );
}
@@ -3180,9 +3311,7 @@ REBAR_NCPaint (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
return 0;
GetWindowRect (infoPtr->hwndSelf, &rcWindow);
OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top);
- TRACE("rect (%d,%d)-(%d,%d)\n",
- rcWindow.left, rcWindow.top,
- rcWindow.right, rcWindow.bottom);
+ TRACE("rect (%s)\n", wine_dbgstr_rect(&rcWindow));
DrawThemeEdge (theme, hdc, 0, 0, &rcWindow, BDR_RAISEDINNER, BF_TOP, NULL);
ReleaseDC( infoPtr->hwndSelf, hdc );
}
@@ -3213,26 +3342,23 @@ REBAR_NotifyFormat (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
static LRESULT
REBAR_Paint (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
{
- HDC hdc;
- PAINTSTRUCT ps;
- RECT rc;
+ HDC hdc = (HDC)wParam;
- GetClientRect(infoPtr->hwndSelf, &rc);
- hdc = wParam==0 ? BeginPaint (infoPtr->hwndSelf, &ps) : (HDC)wParam;
-
- TRACE("painting (%d,%d)-(%d,%d) client (%d,%d)-(%d,%d)\n",
- ps.rcPaint.left, ps.rcPaint.top,
- ps.rcPaint.right, ps.rcPaint.bottom,
- rc.left, rc.top, rc.right, rc.bottom);
-
- if (ps.fErase) {
- /* Erase area of paint if requested */
- REBAR_InternalEraseBkGnd (infoPtr, wParam, lParam, &ps.rcPaint);
+ if (hdc) {
+ TRACE("painting\n");
+ REBAR_Refresh (infoPtr, hdc);
+ } else {
+ PAINTSTRUCT ps;
+ hdc = BeginPaint (infoPtr->hwndSelf, &ps);
+ TRACE("painting (%s)\n", wine_dbgstr_rect(&ps.rcPaint));
+ if (ps.fErase) {
+ /* Erase area of paint if requested */
+ REBAR_InternalEraseBkGnd (infoPtr, wParam, lParam, &ps.rcPaint);
+ }
+ REBAR_Refresh (infoPtr, hdc);
+ EndPaint (infoPtr->hwndSelf, &ps);
}
- REBAR_Refresh (infoPtr, hdc);
- if (!wParam)
- EndPaint (infoPtr->hwndSelf, &ps);
return 0;
}
@@ -3278,7 +3404,7 @@ REBAR_SetFont (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
REBAR_ValidateBand (infoPtr, lpBand);
}
- REBAR_Layout(infoPtr, NULL);
+ REBAR_Layout(infoPtr);
return 0;
}
@@ -3319,27 +3445,18 @@ REBAR_Size (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
{
TRACE("wParam=%lx, lParam=%lx\n", wParam, lParam);
- /* avoid auto resize infinite recursion */
- if (infoPtr->fStatus & AUTO_RESIZE) {
- infoPtr->fStatus &= ~AUTO_RESIZE;
- TRACE("AUTO_RESIZE was set, reset, fStatus=%08x lparam=%08lx\n",
+ /* avoid _Layout resize recursion (but it shouldn't be infinite and it seems Windows does recurse) */
+ if (infoPtr->fStatus & SELF_RESIZE) {
+ infoPtr->fStatus &= ~SELF_RESIZE;
+ TRACE("SELF_RESIZE was set, reset, fStatus=%08x lparam=%08lx\n",
infoPtr->fStatus, lParam);
return 0;
}
- /* FIXME: wrong */
- if (infoPtr->dwStyle & RBS_AUTOSIZE) {
- NMRBAUTOSIZE autosize;
-
- GetClientRect(infoPtr->hwndSelf, &autosize.rcTarget);
- autosize.fChanged = 0; /* ??? */
- autosize.rcActual = autosize.rcTarget; /* ??? */
- REBAR_Notify((NMHDR *) &autosize, infoPtr, RBN_AUTOSIZE);
- TRACE("RBN_AUTOSIZE client=(%d,%d), lp=%08lx\n",
- autosize.rcTarget.right, autosize.rcTarget.bottom, lParam);
- }
-
- REBAR_Layout(infoPtr, NULL);
+ if (infoPtr->dwStyle & RBS_AUTOSIZE)
+ REBAR_AutoSize(infoPtr, TRUE);
+ else
+ REBAR_Layout(infoPtr);
return 0;
}
@@ -3357,7 +3474,7 @@ REBAR_StyleChanged (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
infoPtr->dwStyle &= ~WS_BORDER;
/* maybe it should be COMMON_STYLES like in toolbar */
if ((ss->styleNew ^ ss->styleOld) & CCS_VERT)
- REBAR_Layout(infoPtr, NULL);
+ REBAR_Layout(infoPtr);
return FALSE;
}
@@ -3384,8 +3501,7 @@ REBAR_WindowPosChanged (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
ret = DefWindowProcW(infoPtr->hwndSelf, WM_WINDOWPOSCHANGED,
wParam, lParam);
GetWindowRect(infoPtr->hwndSelf, &rc);
- TRACE("hwnd %p new pos (%d,%d)-(%d,%d)\n",
- infoPtr->hwndSelf, rc.left, rc.top, rc.right, rc.bottom);
+ TRACE("hwnd %p new pos (%s)\n", infoPtr->hwndSelf, wine_dbgstr_rect(&rc));
return ret;
}
diff --git a/reactos/dll/win32/comctl32/rsrc.rc b/reactos/dll/win32/comctl32/rsrc.rc
index 06ffd4d0f11..9028df9444d 100644
--- a/reactos/dll/win32/comctl32/rsrc.rc
+++ b/reactos/dll/win32/comctl32/rsrc.rc
@@ -107,6 +107,7 @@ IDI_TT_ERROR_SM ICON LOADONCALL DISCARDABLE idi_tt_error_sm.ico
#include "comctl_No.rc"
#include "comctl_Pl.rc"
#include "comctl_Pt.rc"
+#include "comctl_Ro.rc"
#include "comctl_Ru.rc"
#include "comctl_Si.rc"
#include "comctl_Sv.rc"
diff --git a/reactos/dll/win32/comctl32/status.c b/reactos/dll/win32/comctl32/status.c
index 1b9e786ea1e..e704635d043 100644
--- a/reactos/dll/win32/comctl32/status.c
+++ b/reactos/dll/win32/comctl32/status.c
@@ -31,7 +31,7 @@
* TODO:
* -- CCS_BOTTOM (default)
* -- CCS_LEFT
- * -- CCS_NODEVIDER
+ * -- CCS_NODIVIDER
* -- CCS_NOMOVEX
* -- CCS_NOMOVEY
* -- CCS_NOPARENTALIGN
@@ -114,8 +114,8 @@ STATUSBAR_DrawSizeGrip (HTHEME theme, HDC hdc, LPRECT lpRect)
POINT pt;
INT i;
- TRACE("draw size grip %d,%d - %d,%d\n", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
-
+ TRACE("draw size grip %s\n", wine_dbgstr_rect(lpRect));
+
if (theme)
{
RECT gripperRect;
@@ -175,7 +175,7 @@ STATUSBAR_DrawPart (const STATUS_INFO *infoPtr, HDC hdc, const STATUSWINDOWPART
HTHEME theme = GetWindowTheme (infoPtr->Self);
int themePart = SP_PANE;
- TRACE("part bound %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom);
+ TRACE("part bound %s\n", wine_dbgstr_rect(&r));
if (part->style & SBT_POPOUT)
border = BDR_RAISEDOUTER;
else if (part->style & SBT_NOBORDERS)
@@ -333,7 +333,7 @@ STATUSBAR_SetPartBounds (STATUS_INFO *infoPtr)
/* get our window size */
GetClientRect (infoPtr->Self, &rect);
- TRACE("client wnd size is %d,%d - %d,%d\n", rect.left, rect.top, rect.right, rect.bottom);
+ TRACE("client wnd size is %s\n", wine_dbgstr_rect(&rect));
rect.left += infoPtr->horizontalBorder;
rect.top += infoPtr->verticalBorder;
@@ -668,7 +668,7 @@ static BOOL
STATUSBAR_SetParts (STATUS_INFO *infoPtr, INT count, LPINT parts)
{
STATUSWINDOWPART *tmp;
- int i, oldNumParts;
+ UINT i, oldNumParts;
TRACE("(%d,%p)\n", count, parts);
@@ -700,7 +700,7 @@ STATUSBAR_SetParts (STATUS_INFO *infoPtr, INT count, LPINT parts)
infoPtr->parts[i].x = parts[i];
if (infoPtr->hwndToolTip) {
- INT nTipCount, i;
+ UINT nTipCount;
TTTOOLINFOW ti;
ZeroMemory (&ti, sizeof(TTTOOLINFOW));
diff --git a/reactos/dll/win32/comctl32/tab.c b/reactos/dll/win32/comctl32/tab.c
index 35973d01e39..4b1673a6a87 100644
--- a/reactos/dll/win32/comctl32/tab.c
+++ b/reactos/dll/win32/comctl32/tab.c
@@ -414,9 +414,8 @@ static BOOL TAB_InternalGetItemRect(
SELECTED_TAB_OFFSET,
0);
}
- TRACE("item %d tab h=%d, rect=(%d,%d)-(%d,%d)\n",
- itemIndex, infoPtr->tabHeight,
- itemRect->left, itemRect->top, itemRect->right, itemRect->bottom);
+ TRACE("item %d tab h=%d, rect=(%s)\n",
+ itemIndex, infoPtr->tabHeight, wine_dbgstr_rect(itemRect));
/* Now, calculate the position of the item as if it were selected. */
if (selectedRect!=NULL)
@@ -529,9 +528,7 @@ static void TAB_FocusChanging(const TAB_INFO *infoPtr)
*/
if (isVisible)
{
- TRACE("invalidate (%d,%d)-(%d,%d)\n",
- selectedRect.left,selectedRect.top,
- selectedRect.right,selectedRect.bottom);
+ TRACE("invalidate (%s)\n", wine_dbgstr_rect(&selectedRect));
InvalidateRect(infoPtr->hwnd, &selectedRect, TRUE);
}
}
@@ -864,7 +861,8 @@ static LRESULT TAB_AdjustRect(const TAB_INFO *infoPtr, WPARAM fLarger, LPRECT pr
DWORD lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE);
LONG *iRightBottom, *iLeftTop;
- TRACE ("hwnd=%p fLarger=%ld (%d,%d)-(%d,%d)\n", infoPtr->hwnd, fLarger, prc->left, prc->top, prc->right, prc->bottom);
+ TRACE ("hwnd=%p fLarger=%ld (%s)\n", infoPtr->hwnd, fLarger,
+ wine_dbgstr_rect(prc));
if(lStyle & TCS_VERTICAL)
{
@@ -1217,8 +1215,7 @@ static void TAB_SetItemBounds (TAB_INFO *infoPtr)
curr->rect.bottom = 0;
curr->rect.top = curItemRowCount - 1;
- TRACE("Rect: T %i, L %i, B %i, R %i\n", curr->rect.top,
- curr->rect.left, curr->rect.bottom, curr->rect.right);
+ TRACE("Rect: %s\n", wine_dbgstr_rect(&curr->rect));
/*
* The leftmost position of the next item is the rightmost position
@@ -1598,8 +1595,7 @@ TAB_DrawItemInterior(const TAB_INFO *infoPtr, HDC hdc, INT iItem, RECT *drawRect
}
}
}
- TRACE("drawRect=(%d,%d)-(%d,%d)\n",
- drawRect->left, drawRect->top, drawRect->right, drawRect->bottom);
+ TRACE("drawRect=(%s)\n", wine_dbgstr_rect(drawRect));
/* Clear interior */
TAB_EraseTabInterior (infoPtr, hdc, iItem, drawRect);
@@ -1742,10 +1738,9 @@ TAB_DrawItemInterior(const TAB_INFO *infoPtr, HDC hdc, INT iItem, RECT *drawRect
if (center_offset_v < 0)
center_offset_v = 0;
- TRACE("for <%s>, c_o_h=%d, c_o_v=%d, draw=(%d,%d)-(%d,%d), textlen=%d\n",
+ TRACE("for <%s>, c_o_h=%d, c_o_v=%d, draw=(%s), textlen=%d\n",
debugstr_w(item->pszText), center_offset_h, center_offset_v,
- drawRect->left, drawRect->top, drawRect->right, drawRect->bottom,
- (rcText.right-rcText.left));
+ wine_dbgstr_rect(drawRect), (rcText.right-rcText.left));
if((lStyle & TCS_VERTICAL) && (lStyle & TCS_BOTTOM))
{
@@ -1873,10 +1868,9 @@ TAB_DrawItemInterior(const TAB_INFO *infoPtr, HDC hdc, INT iItem, RECT *drawRect
}
else
{
- TRACE("for <%s>, c_o_h=%d, c_o_v=%d, draw=(%d,%d)-(%d,%d), textlen=%d\n",
+ TRACE("for <%s>, c_o_h=%d, c_o_v=%d, draw=(%s), textlen=%d\n",
debugstr_w(item->pszText), center_offset_h, center_offset_v,
- drawRect->left, drawRect->top, drawRect->right, drawRect->bottom,
- (rcText.right-rcText.left));
+ wine_dbgstr_rect(drawRect), (rcText.right-rcText.left));
if (item->pszText)
{
DrawTextW
@@ -2044,7 +2038,7 @@ static void TAB_DrawItem(const TAB_INFO *infoPtr, HDC hdc, INT iItem)
{
/* These are for adjusting the drawing of a Selected tab */
/* The initial values are for the normal case of non-Selected */
- int ZZ = 1; /* Do not strech if selected */
+ int ZZ = 1; /* Do not stretch if selected */
if (iItem == infoPtr->iSelected) {
ZZ = 0;
@@ -2061,10 +2055,8 @@ static void TAB_DrawItem(const TAB_INFO *infoPtr, HDC hdc, INT iItem)
/* Adjust both rectangles to match native */
r.left += (1-ZZ);
- TRACE(" item=%d, fill=(%d,%d)-(%d,%d), edge=(%d,%d)-(%d,%d)\n",
- iItem,
- fillRect.left,fillRect.top,fillRect.right,fillRect.bottom,
- r.left,r.top,r.right,r.bottom);
+ TRACE(" item=%d, fill=(%s), edge=(%s)\n",
+ iItem, wine_dbgstr_rect(&fillRect), wine_dbgstr_rect(&r));
/* Clear interior */
SetBkColor(hdc, bkgnd);
@@ -2102,10 +2094,8 @@ static void TAB_DrawItem(const TAB_INFO *infoPtr, HDC hdc, INT iItem)
}
else
{
- TRACE(" item=%d, fill=(%d,%d)-(%d,%d), edge=(%d,%d)-(%d,%d)\n",
- iItem,
- fillRect.left,fillRect.top,fillRect.right,fillRect.bottom,
- r.left,r.top,r.right,r.bottom);
+ TRACE(" item=%d, fill=(%s), edge=(%s)\n",
+ iItem, wine_dbgstr_rect(&fillRect), wine_dbgstr_rect(&r));
/* Clear interior */
SetBkColor(hdc, bkgnd);
@@ -2156,10 +2146,8 @@ static void TAB_DrawItem(const TAB_INFO *infoPtr, HDC hdc, INT iItem)
r.top -= 1;
}
- TRACE(" item=%d, fill=(%d,%d)-(%d,%d), edge=(%d,%d)-(%d,%d)\n",
- iItem,
- fillRect.left,fillRect.top,fillRect.right,fillRect.bottom,
- r.left,r.top,r.right,r.bottom);
+ TRACE(" item=%d, fill=(%s), edge=(%s)\n",
+ iItem, wine_dbgstr_rect(&fillRect), wine_dbgstr_rect(&r));
/* Clear interior */
SetBkColor(hdc, bkgnd);
@@ -2210,10 +2198,8 @@ static void TAB_DrawItem(const TAB_INFO *infoPtr, HDC hdc, INT iItem)
r.bottom += 2;
}
- TRACE(" item=%d, fill=(%d,%d)-(%d,%d), edge=(%d,%d)-(%d,%d)\n",
- iItem,
- fillRect.left,fillRect.top,fillRect.right,fillRect.bottom,
- r.left,r.top,r.right,r.bottom);
+ TRACE(" item=%d, fill=(%s), edge=(%s)\n",
+ iItem, wine_dbgstr_rect(&fillRect), wine_dbgstr_rect(&r));
/* Clear interior */
SetBkColor(hdc, bkgnd);
@@ -2281,8 +2267,7 @@ static void TAB_DrawBorder(const TAB_INFO *infoPtr, HDC hdc)
rect.top += infoPtr->tabHeight * infoPtr->uNumRows + CONTROL_BORDER_SIZEX;
}
- TRACE("border=(%d,%d)-(%d,%d)\n",
- rect.left, rect.top, rect.right, rect.bottom);
+ TRACE("border=(%s)\n", wine_dbgstr_rect(&rect));
if (theme)
DrawThemeBackground (theme, hdc, TABP_PANE, 0, &rect, NULL);
@@ -2517,11 +2502,9 @@ static void TAB_InvalidateTabArea(const TAB_INFO *infoPtr)
else
rInvalidate.right = clientRect.right - r.left;
}
-
- TRACE("invalidate (%d,%d)-(%d,%d)\n",
- rInvalidate.left, rInvalidate.top,
- rInvalidate.right, rInvalidate.bottom);
-
+
+ TRACE("invalidate (%s)\n", wine_dbgstr_rect(&rInvalidate));
+
InvalidateRect(infoPtr->hwnd, &rInvalidate, TRUE);
}
@@ -2535,9 +2518,7 @@ static inline LRESULT TAB_Paint (TAB_INFO *infoPtr, HDC hdcPaint)
else
{
hdc = BeginPaint (infoPtr->hwnd, &ps);
- TRACE("erase %d, rect=(%d,%d)-(%d,%d)\n",
- ps.fErase,
- ps.rcPaint.left,ps.rcPaint.top,ps.rcPaint.right,ps.rcPaint.bottom);
+ TRACE("erase %d, rect=(%s)\n", ps.fErase, wine_dbgstr_rect(&ps.rcPaint));
}
TAB_Refresh (infoPtr, hdc);
@@ -2557,8 +2538,7 @@ TAB_InsertItemT (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnicode)
RECT rect;
GetClientRect (infoPtr->hwnd, &rect);
- TRACE("Rect: %p T %i, L %i, B %i, R %i\n", infoPtr->hwnd,
- rect.top, rect.left, rect.bottom, rect.right);
+ TRACE("Rect: %p %s\n", infoPtr->hwnd, wine_dbgstr_rect(&rect));
pti = (TCITEMW *)lParam;
iItem = (INT)wParam;
diff --git a/reactos/dll/win32/comctl32/toolbar.c b/reactos/dll/win32/comctl32/toolbar.c
index 21817b2f6bb..1bda0ccca63 100644
--- a/reactos/dll/win32/comctl32/toolbar.c
+++ b/reactos/dll/win32/comctl32/toolbar.c
@@ -283,11 +283,10 @@ TOOLBAR_DumpButton(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *bP, INT btn_
bP->fsState, bP->fsStyle, bP->dwData, bP->iString);
TRACE("string %s\n", debugstr_w(TOOLBAR_GetText(infoPtr,bP)));
if (internal)
- TRACE("button %d id %d, hot=%s, row=%d, rect=(%d,%d)-(%d,%d)\n",
+ TRACE("button %d id %d, hot=%s, row=%d, rect=(%s)\n",
btn_num, bP->idCommand,
(bP->bHot) ? "TRUE":"FALSE", bP->nRow,
- bP->rect.left, bP->rect.top,
- bP->rect.right, bP->rect.bottom);
+ wine_dbgstr_rect(&bP->rect));
}
}
@@ -509,8 +508,7 @@ TOOLBAR_DrawDDFlatSeparator (const RECT *lpRect, HDC hdc, const TBUTTON_INFO *bt
InflateRect (&myrect, -2, 0);
- TRACE("rect=(%d,%d)-(%d,%d)\n",
- myrect.left, myrect.top, myrect.right, myrect.bottom);
+ TRACE("rect=(%s)\n", wine_dbgstr_rect(&myrect));
newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ?
comctl32_color.clrBtnShadow : infoPtr->clrBtnShadow;
@@ -568,8 +566,8 @@ TOOLBAR_DrawString (const TOOLBAR_INFO *infoPtr, RECT *rcText, LPCWSTR lpText,
/* draw text */
if (lpText) {
- TRACE("string=%s rect=(%d,%d)-(%d,%d)\n", debugstr_w(lpText),
- rcText->left, rcText->top, rcText->right, rcText->bottom);
+ TRACE("string=%s rect=(%s)\n", debugstr_w(lpText),
+ wine_dbgstr_rect(rcText));
hOldFont = SelectObject (hdc, infoPtr->hFont);
if ((state & CDIS_HOT) && (dwItemCDFlag & TBCDRF_HILITEHOTTRACK )) {
@@ -880,7 +878,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc, DWORD dwBaseCustDr
}
/* copy text & bitmap rects after adjusting for drop-down arrow
- * so that text & bitmap is centred in the rectangle not containing
+ * so that text & bitmap is centered in the rectangle not containing
* the arrow */
CopyRect(&rcText, &rc);
CopyRect(&rcBitmap, &rc);
@@ -1769,7 +1767,7 @@ TOOLBAR_LayoutToolbar(HWND hwnd)
else
y += cy;
- /* nSepRows is used to calculate the extra height follwoing */
+ /* nSepRows is used to calculate the extra height following */
/* the last row. */
nSepRows++;
}
@@ -2089,7 +2087,7 @@ static void TOOLBAR_Cust_AddButton(const CUSTDLG_INFO *custInfo, HWND hwnd, INT
/* duplicate 'separator' button */
btnNew = (PCUSTOMBUTTON)Alloc(sizeof(CUSTOMBUTTON));
- memcpy(btnNew, btnInfo, sizeof(CUSTOMBUTTON));
+ *btnNew = *btnInfo;
btnInfo = btnNew;
}
@@ -2372,7 +2370,7 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
IDC_TOOLBARBTN_LBOX, LB_GETITEMDATA, index, 0);
}
- memcpy (&btnInfo->btn, &nmtb.tbButton, sizeof(TBBUTTON));
+ btnInfo->btn = nmtb.tbButton;
if (!(nmtb.tbButton.fsStyle & BTNS_SEP))
{
if (lstrlenW(nmtb.pszText))
@@ -4967,7 +4965,7 @@ TOOLBAR_SetRows (HWND hwnd, WPARAM wParam, LPARAM lParam)
rows (if CCS_NORESIZE is set), or will take up the whole window
(if no CCS_NORESIZE).
- Basic algorithum - If N buttons, and y rows requested, each row
+ Basic algorithm - If N buttons, and y rows requested, each row
contains N/y buttons.
FIXME: Handling of separators not obvious from testing results
@@ -5188,6 +5186,7 @@ TOOLBAR_GetStringA (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (iString < infoPtr->nNumStrings)
{
ret = WideCharToMultiByte(CP_ACP, 0, infoPtr->strings[iString], -1, str, buffersize, NULL, NULL);
+ ret--;
TRACE("returning %s\n", debugstr_a(str));
}
@@ -5213,13 +5212,17 @@ TOOLBAR_GetStringW (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
len = min(len, strlenW(infoPtr->strings[iString]));
ret = (len+1)*sizeof(WCHAR);
- memcpy(str, infoPtr->strings[iString], ret);
- str[len] = '\0';
+ if (str)
+ {
+ memcpy(str, infoPtr->strings[iString], ret);
+ str[len] = '\0';
+ }
+ ret = len;
TRACE("returning %s\n", debugstr_w(str));
}
else
- ERR("String index %d out of range (largest is %d)\n", iString, infoPtr->nNumStrings - 1);
+ WARN("String index %d out of range (largest is %d)\n", iString, infoPtr->nNumStrings - 1);
return ret;
}
@@ -5321,8 +5324,7 @@ TOOLBAR_Unkwn463 (HWND hwnd, WPARAM wParam, LPARAM lParam)
GetWindowRect(hwnd, &rc);
MapWindowPoints(0, hwndParent, (LPPOINT)&rc, 2);
- TRACE("mapped to (%d,%d)-(%d,%d)\n",
- rc.left, rc.top, rc.right, rc.bottom);
+ TRACE("mapped to (%s)\n", wine_dbgstr_rect(&rc));
lpsize->cx = max(rc.right-rc.left,
infoPtr->rcBound.right - infoPtr->rcBound.left);
}
@@ -6458,13 +6460,11 @@ TOOLBAR_Paint (HWND hwnd, WPARAM wParam)
PAINTSTRUCT ps;
/* fill ps.rcPaint with a default rect */
- memcpy(&(ps.rcPaint), &(infoPtr->rcBound), sizeof(infoPtr->rcBound));
+ ps.rcPaint = infoPtr->rcBound;
hdc = wParam==0 ? BeginPaint(hwnd, &ps) : (HDC)wParam;
- TRACE("psrect=(%d,%d)-(%d,%d)\n",
- ps.rcPaint.left, ps.rcPaint.top,
- ps.rcPaint.right, ps.rcPaint.bottom);
+ TRACE("psrect=(%s)\n", wine_dbgstr_rect(&ps.rcPaint));
TOOLBAR_Refresh (hwnd, hdc, &ps);
if (!wParam) EndPaint (hwnd, &ps);
@@ -7184,7 +7184,7 @@ static BOOL TOOLBAR_GetButtonInfo(const TOOLBAR_INFO *infoPtr, NMTOOLBARW *nmtb)
MultiByteToWideChar(CP_ACP, 0, (LPCSTR)nmtba.pszText, -1,
nmtb->pszText, nmtb->cchText);
- memcpy(&nmtb->tbButton, &nmtba.tbButton, sizeof(TBBUTTON));
+ nmtb->tbButton = nmtba.tbButton;
bRet = TRUE;
}
diff --git a/reactos/dll/win32/comctl32/tooltips.c b/reactos/dll/win32/comctl32/tooltips.c
index 695da3ca6ee..efdc41e49e1 100644
--- a/reactos/dll/win32/comctl32/tooltips.c
+++ b/reactos/dll/win32/comctl32/tooltips.c
@@ -202,6 +202,44 @@ TOOLTIPS_InitSystemSettings (TOOLTIPS_INFO *infoPtr)
infoPtr->hTitleFont = CreateFontIndirectW (&nclm.lfStatusFont);
}
+/* Custom draw routines */
+static void
+TOOLTIPS_customdraw_fill(NMTTCUSTOMDRAW *lpnmttcd,
+ const HWND hwnd,
+ HDC hdc, const RECT *rcBounds, UINT uFlags)
+{
+ TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr(hwnd);
+
+ ZeroMemory(lpnmttcd, sizeof(NMTTCUSTOMDRAW));
+ lpnmttcd->uDrawFlags = uFlags;
+ lpnmttcd->nmcd.hdr.hwndFrom = hwnd;
+ lpnmttcd->nmcd.hdr.code = NM_CUSTOMDRAW;
+ if (infoPtr->nCurrentTool != -1) {
+ TTTOOL_INFO *toolPtr = &infoPtr->tools[infoPtr->nCurrentTool];
+ lpnmttcd->nmcd.hdr.idFrom = toolPtr->uId;
+ }
+ lpnmttcd->nmcd.hdc = hdc;
+ lpnmttcd->nmcd.rc = *rcBounds;
+ /* FIXME - dwItemSpec, uItemState, lItemlParam */
+}
+
+static inline DWORD
+TOOLTIPS_notify_customdraw (DWORD dwDrawStage, NMTTCUSTOMDRAW *lpnmttcd)
+{
+ LRESULT result = CDRF_DODEFAULT;
+ lpnmttcd->nmcd.dwDrawStage = dwDrawStage;
+
+ TRACE("Notifying stage %d, flags %x, id %x\n", lpnmttcd->nmcd.dwDrawStage,
+ lpnmttcd->uDrawFlags, lpnmttcd->nmcd.hdr.code);
+
+ result = SendMessageW(GetParent(lpnmttcd->nmcd.hdr.hwndFrom), WM_NOTIFY,
+ 0, (LPARAM)lpnmttcd);
+
+ TRACE("Notify result %x\n", (unsigned int)result);
+
+ return result;
+}
+
static void
TOOLTIPS_Refresh (HWND hwnd, HDC hdc)
{
@@ -213,6 +251,8 @@ TOOLTIPS_Refresh (HWND hwnd, HDC hdc)
UINT uFlags = DT_EXTERNALLEADING;
HRGN hRgn = NULL;
DWORD dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
+ NMTTCUSTOMDRAW nmttcd;
+ DWORD cdmode;
if (infoPtr->nMaxTipWidth > -1)
uFlags |= DT_WORDBREAK;
@@ -224,6 +264,13 @@ TOOLTIPS_Refresh (HWND hwnd, HDC hdc)
oldBkMode = SetBkMode (hdc, TRANSPARENT);
SetTextColor (hdc, infoPtr->clrText);
+ hOldFont = SelectObject (hdc, infoPtr->hFont);
+
+ /* Custom draw - Call PrePaint once initial properties set up */
+ /* Note: Contrary to MSDN, CDRF_SKIPDEFAULT still draws a tooltip */
+ TOOLTIPS_customdraw_fill(&nmttcd, hwnd, hdc, &rc, uFlags);
+ cdmode = TOOLTIPS_notify_customdraw(CDDS_PREPAINT, &nmttcd);
+ uFlags = nmttcd.uDrawFlags;
if (dwStyle & TTS_BALLOON)
{
@@ -259,6 +306,7 @@ TOOLTIPS_Refresh (HWND hwnd, HDC hdc)
RECT rcTitle = {rc.left, rc.top, rc.right, rc.bottom};
int height;
BOOL icon_present;
+ HFONT prevFont;
/* draw icon */
icon_present = infoPtr->hTitleIcon &&
@@ -270,9 +318,9 @@ TOOLTIPS_Refresh (HWND hwnd, HDC hdc)
rcTitle.bottom = rc.top + ICON_HEIGHT;
/* draw title text */
- hOldFont = SelectObject (hdc, infoPtr->hTitleFont);
+ prevFont = SelectObject (hdc, infoPtr->hTitleFont);
height = DrawTextW(hdc, infoPtr->pszTitle, -1, &rcTitle, DT_BOTTOM | DT_SINGLELINE | DT_NOPREFIX);
- SelectObject (hdc, hOldFont);
+ SelectObject (hdc, prevFont);
rc.top += height + BALLOON_TITLE_TEXT_SPACING;
}
}
@@ -286,8 +334,13 @@ TOOLTIPS_Refresh (HWND hwnd, HDC hdc)
}
/* draw text */
- hOldFont = SelectObject (hdc, infoPtr->hFont);
DrawTextW (hdc, infoPtr->szTipText, -1, &rc, uFlags);
+
+ /* Custom draw - Call PostPaint after drawing */
+ if (cdmode & CDRF_NOTIFYPOSTPAINT) {
+ TOOLTIPS_notify_customdraw(CDDS_POSTPAINT, &nmttcd);
+ }
+
/* be polite and reset the things we changed in the dc */
SelectObject (hdc, hOldFont);
SetBkMode (hdc, oldBkMode);
@@ -752,7 +805,7 @@ TOOLTIPS_Show (HWND hwnd, TOOLTIPS_INFO *infoPtr, BOOL track_activate)
* it is no longer needed */
}
- SetWindowPos (hwnd, HWND_TOP, rect.left, rect.top,
+ SetWindowPos (hwnd, HWND_TOPMOST, rect.left, rect.top,
rect.right - rect.left, rect.bottom - rect.top,
SWP_SHOWWINDOW | SWP_NOACTIVATE);
diff --git a/reactos/dll/win32/comctl32/trackbar.c b/reactos/dll/win32/comctl32/trackbar.c
index 076313f67c4..7cdfe71c606 100644
--- a/reactos/dll/win32/comctl32/trackbar.c
+++ b/reactos/dll/win32/comctl32/trackbar.c
@@ -439,8 +439,7 @@ TRACKBAR_CalcSelection (TRACKBAR_INFO *infoPtr)
}
}
- TRACE("selection[left=%d, top=%d, right=%d, bottom=%d]\n",
- selection->left, selection->top, selection->right, selection->bottom);
+ TRACE("selection[%s]\n", wine_dbgstr_rect(selection));
}
static BOOL
@@ -865,14 +864,11 @@ TRACKBAR_Refresh (TRACKBAR_INFO *infoPtr, HDC hdcDst)
gcdrf = notify_customdraw(infoPtr, &nmcd, CDDS_PREPAINT);
if (gcdrf & CDRF_SKIPDEFAULT) goto cleanup;
- /* Erase backbround */
+ /* Erase background */
if (gcdrf == CDRF_DODEFAULT ||
notify_customdraw(infoPtr, &nmcd, CDDS_PREERASE) != CDRF_SKIPDEFAULT) {
if ((theme = GetWindowTheme (infoPtr->hwndSelf))) {
- DrawThemeBackground (theme, hdc,
- (GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_VERT) ?
- TKP_TRACKVERT : TKP_TRACK, TKS_NORMAL, &rcClient, 0);
- DrawThemeParentBackground (infoPtr->hwndSelf, hdc, &rcClient);
+ DrawThemeParentBackground (infoPtr->hwndSelf, hdc, 0);
}
else
FillRect (hdc, &rcClient, GetSysColorBrush(COLOR_BTNFACE));
diff --git a/reactos/dll/win32/comctl32/treeview.c b/reactos/dll/win32/comctl32/treeview.c
index 9ecc45c4fd5..84b23f5d252 100644
--- a/reactos/dll/win32/comctl32/treeview.c
+++ b/reactos/dll/win32/comctl32/treeview.c
@@ -169,7 +169,7 @@ typedef struct tagTREEVIEW_INFO
#define TV_VSCROLL 0x02 /* (horizontal/vertical) */
#define TV_LDRAG 0x04 /* Lbutton pushed to start drag */
#define TV_LDRAGGING 0x08 /* Lbutton pushed, mouse moved. */
-#define TV_RDRAG 0x10 /* dito Rbutton */
+#define TV_RDRAG 0x10 /* ditto Rbutton */
#define TV_RDRAGGING 0x20
/* bitflags for infoPtr->timer */
@@ -241,8 +241,6 @@ TREEVIEW_GetInfoPtr(HWND hwnd)
static inline int
TREEVIEW_GetItemIndex(const TREEVIEW_INFO *infoPtr, HTREEITEM handle)
{
- assert(infoPtr != NULL);
-
return DPA_GetPtrIndex(infoPtr->items, handle);
}
@@ -407,8 +405,6 @@ TREEVIEW_GetPrevListItem(const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *tvIt
static TREEVIEW_ITEM *
TREEVIEW_GetNextListItem(const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *tvItem)
{
- assert(tvItem != NULL);
-
/*
* If this item has children and is expanded, return the first child
*/
@@ -1049,7 +1045,6 @@ static void
TREEVIEW_InsertBefore(TREEVIEW_ITEM *newItem, TREEVIEW_ITEM *sibling,
TREEVIEW_ITEM *parent)
{
- assert(newItem != NULL);
assert(parent != NULL);
if (sibling != NULL)
@@ -1082,7 +1077,6 @@ static void
TREEVIEW_InsertAfter(TREEVIEW_ITEM *newItem, TREEVIEW_ITEM *sibling,
TREEVIEW_ITEM *parent)
{
- assert(newItem != NULL);
assert(parent != NULL);
if (sibling != NULL)
@@ -2033,8 +2027,7 @@ TREEVIEW_GetItemRect(const TREEVIEW_INFO *infoPtr, BOOL fTextRect, LPRECT lpRect
*lpRect = wineItem->rect;
}
- TRACE("%s [L:%d R:%d T:%d B:%d]\n", fTextRect ? "text" : "item",
- lpRect->left, lpRect->right, lpRect->top, lpRect->bottom);
+ TRACE("%s [%s]\n", fTextRect ? "text" : "item", wine_dbgstr_rect(lpRect));
return TRUE;
}
@@ -2042,7 +2035,7 @@ TREEVIEW_GetItemRect(const TREEVIEW_INFO *infoPtr, BOOL fTextRect, LPRECT lpRect
static inline LRESULT
TREEVIEW_GetVisibleCount(const TREEVIEW_INFO *infoPtr)
{
- /* Suprise! This does not take integral height into account. */
+ /* Surprise! This does not take integral height into account. */
return infoPtr->clientHeight / infoPtr->uItemHeight;
}
@@ -2138,7 +2131,7 @@ TREEVIEW_SetItemT(TREEVIEW_INFO *infoPtr, const TVITEMEXW *tvItem, BOOL isW)
if (!TREEVIEW_ValidItem(infoPtr, wineItem))
return FALSE;
- /* store the orignal item values */
+ /* store the original item values */
originalItem = *wineItem;
if (!TREEVIEW_DoSetItemT(infoPtr, wineItem, tvItem, isW))
@@ -2580,9 +2573,8 @@ TREEVIEW_DrawItem(const TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *wineItem
rcText.left = wineItem->textOffset;
rcText.right = rcText.left + wineItem->textWidth + 4;
- TRACE("drawing text %s at (%d,%d)-(%d,%d)\n",
- debugstr_w(wineItem->pszText),
- rcText.left, rcText.top, rcText.right, rcText.bottom);
+ TRACE("drawing text %s at (%s)\n",
+ debugstr_w(wineItem->pszText), wine_dbgstr_rect(&rcText));
/* Draw it */
ExtTextOutW(hdc, rcText.left + 2, rcText.top + 1,
@@ -3015,7 +3007,7 @@ TREEVIEW_Sort(TREEVIEW_INFO *infoPtr, BOOL fRecurse, HTREEITEM parent,
item = (HTREEITEM)DPA_GetPtr(sortList, count++);
while ((nextItem = (HTREEITEM)DPA_GetPtr(sortList, count++)) != NULL)
{
- /* link the two current item toghether */
+ /* link the two current item together */
item->nextSibling = nextItem;
nextItem->prevSibling = item;
@@ -3586,7 +3578,7 @@ TREEVIEW_Command(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
infoPtr->bLabelChanged = TRUE;
- len = GetWindowTextW(infoPtr->hwndEdit, buffer, sizeof(buffer));
+ len = GetWindowTextW(infoPtr->hwndEdit, buffer, sizeof(buffer)/sizeof(buffer[0]));
/* Select font to get the right dimension of the string */
hFont = (HFONT)SendMessageW(infoPtr->hwndEdit, WM_GETFONT, 0, 0);
@@ -4365,7 +4357,7 @@ TREEVIEW_SelectItem(TREEVIEW_INFO *infoPtr, INT wParam, HTREEITEM item)
* BUGS
*
* - The current implementation has a list of characters it will
- * accept and it ignores averything else. In particular it will
+ * accept and it ignores everything else. In particular it will
* ignore accentuated characters which seems to match what
* Windows does. But I'm not sure it makes sense to follow
* Windows there.
@@ -4515,7 +4507,7 @@ TREEVIEW_EnsureVisible(TREEVIEW_INFO *infoPtr, HTREEITEM item, BOOL bHScroll)
/* Expand parents as necessary. */
HTREEITEM parent;
- /* see if we are trying to ensure that root is vislble */
+ /* see if we are trying to ensure that root is visible */
if((item != infoPtr->root) && TREEVIEW_ValidItem(infoPtr, item))
parent = item->parent;
else
diff --git a/reactos/dll/win32/comctl32/updown.c b/reactos/dll/win32/comctl32/updown.c
index c99507e241d..74a96f652dd 100644
--- a/reactos/dll/win32/comctl32/updown.c
+++ b/reactos/dll/win32/comctl32/updown.c
@@ -137,7 +137,7 @@ static BOOL UPDOWN_InBounds(const UPDOWN_INFO *infoPtr, int val)
/***********************************************************************
* UPDOWN_OffsetVal
* Change the current value by delta.
- * It returns TRUE is the value was changed successfuly, or FALSE
+ * It returns TRUE is the value was changed successfully, or FALSE
* if the value was not changed, as it would go out of bounds.
*/
static BOOL UPDOWN_OffsetVal(UPDOWN_INFO *infoPtr, int delta)
@@ -174,7 +174,7 @@ static BOOL UPDOWN_HasBuddyBorder(const UPDOWN_INFO *infoPtr)
* rect - will hold the rectangle
* arrow - FLAG_INCR to get the "increment" rect (up or right)
* FLAG_DECR to get the "decrement" rect (down or left)
- * If both flags are pressent, the envelope is returned.
+ * If both flags are present, the envelope is returned.
*/
static void UPDOWN_GetArrowRect (const UPDOWN_INFO* infoPtr, RECT *rect, int arrow)
{