dlls/shell32/shv_item_cmenu.c

Ge van Geldorp gvg at reactos.com
Mon Sep 20 08:55:37 CDT 2004


Changelog:
  Martin Fuchs <martin-fuchs at gmx.net>
  correct setting of default menu item in shell context menus

Index: dlls/shell32/shv_item_cmenu.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shv_item_cmenu.c,v
retrieving revision 1.25
diff -u -r1.25 shv_item_cmenu.c
--- dlls/shell32/shv_item_cmenu.c	9 Sep 2004 20:17:07 -0000	1.25
+++ dlls/shell32/shv_item_cmenu.c	20 Sep 2004 13:50:12 -0000
@@ -204,10 +204,12 @@
 	mii.fType = fType;
 	InsertMenuItemA( hmenu, indexMenu, fByPosition, &mii);
 }
+
 /**************************************************************************
 * ISvItemCm_fnQueryContextMenu()
+* FIXME: load menu MENU_SHV_FILE out of resources instead if creating
+*		 each menu item by calling _InsertMenuItem()
 */
-
 static HRESULT WINAPI ISvItemCm_fnQueryContextMenu(
 	IContextMenu2 *iface,
 	HMENU hmenu,
@@ -220,25 +222,27 @@
 
 	TRACE("(%p)->(hmenu=%p indexmenu=%x cmdfirst=%x cmdlast=%x flags=%x )\n",This, hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
 
-	if(!(CMF_DEFAULTONLY & uFlags))
+	if (idCmdFirst != 0)
+	  FIXME("We should use idCmdFirst=%d and idCmdLast=%d for command ids\n", idCmdFirst, idCmdLast);
+
+	if(!(CMF_DEFAULTONLY & uFlags) && This->cidl>0)
 	{
-	  if(uFlags & CMF_EXPLORE)
+	  if(!(uFlags & CMF_EXPLORE))
+	    _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING, "&Select", MFS_ENABLED);
+
+	  if(This->bAllValues)
 	  {
-	    if(This->bAllValues)
-	    {
-	      _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING, "&Open", MFS_ENABLED);
-	      _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_EXPLORE, MFT_STRING, "&Explore", MFS_ENABLED|MFS_DEFAULT);
-	    }
-	    else
-	    {
-	      _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_EXPLORE, MFT_STRING, "&Explore", MFS_ENABLED|MFS_DEFAULT);
-	      _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING, "&Open", MFS_ENABLED);
-	    }
+	    _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING, "&Open", MFS_ENABLED);
+	    _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_EXPLORE, MFT_STRING, "&Explore", MFS_ENABLED);
 	  }
 	  else
 	  {
-	    _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING, "&Select", MFS_ENABLED|MFS_DEFAULT);
+	    _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_EXPLORE, MFT_STRING, "&Explore", MFS_ENABLED);
+	    _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING, "&Open", MFS_ENABLED);
 	  }
+
+	  SetMenuDefaultItem(hmenu, 0, MF_BYPOSITION);
+
 	  _InsertMenuItem(hmenu, indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0);
 	  _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_COPY, MFT_STRING, "&Copy", MFS_ENABLED);
 	  _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_CUT, MFT_STRING, "&Cut", MFS_ENABLED);



More information about the wine-patches mailing list