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(); }
void KWBuffer::slotLoadFile() { loadFilePart(); // emit linesChanged(m_totalLines); emit linesChanged(20); }
void ConsoleModel::setLines(QString lines) { beginResetModel(); m_lines = lines.split(QRegExp("[\n\r]")); endResetModel(); emit linesChanged(); }
/* ** Configure QsciScintilla query widget */ void ScriptWidget::_configureQueryText() { QsciLexerJavaScript *javaScriptLexer = new JSLexer(this); javaScriptLexer->setFont(_textFont); _queryText->setFixedHeight(23); _queryText->setAutoIndent(true); _queryText->setIndentationsUseTabs(false); _queryText->setIndentationWidth(4); _queryText->setUtf8(true); _queryText->installEventFilter(this); _queryText->setMarginWidth(1, 0); // to hide left gray column _queryText->setBraceMatching(QsciScintilla::StrictBraceMatch); _queryText->setFont(_textFont); _queryText->setPaper(QColor(255, 0, 0, 127)); _queryText->setLexer(javaScriptLexer); _queryText->setCaretForegroundColor(QColor("#FFFFFF")); _queryText->setMatchedBraceBackgroundColor(QColor(73, 76, 78)); _queryText->setMatchedBraceForegroundColor(QColor("#FF8861")); //1AB0A6 _queryText->setWrapMode((QsciScintilla::WrapMode)QsciScintilla::SC_WRAP_NONE); _queryText->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); _queryText->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); //_queryText->SendScintilla(QsciScintilla::SCI_SETFONTQUALITY, QsciScintilla::SC_EFF_QUALITY_LCD_OPTIMIZED); //_queryText->SendScintilla (QsciScintillaBase::SCI_SETKEYWORDS, "db"); _queryText->setStyleSheet("QFrame { background-color: rgb(73, 76, 78); border: 1px solid #c7c5c4; border-radius: 4px; margin: 0px; padding: 0px;}"); connect(_queryText, SIGNAL(linesChanged()), SLOT(ui_queryLinesCountChanged())); connect(_queryText, SIGNAL(textChanged()), SLOT(onTextChanged())); connect(_queryText, SIGNAL(cursorPositionChanged(int,int)), SLOT(onCursorPositionChanged(int,int))); }
void ULLineEditor::init ( double base, double right ) { // if(initControl) // clear(); m_baseLine = base; // m_marginLeft = left; m_marginRight = right; if ( ltr ) { m_curPpos = 0.0; } else { m_curPpos = right; } lineBase = addLine ( QLineF ( 0.0,m_baseLine,m_marginRight,m_baseLine ) ); lineBase->setEnabled ( false ); lineLeft = addLine ( QLineF ( 0.0,0.0,0.0,m_baseLine ) ); lineLeft->setEnabled ( false ); lineRight = addLine ( QLineF ( m_marginRight,0.0,m_marginRight,m_baseLine ) ); lineRight->setEnabled ( false ); lineCursor = addLine ( QLineF ( m_curPpos,0.0,m_curPpos,m_baseLine ) ); lineCursor->setEnabled ( false ); lineCursor->setPen ( QPen ( Qt::blue ) ); initControl = true; emit linesChanged ( m_baseLine,m_marginRight,m_curPpos ); }
QPlasmaTextDoc::QPlasmaTextDoc(QWidget* parent) : QPlasmaDocument(kDocText, parent), fSyntax(kStxNone), fEncoding(kTypeAnsi), fLexersInited(false) { memset(fDroidKey, 0, sizeof(fDroidKey)); fEditor = new QsciScintilla(this); fEditor->setEolMode(QsciScintilla::EolWindows); // Because it's what Plasma uses fEditor->setUtf8(true); fEditor->SendScintilla(QsciScintillaBase::SCI_SETENDATLASTLINE, 0); fEditor->SendScintilla(QsciScintillaBase::SCI_SETSCROLLWIDTHTRACKING, 1); fEditor->SendScintilla(QsciScintillaBase::SCI_SETSCROLLWIDTH, 1000); QGridLayout* layout = new QGridLayout(this); layout->setContentsMargins(4, 4, 4, 4); layout->addWidget(fEditor, 0, 0); setLayout(layout); // Initialize the editor settings, fonts, etc updateSettings(); connect(fEditor, SIGNAL(linesChanged()), this, SLOT(adjustLineNumbers())); connect(fEditor, SIGNAL(SCN_SAVEPOINTLEFT()), this, SLOT(makeDirty())); connect(fEditor, SIGNAL(SCN_SAVEPOINTREACHED()), this, SLOT(maybeClean())); connect(fEditor, SIGNAL(selectionChanged()), this, SIGNAL(statusChanged())); connect(fEditor, SIGNAL(textChanged()), this, SIGNAL(statusChanged())); }
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 ConsoleModel::setLines(QStringList lines) { if (m_lines == lines) return; beginResetModel(); m_lines = lines; endResetModel(); emit linesChanged(); }
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 ULLineEditor::adjust() { clear(); lineBase = addLine ( QLineF ( 0.0,m_baseLine,m_marginRight,m_baseLine ) ); lineBase->setEnabled ( false ); lineLeft = addLine ( QLineF ( 0.0,0.0,0.0,m_baseLine ) ); lineLeft->setEnabled ( false ); lineRight = addLine ( QLineF ( m_marginRight,0.0,m_marginRight,m_baseLine ) ); lineRight->setEnabled ( false ); lineCursor = addLine ( QLineF ( m_curPpos,0.0,m_curPpos,m_baseLine ) ); lineCursor->setEnabled ( false ); lineCursor->setPen ( QPen ( Qt::blue ) ); emit linesChanged ( m_baseLine,m_marginRight,m_curPpos ); }
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()))); }
CodeEditor::CodeEditor(Toolchain* t, QString filename, QWidget* parent): QsciScintilla(parent) { loading = false; highlighter = 0; connect(this, SIGNAL(textChanged()), this, SLOT(updateFileName())); connect(this, SIGNAL(linesChanged()), this, SLOT(updateLineNumberMarginWidth())); fileName = filename; // FIXME: Remove this; this just makes it so Ctrl-S doesn't ask for a filename. path = filename; toolchain = t; dirty = false; setHighlighter(); setupEditor(); setupMargins(); setupSignals(); readFile(filename); }
foreach(int line, breakpoints){ toggleBreakpoint(line-1); } } // Connections connect(this, SIGNAL(checkReloadContent()), SLOT(on_check_reload_content()), Qt::QueuedConnection); connect(this, SIGNAL(textChanged()), SLOT(on_text_changed())); connect(this, SIGNAL(asyncRemoveChangeFlag()), SLOT(removeChangedFlag()), Qt::QueuedConnection); // Breakpoint connect(this, SIGNAL(marginClicked(int,int,Qt::KeyboardModifiers)), SLOT(on_margin_clicked(int,int,Qt::KeyboardModifiers))); connect(this, SIGNAL(addBreakpoint(QString,int)), HilecSingleton::hilec(), SLOT(addBreakpoint(QString,int))); connect(this, SIGNAL(removeBreakpoint(QString,int)), HilecSingleton::hilec(), SLOT(removeBreakpoint(QString,int))); connect(this, SIGNAL(linesChanged()), SLOT(updateMargins())); // Compile error connect(HilecSingleton::hilec(), SIGNAL(compileError(ScriptCompileInfo)), SLOT(on_check_compile_error(ScriptCompileInfo))); // Keyboard Shortcurts new QShortcut(Qt::Key_F9, this, SLOT(toggleBreakpoint())); } void FileEditor::fileRenamed(const QString &newName) { foreach(int key, mBreakpointMarkers.keys()) { emit removeBreakpoint(mFilename, mBreakpointMarkers[key]+1); emit addBreakpoint(newName, mBreakpointMarkers[key]+1); }
/** * Make the object resize to margin to fit the contents with padding */ void ScriptEditor::setAutoMarginResize() { connect(this, SIGNAL(linesChanged()), this, SLOT(padMargin())); }
void pEditor::setLineNumbersMarginAutoWidth( bool b ) { setProperty( "LineNumbersMarginAutoWidth", b ); emit linesChanged(); }
void QsciEditor::setupActions() { cutAct = new QAction( QIcon::fromTheme( "edit-cut" ), "Cu&t", this ); cutAct->setStatusTip( "Cut the selected text" ); cutAct->setShortcut( tr( "Ctrl+X" ) ); copyAct = new QAction( QIcon::fromTheme( "edit-copy" ), "&Copy", this ); copyAct->setStatusTip( "Copy the selected text" ); copyAct->setShortcut( tr( "Ctrl+C" ) ); pasteAct = new QAction( QIcon::fromTheme( "edit-paste" ), "&Paste", this ); pasteAct->setStatusTip( "Paste the text on the clipboard" ); pasteAct->setShortcut( tr( "Ctrl+V" ) ); deleteAct = new QAction( QIcon::fromTheme( "edit-delete" ), "&Delete", this ); deleteAct->setStatusTip( "Delete the selected Text" ); deleteAct->setShortcut( tr( "Delete" ) ); selectAct = new QAction( QIcon::fromTheme( "edit-select-all" ), "Select &All", this ); selectAct->setStatusTip( "Select all the text" ); selectAct->setShortcut( tr( "Ctrl+A" ) ); deselectAct = new QAction( QIcon(), "Deselect &All", this ); deselectAct->setStatusTip( "Deselect all the text" ); deselectAct->setShortcut( tr( "Ctrl+Shift+A" ) ); undoAct = new QAction( QIcon::fromTheme( "edit-undo" ), "&Undo", this ); undoAct->setStatusTip( "Undo the last change" ); undoAct->setShortcut( tr( "Ctrl+Z" ) ); redoAct = new QAction( QIcon::fromTheme( "edit-redo" ), "&Redo", this ); redoAct->setStatusTip( "Redo the undone change" ); redoAct->setShortcut( tr( "Ctrl+Y" ) ); searchAct = new QAction( QIcon::fromTheme( "edit-find" ), "&Search", this ); searchAct->setStatusTip( "Search the document" ); searchAct->setShortcut( tr( "Ctrl+F" ) ); replaceAct = new QAction( QIcon::fromTheme( "edit-find-replace" ), "&Replace", this ); replaceAct->setStatusTip( "Replace text in the document" ); replaceAct->setShortcut( tr( "Ctrl+R" ) ); changeFontAct = new QAction( QIcon::fromTheme( "preferences-desktop-font" ), "Change &Font", this ); changeFontAct->setStatusTip( "Change the font of the document" ); changeFontAct->setShortcut( tr( "Ctrl+Shift+F" ) ); toggleCaseAct = new QAction( "T&oggle Case of Selection", this ); toggleCaseAct->setStatusTip( "Toggle the case of the selected text" ); toggleCaseAct->setShortcut( tr( "Ctrl+Alt+U" ) ); connect( this, SIGNAL( customContextMenuRequested( const QPoint& ) ), this, SLOT( showCustomMenu( const QPoint& ) ) ); connect( cutAct, SIGNAL( triggered() ), this, SLOT( cutAction() ) ); connect( copyAct, SIGNAL( triggered() ), this, SLOT( copyAction() ) ); connect( pasteAct, SIGNAL( triggered() ), this, SLOT( pasteAction() ) ); connect( deleteAct, SIGNAL( triggered() ), this, SLOT( deleteAction() ) ); connect( undoAct, SIGNAL( triggered() ), this, SLOT( undoAction() ) ); connect( redoAct, SIGNAL( triggered() ), this, SLOT( redoAction() ) ); connect( selectAct, SIGNAL( triggered() ), this, SLOT( selectAction() ) ); connect( deselectAct, SIGNAL( triggered() ), this, SLOT( deselectAction() ) ); connect( changeFontAct, SIGNAL( triggered() ), this, SLOT( changeFont() ) ); connect( toggleCaseAct, SIGNAL( triggered() ), this, SLOT( toggleCase() ) ); connect( searchAct, SIGNAL( triggered() ), this, SLOT( showSearch() ) ); connect( this, SIGNAL( linesChanged() ), this, SLOT( resizeMargins() ) ); addAction( cutAct ); addAction( copyAct ); addAction( pasteAct ); addAction( deleteAct ); addAction( selectAct ); addAction( deselectAct ); addAction( undoAct ); addAction( redoAct ); addAction( searchAct ); addAction( replaceAct ); addAction( changeFontAct ); addAction( toggleCaseAct ); /* Change keyBindings */ SendScintilla( SCI_ASSIGNCMDKEY, SCK_DOWN + ( SCMOD_CTRL << 16 ), SCI_PARADOWN ); SendScintilla( SCI_ASSIGNCMDKEY, SCK_UP + ( SCMOD_CTRL << 16 ), SCI_PARAUP ); SendScintilla( SCI_ASSIGNCMDKEY, SCK_DOWN + ( SCMOD_ALT << 16 ), SCI_LINESCROLLDOWN ); SendScintilla( SCI_ASSIGNCMDKEY, SCK_UP + ( SCMOD_ALT << 16 ), SCI_LINESCROLLUP ); /* Remove Ctrl+D as duplicate line */ SendScintilla( SCI_CLEARCMDKEY, 68 + ( SCMOD_CTRL << 16 ) ); };
QPixmap markerPixmap(const QColor& color, const QColor& bgColor) { // create unique string-name for color combinations QString cacheName(color.name()+bgColor.name()); QPixmap px(16, 16); // The method signature was changed: it's // bool QPixmapCache::find ( const QString & key, QPixmap & pm ) in Qt <= 4.5 // and // bool QPixmapCache::find ( const QString & key, QPixmap * pm ) in Qt >= 4.6 #if QT_VERSION >= 0x040600 if ( QPixmapCache::find(cacheName, &px) ) { #else if ( QPixmapCache::find(cacheName, px) ) { #endif return px; } px.fill(bgColor); QPainter p(&px); // As we are using pixmap cache for most pixmap access // we can use more resource and time consuming rendering // to get better results (smooth rounded bullet in this case). // Remember: painting is performed only once per running juffed // in the ideal case. p.setRenderHint(QPainter::Antialiasing); int red = color.red(); int green = color.green(); int blue = color.blue(); QColor light(red + (255 - red) / 2, green + (255 - green) / 2, blue + (255 - blue) / 2); QColor dark(red / 2, green / 2, blue / 2); QRadialGradient gr(0.4, 0.4, 0.5, 0.4, 0.4); gr.setCoordinateMode(QGradient::ObjectBoundingMode); gr.setColorAt(0, light); gr.setColorAt(1, dark); p.setPen(dark); p.setBrush(gr); p.drawEllipse(1, 1, 14, 14); p.end(); QPixmapCache::insert(cacheName, px); return px; } class SciDoc::Interior { public: Interior(QWidget* w) { // LOGGER; curEdit_ = NULL; spl_ = new QSplitter(Qt::Vertical); QVBoxLayout* vBox = new QVBoxLayout(); vBox->setContentsMargins(0, 0, 0, 0); vBox->addWidget(spl_); w->setLayout(vBox); edit1_ = createEdit(); edit2_ = createEdit(); spl_->addWidget(edit1_); spl_->addWidget(edit2_); edit1_->setDocument(edit2_->document()); w->setFocusProxy(spl_); spl_->setSizes(QList<int>() << 0 << spl_->height()); hlTimer_ = new QTimer( w ); hlTimer_->setSingleShot( true ); connect(hlTimer_, SIGNAL(timeout()), w, SLOT(highlightWord())); } JuffScintilla* createEdit() { // LOGGER; JuffScintilla* edit = new JuffScintilla(); edit->setFocusPolicy(Qt::ClickFocus); edit->setUtf8(true); edit->setFolding(QsciScintilla::BoxedTreeFoldStyle); edit->setAutoIndent(true); edit->setBraceMatching(QsciScintilla::SloppyBraceMatch); // margins edit->setMarginLineNumbers(0, false); edit->setMarginLineNumbers(1, true); edit->setMarginSensitivity(0, true); edit->setMarginWidth(0, 20); edit->setMarginWidth(2, 12); // markers edit->markerDefine(QsciScintilla::Background, 2); // Set the 0th margin accept markers numbered 1 and 2 // Binary mask for markers 1 and 2 is 00000110 ( == 6 ) edit->setMarginMarkerMask(0, 6); edit->setMarginMarkerMask(1, 0); return edit; } void setCurrentEdit(JuffScintilla* edit) { // LOGGER; curEdit_ = edit; spl_->setFocusProxy(edit); } JuffScintilla* edit1_; JuffScintilla* edit2_; JuffScintilla* curEdit_; QString syntax_; QSplitter* spl_; QTimer* hlTimer_; }; SciDoc::SciDoc(const QString& fileName) : Juff::Document(fileName) { // LOGGER; int_ = new Interior(this); JuffScintilla* edits[] = { int_->edit1_, int_->edit2_ }; for ( int i = 0; i < 2; ++i) { JuffScintilla* edit = edits[i]; connect(edit, SIGNAL(cursorPositionChanged(int, int)), this, SLOT(onCursorMoved(int, int))); // connect(int_->edit1_, SIGNAL(contextMenuCalled(int, int)), this, SIGNAL(contextMenuCalled(int, int))); connect(edit, SIGNAL(marginClicked(int, int, Qt::KeyboardModifiers)), SLOT(onMarginClicked(int, int, Qt::KeyboardModifiers))); connect(edit, SIGNAL(focusReceived()), SLOT(onEditFocused())); connect(edit, SIGNAL(markersMenuRequested(const QPoint&)), SIGNAL(markersMenuRequested(const QPoint&))); connect(edit, SIGNAL(escapePressed()), SIGNAL(escapePressed())); } connect(int_->edit1_, SIGNAL(modificationChanged(bool)), this, SIGNAL(modified(bool))); connect(int_->edit1_, SIGNAL(linesChanged()), SLOT(onLineCountChanged())); connect(int_->edit1_, SIGNAL(textChanged()), this, SIGNAL(textChanged())); QString lexName = "none"; SciDoc::Eol eol = guessEol(fileName); std::pair<bool,int> indentation = guessIndentation(fileName); if ( !fileName.isEmpty() && !isNoname() ) { QString codecName = Document::guessCharset(fileName); if ( !codecName.isEmpty() ) setCharset(codecName); readFile(); setEol(eol); setIndentationsUseTabs(indentation.first); setTabWidth(indentation.second); int_->edit1_->setModified(false); // syntax highlighting lexName = LexerStorage::instance()->lexerName(fileName); } else { setEol(eol); setIndentationsUseTabs(indentation.first); setTabWidth(indentation.second); } setLexer(lexName); applySettings(); QAction* hlWordAct = new QAction("", this); hlWordAct->setShortcut(QKeySequence("Ctrl+H")); connect(hlWordAct, SIGNAL(triggered()), SLOT(highlightWord())); addAction(hlWordAct); } /*SciDoc::SciDoc(Juff::Document* doc) : Juff::Document(doc) { SciDoc* d = qobject_cast<SciDoc*>(doc); if ( d != 0 ) { int_->edit1_->setDocument(d->int_->edit1_->document()); int_->edit2_->setDocument(d->int_->edit2_->document()); } }*/ SciDoc::~SciDoc() { delete int_; } QString SciDoc::type() const { return "QSci"; } bool SciDoc::supportsAction(Juff::ActionID id) const { switch (id) { case Juff::FileClone : return true; default : return Juff::Document::supportsAction(id); } } /*Juff::Document* SciDoc::createClone() { if ( hasClone() ) return NULL; else return new SciDoc(this); } void SciDoc::updateClone() { LOGGER; // SciDoc* cln = qobject_cast<SciDoc*>(clone()); // if ( cln != 0 ) { // if ( cln->int_->syntax_ != int_->syntax_ ) { // cln->int_->syntax_ = int_->syntax_; // QsciLexer* lexer = LexerStorage::instance()->lexer(int_->syntax_); // cln->int_->edit1_->setLexer(lexer); // cln->int_->edit2_->setLexer(lexer); // } // } Juff::Document::updateClone(); }*/ void SciDoc::init() { int_->setCurrentEdit(int_->edit2_); }