Пример #1
0
		public bool CanPlace(System.Collections.Generic.ICollection<DesignItem> childItems, PlacementType type, PlacementAlignment position)
		{
			return type == PlacementType.Resize &&
				(position == PlacementAlignment.Right
				 || position == PlacementAlignment.BottomRight
				 || position == PlacementAlignment.Bottom);
		}
Пример #2
0
        protected DesignerThumb CreateThumb(PlacementAlignment alignment, Cursor cursor, int index)
        {
            DesignerThumb designerThumb = new MultiPointThumb
            {
                Index              = index,
                Alignment          = alignment,
                Cursor             = cursor,
                IsPrimarySelection = true
            };
            AdornerPlacement ap = Place(designerThumb, alignment, index);

            (designerThumb as MultiPointThumb).AdornerPlacement = ap;

            AdornerPanel.SetPlacement(designerThumb, ap);
            adornerPanel.Children.Add(designerThumb);

            DragListener drag = new DragListener(designerThumb);

            WeakEventManager <DesignerThumb, MouseButtonEventArgs> .AddHandler(designerThumb,
                                                                               "PreviewMouseLeftButtonDown", ResizeThumbOnMouseLeftButtonUp);

            drag.Started   += drag_Started;
            drag.Changed   += drag_Changed;
            drag.Completed += drag_Completed;
            return(designerThumb);
        }
Пример #3
0
        /// <summary>
        /// Places resize thumbs at their respective positions
        /// and streches out thumbs which are at the center of outline to extend resizability across the whole outline
        /// </summary>
        /// <param name="designerThumb"></param>
        /// <param name="alignment"></param>
        /// <param name="index">if using a polygon or multipoint adorner this is the index of the point in the Points array</param>
        /// <returns></returns>
        protected PointTrackerPlacementSupport Place(DesignerThumb designerThumb, PlacementAlignment alignment,
                                                     int index = -1)
        {
            PointTrackerPlacementSupport placement =
                new PointTrackerPlacementSupport(ExtendedItem.View as Shape, alignment, index);

            return(placement);
        }
Пример #4
0
		protected DesignerThumb CreateThumb(PlacementAlignment alignment, Cursor cursor)
		{
			DesignerThumb designerThumb = new DesignerThumb { Alignment = alignment, Cursor = cursor, IsPrimarySelection = true};
			AdornerPanel.SetPlacement(designerThumb, Place(designerThumb, alignment));

			adornerPanel.Children.Add(designerThumb);

			DragListener = new DragListener(designerThumb);
			DragListener.Started += drag_Started;
			DragListener.Changed += drag_Changed;
			DragListener.Completed += drag_Completed;
			
			return designerThumb;
		}
		protected UserControlPointsObjectThumb CreateThumb(PlacementAlignment alignment, Cursor cursor, DependencyProperty property)
		{
			var designerThumb = new UserControlPointsObjectThumb { Alignment = alignment, Cursor = cursor, IsPrimarySelection = true, DependencyProperty = property };
			AdornerPanel.SetPlacement(designerThumb, Place(designerThumb, alignment));

			adornerPanel.Children.Add(designerThumb);

			DragListener = new DragListener(designerThumb);
			DragListener.Started += drag_Started;
			DragListener.Changed += drag_Changed;
			DragListener.Completed += drag_Completed;

			return designerThumb;
		}
Пример #6
0
		ResizeThumb CreateThumb(PlacementAlignment alignment, Cursor cursor)
		{
			ResizeThumb resizeThumb = new ResizeThumbImpl( cursor == Cursors.SizeNS, cursor == Cursors.SizeWE );
			resizeThumb.Cursor = cursor;
			resizeThumb.Alignment = alignment;
			AdornerPanel.SetPlacement(resizeThumb, Place(ref resizeThumb, alignment));
			adornerPanel.Children.Add(resizeThumb);
			
			DragListener drag = new DragListener(resizeThumb);
			drag.Started += new DragHandler(drag_Started);
			drag.Changed += new DragHandler(drag_Changed);
			drag.Completed += new DragHandler(drag_Completed);
			return resizeThumb;
		}
Пример #7
0
        ResizeThumb CreateThumb(PlacementAlignment alignment, Cursor cursor)
        {
            ResizeThumb resizeThumb = new ResizeThumbImpl(cursor == Cursors.SizeNS, cursor == Cursors.SizeWE);

            resizeThumb.Cursor    = cursor;
            resizeThumb.Alignment = alignment;
            AdornerPanel.SetPlacement(resizeThumb, Place(ref resizeThumb, alignment));
            adornerPanel.Children.Add(resizeThumb);

            DragListener drag = new DragListener(resizeThumb);

            drag.Started   += new DragHandler(drag_Started);
            drag.Changed   += new DragHandler(drag_Changed);
            drag.Completed += new DragHandler(drag_Completed);
            return(resizeThumb);
        }
        DesignerThumb CreateThumb(PlacementAlignment alignment, Cursor cursor)
        {
            DesignerThumb designerThumb = new ResizeThumb(cursor == Cursors.SizeNS, cursor == Cursors.SizeWE);

            designerThumb.Cursor    = cursor;
            designerThumb.Alignment = alignment;
            AdornerPanel.SetPlacement(designerThumb, Place(ref designerThumb, alignment));
            adornerPanel.Children.Add(designerThumb);

            DragListener drag = new DragListener(designerThumb);

            drag.Started   += drag_Started;
            drag.Changed   += drag_Changed;
            drag.Completed += drag_Completed;
            return(designerThumb);
        }
Пример #9
0
        protected DesignerThumb CreateThumb(PlacementAlignment alignment, Cursor cursor)
        {
            DesignerThumb designerThumb = new DesignerThumb {
                Alignment = alignment, Cursor = cursor, IsPrimarySelection = true
            };

            AdornerPanel.SetPlacement(designerThumb, Place(designerThumb, alignment));

            adornerPanel.Children.Add(designerThumb);

            DragListener            = new DragListener(designerThumb);
            DragListener.Started   += drag_Started;
            DragListener.Changed   += drag_Changed;
            DragListener.Completed += drag_Completed;

            return(designerThumb);
        }
Пример #10
0
        protected UserControlPointsObjectThumb CreateThumb(PlacementAlignment alignment, Cursor cursor, DependencyProperty property)
        {
            var designerThumb = new UserControlPointsObjectThumb {
                Alignment = alignment, Cursor = cursor, IsPrimarySelection = true, DependencyProperty = property
            };

            AdornerPanel.SetPlacement(designerThumb, Place(designerThumb, alignment));

            adornerPanel.Children.Add(designerThumb);

            DragListener            = new DragListener(designerThumb);
            DragListener.Started   += drag_Started;
            DragListener.Changed   += drag_Changed;
            DragListener.Completed += drag_Completed;

            return(designerThumb);
        }
		protected DesignerThumb CreateThumb(PlacementAlignment alignment, Cursor cursor, int index)
		{
			DesignerThumb designerThumb = new MultiPointThumb { Index = index, Alignment = alignment, Cursor = cursor, IsPrimarySelection = true };
			AdornerPlacement ap = Place(designerThumb, alignment, index);
			(designerThumb as MultiPointThumb).AdornerPlacement = ap;

			AdornerPanel.SetPlacement(designerThumb, ap);
			adornerPanel.Children.Add(designerThumb);

			DragListener drag = new DragListener(designerThumb);

			WeakEventManager<DesignerThumb, MouseButtonEventArgs>.AddHandler(designerThumb, "PreviewMouseLeftButtonDown", ResizeThumbOnMouseLeftButtonUp);

			drag.Started += drag_Started;
			drag.Changed += drag_Changed;
			drag.Completed += drag_Completed;
			return designerThumb;
		}
Пример #12
0
        protected virtual PathThumb CreateThumb(PlacementAlignment alignment, Cursor cursor, int index,
                                                PathPoint pathpoint, Transform transform)
        {
            var designerThumb = new PathThumb(index, pathpoint)
            {
                Cursor = cursor
            };

            designerThumb.OperationMenu = BuildMenu(pathpoint);

            designerThumb.InnerRenderTransform = ((Transform)transform.Inverse);

            if (pathpoint.TargetPathPoint != null)
            {
                designerThumb.IsEllipse  = true;
                designerThumb.Foreground = Brushes.Blue;

                var bnd = new Binding("TranslatedPoint")
                {
                    Source    = pathpoint.TargetPathPoint,
                    Mode      = BindingMode.OneWay,
                    Converter = new RelativeToPointConverter(pathpoint)
                };
                designerThumb.SetBinding(PathThumb.RelativeToPointProperty, bnd);
            }

            AdornerPanel.SetPlacement(designerThumb, designerThumb.AdornerPlacement);
            adornerPanel.Children.Add(designerThumb);

            DragListener drag = new DragListener(designerThumb);

            drag.Transform = transform;

            WeakEventManager <DesignerThumb, MouseButtonEventArgs> .AddHandler(designerThumb,
                                                                               "PreviewMouseLeftButtonDown", ResizeThumbOnMouseLeftButtonUp);

            drag.MouseDown += drag_MouseDown;
            drag.Started   += drag_Started;
            drag.Changed   += drag_Changed;
            drag.Completed += drag_Completed;
            return(designerThumb);
        }
Пример #13
0
		/// <summary>
		/// Places resize thumbs at their respective positions
		/// and streches out thumbs which are at the center of outline to extend resizability across the whole outline
		/// </summary>
		/// <param name="resizeThumb"></param>
		/// <param name="alignment"></param>
		/// <returns></returns>
		private RelativePlacement Place(ref ResizeThumb resizeThumb,PlacementAlignment alignment)
		{
			RelativePlacement placement = new RelativePlacement(alignment.Horizontal,alignment.Vertical);
			
			if (alignment.Horizontal == HorizontalAlignment.Center)
			{
				placement.WidthRelativeToContentWidth = 1;
				placement.HeightOffset = 6;
				resizeThumb.Opacity = 0;
				return placement;
			}
			if (alignment.Vertical == VerticalAlignment.Center)
			{
				placement.HeightRelativeToContentHeight = 1;
				placement.WidthOffset = 6;
				resizeThumb.Opacity = 0;
				return placement;
			}
			
			placement.WidthOffset = 6;
			placement.HeightOffset = 6;
			return placement;
		}
        /// <summary>
        /// Places resize thumbs at their respective positions
        /// and streches out thumbs which are at the center of outline to extend resizability across the whole outline
        /// </summary>
        /// <param name="designerThumb"></param>
        /// <param name="alignment"></param>
        /// <returns></returns>
        private RelativePlacement Place(ref DesignerThumb designerThumb, PlacementAlignment alignment)
        {
            RelativePlacement placement = new RelativePlacement(alignment.Horizontal, alignment.Vertical);

            if (alignment.Horizontal == HorizontalAlignment.Center)
            {
                placement.WidthRelativeToContentWidth = 1;
                placement.HeightOffset = 6;
                designerThumb.Opacity  = 0;
                return(placement);
            }
            if (alignment.Vertical == VerticalAlignment.Center)
            {
                placement.HeightRelativeToContentHeight = 1;
                placement.WidthOffset = 6;
                designerThumb.Opacity = 0;
                return(placement);
            }

            placement.WidthOffset  = 6;
            placement.HeightOffset = 6;
            return(placement);
        }
		protected virtual PathThumb CreateThumb(PlacementAlignment alignment, Cursor cursor, int index, PathPoint pathpoint, Transform transform)
		{
			var designerThumb = new PathThumb(index, pathpoint) {Cursor = cursor};
			designerThumb.OperationMenu = BuildMenu(pathpoint);
			
			designerThumb.InnerRenderTransform = ((Transform)transform.Inverse);
			
			if (pathpoint.TargetPathPoint != null) {
				designerThumb.IsEllipse = true;
				designerThumb.Foreground = Brushes.Blue;

				var bnd = new Binding("TranslatedPoint") { Source = pathpoint.TargetPathPoint, Mode = BindingMode.OneWay, Converter = new RelativeToPointConverter(pathpoint) };
				designerThumb.SetBinding(PathThumb.RelativeToPointProperty, bnd);
			}

			AdornerPanel.SetPlacement(designerThumb, designerThumb.AdornerPlacement);
			adornerPanel.Children.Add(designerThumb);

			DragListener drag = new DragListener(designerThumb);
			drag.Transform = transform;

			WeakEventManager<DesignerThumb, MouseButtonEventArgs>.AddHandler(designerThumb, "PreviewMouseLeftButtonDown", ResizeThumbOnMouseLeftButtonUp);

			drag.MouseDown += drag_MouseDown;
			drag.Started += drag_Started;
			drag.Changed += drag_Changed;
			drag.Completed += drag_Completed;
			return designerThumb;
		}
		public virtual bool CanPlace(IEnumerable<DesignItem> childItems, PlacementType type, PlacementAlignment position)
		{
			return true;
		}
 public virtual bool CanPlace(IEnumerable <DesignItem> childItems, PlacementType type, PlacementAlignment position)
 {
     return(type == PlacementType.Delete);
 }
Пример #18
0
 public bool CanPlace(IEnumerable <DesignItem> childItems, PlacementType type, PlacementAlignment position)
 {
     return(type == PlacementType.Resize && (position == PlacementAlignment.Right ||
                                             position == PlacementAlignment.BottomRight ||
                                             position == PlacementAlignment.Bottom));
 }
		void AddLines(Rect r, double inflate, bool requireOverlap, List<Snapline> h, List<Snapline> v, PlacementAlignment? filter)
		{
			Rect r2 = r;
			r2.Inflate(inflate, inflate);
			
			if (filter == null || filter.Value.Vertical == VerticalAlignment.Top)
				h.Add(new Snapline() { RequireOverlap = requireOverlap, Offset = r2.Top - 1, Start = r.Left, End = r.Right });
			if (filter == null || filter.Value.Vertical == VerticalAlignment.Bottom)
				h.Add(new Snapline() { RequireOverlap = requireOverlap, Offset = r2.Bottom - 1, Start = r.Left, End = r.Right });
			if (filter == null || filter.Value.Horizontal == HorizontalAlignment.Left)
				v.Add(new Snapline() { RequireOverlap = requireOverlap, Offset = r2.Left - 1, Start = r.Top, End = r.Bottom });
			if (filter == null || filter.Value.Horizontal == HorizontalAlignment.Right)
				v.Add(new Snapline() { RequireOverlap = requireOverlap, Offset = r2.Right - 1, Start = r.Top, End = r.Bottom });
		}
Пример #20
0
 public ArrowLinePointTrackerPlacementSupport(Shape s, PlacementAlignment align, int index)
 {
     shape     = s;
     alignment = align;
     Index     = index;
 }
Пример #21
0
		public virtual bool CanPlace(ICollection<DesignItem> childItems, PlacementType type, PlacementAlignment position)
		{
			return true;
		}
Пример #22
0
 public bool CanPlace(System.Collections.Generic.ICollection <DesignItem> childItems, PlacementType type, PlacementAlignment position)
 {
     return(type == PlacementType.Resize &&
            (position == PlacementAlignment.Right ||
             position == PlacementAlignment.BottomRight ||
             position == PlacementAlignment.Bottom));
 }
Пример #23
0
 public virtual bool CanPlace(ICollection <DesignItem> childItems, PlacementType type, PlacementAlignment position)
 {
     return(true);
 }
		public PointTrackerPlacementSupport(Shape s, PlacementAlignment align, int index)
		{
			shape = s;
			alignment = align;
			Index = index;
		}
Пример #25
0
		/// <summary>
		/// Places resize thumbs at their respective positions
		/// and streches out thumbs which are at the center of outline to extend resizability across the whole outline
		/// </summary>
		/// <param name="designerThumb"></param>
		/// <param name="alignment"></param>
		/// <param name="index">if using a polygon or multipoint adorner this is the index of the point in the Points array</param>
		/// <returns></returns>
		protected PointTrackerPlacementSupport Place(ref DesignerThumb designerThumb, PlacementAlignment alignment, int index = -1)
		{
			PointTrackerPlacementSupport placement = new PointTrackerPlacementSupport(ExtendedItem.View as Shape, alignment, index);
			return placement;
		}
Пример #26
0
		public bool CanPlace(IEnumerable<DesignItem> childItems, PlacementType type, PlacementAlignment position)
		{
			return type == PlacementType.Resize && (position == PlacementAlignment.Right || position == PlacementAlignment.BottomRight || position == PlacementAlignment.Bottom);
		}