示例#1
0
 private HideCommand(DockItem dockItem)
     : base(dockItem)
 {
     Debug.Assert(dockItem.DockPosition != DockPosition.Hidden);
     Debug.Assert(dockItem.FirstPane != null);
     _showMethod = GetShowMethod(dockItem, dockItem.FirstPane);
 }
示例#2
0
 internal ShowAsFloatingAction(int source, Rect floatingWindowBounds, DockItemShowMethod showMethod)
     : base(source, showMethod)
 {
     _left   = floatingWindowBounds.Left;
     _top    = floatingWindowBounds.Top;
     _width  = floatingWindowBounds.Width;
     _height = floatingWindowBounds.Height;
 }
示例#3
0
 protected ShowActionEventArgs(DockItem item, DockControl dockControl, DockItemShowMethod showMethod)
     : base(item)
 {
     _dockControl           = dockControl;
     _oldDockTreePosition   = DockItem.DockTreePosition;
     _oldIsAutoHide         = DockItem.IsAutoHide;
     _oldDockPosition       = DockItem.DockPosition;
     _showAction            = new T();
     _showAction.Source     = DockControl.DockItems.IndexOf(item);
     _showAction.ShowMethod = showMethod;
 }
            public static void Execute(DockItem dockItem, DockItemShowMethod showMethod)
            {
                DockControl dockControl = dockItem.DockControl;

                if (dockControl.CanEnterUndo)
                {
                    dockControl.ExecuteCommand(new ToggleAutoHideCommand(dockItem, showMethod));
                }
                else
                {
                    dockItem.DoToggleAutoHide(showMethod);
                }
            }
            public static void Execute(DockItem dockItem, DockPane pane, int index, DockItemShowMethod showMethod)
            {
                DockControl dockControl = pane.DockControl;

                Debug.Assert(dockControl != null);
                if (TestUndo(dockItem, dockControl))
                {
                    dockControl.ExecuteCommand(new ShowAsTabbedCommand(dockItem, pane, index, showMethod));
                }
                else
                {
                    dockItem.DoShowAsTabbed(pane, index, showMethod);
                }
            }
示例#6
0
            private static ShowAction GetShowAsTabbedAction(DockItem item, DockPane pane)
            {
                DockControl        dockControl = item.DockControl;
                int                source      = dockControl.DockItems.IndexOf(item);
                DockItemShowMethod showMethod  = GetShowMethod(item, pane);

                int      index       = pane.Items.IndexOf(item);
                DockItem targetItem  = pane.Items[index == 0 ? 1 : 0];
                int      targetIndex = dockControl.DockItems.IndexOf(targetItem);

                if (index == pane.Items.Count - 1)
                {
                    index = -1;
                }
                return(new ShowAsTabbedAction(source, targetIndex, pane.IsFloating, index, showMethod));
            }
示例#7
0
            private static ShowAction GetShowAsSidePaneAction(DockItem item, DockPane pane)
            {
                DockPaneSplit split = pane.Parent;

                Debug.Assert(split != null);
                DockPaneNode targetPaneNode = split.Child1 == pane ? split.Child2 : split.Child1;

                Debug.Assert(targetPaneNode != null);
                DockPaneNodeStruct targetPaneNodeStruct = DockPaneNodeStruct.FromDockPaneNode(targetPaneNode);
                bool swapChildren = split.Child1 == targetPaneNode;
                Dock side;

                if (split.Orientation == Orientation.Horizontal)
                {
                    if (split.IsSplitterTopLeft)
                    {
                        side = Dock.Left;
                    }
                    else
                    {
                        side = Dock.Right;
                    }
                }
                else
                {
                    if (split.IsSplitterTopLeft)
                    {
                        side = Dock.Top;
                    }
                    else
                    {
                        side = Dock.Bottom;
                    }
                }
                SplitterDistance splitterDistance = split.SplitterDistance;

                int  source                   = pane.DockControl.DockItems.IndexOf(item);
                int  targetIndex              = targetPaneNodeStruct.ItemIndex;
                bool isFloating               = targetPaneNodeStruct.IsFloating;
                int  ancestorLevel            = targetPaneNodeStruct.AncestorLevel;
                bool isAutoHide               = pane.IsAutoHide;
                DockItemShowMethod showMethod = GetShowMethod(item, pane);

                return(new ShowAsSidePaneAction(source, targetIndex, isFloating, ancestorLevel, isAutoHide, side, splitterDistance, swapChildren, showMethod));
            }
示例#8
0
            private static ShowAction GetShowAsDockTreeRootAction(DockItem item, DockPane pane)
            {
                DockControl        dockControl = item.DockControl;
                int                source      = dockControl.DockItems.IndexOf(item);
                DockItemShowMethod showMethod  = GetShowMethod(item, pane);

                DockTree dockTree = pane.DockTree;

                if (dockTree.IsFloating)
                {
                    FloatingWindow floatingWindow = dockTree.FloatingWindow;
                    Rect           bounds         = new Rect(floatingWindow.Left, floatingWindow.Top, floatingWindow.Width, floatingWindow.Height);
                    return(new ShowAsFloatingAction(source, bounds, showMethod));
                }
                else
                {
                    DockPosition dockPosition = DockPositionHelper.GetDockPosition(pane.DockTreePosition, pane.IsAutoHide);
                    return(new ShowAsDockPositionAction(source, dockPosition, showMethod));
                }
            }
示例#9
0
 internal ShowAction(int source, DockItemShowMethod showMethod)
 {
     _source     = source;
     _showMethod = showMethod;
 }
            public ShowAsSidePaneEventArgs(DockItem dockItem, DockPaneNode paneNode, bool isAutoHide, Dock side, SplitterDistance size, bool isSizeForTarget, DockItemShowMethod showMethod)
                : base(dockItem, paneNode.DockControl, showMethod)
            {
                ShowAsSidePaneAction showAction     = StrongTypeShowAction;
                DockPaneNodeStruct   paneNodeStruct = DockPaneNodeStruct.FromDockPaneNode(paneNode);

                showAction.Target          = paneNodeStruct.ItemIndex;
                showAction.IsFloating      = paneNodeStruct.IsFloating;
                showAction.AncestorLevel   = paneNodeStruct.AncestorLevel;
                showAction.IsAutoHide      = isAutoHide;
                showAction.Side            = side;
                showAction.Size            = size;
                showAction.IsSizeForTarget = isSizeForTarget;
            }
示例#11
0
        private ShowAsSidePaneAction GetShowAsSidePaneAction(DockItem sourceItem, DockPane sourcePane, DockPane targetPane, int ancestorSplitLevel, DockPaneSplit split, DockItemShowMethod showMethod)
        {
            Debug.Assert(sourceItem != null);
            Debug.Assert(targetPane != null);

            Dock side;

            if (split.Orientation == Orientation.Horizontal)
            {
                if (split.IsSplitterTopLeft)
                {
                    side = Dock.Left;
                }
                else
                {
                    side = Dock.Right;
                }
            }
            else
            {
                if (split.IsSplitterTopLeft)
                {
                    side = Dock.Top;
                }
                else
                {
                    side = Dock.Bottom;
                }
            }

            SplitterDistance splitterDistance = split.SplitterDistance;

            DockPaneSplit child1Split  = split.Child1 as DockPaneSplit;
            bool          swapChildren = split.Child1 == targetPane || (child1Split != null && child1Split.IsParentOf(targetPane));

            int      source     = GetIndex(sourceItem);
            DockItem targetItem = GetItems(targetPane)[0];

            Debug.Assert(targetPane.Items.Contains(targetItem));
            int  targetIndex = GetIndex(targetItem);
            bool isAutoHide  = sourcePane.IsAutoHide;

            return(new ShowAsSidePaneAction(source, targetIndex, targetPane.IsFloating, ancestorSplitLevel, isAutoHide, side, splitterDistance, swapChildren, showMethod));
        }
示例#12
0
 internal ShowInDockTreeAction(int source, int target, bool isFloating, DockItemShowMethod showMethod)
     : base(source, showMethod)
 {
     _target     = target;
     _isFloating = isFloating;
 }
示例#13
0
 internal ShowAsDockPositionAction(int source, DockPosition dockPosition, DockItemShowMethod showMethod)
     : base(source, showMethod)
 {
     _dockPosition = dockPosition;
 }
示例#14
0
        private ShowAction GetShowAction(DockItem item, DockPane pane)
        {
            Debug.Assert(item != null);
            Debug.Assert(pane != null && pane.Items.Contains(item));
            Debug.Assert(item.FirstPane == pane || item.SecondPane == pane);

            int source = GetIndex(item);
            DockItemShowMethod showMethod = item.SecondPane == pane || item.IsHidden ? DockItemShowMethod.Hide : DockItemShowMethod.Activate;

            Collection <DockItem> items;
            ShowAction            action;

            if (_panes.Contains(pane))
            {
                items = GetItems(pane);
                DockItem targetItem   = items[0];
                int      targetIndex  = GetIndex(targetItem);
                DockItem itemToInsert = FindItemToInsert(item, pane);
                int      index        = itemToInsert == null ? -1 : items.IndexOf(itemToInsert);
                action = new ShowAsTabbedAction(source, targetIndex, pane.IsFloating, index, showMethod);
            }
            else
            {
                if (IsDockTreeEmpty(pane))
                {
                    DockTree dockTree = pane.DockTree;

                    if (dockTree.IsFloating)
                    {
                        showMethod = DockItemShowMethod.Activate;
                        FloatingWindow floatingWindow = dockTree.FloatingWindow;
                        Rect           bounds         = new Rect(floatingWindow.Left, floatingWindow.Top, floatingWindow.Width, floatingWindow.Height);
                        action = new ShowAsFloatingAction(source, bounds, showMethod);
                    }
                    else
                    {
                        DockPosition dockPosition = DockPositionHelper.GetDockPosition(pane.DockTreePosition, pane.IsAutoHide);
                        action = new ShowAsDockPositionAction(source, dockPosition, showMethod);
                    }
                }
                else
                {
                    DockPane      targetPane = null;
                    DockPaneSplit split;
                    for (split = pane.Parent; split != null; split = split.Parent)
                    {
                        foreach (DockPane pane1 in _panes)
                        {
                            if (split.IsParentOf(pane1))
                            {
                                targetPane = pane1;
                                break;
                            }
                        }
                        if (targetPane != null)
                        {
                            break;
                        }
                    }
                    Debug.Assert(targetPane != null);
                    Debug.Assert(split != null);

                    int ancestorSplitLevel = 0;
                    foreach (DockPaneSplit split1 in _splits)
                    {
                        if (split.IsParentOf(split1) && split1.IsParentOf(targetPane))
                        {
                            ancestorSplitLevel++;
                        }
                    }
                    action = GetShowAsSidePaneAction(item, pane, targetPane, ancestorSplitLevel, split, showMethod);
                    _splits.Add(split);
                }
                _panes.Add(pane);
                items = new Collection <DockItem>();
                _itemsCollections.Add(items);
            }
            items.Add(item);
            return(action);
        }
 private ShowAsFloatingCommand(DockItem dockItem, Rect floatingWindowBounds, DockItemShowMethod showMethod)
     : base(dockItem, showMethod)
 {
     _floatingWindowBounds = floatingWindowBounds;
 }
 public ToggleAutoHideEventArgs(DockItem dockItem, bool isAutoHide, DockItemShowMethod showMethod)
     : base(dockItem)
 {
     _isAutoHide = isAutoHide;
     _showMethod = showMethod;
 }
示例#17
0
            public static void Execute(DockItem dockItem, DockPaneNode paneNode, bool isAutoHide, Dock side, SplitterDistance size, bool isSizeForTarget, DockItemShowMethod showMethod)
            {
                DockControl dockControl = paneNode.DockControl;

                Debug.Assert(dockControl != null);
                if (TestUndo(dockItem, dockControl))
                {
                    dockControl.ExecuteCommand(new ShowAsSidePaneCommand(dockItem, paneNode, isAutoHide, side, size, isSizeForTarget, showMethod));
                }
                else // if (dockItem.DockControl == dockControl) Fix for 1.1.3730: this condition will prevent unattached DockItem from showing
                {
                    dockItem.DoShowAsSidePane(paneNode, isAutoHide, side, size, isSizeForTarget, showMethod);
                }
            }
 protected ShowCommandBase(DockItem dockItem, DockItemShowMethod showMethod)
     : base(dockItem)
 {
     _showMethod = showMethod;
 }
示例#19
0
 private ShowAsDockPositionCommand(DockItem dockItem, DockPosition dockPosition, DockItemShowMethod showMethod)
     : base(dockItem, showMethod)
 {
     _dockPosition = dockPosition;
 }
示例#20
0
 public static void Execute(DockItem dockItem, DockControl dockControl, DockPosition dockPosition, DockItemShowMethod showMethod)
 {
     Debug.Assert(dockControl != null);
     if (TestUndo(dockItem, dockControl))
     {
         dockControl.ExecuteCommand(new ShowAsDockPositionCommand(dockItem, dockPosition, showMethod));
     }
     else
     {
         dockItem.DoShowAsDockPosition(dockControl, dockPosition, showMethod);
     }
 }
 public ShowAsDockPositionEventArgs(DockItem dockItem, DockControl dockControl, DockPosition dockPosition, DockItemShowMethod showMethod)
     : base(dockItem, dockControl, showMethod)
 {
     StrongTypeShowAction.DockPosition = dockPosition;
 }
示例#22
0
 internal ShowAsTabbedAction(int source, int target, bool isFloating, int index, DockItemShowMethod showMethod)
     : base(source, target, isFloating, showMethod)
 {
     _index = index;
 }
 private ShowAsTabbedCommand(DockItem dockItem, DockPane pane, int index, DockItemShowMethod showMethod)
     : base(dockItem, showMethod)
 {
     TargetPane = pane;
     _index     = index;
 }
示例#24
0
            public ShowAsFloatingEventArgs(DockItem dockItem, DockControl dockControl, Rect floatingWindowBounds, DockItemShowMethod showMethod)
                : base(dockItem, dockControl, showMethod)
            {
                ShowAsFloatingAction showAction = StrongTypeShowAction;

                showAction.Left   = floatingWindowBounds.Left;
                showAction.Top    = floatingWindowBounds.Top;
                showAction.Width  = floatingWindowBounds.Width;
                showAction.Height = floatingWindowBounds.Height;
            }
示例#25
0
 internal ShowAsSidePaneAction(int source, int target, bool isFloating, int ancestorLevel, bool isAutoHide, Dock side, SplitterDistance size, bool isSizeForTarget, DockItemShowMethod showMethod)
     : base(source, target, isFloating, showMethod)
 {
     _ancestorLevel   = ancestorLevel;
     _isAutoHide      = isAutoHide;
     _side            = side;
     _size            = size;
     _isSizeForTarget = isSizeForTarget;
 }
示例#26
0
            public ShowAsTabbedEventArgs(DockItem dockItem, DockPane pane, int index, DockItemShowMethod showMethod)
                : base(dockItem, pane.DockControl, showMethod)
            {
                ShowAsTabbedAction showAction     = StrongTypeShowAction;
                DockPaneNodeStruct paneNodeStruct = DockPaneNodeStruct.FromDockPaneNode(pane);

                showAction.Target     = paneNodeStruct.ItemIndex;
                showAction.IsFloating = paneNodeStruct.IsFloating;
                showAction.Index      = index;
            }
 private ToggleAutoHideCommand(DockItem dockItem, DockItemShowMethod showMethod)
     : base(dockItem)
 {
     _showMethod     = showMethod;
     _undoShowMethod = GetShowMethod(dockItem, dockItem.FirstPane);
 }
示例#28
0
 private ShowAsSidePaneCommand(DockItem dockItem, DockPaneNode paneNode, bool isAutoHide, Dock side, SplitterDistance size, bool isSizeForTarget, DockItemShowMethod showMethod)
     : base(dockItem, showMethod)
 {
     TargetPaneNode   = paneNode;
     _isAutoHide      = isAutoHide;
     _side            = side;
     _size            = size;
     _isSizeForTarget = isSizeForTarget;
 }
 public static void Execute(DockItem dockItem, DockControl dockControl, Rect floatingWindowBounds, DockItemShowMethod showMethod)
 {
     Debug.Assert(dockControl != null);
     if (TestUndo(dockItem, dockControl))
     {
         dockControl.ExecuteCommand(new ShowAsFloatingCommand(dockItem, floatingWindowBounds, showMethod));
     }
     else
     {
         dockItem.DoShowAsFloating(dockControl, floatingWindowBounds, showMethod);
     }
 }