forked from qt-creator/qt-creator
BaseTextEditor: Style fixes
Whitespace, s/e/m_editorWidget/, remove unneeded struct, remove 'inline' when not needed... Change-Id: I1ce76f5c4b1febe45c4a3b6404107fed7d9c6868 Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
@@ -104,39 +104,38 @@
|
|||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using namespace TextEditor;
|
|
||||||
using namespace TextEditor::Internal;
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class TextEditExtraArea : public QWidget {
|
class TextEditExtraArea : public QWidget
|
||||||
BaseTextEditorWidget *textEdit;
|
{
|
||||||
public:
|
public:
|
||||||
TextEditExtraArea(BaseTextEditorWidget *edit):QWidget(edit) {
|
TextEditExtraArea(BaseTextEditorWidget *edit)
|
||||||
|
: QWidget(edit)
|
||||||
|
{
|
||||||
textEdit = edit;
|
textEdit = edit;
|
||||||
setAutoFillBackground(true);
|
setAutoFillBackground(true);
|
||||||
}
|
}
|
||||||
public:
|
|
||||||
|
|
||||||
|
protected:
|
||||||
QSize sizeHint() const {
|
QSize sizeHint() const {
|
||||||
return QSize(textEdit->extraAreaWidth(), 0);
|
return QSize(textEdit->extraAreaWidth(), 0);
|
||||||
}
|
}
|
||||||
protected:
|
void paintEvent(QPaintEvent *event) {
|
||||||
void paintEvent(QPaintEvent *event){
|
|
||||||
textEdit->extraAreaPaintEvent(event);
|
textEdit->extraAreaPaintEvent(event);
|
||||||
}
|
}
|
||||||
void mousePressEvent(QMouseEvent *event){
|
void mousePressEvent(QMouseEvent *event) {
|
||||||
textEdit->extraAreaMouseEvent(event);
|
textEdit->extraAreaMouseEvent(event);
|
||||||
}
|
}
|
||||||
void mouseMoveEvent(QMouseEvent *event){
|
void mouseMoveEvent(QMouseEvent *event) {
|
||||||
textEdit->extraAreaMouseEvent(event);
|
textEdit->extraAreaMouseEvent(event);
|
||||||
}
|
}
|
||||||
void mouseReleaseEvent(QMouseEvent *event){
|
void mouseReleaseEvent(QMouseEvent *event) {
|
||||||
textEdit->extraAreaMouseEvent(event);
|
textEdit->extraAreaMouseEvent(event);
|
||||||
}
|
}
|
||||||
void leaveEvent(QEvent *event){
|
void leaveEvent(QEvent *event) {
|
||||||
textEdit->extraAreaLeaveEvent(event);
|
textEdit->extraAreaLeaveEvent(event);
|
||||||
}
|
}
|
||||||
void contextMenuEvent(QContextMenuEvent *event) {
|
void contextMenuEvent(QContextMenuEvent *event) {
|
||||||
@@ -146,13 +145,17 @@ protected:
|
|||||||
void wheelEvent(QWheelEvent *event) {
|
void wheelEvent(QWheelEvent *event) {
|
||||||
QCoreApplication::sendEvent(textEdit->viewport(), event);
|
QCoreApplication::sendEvent(textEdit->viewport(), event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
BaseTextEditorWidget *textEdit;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace TextEditor
|
|
||||||
|
using namespace Internal;
|
||||||
|
|
||||||
Core::IEditor *BaseTextEditorWidget::openEditorAt(const QString &fileName, int line, int column,
|
Core::IEditor *BaseTextEditorWidget::openEditorAt(const QString &fileName, int line, int column,
|
||||||
const Core::Id &editorKind,
|
Core::Id editorKind,
|
||||||
Core::EditorManager::OpenEditorFlags flags,
|
Core::EditorManager::OpenEditorFlags flags,
|
||||||
bool *newEditor)
|
bool *newEditor)
|
||||||
{
|
{
|
||||||
@@ -294,7 +297,7 @@ void BaseTextEditorWidget::setMimeType(const QString &mt)
|
|||||||
|
|
||||||
void BaseTextEditorWidget::print(QPrinter *printer)
|
void BaseTextEditorWidget::print(QPrinter *printer)
|
||||||
{
|
{
|
||||||
const bool oldFullPage = printer->fullPage();
|
const bool oldFullPage = printer->fullPage();
|
||||||
printer->setFullPage(true);
|
printer->setFullPage(true);
|
||||||
QPrintDialog *dlg = new QPrintDialog(printer, this);
|
QPrintDialog *dlg = new QPrintDialog(printer, this);
|
||||||
dlg->setWindowTitle(tr("Print Document"));
|
dlg->setWindowTitle(tr("Print Document"));
|
||||||
@@ -307,7 +310,7 @@ void BaseTextEditorWidget::print(QPrinter *printer)
|
|||||||
static int foldBoxWidth(const QFontMetrics &fm)
|
static int foldBoxWidth(const QFontMetrics &fm)
|
||||||
{
|
{
|
||||||
const int lineSpacing = fm.lineSpacing();
|
const int lineSpacing = fm.lineSpacing();
|
||||||
return lineSpacing + lineSpacing%2 + 1;
|
return lineSpacing + lineSpacing % 2 + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void printPage(int index, QPainter *painter, const QTextDocument *doc,
|
static void printPage(int index, QPainter *painter, const QTextDocument *doc,
|
||||||
@@ -381,7 +384,7 @@ void BaseTextEditorWidgetPrivate::print(QPrinter *printer)
|
|||||||
QList<QTextLayout::FormatRange> formatList = srcBlock.layout()->additionalFormats();
|
QList<QTextLayout::FormatRange> formatList = srcBlock.layout()->additionalFormats();
|
||||||
if (backgroundIsDark) {
|
if (backgroundIsDark) {
|
||||||
// adjust syntax highlighting colors for better contrast
|
// adjust syntax highlighting colors for better contrast
|
||||||
for (int i = formatList.count() - 1; i >=0; --i) {
|
for (int i = formatList.count() - 1; i >= 0; --i) {
|
||||||
QTextCharFormat &format = formatList[i].format;
|
QTextCharFormat &format = formatList[i].format;
|
||||||
if (format.background().color() == background) {
|
if (format.background().color() == background) {
|
||||||
QBrush brush = format.foreground();
|
QBrush brush = format.foreground();
|
||||||
@@ -423,7 +426,7 @@ void BaseTextEditorWidgetPrivate::print(QPrinter *printer)
|
|||||||
|
|
||||||
int docCopies;
|
int docCopies;
|
||||||
int pageCopies;
|
int pageCopies;
|
||||||
if (printer->collateCopies() == true){
|
if (printer->collateCopies() == true) {
|
||||||
docCopies = 1;
|
docCopies = 1;
|
||||||
pageCopies = printer->numCopies();
|
pageCopies = printer->numCopies();
|
||||||
} else {
|
} else {
|
||||||
@@ -631,8 +634,6 @@ const Utils::ChangeSet &BaseTextEditorWidget::changeSet() const
|
|||||||
|
|
||||||
void BaseTextEditorWidget::setChangeSet(const Utils::ChangeSet &changeSet)
|
void BaseTextEditorWidget::setChangeSet(const Utils::ChangeSet &changeSet)
|
||||||
{
|
{
|
||||||
using namespace Utils;
|
|
||||||
|
|
||||||
d->m_changeSet = changeSet;
|
d->m_changeSet = changeSet;
|
||||||
|
|
||||||
foreach (const ChangeSet::EditOp &op, changeSet.operationList()) {
|
foreach (const ChangeSet::EditOp &op, changeSet.operationList()) {
|
||||||
@@ -1057,7 +1058,6 @@ void BaseTextEditorWidget::uppercaseSelection()
|
|||||||
transformSelection(&QString::toUpper);
|
transformSelection(&QString::toUpper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BaseTextEditorWidget::lowercaseSelection()
|
void BaseTextEditorWidget::lowercaseSelection()
|
||||||
{
|
{
|
||||||
transformSelection(&QString::toLower);
|
transformSelection(&QString::toLower);
|
||||||
@@ -1173,7 +1173,7 @@ void BaseTextEditorWidget::moveLineUpDown(bool up)
|
|||||||
d->m_refactorOverlay->setMarkers(nonAffectedMarkers + affectedMarkers);
|
d->m_refactorOverlay->setMarkers(nonAffectedMarkers + affectedMarkers);
|
||||||
|
|
||||||
bool shouldReindent = true;
|
bool shouldReindent = true;
|
||||||
const Utils::CommentDefinition* commentDefinition(editor()->commentDefinition());
|
const CommentDefinition *commentDefinition(editor()->commentDefinition());
|
||||||
if (commentDefinition) {
|
if (commentDefinition) {
|
||||||
QString trimmedText(text.trimmed());
|
QString trimmedText(text.trimmed());
|
||||||
|
|
||||||
@@ -2825,19 +2825,6 @@ void BaseTextEditorWidgetPrivate::highlightSearchResults(const QTextBlock &block
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace TextEditor {
|
|
||||||
namespace Internal {
|
|
||||||
struct BlockSelectionData {
|
|
||||||
int selectionIndex;
|
|
||||||
int selectionStart;
|
|
||||||
int selectionEnd;
|
|
||||||
int firstColumn;
|
|
||||||
int lastColumn;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseTextEditorWidgetPrivate::clearBlockSelection()
|
void BaseTextEditorWidgetPrivate::clearBlockSelection()
|
||||||
{
|
{
|
||||||
if (m_inBlockSelectionMode) {
|
if (m_inBlockSelectionMode) {
|
||||||
@@ -6281,9 +6268,9 @@ void BaseTextEditorWidget::appendStandardContextMenuActions(QMenu *menu)
|
|||||||
|
|
||||||
|
|
||||||
BaseTextEditor::BaseTextEditor(BaseTextEditorWidget *editor)
|
BaseTextEditor::BaseTextEditor(BaseTextEditorWidget *editor)
|
||||||
: e(editor)
|
: m_editorWidget(editor)
|
||||||
{
|
{
|
||||||
setWidget(e);
|
setWidget(m_editorWidget);
|
||||||
using namespace Find;
|
using namespace Find;
|
||||||
Aggregation::Aggregate *aggregate = new Aggregation::Aggregate;
|
Aggregation::Aggregate *aggregate = new Aggregation::Aggregate;
|
||||||
BaseTextFind *baseTextFind = new BaseTextFind(editor);
|
BaseTextFind *baseTextFind = new BaseTextFind(editor);
|
||||||
@@ -6318,7 +6305,7 @@ BaseTextEditor::BaseTextEditor(BaseTextEditorWidget *editor)
|
|||||||
BaseTextEditor::~BaseTextEditor()
|
BaseTextEditor::~BaseTextEditor()
|
||||||
{
|
{
|
||||||
delete m_toolBar;
|
delete m_toolBar;
|
||||||
delete e;
|
delete m_editorWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *BaseTextEditor::toolBar()
|
QWidget *BaseTextEditor::toolBar()
|
||||||
@@ -6343,74 +6330,74 @@ void BaseTextEditor::insertExtraToolBarWidget(BaseTextEditor::Side side,
|
|||||||
|
|
||||||
int BaseTextEditor::currentLine() const
|
int BaseTextEditor::currentLine() const
|
||||||
{
|
{
|
||||||
return e->textCursor().blockNumber() + 1;
|
return m_editorWidget->textCursor().blockNumber() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BaseTextEditor::currentColumn() const
|
int BaseTextEditor::currentColumn() const
|
||||||
{
|
{
|
||||||
QTextCursor cursor = e->textCursor();
|
QTextCursor cursor = m_editorWidget->textCursor();
|
||||||
return cursor.position() - cursor.block().position() + 1;
|
return cursor.position() - cursor.block().position() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BaseTextEditor::columnCount() const
|
int BaseTextEditor::columnCount() const
|
||||||
{
|
{
|
||||||
return e->columnCount();
|
return m_editorWidget->columnCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
int BaseTextEditor::rowCount() const
|
int BaseTextEditor::rowCount() const
|
||||||
{
|
{
|
||||||
return e->rowCount();
|
return m_editorWidget->rowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect BaseTextEditor::cursorRect(int pos) const
|
QRect BaseTextEditor::cursorRect(int pos) const
|
||||||
{
|
{
|
||||||
QTextCursor tc = e->textCursor();
|
QTextCursor tc = m_editorWidget->textCursor();
|
||||||
if (pos >= 0)
|
if (pos >= 0)
|
||||||
tc.setPosition(pos);
|
tc.setPosition(pos);
|
||||||
QRect result = e->cursorRect(tc);
|
QRect result = m_editorWidget->cursorRect(tc);
|
||||||
result.moveTo(e->viewport()->mapToGlobal(result.topLeft()));
|
result.moveTo(m_editorWidget->viewport()->mapToGlobal(result.topLeft()));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BaseTextEditor::selectedText() const
|
QString BaseTextEditor::selectedText() const
|
||||||
{
|
{
|
||||||
if (e->textCursor().hasSelection())
|
if (m_editorWidget->textCursor().hasSelection())
|
||||||
return e->textCursor().selectedText();
|
return m_editorWidget->textCursor().selectedText();
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseTextEditor::remove(int length)
|
void BaseTextEditor::remove(int length)
|
||||||
{
|
{
|
||||||
QTextCursor tc = e->textCursor();
|
QTextCursor tc = m_editorWidget->textCursor();
|
||||||
tc.setPosition(tc.position() + length, QTextCursor::KeepAnchor);
|
tc.setPosition(tc.position() + length, QTextCursor::KeepAnchor);
|
||||||
tc.removeSelectedText();
|
tc.removeSelectedText();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseTextEditor::insert(const QString &string)
|
void BaseTextEditor::insert(const QString &string)
|
||||||
{
|
{
|
||||||
QTextCursor tc = e->textCursor();
|
QTextCursor tc = m_editorWidget->textCursor();
|
||||||
tc.insertText(string);
|
tc.insertText(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseTextEditor::replace(int length, const QString &string)
|
void BaseTextEditor::replace(int length, const QString &string)
|
||||||
{
|
{
|
||||||
QTextCursor tc = e->textCursor();
|
QTextCursor tc = m_editorWidget->textCursor();
|
||||||
tc.setPosition(tc.position() + length, QTextCursor::KeepAnchor);
|
tc.setPosition(tc.position() + length, QTextCursor::KeepAnchor);
|
||||||
tc.insertText(string);
|
tc.insertText(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseTextEditor::setCursorPosition(int pos)
|
void BaseTextEditor::setCursorPosition(int pos)
|
||||||
{
|
{
|
||||||
QTextCursor tc = e->textCursor();
|
QTextCursor tc = m_editorWidget->textCursor();
|
||||||
tc.setPosition(pos);
|
tc.setPosition(pos);
|
||||||
e->setTextCursor(tc);
|
m_editorWidget->setTextCursor(tc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseTextEditor::select(int toPos)
|
void BaseTextEditor::select(int toPos)
|
||||||
{
|
{
|
||||||
QTextCursor tc = e->textCursor();
|
QTextCursor tc = m_editorWidget->textCursor();
|
||||||
tc.setPosition(toPos, QTextCursor::KeepAnchor);
|
tc.setPosition(toPos, QTextCursor::KeepAnchor);
|
||||||
e->setTextCursor(tc);
|
m_editorWidget->setTextCursor(tc);
|
||||||
}
|
}
|
||||||
|
|
||||||
const CommentDefinition *BaseTextEditor::commentDefinition() const
|
const CommentDefinition *BaseTextEditor::commentDefinition() const
|
||||||
@@ -6420,16 +6407,16 @@ const CommentDefinition *BaseTextEditor::commentDefinition() const
|
|||||||
|
|
||||||
void BaseTextEditor::updateCursorPosition()
|
void BaseTextEditor::updateCursorPosition()
|
||||||
{
|
{
|
||||||
const QTextCursor cursor = e->textCursor();
|
const QTextCursor cursor = m_editorWidget->textCursor();
|
||||||
const QTextBlock block = cursor.block();
|
const QTextBlock block = cursor.block();
|
||||||
const int line = block.blockNumber() + 1;
|
const int line = block.blockNumber() + 1;
|
||||||
const int column = cursor.position() - block.position();
|
const int column = cursor.position() - block.position();
|
||||||
m_cursorPositionLabel->setText(tr("Line: %1, Col: %2").arg(line).arg(e->tabSettings().columnAt(block.text(), column)+1),
|
m_cursorPositionLabel->setText(tr("Line: %1, Col: %2").arg(line).arg(m_editorWidget->tabSettings().columnAt(block.text(), column)+1),
|
||||||
tr("Line: 9999, Col: 999"));
|
tr("Line: 9999, Col: 999"));
|
||||||
m_contextHelpId.clear();
|
m_contextHelpId.clear();
|
||||||
|
|
||||||
if (!block.isVisible())
|
if (!block.isVisible())
|
||||||
e->ensureCursorVisible();
|
m_editorWidget->ensureCursorVisible();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6456,8 +6443,8 @@ void BaseTextEditor::setFileEncodingLabelText(const QString &text)
|
|||||||
QString BaseTextEditor::contextHelpId() const
|
QString BaseTextEditor::contextHelpId() const
|
||||||
{
|
{
|
||||||
if (m_contextHelpId.isEmpty())
|
if (m_contextHelpId.isEmpty())
|
||||||
emit const_cast<BaseTextEditor*>(this)->contextHelpIdRequested(e->editor(),
|
emit const_cast<BaseTextEditor*>(this)->contextHelpIdRequested(m_editorWidget->editor(),
|
||||||
e->textCursor().position());
|
m_editorWidget->textCursor().position());
|
||||||
return m_contextHelpId;
|
return m_contextHelpId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6754,3 +6741,10 @@ QString TextEditor::BaseTextEditorWidget::foldReplacementText(const QTextBlock &
|
|||||||
{
|
{
|
||||||
return QLatin1String("...");
|
return QLatin1String("...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BaseTextEditor::open(QString *errorString, const QString &fileName, const QString &realFileName)
|
||||||
|
{
|
||||||
|
return m_editorWidget->open(errorString, fileName, realFileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace TextEditor
|
||||||
|
|||||||
@@ -126,12 +126,13 @@ class TEXTEDITOR_EXPORT BaseTextEditorWidget : public QPlainTextEdit
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(int verticalBlockSelectionFirstColumn READ verticalBlockSelectionFirstColumn)
|
Q_PROPERTY(int verticalBlockSelectionFirstColumn READ verticalBlockSelectionFirstColumn)
|
||||||
Q_PROPERTY(int verticalBlockSelectionLastColumn READ verticalBlockSelectionLastColumn)
|
Q_PROPERTY(int verticalBlockSelectionLastColumn READ verticalBlockSelectionLastColumn)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BaseTextEditorWidget(QWidget *parent);
|
BaseTextEditorWidget(QWidget *parent);
|
||||||
~BaseTextEditorWidget();
|
~BaseTextEditorWidget();
|
||||||
|
|
||||||
static Core::IEditor *openEditorAt(const QString &fileName, int line, int column = 0,
|
static Core::IEditor *openEditorAt(const QString &fileName, int line, int column = 0,
|
||||||
const Core::Id &editorId = Core::Id(),
|
Core::Id editorId = Core::Id(),
|
||||||
Core::EditorManager::OpenEditorFlags flags = Core::EditorManager::IgnoreNavigationHistory,
|
Core::EditorManager::OpenEditorFlags flags = Core::EditorManager::IgnoreNavigationHistory,
|
||||||
bool *newEditor = 0);
|
bool *newEditor = 0);
|
||||||
|
|
||||||
@@ -146,13 +147,10 @@ public:
|
|||||||
bool restoreState(const QByteArray &state);
|
bool restoreState(const QByteArray &state);
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
|
|
||||||
// ITextEditor
|
|
||||||
|
|
||||||
void gotoLine(int line, int column = 0);
|
void gotoLine(int line, int column = 0);
|
||||||
|
|
||||||
int position(
|
int position(ITextEditor::PositionOperation posOp = ITextEditor::Current,
|
||||||
ITextEditor::PositionOperation posOp = ITextEditor::Current
|
int at = -1) const;
|
||||||
, int at = -1) const;
|
|
||||||
void convertPosition(int pos, int *line, int *column) const;
|
void convertPosition(int pos, int *line, int *column) const;
|
||||||
|
|
||||||
BaseTextEditor *editor() const;
|
BaseTextEditor *editor() const;
|
||||||
@@ -164,7 +162,7 @@ public:
|
|||||||
QString mimeType() const;
|
QString mimeType() const;
|
||||||
virtual void setMimeType(const QString &mt);
|
virtual void setMimeType(const QString &mt);
|
||||||
|
|
||||||
void appendMenuActionsFromContext(QMenu *menu, const Core::Id menuContextId);
|
void appendMenuActionsFromContext(QMenu *menu, Core::Id menuContextId);
|
||||||
void appendStandardContextMenuActions(QMenu *menu);
|
void appendStandardContextMenuActions(QMenu *menu);
|
||||||
|
|
||||||
// Works only in conjunction with a syntax highlighter that puts
|
// Works only in conjunction with a syntax highlighter that puts
|
||||||
@@ -217,7 +215,7 @@ public:
|
|||||||
int columnCount() const;
|
int columnCount() const;
|
||||||
int rowCount() const;
|
int rowCount() const;
|
||||||
|
|
||||||
void setActionHack(QObject *);
|
void setActionHack(QObject *hack);
|
||||||
QObject *actionHack() const;
|
QObject *actionHack() const;
|
||||||
|
|
||||||
void setTextCodec(QTextCodec *codec);
|
void setTextCodec(QTextCodec *codec);
|
||||||
@@ -617,17 +615,17 @@ public:
|
|||||||
~BaseTextEditor();
|
~BaseTextEditor();
|
||||||
|
|
||||||
friend class BaseTextEditorWidget;
|
friend class BaseTextEditorWidget;
|
||||||
BaseTextEditorWidget *editorWidget() const { return e; }
|
BaseTextEditorWidget *editorWidget() const { return m_editorWidget; }
|
||||||
|
|
||||||
// IEditor
|
// IEditor
|
||||||
Core::IDocument * document() { return e->editorDocument(); }
|
Core::IDocument *document() { return m_editorWidget->editorDocument(); }
|
||||||
bool createNew(const QString &contents) { return e->createNew(contents); }
|
bool createNew(const QString &contents) { return m_editorWidget->createNew(contents); }
|
||||||
bool open(QString *errorString, const QString &fileName, const QString &realFileName) { return e->open(errorString, fileName, realFileName); }
|
bool open(QString *errorString, const QString &fileName, const QString &realFileName);
|
||||||
QString displayName() const { return e->displayName(); }
|
QString displayName() const { return m_editorWidget->displayName(); }
|
||||||
void setDisplayName(const QString &title) { e->setDisplayName(title); emit changed(); }
|
void setDisplayName(const QString &title) { m_editorWidget->setDisplayName(title); emit changed(); }
|
||||||
|
|
||||||
QByteArray saveState() const { return e->saveState(); }
|
QByteArray saveState() const { return m_editorWidget->saveState(); }
|
||||||
bool restoreState(const QByteArray &state) { return e->restoreState(state); }
|
bool restoreState(const QByteArray &state) { return m_editorWidget->restoreState(state); }
|
||||||
QWidget *toolBar();
|
QWidget *toolBar();
|
||||||
|
|
||||||
enum Side { Left, Right };
|
enum Side { Left, Right };
|
||||||
@@ -636,25 +634,24 @@ public:
|
|||||||
// ITextEditor
|
// ITextEditor
|
||||||
int currentLine() const;
|
int currentLine() const;
|
||||||
int currentColumn() const;
|
int currentColumn() const;
|
||||||
void gotoLine(int line, int column = 0) { e->gotoLine(line, column); }
|
void gotoLine(int line, int column = 0) { m_editorWidget->gotoLine(line, column); }
|
||||||
int columnCount() const;
|
int columnCount() const;
|
||||||
int rowCount() const;
|
int rowCount() const;
|
||||||
|
|
||||||
int position(PositionOperation posOp = Current, int at = -1) const
|
int position(PositionOperation posOp = Current, int at = -1) const
|
||||||
{ return e->position(posOp, at); }
|
{ return m_editorWidget->position(posOp, at); }
|
||||||
void convertPosition(int pos, int *line, int *column) const
|
void convertPosition(int pos, int *line, int *column) const
|
||||||
{ e->convertPosition(pos, line, column); }
|
{ m_editorWidget->convertPosition(pos, line, column); }
|
||||||
QRect cursorRect(int pos = -1) const;
|
QRect cursorRect(int pos = -1) const;
|
||||||
|
|
||||||
QString selectedText() const;
|
QString selectedText() const;
|
||||||
|
|
||||||
inline ITextMarkable *markableInterface() { return e->markableInterface(); }
|
ITextMarkable *markableInterface() { return m_editorWidget->markableInterface(); }
|
||||||
|
|
||||||
QString contextHelpId() const; // from IContext
|
QString contextHelpId() const; // from IContext
|
||||||
|
|
||||||
inline void setTextCodec(QTextCodec *codec, TextCodecReason = TextCodecOtherReason) { e->setTextCodec(codec); }
|
void setTextCodec(QTextCodec *codec, TextCodecReason = TextCodecOtherReason) { m_editorWidget->setTextCodec(codec); }
|
||||||
inline QTextCodec *textCodec() const { return e->textCodec(); }
|
QTextCodec *textCodec() const { return m_editorWidget->textCodec(); }
|
||||||
|
|
||||||
|
|
||||||
// ITextEditor
|
// ITextEditor
|
||||||
void remove(int length);
|
void remove(int length);
|
||||||
@@ -662,7 +659,7 @@ public:
|
|||||||
void replace(int length, const QString &string);
|
void replace(int length, const QString &string);
|
||||||
void setCursorPosition(int pos);
|
void setCursorPosition(int pos);
|
||||||
void select(int toPos);
|
void select(int toPos);
|
||||||
const Utils::CommentDefinition* commentDefinition() const;
|
const Utils::CommentDefinition *commentDefinition() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateCursorPosition();
|
void updateCursorPosition();
|
||||||
@@ -671,7 +668,9 @@ private slots:
|
|||||||
void setFileEncodingLabelText(const QString &text);
|
void setFileEncodingLabelText(const QString &text);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BaseTextEditorWidget *e;
|
// Note: This is always a copy of IContext::m_widget.
|
||||||
|
BaseTextEditorWidget *m_editorWidget;
|
||||||
|
|
||||||
QToolBar *m_toolBar;
|
QToolBar *m_toolBar;
|
||||||
QWidget *m_stretchWidget;
|
QWidget *m_stretchWidget;
|
||||||
QAction *m_cursorPositionLabelAction;
|
QAction *m_cursorPositionLabelAction;
|
||||||
|
|||||||
Reference in New Issue
Block a user