Inheritance: System.Windows.Forms.Form, INestedPanesContainer, IDockDragSource
Example #1
0
        protected internal DockPane(IDockContent content, FloatWindow floatWindow, bool show)
        {
            if (floatWindow == null)
                throw new ArgumentNullException("floatWindow");

            InternalConstruct(content, DockState.Float, false, Rectangle.Empty, floatWindow.NestedPanes.GetDefaultPreviousPane(this), DockAlignment.Right, 0.5, show);
        }
Example #2
0
        internal void RemoveFloatWindow(FloatWindow floatWindow)
        {
            if (!FloatWindows.Contains(floatWindow))
                return;

            FloatWindows.Remove(floatWindow);
            if (FloatWindows.Count != 0)
                return;

            if (ParentForm == null) 
                return;

            ParentForm.Focus();
        }
Example #3
0
        internal void AddFloatWindow(FloatWindow floatWindow)
        {
            if (FloatWindows.Contains(floatWindow))
                return;

            FloatWindows.Add(floatWindow);
        }
 public DockPane CreateDockPane(IDockContent content, FloatWindow floatWindow, bool show)
 {
     return new DockPane(content, floatWindow, show);
 }
Example #5
0
 public FloatingWindow(FloatWindow floatWindow)
 {
     _floatWindow = floatWindow;
 }
Example #6
0
		internal void RemoveFloatWindow(FloatWindow floatWindow)
		{
			if (!FloatWindows.Contains(floatWindow))
				return;

			FloatWindows.Remove(floatWindow);
		}
Example #7
0
        private static bool SearchChilds(Control window, CursorPoint info, DockPanel dockPanel)
        {
            // enumerate child controls at the cursor point
            List <Control> childs              = new List <Control>();
            const uint     CWP_SKIPDISABLED    = 0x0002;
            const uint     CWP_SKIPINVISIBLE   = 0x0001;
            const uint     CWP_SKIPTRANSPARENT = 0x0004;
            uint           flags = CWP_SKIPDISABLED | CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT;

            Control current = window;

            while (true)
            {
                childs.Add(current);
                IntPtr hwnd = NativeMethods.ChildWindowFromPointEx(
                    current.Handle, current.PointToClient(info.Cursor), flags);
                if (hwnd == current.Handle || hwnd == IntPtr.Zero)
                {
                    break;
                }
                current = Control.FromHandle(hwnd);
                if (current == null)
                {
                    break;
                }
            }

            // make the array deepest first
            childs.Reverse();

            bool targetFound = false;

            foreach (Control control in childs)
            {
                if (info.Pane == null)                     // not found?
                {
                    IDockContent content = control as IDockContent;
                    if (content != null && content.DockHandler.DockPanel == dockPanel)
                    {
                        info.Pane   = content.DockHandler.Pane;
                        targetFound = true;
                    }

                    DockPane pane = control as DockPane;
                    if (pane != null && pane.DockPanel == dockPanel)
                    {
                        info.Pane   = pane;
                        targetFound = true;
                    }
                }

                if (info.FloatWindow == null && info.DockPanel == null)                     // not found?
                {
                    FloatWindow floatWindow = window as FloatWindow;
                    if (floatWindow != null && floatWindow.DockPanel == dockPanel)
                    {
                        info.FloatWindow = floatWindow;
                        targetFound      = true;
                    }

                    DockPanel panel = control as DockPanel;
                    if (panel != null && panel == dockPanel)
                    {
                        info.DockPanel = panel;
                        targetFound    = true;
                    }
                }
            }

            return(targetFound);
        }
            public static void LoadFromXml(DockPanel dockPanel, Stream stream, DeserializeDockContent deserializeContent, bool closeStream)
            {
                if (dockPanel.Contents.Count != 0)
                {
                    throw new InvalidOperationException(Strings.DockPanel_LoadFromXml_AlreadyInitialized);
                }

                DockPanelStruct dockPanelStruct;

                ContentStruct[]     contents;
                PaneStruct[]        panes;
                DockWindowStruct[]  dockWindows;
                FloatWindowStruct[] floatWindows;
                using (var xmlIn = new XmlTextReader(stream)
                {
                    WhitespaceHandling = WhitespaceHandling.None
                })
                {
                    xmlIn.MoveToContent();

                    while (!xmlIn.Name.Equals("DockPanel"))
                    {
                        if (!MoveToNextElement(xmlIn))
                        {
                            throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
                        }
                    }

                    string formatVersion = xmlIn.GetAttribute("FormatVersion");
                    if (!IsFormatVersionValid(formatVersion))
                    {
                        throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidFormatVersion);
                    }

                    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"), CultureInfo.InvariantCulture);
                    dockPanelStruct.IndexActivePane         = Convert.ToInt32(xmlIn.GetAttribute("ActivePane"), CultureInfo.InvariantCulture);

                    // Load Contents
                    MoveToNextElement(xmlIn);
                    if (xmlIn.Name != "Contents")
                    {
                        throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
                    }
                    contents = LoadContents(xmlIn);

                    // Load Panes
                    if (xmlIn.Name != "Panes")
                    {
                        throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
                    }
                    panes = LoadPanes(xmlIn);

                    // Load DockWindows
                    if (xmlIn.Name != "DockWindows")
                    {
                        throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
                    }
                    dockWindows = LoadDockWindows(xmlIn, dockPanel);

                    // Load FloatWindows
                    if (xmlIn.Name != "FloatWindows")
                    {
                        throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
                    }
                    floatWindows = LoadFloatWindows(xmlIn);

                    if (closeStream)
                    {
                        xmlIn.Close();
                    }
                }

                dockPanel.SuspendLayout(true);

                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++)
                {
                    IDockContent 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++)
                    {
                        IDockContent 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].NestedPanes.Length; j++)
                    {
                        DockWindow    dw            = dockPanel.DockWindows[dockWindows[i].DockState];
                        int           indexPane     = dockWindows[i].NestedPanes[j].IndexPane;
                        DockPane      pane          = dockPanel.Panes[indexPane];
                        int           indexPrevPane = dockWindows[i].NestedPanes[j].IndexPrevPane;
                        DockPane      prevPane      = (indexPrevPane == -1) ? dw.NestedPanes.GetDefaultPreviousPane(pane) : dockPanel.Panes[indexPrevPane];
                        DockAlignment alignment     = dockWindows[i].NestedPanes[j].Alignment;
                        double        proportion    = dockWindows[i].NestedPanes[j].Proportion;
                        pane.DockTo(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].NestedPanes.Length; j++)
                    {
                        int      indexPane = floatWindows[i].NestedPanes[j].IndexPane;
                        DockPane pane      = dockPanel.Panes[indexPane];
                        if (j == 0)
                        {
                            fw = dockPanel.FloatWindowFactory.CreateFloatWindow(dockPanel, pane, floatWindows[i].Bounds);
                        }
                        else
                        {
                            int           indexPrevPane = floatWindows[i].NestedPanes[j].IndexPrevPane;
                            DockPane      prevPane      = indexPrevPane == -1 ? null : dockPanel.Panes[indexPrevPane];
                            DockAlignment alignment     = floatWindows[i].NestedPanes[j].Alignment;
                            double        proportion    = floatWindows[i].NestedPanes[j].Proportion;
                            pane.DockTo(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++)
                {
                    IDockContent 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++)
                {
                    IDockContent 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();
                    }
                }

                dockPanel.ResumeLayout(true, true);
            }
 public DockPane CreateDockPane(IDockContent content, FloatWindow floatWindow, bool show)
 {
     return(new DockPane(content, floatWindow, show));
 }
Example #10
0
            public static void LoadFromXml(DockPanel dockPanel, Stream stream, DeserializeDockContent deserializeContent, bool closeStream)
            {
                if (dockPanel.Contents.Count != 0)
                {
                    throw new InvalidOperationException(Strings.DockPanel_LoadFromXml_AlreadyInitialized);
                }

                XmlTextReader xmlIn = new XmlTextReader(stream);

                xmlIn.WhitespaceHandling = WhitespaceHandling.None;
                xmlIn.MoveToContent();

                while (!xmlIn.Name.Equals("DockPanel"))
                {
                    if (!MoveToNextElement(xmlIn))
                    {
                        throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
                    }
                }

                string formatVersion = xmlIn.GetAttribute("FormatVersion");

                if (!IsFormatVersionValid(formatVersion))
                {
                    throw new ArgumentException(Strings.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"), CultureInfo.InvariantCulture);
                dockPanelStruct.IndexActivePane         = Convert.ToInt32(xmlIn.GetAttribute("ActivePane"), CultureInfo.InvariantCulture);

                // Load Contents
                MoveToNextElement(xmlIn);
                if (xmlIn.Name != "Contents")
                {
                    throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
                }
                ContentStruct[] contents = LoadContents(xmlIn);

                // Load Panes
                if (xmlIn.Name != "Panes")
                {
                    throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
                }
                PaneStruct[] panes = LoadPanes(xmlIn);

                // Load DockWindows
                if (xmlIn.Name != "DockWindows")
                {
                    throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
                }
                DockWindowStruct[] dockWindows = LoadDockWindows(xmlIn, dockPanel);

                // Load FloatWindows
                if (xmlIn.Name != "FloatWindows")
                {
                    throw new ArgumentException(Strings.DockPanel_LoadFromXml_InvalidXmlFormat);
                }
                FloatWindowStruct[] floatWindows = LoadFloatWindows(xmlIn);

                if (closeStream)
                {
                    xmlIn.Close();
                }

                dockPanel.SuspendLayout(true);

                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++)
                {
                    IDockContent content = deserializeContent(contents[i].PersistString);
                    if (content == null)
                    {
                        content = new DummyContent();
                    }
                    content.DockHandler.DockPanel       = dockPanel;
                    content.DockHandler.AutoHidePortion = contents[i].AutoHidePortion;
                    // "avoiding flickering" will cause "exception" at DockPane.cs:153 that I screened
                    // and global failure of LoadXml()
                    //content.DockHandler.IsHidden = true;
                    content.DockHandler.IsHidden = false;
                    content.DockHandler.IsFloat  = contents[i].IsFloat;
                }

                // Create panes
                for (int i = 0; i < panes.Length; i++)
                {
                    DockPane   pane       = null;
                    PaneStruct paneStruct = panes[i];
                    for (int j = 0; j < paneStruct.IndexContents.Length; j++)
                    {
                        try {
                            int          idx     = paneStruct.IndexContents[j];
                            IDockContent content = dockPanel.Contents[idx];
                            if (content == null || content.DockHandler == null)
                            {
                                string msg = "avoiding exception";
                                continue;
                            }
                            if (j == 0)
                            {
                                pane = dockPanel.DockPaneFactory.CreateDockPane(content, paneStruct.DockState, false);
                            }
                            else if (paneStruct.DockState == DockState.Float)
                            {
                                content.DockHandler.FloatPane = pane;
                            }
                            else
                            {
                                content.DockHandler.PanelPane = pane;
                            }
                        } catch (Exception e) {
                            continue;
                        }
                    }
                }

                // Assign Panes to DockWindows
                for (int i = 0; i < dockWindows.Length; i++)
                {
                    for (int j = 0; j < dockWindows[i].NestedPanes.Length; j++)
                    {
                        DockWindow    dw            = dockPanel.DockWindows[dockWindows[i].DockState];
                        int           indexPane     = dockWindows[i].NestedPanes[j].IndexPane;
                        DockPane      pane          = dockPanel.Panes[indexPane];
                        int           indexPrevPane = dockWindows[i].NestedPanes[j].IndexPrevPane;
                        DockPane      prevPane      = (indexPrevPane == -1) ? dw.NestedPanes.GetDefaultPreviousPane(pane) : dockPanel.Panes[indexPrevPane];
                        DockAlignment alignment     = dockWindows[i].NestedPanes[j].Alignment;
                        double        proportion    = dockWindows[i].NestedPanes[j].Proportion;
                        pane.DockTo(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].NestedPanes.Length; j++)
                    {
                        int      indexPane = floatWindows[i].NestedPanes[j].IndexPane;
                        DockPane pane      = dockPanel.Panes[indexPane];
                        if (j == 0)
                        {
                            fw = dockPanel.FloatWindowFactory.CreateFloatWindow(dockPanel, pane, floatWindows[i].Bounds);
                        }
                        else
                        {
                            int           indexPrevPane = floatWindows[i].NestedPanes[j].IndexPrevPane;
                            DockPane      prevPane      = indexPrevPane == -1 ? null : dockPanel.Panes[indexPrevPane];
                            DockAlignment alignment     = floatWindows[i].NestedPanes[j].Alignment;
                            double        proportion    = floatWindows[i].NestedPanes[j].Proportion;
                            pane.DockTo(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++)
                    {
                        int sorted_i = sortedContents[i];
                        for (int j = i + 1; j < contents.Length; j++)
                        {
                            int sorted_j = sortedContents[j];
                            try {
                                if (sorted_i >= dockPanel.Contents.Count)
                                {
                                    string msg = "slow pointer went beyond the array length";
                                }
                                if (sorted_j >= dockPanel.Contents.Count)
                                {
                                    string msg = "fast pointer went beyond the array length";
                                }
                                if (dockPanel.Contents[sorted_j].DockHandler == null)
                                {
                                    string msg = "where is my handler?...";
                                }
                                DockPane pane1        = dockPanel.Contents[sorted_i].DockHandler.Pane;
                                int      ZOrderIndex1 = pane1 == null ? 0 : panes[dockPanel.Panes.IndexOf(pane1)].ZOrderIndex;
                                DockPane pane2        = dockPanel.Contents[sorted_j].DockHandler.Pane;
                                int      ZOrderIndex2 = pane2 == null ? 0 : panes[dockPanel.Panes.IndexOf(pane2)].ZOrderIndex;
                                if (ZOrderIndex1 > ZOrderIndex2)
                                {
                                    int temp = sorted_i;
                                    sortedContents[i] = sorted_j;
                                    sortedContents[j] = temp;
                                }
                            } catch (Exception ex) {
                                continue;
                            }
                        }
                    }
                }

                // show non-document IDockContent first to avoid screen flickers
                for (int i = 0; i < contents.Length; i++)
                {
                    int sorted_i = sortedContents[i];
                    if (sorted_i >= dockPanel.Contents.Count)
                    {
                        string msg = "Huston we have a problem";
                    }
                    IDockContent content = dockPanel.Contents[sorted_i];
                    if (content.DockHandler.Pane != null &&
                        content.DockHandler.Pane.DockState != DockState.Document)
                    {
                        // floating windows should not be marked IsHidden in Layout.xml...
                        //if they are, that will cause "ActiveContent must be one of the visible contents""
                        content.DockHandler.IsHidden = contents[sorted_i].IsHidden;
                        //content.DockHandler.IsHidden = false;
                    }
                }

                // after all non-document IDockContent, show document IDockContent
                for (int i = 0; i < contents.Length; i++)
                {
                    int          sorted_i = sortedContents[i];
                    IDockContent content  = dockPanel.Contents[sorted_i];
                    if (content.DockHandler.Pane != null &&
                        content.DockHandler.Pane.DockState == DockState.Document)
                    {
                        // but here I don't want to hide panes which are unserialized as hidden!!
                        // minimized ExceptionForm will disappear and that will make hidden: ChartForm and corresponding EditorForm
                        // hm it looks okay, I don't know what healed ExceptionForm...
                        content.DockHandler.IsHidden = contents[sorted_i].IsHidden;
                        //content.DockHandler.IsHidden = false;
                    }
                }

                for (int i = 0; i < panes.Length; i++)
                {
                    PaneStruct pane_i                 = panes[i];
                    DockPane   destination            = dockPanel.Panes[i];
                    int        paneActiveContentIndex = pane_i.IndexActiveContent;
                    //try {
                    //	destination.ActiveContent = paneActiveContentIndex == -1
                    //		? null : dockPanel.Contents[paneActiveContentIndex];
                    //} catch (Exception ex) {
                    //	int a = 1;
                    //}
                    if (paneActiveContentIndex != -1)
                    {
                        destination.ActiveContent = dockPanel.Contents[paneActiveContentIndex];
                    }
                }

                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();
                    }
                }

                dockPanel.ResumeLayout(true, true);
            }
 public VS2013DockPane(IDockContent content, FloatWindow floatWindow, bool show)
     : base(content, floatWindow, show)
 {
 }
Example #12
0
 internal void RemoveFloatWindow(FloatWindow floatWindow)
 {
     if(!this.FloatWindows.Contains(floatWindow)){
         return;
     }
     this.FloatWindows.Remove(floatWindow);
 }
Example #13
0
 internal void AddFloatWindow(FloatWindow floatWindow)
 {
     if(this.FloatWindows.Contains(floatWindow)){
         return;
     }
     this.FloatWindows.Add(floatWindow);
 }