Update of /cvsroot/jcframework/FrameworkMapper/WinFormsUI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5004/WinFormsUI Added Files: AssemblyInfo.cs AutoHideWindow.cs AutoHideWindowSplitter.cs DisplayingDockList.cs DockAreasEditor.cs DockContent.cs DockContent.resx DockContentCollection.cs DockHelper.cs DockList.cs DockPane.cs DockPaneCollection.cs DockPaneSplitter.cs DockPaneSplitter.resx DockPanel.cs DockPanelPersist.cs DockWindow.cs DockWindowCollection.cs DockWindowSplitter.cs DragHandler.cs DragHandlerBase.cs DrawHelper.cs DummyControl.cs Enums.cs EventArgs.cs FloatWindow.cs FloatWindow.resx FloatWindowCollection.cs HiddenMdiChild.cs InertButton.cs InertButton.resx Interfaces.cs LocalWindowsHook.cs Localization.cs Measures.cs NestedDockingStatus.cs ResourceHelper.cs SplitterBase.cs Strings.resX WinFormsUI.csproj Log Message: Major update to incorporate CodeSmith scripts, and integration with WinMerge for viewing differences. --- NEW FILE: DockList.cs --- // ***************************************************************************** // // Copyright 2004, Weifen Luo // All rights reserved. The software and associated documentation // supplied hereunder are the proprietary information of Weifen Luo // and are supplied subject to licence terms. // // WinFormsUI Library Version 1.0 // ***************************************************************************** using System; using System.Collections; using System.Drawing; namespace WeifenLuo.WinFormsUI { public class DockList : ReadOnlyCollectionBase { private IDockListContainer m_container; private DisplayingDockList m_displayingList; internal DockList(IDockListContainer container) { m_container = container; m_displayingList = new DisplayingDockList(this); } public IDockListContainer Container { get { return m_container; } } internal DisplayingDockList DisplayingList { get { return m_displayingList; } } public DockState DockState { get { return Container.DockState; } } public bool IsFloat { get { return DockState == DockState.Float; } } public bool Contains(DockPane pane) { return InnerList.Contains(pane); } public int IndexOf(DockPane pane) { return InnerList.IndexOf(pane); } public DockPane this[int index] { get { return InnerList[index] as DockPane; } } internal void Add(DockPane pane) { InnerList.Add(pane); } internal void Remove(DockPane pane) { if (!Contains(pane)) return; NestedDockingStatus statusPane = pane.GetNestedDockingStatus(IsFloat); DockPane lastNestedPane = null; for (int i=Count - 1; i> IndexOf(pane); i--) { if (this[i].GetNestedDockingStatus(IsFloat).PrevPane == pane) { lastNestedPane = this[i]; break; } } if (lastNestedPane != null) { int indexLastNestedPane = IndexOf(lastNestedPane); InnerList.Remove(lastNestedPane); InnerList[IndexOf(pane)] = lastNestedPane; NestedDockingStatus lastNestedDock = lastNestedPane.GetNestedDockingStatus(IsFloat); lastNestedDock.SetStatus(this, statusPane.PrevPane, statusPane.Alignment, statusPane.Proportion); for (int i=indexLastNestedPane - 1; i>IndexOf(lastNestedPane); i--) { NestedDockingStatus status = this[i].GetNestedDockingStatus(IsFloat); if (status.PrevPane == pane) status.SetStatus(this, lastNestedPane, status.Alignment, status.Proportion); } } else InnerList.Remove(pane); statusPane.SetStatus(null, null, DockAlignment.Left, 0.5); statusPane.SetDisplayingStatus(false, null, DockAlignment.Left, 0.5); statusPane.SetDisplayingBounds(Rectangle.Empty, Rectangle.Empty, Rectangle.Empty); } } } --- NEW FILE: DockAreasEditor.cs --- // ***************************************************************************** // // Copyright 2004, Weifen Luo // All rights reserved. The software and associated documentation // supplied hereunder are the proprietary information of Weifen Luo // and are supplied subject to licence terms. // // WinFormsUI Library Version 1.0 // ***************************************************************************** using System; using System.ComponentModel; using System.Drawing; using System.Drawing.Design; using System.Windows.Forms; using System.Windows.Forms.Design; namespace WeifenLuo.WinFormsUI { internal class DockAreasEditor : UITypeEditor { /// <summary> /// Summary description for DockAreasEditorControl. /// </summary> private class DockAreasEditorControl : System.Windows.Forms.UserControl { private IWindowsFormsEditorService m_edSvc; private CheckBox checkBoxFloat; private CheckBox checkBoxDockLeft; private CheckBox checkBoxDockRight; private CheckBox checkBoxDockTop; private CheckBox checkBoxDockBottom; private CheckBox checkBoxDockFill; private DockAreas m_oldDockAreas; public DockAreas DockAreas { get { DockAreas dockAreas = 0; if (checkBoxFloat.Checked) dockAreas |= DockAreas.Float; if (checkBoxDockLeft.Checked) dockAreas |= DockAreas.DockLeft; if (checkBoxDockRight.Checked) dockAreas |= DockAreas.DockRight; if (checkBoxDockTop.Checked) dockAreas |= DockAreas.DockTop; if (checkBoxDockBottom.Checked) dockAreas |= DockAreas.DockBottom; if (checkBoxDockFill.Checked) dockAreas |= DockAreas.Document; if (dockAreas == 0) return m_oldDockAreas; else return dockAreas; } } public DockAreasEditorControl() { checkBoxFloat = new CheckBox(); checkBoxDockLeft = new CheckBox(); checkBoxDockRight = new CheckBox(); checkBoxDockTop = new CheckBox(); checkBoxDockBottom = new CheckBox(); checkBoxDockFill = new CheckBox(); SuspendLayout(); checkBoxFloat.Appearance = Appearance.Button; checkBoxFloat.Dock = DockStyle.Top; checkBoxFloat.Height = 24; checkBoxFloat.Text = "(Float)"; checkBoxFloat.TextAlign = ContentAlignment.MiddleCenter; checkBoxFloat.FlatStyle = FlatStyle.System; checkBoxDockLeft.Appearance = System.Windows.Forms.Appearance.Button; checkBoxDockLeft.Dock = System.Windows.Forms.DockStyle.Left; checkBoxDockLeft.Width = 24; checkBoxDockLeft.FlatStyle = FlatStyle.System; checkBoxDockRight.Appearance = System.Windows.Forms.Appearance.Button; checkBoxDockRight.Dock = System.Windows.Forms.DockStyle.Right; checkBoxDockRight.Width = 24; checkBoxDockRight.FlatStyle = FlatStyle.System; checkBoxDockTop.Appearance = System.Windows.Forms.Appearance.Button; checkBoxDockTop.Dock = System.Windows.Forms.DockStyle.Top; checkBoxDockTop.Height = 24; checkBoxDockTop.FlatStyle = FlatStyle.System; checkBoxDockBottom.Appearance = System.Windows.Forms.Appearance.Button; checkBoxDockBottom.Dock = System.Windows.Forms.DockStyle.Bottom; checkBoxDockBottom.Height = 24; checkBoxDockBottom.FlatStyle = FlatStyle.System; checkBoxDockFill.Appearance = System.Windows.Forms.Appearance.Button; checkBoxDockFill.Dock = System.Windows.Forms.DockStyle.Fill; checkBoxDockFill.FlatStyle = FlatStyle.System; this.Controls.AddRange(new Control[] { checkBoxDockFill, checkBoxDockBottom, checkBoxDockTop, checkBoxDockRight, checkBoxDockLeft, checkBoxFloat}); Size = new System.Drawing.Size(160, 144); BackColor = SystemColors.Control; ResumeLayout(false); } public void SetStates(IWindowsFormsEditorService edSvc, DockAreas dockAreas) { m_edSvc = edSvc; m_oldDockAreas = dockAreas; if ((dockAreas & DockAreas.DockLeft) != 0) checkBoxDockLeft.Checked = true; if ((dockAreas & DockAreas.DockRight) != 0) checkBoxDockRight.Checked = true; if ((dockAreas & DockAreas.DockTop) != 0) checkBoxDockTop.Checked = true; if ((dockAreas & DockAreas.DockTop) != 0) checkBoxDockTop.Checked = true; if ((dockAreas & DockAreas.DockBottom) != 0) checkBoxDockBottom.Checked = true; if ((dockAreas & DockAreas.Document) != 0) checkBoxDockFill.Checked = true; if ((dockAreas & DockAreas.Float) != 0) checkBoxFloat.Checked = true; } } private DockAreasEditor.DockAreasEditorControl m_ui = null; public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) { return UITypeEditorEditStyle.DropDown; } public override object EditValue(ITypeDescriptorContext context, IServiceProvider sp, object value) { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)sp.GetService(typeof(IWindowsFormsEditorService)); if (m_ui == null) m_ui = new DockAreasEditor.DockAreasEditorControl(); m_ui.SetStates(edSvc, (DockAreas)value); edSvc.DropDownControl(m_ui); return m_ui.DockAreas; } } } --- NEW FILE: DockPane.cs --- // ***************************************************************************** // // Copyright 2004, Weifen Luo // All rights reserved. The software and associated documentation // supplied hereunder are the proprietary information of Weifen Luo // and are supplied subject to licence terms. // // WinFormsUI Library Version 1.0 // ***************************************************************************** using System; using System.ComponentModel; using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms; using System.Runtime.InteropServices; namespace WeifenLuo.WinFormsUI { [...1859 lines suppressed...] if (container.DockState == DockState.Float && container.DockList.Count == 0) ((FloatWindow)container).Close(); else ((Control)container).PerformLayout(); } public void SetNestedDockingProportion(double proportion) { SetNestedDockingProportion(proportion, DockState == DockState.Float); } public void SetNestedDockingProportion(double proportion, bool isFloat) { NestedDockingStatus status = this.GetNestedDockingStatus(isFloat); status.SetStatus(status.DockList, status.PrevPane, status.Alignment, proportion); if ((this.DockState == DockState.Float) == isFloat) ((Control)this.DockListContainer).PerformLayout(); } } } --- NEW FILE: DockContent.resx --- <?xml version="1.0" encoding="utf-8" ?> <root> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:element name="root" msdata:IsDataSet="true"> <xsd:complexType> <xsd:choice maxOccurs="unbounded"> <xsd:element name="data"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="mimetype" type="xsd:string" /> </xsd:complexType> </xsd:element> <xsd:element name="resheader"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required" /> </xsd:complexType> </xsd:element> </xsd:choice> </xsd:complexType> </xsd:element> </xsd:schema> <resheader name="ResMimeType"> <value>text/microsoft-resx</value> </resheader> <resheader name="Version"> <value>1.0.0.0</value> </resheader> <resheader name="Reader"> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="Writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> </root> --- NEW FILE: DockWindowCollection.cs --- // ***************************************************************************** // // Copyright 2004, Weifen Luo // All rights reserved. The software and associated documentation // supplied hereunder are the proprietary information of Weifen Luo // and are supplied subject to licence terms. // // WinFormsUI Library Version 1.0 // ***************************************************************************** using System; using System.Collections; namespace WeifenLuo.WinFormsUI { public class DockWindowCollection : ReadOnlyCollectionBase { internal DockWindowCollection(DockPanel dockPanel) { InnerList.Add(new DockWindow(dockPanel, DockState.Document)); InnerList.Add(new DockWindow(dockPanel, DockState.DockLeft)); InnerList.Add(new DockWindow(dockPanel, DockState.DockRight)); InnerList.Add(new DockWindow(dockPanel, DockState.DockTop)); InnerList.Add(new DockWindow(dockPanel, DockState.DockBottom)); } public DockWindow this [DockState dockState] { get { if (dockState == DockState.Document) return InnerList[0] as DockWindow; else if (dockState == DockState.DockLeft) return InnerList[1] as DockWindow; else if (dockState == DockState.DockRight) return InnerList[2] as DockWindow; else if (dockState == DockState.DockTop) return InnerList[3] as DockWindow; else if (dockState == DockState.DockBottom) return InnerList[4] as DockWindow; throw (new ArgumentOutOfRangeException()); } } } } --- NEW FILE: DummyControl.cs --- using System; using System.Windows.Forms; namespace WeifenLuo.WinFormsUI { internal class DummyControl : Control { public DummyControl() { SetStyle(ControlStyles.Selectable, false); } } } --- NEW FILE: WinFormsUI.csproj --- <VisualStudioProject> <CSHARP ProjectType = "Local" ProductVersion = "7.10.3077" SchemaVersion = "2.0" ProjectGuid = "{D3C782BA-178E-4235-A3BA-8C11DEBB6BEE}" > <Build> <Settings ApplicationIcon = "" AssemblyKeyContainerName = "" AssemblyName = "WeifenLuo.WinFormsUI" AssemblyOriginatorKeyFile = "" DefaultClientScript = "JScript" DefaultHTMLPageLayout = "Grid" DefaultTargetSchema = "IE50" DelaySign = "false" OutputType = "Library" PreBuildEvent = "" PostBuildEvent = "" RootNamespace = "WeifenLuo.WinFormsUI" RunPostBuildEvent = "OnBuildSuccess" StartupObject = "" > <Config Name = "Debug" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "DEBUG;TRACE" DocumentationFile = "" DebugSymbols = "true" FileAlignment = "4096" IncrementalBuild = "true" NoStdLib = "false" NoWarn = "" Optimize = "false" OutputPath = "bin\Debug\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> <Config Name = "Release" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "TRACE" DocumentationFile = "" DebugSymbols = "false" FileAlignment = "4096" IncrementalBuild = "false" NoStdLib = "false" NoWarn = "" Optimize = "true" OutputPath = "bin\Release\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> </Settings> <References> <Reference Name = "System" AssemblyName = "System" HintPath = "..\..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.dll" /> <Reference Name = "System.XML" AssemblyName = "System.Xml" HintPath = "..\..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.XML.dll" /> <Reference Name = "System.Drawing" AssemblyName = "System.Drawing" HintPath = "..\..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Drawing.dll" /> <Reference Name = "System.Windows.Forms" AssemblyName = "System.Windows.Forms" HintPath = "..\..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.dll" /> <Reference Name = "System.Design" AssemblyName = "System.Design" HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Design.dll" /> <Reference Name = "System.Data" AssemblyName = "System.Data" HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll" /> </References> </Build> <Files> <Include> <File RelPath = "AssemblyInfo.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "AutoHideWindow.cs" SubType = "Component" BuildAction = "Compile" /> <File RelPath = "AutoHideWindowSplitter.cs" SubType = "Component" BuildAction = "Compile" /> <File RelPath = "DisplayingDockList.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "DockAreasEditor.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "DockContent.cs" SubType = "Form" BuildAction = "Compile" /> <File RelPath = "DockContent.resx" DependentUpon = "DockContent.cs" BuildAction = "EmbeddedResource" /> <File RelPath = "DockContentCollection.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "DockHelper.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "DockList.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "DockPane.cs" SubType = "UserControl" BuildAction = "Compile" /> <File RelPath = "DockPaneCollection.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "DockPanel.cs" SubType = "Component" BuildAction = "Compile" /> <File RelPath = "DockPanelPersist.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "DockPaneSplitter.cs" SubType = "Component" BuildAction = "Compile" /> <File RelPath = "DockPaneSplitter.resx" DependentUpon = "DockPaneSplitter.cs" BuildAction = "EmbeddedResource" /> <File RelPath = "DockWindow.cs" SubType = "Component" BuildAction = "Compile" /> <File RelPath = "DockWindowCollection.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "DockWindowSplitter.cs" SubType = "Component" BuildAction = "Compile" /> <File RelPath = "DragHandler.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "DragHandlerBase.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "DrawHelper.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "DummyControl.cs" SubType = "Component" BuildAction = "Compile" /> <File RelPath = "Enums.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "EventArgs.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "FloatWindow.cs" SubType = "Form" BuildAction = "Compile" /> <File RelPath = "FloatWindow.resx" DependentUpon = "FloatWindow.cs" BuildAction = "EmbeddedResource" /> <File RelPath = "FloatWindowCollection.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "HiddenMdiChild.cs" SubType = "Form" BuildAction = "Compile" /> <File RelPath = "InertButton.cs" SubType = "Component" BuildAction = "Compile" /> <File RelPath = "InertButton.resx" DependentUpon = "InertButton.cs" BuildAction = "EmbeddedResource" /> <File RelPath = "Interfaces.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Localization.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "LocalWindowsHook.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Measures.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "NestedDockingStatus.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "ResourceHelper.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "SplitterBase.cs" SubType = "Component" BuildAction = "Compile" /> <File RelPath = "Strings.resX" BuildAction = "EmbeddedResource" /> <File RelPath = "Resources\DockPane.AutoHideNo.bmp" BuildAction = "EmbeddedResource" /> <File RelPath = "Resources\DockPane.AutoHideYes.bmp" BuildAction = "EmbeddedResource" /> <File RelPath = "Resources\DockPane.DocumentCloseDisabled.bmp" BuildAction = "EmbeddedResource" /> <File RelPath = "Resources\DockPane.DocumentCloseEnabled.bmp" BuildAction = "EmbeddedResource" /> <File RelPath = "Resources\DockPane.ScrollLeftDisabled.bmp" BuildAction = "EmbeddedResource" /> <File RelPath = "Resources\DockPane.ScrollLeftEnabled.bmp" BuildAction = "EmbeddedResource" /> <File RelPath = "Resources\DockPane.ScrollRightDisabled.bmp" BuildAction = "EmbeddedResource" /> <File RelPath = "Resources\DockPane.ScrollRightEnabled.bmp" BuildAction = "EmbeddedResource" /> <File RelPath = "Resources\DockPane.ToolWindowCloseDisabled.bmp" BuildAction = "EmbeddedResource" /> <File RelPath = "Resources\DockPane.ToolWindowCloseEnabled.bmp" BuildAction = "EmbeddedResource" /> <File RelPath = "Win32\Enums.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Win32\Gdi32.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Win32\Structs.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Win32\User32.cs" SubType = "Code" BuildAction = "Compile" /> </Include> </Files> </CSHARP> </VisualStudioProject> --- NEW FILE: EventArgs.cs --- // ***************************************************************************** // // Copyright 2004, Weifen Luo // All rights reserved. The software and associated documentation // supplied hereunder are the proprietary information of Weifen Luo // and are supplied subject to licence terms. // // WinFormsUI Library Version 1.0 // ***************************************************************************** using System; namespace WeifenLuo.WinFormsUI { public class DockContentEventArgs : EventArgs { public DockContent m_content; public DockContentEventArgs(DockContent content) { m_content = content; } public DockContent Content { get { return m_content; } } } } --- NEW FILE: Strings.resX --- <?xml version="1.0" encoding="utf-8" ?> <root> <!-- Microsoft ResX Schema Version 1.3 The primary goals of this format is to allow a simple XML format that is mostly human readable. The generation and parsing of the various data types are done through the TypeConverter classes associated with the data types. Example: ... ado.net/XML headers & schema ... <resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="version">1.3</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <data name="Name1">this is my long string</data> <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> [base64 mime encoded serialized .NET Framework object] </data> <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> [base64 mime encoded string representing a byte array form of the .NET Framework object] </data> There are any number of "resheader" rows that contain simple name/value pairs. Each data row contains a name, and value. The row also contains a type or mimetype. Type corresponds to a .NET class that support text/value conversion through the TypeConverter architecture. Classes that don't support this are serialized and stored with the mimetype set. The mimetype is used forserialized objects, and tells the ResXResourceReader how to depersist the object. This is currently not extensible. For a given mimetype the value must be set accordingly: Note - application/x-microsoft.net.object.binary.base64 is the format that the ResXResourceWriter will generate, however the reader can read any of the formats listed below. mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with : System.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 value : The object must be serialized with : System.Runtime.Serialization.Formatters.Soap.SoapFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.bytearray.base64 value : The object must be serialized into a byte array : using a System.ComponentModel.TypeConverter : and then encoded with base64 encoding. --> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:element name="root" msdata:IsDataSet="true"> <xsd:complexType> <xsd:choice maxOccurs="unbounded"> <xsd:element name="data"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> </xsd:complexType> </xsd:element> <xsd:element name="resheader"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required" /> </xsd:complexType> </xsd:element> </xsd:choice> </xsd:complexType> </xsd:element> </xsd:schema> <resheader name="resmimetype"> <value>text/microsoft-resx</value> </resheader> <resheader name="version"> <value>1.3</value> </resheader> <resheader name="reader"> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <data name="DockContent.Show.InvalidDockState"> <value>Invalid DockState: Content can not be showed as "Unknown" or "Hidden".</value> </data> <data name="DockPanel.LoadFromXml.InvalidFormatVersion"> <value>The configuration file's version is invalid.</value> </data> <data name="Category.DockingNotification"> <value>Docking Notification</value> </data> <data name="InertButton.Monochrom.Description"> <value>Determines fore/back colors are used to display black/white image.</value> </data> <data name="DockPanel.LoadFromXml.InvalidXmlFormat"> <value>The XML file format is invalid.</value> </data> <data name="InertButton.ToolTipText.Description"> <value>The tool tip text to display.</value> </data> <data name="InertButton.BorderWidth.Description"> <value>The border width of the control.</value> </data> <data name="FloatWindow.SetPaneIndex.InvalidPane"> <value>Invalid Pane: DockPane not within the collection.</value> </data> <data name="InertButton.ImageIndexDisabled.Description"> <value>The index of the image in the ImageList to display when the control is disabled.</value> </data> <data name="DockPanel.SetPaneIndex.InvalidPane"> <value>Invalid Pane: DockPane not within the collection.</value> </data> <data name="DockContent.ToolTipText.Description"> <value>The text displayed when mouse hovers over the tab.</value> </data> <data name="DockPane.Constructor.NullDockPanel"> <value>Invalid argument: The content's DockPanel can not be "null".</value> </data> <data name="InertButton.IsPopup.Description"> <value>Determines whether the control should be displayed in popup style.</value> </data> <data name="DockPanel.DockLeftPortion.Description"> <value>Portion of the left docking window.</value> </data> <data name="FloatWindow.Constructor.NullPane"> <value>Invalid argument: DockPane can not be "null".</value> </data> <data name="DockPane.ToolTipAutoHide"> <value>Auto Hide</value> </data> <data name="DockPane.ActiveContent.InvalidValue"> <value>Invalid Content: ActiveContent must be one of the visible contents, or null if there is no visible content.</value> </data> <data name="DockPane.ToolTipScrollLeft"> <value>Scroll Left</value> </data> <data name="DockContent.Show.NullDockPanel"> <value>DockPanel can not be null.</value> </data> <data name="DockContent.HideOnClose.Description"> <value>Indicates the content will be hidden instead of being closed.</value> </data> <data name="DockPanel.ActiveAutoHideContent.InvalidValue"> <value>Invalid Content: The content must be auto-hide state and assiociates with this DockPanel.</value> </data> <data name="Category.Docking"> <value>Docking</value> </data> <data name="InertButton.ImageDisabled.Description"> <value>The image will be displayed when the control is disabled.</value> </data> <data name="DockPanel.DockRightPortion.Description"> <value>Portion of the right docking window.</value> </data> <data name="FloatWindow.SetPaneIndex.InvalidIndex"> <value>Invalid Index: The index is out of range.</value> </data> <data name="DockPanel.DockBottomPortion.Description"> <value>Portion of the bottom docking window.</value> </data> <data name="DockPane.ToolTipDocumentWindowClose"> <value>Close</value> </data> <data name="DockContent.DockableAreas.Description"> <value>Gets or sets a value indicating in which area of the DockPanel the content allowed to show.</value> </data> <data name="DockPane.Constructor.NullContent"> <value>Invalid argument: Content can not be "null".</value> </data> <data name="DockContent.AutoHidePortion.Description"> <value>The portion when the content displayed in auto hide mode.</value> </data> <data name="DockContent.ShowHint.Description"> <value>The desired docking state when first showing.</value> </data> <data name="DockPanel.ContentRemoved.Description"> <value>Occurs when a content removed from the DockPanel.</value> </data> <data name="DockPanel.SetPaneIndex.InvalidIndex"> <value>Invalid Index: The index is out of range.</value> </data> <data name="InertButton.TextAlign.Description"> <value>The alignment of the text that will be displayed in the face of the control.</value> </data> <data name="DockContent.AllowRedocking.Description"> <value>Determines if drag-and-drop re-docking is allowed.</value> </data> <data name="FloatWindow.Constructor.NullDockPanel"> <value>Invalid argument: DockPanel can not be "null".</value> </data> <data name="DockPane.SetContentIndex.InvalidContent"> <value>Invalid Content: Content not within the collection.</value> </data> <data name="InertButton.ImageEnabled.Description"> <value>The image will be displayed when the control is enabled.</value> </data> <data name="DockPane.SetContentIndex.InvalidIndex"> <value>Invalid Index: The index is out of range.</value> </data> <data name="DockPanel.ContentAdded.Description"> <value>Occurs when a content added to the DockPanel.</value> </data> <data name="DockPanel.DockTopPortion.Description"> <value>Portion of the top docking window.</value> </data> <data name="DockPanel.LoadFromXml.AlreadyInitialized"> <value>The DockPanel has already been initialized.</value> </data> <data name="DockContent.DockableAreas.InvalidValue"> <value>Invalid Value: The value of DockableAreas conflicts with current DockState.</value> </data> <data name="DockContent.CloseButton.Description"> <value>Enable/Disable the close button of the content.</value> </data> <data name="DockPane.ToolTipScrollRight"> <value>Scroll Right</value> </data> <data name="DockContent.DockStateChanged.Description"> <value>Occurs when the value of DockState property changed.</value> </data> <data name="Category.PropertyChanged"> <value>Property Changed</value> </data> <data name="DockPane.ToolTipDockWindowClose"> <value>Close</value> </data> <data name="DockPanel.ActiveDocumentChanged.Description"> <value>Occurs when the value of ActiveDocument property changed.</value> </data> <data name="InertButton.ImageIndexEnabled.Description"> <value>The index of the image in the image list to display when the control is enabled.</value> </data> <data name="InertButton.BorderColor.Description"> <value>The color of the left top border.</value> </data> <data name="DockContent.AutoHidePortion.OutOfRange"> <value>The provided value is out of range.</value> </data> <data name="InertButton.ImageList.Description"> <value>The image list to get the image(s) to display in the face of the control.</value> </data> <data name="DockContent.ShowHint.InvalidValue"> <value>Invalid value, check DockableAreas property.</value> </data> <data name="DockPane.FloatWindow.InvalidValue"> <value>FloatWindow property can not be set to "null" when DockState is DockState.Float.</value> </data> <data name="DockPanel.ActiveContentChanged.Description"> <value>Occurs when the value of ActiveContentProperty changed.</value> </data> <data name="DockContent.TabText.Description"> <value>The tab text displayed in the dock pane. If not set, the Text property will be used.</value> </data> <data name="DockPanel.ActivePaneChanged.Description"> <value>Occurs when the value of ActivePane property changed.</value> </data> <data name="DockPane.AddToDockList.NullContainer"> <value>The container can not be null.</value> </data> <data name="DockPane.AddToDockList.NullPrevPane"> <value>The PrevPane can not be null when the dock list is not empty.</value> </data> <data name="DockPane.AddToDockList.NoPrevPane"> <value>The PrevPane does not exist in the dock list.</value> </data> <data name="DockPane.AddToDockList.SelfPrevPane"> <value>The PrevPane can not be itself.</value> </data> <data name="DockContent.TabPageContextMenu.Description"> <value>Context menu displayed for the dock pane tab strip.</value> </data> <data name="DockPane.VisibleState.InvalidState"> <value>The state for visible state is invalid.</value> </data> <data name="DockContent.DockState.InvalidState"> <value>The dock state is invalid.</value> </data> <data name="DockContent.DockState.NullPanel"> <value>The dock panel is null.</value> </data> </root> --- NEW FILE: ResourceHelper.cs --- // ***************************************************************************** // // Copyright 2004, Weifen Luo // All rights reserved. The software and associated documentation // supplied hereunder are the proprietary information of Weifen Luo // and are supplied subject to licence terms. // // WinFormsUI Library Version 1.0 // ***************************************************************************** using System; using System.Drawing; using System.Reflection; using System.Resources; using System.Windows.Forms; namespace WeifenLuo.WinFormsUI { /// <summary> /// Summary description for ResourceHelper. /// </summary> internal class ResourceHelper { private static ResourceManager m_resourceManager; static ResourceHelper() { m_resourceManager = new ResourceManager("WeifenLuo.WinFormsUI.Strings", typeof(DockPanel).Assembly); } public static Bitmap LoadBitmap(string name) { Assembly assembly = typeof(ResourceHelper).Assembly; string fullNamePrefix = "WeifenLuo.WinFormsUI.Resources."; return new Bitmap(assembly.GetManifestResourceStream(fullNamePrefix + name)); } public static string GetString(string name) { return m_resourceManager.GetString(name); } } } --- NEW FILE: DockPanelPersist.cs --- // ***************************************************************************** // // Copyright 2004, Weifen Luo // All rights reserved. The software and associated documentation // supplied hereunder are the proprietary information of Weifen Luo // and are supplied subject to licence terms. // // WinFormsUI Library Version 1.0 // ***************************************************************************** using System; using System.ComponentModel; using System.Windows.Forms; using System.Drawing; using WeifenLuo.WinFormsUI; using System.IO; using System.Text; using System.Xml; using System.Globalization; namespace WeifenLuo.WinFormsUI { internal class DockPanelPersist { private const string ConfigFileVersion = "0.9.2"; private class DummyContent : DockContent { } private struct DockPanelStruct { private double m_dockLeftPortion; public double DockLeftPortion { get { return m_dockLeftPortion; } set { m_dockLeftPortion = value; } } private double m_dockRightPortion; public double DockRightPortion { get { return m_dockRightPortion; } set { m_dockRightPortion = value; } } private double m_dockTopPortion; public double DockTopPortion { get { return m_dockTopPortion; } set { m_dockTopPortion = value; } } private double m_dockBottomPortion; public double DockBottomPortion { get { return m_dockBottomPortion; } set { m_dockBottomPortion = value; } } private int m_indexActiveDocumentPane; public int IndexActiveDocumentPane { get { return m_indexActiveDocumentPane; } set { m_indexActiveDocumentPane = value; } } private int m_indexActivePane; public int IndexActivePane { get { return m_indexActivePane; } set { m_indexActivePane = value; } } } private struct ContentStruct { private string m_persistString; public string PersistString { get { return m_persistString; } set { m_persistString = value; } } private double m_autoHidePortion; public double AutoHidePortion { get { return m_autoHidePortion; } set { m_autoHidePortion = value; } } private bool m_isHidden; public bool IsHidden { get { return m_isHidden; } set { m_isHidden = value; } } } private struct PaneStruct { private DockState m_visibleState; public DockState VisibleState { get { return m_visibleState; } set { m_visibleState = value; } } private bool m_isHidden; public bool IsHidden { get { return m_isHidden; } set { m_isHidden = value; } } private DockState m_dockState; public DockState DockState { get { return m_dockState; } set { m_dockState = value; } } private int m_indexActiveContent; public int IndexActiveContent { get { return m_indexActiveContent; } set { m_indexActiveContent = value; } } private int[] m_indexContents; public int[] IndexContents { get { return m_indexContents; } set { m_indexContents = value; } } private int m_zOrderIndex; public int ZOrderIndex { get { return m_zOrderIndex; } set { m_zOrderIndex = value; } } } private struct DockListItem { private int m_indexPane; public int IndexPane { get { return m_indexPane; } set { m_indexPane = value; } } private int m_indexPrevPane; public int IndexPrevPane { get { return m_indexPrevPane; } set { m_indexPrevPane = value; } } private DockAlignment m_alignment; public DockAlignment Alignment { get { return m_alignment; } set { m_alignment = value; } } private double m_proportion; public double Proportion { get { return m_proportion; } set { m_proportion = value; } } } private struct DockWindowStruct { private DockState m_dockState; public DockState DockState { get { return m_dockState; } set { m_dockState = value; } } private int m_zOrderIndex; public int ZOrderIndex { get { return m_zOrderIndex; } set { m_zOrderIndex = value; } } private DockListItem[] m_dockList; public DockListItem[] DockList { get { return m_dockList; } set { m_dockList = value; } } } private struct FloatWindowStruct { private Rectangle m_bounds; public Rectangle Bounds { get { return m_bounds; } set { m_bounds = value; } } private bool m_allowRedocking; public bool AllowRedocking { get { return m_allowRedocking; } set { m_allowRedocking = value; } } private int m_zOrderIndex; public int ZOrderIndex { get { return m_zOrderIndex; } set { m_zOrderIndex = value; } } private DockListItem[] m_dockList; public DockListItem[] DockList { get { return m_dockList; } set { m_dockList = value; } } } public DockPanelPersist() { } public static void SaveAsXml(DockPanel dockPanel, string filename) { SaveAsXml(dockPanel, filename, Encoding.Unicode); } public static void SaveAsXml(DockPanel dockPanel, string filename, Encoding encoding) { FileStream fs = new FileStream(filename, FileMode.Create); try { SaveAsXml(dockPanel, fs, encoding); } finally { fs.Close(); } } public static void SaveAsXml(DockPanel dockPanel, Stream stream, Encoding encoding) { XmlTextWriter xmlOut = new XmlTextWriter(stream, encoding); // Use indenting for readability xmlOut.Formatting = Formatting.Indented; // Always begin file with identification and warning xmlOut.WriteStartDocument(); xmlOut.WriteComment(" DockPanel configuration file. Author: Weifen Luo, all rights reserved. "); xmlOut.WriteComment(" !!! AUTOMATICALLY GENERATED FILE. DO NOT MODIFY !!! "); // Associate a version number with the root element so that future version of the code // will be able to be backwards compatible or at least recognise out of date versions xmlOut.WriteStartElement("DockPanel"); xmlOut.WriteAttributeString("FormatVersion", ConfigFileVersion); xmlOut.WriteAttributeString("DockLeftPortion", dockPanel.DockLeftPortion.ToString(CultureInfo.InvariantCulture)); xmlOut.WriteAttributeString("DockRightPortion", dockPanel.DockRightPortion.ToString(CultureInfo.InvariantCulture)); xmlOut.WriteAttributeString("DockTopPortion", dockPanel.DockTopPortion.ToString(CultureInfo.InvariantCulture)); xmlOut.WriteAttributeString("DockBottomPortion", dockPanel.DockBottomPortion.ToString(CultureInfo.InvariantCulture)); xmlOut.WriteAttributeString("ActiveDocumentPane", dockPanel.Panes.IndexOf(dockPanel.ActiveDocumentPane).ToString()); xmlOut.WriteAttributeString("ActivePane", dockPanel.Panes.IndexOf(dockPanel.ActivePane).ToString()); // Contents xmlOut.WriteStartElement("Contents"); xmlOut.WriteAttributeString("Count", dockPanel.Contents.Count.ToString()); foreach (DockContent content in dockPanel.Contents) { xmlOut.WriteStartElement("Content"); xmlOut.WriteAttributeString("ID", dockPanel.Contents.IndexOf(content).ToString()); xmlOut.WriteAttributeString("PersistString", content.PersistString); xmlOut.WriteAttributeString("AutoHidePortion", content.AutoHidePortion.ToString(CultureInfo.InvariantCulture)); xmlOut.WriteAttributeString("IsHidden", content.IsHidden.ToString()); xmlOut.WriteEndElement(); } xmlOut.WriteEndElement(); // Panes xmlOut.WriteStartElement("Panes"); xmlOut.WriteAttributeString("Count", dockPanel.Panes.Count.ToString()); foreach (DockPane pane in dockPanel.Panes) { xmlOut.WriteStartElement("Pane"); xmlOut.WriteAttributeString("ID", dockPanel.Panes.IndexOf(pane).ToString()); xmlOut.WriteAttributeString("VisibleState", pane.VisibleState.ToString()); xmlOut.WriteAttributeString("IsHidden", pane.IsHidden.ToString()); xmlOut.WriteAttributeString("ActiveContent", dockPanel.Contents.IndexOf(pane.ActiveContent).ToString()); xmlOut.WriteStartElement("Contents"); xmlOut.WriteAttributeString("Count", pane.Contents.Count.ToString()); foreach (DockContent content in pane.Contents) { xmlOut.WriteStartElement("Content"); xmlOut.WriteAttributeString("ID", pane.Contents.IndexOf(content).ToString()); xmlOut.WriteAttributeString("RefID", dockPanel.Contents.IndexOf(content).ToString()); xmlOut.WriteEndElement(); } xmlOut.WriteEndElement(); xmlOut.WriteEndElement(); } xmlOut.WriteEndElement(); // DockWindows xmlOut.WriteStartElement("DockWindows"); int count = 0; foreach (DockWindow dw in dockPanel.DockWindows) if (dw.DockList.Count > 0) count++; xmlOut.WriteAttributeString("Count", count.ToString()); int i = 0; foreach (DockWindow dw in dockPanel.DockWindows) { if (dw.DockList.Count == 0) continue; xmlOut.WriteStartElement("DockWindow"); xmlOut.WriteAttributeString("ID", i.ToString()); xmlOut.WriteAttributeString("DockState", dw.DockState.ToString()); xmlOut.WriteAttributeString("ZOrderIndex", dockPanel.Controls.IndexOf(dw).ToString()); xmlOut.WriteStartElement("DockList"); xmlOut.WriteAttributeString("Count", dw.DockList.Count.ToString()); foreach (DockPane pane in dw.DockList) { xmlOut.WriteStartElement("Pane"); xmlOut.WriteAttributeString("ID", dw.DockList.IndexOf(pane).ToString()); xmlOut.WriteAttributeString("RefID", dockPanel.Panes.IndexOf(pane).ToString()); NestedDockingStatus status = pane.GetNestedDockingStatus(false); xmlOut.WriteAttributeString("PrevPane", dockPanel.Panes.IndexOf(status.PrevPane).ToString()); xmlOut.WriteAttributeString("Alignment", status.Alignment.ToString()); xmlOut.WriteAttributeString("Proportion", status.Proportion.ToString(CultureInfo.InvariantCulture)); xmlOut.WriteEndElement(); } xmlOut.WriteEndElement(); xmlOut.WriteEndElement(); i++; } xmlOut.WriteEndElement(); // FloatWindows RectangleConverter rectConverter = new RectangleConverter(); xmlOut.WriteStartElement("FloatWindows"); xmlOut.WriteAttributeString("Count", dockPanel.FloatWindows.Count.ToString()); foreach (FloatWindow fw in dockPanel.FloatWindows) { xmlOut.WriteStartElement("FloatWindow"); xmlOut.WriteAttributeString("ID", dockPanel.FloatWindows.IndexOf(fw).ToString()); xmlOut.WriteAttributeString("Bounds", rectConverter.ConvertToInvariantString(fw.Bounds)); xmlOut.WriteAttributeString("AllowRedocking", fw.AllowRedocking.ToString()); xmlOut.WriteAttributeString("ZOrderIndex", fw.DockPanel.FloatWindows.IndexOf(fw).ToString()); xmlOut.WriteStartElement("DockList"); xmlOut.WriteAttributeString("Count", fw.DockList.Count.ToString()); foreach (DockPane pane in fw.DockList) { xmlOut.WriteStartElement("Pane"); xmlOut.WriteAttributeString("ID", fw.DockList.IndexOf(pane).ToString()); xmlOut.WriteAttributeString("RefID", dockPanel.Panes.IndexOf(pane).ToString()); NestedDockingStatus status = pane.GetNestedDockingStatus(true); xmlOut.WriteAttributeString("PrevPane", dockPanel.Panes.IndexOf(status.PrevPane).ToString()); xmlOut.WriteAttributeString("Alignment", status.Alignment.ToString()); xmlOut.WriteAttributeString("Proportion", status.Proportion.ToString(CultureInfo.InvariantCulture)); xmlOut.WriteEndElement(); } xmlOut.WriteEndElement(); xmlOut.WriteEndElement(); } xmlOut.WriteEndElement(); // </FloatWindows> xmlOut.WriteEndElement(); xmlOut.WriteEndDocument(); // This should flush all actions and close the file xmlOut.Close(); } public static void LoadFromXml(DockPanel dockPanel, string filename, DeserializeDockContent deserializeContent) { FileStream fs = new FileStream(filename, FileMode.Open); try { LoadFromXml(dockPanel, fs, deserializeContent); } finally { fs.Close(); } } public static void LoadFromXml(DockPanel dockPanel, Stream stream, DeserializeDockContent deserializeContent) { if (dockPanel.Contents.Count != 0) throw new InvalidOperationException(ResourceHelper.GetString("DockPanel.LoadFromXml.AlreadyInitialized")); EnumConverter dockStateConverter = new EnumConverter(typeof(DockState)); EnumConverter dockAlignmentConverter = new EnumConverter(typeof(DockAlignment)); RectangleConverter rectConverter = new RectangleConverter(); XmlTextReader xmlIn = new XmlTextReader(stream); xmlIn.WhitespaceHandling = WhitespaceHandling.None; xmlIn.MoveToContent(); if (xmlIn.Name != "DockPanel") throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat")); string formatVersion = xmlIn.GetAttribute("FormatVersion"); if (formatVersion != ConfigFileVersion) throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidFormatVersion")); DockPanelStruct dockPanelStruct = new DockPanelStruct(); dockPanelStruct.DockLeftPortion = Convert.ToDouble(xmlIn.GetAttribute("DockLeftPortion"), CultureInfo.InvariantCulture); dockPanelStruct.DockRightPortion = Convert.ToDouble(xmlIn.GetAttribute("DockRightPortion"), CultureInfo.InvariantCulture); dockPanelStruct.DockTopPortion = Convert.ToDouble(xmlIn.GetAttribute("DockTopPortion"), CultureInfo.InvariantCulture); dockPanelStruct.DockBottomPortion = Convert.ToDouble(xmlIn.GetAttribute("DockBottomPortion"), CultureInfo.InvariantCulture); dockPanelStruct.IndexActiveDocumentPane = Convert.ToInt32(xmlIn.GetAttribute("ActiveDocumentPane")); dockPanelStruct.IndexActivePane = Convert.ToInt32(xmlIn.GetAttribute("ActivePane")); // Load Contents MoveToNextElement(xmlIn); if (xmlIn.Name != "Contents") throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat")); int countOfContents = Convert.ToInt32(xmlIn.GetAttribute("Count")); ContentStruct[] contents = new ContentStruct[countOfContents]; MoveToNextElement(xmlIn); for (int i=0; i<countOfContents; i++) { int id = Convert.ToInt32(xmlIn.GetAttribute("ID")); if (xmlIn.Name != "Content" || id != i) throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat")); contents[i].PersistString = xmlIn.GetAttribute("PersistString"); contents[i].AutoHidePortion = Convert.ToDouble(xmlIn.GetAttribute("AutoHidePortion"), CultureInfo.InvariantCulture); contents[i].IsHidden = Convert.ToBoolean(xmlIn.GetAttribute("IsHidden")); MoveToNextElement(xmlIn); } // Load Panes if (xmlIn.Name != "Panes") throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat")); int countOfPanes = Convert.ToInt32(xmlIn.GetAttribute("Count")); PaneStruct[] panes = new PaneStruct[countOfPanes]; MoveToNextElement(xmlIn); for (int i=0; i<countOfPanes; i++) { int id = Convert.ToInt32(xmlIn.GetAttribute("ID")); if (xmlIn.Name != "Pane" || id != i) throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat")); panes[i].VisibleState = (DockState)dockStateConverter.ConvertFrom(xmlIn.GetAttribute("VisibleState")); panes[i].IsHidden = Convert.ToBoolean(xmlIn.GetAttribute("IsHidden")); panes[i].DockState = panes[i].IsHidden ? DockState.Hidden : panes[i].VisibleState; panes[i].IndexActiveContent = Convert.ToInt32(xmlIn.GetAttribute("ActiveContent")); panes[i].ZOrderIndex = -1; MoveToNextElement(xmlIn); if (xmlIn.Name != "Contents") throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat")); int countOfPaneContents = Convert.ToInt32(xmlIn.GetAttribute("Count")); panes[i].IndexContents = new int[countOfPaneContents]; MoveToNextElement(xmlIn); for (int j=0; j<countOfPaneContents; j++) { int id2 = Convert.ToInt32(xmlIn.GetAttribute("ID")); if (xmlIn.Name != "Content" || id2 != j) throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat")); panes[i].IndexContents[j] = Convert.ToInt32(xmlIn.GetAttribute("RefID")); MoveToNextElement(xmlIn); } } // Load DockWindows if (xmlIn.Name != "DockWindows") throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat")); int countOfDockWindows = Convert.ToInt32(xmlIn.GetAttribute("Count")); DockWindowStruct[] dockWindows = new DockWindowStruct[countOfDockWindows]; MoveToNextElement(xmlIn); for (int i=0; i<countOfDockWindows; i++) { int id = Convert.ToInt32(xmlIn.GetAttribute("ID")); if (xmlIn.Name != "DockWindow" || id != i) throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat")); dockWindows[i].DockState = (DockState)dockStateConverter.ConvertFrom(xmlIn.GetAttribute("DockState")); dockWindows[i].ZOrderIndex = Convert.ToInt32(xmlIn.GetAttribute("ZOrderIndex")); MoveToNextElement(xmlIn); if (xmlIn.Name != "DockList") throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat")); int countOfDockList = Convert.ToInt32(xmlIn.GetAttribute("Count")); dockWindows[i].DockList = new DockListItem[countOfDockList]; MoveToNextElement(xmlIn); for (int j=0; j<countOfDockList; j++) { int id2 = Convert.ToInt32(xmlIn.GetAttribute("ID")); if (xmlIn.Name != "Pane" || id2 != j) throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat")); dockWindows[i].DockList[j].IndexPane = Convert.ToInt32(xmlIn.GetAttribute("RefID")); dockWindows[i].DockList[j].IndexPrevPane = Convert.ToInt32(xmlIn.GetAttribute("PrevPane")); dockWindows[i].DockList[j].Alignment = (DockAlignment)dockAlignmentConverter.ConvertFrom(xmlIn.GetAttribute("Alignment")); dockWindows[i].DockList[j].Proportion = Convert.ToDouble(xmlIn.GetAttribute("Proportion"), CultureInfo.InvariantCulture); MoveToNextElement(xmlIn); } } // Load FloatWindows if (xmlIn.Name != "FloatWindows") throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat")); int countOfFloatWindows = Convert.ToInt32(xmlIn.GetAttribute("Count")); FloatWindowStruct[] floatWindows = new FloatWindowStruct[countOfFloatWindows]; MoveToNextElement(xmlIn); for (int i=0; i<countOfFloatWindows; i++) { int id = Convert.ToInt32(xmlIn.GetAttribute("ID")); if (xmlIn.Name != "FloatWindow" || id != i) throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat")); ... [truncated message content] |