Commit 8e9a70ad authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer

Renamed TextEditDocumentLayout to BaseTextDocumentLayout

parent 41ab8fbb
......@@ -67,11 +67,11 @@ void CppHighlighter::highlightBlock(const QString &text)
if (tokens.isEmpty()) {
setCurrentBlockState(previousState);
if (TextBlockUserData *userData = TextEditDocumentLayout::testUserData(currentBlock())) {
if (TextBlockUserData *userData = BaseTextDocumentLayout::testUserData(currentBlock())) {
userData->setClosingCollapseMode(TextBlockUserData::NoClosingCollapse);
userData->setCollapseMode(TextBlockUserData::NoCollapse);
}
TextEditDocumentLayout::clearParentheses(currentBlock());
BaseTextDocumentLayout::clearParentheses(currentBlock());
if (text.length()) // the empty line can still contain whitespace
setFormat(0, text.length(), m_formats[CppVisualWhitespace]);
return;
......@@ -177,7 +177,7 @@ void CppHighlighter::highlightBlock(const QString &text)
highlightLine(text, lastTokenEnd, text.length() - lastTokenEnd, QTextCharFormat());
}
if (TextBlockUserData *userData = TextEditDocumentLayout::testUserData(currentBlock())) {
if (TextBlockUserData *userData = BaseTextDocumentLayout::testUserData(currentBlock())) {
userData->setClosingCollapseMode(TextBlockUserData::NoClosingCollapse);
userData->setCollapseMode(TextBlockUserData::NoCollapse);
}
......@@ -194,13 +194,13 @@ void CppHighlighter::highlightBlock(const QString &text)
TextBlockUserData::CollapseMode collapseMode = TextBlockUserData::CollapseAfter;
if (collapse == firstNonSpace && c != QLatin1Char('+'))
collapseMode = TextBlockUserData::CollapseThis;
TextEditDocumentLayout::userData(currentBlock())->setCollapseMode(collapseMode);
BaseTextDocumentLayout::userData(currentBlock())->setCollapseMode(collapseMode);
}
int cc = Parenthesis::closeCollapseAtPos(parentheses);
if (cc >= 0) {
TextBlockUserData *userData = TextEditDocumentLayout::userData(currentBlock());
TextBlockUserData *userData = BaseTextDocumentLayout::userData(currentBlock());
userData->setClosingCollapseMode(TextBlockUserData::ClosingCollapse);
QString trailingText = text.mid(cc+1).simplified();
if (trailingText.isEmpty() || trailingText == QLatin1String(";")) {
......@@ -208,11 +208,11 @@ void CppHighlighter::highlightBlock(const QString &text)
}
}
TextEditDocumentLayout::setParentheses(currentBlock(), parentheses);
BaseTextDocumentLayout::setParentheses(currentBlock(), parentheses);
// if the block is ifdefed out, we only store the parentheses, but
// do not adjust the brace depth.
if (TextEditDocumentLayout::ifdefedOut(currentBlock()))
if (BaseTextDocumentLayout::ifdefedOut(currentBlock()))
braceDepth = initialBraceDepth;
// optimization: if only the brace depth changes, we adjust subsequent blocks
......@@ -225,7 +225,7 @@ void CppHighlighter::highlightBlock(const QString &text)
int delta = braceDepth - oldBraceDepth;
QTextBlock block = currentBlock().next();
while (block.isValid() && block.userState() != -1) {
TextEditDocumentLayout::changeBraceDepth(block, delta);
BaseTextDocumentLayout::changeBraceDepth(block, delta);
block = block.next();
}
}
......
......@@ -58,12 +58,12 @@ bool DocumentMarker::addMark(TextEditor::ITextMark *mark, int line)
{
QTC_ASSERT(line >= 1, return false);
int blockNumber = line - 1;
TextEditDocumentLayout *documentLayout = qobject_cast<TextEditDocumentLayout*>(document->documentLayout());
BaseTextDocumentLayout *documentLayout = qobject_cast<BaseTextDocumentLayout*>(document->documentLayout());
QTC_ASSERT(documentLayout, return false);
QTextBlock block = document->findBlockByNumber(blockNumber);
if (block.isValid()) {
TextBlockUserData *userData = TextEditDocumentLayout::userData(block);
TextBlockUserData *userData = BaseTextDocumentLayout::userData(block);
userData->addMark(mark);
mark->updateLineNumber(blockNumber + 1);
mark->updateBlock(block);
......@@ -81,7 +81,7 @@ TextEditor::TextMarks DocumentMarker::marksAt(int line) const
QTextBlock block = document->findBlockByNumber(blockNumber);
if (block.isValid()) {
if (TextBlockUserData *userData = TextEditDocumentLayout::testUserData(block))
if (TextBlockUserData *userData = BaseTextDocumentLayout::testUserData(block))
return userData->marks();
}
return TextMarks();
......@@ -117,7 +117,7 @@ bool DocumentMarker::hasMark(TextEditor::ITextMark *mark) const
void DocumentMarker::updateMark(ITextMark *mark)
{
Q_UNUSED(mark)
TextEditDocumentLayout *documentLayout = qobject_cast<TextEditDocumentLayout*>(document->documentLayout());
BaseTextDocumentLayout *documentLayout = qobject_cast<BaseTextDocumentLayout*>(document->documentLayout());
QTC_ASSERT(documentLayout, return);
documentLayout->requestUpdate();
}
......@@ -304,7 +304,7 @@ bool BaseTextDocument::open(const QString &fileName)
m_document->setHtml(tr("<em>Binary data</em>"));
else
m_document->setPlainText(text);
TextEditDocumentLayout *documentLayout = qobject_cast<TextEditDocumentLayout*>(m_document->documentLayout());
BaseTextDocumentLayout *documentLayout = qobject_cast<BaseTextDocumentLayout*>(m_document->documentLayout());
QTC_ASSERT(documentLayout, return true);
documentLayout->lastSaveRevision = m_document->revision();
m_document->setModified(false);
......@@ -376,7 +376,7 @@ void BaseTextDocument::cleanWhitespace(const QTextCursor &cursor)
void BaseTextDocument::cleanWhitespace(QTextCursor& cursor, bool cleanIndentation, bool inEntireDocument)
{
TextEditDocumentLayout *documentLayout = qobject_cast<TextEditDocumentLayout*>(m_document->documentLayout());
BaseTextDocumentLayout *documentLayout = qobject_cast<BaseTextDocumentLayout*>(m_document->documentLayout());
QTextBlock block = m_document->findBlock(cursor.selectionStart());
QTextBlock end;
......
......@@ -205,10 +205,10 @@ void TextBlockUserData::doCollapse(const QTextBlock& block, bool visible)
TextBlockUserData::MatchType TextBlockUserData::checkOpenParenthesis(QTextCursor *cursor, QChar c)
{
QTextBlock block = cursor->block();
if (!TextEditDocumentLayout::hasParentheses(block) || TextEditDocumentLayout::ifdefedOut(block))
if (!BaseTextDocumentLayout::hasParentheses(block) || BaseTextDocumentLayout::ifdefedOut(block))
return NoMatch;
Parentheses parenList = TextEditDocumentLayout::parentheses(block);
Parentheses parenList = BaseTextDocumentLayout::parentheses(block);
Parenthesis openParen, closedParen;
QTextBlock closedParenParag = block;
......@@ -235,9 +235,9 @@ TextBlockUserData::MatchType TextBlockUserData::checkOpenParenthesis(QTextCursor
closedParenParag = closedParenParag.next();
if (!closedParenParag.isValid())
return NoMatch;
if (TextEditDocumentLayout::hasParentheses(closedParenParag)
&& !TextEditDocumentLayout::ifdefedOut(closedParenParag)) {
parenList = TextEditDocumentLayout::parentheses(closedParenParag);
if (BaseTextDocumentLayout::hasParentheses(closedParenParag)
&& !BaseTextDocumentLayout::ifdefedOut(closedParenParag)) {
parenList = BaseTextDocumentLayout::parentheses(closedParenParag);
break;
}
}
......@@ -274,10 +274,10 @@ TextBlockUserData::MatchType TextBlockUserData::checkOpenParenthesis(QTextCursor
TextBlockUserData::MatchType TextBlockUserData::checkClosedParenthesis(QTextCursor *cursor, QChar c)
{
QTextBlock block = cursor->block();
if (!TextEditDocumentLayout::hasParentheses(block) || TextEditDocumentLayout::ifdefedOut(block))
if (!BaseTextDocumentLayout::hasParentheses(block) || BaseTextDocumentLayout::ifdefedOut(block))
return NoMatch;
Parentheses parenList = TextEditDocumentLayout::parentheses(block);
Parentheses parenList = BaseTextDocumentLayout::parentheses(block);
Parenthesis openParen, closedParen;
QTextBlock openParenParag = block;
......@@ -305,9 +305,9 @@ TextBlockUserData::MatchType TextBlockUserData::checkClosedParenthesis(QTextCurs
if (!openParenParag.isValid())
return NoMatch;
if (TextEditDocumentLayout::hasParentheses(openParenParag)
&& !TextEditDocumentLayout::ifdefedOut(openParenParag)) {
parenList = TextEditDocumentLayout::parentheses(openParenParag);
if (BaseTextDocumentLayout::hasParentheses(openParenParag)
&& !BaseTextDocumentLayout::ifdefedOut(openParenParag)) {
parenList = BaseTextDocumentLayout::parentheses(openParenParag);
break;
}
}
......@@ -346,8 +346,8 @@ bool TextBlockUserData::findPreviousOpenParenthesis(QTextCursor *cursor, bool se
int position = cursor->position();
int ignore = 0;
while (block.isValid()) {
Parentheses parenList = TextEditDocumentLayout::parentheses(block);
if (!parenList.isEmpty() && !TextEditDocumentLayout::ifdefedOut(block)) {
Parentheses parenList = BaseTextDocumentLayout::parentheses(block);
if (!parenList.isEmpty() && !BaseTextDocumentLayout::ifdefedOut(block)) {
for (int i = parenList.count()-1; i >= 0; --i) {
Parenthesis paren = parenList.at(i);
if (block == cursor->block() &&
......@@ -374,8 +374,8 @@ bool TextBlockUserData::findPreviousBlockOpenParenthesis(QTextCursor *cursor, bo
int position = cursor->position();
int ignore = 0;
while (block.isValid()) {
Parentheses parenList = TextEditDocumentLayout::parentheses(block);
if (!parenList.isEmpty() && !TextEditDocumentLayout::ifdefedOut(block)) {
Parentheses parenList = BaseTextDocumentLayout::parentheses(block);
if (!parenList.isEmpty() && !BaseTextDocumentLayout::ifdefedOut(block)) {
for (int i = parenList.count()-1; i >= 0; --i) {
Parenthesis paren = parenList.at(i);
if (paren.chr != QLatin1Char('{') && paren.chr != QLatin1Char('}')
......@@ -410,8 +410,8 @@ bool TextBlockUserData::findNextClosingParenthesis(QTextCursor *cursor, bool sel
int position = cursor->position();
int ignore = 0;
while (block.isValid()) {
Parentheses parenList = TextEditDocumentLayout::parentheses(block);
if (!parenList.isEmpty() && !TextEditDocumentLayout::ifdefedOut(block)) {
Parentheses parenList = BaseTextDocumentLayout::parentheses(block);
if (!parenList.isEmpty() && !BaseTextDocumentLayout::ifdefedOut(block)) {
for (int i = 0; i < parenList.count(); ++i) {
Parenthesis paren = parenList.at(i);
if (block == cursor->block() &&
......@@ -438,8 +438,8 @@ bool TextBlockUserData::findNextBlockClosingParenthesis(QTextCursor *cursor)
int position = cursor->position();
int ignore = 0;
while (block.isValid()) {
Parentheses parenList = TextEditDocumentLayout::parentheses(block);
if (!parenList.isEmpty() && !TextEditDocumentLayout::ifdefedOut(block)) {
Parentheses parenList = BaseTextDocumentLayout::parentheses(block);
if (!parenList.isEmpty() && !BaseTextDocumentLayout::ifdefedOut(block)) {
for (int i = 0; i < parenList.count(); ++i) {
Parenthesis paren = parenList.at(i);
if (paren.chr != QLatin1Char('{') && paren.chr != QLatin1Char('}')
......@@ -469,12 +469,12 @@ TextBlockUserData::MatchType TextBlockUserData::matchCursorBackward(QTextCursor
cursor->clearSelection();
const QTextBlock block = cursor->block();
if (!TextEditDocumentLayout::hasParentheses(block) || TextEditDocumentLayout::ifdefedOut(block))
if (!BaseTextDocumentLayout::hasParentheses(block) || BaseTextDocumentLayout::ifdefedOut(block))
return NoMatch;
const int relPos = cursor->position() - block.position();
Parentheses parentheses = TextEditDocumentLayout::parentheses(block);
Parentheses parentheses = BaseTextDocumentLayout::parentheses(block);
const Parentheses::const_iterator cend = parentheses.constEnd();
for (Parentheses::const_iterator it = parentheses.constBegin();it != cend; ++it) {
const Parenthesis &paren = *it;
......@@ -491,12 +491,12 @@ TextBlockUserData::MatchType TextBlockUserData::matchCursorForward(QTextCursor *
cursor->clearSelection();
const QTextBlock block = cursor->block();
if (!TextEditDocumentLayout::hasParentheses(block) || TextEditDocumentLayout::ifdefedOut(block))
if (!BaseTextDocumentLayout::hasParentheses(block) || BaseTextDocumentLayout::ifdefedOut(block))
return NoMatch;
const int relPos = cursor->position() - block.position();
Parentheses parentheses = TextEditDocumentLayout::parentheses(block);
Parentheses parentheses = BaseTextDocumentLayout::parentheses(block);
const Parentheses::const_iterator cend = parentheses.constEnd();
for (Parentheses::const_iterator it = parentheses.constBegin();it != cend; ++it) {
const Parenthesis &paren = *it;
......@@ -509,17 +509,17 @@ TextBlockUserData::MatchType TextBlockUserData::matchCursorForward(QTextCursor *
}
TextEditDocumentLayout::TextEditDocumentLayout(QTextDocument *doc)
BaseTextDocumentLayout::BaseTextDocumentLayout(QTextDocument *doc)
:QPlainTextDocumentLayout(doc) {
lastSaveRevision = 0;
hasMarks = 0;
}
TextEditDocumentLayout::~TextEditDocumentLayout()
BaseTextDocumentLayout::~BaseTextDocumentLayout()
{
}
void TextEditDocumentLayout::setParentheses(const QTextBlock &block, const Parentheses &parentheses)
void BaseTextDocumentLayout::setParentheses(const QTextBlock &block, const Parentheses &parentheses)
{
if (parentheses.isEmpty()) {
if (TextBlockUserData *userData = testUserData(block))
......@@ -529,47 +529,47 @@ void TextEditDocumentLayout::setParentheses(const QTextBlock &block, const Paren
}
}
Parentheses TextEditDocumentLayout::parentheses(const QTextBlock &block)
Parentheses BaseTextDocumentLayout::parentheses(const QTextBlock &block)
{
if (TextBlockUserData *userData = testUserData(block))
return userData->parentheses();
return Parentheses();
}
bool TextEditDocumentLayout::hasParentheses(const QTextBlock &block)
bool BaseTextDocumentLayout::hasParentheses(const QTextBlock &block)
{
if (TextBlockUserData *userData = testUserData(block))
return userData->hasParentheses();
return false;
}
bool TextEditDocumentLayout::setIfdefedOut(const QTextBlock &block)
bool BaseTextDocumentLayout::setIfdefedOut(const QTextBlock &block)
{
return userData(block)->setIfdefedOut();
}
bool TextEditDocumentLayout::clearIfdefedOut(const QTextBlock &block)
bool BaseTextDocumentLayout::clearIfdefedOut(const QTextBlock &block)
{
if (TextBlockUserData *userData = testUserData(block))
return userData->clearIfdefedOut();
return false;
}
bool TextEditDocumentLayout::ifdefedOut(const QTextBlock &block)
bool BaseTextDocumentLayout::ifdefedOut(const QTextBlock &block)
{
if (TextBlockUserData *userData = testUserData(block))
return userData->ifdefedOut();
return false;
}
int TextEditDocumentLayout::braceDepthDelta(const QTextBlock &block)
int BaseTextDocumentLayout::braceDepthDelta(const QTextBlock &block)
{
if (TextBlockUserData *userData = testUserData(block))
return userData->braceDepthDelta();
return 0;
}
int TextEditDocumentLayout::braceDepth(const QTextBlock &block)
int BaseTextDocumentLayout::braceDepth(const QTextBlock &block)
{
int state = block.userState();
if (state == -1)
......@@ -577,7 +577,7 @@ int TextEditDocumentLayout::braceDepth(const QTextBlock &block)
return state >> 8;
}
void TextEditDocumentLayout::setBraceDepth(QTextBlock &block, int depth)
void BaseTextDocumentLayout::setBraceDepth(QTextBlock &block, int depth)
{
int state = block.userState();
if (state == -1)
......@@ -586,7 +586,7 @@ void TextEditDocumentLayout::setBraceDepth(QTextBlock &block, int depth)
block.setUserState((depth << 8) | state);
}
void TextEditDocumentLayout::changeBraceDepth(QTextBlock &block, int delta)
void BaseTextDocumentLayout::changeBraceDepth(QTextBlock &block, int delta)
{
if (delta)
setBraceDepth(block, braceDepth(block) + delta);
......
......@@ -173,13 +173,13 @@ private:
};
class TEXTEDITOR_EXPORT TextEditDocumentLayout : public QPlainTextDocumentLayout
class TEXTEDITOR_EXPORT BaseTextDocumentLayout : public QPlainTextDocumentLayout
{
Q_OBJECT
public:
TextEditDocumentLayout(QTextDocument *doc);
~TextEditDocumentLayout();
BaseTextDocumentLayout(QTextDocument *doc);
~BaseTextDocumentLayout();
static void setParentheses(const QTextBlock &block, const Parentheses &parentheses);
static void clearParentheses(const QTextBlock &block) { setParentheses(block, Parentheses());}
......
......@@ -590,7 +590,7 @@ bool BaseTextEditor::open(const QString &fileName)
void BaseTextEditorPrivate::collapseLicenseHeader()
{
QTextDocument *doc = q->document();
TextEditDocumentLayout *documentLayout = qobject_cast<TextEditDocumentLayout*>(doc->documentLayout());
BaseTextDocumentLayout *documentLayout = qobject_cast<BaseTextDocumentLayout*>(doc->documentLayout());
QTC_ASSERT(documentLayout, return);
QTextBlock block = doc->firstBlock();
const TabSettings &ts = m_document->tabSettings();
......@@ -1768,7 +1768,7 @@ void BaseTextEditorPrivate::setupDocumentSignals(BaseTextDocument *document)
}
QTextDocument *doc = document->document();
TextEditDocumentLayout *documentLayout = qobject_cast<TextEditDocumentLayout*>(doc->documentLayout());
BaseTextDocumentLayout *documentLayout = qobject_cast<BaseTextDocumentLayout*>(doc->documentLayout());
if (!documentLayout) {
QTextOption opt = doc->defaultTextOption();
opt.setTextDirection(Qt::LeftToRight);
......@@ -1776,7 +1776,7 @@ void BaseTextEditorPrivate::setupDocumentSignals(BaseTextDocument *document)
| QTextOption::AddSpaceForLineAndParagraphSeparators
);
doc->setDefaultTextOption(opt);
documentLayout = new TextEditDocumentLayout(doc);
documentLayout = new BaseTextDocumentLayout(doc);
doc->setDocumentLayout(documentLayout);
}
......@@ -2162,7 +2162,7 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
QPainter painter(viewport());
QTextDocument *doc = document();
TextEditDocumentLayout *documentLayout = qobject_cast<TextEditDocumentLayout*>(doc->documentLayout());
BaseTextDocumentLayout *documentLayout = qobject_cast<BaseTextDocumentLayout*>(doc->documentLayout());
QTC_ASSERT(documentLayout, return);
QPointF offset(contentOffset());
......@@ -2344,7 +2344,7 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
if (r.bottom() >= er.top() && r.top() <= er.bottom()) {
if (TextEditDocumentLayout::ifdefedOut(block)) {
if (BaseTextDocumentLayout::ifdefedOut(block)) {
QRectF rr = r;
rr.setRight(viewportRect.width() - offset.x());
if (lineX > 0)
......@@ -2355,7 +2355,7 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
QTextLayout *layout = block.layout();
QTextOption option = layout->textOption();
if (suppressSyntaxInIfdefedOutBlock && TextEditDocumentLayout::ifdefedOut(block)) {
if (suppressSyntaxInIfdefedOutBlock && BaseTextDocumentLayout::ifdefedOut(block)) {
option.setFlags(option.flags() | QTextOption::SuppressColors);
painter.setPen(d->m_ifdefedOutFormat.foreground().color());
} else {
......@@ -2437,7 +2437,7 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
}
rr.setRight(qMin(lineX, rr.right()));
}
if (d->m_highlightBlocksInfo.isEmpty() || TextEditDocumentLayout::ifdefedOut(block))
if (d->m_highlightBlocksInfo.isEmpty() || BaseTextDocumentLayout::ifdefedOut(block))
painter.fillRect(rr, d->m_currentLineFormat.background());
}
......@@ -2732,7 +2732,7 @@ QWidget *BaseTextEditor::extraArea() const
int BaseTextEditor::extraAreaWidth(int *markWidthPtr) const
{
TextEditDocumentLayout *documentLayout = qobject_cast<TextEditDocumentLayout*>(document()->documentLayout());
BaseTextDocumentLayout *documentLayout = qobject_cast<BaseTextDocumentLayout*>(document()->documentLayout());
if (!documentLayout)
return 0;
......@@ -2818,7 +2818,7 @@ static void drawRectBox(QPainter *painter, const QRect &rect, bool start, bool e
void BaseTextEditor::extraAreaPaintEvent(QPaintEvent *e)
{
QTextDocument *doc = document();
TextEditDocumentLayout *documentLayout = qobject_cast<TextEditDocumentLayout*>(doc->documentLayout());
BaseTextDocumentLayout *documentLayout = qobject_cast<BaseTextDocumentLayout*>(doc->documentLayout());
QTC_ASSERT(documentLayout, return);
int selStart = textCursor().selectionStart();
......@@ -2933,7 +2933,7 @@ void BaseTextEditor::extraAreaPaintEvent(QPaintEvent *e)
}
}
TextBlockUserData *nextBlockUserData = TextEditDocumentLayout::testUserData(nextBlock);
TextBlockUserData *nextBlockUserData = BaseTextDocumentLayout::testUserData(nextBlock);
bool collapseNext = nextBlockUserData
&& nextBlockUserData->collapseMode() == TextBlockUserData::CollapseThis
......@@ -3072,7 +3072,7 @@ void BaseTextEditor::slotModificationChanged(bool m)
return;
QTextDocument *doc = document();
TextEditDocumentLayout *documentLayout = qobject_cast<TextEditDocumentLayout*>(doc->documentLayout());
BaseTextDocumentLayout *documentLayout = qobject_cast<BaseTextDocumentLayout*>(doc->documentLayout());
QTC_ASSERT(documentLayout, return);
int oldLastSaveRevision = documentLayout->lastSaveRevision;
documentLayout->lastSaveRevision = doc->revision();
......@@ -3149,8 +3149,8 @@ void BaseTextEditor::slotCursorPositionChanged()
{
#if 0
qDebug() << "block" << textCursor().blockNumber()+1
<< "depth:" << TextEditDocumentLayout::braceDepth(textCursor().block())
<< '/' << TextEditDocumentLayout::braceDepth(document()->lastBlock());
<< "depth:" << BaseTextDocumentLayout::braceDepth(textCursor().block())
<< '/' << BaseTextDocumentLayout::braceDepth(document()->lastBlock());
#endif
if (!d->m_contentsChanged && d->m_lastCursorChangeWasInteresting) {
Core::EditorManager::instance()->addCurrentPositionToNavigationHistory(editableInterface(), d->m_tempNavigationState);
......@@ -3524,7 +3524,7 @@ void BaseTextEditor::ensureCursorVisible()
void BaseTextEditor::toggleBlockVisible(const QTextBlock &block)
{
TextEditDocumentLayout *documentLayout = qobject_cast<TextEditDocumentLayout*>(document()->documentLayout());
BaseTextDocumentLayout *documentLayout = qobject_cast<BaseTextDocumentLayout*>(document()->documentLayout());
QTC_ASSERT(documentLayout, return);
bool visible = block.next().isVisible();
......@@ -3731,8 +3731,8 @@ void BaseTextEditor::countBrackets(QTextCursor cursor, int from, int end, QChar
cursor.setPosition(from);
QTextBlock block = cursor.block();
while (block.isValid() && block.position() < end) {
TextEditor::Parentheses parenList = TextEditor::TextEditDocumentLayout::parentheses(block);
if (!parenList.isEmpty() && !TextEditor::TextEditDocumentLayout::ifdefedOut(block)) {
TextEditor::Parentheses parenList = TextEditor::BaseTextDocumentLayout::parentheses(block);
if (!parenList.isEmpty() && !TextEditor::BaseTextDocumentLayout::ifdefedOut(block)) {
for (int i = 0; i < parenList.count(); ++i) {
TextEditor::Parenthesis paren = parenList.at(i);
int position = block.position() + paren.pos;
......@@ -4077,7 +4077,7 @@ void BaseTextEditor::clearLink()
void BaseTextEditorPrivate::updateMarksBlock(const QTextBlock &block)
{
if (const TextBlockUserData *userData = TextEditDocumentLayout::testUserData(block))
if (const TextBlockUserData *userData = BaseTextDocumentLayout::testUserData(block))
foreach (ITextMark *mrk, userData->marks())
mrk->updateBlock(block);
}
......@@ -4088,7 +4088,7 @@ void BaseTextEditorPrivate::updateMarksLineNumber()
QTextBlock block = doc->begin();
int blockNumber = 0;
while (block.isValid()) {
if (const TextBlockUserData *userData = TextEditDocumentLayout::testUserData(block))
if (const TextBlockUserData *userData = BaseTextDocumentLayout::testUserData(block))
foreach (ITextMark *mrk, userData->marks()) {
mrk->updateLineNumber(blockNumber + 1);
}
......@@ -4493,7 +4493,7 @@ QString BaseTextEditor::extraSelectionTooltip(int pos) const
void BaseTextEditor::setIfdefedOutBlocks(const QList<BaseTextEditor::BlockRange> &blocks)
{
QTextDocument *doc = document();
TextEditDocumentLayout *documentLayout = qobject_cast<TextEditDocumentLayout*>(doc->documentLayout());
BaseTextDocumentLayout *documentLayout = qobject_cast<BaseTextDocumentLayout*>(doc->documentLayout());
QTC_ASSERT(documentLayout, return);
bool needUpdate = false;
......@@ -4508,19 +4508,19 @@ void BaseTextEditor::setIfdefedOutBlocks(const QList<BaseTextEditor::BlockRange>
if (rangeNumber < blocks.size()) {
const BlockRange &range = blocks.at(rangeNumber);
if (block.position() >= range.first && ((block.position() + block.length() - 1) <= range.last || !range.last)) {
set = TextEditDocumentLayout::setIfdefedOut(block);
set = BaseTextDocumentLayout::setIfdefedOut(block);
} else {
cleared = TextEditDocumentLayout::clearIfdefedOut(block);
cleared = BaseTextDocumentLayout::clearIfdefedOut(block);
}
if (block.contains(range.last))
++rangeNumber;
} else {
cleared = TextEditDocumentLayout::clearIfdefedOut(block);
cleared = BaseTextDocumentLayout::clearIfdefedOut(block);
}
if (cleared || set) {
needUpdate = true;
int delta = TextEditDocumentLayout::braceDepthDelta(block);
int delta = BaseTextDocumentLayout::braceDepthDelta(block);
if (cleared)
braceDepthDelta += delta;
else if (set)
......@@ -4528,7 +4528,7 @@ void BaseTextEditor::setIfdefedOutBlocks(const QList<BaseTextEditor::BlockRange>
}
if (braceDepthDelta)
TextEditDocumentLayout::changeBraceDepth(block,braceDepthDelta);
BaseTextDocumentLayout::changeBraceDepth(block,braceDepthDelta);
block = block.next();
}
......@@ -4802,7 +4802,7 @@ void BaseTextEditor::setStorageSettings(const StorageSettings &storageSettings)
void BaseTextEditor::collapse()
{
QTextDocument *doc = document();
TextEditDocumentLayout *documentLayout = qobject_cast<TextEditDocumentLayout*>(doc->documentLayout());
BaseTextDocumentLayout *documentLayout = qobject_cast<BaseTextDocumentLayout*>(doc->documentLayout());
QTC_ASSERT(documentLayout, return);
QTextBlock block = textCursor().block();
QTextBlock curBlock = block;
......@@ -4826,7 +4826,7 @@ void BaseTextEditor::collapse()
void BaseTextEditor::expand()
{
QTextDocument *doc = document();
TextEditDocumentLayout *documentLayout = qobject_cast<TextEditDocumentLayout*>(doc->documentLayout());
BaseTextDocumentLayout *documentLayout = qobject_cast<BaseTextDocumentLayout*>(doc->documentLayout());
QTC_ASSERT(documentLayout, return);
QTextBlock block = textCursor().block();
while (block.isValid() && !block.isVisible())
......@@ -4840,7 +4840,7 @@ void BaseTextEditor::expand()
void BaseTextEditor::unCollapseAll()
{
QTextDocument *doc = document();
TextEditDocumentLayout *documentLayout = qobject_cast<TextEditDocumentLayout*>(doc->documentLayout());
BaseTextDocumentLayout *documentLayout = qobject_cast<BaseTextDocumentLayout*>(doc->documentLayout());
QTC_ASSERT(documentLayout, return);
QTextBlock block = doc->firstBlock();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment