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