Browse Source

AvalonEdit TextEditor/TextArea: when changing the document/options, set document/options on the inner TextArea/TextView before the DocumentChanged/OptionChanged event is raised.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5251 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Daniel Grunwald 16 years ago
parent
commit
ddee637521
  1. 4
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/TextArea.cs
  2. 4
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditor.cs

4
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/TextArea.cs

@ -62,8 +62,6 @@ namespace ICSharpCode.AvalonEdit.Editing @@ -62,8 +62,6 @@ namespace ICSharpCode.AvalonEdit.Editing
throw new ArgumentNullException("textView");
this.textView = textView;
this.Options = textView.Options;
textView.SetBinding(TextView.DocumentProperty, new Binding(DocumentProperty.Name) { Source = this });
textView.SetBinding(TextView.OptionsProperty, new Binding(OptionsProperty.Name) { Source = this });
textView.Services.AddService(typeof(TextArea), this);
@ -200,6 +198,7 @@ namespace ICSharpCode.AvalonEdit.Editing @@ -200,6 +198,7 @@ namespace ICSharpCode.AvalonEdit.Editing
TextDocumentWeakEventManager.UpdateStarted.RemoveListener(oldValue, this);
TextDocumentWeakEventManager.UpdateFinished.RemoveListener(oldValue, this);
}
textView.Document = newValue;
if (newValue != null) {
TextDocumentWeakEventManager.Changing.AddListener(newValue, this);
TextDocumentWeakEventManager.Changed.AddListener(newValue, this);
@ -252,6 +251,7 @@ namespace ICSharpCode.AvalonEdit.Editing @@ -252,6 +251,7 @@ namespace ICSharpCode.AvalonEdit.Editing
if (oldValue != null) {
PropertyChangedWeakEventManager.RemoveListener(oldValue, this);
}
textView.Options = newValue;
if (newValue != null) {
PropertyChangedWeakEventManager.AddListener(newValue, this);
}

4
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditor.cs

@ -60,8 +60,6 @@ namespace ICSharpCode.AvalonEdit @@ -60,8 +60,6 @@ namespace ICSharpCode.AvalonEdit
this.Options = textArea.Options;
this.Document = new TextDocument();
textArea.SetBinding(TextArea.DocumentProperty, new Binding(DocumentProperty.Name) { Source = this });
textArea.SetBinding(TextArea.OptionsProperty, new Binding(OptionsProperty.Name) { Source = this });
}
#endregion
@ -124,6 +122,7 @@ namespace ICSharpCode.AvalonEdit @@ -124,6 +122,7 @@ namespace ICSharpCode.AvalonEdit
if (oldValue != null) {
TextDocumentWeakEventManager.TextChanged.RemoveListener(oldValue, this);
}
textArea.Document = newValue;
if (newValue != null) {
TextDocumentWeakEventManager.TextChanged.AddListener(newValue, this);
}
@ -172,6 +171,7 @@ namespace ICSharpCode.AvalonEdit @@ -172,6 +171,7 @@ namespace ICSharpCode.AvalonEdit
if (oldValue != null) {
PropertyChangedWeakEventManager.RemoveListener(oldValue, this);
}
textArea.Options = newValue;
if (newValue != null) {
PropertyChangedWeakEventManager.AddListener(newValue, this);
}

Loading…
Cancel
Save