|
|
|
@ -17,10 +17,10 @@ namespace ICSharpCode.TextEditor.Document
@@ -17,10 +17,10 @@ namespace ICSharpCode.TextEditor.Document
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class SelectionManager : IDisposable |
|
|
|
|
{ |
|
|
|
|
public Point selectionStart; |
|
|
|
|
internal Point selectionStart; |
|
|
|
|
IDocument document; |
|
|
|
|
TextArea textArea; |
|
|
|
|
public SelectFrom selectFrom = new SelectFrom(); |
|
|
|
|
internal SelectFrom selectFrom = new SelectFrom(); |
|
|
|
|
|
|
|
|
|
List<ISelection> selectionCollection = new List<ISelection>(); |
|
|
|
|
|
|
|
|
@ -42,6 +42,20 @@ namespace ICSharpCode.TextEditor.Document
@@ -42,6 +42,20 @@ namespace ICSharpCode.TextEditor.Document
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public bool SelectionIsReadonly { |
|
|
|
|
get { |
|
|
|
|
if (document.ReadOnly) |
|
|
|
|
return true; |
|
|
|
|
if (document.TextEditorProperties.UseCustomLine) { |
|
|
|
|
foreach (ISelection sel in selectionCollection) { |
|
|
|
|
if (document.CustomLineManager.IsReadOnly(sel, false)) |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <value>
|
|
|
|
|
/// The text that is currently selected.
|
|
|
|
|
/// </value>
|
|
|
|
@ -371,7 +385,7 @@ namespace ICSharpCode.TextEditor.Document
@@ -371,7 +385,7 @@ namespace ICSharpCode.TextEditor.Document
|
|
|
|
|
/// <remarks>
|
|
|
|
|
/// Used internally, do not call.
|
|
|
|
|
/// </remarks>
|
|
|
|
|
public void Insert(int offset, string text) |
|
|
|
|
internal void Insert(int offset, string text) |
|
|
|
|
{ |
|
|
|
|
// foreach (ISelection selection in SelectionCollection) {
|
|
|
|
|
// if (selection.Offset > offset) {
|
|
|
|
@ -385,7 +399,7 @@ namespace ICSharpCode.TextEditor.Document
@@ -385,7 +399,7 @@ namespace ICSharpCode.TextEditor.Document
|
|
|
|
|
/// <remarks>
|
|
|
|
|
/// Used internally, do not call.
|
|
|
|
|
/// </remarks>
|
|
|
|
|
public void Remove(int offset, int length) |
|
|
|
|
internal void Remove(int offset, int length) |
|
|
|
|
{ |
|
|
|
|
// foreach (ISelection selection in selectionCollection) {
|
|
|
|
|
// if (selection.Offset > offset) {
|
|
|
|
@ -399,7 +413,7 @@ namespace ICSharpCode.TextEditor.Document
@@ -399,7 +413,7 @@ namespace ICSharpCode.TextEditor.Document
|
|
|
|
|
/// <remarks>
|
|
|
|
|
/// Used internally, do not call.
|
|
|
|
|
/// </remarks>
|
|
|
|
|
public void Replace(int offset, int length, string text) |
|
|
|
|
internal void Replace(int offset, int length, string text) |
|
|
|
|
{ |
|
|
|
|
// foreach (ISelection selection in selectionCollection) {
|
|
|
|
|
// if (selection.Offset > offset) {
|
|
|
|
@ -450,7 +464,7 @@ namespace ICSharpCode.TextEditor.Document
@@ -450,7 +464,7 @@ namespace ICSharpCode.TextEditor.Document
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// selection initiated from...
|
|
|
|
|
public class SelectFrom { |
|
|
|
|
internal class SelectFrom { |
|
|
|
|
public int where = WhereFrom.None; // last selection initiator
|
|
|
|
|
public int first = WhereFrom.None; // first selection initiator
|
|
|
|
|
|
|
|
|
@ -460,7 +474,7 @@ namespace ICSharpCode.TextEditor.Document
@@ -460,7 +474,7 @@ namespace ICSharpCode.TextEditor.Document
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// selection initiated from type...
|
|
|
|
|
public class WhereFrom { |
|
|
|
|
internal class WhereFrom { |
|
|
|
|
public const int None = 0; |
|
|
|
|
public const int Gutter = 1; |
|
|
|
|
public const int TArea = 2; |
|
|
|
|