Kate
katerenderer.cpp
Go to the documentation of this file.
172 void KateRenderer::paintTextLineBackground(QPainter& paint, KateLineLayoutPtr layout, int currentViewLine, int xStart, int xEnd)
192 KTextEditor::MarkInterface::MarkTypes markType = (KTextEditor::MarkInterface::MarkTypes)(1<<bit);
234 paint.fillRect(0, lineHeight() * currentViewLine, xEnd - xStart, lineHeight(), currentLineColor);
340 QList<QTextLayout::FormatRange> KateRenderer::decorationsForLine( const Kate::TextLine& textLine, int line, bool selectionsOnly, KateRenderRange* completionHighlight, bool completionSelected ) const
345 QList<Kate::TextRange *> rangesWithAttributes = m_doc->buffer().rangesForLine (line, m_printerFriendly ? 0 : m_view, true);
354 inbuiltHighlight->addRange(new KTextEditor::Range(KTextEditor::Cursor(line, al[i].offset), al[i].length), specificAttribute(al[i].attributeValue));
363 // sort all ranges, we want that the most specific ranges win during rendering, multiple equal ranges are kind of random, still better than old smart rangs behavior ;)
375 if (KTextEditor::Attribute::Ptr attributeMouseIn = attribute->dynamicAttribute (KTextEditor::Attribute::ActivateMouseIn)) {
381 if (KTextEditor::Attribute::Ptr attributeCaretIn = attribute->dynamicAttribute (KTextEditor::Attribute::ActivateCaretIn)) {
398 if ((selectionsOnly && showSelections() && m_view->selection()) || (completionHighlight && completionSelected) || m_view->blockSelection()) {
407 backgroundAttribute->setForeground(attribute(KTextEditor::HighlightInterface::dsNormal)->selectedForeground().color());
411 selectionHighlight->addRange(new KTextEditor::Range(line, 0, line + 1, 0), backgroundAttribute);
414 selectionHighlight->addRange(new KTextEditor::Range(m_doc->rangeOnLine(m_view->selectionRange(), line)), backgroundAttribute);
416 selectionHighlight->addRange(new KTextEditor::Range(m_view->selectionRange()), backgroundAttribute);
425 // Calculate the range which we need to iterate in order to get the highlighting for just this line
432 KTextEditor::Range rangeNeeded = m_view->selectionRange() & KTextEditor::Range(line, 0, line + 1, 0);
491 void KateRenderer::assignSelectionBrushesFromAttribute(QTextLayout::FormatRange& target, const KTextEditor::Attribute& attribute) const
506 void KateRenderer::paintTextLine(QPainter& paint, KateLineLayoutPtr range, int xStart, int xEnd, const KTextEditor::Cursor* cursor)
522 bool drawSelection = m_view->selection() && showSelections() && m_view->selectionRange().overlapsLine(range->line());
523 // Draw selection in block selecton mode. We need 2 kinds of selections that QTextLayout::draw can't render:
527 int selectionStartColumn = m_doc->fromVirtualColumn(range->line(), m_doc->toVirtualColumn(m_view->selectionRange().start()));
528 int selectionEndColumn = m_doc->fromVirtualColumn(range->line(), m_doc->toVirtualColumn(m_view->selectionRange().end()));
533 int selectionStartX = (selectionStartColumn > lastLine.startCol()) ? cursorToX(lastLine, selectionStartColumn, true) : 0;
535 paint.fillRect(QRect(selectionStartX - xStart, (int)lastLine.lineLayout().y(), selectionEndX - selectionStartX, lineHeight()), selectionBrush);
541 paint.fillRect(QRect(selectionX - xStart, (int)selectionLine.lineLayout().y(), selectStickWidth, lineHeight()), selectionBrush);
613 if (m_view->selection() && !m_view->blockSelection() && m_view->lineEndSelected(line.end(true))) {
683 paintTrailingSpace(paint, line.lineLayout().cursorToX(spaceIndex) - xStart + spaceWidth()/2.0, y);
694 paint.fillRect(0, lineHeight(), range->shiftX() - xStart, lineHeight() * (range->viewLineCount() - 1),
696 paint.fillRect(0, lineHeight(), range->shiftX() - xStart, lineHeight() * (range->viewLineCount() - 1),
789 paint.drawLine(0, (lineHeight() * range->viewLineCount()) - 1, xEnd - xStart, (lineHeight() * range->viewLineCount()) - 1);
794 if ((!isPrinterFriendly()) && config()->wordWrapMarker() && QFontInfo(config()->font()).fixedPitch())
912 void KateRenderer::layoutLine(KateLineLayoutPtr lineLayout, int maxwidth, bool cacheLayout) const
1053 int KateRenderer::cursorToX(const KateTextLayout& range, const KTextEditor::Cursor & pos, bool returnPastLine) const
1071 KTextEditor::Cursor KateRenderer::xToCursor(const KateTextLayout & range, int x, bool returnPastLine ) const
Cursor & start()
int cursorToX(const KateTextLayout &range, int col, bool returnPastLine=false) const
Returns the x position of cursor col on the line range.
Definition: katerenderer.cpp:1048
void setShowSelections(bool showSelections)
Set whether the view's selections should be shown.
Definition: katerenderer.cpp:135
bool drawCaret() const
Determine whether the caret (text cursor) will be drawn.
Definition: katerenderer.h:115
void addRange(KTextEditor::Range *range, KTextEditor::Attribute::Ptr attribute)
Definition: katerenderrange.cpp:96
const QColor & selectionColor() const
Definition: kateconfig.cpp:2199
Definition: katerenderer.h:71
static const QChar nbSpaceChar(0xa0)
void paintTextLineBackground(QPainter &paint, KateLineLayoutPtr layout, int currentViewLine, int xStart, int xEnd)
Paint the background of a line.
Definition: katerenderer.cpp:172
KateTextLayout viewLine(int viewLine) const
Definition: katelinelayout.cpp:177
void advanceTo(const KTextEditor::Cursor &pos)
Definition: katerenderrange.cpp:165
const KTextEditor::MovingCursor & start() const
Retrieve start cursor of this range, read-only.
Definition: katetextrange.h:119
const QColor & lineMarkerColor(KTextEditor::MarkInterface::MarkTypes type=KTextEditor::MarkInterface::markType01) const
Definition: kateconfig.cpp:2241
void setCaretOverrideColor(const QColor &color)
Set a brush with which to override drawing of the caret.
Definition: katerenderer.cpp:1083
KateRenderer(KateDocument *doc, Kate::TextFolding &folding, KateView *view=0)
Constructor.
Definition: katerenderer.cpp:49
const QFontMetricsF & currentFontMetrics() const
Definition: katerenderer.cpp:810
KTextEditor::Attribute::Ptr attribute(uint pos) const
This takes an in index, and returns all the attributes for it.
Definition: katerenderer.cpp:79
const Kate::TextLine & textLine(bool forceReload=false) const
Definition: katelinelayout.cpp:65
Definition: katerenderrange.h:66
QBrush selectedForeground() const
void increaseFontSizes()
Change to a different font (soon to be font set?)
Definition: katerenderer.cpp:140
const QColor & wordWrapMarkerColor() const
Definition: kateconfig.cpp:2296
void layoutLine(KateLineLayoutPtr line, int maxwidth=-1, bool cacheLayout=false) const
Text width & height calculation functions...
Definition: katerenderer.cpp:912
static Cursor start()
int fromVirtualColumn(int line, int column) const
Definition: katedocument.cpp:2579
int endCol(bool indicateEOL=false) const
Return the end column of this text line.
Definition: katetextlayout.cpp:140
KTextEditor::Cursor xToCursor(const KateTextLayout &range, int x, bool returnPastLine=false) const
Returns the real cursor which is occupied by the specified x value, or that closest to it...
Definition: katerenderer.cpp:1071
KSharedConfigPtr config()
void setShowTrailingSpaces(bool showSpaces)
Set whether a mark should be painted for trailing spaces.
Definition: katerenderer.cpp:110
bool includesCursor(const KTextEditor::Cursor &realCursor) const
Definition: katelinelayout.cpp:60
virtual const KTextEditor::Range & selectionRange() const
Definition: kateview.cpp:2760
int dynWordWrapAlignIndent() const
Definition: kateconfig.cpp:1360
Handles all of the work of rendering the text (used for the views and printing)
Definition: katerenderer.h:50
void setShowTabs(bool showTabs)
Set whether a mark should be painted to help identifying tabs.
Definition: katerenderer.cpp:105
void setPrinterFriendly(bool printerFriendly)
Configure this renderer to paint in a printer-friendly fashion.
Definition: katerenderer.cpp:163
Definition: katerenderer.h:72
Definition: katerenderer.h:73
bool getSelectionBounds(int line, int lineLength, int &start, int &end) const
Definition: katerenderer.cpp:830
KSharedPtr< Attribute > Ptr
QList< KTextEditor::Attribute::Ptr > attributes(const QString &schema)
Definition: katehighlight.cpp:2134
KateView * view() const
Returns the view to which this renderer is bound.
Definition: katerenderer.h:103
Definition: katerenderrange.h:47
static const QChar spaceChar(' ')
KTextEditor::Range rangeOnLine(KTextEditor::Range range, int line) const
Definition: katedocument.cpp:319
Class representing the folding information for a TextBuffer.
Definition: katetextfolding.h:42
Definition: katerenderer.h:70
void setShowIndentationLines(bool on)
Definition: kateconfig.cpp:2589
Definition: kateview.h:78
const Cursor toCursor() const
const QColor & highlightedLineColor() const
Definition: kateconfig.cpp:2220
Definition: katedocument.h:74
void updateAttributes()
update the highlighting attributes (for example after an hl change or after hl config changed) ...
Definition: katerenderer.cpp:74
QBrush selectedBackground() const
static const QChar tabChar('\t')
bool overlapsLine(int line) const
KTextEditor::Attribute::Ptr specificAttribute(int context) const
Definition: katerenderer.cpp:87
int viewLineForColumn(int column) const
Definition: katelinelayout.cpp:212
virtual int line() const
QList< TextRange * > rangesForLine(int line, KTextEditor::View *view, bool rangesWithAttributeOnly) const
Return the ranges which affect the given line.
Definition: katetextbuffer.cpp:872
const KTextEditor::MovingCursor & end() const
Retrieve end cursor of this range, read-only.
Definition: katetextrange.h:131
Definition: kateconfig.h:591
This class represents one visible line of text; with dynamic wrapping, many KateTextLayouts can be ne...
Definition: katetextlayout.h:38
KateRenderer::caretStyles caretStyle() const
The style of the caret (text cursor) to be painted.
Definition: katerenderer.h:127
static bool rangeLessThanForRenderer(const Kate::TextRange *a, const Kate::TextRange *b)
Definition: katerenderer.cpp:320
void setCaretStyle(KateRenderer::caretStyles style)
Set the style of caret to be painted.
Definition: katerenderer.cpp:100
Cursor & end()
bool containsLine(int line) const
QSharedPointer< TextLineData > TextLine
The normal world only accesses the text lines with shared pointers.
Definition: katetextline.h:443
void paintTextLine(QPainter &paint, KateLineLayoutPtr range, int xStart, int xEnd, const KTextEditor::Cursor *cursor=0L)
This is the ultimate function to perform painting of a text line.
Definition: katerenderer.cpp:506
KTextEditor::Attribute::Ptr generateAttribute() const
Definition: katerenderrange.cpp:189
KTextEditor::Cursor end(bool indicateEOL=false) const
Return the end position of this text line.
Definition: katetextlayout.cpp:152
bool showIndentationLines() const
Definition: kateconfig.cpp:2581
int toVirtualColumn(int line, int column) const
Definition: katedocument.cpp:2564
bool startsInvisibleBlock() const
Definition: katelinelayout.cpp:97
const QFontMetricsF & fontMetrics() const
Definition: kateconfig.cpp:2135
KTextEditor::Attribute::Ptr attribute() const
Gets the active Attribute for this range.
Definition: katetextrange.h:173
QList< QTextLayout::FormatRange > decorationsForLine(const Kate::TextLine &textLine, int line, bool selectionsOnly=false, KateRenderRange *completionHighlight=0L, bool completionSelected=false) const
The ultimate decoration creation function.
Definition: katerenderer.cpp:340
bool lineEndSelected(const KTextEditor::Cursor &lineEndPos)
Definition: kateview.cpp:2076
KTextEditor::Cursor nextBoundary() const
Definition: katerenderrange.cpp:143
void setShowIndentLines(bool showLines)
Set whether a guide should be painted to help identifying indent lines.
Definition: katerenderer.cpp:125
void setDrawCaret(bool drawCaret)
Set whether the caret (text cursor) will be drawn.
Definition: katerenderer.cpp:95
virtual void setColumn(int column)
int column() const
Definition: katerenderrange.h:35
bool isLineRightToLeft(KateLineLayoutPtr lineLayout) const
This is a smaller QString::isRightToLeft().
Definition: katerenderer.cpp:1010
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:31:52 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:31:52 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.