From 2db94e4dde4de4b735fc433c144b0c48caea5e26 Mon Sep 17 00:00:00 2001 From: Zihan Chen Date: Mon, 2 Apr 2018 04:09:42 -0700 Subject: [PATCH] ... --- Import/GacUI.cpp | 2 +- TODO.md | 4 ++-- .../TextEditor/UI/Source/MainWindow.cpp | 13 ++++++++++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Import/GacUI.cpp b/Import/GacUI.cpp index d26d7b26..3907db2d 100644 --- a/Import/GacUI.cpp +++ b/Import/GacUI.cpp @@ -25697,7 +25697,7 @@ GuiGeneralUndoRedoProcessor { steps.Clear(); firstFutureStep=0; - savedStep=-1; + savedStep=0; } } diff --git a/TODO.md b/TODO.md index 8f14783c..da752270 100644 --- a/TODO.md +++ b/TODO.md @@ -67,9 +67,9 @@ https://zhuanlan.zhihu.com/p/33778843 - [x] Demo: Direct2DClock - [x] Demo: Responsive1 - [x] Demo: Responsive2 -- [ ] Demo: TextEditor +- [x] Demo: TextEditor - [x] Use toolstrip group instead of splitter - - [ ] Recently opened files in both menu and toolbar + - [x] Recently opened files in both menu and toolbar - [x] Prevent from crashing while binding to a.b.c if a.b is null with a.b.cChanged exists - [ ] **Update Release** - [ ] Demo: TriplePhaseImageButton diff --git a/Tutorial/GacUI_Controls/TextEditor/UI/Source/MainWindow.cpp b/Tutorial/GacUI_Controls/TextEditor/UI/Source/MainWindow.cpp index a54b0669..5c7e0632 100644 --- a/Tutorial/GacUI_Controls/TextEditor/UI/Source/MainWindow.cpp +++ b/Tutorial/GacUI_Controls/TextEditor/UI/Source/MainWindow.cpp @@ -70,6 +70,7 @@ namespace demo textBox->SetText(reader.ReadToEnd()); textBox->Select(TextPos(), TextPos()); textBox->SetFocus(); + textBox->ClearUndoRedo(); fileName = dialogOpen->GetFileName(); if (INVLOC.EndsWith(fileName, L".xml", Locale::IgnoreCase)) @@ -81,8 +82,10 @@ namespace demo SetupTextConfig(); } - textBox->ClearUndoRedo(); - AddRecentFile(path); + GetApplication()->InvokeInMainThread(this, [=]() + { + AddRecentFile(path); + }); return true; } else @@ -147,7 +150,11 @@ namespace demo { SetupTextConfig(); } - AddRecentFile(targetFileName); + + GetApplication()->InvokeInMainThread(this, [=]() + { + AddRecentFile(targetFileName); + }); return true; } else