user32: Menu tracing improvements.

This commit is contained in:
Rein Klazes 2006-01-04 14:48:07 +01:00 committed by Alexandre Julliard
parent 67f29999a3
commit 1d4b52c254
1 changed files with 65 additions and 84 deletions

View File

@ -210,74 +210,64 @@ const struct builtin_class_descr MENU_builtin_class =
static void do_debug_print_menuitem(const char *prefix, MENUITEM * mp, static void do_debug_print_menuitem(const char *prefix, MENUITEM * mp,
const char *postfix) const char *postfix)
{ {
static const char * const hbmmenus[] = { "HBMMENU_CALLBACK", "", "HBMMENU_SYSTEM",
"HBMMENU_MBAR_RESTORE", "HBMMENU_MBAR_MINIMIZE", "HBMMENU_MBAR_CLOSE",
"HBMMENU_MBAR_CLOSE_D", "HBMMENU_MBAR_MINIMIZE_D", "HBMMENU_POPUP_CLOSE",
"HBMMENU_POPUP_RESTORE", "HBMMENU_POPUP_MAXIMIZE", "HBMMENU_POPUP_MINIMIZE"};
TRACE("%s ", prefix); TRACE("%s ", prefix);
if (mp) { if (mp) {
UINT flags = mp->fType; UINT flags = mp->fType;
int type = MENU_ITEM_TYPE(flags); TRACE( "{ ID=0x%x", mp->wID);
TRACE( "{ ID=0x%x", mp->wID); if ( mp->hSubMenu)
if (flags & MF_POPUP) TRACE( ", Sub=%p", mp->hSubMenu);
TRACE( ", Sub=%p", mp->hSubMenu); if (flags) {
if (flags) { int count = 0;
int count = 0; TRACE( ", fType=");
TRACE( ", Type="); MENUFLAG( MFT_SEPARATOR, "sep");
if (type == MFT_STRING) MENUFLAG( MFT_OWNERDRAW, "own");
/* Nothing */ ; MENUFLAG( MFT_BITMAP, "bit");
else if (type == MFT_SEPARATOR) MENUFLAG(MF_POPUP, "pop");
MENUOUT("sep"); MENUFLAG(MFT_MENUBARBREAK, "barbrk");
else if (type == MFT_OWNERDRAW) MENUFLAG(MFT_MENUBREAK, "brk");
MENUOUT("own"); MENUFLAG(MFT_RADIOCHECK, "radio");
else if (type == MFT_BITMAP) MENUFLAG(MFT_RIGHTORDER, "rorder");
MENUOUT("bit"); MENUFLAG(MF_SYSMENU, "sys");
else MENUFLAG(MFT_RIGHTJUSTIFY, "right"); /* same as MF_HELP */
MENUOUT("???"); if (flags)
flags -= type; TRACE( "+0x%x", flags);
}
MENUFLAG(MF_POPUP, "pop"); flags = mp->fState;
MENUFLAG(MFT_MENUBARBREAK, "barbrk"); if (flags) {
MENUFLAG(MFT_MENUBREAK, "brk"); int count = 0;
MENUFLAG(MFT_RADIOCHECK, "radio"); TRACE( ", State=");
MENUFLAG(MFT_RIGHTORDER, "rorder"); MENUFLAG(MFS_GRAYED, "grey");
MENUFLAG(MF_SYSMENU, "sys"); MENUFLAG(MFS_DEFAULT, "default");
MENUFLAG(MFT_RIGHTJUSTIFY, "right"); /* same as MF_HELP */ MENUFLAG(MFS_DISABLED, "dis");
MENUFLAG(MFS_CHECKED, "check");
if (flags) MENUFLAG(MFS_HILITE, "hi");
TRACE( "+0x%x", flags); MENUFLAG(MF_USECHECKBITMAPS, "usebit");
} MENUFLAG(MF_MOUSESELECT, "mouse");
flags = mp->fState; if (flags)
if (flags) { TRACE( "+0x%x", flags);
int count = 0; }
TRACE( ", State="); if (mp->hCheckBit)
MENUFLAG(MFS_GRAYED, "grey"); TRACE( ", Chk=%p", mp->hCheckBit);
MENUFLAG(MFS_DEFAULT, "default"); if (mp->hUnCheckBit)
MENUFLAG(MFS_DISABLED, "dis"); TRACE( ", Unc=%p", mp->hUnCheckBit);
MENUFLAG(MFS_CHECKED, "check"); if (mp->text)
MENUFLAG(MFS_HILITE, "hi"); TRACE( ", Text=%s", debugstr_w(mp->text));
MENUFLAG(MF_USECHECKBITMAPS, "usebit"); if (mp->dwItemData)
MENUFLAG(MF_MOUSESELECT, "mouse"); TRACE( ", ItemData=0x%08lx", mp->dwItemData);
if (flags) if (mp->hbmpItem)
TRACE( "+0x%x", flags); {
} if( IS_MAGIC_BITMAP(mp->hbmpItem))
if (mp->hCheckBit) TRACE( ", hbitmap=%s", hbmmenus[ (INT_PTR)mp->hbmpItem + 1]);
TRACE( ", Chk=%p", mp->hCheckBit); else
if (mp->hUnCheckBit) TRACE( ", hbitmap=%p", mp->hbmpItem);
TRACE( ", Unc=%p", mp->hUnCheckBit); }
TRACE( " }");
if (type == MFT_STRING) { } else
if (mp->text) TRACE( "NULL");
TRACE( ", Text=%s", debugstr_w(mp->text));
else
TRACE( ", Text=Null");
} else if (mp->text == NULL)
/* Nothing */ ;
else
TRACE( ", Text=%p", mp->text);
if (mp->dwItemData)
TRACE( ", ItemData=0x%08lx", mp->dwItemData);
TRACE( " }");
} else {
TRACE( "NULL");
}
TRACE(" %s\n", postfix); TRACE(" %s\n", postfix);
} }
@ -965,7 +955,7 @@ static void MENU_CalcItemSize( HDC hdc, MENUITEM *lpitem, HWND hwndOwner,
- arrow_bitmap_width; - arrow_bitmap_width;
} }
} }
TRACE("(%ld,%ld)-(%ld,%ld)\n", lpitem->rect.left, lpitem->rect.top, lpitem->rect.right, lpitem->rect.bottom); TRACE("%s\n", wine_dbgstr_rect( &lpitem->rect));
} }
@ -1059,8 +1049,7 @@ static void MENU_MenuBarCalcSize( HDC hdc, LPRECT lprect,
if ((lprect == NULL) || (lppop == NULL)) return; if ((lprect == NULL) || (lppop == NULL)) return;
if (lppop->nItems == 0) return; if (lppop->nItems == 0) return;
TRACE("left=%ld top=%ld right=%ld bottom=%ld\n", TRACE("lprect %p %s\n", lprect, wine_dbgstr_rect( lprect));
lprect->left, lprect->top, lprect->right, lprect->bottom);
lppop->Width = lprect->right - lprect->left; lppop->Width = lprect->right - lprect->left;
lppop->Height = 0; lppop->Height = 0;
maxY = lprect->top+1; maxY = lprect->top+1;
@ -1081,8 +1070,7 @@ static void MENU_MenuBarCalcSize( HDC hdc, LPRECT lprect,
if ((i != start) && if ((i != start) &&
(lpitem->fType & (MF_MENUBREAK | MF_MENUBARBREAK))) break; (lpitem->fType & (MF_MENUBREAK | MF_MENUBARBREAK))) break;
TRACE("calling MENU_CalcItemSize org=(%d, %d)\n", TRACE("calling MENU_CalcItemSize org=(%d, %d)\n", orgX, orgY );
orgX, orgY );
debug_print_menuitem (" item: ", lpitem, ""); debug_print_menuitem (" item: ", lpitem, "");
MENU_CalcItemSize( hdc, lpitem, hwndOwner, orgX, orgY, TRUE, lppop ); MENU_CalcItemSize( hdc, lpitem, hwndOwner, orgX, orgY, TRUE, lppop );
@ -1192,16 +1180,14 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
dis.hDC = hdc; dis.hDC = hdc;
dis.rcItem = lpitem->rect; dis.rcItem = lpitem->rect;
TRACE("Ownerdraw: owner=%p itemID=%d, itemState=%d, itemAction=%d, " TRACE("Ownerdraw: owner=%p itemID=%d, itemState=%d, itemAction=%d, "
"hwndItem=%p, hdc=%p, rcItem={%ld,%ld,%ld,%ld}\n", hwndOwner, "hwndItem=%p, hdc=%p, rcItem=%s\n", hwndOwner,
dis.itemID, dis.itemState, dis.itemAction, dis.hwndItem, dis.itemID, dis.itemState, dis.itemAction, dis.hwndItem,
dis.hDC, dis.rcItem.left, dis.rcItem.top, dis.rcItem.right, dis.hDC, wine_dbgstr_rect( &dis.rcItem));
dis.rcItem.bottom);
SendMessageW( hwndOwner, WM_DRAWITEM, 0, (LPARAM)&dis ); SendMessageW( hwndOwner, WM_DRAWITEM, 0, (LPARAM)&dis );
/* Fall through to draw popup-menu arrow */ /* Fall through to draw popup-menu arrow */
} }
TRACE("rect={%ld,%ld,%ld,%ld}\n", lpitem->rect.left, lpitem->rect.top, TRACE("rect=%s\n", wine_dbgstr_rect( &lpitem->rect));
lpitem->rect.right,lpitem->rect.bottom);
if (menuBar && (lpitem->fType & MF_SEPARATOR)) return; if (menuBar && (lpitem->fType & MF_SEPARATOR)) return;
@ -2656,9 +2642,8 @@ static BOOL MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
mt.pt.x = x; mt.pt.x = x;
mt.pt.y = y; mt.pt.y = y;
TRACE("hmenu=%p flags=0x%08x (%d,%d) hwnd=%p (%ld,%ld)-(%ld,%ld)\n", TRACE("hmenu=%p flags=0x%08x (%d,%d) hwnd=%p %s\n",
hmenu, wFlags, x, y, hwnd, (lprect) ? lprect->left : 0, (lprect) ? lprect->top : 0, hmenu, wFlags, x, y, hwnd, wine_dbgstr_rect( lprect));
(lprect) ? lprect->right : 0, (lprect) ? lprect->bottom : 0);
fEndMenu = FALSE; fEndMenu = FALSE;
if (!(menu = MENU_GetMenu( hmenu ))) if (!(menu = MENU_GetMenu( hmenu )))
@ -2989,7 +2974,7 @@ void MENU_TrackMouseMenuBar( HWND hWnd, INT ht, POINT pt )
HMENU hMenu = (ht == HTSYSMENU) ? get_win_sys_menu( hWnd ) : GetMenu( hWnd ); HMENU hMenu = (ht == HTSYSMENU) ? get_win_sys_menu( hWnd ) : GetMenu( hWnd );
UINT wFlags = TPM_ENTERIDLEEX | TPM_BUTTONDOWN | TPM_LEFTALIGN | TPM_LEFTBUTTON; UINT wFlags = TPM_ENTERIDLEEX | TPM_BUTTONDOWN | TPM_LEFTALIGN | TPM_LEFTBUTTON;
TRACE("wnd=%p ht=0x%04x (%ld,%ld)\n", hWnd, ht, pt.x, pt.y); TRACE("wnd=%p ht=0x%04x %s\n", hWnd, ht, wine_dbgstr_point( &pt));
if (IsMenu(hMenu)) if (IsMenu(hMenu))
{ {
@ -3543,13 +3528,9 @@ BOOL WINAPI ModifyMenuW( HMENU hMenu, UINT pos, UINT flags,
MENUITEM *item; MENUITEM *item;
if (IS_STRING_ITEM(flags)) if (IS_STRING_ITEM(flags))
{
TRACE("%p %d %04x %04x %s\n", hMenu, pos, flags, id, debugstr_w(str) ); TRACE("%p %d %04x %04x %s\n", hMenu, pos, flags, id, debugstr_w(str) );
}
else else
{
TRACE("%p %d %04x %04x %p\n", hMenu, pos, flags, id, str ); TRACE("%p %d %04x %04x %p\n", hMenu, pos, flags, id, str );
}
if (!(item = MENU_FindItem( &hMenu, &pos, flags ))) return FALSE; if (!(item = MENU_FindItem( &hMenu, &pos, flags ))) return FALSE;
MENU_GetMenu(hMenu)->Height = 0; /* force size recalculate */ MENU_GetMenu(hMenu)->Height = 0; /* force size recalculate */