Пример #1
0
		private void InternalConstruct(DockPanel 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();
		}
Пример #2
0
 internal void SetStatus(DockList list, DockPane prevPane, DockAlignment alignment, double proportion)
 {
     m_dockList   = list;
     m_prevPane   = prevPane;
     m_alignment  = alignment;
     m_proportion = proportion;
 }
Пример #3
0
        internal void Add(DockPane pane)
        {
            if (pane == null)
            {
                return;
            }

            DockList oldDockList = (pane.DockListContainer == null) ? null : pane.DockListContainer.DockList;

            if (oldDockList != null)
            {
                oldDockList.InternalRemove(pane);
            }
            InnerList.Add(pane);
            if (oldDockList != null)
            {
                oldDockList.CheckFloatWindowDispose();
            }
        }
Пример #4
0
		internal DockWindow(DockPanel 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();
		}
Пример #5
0
        internal DockWindow(DockPanel 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();
        }
Пример #6
0
        private void MergeDockList(DisplayingDockList dockListFrom, DockList dockListTo, DockPane prevPane, DockAlignment alignment, double proportion)
        {
            if (dockListFrom.Count == 0)
            {
                return;
            }

            int count = dockListFrom.Count;

            DockPane[]      panes       = new DockPane[count];
            DockPane[]      prevPanes   = new DockPane[count];
            DockAlignment[] alignments  = new DockAlignment[count];
            double[]        proportions = new double[count];

            for (int i = 0; i < count; i++)
            {
                panes[i]       = dockListFrom[i];
                prevPanes[i]   = dockListFrom[i].NestedDockingStatus.PrevPane;
                alignments[i]  = dockListFrom[i].NestedDockingStatus.Alignment;
                proportions[i] = dockListFrom[i].NestedDockingStatus.Proportion;
            }

            DockPane pane = panes[0].AddToDockList(dockListTo.Container, prevPane, alignment, proportion);

            panes[0].DockState = dockListTo.DockState;
            panes[0].Activate();

            for (int i = 1; i < count; i++)
            {
                for (int j = i; j < count; j++)
                {
                    if (prevPanes[j] == panes[i - 1])
                    {
                        prevPanes[j] = pane;
                    }
                }
                pane = panes[i].AddToDockList(dockListTo.Container, prevPanes[i], alignments[i], proportions[i]);
                panes[i].DockState = dockListTo.DockState;
                panes[i].Activate();
            }
        }
Пример #7
0
        private void InternalConstruct(DockPanel 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();
        }
Пример #8
0
 internal DisplayingDockList(DockList dockList)
 {
     m_dockList = dockList;
 }
Пример #9
0
		internal void SetStatus(DockList list, DockPane prevPane, DockAlignment alignment, double proportion)
		{
			m_dockList = list;
			m_prevPane = prevPane;
			m_alignment = alignment;
			m_proportion = proportion;
		}
Пример #10
0
		internal DisplayingDockList(DockList dockList)
		{
			m_dockList = dockList;
		}
Пример #11
0
        private void FloatWindow_OnEndDrag(bool abort)
        {
            if (abort)
            {
                return;
            }

            FloatWindow floatWindow = (FloatWindow)DragControl;

            if (!DockOutline.FloatWindowBounds.IsEmpty)
            {
                DragControl.Bounds = DockOutline.FloatWindowBounds;
            }
            else if (DockOutline.DockTo is DockPane)
            {
                DockPane paneTo = DockOutline.DockTo as DockPane;

                if (DockOutline.Dock == DockStyle.Fill)
                {
                    for (int i = floatWindow.DockList.Count - 1; i >= 0; i--)
                    {
                        DockPane pane = floatWindow.DockList[i];
                        for (int j = pane.Contents.Count - 1; j >= 0; j--)
                        {
                            IDockContent c = pane.Contents[j];
                            c.DockHandler.Pane = paneTo;
                            if (DockOutline.ContentIndex != -1)
                            {
                                paneTo.SetContentIndex(c, DockOutline.ContentIndex);
                            }
                            c.DockHandler.Activate();
                        }
                    }
                }
                else
                {
                    DockAlignment alignment = DockAlignment.Left;
                    if (DockOutline.Dock == DockStyle.Left)
                    {
                        alignment = DockAlignment.Left;
                    }
                    else if (DockOutline.Dock == DockStyle.Right)
                    {
                        alignment = DockAlignment.Right;
                    }
                    else if (DockOutline.Dock == DockStyle.Top)
                    {
                        alignment = DockAlignment.Top;
                    }
                    else if (DockOutline.Dock == DockStyle.Bottom)
                    {
                        alignment = DockAlignment.Bottom;
                    }

                    MergeDockList(floatWindow.DisplayingList, paneTo.DockListContainer.DockList, paneTo, alignment, 0.5);
                }
            }
            else if (DockOutline.DockTo is DockPanel)
            {
                SetDockWindow();

                DockList dockListTo = null;

                if (DockOutline.Dock == DockStyle.Top)
                {
                    dockListTo = floatWindow.DockPanel.DockWindows[DockState.DockTop].DockList;
                }
                else if (DockOutline.Dock == DockStyle.Bottom)
                {
                    dockListTo = floatWindow.DockPanel.DockWindows[DockState.DockBottom].DockList;
                }
                else if (DockOutline.Dock == DockStyle.Left)
                {
                    dockListTo = floatWindow.DockPanel.DockWindows[DockState.DockLeft].DockList;
                }
                else if (DockOutline.Dock == DockStyle.Right)
                {
                    dockListTo = floatWindow.DockPanel.DockWindows[DockState.DockRight].DockList;
                }
                else if (DockOutline.Dock == DockStyle.Fill)
                {
                    dockListTo = floatWindow.DockPanel.DockWindows[DockState.Document].DockList;
                }

                DockPane prevPane = null;
                for (int i = dockListTo.Count - 1; i >= 0; i--)
                {
                    if (dockListTo[i] != floatWindow.DisplayingList[0])
                    {
                        prevPane = dockListTo[i];
                    }
                }
                MergeDockList(floatWindow.DisplayingList, dockListTo, prevPane, DockAlignment.Left, 0.5);
            }
        }
Пример #12
0
		private void MergeDockList(DisplayingDockList dockListFrom, DockList dockListTo, DockPane prevPane, DockAlignment alignment, double proportion)
		{
			if (dockListFrom.Count == 0)
				return;

			int count = dockListFrom.Count;
			DockPane[] panes = new DockPane[count];
			DockPane[] prevPanes = new DockPane[count];
			DockAlignment[] alignments = new DockAlignment[count];
			double[] proportions = new double[count];

			for (int i=0; i<count; i++)
			{
				panes[i] = dockListFrom[i];
				prevPanes[i] = dockListFrom[i].NestedDockingStatus.PrevPane;
				alignments[i] = dockListFrom[i].NestedDockingStatus.Alignment;
				proportions[i] = dockListFrom[i].NestedDockingStatus.Proportion;
			}

			DockPane pane = panes[0].AddToDockList(dockListTo.Container, prevPane, alignment, proportion);
			panes[0].DockState = dockListTo.DockState;
			panes[0].Activate();

			for (int i=1; i<count; i++)
			{
				for (int j=i; j<count; j++)
				{
					if (prevPanes[j] == panes[i-1])
						prevPanes[j] = pane;
				}
				pane = panes[i].AddToDockList(dockListTo.Container, prevPanes[i], alignments[i], proportions[i]);
				panes[i].DockState = dockListTo.DockState;
				panes[i].Activate();
			}
		}