Document _Document;
Popup popup;
- const int Interval = 16;
+ const int Interval = 96;
const int IntervalWhenLostFocuse = 160;
static FooTextBox()
this.textStore.CompositionEnded += textStore_CompositionEnded;
this.Render = new D2DRender(this, 200, 200,this.image);
- this.Render.ShowFullSpace = this.ShowFullSpace;
- this.Render.ShowHalfSpace = this.ShowHalfSpace;
- this.Render.ShowTab = this.ShowTab;
this.Document = new Document();
this.Document.HideRuler = !this.DrawRuler;
this.Document.UrlMark = this.MarkURL;
this.Document.TabStops = this.TabChars;
+ this.Document.ShowFullSpace = this.ShowFullSpace;
+ this.Document.ShowHalfSpace = this.ShowHalfSpace;
+ this.Document.ShowTab = this.ShowTab;
this._Controller = new Controller(this.Document, this.View);
this._Document.SelectionChanged += new EventHandler(Controller_SelectionChanged);
{
this.verticalScrollBar.SmallChange = 1;
this.verticalScrollBar.LargeChange = 10;
- this.verticalScrollBar.Maximum = this.View.LayoutLines.Count;
+ this.verticalScrollBar.Maximum = this.Document.LayoutLines.Count - 1;
this.verticalScrollBar.Scroll += new ScrollEventHandler(verticalScrollBar_Scroll);
}
}
/// </summary>
public void Refresh()
{
- this.Document.RequestRedraw();
+ this.Refresh(this.View.PageBound);
}
/// <summary>
TextStoreHelper.NotifyTextChanged(this.textStore, 0, 0, this.Document.Length);
if (this.verticalScrollBar != null)
this.verticalScrollBar.Maximum = this.View.LayoutLines.Count;
+ this.View.CalculateWhloeViewPort();
this.View.CalculateLineCountOnScreen();
this.IsEnabled = true;
this.Refresh(this.View.PageBound);
if (e.LeftButton == MouseButtonState.Pressed)
{
+ if (p.X < this.Render.TextArea.X)
+ this.Document.SelectLine((int)index);
+ else
+ this.Document.SelectWord((int)index);
- this.Document.SelectWord((int)index);
this.textStore.NotifySelectionChanged();
if(this.peer != null)
this.peer.OnNotifyCaretChanged();
TextPointSearchRange searchRange;
if (this.View.HitTextArea(p.X, p.Y))
+ {
searchRange = TextPointSearchRange.TextAreaOnly;
+ }
else if (leftPressed)
+ {
searchRange = TextPointSearchRange.Full;
+ }
else
- searchRange = TextPointSearchRange.TextAreaOnly;
+ {
+ this.Cursor = Cursors.Arrow;
+ base.OnMouseMove(e);
+ return;
+ }
TextPoint tp = this.View.GetTextPointFromPostion(p, searchRange);
if (tp == TextPoint.Null)
{
+ this.Cursor = Cursors.Arrow;
base.OnMouseMove(e);
return;
}
{
this.Cursor = Cursors.Arrow;
}
-
if (leftPressed)
{
- this._Controller.MoveCaretAndSelect(tp);
+ bool controlPressed = (Keyboard.GetKeyStates(Key.LeftCtrl) & KeyStates.Down) == KeyStates.Down;
+ this._Controller.MoveCaretAndSelect(tp, controlPressed);
if (this.peer != null)
this.peer.OnNotifyCaretChanged();
this.Refresh();
toX = this.horizontalScrollBar.Value;
else
toX = -this.horizontalScrollBar.Value;
- this._Controller.Scroll(toX, this.View.Src.Row, false, false);
+ this.Controller.ScrollByPixel(ScrollDirection.Left, (int)toX, false, false);
this.Refresh();
}
{
if (this.verticalScrollBar == null)
return;
- int newRow = (int)this.verticalScrollBar.Value;
- if (newRow >= this.View.LayoutLines.Count)
- return;
- this._Controller.Scroll(this.View.Src.X,newRow, false, false);
+ this.Controller.Scroll(this.Document.Src.X, (int)this.verticalScrollBar.Value, false, false);
this.Refresh();
}
if (this.horizontalScrollBar == null || this.verticalScrollBar == null)
return;
EditView view = this.View;
- if (view.Src.Row > this.verticalScrollBar.Maximum)
- this.verticalScrollBar.Maximum = view.Src.Row + view.LineCountOnScreen + 1;
+ if (view.Src.Row > this.Document.LayoutLines.Count)
+ this.verticalScrollBar.Maximum = this.Document.LayoutLines.Count - 1;
double absoulteX = Math.Abs(view.Src.X);
if(absoulteX > this.horizontalScrollBar.Maximum)
this.horizontalScrollBar.Maximum = absoulteX + view.PageBound.Width + 1;
this._Document.AutoComplete.GetPostion = (tp, edoc) =>
{
var p = this.View.GetPostionFromTextPoint(tp);
- int height = (int)doc.LayoutLines.GetLayout(edoc.CaretPostion.row).Height;
+ int height = (int)this.Render.emSize.Height;
p.Y += height;
return PointToScreen(this.TranslatePoint(p.Scale(Util.GetScale()), this));
};
case "Foreground":
this.Render.Foreground = D2DRender.ToColor4(this.Foreground);
break;
+ case "HilightForeground":
+ this.Render.HilightForeground = D2DRender.ToColor4(this.HilightForeground);
+ break;
case "Background":
this.Render.Background = D2DRender.ToColor4(this.Background);
break;
/// </summary>
public new static readonly DependencyProperty BackgroundProperty =
DependencyProperty.Register("Background", typeof(System.Windows.Media.Color), typeof(FooTextBox), new FrameworkPropertyMetadata(SystemColors.WindowColor));
-
+
+ /// <summary>
+ /// 選択時の文字色を表す。これは依存プロパティです
+ /// </summary>
+ public System.Windows.Media.Color HilightForeground
+ {
+ get { return (System.Windows.Media.Color)GetValue(HilightForegroundProperty); }
+ set { SetValue(HilightForegroundProperty, value); }
+ }
+
+ /// <summary>
+ /// ControlCharの依存プロパティを表す
+ /// </summary>
+ public static readonly DependencyProperty HilightForegroundProperty =
+ DependencyProperty.Register("HilightForeground", typeof(System.Windows.Media.Color), typeof(FooTextBox), new FrameworkPropertyMetadata(Colors.White));
+
/// <summary>
/// コントロールコードの文字色を表す。これは依存プロパティです
/// </summary>