//============================================================================== bool CodeEditorComponent::keyPressed (const KeyPress& key) { if (! TextEditorKeyMapper<CodeEditorComponent>::invokeKeyFunction (*this, key)) { if (key == KeyPress::tabKey || key.getTextCharacter() == '\t') { insertTabAtCaret(); } else if (key == KeyPress::returnKey) { newTransaction(); insertTextAtCaret (document.getNewLineCharacters()); } else if (key.isKeyCode (KeyPress::escapeKey)) { newTransaction(); } else if (key.getTextCharacter() >= ' ') { insertTextAtCaret (String::charToString (key.getTextCharacter())); } else { return false; } } return true; }
void CodeEditorComponent::paste() { newTransaction(); const String clip (SystemClipboard::getTextFromClipboard()); if (clip.isNotEmpty()) insertTextAtCaret (clip); newTransaction(); }
bool CodeEditorComponent::pasteFromClipboard() { newTransaction(); const String clip (SystemClipboard::getTextFromClipboard()); if (clip.isNotEmpty()) insertText (clip); newTransaction(); return true; }
bool CodeEditorComponent::cutToClipboard() { copyToClipboard(); cut(); newTransaction(); return true; }
void CodeEditorComponent::mouseUp (const MouseEvent&) { newTransaction(); beginDragAutoRepeat (0); dragType = notDragging; setMouseCursor (MouseCursor::IBeamCursor); }
//============================================================================== void CodeEditorComponent::mouseDown (const MouseEvent& e) { newTransaction(); dragType = notDragging; if (e.mods.isPopupMenu()) { setMouseCursor (MouseCursor::NormalCursor); if (getHighlightedRegion().isEmpty()) { CodeDocument::Position start, end; document.findTokenContaining (getPositionAt (e.x, e.y), start, end); if (start.getPosition() < end.getPosition()) selectRegion (start, end); } PopupMenu m; m.setLookAndFeel (&getLookAndFeel()); addPopupMenuItems (m, &e); m.showMenuAsync (PopupMenu::Options(), ModalCallbackFunction::forComponent (codeEditorMenuCallback, this)); } else { beginDragAutoRepeat (100); moveCaretTo (getPositionAt (e.x, e.y), e.mods.isShiftDown()); } }
bool CodeEditorComponent::moveCaretToEndOfLine (const bool selecting) { newTransaction(); moveCaretTo (CodeDocument::Position (document, caretPos.getLineNumber(), std::numeric_limits<int>::max()), selecting); return true; }
bool CodeEditorComponent::selectAll() { newTransaction(); moveCaretTo (CodeDocument::Position (&document, std::numeric_limits<int>::max(), std::numeric_limits<int>::max()), false); moveCaretTo (CodeDocument::Position (&document, 0, 0), true); return true; }
bool Device::forceNonRemovable() { LOG_INFO( "Fixing up device ", m_uuid, " removable state..." ); auto dbConn = m_ml->getConn(); auto t = dbConn->newTransaction(); // The folders were also create based on the removable state, so we need to // update their mrl. // Files were not impacted by the issue. const std::string foldersReq = "SELECT * FROM " + Folder::Table::Name + " WHERE device_id = ?"; auto folders = Folder::fetchAll<Folder>( m_ml, foldersReq, m_id ); for ( auto& f : folders ) { if ( f->isRemovable() == false ) continue; auto fullMrl = f->mrl(); if ( f->forceNonRemovable( fullMrl ) == false ) return false; } // Update the device after updating the folders, to avoid any potential // screwup where the device would be deemed non-removable, and the MRL would // be only the relative part. const std::string req = "UPDATE " + Table::Name + " SET is_removable = ? " " WHERE id_device = ?"; if ( sqlite::Tools::executeUpdate( dbConn, req, false, m_id ) == false ) return false; m_isRemovable = false; t->commit(); return true; }
static void TransDataValOptFun(CCHashMap *pCCHM, void *key, volatile void **ppVal, void *pParam) { char tmpBuf[32]; CatTransData *pData = (CatTransData *) (*ppVal); if (pData->m_count > 0) { CatTransaction *pTrans = newTransaction(pData->m_type, pData->m_name); CatMessageInner *pInner = getInnerMsg(pTrans); pInner->data = catsdsnewEmpty(128); pInner->data = catsdscatchar(pInner->data, '@'); pInner->data = catsdscat(pInner->data, catItoA(pData->m_count, tmpBuf, 10)); pInner->data = catsdscatchar(pInner->data, ';'); pInner->data = catsdscat(pInner->data, catItoA(pData->m_error, tmpBuf, 10)); pInner->data = catsdscatchar(pInner->data, ';'); pInner->data = catsdscat(pInner->data, catItoA(pData->m_durationMsSum, tmpBuf, 10)); pInner->data = catsdscatchar(pInner->data, ';'); sds durationString = buildDurationString(pData); pInner->data = catsdscatsds(pInner->data, durationString); catsdsfree(durationString); pTrans->setStatus(pTrans, CAT_SUCCESS); pTrans->complete(pTrans); _CLog_debugInfo("%s | %s : %s\n", pInner->type, pInner->name, pInner->data); } pData->m_count = 0; pData->m_error = 0; pData->m_durationMsSum = 0; clearCCHashMap(pData->m_durations); }
void CodeEditorComponent::pageUp (const bool selecting) { newTransaction(); scrollBy (-linesOnScreen); moveCaretTo (caretPos.movedByLines (-linesOnScreen), selecting); }
bool CodeEditorComponent::pageUp (const bool selecting) { newTransaction(); scrollBy (-linesOnScreen); moveLineDelta (-linesOnScreen, selecting); return true; }
bool CodeEditorComponent::pageDown (const bool selecting) { newTransaction(); scrollBy (jlimit (0, linesOnScreen, 1 + document.getNumLines() - firstLineOnScreen - linesOnScreen)); moveLineDelta (linesOnScreen, selecting); return true; }
void CodeEditorComponent::pageDown (const bool selecting) { newTransaction(); scrollBy (jlimit (0, linesOnScreen, 1 + document.getNumLines() - firstLineOnScreen - linesOnScreen)); moveCaretTo (caretPos.movedByLines (linesOnScreen), selecting); }
bool CodeEditorComponent::selectAll() { newTransaction(); selectRegion (CodeDocument::Position (document, std::numeric_limits<int>::max(), std::numeric_limits<int>::max()), CodeDocument::Position (document, 0, 0)); return true; }
void CodeEditorComponent::scrollDown() { newTransaction(); scrollBy (-1); if (caretPos.getLineNumber() >= firstLineOnScreen + linesOnScreen) moveCaretTo (caretPos.movedByLines (-1), false); }
void CodeEditorComponent::cursorUp (const bool selecting) { newTransaction(); if (caretPos.getLineNumber() == 0) moveCaretTo (CodeDocument::Position (&document, 0, 0), selecting); else moveCaretTo (caretPos.movedByLines (-1), selecting); }
void CodeEditorComponent::cursorDown (const bool selecting) { newTransaction(); if (caretPos.getLineNumber() == document.getNumLines() - 1) moveCaretTo (CodeDocument::Position (&document, INT_MAX, INT_MAX), selecting); else moveCaretTo (caretPos.movedByLines (1), selecting); }
void CodeEditorComponent::cursorRight (const bool moveInWholeWordSteps, const bool selecting) { newTransaction(); if (moveInWholeWordSteps) moveCaretTo (document.findWordBreakAfter (caretPos), selecting); else moveCaretTo (caretPos.movedBy (1), selecting); }
void CodeDocument::undo() { if (!undoDisabled) { newTransaction(); undoManager.undo(); } }
void EtherIPC::handleGetTransactionByHash() { QJsonValue jv; if ( !readReply(jv) ) { return bail(); } emit newTransaction(TransactionInfo(jv.toObject())); done(); }
void CodeEditorComponent::copy() { newTransaction(); const String selection (document.getTextBetween (selectionStart, selectionEnd)); if (selection.isNotEmpty()) SystemClipboard::copyTextToClipboard (selection); }
bool CodeEditorComponent::scrollDown() { newTransaction(); scrollBy (-1); if (caretPos.getLineNumber() >= firstLineOnScreen + linesOnScreen) moveLineDelta (-1, false); return true; }
bool CodeEditorComponent::scrollUp() { newTransaction(); scrollBy (1); if (caretPos.getLineNumber() < firstLineOnScreen) moveLineDelta (1, false); return true; }
TTile *TTileServerDirect::load(const TTileRef &ref, TTileClient *client, void *privateData, uint flag) { TTile *tile = _container.get(ref, client, flag); if((tile == NULL) && _online && !(flag & TILESERVER_FLAG_DONTLOAD)) { newTransaction(ref, client, privateData); } return tile; }
bool CodeEditorComponent::moveCaretLeft (const bool moveInWholeWordSteps, const bool selecting) { newTransaction(); if (moveInWholeWordSteps) moveCaretTo (document.findWordBreakBefore (caretPos), selecting); else moveCaretTo (caretPos.movedBy (-1), selecting); return true; }
void CodeEditorComponent::goToStartOfLine (const bool selecting) { newTransaction(); int index = findFirstNonWhitespaceChar (caretPos.getLineText()); if (index >= caretPos.getIndexInLine() && caretPos.getIndexInLine() > 0) index = 0; moveCaretTo (CodeDocument::Position (&document, caretPos.getLineNumber(), index), selecting); }
bool CodeEditorComponent::moveCaretUp (const bool selecting) { newTransaction(); if (caretPos.getLineNumber() == 0) moveCaretTo (CodeDocument::Position (&document, 0, 0), selecting); else moveLineDelta (-1, selecting); return true; }
bool CodeEditorComponent::moveCaretDown (const bool selecting) { newTransaction(); if (caretPos.getLineNumber() == document.getNumLines() - 1) moveCaretTo (CodeDocument::Position (&document, std::numeric_limits<int>::max(), std::numeric_limits<int>::max()), selecting); else moveLineDelta (1, selecting); return true; }
void sendTransData() { if (g_transAggregator->m_count <= 0) { return; } getContextMessageTree()->canDiscard = 0; CatTransaction *pTrans = newTransaction("System", "TransactionAggregator"); if (g_transAggregator->m_count < 2000) { sendTransDataNoClear(); } else { sendTransDataClear(); } pTrans->setStatus(pTrans, CAT_SUCCESS); pTrans->complete(pTrans); }