/// ドキュメント全体が削除されたことを表す
/// </summary>
Clear,
+ /// <summary>
+ /// レイアウトが再構築されたことを表す
+ /// </summary>
+ RebuildLayout,
}
/// <summary>
/// </summary>
public void PerformLayout()
{
- //単に再構築するだけなので行ダーティフラグは更新してはいけない
this.LayoutLines.IsFrozneDirtyFlag = true;
- this.FireUpdate(new DocumentUpdateEventArgs(UpdateType.Clear, -1, -1, -1));
- this.FireUpdate(new DocumentUpdateEventArgs(UpdateType.Replace, 0, 0, this.Length));
+ this.FireUpdate(new DocumentUpdateEventArgs(UpdateType.RebuildLayout, -1, -1, -1));
this.LayoutLines.IsFrozneDirtyFlag = false;
if (this.PerformLayouted != null)
this.PerformLayouted(this, null);
{
switch (e.type)
{
+ case UpdateType.RebuildLayout:
+ this._LayoutLines.Clear();
+ this._LayoutLines.UpdateAsReplace(0, 0, this.Length);
+ break;
case UpdateType.Replace:
if (e.row == null)
{
this._LayoutLines.UpdateLineAsReplace(e.row.Value, e.removeLength, e.insertLength);
this.Markers.UpdateMarkers(this.LayoutLines.GetIndexFromLineNumber(e.row.Value), e.insertLength, e.removeLength);
}
+ this.Dirty = true;
break;
case UpdateType.Clear:
this._LayoutLines.Clear();
+ this.Dirty = true;
break;
}
- this.Dirty = true;
if(this.FireUpdateEvent)
this.Update(this, e);
}
if (flow == AdjustFlow.Row || flow == AdjustFlow.Both)
{
+ int PhyLineCountOnScreen = (int)(this.render.TextArea.Height / this.render.emSize.Height);
//計算量を減らすため
- if (tp.row < this.Src.Row)
+ if (tp.row < this.Src.Row || tp.row + PhyLineCountOnScreen * 2 > this.Src.Row)
this.Document.Src = new SrcPoint(this.Src.X, tp.row, -relPoint.Y);
//キャレットのY座標を求める
double lineHeight = this.render.emSize.Height;
double caret_y = this.Src.OffsetY; //src.rowからキャレット位置
- double alignedHeight = (int)(this.render.TextArea.Height / this.render.emSize.Height) * this.render.emSize.Height;
+ double alignedHeight = PhyLineCountOnScreen * this.render.emSize.Height;
for (int i = this.Src.Row; i < tp.row; i++)
{
int lineHeadIndex = this.LayoutLines.GetIndexFromLineNumber(i);
public override void CalculateWhloeViewPort()
{
+ if(this.Document.LineBreak == LineBreakMethod.None)
+ {
+ this._LongestHeight = this.LayoutLines.Count * this.render.emSize.Height;
+ //CalculateLineCountOnScreenで最小幅は計算する
+ return;
+ }
double width = 0, height = 0;
for(int i = 0; i < this.LayoutLines.Count; i++)
{