Dmitry Timoshkov wrote:
Hello,
Changelog: Dmitry Timoshkov dmitry@codeweavers.com Add support for TB_GETMETRICS and TB_SETMETRICS messages.
diff -u cvs/hq/wine/dlls/comctl32/toolbar.c wine/dlls/comctl32/toolbar.c --- cvs/hq/wine/dlls/comctl32/toolbar.c 2004-03-07 17:24:46.000000000 +0800 +++ wine/dlls/comctl32/toolbar.c 2004-03-07 18:12:44.000000000 +0800 @@ -5871,6 +5871,60 @@ TOOLBAR_SysColorChange (HWND hwnd) }
+static LRESULT TOOLBAR_GetMetrics(HWND hwnd, LPTBMETRICS lpMetrics) +{
- TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
- if (lpMetrics->cbSize != sizeof(TBMETRICS))
- return 0;
- if (lpMetrics->dwMask & TBMF_PAD)
- {
- lpMetrics->cxPad = infoPtr->nButtonWidth;
- lpMetrics->cyPad = infoPtr->nButtonHeight;
- }
- if (lpMetrics->dwMask & TBMF_BARPAD)
- {
- lpMetrics->cxBarPad = infoPtr->nWidth;
- lpMetrics->cyBarPad = infoPtr->nHeight;
- }
- if (lpMetrics->dwMask & TBMF_BUTTONSPACING)
- {
- lpMetrics->cxButtonSpacing = infoPtr->szPadding.cx;
- lpMetrics->cyButtonSpacing = infoPtr->szPadding.cy;
I don't think this is quite right. MSDN says that cxButtonSpacing is "Width of the space between toolbar buttons", where as padding is "used to create a blank area between the edge of the button and the button's image and/or text". If experimentation proves that they are the same then a nice comment saying MSDN is wrong would be appropriate.
Rob
"Robert Shearman" R.J.Shearman@warwick.ac.uk wrote:
- if (lpMetrics->dwMask & TBMF_BUTTONSPACING)
- {
- lpMetrics->cxButtonSpacing = infoPtr->szPadding.cx;
- lpMetrics->cyButtonSpacing = infoPtr->szPadding.cy;
I don't think this is quite right. MSDN says that cxButtonSpacing is "Width of the space between toolbar buttons", where as padding is "used to create a blank area between the edge of the button and the button's image and/or text". If experimentation proves that they are the same then a nice comment saying MSDN is wrong would be appropriate.
My implementation was based only on MSDN docs. I just compared a raw message list between latest MSDN and Wine implementation and found that two. So I decided to add support for them.
A comment for szPadding in Wine says: /* padding values around button */.
Looks like toolbar.c has plenty of similar (and possibly redundant) things:
INT nHeight; /* height of the toolbar */ INT nWidth; /* width of the toolbar */ RECT client_rect; RECT rcBound; /* bounding rectangle */
What another field should be used for c[x|y]ButtonSpacing instead?
Dmitry Timoshkov wrote:
"Robert Shearman" R.J.Shearman@warwick.ac.uk wrote:
- if (lpMetrics->dwMask & TBMF_BUTTONSPACING)
- {
- lpMetrics->cxButtonSpacing = infoPtr->szPadding.cx;
- lpMetrics->cyButtonSpacing = infoPtr->szPadding.cy;
I don't think this is quite right. MSDN says that
cxButtonSpacing is "Width
of the space between toolbar buttons", where as padding is
"used to create a
blank area between the edge of the button and the button's image and/or text". If experimentation proves that they are the same then a
nice comment
saying MSDN is wrong would be appropriate.
My implementation was based only on MSDN docs. I just compared a raw message list between latest MSDN and Wine implementation and found that two. So I decided to add support for them.
A comment for szPadding in Wine says: /* padding values around button */.
Looks like toolbar.c has plenty of similar (and possibly redundant) things:
INT nHeight; /* height of the toolbar */ INT nWidth; /* width of the toolbar */ RECT client_rect; RECT rcBound; /* bounding rectangle */
Yes, on first inspection it looks as though they are redundant. I'll take a look at this and see if I can clean it up. I have a fairly large patch for the drawing code in the works which should make it much easier to add themeing support and looks much neater, so I'll get this out of the way first.
What another field should be used for c[x|y]ButtonSpacing instead?
It looks like it. It shouldn't be too hard to add support for it. You will just need to change TOOLBAR_CalcToolbar to add on the extra spacing between the buttons.
Rob
"Robert Shearman" R.J.Shearman@warwick.ac.uk wrote:
A comment for szPadding in Wine says: /* padding values around button */.
Looks like toolbar.c has plenty of similar (and possibly redundant) things:
INT nHeight; /* height of the toolbar */ INT nWidth; /* width of the toolbar */ RECT client_rect; RECT rcBound; /* bounding rectangle */
Yes, on first inspection it looks as though they are redundant. I'll take a look at this and see if I can clean it up. I have a fairly large patch for the drawing code in the works which should make it much easier to add themeing support and looks much neater, so I'll get this out of the way first.
What another field should be used for c[x|y]ButtonSpacing instead?
It looks like it. It shouldn't be too hard to add support for it. You will just need to change TOOLBAR_CalcToolbar to add on the extra spacing between the buttons.
I take it that toolbar.c code doesn't have support for button spacing yet? In that case I'll wait for your work. Feel free to add support for it in your patch and incorporate my work in it.
Dmitry Timoshkov wrote:
What another field should be used for c[x|y]ButtonSpacing instead?
It looks like it. It shouldn't be too hard to add support for
it. You will
just need to change TOOLBAR_CalcToolbar to add on the extra
spacing between
the buttons.
I take it that toolbar.c code doesn't have support for button spacing yet? In that case I'll wait for your work. Feel free to add support for it in your patch and incorporate my work in it.
Ok. Will do. I have another patch in the works adding the other missing messages too.
Rob