Exemple #1
0
 private void RemoveAllSides()
 {
     SuspendLayout();
     if (LeftSide != null)
     {
         LeftSide.Parent = null;
         LeftSide.Dispose();
         LeftSide = null;
     }
     if (TopSide != null)
     {
         TopSide.Parent = null;
         TopSide.Dispose();
         TopSide = null;
     }
     if (RightSide != null)
     {
         RightSide.Parent = null;
         RightSide.Dispose();
         RightSide = null;
     }
     if (BottomSide != null)
     {
         BottomSide.Parent = null;
         BottomSide.Dispose();
         BottomSide = null;
     }
     RootControl.SetBounds(
         ViewConstants.Spacing, ViewConstants.Spacing,
         Width - ViewConstants.Spacing * 2, Height - ViewConstants.Spacing * 2,
         BoundsSpecified.All);
     ResumeLayout(true);
 }
Exemple #2
0
        public void WriteXml(XmlWriter writer)
        {
            writer.WriteStartElement("RootPanel");
            if (RootPanel != null)
            {
                RootPanel.WriteXml(writer);
            }
            writer.WriteEndElement();

            writer.WriteStartElement("TopSide");
            if (TopSide != null)
            {
                TopSide.WriteXml(writer);
            }
            writer.WriteEndElement();

            writer.WriteStartElement("RightSide");
            if (RightSide != null)
            {
                RightSide.WriteXml(writer);
            }
            writer.WriteEndElement();

            writer.WriteStartElement("LeftSide");
            if (LeftSide != null)
            {
                LeftSide.WriteXml(writer);
            }
            writer.WriteEndElement();

            writer.WriteStartElement("BottomSide");
            if (BottomSide != null)
            {
                BottomSide.WriteXml(writer);
            }
            writer.WriteEndElement();

            // Write all floating windows (can be LayoutDocumentFloatingWindow or LayoutAnchorableFloatingWindow).
            // To prevent "can not create instance of abstract type", the type is retrieved with GetType().Name
            writer.WriteStartElement("FloatingWindows");
            foreach (var layoutFloatingWindow in FloatingWindows)
            {
                writer.WriteStartElement(layoutFloatingWindow.GetType().Name);
                layoutFloatingWindow.WriteXml(writer);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();

            writer.WriteStartElement("Hidden");
            foreach (var layoutAnchorable in Hidden)
            {
                writer.WriteStartElement(layoutAnchorable.GetType().Name);
                layoutAnchorable.WriteXml(writer);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();
        }
Exemple #3
0
        private void RemoveTopSide()
        {
            if (TopSide != null)
            {
                TopSide.Parent = null;
                TopSide.Dispose();
                TopSide = null;

                var bounds = RootControl.Bounds;
                bounds.Y          -= Renderer.SideTabHeight;
                bounds.Height     += Renderer.SideTabHeight;
                RootControl.Bounds = bounds;
                var vcs = Height - Renderer.SideTabHeight * 2;
                if (BottomSide != null)
                {
                    vcs -= Renderer.SideTabHeight;
                }
                if (LeftSide != null)
                {
                    var h   = LeftSide.Height;
                    var len = LeftSide.OptimalLength;
                    if (h >= len)
                    {
                        LeftSide.Top = ViewConstants.Spacing;
                    }
                    else
                    {
                        if (len > vcs)
                        {
                            len = vcs;
                        }
                        LeftSide.SetBounds(
                            0, ViewConstants.Spacing, Renderer.SideTabHeight, len,
                            BoundsSpecified.Y | BoundsSpecified.Height);
                    }
                }
                if (RightSide != null)
                {
                    var h   = RightSide.Height;
                    var len = RightSide.OptimalLength;
                    if (h >= len)
                    {
                        RightSide.Top = ViewConstants.Spacing;
                    }
                    else
                    {
                        if (len > vcs)
                        {
                            len = vcs;
                        }
                        RightSide.SetBounds(
                            0, ViewConstants.Spacing, Renderer.SideTabHeight, len,
                            BoundsSpecified.Y | BoundsSpecified.Height);
                    }
                }
            }
        }
Exemple #4
0
        private void RemoveLeftSide()
        {
            if (LeftSide != null)
            {
                LeftSide.Parent = null;
                LeftSide.Dispose();
                LeftSide = null;

                var bounds = RootControl.Bounds;
                bounds.X          -= Renderer.SideTabHeight;
                bounds.Width      += Renderer.SideTabHeight;
                RootControl.Bounds = bounds;
                var hcs = Width - ViewConstants.Spacing * 2;
                if (RightSide != null)
                {
                    hcs -= Renderer.SideTabHeight;
                }
                if (TopSide != null)
                {
                    var w   = TopSide.Width;
                    var len = TopSide.OptimalLength;
                    if (w >= len)
                    {
                        TopSide.Left = ViewConstants.Spacing;
                    }
                    else
                    {
                        if (len > hcs)
                        {
                            len = hcs;
                        }
                        TopSide.SetBounds(
                            ViewConstants.Spacing, 0, len, Renderer.SideTabHeight,
                            BoundsSpecified.X | BoundsSpecified.Width);
                    }
                }
                if (BottomSide != null)
                {
                    var w   = BottomSide.Height;
                    var len = BottomSide.OptimalLength;
                    if (w >= len)
                    {
                        BottomSide.Left = ViewConstants.Spacing;
                    }
                    else
                    {
                        if (len > hcs)
                        {
                            len = hcs;
                        }
                        BottomSide.SetBounds(
                            ViewConstants.Spacing, 0, len, Renderer.SideTabHeight,
                            BoundsSpecified.X | BoundsSpecified.Width);
                    }
                }
            }
        }
Exemple #5
0
        private IEnumerator rotate(int rotation)
        {
            float targetRotation = transform.eulerAngles.z + rotation;
            float startRotation  = transform.eulerAngles.z;

            float portion = 0;

            while (portion < 1)
            {
                portion += (Time.deltaTime / rotateTime);
                if (portion >= 1)
                {
                    transform.eulerAngles = new Vector3(0, 0, targetRotation);
                    break;
                }
                else
                {
                    transform.eulerAngles = new Vector3(0, 0, (startRotation * (1 - portion)) + (targetRotation * portion));
                }

                yield return(null);
            }

            if (targetRotation < 0)
            {
                targetRotation = 360 + targetRotation;
            }
            targetRotation %= 360;

            if (((int)targetRotation + 1) / 90 == 0)
            {
                topSide = TopSide.Up;
            }

            if (((int)targetRotation + 1) / 90 == 1)
            {
                topSide = TopSide.Right;
            }

            if (((int)targetRotation + 1) / 90 == 2)
            {
                topSide = TopSide.Down;
            }

            if (((int)targetRotation + 1) / 90 == 3)
            {
                topSide = TopSide.Left;
            }

            rotating = null;

            foreach (var cell in cells)
            {
                cell.HandleGridChange();
            }
        }
Exemple #6
0
 public Tile(long id, char[][] content)
 {
     Id      = id;
     Content = content;
     Sides   = new[] {
         TopSide,
         RightSide,
         BottomSide,
         LeftSide,
         string.Join("", TopSide.Reverse()),
         string.Join("", RightSide.Reverse()),
         string.Join("", BottomSide.Reverse()),
         string.Join("", LeftSide.Reverse())
     };
 }
Exemple #7
0
        internal void AddSideChild(IDockElement ele, DockSide side)
        {
            switch (side)
            {
            case DockSide.Left:
                LeftSide.Attach(ele);
                break;

            case DockSide.Right:
                RightSide.Attach(ele);
                break;

            case DockSide.Top:
                TopSide.Attach(ele);
                break;

            case DockSide.Bottom:
                BottomSide.Attach(ele);
                break;
            }
        }
Exemple #8
0
 /// <summary>
 /// Releases the unmanaged resources used by the <see cref="T:System.Windows.Forms.Control"/> and its child controls and optionally releases the managed resources.
 /// </summary>
 /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
 protected override void Dispose(bool disposing)
 {
     lock (_grids)
     {
         _grids.Remove(this);
     }
     if (disposing)
     {
         _dockMarkers.Dispose();
         if (LeftSide != null)
         {
             LeftSide.Dispose();
             LeftSide = null;
         }
         if (TopSide != null)
         {
             TopSide.Dispose();
             TopSide = null;
         }
         if (RightSide != null)
         {
             RightSide.Dispose();
             RightSide = null;
         }
         if (BottomSide != null)
         {
             BottomSide.Dispose();
             BottomSide = null;
         }
         if (PopupsStack != null)
         {
             PopupsStack.Dispose();
             PopupsStack = null;
         }
         RootControl = null;
         _floatingViewForms.Clear();
     }
     base.Dispose(disposing);
 }
Exemple #9
0
 public void Flip()
 {
     TopSide    = TopSide.GetOppositeSide();
     BottomSide = BottomSide.GetOppositeSide();
 }
Exemple #10
0
 public Piece(Side topSide)
 {
     TopSide    = topSide ?? throw new ArgumentNullException();
     BottomSide = TopSide.GetOppositeSide();
 }