Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
beb89fd1
Commit
beb89fd1
authored
Jan 08, 2012
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jan 09, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Store common menu data in a separate structure.
parent
b1f04e23
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
52 deletions
+54
-52
shv_bg_cmenu.c
dlls/shell32/shv_bg_cmenu.c
+4
-3
shv_item_cmenu.c
dlls/shell32/shv_item_cmenu.c
+50
-49
No files found.
dlls/shell32/shv_bg_cmenu.c
View file @
beb89fd1
...
...
@@ -430,7 +430,7 @@ static HRESULT WINAPI ISVBgCm_fnHandleMenuMsg(
* IContextMenu2 VTable
*
*/
static
const
IContextMenu2Vtbl
cmvt
=
static
const
IContextMenu2Vtbl
BackgroundContextMenuVtbl
=
{
ISVBgCm_fnQueryInterface
,
ISVBgCm_fnAddRef
,
...
...
@@ -445,11 +445,12 @@ IContextMenu2 *ISvBgCm_Constructor(IShellFolder *pSFParent, BOOL bDesktop)
{
BgCmImpl
*
cm
;
cm
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
cm
));
cm
->
IContextMenu2_iface
.
lpVtbl
=
&
cmvt
;
cm
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
cm
));
cm
->
IContextMenu2_iface
.
lpVtbl
=
&
BackgroundContextMenuVtbl
;
cm
->
ref
=
1
;
cm
->
pSFParent
=
pSFParent
;
cm
->
bDesktop
=
bDesktop
;
cm
->
verb_offset
=
0
;
if
(
pSFParent
)
IShellFolder_AddRef
(
pSFParent
);
TRACE
(
"(%p)->()
\n
"
,
cm
);
...
...
dlls/shell32/shv_item_cmenu.c
View file @
beb89fd1
...
...
@@ -42,29 +42,33 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
shell
);
typedef
struct
{
IContextMenu2
IContextMenu2_iface
;
LONG
ref
;
IShellFolder
*
parent
;
UINT
verb_offset
;
}
ContextMenu
;
/**************************************************************************
* IContextMenu Implementation
*/
typedef
struct
{
IContextMenu2
IContextMenu2_iface
;
LONG
ref
;
IShellFolder
*
pSFParent
;
ContextMenu
menu
;
LPITEMIDLIST
pidl
;
/* root pidl */
LPITEMIDLIST
*
apidl
;
/* array of child pidls */
UINT
cidl
;
BOOL
bAllValues
;
UINT
verb_offset
;
}
ItemCmImpl
;
static
inline
ItemCmImpl
*
impl_from_IContextMenu2
(
IContextMenu2
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
ItemCmImpl
,
IContextMenu2_iface
);
return
CONTAINING_RECORD
(
iface
,
ItemCmImpl
,
menu
.
IContextMenu2_iface
);
}
static
const
IContextMenu2Vtbl
cmvt
;
/**************************************************************************
* ISvItemCm_CanRenameItems()
*/
...
...
@@ -79,42 +83,13 @@ static BOOL ISvItemCm_CanRenameItems(ItemCmImpl *This)
for
(
i
=
0
;
i
<
This
->
cidl
;
i
++
){}
if
(
i
>
1
)
return
FALSE
;
/* can't rename more than one item at a time*/
dwAttributes
=
SFGAO_CANRENAME
;
IShellFolder_GetAttributesOf
(
This
->
pSFP
arent
,
1
,
(
LPCITEMIDLIST
*
)
This
->
apidl
,
&
dwAttributes
);
IShellFolder_GetAttributesOf
(
This
->
menu
.
p
arent
,
1
,
(
LPCITEMIDLIST
*
)
This
->
apidl
,
&
dwAttributes
);
return
dwAttributes
&
SFGAO_CANRENAME
;
}
return
FALSE
;
}
/**************************************************************************
* ISvItemCm_Constructor()
*/
IContextMenu2
*
ISvItemCm_Constructor
(
LPSHELLFOLDER
pSFParent
,
LPCITEMIDLIST
pidl
,
const
LPCITEMIDLIST
*
apidl
,
UINT
cidl
)
{
ItemCmImpl
*
cm
;
UINT
u
;
cm
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
ItemCmImpl
));
cm
->
IContextMenu2_iface
.
lpVtbl
=
&
cmvt
;
cm
->
ref
=
1
;
cm
->
pidl
=
ILClone
(
pidl
);
cm
->
pSFParent
=
pSFParent
;
if
(
pSFParent
)
IShellFolder_AddRef
(
pSFParent
);
cm
->
apidl
=
_ILCopyaPidl
(
apidl
,
cidl
);
cm
->
cidl
=
cidl
;
cm
->
bAllValues
=
1
;
for
(
u
=
0
;
u
<
cidl
;
u
++
)
{
cm
->
bAllValues
&=
(
_ILIsValue
(
apidl
[
u
])
?
1
:
0
);
}
TRACE
(
"(%p)->()
\n
"
,
cm
);
return
&
cm
->
IContextMenu2_iface
;
}
/**************************************************************************
* ISvItemCm_fnQueryInterface
*/
static
HRESULT
WINAPI
ISvItemCm_fnQueryInterface
(
IContextMenu2
*
iface
,
REFIID
riid
,
LPVOID
*
ppvObj
)
...
...
@@ -152,7 +127,7 @@ static HRESULT WINAPI ISvItemCm_fnQueryInterface(IContextMenu2 *iface, REFIID ri
static
ULONG
WINAPI
ISvItemCm_fnAddRef
(
IContextMenu2
*
iface
)
{
ItemCmImpl
*
This
=
impl_from_IContextMenu2
(
iface
);
ULONG
refCount
=
InterlockedIncrement
(
&
This
->
ref
);
ULONG
refCount
=
InterlockedIncrement
(
&
This
->
menu
.
ref
);
TRACE
(
"(%p)->(count=%u)
\n
"
,
This
,
refCount
-
1
);
...
...
@@ -165,7 +140,7 @@ static ULONG WINAPI ISvItemCm_fnAddRef(IContextMenu2 *iface)
static
ULONG
WINAPI
ISvItemCm_fnRelease
(
IContextMenu2
*
iface
)
{
ItemCmImpl
*
This
=
impl_from_IContextMenu2
(
iface
);
ULONG
refCount
=
InterlockedDecrement
(
&
This
->
ref
);
ULONG
refCount
=
InterlockedDecrement
(
&
This
->
menu
.
ref
);
TRACE
(
"(%p)->(count=%i)
\n
"
,
This
,
refCount
+
1
);
...
...
@@ -173,8 +148,8 @@ static ULONG WINAPI ISvItemCm_fnRelease(IContextMenu2 *iface)
{
TRACE
(
" destroying IContextMenu(%p)
\n
"
,
This
);
if
(
This
->
pSFP
arent
)
IShellFolder_Release
(
This
->
pSFP
arent
);
if
(
This
->
menu
.
p
arent
)
IShellFolder_Release
(
This
->
menu
.
p
arent
);
SHFree
(
This
->
pidl
);
...
...
@@ -229,7 +204,7 @@ static HRESULT WINAPI ISvItemCm_fnQueryContextMenu(
TRACE
(
"(%p)->(hmenu=%p indexmenu=%x cmdfirst=%x cmdlast=%x flags=%x )
\n
"
,
This
,
hmenu
,
indexMenu
,
idCmdFirst
,
idCmdLast
,
uFlags
);
This
->
verb_offset
=
idCmdFirst
;
This
->
menu
.
verb_offset
=
idCmdFirst
;
if
(
!
(
CMF_DEFAULTONLY
&
uFlags
)
&&
This
->
cidl
>
0
)
{
...
...
@@ -339,7 +314,7 @@ static void DoDelete(ItemCmImpl *This)
{
ISFHelper
*
psfhlp
;
IShellFolder_QueryInterface
(
This
->
pSFP
arent
,
&
IID_ISFHelper
,
(
LPVOID
*
)
&
psfhlp
);
IShellFolder_QueryInterface
(
This
->
menu
.
p
arent
,
&
IID_ISFHelper
,
(
LPVOID
*
)
&
psfhlp
);
if
(
psfhlp
)
{
ISFHelper_DeleteItems
(
psfhlp
,
This
->
cidl
,
(
LPCITEMIDLIST
*
)
This
->
apidl
);
...
...
@@ -516,7 +491,7 @@ static HRESULT WINAPI ISvItemCm_fnInvokeCommand(
if
(
HIWORD
(
lpcmi
->
lpVerb
)
==
0
)
{
switch
(
LOWORD
(
lpcmi
->
lpVerb
-
This
->
verb_offset
))
switch
(
LOWORD
(
lpcmi
->
lpVerb
-
This
->
menu
.
verb_offset
))
{
case
FCIDM_SHVIEW_EXPLORE
:
TRACE
(
"Verb FCIDM_SHVIEW_EXPLORE
\n
"
);
...
...
@@ -547,7 +522,7 @@ static HRESULT WINAPI ISvItemCm_fnInvokeCommand(
DoOpenProperties
(
This
,
lpcmi
->
hwnd
);
break
;
default:
FIXME
(
"Unhandled Verb %xl
\n
"
,
LOWORD
(
lpcmi
->
lpVerb
)
-
This
->
verb_offset
);
FIXME
(
"Unhandled Verb %xl
\n
"
,
LOWORD
(
lpcmi
->
lpVerb
)
-
This
->
menu
.
verb_offset
);
return
E_INVALIDARG
;
}
}
...
...
@@ -591,7 +566,7 @@ static HRESULT WINAPI ISvItemCm_fnGetCommandString(
break
;
case
GCS_VERBA
:
switch
(
idCommand
-
This
->
verb_offset
)
switch
(
idCommand
-
This
->
menu
.
verb_offset
)
{
case
FCIDM_SHVIEW_RENAME
:
strcpy
(
lpszName
,
"rename"
);
...
...
@@ -603,7 +578,7 @@ static HRESULT WINAPI ISvItemCm_fnGetCommandString(
/* NT 4.0 with IE 3.0x or no IE will always call This with GCS_VERBW. In This
case, you need to do the lstrcpyW to the pointer passed.*/
case
GCS_VERBW
:
switch
(
idCommand
-
This
->
verb_offset
)
switch
(
idCommand
-
This
->
menu
.
verb_offset
)
{
case
FCIDM_SHVIEW_RENAME
:
MultiByteToWideChar
(
CP_ACP
,
0
,
"rename"
,
-
1
,
(
LPWSTR
)
lpszName
,
uMaxNameLen
);
...
...
@@ -640,7 +615,7 @@ static HRESULT WINAPI ISvItemCm_fnHandleMenuMsg(
return
E_NOTIMPL
;
}
static
const
IContextMenu2Vtbl
cmvt
=
static
const
IContextMenu2Vtbl
ItemContextMenuVtbl
=
{
ISvItemCm_fnQueryInterface
,
ISvItemCm_fnAddRef
,
...
...
@@ -650,3 +625,29 @@ static const IContextMenu2Vtbl cmvt =
ISvItemCm_fnGetCommandString
,
ISvItemCm_fnHandleMenuMsg
};
IContextMenu2
*
ISvItemCm_Constructor
(
IShellFolder
*
parent
,
LPCITEMIDLIST
pidl
,
const
LPCITEMIDLIST
*
apidl
,
UINT
cidl
)
{
ItemCmImpl
*
cm
;
UINT
u
;
cm
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
ItemCmImpl
));
cm
->
menu
.
IContextMenu2_iface
.
lpVtbl
=
&
ItemContextMenuVtbl
;
cm
->
menu
.
ref
=
1
;
cm
->
menu
.
verb_offset
=
0
;
cm
->
menu
.
parent
=
parent
;
cm
->
pidl
=
ILClone
(
pidl
);
if
(
parent
)
IShellFolder_AddRef
(
parent
);
cm
->
apidl
=
_ILCopyaPidl
(
apidl
,
cidl
);
cm
->
cidl
=
cidl
;
cm
->
bAllValues
=
1
;
for
(
u
=
0
;
u
<
cidl
;
u
++
)
cm
->
bAllValues
&=
(
_ILIsValue
(
apidl
[
u
])
?
1
:
0
);
TRACE
(
"(%p)
\n
"
,
cm
);
return
&
cm
->
menu
.
IContextMenu2_iface
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment