void SFileWorker::MoveToTrash(const SFile *srcFolder, const SFileList *fileList) { BEntry entry(TRASH_ENTRY); SFile trashFolder(&entry); ModifyRestoreAttribute(fileList,true); Cut(srcFolder, fileList); Paste(&trashFolder); }
bool SMatrix::Jointer_bottom(SMatrix& other) { if(other.nCol()!=nCol()) return FALSE; if(!AddRows(other.nRow(),ERRORVAL)) return FALSE; return Paste(other,nRow()-other.nRow(),0); }
void Plugin::hookMessageWillCreated (LeechCraft::IHookProxy_ptr proxy, QObject*, QObject *entry, int, QString) { ICLEntry *other = qobject_cast<ICLEntry*> (entry); if (!other) { qWarning () << Q_FUNC_INFO << "unable to cast" << entry << "to ICLEntry"; return; } QString text = proxy->GetValue ("text").toString (); const int maxLines = XmlSettingsManager::Instance () .property ("LineCount").toInt (); if (text.split ('\n').size () < maxLines) return; QByteArray propName; switch (other->GetEntryType ()) { case ICLEntry::ETChat: propName = "EnableForNormalChats"; break; case ICLEntry::ETMUC: propName = "EnableForMUCChats"; break; case ICLEntry::ETPrivateChat: propName = "EnableForPrivateChats"; break; default: return; } if (!XmlSettingsManager::Instance ().property (propName).toBool ()) return; PasteDialog dia; dia.exec (); auto choice = dia.GetChoice (); switch (choice) { case PasteDialog::Cancel: proxy->CancelDefault (); case PasteDialog::No: return; case PasteDialog::Yes: { auto service = dia.GetCreator () (entry); service->Paste ({ Proxy_->GetNetworkAccessManager (), text, dia.GetHighlight () }); proxy->CancelDefault (); } } }
void PolycodeEditor::handleEvent(Event *event) { if(event->getDispatcher() == CoreServices::getInstance()->getCore() && enabled) { switch(event->getEventCode()) { // Only copypaste of more complex IDE entities is handled here. // Pure text copy/paste is handled in: // Modules/Contents/UI/Source/PolyUITextInput.cpp case Core::EVENT_SELECT_ALL: { selectAll(); } break; case Core::EVENT_COPY: { void *data = NULL; String dataType = Copy(&data); if(data) { globalClipboard->setData(data, dataType, this); } } break; case Core::EVENT_PASTE: { if(globalClipboard->getData()) { Paste(globalClipboard->getData(), globalClipboard->getType()); } } break; case Core::EVENT_UNDO: { if(editorActions.size() > 0 && currentUndoPosition >= 0) { doAction(editorActions[currentUndoPosition].actionName, editorActions[currentUndoPosition].beforeData); currentUndoPosition--; if(currentUndoPosition < -1) { currentUndoPosition = -1; } } } break; case Core::EVENT_REDO: { if(editorActions.size() > 0) { currentUndoPosition++; if(currentUndoPosition > editorActions.size()-1) { currentUndoPosition = editorActions.size()-1; } else { doAction(editorActions[currentUndoPosition].actionName, editorActions[currentUndoPosition].afterData); } } } break; } } }
void Console::Append(const String& s) { if(s.IsEmpty()) return; if(console) { String t = Filter(s, sCharFilterNoCr); if(*t.Last() == '\n') t.Trim(t.GetCount() - 1); Puts(t); return; } int l, h; GetSelection(l, h); if(GetCursor() == GetLength()) l = -1; EditPos p = GetEditPos(); SetEditable(); MoveTextEnd(); WString t = Filter(s, sAppf).ToWString(); int mg = sb.GetReducedViewSize().cx / GetFont().GetAveWidth(); if(wrap_text && mg > 4) { int x = GetColumnLine(GetCursor()).x; WStringBuffer tt; const wchar *q = t; while(*q) { if(x > mg - 1) { tt.Cat('\n'); tt.Cat(" "); x = 4; } x++; if(*q == '\n') x = 0; tt.Cat(*q++); } Paste(tt); } else Paste(t); SetReadOnly(); if(l >= 0) { SetEditPos(p); SetSelection(l, h); } }
bool GeneralMatrix::Jointer_Right(GeneralMatrix& other) { if(other.nRow()!=nRow()) return FALSE; if(!AddCols(other.nCol(),ERRORVAL)) return FALSE; Paste(other,0,nCol()-other.nCol()); return TRUE; }
void Plugin::hookMessageWillCreated (LeechCraft::IHookProxy_ptr proxy, QObject *chatTab, QObject *entry, int, QString) { ICLEntry *other = qobject_cast<ICLEntry*> (entry); if (!other) { qWarning () << Q_FUNC_INFO << "unable to cast" << entry << "to ICLEntry"; return; } QString text = proxy->GetValue ("text").toString (); const int maxLines = XmlSettingsManager::Instance () .property ("LineCount").toInt (); if (text.split ('\n').size () < maxLines) return; QByteArray propName; switch (other->GetEntryType ()) { case ICLEntry::ETChat: propName = "EnableForNormalChats"; break; case ICLEntry::ETMUC: propName = "EnableForMUCChats"; break; case ICLEntry::ETPrivateChat: propName = "EnableForPrivateChats"; break; default: return; } if (!XmlSettingsManager::Instance () .property (propName).toBool ()) return; const bool shouldConfirm = XmlSettingsManager::Instance () .property ("ConfirmPasting").toBool (); if (shouldConfirm && QMessageBox::question (qobject_cast<QWidget*> (chatTab), tr ("Confirm pasting"), tr ("This message is too long according to current " "settings. Would you like to paste it on a " "pastebin?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) return; Paste (text, entry); proxy->CancelDefault (); }
void WaveTrack::InsertSilence(double t, double lenSecs) { // Create a new track containing as much silence as we // need to insert, and then call Paste to do the insertion sampleCount len = (sampleCount) (lenSecs * rate + 0.5); WaveTrack *sTrack = new WaveTrack(dirManager); sTrack->rate = rate; sampleCount idealSamples = GetIdealBlockSize(); sampleType *buffer = new sampleType[idealSamples]; sampleCount i; for (i = 0; i < idealSamples; i++) buffer[i] = 0; sampleCount pos = 0; BlockFile *firstBlockFile = NULL; while (len) { sampleCount l = (len > idealSamples ? idealSamples : len); WaveBlock *w = new WaveBlock(); w->start = pos; w->len = l; w->min = 0; w->max = 0; if (pos == 0 || len == l) { w->f = dirManager->NewBlockFile(); firstBlockFile = w->f; bool inited = InitBlock(w); wxASSERT(inited); FirstWrite(buffer, w, l); } else { w->f = dirManager->CopyBlockFile(firstBlockFile); if (!w->f) { wxMessageBox("Could not paste! (Out of disk space?)"); } } sTrack->block->Add(w); pos += l; len -= l; } sTrack->numSamples = pos; Paste(t, sTrack); delete sTrack; ConsistencyCheck("InsertSilence"); }
void CMHistoryText::PlaceCursorAtEnd() { if (!IsEmpty()) { SetCaretLocation(GetTextLength()+1); if (GetText().GetLastCharacter() != '\n') { Paste("\n"); } } }
bool GeneralMatrix::Jointer_Diagonal(GeneralMatrix& other,ELEMTYPE Val) { int iCol; iCol = nRow()==0 ? other.nCol()-1 : other.nCol(); if(!AddRows(other.nRow(),Val)) return FALSE; if(!AddCols(iCol,Val)) return FALSE; return Paste(other,nRow()-other.nRow(),nCol()-other.nCol()); }
bool Sequence::InsertSilence(sampleCount s0, sampleCount len) { // Create a new track containing as much silence as we // need to insert, and then call Paste to do the insertion Sequence *sTrack = new Sequence(mDirManager, mSampleFormat); sampleCount idealSamples = GetIdealBlockSize(); // Allocate a zeroed buffer samplePtr buffer = NewSamples(idealSamples, mSampleFormat); ClearSamples(buffer, mSampleFormat, 0, idealSamples); sampleCount pos = 0; BlockFile *firstBlockFile = NULL; while (len) { sampleCount l = (len > idealSamples ? idealSamples : len); SeqBlock *w = new SeqBlock(); w->start = pos; w->len = l; w->min = float(0.0); w->max = float(0.0); w->rms = float(0.0); if (pos == 0 || len == l) { w->f = mDirManager->NewBlockFile(mSummary->totalSummaryBytes); firstBlockFile = w->f; FirstWrite(buffer, w, l); } else { w->f = mDirManager->CopyBlockFile(firstBlockFile); if (!w->f) { // TODO set error message return false; } } sTrack->mBlock->Add(w); pos += l; len -= l; } sTrack->mNumSamples = pos; Paste(s0, sTrack); delete sTrack; DeleteSamples(buffer); return ConsistencyCheck("InsertSilence"); }
void CSequenceEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { short control; control = (GetKeyState(VK_CONTROL)&(-128)); if ((nChar=='V'||nChar=='v')) { //The user pressed cntrl-V if (control) Paste(); } CEdit::OnKeyDown(nChar, nRepCnt, nFlags); }
Sequence::Sequence(const Sequence &orig) { mDirManager = orig.mDirManager; mNumSamples = 0; mSampleFormat = orig.mSampleFormat; mSummary = new SummaryInfo; *mSummary = *orig.mSummary; mMaxSamples = orig.mMaxSamples; mMinSamples = orig.mMinSamples; mBlock = new BlockArray(); Paste(0, &orig); }
Sequence::Sequence(const Sequence &orig) { mDirManager = orig.mDirManager; mDirManager->Ref(); mNumSamples = 0; mSampleFormat = orig.mSampleFormat; mMaxSamples = orig.mMaxSamples; mMinSamples = orig.mMinSamples; mErrorOpening = false; mBlock = new BlockArray(); Paste(0, &orig); }
void NativeTextfieldWin::ExecuteCommand(int command_id) { ScopedFreeze freeze(this, GetTextObjectModel()); OnBeforePossibleChange(); switch(command_id) { case IDS_APP_UNDO: Undo(); break; case IDS_APP_CUT: Cut(); break; case IDS_APP_COPY: Copy(); break; case IDS_APP_PASTE: Paste(); break; case IDS_APP_SELECT_ALL: SelectAll(); break; default: NOTREACHED(); break; } OnAfterPossibleChange(true); }
bool WaveClip::ExpandCutLine(double cutLinePosition) { for (WaveClipList::compatibility_iterator it = mCutLines.GetFirst(); it; it=it->GetNext()) { WaveClip* cutline = it->GetData(); if (fabs(mOffset + cutline->GetOffset() - cutLinePosition) < 0.0001) { if (!Paste(mOffset+cutline->GetOffset(), cutline)) return false; delete cutline; mCutLines.DeleteNode(it); return true; } } return false; }
void OnChar(wxKeyEvent& event) { if (event.GetKeyCode() == WXK_TAB) return; #ifdef __WXMAC__ if (event.GetKeyCode() == 'v' && event.GetModifiers() == wxMOD_CMD) { Paste(); wxTextCtrl* text = ((wxTextCtrl*)m_text); text->SetStyle(0, text->GetLastPosition(), GetDefaultTextCtrlStyle(text)); return; } #endif event.Skip(); }
void PerformPaste (ICLEntry *other, const QString& text, const ICoreProxy_ptr& proxy, const IUserChoiceHandler_ptr& handler, OkF okCont, CancelF cancelCont) { QSettings settings (QCoreApplication::organizationName (), QCoreApplication::applicationName () + "_Azoth_Autopaste"); settings.beginGroup ("SavedChoices"); settings.beginGroup (other->GetEntryID ()); const auto guard = Util::MakeScopeGuard ([&settings] { settings.endGroup (); settings.endGroup (); }); if (!handler->ShouldAsk (settings)) return; PasteDialog dia; dia.SetCreatorName (settings.value ("Service").toString ()); dia.SetHighlight (static_cast<Highlight> (settings.value ("Highlight").toInt ())); dia.exec (); switch (dia.GetChoice ()) { case PasteDialog::Cancel: cancelCont (); break; case PasteDialog::No: handler->Rejected (settings); break; case PasteDialog::Yes: { auto service = dia.GetCreator () (other->GetQObject (), proxy); service->Paste ({ proxy->GetNetworkAccessManager (), text, dia.GetHighlight () }); okCont (); handler->Accepted (settings); settings.setValue ("Service", dia.GetCreatorName ()); settings.setValue ("Highlight", static_cast<int> (dia.GetHighlight ())); break; } } }
void Track::SyncLockAdjust(double oldT1, double newT1) { if (newT1 > oldT1) { // Insert space within the track if (oldT1 > GetEndTime()) return; auto tmp = Cut(oldT1, GetEndTime()); Paste(newT1, tmp.get()); } else if (newT1 < oldT1) { // Remove from the track Clear(newT1, oldT1); } }
void CConsoleEdit::OnMenuPlaster() { int nStart,nEnd; GetSel(nStart,nEnd); if(nStart == nEnd) { // 粘贴 MoveToEnd(); Paste(); CString alltext; GetWindowText(alltext); MoveToEnd(); // 得到命令 alltext = alltext.Mid(m_last_title_pos,m_nLength-m_last_title_pos); strncpy(m_cmd,alltext,alltext.GetLength()>sizeof(m_cmd)?sizeof(m_cmd):alltext.GetLength()); } }
BOOL CSmartComboBox::PreTranslateMessage(MSG* pMsg) { if (pMsg->message == WM_KEYDOWN) { if (GetAsyncKeyState(VK_CONTROL)) { if (pMsg->wParam == VkKeyScan('v')) { Paste(); } else if (pMsg->wParam == VkKeyScan('c')) { Copy(); } else if (pMsg->wParam == VkKeyScan('x')) { Cut(); } return TRUE; } } return CComboBox::PreTranslateMessage(pMsg); }
Sequence::Sequence(const Sequence &orig, DirManager *projDirManager) { // essentially a copy constructor - but you must pass in the // current project's DirManager, because we might be copying // from one project to another mDirManager = projDirManager; mDirManager->Ref(); mNumSamples = 0; mSampleFormat = orig.mSampleFormat; mMaxSamples = orig.mMaxSamples; mMinSamples = orig.mMinSamples; mErrorOpening = false; mBlock = new BlockArray(); Paste(0, &orig); }
void GroupListView::CreateActions() { actRename = new QAction(QIcon(":/img16x16/cell_edit.png"),tr("Rename"),this); actRename->setShortcut( Qt::Key_F2 ); actRename->setShortcutContext(Qt::WidgetWithChildrenShortcut); connect(actRename,SIGNAL(triggered()), this,SLOT(EditItem())); addAction(actRename); actAddNew = new QAction(QIcon(":/img16x16/edit_add.png"),tr("Insert new"),this); actAddNew->setShortcut( Qt::Key_Insert ); actAddNew->setShortcutContext(Qt::WidgetWithChildrenShortcut); connect(actAddNew,SIGNAL(triggered()), this,SLOT(InsertItem())); addAction(actAddNew); actDel = new QAction(QIcon(":/img16x16/edit_remove.png"),tr("Delete"),this); actDel->setShortcut(QKeySequence::Delete); actDel->setShortcutContext(Qt::WidgetWithChildrenShortcut); connect(actDel,SIGNAL(triggered()), this,SLOT(DeleteItem())); addAction(actDel); actCopy = new QAction( QIcon(":/img16x16/editcopy.png"), "Copy", this); actCopy->setShortcuts(QKeySequence::Copy); actCopy->setShortcutContext(Qt::WidgetWithChildrenShortcut); connect(actCopy, SIGNAL(triggered()), this, SLOT(Copy())); addAction(actCopy); actPaste = new QAction( QIcon(":/img16x16/editpaste.png"), "Paste", this); actPaste->setShortcuts(QKeySequence::Paste); actPaste->setShortcutContext(Qt::WidgetWithChildrenShortcut); connect(actPaste, SIGNAL(triggered()), this, SLOT(Paste())); addAction(actPaste); actCut = new QAction( QIcon(":/img16x16/editcut.png"), "Cut", this); actCut->setShortcuts(QKeySequence::Cut); actCut->setShortcutContext(Qt::WidgetWithChildrenShortcut); connect(actCut, SIGNAL(triggered()), this, SLOT(Cut())); addAction(actCut); }
void Copy(const char *srcpath, const char *dstpath) { int rdfd = open(srcpath, O_RDONLY); if (rdfd == -1) { perror("open srcpath failed!"); return; } int wrfd = open(dstpath, O_CREAT|O_WRONLY|O_TRUNC, S_IRUSR|S_IWUSR); if (wrfd == -1) { perror("open dstpath failed!"); return; } char buff[BUFF_SIZE+1]; int count = 0; int size = 0; // copy while (1) { size = read(rdfd, buff, BUFF_SIZE-count); if (size == -1) { if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) continue; perror("read failed!"); return; } count += size; if (count == BUFF_SIZE || size == 0) { buff[count] = '\0'; // Dump(buff, count); Paste(wrfd, buff, count); memset(buff, 0, count); count = 0; } if (size == 0) break; } }
void CSimpleReport::RowUpMulti() { // 한꺼번에 여러개를 올림 CXTPReportSelectedRows* pRows = GetSelectedRows(); if (!pRows) return; CXTPReportRow* pRow = pRows->GetAt(0); if (!pRow) return; int n = pRow->GetIndex(); if (n == 0) // 더이상 올라갈 수 없음 return; Cut(); RowSetFocused(n-1); Paste(); SetFocus(); }
void TimeEdit::PasteTime() { if (byFrame) { Paste(); return; } std::string text(GetClipboard()); if (text.empty()) return; AssTime tempTime(text); if (tempTime.GetAssFormated() == text) { SetTime(tempTime); SetSelection(0, GetValue().size()); wxCommandEvent evt(wxEVT_TEXT, GetId()); evt.SetEventObject(this); HandleWindowEvent(evt); } }
void MouseButton(int button, bool down) { if (down) { if (!Planes.size()) return; if (button == 3) // Copy to clipboard { // TODO: overload tileplane subscript operator TilePlane *P = Planes.back(); TileObject O = P->grid[P->editx + P->edity * P->w]; Clip_Visual = O.Visual; Clip_Behavior = O.Behavior; } else if (button == 1) // Paste tile { Paste(); Pasting = true; } } else Pasting = false; }
void wxWebView::OnKeyEvents(wxKeyEvent& event) { WebCore::Frame* frame = 0; if (m_mainFrame) frame = m_mainFrame->GetFrame(); if (frame && frame->view()) { // WebCore doesn't handle these events itself, so we need to do // it and not send the event down or else CTRL+C will erase the text // and replace it with c. if (event.CmdDown() && event.GetEventType() == wxEVT_KEY_UP) { if (event.GetKeyCode() == static_cast<int>('C')) Copy(); else if (event.GetKeyCode() == static_cast<int>('X')) Cut(); else if (event.GetKeyCode() == static_cast<int>('V')) Paste(); else if (event.GetKeyCode() == static_cast<int>('Z')) { if (event.ShiftDown()) { if (m_mainFrame->CanRedo()) m_mainFrame->Redo(); } else { if (m_mainFrame->CanUndo()) m_mainFrame->Undo(); } } } else { WebCore::PlatformKeyboardEvent wkEvent(event); if (wkEvent.type() == WebCore::PlatformKeyboardEvent::Char && wkEvent.altKey()) frame->eventHandler()->handleAccessKey(wkEvent); else frame->eventHandler()->keyEvent(wkEvent); } } // make sure we get the character event. if (event.GetEventType() != wxEVT_CHAR) event.Skip(); }
bool Sequence::InsertSilence(sampleCount s0, sampleCount len) { // Quick check to make sure that it doesn't overflow if (((double)mNumSamples) + ((double)len) > wxLL(9223372036854775807)) return false; // Create a new track containing as much silence as we // need to insert, and then call Paste to do the insertion. // We make use of a SilentBlockFile, which takes up no // space on disk. Sequence *sTrack = new Sequence(mDirManager, mSampleFormat); sampleCount idealSamples = GetIdealBlockSize(); sampleCount pos = 0; while (len) { sampleCount l = (len > idealSamples ? idealSamples : len); SeqBlock *w = new SeqBlock(); w->start = pos; w->f = new SilentBlockFile(l); sTrack->mBlock->Add(w); pos += l; len -= l; } sTrack->mNumSamples = pos; bool bResult = Paste(s0, sTrack); delete sTrack; return bResult && ConsistencyCheck(wxT("InsertSilence")); }
HRESULT CMainFrameDropTarget::PasteHTML(COleDataObject& data) { HRESULT hrPasteResult = E_FAIL; HGLOBAL hMem; if ((hMem = data.GetGlobalData(m_cfHTML)) != NULL) { LPCSTR pszClipboard; if ((pszClipboard = (LPCSTR)GlobalLock(hMem)) != NULL) { hrPasteResult = S_FALSE; // default: nothing was pasted LPCSTR pszHTML = strchr(pszClipboard, '<'); if (pszHTML != NULL) { CComBSTR bstrHTMLText((LPCOLESTR)CA2W(pszHTML)); PASTEURLDATA Paste(bstrHTMLText); hrPasteResult = PasteHTML(&Paste); } GlobalUnlock(hMem); } GlobalFree(hMem); } return hrPasteResult; }