ITextRender render;
int stepRow = -1,stepLength = 0;
const int STEP_ROW_IS_NONE = -1;
+ IFoldingStrategy _folding;
internal LineToIndexTable(Document buf)
{
/// </summary>
internal IHilighter Hilighter { get; set; }
- internal IFoldingStrategy FoldingStrategy { get; set; }
+ internal IFoldingStrategy FoldingStrategy
+ {
+ get
+ {
+ return this._folding;
+ }
+ set
+ {
+ this._folding = value;
+ if (value == null)
+ this.FoldingCollection.Clear();
+ }
+ }
/// <summary>
/// 保持しているレイアウトキャッシュをクリアーする
public IHilighter Hilighter
{
get { return this._LayoutLines.Hilighter; }
- set { this._LayoutLines.Hilighter = value; }
+ set { this._LayoutLines.Hilighter = value; this._LayoutLines.ClearLayoutCache(); }
}
/// <summary>
{
//こうしないと選択できなくなってしまう
this.nowCaretMove = true;
+ SetValue(SelectedTextProperty, this._Controller.SelectedText);
SetValue(SelectionProperty, new TextRange(this._Controller.SelectionStart, this._Controller.SelectionLength));
SetValue(CaretPostionPropertyKey, this.Document.CaretPostion);
this.nowCaretMove = false;
public static void OnPropertyChanged(object sender, DependencyPropertyChangedEventArgs e)
{
FooTextBox source = (FooTextBox)sender;
+ if(e.Property.Equals(SelectedTextProperty) && !source.nowCaretMove)
+ source._Controller.SelectedText = source.SelectedText;
+ if(e.Property.Equals(HilighterProperty))
+ source.View.Hilighter = source.Hilighter;
+ if (e.Property.Equals(TextAntialiasModeProperty))
+ source.Render.TextAntialiasMode = source.TextAntialiasMode;
+ if (e.Property.Equals(FoldingStrategyProperty))
+ source.View.LayoutLines.FoldingStrategy = source.FoldingStrategy;
if (e.Property.Equals(IndentModeProperty))
source.Controller.IndentMode = source.IndentMode;
if (e.Property.Equals(SelectionProperty) && !source.nowCaretMove)
/// </summary>
public TextAntialiasMode TextAntialiasMode
{
- get
- {
- return this.Render.TextAntialiasMode;
- }
- set
- {
- this.Render.TextAntialiasMode = value;
- }
+ get { return (TextAntialiasMode)GetValue(TextAntialiasModeProperty); }
+ set { SetValue(TextAntialiasModeProperty, value); }
}
/// <summary>
+ /// TextAntialiasModeの依存プロパティを表す
+ /// </summary>
+ public static readonly DependencyProperty TextAntialiasModeProperty =
+ DependencyProperty.Register("TextAntialiasMode", typeof(TextAntialiasMode), typeof(FooTextBox), new PropertyMetadata(TextAntialiasMode.Default));
+
+ /// <summary>
/// シンタックスハイライターを表す
/// </summary>
public IHilighter Hilighter
{
- get
- {
- return this.View.Hilighter;
- }
- set
- {
- this.View.Hilighter = value;
- this.View.LayoutLines.ClearLayoutCache();
- }
+ get { return (IHilighter)GetValue(HilighterProperty); }
+ set { SetValue(HilighterProperty, value); }
}
/// <summary>
+ /// Hilighterの依存プロパティを表す
+ /// </summary>
+ public static readonly DependencyProperty HilighterProperty =
+ DependencyProperty.Register("Hilighter", typeof(IHilighter), typeof(FooTextBox), new PropertyMetadata(null));
+
+ /// <summary>
/// フォールティングを作成するインターフェイスを表す
/// </summary>
public IFoldingStrategy FoldingStrategy
{
- get
- {
- return this.View.LayoutLines.FoldingStrategy;
- }
- set
- {
- this.View.LayoutLines.FoldingStrategy = value;
- if (value == null)
- this.View.LayoutLines.FoldingCollection.Clear();
- }
+ get { return (IFoldingStrategy)GetValue(FoldingStrategyProperty); }
+ set { SetValue(FoldingStrategyProperty, value); }
}
/// <summary>
+ /// FoldingStrategyの依存プロパティ
+ /// </summary>
+ public static readonly DependencyProperty FoldingStrategyProperty =
+ DependencyProperty.Register("FoldingStrategy", typeof(IFoldingStrategy), typeof(FooTextBox), new PropertyMetadata(null));
+
+ /// <summary>
/// マーカーパターンセットを表す
/// </summary>
public MarkerPatternSet MarkerPatternSet
/// </summary>
public string SelectedText
{
- get
- {
- return this._Controller.SelectedText;
- }
- set
- {
- int oldLength = this.Document.Length;
- this._Controller.SelectedText = value;
- }
+ get { return (string)GetValue(SelectedTextProperty); }
+ set { SetValue(SelectedTextProperty, value); }
}
/// <summary>
+ /// SelectedTextの依存プロパティを表す
+ /// </summary>
+ public static readonly DependencyProperty SelectedTextProperty =
+ DependencyProperty.Register("SelectedText", typeof(string), typeof(FooTextBox), new PropertyMetadata(null));
+
+ /// <summary>
/// インデントの方法を表す
/// </summary>
public IndentMode IndentMode
this.CaretMoved(this, null);
//こうしないと選択できなくなってしまう
this.isNotifyChanged = true;
+ SetValue(SelectedTextProperty, this._Controller.SelectedText);
SetValue(SelectionProperty, new TextRange(this._Controller.SelectionStart, this._Controller.SelectionLength));
SetValue(CaretPostionProperty, this.Document.CaretPostion);
this.isNotifyChanged = false;
{
switch (e.Property.Name)
{
+ case "Hilighter":
+ this.View.Hilighter = this.Hilighter;
+ break;
+ case "TextAntialiasMode":
+ this.Render.TextAntialiasMode = this.TextAntialiasMode;
+ break;
+ case "FoldingStrategy":
+ this.View.LayoutLines.FoldingStrategy = this.FoldingStrategy;
+ break;
+ case "SelectedText":
+ if (!this.isNotifyChanged)
+ this._Controller.SelectedText = this.SelectedText;
+ break;
case "IndentMode":
this._Controller.IndentMode = this.IndentMode;
break;
/// </summary>
public TextAntialiasMode TextAntialiasMode
{
- get
- {
- return this.Render.TextAntialiasMode;
- }
- set
- {
- this.Render.TextAntialiasMode = value;
- }
+ get { return (TextAntialiasMode)GetValue(TextAntialiasModeProperty); }
+ set { SetValue(TextAntialiasModeProperty, value); }
}
/// <summary>
+ /// TextAntialiasModeの依存プロパティを表す
+ /// </summary>
+ public static readonly DependencyProperty TextAntialiasModeProperty =
+ DependencyProperty.Register("TextAntialiasMode", typeof(TextAntialiasMode), typeof(FooTextBox), new PropertyMetadata(TextAntialiasMode.Default));
+
+ /// <summary>
/// シンタックスハイライターを表す
/// </summary>
public IHilighter Hilighter
{
- get
- {
- return this.View.Hilighter;
- }
- set
- {
- this.View.Hilighter = value;
- this.View.LayoutLines.ClearLayoutCache();
- }
+ get { return (IHilighter)GetValue(HilighterProperty); }
+ set { SetValue(HilighterProperty, value); }
}
/// <summary>
+ /// Hilighterの依存プロパティを表す
+ /// </summary>
+ public static readonly DependencyProperty HilighterProperty =
+ DependencyProperty.Register("Hilighter", typeof(IHilighter), typeof(FooTextBox), new PropertyMetadata(null));
+
+ /// <summary>
/// フォールティングを作成するインターフェイスを表す
/// </summary>
public IFoldingStrategy FoldingStrategy
{
- get
- {
- return this.View.LayoutLines.FoldingStrategy;
- }
- set
- {
- this.View.LayoutLines.FoldingStrategy = value;
- if (value == null)
- this.View.LayoutLines.FoldingCollection.Clear();
- }
+ get { return (IFoldingStrategy)GetValue(FoldingStrategyProperty); }
+ set { SetValue(FoldingStrategyProperty, value); }
}
/// <summary>
+ /// FoldingStrategyの依存プロパティ
+ /// </summary>
+ public static readonly DependencyProperty FoldingStrategyProperty =
+ DependencyProperty.Register("FoldingStrategy", typeof(IFoldingStrategy), typeof(FooTextBox), new PropertyMetadata(null));
+
+
+ /// <summary>
/// マーカーパターンセット
/// </summary>
public MarkerPatternSet MarkerPatternSet
/// </summary>
public string SelectedText
{
- get
- {
- return this._Controller.SelectedText;
- }
- set
- {
- int oldLength = this.Document.Length;
- this._Controller.SelectedText = value;
- }
+ get { return (string)GetValue(SelectedTextProperty); }
+ set { SetValue(SelectedTextProperty, value); }
}
/// <summary>
+ /// SelectedTextの依存プロパティを表す
+ /// </summary>
+ public static readonly DependencyProperty SelectedTextProperty =
+ DependencyProperty.Register("SelectedText", typeof(string), typeof(FooTextBox), new PropertyMetadata(null));
+
+ /// <summary>
/// インデントの方法を表す
/// </summary>
public IndentMode IndentMode