Module: wine Branch: refs/heads/master Commit: cc5b5cea967d466ef4c87d039f63d90a99980b76 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=cc5b5cea967d466ef4c87d03...
Author: Rein Klazes wijn@wanadoo.nl Date: Wed Mar 1 16:39:37 2006 +0100
user32: Fix handling of '\b' right flush character in menus. - do not add extra space; modify the tests to confirm this; - right flush to the menu tab stop, not to the menu border; - small fixes to the menu tab stop calculation.
---
dlls/user/menu.c | 17 +++++++---------- dlls/user/tests/menu.c | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/dlls/user/menu.c b/dlls/user/menu.c index e2c6318..673fcc4 100644 --- a/dlls/user/menu.c +++ b/dlls/user/menu.c @@ -997,6 +997,7 @@ static void MENU_CalcItemSize( HDC hdc, }
itemheight = 0; + lpitem->xTab = 0;
if (!menuBar) { if (lpitem->hbmpItem) { @@ -1011,9 +1012,11 @@ static void MENU_CalcItemSize( HDC hdc, lpitem->rect.right += size.cx + 2; itemheight = size.cy + 2; } - lpitem->rect.right += 4 + arrow_bitmap_width + menucharsize.cx; if( !(lppop->dwStyle & MNS_NOCHECK)) lpitem->rect.right += check_bitmap_width; + lpitem->rect.right += 4 + menucharsize.cx; + lpitem->xTab = lpitem->rect.right; + lpitem->rect.right += arrow_bitmap_width; } else if (lpitem->hbmpItem) { /* menuBar */ SIZE size;
@@ -1030,7 +1033,6 @@ static void MENU_CalcItemSize( HDC hdc, RECT rc = lpitem->rect; LONG txtheight, txtwidth;
- lpitem->xTab = 0; if ( lpitem->fState & MFS_DEFAULT ) { hfontOld = SelectObject( hdc, get_menu_font(TRUE) ); } @@ -1055,8 +1057,7 @@ static void MENU_CalcItemSize( HDC hdc, /* get text size after the tab */ tmpheight = DrawTextW( hdc, p, -1, &tmprc, DT_SINGLELINE|DT_CALCRECT); - lpitem->xTab = menucharsize.cx + - 4 + check_bitmap_width + lpitem->bmpsize.cx + txtwidth; + lpitem->xTab += txtwidth; txtheight = max( txtheight, tmpheight); txtwidth += menucharsize.cx + /* space for the tab */ tmprc.right - tmprc.left; /* space for the short cut */ @@ -1064,13 +1065,8 @@ static void MENU_CalcItemSize( HDC hdc, txtheight = DrawTextW( hdc, lpitem->text, -1, &rc, DT_SINGLELINE|DT_CALCRECT); txtwidth = rc.right - rc.left; - if (strchrW( lpitem->text, '\b' )) - lpitem->rect.right += menucharsize.cx; - lpitem->xTab = 4 + check_bitmap_width + lpitem->bmpsize.cx + - txtwidth; + lpitem->xTab += txtwidth; } - if( (lppop->dwStyle & MNS_NOCHECK)) - lpitem->xTab -= check_bitmap_width; lpitem->rect.right += 2 + txtwidth; itemheight = max( itemheight, max( txtheight + 2, menucharsize.cy + 4)); @@ -1642,6 +1638,7 @@ static void MENU_DrawMenuItem( HWND hwnd } else { + rect.right = lpitem->xTab; uFormat = DT_RIGHT | DT_VCENTER | DT_SINGLELINE; }
diff --git a/dlls/user/tests/menu.c b/dlls/user/tests/menu.c index 7de5d6d..7bb0f94 100644 --- a/dlls/user/tests/menu.c +++ b/dlls/user/tests/menu.c @@ -64,7 +64,7 @@ static struct { SIZE sc_size; /* size of the short-cut */ } MOD_txtsizes[] = { { "Pinot &Noir" }, - { "&Merlot\t" }, + { "&Merlot\bF4" }, { "Shira&z\tAlt+S" }, { "" }, { NULL }