/// <summary> /// Creates a new Environment class /// </summary> /// <param name="sdm">The docking manager used by GLua</param> /// <param name="tStrip">Tab context menu</param> /// <param name="eStrip">Edit control context menu</param> /// <param name="pStrip">Project node context menu</param> /// <param name="cStrip">Code node context menu</param> /// <param name="fStrip">Folder node context menu</param> /// <param name="code">Code provider for code completion</param> public Workspace(DockContainer sdm, ContextMenuStrip tStrip, ContextMenuStrip eStrip, ContextMenuStrip pStrip, ContextMenuStrip cStrip, ContextMenuStrip fStrip, ImageList images) { // set all the values Manager = sdm; ImageList = images; _explorer = new ProjectExplorer(this); TreeView = _explorer.tvFiles; ImageList = _explorer.imgList; _explorer.Show(sdm, DockState.DockLeft); //, DockState.DockLeft); _bug = new WebWindow("http://code.google.com/p/gluar/issues/list") {TabText = "Bug Reporter"}; TabStrip = tStrip; EditStrip = eStrip; ProjectStrip = _explorer.projectMenu; CodeStrip = _explorer.fileMenu; FolderStrip = _explorer.folderMenu; // used to set the right clicked node as the current node //treeView.NodeMouseClick += new TreeNodeMouseClickEventHandler(treeView_NodeMouseClick); // Taken out by Marine // ! Put back in by VoiDeD // load the code database and settings _code = CodeProvider.Load(Application.StartupPath + "\\code.db"); _obj = new ObjectBrowser(_code, images, this); // Taken out by Marine // Get working in next version //settings = Settings.Load( Application.StartupPath + "\\data\\settings.xml" ); }
private void InternalConstruct(DockContainer dockPanel, DockPane pane, bool boundsSpecified, Rectangle bounds) { if (dockPanel == null) throw(new ArgumentNullException(ResourceHelper.GetString("FloatWindow.Constructor.NullDockPanel"))); m_dockList = new DockList(this); FormBorderStyle = FormBorderStyle.SizableToolWindow; ShowInTaskbar = false; SuspendLayout(); if (boundsSpecified) { Bounds = bounds; StartPosition = FormStartPosition.Manual; } else StartPosition = FormStartPosition.WindowsDefaultLocation; if (Environment.Version.Major == 1) { m_dummyControl = new DummyControl(); m_dummyControl.Bounds = Rectangle.Empty; Controls.Add(m_dummyControl); } m_dockPanel = dockPanel; Owner = DockPanel.FindForm(); DockPanel.AddFloatWindow(this); if (pane != null) pane.FloatWindow = this; ResumeLayout(); }
internal DockWindowCollection(DockContainer 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)); }
/// <include file='CodeDoc/AutoHideStripVS2003.xml' path='//CodeDoc/Class[@name="AutoHideStripVS2003"]/Construct[@name="(DockPanel)"]/*'/> protected internal AutoHideStripVS2005(DockContainer panel) : base(panel) { SetStyle(ControlStyles.ResizeRedraw, true); SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); BackColor = Color.WhiteSmoke; }
internal AutoHidePaneCollection(DockContainer panel, DockState dockState) { m_dockPanel = panel; m_states = new AutoHideStateCollection(); States[DockState.DockTopAutoHide].Selected = (dockState==DockState.DockTopAutoHide); States[DockState.DockBottomAutoHide].Selected = (dockState==DockState.DockBottomAutoHide); States[DockState.DockLeftAutoHide].Selected = (dockState==DockState.DockLeftAutoHide); States[DockState.DockRightAutoHide].Selected = (dockState==DockState.DockRightAutoHide); }
public AutoHideWindow(DockContainer dockPanel) { m_dockPanel = dockPanel; m_timerMouseTrack = new Timer(); m_timerMouseTrack.Tick += new EventHandler(TimerMouseTrack_Tick); Visible = false; m_splitter = new AutoHideWindowSplitter(); Controls.Add(m_splitter); }
public static FloatWindow FloatWindowAtPoint(Point pt, DockContainer dockPanel) { for (Control control = Win32Helper.ControlAtPoint(pt); control != null; control = control.Parent) { FloatWindow floatWindow = control as FloatWindow; if (floatWindow != null && floatWindow.DockPanel == dockPanel) return control as FloatWindow; } return null; }
public static void LoadFromXml(DockContainer dockPanel, string filename, DeserializeDockContent deserializeContent) { FileStream fs = new FileStream(filename, FileMode.Open); try { LoadFromXml(dockPanel, fs, deserializeContent); } finally { fs.Close(); } }
/// <include file='CodeDoc/AutoHideStripBase.xml' path='//CodeDoc/Class[@name="AutoHideStripBase"]/Construct[@name="(DockPanel)"]/*'/> protected internal AutoHideStripBase(DockContainer panel) { m_dockPanel = panel; m_panesTop = new AutoHidePaneCollection(panel, DockState.DockTopAutoHide); m_panesBottom = new AutoHidePaneCollection(panel, DockState.DockBottomAutoHide); m_panesLeft = new AutoHidePaneCollection(panel, DockState.DockLeftAutoHide); m_panesRight = new AutoHidePaneCollection(panel, DockState.DockRightAutoHide); #if FRAMEWORK_VER_2x SetStyle(ControlStyles.OptimizedDoubleBuffer, true); #else SetStyle(ControlStyles.DoubleBuffer, true); #endif SetStyle(ControlStyles.Selectable, false); }
public FormMain() { InitializeComponent(); SyntaxLoader.UserCustomStyles = Path.Combine(Application.StartupPath, "conf"); SyntaxLoader.UseUserCustomStyles = true; if (Directory.Exists(SyntaxLoader.UserCustomStyles) == false) Directory.CreateDirectory(SyntaxLoader.UserCustomStyles); _DockContainer = new DockContainer(); toolStripContainer1.ContentPanel.Controls.Add(_DockContainer); _DockContainer.Dock = DockStyle.Fill; _DockContainer.DocumentStyle = DocumentStyles.DockingWindow; _DockContainer.ActiveDocumentChanged+=new EventHandler(_DockContainer_ActiveDocumentChanged); _DockContainer.ActiveContentChanged+=new EventHandler(_DockContainer_ActiveContentChanged); _Languages = new LanguageList(); LoadSyntaxes(); mnuNew.DropDownItems.AddRange(GetNewFileItems()); btnNew.DropDownItems.AddRange(GetNewFileItems()); this.LoadRecents(); this.FormClosing += new FormClosingEventHandler(FormMain_FormClosing); //if (File.Exists(Application.StartupPath + @"\dockconfig.xml")) // _DockContainer.LoadFromXml(Application.StartupPath + @"\dockconfig.xml", null); ((ToolStripProfessionalRenderer)mainToolBar.Renderer).ColorTable.UseSystemColors = true; this.Text = "FireEdit"; _OutputWindow = new FireEditOutputWindow(); _OutputWindow.Icon = Icon.FromHandle(Properties.Resources.Output.GetHicon()); }
internal DockWindow(DockContainer dockPanel, DockState dockState) { m_dockList = new DockList(this); m_dockPanel = dockPanel; m_dockState = dockState; Visible = false; SuspendLayout(); if (DockState == DockState.DockLeft || DockState == DockState.DockRight || DockState == DockState.DockTop || DockState == DockState.DockBottom) { m_splitter = new DockWindowSplitter(); Controls.Add(m_splitter); } if (DockState == DockState.DockLeft) { Dock = DockStyle.Left; m_splitter.Dock = DockStyle.Right; } else if (DockState == DockState.DockRight) { Dock = DockStyle.Right; m_splitter.Dock = DockStyle.Left; } else if (DockState == DockState.DockTop) { Dock = DockStyle.Top; m_splitter.Dock = DockStyle.Bottom; } else if (DockState == DockState.DockBottom) { Dock = DockStyle.Bottom; m_splitter.Dock = DockStyle.Top; } else if (DockState == DockState.Document) { Dock = DockStyle.Fill; } ResumeLayout(); }
public static void LoadFromXml(DockContainer dockPanel, Stream stream, DeserializeDockContent deserializeContent) { LoadFromXml(dockPanel, stream, deserializeContent, true); }
public static void LoadFromXml(DockContainer dockPanel, Stream stream, DeserializeDockContent deserializeContent, bool closeStream) { 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(); while (!xmlIn.Name.Equals("DockPanel")) { if (!MoveToNextElement(xmlIn)) throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat")); } string formatVersion = xmlIn.GetAttribute("FormatVersion"); if (!IsFormatVersionValid(formatVersion)) 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")); contents[i].IsFloat = Convert.ToBoolean(xmlIn.GetAttribute("IsFloat")); 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].DockState = (DockState)dockStateConverter.ConvertFrom(xmlIn.GetAttribute("DockState")); 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 = dockPanel.DockWindows.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")); floatWindows[i].Bounds = (Rectangle)rectConverter.ConvertFromInvariantString(xmlIn.GetAttribute("Bounds")); floatWindows[i].AllowRedocking = Convert.ToBoolean(xmlIn.GetAttribute("AllowRedocking")); floatWindows[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")); floatWindows[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")); floatWindows[i].DockList[j].IndexPane = Convert.ToInt32(xmlIn.GetAttribute("RefID")); floatWindows[i].DockList[j].IndexPrevPane = Convert.ToInt32(xmlIn.GetAttribute("PrevPane")); floatWindows[i].DockList[j].Alignment = (DockAlignment)dockAlignmentConverter.ConvertFrom(xmlIn.GetAttribute("Alignment")); floatWindows[i].DockList[j].Proportion = Convert.ToDouble(xmlIn.GetAttribute("Proportion"), CultureInfo.InvariantCulture); MoveToNextElement(xmlIn); } } if (closeStream) xmlIn.Close(); dockPanel.DockLeftPortion = dockPanelStruct.DockLeftPortion; dockPanel.DockRightPortion = dockPanelStruct.DockRightPortion; dockPanel.DockTopPortion = dockPanelStruct.DockTopPortion; dockPanel.DockBottomPortion = dockPanelStruct.DockBottomPortion; // Set DockWindow ZOrders int prevMaxDockWindowZOrder = int.MaxValue; for (int i=0; i<dockWindows.Length; i++) { int maxDockWindowZOrder = -1; int index = -1; for (int j=0; j<dockWindows.Length; j++) { if (dockWindows[j].ZOrderIndex > maxDockWindowZOrder && dockWindows[j].ZOrderIndex < prevMaxDockWindowZOrder) { maxDockWindowZOrder = dockWindows[j].ZOrderIndex; index = j; } } dockPanel.DockWindows[dockWindows[index].DockState].BringToFront(); prevMaxDockWindowZOrder = maxDockWindowZOrder; } // Create Contents for (int i=0; i<contents.Length; i++) { IDockableWindow content = deserializeContent(contents[i].PersistString); if (content == null) content = new DummyContent(); content.DockHandler.DockPanel = dockPanel; content.DockHandler.AutoHidePortion = contents[i].AutoHidePortion; content.DockHandler.IsHidden = true; content.DockHandler.IsFloat = contents[i].IsFloat; } // Create panes for (int i=0; i<panes.Length; i++) { DockPane pane = null; for (int j=0; j<panes[i].IndexContents.Length; j++) { IDockableWindow content = dockPanel.Contents[panes[i].IndexContents[j]]; if (j==0) pane = dockPanel.DockPaneFactory.CreateDockPane(content, panes[i].DockState, false); else if (panes[i].DockState == DockState.Float) content.DockHandler.FloatPane = pane; else content.DockHandler.PanelPane = pane; } } // Assign Panes to DockWindows for (int i=0; i<dockWindows.Length; i++) { for (int j=0; j<dockWindows[i].DockList.Length; j++) { DockWindow dw = dockPanel.DockWindows[dockWindows[i].DockState]; int indexPane = dockWindows[i].DockList[j].IndexPane; DockPane pane = dockPanel.Panes[indexPane]; int indexPrevPane = dockWindows[i].DockList[j].IndexPrevPane; DockPane prevPane = (indexPrevPane == -1) ? dw.DockList.GetDefaultPrevPane(pane) : dockPanel.Panes[indexPrevPane]; DockAlignment alignment = dockWindows[i].DockList[j].Alignment; double proportion = dockWindows[i].DockList[j].Proportion; pane.AddToDockList(dw, prevPane, alignment, proportion); if (panes[indexPane].DockState == dw.DockState) panes[indexPane].ZOrderIndex = dockWindows[i].ZOrderIndex; } } // Create float windows for (int i=0; i<floatWindows.Length; i++) { FloatWindow fw = null; for (int j=0; j<floatWindows[i].DockList.Length; j++) { int indexPane = floatWindows[i].DockList[j].IndexPane; DockPane pane = dockPanel.Panes[indexPane]; if (j == 0) fw = dockPanel.FloatWindowFactory.CreateFloatWindow(dockPanel, pane, floatWindows[i].Bounds); else { int indexPrevPane = floatWindows[i].DockList[j].IndexPrevPane; DockPane prevPane = indexPrevPane == -1 ? null : dockPanel.Panes[indexPrevPane]; DockAlignment alignment = floatWindows[i].DockList[j].Alignment; double proportion = floatWindows[i].DockList[j].Proportion; pane.AddToDockList(fw, prevPane, alignment, proportion); if (panes[indexPane].DockState == fw.DockState) panes[indexPane].ZOrderIndex = floatWindows[i].ZOrderIndex; } } } // sort IDockContent by its Pane's ZOrder int[] sortedContents = null; if (contents.Length > 0) { sortedContents = new int[contents.Length]; for (int i=0; i<contents.Length; i++) sortedContents[i] = i; int lastDocument = contents.Length; for (int i=0; i<contents.Length - 1; i++) { for (int j=i+1; j<contents.Length; j++) { DockPane pane1 = dockPanel.Contents[sortedContents[i]].DockHandler.Pane; int ZOrderIndex1 = pane1 == null ? 0 : panes[dockPanel.Panes.IndexOf(pane1)].ZOrderIndex; DockPane pane2 = dockPanel.Contents[sortedContents[j]].DockHandler.Pane; int ZOrderIndex2 = pane2 == null ? 0 : panes[dockPanel.Panes.IndexOf(pane2)].ZOrderIndex; if (ZOrderIndex1 > ZOrderIndex2) { int temp = sortedContents[i]; sortedContents[i] = sortedContents[j]; sortedContents[j] = temp; } } } } // show non-document IDockContent first to avoid screen flickers for (int i=0; i<contents.Length; i++) { IDockableWindow content = dockPanel.Contents[sortedContents[i]]; if (content.DockHandler.Pane != null && content.DockHandler.Pane.DockState != DockState.Document) content.DockHandler.IsHidden = contents[sortedContents[i]].IsHidden; } // after all non-document IDockContent, show document IDockContent for (int i=0; i<contents.Length; i++) { IDockableWindow content = dockPanel.Contents[sortedContents[i]]; if (content.DockHandler.Pane != null && content.DockHandler.Pane.DockState == DockState.Document) content.DockHandler.IsHidden = contents[sortedContents[i]].IsHidden; } for (int i=0; i<panes.Length; i++) dockPanel.Panes[i].ActiveContent = panes[i].IndexActiveContent == -1 ? null : dockPanel.Contents[panes[i].IndexActiveContent]; if (dockPanelStruct.IndexActiveDocumentPane != -1) dockPanel.Panes[dockPanelStruct.IndexActiveDocumentPane].Activate(); if (dockPanelStruct.IndexActivePane != -1) dockPanel.Panes[dockPanelStruct.IndexActivePane].Activate(); for (int i=dockPanel.Contents.Count-1; i>=0; i--) if (dockPanel.Contents[i] is DummyContent) dockPanel.Contents[i].DockHandler.Form.Close(); }
public static void SaveAsXml(DockContainer dockPanel, Stream stream, Encoding encoding) { SaveAsXml(dockPanel, stream, encoding, false); }
public static void SaveAsXml(DockContainer dockPanel, Stream stream, Encoding encoding, bool upstream) { XmlTextWriter xmlOut = new XmlTextWriter(stream, encoding); // Use indenting for readability xmlOut.Formatting = Formatting.Indented; if (!upstream) xmlOut.WriteStartDocument(); // Always begin file with identification and warning 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 (IDockableWindow content in dockPanel.Contents) { xmlOut.WriteStartElement("Content"); xmlOut.WriteAttributeString("ID", dockPanel.Contents.IndexOf(content).ToString()); xmlOut.WriteAttributeString("PersistString", content.DockHandler.PersistString); xmlOut.WriteAttributeString("AutoHidePortion", content.DockHandler.AutoHidePortion.ToString(CultureInfo.InvariantCulture)); xmlOut.WriteAttributeString("IsHidden", content.DockHandler.IsHidden.ToString()); xmlOut.WriteAttributeString("IsFloat", content.DockHandler.IsFloat.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("DockState", pane.DockState.ToString()); xmlOut.WriteAttributeString("ActiveContent", dockPanel.Contents.IndexOf(pane.ActiveContent).ToString()); xmlOut.WriteStartElement("Contents"); xmlOut.WriteAttributeString("Count", pane.Contents.Count.ToString()); foreach (IDockableWindow 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 dockWindowId = 0; foreach (DockWindow dw in dockPanel.DockWindows) { xmlOut.WriteStartElement("DockWindow"); xmlOut.WriteAttributeString("ID", dockWindowId.ToString()); dockWindowId++; 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.NestedDockingStatus; 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 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.NestedDockingStatus; 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(); if (!upstream) { xmlOut.WriteEndDocument(); xmlOut.Close(); } else xmlOut.Flush(); }
/// <include file='CodeDoc\DockContentHandler.xml' path='//CodeDoc/Class[@name="DockContentHandler"]/Method[@name="Show(DockPanel, DockState)"]/*'/> public void Show(DockContainer dockPanel, DockState dockState) { if (dockPanel == null) throw(new ArgumentNullException(ResourceHelper.GetString("IDockContent.Show.NullDockPanel"))); if (dockState == DockState.Unknown || dockState == DockState.Hidden) throw(new ArgumentException(ResourceHelper.GetString("IDockContent.Show.InvalidDockState"))); DockPanel = dockPanel; if (dockState == DockState.Float && FloatPane == null) Pane = DockPanel.DockPaneFactory.CreateDockPane(Content, DockState.Float, true); else if (PanelPane == null) { DockPane paneExisting = null; foreach (DockPane pane in DockPanel.Panes) if (pane.DockState == dockState) { paneExisting = pane; break; } if (paneExisting == null) Pane = DockPanel.DockPaneFactory.CreateDockPane(Content, dockState, true); else Pane = paneExisting; } DockState = dockState; Activate(); }
public static void SaveAsXml(DockContainer dockPanel, string filename, Encoding encoding) { FileStream fs = new FileStream(filename, FileMode.Create); try { SaveAsXml(dockPanel, fs, encoding); } finally { fs.Close(); } }
/// <include file='CodeDoc\FloatWindow.xml' path='//CodeDoc/Class[@name="FloatWindow"]/Constructor[@name="(DockPanel, DockPane, Rectangle)"]/*'/> public FloatWindow(DockContainer dockPanel, DockPane pane, Rectangle bounds) { InternalConstruct(dockPanel, pane, true, bounds); }
//====================Liuyang: 23, Jan, 2010============================ //a new simulation datastore is created for each simulation form; //where the explicity ID is used rather than hashed ID, which can help user to understand more. //private DataStoreSimulation DataStoreSimulation = new DataStoreSimulation(); //====================Liuyang: 23, Jan, 2010============================ public SimulationForm() { InitializeComponent(); this.toolStripContainer1.ContentPanel.SuspendLayout(); this.toolStripContainer1.TopToolStripPanel.SuspendLayout(); this.toolStripContainer1.SuspendLayout(); this.SplitContainer.Panel1.SuspendLayout(); this.SplitContainer.Panel2.SuspendLayout(); this.SplitContainer.SuspendLayout(); this.GroupBox_EnabledEvents.SuspendLayout(); this.GroupBox_EventTrace.SuspendLayout(); this.toolStrip1.SuspendLayout(); this.MenuStrip_Trace.SuspendLayout(); this.statusStrip1.SuspendLayout(); this.TableLayoutPanel.SuspendLayout(); this.SuspendLayout(); resources = new System.ComponentModel.ComponentResourceManager(typeof (SimulationForm)); if (Common.Utility.Utilities.IsUnixOS) { StateInfoControl = new StateInfoControl(); StateInfoControl.Dock = DockStyle.Fill; SplitContainer.Dock = DockStyle.Right; this.StateInfoControl.Dock = DockStyle.Left; this.TableLayoutPanel.Controls.Add(this.SimulatorViewer); this.TableLayoutPanel.Controls.Add(this.SplitContainer); this.TableLayoutPanel.Controls.Add(this.StateInfoControl); InitializeResourceText(); Timer_Run.Tick += new EventHandler(Timer_Drawing_Tick); Timer_Replay.Tick += new EventHandler(Timer_Replay_Tick); Timer_SimulateTrace.Tick += new EventHandler(Timer_SimulateTrace_Tick); //show the event window by default. Button_InteractionPane.Checked = true; Panel_ToolbarCover.BringToFront(); this.ListView_EnabledEvents.OwnerDraw = true; this.ListView_EnabledEvents.DrawItem += new DrawListViewItemEventHandler(ListView_EnabledEvents_DrawItem); ListView_EnabledEvents.DrawColumnHeader += new DrawListViewColumnHeaderEventHandler(ListView_EnabledEvents_DrawColumnHeader); SimulatorViewer.Resize += new EventHandler(SimulatorViewer_Resize); Button_StatePane.Checked = true; StatusLabel.Text = Resources.Ready; } else { this.DockContainer = new Fireball.Docking.DockContainer(); // // DockContainer // this.DockContainer.ActiveAutoHideContent = null; resources.ApplyResources(this.DockContainer, "DockContainer"); //this.DockContainer.Name = "DockContainer"; this.toolStripContainer1.ContentPanel.Controls.Add(this.DockContainer); //toolStripContainer1.ContentPanel.Controls.Add(this.gra) //toolStripContainer1.ContentPanel.Controls.Remove(this.TableLayoutPanel); this.TableLayoutPanel.Visible = false; //initialize the event window this.toolStripContainer1.ContentPanel.Controls.Remove(SplitContainer); SplitContainer.Dock = DockStyle.Fill; EventWindow = new DockableWindow(); EventWindow.DockableAreas = DockAreas.DockRight | DockAreas.DockLeft | DockAreas.Float; EventWindow.CloseButton = false; EventWindow.Controls.Add(SplitContainer); //initialize the data store window. StatePane = new DockableWindow(); StatePane.DockableAreas = DockAreas.DockLeft | DockAreas.DockRight | DockAreas.Float; StateInfoControl = new StateInfoControl(); StateInfoControl.Dock = DockStyle.Fill; StatePane.Controls.Add(StateInfoControl); StatePane.CloseButton = false; InitializeResourceText(); Timer_Run.Tick += new EventHandler(Timer_Drawing_Tick); Timer_Replay.Tick += new EventHandler(Timer_Replay_Tick); Timer_SimulateTrace.Tick += new EventHandler(Timer_SimulateTrace_Tick); //show the event window by default. Button_InteractionPane.Checked = true; //release the simulator viewer from the dockContainer DockContainer.Controls.Remove(SimulatorViewer); //Create the dummy DocumentTab to initialize the Document DockWindow in a proper way //actually, there should be a better way to do this by initialize the Document DockWindow directly. //since we are not sure about the how the Dock control is implemented, so we play this trick here. DockContainer.DocumentStyle = DocumentStyles.DockingWindow; DockableWindow SimulatorViewerTab = new DockableWindow(); SimulatorViewerTab.Show(DockContainer, DockState.Document); //show the simulator viewer in the SimulatorViewerDockWindow SimulatorViewerDockWindow = SimulatorViewerTab.Parent.Parent; SimulatorViewerDockWindow.Controls.Clear(); SimulatorViewerDockWindow.Controls.Add(SimulatorViewer); SimulatorViewerDockWindow.Controls.Add(Panel_ToolbarCover); Panel_ToolbarCover.BringToFront(); this.ListView_EnabledEvents.OwnerDraw = true; this.ListView_EnabledEvents.DrawItem += new DrawListViewItemEventHandler(ListView_EnabledEvents_DrawItem); ListView_EnabledEvents.DrawColumnHeader += new DrawListViewColumnHeaderEventHandler(ListView_EnabledEvents_DrawColumnHeader); SimulatorViewer.Resize += new EventHandler(SimulatorViewer_Resize); Button_StatePane.Checked = true; StatusLabel.Text = Resources.Ready; //Common.Ultility.Ultility.SimulationForms.Add(this); } //SimulatorViewer.Invalidate(); SimulatorViewer.Refresh(); this.toolStripContainer1.ContentPanel.ResumeLayout(false); this.toolStripContainer1.TopToolStripPanel.ResumeLayout(false); this.toolStripContainer1.TopToolStripPanel.PerformLayout(); this.toolStripContainer1.ResumeLayout(false); this.toolStripContainer1.PerformLayout(); this.SplitContainer.Panel1.ResumeLayout(false); this.SplitContainer.Panel2.ResumeLayout(false); this.SplitContainer.ResumeLayout(false); this.GroupBox_EnabledEvents.ResumeLayout(false); this.GroupBox_EventTrace.ResumeLayout(false); this.toolStrip1.ResumeLayout(false); this.toolStrip1.PerformLayout(); this.MenuStrip_Trace.ResumeLayout(false); this.statusStrip1.ResumeLayout(false); this.statusStrip1.PerformLayout(); this.TableLayoutPanel.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); }
private void InternalConstruct(IDockableWindow content, DockState dockState, bool flagBounds, Rectangle floatWindowBounds, DockPane prevPane, DockAlignment alignment, double proportion, bool show) { if (dockState == DockState.Hidden || dockState == DockState.Unknown) throw new ArgumentException(ResourceHelper.GetString("DockPane.DockState.InvalidState")); if (content == null) throw new ArgumentNullException(ResourceHelper.GetString("DockPane.Constructor.NullContent")); if (content.DockHandler.DockPanel == null) throw new ArgumentException(ResourceHelper.GetString("DockPane.Constructor.NullDockPanel")); SuspendLayout(); SetStyle(ControlStyles.Selectable, false); m_isFloat = (dockState == DockState.Float); m_contents = new DockContentCollection(); m_displayingContents = new DockContentCollection(this); m_tabs = new DockPaneTabCollection(this); m_dockPanel = content.DockHandler.DockPanel; m_dockPanel.AddPane(this); m_splitter = new DockPaneSplitter(this); m_nestedDockingStatus = new NestedDockingStatus(this); m_autoHidePane = DockPanel.AutoHidePaneFactory.CreateAutoHidePane(this); m_captionControl = DockPanel.DockPaneCaptionFactory.CreateDockPaneCaption(this); m_tabStripControl = DockPanel.DockPaneStripFactory.CreateDockPaneStrip(this); Controls.AddRange(new Control[] { m_captionControl, m_tabStripControl }); DockPanel.SuspendLayout(true); if (flagBounds) FloatWindow = DockPanel.FloatWindowFactory.CreateFloatWindow(DockPanel, this, floatWindowBounds); else if (prevPane != null) AddToDockList(prevPane.DockListContainer, prevPane, alignment, proportion); SetDockState(dockState); if (show) content.DockHandler.Pane = this; else if (this.IsFloat) content.DockHandler.FloatPane = this; else content.DockHandler.PanelPane = this; ResumeLayout(); DockPanel.ResumeLayout(true, true); }
/// <include file='CodeDoc\FloatWindow.xml' path='//CodeDoc/Class[@name="FloatWindow"]/Constructor[@name="Overloads"]/*'/> /// <include file='CodeDoc\FloatWindow.xml' path='//CodeDoc/Class[@name="FloatWindow"]/Constructor[@name="(DockPanel, DockPane)"]/*'/> public FloatWindow(DockContainer dockPanel, DockPane pane) { InternalConstruct(dockPanel, pane, false, Rectangle.Empty); }
/// <include file='CodeDoc\DockContent.xml' path='//CodeDoc/Class[@name="DockContent"]/Method[@name="Show(DockPanel, DockState)"]/*'/> public void Show(DockContainer dockPanel, DockState dockState) { DockHandler.Show(dockPanel, dockState); }
private void SetOutline(DockContainer dockPanel, DockStyle dock, bool fullPanelEdge) { Rectangle rect = fullPanelEdge ? dockPanel.DockArea : dockPanel.DocumentWindowBounds; rect.Location = dockPanel.PointToScreen(rect.Location); if (dock == DockStyle.Top) { int height = (int)(rect.Height * dockPanel.DockBottomPortion); rect = new Rectangle(rect.X, rect.Y, rect.Width, height); } else if (dock == DockStyle.Bottom) { int height = (int)(rect.Height * dockPanel.DockBottomPortion); rect = new Rectangle(rect.X, rect.Bottom - height, rect.Width, height); } else if (dock == DockStyle.Left) { int width = (int)(rect.Width * dockPanel.DockLeftPortion); rect = new Rectangle(rect.X, rect.Y, width, rect.Height); } else if (dock == DockStyle.Right) { int width = (int)(rect.Width * dockPanel.DockRightPortion); rect = new Rectangle(rect.Right - width, rect.Y, width, rect.Height); } else if (dock == DockStyle.Fill) { rect = dockPanel.DocumentWindowBounds; rect.Location = dockPanel.PointToScreen(rect.Location); } SetDragForm(rect); }
/// <include file='CodeDoc\DockContentHandler.xml' path='//CodeDoc/Class[@name="DockContentHandler"]/Method[@name="Show(DockPanel, Rectangle)"]/*'/> public void Show(DockContainer dockPanel, Rectangle floatWindowBounds) { if (dockPanel == null) throw(new ArgumentNullException(ResourceHelper.GetString("IDockContent.Show.NullDockPanel"))); DockPanel = dockPanel; if (FloatPane == null) { IsHidden = true; // to reduce the screen flicker FloatPane = DockPanel.DockPaneFactory.CreateDockPane(Content, DockState.Float, false); FloatPane.FloatWindow.StartPosition = FormStartPosition.Manual; } FloatPane.FloatWindow.Bounds = floatWindowBounds; Show(dockPanel, DockState.Float); Activate(); }
/// <exclude/> protected override void Dispose(bool disposing) { if (disposing) { m_dockState = DockState.Unknown; if (DockListContainer != null) DockListContainer.DockList.Remove(this); if (DockPanel != null) { DockPanel.RemovePane(this); m_dockPanel = null; } Splitter.Dispose(); AutoHidePane.Dispose(); } base.Dispose(disposing); }
public static void SaveAsXml(DockContainer dockPanel, string filename) { SaveAsXml(dockPanel, filename, Encoding.Unicode); }
/// <include file='CodeDoc\DockContent.xml' path='//CodeDoc/Class[@name="DockContent"]/Method[@name="Show(DockPanel)"]/*'/> public void Show(DockContainer dockPanel) { DockHandler.Show(dockPanel); }
/// <include file='CodeDoc\DockContentHandler.xml' path='//CodeDoc/Class[@name="DockContentHandler"]/Method[@name="Show(DockPanel)"]/*'/> public void Show(DockContainer dockPanel) { if (dockPanel == null) throw(new ArgumentNullException(ResourceHelper.GetString("IDockContent.Show.NullDockPanel"))); if (DockState == DockState.Unknown) Show(dockPanel, DefaultShowState); else Activate(); }
/// <include file='CodeDoc\DockContent.xml' path='//CodeDoc/Class[@name="DockContent"]/Method[@name="Show(DockPanel, Rectangle)"]/*'/> public void Show(DockContainer dockPanel, Rectangle floatWindowBounds) { DockHandler.Show(dockPanel, floatWindowBounds); }
/// <exclude/> protected override void Dispose(bool disposing) { if (disposing) { if (DockPanel != null) DockPanel.RemoveFloatWindow(this); m_dockPanel = null; } base.Dispose(disposing); }