Esempio n. 1
0
        public void AddPanel(OSCPanel panel, float minimalSize, float size = 0.5f)
        {
            var data = new PanelData();

            data.Panel            = panel;
            data.MinimumSizePixel = minimalSize;
            data.Size             = size;

            _storedPanelData.Add(data);

            var fullSize = 0f;

            foreach (var storedData in _storedPanelData)
            {
                fullSize += storedData.Size;
            }

            if (fullSize > 1f)
            {
                foreach (var storedData in _storedPanelData)
                {
                    storedData.Size = 1f / _storedPanelData.Count;
                }
            }

            if (_storedPanelData.Count < 2)
            {
                return;
            }

            _splitters.Clear();
            _selectedSplitter = null;

            Splitter previousSplitter = null;

            foreach (var storedData in _storedPanelData)
            {
                if (previousSplitter != null)
                {
                    previousSplitter.SecondPanel = storedData.Panel;
                    previousSplitter.SecondData  = storedData;

                    _splitters.Add(previousSplitter);
                }

                previousSplitter = new Splitter()
                {
                    FirstPanel = storedData.Panel,
                    FirstData  = storedData
                };
            }

            LoadData();
        }
Esempio n. 2
0
        public OSCPanel[] GetChildPanels()
        {
            var childs = new OSCPanel[_storedPanelData.Count];

            for (var i = 0; i < _storedPanelData.Count; i++)
            {
                childs[i] = _storedPanelData[i].Panel;
            }

            return(childs);
        }
Esempio n. 3
0
        public void AddPanel(OSCPanel panel, float minimalSize, float size = 0.5f)
        {
            var data = new PanelContainer();

            data.Panel            = panel;
            data.MinimumSizePixel = minimalSize;
            data.Size             = size;

            _panelContainers.Add(data);

            var fullSize = 0f;

            foreach (var storedData in _panelContainers)
            {
                fullSize += storedData.Size;
            }

            if (fullSize > 1f)
            {
                foreach (var panelContainer in _panelContainers)
                {
                    panelContainer.Size = 1f / _panelContainers.Count;
                }
            }

            if (_panelContainers.Count < 2)
            {
                return;
            }

            _splitters.Clear();
            _selectedSplitter = null;

            Splitter previousSplitter = null;

            foreach (var panelContainer in _panelContainers)
            {
                if (previousSplitter != null)
                {
                    previousSplitter.SecondPanel        = panelContainer.Panel;
                    previousSplitter.RightDownContainer = panelContainer;

                    _splitters.Add(previousSplitter);
                }

                previousSplitter = new Splitter()
                {
                    FirstPanel       = panelContainer.Panel,
                    LeftTopContainer = panelContainer
                };
            }

            LoadData();
        }
Esempio n. 4
0
        private Splitter GetSplitter(OSCPanel firstPanel)
        {
            foreach (var splitter in _splitters)
            {
                if (splitter.FirstPanel == firstPanel)
                {
                    return(splitter);
                }
            }

            return(null);
        }