1 | // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team |
---|
2 | // |
---|
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this |
---|
4 | // software and associated documentation files (the "Software"), to deal in the Software |
---|
5 | // without restriction, including without limitation the rights to use, copy, modify, merge, |
---|
6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons |
---|
7 | // to whom the Software is furnished to do so, subject to the following conditions: |
---|
8 | // |
---|
9 | // The above copyright notice and this permission notice shall be included in all copies or |
---|
10 | // substantial portions of the Software. |
---|
11 | // |
---|
12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, |
---|
13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
---|
14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE |
---|
15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
---|
16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
---|
17 | // DEALINGS IN THE SOFTWARE. |
---|
18 | |
---|
19 | using System; |
---|
20 | |
---|
21 | namespace ICSharpCode.AvalonEdit.Document |
---|
22 | { |
---|
23 | /// <summary> |
---|
24 | /// Allows for low-level line tracking. |
---|
25 | /// </summary> |
---|
26 | /// <remarks> |
---|
27 | /// The methods on this interface are called by the TextDocument's LineManager immediately after the document |
---|
28 | /// has changed, *while* the DocumentLineTree is updating. |
---|
29 | /// Thus, the DocumentLineTree may be in an invalid state when these methods are called. |
---|
30 | /// This interface should only be used to update per-line data structures like the HeightTree. |
---|
31 | /// Line trackers must not cause any events to be raised during an update to prevent other code from seeing |
---|
32 | /// the invalid state. |
---|
33 | /// Line trackers may be called while the TextDocument has taken a lock. |
---|
34 | /// You must be careful not to dead-lock inside ILineTracker callbacks. |
---|
35 | /// </remarks> |
---|
36 | public interface ILineTracker |
---|
37 | { |
---|
38 | /// <summary> |
---|
39 | /// Is called immediately before a document line is removed. |
---|
40 | /// </summary> |
---|
41 | void BeforeRemoveLine(DocumentLine line); |
---|
42 | |
---|
43 | // /// <summary> |
---|
44 | // /// Is called immediately after a document line is removed. |
---|
45 | // /// </summary> |
---|
46 | // void AfterRemoveLine(DocumentLine line); |
---|
47 | |
---|
48 | /// <summary> |
---|
49 | /// Is called immediately before a document line changes length. |
---|
50 | /// This method will be called whenever the line is changed, even when the length stays as it is. |
---|
51 | /// The method might be called multiple times for a single line because |
---|
52 | /// a replacement is internally handled as removal followed by insertion. |
---|
53 | /// </summary> |
---|
54 | void SetLineLength(DocumentLine line, int newTotalLength); |
---|
55 | |
---|
56 | /// <summary> |
---|
57 | /// Is called immediately after a line was inserted. |
---|
58 | /// </summary> |
---|
59 | /// <param name="newLine">The new line</param> |
---|
60 | /// <param name="insertionPos">The existing line before the new line</param> |
---|
61 | void LineInserted(DocumentLine insertionPos, DocumentLine newLine); |
---|
62 | |
---|
63 | /// <summary> |
---|
64 | /// Indicates that there were changes to the document that the line tracker was not notified of. |
---|
65 | /// The document is in a consistent state (but the line trackers aren't), and line trackers should |
---|
66 | /// throw away their data and rebuild the document. |
---|
67 | /// </summary> |
---|
68 | void RebuildDocument(); |
---|
69 | |
---|
70 | /// <summary> |
---|
71 | /// Notifies the line tracker that a document change (a single change, not a change group) has completed. |
---|
72 | /// This method gets called after the change has been performed, but before the <see cref="TextDocument.Changed"/> event |
---|
73 | /// is raised. |
---|
74 | /// </summary> |
---|
75 | void ChangeComplete(DocumentChangeEventArgs e); |
---|
76 | } |
---|
77 | } |
---|