blob: 1070fb59f7359fbeb850fe368fc5a94c249e1bd3 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
 | // Scintilla source code edit control
/** @file ContractionState.h
 ** Manages visibility of lines for folding and wrapping.
 **/
// Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef CONTRACTIONSTATE_H
#define CONTRACTIONSTATE_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
template<class T>
class SparseVector;
/**
 */
class ContractionState {
	// These contain 1 element for every document line.
	std::unique_ptr<RunStyles> visible;
	std::unique_ptr<RunStyles> expanded;
	std::unique_ptr<RunStyles> heights;
	std::unique_ptr<SparseVector<UniqueString>> foldDisplayTexts;
	std::unique_ptr<Partitioning> displayLines;
	Sci::Line linesInDocument;
	void EnsureData();
	bool OneToOne() const {
		// True when each document line is exactly one display line so need for
		// complex data structures.
		return visible == nullptr;
	}
public:
	ContractionState();
	// Deleted so ContractionState objects can not be copied.
	ContractionState(const ContractionState &) = delete;
	void operator=(const ContractionState &) = delete;
	virtual ~ContractionState();
	void Clear();
	Sci::Line LinesInDoc() const;
	Sci::Line LinesDisplayed() const;
	Sci::Line DisplayFromDoc(Sci::Line lineDoc) const;
	Sci::Line DisplayLastFromDoc(Sci::Line lineDoc) const;
	Sci::Line DocFromDisplay(Sci::Line lineDisplay) const;
	void InsertLine(Sci::Line lineDoc);
	void InsertLines(Sci::Line lineDoc, Sci::Line lineCount);
	void DeleteLine(Sci::Line lineDoc);
	void DeleteLines(Sci::Line lineDoc, Sci::Line lineCount);
	bool GetVisible(Sci::Line lineDoc) const;
	bool SetVisible(Sci::Line lineDocStart, Sci::Line lineDocEnd, bool isVisible);
	bool HiddenLines() const;
	const char *GetFoldDisplayText(Sci::Line lineDoc) const;
	bool SetFoldDisplayText(Sci::Line lineDoc, const char *text);
	bool GetExpanded(Sci::Line lineDoc) const;
	bool SetExpanded(Sci::Line lineDoc, bool isExpanded);
	bool GetFoldDisplayTextShown(Sci::Line lineDoc) const;
	Sci::Line ContractedNext(Sci::Line lineDocStart) const;
	int GetHeight(Sci::Line lineDoc) const;
	bool SetHeight(Sci::Line lineDoc, int height);
	void ShowAll();
	void Check() const;
};
#ifdef SCI_NAMESPACE
}
#endif
#endif
 |