From 6141acef3d17d79b4a1bebcb499f55b51aecdd6a Mon Sep 17 00:00:00 2001 From: gdkhd812 Date: Sun, 25 Aug 2013 01:09:01 +0900 Subject: [PATCH] =?utf8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E6=93=8D?= =?utf8?q?=E4=BD=9C=E9=96=A2=E9=80=A3=E3=82=92DocumentExtend=E3=82=AF?= =?utf8?q?=E3=83=A9=E3=82=B9=E3=81=AB=E5=88=86=E9=9B=A2=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Common/Document.cs | 239 ++------------------------- Common/DocumentExtend.cs | 249 +++++++++++++++++++++++++++++ Common/EditView.cs | 2 +- Common/PrintableView.cs | 2 +- Common/ViewBase.cs | 15 +- Metro/FooEditEngnine/FooEditEngine.csproj | 3 + Metro/FooEditEngnine/FooTextBox.cs | 3 +- Metro/Test/MainPage.xaml.cs | 1 + WPF/FooEditEngine/FooEditEngine.csproj | 3 + WPF/FooEditEngine/FooTextBox.cs | 3 +- WPF/Test/MainWindow.xaml.cs | 7 +- Windows/FooEditEngine/FooEditEngine.csproj | 3 + Windows/FooEditEngine/FooTextBox.cs | 24 +-- Windows/Test/Form1.cs | 2 +- 14 files changed, 285 insertions(+), 271 deletions(-) create mode 100644 Common/DocumentExtend.cs diff --git a/Common/Document.cs b/Common/Document.cs index 33fd3a5..5e3242f 100644 --- a/Common/Document.cs +++ b/Common/Document.cs @@ -9,8 +9,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -//#define TEST_ASYNC - using System; using System.IO; using System.Collections.Generic; @@ -149,8 +147,6 @@ namespace FooEditEngine Regex regex; Match match; StringBuffer buffer; - CancellationTokenSource cancleTokenSource; - Progress _Progress = new Progress(); bool _EnableFireUpdateEvent = true; /// @@ -176,21 +172,6 @@ namespace FooEditEngine } /// - /// 進捗処理を表す - /// - public event EventHandler Progress - { - add - { - this._Progress.ProgressChanged += value; - } - remove - { - this._Progress.ProgressChanged -= value; - } - } - - /// /// ドキュメントが更新された時に呼ばれるイベント /// public event DocumentUpdateEventHandler Update; @@ -233,7 +214,7 @@ namespace FooEditEngine public AsyncState State { get; - private set; + internal set; } /// @@ -285,6 +266,14 @@ namespace FooEditEngine private set; } + internal StringBuffer StringBuffer + { + get + { + return this.buffer; + } + } + /// /// DocumentReaderを作成します /// @@ -441,216 +430,6 @@ namespace FooEditEngine } /// - /// 非同期操作をキャンセルします - /// - public void Cancel() - { - if(this.cancleTokenSource != null) - this.cancleTokenSource.Cancel(); - } - -#if !METRO - /// - /// ファイルからドキュメントを構築します - /// - /// 読み取り先のファイル - /// エンコーディング - /// 非同期操作中はこのメソッドを実行することはできません - public void Load(string filepath, Encoding enc) - { - if (this.State != AsyncState.None) - throw new InvalidOperationException(); - using (StreamReader sr = new StreamReader(filepath, enc)) - { - this.Load(sr); - } - } - - /// - /// ファイルからドキュメントを非同期的に構築します - /// - /// 読み取り先のファイル - /// エンコーディング - /// 読み取り操作は別スレッドで行われます。また、非同期操作中にこのメソッドを読みだすことはできません - public async Task LoadAsync(string filepath, Encoding enc) - { - if (this.State != AsyncState.None) - throw new InvalidOperationException(); - this.cancleTokenSource = new CancellationTokenSource(); - using (StreamReader sr = new StreamReader(filepath, enc)) - { - await this.LoadAsync(sr, this.cancleTokenSource); - } - } -#endif - - /// - /// ストリームからドキュメントを構築します - /// - /// 読み取り先のストリーム - /// 非同期操作中はこのメソッドを実行することはできません - public void Load(TextReader sr) - { - Task t = this.LoadAsync(sr, null); - t.Wait(); - } - - /// - /// ストリームからドキュメントを非同期的に構築します - /// - /// 読み取り先のストリーム - /// Taskオブジェクト - /// 非同期操作中はこのメソッドを実行することはできません - public async Task LoadAsync(TextReader sr) - { - this.cancleTokenSource = new CancellationTokenSource(); - await this.LoadAsync(sr, this.cancleTokenSource); - } - - /// - /// ストリームからドキュメントを非同期的に構築します - /// - /// 読み取り先のストリーム - /// キャンセルトークン - /// Taskオブジェクト - /// 非同期操作中はこのメソッドを実行することはできません - async Task LoadAsync(TextReader sr,CancellationTokenSource tokenSource = null) - { - if (this.State != AsyncState.None) - throw new InvalidOperationException(); - if (sr.Peek() == -1) - { - return; - } - - IProgress progress = this._Progress; - try - { - progress.Report(new ProgressEventArgs(ProgressState.Start)); - this.State = AsyncState.Loading; - this.FireUpdateEvent = false; - this.buffer.Clear(); - this.UndoManager.BeginLock(); - string str; - for (int i = 0; (str = await sr.ReadLineAsync().ConfigureAwait(false)) != null; i++) - { - int index = this.buffer.Length; - if (index < 0) - index = 0; - - this.buffer.Replace(index, 0, str + Document.NewLine); - - if(tokenSource != null) - tokenSource.Token.ThrowIfCancellationRequested(); -#if TEST_ASYNC - System.Threading.Thread.Sleep(10); -#endif - } - } - finally - { - this.FireUpdateEvent = true; - this.UndoManager.EndLock(); - this.State = AsyncState.None; - progress.Report(new ProgressEventArgs(ProgressState.Complete)); - } - } - -#if !METRO - /// - /// ドキュメントをファイルに保存します - /// - /// 保存先のファイル - /// 保存したいエンコード - /// 改行を表す文字列 - /// 非同期操作中はこのメソッドを実行することはできません - public void Save(string filepath, Encoding enc, string newline) - { - if (this.State != AsyncState.None) - throw new InvalidOperationException(); - using (StreamWriter sw = new StreamWriter(filepath, false, enc)) - { - sw.NewLine = newline; - this.Save(sw); - } - } - - /// - /// ドキュメントをファイルに保存します - /// - /// 保存先のファイル - /// 保存したいエンコード - /// 改行を表す文字列 - /// 非同期操作中はこのメソッドを実行することはできません - public async Task SaveAsync(string filepath, Encoding enc, string newline) - { - if (this.State != AsyncState.None) - throw new InvalidOperationException(); - this.cancleTokenSource = new CancellationTokenSource(); - using (StreamWriter sw = new StreamWriter(filepath, false, enc)) - { - sw.NewLine = newline; - await this.SaveAsync(sw,this.cancleTokenSource); - } - } -#endif - - /// - /// ストリームに保存します - /// - /// 保存先のストリーム - /// キャンセルトークン - /// Taskオブジェクト - /// 非同期操作中はこのメソッドを実行することはできません - public void Save(StreamWriter sw, CancellationTokenSource tokenSource = null) - { - Task t = this.SaveAsync(sw, null); - t.Wait(); - } - - /// - /// ストリームに非同期モードで保存します - /// - /// 保存先のストリーム - /// キャンセルトークン - /// Taskオブジェクト - /// 非同期操作中はこのメソッドを実行することはできません - public async Task SaveAsync(StreamWriter sw, CancellationTokenSource tokenSource = null) - { - if (this.State != AsyncState.None) - throw new InvalidOperationException(); - IProgress progress = this._Progress; - try - { - progress.Report(new ProgressEventArgs(ProgressState.Start)); - this.State = AsyncState.Saving; - StringBuilder line = new StringBuilder(); - for (int i = 0; i < this.Length; i++) - { - char c = this.buffer[i]; - line.Append(c); - if (c == Document.NewLine || i == this.Length - 1) - { - string str = line.ToString(); - str = str.Replace(Document.NewLine.ToString(), sw.NewLine); - await sw.WriteAsync(str).ConfigureAwait(false); - line.Clear(); - if(tokenSource != null) - tokenSource.Token.ThrowIfCancellationRequested(); -#if TEST_ASYNC - System.Threading.Thread.Sleep(10); -#endif - } - } - } - finally - { - this.State = AsyncState.None; - progress.Report(new ProgressEventArgs(ProgressState.Complete)); - } - } - - /// /// Find()で使用するパラメーターをセットします /// /// 検索したい文字列 diff --git a/Common/DocumentExtend.cs b/Common/DocumentExtend.cs new file mode 100644 index 0000000..8baac86 --- /dev/null +++ b/Common/DocumentExtend.cs @@ -0,0 +1,249 @@ +/* + * Copyright (C) 2013 FooProject + * * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program. If not, see . + */ + +//#define TEST_ASYNC + +using System; +using System.IO; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace FooEditEngine +{ + /// + /// Documentの拡張クラス + /// + public static class DocumentExtend + { + static Progress _Progress = new Progress(); + /// + /// 進捗処理を表す + /// + public static event EventHandler Progress + { + add + { + _Progress.ProgressChanged += value; + } + remove + { + _Progress.ProgressChanged -= value; + } + } + +#if !METRO + /// + /// ファイルからドキュメントを構築します + /// + /// Documentオブジェクト + /// 読み取り先のファイル + /// エンコーディング + /// + /// 非同期操作中はこのメソッドを実行することはできません。 + /// + public static void Load(this Document doc, string filepath, Encoding enc) + { + if (doc.State != AsyncState.None) + throw new InvalidOperationException(); + using (StreamReader sr = new StreamReader(filepath, enc)) + { + Load(doc,sr); + } + } + + /// + /// ファイルからドキュメントを非同期的に構築します + /// + /// Documentオブジェクト + /// 読み取り先のファイル + /// エンコーディング + /// キャンセル用のトークン + /// + /// 読み取り操作は別スレッドで行われます。 + /// また、非同期操作中にこのメソッドを読みだすことはできません + /// + public static async Task LoadAsync(this Document doc, string filepath, Encoding enc, CancellationTokenSource token) + { + if (doc.State != AsyncState.None) + throw new InvalidOperationException(); + using (StreamReader sr = new StreamReader(filepath, enc)) + { + await LoadAsync(doc,sr, token); + } + } +#endif + + /// + /// ストリームからドキュメントを構築します + /// + /// Documentオブジェクト + /// 読み取り先のストリーム + /// + /// 非同期操作中はこのメソッドを実行することはできません + /// + public static void Load(this Document doc, TextReader sr) + { + Task t = LoadAsync(doc,sr, null); + t.Wait(); + } + + /// + /// ストリームからドキュメントを非同期的に構築します + /// + /// Documentオブジェクト + /// 読み取り先のストリーム + /// キャンセルトークン + /// Taskオブジェクト + /// + /// 読み取り操作は別スレッドで行われます。 + /// また、非同期操作中はこのメソッドを実行することはできません。 + /// + public static async Task LoadAsync(this Document doc, TextReader sr, CancellationTokenSource tokenSource = null) + { + if (doc.State != AsyncState.None) + throw new InvalidOperationException(); + if (sr.Peek() == -1) + { + return; + } + + IProgress progress = _Progress; + try + { + progress.Report(new ProgressEventArgs(ProgressState.Start)); + doc.State = AsyncState.Loading; + doc.FireUpdateEvent = false; + doc.StringBuffer.Clear(); + doc.UndoManager.BeginLock(); + string str; + for (int i = 0; (str = await sr.ReadLineAsync().ConfigureAwait(false)) != null; i++) + { + int index = doc.StringBuffer.Length; + if (index < 0) + index = 0; + + doc.StringBuffer.Replace(index, 0, str + Document.NewLine); + + if (tokenSource != null) + tokenSource.Token.ThrowIfCancellationRequested(); +#if TEST_ASYNC + System.Threading.Thread.Sleep(10); +#endif + } + } + finally + { + doc.FireUpdateEvent = true; + doc.UndoManager.EndLock(); + doc.State = AsyncState.None; + progress.Report(new ProgressEventArgs(ProgressState.Complete)); + } + } + +#if !METRO + /// + /// ドキュメントをファイルに保存します + /// + /// Documentオブジェクト + /// 保存先のファイル + /// 保存したいエンコード + /// 改行を表す文字列 + /// 非同期操作中はこのメソッドを実行することはできません + public static void Save(this Document doc, string filepath, Encoding enc, string newline) + { + if (doc.State != AsyncState.None) + throw new InvalidOperationException(); + using (StreamWriter sw = new StreamWriter(filepath, false, enc)) + { + sw.NewLine = newline; + Save(doc,sw); + } + } + + /// + /// ドキュメントをファイルに保存します + /// + /// Documentオブジェクト + /// 保存先のファイル + /// 保存したいエンコード + /// 改行を表す文字列 + /// CancellationTokenSourceオブジェクト + /// 非同期操作中はこのメソッドを実行することはできません + public static async Task SaveAsync(this Document doc, string filepath, Encoding enc, string newline,CancellationTokenSource token) + { + if (doc.State != AsyncState.None) + throw new InvalidOperationException(); + using (StreamWriter sw = new StreamWriter(filepath, false, enc)) + { + sw.NewLine = newline; + await SaveAsync(doc,sw, token); + } + } +#endif + + /// + /// ストリームに保存します + /// + /// Documentオブジェクト + /// 保存先のストリーム + /// Taskオブジェクト + /// 非同期操作中はこのメソッドを実行することはできません + public static void Save(this Document doc, StreamWriter sw) + { + Task t = SaveAsync(doc,sw, null); + t.Wait(); + } + + /// + /// ストリームに非同期モードで保存します + /// + /// Documentオブジェクト + /// 保存先のストリーム + /// キャンセルトークン + /// Taskオブジェクト + /// 非同期操作中はこのメソッドを実行することはできません + public static async Task SaveAsync(this Document doc,StreamWriter sw, CancellationTokenSource tokenSource = null) + { + if (doc.State != AsyncState.None) + throw new InvalidOperationException(); + IProgress progress = _Progress; + try + { + progress.Report(new ProgressEventArgs(ProgressState.Start)); + doc.State = AsyncState.Saving; + StringBuilder line = new StringBuilder(); + for (int i = 0; i < doc.Length; i++) + { + char c = doc[i]; + line.Append(c); + if (c == Document.NewLine || i == doc.Length - 1) + { + string str = line.ToString(); + str = str.Replace(Document.NewLine.ToString(), sw.NewLine); + await sw.WriteAsync(str).ConfigureAwait(false); + line.Clear(); + if (tokenSource != null) + tokenSource.Token.ThrowIfCancellationRequested(); +#if TEST_ASYNC + System.Threading.Thread.Sleep(10); +#endif + } + } + } + finally + { + doc.State = AsyncState.None; + progress.Report(new ProgressEventArgs(ProgressState.Complete)); + } + } + } +} diff --git a/Common/EditView.cs b/Common/EditView.cs index 48c7662..0e0f8e2 100644 --- a/Common/EditView.cs +++ b/Common/EditView.cs @@ -813,7 +813,7 @@ namespace FooEditEngine this.LineBreakingMarginWidth = width * 5 / 100; } - protected override void CalculateLineCountOnScreen() + public override void CalculateLineCountOnScreen() { if (this.LayoutLines.Count == 0 || this.PageBound.Height == 0) return; diff --git a/Common/PrintableView.cs b/Common/PrintableView.cs index 967feef..9ab4c62 100644 --- a/Common/PrintableView.cs +++ b/Common/PrintableView.cs @@ -117,7 +117,7 @@ namespace FooEditEngine this.render.TextArea = new Rectangle(x, y, width, height); } - protected override void CalculateLineCountOnScreen() + public override void CalculateLineCountOnScreen() { if (this.LayoutLines.Count == 0) return; diff --git a/Common/ViewBase.cs b/Common/ViewBase.cs index 4338a12..63eb3c1 100644 --- a/Common/ViewBase.cs +++ b/Common/ViewBase.cs @@ -52,7 +52,6 @@ namespace FooEditEngine { this.Document = doc; this.Document.UpdateCalledAlways += new DocumentUpdateEventHandler(doc_Update); - this.Document.Progress += Document_Progress; this._LayoutLines = new LineToIndexTable(this.Document, r); this._LayoutLines.SpilitString = new SpilitStringEventHandler(LayoutLines_SpilitStringByChar); this.render = r; @@ -253,12 +252,15 @@ namespace FooEditEngine GC.SuppressFinalize(this); } + public virtual void CalculateLineCountOnScreen() + { + } + protected virtual void Dispose(bool disposing) { if (disposing) { this.Document.UpdateCalledAlways -= new DocumentUpdateEventHandler(this.doc_Update); //これをしないと複数のビューを作成した時に妙なエラーが発生する - this.Document.Progress -= Document_Progress; } this._LayoutLines.Clear(); } @@ -267,9 +269,6 @@ namespace FooEditEngine { } - protected virtual void CalculateLineCountOnScreen() - { - } protected virtual void OnSrcChanged(EventArgs e) { @@ -309,12 +308,6 @@ namespace FooEditEngine } } - void Document_Progress(object sender, ProgressEventArgs e) - { - if (e.state == ProgressState.Complete) - this.CalculateLineCountOnScreen(); - } - void doc_Update(object sender, DocumentUpdateEventArgs e) { switch (e.type) diff --git a/Metro/FooEditEngnine/FooEditEngine.csproj b/Metro/FooEditEngnine/FooEditEngine.csproj index 29b8bb9..6ccd8e1 100644 --- a/Metro/FooEditEngnine/FooEditEngine.csproj +++ b/Metro/FooEditEngnine/FooEditEngine.csproj @@ -144,6 +144,9 @@ Document.cs + + DocumentExtend.cs + EditView.cs diff --git a/Metro/FooEditEngnine/FooTextBox.cs b/Metro/FooEditEngnine/FooTextBox.cs index dac43c6..44214a3 100644 --- a/Metro/FooEditEngnine/FooTextBox.cs +++ b/Metro/FooEditEngnine/FooTextBox.cs @@ -71,7 +71,7 @@ namespace FooEditEngine.Metro this.textStore.CompositionEnded += textStore_CompositionEnded; this.Document = new Document(); - this.Document.Progress += Document_Progress; + DocumentExtend.Progress += Document_Progress; this.rectangle = new Windows.UI.Xaml.Shapes.Rectangle(); this.rectangle.Margin = this.Padding; @@ -1059,6 +1059,7 @@ namespace FooEditEngine.Metro this.textStore.NotifyTextChanged(0, 0, this.Document.Length); if (this.verticalScrollBar != null) this.verticalScrollBar.Maximum = this.View.LayoutLines.Count; + this.View.CalculateLineCountOnScreen(); break; } } diff --git a/Metro/Test/MainPage.xaml.cs b/Metro/Test/MainPage.xaml.cs index eb411b2..43ef768 100644 --- a/Metro/Test/MainPage.xaml.cs +++ b/Metro/Test/MainPage.xaml.cs @@ -20,6 +20,7 @@ using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Navigation; using Windows.UI.ApplicationSettings; +using FooEditEngine; using FooEditEngine.Metro; // 空白ページのアイテム テンプレートについては、http://go.microsoft.com/fwlink/?LinkId=234238 を参照してください diff --git a/WPF/FooEditEngine/FooEditEngine.csproj b/WPF/FooEditEngine/FooEditEngine.csproj index 3cd3693..6ce613b 100644 --- a/WPF/FooEditEngine/FooEditEngine.csproj +++ b/WPF/FooEditEngine/FooEditEngine.csproj @@ -108,6 +108,9 @@ Document.cs + + DocumentExtend.cs + EditView.cs diff --git a/WPF/FooEditEngine/FooTextBox.cs b/WPF/FooEditEngine/FooTextBox.cs index 3a3fc3a..64bcbcc 100644 --- a/WPF/FooEditEngine/FooTextBox.cs +++ b/WPF/FooEditEngine/FooTextBox.cs @@ -83,7 +83,7 @@ namespace FooEditEngine.WPF this.textStore.CompositionEnded += textStore_CompositionEnded; this.Document = new Document(); - this.Document.Progress += Document_Progress; + DocumentExtend.Progress += Document_Progress; this.Render = new D2DRender(this, 200, 200,this.image); this.Render.ShowFullSpace = this.ShowFullSpace; @@ -946,6 +946,7 @@ namespace FooEditEngine.WPF this.OnMouseMove(new MouseEventArgs(Mouse.PrimaryDevice, new TimeSpan(DateTime.Now.Ticks).Milliseconds)); if(this.verticalScrollBar != null) this.verticalScrollBar.Maximum = this.View.LayoutLines.Count; + this.View.CalculateLineCountOnScreen(); break; } } diff --git a/WPF/Test/MainWindow.xaml.cs b/WPF/Test/MainWindow.xaml.cs index eeabf01..5ed1212 100644 --- a/WPF/Test/MainWindow.xaml.cs +++ b/WPF/Test/MainWindow.xaml.cs @@ -25,6 +25,7 @@ namespace Test /// public partial class MainWindow : Window { + System.Threading.CancellationTokenSource cancleTokenSrc = new System.Threading.CancellationTokenSource(); public MainWindow() { InitializeComponent(); @@ -38,7 +39,7 @@ namespace Test void MainWindow_Closed(object sender, System.EventArgs e) { - this.fooTextBox.Document.Cancel(); + this.cancleTokenSrc.Cancel(); } void fooTextBox_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) @@ -120,7 +121,7 @@ namespace Test bool result = (bool)ofd.ShowDialog(this); if (result == true) { - await this.fooTextBox.Document.LoadAsync(ofd.FileName, Encoding.Default); + await this.fooTextBox.Document.LoadAsync(ofd.FileName, Encoding.Default,this.cancleTokenSrc); this.fooTextBox.Refresh(); } } @@ -190,7 +191,7 @@ namespace Test bool result = (bool)sfd.ShowDialog(this); if (result == true) { - await this.fooTextBox.Document.SaveAsync(sfd.FileName,Encoding.Default,"\r\n"); + await this.fooTextBox.Document.SaveAsync(sfd.FileName,Encoding.Default,"\r\n",cancleTokenSrc); MessageBox.Show("complete"); } } diff --git a/Windows/FooEditEngine/FooEditEngine.csproj b/Windows/FooEditEngine/FooEditEngine.csproj index 1fda0bd..dca7313 100644 --- a/Windows/FooEditEngine/FooEditEngine.csproj +++ b/Windows/FooEditEngine/FooEditEngine.csproj @@ -82,6 +82,9 @@ Document.cs + + DocumentExtend.cs + EditView.cs diff --git a/Windows/FooEditEngine/FooTextBox.cs b/Windows/FooEditEngine/FooTextBox.cs index fc22000..0171f15 100644 --- a/Windows/FooEditEngine/FooTextBox.cs +++ b/Windows/FooEditEngine/FooTextBox.cs @@ -70,8 +70,7 @@ namespace FooEditEngine.Windows this.SetStyle(ControlStyles.Opaque, true); this.Document = new Document(); - this.Document.Progress += Document_Progress; - this.Document.ChangeFireUpdateEvent += new EventHandler(Document_ChangeFireUpdateEvent); + DocumentExtend.Progress += Document_Progress; this.render = new D2DTextRender(this); this.View = new EditView(this.Document,this.render,new Margin(5,5,5,5)); @@ -645,26 +644,6 @@ namespace FooEditEngine.Windows this.Controller.DeSelectAll(); } - void Document_ChangeFireUpdateEvent(object sender, EventArgs e) - { - if (this.Document.FireUpdateEvent) - { - this.Controller.AdjustCaret(); - this.DeSelectAll(); - this.BeginInvoke(new Action(() => - { - this.Timer.Start(); - })); - } - else - { - this.BeginInvoke(new Action(() => - { - this.Timer.Stop(); - })); - } - } - /// /// クリップボードにコピーする /// @@ -1404,6 +1383,7 @@ namespace FooEditEngine.Windows { this.initScrollBars(); this.OnMouseMove(new MouseEventArgs(MouseButtons.None, 0, MousePosition.X, MousePosition.Y, 0)); + this.View.CalculateLineCountOnScreen(); } } diff --git a/Windows/Test/Form1.cs b/Windows/Test/Form1.cs index 13a9010..c978e23 100644 --- a/Windows/Test/Form1.cs +++ b/Windows/Test/Form1.cs @@ -63,7 +63,7 @@ namespace Test.Windows OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { - await this.fooTextBox1.Document.LoadAsync(ofd.FileName, Encoding.Default); + await this.fooTextBox1.Document.LoadAsync(ofd.FileName, Encoding.Default,null); this.fooTextBox1.Refresh(); } } -- 2.11.0