mirror of https://github.com/vitalif/openscad
indentation
parent
138d5bc57e
commit
c59d3aef79
49
src/editor.h
49
src/editor.h
|
@ -14,42 +14,41 @@ class EditorInterface : public QWidget
|
|||
public:
|
||||
EditorInterface(QWidget *parent);
|
||||
~EditorInterface();
|
||||
virtual QSize sizeHint(){ QSize size; return size;}
|
||||
virtual void setInitialSizeHint(const QSize&) { }
|
||||
virtual QSize sizeHint(){ QSize size; return size;}
|
||||
virtual void setInitialSizeHint(const QSize&) { }
|
||||
virtual void wheelEvent (QWheelEvent*) { }
|
||||
virtual void setTabStopWidth(int) { }
|
||||
virtual QString toPlainText() { QString s; return s;}
|
||||
virtual QTextCursor textCursor() { QTextCursor c; return c;}
|
||||
virtual void setTextCursor (const QTextCursor &) { }
|
||||
virtual QTextDocument *document(){QTextDocument *t = new QTextDocument; return t;}
|
||||
virtual void setTabStopWidth(int) { }
|
||||
virtual QString toPlainText() { QString s; return s;}
|
||||
virtual QTextCursor textCursor() { QTextCursor c; return c;}
|
||||
virtual void setTextCursor (const QTextCursor &) { }
|
||||
virtual QTextDocument *document(){QTextDocument *t = new QTextDocument; return t;}
|
||||
virtual bool find(const QString &, bool findNext = false, bool findBackwards = false) = 0;
|
||||
virtual void replaceSelectedText(QString&){ }
|
||||
|
||||
public slots:
|
||||
virtual void zoomIn(){ }
|
||||
virtual void zoomOut() { }
|
||||
virtual void setLineWrapping(bool) { }
|
||||
virtual void setContentModified(bool){ }
|
||||
virtual bool isContentModified(){ return 0; }
|
||||
virtual void indentSelection(){ }
|
||||
virtual void unindentSelection(){ }
|
||||
virtual void commentSelection() {}
|
||||
virtual void uncommentSelection(){}
|
||||
virtual void setPlainText(const QString &){ }
|
||||
virtual void highlightError(int) {}
|
||||
virtual void unhighlightLastError() {}
|
||||
virtual void setHighlightScheme(const QString&){ }
|
||||
virtual void zoomOut() { }
|
||||
virtual void setLineWrapping(bool) { }
|
||||
virtual void setContentModified(bool){ }
|
||||
virtual bool isContentModified(){ return 0; }
|
||||
virtual void indentSelection(){ }
|
||||
virtual void unindentSelection(){ }
|
||||
virtual void commentSelection() {}
|
||||
virtual void uncommentSelection(){}
|
||||
virtual void setPlainText(const QString &){ }
|
||||
virtual void highlightError(int) {}
|
||||
virtual void unhighlightLastError() {}
|
||||
virtual void setHighlightScheme(const QString&){ }
|
||||
virtual void insertPlainText(const QString&){ }
|
||||
virtual void undo(){ }
|
||||
virtual void redo(){ }
|
||||
virtual void cut(){ }
|
||||
virtual void copy(){ }
|
||||
virtual void paste(){ }
|
||||
virtual void redo(){ }
|
||||
virtual void cut(){ }
|
||||
virtual void copy(){ }
|
||||
virtual void paste(){ }
|
||||
virtual void onTextChanged() { }
|
||||
virtual void initFont(const QString&, uint){ }
|
||||
|
||||
private:
|
||||
Highlighter *highlighter;
|
||||
Highlighter *highlighter;
|
||||
QSize initialSizeHint;
|
||||
|
||||
};
|
||||
|
|
|
@ -6,35 +6,35 @@
|
|||
|
||||
ScintillaEditor::ScintillaEditor(QWidget *parent) : EditorInterface(parent)
|
||||
{
|
||||
scintillaLayout = new QVBoxLayout(this);
|
||||
qsci = new QsciScintilla(this);
|
||||
scintillaLayout->setContentsMargins(0, 0, 0, 0);
|
||||
scintillaLayout->addWidget(qsci);
|
||||
qsci->setBraceMatching (QsciScintilla::SloppyBraceMatch);
|
||||
qsci->setWrapMode(QsciScintilla::WrapWord);
|
||||
qsci->setWrapVisualFlags(QsciScintilla::WrapFlagByText, QsciScintilla::WrapFlagByText, 0);
|
||||
qsci->setAutoIndent(true);
|
||||
qsci->indicatorDefine(QsciScintilla::RoundBoxIndicator, indicatorNumber);
|
||||
qsci->markerDefine(QsciScintilla::Circle, markerNumber);
|
||||
qsci->setUtf8(true);
|
||||
preferenceEditorOption = Preferences::inst()->getValue("editor/syntaxhighlight").toString();
|
||||
lexer = new ScadLexer(this);
|
||||
initLexer();
|
||||
initMargin();
|
||||
qsci->setFolding(QsciScintilla::BoxedTreeFoldStyle, 4);
|
||||
qsci->setCaretLineVisible(true);
|
||||
this->setHighlightScheme(preferenceEditorOption);
|
||||
scintillaLayout = new QVBoxLayout(this);
|
||||
qsci = new QsciScintilla(this);
|
||||
scintillaLayout->setContentsMargins(0, 0, 0, 0);
|
||||
scintillaLayout->addWidget(qsci);
|
||||
qsci->setBraceMatching (QsciScintilla::SloppyBraceMatch);
|
||||
qsci->setWrapMode(QsciScintilla::WrapWord);
|
||||
qsci->setWrapVisualFlags(QsciScintilla::WrapFlagByText, QsciScintilla::WrapFlagByText, 0);
|
||||
qsci->setAutoIndent(true);
|
||||
qsci->indicatorDefine(QsciScintilla::RoundBoxIndicator, indicatorNumber);
|
||||
qsci->markerDefine(QsciScintilla::Circle, markerNumber);
|
||||
qsci->setUtf8(true);
|
||||
preferenceEditorOption = Preferences::inst()->getValue("editor/syntaxhighlight").toString();
|
||||
lexer = new ScadLexer(this);
|
||||
initLexer();
|
||||
initMargin();
|
||||
qsci->setFolding(QsciScintilla::BoxedTreeFoldStyle, 4);
|
||||
qsci->setCaretLineVisible(true);
|
||||
this->setHighlightScheme(preferenceEditorOption);
|
||||
|
||||
}
|
||||
|
||||
void ScintillaEditor::setPlainText(const QString &text)
|
||||
{
|
||||
qsci->setText(text);
|
||||
qsci->setText(text);
|
||||
}
|
||||
|
||||
QString ScintillaEditor::toPlainText()
|
||||
{
|
||||
return qsci->text();
|
||||
return qsci->text();
|
||||
}
|
||||
|
||||
bool ScintillaEditor::isContentModified()
|
||||
|
@ -44,196 +44,196 @@ bool ScintillaEditor::isContentModified()
|
|||
|
||||
void ScintillaEditor::highlightError(int error_pos)
|
||||
{
|
||||
int line, index;
|
||||
qsci->lineIndexFromPosition(error_pos, &line, &index);
|
||||
qsci->fillIndicatorRange(line, index, line, index+1, indicatorNumber);
|
||||
qsci->setIndicatorForegroundColor(QColor(255,0,0,100));
|
||||
qsci->markerAdd(line, markerNumber);
|
||||
int line, index;
|
||||
qsci->lineIndexFromPosition(error_pos, &line, &index);
|
||||
qsci->fillIndicatorRange(line, index, line, index+1, indicatorNumber);
|
||||
qsci->setIndicatorForegroundColor(QColor(255,0,0,100));
|
||||
qsci->markerAdd(line, markerNumber);
|
||||
}
|
||||
|
||||
void ScintillaEditor::unhighlightLastError()
|
||||
{
|
||||
int totalLength = qsci->text().length();
|
||||
int line, index;
|
||||
qsci->lineIndexFromPosition(totalLength, &line, &index);
|
||||
qsci->clearIndicatorRange(0, 0, line, index, indicatorNumber);
|
||||
qsci->markerDeleteAll(markerNumber);
|
||||
int totalLength = qsci->text().length();
|
||||
int line, index;
|
||||
qsci->lineIndexFromPosition(totalLength, &line, &index);
|
||||
qsci->clearIndicatorRange(0, 0, line, index, indicatorNumber);
|
||||
qsci->markerDeleteAll(markerNumber);
|
||||
}
|
||||
|
||||
//Editor themes
|
||||
void ScintillaEditor::forLightBackground()
|
||||
{
|
||||
lexer->setPaper("#fff");
|
||||
lexer->setColor(QColor("#272822")); // -> Style: Default text
|
||||
lexer->setColor(QColor("Green"), QsciLexerCPP::Keyword); // -> Style: Keyword
|
||||
lexer->setColor(QColor("Green"), QsciLexerCPP::KeywordSet2); // -> Style: KeywordSet2
|
||||
lexer->setColor(Qt::blue, QsciLexerCPP::CommentDocKeyword); // -> used in comments only like /*! \cube */
|
||||
lexer->setColor(QColor("DarkBlue"), QsciLexerCPP::GlobalClass); // -> Style: GlobalClass
|
||||
lexer->setColor(Qt::blue, QsciLexerCPP::Operator);
|
||||
lexer->setColor(Qt::darkMagenta, QsciLexerCPP::DoubleQuotedString);
|
||||
lexer->setColor(Qt::darkCyan, QsciLexerCPP::Comment);
|
||||
lexer->setColor(Qt::darkCyan, QsciLexerCPP::CommentLine);
|
||||
lexer->setColor(QColor("DarkRed"), QsciLexerCPP::Number);
|
||||
qsci->setMarkerBackgroundColor(QColor(255, 0, 0, 100), markerNumber);
|
||||
qsci->setCaretLineBackgroundColor(QColor("#ffe4e4"));
|
||||
qsci->setMarginsBackgroundColor(QColor("#ccc"));
|
||||
qsci->setMarginsForegroundColor(QColor("#111"));
|
||||
lexer->setPaper("#fff");
|
||||
lexer->setColor(QColor("#272822")); // -> Style: Default text
|
||||
lexer->setColor(QColor("Green"), QsciLexerCPP::Keyword); // -> Style: Keyword
|
||||
lexer->setColor(QColor("Green"), QsciLexerCPP::KeywordSet2); // -> Style: KeywordSet2
|
||||
lexer->setColor(Qt::blue, QsciLexerCPP::CommentDocKeyword); // -> used in comments only like /*! \cube */
|
||||
lexer->setColor(QColor("DarkBlue"), QsciLexerCPP::GlobalClass); // -> Style: GlobalClass
|
||||
lexer->setColor(Qt::blue, QsciLexerCPP::Operator);
|
||||
lexer->setColor(Qt::darkMagenta, QsciLexerCPP::DoubleQuotedString);
|
||||
lexer->setColor(Qt::darkCyan, QsciLexerCPP::Comment);
|
||||
lexer->setColor(Qt::darkCyan, QsciLexerCPP::CommentLine);
|
||||
lexer->setColor(QColor("DarkRed"), QsciLexerCPP::Number);
|
||||
qsci->setMarkerBackgroundColor(QColor(255, 0, 0, 100), markerNumber);
|
||||
qsci->setCaretLineBackgroundColor(QColor("#ffe4e4"));
|
||||
qsci->setMarginsBackgroundColor(QColor("#ccc"));
|
||||
qsci->setMarginsForegroundColor(QColor("#111"));
|
||||
}
|
||||
|
||||
void ScintillaEditor::forDarkBackground()
|
||||
{
|
||||
lexer->setPaper(QColor("#272822"));
|
||||
lexer->setColor(QColor(Qt::white));
|
||||
lexer->setColor(QColor("#f12971"), QsciLexerCPP::Keyword);
|
||||
lexer->setColor(QColor("#56dbf0"),QsciLexerCPP::KeywordSet2);
|
||||
lexer->setColor(QColor("#ccdf32"), QsciLexerCPP::CommentDocKeyword);
|
||||
lexer->setColor(QColor("#56d8f0"), QsciLexerCPP::GlobalClass);
|
||||
lexer->setColor(QColor("#d8d8d8"), QsciLexerCPP::Operator);
|
||||
lexer->setColor(QColor("#e6db74"), QsciLexerCPP::DoubleQuotedString);
|
||||
lexer->setColor(QColor("#e6db74"), QsciLexerCPP::CommentLine);
|
||||
lexer->setColor(QColor("#af7dff"), QsciLexerCPP::Number);
|
||||
qsci->setCaretLineBackgroundColor(QColor(104,225,104, 127));
|
||||
qsci->setMarkerBackgroundColor(QColor(255, 0, 0, 100), markerNumber);
|
||||
qsci->setMarginsBackgroundColor(QColor("20,20,20,150"));
|
||||
qsci->setMarginsForegroundColor(QColor("#fff"));
|
||||
lexer->setPaper(QColor("#272822"));
|
||||
lexer->setColor(QColor(Qt::white));
|
||||
lexer->setColor(QColor("#f12971"), QsciLexerCPP::Keyword);
|
||||
lexer->setColor(QColor("#56dbf0"),QsciLexerCPP::KeywordSet2);
|
||||
lexer->setColor(QColor("#ccdf32"), QsciLexerCPP::CommentDocKeyword);
|
||||
lexer->setColor(QColor("#56d8f0"), QsciLexerCPP::GlobalClass);
|
||||
lexer->setColor(QColor("#d8d8d8"), QsciLexerCPP::Operator);
|
||||
lexer->setColor(QColor("#e6db74"), QsciLexerCPP::DoubleQuotedString);
|
||||
lexer->setColor(QColor("#e6db74"), QsciLexerCPP::CommentLine);
|
||||
lexer->setColor(QColor("#af7dff"), QsciLexerCPP::Number);
|
||||
qsci->setCaretLineBackgroundColor(QColor(104,225,104, 127));
|
||||
qsci->setMarkerBackgroundColor(QColor(255, 0, 0, 100), markerNumber);
|
||||
qsci->setMarginsBackgroundColor(QColor("20,20,20,150"));
|
||||
qsci->setMarginsForegroundColor(QColor("#fff"));
|
||||
|
||||
}
|
||||
|
||||
void ScintillaEditor::Monokai()
|
||||
{
|
||||
lexer->setPaper("#272822");
|
||||
lexer->setColor(QColor("#f8f8f2")); // -> Style: Default text
|
||||
lexer->setColor(QColor("#66c3b3"), QsciLexerCPP::Keyword); // -> Style: Keyword
|
||||
lexer->setColor(QColor("#79abff"), QsciLexerCPP::KeywordSet2); // -> Style: KeywordSet2
|
||||
lexer->setColor(QColor("#ccdf32"), QsciLexerCPP::CommentDocKeyword); // -> used in comments only like /*! \cube */
|
||||
lexer->setColor(QColor("#ffffff"), QsciLexerCPP::GlobalClass); // -> Style: GlobalClass
|
||||
lexer->setColor(QColor("#d8d8d8"), QsciLexerCPP::Operator);
|
||||
lexer->setColor(QColor("#e6db74"), QsciLexerCPP::DoubleQuotedString);
|
||||
lexer->setColor(QColor("#75715e"), QsciLexerCPP::CommentLine);
|
||||
lexer->setColor(QColor("#7fb347"), QsciLexerCPP::Number);
|
||||
qsci->setMarkerBackgroundColor(QColor(255, 0, 0, 100), markerNumber);
|
||||
qsci->setCaretLineBackgroundColor(QColor("#3e3d32"));
|
||||
qsci->setMarginsBackgroundColor(QColor("#757575"));
|
||||
qsci->setMarginsForegroundColor(QColor("#f8f8f2"));
|
||||
lexer->setPaper("#272822");
|
||||
lexer->setColor(QColor("#f8f8f2")); // -> Style: Default text
|
||||
lexer->setColor(QColor("#66c3b3"), QsciLexerCPP::Keyword); // -> Style: Keyword
|
||||
lexer->setColor(QColor("#79abff"), QsciLexerCPP::KeywordSet2); // -> Style: KeywordSet2
|
||||
lexer->setColor(QColor("#ccdf32"), QsciLexerCPP::CommentDocKeyword); // -> used in comments only like /*! \cube */
|
||||
lexer->setColor(QColor("#ffffff"), QsciLexerCPP::GlobalClass); // -> Style: GlobalClass
|
||||
lexer->setColor(QColor("#d8d8d8"), QsciLexerCPP::Operator);
|
||||
lexer->setColor(QColor("#e6db74"), QsciLexerCPP::DoubleQuotedString);
|
||||
lexer->setColor(QColor("#75715e"), QsciLexerCPP::CommentLine);
|
||||
lexer->setColor(QColor("#7fb347"), QsciLexerCPP::Number);
|
||||
qsci->setMarkerBackgroundColor(QColor(255, 0, 0, 100), markerNumber);
|
||||
qsci->setCaretLineBackgroundColor(QColor("#3e3d32"));
|
||||
qsci->setMarginsBackgroundColor(QColor("#757575"));
|
||||
qsci->setMarginsForegroundColor(QColor("#f8f8f2"));
|
||||
}
|
||||
|
||||
void ScintillaEditor::Solarized_light()
|
||||
{
|
||||
lexer->setPaper("#fdf6e3");
|
||||
lexer->setColor(QColor("#657b83")); // -> Style: Default text
|
||||
lexer->setColor(QColor("#268ad1"), QsciLexerCPP::Keyword); // -> Style: Keyword
|
||||
lexer->setColor(QColor("#6c71c4"), QsciLexerCPP::KeywordSet2); // -> Style: KeywordSet2
|
||||
lexer->setColor(QColor("#b58900"), QsciLexerCPP::CommentDocKeyword); // -> used in comments only like /*! \cube */
|
||||
lexer->setColor(QColor("#b58800"), QsciLexerCPP::GlobalClass); // -> Style: GlobalClass
|
||||
lexer->setColor(QColor("#859900"), QsciLexerCPP::Operator);
|
||||
lexer->setColor(QColor("#2aa198"), QsciLexerCPP::DoubleQuotedString);
|
||||
lexer->setColor(QColor("#b58800"), QsciLexerCPP::CommentLine);
|
||||
lexer->setColor(QColor("#cb4b16"), QsciLexerCPP::Number);
|
||||
qsci->setMarkerBackgroundColor(QColor(255, 0, 0, 100), markerNumber);
|
||||
qsci->setCaretLineBackgroundColor(QColor("#eeead5"));
|
||||
qsci->setMarginsBackgroundColor(QColor("#eee8d5"));
|
||||
qsci->setMarginsForegroundColor(QColor("#93a1a1"));
|
||||
lexer->setPaper("#fdf6e3");
|
||||
lexer->setColor(QColor("#657b83")); // -> Style: Default text
|
||||
lexer->setColor(QColor("#268ad1"), QsciLexerCPP::Keyword); // -> Style: Keyword
|
||||
lexer->setColor(QColor("#6c71c4"), QsciLexerCPP::KeywordSet2); // -> Style: KeywordSet2
|
||||
lexer->setColor(QColor("#b58900"), QsciLexerCPP::CommentDocKeyword); // -> used in comments only like /*! \cube */
|
||||
lexer->setColor(QColor("#b58800"), QsciLexerCPP::GlobalClass); // -> Style: GlobalClass
|
||||
lexer->setColor(QColor("#859900"), QsciLexerCPP::Operator);
|
||||
lexer->setColor(QColor("#2aa198"), QsciLexerCPP::DoubleQuotedString);
|
||||
lexer->setColor(QColor("#b58800"), QsciLexerCPP::CommentLine);
|
||||
lexer->setColor(QColor("#cb4b16"), QsciLexerCPP::Number);
|
||||
qsci->setMarkerBackgroundColor(QColor(255, 0, 0, 100), markerNumber);
|
||||
qsci->setCaretLineBackgroundColor(QColor("#eeead5"));
|
||||
qsci->setMarginsBackgroundColor(QColor("#eee8d5"));
|
||||
qsci->setMarginsForegroundColor(QColor("#93a1a1"));
|
||||
}
|
||||
|
||||
void ScintillaEditor::noColor()
|
||||
{
|
||||
lexer->setPaper(Qt::white);
|
||||
lexer->setColor(Qt::black);
|
||||
qsci->setMarginsBackgroundColor(QColor("#ccc"));
|
||||
qsci->setMarginsForegroundColor(QColor("#111"));
|
||||
lexer->setPaper(Qt::white);
|
||||
lexer->setColor(Qt::black);
|
||||
qsci->setMarginsBackgroundColor(QColor("#ccc"));
|
||||
qsci->setMarginsForegroundColor(QColor("#111"));
|
||||
|
||||
}
|
||||
void ScintillaEditor::setHighlightScheme(const QString &name)
|
||||
{
|
||||
|
||||
if(name == "For Light Background")
|
||||
{
|
||||
forLightBackground();
|
||||
}
|
||||
else if(name == "For Dark Background")
|
||||
{
|
||||
forDarkBackground();
|
||||
}
|
||||
else if(name == "Monokai")
|
||||
{
|
||||
Monokai();
|
||||
}
|
||||
else if(name == "Solarized")
|
||||
{
|
||||
Solarized_light();
|
||||
}
|
||||
else if(name == "Off")
|
||||
{
|
||||
noColor();
|
||||
}
|
||||
if(name == "For Light Background")
|
||||
{
|
||||
forLightBackground();
|
||||
}
|
||||
else if(name == "For Dark Background")
|
||||
{
|
||||
forDarkBackground();
|
||||
}
|
||||
else if(name == "Monokai")
|
||||
{
|
||||
Monokai();
|
||||
}
|
||||
else if(name == "Solarized")
|
||||
{
|
||||
Solarized_light();
|
||||
}
|
||||
else if(name == "Off")
|
||||
{
|
||||
noColor();
|
||||
}
|
||||
}
|
||||
|
||||
void ScintillaEditor::insertPlainText(const QString &text)
|
||||
{
|
||||
qsci->setText(text);
|
||||
qsci->setText(text);
|
||||
}
|
||||
|
||||
void ScintillaEditor::undo()
|
||||
{
|
||||
qsci->undo();
|
||||
qsci->undo();
|
||||
}
|
||||
|
||||
void ScintillaEditor::redo()
|
||||
{
|
||||
qsci->redo();
|
||||
qsci->redo();
|
||||
}
|
||||
|
||||
void ScintillaEditor::cut()
|
||||
{
|
||||
qsci->cut();
|
||||
qsci->cut();
|
||||
}
|
||||
|
||||
void ScintillaEditor::copy()
|
||||
{
|
||||
qsci->copy();
|
||||
qsci->copy();
|
||||
}
|
||||
|
||||
void ScintillaEditor::paste()
|
||||
{
|
||||
qsci->paste();
|
||||
qsci->paste();
|
||||
}
|
||||
|
||||
void ScintillaEditor::zoomIn()
|
||||
{
|
||||
qsci->zoomIn();
|
||||
qsci->zoomIn();
|
||||
}
|
||||
|
||||
void ScintillaEditor::zoomOut()
|
||||
{
|
||||
qsci->zoomOut();
|
||||
qsci->zoomOut();
|
||||
}
|
||||
|
||||
void ScintillaEditor::initFont(const QString& fontName, uint size)
|
||||
{
|
||||
QFont font(fontName, size);
|
||||
font.setFixedPitch(true);
|
||||
lexer->setFont(font);
|
||||
QFont font(fontName, size);
|
||||
font.setFixedPitch(true);
|
||||
lexer->setFont(font);
|
||||
}
|
||||
|
||||
void ScintillaEditor::initLexer()
|
||||
{
|
||||
qsci->setLexer(lexer);
|
||||
qsci->setLexer(lexer);
|
||||
}
|
||||
|
||||
void ScintillaEditor::initMargin()
|
||||
{
|
||||
QFontMetrics fontmetrics = QFontMetrics(qsci->font());
|
||||
qsci->setMarginsFont(qsci->font());
|
||||
qsci->setMarginWidth(0, fontmetrics.width(QString::number(qsci->lines())) + 6);
|
||||
qsci->setMarginLineNumbers(0, true);
|
||||
QFontMetrics fontmetrics = QFontMetrics(qsci->font());
|
||||
qsci->setMarginsFont(qsci->font());
|
||||
qsci->setMarginWidth(0, fontmetrics.width(QString::number(qsci->lines())) + 6);
|
||||
qsci->setMarginLineNumbers(0, true);
|
||||
|
||||
connect(qsci, SIGNAL(textChanged()), this, SLOT(onTextChanged()));
|
||||
connect(qsci, SIGNAL(textChanged()), this, SLOT(onTextChanged()));
|
||||
}
|
||||
|
||||
void ScintillaEditor::onTextChanged()
|
||||
{
|
||||
QFontMetrics fontmetrics = qsci->fontMetrics();
|
||||
qsci->setMarginWidth(0, fontmetrics.width(QString::number(qsci->lines())) + 6);
|
||||
QFontMetrics fontmetrics = qsci->fontMetrics();
|
||||
qsci->setMarginWidth(0, fontmetrics.width(QString::number(qsci->lines())) + 6);
|
||||
}
|
||||
|
||||
bool ScintillaEditor::find(const QString &expr, bool findNext, bool findBackwards)
|
||||
|
@ -255,6 +255,6 @@ bool ScintillaEditor::find(const QString &expr, bool findNext, bool findBackward
|
|||
|
||||
void ScintillaEditor::replaceSelectedText(QString& newText)
|
||||
{
|
||||
qsci->replaceSelectedText(newText);
|
||||
qsci->replaceSelectedText(newText);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
class ScintillaEditor : public EditorInterface
|
||||
{
|
||||
public:
|
||||
ScintillaEditor(QWidget *parent);
|
||||
QsciScintilla *qsci;
|
||||
QString toPlainText();
|
||||
ScintillaEditor(QWidget *parent);
|
||||
QsciScintilla *qsci;
|
||||
QString toPlainText();
|
||||
void initMargin();
|
||||
void initLexer();
|
||||
void forLightBackground();
|
||||
|
@ -27,23 +27,23 @@ public:
|
|||
|
||||
public slots:
|
||||
void zoomIn();
|
||||
void zoomOut();
|
||||
void setPlainText(const QString&);
|
||||
void zoomOut();
|
||||
void setPlainText(const QString&);
|
||||
bool isContentModified();
|
||||
void highlightError(int);
|
||||
void unhighlightLastError();
|
||||
void setHighlightScheme(const QString&);
|
||||
void highlightError(int);
|
||||
void unhighlightLastError();
|
||||
void setHighlightScheme(const QString&);
|
||||
void insertPlainText(const QString&);
|
||||
void undo();
|
||||
void redo();
|
||||
void cut();
|
||||
void copy();
|
||||
void paste();
|
||||
void redo();
|
||||
void cut();
|
||||
void copy();
|
||||
void paste();
|
||||
void onTextChanged();
|
||||
void initFont(const QString&, uint);
|
||||
|
||||
private:
|
||||
QVBoxLayout *scintillaLayout;
|
||||
QVBoxLayout *scintillaLayout;
|
||||
const int indicatorNumber = 1;
|
||||
const int markerNumber = 2;
|
||||
ScadLexer *lexer;
|
||||
|
|
Loading…
Reference in New Issue