Browse Source

fixed scrolling in Console-Pads

4.0
Siegfried Pammer 15 years ago
parent
commit
41b10e921c
  1. 27
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditorOptions.cs
  2. 10
      src/Main/Base/Project/Src/Gui/Pads/AbstractConsolePad.cs

27
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditorOptions.cs

@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
using System;
using System.ComponentModel;
using System.Reflection;
using System.Text;
namespace ICSharpCode.AvalonEdit
@ -13,6 +14,32 @@ namespace ICSharpCode.AvalonEdit @@ -13,6 +14,32 @@ namespace ICSharpCode.AvalonEdit
[Serializable]
public class TextEditorOptions : INotifyPropertyChanged
{
#region ctor
/// <summary>
/// Initializes an empty instance of TextEditorOptions.
/// </summary>
public TextEditorOptions()
{
}
/// <summary>
/// Initializes a new instance of TextEditorOptions by copying all values
/// from <paramref name="options"/> to the new instance.
/// </summary>
public TextEditorOptions(TextEditorOptions options)
{
// get all the fields in the class
FieldInfo[] fields = GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
// copy each value over to 'this'
foreach(FieldInfo fi in fields) {
if (fi.IsNotSerialized)
continue;
fi.SetValue(this, fi.GetValue(options));
}
}
#endregion
#region PropertyChanged handling
/// <inheritdoc/>
[field: NonSerialized]

10
src/Main/Base/Project/Src/Gui/Pads/AbstractConsolePad.cs

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using ICSharpCode.AvalonEdit;
using ICSharpCode.Core.Presentation;
using System;
using System.Collections.Generic;
@ -262,6 +263,8 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -262,6 +263,8 @@ namespace ICSharpCode.SharpDevelop.Gui
internal ITextEditor editorAdapter;
internal BeginReadOnlySectionProvider readOnlyRegion;
static TextEditorOptions consoleOptions;
public ConsoleControl()
{
this.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
@ -276,6 +279,13 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -276,6 +279,13 @@ namespace ICSharpCode.SharpDevelop.Gui
this.editor.SetValue(Grid.RowProperty, 0);
this.editor.ShowLineNumbers = false;
if (consoleOptions == null) {
consoleOptions = new TextEditorOptions(editor.Options);
consoleOptions.AllowScrollBelowDocument = false;
}
this.editor.Options = consoleOptions;
this.Children.Add(editor);
editor.TextArea.ReadOnlySectionProvider = readOnlyRegion = new BeginReadOnlySectionProvider();

Loading…
Cancel
Save