From 0adca4ad14500910cca14a54d7d4c19e740606da Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Thu, 7 Apr 2011 21:26:47 +1000 Subject: =?UTF-8?q?Add=20highlighting=20of=20current=20folding=20block.=20?= =?UTF-8?q?Feature=20#3147069.=20APIs=20MarkerEnableHighlight=20and=20Mark?= =?UTF-8?q?erSetBackSelected.=20From=20J=C3=A9r=C3=B4me=20Laforge.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Document.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'src/Document.h') diff --git a/src/Document.h b/src/Document.h index fd0998260..851c10081 100644 --- a/src/Document.h +++ b/src/Document.h @@ -115,6 +115,47 @@ struct StyledText { } }; +class HighlightDelimiter { +public: + HighlightDelimiter() { + beginFoldBlock = -1; + endFoldBlock = -1; + beginMarginCorrectlyDrawnZone = -1; + endMarginCorrectlyDrawnZone = -1; + isEnabled = false; + } + + bool NeedsDrawing(int line) { + return isEnabled && (line <= beginMarginCorrectlyDrawnZone || endMarginCorrectlyDrawnZone <= line); + } + + bool isCurrentBlockHighlight(int line) { + return isEnabled && beginFoldBlock <= line && line <= endFoldBlock; + } + + bool isHeadBlockFold(int line) { + return beginFoldBlock == line && line < endFoldBlock; + } + + bool isBodyBlockFold(int line) { + return beginFoldBlock < line && line < endFoldBlock; + } + + bool isTailBlockFold(int line) { + return beginFoldBlock < line && line == endFoldBlock; + } + + // beginFoldBlock : Begin of current fold block. + // endStartBlock : End of zone where margin is already drawn. + // beginMarginCorrectlyDrawnZone : Begin of zone where margin is already drawn. + // endMarginCorrectlyDrawnZone : End of current fold block. + int beginFoldBlock; + int endFoldBlock; + int beginMarginCorrectlyDrawnZone; + int endMarginCorrectlyDrawnZone; + bool isEnabled; +}; + class CaseFolder { public: virtual ~CaseFolder() { @@ -299,6 +340,7 @@ public: void ClearLevels(); int GetLastChild(int lineParent, int level=-1); int GetFoldParent(int line); + void GetHighlightDelimiters(int line, HighlightDelimiter &hDelimiter); void Indent(bool forwards); int ExtendWordSelect(int pos, int delta, bool onlyWordCharacters=false); -- cgit v1.2.3