Ejemplo n.º 1
0
 public static Orientation?GetDockOrientation(this DockTarget d)
 {
     if (d == DockTarget.Center)
     {
         return(null);
     }
     else if (d == DockTarget.DockLeft || d == DockTarget.DockRight || d == DockTarget.SplitLeft || d == DockTarget.SplitRight)
     {
         return(Orientation.Horizontal);
     }
     else
     {
         return(Orientation.Vertical);
     }
 }
Ejemplo n.º 2
0
        protected override void PrepareAdornerLayer(DockAdornerWindow adornerLayer, ViewElement floatingElement)
        {
            DockTarget      target           = (DockTarget)adornerLayer.AdornedElement;
            ConstrainedView constrainedView1 = target.TargetElement as ConstrainedView;
            ConstrainedView constrainedView2 = floatingElement as ConstrainedView;

            if (constrainedView2 != null)
            {
                constrainedView2.ApplyFloatingConstraints(adornerLayer, target);
            }
            if (constrainedView1 == null)
            {
                return;
            }
            constrainedView1.ApplyDockTargetConstraints(adornerLayer, floatingElement);
        }
Ejemplo n.º 3
0
                internal _DockIndicator(AuDockPanel manager, _Float gfloat)
                {
                    _manager = manager;
                    _float   = gfloat;
                    _target  = new DockTarget();

                    this.SuspendLayout();
                    this.AutoScaleMode   = AutoScaleMode.None;
                    this.FormBorderStyle = FormBorderStyle.None;
                    this.StartPosition   = FormStartPosition.Manual;
                    this.Bounds          = _manager._firstSplit.RectangleInScreen;
                    this.Opacity         = 0.3;
                    this.TransparencyKey = Color.Yellow;
                    this.SetStyle(ControlStyles.Opaque, true);
                    this.ResumeLayout(false);
                }
Ejemplo n.º 4
0
        internal DockEventArgs(IEnumerable <FrameworkElement> sourceItems, FrameworkElement targetElement, DockTarget targetDock, object targetIndex)
        {
            SourceWindow  = Window.GetWindow(sourceItems.First());
            SourceContent = sourceItems.Select(i => i.GetContainerContext() ?? i);
            TargetDock    = targetDock;
            TargetItem    = targetIndex;

            if (targetDock.GetDockOrientation() == Orientation.Horizontal)
            {
                DesiredSize = Math.Min(SourceWindow.ActualWidth, targetElement.ActualWidth / 2);
            }
            else
            {
                DesiredSize = Math.Min(SourceWindow.ActualHeight, targetElement.ActualHeight / 2);
            }
        }
Ejemplo n.º 5
0
            internal DockTarget Drag(Point p)
            {
                bool       canDock = false;
                DockTarget target  = null;

                AWnd  w    = (AWnd)this;
                RECT  r    = w.Rect;
                Point offs = new Point(p.X - r.left, p.Y - r.top);
                bool  ok   = Au.Util.ADragDrop.SimpleDragDrop(w, MButtons.Left, d =>
                {
                    if (d.Msg.message != Api.WM_MOUSEMOVE)
                    {
                        return;
                    }

                    p = AMouse.XY;
                    w.MoveLL(p.X - offs.X, p.Y - offs.Y);

                    if (!canDock && ModifierKeys.HasFlag(Keys.Alt))
                    {
                        canDock = true;
                        //this.AllowTransparency = true; this.Opacity = 0.5; //exception
                        ((AWnd)this).SetTransparency(true, 128);
                        _dockIndic = new _DockIndicator(_manager, this);
                        _dockIndic.Show(this);
                    }
                    if (canDock)
                    {
                        _dockIndic.OnFloatMoved(_manager.PointToClient(p));
                    }
                });

                if (canDock)
                {
                    ((AWnd)this).SetTransparency(false);
                    _dockIndic.Close();
                    if (ok)
                    {
                        target = _dockIndic.OnFloatDropped();
                    }
                    _dockIndic = null;
                }

                return(target);
            }
Ejemplo n.º 6
0
        protected override bool IsValidFillPreviewOperation(DockTarget dockTarget, ViewElement dockingView)
        {
            if (!base.IsValidFillPreviewOperation(dockTarget, dockingView))
            {
                return(false);
            }
            ConstrainedView constrainedView1 = dockTarget.TargetElement as ConstrainedView;
            ConstrainedView constrainedView2 = dockingView as ConstrainedView;

            if (constrainedView1 != null && !constrainedView1.IsValidFillPreviewOperation(dockTarget, dockingView))
            {
                return(false);
            }
            if (constrainedView2 != null)
            {
                return(constrainedView2.IsValidFillPreviewOperation(dockTarget, dockingView));
            }
            return(true);
        }
Ejemplo n.º 7
0
        protected override bool IsValidDockTarget(DockTarget target, IList <DockSiteType> types, ViewElement floatingElement)
        {
            if (!base.IsValidDockTarget(target, types, floatingElement))
            {
                return(false);
            }
            ConstrainedView constrainedView1 = target.TargetElement as ConstrainedView;
            ConstrainedView constrainedView2 = floatingElement as ConstrainedView;

            if (constrainedView1 != null && !constrainedView1.IsFloatingElementValidForDock(floatingElement))
            {
                return(false);
            }
            if (constrainedView2 != null)
            {
                return(constrainedView2.IsDockTargetValidForDock(target));
            }
            return(true);
        }
Ejemplo n.º 8
0
        public Rect MeasureTabStrip()
        {
            if (this.TabStrip == null)
            {
                throw new InvalidOperationException("TabStrip must be initialized.");
            }
            this.draggedTabPosition = -1;
            Point topLeft     = new Point(double.MaxValue, double.MaxValue);
            Point bottomRight = new Point(double.MinValue, double.MinValue);

            this.tabRects.Clear();
            foreach (UIElement uiElement in this.TabStrip.Children)
            {
                TabItem tabChild = uiElement as TabItem;
                if (tabChild != null)
                {
                    this.MeasureTabItem(tabChild, ref topLeft, ref bottomRight);
                    ViewElement viewElement = tabChild.DataContext as ViewElement;
                    if (viewElement != null && viewElement == this.DraggedViewElement)
                    {
                        this.draggedTabPosition = this.tabRects.Count - 1;
                    }
                }
            }
            if (topLeft.X == double.MaxValue || topLeft.Y == double.MaxValue || (bottomRight.X == double.MinValue || bottomRight.Y == double.MinValue))
            {
                topLeft.X     = 0.0;
                topLeft.Y     = 0.0;
                bottomRight.X = 0.0;
                bottomRight.Y = 0.0;
                this.tabRects.Clear();
            }
            this.tabStripRect = new Rect(topLeft, bottomRight);
            DockTarget ancestor = Microsoft.VisualStudio.PlatformUI.ExtensionMethods.FindAncestor <DockTarget>((Visual)this.TabStrip);

            if (ancestor != null && ancestor.DockTargetType == DockTargetType.Auto && ExtensionMethods.IsConnectedToPresentationSource((DependencyObject)ancestor))
            {
                this.tabStripRect = new Rect(ancestor.PointToScreen(new Point(0.0, 0.0)), DpiHelper.LogicalToDeviceUnits(new Size(ancestor.ActualWidth, ancestor.ActualHeight)));
            }
            this.NormalizeTabHeight();
            return(this.tabStripRect);
        }
Ejemplo n.º 9
0
 public static Dock?GetDockSide(this DockTarget d)
 {
     if (d == DockTarget.Center)
     {
         return(null);
     }
     else if (d == DockTarget.DockLeft || d == DockTarget.SplitLeft)
     {
         return(Dock.Left);
     }
     else if (d == DockTarget.DockTop || d == DockTarget.SplitTop)
     {
         return(Dock.Top);
     }
     else if (d == DockTarget.DockRight || d == DockTarget.SplitRight)
     {
         return(Dock.Right);
     }
     else
     {
         return(Dock.Bottom);
     }
 }
Ejemplo n.º 10
0
 public override bool IsValidFillPreviewOperation(DockTarget target, ViewElement floatingElement)
 {
     return(false);
 }
Ejemplo n.º 11
0
        public override void ApplyFloatingConstraints(DockAdornerWindow adornerLayer, DockTarget target)
        {
            DockAdornerWindow dockAdornerWindow = adornerLayer;
            int num1 = dockAdornerWindow.IsInnerCenterTargetEnabled ? 1 : 0;
            int num2 = 0;

            dockAdornerWindow.IsInnerCenterTargetEnabled = num2 != 0;
        }
Ejemplo n.º 12
0
        public void DockTarget_Ctor()
        {
            var actual = new DockTarget();

            Assert.NotNull(actual);
        }
Ejemplo n.º 13
0
 public override void OnMouseMove(Point position)
 {
     DockTarget dockTarget = null;
     if ((Control.ModifierKeys & Keys.Control) != Keys.Control)
     {
         dockTarget = FindDockTarget(position);
     }
     if (dockTarget == null || (dockTarget.type == DockTargetType.Undefined && Manager != null && AllowFloat))
     {
         if (Manager != null && AllowFloat)
         {
             dockTarget = new DockTarget(DockTargetType.Float);
         }
         else
         {
             dockTarget = new DockTarget(DockTargetType.None);
         }
     }
     if (dockTarget.type == DockTargetType.Undefined)
     {
         dockTarget.type = DockTargetType.None;
     }
     if (dockTarget.type == DockTargetType.Float)
     {
         dockTarget.Bounds = new Rectangle(Point_0, size_0);
         dockTarget.Bounds = method_6(dockTarget.Bounds);
     }
     if (dockTarget.layoutSystem == SourceControlSystem && SourceControl != null)
     {
         if (dockTarget.DockSide == DockSide.None)
         {
             UpdateHintForm();
             ControlLayoutSystem controlLayoutSystem = (ControlLayoutSystem)SourceControlSystem;
             if (dockTarget.index != controlLayoutSystem.Controls.IndexOf(SourceControl))
             {
                 if (dockTarget.index != controlLayoutSystem.Controls.IndexOf(SourceControl) + 1)
                 {
                     controlLayoutSystem.Controls.SetChildIndex(SourceControl, dockTarget.index);
                 }
             }
             dockTarget.type = DockTargetType.AlreadyActioned;
             goto IL_147;
         }
     }
     if (dockTarget.type != DockTargetType.None)
     {
         method_1(dockTarget.Bounds, dockTarget.type == DockTargetType.JoinExistingSystem);
     }
     else
     {
         UpdateHintForm();
     }
     IL_147:
     if (Container is DocumentContainer)
     {
         if (dockTarget.type == DockTargetType.AlreadyActioned)
         {
             Cursor.Current = Cursors.Default;
         }
         else if (dockTarget.type != DockTargetType.None)
         {
             Cursor.Current = cursor_0;
         }
         else
         {
             Cursor.Current = cursor_1;
         }
     }
     Target = dockTarget;
 }
Ejemplo n.º 14
0
 protected DockTarget method_13(DockContainer dockContainer_1, ControlLayoutSystem controlLayoutSystem_1, Point point_1, bool bool_2)
 {
     DockTarget dockTarget = new DockTarget(DockTargetType.Undefined);
     Point point = dockContainer_1.PointToClient(point_1);
     if (SourceControl != null || controlLayoutSystem_1 != SourceControlSystem)
     {
         if (controlLayoutSystem_1.Rectangle_0.Contains(point) || controlLayoutSystem_1.rectangle_2.Contains(point))
         {
             dockTarget = new DockTarget(DockTargetType.JoinExistingSystem)
             {
                 dockContainer = dockContainer_1,
                 layoutSystem = controlLayoutSystem_1,
                 DockSide = DockSide.None,
                 Bounds = new Rectangle(dockContainer_1.PointToScreen(controlLayoutSystem_1.Bounds.Location),
                         controlLayoutSystem_1.Bounds.Size)
             };
             dockTarget.index = !controlLayoutSystem_1.rectangle_2.Contains(point) ? controlLayoutSystem_1.Controls.Count : controlLayoutSystem_1.method_15(point);
         }
         if (dockTarget.type == DockTargetType.Undefined && bool_2)
         {
             dockTarget = method_14(dockContainer_1, controlLayoutSystem_1, point_1);
         }
         return dockTarget;
     }
     return controlLayoutSystem_1.Rectangle_0.Contains(point) ? new DockTarget(DockTargetType.None) : new DockTarget(DockTargetType.Undefined);
 }
Ejemplo n.º 15
0
 private DockTarget method_3(Point point_0)
 {
     var dockTarget = new DockTarget(DockTargetType.SplitExistingSystem)
     {
         layoutSystem = _layoutSystem,
         dockContainer = _layoutSystem?.DockContainer
     };
     if (method_5(Rectangle_1, point_0) && _manager.method_5(ContainerDockLocation.Top))
     {
         if (DockStyle != DockStyle.Top)
         {
             if (DockStyle != DockStyle.Fill)
             {
                 goto IL_75;
             }
         }
         dockTarget.DockLocation = ContainerDockLocation.Top;
         dockTarget.DockSide = DockSide.Top;
         goto IL_178;
     }
     IL_75:
     if (method_5(Rectangle_2, point_0) && _manager.method_5(ContainerDockLocation.Right))
     {
         if (DockStyle != DockStyle.Right)
         {
             if (DockStyle != DockStyle.Fill)
             {
                 goto IL_B9;
             }
         }
         dockTarget.DockLocation = ContainerDockLocation.Right;
         dockTarget.DockSide = DockSide.Right;
         goto IL_178;
     }
     IL_B9:
     if (method_5(Rectangle_3, point_0) && _manager.method_5(ContainerDockLocation.Bottom))
     {
         if (DockStyle == DockStyle.Bottom || DockStyle == DockStyle.Fill)
         {
             dockTarget.DockLocation = ContainerDockLocation.Bottom;
             dockTarget.DockSide = DockSide.Bottom;
             goto IL_178;
         }
     }
     if (!method_5(Rectangle_4, point_0) || !_manager.method_5(ContainerDockLocation.Left) || (DockStyle != DockStyle.Left && DockStyle != DockStyle.Fill))
     {
         if (method_5(Rectangle_0, point_0) && _manager.method_5(ContainerDockLocation.Center))
         {
             if (DockStyle == DockStyle.Fill)
             {
                 dockTarget.DockLocation = ContainerDockLocation.Center;
                 dockTarget.DockSide = DockSide.None;
                 goto IL_178;
             }
         }
         dockTarget.type = DockTargetType.Undefined;
     }
     else
     {
         dockTarget.DockLocation = ContainerDockLocation.Left;
         dockTarget.DockSide = DockSide.Left;
     }
     IL_178:
     if (dockTarget.type != DockTargetType.Undefined)
     {
         dockTarget.type = DockTargetType.CreateNewContainer;
         dockTarget.middle = DockStyle == DockStyle.Fill;
         dockTarget.Bounds = smethod_2(_manager.method_8(dockTarget.DockLocation, _manager.DockedSize, dockTarget.middle), _manager.Manager.DockSystemContainer);
     }
     return dockTarget;
 }
Ejemplo n.º 16
0
 private DockTarget method_2(Point point_0)
 {
     var dockTarget = new DockTarget(DockTargetType.SplitExistingSystem)
     {
         layoutSystem = _layoutSystem,
         dockContainer = _layoutSystem.DockContainer
     };
     if (method_5(Rectangle_1, point_0))
     {
         dockTarget.DockSide = DockSide.Top;
     }
     else if (!method_5(Rectangle_2, point_0))
     {
         if (!method_5(Rectangle_3, point_0))
         {
             if (!method_5(Rectangle_4, point_0))
             {
                 if (!method_5(Rectangle_0, point_0))
                 {
                     dockTarget.type = DockTargetType.Undefined;
                 }
                 else
                 {
                     dockTarget.type = DockTargetType.JoinExistingSystem;
                     dockTarget.DockSide = DockSide.None;
                 }
             }
             else
             {
                 dockTarget.DockSide = DockSide.Left;
             }
         }
         else
         {
             dockTarget.DockSide = DockSide.Bottom;
         }
     }
     else
     {
         dockTarget.DockSide = DockSide.Right;
     }
     dockTarget.Bounds = _manager.method_20(_layoutSystem.DockContainer, _layoutSystem, dockTarget.DockSide);
     return dockTarget;
 }
Ejemplo n.º 17
0
 private ControlLayoutSystem method_23(Point point_1, out DockTarget dockTarget_1)
 {
     dockTarget_1 = null;
     for (int i = 1; i >= 0; i--)
     {
         bool flag = Convert.ToBoolean(i);
         ControlLayoutSystem[] controlLayoutSystem_ = ControlLayoutSystem_0;
         foreach (ControlLayoutSystem controlLayoutSystem in controlLayoutSystem_)
         {
             if (controlLayoutSystem.DockContainer.IsFloating == flag)
             {
                 Rectangle rectangle = new Rectangle(controlLayoutSystem.DockContainer.PointToScreen(controlLayoutSystem.Bounds.Location), controlLayoutSystem.Bounds.Size);
                 if (rectangle.Contains(point_1))
                 {
                     dockTarget_1 = method_13(controlLayoutSystem.DockContainer, controlLayoutSystem, point_1, false);
                     ControlLayoutSystem result;
                     if (dockTarget_1.type != DockTargetType.Undefined)
                     {
                         result = null;
                     }
                     else
                     {
                         result = controlLayoutSystem;
                     }
                     return result;
                 }
             }
         }
     }
     return null;
 }
Ejemplo n.º 18
0
 public abstract bool IsDockTargetValidForDock(DockTarget target);
Ejemplo n.º 19
0
 private void method_15(DockContainer dockContainer_1, ControlLayoutSystem controlLayoutSystem_1, DockTarget dockTarget_1, Rectangle rectangle_1, Point point_1)
 {
     rectangle_1.X = rectangle_1.Right - 30;
     rectangle_1.Y = rectangle_1.Bottom - 30;
     point_1.X -= rectangle_1.Left;
     point_1.Y -= rectangle_1.Top;
     rectangle_1 = new Rectangle(0, 0, 30, 30);
     method_19(dockContainer_1, controlLayoutSystem_1, dockTarget_1, point_1.Y > rectangle_1.Top + (int)(rectangle_1.Height * ((float)point_1.X / rectangle_1.Width))
         ? DockSide.Bottom
         : DockSide.Right);
 }
Ejemplo n.º 20
0
        private void OnFloatingElementDocked(object sender, FloatingElementDockedEventArgs args)
        {
            if (args.Content == null)
            {
                return;
            }
            DockTarget dockTarget = (DockTarget)sender;

            if (args.CreateDocumentGroup)
            {
                DocumentGroup          documentGroup = dockTarget.DataContext as DocumentGroup;
                DocumentGroupContainer container     = dockTarget.DataContext as DocumentGroupContainer;
                if (documentGroup == null)
                {
                    documentGroup = container.Children[0] as DocumentGroup;
                }
                if (container == null)
                {
                    container = documentGroup.Parent as DocumentGroupContainer;
                }
                Orientation orientation = container.Orientation;
                int         position    = container.Children.IndexOf((ViewElement)documentGroup);
                switch (args.DockDirection)
                {
                case DockDirection.FirstValue:
                    orientation = Orientation.Vertical;
                    break;

                case DockDirection.Bottom:
                    orientation = Orientation.Vertical;
                    ++position;
                    break;

                case DockDirection.Left:
                    orientation = Orientation.Horizontal;
                    break;

                case DockDirection.Right:
                    orientation = Orientation.Horizontal;
                    ++position;
                    break;
                }
                container.Orientation = orientation;
                ViewElement viewElement = container.Children[0];
                DockOperations.Dock((ViewElement)DockOperations.CreateDocumentGroupAt(container, position), args.Content, DockDirection.Fill);
            }
            else if (dockTarget.DockTargetType == DockTargetType.Inside || dockTarget.DockTargetType == DockTargetType.CenterOnly || (dockTarget.DockTargetType == DockTargetType.SidesOnly || dockTarget.DockTargetType == DockTargetType.FillPreview))
            {
                ViewElement   targetView    = dockTarget.DataContext as ViewElement;
                DocumentGroup documentGroup = targetView as DocumentGroup;
                if (documentGroup != null && args.DockDirection != DockDirection.Fill)
                {
                    targetView = (ViewElement)documentGroup.Parent;
                }
                DockOperations.Dock(targetView, args.Content, args.DockDirection);
            }
            else
            {
                DockOperations.DockOutside(dockTarget.DataContext as ViewGroup, args.Content, args.DockDirection);
            }
        }
Ejemplo n.º 21
0
 public abstract void ApplyFloatingConstraints(DockAdornerWindow adornerLayer, DockTarget target);
Ejemplo n.º 22
0
 private void method_18(DockContainer dockContainer_1, ControlLayoutSystem controlLayoutSystem_1, DockTarget dockTarget_1, Rectangle rectangle_1, Point point_1)
 {
     point_1.X -= rectangle_1.Left;
     point_1.Y -= rectangle_1.Top;
     rectangle_1 = new Rectangle(0, 0, 30, 30);
     if (point_1.Y <=
         rectangle_1.Top + (int)(rectangle_1.Height * (point_1.X / (float)rectangle_1.Width)))
     {
         method_19(dockContainer_1, controlLayoutSystem_1, dockTarget_1, DockSide.Top);
     }
     else
     {
         method_19(dockContainer_1, controlLayoutSystem_1, dockTarget_1, DockSide.Left);
     }
 }
Ejemplo n.º 23
0
 public abstract bool IsValidFillPreviewOperation(DockTarget target, ViewElement floatingElement);
Ejemplo n.º 24
0
 private void method_19(DockContainer container, ControlLayoutSystem layoutSystem, DockTarget dockTarget, DockSide dockSide)
 {
     dockTarget.Bounds = method_20(container, layoutSystem, dockSide);
     dockTarget.DockSide = dockSide;
 }