]> git.saurik.com Git - wxWidgets.git/blob - contrib/src/stc/scintilla/src/ContractionState.h
Patch #1106564, corrects possible 100% CPU load condition.
[wxWidgets.git] / contrib / src / stc / scintilla / src / ContractionState.h
1 // Scintilla source code edit control
2 /** @file ContractionState.h
3 ** Manages visibility of lines for folding.
4 **/
5 // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
6 // The License.txt file describes the conditions under which this software may be distributed.
7
8 #ifndef CONTRACTIONSTATE_H
9 #define CONTRACTIONSTATE_H
10
11 /**
12 */
13 class OneLine {
14 public:
15 int displayLine; ///< Position within set of visible lines
16 //int docLine; ///< Inverse of @a displayLine
17 int height; ///< Number of display lines needed to show all of the line
18 bool visible;
19 bool expanded;
20
21 OneLine();
22 virtual ~OneLine() {}
23 };
24
25 /**
26 */
27 class ContractionState {
28 void Grow(int sizeNew);
29 enum { growSize = 4000 };
30 int linesInDoc;
31 mutable int linesInDisplay;
32 mutable OneLine *lines;
33 int size;
34 mutable int *docLines;
35 mutable int sizeDocLines;
36 mutable bool valid;
37 void MakeValid() const;
38
39 public:
40 ContractionState();
41 virtual ~ContractionState();
42
43 void Clear();
44
45 int LinesInDoc() const;
46 int LinesDisplayed() const;
47 int DisplayFromDoc(int lineDoc) const;
48 int DocFromDisplay(int lineDisplay) const;
49
50 void InsertLines(int lineDoc, int lineCount);
51 void DeleteLines(int lineDoc, int lineCount);
52
53 bool GetVisible(int lineDoc) const;
54 bool SetVisible(int lineDocStart, int lineDocEnd, bool visible);
55
56 bool GetExpanded(int lineDoc) const;
57 bool SetExpanded(int lineDoc, bool expanded);
58
59 int GetHeight(int lineDoc) const;
60 bool SetHeight(int lineDoc, int height);
61
62 void ShowAll();
63 };
64
65 #endif