From 6991527a951ec6fc40aa9d0c1d98fb7adc444999 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Fri, 12 Feb 2010 16:52:10 +0000 Subject: [PATCH] Removed SHFB from SharpDevelop distribution. Updated "Generate documentation" command to search for a manually installed SHFB. Generated SHFB project file now uses SHFB 1.8.0.3 file format. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@5499 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Resources/TortoiseSvnNotFoundForm.xfrm | 45 ----- .../Src/Gui/TortoiseSvnNotFoundForm.cs | 19 +- .../Project/SubversionAddIn.csproj | 4 +- .../Project/ICSharpCode.SharpDevelop.csproj | 7 +- .../Src/Commands/ProjectMenuCommands.cs | 121 +++++++++-- .../Dialogs/ToolNotFoundDialog.Designer.cs | 113 +++++++++++ .../Src/Gui/Dialogs/ToolNotFoundDialog.cs | 47 +++++ src/Setup/Files.wxs | 190 ------------------ src/Setup/Setup.wxs | 10 - src/Tools/Tools.build | 17 -- 10 files changed, 278 insertions(+), 295 deletions(-) delete mode 100644 src/AddIns/Misc/SubversionAddIn/Project/Resources/TortoiseSvnNotFoundForm.xfrm create mode 100644 src/Main/Base/Project/Src/Gui/Dialogs/ToolNotFoundDialog.Designer.cs create mode 100644 src/Main/Base/Project/Src/Gui/Dialogs/ToolNotFoundDialog.cs diff --git a/src/AddIns/Misc/SubversionAddIn/Project/Resources/TortoiseSvnNotFoundForm.xfrm b/src/AddIns/Misc/SubversionAddIn/Project/Resources/TortoiseSvnNotFoundForm.xfrm deleted file mode 100644 index aa092c711d..0000000000 --- a/src/AddIns/Misc/SubversionAddIn/Project/Resources/TortoiseSvnNotFoundForm.xfrm +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/TortoiseSvnNotFoundForm.cs b/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/TortoiseSvnNotFoundForm.cs index 01f7dce42f..e6b29e9ce8 100644 --- a/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/TortoiseSvnNotFoundForm.cs +++ b/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/TortoiseSvnNotFoundForm.cs @@ -11,28 +11,15 @@ using System.Windows.Forms; using ICSharpCode.Core; using ICSharpCode.Core.WinForms; -using ICSharpCode.SharpDevelop.Gui.XmlForms; +using ICSharpCode.SharpDevelop.Gui; namespace ICSharpCode.Svn { - public class TortoiseSvnNotFoundForm : BaseSharpDevelopForm + public class TortoiseSvnNotFoundForm : ToolNotFoundDialog { public TortoiseSvnNotFoundForm() + : base(StringParser.Parse("${res:AddIns.Subversion.TortoiseSVNRequired}"), "http://tortoisesvn.net/", null) { - SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("ICSharpCode.Svn.Resources.TortoiseSvnNotFoundForm.xfrm")); - - ((Label)ControlDictionary["messageLabel"]).Text = StringParser.Parse("${res:AddIns.Subversion.TortoiseSVNRequired}"); - ((PictureBox)ControlDictionary["iconPictureBox"]).Image = WinFormsResourceService.GetBitmap("Icons.32x32.Information"); - ((LinkLabel)ControlDictionary["linkLabel"]).Click += LinkLabelClicked; - } - - void LinkLabelClicked(object sender, EventArgs e) - { - try { - Process.Start("http://tortoisesvn.tigris.org"); - } catch (Exception ex) { - LoggingService.Warn("Cannot start http://tortoisesvn.tigris.org", ex); - } } } } diff --git a/src/AddIns/Misc/SubversionAddIn/Project/SubversionAddIn.csproj b/src/AddIns/Misc/SubversionAddIn/Project/SubversionAddIn.csproj index a6ec10b1e5..68b264f6bc 100644 --- a/src/AddIns/Misc/SubversionAddIn/Project/SubversionAddIn.csproj +++ b/src/AddIns/Misc/SubversionAddIn/Project/SubversionAddIn.csproj @@ -1,4 +1,5 @@ - + + Library ICSharpCode.Svn @@ -70,7 +71,6 @@ Configuration\GlobalAssemblyInfo.cs - DiffPanel.cs diff --git a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj index ccc451df47..daddf93263 100644 --- a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj +++ b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj @@ -1,4 +1,5 @@ - + + Debug AnyCPU @@ -94,6 +95,10 @@ ConvertToMSBuild35Dialog.cs + + + ToolNotFoundDialog.cs + AddNewConfigurationDialog.cs diff --git a/src/Main/Base/Project/Src/Commands/ProjectMenuCommands.cs b/src/Main/Base/Project/Src/Commands/ProjectMenuCommands.cs index e35da8beb4..a464a5da5e 100644 --- a/src/Main/Base/Project/Src/Commands/ProjectMenuCommands.cs +++ b/src/Main/Base/Project/Src/Commands/ProjectMenuCommands.cs @@ -8,10 +8,13 @@ using System; using System.Diagnostics; using System.IO; +using System.Text; +using System.Xml; using ICSharpCode.Core; using ICSharpCode.SharpDevelop.Gui; using ICSharpCode.SharpDevelop.Project.Dialogs; +using Microsoft.Win32; namespace ICSharpCode.SharpDevelop.Project.Commands { @@ -46,41 +49,131 @@ namespace ICSharpCode.SharpDevelop.Project.Commands public class GenerateProjectDocumentation : AbstractMenuCommand { + static string FindSHFB() + { + string command = Registry.GetValue(@"HKEY_CLASSES_ROOT\Sandcastle Help File Builder Project\shell\open\command", null, string.Empty) as string; + return ExtractExecutableFromCommand(command); + } + + static string ExtractExecutableFromCommand(string command) + { + if (string.IsNullOrEmpty(command)) + return null; + command = command.Trim(); + if (string.IsNullOrEmpty(command)) + return null; + if (command[0] == '"') { + // "program" %1 + int pos = command.IndexOf('"', 1); + if (pos < 0) + return null; + return command.Substring(1, pos - 1); + } else { + // program %1 + int pos = command.IndexOf(' '); + if (pos < 0) + return command; + else + return command.Substring(0, pos); + } + } + public override void Run() { CompilableProject project = ProjectService.CurrentProject as CompilableProject; if (project == null) { return; } - string assembly = project.OutputAssemblyFullPath; - if (!File.Exists(assembly)) { - MessageService.ShowMessage("${res:ProjectComponent.ContextMenu.GenerateDocumentation.ProjectNeedsToBeCompiled}"); + string sandcastleHelpFileBuilderPath = FindSHFB(); + if (sandcastleHelpFileBuilderPath == null || !File.Exists(sandcastleHelpFileBuilderPath)) { + using (ToolNotFoundDialog dlg = new ToolNotFoundDialog( + StringParser.Parse("${res:ProjectComponent.ContextMenu.GenerateDocumentation.SHFBNotFound}"), + "http://www.codeplex.com/SHFB/", null)) + { + dlg.ShowDialog(WorkbenchSingleton.MainForm); + } return; } + + string assembly = project.OutputAssemblyFullPath; string xmlDocFile = project.DocumentationFileFullPath; if (xmlDocFile == null) { MessageService.ShowMessage("${res:ProjectComponent.ContextMenu.GenerateDocumentation.NeedToEditBuildOptions}"); return; } + if (!File.Exists(assembly)) { + MessageService.ShowMessage("${res:ProjectComponent.ContextMenu.GenerateDocumentation.ProjectNeedsToBeCompiled}"); + return; + } if (!File.Exists(xmlDocFile)) { MessageService.ShowMessage("${res:ProjectComponent.ContextMenu.GenerateDocumentation.ProjectNeedsToBeCompiled2}"); return; } - string sandcastleHelpFileBuilderProjectFile = Path.ChangeExtension(assembly, ".shfb"); + string sandcastleHelpFileBuilderProjectFile = Path.ChangeExtension(project.FileName, ".shfbproj"); if (!File.Exists(sandcastleHelpFileBuilderProjectFile)) { - using (StreamWriter sw = File.CreateText(sandcastleHelpFileBuilderProjectFile)) { - sw.WriteLine(""); - sw.WriteLine(" "); - sw.WriteLine(" "); - sw.WriteLine(" "); - sw.WriteLine(""); + using (XmlTextWriter w = new XmlTextWriter(sandcastleHelpFileBuilderProjectFile, Encoding.UTF8)) { + w.Formatting = Formatting.Indented; + const string ns = "http://schemas.microsoft.com/developer/msbuild/2003"; + w.WriteStartElement("Project", ns); + w.WriteAttributeString("DefaultTargets", "Build"); + w.WriteAttributeString("ToolsVersion", "3.5"); + + w.WriteStartElement("PropertyGroup", ns); + w.WriteComment("The configuration and platform will be used to determine which\n" + + "assemblies to include from solution and project documentation\n" + + "sources"); + w.WriteStartElement("Configuration", ns); + w.WriteAttributeString("Condition", " '$(Configuration)' == '' "); + w.WriteValue("Debug"); + w.WriteEndElement(); // + + w.WriteStartElement("Platform", ns); + w.WriteAttributeString("Condition", " '$(Platform)' == '' "); + w.WriteValue("AnyCPU"); + w.WriteEndElement(); // + + w.WriteElementString("SchemaVersion", ns, "2.0"); + w.WriteElementString("ProjectGuid", ns, Guid.NewGuid().ToString("B")); + w.WriteElementString("SHFBSchemaVersion", ns, "1.8.0.3"); + + w.WriteElementString("AssemblyName", ns, "Documentation"); + w.WriteElementString("RootNamespace", ns, "Documentation"); + w.WriteElementString("Name", ns, "Documentation"); + + w.WriteElementString("OutputPath", ns, @".\Help\"); + w.WriteElementString("HtmlHelpName", ns, "Documentation"); + + w.WriteStartElement("DocumentationSources", ns); + w.WriteStartElement("DocumentationSource", ""); + w.WriteAttributeString("sourceFile", FileUtility.GetRelativePath(Path.GetDirectoryName(sandcastleHelpFileBuilderProjectFile), project.FileName)); + w.WriteEndElement(); // + w.WriteEndElement(); // + + w.WriteEndElement(); // + + w.WriteComment("There are no properties for these groups. AnyCPU needs to appear in\n" + + "order for Visual Studio to perform the build. The others are optional\n" + + "common platform types that may appear."); + string[] confPlatList = { + "Debug|AnyCPU", "Release|AnyCPU", "Debug|x86", "Release|x86", "Debug|x64", "Release|x64", "Debug|Win32", "Release|Win32" + }; + foreach (string confPlat in confPlatList) { + w.WriteStartElement("PropertyGroup", ns); + w.WriteAttributeString("Condition", " '$(Configuration)|$(Platform)' == '" + confPlat + "' "); + w.WriteEndElement(); // + } + + w.WriteComment("Import the SHFB build targets"); + w.WriteStartElement("Import", ns); + w.WriteAttributeString("Project", @"$(SHFBROOT)\SandcastleHelpFileBuilder.targets"); + w.WriteEndElement(); // + + w.WriteEndElement(); // } } - string sandcastleHelpFileBuilderDirectory = Path.Combine(FileUtility.ApplicationRootPath, "bin/Tools/SHFB"); - - ProcessStartInfo psi = new ProcessStartInfo(Path.Combine(sandcastleHelpFileBuilderDirectory, "SandcastleBuilderGUI.exe"), '"' + sandcastleHelpFileBuilderProjectFile + '"'); - psi.WorkingDirectory = sandcastleHelpFileBuilderDirectory; + ProcessStartInfo psi = new ProcessStartInfo(sandcastleHelpFileBuilderPath, '"' + sandcastleHelpFileBuilderProjectFile + '"'); + psi.WorkingDirectory = Path.GetDirectoryName(sandcastleHelpFileBuilderPath); psi.UseShellExecute = false; Process.Start(psi); } diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/ToolNotFoundDialog.Designer.cs b/src/Main/Base/Project/Src/Gui/Dialogs/ToolNotFoundDialog.Designer.cs new file mode 100644 index 0000000000..11f56be417 --- /dev/null +++ b/src/Main/Base/Project/Src/Gui/Dialogs/ToolNotFoundDialog.Designer.cs @@ -0,0 +1,113 @@ +// +// +// +// +// $Revision$ +// + +namespace ICSharpCode.SharpDevelop.Gui +{ + partial class ToolNotFoundDialog + { + /// + /// Designer variable used to keep track of non-visual components. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Disposes resources used by the form. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing) { + if (components != null) { + components.Dispose(); + } + } + base.Dispose(disposing); + } + + /// + /// This method is required for Windows Forms designer support. + /// Do not change the method contents inside the source code editor. The Forms designer might + /// not be able to load this method if it was changed manually. + /// + private void InitializeComponent() + { + this.pictureBox = new System.Windows.Forms.PictureBox(); + this.descriptionLabel = new System.Windows.Forms.Label(); + this.linkLabel = new System.Windows.Forms.LinkLabel(); + this.okButton = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); + this.SuspendLayout(); + // + // pictureBox + // + this.pictureBox.Location = new System.Drawing.Point(12, 12); + this.pictureBox.Name = "pictureBox"; + this.pictureBox.Size = new System.Drawing.Size(32, 32); + this.pictureBox.TabIndex = 0; + this.pictureBox.TabStop = false; + // + // descriptionLabel + // + this.descriptionLabel.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.descriptionLabel.Location = new System.Drawing.Point(50, 9); + this.descriptionLabel.Name = "descriptionLabel"; + this.descriptionLabel.Size = new System.Drawing.Size(282, 91); + this.descriptionLabel.TabIndex = 1; + this.descriptionLabel.Text = "description"; + // + // linkLabel + // + this.linkLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.linkLabel.Location = new System.Drawing.Point(12, 102); + this.linkLabel.Name = "linkLabel"; + this.linkLabel.Size = new System.Drawing.Size(239, 23); + this.linkLabel.TabIndex = 2; + this.linkLabel.TabStop = true; + this.linkLabel.Text = "URL"; + this.linkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LinkLabelLinkClicked); + // + // okButton + // + this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK; + this.okButton.Location = new System.Drawing.Point(257, 102); + this.okButton.Name = "okButton"; + this.okButton.Size = new System.Drawing.Size(75, 23); + this.okButton.TabIndex = 0; + this.okButton.Text = "OK"; + this.okButton.UseVisualStyleBackColor = true; + // + // ToolNotFoundDialog + // + this.AcceptButton = this.okButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(344, 134); + this.Controls.Add(this.okButton); + this.Controls.Add(this.linkLabel); + this.Controls.Add(this.descriptionLabel); + this.Controls.Add(this.pictureBox); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(360, 140); + this.Name = "ToolNotFoundDialog"; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "ToolNotFoundDialog"; + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); + this.ResumeLayout(false); + } + private System.Windows.Forms.LinkLabel linkLabel; + private System.Windows.Forms.Button okButton; + private System.Windows.Forms.Label descriptionLabel; + private System.Windows.Forms.PictureBox pictureBox; + } +} diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/ToolNotFoundDialog.cs b/src/Main/Base/Project/Src/Gui/Dialogs/ToolNotFoundDialog.cs new file mode 100644 index 0000000000..7c23de1052 --- /dev/null +++ b/src/Main/Base/Project/Src/Gui/Dialogs/ToolNotFoundDialog.cs @@ -0,0 +1,47 @@ +// +// +// +// +// $Revision$ +// + +using System; +using System.Diagnostics; +using System.Drawing; +using System.Windows.Forms; + +using ICSharpCode.Core; +using ICSharpCode.Core.WinForms; + +namespace ICSharpCode.SharpDevelop.Gui +{ + public partial class ToolNotFoundDialog : Form + { + /// + /// Creates a new instance of the ToolNotFoundDialog. + /// + /// The description text + /// The link target (with leading http://) + /// 32x32 icon to display next to the description. May be null. + public ToolNotFoundDialog(string description, string linkTarget, Image icon) + { + // The InitializeComponent() call is required for Windows Forms designer support. + InitializeComponent(); + + descriptionLabel.Text = description; + linkLabel.Text = linkTarget; + pictureBox.Image = icon ?? WinFormsResourceService.GetBitmap("Icons.32x32.Information"); + this.Text = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Gui.Dialogs.ToolNotFoundDialog.Title}"); + okButton.Text = StringParser.Parse("${res:Global.OKButtonText}"); + } + + void LinkLabelLinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + try { + Process.Start(linkLabel.Text); + } catch (Exception ex) { + LoggingService.Warn("Cannot start " + linkLabel.Text, ex); + } + } + } +} diff --git a/src/Setup/Files.wxs b/src/Setup/Files.wxs index a87860b7bb..d7fe030356 100644 --- a/src/Setup/Files.wxs +++ b/src/Setup/Files.wxs @@ -427,9 +427,6 @@ - - - @@ -492,193 +489,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Setup/Setup.wxs b/src/Setup/Setup.wxs index 78d45c699d..75a476eaf5 100644 --- a/src/Setup/Setup.wxs +++ b/src/Setup/Setup.wxs @@ -263,17 +263,7 @@ - - - - - - - - - - diff --git a/src/Tools/Tools.build b/src/Tools/Tools.build index 4dcc2ffcee..57dd3cad6a 100644 --- a/src/Tools/Tools.build +++ b/src/Tools/Tools.build @@ -1,13 +1,5 @@ - - - - - - - - @@ -21,15 +13,6 @@ - - - - - - - - -