MCPcopy Create free account
hub / github.com/bumptop/BumpTop / Key_CopySelection

Function Key_CopySelection

trunk/win/Source/BT_Util.cpp:6141–6208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6139}
6140
6141void Key_CopySelection()
6142{
6143 // XXX: TODO TAKE CARE OF HARD PILES
6144
6145 LOG_LINE_REACHED();
6146
6147 IShellFolder * desktopFolder = NULL;
6148 IShellFolder2 * psf = NULL;
6149 IShellView * psv = NULL;
6150
6151 // get the shell folder
6152 if (SUCCEEDED(SHGetDesktopFolder(&desktopFolder)))
6153 {
6154 {
6155 // create a list of all the items to be copied
6156 vector<BumpObject *> selection = sel->getBumpObjects();
6157 StrList filePaths = GetFilteredSetForIDataObject(selection, &psf);
6158 if (filePaths.empty())
6159 return;
6160
6161 // reselect the proper selection
6162 QList<BumpObject *> newSelection;
6163 for (int i = 0; i < selection.size(); ++i)
6164 {
6165 selection[i]->setAlphaAnim(selection[i]->getAlpha(), 1.0f, 10);
6166 selection[i]->setFreshnessAlphaAnim(1.0f, 20);
6167 newSelection.append(selection[i]);
6168 }
6169 sel->replace(newSelection);
6170
6171 // build the set of pidls that are to be acted upon
6172 uint numPidls = filePaths.size();
6173 LPCITEMIDLIST * pidlArray = new LPCITEMIDLIST[numPidls];
6174 for (int i = 0; i < numPidls; ++i)
6175 {
6176 pidlArray[i] = winOS->GetRelativePidlFromAbsFilePath(filePaths[i]);
6177 }
6178
6179 // get the IDataObject representing these files
6180 IDataObject * pdo = NULL;
6181 HRESULT hr = psf->GetUIObjectOf(NULL, numPidls, pidlArray, IID_IDataObject, NULL, (void **) &pdo);
6182
6183 // set this data object to be a copy
6184 FORMATETC typeFmt = {RegisterClipboardFormat(CFSTR_PREFERREDDROPEFFECT), NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
6185 STGMEDIUM typeStgm = {0};
6186 typeStgm.tymed = TYMED_HGLOBAL;
6187 typeStgm.hGlobal = GlobalAlloc(GMEM_SHARE | GMEM_MOVEABLE, sizeof(DWORD));
6188 *((DWORD*)GlobalLock(typeStgm.hGlobal)) = DROPEFFECT_COPY;
6189 GlobalUnlock(typeStgm.hGlobal);
6190 pdo->SetData(&typeFmt, &typeStgm, TRUE);
6191
6192 // set the clipboard with these files
6193 OleSetClipboard(pdo);
6194
6195 psf->Release();
6196
6197 // display notification
6198 MessageClearPolicy clearPolicy;

Callers

nothing calls this directly

Calls 15

getAlphaMethod · 0.80
setFreshnessAlphaAnimMethod · 0.80
addMessageMethod · 0.80
messagesMethod · 0.80
QStringFunction · 0.50
getBumpObjectsMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
setAlphaAnimMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected