|
|
|
|
@ -11,7 +11,7 @@ namespace ICSharpCode.AvalonEdit.Rendering
@@ -11,7 +11,7 @@ namespace ICSharpCode.AvalonEdit.Rendering
|
|
|
|
|
/// Represents a collapsed line section.
|
|
|
|
|
/// Use the Uncollapse() method to uncollapse the section.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public sealed class CollapsedLineSection : INotifyPropertyChanged |
|
|
|
|
public sealed class CollapsedLineSection |
|
|
|
|
{ |
|
|
|
|
bool isCollapsed = true; |
|
|
|
|
DocumentLine start, end; |
|
|
|
|
@ -41,7 +41,7 @@ namespace ICSharpCode.AvalonEdit.Rendering
@@ -41,7 +41,7 @@ namespace ICSharpCode.AvalonEdit.Rendering
|
|
|
|
|
/// This property initially is true and turns to false when uncollapsing the section.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsCollapsed { |
|
|
|
|
get { return isCollapsed; } |
|
|
|
|
get { return start != null; } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
@ -51,10 +51,7 @@ namespace ICSharpCode.AvalonEdit.Rendering
@@ -51,10 +51,7 @@ namespace ICSharpCode.AvalonEdit.Rendering
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DocumentLine Start { |
|
|
|
|
get { return start; } |
|
|
|
|
internal set { |
|
|
|
|
start = value; |
|
|
|
|
// TODO: raised property changed event (but only after the operation is complete)
|
|
|
|
|
} |
|
|
|
|
internal set { start = value; } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
@ -64,46 +61,26 @@ namespace ICSharpCode.AvalonEdit.Rendering
@@ -64,46 +61,26 @@ namespace ICSharpCode.AvalonEdit.Rendering
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DocumentLine End { |
|
|
|
|
get { return end; } |
|
|
|
|
internal set { |
|
|
|
|
end = value; |
|
|
|
|
// TODO: raised property changed event (but only after the operation is complete)
|
|
|
|
|
} |
|
|
|
|
internal set { end = value; } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Uncollapses the section.
|
|
|
|
|
/// This causes the Start and End properties to be set to null!
|
|
|
|
|
/// Runtime: O(log(n))
|
|
|
|
|
/// Does nothing if the section is already uncollapsed.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <exception cref="InvalidOperationException">
|
|
|
|
|
/// The section is already uncollapsed, or the text containing the section was deleted.
|
|
|
|
|
/// </exception>
|
|
|
|
|
public void Uncollapse() |
|
|
|
|
{ |
|
|
|
|
if (start == null) |
|
|
|
|
throw new InvalidOperationException(); |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
heightTree.Uncollapse(this); |
|
|
|
|
#if DEBUG
|
|
|
|
|
heightTree.CheckProperties(); |
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
start = end = null; |
|
|
|
|
isCollapsed = false; |
|
|
|
|
NotifyPropertyChanged("Start"); |
|
|
|
|
NotifyPropertyChanged("End"); |
|
|
|
|
NotifyPropertyChanged("IsCollapsed"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Is raised when of the properties Start,End,IsCollapsed changes.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged; |
|
|
|
|
|
|
|
|
|
void NotifyPropertyChanged(string propertyName) |
|
|
|
|
{ |
|
|
|
|
if (PropertyChanged != null) |
|
|
|
|
PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); |
|
|
|
|
start = null; |
|
|
|
|
end = null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
@ -113,7 +90,7 @@ namespace ICSharpCode.AvalonEdit.Rendering
@@ -113,7 +90,7 @@ namespace ICSharpCode.AvalonEdit.Rendering
|
|
|
|
|
public override string ToString() |
|
|
|
|
{ |
|
|
|
|
return "[CollapsedSection" + ID + " Start=" + (start != null ? start.LineNumber.ToString() : "null") |
|
|
|
|
+ " End=" + (end != null ? end.LineNumber.ToString() : "null") + " IsCollapsed=" + isCollapsed + "]"; |
|
|
|
|
+ " End=" + (end != null ? end.LineNumber.ToString() : "null") + "]"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|