• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

Kate

  • kde-4.14
  • applications
  • kate
  • part
  • render
katelayoutcache.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE libraries and the Kate part.
2  *
3  * Copyright (C) 2005 Hamish Rodda <rodda@kde.org>
4  * Copyright (C) 2008 Dominik Haumann <dhaumann kde org>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 #include "katelayoutcache.h"
23 #include "katelayoutcache.moc"
24 
25 #include <QtAlgorithms>
26 
27 #include "katerenderer.h"
28 #include "kateview.h"
29 #include "katedocument.h"
30 #include "katebuffer.h"
31 
32 static bool enableLayoutCache = false;
33 
34 //BEGIN KateLineLayoutMap
35 KateLineLayoutMap::KateLineLayoutMap()
36 {
37 }
38 
39 KateLineLayoutMap::~KateLineLayoutMap()
40 {
41 }
42 
43 bool lessThan(const KateLineLayoutMap::LineLayoutPair& lhs,
44  const KateLineLayoutMap::LineLayoutPair& rhs)
45 {
46  return lhs.first < rhs.first;
47 }
48 
49 void KateLineLayoutMap::clear()
50 {
51  m_lineLayouts.clear();
52 }
53 
54 bool KateLineLayoutMap::contains(int i) const
55 {
56  LineLayoutMap::const_iterator it =
57  qBinaryFind(m_lineLayouts.constBegin(), m_lineLayouts.constEnd(), LineLayoutPair(i,KateLineLayoutPtr()), lessThan);
58  return (it != m_lineLayouts.constEnd());
59 }
60 
61 void KateLineLayoutMap::insert(int realLine, const KateLineLayoutPtr& lineLayoutPtr)
62 {
63  LineLayoutMap::iterator it =
64  qBinaryFind(m_lineLayouts.begin(), m_lineLayouts.end(), LineLayoutPair(realLine,KateLineLayoutPtr()), lessThan);
65  if (it != m_lineLayouts.end()) {
66  (*it).second = lineLayoutPtr;
67  } else {
68  it = qUpperBound(m_lineLayouts.begin(), m_lineLayouts.end(), LineLayoutPair(realLine,KateLineLayoutPtr()), lessThan);
69  m_lineLayouts.insert(it, LineLayoutPair(realLine, lineLayoutPtr));
70  }
71 }
72 
73 void KateLineLayoutMap::viewWidthIncreased()
74 {
75  LineLayoutMap::iterator it = m_lineLayouts.begin();
76  for ( ; it != m_lineLayouts.end(); ++it) {
77  if ((*it).second->isValid() && (*it).second->viewLineCount() > 1)
78  (*it).second->invalidateLayout();
79  }
80 }
81 
82 void KateLineLayoutMap::viewWidthDecreased(int newWidth)
83 {
84  LineLayoutMap::iterator it = m_lineLayouts.begin();
85  for ( ; it != m_lineLayouts.end(); ++it) {
86  if ((*it).second->isValid()
87  && ((*it).second->viewLineCount() > 1 || (*it).second->width() > newWidth))
88  (*it).second->invalidateLayout();
89  }
90 }
91 
92 void KateLineLayoutMap::relayoutLines(int startRealLine, int endRealLine)
93 {
94  LineLayoutMap::iterator start =
95  qLowerBound(m_lineLayouts.begin(), m_lineLayouts.end(), LineLayoutPair(startRealLine, KateLineLayoutPtr()), lessThan);
96  LineLayoutMap::iterator end =
97  qUpperBound(start, m_lineLayouts.end(), LineLayoutPair(endRealLine, KateLineLayoutPtr()), lessThan);
98 
99  while (start != end) {
100  (*start).second->setLayoutDirty();
101  ++start;
102  }
103 }
104 
105 void KateLineLayoutMap::slotEditDone(int fromLine, int toLine, int shiftAmount)
106 {
107  LineLayoutMap::iterator start =
108  qLowerBound(m_lineLayouts.begin(), m_lineLayouts.end(), LineLayoutPair(fromLine, KateLineLayoutPtr()), lessThan);
109  LineLayoutMap::iterator end =
110  qUpperBound(start, m_lineLayouts.end(), LineLayoutPair(toLine, KateLineLayoutPtr()), lessThan);
111  LineLayoutMap::iterator it;
112 
113  if (shiftAmount != 0) {
114  for (it = end; it != m_lineLayouts.end(); ++it) {
115  (*it).first += shiftAmount;
116  (*it).second->setLine((*it).second->line() + shiftAmount);
117  }
118 
119  for (it = start; it != end; ++it) {
120  (*it).second->clear();
121  }
122 
123  m_lineLayouts.erase(start, end);
124  } else {
125  for (it = start; it != end; ++it) {
126  (*it).second->setLayoutDirty();
127  }
128  }
129 }
130 
131 
132 KateLineLayoutPtr& KateLineLayoutMap::operator[](int i)
133 {
134  LineLayoutMap::iterator it =
135  qBinaryFind(m_lineLayouts.begin(), m_lineLayouts.end(), LineLayoutPair(i, KateLineLayoutPtr()), lessThan);
136  return (*it).second;
137 }
138 //END KateLineLayoutMap
139 
140 KateLayoutCache::KateLayoutCache(KateRenderer* renderer, QObject* parent)
141  : QObject(parent)
142  , m_renderer(renderer)
143  , m_startPos(-1,-1)
144  , m_viewWidth(0)
145  , m_wrap(false)
146  , m_acceptDirtyLayouts (false)
147 {
148  Q_ASSERT(m_renderer);
149 
153  connect(&m_renderer->doc()->buffer(), SIGNAL(lineWrapped(KTextEditor::Cursor)), this, SLOT(wrapLine(KTextEditor::Cursor)));
154  connect(&m_renderer->doc()->buffer(), SIGNAL(lineUnwrapped(int)), this, SLOT(unwrapLine(int)));
155  connect(&m_renderer->doc()->buffer(), SIGNAL(textInserted(KTextEditor::Cursor,QString)), this, SLOT(insertText(KTextEditor::Cursor,QString)));
156  connect(&m_renderer->doc()->buffer(), SIGNAL(textRemoved(KTextEditor::Range,QString)), this, SLOT(removeText(KTextEditor::Range)));
157 }
158 
159 void KateLayoutCache::updateViewCache(const KTextEditor::Cursor& startPos, int newViewLineCount, int viewLinesScrolled)
160 {
161  //kDebug( 13033 ) << startPos << " nvlc " << newViewLineCount << " vls " << viewLinesScrolled;
162 
163  int oldViewLineCount = m_textLayouts.count();
164  if (newViewLineCount == -1)
165  newViewLineCount = oldViewLineCount;
166 
167  enableLayoutCache = true;
168 
169  int realLine;
170  if (newViewLineCount == -1)
171  realLine = m_renderer->folding().visibleLineToLine(m_renderer->folding().lineToVisibleLine(startPos.line()));
172  else
173  realLine = m_renderer->folding().visibleLineToLine(startPos.line());
174  int _viewLine = 0;
175 
176  if (wrap()) {
177  // TODO check these assumptions are ok... probably they don't give much speedup anyway?
178  if (startPos == m_startPos && m_textLayouts.count()) {
179  _viewLine = m_textLayouts.first().viewLine();
180 
181  } else if (viewLinesScrolled > 0 && viewLinesScrolled < m_textLayouts.count()) {
182  _viewLine = m_textLayouts[viewLinesScrolled].viewLine();
183 
184  } else {
185  KateLineLayoutPtr l = line(realLine);
186  if (l) {
187  Q_ASSERT(l->isValid());
188  Q_ASSERT(l->length() >= startPos.column() || m_renderer->view()->wrapCursor());
189 
190  for (; _viewLine < l->viewLineCount(); ++_viewLine) {
191  const KateTextLayout& t = l->viewLine(_viewLine);
192  if (t.startCol() >= startPos.column() || _viewLine == l->viewLineCount() - 1)
193  goto foundViewLine;
194  }
195 
196  // FIXME FIXME need to calculate past-end-of-line position here...
197  Q_ASSERT(false);
198 
199  foundViewLine:
200  Q_ASSERT(true);
201  }
202  }
203  }
204 
205  m_startPos = startPos;
206 
207  // Move the text layouts if we've just scrolled...
208  if (viewLinesScrolled != 0) {
209  // loop backwards if we've just scrolled up...
210  bool forwards = viewLinesScrolled >= 0 ? true : false;
211  for (int z = forwards ? 0 : m_textLayouts.count() - 1; forwards ? (z < m_textLayouts.count()) : (z >= 0); forwards ? z++ : z--) {
212  int oldZ = z + viewLinesScrolled;
213  if (oldZ >= 0 && oldZ < m_textLayouts.count())
214  m_textLayouts[z] = m_textLayouts[oldZ];
215  }
216  }
217 
218  // Resize functionality
219  if (newViewLineCount > oldViewLineCount) {
220  m_textLayouts.reserve(newViewLineCount);
221 
222  } else if (newViewLineCount < oldViewLineCount) {
223  /* FIXME reintroduce... check we're not missing any
224  int lastLine = m_textLayouts[newSize - 1].line();
225  for (int i = oldSize; i < newSize; i++) {
226  const KateTextLayout& layout = m_textLayouts[i];
227  if (layout.line() > lastLine && !layout.viewLine())
228  layout.kateLineLayout()->layout()->setCacheEnabled(false);
229  }*/
230  m_textLayouts.resize(newViewLineCount);
231  }
232 
233  KateLineLayoutPtr l = line(realLine);
234  for (int i = 0; i < newViewLineCount; ++i) {
235  if (!l) {
236  if (i < m_textLayouts.count()) {
237  if (m_textLayouts[i].isValid())
238  m_textLayouts[i] = KateTextLayout::invalid();
239  } else {
240  m_textLayouts.append(KateTextLayout::invalid());
241  }
242  continue;
243  }
244 
245  Q_ASSERT(l->isValid());
246  Q_ASSERT(_viewLine < l->viewLineCount());
247 
248  if (i < m_textLayouts.count()) {
249  bool dirty = false;
250  if (m_textLayouts[i].line() != realLine || m_textLayouts[i].viewLine() != _viewLine || (!m_textLayouts[i].isValid() && l->viewLine(_viewLine).isValid()))
251  dirty = true;
252  m_textLayouts[i] = l->viewLine(_viewLine);
253  if (dirty)
254  m_textLayouts[i].setDirty(true);
255 
256  } else {
257  m_textLayouts.append(l->viewLine(_viewLine));
258  }
259 
260  //kDebug( 13033 ) << "Laid out line " << realLine << " (" << l << "), viewLine " << _viewLine << " (" << m_textLayouts[i].kateLineLayout().data() << ")";
261  //m_textLayouts[i].debugOutput();
262 
263  _viewLine++;
264 
265  if (_viewLine > l->viewLineCount() - 1) {
266  int virtualLine = l->virtualLine() + 1;
267  realLine = m_renderer->folding().visibleLineToLine(virtualLine);
268  _viewLine = 0;
269  if (realLine < m_renderer->doc()->lines()) {
270  l = line(realLine, virtualLine);
271  } else {
272  l = 0;
273  }
274  }
275  }
276 
277  enableLayoutCache = false;
278 }
279 
280 KateLineLayoutPtr KateLayoutCache::line( int realLine, int virtualLine )
281 {
282  if (m_lineLayouts.contains(realLine)) {
283  KateLineLayoutPtr l = m_lineLayouts[realLine];
284 
285  // ensure line is OK
286  Q_ASSERT (l->line() == realLine);
287  Q_ASSERT (realLine < m_renderer->doc()->buffer().lines());
288 
289  if (virtualLine != -1)
290  l->setVirtualLine(virtualLine);
291 
292  if (!l->isValid())
293  {
294  l->setUsePlainTextLine (acceptDirtyLayouts());
295  l->textLine (!acceptDirtyLayouts());
296  m_renderer->layoutLine(l, wrap() ? m_viewWidth : -1, enableLayoutCache);
297  }
298  else if (l->isLayoutDirty() && !acceptDirtyLayouts())
299  {
300  // reset textline
301  l->setUsePlainTextLine (false);
302  l->textLine (true);
303  m_renderer->layoutLine(l, wrap() ? m_viewWidth : -1, enableLayoutCache);
304  }
305 
306  Q_ASSERT(l->isValid() && (!l->isLayoutDirty() || acceptDirtyLayouts()));
307 
308  return l;
309  }
310 
311  if (realLine < 0 || realLine >= m_renderer->doc()->lines())
312  return KateLineLayoutPtr();
313 
314  KateLineLayoutPtr l(new KateLineLayout(*m_renderer));
315  l->setLine(realLine, virtualLine);
316 
317  // Mark it dirty, because it may not have the syntax highlighting applied
318  // mark this here, to allow layoutLine to use plainLines...
319  if (acceptDirtyLayouts())
320  l->setUsePlainTextLine (true);
321 
322  m_renderer->layoutLine(l, wrap() ? m_viewWidth : -1, enableLayoutCache);
323  Q_ASSERT(l->isValid());
324 
325  if (acceptDirtyLayouts())
326  l->setLayoutDirty (true);
327 
328  m_lineLayouts.insert(realLine, l);
329  return l;
330 }
331 
332 KateLineLayoutPtr KateLayoutCache::line( const KTextEditor::Cursor & realCursor )
333 {
334  return line(realCursor.line());
335 }
336 
337 KateTextLayout KateLayoutCache::textLayout( const KTextEditor::Cursor & realCursor )
338 {
339  /*if (realCursor >= viewCacheStart() && (realCursor < viewCacheEnd() || realCursor == viewCacheEnd() && !m_textLayouts.last().wrap()))
340  foreach (const KateTextLayout& l, m_textLayouts)
341  if (l.line() == realCursor.line() && (l.endCol() < realCursor.column() || !l.wrap()))
342  return l;*/
343 
344  return line(realCursor.line())->viewLine(viewLine(realCursor));
345 }
346 
347 KateTextLayout KateLayoutCache::textLayout( uint realLine, int _viewLine )
348 {
349  /*if (m_textLayouts.count() && (realLine >= m_textLayouts.first().line() && _viewLine >= m_textLayouts.first().viewLine()) &&
350  (realLine <= m_textLayouts.last().line() && _viewLine <= m_textLayouts.first().viewLine()))
351  foreach (const KateTextLayout& l, m_textLayouts)
352  if (l.line() == realLine && l.viewLine() == _viewLine)
353  return const_cast<KateTextLayout&>(l);*/
354 
355  return line(realLine)->viewLine(_viewLine);
356 }
357 
358 KateTextLayout & KateLayoutCache::viewLine( int _viewLine )
359 {
360  Q_ASSERT(_viewLine >= 0 && _viewLine < m_textLayouts.count());
361  return m_textLayouts[_viewLine];
362 }
363 
364 int KateLayoutCache::viewCacheLineCount( ) const
365 {
366  return m_textLayouts.count();
367 }
368 
369 KTextEditor::Cursor KateLayoutCache::viewCacheStart( ) const
370 {
371  return m_textLayouts.count() ? m_textLayouts.first().start() : KTextEditor::Cursor();
372 }
373 
374 KTextEditor::Cursor KateLayoutCache::viewCacheEnd( ) const
375 {
376  return m_textLayouts.count() ? m_textLayouts.last().end() : KTextEditor::Cursor();
377 }
378 
379 int KateLayoutCache::viewWidth( ) const
380 {
381  return m_viewWidth;
382 }
383 
389 int KateLayoutCache::viewLine(const KTextEditor::Cursor& realCursor)
390 {
391  if (realCursor.column() <= 0 || realCursor.line() < 0) return 0;
392 
393  Q_ASSERT(realCursor.line() < m_renderer->doc()->lines());
394  KateLineLayoutPtr thisLine = line(realCursor.line());
395 
396  for (int i = 0; i < thisLine->viewLineCount(); ++i) {
397  const KateTextLayout& l = thisLine->viewLine(i);
398  if (realCursor.column() >= l.startCol() && realCursor.column() < l.endCol())
399  return i;
400  }
401 
402  return thisLine->viewLineCount() - 1;
403 }
404 
405 int KateLayoutCache::displayViewLine(const KTextEditor::Cursor& virtualCursor, bool limitToVisible)
406 {
407  if (!virtualCursor.isValid())
408  return -1;
409 
410  KTextEditor::Cursor work = viewCacheStart();
411 
412  // only try this with valid lines!
413  if (work.isValid())
414  work.setLine(m_renderer->folding().lineToVisibleLine(work.line()));
415 
416  if (!work.isValid())
417  return virtualCursor.line();
418 
419  int limit = m_textLayouts.count();
420 
421  // Efficient non-word-wrapped path
422  if (!m_renderer->view()->dynWordWrap()) {
423  int ret = virtualCursor.line() - work.line();
424  if (limitToVisible && (ret < 0 || ret > limit))
425  return -1;
426  else
427  return ret;
428  }
429 
430  if (work == virtualCursor) {
431  return 0;
432  }
433 
434  int ret = -(int)viewLine(viewCacheStart());
435  bool forwards = (work < virtualCursor);
436 
437  // FIXME switch to using ranges? faster?
438  if (forwards) {
439  while (work.line() != virtualCursor.line()) {
440  ret += viewLineCount(m_renderer->folding().visibleLineToLine(work.line()));
441  work.setLine(work.line() + 1);
442  if (limitToVisible && ret > limit)
443  return -1;
444  }
445  } else {
446  while (work.line() != virtualCursor.line()) {
447  work.setLine(work.line() - 1);
448  ret -= viewLineCount(m_renderer->folding().visibleLineToLine(work.line()));
449  if (limitToVisible && ret < 0)
450  return -1;
451  }
452  }
453 
454  // final difference
455  KTextEditor::Cursor realCursor = virtualCursor;
456  realCursor.setLine(m_renderer->folding().visibleLineToLine(realCursor.line()));
457  if (realCursor.column() == -1) realCursor.setColumn(m_renderer->doc()->lineLength(realCursor.line()));
458  ret += viewLine(realCursor);
459 
460  if (limitToVisible && (ret < 0 || ret > limit))
461  return -1;
462 
463  return ret;
464 }
465 
466 int KateLayoutCache::lastViewLine(int realLine)
467 {
468  if (!m_renderer->view()->dynWordWrap()) return 0;
469 
470  KateLineLayoutPtr l = line(realLine);
471  Q_ASSERT(l);
472  return l->viewLineCount() - 1;
473 }
474 
475 int KateLayoutCache::viewLineCount(int realLine)
476 {
477  return lastViewLine(realLine) + 1;
478 }
479 
480 void KateLayoutCache::viewCacheDebugOutput( ) const
481 {
482  kDebug( 13033 ) << "Printing values for " << m_textLayouts.count() << " lines:";
483  if (m_textLayouts.count())
484  {
485  foreach (const KateTextLayout& t, m_textLayouts)
486  if (t.isValid())
487  {
488  t.debugOutput();
489  }
490  else
491  {
492  kDebug( 13033 ) << "Line Invalid.";
493  }
494  }
495 }
496 
497 void KateLayoutCache::wrapLine (const KTextEditor::Cursor &position)
498 {
499  m_lineLayouts.slotEditDone (position.line(), position.line() + 1, 1);
500 }
501 
502 void KateLayoutCache::unwrapLine (int line)
503 {
504  m_lineLayouts.slotEditDone (line - 1, line, -1);
505 }
506 
507 void KateLayoutCache::insertText (const KTextEditor::Cursor &position, const QString &)
508 {
509  m_lineLayouts.slotEditDone(position.line(), position.line(), 0);
510 }
511 
512 void KateLayoutCache::removeText (const KTextEditor::Range &range)
513 {
514  m_lineLayouts.slotEditDone(range.start().line(), range.start().line(), 0);
515 }
516 
517 void KateLayoutCache::clear( )
518 {
519  m_textLayouts.clear();
520  m_lineLayouts.clear();
521  m_startPos = KTextEditor::Cursor(-1,-1);
522 }
523 
524 void KateLayoutCache::setViewWidth( int width )
525 {
526  bool wider = width > m_viewWidth;
527 
528  m_viewWidth = width;
529 
530  m_lineLayouts.clear();
531  m_startPos = KTextEditor::Cursor(-1,-1);
532 
533  // Only get rid of layouts that we have to
534  if (wider) {
535  m_lineLayouts.viewWidthIncreased();
536  } else {
537  m_lineLayouts.viewWidthDecreased(width);
538  }
539 }
540 
541 bool KateLayoutCache::wrap( ) const
542 {
543  return m_wrap;
544 }
545 
546 void KateLayoutCache::setWrap( bool wrap )
547 {
548  m_wrap = wrap;
549  clear();
550 }
551 
552 void KateLayoutCache::relayoutLines( int startRealLine, int endRealLine )
553 {
554  if (startRealLine > endRealLine)
555  kWarning() << "start" << startRealLine << "before end" << endRealLine;
556 
557  m_lineLayouts.relayoutLines(startRealLine, endRealLine);
558 }
559 
560 bool KateLayoutCache::acceptDirtyLayouts()
561 {
562  return m_acceptDirtyLayouts;
563 }
564 
565 void KateLayoutCache::setAcceptDirtyLayouts(bool accept)
566 {
567  m_acceptDirtyLayouts = accept;
568 }
569 
570 // kate: space-indent on; indent-width 2; replace-tabs on;
KateDocument::buffer
KateBuffer & buffer()
Get access to buffer of this document.
Definition: katedocument.h:946
KateLineLayoutMap::contains
bool contains(int i) const
Definition: katelayoutcache.cpp:54
KateLayoutCache::viewCacheStart
KTextEditor::Cursor viewCacheStart() const
Definition: katelayoutcache.cpp:369
kateview.h
KateTextLayout::startCol
int startCol() const
Definition: katetextlayout.cpp:127
katerenderer.h
QVector::append
void append(const T &value)
QVector::begin
iterator begin()
KateView::dynWordWrap
bool dynWordWrap() const
Definition: kateview.h:244
KateDocument::lineLength
virtual int lineLength(int line) const
Definition: katedocument.cpp:758
KateLineLayoutMap::LineLayoutPair
QPair< int, KateLineLayoutPtr > LineLayoutPair
Definition: katelayoutcache.h:56
KateLineLayoutMap::KateLineLayoutMap
KateLineLayoutMap()
Definition: katelayoutcache.cpp:35
KateLineLayoutMap::insert
void insert(int realLine, const KateLineLayoutPtr &lineLayoutPtr)
Definition: katelayoutcache.cpp:61
QVector::constEnd
const_iterator constEnd() const
Kate::TextFolding::visibleLineToLine
int visibleLineToLine(int visibleLine) const
Convert a visible line number to a line number in the text buffer.
Definition: katetextfolding.cpp:422
QVector::last
T & last()
KateTextLayout::isValid
bool isValid() const
Definition: katetextlayout.cpp:88
QVector::insert
void insert(int i, const T &value)
QVector::erase
iterator erase(iterator begin, iterator end)
katedocument.h
KateTextLayout::debugOutput
void debugOutput() const
Definition: katetextlayout.cpp:63
KateLayoutCache::textLayout
KateTextLayout textLayout(const KTextEditor::Cursor &realCursor)
Returns the layout describing the text line which is occupied by realCursor.
Definition: katelayoutcache.cpp:337
KateLineLayoutMap::slotEditDone
void slotEditDone(int fromLine, int toLine, int shiftAmount)
Definition: katelayoutcache.cpp:105
enableLayoutCache
static bool enableLayoutCache
Definition: katelayoutcache.cpp:32
QVector::first
T & first()
KateRenderer::layoutLine
void layoutLine(KateLineLayoutPtr line, int maxwidth=-1, bool cacheLayout=false) const
Text width & height calculation functions...
Definition: katerenderer.cpp:912
KateLayoutCache::clear
void clear()
Definition: katelayoutcache.cpp:517
KateLineLayoutMap::relayoutLines
void relayoutLines(int startRealLine, int endRealLine)
Definition: katelayoutcache.cpp:92
KateLineLayout
Definition: katelinelayout.h:34
KateTextLayout::endCol
int endCol(bool indicateEOL=false) const
Return the end column of this text line.
Definition: katetextlayout.cpp:140
KateLineLayoutMap::~KateLineLayoutMap
~KateLineLayoutMap()
Definition: katelayoutcache.cpp:39
katebuffer.h
KateLayoutCache::setAcceptDirtyLayouts
void setAcceptDirtyLayouts(bool accept)
Definition: katelayoutcache.cpp:565
KateRenderer
Handles all of the work of rendering the text (used for the views and printing)
Definition: katerenderer.h:50
QVector::clear
void clear()
lessThan
bool lessThan(const KateLineLayoutMap::LineLayoutPair &lhs, const KateLineLayoutMap::LineLayoutPair &rhs)
Definition: katelayoutcache.cpp:43
KateLayoutCache::acceptDirtyLayouts
bool acceptDirtyLayouts()
Definition: katelayoutcache.cpp:560
KateLineLayoutMap::viewWidthDecreased
void viewWidthDecreased(int newWidth)
Definition: katelayoutcache.cpp:82
QVector::resize
void resize(int size)
KateTextLayout::viewLine
int viewLine() const
Return the index of this visual line inside the document line (KateLineLayout).
Definition: katetextlayout.cpp:109
KateLayoutCache::wrap
bool wrap() const
Definition: katelayoutcache.cpp:541
KateLayoutCache::lastViewLine
int lastViewLine(int realLine)
Definition: katelayoutcache.cpp:466
QObject
katelayoutcache.h
KateRenderer::view
KateView * view() const
Returns the view to which this renderer is bound.
Definition: katerenderer.h:103
KateLayoutCache::KateLayoutCache
KateLayoutCache(KateRenderer *renderer, QObject *parent)
Definition: katelayoutcache.cpp:140
KateLayoutCache::line
KateLineLayoutPtr line(int realLine, int virtualLine=-1)
Returns the KateLineLayout for the specified line.
Definition: katelayoutcache.cpp:280
KateDocument::lines
virtual int lines() const
Definition: katedocument.cpp:753
QString
KateLayoutCache::viewLine
KateTextLayout & viewLine(int viewLine)
Returns the layout of the corresponding line in the view.
Definition: katelayoutcache.cpp:358
QPair
Kate::TextFolding::lineToVisibleLine
int lineToVisibleLine(int line) const
Convert a text buffer line to a visible line number.
Definition: katetextfolding.cpp:366
KateRenderer::folding
Kate::TextFolding & folding() const
Returns the folding info to which this renderer is bound.
Definition: katerenderer.h:98
QVector::reserve
void reserve(int size)
KateLineLayoutMap::operator[]
KateLineLayoutPtr & operator[](int i)
Definition: katelayoutcache.cpp:132
KateLayoutCache::setViewWidth
void setViewWidth(int width)
Definition: katelayoutcache.cpp:524
KateLayoutCache::setWrap
void setWrap(bool wrap)
Definition: katelayoutcache.cpp:546
QVector::constBegin
const_iterator constBegin() const
KateLayoutCache::viewLineCount
int viewLineCount(int realLine)
Definition: katelayoutcache.cpp:475
KateTextLayout
This class represents one visible line of text; with dynamic wrapping, many KateTextLayouts can be ne...
Definition: katetextlayout.h:38
KateLayoutCache::relayoutLines
void relayoutLines(int startRealLine, int endRealLine)
Definition: katelayoutcache.cpp:552
KateLayoutCache::viewCacheEnd
KTextEditor::Cursor viewCacheEnd() const
Definition: katelayoutcache.cpp:374
QVector::count
int count(const T &value) const
KateRenderer::doc
KateDocument * doc() const
Returns the document to which this renderer is bound.
Definition: katerenderer.h:92
KateView::wrapCursor
bool wrapCursor() const
Definition: kateview.cpp:2262
KateLayoutCache::displayViewLine
int displayViewLine(const KTextEditor::Cursor &virtualCursor, bool limitToVisible=false)
Definition: katelayoutcache.cpp:405
KateLayoutCache::viewWidth
int viewWidth() const
Definition: katelayoutcache.cpp:379
KateLineLayoutMap::viewWidthIncreased
void viewWidthIncreased()
Definition: katelayoutcache.cpp:73
KateLayoutCache::viewCacheDebugOutput
void viewCacheDebugOutput() const
Definition: katelayoutcache.cpp:480
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
KateLayoutCache::viewCacheLineCount
int viewCacheLineCount() const
Definition: katelayoutcache.cpp:364
KateLayoutCache::updateViewCache
void updateViewCache(const KTextEditor::Cursor &startPos, int newViewLineCount=-1, int viewLinesScrolled=0)
Definition: katelayoutcache.cpp:159
KateTextLayout::invalid
static KateTextLayout invalid()
Definition: katetextlayout.cpp:210
QVector::end
iterator end()
KateLineLayoutPtr
KSharedPtr< KateLineLayout > KateLineLayoutPtr
Definition: katelinelayout.h:120
KateLineLayoutMap::clear
void clear()
Definition: katelayoutcache.cpp:49
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:58 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Kate

Skip menu "Kate"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Konsole

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal