actually calculate the count of all of the same document types so we can provide a more accurate empty document name

This commit is contained in:
Michael Becker 2022-09-14 00:20:41 -04:00
parent 0bed50484d
commit fe6590611e
No known key found for this signature in database
GPG Key ID: DA394832305DA332

View File

@ -545,6 +545,7 @@ namespace UniversalEditor.UserInterface.Dialogs
projectNamePrefix = pt.Title.Replace(" ", String.Empty);
// projectNamePrefix = "Project";
}
txtFileName.Text = projectNamePrefix + "1";
}
if (!txtSolutionName.IsChangedByUser && SolutionTitle == null)
@ -567,7 +568,22 @@ namespace UniversalEditor.UserInterface.Dialogs
prefix = prefix.Substring(0, prefix.Length - "ObjectModel".Length);
}
}
txtFileName.Text = prefix + "1";
int iCount = 0;
// go through all windows, and all open documents, and count all of the same ObjectModel
for (int i = 0; i < ((EditorApplication)Application.Instance).Windows.Count; i++)
{
for (int j = 0; j < ((EditorApplication)Application.Instance).Windows[i].Documents.Count; j++)
{
if (((EditorApplication)Application.Instance).Windows[i].Documents[j].ObjectModel.MakeReference() == pt.ObjectModel.MakeReference())
{
iCount++;
}
}
}
txtFileName.Text = String.Concat(prefix, (iCount + 1));
}
}
}