示例#1
0
 protected virtual bool IsValidDockTarget(DockTarget target, IList <DockSiteType> types, ViewElement floatingElement)
 {
     if (target != null && (target.TargetElement == null || target.TargetElement.AreDockTargetsEnabled) && types.Contains(target.DockSiteType))
     {
         return(DockOperations.AreDockRestrictionsFulfilled(floatingElement.DockRestriction, target.TargetElement));
     }
     return(false);
 }
示例#2
0
        private void HandleDockIntoTabStrip(DraggedTabInfo tabInfo, DragUndockHeader header, DragAbsoluteEventArgs args)
        {
            int dockPosition = tabInfo.GetClosestTabIndexAt(args.ScreenPoint);

            if (-1 == dockPosition)
            {
                return;
            }
            ViewElement viewElement = tabInfo.TargetElement;

            if (viewElement == null && tabInfo.GroupContainer != null)
            {
                viewElement = (ViewElement)DockOperations.CreateDocumentGroupAt(tabInfo.GroupContainer, tabInfo.GroupPosition);
                viewElement.DockedHeight   = tabInfo.GroupDockedHeight;
                viewElement.DockedWidth    = tabInfo.GroupDockedWidth;
                viewElement.FloatingHeight = tabInfo.GroupFloatingHeight;
                viewElement.FloatingWidth  = tabInfo.GroupFloatingWidth;
            }
            if (!DockOperations.AreDockRestrictionsFulfilled(header.ViewElement, viewElement))
            {
                return;
            }
            bool      flag      = false;
            ViewGroup viewGroup = tabInfo.NestedGroup as ViewGroup;

            if (viewGroup != null)
            {
                flag = viewGroup.Children.Contains(header.ViewElement);
            }
            if (!flag && tabInfo.TabRects.Count > 0 && args.ScreenPoint.X > tabInfo.TabRects[tabInfo.TabRects.Count - 1].Right)
            {
                dockPosition = tabInfo.TabRects.Count;
            }
            if (tabInfo.TabRects.Count == 0)
            {
                dockPosition = 0;
            }
            if (DockManager.Instance.DraggedTabInfo != null && -1 != DockManager.Instance.DraggedTabInfo.DraggedTabPosition)
            {
                DockManager.Instance.DraggedTabInfo.RemoveTabRect(DockManager.Instance.DraggedTabInfo.DraggedTabPosition);
            }
            DockOperations.DockAt(viewElement, header.ViewElement, dockPosition);
            tabInfo.TabStrip.IsNotificationNeeded = true;
            tabInfo.DraggedTabPosition            = dockPosition;
            tabInfo.ClearVirtualTabRect();
            DockManager.Instance.ClearAdorners();
        }
示例#3
0
        public void PerformDrop(DragAbsoluteEventArgs args)
        {
            DragUndockHeader dragUndockHeader = args.OriginalSource as DragUndockHeader;
            FloatingWindow   floatingWindow   = Microsoft.VisualStudio.PlatformUI.ExtensionMethods.FindAncestor <FloatingWindow>((Visual)dragUndockHeader);

            DockManager.DockSiteHitTestResult hitElement = this.FindHitElement(args.ScreenPoint, (Predicate <DockManager.DockSite>)(s => s.Visual != floatingWindow));
            if (hitElement != null)
            {
                DockSiteAdorner   ancestorOrSelf1 = Microsoft.VisualStudio.PlatformUI.ExtensionMethods.FindAncestorOrSelf <DockSiteAdorner>(hitElement.VisualHit);
                DockAdornerWindow ancestorOrSelf2 = Microsoft.VisualStudio.PlatformUI.ExtensionMethods.FindAncestorOrSelf <DockAdornerWindow>(hitElement.VisualHit);
                DockTarget        dockTarget      = Microsoft.VisualStudio.PlatformUI.ExtensionMethods.FindAncestorOrSelf <DockTarget>(hitElement.VisualHit);
                DockDirection     dockDirection   = DockDirection.Fill;
                bool flag = false;
                bool createDocumentGroup = false;
                if (floatingWindow != null && this.IsValidFillPreviewOperation(dockTarget, dragUndockHeader.ViewElement))
                {
                    dockDirection = DockDirection.Fill;
                    flag          = true;
                }
                if (ancestorOrSelf1 != null && ancestorOrSelf2 != null && ancestorOrSelf2.AdornedElement != null)
                {
                    dockDirection = ancestorOrSelf1.DockDirection;
                    dockTarget    = ancestorOrSelf2.AdornedElement as DockTarget;
                    if (DockOperations.AreDockRestrictionsFulfilled(dragUndockHeader.ViewElement, dockTarget.TargetElement))
                    {
                        flag = true;
                        createDocumentGroup = ancestorOrSelf1.CreatesDocumentGroup;
                    }
                }
                if (flag)
                {
                    PerformanceUtility.MeasurePerformanceUntilRender(PerformanceEvent.DockPalette);
                    dockTarget.RaiseEvent((RoutedEventArgs) new FloatingElementDockedEventArgs(DockManager.FloatingElementDockedEvent, dragUndockHeader.ViewElement, dockDirection, createDocumentGroup));
                }
            }
            this.ClearAdorners();
        }
示例#4
0
        protected virtual bool IsValidFillPreviewOperation(DockTarget dockTarget, ViewElement dockingView)
        {
            bool flag = false;

            if (dockTarget != null && dockTarget.DockTargetType == DockTargetType.FillPreview && (DockOperations.AreDockRestrictionsFulfilled(dockingView, dockTarget.TargetElement) && dockTarget.TargetElement.AreDockTargetsEnabled))
            {
                flag = true;
            }
            return(flag);
        }