don't load NULL documents, associate EditorPage.Document properly, EditorPage.Document SHOULD load document properly but it doesn't

This commit is contained in:
Michael Becker 2019-12-20 07:36:11 -05:00
parent 26634f7efd
commit 07aaeb2d47
No known key found for this signature in database
GPG Key ID: 506F54899E2BFED7

View File

@ -431,6 +431,8 @@ namespace UniversalEditor.UserInterface
private void InitEditorPage(Document doc)
{
if (doc == null) return;
bool loaded = false;
if (doc.DataFormat == null)
{
@ -575,6 +577,9 @@ namespace UniversalEditor.UserInterface
List<int> indices = new List<int>();
for (int i = 0; i < pages.Length; i++)
{
if (pages[i].Document == null)
continue;
if (!pages[i].Document.IsChanged)
continue;
@ -676,7 +681,12 @@ namespace UniversalEditor.UserInterface
if (ed == null) return;
EditorPage page = new EditorPage();
page.Document = new Document(ed.ObjectModel, null, new FileAccessor(filename));
// HACK til we can properly fix this
page.Controls.Clear();
page.Controls.Add(ed, new BoxLayout.Constraints(true, true));
page.DocumentEdited += page_DocumentEdited;
InitDocTab(filename, System.IO.Path.GetFileName(filename), page);