Index: Setup2/Cosmos.iss =================================================================== --- Setup2/Cosmos.iss (revision 79470) +++ Setup2/Cosmos.iss (working copy) @@ -236,6 +236,13 @@ Root: HKLM; SubKey: Software\Microsoft\VisualStudio\10.0\CLSID\{{3b72bb68-7363-45a2-9eba-55c8d5f36e36}; ValueType: string; ValueName: Class; ValueData: Cosmos.VS.Package.VMPage Root: HKLM; SubKey: Software\Microsoft\VisualStudio\10.0\CLSID\{{3b72bb68-7363-45a2-9eba-55c8d5f36e36}; ValueType: string; ValueName: CodeBase; ValueData: {app}\build\vsip\cosmos.vs.package.dll Root: HKLM; SubKey: Software\Microsoft\VisualStudio\10.0\CLSID\{{3b72bb68-7363-45a2-9eba-55c8d5f36e36}; ValueType: string; ValueName: ThreadingModel; ValueData: Both +; ExternalLibs configuration page +Root: HKLM; SubKey: Software\Microsoft\VisualStudio\10.0\CLSID\{{6F41DDF7-6BF2-46D0-96DC-3FEC494B8EE8}; ValueType: none; Flags: uninsdeletekey +Root: HKLM; SubKey: Software\Microsoft\VisualStudio\10.0\CLSID\{{6F41DDF7-6BF2-46D0-96DC-3FEC494B8EE8}; ValueType: string; ValueName: ; ValueData: Cosmos.VS.Package.ExternalLibPage +Root: HKLM; SubKey: Software\Microsoft\VisualStudio\10.0\CLSID\{{6F41DDF7-6BF2-46D0-96DC-3FEC494B8EE8}; ValueType: string; ValueName: InprocServer32; ValueData: {sys}\MSCOREE.DLL +Root: HKLM; SubKey: Software\Microsoft\VisualStudio\10.0\CLSID\{{6F41DDF7-6BF2-46D0-96DC-3FEC494B8EE8}; ValueType: string; ValueName: Class; ValueData: Cosmos.VS.Package.ExternalLibPage +Root: HKLM; SubKey: Software\Microsoft\VisualStudio\10.0\CLSID\{{6F41DDF7-6BF2-46D0-96DC-3FEC494B8EE8}; ValueType: string; ValueName: CodeBase; ValueData: {app}\build\vsip\cosmos.vs.package.dll +Root: HKLM; SubKey: Software\Microsoft\VisualStudio\10.0\CLSID\{{6F41DDF7-6BF2-46D0-96DC-3FEC494B8EE8}; ValueType: string; ValueName: ThreadingModel; ValueData: Both ; project type factory Root: HKLM; SubKey: Software\Microsoft\VisualStudio\10.0\Projects\{{471ec4bb-e47e-4229-a789-d1f5f83b52d4}; ValueType: none; Flags: uninsdeletekey Index: source2/Build/Cosmos.Build.Common/Cosmos.Build.Common.csproj =================================================================== --- source2/Build/Cosmos.Build.Common/Cosmos.Build.Common.csproj (revision 79470) +++ source2/Build/Cosmos.Build.Common/Cosmos.Build.Common.csproj (working copy) @@ -73,6 +73,7 @@ + Index: source2/Build/Cosmos.Build.MSBuild/Cosmos.targets =================================================================== --- source2/Build/Cosmos.Build.MSBuild/Cosmos.targets (revision 79470) +++ source2/Build/Cosmos.Build.MSBuild/Cosmos.targets (working copy) @@ -47,6 +47,7 @@ ConfigurationBase.cs + + UserControl + + + ExteralLibPage.cs + UserControl @@ -157,6 +163,9 @@ + + ExteralLibPage.cs + true @@ -234,9 +243,9 @@ Templates\Projects\CosmosProject %28C#%29 - - Templates\Projects\CosmosProject %28C#%29 - + + Templates\Projects\CosmosProject %28C#%29 + Templates\Projects\Cosmos @@ -246,27 +255,27 @@ Templates\Projects\Cosmos - - Templates\Projects\CosmosProject %28C#%29 - - - Templates\Projects\CosmosProject %28C#%29 - - - Templates\Projects\CosmosProject %28F#%29 - - - Templates\Projects\CosmosProject %28F#%29 - - - Templates\Projects\CosmosProject %28F#%29 - - - Templates\Projects\CosmosProject %28F#%29 - - - Templates\Projects\CosmosProject %28F#%29 - + + Templates\Projects\CosmosProject %28C#%29 + + + Templates\Projects\CosmosProject %28C#%29 + + + Templates\Projects\CosmosProject %28F#%29 + + + Templates\Projects\CosmosProject %28F#%29 + + + Templates\Projects\CosmosProject %28F#%29 + + + Templates\Projects\CosmosProject %28F#%29 + + + Templates\Projects\CosmosProject %28F#%29 + BuildPage.cs Index: source2/VSIP/Cosmos.VS.Package/DebugPage.Designer.cs =================================================================== --- source2/VSIP/Cosmos.VS.Package/DebugPage.Designer.cs (revision 79470) +++ source2/VSIP/Cosmos.VS.Package/DebugPage.Designer.cs (working copy) @@ -33,10 +33,8 @@ // // panelSubPage // - this.panelSubPage.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); this.panelSubPage.AutoScroll = true; + this.panelSubPage.Dock = System.Windows.Forms.DockStyle.Fill; this.panelSubPage.Location = new System.Drawing.Point(0, 41); this.panelSubPage.Margin = new System.Windows.Forms.Padding(0); this.panelSubPage.Name = "panelSubPage"; @@ -50,7 +48,7 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.panelSubPage); this.Controls.Add(this.labelNoConfig); - this.Font = new System.Drawing.Font("Segoe UI", 8.25F); + this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); this.Name = "DebugPage"; this.Title = "Debug"; this.Controls.SetChildIndex(this.labelNoConfig, 0); Index: source2/VSIP/Cosmos.VS.Package/DebugPage.resx =================================================================== --- source2/VSIP/Cosmos.VS.Package/DebugPage.resx (revision 79470) +++ source2/VSIP/Cosmos.VS.Package/DebugPage.resx (working copy) @@ -112,9 +112,9 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.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 Index: source2/VSIP/Cosmos.VS.Package/ExteralLibPage.cs =================================================================== --- source2/VSIP/Cosmos.VS.Package/ExteralLibPage.cs (revision 0) +++ source2/VSIP/Cosmos.VS.Package/ExteralLibPage.cs (revision 0) @@ -0,0 +1,156 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Text; +using System.Windows.Forms; +using Cosmos.Build.Common; + +namespace Cosmos.VS.Package +{ + public partial class ExternalLibPage : CustomPropertyPage + { + List ExternalLibraries = new List(); + + public ExternalLibPage() + { + InitializeComponent(); + } + + protected ExternalLibsProperties mProps = new ExternalLibsProperties(); + public override PropertiesBase Properties + { + get { return mProps; } + } + + private List ConvertToList(String str) + { + if (str != null && str != "" && str != "\r\n" && str != "\r" && str != "\n") + { + return new List(str.Split("~~~~~~".ToCharArray())); + } + else + { + return new List(); + } + } + + private String ConvertFromList(List lst) + { + string externalLibsForArgs = ""; + bool first = true; + foreach (string s in lst) + { + if (!first) + { + externalLibsForArgs += "~~~~~~"; // That's 6 of them, this separates the libs. + } + externalLibsForArgs += s; + } + return externalLibsForArgs; + } + + protected override void FillProperties() + { + base.FillProperties(); + mProps.Reset(); + + mProps.SetProperty("ExternalLibsForArgs", GetConfigProperty("ExternalLibsForArgs")); + ExternalLibraries = ConvertToList(mProps.ExternalLibraries); + foreach (string s in ExternalLibraries) + { + ExternalLibsListBox.Items.Add(s); + } + } + + #region Relative Path + private string GetRelativePath(string fullPath) + { + string fromDirectory = Project.FullName.Substring(0, (Project.FullName.Length - Project.FileName.Length)); + + if (fullPath == null) + throw new ArgumentNullException("fullPath"); + + bool isRooted = (System.IO.Path.IsPathRooted(fromDirectory) && System.IO.Path.IsPathRooted(fullPath)); + + if (isRooted) + { + bool isDifferentRoot = (string.Compare(System.IO.Path.GetPathRoot(fromDirectory), System.IO.Path.GetPathRoot(fullPath), true) != 0); + + if (isDifferentRoot) + return fullPath; + } + + List relativePath = new List(); + string[] fromDirectories = fromDirectory.Split(System.IO.Path.DirectorySeparatorChar); + + string[] toDirectories = fullPath.Split(System.IO.Path.DirectorySeparatorChar); + + int length = Math.Min(fromDirectories.Length, toDirectories.Length); + + int lastCommonRoot = -1; + + // find common root + for (int x = 0; x < length; x++) + { + if (string.Compare(fromDirectories[x], toDirectories[x], true) != 0) + break; + + lastCommonRoot = x; + } + + if (lastCommonRoot == -1) + return fullPath; + + // add relative folders in from path + for (int x = lastCommonRoot + 1; x < fromDirectories.Length; x++) + { + if (fromDirectories[x].Length > 0) + relativePath.Add(".."); + } + + // add to folders to path + for (int x = lastCommonRoot + 1; x < toDirectories.Length; x++) + { + relativePath.Add(toDirectories[x]); + } + + // create relative path + string[] relativeParts = new string[relativePath.Count]; + relativePath.CopyTo(relativeParts, 0); + + string newPath = string.Join(System.IO.Path.DirectorySeparatorChar.ToString(), relativeParts); + + return newPath; + } + #endregion + + private void AddButton_Click(object sender, EventArgs e) + { + if (openFileDialog1.ShowDialog() == DialogResult.OK) + { + if (!ExternalLibraries.Contains(openFileDialog1.FileName)) + { + string fpath = GetRelativePath(openFileDialog1.FileName); + ExternalLibraries.Add(fpath); + ExternalLibsListBox.Items.Add(fpath); + mProps.ExternalLibraries = ConvertFromList(ExternalLibraries); + IsDirty = true; + } + } + } + + private void RemoveButton_Click(object sender, EventArgs e) + { + if (ExternalLibsListBox.SelectedIndex > -1) + { + ExternalLibraries.Remove((string)ExternalLibsListBox.Items[ExternalLibsListBox.SelectedIndex]); + ExternalLibsListBox.Items.Remove(ExternalLibsListBox.Items[ExternalLibsListBox.SelectedIndex]); + mProps.ExternalLibraries = ConvertFromList(ExternalLibraries); + IsDirty = true; + } + } + + } +} Index: source2/VSIP/Cosmos.VS.Package/ExteralLibPage.Designer.cs =================================================================== --- source2/VSIP/Cosmos.VS.Package/ExteralLibPage.Designer.cs (revision 0) +++ source2/VSIP/Cosmos.VS.Package/ExteralLibPage.Designer.cs (revision 0) @@ -0,0 +1,172 @@ +namespace Cosmos.VS.Package +{ + partial class ExternalLibPage + { + /// + /// 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 Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.AddButton = new System.Windows.Forms.Button(); + this.splitContainer2 = new System.Windows.Forms.SplitContainer(); + this.RemoveButton = new System.Windows.Forms.Button(); + this.ExternalLibsListBox = new System.Windows.Forms.ListBox(); + this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); + this.tableLayoutPanel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); + this.splitContainer2.Panel1.SuspendLayout(); + this.splitContainer2.SuspendLayout(); + this.SuspendLayout(); + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 2; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 75F)); + this.tableLayoutPanel1.Controls.Add(this.splitContainer1, 1, 0); + this.tableLayoutPanel1.Controls.Add(this.ExternalLibsListBox, 0, 0); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 1; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(439, 245); + this.tableLayoutPanel1.TabIndex = 0; + // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.IsSplitterFixed = true; + this.splitContainer1.Location = new System.Drawing.Point(364, 0); + this.splitContainer1.Margin = new System.Windows.Forms.Padding(0); + this.splitContainer1.Name = "splitContainer1"; + this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.AddButton); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.splitContainer2); + this.splitContainer1.Size = new System.Drawing.Size(75, 245); + this.splitContainer1.SplitterDistance = 25; + this.splitContainer1.SplitterWidth = 1; + this.splitContainer1.TabIndex = 0; + this.splitContainer1.TabStop = false; + // + // AddButton + // + this.AddButton.Dock = System.Windows.Forms.DockStyle.Fill; + this.AddButton.Location = new System.Drawing.Point(0, 0); + this.AddButton.Name = "AddButton"; + this.AddButton.Size = new System.Drawing.Size(75, 25); + this.AddButton.TabIndex = 0; + this.AddButton.Text = "Add"; + this.AddButton.UseVisualStyleBackColor = true; + this.AddButton.Click += new System.EventHandler(this.AddButton_Click); + // + // splitContainer2 + // + this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer2.IsSplitterFixed = true; + this.splitContainer2.Location = new System.Drawing.Point(0, 0); + this.splitContainer2.Margin = new System.Windows.Forms.Padding(0); + this.splitContainer2.Name = "splitContainer2"; + this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // splitContainer2.Panel1 + // + this.splitContainer2.Panel1.Controls.Add(this.RemoveButton); + this.splitContainer2.Size = new System.Drawing.Size(75, 219); + this.splitContainer2.SplitterDistance = 25; + this.splitContainer2.SplitterWidth = 1; + this.splitContainer2.TabIndex = 0; + this.splitContainer2.TabStop = false; + // + // RemoveButton + // + this.RemoveButton.Dock = System.Windows.Forms.DockStyle.Fill; + this.RemoveButton.Location = new System.Drawing.Point(0, 0); + this.RemoveButton.Name = "RemoveButton"; + this.RemoveButton.Size = new System.Drawing.Size(75, 25); + this.RemoveButton.TabIndex = 0; + this.RemoveButton.Text = "Remove"; + this.RemoveButton.UseVisualStyleBackColor = true; + this.RemoveButton.Click += new System.EventHandler(this.RemoveButton_Click); + // + // ExternalLibsListBox + // + this.ExternalLibsListBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.ExternalLibsListBox.FormattingEnabled = true; + this.ExternalLibsListBox.Location = new System.Drawing.Point(3, 3); + this.ExternalLibsListBox.Name = "ExternalLibsListBox"; + this.ExternalLibsListBox.Size = new System.Drawing.Size(358, 239); + this.ExternalLibsListBox.TabIndex = 1; + // + // openFileDialog1 + // + this.openFileDialog1.Filter = "Object Files (*.obj) |*.obj"; + // + // ExternalLibPage + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.tableLayoutPanel1); + this.Margin = new System.Windows.Forms.Padding(0); + this.Name = "ExternalLibPage"; + this.Size = new System.Drawing.Size(439, 245); + this.Title = "External Libraries"; + this.tableLayoutPanel1.ResumeLayout(false); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + this.splitContainer2.Panel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); + this.splitContainer2.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.SplitContainer splitContainer1; + private System.Windows.Forms.Button AddButton; + private System.Windows.Forms.SplitContainer splitContainer2; + private System.Windows.Forms.Button RemoveButton; + private System.Windows.Forms.ListBox ExternalLibsListBox; + private System.Windows.Forms.OpenFileDialog openFileDialog1; + + + } +} Index: source2/VSIP/Cosmos.VS.Package/ExteralLibPage.resx =================================================================== --- source2/VSIP/Cosmos.VS.Package/ExteralLibPage.resx (revision 0) +++ source2/VSIP/Cosmos.VS.Package/ExteralLibPage.resx (revision 0) @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + 17, 17 + + + 25 + + \ No newline at end of file Index: source2/VSIP/Cosmos.VS.Package/Guids.cs =================================================================== --- source2/VSIP/Cosmos.VS.Package/Guids.cs (revision 79470) +++ source2/VSIP/Cosmos.VS.Package/Guids.cs (working copy) @@ -10,7 +10,8 @@ // These GUIDs are also used in the .iss, as are the prop page names. If you change names // or GUIDs you need to update the .iss as well. public const string BuildPage = "d33a2d29-c4fd-4e12-a510-4c01a14d63e1"; - public const string DebugPage = "39801176-289f-405f-9425-2931a2c03912"; + public const string DebugPage = "39801176-289f-405f-9425-2931a2c03912"; + public const string ExternalLibPage = "6F41DDF7-6BF2-46D0-96DC-3FEC494B8EE8"; public const string VMPage = "3b72bb68-7363-45a2-9eba-55c8d5f36e36"; public static readonly Guid guidProjectCmdSet = new Guid(guidProjectCmdSetString); Index: source2/VSIP/Cosmos.VS.Package/VSProjectNode.cs =================================================================== --- source2/VSIP/Cosmos.VS.Package/VSProjectNode.cs (revision 79470) +++ source2/VSIP/Cosmos.VS.Package/VSProjectNode.cs (working copy) @@ -11,7 +11,7 @@ public class VSProjectNode : ProjectNode { internal static int imageIndex; - public override int ImageIndex + public override int ImageIndex { get { return imageIndex; } } @@ -44,9 +44,9 @@ public override MSBuildResult Build(uint vsopts, string config, IVsOutputWindowPane output, string target) { - // remove it, no really function in it Trivalik + // remove it, no really function in it Trivalik //var xReferenceContainer = GetReferenceContainer(); - + return base.Build(vsopts, config, output, target); } @@ -69,18 +69,19 @@ { uiThreadCallback(MSBuildResult.Successful, "Skipped"); output.OutputStringThreadSafe("Project skipped, as it's not necessary for running"); + output.OutputStringThreadSafe("\r\n"); return; } } } - } + } base.BuildAsync(vsopts, config, output, target, uiThreadCallback); } protected override MSBuildResult InvokeMsBuild(string target) { - // if the project is not set as startup project, don't build the iso - + // if the project is not set as startup project, don't build the iso + return base.InvokeMsBuild(target); } @@ -113,13 +114,15 @@ LogUtility.LogString("Entering Cosmos.VS.Package.VSProjectNode.GetConfigurationIndependentPropertyPages()"); try { - return new Guid[] { - // typeof(PropPageEnvironment).GUID, - //typeof(PropPageTest).GUID, - typeof(BuildPage).GUID, - typeof(DebugPage).GUID, - typeof(VMPage).GUID, - }; + return new Guid[] + { + // typeof(PropPageEnvironment).GUID, + //typeof(PropPageTest).GUID, + typeof(BuildPage).GUID, + typeof(DebugPage).GUID, + typeof(VMPage).GUID, + new Guid("6F41DDF7-6BF2-46D0-96DC-3FEC494B8EE8"), // ExternalLibPage + }; } finally { @@ -142,8 +145,7 @@ get { return "CosmosProjectType"; } } - public override void AddFileFromTemplate( - string source, string target) + public override void AddFileFromTemplate(string source, string target) { LogUtility.LogString("Entering Cosmos.VS.Package.VSProjectNode.AddFileFromTemplate('{0}', '{1}')", source, target); try