preliminary scaffolding to support project settings
This commit is contained in:
parent
dc78a506eb
commit
9bfb038efd
@ -60,6 +60,7 @@ namespace UniversalEditor
|
||||
public Setting.SettingCollection Variables { get; } = new Setting.SettingCollection();
|
||||
|
||||
public string ProjectFileExtension { get; set; } = null;
|
||||
public SettingsProvider SettingsProvider { get; set; } = null;
|
||||
}
|
||||
/// <summary>
|
||||
/// A shortcut placed in the "Add New Item" menu when the project is selected. When
|
||||
|
||||
@ -1414,5 +1414,38 @@ namespace UniversalEditor.UserInterface
|
||||
|
||||
private Perspective.PerspectiveCollection mvarPerspectives = new Perspective.PerspectiveCollection();
|
||||
public Perspective.PerspectiveCollection Perspectives { get { return mvarPerspectives; } }
|
||||
|
||||
public void ShowProjectSettings(UniversalEditor.ObjectModels.Project.ProjectObjectModel project)
|
||||
{
|
||||
List<SettingsProvider> list = new List<SettingsProvider>();
|
||||
foreach (ProjectType projType in project.ProjectTypes)
|
||||
{
|
||||
if (projType.SettingsProvider != null)
|
||||
{
|
||||
list.Add(projType.SettingsProvider);
|
||||
}
|
||||
}
|
||||
if (list.Count > 0)
|
||||
{
|
||||
SettingsDialog dlg = new SettingsDialog();
|
||||
dlg.SettingsProviders.Clear();
|
||||
foreach (SettingsProvider sp in list)
|
||||
{
|
||||
dlg.SettingsProviders.Add(sp);
|
||||
}
|
||||
|
||||
dlg.Text = String.Format("{0} Properties", project.Title);
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
// TODO: apply properties to project
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Accessors.MemoryAccessor ma = new Accessors.MemoryAccessor(new byte[0], String.Format("{0} Properties", project.Title));
|
||||
Document d = new Document(project, null, ma);
|
||||
d.Title = String.Format("{0} Properties", project.Title);
|
||||
((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow).OpenFile(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MBS.Framework;
|
||||
using MBS.Framework.UserInterface;
|
||||
using MBS.Framework.UserInterface.Controls;
|
||||
@ -300,10 +301,7 @@ namespace UniversalEditor.UserInterface.Panels
|
||||
ProjectFolder folder = e.Row.GetExtraData<ProjectFolder>("folder");
|
||||
if (project != null)
|
||||
{
|
||||
Accessors.MemoryAccessor ma = new Accessors.MemoryAccessor(new byte[0], String.Format("{0} Properties", project.Title));
|
||||
Document d = new Document(project, null, ma);
|
||||
d.Title = String.Format("{0} Properties", project.Title);
|
||||
((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow).OpenFile(d);
|
||||
((EditorApplication)Application.Instance).ShowProjectSettings(project);
|
||||
}
|
||||
else if (file != null)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user