diff --git a/ANX.Framework.Content.Pipeline/Tasks/ContentProject.cs b/ANX.Framework.Content.Pipeline/Tasks/ContentProject.cs index 816e05df..65f71a14 100644 --- a/ANX.Framework.Content.Pipeline/Tasks/ContentProject.cs +++ b/ANX.Framework.Content.Pipeline/Tasks/ContentProject.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.IO; using System.Text; using System.Xml; +using ANX.Framework.Graphics; using ANX.Framework.NonXNA.Development; #endregion @@ -34,7 +35,7 @@ namespace ANX.Framework.Content.Pipeline.Tasks /// Minor version of the project format. /// Used to keep backwards compatibility /// - public int VersionMinor { get { return 1; } } //before you commit your changes, please increase this value by one (and if you added stuff, please check the version before you read anything out of a file). + public int VersionMinor { get { return 2; } } //before you commit your changes, please increase this value by one (and if you added stuff, please check the version before you read anything out of a file). /// /// The directory where the compiled output will be placed @@ -72,6 +73,11 @@ namespace ANX.Framework.Content.Pipeline.Tasks /// public String Creator { get; set; } + /// + /// Target Graphics Profile + /// + public GraphicsProfile Profile { get; set; } + /// /// The configuration. Can be "Debug" or "Release". /// @@ -126,6 +132,11 @@ namespace ANX.Framework.Content.Pipeline.Tasks writer.WriteValue(Configuration); writer.WriteEndElement(); + //Reach + writer.WriteStartElement("Profile"); + writer.WriteValue(Profile.ToString()); + writer.WriteEndElement(); + //Windows writer.WriteStartElement("Platform"); writer.WriteValue(Platform.ToString()); @@ -245,6 +256,25 @@ namespace ANX.Framework.Content.Pipeline.Tasks if (versionMajor == 1 && versionMinor >= 0) project.Configuration = reader.ReadElementContentAsString(); break; + case "Profile": + if (reader.NodeType == XmlNodeType.Element) + { + if (versionMinor < 2) + project.Profile = GraphicsProfile.Reach; + else + { + switch (reader.ReadElementContentAsString()) + { + case "Reach": + project.Profile = GraphicsProfile.Reach; + break; + case "HiDef": + project.Profile = GraphicsProfile.HiDef; + break; + } + } + } + break; case "Platform": if (reader.NodeType == XmlNodeType.Element) { diff --git a/Tools/ANXContentCompilerGUI/ANX.ContentCompiler.GUI.csproj b/Tools/ANXContentCompilerGUI/ANX.ContentCompiler.GUI.csproj index 8911befb..7545a602 100644 --- a/Tools/ANXContentCompilerGUI/ANX.ContentCompiler.GUI.csproj +++ b/Tools/ANXContentCompilerGUI/ANX.ContentCompiler.GUI.csproj @@ -49,6 +49,7 @@ + UserControl @@ -61,6 +62,18 @@ RibbonButton.cs + + UserControl + + + RibbonTextBox.cs + + + Form + + + ErrorLogScreen.cs + Form @@ -103,6 +116,7 @@ FirstStartScreen.cs + UserControl @@ -131,6 +145,12 @@ + + RibbonTextBox.cs + + + ErrorLogScreen.cs + MainWindow.cs @@ -177,6 +197,10 @@ {2DAFDFC1-223B-4741-87BB-BE3D0A7617DB} ANX.Framework.Content.Pipeline + + {6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35} + ANX.Framework + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Tools/ANXContentCompilerGUI/Dialogues/ErrorLogScreen.Designer.cs b/Tools/ANXContentCompilerGUI/Dialogues/ErrorLogScreen.Designer.cs new file mode 100644 index 00000000..7b18cf2f --- /dev/null +++ b/Tools/ANXContentCompilerGUI/Dialogues/ErrorLogScreen.Designer.cs @@ -0,0 +1,165 @@ +namespace ANX.ContentCompiler.GUI.Dialogues +{ + partial class ErrorLogScreen + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.buttonNext = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.panel1 = new System.Windows.Forms.Panel(); + this.textBox = new System.Windows.Forms.TextBox(); + this.labelHeading = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.panel1.SuspendLayout(); + this.SuspendLayout(); + // + // buttonNext + // + this.buttonNext.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonNext.FlatAppearance.BorderColor = System.Drawing.Color.Gray; + this.buttonNext.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Green; + this.buttonNext.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Gray; + this.buttonNext.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.buttonNext.Location = new System.Drawing.Point(504, 317); + this.buttonNext.Name = "buttonNext"; + this.buttonNext.Size = new System.Drawing.Size(84, 30); + this.buttonNext.TabIndex = 6; + this.buttonNext.Text = "OK"; + this.buttonNext.UseVisualStyleBackColor = true; + this.buttonNext.Click += new System.EventHandler(this.ButtonNextClick); + // + // button3 + // + this.button3.DialogResult = System.Windows.Forms.DialogResult.Abort; + this.button3.FlatAppearance.BorderSize = 0; + this.button3.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Green; + this.button3.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Gray; + this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button3.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.button3.Location = new System.Drawing.Point(572, -1); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(26, 23); + this.button3.TabIndex = 7; + this.button3.Text = "X"; + this.button3.UseVisualStyleBackColor = true; + // + // panel1 + // + this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panel1.Controls.Add(this.textBox); + this.panel1.Controls.Add(this.labelHeading); + this.panel1.Controls.Add(this.label1); + this.panel1.Controls.Add(this.buttonNext); + this.panel1.Controls.Add(this.button3); + this.panel1.Controls.Add(this.buttonCancel); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(0, 0); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(600, 359); + this.panel1.TabIndex = 14; + // + // textBox + // + this.textBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.textBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox.ForeColor = System.Drawing.Color.White; + this.textBox.Location = new System.Drawing.Point(41, 77); + this.textBox.Multiline = true; + this.textBox.Name = "textBox"; + this.textBox.ReadOnly = true; + this.textBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.textBox.Size = new System.Drawing.Size(497, 221); + this.textBox.TabIndex = 16; + // + // labelHeading + // + this.labelHeading.Font = new System.Drawing.Font("Segoe UI Semibold", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelHeading.Location = new System.Drawing.Point(85, 36); + this.labelHeading.Name = "labelHeading"; + this.labelHeading.Size = new System.Drawing.Size(429, 38); + this.labelHeading.TabIndex = 15; + this.labelHeading.Text = "Here\'s the log of the build process:"; + this.labelHeading.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // label1 + // + this.label1.Location = new System.Drawing.Point(-4, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(570, 22); + this.label1.TabIndex = 14; + this.label1.Text = "Build Log"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // buttonCancel + // + this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.buttonCancel.FlatAppearance.BorderColor = System.Drawing.Color.Gray; + this.buttonCancel.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Green; + this.buttonCancel.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Gray; + this.buttonCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.buttonCancel.Location = new System.Drawing.Point(12, 317); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(75, 30); + this.buttonCancel.TabIndex = 5; + this.buttonCancel.Text = "Copy"; + this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler(this.ButtonCancelClick); + // + // ErrorLogScreen + // + 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))))); + this.ClientSize = new System.Drawing.Size(600, 359); + this.Controls.Add(this.panel1); + 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.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Name = "ErrorLogScreen"; + this.ShowInTaskbar = false; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "FirstStartScreen"; + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button buttonNext; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label labelHeading; + private System.Windows.Forms.Button buttonCancel; + private System.Windows.Forms.TextBox textBox; + } +} \ No newline at end of file diff --git a/Tools/ANXContentCompilerGUI/Dialogues/ErrorLogScreen.cs b/Tools/ANXContentCompilerGUI/Dialogues/ErrorLogScreen.cs new file mode 100644 index 00000000..dde1b9a4 --- /dev/null +++ b/Tools/ANXContentCompilerGUI/Dialogues/ErrorLogScreen.cs @@ -0,0 +1,42 @@ +using System; +using System.IO; +using System.Windows.Forms; + +namespace ANX.ContentCompiler.GUI.Dialogues +{ + public partial class ErrorLogScreen : Form + { + public ErrorLogScreen(string[] errorLog) + { + InitializeComponent(); + SetUpColors(); + textBox.Lines = errorLog; + } + + private void SetUpColors() + { + BackColor = Settings.MainColor; + ForeColor = Settings.ForeColor; + button3.FlatAppearance.MouseOverBackColor = Settings.LightMainColor; + buttonCancel.FlatAppearance.MouseOverBackColor = Settings.LightMainColor; + buttonNext.FlatAppearance.MouseOverBackColor = Settings.LightMainColor; + button3.FlatAppearance.MouseDownBackColor = Settings.AccentColor3; + buttonCancel.FlatAppearance.MouseDownBackColor = Settings.AccentColor3; + buttonNext.FlatAppearance.MouseDownBackColor = Settings.AccentColor3; + buttonNext.FlatAppearance.BorderColor = Settings.LightMainColor; + button3.FlatAppearance.BorderColor = Settings.LightMainColor; + buttonCancel.FlatAppearance.BorderColor = Settings.LightMainColor; + } + + private void ButtonNextClick(object sender, EventArgs e) + { + DialogResult = DialogResult.OK; + } + + private void ButtonCancelClick(object sender, EventArgs e) + { + Clipboard.SetText(textBox.Text); + buttonCancel.Text = "Copied."; + } + } +} \ No newline at end of file diff --git a/Tools/ANXContentCompilerGUI/Dialogues/ErrorLogScreen.resx b/Tools/ANXContentCompilerGUI/Dialogues/ErrorLogScreen.resx new file mode 100644 index 00000000..29dcb1b3 --- /dev/null +++ b/Tools/ANXContentCompilerGUI/Dialogues/ErrorLogScreen.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Tools/ANXContentCompilerGUI/Dialogues/FirstStartScreen.Designer.cs b/Tools/ANXContentCompilerGUI/Dialogues/FirstStartScreen.Designer.cs index 9650582a..791b79b3 100644 --- a/Tools/ANXContentCompilerGUI/Dialogues/FirstStartScreen.Designer.cs +++ b/Tools/ANXContentCompilerGUI/Dialogues/FirstStartScreen.Designer.cs @@ -1,4 +1,6 @@ -namespace ANX.ContentCompiler.GUI.Dialogues +using ANX.ContentCompiler.GUI.Properties; + +namespace ANX.ContentCompiler.GUI.Dialogues { partial class FirstStartScreen { @@ -124,7 +126,7 @@ // // pictureBoxArrowLeft // - this.pictureBoxArrowLeft.Image = ((System.Drawing.Image)(resources.GetObject("pictureBoxArrowLeft.Image"))); + this.pictureBoxArrowLeft.Image = ((System.Drawing.Image)(Resources.arrow_left)); this.pictureBoxArrowLeft.Location = new System.Drawing.Point(176, 274); this.pictureBoxArrowLeft.Name = "pictureBoxArrowLeft"; this.pictureBoxArrowLeft.Size = new System.Drawing.Size(118, 114); @@ -134,7 +136,7 @@ // // pictureBoxArrowRight // - this.pictureBoxArrowRight.Image = ((System.Drawing.Image)(resources.GetObject("pictureBoxArrowRight.Image"))); + this.pictureBoxArrowRight.Image = ((System.Drawing.Image)(Resources.arrow_right)); this.pictureBoxArrowRight.Location = new System.Drawing.Point(317, 274); this.pictureBoxArrowRight.Name = "pictureBoxArrowRight"; this.pictureBoxArrowRight.Size = new System.Drawing.Size(119, 114); diff --git a/Tools/ANXContentCompilerGUI/Dialogues/NewProjectSummaryScreen.Designer.cs b/Tools/ANXContentCompilerGUI/Dialogues/NewProjectSummaryScreen.Designer.cs index bfa0f06a..8c3cffb2 100644 --- a/Tools/ANXContentCompilerGUI/Dialogues/NewProjectSummaryScreen.Designer.cs +++ b/Tools/ANXContentCompilerGUI/Dialogues/NewProjectSummaryScreen.Designer.cs @@ -80,7 +80,7 @@ this.textBox.ReadOnly = true; this.textBox.Size = new System.Drawing.Size(424, 198); this.textBox.TabIndex = 17; - this.textBox.Text = resources.GetString("textBox.Text"); + this.textBox.Text = ""; // // label2 // diff --git a/Tools/ANXContentCompilerGUI/Dialogues/OpenProjectScreen.Designer.cs b/Tools/ANXContentCompilerGUI/Dialogues/OpenProjectScreen.Designer.cs index 76d2f0b2..9824451f 100644 --- a/Tools/ANXContentCompilerGUI/Dialogues/OpenProjectScreen.Designer.cs +++ b/Tools/ANXContentCompilerGUI/Dialogues/OpenProjectScreen.Designer.cs @@ -209,6 +209,6 @@ private System.Windows.Forms.Button buttonBrowse; private System.Windows.Forms.Label labelManualSearch; public System.Windows.Forms.TextBox textBoxLocation; - private System.Windows.Forms.ListBox listBoxRecentProjects; + public System.Windows.Forms.ListBox listBoxRecentProjects; } } \ No newline at end of file diff --git a/Tools/ANXContentCompilerGUI/Dialogues/OpenProjectScreen.cs b/Tools/ANXContentCompilerGUI/Dialogues/OpenProjectScreen.cs index 1bced624..8c8277fa 100644 --- a/Tools/ANXContentCompilerGUI/Dialogues/OpenProjectScreen.cs +++ b/Tools/ANXContentCompilerGUI/Dialogues/OpenProjectScreen.cs @@ -10,6 +10,11 @@ namespace ANX.ContentCompiler.GUI.Dialogues { InitializeComponent(); SetUpColors(); + listBoxRecentProjects.Items.Clear(); + foreach(var project in MainWindow.Instance.RecentProjects) + { + listBoxRecentProjects.Items.Add(project); + } } private void SetUpColors() diff --git a/Tools/ANXContentCompilerGUI/MainWindow.Designer.cs b/Tools/ANXContentCompilerGUI/MainWindow.Designer.cs index b14fdd4a..803d9f9f 100644 --- a/Tools/ANXContentCompilerGUI/MainWindow.Designer.cs +++ b/Tools/ANXContentCompilerGUI/MainWindow.Designer.cs @@ -32,6 +32,13 @@ namespace ANX.ContentCompiler.GUI { this.components = new System.ComponentModel.Container(); this.splitContainerMenuLayout = new System.Windows.Forms.SplitContainer(); + this.ribbonTextBox = new ANX.ContentCompiler.GUI.Controls.RibbonTextBox(); + this.ribbonButtonHelp = new ANX.ContentCompiler.GUI.Controls.RibbonButton(); + this.ribbonButtonWeb = new ANX.ContentCompiler.GUI.Controls.RibbonButton(); + this.ribbonButtonClean = new ANX.ContentCompiler.GUI.Controls.RibbonButton(); + this.ribbonButtonSave = new ANX.ContentCompiler.GUI.Controls.RibbonButton(); + this.ribbonButtonLoad = new ANX.ContentCompiler.GUI.Controls.RibbonButton(); + this.ribbonButtonNew = new ANX.ContentCompiler.GUI.Controls.RibbonButton(); this.buttonQuit = new System.Windows.Forms.Button(); this.buttonMenu = new System.Windows.Forms.Button(); this.labelTitle = new System.Windows.Forms.Label(); @@ -43,17 +50,11 @@ namespace ANX.ContentCompiler.GUI this.treeViewItemRename = new System.Windows.Forms.ToolStripMenuItem(); this.treeViewItemDelete = new System.Windows.Forms.ToolStripMenuItem(); this.splitContainerProperties = new System.Windows.Forms.SplitContainer(); + this.editingState = new ANX.ContentCompiler.GUI.States.EditingState(); + this.startState = new ANX.ContentCompiler.GUI.States.StartState(); this.labelProperties = new System.Windows.Forms.Label(); this.propertyGrid = new System.Windows.Forms.PropertyGrid(); this.menuState = new ANX.ContentCompiler.GUI.States.MenuState(); - this.ribbonButtonHelp = new ANX.ContentCompiler.GUI.Controls.RibbonButton(); - this.ribbonButtonWeb = new ANX.ContentCompiler.GUI.Controls.RibbonButton(); - this.ribbonButtonClean = new ANX.ContentCompiler.GUI.Controls.RibbonButton(); - this.ribbonButtonSave = new ANX.ContentCompiler.GUI.Controls.RibbonButton(); - this.ribbonButtonLoad = new ANX.ContentCompiler.GUI.Controls.RibbonButton(); - this.ribbonButtonNew = new ANX.ContentCompiler.GUI.Controls.RibbonButton(); - this.editingState = new ANX.ContentCompiler.GUI.States.EditingState(); - this.startState = new ANX.ContentCompiler.GUI.States.StartState(); ((System.ComponentModel.ISupportInitialize)(this.splitContainerMenuLayout)).BeginInit(); this.splitContainerMenuLayout.Panel1.SuspendLayout(); this.splitContainerMenuLayout.Panel2.SuspendLayout(); @@ -81,6 +82,7 @@ namespace ANX.ContentCompiler.GUI // // splitContainerMenuLayout.Panel1 // + this.splitContainerMenuLayout.Panel1.Controls.Add(this.ribbonTextBox); this.splitContainerMenuLayout.Panel1.Controls.Add(this.ribbonButtonHelp); this.splitContainerMenuLayout.Panel1.Controls.Add(this.ribbonButtonWeb); this.splitContainerMenuLayout.Panel1.Controls.Add(this.ribbonButtonClean); @@ -98,6 +100,79 @@ namespace ANX.ContentCompiler.GUI this.splitContainerMenuLayout.SplitterDistance = 99; this.splitContainerMenuLayout.TabIndex = 0; // + // ribbonTextBox + // + this.ribbonTextBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.ribbonTextBox.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.ribbonTextBox.Location = new System.Drawing.Point(532, 26); + this.ribbonTextBox.Name = "ribbonTextBox"; + this.ribbonTextBox.Size = new System.Drawing.Size(320, 70); + this.ribbonTextBox.TabIndex = 9; + // + // ribbonButtonHelp + // + this.ribbonButtonHelp.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.ribbonButtonHelp.Content = "Help"; + this.ribbonButtonHelp.Image = global::ANX.ContentCompiler.GUI.Properties.Resources.appbar_question; + this.ribbonButtonHelp.Location = new System.Drawing.Point(299, 26); + this.ribbonButtonHelp.Name = "ribbonButtonHelp"; + this.ribbonButtonHelp.Size = new System.Drawing.Size(52, 68); + this.ribbonButtonHelp.TabIndex = 8; + // + // ribbonButtonWeb + // + this.ribbonButtonWeb.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.ribbonButtonWeb.Content = "Website"; + this.ribbonButtonWeb.Image = global::ANX.ContentCompiler.GUI.Properties.Resources.appbar_globe; + this.ribbonButtonWeb.Location = new System.Drawing.Point(237, 26); + this.ribbonButtonWeb.Name = "ribbonButtonWeb"; + this.ribbonButtonWeb.Size = new System.Drawing.Size(63, 68); + this.ribbonButtonWeb.TabIndex = 7; + // + // ribbonButtonClean + // + this.ribbonButtonClean.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; + this.ribbonButtonClean.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.ribbonButtonClean.Content = "Clean"; + this.ribbonButtonClean.Image = global::ANX.ContentCompiler.GUI.Properties.Resources.appbar_clean; + this.ribbonButtonClean.Location = new System.Drawing.Point(186, 26); + this.ribbonButtonClean.Name = "ribbonButtonClean"; + this.ribbonButtonClean.Size = new System.Drawing.Size(52, 68); + this.ribbonButtonClean.TabIndex = 6; + // + // ribbonButtonSave + // + this.ribbonButtonSave.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.ribbonButtonSave.Content = "Save"; + this.ribbonButtonSave.Image = global::ANX.ContentCompiler.GUI.Properties.Resources.appbar_save; + this.ribbonButtonSave.Location = new System.Drawing.Point(105, 26); + this.ribbonButtonSave.Name = "ribbonButtonSave"; + this.ribbonButtonSave.Size = new System.Drawing.Size(52, 68); + this.ribbonButtonSave.TabIndex = 5; + this.ribbonButtonSave.Click += new System.EventHandler(this.SaveProject); + // + // ribbonButtonLoad + // + this.ribbonButtonLoad.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.ribbonButtonLoad.Content = "Open"; + this.ribbonButtonLoad.Image = global::ANX.ContentCompiler.GUI.Properties.Resources.appbar_folder_open; + this.ribbonButtonLoad.Location = new System.Drawing.Point(54, 26); + this.ribbonButtonLoad.Name = "ribbonButtonLoad"; + this.ribbonButtonLoad.Size = new System.Drawing.Size(52, 68); + this.ribbonButtonLoad.TabIndex = 4; + this.ribbonButtonLoad.Click += new System.EventHandler(this.OpenProjectDialog); + // + // ribbonButtonNew + // + this.ribbonButtonNew.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.ribbonButtonNew.Content = "New"; + this.ribbonButtonNew.Image = global::ANX.ContentCompiler.GUI.Properties.Resources.appbar_page_multiple; + this.ribbonButtonNew.Location = new System.Drawing.Point(3, 26); + this.ribbonButtonNew.Name = "ribbonButtonNew"; + this.ribbonButtonNew.Size = new System.Drawing.Size(52, 68); + this.ribbonButtonNew.TabIndex = 3; + this.ribbonButtonNew.Click += new System.EventHandler(this.NewProject); + // // buttonQuit // this.buttonQuit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); @@ -259,6 +334,26 @@ namespace ANX.ContentCompiler.GUI this.splitContainerProperties.SplitterDistance = 366; this.splitContainerProperties.TabIndex = 0; // + // editingState + // + this.editingState.Dock = System.Windows.Forms.DockStyle.Fill; + this.editingState.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.editingState.Location = new System.Drawing.Point(0, 0); + this.editingState.Name = "editingState"; + this.editingState.Size = new System.Drawing.Size(364, 547); + this.editingState.TabIndex = 1; + this.editingState.Visible = false; + // + // startState + // + this.startState.Dock = System.Windows.Forms.DockStyle.Fill; + this.startState.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.startState.Location = new System.Drawing.Point(0, 0); + this.startState.Name = "startState"; + this.startState.Size = new System.Drawing.Size(364, 547); + this.startState.TabIndex = 0; + this.startState.Visible = false; + // // labelProperties // this.labelProperties.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) @@ -307,90 +402,6 @@ namespace ANX.ContentCompiler.GUI this.menuState.TabIndex = 1; this.menuState.Visible = false; // - // ribbonButtonHelp - // - this.ribbonButtonHelp.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.ribbonButtonHelp.Content = "Help"; - this.ribbonButtonHelp.Image = global::ANX.ContentCompiler.GUI.Properties.Resources.appbar_question; - this.ribbonButtonHelp.Location = new System.Drawing.Point(299, 26); - this.ribbonButtonHelp.Name = "ribbonButtonHelp"; - this.ribbonButtonHelp.Size = new System.Drawing.Size(52, 68); - this.ribbonButtonHelp.TabIndex = 8; - // - // ribbonButtonWeb - // - this.ribbonButtonWeb.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.ribbonButtonWeb.Content = "Website"; - this.ribbonButtonWeb.Image = global::ANX.ContentCompiler.GUI.Properties.Resources.appbar_globe; - this.ribbonButtonWeb.Location = new System.Drawing.Point(237, 26); - this.ribbonButtonWeb.Name = "ribbonButtonWeb"; - this.ribbonButtonWeb.Size = new System.Drawing.Size(63, 68); - this.ribbonButtonWeb.TabIndex = 7; - // - // ribbonButtonClean - // - this.ribbonButtonClean.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.ribbonButtonClean.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.ribbonButtonClean.Content = "Clean"; - this.ribbonButtonClean.Image = global::ANX.ContentCompiler.GUI.Properties.Resources.appbar_clean; - this.ribbonButtonClean.Location = new System.Drawing.Point(186, 26); - this.ribbonButtonClean.Name = "ribbonButtonClean"; - this.ribbonButtonClean.Size = new System.Drawing.Size(52, 68); - this.ribbonButtonClean.TabIndex = 6; - // - // ribbonButtonSave - // - this.ribbonButtonSave.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.ribbonButtonSave.Content = "Save"; - this.ribbonButtonSave.Image = global::ANX.ContentCompiler.GUI.Properties.Resources.appbar_save; - this.ribbonButtonSave.Location = new System.Drawing.Point(105, 26); - this.ribbonButtonSave.Name = "ribbonButtonSave"; - this.ribbonButtonSave.Size = new System.Drawing.Size(52, 68); - this.ribbonButtonSave.TabIndex = 5; - this.ribbonButtonSave.Click += new System.EventHandler(this.SaveProject); - // - // ribbonButtonLoad - // - this.ribbonButtonLoad.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.ribbonButtonLoad.Content = "Open"; - this.ribbonButtonLoad.Image = global::ANX.ContentCompiler.GUI.Properties.Resources.appbar_folder_open; - this.ribbonButtonLoad.Location = new System.Drawing.Point(54, 26); - this.ribbonButtonLoad.Name = "ribbonButtonLoad"; - this.ribbonButtonLoad.Size = new System.Drawing.Size(52, 68); - this.ribbonButtonLoad.TabIndex = 4; - this.ribbonButtonLoad.Click += new System.EventHandler(this.OpenProjectDialog); - // - // ribbonButtonNew - // - this.ribbonButtonNew.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.ribbonButtonNew.Content = "New"; - this.ribbonButtonNew.Image = global::ANX.ContentCompiler.GUI.Properties.Resources.appbar_page_multiple; - this.ribbonButtonNew.Location = new System.Drawing.Point(3, 26); - this.ribbonButtonNew.Name = "ribbonButtonNew"; - this.ribbonButtonNew.Size = new System.Drawing.Size(52, 68); - this.ribbonButtonNew.TabIndex = 3; - this.ribbonButtonNew.Click += new System.EventHandler(this.NewProject); - // - // editingState - // - this.editingState.Dock = System.Windows.Forms.DockStyle.Fill; - this.editingState.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.editingState.Location = new System.Drawing.Point(0, 0); - this.editingState.Name = "editingState"; - this.editingState.Size = new System.Drawing.Size(364, 547); - this.editingState.TabIndex = 1; - this.editingState.Visible = false; - // - // startState - // - this.startState.Dock = System.Windows.Forms.DockStyle.Fill; - this.startState.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.startState.Location = new System.Drawing.Point(0, 0); - this.startState.Name = "startState"; - this.startState.Size = new System.Drawing.Size(364, 547); - this.startState.TabIndex = 0; - this.startState.Visible = false; - // // MainWindow // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -450,6 +461,7 @@ namespace ANX.ContentCompiler.GUI private EditingState editingState; private MenuState menuState; private System.Windows.Forms.Button buttonMenu; + public Controls.RibbonTextBox ribbonTextBox; } } diff --git a/Tools/ANXContentCompilerGUI/MainWindow.cs b/Tools/ANXContentCompilerGUI/MainWindow.cs index b94e3fb7..56f2d7a8 100644 --- a/Tools/ANXContentCompilerGUI/MainWindow.cs +++ b/Tools/ANXContentCompilerGUI/MainWindow.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Drawing; using System.IO; using System.Linq; +using System.Threading; using System.Windows.Forms; using ANX.ContentCompiler.GUI.Dialogues; using ANX.Framework.Content.Pipeline; @@ -32,6 +33,7 @@ namespace ANX.ContentCompiler.GUI public String ProjectFolder { get; set; } public String ProjectOutputDir { get; set; } public String ProjectImportersDir { get; set; } + public RecentProjects RecentProjects { get; set; } #endregion #region Init @@ -44,9 +46,14 @@ namespace ANX.ContentCompiler.GUI { Settings.Defaults(); Settings.Save(SettingsFile); + RecentProjects = new RecentProjects(); + RecentProjects.Save(); } else + { Settings.Load(SettingsFile); + RecentProjects = RecentProjects.Load(); + } treeViewItemAddFolder.MouseEnter += TreeViewItemMouseEnter; treeViewItemAddFolder.MouseLeave += TreeViewItemeLeave; treeViewItemDelete.MouseEnter += TreeViewItemMouseEnter; @@ -120,16 +127,21 @@ namespace ANX.ContentCompiler.GUI { using (var dlg = new OpenProjectScreen()) { - if (dlg.ShowDialog() == DialogResult.OK) - { + if (dlg.ShowDialog() != DialogResult.OK) return; + + if (dlg.listBoxRecentProjects.SelectedItem == null) OpenProject(dlg.textBoxLocation.Text); - } + else + OpenProject((string)dlg.listBoxRecentProjects.SelectedItem); } } public void OpenProject(string path) { if (!File.Exists(path)) - throw new FileNotFoundException("No file found at the given location:", path); + { + MessageBox.Show("No file found at this location: " + path, "Project not found"); + return; + } _contentProject = ContentProject.Load(path); ProjectName = _contentProject.Name; ProjectOutputDir = _contentProject.OutputDirectory; @@ -150,6 +162,9 @@ namespace ANX.ContentCompiler.GUI SaveProjectAs(sender, e); _contentProject.Save(ProjectPath); + if (RecentProjects.Contains(ProjectPath)) + RecentProjects.Remove(ProjectPath); + RecentProjects.Add(ProjectPath); } #endregion @@ -170,6 +185,55 @@ namespace ANX.ContentCompiler.GUI } #endregion + #region BuildProject + public void BuildProject(object sender, EventArgs e) + { + DisableUI(); + BuildContent builderTask = new BuildContent(); + builderTask.BuildLogger = new CCompilerBuildLogger(); + builderTask.OutputDirectory = _contentProject.OutputDirectory; + builderTask.TargetPlatform = _contentProject.Platform; + builderTask.TargetProfile = _contentProject.Profile; + builderTask.CompressContent = false; + try + { + builderTask.Execute(_contentProject.BuildItems); + } + catch(Exception ex) + { + ribbonTextBox.AddMessage("[ERROR] " + ex.ToString() + "\n Stack: " + ex.StackTrace); + EnableUI(); + } + EnableUI(); + } + + private void DisableUI() + { + buttonMenu.Enabled = false; + buttonQuit.Enabled = false; + editingState.Enabled = false; + treeView.Enabled = false; + propertyGrid.Enabled = false; + ribbonButtonNew.Enabled = false; + ribbonButtonSave.Enabled = false; + ribbonButtonLoad.Enabled = false; + ribbonButtonClean.Enabled = false; + } + + private void EnableUI() + { + buttonMenu.Enabled = true; + buttonQuit.Enabled = true; + editingState.Enabled = true; + treeView.Enabled = true; + propertyGrid.Enabled = true; + ribbonButtonNew.Enabled = true; + ribbonButtonSave.Enabled = true; + ribbonButtonLoad.Enabled = true; + ribbonButtonClean.Enabled = true; + } + #endregion + #region FileMethods private void AddFile(string file) { @@ -180,15 +244,13 @@ namespace ANX.ContentCompiler.GUI var node = treeView.SelectedNode; if (node != null) folder = node.Name; - else - node = treeView.Nodes[0]; 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, true); var item = new BuildItem { - AssetName = !String.IsNullOrEmpty(folder) ? folder.Replace(_contentProject.ContentRoot + Path.DirectorySeparatorChar, "") + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(file) : Path.GetFileNameWithoutExtension(file), + AssetName = folder.Equals(_contentProject.ContentRoot) ? Path.GetFileNameWithoutExtension(file) : folder.Replace(_contentProject.ContentRoot + Path.DirectorySeparatorChar, "") + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(file), SourceFilename = absPath, OutputFilename = ProjectOutputDir + Path.DirectorySeparatorChar + folder + Path.DirectorySeparatorChar + Path.GetFileName(file), ImporterName = ImporterManager.GuessImporterByFileExtension(file) @@ -430,6 +492,7 @@ namespace ANX.ContentCompiler.GUI private void MainWindowFormClosed(object sender, FormClosedEventArgs e) { Settings.Save(SettingsFile); + RecentProjects.Save(); } private void MainWindowFormClosing(object sender, FormClosingEventArgs e) diff --git a/Tools/ANXContentCompilerGUI/Properties/Resources.resources b/Tools/ANXContentCompilerGUI/Properties/Resources.resources new file mode 100644 index 00000000..f43c833d Binary files /dev/null and b/Tools/ANXContentCompilerGUI/Properties/Resources.resources differ diff --git a/Tools/ANXContentCompilerGUI/RecentProjects.cs b/Tools/ANXContentCompilerGUI/RecentProjects.cs new file mode 100644 index 00000000..1e8fedbf --- /dev/null +++ b/Tools/ANXContentCompilerGUI/RecentProjects.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml; + +namespace ANX.ContentCompiler.GUI +{ + public class RecentProjects : List + { + private static readonly string Path = + Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + System.IO.Path.DirectorySeparatorChar + "ANX Content Compiler" + System.IO.Path.DirectorySeparatorChar + "recentProjects.ees"; + + public RecentProjects() + : base(10) + { + + } + + public void Save() + { + XmlWriter writer = XmlWriter.Create(Path, + new XmlWriterSettings + { + Encoding = Encoding.UTF8, + Indent = true, + NewLineHandling = NewLineHandling.Entitize + }); + writer.WriteStartDocument(); + writer.WriteStartElement("RecentProjects"); + foreach (string project in this) + { + writer.WriteStartElement("ContentProject"); + writer.WriteValue(project); + writer.WriteEndElement(); + } + writer.WriteEndElement(); + writer.WriteEndDocument(); + writer.Flush(); + writer.Close(); + } + + public static RecentProjects Load() + { + var instance = new RecentProjects(); + XmlReader reader = XmlReader.Create(Path); + while (!reader.EOF) + { + if (reader.Name == "ContentProject") + instance.Add(reader.ReadElementContentAsString()); + reader.Read(); + } + reader.Close(); + return instance; + } + } +} \ No newline at end of file diff --git a/Tools/ANXContentCompilerGUI/Settings.cs b/Tools/ANXContentCompilerGUI/Settings.cs index 528f1305..57e6dfa9 100644 --- a/Tools/ANXContentCompilerGUI/Settings.cs +++ b/Tools/ANXContentCompilerGUI/Settings.cs @@ -95,7 +95,7 @@ namespace ANX.ContentCompiler.GUI if (!Directory.Exists(Path.GetDirectoryName(path))) Directory.CreateDirectory(Path.GetDirectoryName(path)); - XmlWriter writer = new XmlTextWriter(path, Encoding.Unicode); + XmlWriter writer = XmlWriter.Create(path, new XmlWriterSettings() { Encoding = Encoding.UTF8, Indent = true, NewLineHandling = NewLineHandling.Entitize }); writer.WriteStartDocument(); writer.WriteStartElement("CCompiler4Settings"); writer.WriteStartElement("MainColor"); diff --git a/Tools/ANXContentCompilerGUI/States/EditingState.Designer.cs b/Tools/ANXContentCompilerGUI/States/EditingState.Designer.cs index 8f70a290..2ede32ef 100644 --- a/Tools/ANXContentCompilerGUI/States/EditingState.Designer.cs +++ b/Tools/ANXContentCompilerGUI/States/EditingState.Designer.cs @@ -96,6 +96,7 @@ this.arrowButtonBuild.Name = "arrowButtonBuild"; this.arrowButtonBuild.Size = new System.Drawing.Size(348, 64); this.arrowButtonBuild.TabIndex = 8; + this.arrowButtonBuild.Click += new System.EventHandler(this.ArrowButtonBuildClick); // // EditingState // diff --git a/Tools/ANXContentCompilerGUI/States/EditingState.cs b/Tools/ANXContentCompilerGUI/States/EditingState.cs index 195c7c65..073603f9 100644 --- a/Tools/ANXContentCompilerGUI/States/EditingState.cs +++ b/Tools/ANXContentCompilerGUI/States/EditingState.cs @@ -39,5 +39,10 @@ namespace ANX.ContentCompiler.GUI.States } } + private void ArrowButtonBuildClick(object sender, EventArgs e) + { + MainWindow.Instance.BuildProject(sender, e); + } + } } diff --git a/Tools/ANXContentCompilerGUI/States/MenuState.Designer.cs b/Tools/ANXContentCompilerGUI/States/MenuState.Designer.cs index 643108e2..bfa81e9b 100644 --- a/Tools/ANXContentCompilerGUI/States/MenuState.Designer.cs +++ b/Tools/ANXContentCompilerGUI/States/MenuState.Designer.cs @@ -263,7 +263,7 @@ this.labelOpenDesc.Name = "labelOpenDesc"; this.labelOpenDesc.Size = new System.Drawing.Size(687, 70); this.labelOpenDesc.TabIndex = 3; - this.labelOpenDesc.Text = resources.GetString("labelOpenDesc.Text"); + this.labelOpenDesc.Text = "If you want to import Content Projects from XNA or previous Content Compiler versions, you can do that by clicking the import button."; // // arrowButtonImport //