Beispiel #1
0
        private IPane Remove(IPane parent, IPane pane)
        {
            if (parent is PaneGroup)
            {
                PaneGroup group = parent as PaneGroup;
                if (group.First == pane)
                {
                    return(group.Second);
                }
                if (group.Second == pane)
                {
                    return(group.First);
                }

                IPane resultPane = Remove(group.First, pane);
                if (resultPane != null)
                {
                    group.First = resultPane;
                }
                else
                {
                    resultPane = Remove(group.Second, pane);
                    if (resultPane != null)
                    {
                        group.Second = resultPane;
                    }
                }
            }

            return(null);
        }
Beispiel #2
0
        private PaneGroup FindParentGroup(PaneGroup group, IPane pane)
        {
            if (group.First == pane || group.Second == pane)
            {
                return(group);
            }

            PaneGroup childGroup = group.First as PaneGroup;
            PaneGroup foundGroup = null;

            if (childGroup != null)
            {
                foundGroup = FindParentGroup(childGroup, pane);
            }
            if (foundGroup != null)
            {
                return(foundGroup);
            }

            childGroup = group.Second as PaneGroup;
            if (childGroup != null)
            {
                foundGroup = FindParentGroup(childGroup, pane);
            }
            if (foundGroup != null)
            {
                return(foundGroup);
            }

            return(null);
        }
Beispiel #3
0
 public void SetRoot(DocumentsPane pane)
 {
     if (_rootPane == null)
     {
         _rootPane = pane;
     }
 }
Beispiel #4
0
            public IPane FindFirst(PaneCondition condition)
            {
                if (_pane != null)
                {
                    if (condition(_pane))
                    {
                        return(_pane);
                    }
                }
                else if (_childList != null)
                {
                    IPane p = _childList.FindFirst(condition);
                    if (p != null)
                    {
                        return(p);
                    }
                }

                if (_next != null)
                {
                    return(_next.FindFirst(condition));
                }

                return(null);
            }
 private void AssertPane(IPane view)
 {
     if (!_panes.Contains(view))
     {
         throw new Exception("pane does not belong to the environment");
     }
 }
        public void Draw(IPane pane)
        {
            AssertPane(pane);

            // TODO : deal with views that extend outside the visible console
            var top  = pane.Top;
            var left = pane.Left;

            foreach (var line in pane.VisibleBuffer)
            {
                Console.SetCursorPosition(left, top);
                if (top == Console.WindowHeight - 1 && left + line.Length == Console.WindowWidth)
                {
                    // this is the last console line and it goes all the way to the left edge. Time for
                    // some hackery to avoid the cursor pushing the buffer up by a line
                    Console.SetCursorPosition(left, top);
                    Console.Write(line.Last());
                    Console.MoveBufferArea(left, top, 1, 1, Console.WindowWidth - 1, top);
                    Console.SetCursorPosition(left, top);
                    Console.Write(line.Take(line.Length - 1).ToArray());
                }
                else
                {
                    Console.Write(line);
                }
                top++;
            }
            InitCursor();
        }
Beispiel #7
0
        private void SelectChanged([NotNull] IPane pane, [CanBeNull] IEnumerable <object> objects)
        {
            Debug.ArgumentNotNull(pane, nameof(pane));

            var servicePane = pane as IServicePane;

            if (servicePane == null)
            {
                return;
            }

            var trackSelection = servicePane.GetVsService(typeof(STrackSelection)) as ITrackSelection;

            if (trackSelection == null)
            {
                return;
            }

            var list = new ArrayList();

            if (objects != null)
            {
                foreach (var o in objects)
                {
                    list.Add(o);
                }
            }

            var container = new SelectionContainer
            {
                SelectedObjects = list
            };

            trackSelection.OnSelectChange(container);
        }
Beispiel #8
0
            private bool _splitterEventGuarding; //余計なイベントを無視するためのフラグ

            //SplitInfoからの構築用
            public DivisionNode(DivisionList parent, IPane pane, double ratio) {
                Debug.Assert(parent != null);
                Debug.Assert(pane != null);
                _parent = parent;
                _pane = pane;
                _ratio = ratio;
            }
Beispiel #9
0
        public void Move(Pane source, Pane destination, Dock dock)
        {
            IPane resultPane = Remove(_rootPane, source);

            if (resultPane != null)
            {
                _rootPane = resultPane;
            }

            PaneGroup parentGroup = FindParentGroup(_rootPane as PaneGroup, destination);

            if (parentGroup.First == destination)
            {
                switch (dock)
                {
                case Dock.Left:
                    parentGroup.First = new PaneGroup(source, destination, SplitOrientation.Vertical);
                    break;

                case Dock.Right:
                    parentGroup.First = new PaneGroup(destination, source, SplitOrientation.Vertical);
                    break;

                case Dock.Top:
                    parentGroup.First = new PaneGroup(source, destination, SplitOrientation.Horizontal);
                    break;

                case Dock.Bottom:
                    parentGroup.First = new PaneGroup(destination, source, SplitOrientation.Horizontal);
                    break;
                }
            }
            else
            {
                switch (dock)
                {
                case Dock.Left:
                    parentGroup.Second = new PaneGroup(source, destination, SplitOrientation.Vertical);
                    break;

                case Dock.Right:
                    parentGroup.Second = new PaneGroup(destination, source, SplitOrientation.Vertical);
                    break;

                case Dock.Top:
                    parentGroup.Second = new PaneGroup(source, destination, SplitOrientation.Horizontal);
                    break;

                case Dock.Bottom:
                    parentGroup.Second = new PaneGroup(destination, source, SplitOrientation.Horizontal);
                    break;
                }
            }

            if (source is DockablePane)
            {
                (source as DockablePane).Dock = dock;
            }
        }
Beispiel #10
0
 public void ReplaceChildListByPane(IPane pane)
 {
     Debug.Assert(!IsLeaf);
     _pane      = pane;
     _pane.Size = _childList.HostingControl.Size;
     _childList = null;
     Debug.Assert(IsLeaf);
 }
Beispiel #11
0
            private bool _splitterEventGuarding; //余計なイベントを無視するためのフラグ

            //SplitInfoからの構築用
            public DivisionNode(DivisionList parent, IPane pane, double ratio)
            {
                Debug.Assert(parent != null);
                Debug.Assert(pane != null);
                _parent = parent;
                _pane   = pane;
                _ratio  = ratio;
            }
Beispiel #12
0
            //隣へ挿入
            public void InsertNext(IPane newpane)
            {
                _ratio /= 2;
                DivisionNode newnode = new DivisionNode(_parent, newpane, _ratio); //等分に

                newnode._next = _next;
                _next         = newnode;
            }
Beispiel #13
0
 //子ペインとリストの交換。分割時と併合時に使う
 public void ReplacePaneByChildList(DivisionList newlist)
 {
     Debug.Assert(IsLeaf);
     newlist.HostingControl.Dock = _pane.Dock;
     newlist.HostingControl.Size = _pane.Size;
     _pane      = null;
     _childList = newlist;
     Debug.Assert(!IsLeaf);
 }
Beispiel #14
0
 /// <summary>
 /// Direct access from existing instance
 /// </summary>
 /// <param name="owp"></param>
 public void paneAttach(IVsOutputWindowPane owp)
 {
     if (upane != null)
     {
         Log.Debug("paneAttach-direct: pane is already attached.");
         return;
     }
     upane = new PaneCOM(owp);
 }
Beispiel #15
0
 /// <summary>
 /// Attach pane with EnvDTE.OutputWindowPane
 /// </summary>
 /// <param name="name">Name of the pane</param>
 /// <param name="dte2"></param>
 public void paneAttach(string name, EnvDTE80.DTE2 dte2)
 {
     dte = (EnvDTE.DTE)dte2;
     if (upane != null)
     {
         Log.Debug("paneAttach-DTE: pane is already attached.");
         return;
     }
     upane = new PaneDTE(dte2, name);
 }
Beispiel #16
0
        public void Track([NotNull] IPane pane, [CanBeNull] object selection)
        {
            Assert.ArgumentNotNull(pane, nameof(pane));

            var objects = new[]
            {
                selection
            };

            TrackSelection.SelectObjects(pane, objects);
        }
Beispiel #17
0
        /// <summary>
        /// Initialization of the IVsOutputWindowPane
        /// note: probably slow,
        ///       and be careful with using inside `Initialize()` method or constructor of main package,
        ///       may be inner exception for COM object in VS (tested on VS2013 with docked to output panel)
        ///       Otherwise, use the IVsUIShell.FindToolWindow (again, only with __VSFINDTOOLWIN.FTW_fFindFirst)
        /// </summary>
        /// <param name="name">Name of the pane</param>
        /// <param name="ow"></param>
        /// <param name="dteContext"></param>
        public void paneAttach(string name, IVsOutputWindow ow, EnvDTE.DTE dteContext)
        {
            dte = dteContext;

            if (upane != null)
            {
                Log.Debug("paneAttach-COM: pane is already attached.");
                return;
            }
            upane = new PaneCOM(ow, name);
        }
 public void AddView(IPane view)
 {
     _panes.Add(view);
     if (view.HasFocus)
     {
         foreach (var v in _panes.Where(x => x != view))
         {
             v.Blur();
         }
     }
     InitCursor();
 }
Beispiel #19
0
        //ペインの分割
        public SplitResult SplitPane(IPane target, IPane newpane, Direction direction)
        {
            Debug.Assert(newpane.AsDotNet().Parent == null);

            //分割可能かどうかのチェック1 総数
            if (_count >= _countLimit)
            {
                return(SplitResult.F_TooManyPanes);
            }

            //分割可能かどうかのチェック2 分割対象が最小サイズを満たしているか
            if (SizeToLength(target.Size, direction) < _minimumEdgeLength * 2 + PaneSplitter.SPLITTER_WIDTH)
            {
                return(SplitResult.F_TooSmallToSplit);
            }

            Control parent         = target.AsDotNet().Parent;
            bool    splitting_root = _rootList == null;

            if (splitting_root)   //空の状態からの構築
            {
                _rootList = new DivisionList(this, null, direction, target, newpane, target.Size, target.Dock);
                UIUtil.ReplaceControl(parent, target.AsDotNet(), _rootList.HostingControl);
            }
            else
            {
                DivisionNode node = _rootList.FirstNode.FindNode(target);
                Debug.Assert(node != null);
                if (direction == node.ParentList.Direction)   //同方向分割
                {
                    bool eq = node.ParentList.IsEquallyDivided;
                    node.InsertNext(newpane);
                    if (eq)
                    {
                        node.ParentList.AdjustRatioEqually();
                    }
                }
                else   //異方向分割
                {
                    DivisionList newlist = new DivisionList(this, node, direction, target, newpane, target.Size, target.Dock);
                    node.ReplacePaneByChildList(newlist);
                }
            }

            Rebuild();
            DoLayout();
            FindForm().MinimumSize = _rootList.FirstNode.RequiredMinimumSize; //!!TODO これはコントロールのサイズであり、フォームボーダーとは別の話

            _count++;
            return(SplitResult.Success);
        }
Beispiel #20
0
        public void ShowPane(IPane pane)
        {
            if (pane == null)
            {
                throw new ArgumentNullException(nameof(pane));
            }

            var wnd = new PaneWindow {
                Pane = pane
            };

            DockSite.DocumentWindows.Add(wnd);
            wnd.Activate();
        }
Beispiel #21
0
        public void draw(IContext context)
        {
            ISecurity baseSource            = source.getBaseSource();
            IDictionary <int, Trade> trades = source.getBarIndexedTrades();

            IList <double> losses = new List <double>(baseSource.Bars.Count);
            IList <double> wins   = new List <double>(baseSource.Bars.Count);

            for (int i = 0; i < baseSource.Bars.Count; i++)
            {
                if (trades.ContainsKey(i))
                {
                    if (trades[i].getProfit() > 0)
                    {
                        wins.Add(1);
                        losses.Add(0);
                    }
                    else
                    {
                        wins.Add(0);
                        losses.Add(1);
                    }
                }
                else
                {
                    wins.Add(0);
                    losses.Add(0);
                }
            }

            IPane tradesPanel = context.CreatePane("Trades", 10.0, true);

            tradesPanel.AddList(
                "Win trades",
                wins,
                ListStyles.HISTOHRAM,
                0x00ff00,
                LineStyles.SOLID,
                PaneSides.VSIDE_LAST
                );

            tradesPanel.AddList(
                "Loss trades",
                losses,
                ListStyles.HISTOHRAM,
                0xff0000,
                LineStyles.SOLID,
                PaneSides.VSIDE_LAST
                );
        }
Beispiel #22
0
        public PnLReport draw(IContext context)
        {
            IPane profitPane = context.CreatePane("Profit", 20.0, true);

            if (null != profitSource)
            {
                profitPane.AddList(
                    "ProfitPerMonth",
                    profitSource,
                    ListStyles.HISTOHRAM,
                    0x336699,
                    LineStyles.SOLID,
                    PaneSides.VSIDE_LAST
                    );
            }

            if (null != maxLossSource)
            {
                profitPane.AddList(
                    "MaxLossPerMonth",
                    maxLossSource,
                    ListStyles.HISTOHRAM,
                    0xff00000,
                    LineStyles.SOLID,
                    PaneSides.VSIDE_LAST
                    );
            }

            if (null != profitSource)
            {
                IList <double> profitSma = context.GetData(
                    "ProfitSma",
                    new[] { "3" }, delegate {
                    return(Series.SMA(profitSource, 3));
                }
                    );

                profitPane.AddList(
                    "ProfitPerMonthSma",
                    profitSma,
                    ListStyles.LINE,
                    0xff0000,
                    LineStyles.SOLID,
                    PaneSides.LEFT
                    );
            }

            return(this);
        }
Beispiel #23
0
        public IPane UnifyAll()
        {
            if (_rootList == null)
            {
                return(null);
            }

            IPane   r      = _rootList.FirstPane;
            Control parent = _rootList.HostingControl.Parent;

            UIUtil.ReplaceControl(parent, _rootList.HostingControl, r.AsDotNet());
            _rootList = null;
            _count    = 1;
            return(r);
        }
Beispiel #24
0
        void BottomPane_CloseButtonClicked(object sender, EventArgs e)
        {
            sessionSettings.BottomPaneSplitterPosition = bottomPaneRow.Height.Value / (bottomPaneRow.Height.Value + textViewRow.Height.Value);
            bottomPaneRow.MinHeight = 0;
            bottomPaneRow.Height    = new GridLength(0);
            bottomPane.IsVisible    = false;

            IPane pane = bottomPane.Content as IPane;

            bottomPane.Content = null;
            if (pane != null)
            {
                pane.Closed();
            }
        }
Beispiel #25
0
        void TopPane_CloseButtonClicked(object sender, EventArgs e)
        {
            sessionSettings.TopPaneSplitterPosition = topPaneRow.Height.Value / (topPaneRow.Height.Value + textViewRow.Height.Value);
            topPaneRow.MinHeight = 0;
            topPaneRow.Height    = new GridLength(0);
            topPane.Visibility   = Visibility.Collapsed;

            IPane pane = topPane.Content as IPane;

            topPane.Content = null;
            if (pane != null)
            {
                pane.Closed();
            }
        }
Beispiel #26
0
        public void ChangeDock(DockablePane pane, Dock dock)
        {
            //if (dock == pane.Dock)
            //    return;

            //rimuovo innanizitutto il pane dalla griglia
            IPane resultPane = Remove(_rootPane, pane);

            if (resultPane != null)
            {
                _rootPane = resultPane;
            }

            pane.Dock = dock;
            //(pane.Parent as Grid).Children.Remove(pane);
            Add(pane);
        }
Beispiel #27
0
 private void OnSplitterMouseUp(object sender, MouseEventArgs args)
 {
     if (args.Button != MouseButtons.Middle)
     {
         return; //中クリックのみに興味ある
     }
     PaneDivision.IUIActionHandler h = this.ParentDivision.UIActionHandler;
     if (h != null)
     {
         IPane unify_target = FindUnifyTarget();
         if (unify_target != null)
         {
             h.RequestUnify(unify_target);
         }
         //TODO 結合できないときは通知(ステータスバー等)が出せたほうがいいかも
     }
 }
        public IPane FindPaneFromContent(ManagedContent content)
        {
            IPane pane = First.FindPaneFromContent(content);

            if (pane != null)
            {
                return(pane);
            }

            pane = Second.FindPaneFromContent(content);
            if (pane != null)
            {
                return(pane);
            }

            return(null);
        }
Beispiel #29
0
 public void Add(DockablePane pane)
 {
     switch (pane.Dock)
     {
         case Dock.Right:
             _rootPane = new PaneGroup(_rootPane, pane, SplitOrientation.Vertical);
             break;
         case Dock.Left:
             _rootPane = new PaneGroup(pane, _rootPane, SplitOrientation.Vertical);
             break;
         case Dock.Bottom:
             _rootPane = new PaneGroup(_rootPane, pane, SplitOrientation.Horizontal);
             break;
         case Dock.Top:
             _rootPane = new PaneGroup(pane, _rootPane, SplitOrientation.Horizontal);
             break;
     }
 }
        public void GotFocus([NotNull] IPane pane)
        {
            Assert.ArgumentNotNull(pane, nameof(pane));

            if (pane.Content is ISelectionTracker)
            {
                return;
            }

            IEnumerable <object> selection = null;

            var tracker = pane.Content as ISelectionTracking;

            if (tracker != null)
            {
                selection = tracker.GetSelectedObjects();
            }

            AppHost.Selection.Track(pane, selection);
        }
Beispiel #31
0
 public void ShowInBottomPane(string title, object content)
 {
     bottomPaneRow.MinHeight = 100;
     if (sessionSettings.BottomPaneSplitterPosition > 0 && sessionSettings.BottomPaneSplitterPosition < 1)
     {
         textViewRow.Height   = new GridLength(1 - sessionSettings.BottomPaneSplitterPosition, GridUnitType.Star);
         bottomPaneRow.Height = new GridLength(sessionSettings.BottomPaneSplitterPosition, GridUnitType.Star);
     }
     bottomPane.Title = title;
     if (bottomPane.Content != content)
     {
         IPane pane = bottomPane.Content as IPane;
         if (pane != null)
         {
             pane.Closed();
         }
         bottomPane.Content = content;
     }
     bottomPane.Visibility = Visibility.Visible;
 }
Beispiel #32
0
        public void Add(DockablePane pane)
        {
            switch (pane.Dock)
            {
            case Dock.Right:
                _rootPane = new PaneGroup(_rootPane, pane, SplitOrientation.Vertical);
                break;

            case Dock.Left:
                _rootPane = new PaneGroup(pane, _rootPane, SplitOrientation.Vertical);
                break;

            case Dock.Bottom:
                _rootPane = new PaneGroup(_rootPane, pane, SplitOrientation.Horizontal);
                break;

            case Dock.Top:
                _rootPane = new PaneGroup(pane, _rootPane, SplitOrientation.Horizontal);
                break;
            }
        }
		public void ShowPane(IPane pane)
		{
			if (pane == null)
				throw new ArgumentNullException("pane");

			var wnd = new PaneWindow { Pane = pane };
			DockSite.DocumentWindows.Add(wnd);
			wnd.Activate();
		}
Beispiel #34
0
        /// <summary>
        /// Initialization of the IVsOutputWindowPane
        /// note: probably slow, 
        ///       and be careful with using inside `Initialize()` method or constructor of main package, 
        ///       may be inner exception for COM object in VS (tested on VS2013 with docked to output panel)
        ///       Otherwise, use the IVsUIShell.FindToolWindow (again, only with __VSFINDTOOLWIN.FTW_fFindFirst)
        /// </summary>
        /// <param name="name">Name of the pane</param>
        /// <param name="ow"></param>
        /// <param name="dteContext"></param>
        public void paneAttach(string name, IVsOutputWindow ow, EnvDTE.DTE dteContext)
        {
            dte = dteContext;

            if(upane != null) {
                Log.Debug("paneAttach-COM: pane is already attached.");
                return;
            }
            upane = new PaneCOM(ow, name);
        }
Beispiel #35
0
 /// <summary>
 /// Detaching OWP.
 /// </summary>
 public void paneDetach()
 {
     upane   = null;
     dte     = null;
 }
Beispiel #36
0
 //�q�y�C���ƃ��X�g�̌���B�������ƕ������Ɏg��
 public void ReplacePaneByChildList(DivisionList newlist)
 {
     Debug.Assert(IsLeaf);
     newlist.HostingControl.Dock = _pane.Dock;
     newlist.HostingControl.Size = _pane.Size;
     _pane = null;
     _childList = newlist;
     Debug.Assert(!IsLeaf);
 }
Beispiel #37
0
 public PaneGroup(IPane first, IPane second, SplitOrientation split)
 {
     First = first;
     Second = second;
     Split = split;
 }
Beispiel #38
0
		public void ShowInBottomPane(IPane content) {
			ShowPane(bottomPane, content, bottomPaneRow, sessionSettings.BottomPaneSettings);
		}
Beispiel #39
0
		public bool IsBottomPaneContent(IPane content) {
			return IsPaneContent(bottomPane, content);
		}
Beispiel #40
0
 //�ׂ֑}��
 public void InsertNext(IPane newpane)
 {
     _ratio /= 2;
     DivisionNode newnode = new DivisionNode(_parent, newpane, _ratio); //������
     newnode._next = _next;
     _next = newnode;
 }
Beispiel #41
0
        public void MoveInto(Pane source, Pane destination)
        {
            IPane resultPane = Remove(_rootPane, source);
            if (resultPane != null)
                _rootPane = resultPane;

            List<ManagedContent> ar = new List<ManagedContent>();
            foreach (ManagedContent content in source.Contents)
            {
                ar.Add(content);
                destination.Add(content);
            }

            foreach (ManagedContent content in ar)
                source.Remove(content);
        }
Beispiel #42
0
		bool IsPaneVisible(DockedPane pane, IPane content) {
			return pane.IsVisible && IsPaneContent(pane, content);
		}
Beispiel #43
0
 public void ReplaceChildListByPane(IPane pane)
 {
     Debug.Assert(!IsLeaf);
     _pane = pane;
     _pane.Size = _childList.HostingControl.Size;
     _childList = null;
     Debug.Assert(IsLeaf);
 }
Beispiel #44
0
		public bool IsBottomPaneVisible(IPane content) {
			return IsPaneVisible(bottomPane, content);
		}
Beispiel #45
0
		public bool IsTopPaneVisible(IPane content) {
			return IsPaneVisible(topPane, content);
		}
Beispiel #46
0
		bool IsPaneContent(DockedPane pane, IPane content) {
			return pane.Content == content;
		}
Beispiel #47
0
 /// <summary>
 /// Attach pane with EnvDTE.OutputWindowPane
 /// </summary>
 /// <param name="name">Name of the pane</param>
 /// <param name="dte2"></param>
 public void paneAttach(string name, EnvDTE80.DTE2 dte2)
 {
     dte = (EnvDTE.DTE)dte2;
     if(upane != null) {
         Log.Debug("paneAttach-DTE: pane is already attached.");
         return;
     }
     upane = new PaneDTE(dte2, name);
 }
Beispiel #48
0
        private PaneGroup FindParentGroup(PaneGroup group, IPane pane)
        {
            if (group.First == pane || group.Second == pane)
                return group;

            PaneGroup childGroup = group.First as PaneGroup;
            PaneGroup foundGroup = null;
            if (childGroup != null)
                foundGroup = FindParentGroup(childGroup, pane);
            if (foundGroup != null)
                return foundGroup;

            childGroup = group.Second as PaneGroup;
            if (childGroup != null)
                foundGroup = FindParentGroup(childGroup, pane);
            if (foundGroup != null)
                return foundGroup;

            return null;
        }
Beispiel #49
0
            //������ԂłQ�쐬
            public DivisionList(PaneDivision division, DivisionNode parent, Direction direction, IPane pane1, IPane pane2, Size host_size, DockStyle host_dock)
            {
                _parentDivision = division;
                _parentNode = parent;
                _direction = direction;

                pane1.Dock = DockStyle.Fill;
                pane2.Dock = _direction == Direction.TB ? DockStyle.Bottom : DockStyle.Right;
                _first = new DivisionNode(this, pane1, 1.0);
                _first.InsertNext(pane2);

                _hostingControl = new IntermediateContainer(division);
                _hostingControl.Size = host_size;
                _hostingControl.Dock = host_dock;
            }
Beispiel #50
0
        private IPane Remove(IPane parent, IPane pane)
        {
            if (parent is PaneGroup)
            {
                PaneGroup group = parent as PaneGroup;
                if (group.First == pane)
                    return group.Second;
                if (group.Second == pane)
                    return group.First;

                IPane resultPane = Remove(group.First, pane);
                if (resultPane != null)
                    group.First = resultPane;
                else
                {
                    resultPane = Remove(group.Second, pane);
                    if (resultPane != null)
                        group.Second = resultPane;
                }
            }

            return null;
        }
Beispiel #51
0
        public void Move(Pane source, Pane destination, Dock dock)
        {
            IPane resultPane = Remove(_rootPane, source);
            if (resultPane != null)
                _rootPane = resultPane;

            PaneGroup parentGroup = FindParentGroup(_rootPane as PaneGroup, destination);

            if (parentGroup.First == destination)
            {
                switch (dock)
                {
                    case Dock.Left:
                        parentGroup.First = new PaneGroup(source, destination, SplitOrientation.Vertical);
                        break;
                    case Dock.Right:
                        parentGroup.First = new PaneGroup(destination, source, SplitOrientation.Vertical);
                        break;
                    case Dock.Top:
                        parentGroup.First = new PaneGroup(source, destination, SplitOrientation.Horizontal);
                        break;
                    case Dock.Bottom:
                        parentGroup.First = new PaneGroup(destination, source, SplitOrientation.Horizontal);
                        break;
                }
            }
            else
            {
                switch (dock)
                {
                    case Dock.Left:
                        parentGroup.Second = new PaneGroup(source, destination, SplitOrientation.Vertical);
                        break;
                    case Dock.Right:
                        parentGroup.Second = new PaneGroup(destination, source, SplitOrientation.Vertical);
                        break;
                    case Dock.Top:
                        parentGroup.Second = new PaneGroup(source, destination, SplitOrientation.Horizontal);
                        break;
                    case Dock.Bottom:
                        parentGroup.Second = new PaneGroup(destination, source, SplitOrientation.Horizontal);
                        break;
                }
            }

            if (source is DockablePane)
                (source as DockablePane).Dock = dock;
        }
Beispiel #52
0
		public bool IsTopPaneContent(IPane content) {
			return IsPaneContent(topPane, content);
		}
Beispiel #53
0
 public void SetRoot(DocumentsPane pane)
 {
     if (_rootPane == null)
         _rootPane = pane;
 }
Beispiel #54
0
        public void ChangeDock(DockablePane pane, Dock dock)
        {
            //if (dock == pane.Dock)
            //    return;

            //rimuovo innanizitutto il pane dalla griglia
            IPane resultPane = Remove(_rootPane, pane);
            if (resultPane != null)
                _rootPane = resultPane;

            pane.Dock = dock;
            //(pane.Parent as Grid).Children.Remove(pane);
            Add(pane);
        }
Beispiel #55
0
        private void InternalArrange(Grid grid, IPane pane)
        {
            if (pane is UIElement)
            {
                grid.Children.Add(pane as UIElement);
            }
            else if (pane is PaneGroup)
            {
                PaneGroup group = pane as PaneGroup;
                if (group.First.Hidden && !group.Second.Hidden)
                    InternalArrange(grid, group.Second);
                else if (!group.First.Hidden && group.Second.Hidden)
                    InternalArrange(grid, group.First);
                else
                {
                    Grid firstGrid = new Grid();
                    Grid secondGrid = new Grid();

                    if (group.Split == SplitOrientation.Horizontal)
                    {
                        grid.ColumnDefinitions.Add(new ColumnDefinition());
                        grid.RowDefinitions.Add(new RowDefinition());
                        grid.RowDefinitions.Add(new RowDefinition());

                        grid.RowDefinitions[0].Height = group.First.GridHeight;
                        grid.RowDefinitions[1].Height = group.Second.GridHeight;

                        //if (!grid.RowDefinitions[0].Height.IsStar &&
                        //    !grid.RowDefinitions[1].Height.IsStar)
                        //    grid.RowDefinitions[1].Height = new GridLength(1, GridUnitType.Star);

                        firstGrid.SetValue(Grid.ColumnProperty, 0);
                        firstGrid.SetValue(Grid.RowProperty, 0);
                        secondGrid.SetValue(Grid.ColumnProperty, 0);
                        secondGrid.SetValue(Grid.RowProperty, 1);

                        GridSplitter splitter = new GridSplitter();
                        splitter.VerticalAlignment = VerticalAlignment.Top;
                        splitter.HorizontalAlignment = HorizontalAlignment.Stretch;
                        splitter.SetValue(Grid.ColumnProperty, 0);
                        splitter.SetValue(Grid.RowProperty, 1);
                        splitter.Height = 5;
                        secondGrid.Margin = new Thickness(0, 5, 0, 0);

                        grid.Children.Add(firstGrid);
                        grid.Children.Add(splitter);
                        grid.Children.Add(secondGrid);

                        InternalArrange(firstGrid, group.First);
                        InternalArrange(secondGrid, group.Second);
                    }
                    else
                    {
                        grid.ColumnDefinitions.Add(new ColumnDefinition());
                        grid.ColumnDefinitions.Add(new ColumnDefinition());
                        grid.RowDefinitions.Add(new RowDefinition());

                        grid.ColumnDefinitions[0].Width = group.First.GridWidth;
                        grid.ColumnDefinitions[1].Width = group.Second.GridWidth;
                        if (!grid.ColumnDefinitions[0].Width.IsStar &&
                            !grid.ColumnDefinitions[1].Width.IsStar)
                            grid.ColumnDefinitions[1].Width = new GridLength(1, GridUnitType.Star);

                        firstGrid.SetValue(Grid.ColumnProperty, 0);
                        firstGrid.SetValue(Grid.RowProperty, 0);
                        secondGrid.SetValue(Grid.ColumnProperty, 1);
                        secondGrid.SetValue(Grid.RowProperty, 0);

                        GridSplitter splitter = new GridSplitter();
                        splitter.VerticalAlignment = VerticalAlignment.Stretch;
                        splitter.HorizontalAlignment = HorizontalAlignment.Left;
                        splitter.SetValue(Grid.ColumnProperty, 1);
                        splitter.SetValue(Grid.RowProperty, 0);
                        splitter.Width = 5;
                        secondGrid.Margin = new Thickness(5, 0, 0, 0);

                        grid.Children.Add(firstGrid);
                        grid.Children.Add(splitter);
                        grid.Children.Add(secondGrid);

                        InternalArrange(firstGrid, group.First);
                        InternalArrange(secondGrid, group.Second);
                    }
                }
            }
        }
Beispiel #56
0
        //�y�C���̕���
        public SplitResult SplitPane(IPane target, IPane newpane, Direction direction)
        {
            Debug.Assert(newpane.AsDotNet().Parent == null);

            //�����”\���ǂ����̃`�F�b�N1 ����
            if (_count >= _countLimit)
                return SplitResult.F_TooManyPanes;

            //�����”\���ǂ����̃`�F�b�N2 �����Ώۂ��ŏ��T�C�Y�𖞂����Ă��邩
            if (SizeToLength(target.Size, direction) < _minimumEdgeLength * 2 + PaneSplitter.SPLITTER_WIDTH)
                return SplitResult.F_TooSmallToSplit;

            Control parent = target.AsDotNet().Parent;
            bool splitting_root = _rootList == null;

            if (splitting_root) { //��̏�Ԃ���̍\�z
                _rootList = new DivisionList(this, null, direction, target, newpane, target.Size, target.Dock);
                UIUtil.ReplaceControl(parent, target.AsDotNet(), _rootList.HostingControl);
            }
            else {
                DivisionNode node = _rootList.FirstNode.FindNode(target);
                Debug.Assert(node != null);
                if (direction == node.ParentList.Direction) { //����������
                    bool eq = node.ParentList.IsEquallyDivided;
                    node.InsertNext(newpane);
                    if (eq)
                        node.ParentList.AdjustRatioEqually();
                }
                else { //�ٕ�������
                    DivisionList newlist = new DivisionList(this, node, direction, target, newpane, target.Size, target.Dock);
                    node.ReplacePaneByChildList(newlist);
                }
            }

            Rebuild();
            DoLayout();
            FindForm().MinimumSize = _rootList.FirstNode.RequiredMinimumSize; //!!TODO ����̓R���g���[���̃T�C�Y�ł���A�t�H�[���{�[�_�[�Ƃ͕ʂ̘b

            _count++;
            return SplitResult.Success;
        }
Beispiel #57
0
        //�y�C����‚��Č�������Bout�̈����͎��Ƀt�H�[�J�X��^����ׂ��y�C��
        public SplitResult UnifyPane(IPane target, out IPane nextfocus)
        {
            nextfocus = null; //���s���ɂ̓N���A�ł���悤��
            Debug.Assert(_rootList != null);

            DivisionNode node = _rootList.FirstNode.FindNode(target);
            bool unifying_root = node.ParentList == _rootList && _rootList.NodeCount == 2; //�����̌���RootList������ւ��\��̂Ƃ�
            Control parent = _rootList.HostingControl.Parent;
            if (unifying_root && _rootList.FirstNode.IsLast)
                return SplitResult.F_UnifySingle;

            DivisionList list = node.ParentList;
            DivisionNode active = list.Remove(node);
            if (list.NodeCount == 1) { //�����Ȃ����Ƃ��ɖʓ|������
                if (active.IsLeaf) { // (1) �y�C���ł���Ƃ�
                    IPane newpane = active.Pane;
                    Debug.Assert(newpane != null);
                    if (list.ParentNode == null) { //1-1
                        UIUtil.ReplaceControl(parent, list.HostingControl, newpane.AsDotNet());
                        _rootList = null;
                    }
                    else { //1-2
                        list.ParentNode.ReplaceChildListByPane(newpane);
                    }
                }
                else { // (2) �m�[�h�ł���Ƃ�
                    DivisionList newlist = active.ChildList;
                    if (list.ParentNode == null) { //2-1
                        _rootList = newlist;
                        newlist.ClearParentNode();
                        UIUtil.ReplaceControl(parent, list.HostingControl, newlist.HostingControl);
                    }
                    else { //2-2
                        DivisionList pp = list.ParentNode.ParentList; //�����Ȃ���̃��X�g
                        Debug.Assert(pp.Direction == newlist.Direction);
                        pp.ReplaceNodeByList(list.ParentNode, newlist);
                    }
                }

            }

            if (_rootList != null) {
                Rebuild();
                DoLayout();
                FindForm().MinimumSize = _rootList.FirstNode.RequiredMinimumSize; //!!TODO Splitter�����ō\������Ă��Ȃ��t�H�[���ŃA�E�g
            }

            _count--;
            nextfocus = active.IsLeaf ? active.Pane : active.ChildList.FirstPane;
            return SplitResult.Success;
        }
Beispiel #58
0
		public void ShowInTopPane(IPane content) {
			ShowPane(topPane, content, topPaneRow, sessionSettings.TopPaneSettings);
		}
Beispiel #59
0
		static void ShowPane(DockedPane dockedPane, IPane content, RowDefinition paneRow, SessionSettings.PaneSettings paneSettings) {
			paneRow.MinHeight = 100;
			if (paneSettings.Height > 0 && (paneRow.Height == null || paneRow.Height.Value == 0))
				paneRow.Height = new GridLength(paneSettings.Height, GridUnitType.Pixel);
			dockedPane.Title = content.PaneTitle;
			if (dockedPane.Content != content) {
				var pane = dockedPane.Content;
				if (pane != null)
					pane.Closed();
				dockedPane.Content = content;
			}
			dockedPane.Visibility = Visibility.Visible;
			content.Opened();
		}
Beispiel #60
0
            //�q������^�[�Q�b�g��T��
            public DivisionNode FindNode(IPane t)
            {
                DivisionNode n = null;

                if (_pane != null && _pane.Equals(t))
                    return this; //struct�̂��Ƃ����̂�Equals��g��

                if (_next != null)
                    n = _next.FindNode(t);
                if (n != null)
                    return n;

                if (_childList != null)
                    n = _childList.FirstNode.FindNode(t);
                return n;
            }