string DirectoryListing::loadXML(const string& xml, bool updating) { setUtf8(true); ListLoader ll(getRoot(), updating); SimpleXMLReader(&ll).fromXML(xml); return ll.getBase(); }
QSPEditor::QSPEditor(QWidget *parent) : QsciScintilla(parent) { setUtf8(true); QFont m_font(Config().editorFont()); //m_font.setFamily("Monospace"); m_font.setFixedPitch(true); m_font.setPointSize(Config().editorFontSize()); QFontMetrics m_fm (m_font); this->setFont(m_font); this->setMarginsFont(m_font); this->setMarginWidth(0, m_fm.width("00000")+ 5); this->setMarginLineNumbers(0,true); //Clickable margin 1 for showing markers this->setMarginSensitivity(1, true); connect(this,SIGNAL(marginClicked(int,int,Qt::KeyboardModifiers)), this, SLOT(onMarginClicked(int,int,Qt::KeyboardModifiers))); this->markerDefine(QsciScintilla::RightArrow, ARROW_MARKER_NUM); this->setMarkerBackgroundColor(QColor("#ee1111"),ARROW_MARKER_NUM); this->setEdgeMode(QsciScintilla::EdgeLine); this->setEdgeColumn(200); this->setEdgeColor(QColor("#FF0000")); this->setFolding(QsciScintilla::CircledTreeFoldStyle); this->setBraceMatching(QsciScintilla::SloppyBraceMatch); this->setCaretLineVisible(true); this->setCaretLineBackgroundColor(QColor("#F1EFD8")); this->setMarginsBackgroundColor(QColor("#333333")); this->setMarginsForegroundColor(QColor("#CCCCCC")); this->setFoldMarginColors(QColor("#99CC66"),QColor("#333300")); this->setAutoIndent(true); this->setIndentationWidth(4); m_lexer = new QsciLexerPascal(); m_lexer->setDefaultFont(m_font); //m_lexer->setAutoIndentStyle(QsciScintilla::AiOpening | QsciScintilla::AiClosing); const char *keywords = m_lexer->keywords(0); qDebug() << "Pascal keywords : " << keywords << endl; //this->SendScintilla(QsciScintilla::SCI_STYLESETFONT,1,"Courier"); loadApis(m_lexer); this->setLexer(m_lexer); //this->setAutoIndent(true); this->setBackspaceUnindents(true); this->setAutoCompletionThreshold(1); this->setAutoCompletionSource(QsciScintilla::AcsAPIs); this->setAutoCompletionFillupsEnabled(true); }
DocumentEditor::DocumentEditor(QFileSystemWatcher& watcher_, QWidget* parent_) : ScintillaExt(parent_), _watcher(watcher_) { //codec _notified = true; setUtf8(true); _codec = ""; _bomMode = BomLeaveAsIs; _hasBom = false; _charsetAutoDetect = true; _addNewLineOnSave = false; _trimOnSave = false; _autoDetectEol = false; _autoDetectIndent = false; _isNew = true; _isCloned = false; _clone = 0; _fullPath = ""; //macro _macro = new QsciMacro(this); //load settings Settings settings; settings.applyToDocument(this); // set the 1st margin accept markers // number 1 and 2 (binary mask 00000110 == 6) //setMarginMarkerMask(1, 7); /*markerDefine(QsciScintilla::Circle, MARKER_BOOK); setMarkerBackgroundColor(Qt::green, MARKER_BOOK); setMarkerForegroundColor(Qt::black, MARKER_BOOK);*/ markerDefine(QPixmap(":/images/ledblue.png").scaled(40,16, Qt::KeepAspectRatio, Qt::SmoothTransformation), MARKER_BOOK); setModified(false); // define search indicator createIndicator(INDICATOR_SEARCH, INDIC_ROUNDBOX, Qt::green); // define quick search indicators createIndicator(INDICATOR_QUICK_SEARCH1, INDIC_ROUNDBOX, Qt::green); createIndicator(INDICATOR_QUICK_SEARCH2, INDIC_ROUNDBOX, Qt::blue); // define highlight indicators createIndicator(INDICATOR_HIGHLIGHT1, INDIC_ROUNDBOX, Qt::cyan); createIndicator(INDICATOR_HIGHLIGHT2, INDIC_ROUNDBOX, Qt::green); createIndicator(INDICATOR_HIGHLIGHT3, INDIC_ROUNDBOX, Qt::magenta); createIndicator(INDICATOR_HIGHLIGHT4, INDIC_ROUNDBOX, Qt::red); createIndicator(INDICATOR_HIGHLIGHT5, INDIC_ROUNDBOX, Qt::blue); createIndicator(INDICATOR_HIGHLIGHT6, INDIC_ROUNDBOX, Qt::yellow); //connection connect(this, SIGNAL(marginClicked(int,int, Qt::KeyboardModifiers)), this, SLOT(toggleBookmark(int,int, Qt::KeyboardModifiers))); }
// Note: code mostly duplicated below. void KURLGooglePrivate::init(const KURL& base, const char* rel, int relLength, const TextEncoding* queryEncoding) { // As a performance optimization, we do not use the charset converter if // encoding is UTF-8 or other Unicode encodings. Note that this is // per HTML5 2.5.3 (resolving URL). The URL canonicalizer will be // more efficient with no charset converter object because it // can do UTF-8 internally with no extra copies. // We feel free to make the charset converter object every time since it's // just a wrapper around a reference. KURLCharsetConverter charsetConverterObject(queryEncoding); KURLCharsetConverter* charsetConverter = (!queryEncoding || isUnicodeEncoding(queryEncoding)) ? 0 : &charsetConverterObject; url_canon::RawCanonOutputT<char> output; const CString& baseStr = base.m_url.utf8String(); m_isValid = url_util::ResolveRelative(baseStr.data(), baseStr.length(), base.m_url.m_parsed, rel, relLength, charsetConverter, &output, &m_parsed); // See FIXME in KURLGooglePrivate in the header. If canonicalization has not // changed the string, we can avoid an extra allocation by using assignment. // // When KURL encounters an error such that the URL is invalid and empty // (for example, resolving a relative URL on a non-hierarchical base), it // will produce an isNull URL, and calling setUtf8 will produce an empty // non-null URL. This is unlikely to affect anything, but we preserve this // just in case. if (m_isValid || output.length()) { // Without ref, the whole url is guaranteed to be ASCII-only. if (m_parsed.ref.is_nonempty()) setUtf8(CString(output.data(), output.length())); else setAscii(CString(output.data(), output.length())); } else { // WebCore expects resolved URLs to be empty rather than NULL. setUtf8(CString("", 0)); } }
SqlEditorWidget::SqlEditorWidget(QWidget * parent) : QsciScintilla(parent), m_searchText(""), m_searchIndicator(9) // see QsciScintilla docs { m_prefs = Preferences::instance(); setMarginLineNumbers(0, true); setBraceMatching(SloppyBraceMatch); setAutoIndent(true); QsciLexerSQL * lexer = new QsciLexerSQL(this); QsciAPIs * api = new QsciAPIs(lexer); if (!api->load(":/api/sqlite.api")) qDebug("api is not loaded"); else { api->prepare(); lexer->setAPIs(api); } setAutoCompletionSource(QsciScintilla::AcsAll); setAutoCompletionCaseSensitivity(false); setAutoCompletionReplaceWord(true); setCaretLineVisible(m_prefs->activeHighlighting()); setCaretLineBackgroundColor(m_prefs->activeHighlightColor()); setUtf8(true); setFolding(QsciScintilla::BoxedFoldStyle); lexer->setFoldComments(true); lexer->setFoldCompact(false); setLexer(lexer); // search all occurrences // allow indicator painting *under* the text (but it makes editor slower a bit...) // It paints a colored box under the text for all occurrences of m_searchText. SendScintilla(QsciScintilla::SCI_SETTWOPHASEDRAW, 1); SendScintilla(QsciScintilla::SCI_INDICSETSTYLE, m_searchIndicator, QsciScintilla::INDIC_ROUNDBOX); // TODO/FIXME: make it configurable SendScintilla(QsciScintilla::SCI_INDICSETFORE, m_searchIndicator, QColor(255, 230, 90, 100)); SendScintilla(QsciScintilla::SCI_INDICSETUNDER, m_searchIndicator, 1); // end of search all occurrences connect(this, SIGNAL(linesChanged()), this, SLOT(linesChanged())); connect(this, SIGNAL(cursorPositionChanged(int, int)), this, SLOT(cursorPositionChanged(int, int))); setCursorPosition(0, 0); linesChanged(); prefsChanged(); }
RoboScintilla::RoboScintilla(QWidget *parent) : QsciScintilla(parent), _ignoreEnterKey(false), _ignoreTabKey(false), _lineNumberDigitWidth(0), _lineNumberMarginWidth(0) { setAutoIndent(true); setIndentationsUseTabs(false); setIndentationWidth(indentationWidth); setUtf8(true); setMarginWidth(1, 0); setCaretForegroundColor(caretForegroundColor); setMatchedBraceForegroundColor(matchedBraceForegroundColor); //1AB0A6 setMatchedBraceBackgroundColor(marginsBackgroundColor); setContentsMargins(0, 0, 0, 0); setViewportMargins(3, 3, 3, 3); QFont ourFont = GuiRegistry::instance().font(); setMarginsFont(ourFont); setMarginLineNumbers(0, true); setMarginsBackgroundColor(QColor(53, 56, 58)); setMarginsForegroundColor(QColor(173, 176, 178)); SendScintilla(QsciScintilla::SCI_STYLESETFONT, 1, ourFont.family().data()); SendScintilla(QsciScintilla::SCI_SETHSCROLLBAR, 0); setWrapMode((QsciScintilla::WrapMode)QsciScintilla::SC_WRAP_NONE); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); // Cache width of one digit #ifdef Q_OS_WIN _lineNumberDigitWidth = rowNumberWidth; #else _lineNumberDigitWidth = textWidth(STYLE_LINENUMBER, "0"); #endif updateLineNumbersMarginWidth(); setLineNumbers(AppRegistry::instance().settingsManager()->lineNumbers()); setUtf8(true); VERIFY(connect(this, SIGNAL(linesChanged()), this, SLOT(updateLineNumbersMarginWidth()))); }
SourceEditor::SourceEditor(QWidget *parent) : QsciScintilla(parent) { setLexer(new QsciLexerPerl(this)); // only Perl for now :( setAutoIndent(true); setMarginLineNumbers(NumberMargin, true); setMarginWidth(NumberMargin, "3 "); setBraceMatching(SloppyBraceMatch); setUtf8(true); m_marginWidth = 1; connect(this, SIGNAL(linesChanged()), this, SLOT(linesCountChanged())); }
void KURLGooglePrivate::replaceComponents(const Replacements& replacements) { url_canon::RawCanonOutputT<char> output; url_parse::Parsed newParsed; m_isValid = url_util::ReplaceComponents(utf8String().data(), utf8String().length(), m_parsed, replacements, 0, &output, &newParsed); m_parsed = newParsed; if (m_parsed.ref.is_nonempty()) setUtf8(CString(output.data(), output.length())); else setAscii(CString(output.data(), output.length())); }
// Note: code mostly duplicated above. See FIXMEs and comments there. void KURLGooglePrivate::init(const KURL& base, const UChar* rel, int relLength, const TextEncoding* queryEncoding) { KURLCharsetConverter charsetConverterObject(queryEncoding); KURLCharsetConverter* charsetConverter = (!queryEncoding || isUnicodeEncoding(queryEncoding)) ? 0 : &charsetConverterObject; url_canon::RawCanonOutputT<char> output; const CString& baseStr = base.m_url.utf8String(); m_isValid = url_util::ResolveRelative(baseStr.data(), baseStr.length(), base.m_url.m_parsed, rel, relLength, charsetConverter, &output, &m_parsed); if (m_isValid || output.length()) { if (m_parsed.ref.is_nonempty()) setUtf8(CString(output.data(), output.length())); else setAscii(CString(output.data(), output.length())); } else setUtf8(CString("", 0)); }
bool QsciEditor::loadFile( QString filename) { /* Load the file */ mFilePath = QString( filename ); QFileInfo info( filename ); /* Check if we have a file */ if ( not info.isFile() ) return false; /* Check if we can open a file */ QFile file( filename ); if ( not file.open( QFile::ReadOnly ) ) return false; /* Set the Lexer */ setAutoLexer(); /* We will use a UTF8 charset */ setUtf8( true ); /* Set cursor busy */ QApplication::setOverrideCursor( Qt::WaitCursor ); /* Load the file into the editor */ while ( not file.atEnd() ) append( QString::fromLocal8Bit( file.read( 8192 ) ).replace( "\r\n", "\n" ) ); /* Restore cursor and close file */ QApplication::restoreOverrideCursor(); file.close(); /* Set editor as readonly if we dont have write permissions */ if ( not info.isWritable() ) setReadOnly( true ); /* Focus the editor */ setFocus(); /* Start the 1m Autosave timer */ autoSaveTimer->start( 60000, this ); /* Set the editor as not modified */ setModified( false ); return true; };
DocumentEditor::DocumentEditor(DocumentEditor* document_, QWidget *parent_) : ScintillaExt(parent_), _watcher(document_->_watcher) { _notified = true; //codec setUtf8(true); _codec = document_->_codec; _bomMode = document_->_bomMode; _hasBom = document_->_hasBom; _charsetAutoDetect = document_->_charsetAutoDetect; //document info _autoDetectEol = document_->_autoDetectEol; _autoDetectIndent = document_->_autoDetectIndent; _isNew = document_->isNew(); _fullPath = document_->getFullPath(); setDocument(document_->document()); _clone = document_; _isCloned = true; document_->_clone = this; document_->_isCloned = true; QsciLexer* l = document_->lexer(); if(l != 0) { QString lexLang = l->language(); QsciLexer* newLex = LexerManager::getInstance().lexerFactory(lexLang, this); if(newLex == 0) { //could not find the lexer newLex = LexerManager::getInstance().getAutoLexer(this); } setLexer(newLex); } //macro _macro = new QsciMacro(this); //load settings Settings settings; settings.applyToDocument(this); markerDefine(QPixmap(":/images/ledblue.png").scaled(40,16, Qt::KeepAspectRatio, Qt::SmoothTransformation), MARKER_BOOK); //connection connect(this, SIGNAL(marginClicked(int,int, Qt::KeyboardModifiers)), this, SLOT(toggleBookmark(int,int, Qt::KeyboardModifiers))); }
pEditor::pEditor( QWidget* p ) : QsciScintilla( p ) { const QSize mPixSize = QSize( 16, 16 ); // register image for bookmarks markerDefine( QPixmap( ":/editor/bookmark.png" ).scaled( mPixSize ), mdBookmark ); // deal with utf8 setUtf8( true ); // connection connect( this, SIGNAL( linesChanged() ), this, SLOT( linesChanged() ) ); connect( this, SIGNAL( copyAvailable( bool ) ), this, SLOT( setCopyAvailable( bool ) ) ); connect( this, SIGNAL( cursorPositionChanged( int, int ) ), this, SLOT( cursorPositionChanged( int, int ) ) ); connect( this, SIGNAL( textChanged() ), this, SLOT( textChanged() ) ); connect( QApplication::clipboard(), SIGNAL( dataChanged() ), this, SLOT( clipboardDataChanged() ) ); // init pasteAvailable if ( !mPasteAvailableInit ) { mPasteAvailableInit = true; mPasteAvailable = !QApplication::clipboard()->text().isEmpty(); } // init qscishortcutsmanager if needed standardCommands()->clearKeys(); standardCommands()->clearAlternateKeys(); SendScintilla( QsciScintillaBase::SCI_ASSIGNCMDKEY, SCK_TAB, SCI_TAB); SendScintilla( QsciScintillaBase::SCI_ASSIGNCMDKEY, SCK_ESCAPE, SCI_CANCEL); SendScintilla( QsciScintillaBase::SCI_ASSIGNCMDKEY, SCK_RETURN, SCI_NEWLINE); SendScintilla( QsciScintillaBase::SCI_ASSIGNCMDKEY, SCK_DOWN, SCI_LINEDOWN); SendScintilla( QsciScintillaBase::SCI_ASSIGNCMDKEY, SCK_UP, SCI_LINEUP); SendScintilla( QsciScintillaBase::SCI_ASSIGNCMDKEY, SCK_RIGHT, SCI_CHARRIGHT); SendScintilla( QsciScintillaBase::SCI_ASSIGNCMDKEY, SCK_LEFT, SCI_CHARLEFT); SendScintilla( QsciScintillaBase::SCI_ASSIGNCMDKEY, SCK_BACK, SCI_DELETEBACK); SendScintilla( QsciScintillaBase::SCI_ASSIGNCMDKEY, SCK_PRIOR, SCI_PAGEUP); SendScintilla( QsciScintillaBase::SCI_ASSIGNCMDKEY, SCK_NEXT, SCI_PAGEDOWN); SendScintilla( QsciScintillaBase::SCI_ASSIGNCMDKEY, SCK_HOME, SCI_VCHOME); SendScintilla( QsciScintillaBase::SCI_ASSIGNCMDKEY, SCK_END, SCI_LINEEND); // Create shortcuts manager, if not created qSciShortcutsManager::instance(); }
void chanEditorWidget::init(){ m_action = new QAction(this); m_action->setCheckable(true); connect(m_action, SIGNAL(triggered()), this, SLOT(show())); connect(m_action, SIGNAL(triggered()), this, SLOT(setFocus())); connect(this, SIGNAL(textChanged()), this, SLOT(documentWasModified())); QsciLexerCPP* lexer = new QsciLexerCPP(this); setLexer(lexer); //设置边框行号 setMarginLineNumbers(1, true); //精确的括号匹配 setBraceMatching(QsciScintilla::BraceMatch::StrictBraceMatch); //设置折叠 setFolding(QsciScintilla::FoldStyle::CircledTreeFoldStyle); //设置自动填充有效 setAutoCompletionFillupsEnabled(true); //所有可能的来源 setAutoCompletionSource(QsciScintilla::AcsAll); //补字符号 setCaretLineVisible(true); setAutoIndent(true); setUtf8(true); setWhitespaceVisibility(QsciScintilla::WsVisible); setAttribute(Qt::WA_DeleteOnClose); }
void QgsCodeEditor::setSciWidget() { setUtf8( true ); setCaretLineVisible( true ); setCaretLineBackgroundColor( QColor( "#fcf3ed" ) ); setBraceMatching( QsciScintilla::SloppyBraceMatch ); setMatchedBraceBackgroundColor( QColor( "#b7f907" ) ); // whether margin will be shown setMarginVisible( mMargin ); // whether margin will be shown setFoldingVisible( mFolding ); // indentation setAutoIndent( true ); setIndentationWidth( 4 ); setTabIndents( true ); setBackspaceUnindents( true ); setTabWidth( 4 ); // autocomplete setAutoCompletionThreshold( 2 ); setAutoCompletionSource( QsciScintilla::AcsAPIs ); }
FastoScintilla::FastoScintilla(QWidget* parent) : QsciScintilla(parent), lineNumberMarginWidth_(0), showAutoCompletion_(false) { setAutoIndent(true); setIndentationsUseTabs(false); setIndentationWidth(indentationWidth); setUtf8(true); setMarginWidth(1, 0); setCaretForegroundColor(caretForegroundColor); setMatchedBraceForegroundColor(matchedBraceForegroundColor); setMatchedBraceBackgroundColor(matchedBraceBackgroundColor); setSelectionBackgroundColor(selectionBackgroundColor); setSelectionForegroundColor(selectionForegroundColor); setContentsMargins(0, 0, 0, 0); setViewportMargins(3, 3, 3, 3); setMarginLineNumbers(0, true); // Margins colors // line numbers margin setMarginsBackgroundColor(marginsBackgroundColor); setMarginsForegroundColor(marginsForegroundColor); SendScintilla(QsciScintilla::SCI_SETHSCROLLBAR, 0); setWrapMode(QsciScintilla::WrapNone); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); VERIFY(connect(this, &FastoScintilla::linesChanged, this, &FastoScintilla::updateLineNumbersMarginWidth)); setAutoCompletionThreshold(1); setAutoCompletionCaseSensitivity(false); setAutoCompletionSource(QsciScintilla::AcsNone); }
SonicPiScintilla::SonicPiScintilla(SonicPiLexer *lexer, SonicPiTheme *theme) : QsciScintilla() { this->theme = theme; standardCommands()->clearKeys(); standardCommands()->clearAlternateKeys(); QString skey; QSettings settings("sonic-pi.net", "Key bindings"); #if defined(Q_OS_MAC) int SPi_CTRL = Qt::META; int SPi_META = Qt::CTRL; #else int SPi_CTRL = Qt::CTRL; int SPi_META = Qt::ALT; #endif // basic navigation addKeyBinding(settings, QsciCommand::PageDown, Qt::Key_PageDown); addKeyBinding(settings, QsciCommand::PageUp, Qt::Key_PageUp); addKeyBinding(settings, QsciCommand::LineDown, Qt::Key_N | SPi_CTRL); addOtherKeyBinding(settings, QsciCommand::LineDown, Qt::Key_Down); addKeyBinding(settings, QsciCommand::LineDownExtend, Qt::Key_Down | Qt::SHIFT); addKeyBinding(settings, QsciCommand::LineUp, Qt::Key_P | SPi_CTRL); addOtherKeyBinding(settings, QsciCommand::LineUp, Qt::Key_Up); addKeyBinding(settings, QsciCommand::LineUpExtend, Qt::Key_Up | Qt::SHIFT); addKeyBinding(settings, QsciCommand::CharRight, Qt::Key_F | SPi_CTRL); addOtherKeyBinding(settings, QsciCommand::CharRight, Qt::Key_Right); addKeyBinding(settings, QsciCommand::CharRightExtend, Qt::Key_Right | Qt::SHIFT); addKeyBinding(settings, QsciCommand::WordRight, Qt::Key_F | SPi_META); addOtherKeyBinding(settings, QsciCommand::WordRight, Qt::Key_Right | SPi_CTRL); addKeyBinding(settings, QsciCommand::WordRightExtend, Qt::Key_Right | SPi_CTRL | Qt::SHIFT); addKeyBinding(settings, QsciCommand::CharLeft, Qt::Key_B | SPi_CTRL); addOtherKeyBinding(settings, QsciCommand::CharLeft, Qt::Key_Left); addKeyBinding(settings, QsciCommand::CharLeftExtend, Qt::Key_Left | Qt::SHIFT); addKeyBinding(settings, QsciCommand::WordLeft, Qt::Key_B | SPi_META); addOtherKeyBinding(settings, QsciCommand::WordLeft, Qt::Key_Left | SPi_CTRL); addKeyBinding(settings, QsciCommand::WordLeftExtend, Qt::Key_Left | SPi_CTRL | Qt::SHIFT); addKeyBinding(settings, QsciCommand::Delete, Qt::Key_D | SPi_CTRL); addOtherKeyBinding(settings, QsciCommand::Delete, Qt::Key_Delete); addKeyBinding(settings, QsciCommand::DeleteBack, Qt::Key_H | SPi_CTRL); addOtherKeyBinding(settings, QsciCommand::DeleteBack, Qt::Key_Backspace); addKeyBinding(settings, QsciCommand::Home, Qt::Key_A | SPi_CTRL); addKeyBinding(settings, QsciCommand::VCHome, Qt::Key_Home); addKeyBinding(settings, QsciCommand::VCHomeExtend, Qt::Key_Home | Qt::SHIFT); addKeyBinding(settings, QsciCommand::DocumentStart, Qt::Key_Home | SPi_CTRL); addKeyBinding(settings, QsciCommand::DocumentStartExtend, Qt::Key_Home | SPi_CTRL | Qt::SHIFT); addKeyBinding(settings, QsciCommand::LineEnd, Qt::Key_E | SPi_CTRL); addOtherKeyBinding(settings, QsciCommand::LineEnd, Qt::Key_End); addKeyBinding(settings, QsciCommand::LineEndExtend, Qt::Key_End | Qt::SHIFT); addKeyBinding(settings, QsciCommand::DocumentEnd, Qt::Key_End | SPi_CTRL); addKeyBinding(settings, QsciCommand::DocumentEndExtend, Qt::Key_End | SPi_CTRL | Qt::SHIFT); addKeyBinding(settings, QsciCommand::Delete, Qt::Key_D | SPi_CTRL); addKeyBinding(settings, QsciCommand::VerticalCentreCaret, Qt::Key_L | SPi_CTRL); // tab return addKeyBinding(settings, QsciCommand::Newline, Qt::Key_Return); addKeyBinding(settings, QsciCommand::Backtab, Qt::Key_Tab | Qt::SHIFT); // copy paste addKeyBinding(settings, QsciCommand::SelectionCopy, Qt::Key_C | SPi_META); addOtherKeyBinding(settings, QsciCommand::SelectionCopy, Qt::Key_C | SPi_CTRL); addKeyBinding(settings, QsciCommand::SelectionCut, Qt::Key_X | SPi_META); addOtherKeyBinding(settings, QsciCommand::SelectionCut, Qt::Key_X | SPi_CTRL); addKeyBinding(settings, QsciCommand::Paste, Qt::Key_V | SPi_META); addOtherKeyBinding(settings, QsciCommand::Paste, Qt::Key_Y | SPi_CTRL); addKeyBinding(settings, QsciCommand::Undo, Qt::Key_Z | SPi_META); addOtherKeyBinding(settings, QsciCommand::Undo, Qt::Key_Z | SPi_CTRL); addKeyBinding(settings, QsciCommand::Redo, Qt::Key_Z | Qt::SHIFT | SPi_META); addOtherKeyBinding(settings, QsciCommand::Redo, Qt::Key_Z | Qt::SHIFT | SPi_CTRL); addKeyBinding(settings, QsciCommand::SelectAll, Qt::Key_A | SPi_META); // delete word left and right addKeyBinding(settings, QsciCommand::DeleteWordLeft, Qt::Key_Backslash | SPi_META); addKeyBinding(settings, QsciCommand::DeleteWordLeft, Qt::Key_Backspace | SPi_META); addKeyBinding(settings, QsciCommand::DeleteWordRight, Qt::Key_D | SPi_META); standardCommands()->readSettings(settings); this->setMatchedBraceBackgroundColor(theme->color("MatchedBraceBackground")); this->setMatchedBraceForegroundColor(theme->color("MatchedBraceForeground")); setIndentationWidth(2); setIndentationGuides(true); setIndentationGuidesForegroundColor(theme->color("IndentationGuidesForeground")); setBraceMatching( SonicPiScintilla::SloppyBraceMatch); //TODO: add preference toggle for this: //this->setFolding(SonicPiScintilla::CircledTreeFoldStyle, 2); setCaretLineVisible(true); setCaretLineBackgroundColor(theme->color("CaretLineBackground")); setFoldMarginColors(theme->color("FoldMarginForeground"),theme->color("FoldMarginForeground")); setMarginLineNumbers(0, true); setMarginsBackgroundColor(theme->color("MarginBackground")); setMarginsForegroundColor(theme->color("MarginForeground")); setMarginsFont(QFont("Menlo", 15, -1, true)); setUtf8(true); setText("#loading..."); setLexer((QsciLexer *)lexer); markerDefine(RightArrow, 8); setMarkerBackgroundColor("deeppink", 8); setAutoCompletionThreshold(1); setAutoCompletionSource(SonicPiScintilla::AcsAPIs); setAutoCompletionCaseSensitivity(false); setSelectionBackgroundColor(theme->color("SelectionBackground")); setSelectionForegroundColor(theme->color("SelectionForeground")); setCaretWidth(5); setCaretForegroundColor(theme->color("CaretForeground")); setEolMode(EolUnix); SendScintilla(SCI_SETWORDCHARS, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:_?!"); }