ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
November 2014
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
18 participants
373 discussions
Start a n
N
ew thread
[dquintana] 65275: [COMCTL32] * Begin implementing TB_GETMETRICS/TB_SETMETRICS. Will send to wine once the button spacing setting works (after writing tests and whatever else may be necessary).
by dquintana@svn.reactos.org
Author: dquintana Date: Wed Nov 5 23:00:23 2014 New Revision: 65275 URL:
http://svn.reactos.org/svn/reactos?rev=65275&view=rev
Log: [COMCTL32] * Begin implementing TB_GETMETRICS/TB_SETMETRICS. Will send to wine once the button spacing setting works (after writing tests and whatever else may be necessary). Modified: branches/shell-experiments/dll/win32/comctl32/toolbar.c Modified: branches/shell-experiments/dll/win32/comctl32/toolbar.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/com…
============================================================================== --- branches/shell-experiments/dll/win32/comctl32/toolbar.c [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/comctl32/toolbar.c [iso-8859-1] Wed Nov 5 23:00:23 2014 @@ -33,11 +33,9 @@ * - TBSTYLE_REGISTERDROP * - TBSTYLE_EX_DOUBLEBUFFER * - Messages: - * - TB_GETMETRICS * - TB_GETOBJECT * - TB_INSERTMARKHITTEST * - TB_SAVERESTORE - * - TB_SETMETRICS * - WM_WININICHANGE * - Notifications: * - NM_CHAR @@ -126,6 +124,8 @@ INT nOldHit; INT nHotItem; /* index of the "hot" item */ SIZE szPadding; /* padding values around button */ + SIZE szBarPadding; /* padding values around the toolbar (NOT USED BUT STORED) */ + SIZE szSpacing; /* spacing values between buttons */ INT iTopMargin; /* the top margin */ INT iListGap; /* default gap between text and image for toolbar with list style */ HFONT hDefaultFont; @@ -191,12 +191,18 @@ #define ARROW_HEIGHT 3 #define INSERTMARK_WIDTH 2 +/* default padding inside a button */ #define DEFPAD_CX 7 #define DEFPAD_CY 6 + +/* default space between buttons and between rows */ +#define DEFSPACE_CX 7 +#define DEFSPACE_CY 6 + #define DEFLISTGAP 4 /* vertical padding used in list mode when image is present */ -#define LISTPAD_CY 9 +#define LISTPAD_CY 2 /* how wide to treat the bitmap if it isn't present */ #define NONLIST_NOTEXT_OFFSET 2 @@ -1276,11 +1282,11 @@ /* When the toolbar window style is not TBSTYLE_WRAPABLE, */ /* no layout is necessary. Applications may use this style */ /* to perform their own layout on the toolbar. */ - if( !(infoPtr->dwStyle & TBSTYLE_WRAPABLE) && - !(infoPtr->dwExStyle & TBSTYLE_EX_VERTICAL) ) return; + if (!(infoPtr->dwStyle & TBSTYLE_WRAPABLE) && + !(infoPtr->dwExStyle & TBSTYLE_EX_VERTICAL)) return; btnPtr = infoPtr->buttons; - x = infoPtr->nIndent; + x = infoPtr->nIndent; if (GetParent(infoPtr->hwndSelf)) { @@ -1288,144 +1294,145 @@ * this toolbar. We cannot use its height, as there may be multiple * toolbars in a rebar control */ - GetClientRect( GetParent(infoPtr->hwndSelf), &rc ); + GetClientRect(GetParent(infoPtr->hwndSelf), &rc); infoPtr->nWidth = rc.right - rc.left; } else { - GetWindowRect( infoPtr->hwndSelf, &rc ); + GetWindowRect(infoPtr->hwndSelf, &rc); infoPtr->nWidth = rc.right - rc.left; } bButtonWrap = FALSE; TRACE("start ButtonWidth=%d, BitmapWidth=%d, nWidth=%d, nIndent=%d\n", - infoPtr->nButtonWidth, infoPtr->nBitmapWidth, infoPtr->nWidth, - infoPtr->nIndent); - - for (i = 0; i < infoPtr->nNumButtons; i++ ) - { - btnPtr[i].fsState &= ~TBSTATE_WRAP; - - if (btnPtr[i].fsState & TBSTATE_HIDDEN) - continue; + infoPtr->nButtonWidth, infoPtr->nBitmapWidth, infoPtr->nWidth, + infoPtr->nIndent); + + for (i = 0; i < infoPtr->nNumButtons; i++) + { + btnPtr[i].fsState &= ~TBSTATE_WRAP; + + if (btnPtr[i].fsState & TBSTATE_HIDDEN) + continue; if (btnPtr[i].cx > 0) cx = btnPtr[i].cx; /* horizontal separators are treated as buttons for width */ - else if ((btnPtr[i].fsStyle & BTNS_SEP) && - !(infoPtr->dwStyle & CCS_VERT)) + else if ((btnPtr[i].fsStyle & BTNS_SEP) && + !(infoPtr->dwStyle & CCS_VERT)) cx = (btnPtr[i].iBitmap > 0) ? btnPtr[i].iBitmap : SEPARATOR_WIDTH; - else - cx = infoPtr->nButtonWidth; - - /* Two or more adjacent separators form a separator group. */ - /* The first separator in a group should be wrapped to the */ - /* next row if the previous wrapping is on a button. */ - if( bButtonWrap && - (btnPtr[i].fsStyle & BTNS_SEP) && - (i + 1 < infoPtr->nNumButtons ) && - (btnPtr[i + 1].fsStyle & BTNS_SEP) ) - { - TRACE("wrap point 1 btn %d style %02x\n", i, btnPtr[i].fsStyle); - btnPtr[i].fsState |= TBSTATE_WRAP; - x = infoPtr->nIndent; - i++; - bButtonWrap = FALSE; - continue; - } - - /* The layout makes sure the bitmap is visible, but not the button. */ - /* Test added to also wrap after a button that starts a row but */ - /* is bigger than the area. - GA 8/01 */ - if (( x + cx - (infoPtr->nButtonWidth - infoPtr->nBitmapWidth) / 2 - > infoPtr->nWidth ) || - ((x == infoPtr->nIndent) && (cx > infoPtr->nWidth))) - { - BOOL bFound = FALSE; - - /* If the current button is a separator and not hidden, */ - /* go to the next until it reaches a non separator. */ - /* Wrap the last separator if it is before a button. */ - while( ( ((btnPtr[i].fsStyle & BTNS_SEP) && - !(btnPtr[i].fsStyle & BTNS_DROPDOWN)) || - (btnPtr[i].fsState & TBSTATE_HIDDEN) ) && - i < infoPtr->nNumButtons ) - { - i++; - bFound = TRUE; - } - - if( bFound && i < infoPtr->nNumButtons ) - { - i--; - TRACE("wrap point 2 btn %d style %02x, x=%d, cx=%d\n", - i, btnPtr[i].fsStyle, x, cx); - btnPtr[i].fsState |= TBSTATE_WRAP; - x = infoPtr->nIndent; - bButtonWrap = FALSE; - continue; - } - else if ( i >= infoPtr->nNumButtons) - break; - - /* If the current button is not a separator, find the last */ - /* separator and wrap it. */ - for ( j = i - 1; j >= 0 && !(btnPtr[j].fsState & TBSTATE_WRAP); j--) - { - if ((btnPtr[j].fsStyle & BTNS_SEP) && - !(btnPtr[j].fsState & TBSTATE_HIDDEN)) - { - bFound = TRUE; - i = j; - TRACE("wrap point 3 btn %d style %02x, x=%d, cx=%d\n", - i, btnPtr[i].fsStyle, x, cx); - x = infoPtr->nIndent; - btnPtr[j].fsState |= TBSTATE_WRAP; - bButtonWrap = FALSE; - break; - } - } - - /* If no separator available for wrapping, wrap one of */ - /* non-hidden previous button. */ - if (!bFound) - { - for ( j = i - 1; - j >= 0 && !(btnPtr[j].fsState & TBSTATE_WRAP); j--) - { - if (btnPtr[j].fsState & TBSTATE_HIDDEN) - continue; - - bFound = TRUE; - i = j; - TRACE("wrap point 4 btn %d style %02x, x=%d, cx=%d\n", - i, btnPtr[i].fsStyle, x, cx); - x = infoPtr->nIndent; - btnPtr[j].fsState |= TBSTATE_WRAP; - bButtonWrap = TRUE; - break; - } - } - - /* If all above failed, wrap the current button. */ - if (!bFound) - { - TRACE("wrap point 5 btn %d style %02x, x=%d, cx=%d\n", - i, btnPtr[i].fsStyle, x, cx); - btnPtr[i].fsState |= TBSTATE_WRAP; - x = infoPtr->nIndent; - if (btnPtr[i].fsStyle & BTNS_SEP ) - bButtonWrap = FALSE; - else - bButtonWrap = TRUE; - } - } - else { - TRACE("wrap point 6 btn %d style %02x, x=%d, cx=%d\n", - i, btnPtr[i].fsStyle, x, cx); - x += cx; - } + else + cx = infoPtr->nButtonWidth; + + /* Two or more adjacent separators form a separator group. */ + /* The first separator in a group should be wrapped to the */ + /* next row if the previous wrapping is on a button. */ + if (bButtonWrap && + (btnPtr[i].fsStyle & BTNS_SEP) && + (i + 1 < infoPtr->nNumButtons) && + (btnPtr[i + 1].fsStyle & BTNS_SEP)) + { + TRACE("wrap point 1 btn %d style %02x\n", i, btnPtr[i].fsStyle); + btnPtr[i].fsState |= TBSTATE_WRAP; + x = infoPtr->nIndent; + i++; + bButtonWrap = FALSE; + continue; + } + + /* The layout makes sure the bitmap is visible, but not the button. */ + /* Test added to also wrap after a button that starts a row but */ + /* is bigger than the area. - GA 8/01 */ + if ((x + cx - (infoPtr->nButtonWidth - infoPtr->nBitmapWidth) / 2 + > infoPtr->nWidth) || + ((x == infoPtr->nIndent) && (cx > infoPtr->nWidth))) + { + BOOL bFound = FALSE; + + /* If the current button is a separator and not hidden, */ + /* go to the next until it reaches a non separator. */ + /* Wrap the last separator if it is before a button. */ + while ((((btnPtr[i].fsStyle & BTNS_SEP) && + !(btnPtr[i].fsStyle & BTNS_DROPDOWN)) || + (btnPtr[i].fsState & TBSTATE_HIDDEN)) && + i < infoPtr->nNumButtons) + { + i++; + bFound = TRUE; + } + + if (bFound && i < infoPtr->nNumButtons) + { + i--; + TRACE("wrap point 2 btn %d style %02x, x=%d, cx=%d\n", + i, btnPtr[i].fsStyle, x, cx); + btnPtr[i].fsState |= TBSTATE_WRAP; + x = infoPtr->nIndent; + bButtonWrap = FALSE; + continue; + } + else if (i >= infoPtr->nNumButtons) + break; + + /* If the current button is not a separator, find the last */ + /* separator and wrap it. */ + for (j = i - 1; j >= 0 && !(btnPtr[j].fsState & TBSTATE_WRAP); j--) + { + if ((btnPtr[j].fsStyle & BTNS_SEP) && + !(btnPtr[j].fsState & TBSTATE_HIDDEN)) + { + bFound = TRUE; + i = j; + TRACE("wrap point 3 btn %d style %02x, x=%d, cx=%d\n", + i, btnPtr[i].fsStyle, x, cx); + x = infoPtr->nIndent; + btnPtr[j].fsState |= TBSTATE_WRAP; + bButtonWrap = FALSE; + break; + } + } + + /* If no separator available for wrapping, wrap one of */ + /* non-hidden previous button. */ + if (!bFound) + { + for (j = i - 1; + j >= 0 && !(btnPtr[j].fsState & TBSTATE_WRAP); j--) + { + if (btnPtr[j].fsState & TBSTATE_HIDDEN) + continue; + + bFound = TRUE; + i = j; + TRACE("wrap point 4 btn %d style %02x, x=%d, cx=%d\n", + i, btnPtr[i].fsStyle, x, cx); + x = infoPtr->nIndent; + btnPtr[j].fsState |= TBSTATE_WRAP; + bButtonWrap = TRUE; + break; + } + } + + /* If all above failed, wrap the current button. */ + if (!bFound) + { + TRACE("wrap point 5 btn %d style %02x, x=%d, cx=%d\n", + i, btnPtr[i].fsStyle, x, cx); + btnPtr[i].fsState |= TBSTATE_WRAP; + x = infoPtr->nIndent; + if (btnPtr[i].fsStyle & BTNS_SEP) + bButtonWrap = FALSE; + else + bButtonWrap = TRUE; + } + } + else + { + TRACE("wrap point 6 btn %d style %02x, x=%d, cx=%d\n", + i, btnPtr[i].fsStyle, x, cx); + x += cx; + } } } @@ -1551,9 +1558,8 @@ /* ... add on the necessary padding */ if (bValidImageList) { - if (bHasBitmap) - sizeButton.cy += DEFPAD_CY; - else + sizeButton.cy += infoPtr->szPadding.cy; + if (!bHasBitmap) sizeButton.cy += LISTPAD_CY; } else @@ -1570,7 +1576,7 @@ { if (bHasBitmap) { - sizeButton.cy = infoPtr->nBitmapHeight + DEFPAD_CY; + sizeButton.cy = infoPtr->nBitmapHeight + infoPtr->szPadding.cy; if (sizeString.cy > 0) sizeButton.cy += 1 + sizeString.cy; sizeButton.cx = infoPtr->szPadding.cx + @@ -1627,17 +1633,17 @@ TOOLBAR_LayoutToolbar(TOOLBAR_INFO *infoPtr) { TBUTTON_INFO *btnPtr; - SIZE sizeButton; - INT i, nRows, nSepRows; - INT x, y, cx, cy; - BOOL bWrap; - BOOL validImageList = TOOLBAR_IsValidImageList(infoPtr, 0); - BOOL hasDropDownArrows = TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle); + SIZE sizeButton; + INT i, nRows, nSepRows; + INT x, y, cx, cy; + BOOL bWrap; + BOOL validImageList = TOOLBAR_IsValidImageList(infoPtr, 0); + BOOL hasDropDownArrows = TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle); TOOLBAR_WrapToolbar(infoPtr); - x = infoPtr->nIndent; - y = infoPtr->iTopMargin; + x = infoPtr->nIndent; + y = infoPtr->iTopMargin; cx = infoPtr->nButtonWidth; cy = infoPtr->nButtonHeight; @@ -1652,106 +1658,112 @@ TRACE("cy=%d\n", cy); - for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++ ) - { - bWrap = FALSE; - if (btnPtr->fsState & TBSTATE_HIDDEN) - { - SetRectEmpty (&btnPtr->rect); - continue; - } - - cy = infoPtr->nButtonHeight; - - if (btnPtr->fsStyle & BTNS_SEP) { - if (infoPtr->dwStyle & CCS_VERT) { + for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++) + { + bWrap = FALSE; + if (btnPtr->fsState & TBSTATE_HIDDEN) + { + SetRectEmpty(&btnPtr->rect); + continue; + } + + cy = infoPtr->nButtonHeight; + + if (btnPtr->fsStyle & BTNS_SEP) + { + if (infoPtr->dwStyle & CCS_VERT) + { cy = (btnPtr->iBitmap > 0) ? btnPtr->iBitmap : SEPARATOR_WIDTH; cx = (btnPtr->cx > 0) ? btnPtr->cx : infoPtr->nButtonWidth; - } - else + } + else + { cx = (btnPtr->cx > 0) ? btnPtr->cx : (btnPtr->iBitmap > 0) ? btnPtr->iBitmap : SEPARATOR_WIDTH; - } - else - { + } + } + else + { if (btnPtr->cx) - cx = btnPtr->cx; - else if ((infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || - (btnPtr->fsStyle & BTNS_AUTOSIZE)) { - SIZE sz; - HDC hdc; - HFONT hOldFont; - - hdc = GetDC (infoPtr->hwndSelf); - hOldFont = SelectObject (hdc, infoPtr->hFont); - - TOOLBAR_MeasureString(infoPtr, btnPtr, hdc, &sz); - - SelectObject (hdc, hOldFont); - ReleaseDC (infoPtr->hwndSelf, hdc); - - sizeButton = TOOLBAR_MeasureButton(infoPtr, sz, - TOOLBAR_IsValidBitmapIndex(infoPtr, infoPtr->buttons[i].iBitmap), - validImageList); - cx = sizeButton.cx; + cx = btnPtr->cx; + } + else if ((infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || + (btnPtr->fsStyle & BTNS_AUTOSIZE)) + { + SIZE sz; + HDC hdc; + HFONT hOldFont; + + hdc = GetDC(infoPtr->hwndSelf); + hOldFont = SelectObject(hdc, infoPtr->hFont); + + TOOLBAR_MeasureString(infoPtr, btnPtr, hdc, &sz); + + SelectObject(hdc, hOldFont); + ReleaseDC(infoPtr->hwndSelf, hdc); + + sizeButton = TOOLBAR_MeasureButton(infoPtr, sz, + TOOLBAR_IsValidBitmapIndex(infoPtr, infoPtr->buttons[i].iBitmap), + validImageList); + cx = sizeButton.cx; } else - cx = infoPtr->nButtonWidth; + cx = infoPtr->nButtonWidth; /* if size has been set manually then don't add on extra space * for the drop down arrow */ - if (!btnPtr->cx && hasDropDownArrows && + if (!btnPtr->cx && hasDropDownArrows && ((btnPtr->fsStyle & BTNS_DROPDOWN) || (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN))) - cx += DDARROW_WIDTH; - } - if (btnPtr->fsState & TBSTATE_WRAP ) - bWrap = TRUE; - - SetRect (&btnPtr->rect, x, y, x + cx, y + cy); - - if (infoPtr->rcBound.left > x) - infoPtr->rcBound.left = x; - if (infoPtr->rcBound.right < x + cx) - infoPtr->rcBound.right = x + cx; - if (infoPtr->rcBound.bottom < y + cy) - infoPtr->rcBound.bottom = y + cy; + cx += DDARROW_WIDTH; + } + if (btnPtr->fsState & TBSTATE_WRAP) + bWrap = TRUE; + + SetRect(&btnPtr->rect, x, y, x + cx, y + cy); + + if (infoPtr->rcBound.left > x) + infoPtr->rcBound.left = x; + if (infoPtr->rcBound.right < x + cx) + infoPtr->rcBound.right = x + cx; + if (infoPtr->rcBound.bottom < y + cy) + infoPtr->rcBound.bottom = y + cy; TOOLBAR_TooltipSetRect(infoPtr, btnPtr); - /* btnPtr->nRow is zero based. The space between the rows is */ - /* also considered as a row. */ - btnPtr->nRow = nRows + nSepRows; - - TRACE("button %d style=%x, bWrap=%d, nRows=%d, nSepRows=%d, btnrow=%d, (%d,%d)-(%d,%d)\n", - i, btnPtr->fsStyle, bWrap, nRows, nSepRows, btnPtr->nRow, - x, y, x+cx, y+cy); - - if( bWrap ) - { - if ( !(btnPtr->fsStyle & BTNS_SEP) ) - y += cy; - else - { - if ( !(infoPtr->dwStyle & CCS_VERT)) - y += cy + ( (btnPtr->cx > 0 ) ? - btnPtr->cx : SEPARATOR_WIDTH) * 2 /3; - else - y += cy; - - /* nSepRows is used to calculate the extra height following */ - /* the last row. */ - nSepRows++; - } - x = infoPtr->nIndent; - - /* Increment row number unless this is the last button */ - /* and it has Wrap set. */ - if (i != infoPtr->nNumButtons-1) - nRows++; - } - else - x += cx; + /* btnPtr->nRow is zero based. The space between the rows is */ + /* also considered as a row. */ + btnPtr->nRow = nRows + nSepRows; + + TRACE("button %d style=%x, bWrap=%d, nRows=%d, nSepRows=%d, btnrow=%d, (%d,%d)-(%d,%d)\n", + i, btnPtr->fsStyle, bWrap, nRows, nSepRows, btnPtr->nRow, + x, y, x + cx, y + cy); + + if (bWrap) + { + if (!(btnPtr->fsStyle & BTNS_SEP)) + y += cy; + else + { + if (!(infoPtr->dwStyle & CCS_VERT)) + y += cy + ((btnPtr->cx > 0) ? + btnPtr->cx : SEPARATOR_WIDTH) * 2 / 3; + else + y += cy; + + /* nSepRows is used to calculate the extra height following */ + /* the last row. */ + nSepRows++; + } + x = infoPtr->nIndent; + + /* Increment row number unless this is the last button */ + /* and it has Wrap set. */ + if (i != infoPtr->nNumButtons - 1) + nRows++; + } + else + x += cx; } /* infoPtr->nRows is the number of rows on the toolbar */ @@ -1939,6 +1951,16 @@ msg.pt.y = (short)HIWORD(GetMessagePos ()); SendMessageW (hwndTip, TTM_RELAYEVENT, 0, (LPARAM)&msg); +} + + +static LRESULT +TOOLBAR_ThemeChanged(HWND hwnd) +{ + HTHEME theme = GetWindowTheme(hwnd); + CloseThemeData(theme); + OpenThemeData(hwnd, themeClass); + return 0; } static void @@ -3530,6 +3552,36 @@ } +static LRESULT +TOOLBAR_GetMetrics (const TOOLBAR_INFO *infoPtr, TBMETRICS *pMetrics) +{ + if (pMetrics == NULL) + return FALSE; + + /* TODO: check if cbSize is a valid value */ + + if (pMetrics->dwMask & TBMF_PAD) + { + pMetrics->cxPad = infoPtr->szPadding.cx; + pMetrics->cyPad = infoPtr->szPadding.cy; + } + + if (pMetrics->dwMask & TBMF_BARPAD) + { + pMetrics->cxBarPad = infoPtr->szBarPadding.cx; + pMetrics->cyBarPad = infoPtr->szBarPadding.cy; + } + + if (pMetrics->dwMask & TBMF_BUTTONSPACING) + { + pMetrics->cxButtonSpacing = infoPtr->szSpacing.cx; + pMetrics->cyButtonSpacing = infoPtr->szSpacing.cy; + } + + return TRUE; +} + + /* << TOOLBAR_GetObject >> */ @@ -4710,6 +4762,43 @@ return TRUE; } + +static LRESULT +TOOLBAR_SetMetrics (TOOLBAR_INFO *infoPtr, TBMETRICS *pMetrics) +{ + BOOL changed = FALSE; + + if (!pMetrics) + return FALSE; + + /* TODO: check if cbSize is a valid value */ + + if (pMetrics->dwMask & TBMF_PAD) + { + infoPtr->szPadding.cx = pMetrics->cxPad; + infoPtr->szPadding.cy = pMetrics->cyPad; + changed = TRUE; + } + + if (pMetrics->dwMask & TBMF_PAD) + { + infoPtr->szBarPadding.cx = pMetrics->cxBarPad; + infoPtr->szBarPadding.cy = pMetrics->cyBarPad; + changed = TRUE; + } + + if (pMetrics->dwMask & TBMF_BUTTONSPACING) + { + infoPtr->szSpacing.cx = pMetrics->cxButtonSpacing; + infoPtr->szSpacing.cy = pMetrics->cyButtonSpacing; + changed = TRUE; + } + + if (changed) + TOOLBAR_CalcToolbar(infoPtr); + + return TRUE; +} /* MSDN gives slightly wrong info on padding. * 1. It is not only used on buttons with the BTNS_AUTOSIZE style @@ -5926,6 +6015,8 @@ infoPtr->clrBtnShadow = CLR_DEFAULT; infoPtr->szPadding.cx = DEFPAD_CX; infoPtr->szPadding.cy = DEFPAD_CY; + infoPtr->szSpacing.cx = DEFSPACE_CX; + infoPtr->szSpacing.cy = DEFSPACE_CY; infoPtr->iListGap = DEFLISTGAP; infoPtr->iTopMargin = default_top_margin(infoPtr); infoPtr->dwStyle = lpcs->style; @@ -6359,16 +6450,6 @@ } -/* update theme after a WM_THEMECHANGED message */ -static LRESULT theme_changed (HWND hwnd) -{ - HTHEME theme = GetWindowTheme (hwnd); - CloseThemeData (theme); - OpenThemeData (hwnd, themeClass); - return 0; -} - - static LRESULT WINAPI ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { @@ -6472,6 +6553,9 @@ case TB_GETMAXSIZE: return TOOLBAR_GetMaxSize (infoPtr, (LPSIZE)lParam); + + case TB_GETMETRICS: + return TOOLBAR_GetMetrics (infoPtr, (TBMETRICS*)lParam); /* case TB_GETOBJECT: */ /* 4.71 */ @@ -6488,7 +6572,7 @@ return TOOLBAR_GetState (infoPtr, wParam); case TB_GETSTRINGA: - return TOOLBAR_GetStringA (infoPtr, wParam, (LPSTR)lParam); + return TOOLBAR_GetStringA (infoPtr, wParam, (LPSTR)lParam); case TB_GETSTRINGW: return TOOLBAR_GetStringW (infoPtr, wParam, (LPWSTR)lParam); @@ -6613,6 +6697,9 @@ case TB_SETMAXTEXTROWS: return TOOLBAR_SetMaxTextRows (infoPtr, wParam); + case TB_SETMETRICS: + return TOOLBAR_SetMetrics (infoPtr, (TBMETRICS*)lParam); + case TB_SETPADDING: return TOOLBAR_SetPadding (infoPtr, lParam); @@ -6738,7 +6825,7 @@ return TOOLBAR_SetFocus (infoPtr); case WM_SETFONT: - return TOOLBAR_SetFont(infoPtr, (HFONT)wParam, (WORD)lParam); + return TOOLBAR_SetFont(infoPtr, (HFONT)wParam, (WORD)lParam); case WM_SETREDRAW: return TOOLBAR_SetRedraw (infoPtr, wParam); @@ -6752,8 +6839,8 @@ case WM_SYSCOLORCHANGE: return TOOLBAR_SysColorChange (); - case WM_THEMECHANGED: - return theme_changed (hwnd); + case WM_THEMECHANGED: + return TOOLBAR_ThemeChanged(hwnd); /* case WM_WININICHANGE: */
10 years, 1 month
1
0
0
0
[dquintana] 65274: [EXPLORER-NEW] * Make use of the CToolbar<T> class to implement a CTaskToolbar. * Change the CTaskSwitchWnd class to use CTaskToolbar instead of managing the HWND directly. * Sil...
by dquintana@svn.reactos.org
Author: dquintana Date: Wed Nov 5 22:58:53 2014 New Revision: 65274 URL:
http://svn.reactos.org/svn/reactos?rev=65274&view=rev
Log: [EXPLORER-NEW] * Make use of the CToolbar<T> class to implement a CTaskToolbar. * Change the CTaskSwitchWnd class to use CTaskToolbar instead of managing the HWND directly. * Silence logspam in CTrayBandSite. * Fix CNotifyToolbar to properly. * Move the call to SetMetrics to be called only on initialization, instead of every time an icon changes. * Make the start button a CContainedWindowT instead of a raw HWND. TODO: Make a CStartButton class to manage it. [include/reactos/rosctrls.h] * Some improvements needed by the taskbar. Modified: branches/shell-experiments/base/shell/explorer-new/explorer.cpp branches/shell-experiments/base/shell/explorer-new/taskswnd.cpp branches/shell-experiments/base/shell/explorer-new/tbsite.cpp branches/shell-experiments/base/shell/explorer-new/trayntfy.cpp branches/shell-experiments/base/shell/explorer-new/traywnd.cpp branches/shell-experiments/include/reactos/rosctrls.h Modified: branches/shell-experiments/base/shell/explorer-new/explorer.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/ex…
============================================================================== --- branches/shell-experiments/base/shell/explorer-new/explorer.cpp [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/explorer-new/explorer.cpp [iso-8859-1] Wed Nov 5 22:58:53 2014 @@ -218,7 +218,7 @@ #if !WIN7_COMPAT_MODE BOOL CreateShellDesktop = FALSE; - DbgPrint("Explorer starting... Commandline: %S\n", lpCmdLine); + TRACE("Explorer starting... Commandline: %S\n", lpCmdLine); /* * Set our shutdown parameters: we want to shutdown the very last, Modified: branches/shell-experiments/base/shell/explorer-new/taskswnd.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/ex…
============================================================================== --- branches/shell-experiments/base/shell/explorer-new/taskswnd.cpp [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/explorer-new/taskswnd.cpp [iso-8859-1] Wed Nov 5 22:58:53 2014 @@ -100,10 +100,82 @@ #define TASK_ITEM_ARRAY_ALLOC 64 +class CTaskToolbar : + public CToolbar<TASK_ITEM> +{ +public: + INT UpdateTbButtonSpacing(IN BOOL bHorizontal, IN BOOL bThemed, IN UINT uiRows = 0, IN UINT uiBtnsPerLine = 0) + { + TBMETRICS tbm; + + tbm.cbSize = sizeof(tbm); + tbm.dwMask = TBMF_BARPAD | TBMF_BUTTONSPACING; + + tbm.cxBarPad = tbm.cyBarPad = 0; + + if (bThemed) + { + tbm.cxButtonSpacing = 0; + tbm.cyButtonSpacing = 0; + } + else + { + if (bHorizontal || uiBtnsPerLine > 1) + tbm.cxButtonSpacing = (3 * GetSystemMetrics(SM_CXEDGE) / 2); + else + tbm.cxButtonSpacing = 0; + + if (!bHorizontal || uiRows > 1) + tbm.cyButtonSpacing = (3 * GetSystemMetrics(SM_CYEDGE) / 2); + else + tbm.cyButtonSpacing = 0; + } + + SetMetrics(&tbm); + + return tbm.cxButtonSpacing; + } + + VOID BeginUpdate() + { + SetRedraw(FALSE); + } + + VOID EndUpdate() + { + SendMessageW(WM_SETREDRAW, TRUE); + InvalidateRect(NULL, TRUE); + } + + BOOL SetButtonCommandId(IN INT iButtonIndex, IN INT iCommandId) + { + TBBUTTONINFO tbbi; + + tbbi.cbSize = sizeof(tbbi); + tbbi.dwMask = TBIF_BYINDEX | TBIF_COMMAND; + tbbi.idCommand = iCommandId; + + return SetButtonInfo(iButtonIndex, &tbbi) != 0; + } + +public: + BEGIN_MSG_MAP(CNotifyToolbar) + END_MSG_MAP() + + BOOL Initialize(HWND hWndParent) + { + DWORD styles = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | + TBSTYLE_TOOLTIPS | TBSTYLE_WRAPABLE | TBSTYLE_LIST | TBSTYLE_TRANSPARENT | + CCS_TOP | CCS_NORESIZE | CCS_NODIVIDER; + + return SubclassWindow(Create(hWndParent, styles)); + } +}; + class CTaskSwitchWnd : public CWindowImpl < CTaskSwitchWnd, CWindow, CControlWinTraits > { - CContainedWindow TaskBar; + CTaskToolbar TaskBar; HWND hWndNotify; @@ -118,11 +190,10 @@ PTASK_ITEM ActiveTaskItem; HTHEME TaskBandTheme; - HWND hWndToolbar; UINT TbButtonsPerLine; WORD ToolbarBtnCount; - IImageList * TaskIcons; + HIMAGELIST TaskIcons; BOOL IsGroupingEnabled; BOOL IsDestroying; @@ -132,7 +203,6 @@ public: CTaskSwitchWnd() : - TaskBar(this, 1), hWndNotify(NULL), ShellHookMsg(NULL), TaskGroups(NULL), @@ -141,10 +211,11 @@ TaskItems(0), ActiveTaskItem(0), TaskBandTheme(NULL), - hWndToolbar(NULL), TbButtonsPerLine(0), ToolbarBtnCount(0), - TaskIcons(NULL) + TaskIcons(NULL), + IsGroupingEnabled(FALSE), + IsDestroying(FALSE) { ZeroMemory(&ButtonSize, sizeof(ButtonSize)); szBuf[0] = 0; @@ -153,11 +224,9 @@ #define MAX_TASKS_COUNT (0x7FFF) - VOID TaskSwitchWnd_UpdateButtonsSize( - IN BOOL bRedrawDisabled); - - LPTSTR GetWndTextFromTaskItem( - IN PTASK_ITEM TaskItem) + VOID TaskSwitchWnd_UpdateButtonsSize(IN BOOL bRedrawDisabled); + + LPTSTR GetWndTextFromTaskItem(IN PTASK_ITEM TaskItem) { /* Get the window text without sending a message so we don't hang if an application isn't responding! */ @@ -224,48 +293,14 @@ } #endif - VOID BeginUpdate() - { - ::SendMessage(hWndToolbar, - WM_SETREDRAW, - FALSE, - 0); - } - - VOID EndUpdate() - { - ::SendMessage(hWndToolbar, - WM_SETREDRAW, - TRUE, - 0); - ::InvalidateRect(hWndToolbar, - NULL, - TRUE); - } - - BOOL SetToolbarButtonCommandId( - IN INT iButtonIndex, - IN INT iCommandId) - { - TBBUTTONINFO tbbi; - - tbbi.cbSize = sizeof(tbbi); - tbbi.dwMask = TBIF_BYINDEX | TBIF_COMMAND; - tbbi.idCommand = iCommandId; - - return SendMessage(hWndToolbar, - TB_SETBUTTONINFO, - (WPARAM) iButtonIndex, - (LPARAM) &tbbi) != 0; - } - - VOID UpdateIndexesAfterButtonInserted( - IN INT iIndex) + VOID UpdateIndexesAfter(IN INT iIndex, BOOL bInserted) { PTASK_GROUP CurrentGroup; PTASK_ITEM CurrentTaskItem, LastTaskItem; INT NewIndex; + int offset = bInserted ? +1 : -1; + if (IsGroupingEnabled) { /* Update all affected groups */ @@ -276,10 +311,8 @@ CurrentGroup->Index >= iIndex) { /* Update the toolbar buttons */ - NewIndex = CurrentGroup->Index + 1; - if (SetToolbarButtonCommandId( - CurrentGroup->Index + 1, - NewIndex)) + NewIndex = CurrentGroup->Index + offset; + if (TaskBar.SetButtonCommandId(CurrentGroup->Index + offset, NewIndex)) { CurrentGroup->Index = NewIndex; } @@ -309,10 +342,8 @@ { UpdateTaskItemBtn: /* Update the toolbar buttons */ - NewIndex = CurrentTaskItem->Index + 1; - if (SetToolbarButtonCommandId( - CurrentTaskItem->Index + 1, - NewIndex)) + NewIndex = CurrentTaskItem->Index + offset; + if (TaskBar.SetButtonCommandId(CurrentTaskItem->Index + offset, NewIndex)) { CurrentTaskItem->Index = NewIndex; } @@ -324,73 +355,8 @@ } } - VOID UpdateIndexesAfterButtonDeleted( - IN INT iIndex) - { - PTASK_GROUP CurrentGroup; - PTASK_ITEM CurrentTaskItem, LastTaskItem; - INT NewIndex; - - if (IsGroupingEnabled) - { - /* Update all affected groups */ - CurrentGroup = TaskGroups; - while (CurrentGroup != NULL) - { - if (CurrentGroup->IsCollapsed && - CurrentGroup->Index > iIndex) - { - /* Update the toolbar buttons */ - NewIndex = CurrentGroup->Index - 1; - if (SetToolbarButtonCommandId( - CurrentGroup->Index - 1, - NewIndex)) - { - CurrentGroup->Index = NewIndex; - } - else - CurrentGroup->Index = -1; - } - - CurrentGroup = CurrentGroup->Next; - } - } - - /* Update all affected task items */ - CurrentTaskItem = TaskItems; - LastTaskItem = CurrentTaskItem + TaskItemCount; - while (CurrentTaskItem != LastTaskItem) - { - CurrentGroup = CurrentTaskItem->Group; - if (CurrentGroup != NULL) - { - if (!CurrentGroup->IsCollapsed && - CurrentTaskItem->Index > iIndex) - { - goto UpdateTaskItemBtn; - } - } - else if (CurrentTaskItem->Index > iIndex) - { - UpdateTaskItemBtn: - /* Update the toolbar buttons */ - NewIndex = CurrentTaskItem->Index - 1; - if (SetToolbarButtonCommandId( - CurrentTaskItem->Index - 1, - NewIndex)) - { - CurrentTaskItem->Index = NewIndex; - } - else - CurrentTaskItem->Index = -1; - } - - CurrentTaskItem++; - } - } - - INT UpdateTaskGroupButton( - IN PTASK_GROUP TaskGroup) + + INT UpdateTaskGroupButton(IN PTASK_GROUP TaskGroup) { ASSERT(TaskGroup->Index >= 0); @@ -399,8 +365,7 @@ return TaskGroup->Index; } - VOID ExpandTaskGroup( - IN PTASK_GROUP TaskGroup) + VOID ExpandTaskGroup(IN PTASK_GROUP TaskGroup) { ASSERT(TaskGroup->dwTaskCount > 0); ASSERT(TaskGroup->IsCollapsed); @@ -414,21 +379,26 @@ HICON hIcon = 0; SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL2, 0, SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR) &hIcon); - - if (!hIcon) - SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL, 0, SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR) &hIcon); - - if (!hIcon) - SendMessageTimeout(hwnd, WM_GETICON, ICON_BIG, 0, SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR) &hIcon); - - if (!hIcon) - hIcon = (HICON) GetClassLongPtr(hwnd, GCL_HICONSM); - - if (!hIcon) - hIcon = (HICON) GetClassLongPtr(hwnd, GCL_HICON); + if (hIcon) + return hIcon; + + SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL, 0, SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR) &hIcon); + if (hIcon) + return hIcon; + + SendMessageTimeout(hwnd, WM_GETICON, ICON_BIG, 0, SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR) &hIcon); + if (hIcon) + return hIcon; + + hIcon = (HICON) GetClassLongPtr(hwnd, GCL_HICONSM); + if (hIcon) + return hIcon; + + hIcon = (HICON) GetClassLongPtr(hwnd, GCL_HICON); return hIcon; } + INT UpdateTaskItemButton(IN PTASK_ITEM TaskItem) { TBBUTTONINFO tbbi; @@ -447,23 +417,19 @@ /* Check if we're updating a button that is the last one in the line. If so, we need to set the TBSTATE_WRAP flag! */ - if (TbButtonsPerLine != 0 && - (TaskItem->Index + 1) % TbButtonsPerLine == 0) + if (!Tray->IsHorizontal() || (TbButtonsPerLine != 0 && + (TaskItem->Index + 1) % TbButtonsPerLine == 0)) { tbbi.fsState |= TBSTATE_WRAP; } - tbbi.pszText = GetWndTextFromTaskItem( - TaskItem); + tbbi.pszText = GetWndTextFromTaskItem(TaskItem); icon = GetWndIcon(TaskItem->hWnd); - TaskIcons->ReplaceIcon(TaskItem->IconIndex, icon, &TaskItem->IconIndex); + TaskItem->IconIndex = ImageList_ReplaceIcon(TaskIcons, TaskItem->IconIndex, icon); tbbi.iImage = TaskItem->IconIndex; - if (!SendMessage(hWndToolbar, - TB_SETBUTTONINFO, - (WPARAM) TaskItem->Index, - (LPARAM) &tbbi)) + if (!TaskBar.SetButtonInfo(TaskItem->Index, &tbbi)) { TaskItem->Index = -1; return -1; @@ -473,8 +439,7 @@ return TaskItem->Index; } - VOID RemoveIcon( - IN PTASK_ITEM TaskItem) + VOID RemoveIcon(IN PTASK_ITEM TaskItem) { TBBUTTONINFO tbbi; PTASK_ITEM currentTaskItem, LastItem; @@ -494,15 +459,12 @@ currentTaskItem->IconIndex--; tbbi.iImage = currentTaskItem->IconIndex; - SendMessage(hWndToolbar, - TB_SETBUTTONINFO, - currentTaskItem->Index, - (LPARAM) &tbbi); + TaskBar.SetButtonInfo(currentTaskItem->Index, &tbbi); } currentTaskItem++; } - TaskIcons->Remove(TaskItem->IconIndex); + ImageList_Remove(TaskIcons, TaskItem->IconIndex); } PTASK_ITEM FindLastTaskItemOfGroup( @@ -543,8 +505,7 @@ return FoundTaskItem; } - INT CalculateTaskItemNewButtonIndex( - IN PTASK_ITEM TaskItem) + INT CalculateTaskItemNewButtonIndex(IN PTASK_ITEM TaskItem) { PTASK_GROUP TaskGroup; PTASK_ITEM LastTaskItem; @@ -561,9 +522,7 @@ if (TaskGroup->dwTaskCount > 1) { - LastTaskItem = FindLastTaskItemOfGroup( - TaskGroup, - TaskItem); + LastTaskItem = FindLastTaskItemOfGroup(TaskGroup, TaskItem); if (LastTaskItem != NULL) { /* Since the group is expanded the task items must have an index */ @@ -577,9 +536,7 @@ { /* Find the last NULL group button. NULL groups are added at the end of the task item list when grouping is enabled */ - LastTaskItem = FindLastTaskItemOfGroup( - NULL, - TaskItem); + LastTaskItem = FindLastTaskItemOfGroup(NULL, TaskItem); if (LastTaskItem != NULL) { ASSERT(LastTaskItem->Index >= 0); @@ -592,8 +549,7 @@ return ToolbarBtnCount; } - INT AddTaskItemButton( - IN OUT PTASK_ITEM TaskItem) + INT AddTaskItemButton(IN OUT PTASK_ITEM TaskItem) { TBBUTTON tbBtn; INT iIndex; @@ -601,44 +557,36 @@ if (TaskItem->Index >= 0) { - return UpdateTaskItemButton( - TaskItem); + return UpdateTaskItemButton(TaskItem); } if (TaskItem->Group != NULL && TaskItem->Group->IsCollapsed) { /* The task group is collapsed, we only need to update the group button */ - return UpdateTaskGroupButton( - TaskItem->Group); + return UpdateTaskGroupButton(TaskItem->Group); } icon = GetWndIcon(TaskItem->hWnd); - TaskIcons->ReplaceIcon(-1, icon, &TaskItem->IconIndex); + TaskItem->IconIndex = ImageList_ReplaceIcon(TaskIcons, -1, icon); tbBtn.iBitmap = TaskItem->IconIndex; tbBtn.fsState = TBSTATE_ENABLED | TBSTATE_ELLIPSES; tbBtn.fsStyle = BTNS_CHECK | BTNS_NOPREFIX | BTNS_SHOWTEXT; tbBtn.dwData = TaskItem->Index; - tbBtn.iString = (DWORD_PTR) GetWndTextFromTaskItem( - TaskItem); + tbBtn.iString = (DWORD_PTR) GetWndTextFromTaskItem(TaskItem); /* Find out where to insert the new button */ - iIndex = CalculateTaskItemNewButtonIndex( - TaskItem); + iIndex = CalculateTaskItemNewButtonIndex(TaskItem); ASSERT(iIndex >= 0); tbBtn.idCommand = iIndex; - BeginUpdate(); - - if (SendMessage(hWndToolbar, - TB_INSERTBUTTON, - (WPARAM) iIndex, - (LPARAM) &tbBtn)) - { - UpdateIndexesAfterButtonInserted( - iIndex); + TaskBar.BeginUpdate(); + + if (TaskBar.InsertButton(iIndex, &tbBtn)) + { + UpdateIndexesAfter(iIndex, TRUE); TRACE("Added button %d for hwnd 0x%p\n", iIndex, TaskItem->hWnd); @@ -650,13 +598,12 @@ return iIndex; } - EndUpdate(); + TaskBar.EndUpdate(); return -1; } - BOOL DeleteTaskItemButton( - IN OUT PTASK_ITEM TaskItem) + BOOL DeleteTaskItemButton(IN OUT PTASK_ITEM TaskItem) { PTASK_GROUP TaskGroup; INT iIndex; @@ -668,36 +615,30 @@ if ((TaskGroup != NULL && !TaskGroup->IsCollapsed) || TaskGroup == NULL) { - BeginUpdate(); + TaskBar.BeginUpdate(); RemoveIcon(TaskItem); iIndex = TaskItem->Index; - if (SendMessage(hWndToolbar, - TB_DELETEBUTTON, - (WPARAM) iIndex, - 0)) + if (TaskBar.DeleteButton(iIndex)) { TaskItem->Index = -1; ToolbarBtnCount--; - UpdateIndexesAfterButtonDeleted( - iIndex); + UpdateIndexesAfter(iIndex, FALSE); /* Update button sizes and fix the button wrapping */ - UpdateButtonsSize( - TRUE); + UpdateButtonsSize(TRUE); return TRUE; } - EndUpdate(); + TaskBar.EndUpdate(); } } return FALSE; } - PTASK_GROUP AddToTaskGroup( - IN HWND hWnd) + PTASK_GROUP AddToTaskGroup(IN HWND hWnd) { DWORD dwProcessId; PTASK_GROUP TaskGroup, *PrevLink; @@ -741,8 +682,7 @@ return TaskGroup; } - VOID RemoveTaskFromTaskGroup( - IN OUT PTASK_ITEM TaskItem) + VOID RemoveTaskFromTaskGroup(IN OUT PTASK_ITEM TaskItem) { PTASK_GROUP TaskGroup, CurrentGroup, *PrevLink; @@ -777,21 +717,18 @@ { /* FIXME: Check if we should expand the group */ /* Update the task group button */ - UpdateTaskGroupButton( - TaskGroup); + UpdateTaskGroupButton(TaskGroup); } else { /* Expand the group of one task button to a task button */ - ExpandTaskGroup( - TaskGroup); - } - } - } - } - - PTASK_ITEM FindTaskItem( - IN HWND hWnd) + ExpandTaskGroup(TaskGroup); + } + } + } + } + + PTASK_ITEM FindTaskItem(IN HWND hWnd) { PTASK_ITEM TaskItem, LastItem; @@ -808,15 +745,13 @@ return NULL; } - PTASK_ITEM FindOtherTaskItem( - IN HWND hWnd) + PTASK_ITEM FindOtherTaskItem(IN HWND hWnd) { PTASK_ITEM LastItem, TaskItem; PTASK_GROUP TaskGroup; DWORD dwProcessId; - if (!GetWindowThreadProcessId(hWnd, - &dwProcessId)) + if (!GetWindowThreadProcessId(hWnd, &dwProcessId)) { return NULL; } @@ -903,8 +838,7 @@ return TaskItems + TaskItemCount++; } - VOID FreeTaskItem( - IN OUT PTASK_ITEM TaskItem) + VOID FreeTaskItem(IN OUT PTASK_ITEM TaskItem) { WORD wIndex; @@ -922,27 +856,22 @@ TaskItemCount--; } - VOID DeleteTaskItem( - IN OUT PTASK_ITEM TaskItem) + VOID DeleteTaskItem(IN OUT PTASK_ITEM TaskItem) { if (!IsDestroying) { /* Delete the task button from the toolbar */ - DeleteTaskItemButton( - TaskItem); + DeleteTaskItemButton(TaskItem); } /* Remove the task from it's group */ - RemoveTaskFromTaskGroup( - TaskItem); + RemoveTaskFromTaskGroup(TaskItem); /* Free the task item */ - FreeTaskItem( - TaskItem); - } - - VOID CheckActivateTaskItem( - IN OUT PTASK_ITEM TaskItem) + FreeTaskItem(TaskItem); + } + + VOID CheckActivateTaskItem(IN OUT PTASK_ITEM TaskItem) { PTASK_ITEM CurrentTaskItem; PTASK_GROUP TaskGroup = NULL; @@ -1000,9 +929,7 @@ } } - PTASK_ITEM - FindTaskItemByIndex( - IN INT Index) + PTASK_ITEM FindTaskItemByIndex(IN INT Index) { PTASK_ITEM TaskItem, LastItem; @@ -1019,9 +946,7 @@ return NULL; } - PTASK_GROUP - FindTaskGroupByIndex( - IN INT Index) + PTASK_GROUP FindTaskGroupByIndex(IN INT Index) { PTASK_GROUP CurrentGroup; @@ -1055,13 +980,11 @@ sizeof(*TaskItem)); TaskItem->hWnd = hWnd; TaskItem->Index = -1; - TaskItem->Group = AddToTaskGroup( - hWnd); + TaskItem->Group = AddToTaskGroup(hWnd); if (!IsDestroying) { - AddTaskItemButton( - TaskItem); + AddTaskItemButton(TaskItem); } } } @@ -1069,8 +992,7 @@ return TaskItem != NULL; } - BOOL ActivateTaskItem( - IN OUT PTASK_ITEM TaskItem OPTIONAL) + BOOL ActivateTaskItem(IN OUT PTASK_ITEM TaskItem OPTIONAL) { if (TaskItem != NULL) { @@ -1082,8 +1004,7 @@ return FALSE; } - BOOL ActivateTask( - IN HWND hWnd) + BOOL ActivateTask(IN HWND hWnd) { PTASK_ITEM TaskItem; @@ -1092,12 +1013,10 @@ return ActivateTaskItem(NULL); } - TaskItem = FindTaskItem( - hWnd); + TaskItem = FindTaskItem(hWnd); if (TaskItem == NULL) { - TaskItem = FindOtherTaskItem( - hWnd); + TaskItem = FindOtherTaskItem(hWnd); } if (TaskItem == NULL) @@ -1109,18 +1028,15 @@ return ActivateTaskItem(TaskItem); } - BOOL DeleteTask( - IN HWND hWnd) + BOOL DeleteTask(IN HWND hWnd) { PTASK_ITEM TaskItem; - TaskItem = FindTaskItem( - hWnd); + TaskItem = FindTaskItem(hWnd); if (TaskItem != NULL) { TRACE("Delete window 0x%p on button %d\n", hWnd, TaskItem->Index); - DeleteTaskItem( - TaskItem); + DeleteTaskItem(TaskItem); return TRUE; } //else @@ -1138,40 +1054,33 @@ CurrentTask = TaskItems + TaskItemCount; do { - DeleteTaskItem( - --CurrentTask); + DeleteTaskItem(--CurrentTask); } while (CurrentTask != TaskItems); } } - VOID FlashTaskItem( - IN OUT PTASK_ITEM TaskItem) + VOID FlashTaskItem(IN OUT PTASK_ITEM TaskItem) { TaskItem->RenderFlashed = 1; - UpdateTaskItemButton( - TaskItem); - } - - BOOL FlashTask( - IN HWND hWnd) + UpdateTaskItemButton(TaskItem); + } + + BOOL FlashTask(IN HWND hWnd) { PTASK_ITEM TaskItem; - TaskItem = FindTaskItem( - hWnd); + TaskItem = FindTaskItem(hWnd); if (TaskItem != NULL) { TRACE("Flashing window 0x%p on button %d\n", hWnd, TaskItem->Index); - FlashTaskItem( - TaskItem); + FlashTaskItem(TaskItem); return TRUE; } return FALSE; } - VOID RedrawTaskItem( - IN OUT PTASK_ITEM TaskItem) + VOID RedrawTaskItem(IN OUT PTASK_ITEM TaskItem) { PTASK_GROUP TaskGroup; @@ -1180,8 +1089,7 @@ { if (TaskGroup->IsCollapsed && TaskGroup->Index >= 0) { - UpdateTaskGroupButton( - TaskGroup); + UpdateTaskGroupButton(TaskGroup); } else if (TaskItem->Index >= 0) { @@ -1192,59 +1100,24 @@ { UpdateTaskItem: TaskItem->RenderFlashed = 0; - UpdateTaskItemButton( - TaskItem); - } - } - - - BOOL RedrawTask( - IN HWND hWnd) + UpdateTaskItemButton(TaskItem); + } + } + + + BOOL RedrawTask(IN HWND hWnd) { PTASK_ITEM TaskItem; - TaskItem = FindTaskItem( - hWnd); + TaskItem = FindTaskItem(hWnd); if (TaskItem != NULL) { - RedrawTaskItem( - TaskItem); + RedrawTaskItem(TaskItem); return TRUE; } return FALSE; } - - INT UpdateTbButtonSpacing( - IN BOOL bHorizontal, - IN UINT uiRows, - IN UINT uiBtnsPerLine) - { - TBMETRICS tbm; - - tbm.cbSize = sizeof(tbm); - tbm.dwMask = TBMF_BARPAD | TBMF_BUTTONSPACING; - - tbm.cxBarPad = tbm.cyBarPad = 0; - - if (bHorizontal || uiBtnsPerLine > 1) - tbm.cxButtonSpacing = (3 * GetSystemMetrics(SM_CXEDGE) / 2); - else - tbm.cxButtonSpacing = 0; - - if (!bHorizontal || uiRows > 1) - tbm.cyButtonSpacing = (3 * GetSystemMetrics(SM_CYEDGE) / 2); - else - tbm.cyButtonSpacing = 0; - - SendMessage(hWndToolbar, - TB_SETMETRICS, - 0, - (LPARAM) &tbm); - - return tbm.cxButtonSpacing; - } - VOID UpdateButtonsSize(IN BOOL bRedrawDisabled) { @@ -1252,75 +1125,89 @@ UINT uiRows, uiMax, uiMin, uiBtnsPerLine, ui; LONG NewBtnSize; BOOL Horizontal; - TBBUTTONINFO tbbi; - TBMETRICS tbm; - - if (GetClientRect(&rcClient) && - !IsRectEmpty(&rcClient)) + + if (GetClientRect(&rcClient) && !IsRectEmpty(&rcClient)) { if (ToolbarBtnCount > 0) { - ZeroMemory(&tbm, sizeof(tbm)); - tbm.cbSize = sizeof(tbm); - tbm.dwMask = TBMF_BUTTONSPACING; - SendMessage(hWndToolbar, - TB_GETMETRICS, - 0, - (LPARAM) &tbm); - - uiRows = (rcClient.bottom + tbm.cyButtonSpacing) / (ButtonSize.cy + tbm.cyButtonSpacing); - if (uiRows == 0) - uiRows = 1; - - uiBtnsPerLine = (ToolbarBtnCount + uiRows - 1) / uiRows; - Horizontal = Tray->IsHorizontal(); + if (Horizontal) + { + DbgPrint("HORIZONTAL!\n"); + TBMETRICS tbm = { 0 }; + tbm.cbSize = sizeof(tbm); + tbm.dwMask = TBMF_BUTTONSPACING; + TaskBar.GetMetrics(&tbm); + + uiRows = (rcClient.bottom + tbm.cyButtonSpacing) / (ButtonSize.cy + tbm.cyButtonSpacing); + if (uiRows == 0) + uiRows = 1; + + uiBtnsPerLine = (ToolbarBtnCount + uiRows - 1) / uiRows; + } + else + { + DbgPrint("VERTICAL!\n"); + uiBtnsPerLine = 1; + uiRows = ToolbarBtnCount; + } + if (!bRedrawDisabled) - BeginUpdate(); + TaskBar.BeginUpdate(); /* We might need to update the button spacing */ - tbm.cxButtonSpacing = UpdateTbButtonSpacing( - Horizontal, - uiRows, - uiBtnsPerLine); - - /* Calculate the ideal width and make sure it's within the allowed range */ - NewBtnSize = (rcClient.right - (uiBtnsPerLine * tbm.cxButtonSpacing)) / uiBtnsPerLine; + int cxButtonSpacing = TaskBar.UpdateTbButtonSpacing( + Horizontal, TaskBandTheme != NULL, + uiRows, uiBtnsPerLine); /* Determine the minimum and maximum width of a button */ + uiMin = GetSystemMetrics(SM_CXSIZE) + (2 * GetSystemMetrics(SM_CXEDGE)); if (Horizontal) + { uiMax = GetSystemMetrics(SM_CXMINIMIZED); + + /* Calculate the ideal width and make sure it's within the allowed range */ + NewBtnSize = (rcClient.right - (uiBtnsPerLine * cxButtonSpacing)) / uiBtnsPerLine; + + if (NewBtnSize < (LONG) uiMin) + NewBtnSize = uiMin; + if (NewBtnSize >(LONG)uiMax) + NewBtnSize = uiMax; + + /* Recalculate how many buttons actually fit into one line */ + uiBtnsPerLine = rcClient.right / (NewBtnSize + cxButtonSpacing); + if (uiBtnsPerLine == 0) + uiBtnsPerLine++; + } else - uiMax = rcClient.right; - - uiMin = GetSystemMetrics(SM_CXSIZE) + (2 * GetSystemMetrics(SM_CXEDGE)); - - if (NewBtnSize < (LONG) uiMin) - NewBtnSize = uiMin; - if (NewBtnSize > (LONG)uiMax) - NewBtnSize = uiMax; + { + NewBtnSize = uiMax = rcClient.right; + } ButtonSize.cx = NewBtnSize; - /* Recalculate how many buttons actually fit into one line */ - uiBtnsPerLine = rcClient.right / (NewBtnSize + tbm.cxButtonSpacing); - if (uiBtnsPerLine == 0) - uiBtnsPerLine++; TbButtonsPerLine = uiBtnsPerLine; - tbbi.cbSize = sizeof(tbbi); - tbbi.dwMask = TBIF_BYINDEX | TBIF_SIZE | TBIF_STATE; - tbbi.cx = (INT) NewBtnSize; - for (ui = 0; ui != ToolbarBtnCount; ui++) { + TBBUTTONINFOW tbbi = { 0 }; + tbbi.cbSize = sizeof(tbbi); + tbbi.dwMask = TBIF_BYINDEX | TBIF_SIZE | TBIF_STATE; + tbbi.cx = (INT) NewBtnSize; tbbi.fsState = TBSTATE_ENABLED; /* Check if we're updating a button that is the last one in the line. If so, we need to set the TBSTATE_WRAP flag! */ - if ((ui + 1) % uiBtnsPerLine == 0) + if (Horizontal) + { + if ((ui + 1) % uiBtnsPerLine == 0) + tbbi.fsState |= TBSTATE_WRAP; + } + else + { tbbi.fsState |= TBSTATE_WRAP; + } if (ActiveTaskItem != NULL && ActiveTaskItem->Index == (INT)ui) @@ -1328,33 +1215,19 @@ tbbi.fsState |= TBSTATE_CHECKED; } - SendMessage(hWndToolbar, - TB_SETBUTTONINFO, - (WPARAM) ui, - (LPARAM) &tbbi); - } - -#if 0 - /* FIXME: Force the window to the correct position in case some idiot - did something to us */ - SetWindowPos(hWndToolbar, - NULL, - 0, - 0, - rcClient.right, /* FIXME */ - rcClient.bottom, /* FIXME */ - SWP_NOACTIVATE | SWP_NOZORDER); -#endif + TaskBar.SetButtonInfo(ui, &tbbi); + } } else { TbButtonsPerLine = 0; ButtonSize.cx = 0; } - } - - EndUpdate(); - } + } + + // FIXME: This seems to be enabling redraws prematurely, but moving it to its right place doesn't work! + TaskBar.EndUpdate(); + } BOOL CALLBACK EnumWindowsProc(IN HWND hWnd) { @@ -1377,8 +1250,7 @@ return TRUE; } - static BOOL CALLBACK s_EnumWindowsProc(IN HWND hWnd, - IN LPARAM lParam) + static BOOL CALLBACK s_EnumWindowsProc(IN HWND hWnd, IN LPARAM lParam) { CTaskSwitchWnd * This = (CTaskSwitchWnd *) lParam; @@ -1394,6 +1266,8 @@ LRESULT OnThemeChanged() { + TRACE("OmThemeChanged\n"); + if (TaskBandTheme) CloseThemeData(TaskBandTheme); @@ -1401,6 +1275,7 @@ TaskBandTheme = OpenThemeData(m_hWnd, L"TaskBand"); else TaskBandTheme = NULL; + return TRUE; } @@ -1411,80 +1286,46 @@ LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { - hWndToolbar = CreateWindowEx(0, - TOOLBARCLASSNAME, - szRunningApps, - WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | - TBSTYLE_TOOLTIPS | TBSTYLE_WRAPABLE | TBSTYLE_LIST | TBSTYLE_TRANSPARENT | - CCS_TOP | CCS_NORESIZE | CCS_NODIVIDER, - 0, - 0, - 0, - 0, - m_hWnd, - NULL, - hExplorerInstance, - NULL); - - if (hWndToolbar != NULL) - { - HMODULE hShell32; - SIZE BtnSize; - - TaskBar.SubclassWindow(hWndToolbar); - - SetWindowTheme(hWndToolbar, L"TaskBand", NULL); - OnThemeChanged(); - - /* Identify the version we're using */ - SendMessage(hWndToolbar, - TB_BUTTONSTRUCTSIZE, - sizeof(TBBUTTON), - 0); - - TaskIcons = (IImageList*) ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 1000); - SendMessage(hWndToolbar, TB_SETIMAGELIST, 0, (LPARAM) TaskIcons); - - /* Calculate the default button size. Don't save this in ButtonSize.cx so that - the actual button width gets updated correctly on the first recalculation */ - BtnSize.cx = GetSystemMetrics(SM_CXMINIMIZED); - ButtonSize.cy = BtnSize.cy = GetSystemMetrics(SM_CYSIZE) + (2 * GetSystemMetrics(SM_CYEDGE)); - SendMessage(hWndToolbar, TB_SETBUTTONSIZE, 0, (LPARAM) MAKELONG(BtnSize.cx, BtnSize.cy)); - - /* We don't want to see partially clipped buttons...not that we could see them... */ -#if 0 - SendMessage(hWndToolbar, - TB_SETEXTENDEDSTYLE, - 0, - TBSTYLE_EX_HIDECLIPPEDBUTTONS); -#endif - - /* Set proper spacing between buttons */ - UpdateTbButtonSpacing(Tray->IsHorizontal(), 0, 0); - - /* Register the shell hook */ - ShellHookMsg = RegisterWindowMessage(TEXT("SHELLHOOK")); - - DbgPrint("ShellHookMsg got assigned number %d\n", ShellHookMsg); - - hShell32 = GetModuleHandle(TEXT("SHELL32.DLL")); - if (hShell32 != NULL) - { - REGSHELLHOOK RegShellHook; - - /* RegisterShellHook */ - RegShellHook = (REGSHELLHOOK) GetProcAddress(hShell32, (LPCSTR) ((LONG) 181)); - if (RegShellHook != NULL) - { - RegShellHook(m_hWnd, 3); /* 1 if no NT! We're targeting NT so we don't care! */ - } - } - - RefreshWindowList(); - - /* Recalculate the button size */ - UpdateButtonsSize(FALSE); - } + if (!TaskBar.Initialize(m_hWnd)) + return FALSE; + + SetWindowTheme(TaskBar.m_hWnd, L"TaskBand", NULL); + OnThemeChanged(); + + TaskIcons = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 1000); + TaskBar.SetImageList(TaskIcons); + + /* Calculate the default button size. Don't save this in ButtonSize.cx so that + the actual button width gets updated correctly on the first recalculation */ + int cx = GetSystemMetrics(SM_CXMINIMIZED); + int cy = ButtonSize.cy = GetSystemMetrics(SM_CYSIZE) + (2 * GetSystemMetrics(SM_CYEDGE)); + TaskBar.SetButtonSize(cx, cy); + + /* Set proper spacing between buttons */ + TaskBar.UpdateTbButtonSpacing(Tray->IsHorizontal(), TaskBandTheme != NULL); + + /* Register the shell hook */ + ShellHookMsg = RegisterWindowMessage(TEXT("SHELLHOOK")); + + TRACE("ShellHookMsg got assigned number %d\n", ShellHookMsg); + + HMODULE hShell32 = GetModuleHandle(TEXT("SHELL32.DLL")); + if (hShell32 != NULL) + { + REGSHELLHOOK RegShellHook; + + /* RegisterShellHook */ + RegShellHook = (REGSHELLHOOK) GetProcAddress(hShell32, (LPCSTR) ((LONG) 181)); + if (RegShellHook != NULL) + { + RegShellHook(m_hWnd, 3); /* 1 if no NT! We're targeting NT so we don't care! */ + } + } + + RefreshWindowList(); + + /* Recalculate the button size */ + UpdateButtonsSize(FALSE); #if DUMP_TASKS != 0 SetTimer(hwnd, 1, 5000, NULL); @@ -1519,9 +1360,7 @@ return TRUE; } - BOOL HandleAppCommand( - IN WPARAM wParam, - IN LPARAM lParam) + BOOL HandleAppCommand(IN WPARAM wParam, IN LPARAM lParam) { BOOL Ret = FALSE; @@ -1553,20 +1392,17 @@ return 0; } - DbgPrint("Received shell hook message: wParam=%08lx, lParam=%08lx\n", wParam, lParam); + TRACE("Received shell hook message: wParam=%08lx, lParam=%08lx\n", wParam, lParam); switch ((INT) wParam) { case HSHELL_APPCOMMAND: - HandleAppCommand( - wParam, - lParam); + HandleAppCommand(wParam, lParam); Ret = TRUE; break; case HSHELL_WINDOWCREATED: - Ret = AddTask( - (HWND) lParam); + Ret = AddTask((HWND) lParam); break; case HSHELL_WINDOWDESTROYED: @@ -1630,18 +1466,15 @@ return Ret; } - VOID EnableGrouping( - IN BOOL bEnable) + VOID EnableGrouping(IN BOOL bEnable) { IsGroupingEnabled = bEnable; /* Collapse or expand groups if neccessary */ - UpdateButtonsSize( - FALSE); - } - - VOID HandleTaskItemClick( - IN OUT PTASK_ITEM TaskItem) + UpdateButtonsSize(FALSE); + } + + VOID HandleTaskItemClick(IN OUT PTASK_ITEM TaskItem) { BOOL bIsMinimized; BOOL bIsActive; @@ -1683,14 +1516,12 @@ } } - VOID HandleTaskGroupClick( - IN OUT PTASK_GROUP TaskGroup) + VOID HandleTaskGroupClick(IN OUT PTASK_GROUP TaskGroup) { /* TODO: Show task group menu */ } - BOOL HandleButtonClick( - IN WORD wIndex) + BOOL HandleButtonClick(IN WORD wIndex) { PTASK_ITEM TaskItem; PTASK_GROUP TaskGroup; @@ -1700,8 +1531,7 @@ TaskGroup = FindTaskGroupByIndex((INT) wIndex); if (TaskGroup != NULL && TaskGroup->IsCollapsed) { - HandleTaskGroupClick( - TaskGroup); + HandleTaskGroupClick(TaskGroup); return TRUE; } } @@ -1709,8 +1539,7 @@ TaskItem = FindTaskItemByIndex((INT) wIndex); if (TaskItem != NULL) { - HandleTaskItemClick( - TaskItem); + HandleTaskItemClick(TaskItem); return TRUE; } @@ -1718,32 +1547,31 @@ } - VOID HandleTaskItemRightClick( - IN OUT PTASK_ITEM TaskItem) + VOID HandleTaskItemRightClick(IN OUT PTASK_ITEM TaskItem) { HMENU hmenu = GetSystemMenu(TaskItem->hWnd, FALSE); - if (hmenu) { + if (hmenu) + { POINT pt; int cmd; GetCursorPos(&pt); - cmd = TrackPopupMenu(hmenu, TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hWndToolbar, NULL); - if (cmd) { + cmd = TrackPopupMenu(hmenu, TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, TaskBar.m_hWnd, NULL); + if (cmd) + { SetForegroundWindow(TaskItem->hWnd); // reactivate window after the context menu has closed PostMessage(TaskItem->hWnd, WM_SYSCOMMAND, cmd, 0); } } } - VOID HandleTaskGroupRightClick( - IN OUT PTASK_GROUP TaskGroup) + VOID HandleTaskGroupRightClick(IN OUT PTASK_GROUP TaskGroup) { /* TODO: Show task group right click menu */ } - BOOL HandleButtonRightClick( - IN WORD wIndex) + BOOL HandleButtonRightClick(IN WORD wIndex) { PTASK_ITEM TaskItem; PTASK_GROUP TaskGroup; @@ -1752,8 +1580,7 @@ TaskGroup = FindTaskGroupByIndex((INT) wIndex); if (TaskGroup != NULL && TaskGroup->IsCollapsed) { - HandleTaskGroupRightClick( - TaskGroup); + HandleTaskGroupRightClick(TaskGroup); return TRUE; } } @@ -1762,8 +1589,7 @@ if (TaskItem != NULL) { - HandleTaskItemRightClick( - TaskItem); + HandleTaskItemRightClick(TaskItem); return TRUE; } @@ -1828,8 +1654,7 @@ { case CDDS_ITEMPREPAINT: - Ret = HandleItemPaint( - nmtbcd); + Ret = HandleItemPaint(nmtbcd); break; case CDDS_PREPAINT: @@ -1876,18 +1701,11 @@ szClient.cx = LOWORD(lParam); szClient.cy = HIWORD(lParam); - if (hWndToolbar != NULL) - { - ::SetWindowPos(hWndToolbar, - NULL, - 0, - 0, - szClient.cx, - szClient.cy, - SWP_NOZORDER); - - UpdateButtonsSize( - FALSE); + if (TaskBar.m_hWnd != NULL) + { + TaskBar.SetWindowPos(NULL, 0, 0, szClient.cx, szClient.cy, SWP_NOZORDER); + + UpdateButtonsSize(FALSE); } return TRUE; } @@ -1926,10 +1744,9 @@ LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { LRESULT Ret = TRUE; - if (lParam != 0 && (HWND) lParam == hWndToolbar) - { - HandleButtonClick( - LOWORD(wParam)); + if (lParam != 0 && (HWND) lParam == TaskBar.m_hWnd) + { + HandleButtonClick(LOWORD(wParam)); } return Ret; } @@ -1939,10 +1756,9 @@ LRESULT Ret = TRUE; const NMHDR *nmh = (const NMHDR *) lParam; - if (nmh->hwndFrom == hWndToolbar) - { - Ret = HandleToolbarNotification( - nmh); + if (nmh->hwndFrom == TaskBar.m_hWnd) + { + Ret = HandleToolbarNotification(nmh); } return Ret; } @@ -1960,37 +1776,27 @@ LRESULT OnUpdateTaskbarPos(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { /* Update the button spacing */ - UpdateTbButtonSpacing( - Tray->IsHorizontal(), - 0, - 0); + TaskBar.UpdateTbButtonSpacing(Tray->IsHorizontal(), TaskBandTheme != NULL); return TRUE; } LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { LRESULT Ret; - if (hWndToolbar != NULL) + if (TaskBar.m_hWnd != NULL) { POINT pt; INT_PTR iBtn; - pt.x = (LONG) LOWORD(lParam); - pt.y = (LONG) HIWORD(lParam); - - MapWindowPoints(NULL, - hWndToolbar, - &pt, - 1); - - iBtn = (INT_PTR) SendMessage(hWndToolbar, - TB_HITTEST, - 0, - (LPARAM) &pt); + pt.x = GET_X_LPARAM(lParam); + pt.y = GET_Y_LPARAM(lParam); + + ::ScreenToClient(TaskBar.m_hWnd, &pt); + + iBtn = TaskBar.HitTest(&pt); if (iBtn >= 0) { - HandleButtonRightClick( - iBtn); + HandleButtonRightClick(iBtn); } else goto ForwardContextMenuMsg; @@ -1999,10 +1805,7 @@ { ForwardContextMenuMsg: /* Forward message */ - Ret = SendMessage(Tray->GetHWND(), - uMsg, - wParam, - lParam); + Ret = SendMessage(Tray->GetHWND(), uMsg, wParam, lParam); } return Ret; } @@ -2014,8 +1817,8 @@ { RECT* prcMinRect = (RECT*) lParam; RECT rcItem, rcToolbar; - SendMessageW(hWndToolbar, TB_GETITEMRECT, TaskItem->Index, (LPARAM) &rcItem); - GetWindowRect(hWndToolbar, &rcToolbar); + TaskBar.GetItemRect(TaskItem->Index, &rcItem); + GetWindowRect(TaskBar.m_hWnd, &rcToolbar); OffsetRect(&rcItem, rcToolbar.left, rcToolbar.top); Modified: branches/shell-experiments/base/shell/explorer-new/tbsite.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/ex…
============================================================================== --- branches/shell-experiments/base/shell/explorer-new/tbsite.cpp [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/explorer-new/tbsite.cpp [iso-8859-1] Wed Nov 5 22:58:53 2014 @@ -262,13 +262,10 @@ return E_FAIL; /*TRACE("Calling IWinEventHandler::ProcessMessage(0x%p, 0x%x, 0x%p, 0x%p, 0x%p) hWndRebar=0x%p\n", hWnd, uMsg, wParam, lParam, plResult, hWndRebar);*/ - hRet = WindowEventHandler->OnWinEvent( - hWnd, - uMsg, - wParam, - lParam, - plResult); - if (FAILED_UNEXPECTEDLY(hRet)) + hRet = WindowEventHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, plResult); + +#if 0 + if (FAILED(hRet)) { if (uMsg == WM_NOTIFY) { @@ -280,6 +277,7 @@ ERR("ITrayBandSite->IWinEventHandler::ProcessMessage(0x%p,0x%x,0x%p,0x%p,0x%p->0x%p) returned: 0x%x\n", hWnd, uMsg, wParam, lParam, plResult, *plResult, hRet); } } +#endif return hRet; } Modified: branches/shell-experiments/base/shell/explorer-new/trayntfy.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/ex…
============================================================================== --- branches/shell-experiments/base/shell/explorer-new/trayntfy.cpp [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/explorer-new/trayntfy.cpp [iso-8859-1] Wed Nov 5 22:58:53 2014 @@ -19,7 +19,9 @@ */ #include "precomp.h" -//#include <docobj.h> + +#define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp)) +#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp)) /* * SysPagerWnd @@ -85,6 +87,13 @@ TBBUTTON tbBtn; NOTIFYICONDATA * notifyItem; WCHAR text [] = TEXT(""); + + int index = FindItemByIconData(iconData, ¬ifyItem); + if (index >= 0) + { + UpdateButton(iconData); + return; + } notifyItem = new NOTIFYICONDATA(); ZeroMemory(notifyItem, sizeof(*notifyItem)); @@ -203,7 +212,7 @@ delete notifyItem; } - VOID GetTooltip(int index, LPTSTR szTip, DWORD cchTip) + VOID GetTooltipText(int index, LPTSTR szTip, DWORD cchTip) { NOTIFYICONDATA * notifyItem; notifyItem = GetItemData(index); @@ -242,7 +251,7 @@ if (uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST) { - DbgPrint("Sending message %S from button %d to %p (msg=%x, w=%x, l=%x)...\n", + TRACE("Sending message %S from button %d to %p (msg=%x, w=%x, l=%x)...\n", eventNames[uMsg - WM_MOUSEFIRST], wIndex, notifyItem->hWnd, notifyItem->uCallbackMessage, notifyItem->uID, uMsg); } @@ -269,13 +278,9 @@ LRESULT OnMouseEvent(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { - POINT pt; - INT iBtn; - - pt.x = LOWORD(lParam); - pt.y = HIWORD(lParam); - - iBtn = (INT) SendMessageW(TB_HITTEST, 0, (LPARAM) &pt); + POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; + + INT iBtn = HitTest(&pt); if (iBtn >= 0) { @@ -285,10 +290,65 @@ bHandled = FALSE; return FALSE; } + + LRESULT OnTooltipShow(INT uCode, LPNMHDR hdr, BOOL& bHandled) + { + RECT rcTip, rcItem; + GetWindowRect(hdr->hwndFrom, &rcTip); + + SIZE szTip = { rcTip.right - rcTip.left, rcTip.bottom - rcTip.top }; + + INT iBtn = GetHotItem(); + + if (iBtn >= 0) + { + MONITORINFO monInfo = { 0 }; + HMONITOR hMon = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST); + + monInfo.cbSize = sizeof(monInfo); + + if (hMon) + GetMonitorInfo(hMon, &monInfo); + else + GetWindowRect(GetDesktopWindow(), &monInfo.rcMonitor); + + GetItemRect(iBtn, &rcItem); + + POINT ptItem = { rcItem.left, rcItem.top }; + SIZE szItem = { rcItem.right - rcItem.left, rcItem.bottom - rcItem.top }; + ClientToScreen(m_hWnd, &ptItem); + + ptItem.x += szItem.cx / 2; + ptItem.y -= szTip.cy; + + if (ptItem.x + szTip.cx > monInfo.rcMonitor.right) + ptItem.x = monInfo.rcMonitor.right - szTip.cx; + + if (ptItem.y + szTip.cy > monInfo.rcMonitor.bottom) + ptItem.y = monInfo.rcMonitor.bottom - szTip.cy; + + if (ptItem.x < monInfo.rcMonitor.left) + ptItem.x = monInfo.rcMonitor.left; + + if (ptItem.y < monInfo.rcMonitor.top) + ptItem.y = monInfo.rcMonitor.top; + + TRACE("ptItem { %d, %d }\n", ptItem.x, ptItem.y); + + ::SetWindowPos(hdr->hwndFrom, NULL, ptItem.x, ptItem.y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); + + return TRUE; + } + + bHandled = FALSE; + return 0; + } + public: BEGIN_MSG_MAP(CNotifyToolbar) MESSAGE_RANGE_HANDLER(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseEvent) + NOTIFY_CODE_HANDLER(TTN_SHOW, OnTooltipShow) END_MSG_MAP() void Initialize(HWND hWndParent) @@ -298,7 +358,7 @@ TBSTYLE_FLAT | TBSTYLE_TOOLTIPS | TBSTYLE_WRAPABLE | TBSTYLE_TRANSPARENT | CCS_TOP | CCS_NORESIZE | CCS_NOPARENTALIGN | CCS_NODIVIDER; - Create(hWndParent, styles); + SubclassWindow(Create(hWndParent, styles)); SetWindowTheme(m_hWnd, L"TrayNotify", NULL); @@ -398,7 +458,6 @@ void GetSize(IN WPARAM wParam, IN PSIZE size) { INT rows = 0; - TBMETRICS tbm; int VisibleButtonCount = Toolbar.GetVisibleButtonCount(); if (wParam) /* horizontal */ @@ -415,20 +474,12 @@ rows++; size->cy = (VisibleButtonCount + rows - 1) / rows * 24; } - - tbm.cbSize = sizeof(tbm); - tbm.dwMask = TBMF_BARPAD | TBMF_BUTTONSPACING; - tbm.cxBarPad = tbm.cyBarPad = 0; - tbm.cxButtonSpacing = 0; - tbm.cyButtonSpacing = 0; - - Toolbar.SetMetrics(&tbm); } LRESULT OnGetInfoTip(INT uCode, LPNMHDR hdr, BOOL& bHandled) { NMTBGETINFOTIPW * nmtip = (NMTBGETINFOTIPW *) hdr; - Toolbar.GetTooltip(nmtip->iItem, nmtip->pszText, nmtip->cchTextMax); + Toolbar.GetTooltipText(nmtip->iItem, nmtip->pszText, nmtip->cchTextMax); return TRUE; } @@ -457,6 +508,15 @@ if (Toolbar) { + TBMETRICS tbm; + tbm.cbSize = sizeof(tbm); + tbm.dwMask = TBMF_BARPAD | TBMF_BUTTONSPACING; + tbm.cxBarPad = tbm.cyBarPad = 0; + tbm.cxButtonSpacing = 0; + tbm.cyButtonSpacing = 0; + + Toolbar.SetMetrics(&tbm); + Toolbar.SetWindowPos(NULL, 0, 0, szClient.cx, szClient.cy, SWP_NOZORDER); Toolbar.AutoSize(); Modified: branches/shell-experiments/base/shell/explorer-new/traywnd.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/ex…
============================================================================== --- branches/shell-experiments/base/shell/explorer-new/traywnd.cpp [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/explorer-new/traywnd.cpp [iso-8859-1] Wed Nov 5 22:58:53 2014 @@ -60,10 +60,10 @@ public ITrayWindow, public IShellDesktopTray { + CContainedWindow StartButton; + HTHEME TaskbarTheme; HWND hWndDesktop; - - HWND hwndStart; IImageList * himlStartBtn; SIZE StartBtnSize; @@ -120,9 +120,9 @@ public: CTrayWindow() : + StartButton(this, 1), TaskbarTheme(NULL), hWndDesktop(NULL), - hwndStart(NULL), himlStartBtn(NULL), hStartBtnFont(NULL), hCaptionFont(NULL), @@ -815,8 +815,7 @@ ResizeWorkArea(); - ApplyClipping( - TRUE); + ApplyClipping(TRUE); } typedef struct _TW_STUCKRECTS2 @@ -1058,20 +1057,14 @@ SIZE Size = { 0, 0 }; if (himlStartBtn == NULL || - !SendMessage(hwndStart, - BCM_GETIDEALSIZE, - 0, - (LPARAM) &Size)) + !StartButton.SendMessage(BCM_GETIDEALSIZE, 0, (LPARAM) &Size)) { Size.cx = GetSystemMetrics(SM_CXEDGE); Size.cy = GetSystemMetrics(SM_CYEDGE); if (hbmStart == NULL) { - hbmStart = (HBITMAP) SendMessage(hwndStart, - BM_GETIMAGE, - IMAGE_BITMAP, - 0); + hbmStart = (HBITMAP) StartButton.SendMessage(BM_GETIMAGE, IMAGE_BITMAP, 0); } if (hbmStart != NULL) @@ -1139,11 +1132,11 @@ if (StartSize.cx > rcClient.right) StartSize.cx = rcClient.right; - if (hwndStart != NULL) + if (StartButton.m_hWnd != NULL) { /* Resize and reposition the button */ dwp = DeferWindowPos(dwp, - hwndStart, + StartButton.m_hWnd, NULL, 0, 0, @@ -1407,6 +1400,15 @@ else TaskbarTheme = NULL; + if (TaskbarTheme) + { + SetWindowStyle(m_hWnd, WS_THICKFRAME | WS_BORDER, 0); + } + else + { + SetWindowStyle(m_hWnd, WS_THICKFRAME | WS_BORDER, WS_THICKFRAME | WS_BORDER); + } + return TRUE; } @@ -1461,26 +1463,24 @@ } /* Create the Start button */ - hwndStart = CreateWindowEx(0, - WC_BUTTON, - szStartCaption, - WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | - BS_PUSHBUTTON | BS_CENTER | BS_VCENTER | BS_BITMAP, - 0, - 0, - 0, - 0, - m_hWnd, - (HMENU) IDC_STARTBTN, - hExplorerInstance, - NULL); - if (hwndStart) - { - SetWindowTheme(hwndStart, L"Start", NULL); - SendMessage(hwndStart, - WM_SETFONT, - (WPARAM) hStartBtnFont, - FALSE); + StartButton.SubclassWindow(CreateWindowEx( + 0, + WC_BUTTON, + szStartCaption, + WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | + BS_PUSHBUTTON | BS_CENTER | BS_VCENTER | BS_BITMAP, + 0, + 0, + 0, + 0, + m_hWnd, + (HMENU) IDC_STARTBTN, + hExplorerInstance, + NULL)); + if (StartButton.m_hWnd) + { + SetWindowTheme(StartButton.m_hWnd, L"Start", NULL); + StartButton.SendMessage(WM_SETFONT, (WPARAM) hStartBtnFont, FALSE); if (CreateStartBtnImageList()) { @@ -1493,10 +1493,7 @@ bil.margin.top = bil.margin.bottom = 1; bil.uAlign = BUTTON_IMAGELIST_ALIGN_LEFT; - if (!SendMessage(hwndStart, - BCM_SETIMAGELIST, - 0, - (LPARAM) &bil)) + if (!StartButton.SendMessage(BCM_SETIMAGELIST, 0, (LPARAM) &bil)) { /* Fall back to the deprecated method on older systems that don't support Common Controls 6.0 */ @@ -1508,12 +1505,9 @@ /* We're using the image list, remove the BS_BITMAP style and don't center it horizontally */ - SetWindowStyle(hwndStart, - BS_BITMAP | BS_RIGHT, - 0); - - UpdateStartButton( - NULL); + SetWindowStyle(StartButton.m_hWnd, BS_BITMAP | BS_RIGHT, 0); + + UpdateStartButton(NULL); } else { @@ -1523,13 +1517,9 @@ hbmStart = CreateStartButtonBitmap(); if (hbmStart != NULL) { - UpdateStartButton( - hbmStart); - - hbmOld = (HBITMAP) SendMessage(hwndStart, - BM_SETIMAGE, - IMAGE_BITMAP, - (LPARAM) hbmStart); + UpdateStartButton(hbmStart); + + hbmOld = (HBITMAP) StartButton.SendMessage(BM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hbmStart); if (hbmOld != NULL) DeleteObject(hbmOld); @@ -1657,7 +1647,7 @@ HWND hwnd; RECT posRect; - GetWindowRect(hwndStart, &posRect); + GetWindowRect(StartButton.m_hWnd, &posRect); hwnd = CreateWindowEx(0, WC_STATIC, NULL, @@ -1920,7 +1910,7 @@ HWND hwnd; RECT posRect; - GetWindowRect(hwndStart, &posRect); + GetWindowRect(StartButton.m_hWnd, &posRect); hwnd = CreateWindowEx(0, WC_STATIC, @@ -1979,8 +1969,7 @@ RECTL rcExclude; DWORD dwFlags = 0; - if (GetWindowRect(hwndStart, - (RECT*) &rcExclude)) + if (GetWindowRect(StartButton.m_hWnd, (RECT*) &rcExclude)) { switch (Position) { @@ -2007,7 +1996,7 @@ &rcExclude, dwFlags); - SendMessageW(hwndStart, BM_SETSTATE, TRUE, 0); + StartButton.SendMessageW(BM_SETSTATE, TRUE, 0); } } } @@ -2023,7 +2012,7 @@ GetWindowRect(m_hWnd, &rcCurrent); over = PtInRect(&rcCurrent, pt); - if (SendMessage(hwndStart, BM_GETSTATE, 0, 0) != BST_UNCHECKED) + if (StartButton.SendMessage( BM_GETSTATE, 0, 0) != BST_UNCHECKED) { over = TRUE; } @@ -2434,7 +2423,7 @@ uId = TrackMenu( hSysMenu, NULL, - hwndStart, + StartButton.m_hWnd, Position != ABE_TOP, FALSE); if (uId != 0) @@ -2483,16 +2472,13 @@ if (pt.x != -1 || pt.y != -1) ppt = &pt; else - hWndExclude = hwndStart; - - if ((HWND) wParam == hwndStart) + hWndExclude = StartButton.m_hWnd; + + if ((HWND) wParam == StartButton.m_hWnd) { /* Make sure we can't track the context menu if the start menu is currently being shown */ - if (!(SendMessage(hwndStart, - BM_GETSTATE, - 0, - 0) & BST_PUSHED)) + if (!(StartButton.SendMessage(BM_GETSTATE, 0, 0) & BST_PUSHED)) { TrackCtxMenu( &StartMenuBtnCtxMenu, @@ -2511,27 +2497,18 @@ POINT ptClient = *ppt; /* Convert the coordinates to client-coordinates */ - MapWindowPoints(NULL, - m_hWnd, - &ptClient, - 1); - - hWndAtPt = ChildWindowFromPoint(m_hWnd, - ptClient); + MapWindowPoints(NULL, m_hWnd, &ptClient, 1); + + hWndAtPt = ChildWindowFromPoint(m_hWnd, ptClient); if (hWndAtPt != NULL && (hWndAtPt == hwndRebar || IsChild(hwndRebar, hWndAtPt))) { /* Check if the user clicked on the task switch window */ ptClient = *ppt; - MapWindowPoints(NULL, - hwndRebar, - &ptClient, - 1); - - hWndAtPt = ChildWindowFromPointEx(hwndRebar, - ptClient, - CWP_SKIPINVISIBLE | CWP_SKIPDISABLED); + MapWindowPoints(NULL, hwndRebar, &ptClient, 1); + + hWndAtPt = ChildWindowFromPointEx(hwndRebar, ptClient, CWP_SKIPINVISIBLE | CWP_SKIPDISABLED); if (hWndAtPt == hwndTaskSwitch) goto HandleTrayContextMenu; @@ -2572,7 +2549,7 @@ return Ret; } - if (TrayBandSite == NULL || FAILED_UNEXPECTEDLY(hr)) + if (TrayBandSite == NULL || FAILED(hr)) { const NMHDR *nmh = (const NMHDR *) lParam; @@ -2628,7 +2605,7 @@ } else { - SendMessage(m_hWnd, WM_COMMAND, MAKEWPARAM(BN_CLICKED, IDC_STARTBTN), reinterpret_cast<LPARAM>(hwndStart)); + PopupStartMenu(); } return TRUE; @@ -2638,7 +2615,7 @@ { LRESULT Ret = FALSE; - if ((HWND) lParam == hwndStart) + if ((HWND) lParam == StartButton.m_hWnd) { PopupStartMenu(); return FALSE; @@ -2801,9 +2778,7 @@ Msg.wParam = wParam; Msg.lParam = lParam; - if (StartMenuBand->TranslateMenuMessage( - &Msg, - &lRet) == S_OK) + if (StartMenuBand->TranslateMenuMessage(&Msg, &lRet) == S_OK) { return lRet; } @@ -2812,32 +2787,33 @@ lParam = Msg.lParam; } MESSAGE_HANDLER(WM_THEMECHANGED, OnThemeChanged) - NOTIFY_CODE_HANDLER(RBN_AUTOSIZE, OnRebarAutoSize) // Doesn't quite work ;P - MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) - MESSAGE_HANDLER(WM_SIZE, OnSize) - MESSAGE_HANDLER(WM_CREATE, OnCreate) - /*MESSAGE_HANDLER(WM_DESTROY, OnDestroy)*/ - MESSAGE_HANDLER(WM_NCHITTEST, OnNcHitTest) - MESSAGE_HANDLER(WM_COMMAND, OnCommand) - MESSAGE_HANDLER(WM_NOTIFY, OnNotify) - MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextMenu) - MESSAGE_HANDLER(WM_TIMER, OnTimer) - MESSAGE_HANDLER(WM_DISPLAYCHANGE, OnDisplayChange) - MESSAGE_HANDLER(WM_COPYDATA, OnCopyData) - MESSAGE_HANDLER(WM_NCPAINT, OnNcPaint) - MESSAGE_HANDLER(WM_CTLCOLORBTN, OnCtlColorBtn) - MESSAGE_HANDLER(WM_MOVING, OnMoving) - MESSAGE_HANDLER(WM_SIZING, OnSizing) - MESSAGE_HANDLER(WM_WINDOWPOSCHANGING, OnWindowPosChange) - MESSAGE_HANDLER(WM_ENTERSIZEMOVE, OnEnterSizeMove) - MESSAGE_HANDLER(WM_EXITSIZEMOVE, OnExitSizeMove) - MESSAGE_HANDLER(WM_SYSCHAR, OnSysChar) - MESSAGE_HANDLER(WM_NCRBUTTONUP, OnNcRButtonUp) - MESSAGE_HANDLER(WM_NCLBUTTONDBLCLK, OnNcLButtonDblClick) - MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) - MESSAGE_HANDLER(WM_NCMOUSEMOVE, OnMouseMove) - MESSAGE_HANDLER(WM_APP_TRAYDESTROY, OnAppTrayDestroy) - MESSAGE_HANDLER(TWM_OPENSTARTMENU, OnOpenStartMenu) + NOTIFY_CODE_HANDLER(RBN_AUTOSIZE, OnRebarAutoSize) // Doesn't quite work ;P + MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) + MESSAGE_HANDLER(WM_SIZE, OnSize) + MESSAGE_HANDLER(WM_CREATE, OnCreate) + /*MESSAGE_HANDLER(WM_DESTROY, OnDestroy)*/ + MESSAGE_HANDLER(WM_NCHITTEST, OnNcHitTest) + MESSAGE_HANDLER(WM_COMMAND, OnCommand) + MESSAGE_HANDLER(WM_NOTIFY, OnNotify) + MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextMenu) + MESSAGE_HANDLER(WM_TIMER, OnTimer) + MESSAGE_HANDLER(WM_DISPLAYCHANGE, OnDisplayChange) + MESSAGE_HANDLER(WM_COPYDATA, OnCopyData) + MESSAGE_HANDLER(WM_NCPAINT, OnNcPaint) + MESSAGE_HANDLER(WM_CTLCOLORBTN, OnCtlColorBtn) + MESSAGE_HANDLER(WM_MOVING, OnMoving) + MESSAGE_HANDLER(WM_SIZING, OnSizing) + MESSAGE_HANDLER(WM_WINDOWPOSCHANGING, OnWindowPosChange) + MESSAGE_HANDLER(WM_ENTERSIZEMOVE, OnEnterSizeMove) + MESSAGE_HANDLER(WM_EXITSIZEMOVE, OnExitSizeMove) + MESSAGE_HANDLER(WM_SYSCHAR, OnSysChar) + MESSAGE_HANDLER(WM_NCRBUTTONUP, OnNcRButtonUp) + MESSAGE_HANDLER(WM_NCLBUTTONDBLCLK, OnNcLButtonDblClick) + MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) + MESSAGE_HANDLER(WM_NCMOUSEMOVE, OnMouseMove) + MESSAGE_HANDLER(WM_APP_TRAYDESTROY, OnAppTrayDestroy) + MESSAGE_HANDLER(TWM_OPENSTARTMENU, OnOpenStartMenu) + ALT_MSG_MAP(1) END_MSG_MAP() /* @@ -2959,10 +2935,7 @@ while (1) { - Ret = GetMessage(&Msg, - NULL, - 0, - 0); + Ret = GetMessage(&Msg, NULL, 0, 0); if (!Ret || Ret == -1) break; @@ -3026,7 +2999,7 @@ virtual HRESULT RaiseStartButton() { - SendMessageW(hwndStart, BM_SETSTATE, FALSE, 0); + StartButton.SendMessageW(BM_SETSTATE, FALSE, 0); return S_OK; } Modified: branches/shell-experiments/include/reactos/rosctrls.h URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/include/react…
============================================================================== --- branches/shell-experiments/include/reactos/rosctrls.h [iso-8859-1] (original) +++ branches/shell-experiments/include/reactos/rosctrls.h [iso-8859-1] Wed Nov 5 22:58:53 2014 @@ -197,9 +197,9 @@ }; -template<typename TItemData> +template<typename TItemData = DWORD_PTR> class CToolbar : - public CWindow + public CWindowImplBaseT<CWindow> { public: // Configuration methods @@ -215,15 +215,11 @@ dwExStyles = WS_EX_TOOLWINDOW; } - m_hWnd = CreateWindowEx(dwExStyles, + m_hWnd = CreateWindowExW(dwExStyles, TOOLBARCLASSNAME, NULL, dwStyles, - 0, - 0, - 0, - 0, - hWndParent, + 0, 0, 0, 0, hWndParent, NULL, _AtlBaseModule.GetModuleInstance(), NULL); @@ -242,6 +238,21 @@ return SendMessageW(TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); } + HWND GetTooltip() + { + return (HWND)SendMessageW(TB_GETTOOLTIPS); + } + + DWORD SetTooltip(HWND hWndTooltip) + { + return SendMessageW(TB_SETTOOLTIPS, hWndTooltip, 0); + } + + INT GetHotItem() + { + return SendMessageW(TB_GETHOTITEM); + } + public: // Button list management methods int GetButtonCount() { @@ -299,15 +310,36 @@ return SendMessageW(TB_AUTOSIZE); } + DWORD GetMetrics(TBMETRICS * tbm) + { + return SendMessageW(TB_GETMETRICS, 0, (LPARAM) tbm); + } + + DWORD SetMetrics(TBMETRICS * tbm) + { + return SendMessageW(TB_SETMETRICS, 0, (LPARAM) tbm); + } + + DWORD GetItemRect(int index, LPRECT prcItem) + { + return SendMessageW(TB_GETITEMRECT, index, (LPARAM) prcItem); + } + + DWORD SetRedraw(BOOL bEnable) + { + return SendMessageW(WM_SETREDRAW, bEnable); + } + public: // Image list management methods DWORD SetImageList(HIMAGELIST himl) { return SendMessageW(TB_SETIMAGELIST, 0, (LPARAM) himl); } - DWORD SetMetrics(TBMETRICS * tbm) - { - return SendMessageW(TB_SETMETRICS, 0, (LPARAM) tbm); +public: // Other methods + INT HitTest(PPOINT ppt) + { + return (INT) SendMessageW(TB_HITTEST, 0, (LPARAM) ppt); } public: // Utility methods
10 years, 1 month
1
0
0
0
[khornicek] 65273: [WIN32K] - don't create a rect with a zero area in NtGdiExtFloodFill CORE-8755
by khornicek@svn.reactos.org
Author: khornicek Date: Wed Nov 5 22:01:08 2014 New Revision: 65273 URL:
http://svn.reactos.org/svn/reactos?rev=65273&view=rev
Log: [WIN32K] - don't create a rect with a zero area in NtGdiExtFloodFill CORE-8755 Modified: trunk/reactos/win32ss/gdi/ntgdi/fillshap.c Modified: trunk/reactos/win32ss/gdi/ntgdi/fillshap.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/fillshap…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/fillshap.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/fillshap.c [iso-8859-1] Wed Nov 5 22:01:08 2014 @@ -1132,7 +1132,7 @@ goto cleanup; } else - RECTL_vSetRect(&DestRect, 0, psurf->SurfObj.sizlBitmap.cx, 0, psurf->SurfObj.sizlBitmap.cy); + RECTL_vSetRect(&DestRect, 0, 0, psurf->SurfObj.sizlBitmap.cx, psurf->SurfObj.sizlBitmap.cy); DC_vPrepareDCsForBlit(dc, &DestRect, NULL, NULL);
10 years, 1 month
1
0
0
0
[aandrejevic] 65272: [FAST486] Make sure the corrected prefetch address contains the block we're trying to read.
by aandrejevic@svn.reactos.org
Author: aandrejevic Date: Wed Nov 5 20:21:32 2014 New Revision: 65272 URL:
http://svn.reactos.org/svn/reactos?rev=65272&view=rev
Log: [FAST486] Make sure the corrected prefetch address contains the block we're trying to read. Modified: trunk/reactos/lib/fast486/common.c Modified: trunk/reactos/lib/fast486/common.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fast486/common.c?rev=6…
============================================================================== --- trunk/reactos/lib/fast486/common.c [iso-8859-1] (original) +++ trunk/reactos/lib/fast486/common.c [iso-8859-1] Wed Nov 5 20:21:32 2014 @@ -106,6 +106,13 @@ /* We mustn't prefetch across a page boundary */ State->PrefetchAddress = PAGE_ALIGN(State->PrefetchAddress) | (FAST486_PAGE_SIZE - FAST486_CACHE_SIZE); + + if ((LinearAddress - State->PrefetchAddress + Size) >= FAST486_CACHE_SIZE) + { + /* We can't prefetch without possibly violating page permissions */ + State->PrefetchValid = FALSE; + return Fast486ReadLinearMemory(State, LinearAddress, Buffer, Size); + } } /* Prefetch */
10 years, 1 month
1
0
0
0
[akhaldi] 65271: * Sync up to trunk head (r65270).
by akhaldi@svn.reactos.org
Author: akhaldi Date: Wed Nov 5 19:33:30 2014 New Revision: 65271 URL:
http://svn.reactos.org/svn/reactos?rev=65271&view=rev
Log: * Sync up to trunk head (r65270). Added: branches/shell-experiments/dll/win32/iphlpapi/address.c - copied unchanged from r65270, trunk/reactos/dll/win32/iphlpapi/address.c Modified: branches/shell-experiments/ (props changed) branches/shell-experiments/base/applications/regedit/childwnd.c branches/shell-experiments/dll/win32/iphlpapi/CMakeLists.txt branches/shell-experiments/dll/win32/iphlpapi/iphlpapi_main.c branches/shell-experiments/dll/win32/syssetup/classinst.c branches/shell-experiments/drivers/bus/pci/pdo.c branches/shell-experiments/drivers/filesystems/fastfat/cleanup.c branches/shell-experiments/drivers/filesystems/fastfat/fcb.c branches/shell-experiments/drivers/filesystems/ntfs/attrib.c branches/shell-experiments/drivers/filesystems/ntfs/blockdev.c branches/shell-experiments/drivers/filesystems/ntfs/create.c branches/shell-experiments/drivers/filesystems/ntfs/dirctl.c branches/shell-experiments/drivers/filesystems/ntfs/fcb.c branches/shell-experiments/drivers/filesystems/ntfs/finfo.c branches/shell-experiments/drivers/filesystems/ntfs/mft.c branches/shell-experiments/drivers/filesystems/ntfs/misc.c branches/shell-experiments/drivers/filesystems/ntfs/ntfs.h branches/shell-experiments/drivers/filesystems/ntfs/rw.c branches/shell-experiments/drivers/filesystems/ntfs/volinfo.c branches/shell-experiments/drivers/network/afd/afd/tdi.c branches/shell-experiments/drivers/network/afd/include/afd.h branches/shell-experiments/drivers/network/tcpip/include/info.h branches/shell-experiments/drivers/network/tcpip/tcpip/iinfo.c branches/shell-experiments/drivers/network/tcpip/tcpip/ninfo.c branches/shell-experiments/drivers/storage/class/disk/disk.c branches/shell-experiments/drivers/storage/fdc/fdc/fdc.c branches/shell-experiments/drivers/storage/fdc/fdc/fdo.c branches/shell-experiments/drivers/storage/fdc/fdc/pdo.c branches/shell-experiments/include/psdk/iptypes.h branches/shell-experiments/include/reactos/libs/fast486/fast486.h branches/shell-experiments/lib/fast486/common.c branches/shell-experiments/lib/fast486/common.h branches/shell-experiments/lib/fast486/common.inl branches/shell-experiments/lib/fast486/extraops.c branches/shell-experiments/lib/fast486/opcodes.c branches/shell-experiments/lib/fast486/opgroups.c branches/shell-experiments/ntoskrnl/config/cmlazy.c branches/shell-experiments/ntoskrnl/config/ntapi.c branches/shell-experiments/ntoskrnl/ex/init.c branches/shell-experiments/ntoskrnl/ex/pushlock.c branches/shell-experiments/ntoskrnl/ex/sysinfo.c branches/shell-experiments/ntoskrnl/include/internal/ps.h branches/shell-experiments/ntoskrnl/include/internal/se.h branches/shell-experiments/ntoskrnl/io/iomgr/file.c branches/shell-experiments/ntoskrnl/ke/i386/traphdlr.c branches/shell-experiments/ntoskrnl/ke/thrdschd.c branches/shell-experiments/ntoskrnl/lpc/connect.c branches/shell-experiments/ntoskrnl/lpc/send.c branches/shell-experiments/ntoskrnl/ob/obsecure.c branches/shell-experiments/ntoskrnl/ps/query.c branches/shell-experiments/ntoskrnl/ps/quota.c branches/shell-experiments/ntoskrnl/se/acl.c branches/shell-experiments/ntoskrnl/se/sd.c branches/shell-experiments/subsystems/ntvdm/bios/bios32/bios32.c branches/shell-experiments/subsystems/ntvdm/dos/mouse32.c branches/shell-experiments/subsystems/ntvdm/hardware/keyboard.c branches/shell-experiments/subsystems/ntvdm/hardware/mouse.c branches/shell-experiments/win32ss/gdi/ntgdi/region.c branches/shell-experiments/win32ss/user/ntuser/focus.c [This mail would be too long, it was shortened to contain the URLs only.] Modified: branches/shell-experiments/base/applications/regedit/childwnd.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/applicat…
Modified: branches/shell-experiments/dll/win32/iphlpapi/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/iph…
Modified: branches/shell-experiments/dll/win32/iphlpapi/iphlpapi_main.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/iph…
Modified: branches/shell-experiments/dll/win32/syssetup/classinst.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/sys…
Modified: branches/shell-experiments/drivers/bus/pci/pdo.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/drivers/bus/p…
Modified: branches/shell-experiments/drivers/filesystems/fastfat/cleanup.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/drivers/files…
Modified: branches/shell-experiments/drivers/filesystems/fastfat/fcb.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/drivers/files…
Modified: branches/shell-experiments/drivers/filesystems/ntfs/attrib.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/drivers/files…
Modified: branches/shell-experiments/drivers/filesystems/ntfs/blockdev.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/drivers/files…
Modified: branches/shell-experiments/drivers/filesystems/ntfs/create.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/drivers/files…
Modified: branches/shell-experiments/drivers/filesystems/ntfs/dirctl.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/drivers/files…
Modified: branches/shell-experiments/drivers/filesystems/ntfs/fcb.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/drivers/files…
Modified: branches/shell-experiments/drivers/filesystems/ntfs/finfo.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/drivers/files…
Modified: branches/shell-experiments/drivers/filesystems/ntfs/mft.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/drivers/files…
Modified: branches/shell-experiments/drivers/filesystems/ntfs/misc.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/drivers/files…
Modified: branches/shell-experiments/drivers/filesystems/ntfs/ntfs.h URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/drivers/files…
Modified: branches/shell-experiments/drivers/filesystems/ntfs/rw.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/drivers/files…
Modified: branches/shell-experiments/drivers/filesystems/ntfs/volinfo.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/drivers/files…
Modified: branches/shell-experiments/drivers/network/afd/afd/tdi.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/drivers/netwo…
Modified: branches/shell-experiments/drivers/network/afd/include/afd.h URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/drivers/netwo…
Modified: branches/shell-experiments/drivers/network/tcpip/include/info.h URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/drivers/netwo…
Modified: branches/shell-experiments/drivers/network/tcpip/tcpip/iinfo.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/drivers/netwo…
Modified: branches/shell-experiments/drivers/network/tcpip/tcpip/ninfo.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/drivers/netwo…
Modified: branches/shell-experiments/drivers/storage/class/disk/disk.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/drivers/stora…
Modified: branches/shell-experiments/drivers/storage/fdc/fdc/fdc.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/drivers/stora…
Modified: branches/shell-experiments/drivers/storage/fdc/fdc/fdo.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/drivers/stora…
Modified: branches/shell-experiments/drivers/storage/fdc/fdc/pdo.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/drivers/stora…
Modified: branches/shell-experiments/include/psdk/iptypes.h URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/include/psdk/…
Modified: branches/shell-experiments/include/reactos/libs/fast486/fast486.h URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/include/react…
Modified: branches/shell-experiments/lib/fast486/common.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/lib/fast486/c…
Modified: branches/shell-experiments/lib/fast486/common.h URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/lib/fast486/c…
Modified: branches/shell-experiments/lib/fast486/common.inl URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/lib/fast486/c…
Modified: branches/shell-experiments/lib/fast486/extraops.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/lib/fast486/e…
Modified: branches/shell-experiments/lib/fast486/opcodes.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/lib/fast486/o…
Modified: branches/shell-experiments/lib/fast486/opgroups.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/lib/fast486/o…
Modified: branches/shell-experiments/ntoskrnl/config/cmlazy.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/ntoskrnl/conf…
Modified: branches/shell-experiments/ntoskrnl/config/ntapi.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/ntoskrnl/conf…
Modified: branches/shell-experiments/ntoskrnl/ex/init.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/ntoskrnl/ex/i…
Modified: branches/shell-experiments/ntoskrnl/ex/pushlock.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/ntoskrnl/ex/p…
Modified: branches/shell-experiments/ntoskrnl/ex/sysinfo.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/ntoskrnl/ex/s…
Modified: branches/shell-experiments/ntoskrnl/include/internal/ps.h URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/ntoskrnl/incl…
Modified: branches/shell-experiments/ntoskrnl/include/internal/se.h URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/ntoskrnl/incl…
Modified: branches/shell-experiments/ntoskrnl/io/iomgr/file.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/ntoskrnl/io/i…
Modified: branches/shell-experiments/ntoskrnl/ke/i386/traphdlr.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/ntoskrnl/ke/i…
Modified: branches/shell-experiments/ntoskrnl/ke/thrdschd.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/ntoskrnl/ke/t…
Modified: branches/shell-experiments/ntoskrnl/lpc/connect.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/ntoskrnl/lpc/…
Modified: branches/shell-experiments/ntoskrnl/lpc/send.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/ntoskrnl/lpc/…
Modified: branches/shell-experiments/ntoskrnl/ob/obsecure.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/ntoskrnl/ob/o…
Modified: branches/shell-experiments/ntoskrnl/ps/query.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/ntoskrnl/ps/q…
Modified: branches/shell-experiments/ntoskrnl/ps/quota.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/ntoskrnl/ps/q…
Modified: branches/shell-experiments/ntoskrnl/se/acl.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/ntoskrnl/se/a…
Modified: branches/shell-experiments/ntoskrnl/se/sd.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/ntoskrnl/se/s…
Modified: branches/shell-experiments/subsystems/ntvdm/bios/bios32/bios32.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/subsystems/nt…
Modified: branches/shell-experiments/subsystems/ntvdm/dos/mouse32.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/subsystems/nt…
Modified: branches/shell-experiments/subsystems/ntvdm/hardware/keyboard.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/subsystems/nt…
Modified: branches/shell-experiments/subsystems/ntvdm/hardware/mouse.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/subsystems/nt…
Modified: branches/shell-experiments/win32ss/gdi/ntgdi/region.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/win32ss/gdi/n…
Modified: branches/shell-experiments/win32ss/user/ntuser/focus.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/win32ss/user/…
10 years, 1 month
1
0
0
0
[tfaber] 65270: [FASTFAT] - Assert that we never reference or dereference an FCB with RefCount 0 CORE-8733
by tfaber@svn.reactos.org
Author: tfaber Date: Wed Nov 5 19:06:19 2014 New Revision: 65270 URL:
http://svn.reactos.org/svn/reactos?rev=65270&view=rev
Log: [FASTFAT] - Assert that we never reference or dereference an FCB with RefCount 0 CORE-8733 Modified: trunk/reactos/drivers/filesystems/fastfat/fcb.c Modified: trunk/reactos/drivers/filesystems/fastfat/fcb.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/fcb.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/fcb.c [iso-8859-1] Wed Nov 5 19:06:19 2014 @@ -295,6 +295,7 @@ ASSERT(ExIsResourceAcquiredExclusive(&pVCB->DirResource)); ASSERT(pFCB != pVCB->VolumeFcb); + ASSERT(pFCB->RefCount > 0); ++pFCB->RefCount; } @@ -313,6 +314,7 @@ while (pFCB) { ASSERT(pFCB != pVCB->VolumeFcb); + ASSERT(pFCB->RefCount > 0); pFCB->RefCount--; if (pFCB->RefCount == 0) { @@ -497,7 +499,6 @@ fileObject->FsContext = fcb; fileObject->FsContext2 = newCCB; fcb->FileObject = fileObject; - vfatGrabFCB(vcb, fcb); _SEH2_TRY { @@ -510,7 +511,6 @@ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { status = _SEH2_GetExceptionCode(); - fcb->RefCount--; fcb->FileObject = NULL; ExFreeToNPagedLookasideList(&VfatGlobalData->CcbLookasideList, newCCB); ObDereferenceObject(fileObject); @@ -518,6 +518,7 @@ } _SEH2_END; + vfatGrabFCB(vcb, fcb); fcb->Flags |= FCB_CACHE_INITIALIZED; return STATUS_SUCCESS; } @@ -663,7 +664,7 @@ rcFCB->RFCB.FileSize.QuadPart = Size; rcFCB->RFCB.ValidDataLength.QuadPart = Size; rcFCB->RFCB.AllocationSize.QuadPart = ROUND_UP(Size, vcb->FatInfo.BytesPerCluster); - vfatGrabFCB(vcb, rcFCB); + rcFCB->RefCount = 1; if (vfatFCBIsDirectory(rcFCB)) { vfatFCBInitializeCacheFromVolume(vcb, rcFCB);
10 years, 1 month
1
0
0
0
[tfaber] 65269: [FASTFAT] - VfatCleanupFile: do not dereference the FCB when closing the volume file object. ObDereferenceObject already causes an IRP_MJ_CLOSE request to be sent, which dereference...
by tfaber@svn.reactos.org
Author: tfaber Date: Wed Nov 5 18:52:11 2014 New Revision: 65269 URL:
http://svn.reactos.org/svn/reactos?rev=65269&view=rev
Log: [FASTFAT] - VfatCleanupFile: do not dereference the FCB when closing the volume file object. ObDereferenceObject already causes an IRP_MJ_CLOSE request to be sent, which dereferences the FCB. CORE-8733 #resolve Modified: trunk/reactos/drivers/filesystems/fastfat/cleanup.c Modified: trunk/reactos/drivers/filesystems/fastfat/cleanup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/cleanup.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/cleanup.c [iso-8859-1] Wed Nov 5 18:52:11 2014 @@ -92,7 +92,6 @@ pFcb->FileObject = NULL; CcUninitializeCacheMap(tmpFileObject, NULL, NULL); ObDereferenceObject(tmpFileObject); - vfatReleaseFCB(IrpContext->DeviceExt, pFcb); } CcPurgeCacheSection(FileObject->SectionObjectPointer, NULL, 0, FALSE);
10 years, 1 month
1
0
0
0
[zguo] 65268: [0.3.17] Final tag for release.
by zguo@svn.reactos.org
Author: zguo Date: Wed Nov 5 18:41:09 2014 New Revision: 65268 URL:
http://svn.reactos.org/svn/reactos?rev=65268&view=rev
Log: [0.3.17] Final tag for release. Added: tags/ReactOS-0.3.17/ (props changed) - copied from r65155, branches/0.3.17/ Propchange: tags/ReactOS-0.3.17/ ------------------------------------------------------------------------------ --- bugtraq:logregex (added) +++ bugtraq:logregex Wed Nov 5 18:41:09 2014 @@ -0,0 +1,2 @@ +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+) Propchange: tags/ReactOS-0.3.17/ ------------------------------------------------------------------------------ bugtraq:message = See issue #%BUGID% for more details. Propchange: tags/ReactOS-0.3.17/ ------------------------------------------------------------------------------ bugtraq:url =
http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: tags/ReactOS-0.3.17/ ------------------------------------------------------------------------------ svn:mergeinfo = /trunk:64769
10 years, 1 month
1
0
0
0
[akhaldi] 65267: [SHELL32] * Another partial sync of brsfolder.c with Wine 1.7.27. CORE-8540
by akhaldi@svn.reactos.org
Author: akhaldi Date: Wed Nov 5 17:04:42 2014 New Revision: 65267 URL:
http://svn.reactos.org/svn/reactos?rev=65267&view=rev
Log: [SHELL32] * Another partial sync of brsfolder.c with Wine 1.7.27. CORE-8540 Modified: branches/shell-experiments/dll/win32/shell32/wine/brsfolder.c Modified: branches/shell-experiments/dll/win32/shell32/wine/brsfolder.c URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/wine/brsfolder.c [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/wine/brsfolder.c [iso-8859-1] Wed Nov 5 17:04:42 2014 @@ -63,10 +63,10 @@ typedef struct tagTV_ITEMDATA { - IShellFolder* lpsfParent; /* IShellFolder of the parent */ + LPSHELLFOLDER lpsfParent; /* IShellFolder of the parent */ LPITEMIDLIST lpi; /* PIDL relative to parent */ LPITEMIDLIST lpifq; /* Fully qualified PIDL */ - IEnumIDList* pEnumIL; /* Children iterator */ + IEnumIDList* pEnumIL; /* Children iterator */ } TV_ITEMDATA, *LPTV_ITEMDATA; typedef struct tagLAYOUT_INFO @@ -98,12 +98,16 @@ BIF_NEWDIALOGSTYLE | \ BIF_BROWSEINCLUDEFILES) -static void FillTreeView(browse_info*, IShellFolder*, +static void FillTreeView(browse_info*, LPSHELLFOLDER, LPITEMIDLIST, HTREEITEM, IEnumIDList*); -static HTREEITEM InsertTreeViewItem( browse_info*, IShellFolder*, +static HTREEITEM InsertTreeViewItem( browse_info*, IShellFolder *, LPCITEMIDLIST, LPCITEMIDLIST, IEnumIDList*, HTREEITEM); -static const WCHAR szBrowseFolderInfo[] = L"__WINE_BRSFOLDERDLG_INFO"; +static const WCHAR szBrowseFolderInfo[] = { + '_','_','W','I','N','E','_', + 'B','R','S','F','O','L','D','E','R','D','L','G','_', + 'I','N','F','O',0 +}; static inline DWORD BrowseFlagsToSHCONTF(UINT ulFlags) { @@ -125,7 +129,7 @@ int i; GetClientRect(hwnd, &rcWnd); - data = (LAYOUT_DATA *)SHAlloc(sizeof(LAYOUT_DATA)*layout_count); + data = SHAlloc(sizeof(LAYOUT_DATA)*layout_count); for (i = 0; i < layout_count; i++) { RECT r; @@ -184,7 +188,7 @@ * InitializeTreeView [Internal] * * Called from WM_INITDIALOG handler. - * + * * PARAMS * hwndParent [I] The BrowseForFolder dialog * root [I] ITEMIDLIST of the root shell folder @@ -201,18 +205,18 @@ LPCITEMIDLIST root = info->lpBrowseInfo->pidlRoot; TRACE("%p\n", info ); - + Shell_GetImageLists(NULL, &hImageList); if (hImageList) SendMessageW( info->hwndTreeView, TVM_SETIMAGELIST, 0, (LPARAM)hImageList ); /* We want to call InsertTreeViewItem down the code, in order to insert - * the root item of the treeview. Due to InsertTreeViewItem's signature, + * the root item of the treeview. Due to InsertTreeViewItem's signature, * we need the following to do this: * - * + An ITEMIDLIST corresponding to _the parent_ of root. - * + An ITEMIDLIST, which is a relative path from root's parent to root + * + An ITEMIDLIST corresponding to _the parent_ of root. + * + An ITEMIDLIST, which is a relative path from root's parent to root * (containing a single SHITEMID). * + An IShellFolder interface pointer of root's parent folder. * @@ -222,9 +226,8 @@ pidlParent = ILClone(root); ILRemoveLastID(pidlParent); pidlChild = ILClone(ILFindLastID(root)); - - if (_ILIsDesktop(pidlParent)) - { + + if (_ILIsDesktop(pidlParent)) { hr = SHGetDesktopFolder(&lpsfParent); } else { IShellFolder *lpsfDesktop; @@ -236,6 +239,7 @@ return; } hr = IShellFolder_BindToObject(lpsfDesktop, pidlParent, 0, &IID_IShellFolder, (LPVOID*)&lpsfParent); + IShellFolder_Release(lpsfDesktop); } if (FAILED(hr)) { @@ -315,7 +319,7 @@ /****************************************************************************** * GetName [Internal] * - * Query a shell folder for the display name of one of it's children + * Query a shell folder for the display name of one of its children * * PARAMS * lpsf [I] IShellFolder interface of the folder to be queried. @@ -327,19 +331,19 @@ * Success: TRUE * Failure: FALSE */ -static BOOL GetName(IShellFolder * lpsf, LPCITEMIDLIST lpi, DWORD dwFlags, LPWSTR lpFriendlyName) -{ - BOOL bSuccess=TRUE; - STRRET str; - - TRACE("%p %p %x %p\n", lpsf, lpi, dwFlags, lpFriendlyName); - if (SUCCEEDED(IShellFolder_GetDisplayNameOf(lpsf, lpi, dwFlags, &str))) +static BOOL GetName(LPSHELLFOLDER lpsf, LPCITEMIDLIST lpi, DWORD dwFlags, LPWSTR lpFriendlyName) +{ + BOOL bSuccess=TRUE; + STRRET str; + + TRACE("%p %p %x %p\n", lpsf, lpi, dwFlags, lpFriendlyName); + if (SUCCEEDED(IShellFolder_GetDisplayNameOf(lpsf, lpi, dwFlags, &str))) bSuccess = StrRetToStrNW(lpFriendlyName, MAX_PATH, &str, lpi); - else - bSuccess = FALSE; - - TRACE("-- %s\n", debugstr_w(lpFriendlyName)); - return bSuccess; + else + bSuccess = FALSE; + + TRACE("-- %s\n", debugstr_w(lpFriendlyName)); + return bSuccess; } /****************************************************************************** @@ -347,7 +351,7 @@ * * PARAMS * info [I] data for the dialog - * lpsf [I] IShellFolder interface of the item's parent shell folder + * lpsf [I] IShellFolder interface of the item's parent shell folder * pidl [I] ITEMIDLIST of the child to insert, relative to parent * pidlParent [I] ITEMIDLIST of the parent shell folder * pEnumIL [I] Iterator for the children of the item to be inserted @@ -361,46 +365,46 @@ LPCITEMIDLIST pidl, LPCITEMIDLIST pidlParent, IEnumIDList* pEnumIL, HTREEITEM hParent) { - TVITEMW tvi; - TVINSERTSTRUCTW tvins; - WCHAR szBuff[MAX_PATH]; - LPTV_ITEMDATA lptvid=0; - - tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; - - tvi.cChildren= pEnumIL ? 1 : 0; - tvi.mask |= TVIF_CHILDREN; - - if (!GetName(lpsf, pidl, SHGDN_NORMAL, szBuff)) - return NULL; - - lptvid = (TV_ITEMDATA *)SHAlloc( sizeof(TV_ITEMDATA) ); - if (!lptvid) - return NULL; - - tvi.pszText = szBuff; - tvi.cchTextMax = MAX_PATH; - tvi.lParam = (LPARAM)lptvid; - - IShellFolder_AddRef(lpsf); + TVITEMW tvi; + TVINSERTSTRUCTW tvins; + WCHAR szBuff[MAX_PATH]; + LPTV_ITEMDATA lptvid=0; + + tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; + + tvi.cChildren= pEnumIL ? 1 : 0; + tvi.mask |= TVIF_CHILDREN; + + if (!GetName(lpsf, pidl, SHGDN_NORMAL, szBuff)) + return NULL; + + lptvid = SHAlloc( sizeof(TV_ITEMDATA) ); + if (!lptvid) + return NULL; + + tvi.pszText = szBuff; + tvi.cchTextMax = MAX_PATH; + tvi.lParam = (LPARAM)lptvid; + + IShellFolder_AddRef(lpsf); IEnumIDList_AddRef(pEnumIL); - lptvid->lpsfParent = lpsf; - lptvid->lpi = ILClone(pidl); - lptvid->lpifq = pidlParent ? ILCombine(pidlParent, pidl) : ILClone(pidl); - lptvid->pEnumIL = pEnumIL; - GetNormalAndSelectedIcons(lptvid->lpifq, &tvi); - - tvins.u.item = tvi; - tvins.hInsertAfter = NULL; - tvins.hParent = hParent; - - return TreeView_InsertItem( info->hwndTreeView, &tvins ); + lptvid->lpsfParent = lpsf; + lptvid->lpi = ILClone(pidl); + lptvid->lpifq = pidlParent ? ILCombine(pidlParent, pidl) : ILClone(pidl); + lptvid->pEnumIL = pEnumIL; + GetNormalAndSelectedIcons(lptvid->lpifq, &tvi); + + tvins.u.item = tvi; + tvins.hInsertAfter = NULL; + tvins.hParent = hParent; + + return TreeView_InsertItem( info->hwndTreeView, &tvins ); } /****************************************************************************** * FillTreeView [Internal] * - * For each child (given by lpe) of the parent shell folder, which is given by + * For each child (given by lpe) of the parent shell folder, which is given by * lpsf and whose PIDL is pidl, insert a treeview-item right under hParent * * PARAMS @@ -413,32 +417,32 @@ static void FillTreeView( browse_info *info, IShellFolder * lpsf, LPITEMIDLIST pidl, HTREEITEM hParent, IEnumIDList* lpe) { - LPITEMIDLIST pidlTemp = 0; - ULONG ulFetched; - HRESULT hr; - HWND hwnd = GetParent( info->hwndTreeView ); - - TRACE("%p %p %p %p\n",lpsf, pidl, hParent, lpe); - - /* No IEnumIDList -> No children */ - if (!lpe) return; - - SetCapture( hwnd ); - SetCursor( LoadCursorA( 0, (LPSTR)IDC_WAIT ) ); - - while (S_OK == IEnumIDList_Next(lpe,1,&pidlTemp,&ulFetched)) - { - ULONG ulAttrs = SFGAO_HASSUBFOLDER | SFGAO_FOLDER; + LPITEMIDLIST pidlTemp = 0; + ULONG ulFetched; + HRESULT hr; + HWND hwnd = GetParent( info->hwndTreeView ); + + TRACE("%p %p %p %p\n",lpsf, pidl, hParent, lpe); + + /* No IEnumIDList -> No children */ + if (!lpe) return; + + SetCapture( hwnd ); + SetCursor( LoadCursorA( 0, (LPSTR)IDC_WAIT ) ); + + while (S_OK == IEnumIDList_Next(lpe,1,&pidlTemp,&ulFetched)) + { + ULONG ulAttrs = SFGAO_HASSUBFOLDER | SFGAO_FOLDER; IEnumIDList* pEnumIL = NULL; IShellFolder* pSFChild = NULL; - IShellFolder_GetAttributesOf(lpsf, 1, (LPCITEMIDLIST*)&pidlTemp, &ulAttrs); - if (ulAttrs & SFGAO_FOLDER) - { - hr = IShellFolder_BindToObject(lpsf,pidlTemp,NULL,&IID_IShellFolder,(LPVOID*)&pSFChild); - if (SUCCEEDED(hr)) + IShellFolder_GetAttributesOf(lpsf, 1, (LPCITEMIDLIST*)&pidlTemp, &ulAttrs); + if (ulAttrs & SFGAO_FOLDER) + { + hr = IShellFolder_BindToObject(lpsf,pidlTemp,NULL,&IID_IShellFolder,(LPVOID*)&pSFChild); + if (SUCCEEDED(hr)) { - DWORD flags = BrowseFlagsToSHCONTF(info->lpBrowseInfo->ulFlags); - hr = IShellFolder_EnumObjects(pSFChild, hwnd, flags, &pEnumIL); + DWORD flags = BrowseFlagsToSHCONTF(info->lpBrowseInfo->ulFlags); + hr = IShellFolder_EnumObjects(pSFChild, hwnd, flags, &pEnumIL); if (hr == S_OK) { if ((IEnumIDList_Skip(pEnumIL, 1) != S_OK) || @@ -450,17 +454,17 @@ } IShellFolder_Release(pSFChild); } - } - - if (!InsertTreeViewItem(info, lpsf, pidlTemp, pidl, pEnumIL, hParent)) - goto done; - SHFree(pidlTemp); /* Finally, free the pidl that the shell gave us... */ - pidlTemp=NULL; - } + } + + if (!InsertTreeViewItem(info, lpsf, pidlTemp, pidl, pEnumIL, hParent)) + goto done; + SHFree(pidlTemp); /* Finally, free the pidl that the shell gave us... */ + pidlTemp=NULL; + } done: - ReleaseCapture(); - SetCursor(LoadCursorW(0, (LPWSTR)IDC_ARROW)); + ReleaseCapture(); + SetCursor(LoadCursorW(0, (LPWSTR)IDC_ARROW)); SHFree(pidlTemp); } @@ -493,12 +497,10 @@ } dwAttributes = SFGAO_FOLDER | SFGAO_FILESYSTEM; - r = IShellFolder_GetAttributesOf(lptvid->lpsfParent, - 1, - (LPCITEMIDLIST*)&lptvid->lpi, - &dwAttributes); + r = IShellFolder_GetAttributesOf(lptvid->lpsfParent, 1, + (LPCITEMIDLIST*)&lptvid->lpi, &dwAttributes); if (FAILED(r) || - ((dwAttributes & (SFGAO_FOLDER|SFGAO_FILESYSTEM)) != (SFGAO_FOLDER|SFGAO_FILESYSTEM))) + ((dwAttributes & (SFGAO_FOLDER|SFGAO_FILESYSTEM)) != (SFGAO_FOLDER|SFGAO_FILESYSTEM))) { if (lpBrowseInfo->ulFlags & BIF_RETURNONLYFSDIRS) bEnabled = FALSE; @@ -537,7 +539,8 @@ return 0; if (!_ILIsEmpty(lptvid->lpi)) { - r = IShellFolder_BindToObject(lptvid->lpsfParent, lptvid->lpi, 0, &IID_IShellFolder, (void**)&lpsf2); + r = IShellFolder_BindToObject( lptvid->lpsfParent, lptvid->lpi, 0, + &IID_IShellFolder, (void**)&lpsf2 ); } else { lpsf2 = lptvid->lpsfParent; r = IShellFolder_AddRef(lpsf2); @@ -603,8 +606,8 @@ SHFree(item_data->lpifq); SHFree(item_data->lpi); item_data->lpifq = SHSimpleIDListFromPathW(new_path); - IShellFolder_ParseDisplayName(item_data->lpsfParent, NULL, NULL, pnmtv->item.pszText, - NULL, &item_data->lpi, NULL); + IShellFolder_ParseDisplayName(item_data->lpsfParent, NULL, NULL, + pnmtv->item.pszText, NULL, &item_data->lpi, NULL); item.mask = TVIF_HANDLE|TVIF_TEXT; item.pszText = pnmtv->item.pszText; @@ -661,7 +664,7 @@ if (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE) FIXME("flags BIF_NEWDIALOGSTYLE partially implemented\n"); if (lpBrowseInfo->ulFlags & ~SUPPORTEDFLAGS) - FIXME("flags %x not implemented\n", lpBrowseInfo->ulFlags & ~SUPPORTEDFLAGS); + FIXME("flags %x not implemented\n", lpBrowseInfo->ulFlags & ~SUPPORTEDFLAGS); if (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE) { @@ -680,13 +683,13 @@ } if (lpBrowseInfo->lpszTitle) - SetWindowTextW( GetDlgItem(hWnd, IDC_BROWSE_FOR_FOLDER_TITLE), lpBrowseInfo->lpszTitle ); + SetWindowTextW( GetDlgItem(hWnd, IDC_BROWSE_FOR_FOLDER_TITLE), lpBrowseInfo->lpszTitle ); else - ShowWindow( GetDlgItem(hWnd, IDC_BROWSE_FOR_FOLDER_TITLE), SW_HIDE ); + ShowWindow( GetDlgItem(hWnd, IDC_BROWSE_FOR_FOLDER_TITLE), SW_HIDE ); if (!(lpBrowseInfo->ulFlags & BIF_STATUSTEXT) || (lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE)) - ShowWindow( GetDlgItem(hWnd, IDC_BROWSE_FOR_FOLDER_STATUS), SW_HIDE ); + ShowWindow( GetDlgItem(hWnd, IDC_BROWSE_FOR_FOLDER_STATUS), SW_HIDE ); /* Hide "Make New Folder" Button? */ if ((lpBrowseInfo->ulFlags & BIF_NONEWFOLDERBUTTON) @@ -849,10 +852,10 @@ return FALSE; } -static BOOL BrsFolder_OnSetExpanded(browse_info *info, LPVOID selection, +static BOOL BrsFolder_OnSetExpanded(browse_info *info, LPVOID selection, BOOL is_str, HTREEITEM *pItem) { - LPITEMIDLIST pidlSelection = (LPITEMIDLIST)selection; + LPITEMIDLIST pidlSelection = selection; LPCITEMIDLIST pidlCurrent, pidlRoot; TVITEMEXW item; BOOL bResult = FALSE; @@ -868,10 +871,10 @@ if (FAILED(hr)) goto done; - hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, (LPOLESTR)selection, - NULL, &pidlSelection, NULL); + hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, + selection, NULL, &pidlSelection, NULL); IShellFolder_Release(psfDesktop); - if (FAILED(hr)) + if (FAILED(hr)) goto done; } @@ -906,28 +909,28 @@ if (_ILIsEqualSimple(pItemData->lpi, pidlCurrent)) { pidlCurrent = ILGetNext(pidlCurrent); if (!_ILIsEmpty(pidlCurrent)) { - /* Only expand current node and move on to it's first child, + /* Only expand current node and move on to its first child, * if we didn't already reach the last SHITEMID */ SendMessageW(info->hwndTreeView, TVM_EXPAND, TVE_EXPAND, (LPARAM)item.hItem); item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_CHILD, - (LPARAM)item.hItem); + (LPARAM)item.hItem); } } else { item.hItem = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_NEXT, - (LPARAM)item.hItem); + (LPARAM)item.hItem); } } - if (_ILIsEmpty(pidlCurrent) && item.hItem) + if (_ILIsEmpty(pidlCurrent) && item.hItem) bResult = TRUE; done: - if (pidlSelection && pidlSelection != (LPITEMIDLIST)selection) + if (pidlSelection && pidlSelection != selection) ILFree(pidlSelection); - if (pItem) + if (pItem) *pItem = item.hItem; - + return bResult; } @@ -947,13 +950,13 @@ LPWSTR selectionW = NULL; BOOL result = FALSE; int length; - + if (!is_str) return BrsFolder_OnSetSelectionW(info, selection, is_str); - if ((length = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)selection, -1, NULL, 0)) && - (selectionW = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, length * sizeof(WCHAR))) && - MultiByteToWideChar(CP_ACP, 0, (LPCSTR)selection, -1, selectionW, length)) + if ((length = MultiByteToWideChar(CP_ACP, 0, selection, -1, NULL, 0)) && + (selectionW = HeapAlloc(GetProcessHeap(), 0, length * sizeof(WCHAR))) && + MultiByteToWideChar(CP_ACP, 0, selection, -1, selectionW, length)) { result = BrsFolder_OnSetSelectionW(info, selectionW, is_str); } @@ -962,7 +965,7 @@ return result; } -static BOOL BrsFolder_OnWindowPosChanging(browse_info *info, WINDOWPOS *pos) +static LRESULT BrsFolder_OnWindowPosChanging(browse_info *info, WINDOWPOS *pos) { if ((info->lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE) && !(pos->flags & SWP_NOSIZE)) { @@ -989,7 +992,7 @@ * BrsFolderDlgProc32 (not an exported API function) */ static INT_PTR CALLBACK BrsFolderDlgProc( HWND hWnd, UINT msg, WPARAM wParam, - LPARAM lParam ) + LPARAM lParam ) { browse_info *info; @@ -998,7 +1001,7 @@ if (msg == WM_INITDIALOG) return BrsFolder_OnCreate( hWnd, (browse_info*) lParam ); - info = (browse_info*) GetPropW( hWnd, szBrowseFolderInfo ); + info = GetPropW( hWnd, szBrowseFolderInfo ); switch (msg) { @@ -1028,12 +1031,12 @@ case BFFM_ENABLEOK: TRACE("Enable %ld\n", lParam); - EnableWindow(GetDlgItem(hWnd, 1), (lParam)?TRUE:FALSE); + EnableWindow(GetDlgItem(hWnd, 1), lParam != 0); break; case BFFM_SETOKTEXT: /* unicode only */ - TRACE("Set OK text %s\n", debugstr_w((LPWSTR)wParam)); - SetWindowTextW(GetDlgItem(hWnd, 1), (LPWSTR)wParam); + TRACE("Set OK text %s\n", debugstr_w((LPWSTR)lParam)); + SetWindowTextW(GetDlgItem(hWnd, 1), (LPWSTR)lParam); break; case BFFM_SETSELECTIONA: @@ -1071,7 +1074,7 @@ bi.pidlRoot = lpbi->pidlRoot; if (lpbi->pszDisplayName) { - bi.pszDisplayName = (WCHAR *)HeapAlloc( GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR) ); + bi.pszDisplayName = HeapAlloc( GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR) ); MultiByteToWideChar( CP_ACP, 0, lpbi->pszDisplayName, -1, bi.pszDisplayName, MAX_PATH ); } else @@ -1080,7 +1083,7 @@ if (lpbi->lpszTitle) { len = MultiByteToWideChar( CP_ACP, 0, lpbi->lpszTitle, -1, NULL, 0 ); - title = (WCHAR *)HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); + title = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); MultiByteToWideChar( CP_ACP, 0, lpbi->lpszTitle, -1, title, len ); } else @@ -1129,8 +1132,8 @@ else wDlgId = IDD_BROWSE_FOR_FOLDER; r = DialogBoxParamW( shell32_hInstance, MAKEINTRESOURCEW(wDlgId), lpbi->hwndOwner, - BrsFolderDlgProc, (LPARAM)&info ); - if (SUCCEEDED(hr)) + BrsFolderDlgProc, (LPARAM)&info ); + if (SUCCEEDED(hr)) OleUninitialize(); if (!r) {
10 years, 1 month
1
0
0
0
[tfaber] 65266: [REGEDIT] - Avoid unicode character literal. Fixes weird looking address bar button on MSVC build.
by tfaber@svn.reactos.org
Author: tfaber Date: Wed Nov 5 16:51:16 2014 New Revision: 65266 URL:
http://svn.reactos.org/svn/reactos?rev=65266&view=rev
Log: [REGEDIT] - Avoid unicode character literal. Fixes weird looking address bar button on MSVC build. Modified: trunk/reactos/base/applications/regedit/childwnd.c Modified: trunk/reactos/base/applications/regedit/childwnd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/…
============================================================================== --- trunk/reactos/base/applications/regedit/childwnd.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/regedit/childwnd.c [iso-8859-1] Wed Nov 5 16:51:16 2014 @@ -385,7 +385,7 @@ g_pChildWnd->hAddressBarWnd = CreateWindowExW(WS_EX_CLIENTEDGE, L"Edit", NULL, WS_CHILD | WS_VISIBLE | WS_CHILDWINDOW | WS_TABSTOP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hWnd, (HMENU)0, hInst, 0); - g_pChildWnd->hAddressBtnWnd = CreateWindowExW(0, L"Button", L"»", WS_CHILD | WS_VISIBLE | WS_CHILDWINDOW | WS_TABSTOP | BS_TEXT | BS_CENTER | BS_VCENTER | BS_FLAT | BS_DEFPUSHBUTTON, + g_pChildWnd->hAddressBtnWnd = CreateWindowExW(0, L"Button", L"\x00BB", WS_CHILD | WS_VISIBLE | WS_CHILDWINDOW | WS_TABSTOP | BS_TEXT | BS_CENTER | BS_VCENTER | BS_FLAT | BS_DEFPUSHBUTTON, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hWnd, (HMENU)0, hInst, 0); g_pChildWnd->hTreeWnd = CreateTreeView(hWnd, g_pChildWnd->szPath, (HMENU) TREE_WINDOW);
10 years, 1 month
1
0
0
0
← Newer
1
...
24
25
26
27
28
29
30
...
38
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Results per page:
10
25
50
100
200