Changeset 4032 for trunk/src/shell32/shv_bg_cmenu.cpp
- Timestamp:
- Aug 18, 2000, 4:01:27 AM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/shell32/shv_bg_cmenu.cpp
r3243 r4032 1 /* $Id: shv_bg_cmenu.cpp,v 1. 3 2000-03-26 16:34:56 cbratschiExp $ */1 /* $Id: shv_bg_cmenu.cpp,v 1.4 2000-08-18 02:01:27 phaller Exp $ */ 2 2 3 3 /* … … 31 31 32 32 #include "pidl.h" 33 #include "shlguid.h" 33 34 #include "wine/obj_base.h" 34 35 #include "wine/obj_contextmenu.h" 35 36 #include "wine/obj_shellbrowser.h" 36 #include "wine/obj_shellextinit.h"37 37 38 38 #include "shell32_main.h" 39 #include "shellfolder.h" 40 #include "shell.h" 41 #include "wine/undocshell.h" 39 42 40 43 #include <misc.h> … … 48 51 typedef struct 49 52 { ICOM_VTABLE(IContextMenu)* lpvtbl; 53 IShellFolder* pSFParent; 50 54 DWORD ref; 51 55 } BgCmImpl; … … 119 123 This)); 120 124 121 shell32_ObjCount--;122 123 125 if (!--(This->ref)) 124 { TRACE(" destroying IContextMenu(%p)\n",This); 125 126 { 127 TRACE(" destroying IContextMenu(%p)\n",This); 128 129 if(This->pSFParent) 130 IShellFolder_Release(This->pSFParent); 131 126 132 HeapFree(GetProcessHeap(),0,This); 127 133 return 0; 128 134 } 135 136 shell32_ObjCount--; 137 129 138 return This->ref; 130 139 } … … 165 174 166 175 /************************************************************************** 176 * DoNewFolder 177 */ 178 static void DoNewFolder( 179 IContextMenu *iface, 180 IShellView *psv) 181 { 182 ICOM_THIS(BgCmImpl, iface); 183 ISFHelper * psfhlp; 184 char szName[MAX_PATH]; 185 186 IShellFolder_QueryInterface(This->pSFParent, &IID_ISFHelper, (LPVOID*)&psfhlp); 187 if (psfhlp) 188 { 189 LPITEMIDLIST pidl; 190 ISFHelper_GetUniqueName(psfhlp, szName, MAX_PATH); 191 ISFHelper_AddFolder(psfhlp, 0, szName, &pidl); 192 193 if(psv) 194 { 195 /* if we are in a shellview do labeledit */ 196 IShellView_SelectItem(psv, 197 pidl,(SVSI_DESELECTOTHERS | SVSI_EDIT | SVSI_ENSUREVISIBLE 198 |SVSI_FOCUSED|SVSI_SELECT)); 199 } 200 SHFree(pidl); 201 202 ISFHelper_Release(psfhlp); 203 } 204 } 205 206 /************************************************************************** 207 * DoPaste 208 */ 209 static BOOL DoPaste( 210 IContextMenu *iface) 211 { 212 ICOM_THIS(BgCmImpl, iface); 213 BOOL bSuccess = FALSE; 214 IDataObject * pda; 215 216 TRACE("\n"); 217 218 if(SUCCEEDED(pOleGetClipboard(&pda))); 219 { 220 STGMEDIUM medium; 221 FORMATETC formatetc; 222 223 TRACE("pda=%p\n", pda); 224 225 /* Set the FORMATETC structure*/ 226 InitFormatEtc(formatetc, RegisterClipboardFormatA(CFSTR_SHELLIDLIST), TYMED_HGLOBAL); 227 228 /* Get the pidls from IDataObject */ 229 if(SUCCEEDED(IDataObject_GetData(pda,&formatetc,&medium))) 230 { 231 LPITEMIDLIST * apidl; 232 LPITEMIDLIST pidl; 233 IShellFolder *psfFrom = NULL, *psfDesktop; 234 235 LPCIDA lpcida = (LPCIDA)GlobalLock(medium.u.hGlobal); 236 TRACE("cida=%p\n", lpcida); 237 238 apidl = _ILCopyCidaToaPidl(&pidl, lpcida); 239 240 /* bind to the source shellfolder */ 241 SHGetDesktopFolder(&psfDesktop); 242 if(psfDesktop) 243 { 244 IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (LPVOID*)&psfFrom); 245 IShellFolder_Release(psfDesktop); 246 } 247 248 if (psfFrom) 249 { 250 /* get source and destination shellfolder */ 251 ISFHelper *psfhlpdst, *psfhlpsrc; 252 IShellFolder_QueryInterface(This->pSFParent, &IID_ISFHelper, (LPVOID*)&psfhlpdst); 253 IShellFolder_QueryInterface(psfFrom, &IID_ISFHelper, (LPVOID*)&psfhlpsrc); 254 255 /* do the copy/move */ 256 if (psfhlpdst && psfhlpsrc) 257 { 258 ISFHelper_CopyItems(psfhlpdst, psfFrom, lpcida->cidl, apidl); 259 /* fixme handle move 260 ISFHelper_DeleteItems(psfhlpsrc, lpcida->cidl, apidl); 261 */ 262 } 263 if(psfhlpdst) ISFHelper_Release(psfhlpdst); 264 if(psfhlpsrc) ISFHelper_Release(psfhlpsrc); 265 IShellFolder_Release(psfFrom); 266 } 267 268 _ILFreeaPidl(apidl, lpcida->cidl); 269 SHFree(pidl); 270 271 /* release the medium*/ 272 pReleaseStgMedium(&medium); 273 } 274 IDataObject_Release(pda); 275 } 276 #if 0 277 HGLOBAL hMem; 278 279 OpenClipboard(NULL); 280 hMem = GetClipboardData(CF_HDROP); 281 282 if(hMem) 283 { 284 char * pDropFiles = (char *)GlobalLock(hMem); 285 if(pDropFiles) 286 { 287 int len, offset = sizeof(DROPFILESTRUCT); 288 289 while( pDropFiles[offset] != 0) 290 { 291 len = strlen(pDropFiles + offset); 292 TRACE("%s\n", pDropFiles + offset); 293 offset += len+1; 294 } 295 } 296 GlobalUnlock(hMem); 297 } 298 CloseClipboard(); 299 #endif 300 return bSuccess; 301 } 302 303 304 /************************************************************************** 167 305 * ISVBgCm_fnInvokeCommand() 168 306 */ … … 184 322 185 323 /* get the active IShellView */ 186 lpSB = (LPSHELLBROWSER)SendMessageA(lpcmi->hwnd, CWM_GETISHELLBROWSER,0,0); 187 IShellBrowser_QueryActiveShellView(lpSB, &lpSV); 188 IShellView_GetWindow(lpSV, &hWndSV); 189 190 if(HIWORD(lpcmi->lpVerb)) 191 { 192 TRACE("%s\n",lpcmi->lpVerb); 193 194 if (! strcmp(lpcmi->lpVerb,CMDSTR_NEWFOLDERA)) 195 { 196 FIXME("%s not implemented\n",lpcmi->lpVerb); 197 } 198 else if (! strcmp(lpcmi->lpVerb,CMDSTR_VIEWLISTA)) 199 { 200 SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_LISTVIEW,0),0 ); 201 } 202 else if (! strcmp(lpcmi->lpVerb,CMDSTR_VIEWDETAILSA)) 203 { 204 SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_REPORTVIEW,0),0 ); 205 } 206 else 207 { 208 FIXME("please report: unknown verb %s\n",lpcmi->lpVerb); 209 } 210 } 211 else 212 { 213 /* if it's a id just pass it to the parent shv */ 214 SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(LOWORD(lpcmi->lpVerb), 0),0 ); 215 } 216 217 IShellView_Release(lpSV); /* QueryActiveShellView does AddRef*/ 218 return NOERROR; 324 if((lpSB = (LPSHELLBROWSER)SendMessageA(lpcmi->hwnd, CWM_GETISHELLBROWSER,0,0))) 325 { 326 if(SUCCEEDED(IShellBrowser_QueryActiveShellView(lpSB, &lpSV))) 327 { 328 IShellView_GetWindow(lpSV, &hWndSV); 329 } 330 } 331 332 if(lpSV) 333 { 334 if(HIWORD(lpcmi->lpVerb)) 335 { 336 TRACE("%s\n",lpcmi->lpVerb); 337 338 if (! strcmp(lpcmi->lpVerb,CMDSTR_NEWFOLDERA)) 339 { 340 DoNewFolder(iface, lpSV); 341 } 342 else if (! strcmp(lpcmi->lpVerb,CMDSTR_VIEWLISTA)) 343 { 344 if(hWndSV) SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_LISTVIEW,0),0 ); 345 } 346 else if (! strcmp(lpcmi->lpVerb,CMDSTR_VIEWDETAILSA)) 347 { 348 if(hWndSV) SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_REPORTVIEW,0),0 ); 349 } 350 else 351 { 352 FIXME("please report: unknown verb %s\n",lpcmi->lpVerb); 353 } 354 } 355 else 356 { 357 switch(LOWORD(lpcmi->lpVerb)) 358 { 359 case FCIDM_SHVIEW_NEWFOLDER: 360 DoNewFolder(iface, lpSV); 361 break; 362 case FCIDM_SHVIEW_INSERT: 363 DoPaste(iface); 364 break; 365 default: 366 /* if it's a id just pass it to the parent shv */ 367 SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(LOWORD(lpcmi->lpVerb), 0),0 ); 368 break; 369 } 370 } 371 372 IShellView_Release(lpSV); /* QueryActiveShellView does AddRef*/ 373 } 374 return NOERROR; 219 375 } 220 376 … … 300 456 * ISVBgCm_Constructor() 301 457 */ 302 IContextMenu *ISvBgCm_Constructor( void)458 IContextMenu *ISvBgCm_Constructor(IShellFolder* pSFParent) 303 459 { 304 460 BgCmImpl* cm; … … 307 463 cm->lpvtbl=&cmvt; 308 464 cm->ref = 1; 465 cm->pSFParent = pSFParent; 309 466 310 467 dprintf(("SHELL32:shv_bg_cmenu: ISVBgCm_Constructor(%p)\n",
Note:
See TracChangeset
for help on using the changeset viewer.