<commit_before>﻿//Apache2, 2014-present, WinterDev

using System;
namespace LayoutFarm.UI
{
    public class DockSpacesController : NinespaceController
    {
        VerticalBoxExpansion _leftBoxVerticalExpansionFlags = VerticalBoxExpansion.Default;
        VerticalBoxExpansion _rightBoxVerticalExpansionFlags = VerticalBoxExpansion.Default;
        int _topSplitterHeight;
        int _bottomSplitterHeight;
        int _leftSplitterWidth;
        int _rightSplitterWidth;

        public event EventHandler FinishNineSpaceArrangement;
        public DockSpacesController(AbstractRectUI owner, SpaceConcept initConcept)
            : base(owner, initConcept)
        {
            this._myOwner = owner;
            switch (initConcept)
            {
                case SpaceConcept.TwoSpaceHorizontal: //top-bottom
                    {
                        _spaces[L] = InitSpace(SpaceName.Left);
                        _spaces[R] = InitSpace(SpaceName.Right);
                    }
                    break;
                case SpaceConcept.TwoSpaceVertical: //left-right
                    {
                        _spaces[T] = InitSpace(SpaceName.Top);
                        _spaces[B] = InitSpace(SpaceName.Bottom);
                    }
                    break;
                case SpaceConcept.ThreeSpaceHorizontal:
                    {
                        //left-center-right 
                        _spaces[L] = InitSpace(SpaceName.Left);
                        _spaces[C] = InitSpace(SpaceName.Center);
                        _spaces[R] = InitSpace(SpaceName.Right);
                    }
                    break;
                case SpaceConcept.ThreeSpaceVertical:
                    {
                        //top-center-bottom                        
                        _spaces[T] = InitSpace(SpaceName.Top);
                        _spaces[C] = InitSpace(SpaceName.Center);
                        _spaces[B] = InitSpace(SpaceName.Bottom);
                    }
                    break;
                case SpaceConcept.FourSpace:
                    {
                        _spaces[FOURSPACE_LT] = InitSpace(SpaceName.LeftTop);
                        _spaces[FOURSPACE_RT] = InitSpace(SpaceName.RightTop);
                        _spaces[FOURSPACE_RB] = InitSpace(SpaceName.RightBottom);
                        _spaces[FOURSPACE_LB] = InitSpace(SpaceName.LeftBottom);
                    }
                    break;
                case SpaceConcept.FiveSpace:
                    {
                        _spaces[L] = InitSpace(SpaceName.Left);
                        _spaces[R] = InitSpace(SpaceName.Right);
                        _spaces[T] = InitSpace(SpaceName.Top);
                        _spaces[B] = InitSpace(SpaceName.Bottom);
                        _spaces[C] = InitSpace(SpaceName.Center);
                    }
                    break;
                case SpaceConcept.NineSpace:
                default:
                    {
                        _spaces[L] = InitSpace(SpaceName.Left);
                        _spaces[R] = InitSpace(SpaceName.Right);
                        _spaces[T] = InitSpace(SpaceName.Top);
                        _spaces[B] = InitSpace(SpaceName.Bottom);
                        _spaces[C] = InitSpace(SpaceName.Center);
                        _spaces[LT] = InitSpace(SpaceName.LeftTop);
                        _spaces[RT] = InitSpace(SpaceName.RightTop);
                        _spaces[RB] = InitSpace(SpaceName.RightBottom);
                        _spaces[LB] = InitSpace(SpaceName.LeftBottom);
                    }
                    break;
            }
        }
        public void SetSize(int w, int h)
        {
            //set controller size
            this._sizeW = w;
            this._sizeH = h;
            //-------------
            //arrange all space position 
            this.ArrangeAllSpaces();
        }
        public VerticalBoxExpansion LeftSpaceVerticalExpansion
        {
            get
            {
                return _leftBoxVerticalExpansionFlags;
            }
            set
            {
                _leftBoxVerticalExpansionFlags = value;
            }
        }
        public int TopSplitterHeight
        {
            get
            {
                return _topSplitterHeight;
            }
            set
            {
                this._topSplitterHeight = value;
            }
        }
        public int BottomSplitterHeight
        {
            get
            {
                return this._bottomSplitterHeight;
            }
            set
            {
                this._bottomSplitterHeight = value;
            }
        }
        public int LeftSplitterWidth
        {
            get
            {
                return this._leftSplitterWidth;
            }
            set
            {
                this._leftSplitterWidth = value;
            }
        }
        public int RightSplitterWidth
        {
            get
            {
                return this._rightSplitterWidth;
            }
            set
            {
                this._rightSplitterWidth = value;
            }
        }

        //-------------------------------------------------------------------
        public VerticalBoxExpansion RightSpaceVerticalExpansion
        {
            get
            {
                return _rightBoxVerticalExpansionFlags;
            }
            set
            {
                _rightBoxVerticalExpansionFlags = value;
            }
        }


        public override void ArrangeAllSpaces()
        {
#if DEBUG

            //vinv.dbug_SetInitObject(this);
            //vinv.dbug_StartLayoutTrace(dbugVisualElementLayoutMsg.DockSpaceLayer_ArrAllDockSpaces);

#endif
            for (int i = _spaces.Length - 1; i >= 0; --i)
            {
                _spaces[i].CalculateContentSize();
            }
#if DEBUG
            //vinv.dbug_EnterLayerReArrangeContent(this);<commit_msg>1475: DockSpaceController<commit_after>﻿//Apache2, 2014-present, WinterDev

using System;
namespace LayoutFarm.UI
{
    public class DockSpacesController : NinespaceController
    {
        VerticalBoxExpansion _leftBoxVerticalExpansionFlags = VerticalBoxExpansion.Default;
        VerticalBoxExpansion _rightBoxVerticalExpansionFlags = VerticalBoxExpansion.Default;
        int _topSplitterHeight;
        int _bottomSplitterHeight;
        int _leftSplitterWidth;
        int _rightSplitterWidth;

        public event EventHandler FinishNineSpaceArrangement;
        public DockSpacesController(AbstractRectUI owner, SpaceConcept initConcept)
            : base(owner, initConcept)
        {
            _myOwner = owner;
            switch (initConcept)
            {
                case SpaceConcept.TwoSpaceHorizontal: //top-bottom
                    {
                        _spaces[L] = InitSpace(SpaceName.Left);
                        _spaces[R] = InitSpace(SpaceName.Right);
                    }
                    break;
                case SpaceConcept.TwoSpaceVertical: //left-right
                    {
                        _spaces[T] = InitSpace(SpaceName.Top);
                        _spaces[B] = InitSpace(SpaceName.Bottom);
                    }
                    break;
                case SpaceConcept.ThreeSpaceHorizontal:
                    {
                        //left-center-right 
                        _spaces[L] = InitSpace(SpaceName.Left);
                        _spaces[C] = InitSpace(SpaceName.Center);
                        _spaces[R] = InitSpace(SpaceName.Right);
                    }
                    break;
                case SpaceConcept.ThreeSpaceVertical:
                    {
                        //top-center-bottom                        
                        _spaces[T] = InitSpace(SpaceName.Top);
                        _spaces[C] = InitSpace(SpaceName.Center);
                        _spaces[B] = InitSpace(SpaceName.Bottom);
                    }
                    break;
                case SpaceConcept.FourSpace:
                    {
                        _spaces[FOURSPACE_LT] = InitSpace(SpaceName.LeftTop);
                        _spaces[FOURSPACE_RT] = InitSpace(SpaceName.RightTop);
                        _spaces[FOURSPACE_RB] = InitSpace(SpaceName.RightBottom);
                        _spaces[FOURSPACE_LB] = InitSpace(SpaceName.LeftBottom);
                    }
                    break;
                case SpaceConcept.FiveSpace:
                    {
                        _spaces[L] = InitSpace(SpaceName.Left);
                        _spaces[R] = InitSpace(SpaceName.Right);
                        _spaces[T] = InitSpace(SpaceName.Top);
                        _spaces[B] = InitSpace(SpaceName.Bottom);
                        _spaces[C] = InitSpace(SpaceName.Center);
                    }
                    break;
                case SpaceConcept.NineSpace:
                default:
                    {
                        _spaces[L] = InitSpace(SpaceName.Left);
                        _spaces[R] = InitSpace(SpaceName.Right);
                        _spaces[T] = InitSpace(SpaceName.Top);
                        _spaces[B] = InitSpace(SpaceName.Bottom);
                        _spaces[C] = InitSpace(SpaceName.Center);
                        _spaces[LT] = InitSpace(SpaceName.LeftTop);
                        _spaces[RT] = InitSpace(SpaceName.RightTop);
                        _spaces[RB] = InitSpace(SpaceName.RightBottom);
                        _spaces[LB] = InitSpace(SpaceName.LeftBottom);
                    }
                    break;
            }
        }
        public void SetSize(int w, int h)
        {
            //set controller size
            _sizeW = w;
            _sizeH = h;
            //-------------
            //arrange all space position 
            this.ArrangeAllSpaces();
        }
        public VerticalBoxExpansion LeftSpaceVerticalExpansion
        {
            get => _leftBoxVerticalExpansionFlags;
            set => _leftBoxVerticalExpansionFlags = value;
        }
        public int TopSplitterHeight
        {
            get => _topSplitterHeight;
            set => _topSplitterHeight = value;
        }
        public int BottomSplitterHeight
        {
            get => _bottomSplitterHeight;
            set => _bottomSplitterHeight = value;
        }
        public int LeftSplitterWidth
        {
            get => _leftSplitterWidth;
            set => _leftSplitterWidth = value;
        }
        public int RightSplitterWidth
        {
            get => _rightSplitterWidth;
            set => _rightSplitterWidth = value;
        }

        //-------------------------------------------------------------------
        public VerticalBoxExpansion RightSpaceVerticalExpansion
        {
            get => _rightBoxVerticalExpansionFlags;
            set => _rightBoxVerticalExpansionFlags = value;
        }


        public override void ArrangeAllSpaces()
        {
#if DEBUG

            //vinv.dbug_SetInitObject(this);
            //vinv.dbug_StartLayoutTrace(dbugVisualElementLayoutMsg.DockSpaceLayer_ArrAllDockSpaces);

#endif
            for (int i = _spaces.Length - 1; i >= 0; --i)
            {
                _spaces[i].CalculateContentSize();
            }
#if DEBUG
            //vinv.dbug_EnterLayerReArrangeContent(this);
{'fraction_non_alphanumeric': 0.08570679713437009, 'fraction_numerical': 0.0015726017822820198, 'mean_word_length': 1.15007513148009, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7663881', 'n_tokens_mistral': 2909, 'n_tokens_neox': 2637, 'n_words': 424}