Content Compiler:
- Added Folder Feature -> You can now add Folders to a project (this was a hard, buggy one *phew*) - Set Enter-Key as default for OK or Next in Dialogues - Added missing Open/Add functionality in the Menustate
This commit is contained in:
parent
1bb53ec785
commit
8947f2ce8b
@ -61,6 +61,12 @@
|
||||
<Compile Include="Controls\RibbonButton.Designer.cs">
|
||||
<DependentUpon>RibbonButton.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Dialogues\NewFolderScreen.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Dialogues\NewFolderScreen.Designer.cs">
|
||||
<DependentUpon>NewFolderScreen.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Dialogues\OpenProjectScreen.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@ -131,6 +137,9 @@
|
||||
<EmbeddedResource Include="Controls\RibbonButton.resx">
|
||||
<DependentUpon>RibbonButton.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Dialogues\NewFolderScreen.resx">
|
||||
<DependentUpon>NewFolderScreen.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Dialogues\OpenProjectScreen.resx">
|
||||
<DependentUpon>OpenProjectScreen.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
@ -32,12 +32,12 @@
|
||||
this.buttonNext = new System.Windows.Forms.Button();
|
||||
this.button3 = new System.Windows.Forms.Button();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.listBoxRecentProjects = new System.Windows.Forms.ListBox();
|
||||
this.buttonBrowse = new System.Windows.Forms.Button();
|
||||
this.textBoxLocation = new System.Windows.Forms.TextBox();
|
||||
this.labelManualSearch = new System.Windows.Forms.Label();
|
||||
this.labelHeading = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.listBoxRecentProjects = new System.Windows.Forms.ListBox();
|
||||
this.panel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@ -104,6 +104,24 @@
|
||||
this.panel1.Size = new System.Drawing.Size(600, 359);
|
||||
this.panel1.TabIndex = 14;
|
||||
//
|
||||
// listBoxRecentProjects
|
||||
//
|
||||
this.listBoxRecentProjects.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.listBoxRecentProjects.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.listBoxRecentProjects.ForeColor = System.Drawing.Color.LightGray;
|
||||
this.listBoxRecentProjects.FormattingEnabled = true;
|
||||
this.listBoxRecentProjects.Items.AddRange(new object[] {
|
||||
"Test",
|
||||
"Blubb",
|
||||
"Put",
|
||||
"Recent",
|
||||
"Projects",
|
||||
"here"});
|
||||
this.listBoxRecentProjects.Location = new System.Drawing.Point(71, 96);
|
||||
this.listBoxRecentProjects.Name = "listBoxRecentProjects";
|
||||
this.listBoxRecentProjects.Size = new System.Drawing.Size(443, 119);
|
||||
this.listBoxRecentProjects.TabIndex = 21;
|
||||
//
|
||||
// buttonBrowse
|
||||
//
|
||||
this.buttonBrowse.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
@ -158,26 +176,9 @@
|
||||
this.label1.Text = "New Project";
|
||||
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// listBoxRecentProjects
|
||||
//
|
||||
this.listBoxRecentProjects.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.listBoxRecentProjects.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.listBoxRecentProjects.ForeColor = System.Drawing.Color.LightGray;
|
||||
this.listBoxRecentProjects.FormattingEnabled = true;
|
||||
this.listBoxRecentProjects.Items.AddRange(new object[] {
|
||||
"Test",
|
||||
"Blubb",
|
||||
"Put",
|
||||
"Recent",
|
||||
"Projects",
|
||||
"here"});
|
||||
this.listBoxRecentProjects.Location = new System.Drawing.Point(71, 96);
|
||||
this.listBoxRecentProjects.Name = "listBoxRecentProjects";
|
||||
this.listBoxRecentProjects.Size = new System.Drawing.Size(443, 119);
|
||||
this.listBoxRecentProjects.TabIndex = 21;
|
||||
//
|
||||
// OpenProjectScreen
|
||||
//
|
||||
this.AcceptButton = this.buttonNext;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
|
@ -112,9 +112,9 @@
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -184,10 +184,10 @@ namespace ANX.ContentCompiler.GUI
|
||||
var absPath = ProjectFolder + Path.DirectorySeparatorChar + folder + Path.DirectorySeparatorChar + Path.GetFileName(file);
|
||||
if (!Directory.Exists(Path.Combine(ProjectFolder, folder)))
|
||||
Directory.CreateDirectory(Path.Combine(ProjectFolder, folder));
|
||||
File.Copy(file, absPath);
|
||||
File.Copy(file, absPath, true);
|
||||
var item = new BuildItem
|
||||
{
|
||||
AssetName = String.IsNullOrEmpty(folder) ? folder.Replace(_contentProject.ContentRoot, "") + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(file) : Path.GetFileNameWithoutExtension(file),
|
||||
AssetName = !String.IsNullOrEmpty(folder) ? folder.Replace(_contentProject.ContentRoot + Path.DirectorySeparatorChar, "") + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(file) : Path.GetFileNameWithoutExtension(file),
|
||||
SourceFilename = absPath,
|
||||
OutputFilename = ProjectOutputDir + Path.DirectorySeparatorChar + folder + Path.DirectorySeparatorChar + Path.GetFileName(file),
|
||||
ImporterName = ImporterManager.GuessImporterByFileExtension(file)
|
||||
@ -203,6 +203,35 @@ namespace ANX.ContentCompiler.GUI
|
||||
}
|
||||
ChangeEnvironmentOpenProject();
|
||||
}
|
||||
|
||||
public void AddFolder(string name)
|
||||
{
|
||||
string folder = _contentProject.ContentRoot;
|
||||
var node = treeView.SelectedNode;
|
||||
if (node != null)
|
||||
folder = node.Name;
|
||||
else
|
||||
node = treeView.Nodes[0];
|
||||
|
||||
var newFolder = new TreeNode(name) { Name = folder + Path.DirectorySeparatorChar + name};
|
||||
node.Nodes.Add(newFolder);
|
||||
|
||||
}
|
||||
|
||||
public void RemoveFile(string name)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void RemoveFiles(string[] files)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void RemoveFolder(string name)
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region EnvironmentStates
|
||||
@ -228,20 +257,29 @@ namespace ANX.ContentCompiler.GUI
|
||||
var rootNode = new TreeNode(ProjectName + "(" + _contentProject.ContentRoot + ")") {Name = _contentProject.ContentRoot};
|
||||
treeView.Nodes.Add(rootNode);
|
||||
var lastNode = rootNode;
|
||||
foreach (var parts in _contentProject.BuildItems.Select(buildItem => buildItem.AssetName.Split('/')).Where(parts => parts.Length >= 2))
|
||||
foreach (var parts in _contentProject.BuildItems.Select(buildItem => buildItem.AssetName.Split(Path.DirectorySeparatorChar)).Where(parts => parts.Length >= 2))
|
||||
{
|
||||
string folder = "";
|
||||
string parent = _contentProject.ContentRoot;
|
||||
for (int i=0; i < parts.Length - 1; i++)
|
||||
{
|
||||
var node = new TreeNode(parts[i]) {Name = lastNode.Name + "/" + parts[i] + "/"};
|
||||
if (!lastNode.Nodes.Contains(node))
|
||||
{
|
||||
lastNode.Nodes.Add(node);
|
||||
lastNode = node;
|
||||
}
|
||||
if (parts[i] == null) continue;
|
||||
if (i > 0)
|
||||
folder += Path.DirectorySeparatorChar + parts[i];
|
||||
else
|
||||
{
|
||||
lastNode = lastNode.Nodes[parts[i]];
|
||||
}
|
||||
folder = parts[0];
|
||||
|
||||
|
||||
if (parts.Length > 2 && i < parts.Length -2)
|
||||
parent += Path.DirectorySeparatorChar + parts[i];
|
||||
//else if (parts.Length == 2)
|
||||
// parent += Path.DirectorySeparatorChar + parts[0];
|
||||
}
|
||||
lastNode = treeView.RecursiveSearch(parent);
|
||||
var node = new TreeNode(parts[parts.Length - 2]) { Name = _contentProject.ContentRoot + Path.DirectorySeparatorChar + folder };
|
||||
if (!ContainsTreeNode(lastNode, node))
|
||||
{
|
||||
lastNode.Nodes.Add(node);
|
||||
}
|
||||
lastNode = rootNode;
|
||||
}
|
||||
@ -261,15 +299,15 @@ namespace ANX.ContentCompiler.GUI
|
||||
lastNode = lastNode.Nodes[parts[i]];
|
||||
}
|
||||
}*/
|
||||
string path = "";
|
||||
string path = _contentProject.ContentRoot;
|
||||
if (parts != null)
|
||||
{
|
||||
for (int i = 0; i < parts.Length - 1; i++)
|
||||
{
|
||||
path = parts[i];
|
||||
path += String.IsNullOrEmpty(path) ? parts[i] : Path.DirectorySeparatorChar + parts[i];
|
||||
}
|
||||
}
|
||||
if (!String.IsNullOrEmpty(path))
|
||||
if (parts != null)
|
||||
{
|
||||
var node = treeView.RecursiveSearch(path);
|
||||
if (node == null) throw new ArgumentNullException("Node not found!");
|
||||
@ -412,6 +450,12 @@ namespace ANX.ContentCompiler.GUI
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool ContainsTreeNode(TreeNode haystack, TreeNode needle)
|
||||
{
|
||||
return haystack.Nodes.Cast<TreeNode>().Any(node => node.Name.Equals(needle.Name));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PropertyGridEvents
|
||||
|
BIN
Tools/ANXContentCompilerGUI/Resources/appbar.new.png
Normal file
BIN
Tools/ANXContentCompilerGUI/Resources/appbar.new.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 953 B |
BIN
Tools/ANXContentCompilerGUI/Resources/appbar.new.window.png
Normal file
BIN
Tools/ANXContentCompilerGUI/Resources/appbar.new.window.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 402 B |
@ -71,6 +71,7 @@
|
||||
this.arrowButtonCreateFolder.Name = "arrowButtonCreateFolder";
|
||||
this.arrowButtonCreateFolder.Size = new System.Drawing.Size(348, 64);
|
||||
this.arrowButtonCreateFolder.TabIndex = 6;
|
||||
this.arrowButtonCreateFolder.Click += new System.EventHandler(this.ArrowButtonCreateFolderClick);
|
||||
//
|
||||
// arrowButtonPreview
|
||||
//
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using ANX.ContentCompiler.GUI.Dialogues;
|
||||
|
||||
namespace ANX.ContentCompiler.GUI.States
|
||||
{
|
||||
@ -27,5 +28,16 @@ namespace ANX.ContentCompiler.GUI.States
|
||||
}
|
||||
}
|
||||
|
||||
private void ArrowButtonCreateFolderClick(object sender, EventArgs e)
|
||||
{
|
||||
using (var dlg = new NewFolderScreen())
|
||||
{
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
MainWindow.Instance.AddFolder(dlg.textBoxName.Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -384,12 +384,12 @@
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.Controls.Add(this.panelSettings);
|
||||
this.Controls.Add(this.labelVersion);
|
||||
this.Controls.Add(this.panelOpen);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.panelSaveAs);
|
||||
this.Controls.Add(this.panelNew);
|
||||
this.Controls.Add(this.panelSettings);
|
||||
this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.ForeColor = System.Drawing.Color.White;
|
||||
this.Name = "MenuState";
|
||||
|
@ -6,6 +6,7 @@ using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using ANX.ContentCompiler.GUI.Dialogues;
|
||||
|
||||
namespace ANX.ContentCompiler.GUI.States
|
||||
{
|
||||
@ -112,29 +113,45 @@ namespace ANX.ContentCompiler.GUI.States
|
||||
#region MenuNew
|
||||
private void ArrowButtonFileClick(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
using (var dlg = new OpenFileDialog())
|
||||
{
|
||||
dlg.Multiselect = true;
|
||||
dlg.Title = "Add files";
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
MainWindow.Instance.AddFiles(dlg.FileNames);
|
||||
}
|
||||
MainWindow.Instance.ToggleMenuMode();
|
||||
}
|
||||
|
||||
private void ArrowButtonFolderClick(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
using (var dlg = new NewFolderScreen())
|
||||
{
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
MainWindow.Instance.AddFolder(dlg.textBoxName.Text);
|
||||
}
|
||||
}
|
||||
MainWindow.Instance.ToggleMenuMode();
|
||||
}
|
||||
|
||||
private void ArrowButtonNewProjectClick(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
MainWindow.Instance.NewProject(sender, e);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region MenuOpen
|
||||
private void ArrowButtonOpenClick(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
MainWindow.Instance.OpenProjectDialog(sender, e);
|
||||
MainWindow.Instance.ToggleMenuMode();
|
||||
}
|
||||
|
||||
private void ArrowButtonImportClick(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
MainWindow.Instance.OpenProjectDialog(sender, e);
|
||||
MainWindow.Instance.ToggleMenuMode();
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -142,11 +159,13 @@ namespace ANX.ContentCompiler.GUI.States
|
||||
private void ArrowButtonSaveAsCprojClick(object sender, EventArgs e)
|
||||
{
|
||||
MainWindow.Instance.SaveProjectAs(sender, e);
|
||||
MainWindow.Instance.ToggleMenuMode();
|
||||
}
|
||||
|
||||
private void ArrowButtonSaveAsCcProjClick(object sender, EventArgs e)
|
||||
{
|
||||
MainWindow.Instance.SaveProjectAs(sender, e);
|
||||
MainWindow.Instance.ToggleMenuMode();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@ -112,10 +112,10 @@
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="labelOpenDesc.Text" xml:space="preserve">
|
||||
<value>If you want to use your existing XNA Contentproject you need to choose the Import option. Also the Import option is required when trying to open files created by the EES Content Compiler 3.
|
||||
|
@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ANX.ContentCompiler.GUI
|
||||
|
Loading…
x
Reference in New Issue
Block a user