Changeset View
Changeset View
Standalone View
Standalone View
src/render/katerenderer.cpp
Show First 20 Lines • Show All 556 Lines • ▼ Show 20 Line(s) | 553 | // qCDebug(LOG_KTE)<<"KateRenderer::paintTextLine"; | |||
---|---|---|---|---|---|
557 | 557 | | |||
558 | int currentViewLine = -1; | 558 | int currentViewLine = -1; | ||
559 | if (cursor && cursor->line() == range->line()) { | 559 | if (cursor && cursor->line() == range->line()) { | ||
560 | currentViewLine = range->viewLineForColumn(cursor->column()); | 560 | currentViewLine = range->viewLineForColumn(cursor->column()); | ||
561 | } | 561 | } | ||
562 | 562 | | |||
563 | paintTextLineBackground(paint, range, currentViewLine, xStart, xEnd); | 563 | paintTextLineBackground(paint, range, currentViewLine, xStart, xEnd); | ||
564 | 564 | | |||
565 | // Draws the dashed underline at the start of a folded block of text. | ||||
566 | if (!(flags & SkipDrawFirstInvisibleLineUnderlined) && range->startsInvisibleBlock()) { | ||||
567 | const QPainter::RenderHints backupRenderHints = paint.renderHints(); | ||||
568 | paint.setRenderHint(QPainter::Antialiasing, false); | ||||
569 | QPen pen(config()->foldingColor()); | ||||
570 | pen.setCosmetic(true); | ||||
571 | pen.setStyle(Qt::DashLine); | ||||
572 | pen.setDashOffset(xStart); | ||||
573 | pen.setWidth(2); | ||||
574 | paint.setPen(pen); | ||||
575 | paint.drawLine(0, (lineHeight() * range->viewLineCount()) - 2, xEnd - xStart, (lineHeight() * range->viewLineCount()) - 2); | ||||
576 | paint.setRenderHints(backupRenderHints); | ||||
577 | } | ||||
578 | | ||||
565 | if (range->layout()) { | 579 | if (range->layout()) { | ||
566 | bool drawSelection = m_view && m_view->selection() && showSelections() && m_view->selectionRange().overlapsLine(range->line()); | 580 | bool drawSelection = m_view && m_view->selection() && showSelections() && m_view->selectionRange().overlapsLine(range->line()); | ||
567 | // Draw selection in block selection mode. We need 2 kinds of selections that QTextLayout::draw can't render: | 581 | // Draw selection in block selection mode. We need 2 kinds of selections that QTextLayout::draw can't render: | ||
568 | // - past-end-of-line selection and | 582 | // - past-end-of-line selection and | ||
569 | // - 0-column-wide selection (used to indicate where text will be typed) | 583 | // - 0-column-wide selection (used to indicate where text will be typed) | ||
570 | if (drawSelection && m_view->blockSelection()) { | 584 | if (drawSelection && m_view->blockSelection()) { | ||
571 | int selectionStartColumn = m_doc->fromVirtualColumn(range->line(), m_doc->toVirtualColumn(m_view->selectionRange().start())); | 585 | int selectionStartColumn = m_doc->fromVirtualColumn(range->line(), m_doc->toVirtualColumn(m_view->selectionRange().start())); | ||
572 | int selectionEndColumn = m_doc->fromVirtualColumn(range->line(), m_doc->toVirtualColumn(m_view->selectionRange().end())); | 586 | int selectionEndColumn = m_doc->fromVirtualColumn(range->line(), m_doc->toVirtualColumn(m_view->selectionRange().end())); | ||
▲ Show 20 Lines • Show All 304 Lines • ▼ Show 20 Line(s) | 890 | if ((x >= xStart) && (x <= xEnd)) { | |||
877 | paint.fillRect(x - xStart, (int)lastLine.lineLayout().y(), caretWidth, lineHeight(), color); | 891 | paint.fillRect(x - xStart, (int)lastLine.lineLayout().y(), caretWidth, lineHeight(), color); | ||
878 | } | 892 | } | ||
879 | } | 893 | } | ||
880 | 894 | | |||
881 | paint.restore(); | 895 | paint.restore(); | ||
882 | } | 896 | } | ||
883 | } | 897 | } | ||
884 | 898 | | |||
885 | // Draws the dashed underline at the start of a folded block of text. | | |||
886 | if (!(flags & SkipDrawFirstInvisibleLineUnderlined) && range->startsInvisibleBlock()) { | | |||
887 | const QPainter::RenderHints backupRenderHints = paint.renderHints(); | | |||
888 | paint.setRenderHint(QPainter::Antialiasing, false); | | |||
889 | QPen pen(config()->wordWrapMarkerColor()); | | |||
890 | pen.setCosmetic(true); | | |||
891 | pen.setStyle(Qt::DashLine); | | |||
892 | pen.setDashOffset(xStart); | | |||
893 | paint.setPen(pen); | | |||
894 | paint.drawLine(0, (lineHeight() * range->viewLineCount()) - 1, xEnd - xStart, (lineHeight() * range->viewLineCount()) - 1); | | |||
895 | paint.setRenderHints(backupRenderHints); | | |||
896 | } | | |||
897 | | ||||
898 | // show word wrap marker if desirable | 899 | // show word wrap marker if desirable | ||
899 | if ((!isPrinterFriendly()) && config()->wordWrapMarker() && QFontInfo(config()->font()).fixedPitch()) { | 900 | if ((!isPrinterFriendly()) && config()->wordWrapMarker() && QFontInfo(config()->font()).fixedPitch()) { | ||
900 | const QPainter::RenderHints backupRenderHints = paint.renderHints(); | 901 | const QPainter::RenderHints backupRenderHints = paint.renderHints(); | ||
901 | paint.setRenderHint(QPainter::Antialiasing, false); | 902 | paint.setRenderHint(QPainter::Antialiasing, false); | ||
902 | paint.setPen(config()->wordWrapMarkerColor()); | 903 | paint.setPen(config()->wordWrapMarkerColor()); | ||
903 | int _x = qreal(m_doc->config()->wordWrapAt()) * fm.width(QLatin1Char('x')) - xStart; | 904 | int _x = qreal(m_doc->config()->wordWrapAt()) * fm.width(QLatin1Char('x')) - xStart; | ||
904 | paint.drawLine(_x, 0, _x, lineHeight()); | 905 | paint.drawLine(_x, 0, _x, lineHeight()); | ||
905 | paint.setRenderHints(backupRenderHints); | 906 | paint.setRenderHints(backupRenderHints); | ||
▲ Show 20 Lines • Show All 320 Lines • Show Last 20 Lines |