diff --git a/Tools/ANXContentCompilerGUI/ANX.ContentCompiler.GUI.csproj b/Tools/ANXContentCompilerGUI/ANX.ContentCompiler.GUI.csproj index edff6a4b..f8179432 100644 --- a/Tools/ANXContentCompilerGUI/ANX.ContentCompiler.GUI.csproj +++ b/Tools/ANXContentCompilerGUI/ANX.ContentCompiler.GUI.csproj @@ -1,8 +1,12 @@ - + 10.0.0 2.0 + SAK + SAK + SAK + SAK @@ -138,6 +142,12 @@ FirstStartScreen.cs + + Form + + + PreviewScreen.cs + True True @@ -177,6 +187,12 @@ + + PreviewScreen.cs + + + MainWindow.cs + ResXFileCodeGenerator Designer @@ -186,6 +202,9 @@ ResXFileCodeGenerator ShowStrings.Designer.cs + + EditingState.cs + diff --git a/Tools/ANXContentCompilerGUI/Dialogues/PreviewScreen.Designer.cs b/Tools/ANXContentCompilerGUI/Dialogues/PreviewScreen.Designer.cs new file mode 100644 index 00000000..969c0c9d --- /dev/null +++ b/Tools/ANXContentCompilerGUI/Dialogues/PreviewScreen.Designer.cs @@ -0,0 +1,103 @@ +namespace ANX.ContentCompiler.GUI.Dialogues +{ + partial class PreviewScreen + { + /// + /// 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.buttonQuit = new System.Windows.Forms.Button(); + this.labelTitle = new System.Windows.Forms.Label(); + this.drawSurface = new System.Windows.Forms.Panel(); + this.SuspendLayout(); + // + // buttonQuit + // + this.buttonQuit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.buttonQuit.FlatAppearance.BorderSize = 0; + this.buttonQuit.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0))))); + this.buttonQuit.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Gray; + this.buttonQuit.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.buttonQuit.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.buttonQuit.ForeColor = System.Drawing.Color.White; + this.buttonQuit.Location = new System.Drawing.Point(591, 0); + this.buttonQuit.Name = "buttonQuit"; + this.buttonQuit.Size = new System.Drawing.Size(26, 23); + this.buttonQuit.TabIndex = 2; + this.buttonQuit.Text = "X"; + this.buttonQuit.UseVisualStyleBackColor = true; + this.buttonQuit.Click += new System.EventHandler(this.ButtonQuitClick); + // + // labelTitle + // + this.labelTitle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.labelTitle.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.labelTitle.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelTitle.ForeColor = System.Drawing.Color.Silver; + this.labelTitle.Location = new System.Drawing.Point(-1, 0); + this.labelTitle.Name = "labelTitle"; + this.labelTitle.Size = new System.Drawing.Size(618, 24); + this.labelTitle.TabIndex = 3; + this.labelTitle.Text = "Preview"; + this.labelTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.labelTitle.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelTitleMouseDown); + this.labelTitle.MouseMove += new System.Windows.Forms.MouseEventHandler(this.LabelTitleMouseMove); + this.labelTitle.MouseUp += new System.Windows.Forms.MouseEventHandler(this.LabelTitleMouseUp); + // + // drawSurface + // + this.drawSurface.Location = new System.Drawing.Point(12, 27); + this.drawSurface.Name = "drawSurface"; + this.drawSurface.Size = new System.Drawing.Size(595, 410); + this.drawSurface.TabIndex = 4; + // + // PreviewScreen + // + 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(619, 449); + this.Controls.Add(this.drawSurface); + this.Controls.Add(this.buttonQuit); + this.Controls.Add(this.labelTitle); + this.ForeColor = System.Drawing.Color.White; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Name = "PreviewScreen"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Preview"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button buttonQuit; + private System.Windows.Forms.Label labelTitle; + private System.Windows.Forms.Panel drawSurface; + } +} \ No newline at end of file diff --git a/Tools/ANXContentCompilerGUI/Dialogues/PreviewScreen.cs b/Tools/ANXContentCompilerGUI/Dialogues/PreviewScreen.cs new file mode 100644 index 00000000..a985d4dd --- /dev/null +++ b/Tools/ANXContentCompilerGUI/Dialogues/PreviewScreen.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace ANX.ContentCompiler.GUI.Dialogues +{ + public partial class PreviewScreen : Form + { + #region Fields + private Point _lastPos; + private bool _mouseDown; + #endregion + + public PreviewScreen() + { + InitializeComponent(); + } + + #region WindowMoveMethods + + private void LabelTitleMouseMove(object sender, MouseEventArgs e) + { + if (!_mouseDown) return; + int xoffset = MousePosition.X - _lastPos.X; + int yoffset = MousePosition.Y - _lastPos.Y; + Left += xoffset; + Top += yoffset; + _lastPos = MousePosition; + } + + private void LabelTitleMouseDown(object sender, MouseEventArgs e) + { + _mouseDown = true; + _lastPos = MousePosition; + } + + private void LabelTitleMouseUp(object sender, MouseEventArgs e) + { + _mouseDown = false; + } + + #endregion + + private void ButtonQuitClick(object sender, EventArgs e) + { + Close(); + DialogResult = DialogResult.Cancel; + } + } +} diff --git a/Tools/ANXContentCompilerGUI/MainWindow.Designer.cs b/Tools/ANXContentCompilerGUI/MainWindow.Designer.cs index 4f21e251..8ea2ea01 100644 --- a/Tools/ANXContentCompilerGUI/MainWindow.Designer.cs +++ b/Tools/ANXContentCompilerGUI/MainWindow.Designer.cs @@ -32,7 +32,6 @@ namespace ANX.ContentCompiler.GUI private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainWindow)); this.splitContainerMenuLayout = new System.Windows.Forms.SplitContainer(); this.show_pictureBoxRibbon = new System.Windows.Forms.PictureBox(); this.show_pictureBoxMenu = new System.Windows.Forms.PictureBox(); diff --git a/Tools/ANXContentCompilerGUI/MainWindow.cs b/Tools/ANXContentCompilerGUI/MainWindow.cs index 92af644b..d19d0e17 100644 --- a/Tools/ANXContentCompilerGUI/MainWindow.cs +++ b/Tools/ANXContentCompilerGUI/MainWindow.cs @@ -191,6 +191,19 @@ namespace ANX.ContentCompiler.GUI #region SaveProject + protected override bool ProcessCmdKey(ref Message msg, Keys keyData) + { + if (keyData.HasFlag(Keys.Control)) + { + if (keyData.HasFlag(Keys.S)) + { + SaveProject(this, null); + return true; + } + } + return base.ProcessCmdKey(ref msg, keyData); + } + public void SaveProject(object sender, EventArgs e) { if (_contentProject == null) return; @@ -344,11 +357,18 @@ namespace ANX.ContentCompiler.GUI string folder = _contentProject.ContentRoot; TreeNode node = treeView.SelectedNode; if (node != null) - folder = node.Name; + if ((string)node.Tag == "Folder") + folder = node.Name; + else + { + MessageBox.Show("Can not add a file to a file!"); + return; + } else node = treeView.Nodes[0]; - var newFolder = new TreeNode(name) {Name = folder + Path.DirectorySeparatorChar + name}; + var newFolder = new TreeNode(name) { Name = folder + Path.DirectorySeparatorChar + name }; + node.Tag = "Folder"; node.Nodes.Add(newFolder); } @@ -411,9 +431,9 @@ namespace ANX.ContentCompiler.GUI ProjectFolder = _contentProject.InputDirectory; treeView.Nodes.Clear(); - var rootNode = new TreeNode(ProjectName + "(" + _contentProject.ContentRoot + ")") - {Name = _contentProject.ContentRoot}; + var rootNode = new TreeNode(ProjectName + "(" + _contentProject.ContentRoot + ")") { Name = _contentProject.ContentRoot }; treeView.Nodes.Add(rootNode); + rootNode.Tag = "Folder"; TreeNode lastNode = rootNode; //aaaand here comes the nasty part. Watch out, it bites...um bugs! foreach ( @@ -426,7 +446,7 @@ namespace ANX.ContentCompiler.GUI string parent = _contentProject.ContentRoot; for (int i = 0; i < parts.Length - 1; i++) //Examine everything between ContentRoot and fileName. If we find something, add a folder! { - if (parts[i] == null) continue; + if (parts[i] == null) continue; if (i > 0) //if there is already a path we need to add the new part with a SeperatorChar! folder += Path.DirectorySeparatorChar + parts[i]; else @@ -439,8 +459,7 @@ namespace ANX.ContentCompiler.GUI // parent += Path.DirectorySeparatorChar + parts[0]; } lastNode = treeView.RecursiveSearch(parent); //Search for parent node! Often an Exception Candidate! Check the 'parent' var then. - var node = new TreeNode(parts[parts.Length - 2]) - {Name = _contentProject.ContentRoot + Path.DirectorySeparatorChar + folder}; //Finally glue a new folder node together + var node = new TreeNode(parts[parts.Length - 2]) { Name = _contentProject.ContentRoot + Path.DirectorySeparatorChar + folder, Tag = "Folder" }; //Finally glue a new folder node together if (!ContainsTreeNode(lastNode, node)) { lastNode.Nodes.Add(node); // If the folder is new, add it - else it's just wasted memory :) @@ -465,7 +484,7 @@ namespace ANX.ContentCompiler.GUI }*/ //Add the actual files to the tree in their apropriate subdirs string path = _contentProject.ContentRoot; - if (parts != null) + if (parts != null) { for (int i = 0; i < parts.Length - 1; i++) { @@ -476,18 +495,17 @@ namespace ANX.ContentCompiler.GUI { TreeNode node = treeView.RecursiveSearch(path); if (node == null) throw new ArgumentNullException("Node not found!"); - var item = new TreeNode(parts[parts.Length - 1]) {Name = buildItem.AssetName}; + var item = new TreeNode(parts[parts.Length - 1]) { Name = buildItem.AssetName, Tag = "File" }; node.Nodes.Add(item); } else //if the node is "forever alone", put him into the rootNode to make some friends! { - var item = new TreeNode(buildItem.AssetName) {Name = buildItem.AssetName}; + var item = new TreeNode(buildItem.AssetName) { Name = buildItem.AssetName, Tag = "File" }; treeView.Nodes[0].Nodes.Add(item); } } } } - #endregion #region ButtonHandlers @@ -836,5 +854,16 @@ namespace ANX.ContentCompiler.GUI } #endregion + + #region ShowPreview + internal void ShowPreview() + { + using (var preview = new PreviewScreen()) + { + if ((string)treeView.SelectedNode.Tag == "File") + preview.ShowDialog(); + } + } + #endregion } } \ No newline at end of file diff --git a/Tools/ANXContentCompilerGUI/States/EditingState.Designer.cs b/Tools/ANXContentCompilerGUI/States/EditingState.Designer.cs index 2ede32ef..0de7212e 100644 --- a/Tools/ANXContentCompilerGUI/States/EditingState.Designer.cs +++ b/Tools/ANXContentCompilerGUI/States/EditingState.Designer.cs @@ -84,6 +84,7 @@ this.arrowButtonPreview.Name = "arrowButtonPreview"; this.arrowButtonPreview.Size = new System.Drawing.Size(348, 64); this.arrowButtonPreview.TabIndex = 7; + this.arrowButtonPreview.Click += new System.EventHandler(this.ArrowButtonPreviewClick); // // arrowButtonBuild // diff --git a/Tools/ANXContentCompilerGUI/States/EditingState.cs b/Tools/ANXContentCompilerGUI/States/EditingState.cs index 0f752c69..09116b69 100644 --- a/Tools/ANXContentCompilerGUI/States/EditingState.cs +++ b/Tools/ANXContentCompilerGUI/States/EditingState.cs @@ -47,5 +47,10 @@ namespace ANX.ContentCompiler.GUI.States { MainWindow.Instance.BuildProject(sender, e); } + + private void ArrowButtonPreviewClick(object sender, EventArgs e) + { + MainWindow.Instance.ShowPreview(); + } } } \ No newline at end of file diff --git a/Tools/ANXContentCompilerGUI/States/MenuState.cs b/Tools/ANXContentCompilerGUI/States/MenuState.cs index 22a98f52..16109989 100644 --- a/Tools/ANXContentCompilerGUI/States/MenuState.cs +++ b/Tools/ANXContentCompilerGUI/States/MenuState.cs @@ -1,4 +1,5 @@ using System; +using System.Reflection; using System.Windows.Forms; using ANX.ContentCompiler.GUI.Dialogues; using ANX.Framework.NonXNA.Development; @@ -19,6 +20,7 @@ namespace ANX.ContentCompiler.GUI.States private void SetUpColors() { + labelVersion.Text = "ANX Content Compiler v" + Assembly.GetExecutingAssembly().GetName().Version; BackColor = Settings.MainColor; ForeColor = Settings.ForeColor; panel1.BackColor = Settings.AccentColor3;