mirror of
https://github.com/reactos/reactos.git
synced 2025-07-04 08:51:22 +00:00
- Merge Wine-1.1.39 changes to shlmenu.c.
svn path=/trunk/; revision=45687
This commit is contained in:
parent
aaaa6b759a
commit
1aed20b05d
1 changed files with 19 additions and 26 deletions
|
@ -116,7 +116,7 @@ static LPFMINFO FM_SetMenuParameter(
|
||||||
static int FM_InitMenuPopup(HMENU hmenu, LPCITEMIDLIST pAlternatePidl)
|
static int FM_InitMenuPopup(HMENU hmenu, LPCITEMIDLIST pAlternatePidl)
|
||||||
{ IShellFolder *lpsf, *lpsf2;
|
{ IShellFolder *lpsf, *lpsf2;
|
||||||
ULONG ulItemAttr = SFGAO_FOLDER;
|
ULONG ulItemAttr = SFGAO_FOLDER;
|
||||||
UINT uID, uFlags, uEnumFlags;
|
UINT uID, uEnumFlags;
|
||||||
LPFNFMCALLBACK lpfnCallback;
|
LPFNFMCALLBACK lpfnCallback;
|
||||||
LPCITEMIDLIST pidl;
|
LPCITEMIDLIST pidl;
|
||||||
WCHAR sTemp[MAX_PATH];
|
WCHAR sTemp[MAX_PATH];
|
||||||
|
@ -148,7 +148,6 @@ static int FM_InitMenuPopup(HMENU hmenu, LPCITEMIDLIST pAlternatePidl)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
uID = menudata->uID;
|
uID = menudata->uID;
|
||||||
uFlags = menudata->uFlags;
|
|
||||||
uEnumFlags = menudata->uEnumFlags;
|
uEnumFlags = menudata->uEnumFlags;
|
||||||
lpfnCallback = menudata->lpfnCallback;
|
lpfnCallback = menudata->lpfnCallback;
|
||||||
menudata->bInitialized = FALSE;
|
menudata->bInitialized = FALSE;
|
||||||
|
@ -157,7 +156,7 @@ static int FM_InitMenuPopup(HMENU hmenu, LPCITEMIDLIST pAlternatePidl)
|
||||||
|
|
||||||
if (SUCCEEDED (SHGetDesktopFolder(&lpsf)))
|
if (SUCCEEDED (SHGetDesktopFolder(&lpsf)))
|
||||||
{
|
{
|
||||||
if (SUCCEEDED(IShellFolder_BindToObject(lpsf, pidl,0,(REFIID)&IID_IShellFolder,(LPVOID *)&lpsf2)))
|
if (SUCCEEDED(IShellFolder_BindToObject(lpsf, pidl,0,&IID_IShellFolder,(LPVOID *)&lpsf2)))
|
||||||
{
|
{
|
||||||
IEnumIDList *lpe = NULL;
|
IEnumIDList *lpe = NULL;
|
||||||
|
|
||||||
|
@ -314,9 +313,9 @@ static BOOL FileMenu_AppendItemW(
|
||||||
|
|
||||||
if (lpText != FM_SEPARATOR)
|
if (lpText != FM_SEPARATOR)
|
||||||
{
|
{
|
||||||
int len = wcslen (lpText);
|
int len = strlenW (lpText);
|
||||||
myItem = (LPFMITEM) SHAlloc( sizeof(FMITEM) + len*sizeof(WCHAR));
|
myItem = SHAlloc(sizeof(FMITEM) + len*sizeof(WCHAR));
|
||||||
wcscpy (myItem->szItemText, lpText);
|
strcpyW (myItem->szItemText, lpText);
|
||||||
myItem->cchItemText = len;
|
myItem->cchItemText = len;
|
||||||
myItem->iIconIndex = icon;
|
myItem->iIconIndex = icon;
|
||||||
myItem->hMenu = hMenu;
|
myItem->hMenu = hMenu;
|
||||||
|
@ -377,12 +376,15 @@ BOOL WINAPI FileMenu_AppendItemAW(
|
||||||
{
|
{
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
|
||||||
if ((SHELL_OsIsUnicode() && (lpText!=FM_SEPARATOR)) || (lpText == NULL))
|
if (!lpText) return FALSE;
|
||||||
|
|
||||||
|
if (SHELL_OsIsUnicode() || lpText == FM_SEPARATOR)
|
||||||
ret = FileMenu_AppendItemW(hMenu, lpText, uID, icon, hMenuPopup, nItemHeight);
|
ret = FileMenu_AppendItemW(hMenu, lpText, uID, icon, hMenuPopup, nItemHeight);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DWORD len = MultiByteToWideChar( CP_ACP, 0, lpText, -1, NULL, 0 );
|
DWORD len = MultiByteToWideChar( CP_ACP, 0, lpText, -1, NULL, 0 );
|
||||||
LPWSTR lpszText = HeapAlloc ( GetProcessHeap(), 0, len*sizeof(WCHAR) );
|
LPWSTR lpszText = HeapAlloc ( GetProcessHeap(), 0, len*sizeof(WCHAR) );
|
||||||
|
if (!lpszText) return FALSE;
|
||||||
MultiByteToWideChar( CP_ACP, 0, lpText, -1, lpszText, len );
|
MultiByteToWideChar( CP_ACP, 0, lpText, -1, lpszText, len );
|
||||||
ret = FileMenu_AppendItemW(hMenu, lpszText, uID, icon, hMenuPopup, nItemHeight);
|
ret = FileMenu_AppendItemW(hMenu, lpszText, uID, icon, hMenuPopup, nItemHeight);
|
||||||
HeapFree( GetProcessHeap(), 0, lpszText );
|
HeapFree( GetProcessHeap(), 0, lpszText );
|
||||||
|
@ -577,7 +579,7 @@ LRESULT WINAPI FileMenu_DrawItem(
|
||||||
COLORREF clrPrevText, clrPrevBkgnd;
|
COLORREF clrPrevText, clrPrevBkgnd;
|
||||||
int xi,yi,xt,yt;
|
int xi,yi,xt,yt;
|
||||||
HIMAGELIST hImageList;
|
HIMAGELIST hImageList;
|
||||||
RECT TextRect, BorderRect;
|
RECT TextRect;
|
||||||
LPFMINFO menuinfo;
|
LPFMINFO menuinfo;
|
||||||
|
|
||||||
TRACE("%p %p %s\n", hWnd, lpdis, debugstr_w(pMyItem->szItemText));
|
TRACE("%p %p %s\n", hWnd, lpdis, debugstr_w(pMyItem->szItemText));
|
||||||
|
@ -600,9 +602,6 @@ LRESULT WINAPI FileMenu_DrawItem(
|
||||||
if (menuinfo->nBorderWidth)
|
if (menuinfo->nBorderWidth)
|
||||||
TextRect.left += menuinfo->nBorderWidth;
|
TextRect.left += menuinfo->nBorderWidth;
|
||||||
|
|
||||||
BorderRect.right = menuinfo->nBorderWidth;
|
|
||||||
/* FillRect(lpdis->hDC, &BorderRect, CreateSolidBrush( menuinfo->crBorderColor));
|
|
||||||
*/
|
|
||||||
TextRect.left += FM_LEFTBORDER;
|
TextRect.left += FM_LEFTBORDER;
|
||||||
xi = TextRect.left + FM_SPACE1;
|
xi = TextRect.left + FM_SPACE1;
|
||||||
yi = TextRect.top + FM_Y_SPACE/2;
|
yi = TextRect.top + FM_Y_SPACE/2;
|
||||||
|
@ -843,8 +842,7 @@ static BOOL _SHIsMenuSeparator(HMENU hm, int i)
|
||||||
* Shell_MergeMenus [SHELL32.67]
|
* Shell_MergeMenus [SHELL32.67]
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI Shell_MergeMenus (HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags)
|
HRESULT WINAPI Shell_MergeMenus (HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags)
|
||||||
{
|
{ int nItem;
|
||||||
INT nItem;
|
|
||||||
HMENU hmSubMenu;
|
HMENU hmSubMenu;
|
||||||
BOOL bAlreadySeparated;
|
BOOL bAlreadySeparated;
|
||||||
MENUITEMINFOW miiSrc;
|
MENUITEMINFOW miiSrc;
|
||||||
|
@ -855,10 +853,11 @@ HRESULT WINAPI Shell_MergeMenus (HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uI
|
||||||
hmDst, hmSrc, uInsert, uIDAdjust, uIDAdjustMax, uFlags);
|
hmDst, hmSrc, uInsert, uIDAdjust, uIDAdjustMax, uFlags);
|
||||||
|
|
||||||
if (!hmDst || !hmSrc)
|
if (!hmDst || !hmSrc)
|
||||||
{ return uIDMax;
|
return uIDMax;
|
||||||
}
|
|
||||||
|
|
||||||
nItem = GetMenuItemCount(hmDst);
|
nItem = GetMenuItemCount(hmDst);
|
||||||
|
if (nItem == -1)
|
||||||
|
return uIDMax;
|
||||||
|
|
||||||
if (uInsert >= (UINT)nItem) /* insert position inside menu? */
|
if (uInsert >= (UINT)nItem) /* insert position inside menu? */
|
||||||
{
|
{
|
||||||
|
@ -892,7 +891,6 @@ HRESULT WINAPI Shell_MergeMenus (HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uI
|
||||||
|
|
||||||
if (!GetMenuItemInfoW(hmSrc, nItem, TRUE, &miiSrc))
|
if (!GetMenuItemInfoW(hmSrc, nItem, TRUE, &miiSrc))
|
||||||
{
|
{
|
||||||
MessageBoxW(NULL, L"GetMenuItemInfoW failed", NULL, MB_OK);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -902,10 +900,8 @@ MessageBoxW(NULL, L"GetMenuItemInfoW failed", NULL, MB_OK);
|
||||||
{
|
{
|
||||||
/* This is a separator; don't put two of them in a row */
|
/* This is a separator; don't put two of them in a row */
|
||||||
if (bAlreadySeparated)
|
if (bAlreadySeparated)
|
||||||
{
|
|
||||||
MessageBoxW(NULL, L"bAlreadySeparated failed", NULL, MB_OK);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
bAlreadySeparated = TRUE;
|
bAlreadySeparated = TRUE;
|
||||||
}
|
}
|
||||||
else if (miiSrc.hSubMenu)
|
else if (miiSrc.hSubMenu)
|
||||||
|
@ -915,9 +911,8 @@ MessageBoxW(NULL, L"bAlreadySeparated failed", NULL, MB_OK);
|
||||||
miiSrc.wID += uIDAdjust; /* add uIDAdjust to the ID */
|
miiSrc.wID += uIDAdjust; /* add uIDAdjust to the ID */
|
||||||
|
|
||||||
if (miiSrc.wID > uIDAdjustMax) /* skip ID's higher uIDAdjustMax */
|
if (miiSrc.wID > uIDAdjustMax) /* skip ID's higher uIDAdjustMax */
|
||||||
{MessageBoxW(NULL, L"uIDAdjustMax 111 failed", NULL, MB_OK);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
if (uIDMax <= miiSrc.wID) /* remember the highest ID */
|
if (uIDMax <= miiSrc.wID) /* remember the highest ID */
|
||||||
uIDMax = miiSrc.wID + 1;
|
uIDMax = miiSrc.wID + 1;
|
||||||
}
|
}
|
||||||
|
@ -942,10 +937,9 @@ MessageBoxW(NULL, L"bAlreadySeparated failed", NULL, MB_OK);
|
||||||
{
|
{
|
||||||
miiSrc.wID += uIDAdjust; /* add uIDAdjust to the ID */
|
miiSrc.wID += uIDAdjust; /* add uIDAdjust to the ID */
|
||||||
|
|
||||||
if (miiSrc.wID > uIDAdjustMax) /* skip ID's higher uIDAdjustMax */{
|
if (miiSrc.wID > uIDAdjustMax) /* skip ID's higher uIDAdjustMax */
|
||||||
MessageBoxW(NULL, L"uIDAdjustMax max 222 failed", NULL, MB_OK);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
if (uIDMax <= miiSrc.wID) /* remember the highest ID */
|
if (uIDMax <= miiSrc.wID) /* remember the highest ID */
|
||||||
uIDMax = miiSrc.wID + 1;
|
uIDMax = miiSrc.wID + 1;
|
||||||
|
|
||||||
|
@ -956,7 +950,6 @@ MessageBoxW(NULL, L"uIDAdjustMax max 222 failed", NULL, MB_OK);
|
||||||
*/
|
*/
|
||||||
if (!InsertMenuItemW(hmDst, uInsert, TRUE, &miiSrc))
|
if (!InsertMenuItemW(hmDst, uInsert, TRUE, &miiSrc))
|
||||||
{
|
{
|
||||||
MessageBoxW(NULL, L"InsertMenuItemW failed", NULL, MB_OK);
|
|
||||||
return(uIDMax);
|
return(uIDMax);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue