From aa2a7394d855b039953b5044357af3dd879850c3 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Thu, 28 Feb 2002 10:54:35 +0000 Subject: Made number of display lines for a document line be dynamic. --- src/Editor.h | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src/Editor.h') diff --git a/src/Editor.h b/src/Editor.h index a7047ef14..1056a95bb 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -34,13 +34,17 @@ public: /** */ class LineLayout { -public: - enum validLevel { llInvalid, llPositions, llLines } validity; +private: + friend class LineLayoutCache; + int *lineStarts; + int lenLineStarts; /// Drawing is only performed for @a maxLineLength characters on each line. - int maxLineLength; int lineNumber; bool inCache; +public: + int maxLineLength; int numCharsInLine; + enum validLevel { llInvalid, llPositions, llLines } validity; int xHighlightGuide; bool highlightColumn; int selStart; @@ -55,14 +59,22 @@ public: // Wrapped line support int widthLine; int lines; - int maxDisplayLines; - int *lineStarts; - LineLayout(int maxLineLength_ = 8000, int maxDisplayLines=100); + LineLayout(int maxLineLength_); virtual ~LineLayout(); void Resize(int maxLineLength_); void Free(); void Invalidate(validLevel validity_); + int LineStart(int line) { + if (line <= 0) { + return 0; + } else if ((line >= lines) || !lineStarts) { + return numCharsInLine; + } else { + return lineStarts[line]; + } + } + void SetLineStart(int line, int start); }; /** -- cgit v1.2.3