diff --git a/Libraries/UniversalEditor.Essential/DataFormats/UEPackage/UEPackageXMLDataFormat.cs b/Libraries/UniversalEditor.Essential/DataFormats/UEPackage/UEPackageXMLDataFormat.cs index 509ff0b5..b68631f6 100644 --- a/Libraries/UniversalEditor.Essential/DataFormats/UEPackage/UEPackageXMLDataFormat.cs +++ b/Libraries/UniversalEditor.Essential/DataFormats/UEPackage/UEPackageXMLDataFormat.cs @@ -546,6 +546,11 @@ namespace UniversalEditor.DataFormats.UEPackage template.Description = tagInformation.Elements["Description"].Value; } + if (tagInformation.Elements["Prefix"] != null) + { + template.Prefix = tagInformation.Elements["Prefix"].Value; + } + MarkupTagElement tagPath = (tagInformation.Elements["Path"] as MarkupTagElement); if (tagPath != null) { @@ -739,7 +744,7 @@ namespace UniversalEditor.DataFormats.UEPackage if (tagInformation.Elements["ProjectNamePrefix"] != null) { - template.ProjectNamePrefix = tagInformation.Elements["ProjectNamePrefix"].Value; + template.Prefix = tagInformation.Elements["ProjectNamePrefix"].Value; } MarkupTagElement tagPath = (tagInformation.Elements["Path"] as MarkupTagElement); diff --git a/Libraries/UniversalEditor.Essential/Template.cs b/Libraries/UniversalEditor.Essential/Template.cs index 27d8d66c..470c09eb 100644 --- a/Libraries/UniversalEditor.Essential/Template.cs +++ b/Libraries/UniversalEditor.Essential/Template.cs @@ -21,10 +21,9 @@ using System; using System.Collections.Generic; - using UniversalEditor.ObjectModels.Markup; -using UniversalEditor.ObjectModels.PropertyList; using UniversalEditor.ObjectModels.Project; +using UniversalEditor.ObjectModels.PropertyList; namespace UniversalEditor { @@ -82,6 +81,8 @@ namespace UniversalEditor /// public string Description { get { return mvarDescription; } set { mvarDescription = value; } } + public string Prefix { get; set; } = null; + private TemplateVariable.TemplateVariableCollection mvarVariables = new TemplateVariable.TemplateVariableCollection(); /// /// Variables that affect the content of this template. @@ -231,9 +232,6 @@ namespace UniversalEditor public ProjectType.ProjectTypeCollection ProjectTypes { get; } = new ProjectType.ProjectTypeCollection(); - private string mvarProjectNamePrefix = String.Empty; - public string ProjectNamePrefix { get { return mvarProjectNamePrefix; } set { mvarProjectNamePrefix = value; } } - private ProjectFileSystem mvarFileSystem = new ProjectFileSystem(); public ProjectFileSystem FileSystem { get { return mvarFileSystem; } } diff --git a/Libraries/UniversalEditor.UserInterface/Dialogs/NewDialog.cs b/Libraries/UniversalEditor.UserInterface/Dialogs/NewDialog.cs index 818b26e7..dbe36e66 100644 --- a/Libraries/UniversalEditor.UserInterface/Dialogs/NewDialog.cs +++ b/Libraries/UniversalEditor.UserInterface/Dialogs/NewDialog.cs @@ -512,7 +512,7 @@ namespace UniversalEditor.UserInterface.Dialogs if (!txtFileName.IsChangedByUser) { - string projectNamePrefix = pt.ProjectNamePrefix; + string projectNamePrefix = pt.Prefix; if (String.IsNullOrEmpty(projectNamePrefix)) { projectNamePrefix = pt.Title.Replace(" ", String.Empty); @@ -520,6 +520,10 @@ namespace UniversalEditor.UserInterface.Dialogs } txtFileName.Text = projectNamePrefix + "1"; } + if (!txtSolutionName.IsChangedByUser && SolutionTitle == null) + { + txtSolutionName.Text = txtFileName.Text; + } } else if (Mode == NewDialogMode.File) { @@ -527,7 +531,17 @@ namespace UniversalEditor.UserInterface.Dialogs if (pt == null) return; if (!txtFileName.IsChangedByUser) { - // txtFileName.Text = projectNamePrefix + "1"; + + string prefix = pt.Prefix; + if (String.IsNullOrEmpty(prefix)) + { + prefix = pt.ObjectModel.GetType().Name; + if (prefix.EndsWith("ObjectModel")) + { + prefix = prefix.Substring(0, prefix.Length - "ObjectModel".Length); + } + } + txtFileName.Text = prefix + "1"; } } } diff --git a/Libraries/UniversalEditor.UserInterface/EditorWindow.cs b/Libraries/UniversalEditor.UserInterface/EditorWindow.cs index dc07e3a1..a687cc3b 100644 --- a/Libraries/UniversalEditor.UserInterface/EditorWindow.cs +++ b/Libraries/UniversalEditor.UserInterface/EditorWindow.cs @@ -589,6 +589,8 @@ namespace UniversalEditor.UserInterface NewDialog dlg = new NewDialog(); dlg.Mode = NewDialogMode.Project; dlg.CombineObjects = combineObjects; + dlg.SolutionTitle = CurrentSolution?.Title; + if (dlg.ShowDialog() == DialogResult.OK) { SolutionObjectModel solution = null;