|
|
@ -10,17 +10,25 @@ using ICSharpCode.AvalonEdit.Document; |
|
|
|
|
|
|
|
|
|
|
|
namespace ICSharpCode.AvalonEdit.Snippets |
|
|
|
namespace ICSharpCode.AvalonEdit.Snippets |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Creates a named anchor that can be accessed by other SnippetElements.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
public sealed class SnippetAnchorElement : SnippetElement |
|
|
|
public sealed class SnippetAnchorElement : SnippetElement |
|
|
|
{ |
|
|
|
{ |
|
|
|
string textToInsert = ""; |
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Gets or sets the name of the anchor.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
public string Name { get; private set; } |
|
|
|
public string Name { get; private set; } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Creates a SnippetAnchorElement with the supplied name.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
public SnippetAnchorElement(string name) |
|
|
|
public SnippetAnchorElement(string name) |
|
|
|
{ |
|
|
|
{ |
|
|
|
this.Name = name; |
|
|
|
this.Name = name; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public override void Insert(InsertionContext context) |
|
|
|
public override void Insert(InsertionContext context) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int start = context.InsertionPosition; |
|
|
|
int start = context.InsertionPosition; |
|
|
@ -29,8 +37,12 @@ namespace ICSharpCode.AvalonEdit.Snippets |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// AnchorElement created by SnippetAnchorElement.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
public sealed class AnchorElement : IActiveElement |
|
|
|
public sealed class AnchorElement : IActiveElement |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public bool IsEditable { |
|
|
|
public bool IsEditable { |
|
|
|
get { return false; } |
|
|
|
get { return false; } |
|
|
|
} |
|
|
|
} |
|
|
@ -38,10 +50,14 @@ namespace ICSharpCode.AvalonEdit.Snippets |
|
|
|
AnchorSegment segment; |
|
|
|
AnchorSegment segment; |
|
|
|
InsertionContext context; |
|
|
|
InsertionContext context; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public ISegment Segment { |
|
|
|
public ISegment Segment { |
|
|
|
get { return segment; } |
|
|
|
get { return segment; } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Creates a new AnchorElement.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
public AnchorElement(AnchorSegment segment, string text, string name, InsertionContext context) |
|
|
|
public AnchorElement(AnchorSegment segment, string text, string name, InsertionContext context) |
|
|
|
{ |
|
|
|
{ |
|
|
|
this.segment = segment; |
|
|
|
this.segment = segment; |
|
|
@ -50,6 +66,9 @@ namespace ICSharpCode.AvalonEdit.Snippets |
|
|
|
this.Name = name; |
|
|
|
this.Name = name; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Gets or sets the text at the anchor.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
public string Text { |
|
|
|
public string Text { |
|
|
|
get { return context.Document.GetText(segment); } |
|
|
|
get { return context.Document.GetText(segment); } |
|
|
|
set { |
|
|
|
set { |
|
|
@ -63,12 +82,17 @@ namespace ICSharpCode.AvalonEdit.Snippets |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Gets or sets the name of the anchor.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
public string Name { get; private set; } |
|
|
|
public string Name { get; private set; } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public void OnInsertionCompleted() |
|
|
|
public void OnInsertionCompleted() |
|
|
|
{ |
|
|
|
{ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public void Deactivate(SnippetEventArgs e) |
|
|
|
public void Deactivate(SnippetEventArgs e) |
|
|
|
{ |
|
|
|
{ |
|
|
|
} |
|
|
|
} |
|
|
|