| 0: | // HelpFileGeneratorDialog.cs | |
| 1: | // Copyright (C) 2001 Mike Krueger | |
| 2: | // File taken from NUnit Progressbar.cs Copyright 2000 by Philip Craig | |
| 3: | // | |
| 4: | // This program is free software; you can redistribute it and/or | |
| 5: | // modify it under the terms of the GNU General Public License | |
| 6: | // as published by the Free Software Foundation; either version 2 | |
| 7: | // of the License, or (at your option) any later version. | |
| 8: | // | |
| 9: | // This program is distributed in the hope that it will be useful, | |
| 10: | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11: | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12: | // GNU General Public License for more details. | |
| 13: | // | |
| 14: | // You should have received a copy of the GNU General Public License | |
| 15: | // along with this program; if not, write to the Free Software | |
| 16: | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
| 17: | ||
| 18: | using System; | |
| 19: | using System.Drawing; | |
| 20: | using System.Collections; | |
| 21: | using System.ComponentModel; | |
| 22: | using System.Windows.Forms; | |
| 23: | using System.Data; | |
| 24: | using System.IO; | |
| 25: | ||
| 26: | using SharpDevelop.Tool.Data; | |
| 27: | using SharpDevelop.Internal.Project; | |
| 28: | using XMarksTheDOT.Documenter; | |
| 29: | using XMarksTheDOT.Documenter.MsdnHelp; | |
| 30: | ||
| 31: | namespace SharpDevelop.Gui.HelpFileGenerator | |
| 32: | { | |
| 33: | /// <summary> | |
| 34: | /// Summary description for Form1. | |
| 35: | /// </summary> | |
| 36: | public class HelpFileGeneratorDialog : System.Windows.Forms.Form | |
| 37: | { | |
| 38: | private System.Windows.Forms.GroupBox groupBox1; | |
| 39: | private System.Windows.Forms.Label label1; | |
| 40: | private System.Windows.Forms.TextBox textBox1; | |
| 41: | private System.Windows.Forms.Button button1; | |
| 42: | private System.Windows.Forms.CheckBox checkBox1; | |
| 43: | private System.Windows.Forms.CheckBox checkBox2; | |
| 44: | private System.Windows.Forms.Button button2; | |
| 45: | private System.Windows.Forms.Button button3; | |
| 46: | private System.Windows.Forms.CheckBox checkBox3; | |
| 47: | private System.Windows.Forms.Label label2; | |
| 48: | private System.Windows.Forms.TextBox textBox2; | |
| 49: | private System.Windows.Forms.Button button4; | |
| 50: | /// <summary> | |
| 51: | /// Required designer variable. | |
| 52: | /// </summary> | |
| 53: | private System.ComponentModel.Container components = null; | |
| 54: | ||
| 55: | Hashtable namespaceSummaries = new Hashtable(); | |
| 56: | ArrayList assemblySlashDocs = new ArrayList(); | |
| 57: | MsdnHelp msdnHelp = new MsdnHelp(); | |
| 58: | MsdnHelpConfig config = new MsdnHelpConfig(); | |
| 59: | IProject project; | |
| 60: | ||
| 61: | void ClickCancel(object sender, EventArgs e) | |
| 62: | { | |
| 63: | Close(); | |
| 64: | } | |
| 65: | void GenerateDocumentation(object sender, EventArgs e) | |
| 66: | { | |
| 67: | if (textBox1.Text.EndsWith(Path.DirectorySeparatorChar.ToString())) { | |
| 68: | textBox1.Text = textBox1.Text.Substring(0, textBox1.Text.Length - 1); | |
| 69: | } | |
| 70: | config.OutputDirectory = textBox1.Text; | |
| 71: | ||
| 72: | try { | |
| 73: | if (!Directory.Exists(config.OutputDirectory)) { | |
| 74: | Directory.CreateDirectory(config.OutputDirectory); | |
| 75: | } | |
| 76: | } catch (Exception) { | |
| 77: | MessageBox.Show("Can't create output directory"); | |
| 78: | return; | |
| 79: | } | |
| 80: | ||
| 81: | config.HtmlHelpName = textBox2.Text; | |
| 82: | ||
| 83: | config.IncludeFavorites = checkBox3.Checked; | |
| 84: | config.DocumentInternalsAndPrivates = checkBox1.Checked; | |
| 85: | config.ShowMissingDocumentation = checkBox2.Checked; | |
| 86: | msdnHelp.Config = config; | |
| 87: | ||
| 88: | if (project.ProjectDocumentation == null || project.ProjectDocumentation.Length == 0) { | |
| 89: | project.ProjectDocumentation = config.OutputDirectory + config.HtmlHelpName + ".chm"; | |
| 90: | } | |
| 91: | ||
| 92: | BuildForm bf = new BuildForm(); | |
| 93: | ||
| 94: | bf.Start(msdnHelp, | |
| 95: | assemblySlashDocs, namespaceSummaries); | |
| 96: | ||
| 97: | bf.Owner = Owner; | |
| 98: | bf.Show(); | |
| 99: | Close(); | |
| 100: | } | |
| 101: | ||
| 102: | public HelpFileGeneratorDialog(IProject project) | |
| 103: | { | |
| 104: | this.project = project; | |
| 105: | InitializeComponent(); | |
| 106: | string outDir = ((SdProjectConfigurationAdapter)project.ActiveConfiguration).OutputDirectory; | |
| 107: | if (!outDir.EndsWith(Path.DirectorySeparatorChar.ToString())) { | |
| 108: | outDir += Path.DirectorySeparatorChar; | |
| 109: | } | |
| 110: | string outAssembly = ((SdProjectConfigurationAdapter)project.ActiveConfiguration).OutputAssembly; | |
| 111: | string filename = outDir + outAssembly; | |
| 112: | string docpath = project.ProjectDocumentation != null ? Path.GetDirectoryName(project.ProjectDocumentation) : ""; | |
| 113: | ||
| 114: | textBox1.Text = (docpath != null && docpath.Length > 0) ? docpath : outDir + "ProjectDocumentation"; | |
| 115: | textBox2.Text = outAssembly; | |
| 116: | ||
| 117: | string helpCompiler = Options.GetProperty("SharpDevelop.Gui.HelpFileGenerator.HtmlHelpCompilerFilename", @"C:\Program Files\HTML Help Workshop\hhc.exe").ToString(); | |
| 118: | ||
| 119: | if (!File.Exists(helpCompiler)) { | |
| 120: | MessageBox.Show("Html help compiler not found.\nSet the help compiler path in the options.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); | |
| 121: | } | |
| 122: | ||
| 123: | config.HtmlHelpCompilerFilename = helpCompiler; | |
| 124: | ||
| 125: | if (File.Exists(filename + ".exe")) { | |
| 126: | filename += ".exe"; | |
| 127: | } else { | |
| 128: | filename += ".dll"; | |
| 129: | } | |
| 130: | assemblySlashDocs.Add(new AssemblySlashDoc(filename, Path.ChangeExtension(filename, ".xml"))); | |
| 131: | // | |
| 132: | // Required for Windows Form Designer support | |
| 133: | //b | |
| 134: | button2.Click += new EventHandler(GenerateDocumentation); | |
| 135: | button3.Click += new EventHandler(ClickCancel); | |
| 136: | } | |
| 137: | ||
| 138: | /// <summary> | |
| 139: | /// Clean up any resources being used. | |
| 140: | /// </summary> | |
| 141: | protected override void Dispose(bool disposing) | |
| 142: | { | |
| 143: | if (disposing) { | |
| 144: | if (components != null){ | |
| 145: | components.Dispose(); | |
| 146: | } | |
| 147: | } | |
| 148: | base.Dispose(disposing); | |
| 149: | } | |
| 150: | ||
| 151: | #region Windows Form Designer generated code | |
| 152: | /// <summary> | |
| 153: | /// Required method for Designer support - do not modify | |
| 154: | /// the contents of this method with the code editor. | |
| 155: | /// </summary> | |
| 156: | private void InitializeComponent() | |
| 157: | { | |
| 158: | this.groupBox1 = new System.Windows.Forms.GroupBox(); | |
| 159: | this.label1 = new System.Windows.Forms.Label(); | |
| 160: | this.textBox1 = new System.Windows.Forms.TextBox(); | |
| 161: | this.button1 = new System.Windows.Forms.Button(); | |
| 162: | this.checkBox1 = new System.Windows.Forms.CheckBox(); | |
| 163: | this.checkBox2 = new System.Windows.Forms.CheckBox(); | |
| 164: | this.button2 = new System.Windows.Forms.Button(); | |
| 165: | this.button3 = new System.Windows.Forms.Button(); | |
| 166: | this.checkBox3 = new System.Windows.Forms.CheckBox(); | |
| 167: | this.label2 = new System.Windows.Forms.Label(); | |
| 168: | this.textBox2 = new System.Windows.Forms.TextBox(); | |
| 169: | this.button4 = new System.Windows.Forms.Button(); | |
| 170: | this.groupBox1.SuspendLayout(); | |
| 171: | this.SuspendLayout(); | |
| 172: | // | |
| 173: | // groupBox1 | |
| 174: | // | |
| 175: | this.groupBox1.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | |
| 176: | | System.Windows.Forms.AnchorStyles.Left) | |
| 177: | | System.Windows.Forms.AnchorStyles.Right); | |
| 178: | this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] { | |
| 179: | this.button4, | |
| 180: | this.textBox2, | |
| 181: | this.label2, | |
| 182: | this.checkBox3, | |
| 183: | this.checkBox2, | |
| 184: | this.checkBox1, | |
| 185: | this.button1, | |
| 186: | this.textBox1, | |
| 187: | this.label1}); | |
| 188: | this.groupBox1.Location = new System.Drawing.Point(8, 8); | |
| 189: | this.groupBox1.Name = "groupBox1"; | |
| 190: | this.groupBox1.Size = new System.Drawing.Size(362, 178); | |
| 191: | this.groupBox1.TabIndex = 0; | |
| 192: | this.groupBox1.TabStop = false; | |
| 193: | this.groupBox1.Text = "Settings"; | |
| 194: | // | |
| 195: | // label1 | |
| 196: | // | |
| 197: | this.label1.Location = new System.Drawing.Point(8, 16); | |
| 198: | this.label1.Name = "label1"; | |
| 199: | this.label1.Size = new System.Drawing.Size(104, 16); | |
| 200: | this.label1.TabIndex = 0; | |
| 201: | this.label1.Text = "Output Directory"; | |
| 202: | // | |
| 203: | // textBox1 | |
| 204: | // | |
| 205: | this.textBox1.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | |
| 206: | | System.Windows.Forms.AnchorStyles.Left) | |
| 207: | | System.Windows.Forms.AnchorStyles.Right); | |
| 208: | this.textBox1.Location = new System.Drawing.Point(112, 16); | |
| 209: | this.textBox1.Name = "textBox1"; | |
| 210: | this.textBox1.Size = new System.Drawing.Size(210, 20); | |
| 211: | this.textBox1.TabIndex = 1; | |
| 212: | this.textBox1.Text = ""; | |
| 213: | // | |
| 214: | // button1 | |
| 215: | // | |
| 216: | this.button1.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right); | |
| 217: | this.button1.Location = new System.Drawing.Point(330, 16); | |
| 218: | this.button1.Name = "button1"; | |
| 219: | this.button1.Size = new System.Drawing.Size(24, 23); | |
| 220: | this.button1.TabIndex = 2; | |
| 221: | this.button1.Text = "..."; | |
| 222: | // | |
| 223: | // checkBox1 | |
| 224: | // | |
| 225: | this.checkBox1.Anchor = ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | |
| 226: | | System.Windows.Forms.AnchorStyles.Right); | |
| 227: | this.checkBox1.Location = new System.Drawing.Point(8, 122); | |
| 228: | this.checkBox1.Name = "checkBox1"; | |
| 229: | this.checkBox1.Size = new System.Drawing.Size(346, 24); | |
| 230: | this.checkBox1.TabIndex = 3; | |
| 231: | this.checkBox1.Text = "Document Internals and Privates"; | |
| 232: | // | |
| 233: | // checkBox2 | |
| 234: | // | |
| 235: | this.checkBox2.Anchor = ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | |
| 236: | | System.Windows.Forms.AnchorStyles.Right); | |
| 237: | this.checkBox2.Location = new System.Drawing.Point(8, 146); | |
| 238: | this.checkBox2.Name = "checkBox2"; | |
| 239: | this.checkBox2.Size = new System.Drawing.Size(346, 24); | |
| 240: | this.checkBox2.TabIndex = 4; | |
| 241: | this.checkBox2.Text = "Show missing Documentation"; | |
| 242: | // | |
| 243: | // button2 | |
| 244: | // | |
| 245: | this.button2.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right); | |
| 246: | this.button2.Location = new System.Drawing.Point(216, 194); | |
| 247: | this.button2.Name = "button2"; | |
| 248: | this.button2.Size = new System.Drawing.Size(74, 24); | |
| 249: | this.button2.TabIndex = 1; | |
| 250: | this.button2.Text = "Generate"; | |
| 251: | // | |
| 252: | // button3 | |
| 253: | // | |
| 254: | this.button3.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right); | |
| 255: | this.button3.DialogResult = System.Windows.Forms.DialogResult.Cancel; | |
| 256: | this.button3.Location = new System.Drawing.Point(296, 194); | |
| 257: | this.button3.Name = "button3"; | |
| 258: | this.button3.TabIndex = 2; | |
| 259: | this.button3.Text = "Cancel"; | |
| 260: | // | |
| 261: | // checkBox3 | |
| 262: | // | |
| 263: | this.checkBox3.Anchor = ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | |
| 264: | | System.Windows.Forms.AnchorStyles.Right); | |
| 265: | this.checkBox3.Location = new System.Drawing.Point(8, 98); | |
| 266: | this.checkBox3.Name = "checkBox3"; | |
| 267: | this.checkBox3.Size = new System.Drawing.Size(346, 24); | |
| 268: | this.checkBox3.TabIndex = 5; | |
| 269: | this.checkBox3.Text = "Include Favorites"; | |
| 270: | // | |
| 271: | // label2 | |
| 272: | // | |
| 273: | this.label2.Location = new System.Drawing.Point(8, 40); | |
| 274: | this.label2.Name = "label2"; | |
| 275: | this.label2.Size = new System.Drawing.Size(104, 16); | |
| 276: | this.label2.TabIndex = 6; | |
| 277: | this.label2.Text = "Html Help Name"; | |
| 278: | // | |
| 279: | // textBox2 | |
| 280: | // | |
| 281: | this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | |
| 282: | | System.Windows.Forms.AnchorStyles.Right); | |
| 283: | this.textBox2.Location = new System.Drawing.Point(112, 40); | |
| 284: | this.textBox2.Name = "textBox2"; | |
| 285: | this.textBox2.Size = new System.Drawing.Size(210, 20); | |
| 286: | this.textBox2.TabIndex = 7; | |
| 287: | this.textBox2.Text = ""; | |
| 288: | // | |
| 289: | // button4 | |
| 290: | // | |
| 291: | this.button4.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right); | |
| 292: | this.button4.Location = new System.Drawing.Point(274,& |