LRESULT CMainFrame::OnLoadClipOnClipboard(WPARAM wParam, LPARAM lParam) { CClip *pClip = (CClip*)wParam; if(pClip == NULL) { LogSendRecieveInfo("---------ERROR OnLoadClipOnClipboard pClip == NULL"); return FALSE; } if(pClip) { CProcessPaste paste; paste.m_bSendPaste = false; paste.m_bActivateTarget = false; LogSendRecieveInfo("---------OnLoadClipOnClipboard - Before PutFormats on clipboard"); paste.m_pOle->PutFormatOnClipboard(&pClip->m_Formats); paste.m_pOle->CacheGlobalData(theApp.m_cfIgnoreClipboard, NewGlobalP("Ignore", sizeof("Ignore"))); LogSendRecieveInfo("---------OnLoadClipOnClipboard - After PutFormats on clipboard"); LogSendRecieveInfo(StrF(_T("---------OnLoadClipOnClipboard - Setting clip id: %d on ole clipboard"), pClip->m_id)); paste.GetClipIDs().Add(pClip->m_id); paste.DoPaste(); LogSendRecieveInfo(StrF(_T("---------OnLoadClipOnClipboard - After paste clip id: %d on ole clipboard"), pClip->m_id)); } delete pClip; return TRUE; }
bool CDittoCopyBuffer::PastCopyBuffer(long lCopyBuffer) { //Can't paste while another is still active if(WaitForSingleObject(m_Pasting, 1) == WAIT_TIMEOUT) { Log(_T("Copy Buffer pasted to fast")); return false; } m_RestoreTimer.ResetEvent(); m_Pasting.ResetEvent(); bool bRet = false; Log(StrF(_T("Start - PastCopyBuffer buffer = %d"), m_lCurrentDittoBuffer)); try { CppSQLite3Query q = theApp.m_db.execQueryEx(_T("SELECT Main.lID FROM Main ") _T("INNER JOIN CopyBuffers ON CopyBuffers.lClipID = Main.lID ") _T("WHERE CopyBuffers.lCopyBuffer = %d"), lCopyBuffer); if(q.eof() == false) { m_pClipboard = new CClipboardSaveRestoreCopyBuffer; if(m_pClipboard) { //Save the clipboard, //then put the new data on the clipboard //then send a paste //then wait a little and restore the original clipboard data if(m_pClipboard->Save()) { CProcessPaste paste; paste.m_bSendPaste = true; paste.m_bActivateTarget = false; paste.GetClipIDs().Add(q.getIntField(_T("lID"))); paste.DoPaste(); m_pClipboard->m_lRestoreDelay = g_Opt.GetDittoRestoreClipboardDelay(); Log(StrF(_T("PastCopyBuffer sent paste, starting thread to restore clipboard, Delay = %d"), m_pClipboard->m_lRestoreDelay)); AfxBeginThread(CDittoCopyBuffer::DelayRestoreClipboard, (LPVOID)this, THREAD_PRIORITY_LOWEST); bRet = true; } else { Log(_T("PastCopyBuffer failed to save clipboard")); } } } } CATCH_SQLITE_EXCEPTION if(bRet == false) m_Pasting.SetEvent(); return bRet; }
void CQListCtrl::LoadCopyOrCutToClipboard() { ARRAY arr; GetSelectionItemData(arr); INT_PTR count = arr.GetSize(); if(count <= 0) return; CProcessPaste paste; //Don't send the paste just load it into memory paste.m_bSendPaste = false; if(count > 1) paste.GetClipIDs().Copy(arr); else paste.GetClipIDs().Add(arr[0]); //Don't move these to the top BOOL bItWas = g_Opt.m_bUpdateTimeOnPaste; g_Opt.m_bUpdateTimeOnPaste = FALSE; paste.DoPaste(); g_Opt.m_bUpdateTimeOnPaste = bItWas; }
void CMainFrame::PasteOrShowGroup(int dbId, BOOL updateClipTime, BOOL activeTarget, BOOL sendPaste) { try { if (theApp.EnterGroupID(dbId, FALSE, TRUE)) { theApp.m_activeWnd.TrackActiveWnd(true); StartKeyModifyerTimer(); m_quickPaste.ShowQPasteWnd(this, false, true, FALSE); } else { BOOL bItWas = g_Opt.m_bUpdateTimeOnPaste; if (updateClipTime != -1) { g_Opt.m_bUpdateTimeOnPaste = updateClipTime; } CProcessPaste paste; paste.GetClipIDs().Add(dbId); if (activeTarget != -1) { paste.m_bActivateTarget = activeTarget ? true : false;; } if (sendPaste != -1) { paste.m_bSendPaste = sendPaste ? true : false; } paste.DoPaste(); theApp.OnPasteCompleted(); if (updateClipTime != -1) { g_Opt.m_bUpdateTimeOnPaste = bItWas; } } } CATCH_SQLITE_EXCEPTION }
void CMainFrame::DoDittoCopyBufferPaste(int nCopyBuffer) { try { CppSQLite3Query q = theApp.m_db.execQueryEx(_T("SELECT lID FROM Main WHERE CopyBuffer = %d"), nCopyBuffer); if(q.eof() == false) { //Don't move these to the top BOOL bItWas = g_Opt.m_bUpdateTimeOnPaste; g_Opt.m_bUpdateTimeOnPaste = FALSE; CProcessPaste paste; paste.GetClipIDs().Add(q.getIntField(_T("lID"))); paste.m_bActivateTarget = false; paste.DoPaste(); theApp.OnPasteCompleted(); g_Opt.m_bUpdateTimeOnPaste = bItWas; } } CATCH_SQLITE_EXCEPTION }