diff --git a/CSharp/Engines/WindowsForms/Engines/UniversalEditor.Engines.WindowsForms/WindowsFormsEngine.cs b/CSharp/Engines/WindowsForms/Engines/UniversalEditor.Engines.WindowsForms/WindowsFormsEngine.cs index 7eb1f1b0..8ce8178e 100644 --- a/CSharp/Engines/WindowsForms/Engines/UniversalEditor.Engines.WindowsForms/WindowsFormsEngine.cs +++ b/CSharp/Engines/WindowsForms/Engines/UniversalEditor.Engines.WindowsForms/WindowsFormsEngine.cs @@ -183,12 +183,14 @@ namespace UniversalEditor.Engines.WindowsForms // AwesomeControls.Theming.BuiltinThemes.OfficeXPTheme theme = new AwesomeControls.Theming.BuiltinThemes.OfficeXPTheme(); // AwesomeControls.Theming.BuiltinThemes.SlickTheme theme = new AwesomeControls.Theming.BuiltinThemes.SlickTheme(); + // Office 2000 = {105843D0-2F26-4CB7-86AB-10A449815C19} // Office 2007 = {4D86F538-E277-4E6F-9CAC-60F82D49A19D} // VS2012-Dark = {25134C94-B1EB-4C38-9B5B-A2E29FC57AE1} // VS2012-Light = {54CE64B1-2DE3-4147-B499-03F0934AFD37} // VS2012-Blue = {898A65FC-8D08-46F1-BB94-2BF666AC996E} - AwesomeControls.Theming.Theme theme = AwesomeControls.Theming.Theme.GetByID(new Guid("{54CE64B1-2DE3-4147-B499-03F0934AFD37}")); + // AwesomeControls.Theming.Theme theme = AwesomeControls.Theming.Theme.GetByID(new Guid("{54CE64B1-2DE3-4147-B499-03F0934AFD37}")); + AwesomeControls.Theming.Theme theme = AwesomeControls.Theming.Theme.GetByID(new Guid("{105843D0-2F26-4CB7-86AB-10A449815C19}")); if (theme != null) AwesomeControls.Theming.Theme.CurrentTheme = theme; // AwesomeControls.Theming.Theme.CurrentTheme.Properties["UseAllCapsMenus"] = false; diff --git a/CSharp/Engines/WindowsForms/Libraries/UniversalEditor.UserInterface.WindowsForms/Editors/Help/TableOfContentsEditor.Designer.cs b/CSharp/Engines/WindowsForms/Libraries/UniversalEditor.UserInterface.WindowsForms/Editors/Help/TableOfContentsEditor.Designer.cs new file mode 100644 index 00000000..6e14337c --- /dev/null +++ b/CSharp/Engines/WindowsForms/Libraries/UniversalEditor.UserInterface.WindowsForms/Editors/Help/TableOfContentsEditor.Designer.cs @@ -0,0 +1,59 @@ +namespace UniversalEditor.Editors.Help +{ + partial class TableOfContentsEditor + { + /// + /// 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.tv = new System.Windows.Forms.TreeView(); + this.SuspendLayout(); + // + // tv + // + this.tv.Dock = System.Windows.Forms.DockStyle.Fill; + this.tv.Location = new System.Drawing.Point(0, 0); + this.tv.Name = "tv"; + this.tv.Size = new System.Drawing.Size(388, 319); + this.tv.TabIndex = 0; + this.tv.AfterCollapse += new System.Windows.Forms.TreeViewEventHandler(this.tv_AfterCollapse); + this.tv.AfterExpand += new System.Windows.Forms.TreeViewEventHandler(this.tv_AfterExpand); + // + // TableOfContentsEditor + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.tv); + this.Name = "TableOfContentsEditor"; + this.Size = new System.Drawing.Size(388, 319); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TreeView tv; + } +} diff --git a/CSharp/Engines/WindowsForms/Libraries/UniversalEditor.UserInterface.WindowsForms/Editors/Help/TableOfContentsEditor.cs b/CSharp/Engines/WindowsForms/Libraries/UniversalEditor.UserInterface.WindowsForms/Editors/Help/TableOfContentsEditor.cs new file mode 100644 index 00000000..8be070b9 --- /dev/null +++ b/CSharp/Engines/WindowsForms/Libraries/UniversalEditor.UserInterface.WindowsForms/Editors/Help/TableOfContentsEditor.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +using UniversalEditor.ObjectModels.Help.TableOfContents; +using UniversalEditor.UserInterface.WindowsForms; + +namespace UniversalEditor.Editors.Help +{ + public partial class TableOfContentsEditor : Editor + { + public TableOfContentsEditor() + { + InitializeComponent(); + tv.ImageList = SmallImageList; + } + + protected override void OnObjectModelChanged(EventArgs e) + { + base.OnObjectModelChanged(e); + + tv.Nodes.Clear(); + + TableOfContentsObjectModel toc = (ObjectModel as TableOfContentsObjectModel); + if (toc == null) return; + + foreach (TOCNode node in toc.Nodes) + { + LoadTOCNode(node, null); + } + } + + private void LoadTOCNode(TOCNode node, TreeNode parentTreeNode) + { + TreeNode treeNode = new TreeNode(); + treeNode.Text = node.Title; + treeNode.Tag = node; + + treeNode.ImageKey = "generic-book-closed"; + treeNode.SelectedImageKey = "generic-book-closed"; + + foreach (TOCNode node1 in node.Nodes) + { + LoadTOCNode(node1, treeNode); + } + + if (parentTreeNode == null) + { + tv.Nodes.Add(treeNode); + } + else + { + parentTreeNode.Nodes.Add(treeNode); + } + } + + private void tv_AfterCollapse(object sender, TreeViewEventArgs e) + { + if (e.Node == null) return; + if (e.Node.ImageKey == "generic-book-open") + { + e.Node.ImageKey = "generic-book-closed"; + } + } + + private void tv_AfterExpand(object sender, TreeViewEventArgs e) + { + if (e.Node == null) return; + if (e.Node.ImageKey == "generic-book-closed") + { + e.Node.ImageKey = "generic-book-open"; + } + } + } +} diff --git a/CSharp/Engines/WindowsForms/Libraries/UniversalEditor.UserInterface.WindowsForms/Editors/Help/TableOfContentsEditor.resx b/CSharp/Engines/WindowsForms/Libraries/UniversalEditor.UserInterface.WindowsForms/Editors/Help/TableOfContentsEditor.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/CSharp/Engines/WindowsForms/Libraries/UniversalEditor.UserInterface.WindowsForms/Editors/Help/TableOfContentsEditor.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/CSharp/Engines/WindowsForms/Libraries/UniversalEditor.UserInterface.WindowsForms/UniversalEditor.UserInterface.WindowsForms.csproj b/CSharp/Engines/WindowsForms/Libraries/UniversalEditor.UserInterface.WindowsForms/UniversalEditor.UserInterface.WindowsForms.csproj index 6ca21318..b15084a3 100644 --- a/CSharp/Engines/WindowsForms/Libraries/UniversalEditor.UserInterface.WindowsForms/UniversalEditor.UserInterface.WindowsForms.csproj +++ b/CSharp/Engines/WindowsForms/Libraries/UniversalEditor.UserInterface.WindowsForms/UniversalEditor.UserInterface.WindowsForms.csproj @@ -104,6 +104,12 @@ FormattedTextEditor.cs + + UserControl + + + TableOfContentsEditor.cs + UserControl @@ -203,6 +209,9 @@ FormattedTextEditor.cs + + TableOfContentsEditor.cs + MarkupEditor.cs diff --git a/CSharp/Libraries/UniversalEditor.Essential/ObjectModels/Help/TableOfContents/TOCNode.cs b/CSharp/Libraries/UniversalEditor.Essential/ObjectModels/Help/TableOfContents/TOCNode.cs new file mode 100644 index 00000000..3fcf967b --- /dev/null +++ b/CSharp/Libraries/UniversalEditor.Essential/ObjectModels/Help/TableOfContents/TOCNode.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace UniversalEditor.ObjectModels.Help.TableOfContents +{ + public class TOCNode + { + public class TOCNodeCollection + : System.Collections.ObjectModel.Collection + { + + } + + private string mvarLocation = String.Empty; + /// + /// The location of the Help topic pointed to by this . + /// + public string Location { get { return mvarLocation; } set { mvarLocation = value; } } + + private string mvarTitle = String.Empty; + /// + /// The title of the Help topic pointed to by this . + /// + public string Title { get { return mvarTitle; } set { mvarTitle = value; } } + + private TOCNode.TOCNodeCollection mvarNodes = new TOCNode.TOCNodeCollection(); + public TOCNode.TOCNodeCollection Nodes { get { return mvarNodes; } } + } +} diff --git a/CSharp/Libraries/UniversalEditor.Essential/ObjectModels/Help/TableOfContents/TableOfContentsObjectModel.cs b/CSharp/Libraries/UniversalEditor.Essential/ObjectModels/Help/TableOfContents/TableOfContentsObjectModel.cs new file mode 100644 index 00000000..a93975dc --- /dev/null +++ b/CSharp/Libraries/UniversalEditor.Essential/ObjectModels/Help/TableOfContents/TableOfContentsObjectModel.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace UniversalEditor.ObjectModels.Help.TableOfContents +{ + public class TableOfContentsObjectModel : ObjectModel + { + private static ObjectModelReference _omr = null; + protected override ObjectModelReference MakeReferenceInternal() + { + if (_omr == null) + { + _omr = base.MakeReferenceInternal(); + _omr.Title = "Table of Contents"; + _omr.Path = new string[] { "Help", "Table of Contents" }; + } + return _omr; + } + + private TOCNode.TOCNodeCollection mvarNodes = new TOCNode.TOCNodeCollection(); + public TOCNode.TOCNodeCollection Nodes { get { return mvarNodes; } } + + public override void Clear() + { + mvarNodes.Clear(); + } + + public override void CopyTo(ObjectModel where) + { + TableOfContentsObjectModel clone = (where as TableOfContentsObjectModel); + if (where == null) throw new ObjectModelNotSupportedException(); + + foreach (TOCNode node in mvarNodes) + { + clone.Nodes.Add(node); + } + } + } +} diff --git a/CSharp/Libraries/UniversalEditor.Essential/UniversalEditor.Essential.csproj b/CSharp/Libraries/UniversalEditor.Essential/UniversalEditor.Essential.csproj index fbd74b58..36c33f73 100644 --- a/CSharp/Libraries/UniversalEditor.Essential/UniversalEditor.Essential.csproj +++ b/CSharp/Libraries/UniversalEditor.Essential/UniversalEditor.Essential.csproj @@ -105,6 +105,8 @@ + + diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Help/TableOfContents/V3/H1TDataFormat.cs b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Help/TableOfContents/V3/H1TDataFormat.cs new file mode 100644 index 00000000..ded3628f --- /dev/null +++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/DataFormats/Help/TableOfContents/V3/H1TDataFormat.cs @@ -0,0 +1,111 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using UniversalEditor.DataFormats.Markup.XML; +using UniversalEditor.ObjectModels.Help.TableOfContents; +using UniversalEditor.ObjectModels.Markup; + +namespace UniversalEditor.DataFormats.Help.TableOfContents.V3 +{ + public class H1TDataFormat : XMLDataFormat + { + private static DataFormatReference _dfr = null; + protected override DataFormatReference MakeReferenceInternal() + { + if (_dfr == null) + { + _dfr = new DataFormatReference(GetType()); + _dfr.Capabilities.Add(typeof(TableOfContentsObjectModel), DataFormatCapabilities.All); + } + return _dfr; + } + + protected override void BeforeLoadInternal(Stack objectModels) + { + base.BeforeLoadInternal(objectModels); + objectModels.Push(new MarkupObjectModel()); + } + protected override void AfterLoadInternal(Stack objectModels) + { + base.AfterLoadInternal(objectModels); + + MarkupObjectModel mom = (objectModels.Pop() as MarkupObjectModel); + + TableOfContentsObjectModel toc = (objectModels.Pop() as TableOfContentsObjectModel); + if (toc == null) throw new ObjectModelNotSupportedException(); + + MarkupTagElement tagHelpTOC = (mom.Elements["HelpTOC"] as MarkupTagElement); + if (tagHelpTOC == null) throw new InvalidDataFormatException("File does not begin with top-level 'HelpTOC' element"); + + foreach (MarkupElement elNode in tagHelpTOC.Elements) + { + MarkupTagElement tagNode = (elNode as MarkupTagElement); + if (tagNode == null) continue; + if (tagNode.FullName != "HelpTOCNode") continue; + + LoadHelpTOCNode(tagNode, toc.Nodes); + } + } + + protected override void BeforeSaveInternal(Stack objectModels) + { + base.BeforeSaveInternal(objectModels); + + TableOfContentsObjectModel toc = (objectModels.Pop() as TableOfContentsObjectModel); + if (toc == null) throw new ObjectModelNotSupportedException(); + + MarkupObjectModel mom = new MarkupObjectModel(); + + MarkupTagElement tagHelpTOC = new MarkupTagElement(); + tagHelpTOC.FullName = "HelpTOC"; + + foreach (TOCNode node in toc.Nodes) + { + SaveHelpTOCNode(node, tagHelpTOC); + } + + mom.Elements.Add(tagHelpTOC); + + objectModels.Push(mom); + } + + private void LoadHelpTOCNode(MarkupTagElement tag, TOCNode.TOCNodeCollection coll) + { + TOCNode node = new TOCNode(); + + MarkupAttribute attUrl = tag.Attributes["Url"]; + if (attUrl != null) node.Location = attUrl.Value; + + MarkupAttribute attTitle = tag.Attributes["Title"]; + if (attTitle != null) node.Location = attTitle.Value; + + foreach (MarkupElement el1 in tag.Elements) + { + MarkupTagElement tag1 = (el1 as MarkupTagElement); + if (tag1 == null) continue; + if (tag1.FullName != "HelpTOCNode") continue; + + LoadHelpTOCNode(tag1, node.Nodes); + } + + coll.Add(node); + } + + private void SaveHelpTOCNode(TOCNode node, MarkupTagElement tag) + { + MarkupTagElement tag1 = new MarkupTagElement(); + tag1.FullName = "HelpTOCNode"; + tag1.Attributes.Add("Url", node.Location); + tag1.Attributes.Add("Title", node.Title); + + foreach (TOCNode node1 in node.Nodes) + { + SaveHelpTOCNode(node1, tag1); + } + + tag.Elements.Add(tag1); + } + } +} diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/UniversalEditor.Plugins.Microsoft.csproj b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/UniversalEditor.Plugins.Microsoft.csproj index 1bfa6c6b..d2d686de 100644 --- a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/UniversalEditor.Plugins.Microsoft.csproj +++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/UniversalEditor.Plugins.Microsoft.csproj @@ -60,6 +60,7 @@ + diff --git a/CSharp/Plugins/UniversalEditor.Plugins.NewWorldComputing/UniversalEditor.Plugins.NewWorldComputing.csproj b/CSharp/Plugins/UniversalEditor.Plugins.NewWorldComputing/UniversalEditor.Plugins.NewWorldComputing.csproj index ccaa9fb6..f58a078f 100644 --- a/CSharp/Plugins/UniversalEditor.Plugins.NewWorldComputing/UniversalEditor.Plugins.NewWorldComputing.csproj +++ b/CSharp/Plugins/UniversalEditor.Plugins.NewWorldComputing/UniversalEditor.Plugins.NewWorldComputing.csproj @@ -52,9 +52,6 @@ - - - @@ -106,7 +103,9 @@ - + + +