Mercurial > hg > octave-lojdl
changeset 13417:5464586889ae
Repaired line numbers.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Tue, 12 Apr 2011 23:11:28 +0200 |
parents | 9a0e32b20743 |
children | 327326961038 |
files | gui//src/CodeEdit.cpp gui//src/CodeEdit.h gui//src/FileEditorMdiSubWindow.cpp gui//src/NumberedCodeEdit.cpp |
diffstat | 4 files changed, 12 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/gui//src/CodeEdit.cpp +++ b/gui//src/CodeEdit.cpp @@ -20,7 +20,7 @@ #include "CodeEdit.h" CodeEdit::CodeEdit(QWidget *parent) - : QTextEdit(parent), + : QPlainTextEdit(parent), contextMenu(this) { m_syntaxHighlighter=new SyntaxHighlighter(document()); @@ -154,12 +154,12 @@ cursor.insertText(start_blank); setTextCursor(cursor); } else { - return QTextEdit::event(event); + return QPlainTextEdit::event(event); } return true; } } - return QTextEdit::event(event); + return QPlainTextEdit::event(event); } void CodeEdit::buildAutoCompletionList(int pos, int charsRemoved, int charsAdded) { @@ -297,7 +297,7 @@ } void CodeEdit::publicBlockBoundingRectList(QVector<qreal> &list, int &first_line){ - /* + qreal pageBottom = viewport()->height(); QPointF offset=contentOffset(); QTextBlock block=firstVisibleBlock(); @@ -312,6 +312,5 @@ if(y>pageBottom) break; list.append(y); - } - */ + } }
--- a/gui//src/CodeEdit.h +++ b/gui//src/CodeEdit.h @@ -19,7 +19,7 @@ #ifndef CODEEDIT_H #define CODEEDIT_H -#include <QTextEdit> +#include <QPlainTextEdit> #include <QMenu> #include <QTextCursor> #include "SyntaxHighlighter.h" @@ -36,7 +36,7 @@ }; /**TextEdit that supports highlited syntax and autocompletion.*/ -class CodeEdit: public QTextEdit { +class CodeEdit: public QPlainTextEdit { Q_OBJECT public: CodeEdit(QWidget *parent = 0);
--- a/gui//src/FileEditorMdiSubWindow.cpp +++ b/gui//src/FileEditorMdiSubWindow.cpp @@ -66,8 +66,8 @@ m_statusBar = new QStatusBar(this); m_numberedTextView = new NumberedTextView(this, m_codeEdit); - m_codeEdit->setFontFamily("Courier"); - m_codeEdit->setLineWrapMode(QTextEdit::NoWrap); + m_codeEdit->setFont(QFont("Courier")); + m_codeEdit->setLineWrapMode(QPlainTextEdit::NoWrap); QAction *newAction = new QAction(style->standardIcon(QStyle::SP_FileIcon), "", m_toolBar);
--- a/gui//src/NumberedCodeEdit.cpp +++ b/gui//src/NumberedCodeEdit.cpp @@ -38,6 +38,7 @@ stopMarker = QPixmap(); //QString(ICON_PATH) + "/stop.png" ); currentMarker = QPixmap(); // QString(ICON_PATH) + "/bookmark.png" ); bugMarker = QPixmap(); // QString(ICON_PATH) + "/bug.png" ); + setFont(QFont("Courier")); } NumberBar::~NumberBar() @@ -86,7 +87,7 @@ edit->publicBlockBoundingRectList(lines_list, first_line_no); const QFontMetrics fm = edit->fontMetrics(); - const int ascent = fontMetrics().ascent() + 1; // height = ascent + descent + 1 + const int ascent = fontMetrics().ascent(); // height = ascent + descent + 1 QPainter p(this); p.setPen(palette().windowText().color()); @@ -106,7 +107,7 @@ lineCount=first_line_no+i; const QString txt = QString::number( lineCount ); - p.drawText( width() - fm.width(txt), position_y+ascent, txt ); + p.drawText( width() - fm.width(txt) - 2, position_y+ascent, txt ); // Bug marker if ( bugLine == lineCount ) {