Beispiel #1
0
 /// <summary>
 /// Creates a new <see cref="XQBezier"/> instance.
 /// </summary>
 /// <param name="x1"></param>
 /// <param name="y1"></param>
 /// <param name="x2"></param>
 /// <param name="y2"></param>
 /// <param name="x3"></param>
 /// <param name="y3"></param>
 /// <param name="style"></param>
 /// <param name="point"></param>
 /// <param name="isStroked"></param>
 /// <param name="isFilled"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static XQBezier Create(
     double x1, double y1,
     double x2, double y2,
     double x3, double y3,
     ShapeStyle style,
     BaseShape point,
     bool isStroked = true,
     bool isFilled = false,
     string name = "")
 {
     return new XQBezier()
     {
         Name = name,
         Style = style,
         IsStroked = isStroked,
         IsFilled = isFilled,
         Data = new Data()
         {
             Bindings = ImmutableArray.Create<Binding>(),
             Properties = ImmutableArray.Create<Property>()
         },
         Point1 = XPoint.Create(x1, y1, point),
         Point2 = XPoint.Create(x2, y2, point),
         Point3 = XPoint.Create(x3, y3, point)
     };
 }
Beispiel #2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="x1"></param>
 /// <param name="y1"></param>
 /// <param name="x2"></param>
 /// <param name="y2"></param>
 /// <param name="style"></param>
 /// <param name="point"></param>
 /// <param name="isStroked"></param>
 /// <param name="isFilled"></param>
 /// <param name="text"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static XEllipse Create(
     double x1, double y1,
     double x2, double y2,
     ShapeStyle style,
     BaseShape point,
     bool isStroked = true,
     bool isFilled = false,
     string text = null,
     string name = "")
 {
     return new XEllipse()
     {
         Name = name,
         Style = style,
         IsStroked = isStroked,
         IsFilled = isFilled,
         Data = new Data()
         {
             Bindings = ImmutableArray.Create<ShapeBinding>(),
             Properties = ImmutableArray.Create<ShapeProperty>()
         },
         TopLeft = XPoint.Create(x1, y1, point),
         BottomRight = XPoint.Create(x2, y2, point),
         Text = text,
     };
 }
Beispiel #3
0
 /// <summary>
 /// Initializes a new <see cref="RendererState"/> instance.
 /// </summary>
 public RendererState()
 {
     _panX = 0.0;
     _panY = 0.0;
     _zoom = 1.0;
     _enableAutofit = true;
     _drawShapeState = ShapeState.Create(ShapeStateFlags.Visible | ShapeStateFlags.Printable);
     _selectedShape = default(BaseShape);
     _selectedShapes = default(ImmutableHashSet<BaseShape>);
 }
Beispiel #4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="style"></param>
 /// <param name="point"></param>
 /// <param name="isStroked"></param>
 /// <param name="isFilled"></param>
 /// <param name="text"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static XEllipse Create(
     double x, double y,
     ShapeStyle style,
     BaseShape point,
     bool isStroked = true,
     bool isFilled = false,
     string text = null,
     string name = "")
 {
     return Create(x, y, x, y, style, point, isStroked, isFilled, text, name);
 }
Beispiel #5
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="shape"></param>
        public override void Finalize(BaseShape shape)
        {
            var arc = shape as XArc;
            var a = WpfArc.FromXArc(arc, 0, 0);

            if (!_connectedP3)
            {
                arc.Point3.X = a.Start.X;
                arc.Point3.Y = a.Start.Y;
            }

            if (!_connectedP4)
            {
                arc.Point4.X = a.End.X;
                arc.Point4.Y = a.End.Y;
            }
        }
Beispiel #6
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="shape"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static XPoint Create(
     double x = 0.0,
     double y = 0.0,
     BaseShape shape = null,
     string name = "")
 {
     return new XPoint()
     {
         Name = name,
         Style = default(ShapeStyle),
         Data = new Data()
         {
             Bindings = ImmutableArray.Create<ShapeBinding>(),
             Properties = ImmutableArray.Create<ShapeProperty>()
         },
         X = x,
         Y = y,
         Shape = shape
     };
 }
Beispiel #7
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="start"></param>
 /// <param name="end"></param>
 /// <param name="style"></param>
 /// <param name="point"></param>
 /// <param name="isStroked"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static XLine Create(
     XPoint start,
     XPoint end,
     ShapeStyle style,
     BaseShape point,
     bool isStroked = true,
     string name = "")
 {
     return new XLine()
     {
         Name = name,
         Style = style,
         IsStroked = isStroked,
         IsFilled = false,
         Data = new Data()
         {
             Bindings = ImmutableArray.Create<ShapeBinding>(),
             Properties = ImmutableArray.Create<ShapeProperty>()
         },
         Start = start,
         End = end
     };
 }
Beispiel #8
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="shape"></param>
 public abstract void Finalize(BaseShape shape);
Beispiel #9
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="shape"></param>
        public void Add(BaseShape shape)
        {
            if (shape == null)
                return;

            shape.PropertyChanged += ShapeObserver;

            if (shape.Data != null)
            {
                if (shape.Data.Bindings != null)
                {
                    Add(shape.Data.Bindings);
                }

                if (shape.Data.Properties != null)
                {
                    Add(shape.Data.Properties);
                }

                shape.Data.PropertyChanged += DataObserver;
            }

            if (shape.State != null)
            {
                shape.State.PropertyChanged += StateObserver;
            }

            if (shape is XPoint)
            {
                var point = shape as XPoint;
                if (point.Shape != null)
                {
                    point.Shape.PropertyChanged += ShapeObserver;
                }
            }
            else if (shape is XLine)
            {
                var line = shape as XLine;

                if (line.Start != null)
                {
                    line.Start.PropertyChanged += ShapeObserver;
                }

                if (line.End != null)
                {
                    line.End.PropertyChanged += ShapeObserver;
                }
            }
            else if (shape is XRectangle)
            {
                var rectangle = shape as XRectangle;

                if (rectangle.TopLeft != null)
                {
                    rectangle.TopLeft.PropertyChanged += ShapeObserver;
                }

                if (rectangle.BottomRight != null)
                {
                    rectangle.BottomRight.PropertyChanged += ShapeObserver;
                }
            }
            else if (shape is XEllipse)
            {
                var ellipse = shape as XEllipse;

                if (ellipse.TopLeft != null)
                {
                    ellipse.TopLeft.PropertyChanged += ShapeObserver;
                }

                if (ellipse.BottomRight != null)
                {
                    ellipse.BottomRight.PropertyChanged += ShapeObserver;
                }
            }
            else if (shape is XArc)
            {
                var arc = shape as XArc;

                if (arc.Point1 != null)
                {
                    arc.Point1.PropertyChanged += ShapeObserver;
                }

                if (arc.Point2 != null)
                {
                    arc.Point2.PropertyChanged += ShapeObserver;
                }

                if (arc.Point3 != null)
                {
                    arc.Point3.PropertyChanged += ShapeObserver;
                }

                if (arc.Point4 != null)
                {
                    arc.Point4.PropertyChanged += ShapeObserver;
                }
            }
            else if (shape is XBezier)
            {
                var bezier = shape as XBezier;

                if (bezier.Point1 != null)
                {
                    bezier.Point1.PropertyChanged += ShapeObserver;
                }

                if (bezier.Point2 != null)
                {
                    bezier.Point2.PropertyChanged += ShapeObserver;
                }

                if (bezier.Point3 != null)
                {
                    bezier.Point3.PropertyChanged += ShapeObserver;
                }

                if (bezier.Point4 != null)
                {
                    bezier.Point4.PropertyChanged += ShapeObserver;
                }
            }
            else if (shape is XQBezier)
            {
                var qbezier = shape as XQBezier;

                if (qbezier.Point1 != null)
                {
                    qbezier.Point1.PropertyChanged += ShapeObserver;
                }

                if (qbezier.Point2 != null)
                {
                    qbezier.Point2.PropertyChanged += ShapeObserver;
                }

                if (qbezier.Point3 != null)
                {
                    qbezier.Point3.PropertyChanged += ShapeObserver;
                }
            }
            else if (shape is XText)
            {
                var text = shape as XText;

                if (text.TopLeft != null)
                {
                    text.TopLeft.PropertyChanged += ShapeObserver;
                }

                if (text.BottomRight != null)
                {
                    text.BottomRight.PropertyChanged += ShapeObserver;
                }
            }
            else if (shape is XImage)
            {
                var image = shape as XImage;

                if (image.TopLeft != null)
                {
                    image.TopLeft.PropertyChanged += ShapeObserver;
                }

                if (image.BottomRight != null)
                {
                    image.BottomRight.PropertyChanged += ShapeObserver;
                }
            }
            else if (shape is XPath)
            {
                // TODO: Observer path sub properties.
            }
            else if (shape is XGroup)
            {
                var group = shape as XGroup;

                if (group != null)
                {
                    if (group.Shapes != null)
                    {
                        Add(group.Shapes);
                    }

                    if (group.Connectors != null)
                    {
                        Add(group.Connectors);
                    }
                }
            }

            Verbose("Add Shape: " + shape.GetType());
        }
Beispiel #10
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="shape"></param>
        /// <param name="p"></param>
        /// <param name="treshold"></param>
        /// <param name="dx"></param>
        /// <param name="dy"></param>
        /// <returns></returns>
        public static BaseShape HitTest(BaseShape shape, Vector2 p, double treshold, double dx, double dy)
        {
            if (shape is XPoint)
            {
                if (GetPointBounds(shape as XPoint, treshold, dx, dy).Contains(p))
                {
                    return shape;
                }
                return null;
            }
            else if (shape is XLine)
            {
                var line = shape as XLine;

                if (GetPointBounds(line.Start, treshold, dx, dy).Contains(p))
                {
                    return line.Start;
                }

                if (GetPointBounds(line.End, treshold, dx, dy).Contains(p))
                {
                    return line.End;
                }

                if (HitTestLine(line, p, treshold, dx, dy))
                {
                    return line;
                }

                return null;
            }
            else if (shape is XRectangle)
            {
                var rectangle = shape as XRectangle;

                if (GetPointBounds(rectangle.TopLeft, treshold, dx, dy).Contains(p))
                {
                    return rectangle.TopLeft;
                }

                if (GetPointBounds(rectangle.BottomRight, treshold, dx, dy).Contains(p))
                {
                    return rectangle.BottomRight;
                }

                if (GetRectangleBounds(rectangle, dx, dy).Contains(p))
                {
                    return rectangle;
                }
                return null;
            }
            else if (shape is XEllipse)
            {
                var ellipse = shape as XEllipse;

                if (GetPointBounds(ellipse.TopLeft, treshold, dx, dy).Contains(p))
                {
                    return ellipse.TopLeft;
                }

                if (GetPointBounds(ellipse.BottomRight, treshold, dx, dy).Contains(p))
                {
                    return ellipse.BottomRight;
                }

                if (GetEllipseBounds(ellipse, dx, dy).Contains(p))
                {
                    return ellipse;
                }
                return null;
            }
            else if (shape is XArc)
            {
                var arc = shape as XArc;

                if (GetPointBounds(arc.Point1, treshold, dx, dy).Contains(p))
                {
                    return arc.Point1;
                }

                if (GetPointBounds(arc.Point2, treshold, dx, dy).Contains(p))
                {
                    return arc.Point2;
                }

                if (GetPointBounds(arc.Point3, treshold, dx, dy).Contains(p))
                {
                    return arc.Point3;
                }

                if (GetPointBounds(arc.Point4, treshold, dx, dy).Contains(p))
                {
                    return arc.Point4;
                }

                if (GetArcBounds(arc, dx, dy).Contains(p))
                {
                    return arc;
                }
                return null;
            }
            else if (shape is XBezier)
            {
                var bezier = shape as XBezier;

                if (GetPointBounds(bezier.Point1, treshold, dx, dy).Contains(p))
                {
                    return bezier.Point1;
                }

                if (GetPointBounds(bezier.Point2, treshold, dx, dy).Contains(p))
                {
                    return bezier.Point2;
                }

                if (GetPointBounds(bezier.Point3, treshold, dx, dy).Contains(p))
                {
                    return bezier.Point3;
                }

                if (GetPointBounds(bezier.Point4, treshold, dx, dy).Contains(p))
                {
                    return bezier.Point4;
                }

                if (ConvexHullBounds.Contains(bezier, p, dx, dy))
                {
                    return bezier;
                }
                return null;
            }
            else if (shape is XQBezier)
            {
                var qbezier = shape as XQBezier;

                if (GetPointBounds(qbezier.Point1, treshold, dx, dy).Contains(p))
                {
                    return qbezier.Point1;
                }

                if (GetPointBounds(qbezier.Point2, treshold, dx, dy).Contains(p))
                {
                    return qbezier.Point2;
                }

                if (GetPointBounds(qbezier.Point3, treshold, dx, dy).Contains(p))
                {
                    return qbezier.Point3;
                }

                if (ConvexHullBounds.Contains(qbezier, p, dx, dy))
                {
                    return qbezier;
                }
                return null;
            }
            else if (shape is XText)
            {
                var text = shape as XText;

                if (GetPointBounds(text.TopLeft, treshold, dx, dy).Contains(p))
                {
                    return text.TopLeft;
                }

                if (GetPointBounds(text.BottomRight, treshold, dx, dy).Contains(p))
                {
                    return text.BottomRight;
                }

                if (GetTextBounds(text, dx, dy).Contains(p))
                {
                    return text;
                }
                return null;
            }
            else if (shape is XImage)
            {
                var image = shape as XImage;

                if (GetPointBounds(image.TopLeft, treshold, dx, dy).Contains(p))
                {
                    return image.TopLeft;
                }

                if (GetPointBounds(image.BottomRight, treshold, dx, dy).Contains(p))
                {
                    return image.BottomRight;
                }

                if (GetImageBounds(image, dx, dy).Contains(p))
                {
                    return image;
                }
                return null;
            }
            else if (shape is XPath)
            {
                var path = shape as XPath;

                if (path.Geometry != null)
                {
                    var points = path.GetAllPoints();
                    foreach (var point in points)
                    {
                        if (GetPointBounds(point, treshold, dx, dy).Contains(p))
                        {
                            return point;
                        }
                    }

                    if (ConvexHullBounds.Contains(points, p, dx, dy))
                    {
                        return path;
                    }
                }
                return null;
            }
            else if (shape is XGroup)
            {
                var group = shape as XGroup;

                foreach (var connector in group.Connectors.Reverse())
                {
                    if (GetPointBounds(connector, treshold, dx, dy).Contains(p))
                    {
                        return connector;
                    }
                }

                var result = HitTest(group.Shapes.Reverse(), p, treshold, dx, dy);
                if (result != null)
                {
                    return shape;
                }
                return null;
            }

            return null;
        }
Beispiel #11
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="x1"></param>
 /// <param name="y1"></param>
 /// <param name="x2"></param>
 /// <param name="y2"></param>
 /// <param name="style"></param>
 /// <param name="point"></param>
 /// <param name="isStroked"></param>
 /// <param name="isFilled"></param>
 /// <param name="text"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static XRectangle Create(
     double x1, double y1,
     double x2, double y2,
     ShapeStyle style,
     BaseShape point,
     bool isStroked = true,
     bool isFilled = false,
     string text = null,
     string name = "")
 {
     return new XRectangle()
     {
         Name = name,
         Style = style,
         IsStroked = isStroked,
         IsFilled = isFilled,
         Data = new Data()
         {
             Bindings = ImmutableArray.Create<ShapeBinding>(),
             Properties = ImmutableArray.Create<ShapeProperty>()
         },
         TopLeft = XPoint.Create(x1, y1, point),
         BottomRight = XPoint.Create(x2, y2, point),
         Text = text,
         IsGrid = false,
         OffsetX = 30.0,
         OffsetY = 30.0,
         CellWidth = 30.0,
         CellHeight = 30.0
     };
 }
Beispiel #12
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="shape"></param>
        /// <param name="rect"></param>
        /// <param name="selection"></param>
        /// <param name="builder"></param>
        /// <param name="treshold"></param>
        /// <param name="dx"></param>
        /// <param name="dy"></param>
        /// <returns></returns>
        private static bool HitTest(
            BaseShape shape,
            Rect2 rect,
            Vector2[] selection,
            ImmutableHashSet<BaseShape>.Builder builder,
            double treshold,
            double dx,
            double dy)
        {
            if (shape is XPoint)
            {
                if (GetPointBounds(shape as XPoint, treshold, dx, dy).IntersectsWith(rect))
                {
                    if (builder != null)
                    {
                        builder.Add(shape);
                    }
                    else
                    {
                        return true;
                    }
                }
                return false;
            }
            else if (shape is XLine)
            {
                var line = shape as XLine;
                if (GetPointBounds(line.Start, treshold, dx, dy).IntersectsWith(rect)
                    || GetPointBounds(line.End, treshold, dx, dy).IntersectsWith(rect)
                    || MathHelpers.LineIntersectsWithRect(rect, new Point2(line.Start.X, line.Start.Y), new Point2(line.End.X, line.End.Y)))
                {
                    if (builder != null)
                    {
                        builder.Add(line);
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }
                return false;
            }
            else if (shape is XEllipse)
            {
                if (GetEllipseBounds(shape as XEllipse, dx, dy).IntersectsWith(rect))
                {
                    if (builder != null)
                    {
                        builder.Add(shape);
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }
                return false;
            }
            else if (shape is XRectangle)
            {
                if (GetRectangleBounds(shape as XRectangle, dx, dy).IntersectsWith(rect))
                {
                    if (builder != null)
                    {
                        builder.Add(shape);
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }
                return false;
            }
            else if (shape is XArc)
            {
                if (GetArcBounds(shape as XArc, dx, dy).IntersectsWith(rect))
                {
                    if (builder != null)
                    {
                        builder.Add(shape);
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }
                return false;
            }
            else if (shape is XBezier)
            {
                if (ConvexHullBounds.Overlap(selection, ConvexHullBounds.GetVertices(shape as XBezier, dx, dy)))
                {
                    if (builder != null)
                    {
                        builder.Add(shape);
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }
                return false;
            }
            else if (shape is XQBezier)
            {
                if (ConvexHullBounds.Overlap(selection, ConvexHullBounds.GetVertices(shape as XQBezier, dx, dy)))
                {
                    if (builder != null)
                    {
                        builder.Add(shape);
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }
                return false;
            }
            else if (shape is XText)
            {
                if (GetTextBounds(shape as XText, dx, dy).IntersectsWith(rect))
                {
                    if (builder != null)
                    {
                        builder.Add(shape);
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }
                return false;
            }
            else if (shape is XImage)
            {
                if (GetImageBounds(shape as XImage, dx, dy).IntersectsWith(rect))
                {
                    if (builder != null)
                    {
                        builder.Add(shape);
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }
                return false;
            }
            else if (shape is XPath)
            {
                if ((shape as XPath).Geometry != null)
                {
                    var points = (shape as XPath).GetAllPoints();
                    if (ConvexHullBounds.Overlap(selection, ConvexHullBounds.GetVertices(points, dx, dy)))
                    {
                        if (builder != null)
                        {
                            builder.Add(shape);
                            return false;
                        }
                        else
                        {
                            return true;
                        }
                    }
                }
                return false;
            }
            else if (shape is XGroup)
            {
                if (HitTest((shape as XGroup).Shapes.Reverse(), rect, selection, null, treshold, dx, dy) == true)
                {
                    if (builder != null)
                    {
                        builder.Add(shape);
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }
                return false;
            }

            return false;
        }
Beispiel #13
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="shape"></param>
 public abstract void Move(BaseShape shape);
Beispiel #14
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="shape"></param>
        public override void Move(BaseShape shape)
        {
            if (_startHelperPoint != null)
            {
                _startHelperPoint.X = _shape.Start.X;
                _startHelperPoint.Y = _shape.Start.Y;
            }

            if (_endHelperPoint != null)
            {
                _endHelperPoint.X = _shape.End.X;
                _endHelperPoint.Y = _shape.End.Y;
            }
        }
Beispiel #15
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="x1"></param>
 /// <param name="y1"></param>
 /// <param name="x2"></param>
 /// <param name="y2"></param>
 /// <param name="style"></param>
 /// <param name="point"></param>
 /// <param name="isStroked"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static XLine Create(
     double x1, double y1,
     double x2, double y2,
     ShapeStyle style,
     BaseShape point,
     bool isStroked = true,
     string name = "")
 {
     return new XLine()
     {
         Name = name,
         Style = style,
         IsStroked = isStroked,
         IsFilled = false,
         Data = new Data()
         {
             Bindings = ImmutableArray.Create<ShapeBinding>(),
             Properties = ImmutableArray.Create<ShapeProperty>()
         },
         Start = XPoint.Create(x1, y1, point),
         End = XPoint.Create(x2, y2, point)
     };
 }
Beispiel #16
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="topLeft"></param>
 /// <param name="bottomRight"></param>
 /// <param name="style"></param>
 /// <param name="point"></param>
 /// <param name="path"></param>
 /// <param name="isStroked"></param>
 /// <param name="isFilled"></param>
 /// <param name="text"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static XImage Create(
     XPoint topLeft,
     XPoint bottomRight,
     ShapeStyle style,
     BaseShape point,
     string path,
     bool isStroked = false,
     bool isFilled = false,
     string text = null,
     string name = "")
 {
     return new XImage()
     {
         Name = name,
         Style = style,
         IsStroked = isStroked,
         IsFilled = isFilled,
         Data = new Data()
         {
             Bindings = ImmutableArray.Create<ShapeBinding>(),
             Properties = ImmutableArray.Create<ShapeProperty>()
         },
         TopLeft = topLeft,
         BottomRight = bottomRight,
         Path = path,
         Text = text
     };
 }
Beispiel #17
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="shape"></param>
        public override void Move(BaseShape shape)
        {
            var qbezier = shape as XQBezier;

            if (_line12 != null)
            {
                _line12.Start.X = qbezier.Point1.X;
                _line12.Start.Y = qbezier.Point1.Y;
                _line12.End.X = qbezier.Point2.X;
                _line12.End.Y = qbezier.Point2.Y;
            }

            if (_line32 != null)
            {
                _line32.Start.X = qbezier.Point3.X;
                _line32.Start.Y = qbezier.Point3.Y;
                _line32.End.X = qbezier.Point2.X;
                _line32.End.Y = qbezier.Point2.Y;
            }

            if (_helperPoint1 != null)
            {
                _helperPoint1.X = qbezier.Point1.X;
                _helperPoint1.Y = qbezier.Point1.Y;
            }

            if (_helperPoint2 != null)
            {
                _helperPoint2.X = qbezier.Point2.X;
                _helperPoint2.Y = qbezier.Point2.Y;
            }

            if (_helperPoint3 != null)
            {
                _helperPoint3.X = qbezier.Point3.X;
                _helperPoint3.Y = qbezier.Point3.Y;
            }
        }
Beispiel #18
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="shape"></param>
 public void AddShape(BaseShape shape)
 {
     shape.Owner        = this;
     shape.State.Flags &= ~ShapeStateFlags.Standalone;
     Shapes             = Shapes.Add(shape);
 }
Beispiel #19
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="shape"></param>
 public override void Move(BaseShape shape)
 {
 }
Beispiel #20
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="shape"></param>
 public void AddShape(BaseShape shape)
 {
     shape.Owner = this;
     shape.State.Flags &= ~ShapeStateFlags.Standalone;
     Shapes = Shapes.Add(shape);
 }
Beispiel #21
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="style"></param>
 /// <param name="point"></param>
 /// <param name="text"></param>
 /// <param name="isStroked"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static XText Create(
     double x, double y,
     ShapeStyle style,
     BaseShape point,
     string text,
     bool isStroked = true,
     string name = "")
 {
     return Create(x, y, x, y, style, point, text, isStroked, name);
 }
Beispiel #22
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="shape"></param>
        public override void Move(BaseShape shape)
        {
            var bezier = shape as XBezier;

            if (_line12 != null)
            {
                _line12.Start.X = bezier.Point1.X;
                _line12.Start.Y = bezier.Point1.Y;
                _line12.End.X = bezier.Point2.X;
                _line12.End.Y = bezier.Point2.Y;
            }

            if (_line43 != null)
            {
                _line43.Start.X = bezier.Point4.X;
                _line43.Start.Y = bezier.Point4.Y;
                _line43.End.X = bezier.Point3.X;
                _line43.End.Y = bezier.Point3.Y;
            }

            if (_line23 != null)
            {
                _line23.Start.X = bezier.Point2.X;
                _line23.Start.Y = bezier.Point2.Y;
                _line23.End.X = bezier.Point3.X;
                _line23.End.Y = bezier.Point3.Y;
            }

            if (_helperPoint1 != null)
            {
                _helperPoint1.X = bezier.Point1.X;
                _helperPoint1.Y = bezier.Point1.Y;
            }

            if (_helperPoint2 != null)
            {
                _helperPoint2.X = bezier.Point2.X;
                _helperPoint2.Y = bezier.Point2.Y;
            }

            if (_helperPoint3 != null)
            {
                _helperPoint3.X = bezier.Point3.X;
                _helperPoint3.Y = bezier.Point3.Y;
            }

            if (_helperPoint4 != null)
            {
                _helperPoint4.X = bezier.Point4.X;
                _helperPoint4.Y = bezier.Point4.Y;
            }
        }
Beispiel #23
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="style"></param>
 /// <param name="point"></param>
 /// <param name="isStroked"></param>
 /// <param name="isFilled"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static XBezier Create(
     double x, double y,
     ShapeStyle style,
     BaseShape point,
     bool isStroked = true,
     bool isFilled = false,
     string name = "")
 {
     return Create(x, y, x, y, x, y, x, y, style, point, isStroked, isFilled, name);
 }
Beispiel #24
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="shape"></param>
 public override void Move(BaseShape shape)
 {
     switch (_editor.CurrentPathTool)
     {
         case PathTool.Line:
             {
                 MoveLineHelpers();
             }
             break;
         case PathTool.Arc:
             {
                 MoveArcHelpers();
             }
             break;
         case PathTool.Bezier:
             {
                 MoveBezierHelpers();
             }
             break;
         case PathTool.QBezier:
             {
                 MoveQBezierHelpers();
             }
             break;
     }
 }
Beispiel #25
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="shape"></param>
        public override void Move(BaseShape shape)
        {
            var arc = shape as XArc;
            var a = WpfArc.FromXArc(arc, 0, 0);

            if (_ellipse != null)
            {
                _ellipse.TopLeft.X = a.P1.X;
                _ellipse.TopLeft.Y = a.P1.Y;
                _ellipse.BottomRight.X = a.P2.X;
                _ellipse.BottomRight.Y = a.P2.Y;
            }

            if (_startLine != null)
            {
                _startLine.Start.X = a.Center.X;
                _startLine.Start.Y = a.Center.Y;
                _startLine.End.X = a.Start.X;
                _startLine.End.Y = a.Start.Y;
            }

            if (_endLine != null)
            {
                _endLine.Start.X = a.Center.X;
                _endLine.Start.Y = a.Center.Y;
                _endLine.End.X = a.End.X;
                _endLine.End.Y = a.End.Y;
            }

            if (_p1HelperPoint != null)
            {
                _p1HelperPoint.X = a.P1.X;
                _p1HelperPoint.Y = a.P1.Y;
            }

            if (_p2HelperPoint != null)
            {
                _p2HelperPoint.X = a.P2.X;
                _p2HelperPoint.Y = a.P2.Y;
            }

            if (_centerHelperPoint != null)
            {
                _centerHelperPoint.X = a.Center.X;
                _centerHelperPoint.Y = a.Center.Y;
            }

            if (_startHelperPoint != null)
            {
                _startHelperPoint.X = a.Start.X;
                _startHelperPoint.Y = a.Start.Y;
            }

            if (_endHelperPoint != null)
            {
                _endHelperPoint.X = a.End.X;
                _endHelperPoint.Y = a.End.Y;
            }
        }
Beispiel #26
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="shape"></param>
 public abstract void Finalize(BaseShape shape);
Beispiel #27
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="shape"></param>
        public override void Move(BaseShape shape)
        {
            if (_topLeftHelperPoint != null)
            {
                _topLeftHelperPoint.X = _shape.TopLeft.X;
                _topLeftHelperPoint.Y = _shape.TopLeft.Y;
            }

            if (_bottomRightHelperPoint != null)
            {
                _bottomRightHelperPoint.X = _shape.BottomRight.X;
                _bottomRightHelperPoint.Y = _shape.BottomRight.Y;
            }
        }
Beispiel #28
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="shape"></param>
 public override void Move(BaseShape shape)
 {
 }
Beispiel #29
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="shape"></param>
 public abstract void Move(BaseShape shape);
Beispiel #30
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="topLeft"></param>
 /// <param name="bottomRight"></param>
 /// <param name="style"></param>
 /// <param name="point"></param>
 /// <param name="text"></param>
 /// <param name="isStroked"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static XText Create(
     XPoint topLeft,
     XPoint bottomRight,
     ShapeStyle style,
     BaseShape point,
     string text,
     bool isStroked = true,
     string name = "")
 {
     return new XText()
     {
         Name = name,
         Style = style,
         IsStroked = isStroked,
         Data = new Data()
         {
             Bindings = ImmutableArray.Create<ShapeBinding>(),
             Properties = ImmutableArray.Create<ShapeProperty>()
         },
         TopLeft = topLeft,
         BottomRight = bottomRight,
         Text = text
     };
 }
Beispiel #31
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="shape"></param>
 public override void Finalize(BaseShape shape)
 {
 }
Beispiel #32
0
 /// <summary>
 /// Creates a new <see cref="XArc"/> instance.
 /// </summary>
 /// <param name="point1"></param>
 /// <param name="point2"></param>
 /// <param name="point3"></param>
 /// <param name="point4"></param>
 /// <param name="style"></param>
 /// <param name="point"></param>
 /// <param name="isStroked"></param>
 /// <param name="isFilled"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static XArc Create(
     XPoint point1,
     XPoint point2,
     XPoint point3,
     XPoint point4,
     ShapeStyle style,
     BaseShape point,
     bool isStroked = true,
     bool isFilled = false,
     string name = "")
 {
     return new XArc()
     {
         Name = name,
         Style = style,
         IsStroked = isStroked,
         IsFilled = isFilled,
         Data = new Data()
         {
             Bindings = ImmutableArray.Create<Binding>(),
             Properties = ImmutableArray.Create<Property>()
         },
         Point1 = point1,
         Point2 = point2,
         Point3 = point3,
         Point4 = point4
     };
 }
Beispiel #33
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        public override void LeftDown(double x, double y)
        {
            switch (_currentState)
            {
            case State.None:
            {
                _editor.Dehover();
                if (_editor.Renderers[0].State.SelectedShape == null &&
                    _editor.Renderers[0].State.SelectedShapes != null)
                {
                    var result = ShapeBounds.HitTest(_editor.Project.CurrentContainer, new Vector2(x, y), _editor.Project.Options.HitTreshold);
                    if (result != null)
                    {
                        _startX   = _editor.Project.Options.SnapToGrid ? Editor.Snap(x, _editor.Project.Options.SnapX) : x;
                        _startY   = _editor.Project.Options.SnapToGrid ? Editor.Snap(y, _editor.Project.Options.SnapY) : y;
                        _historyX = _startX;
                        _historyY = _startY;
                        GenerateMoveSelectionCache();
                        _currentState           = State.One;
                        _editor.CancelAvailable = true;
                        break;
                    }
                }

                if (_editor.TryToSelectShape(_editor.Project.CurrentContainer, x, y))
                {
                    _startX   = _editor.Project.Options.SnapToGrid ? Editor.Snap(x, _editor.Project.Options.SnapX) : x;
                    _startY   = _editor.Project.Options.SnapToGrid ? Editor.Snap(y, _editor.Project.Options.SnapY) : y;
                    _historyX = _startX;
                    _historyY = _startY;
                    GenerateMoveSelectionCache();
                    _currentState           = State.One;
                    _editor.CancelAvailable = true;
                    break;
                }

                _shape = XRectangle.Create(
                    x, y,
                    _editor.Project.Options.SelectionStyle,
                    null,
                    true, true);
                _editor.Project.CurrentContainer.WorkingLayer.Shapes = _editor.Project.CurrentContainer.WorkingLayer.Shapes.Add(_shape);
                _editor.Project.CurrentContainer.WorkingLayer.Invalidate();
                _currentState           = State.One;
                _editor.CancelAvailable = true;
            }
            break;

            case State.One:
            {
                var rectangle = _shape as XRectangle;
                if (rectangle != null)
                {
                    rectangle.BottomRight.X = x;
                    rectangle.BottomRight.Y = y;
                    _editor.Project.CurrentContainer.WorkingLayer.Shapes = _editor.Project.CurrentContainer.WorkingLayer.Shapes.Remove(_shape);
                    _editor.Project.CurrentContainer.WorkingLayer.Invalidate();
                    _currentState           = State.None;
                    _editor.CancelAvailable = false;
                }
            }
            break;
            }
        }
Beispiel #34
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="shape"></param>
        /// <param name="p"></param>
        /// <param name="treshold"></param>
        /// <param name="dx"></param>
        /// <param name="dy"></param>
        /// <returns></returns>
        public static BaseShape HitTest(BaseShape shape, Vector2 p, double treshold, double dx, double dy)
        {
            if (shape is XPoint)
            {
                if (GetPointBounds(shape as XPoint, treshold, dx, dy).Contains(p))
                {
                    return(shape);
                }
                return(null);
            }
            else if (shape is XLine)
            {
                var line = shape as XLine;

                if (GetPointBounds(line.Start, treshold, dx, dy).Contains(p))
                {
                    return(line.Start);
                }

                if (GetPointBounds(line.End, treshold, dx, dy).Contains(p))
                {
                    return(line.End);
                }

                if (HitTestLine(line, p, treshold, dx, dy))
                {
                    return(line);
                }

                return(null);
            }
            else if (shape is XRectangle)
            {
                var rectangle = shape as XRectangle;

                if (GetPointBounds(rectangle.TopLeft, treshold, dx, dy).Contains(p))
                {
                    return(rectangle.TopLeft);
                }

                if (GetPointBounds(rectangle.BottomRight, treshold, dx, dy).Contains(p))
                {
                    return(rectangle.BottomRight);
                }

                if (GetRectangleBounds(rectangle, dx, dy).Contains(p))
                {
                    return(rectangle);
                }
                return(null);
            }
            else if (shape is XEllipse)
            {
                var ellipse = shape as XEllipse;

                if (GetPointBounds(ellipse.TopLeft, treshold, dx, dy).Contains(p))
                {
                    return(ellipse.TopLeft);
                }

                if (GetPointBounds(ellipse.BottomRight, treshold, dx, dy).Contains(p))
                {
                    return(ellipse.BottomRight);
                }

                if (GetEllipseBounds(ellipse, dx, dy).Contains(p))
                {
                    return(ellipse);
                }
                return(null);
            }
            else if (shape is XArc)
            {
                var arc = shape as XArc;

                if (GetPointBounds(arc.Point1, treshold, dx, dy).Contains(p))
                {
                    return(arc.Point1);
                }

                if (GetPointBounds(arc.Point2, treshold, dx, dy).Contains(p))
                {
                    return(arc.Point2);
                }

                if (GetPointBounds(arc.Point3, treshold, dx, dy).Contains(p))
                {
                    return(arc.Point3);
                }

                if (GetPointBounds(arc.Point4, treshold, dx, dy).Contains(p))
                {
                    return(arc.Point4);
                }

                if (GetArcBounds(arc, dx, dy).Contains(p))
                {
                    return(arc);
                }
                return(null);
            }
            else if (shape is XBezier)
            {
                var bezier = shape as XBezier;

                if (GetPointBounds(bezier.Point1, treshold, dx, dy).Contains(p))
                {
                    return(bezier.Point1);
                }

                if (GetPointBounds(bezier.Point2, treshold, dx, dy).Contains(p))
                {
                    return(bezier.Point2);
                }

                if (GetPointBounds(bezier.Point3, treshold, dx, dy).Contains(p))
                {
                    return(bezier.Point3);
                }

                if (GetPointBounds(bezier.Point4, treshold, dx, dy).Contains(p))
                {
                    return(bezier.Point4);
                }

                if (ConvexHullBounds.Contains(bezier, p, dx, dy))
                {
                    return(bezier);
                }
                return(null);
            }
            else if (shape is XQBezier)
            {
                var qbezier = shape as XQBezier;

                if (GetPointBounds(qbezier.Point1, treshold, dx, dy).Contains(p))
                {
                    return(qbezier.Point1);
                }

                if (GetPointBounds(qbezier.Point2, treshold, dx, dy).Contains(p))
                {
                    return(qbezier.Point2);
                }

                if (GetPointBounds(qbezier.Point3, treshold, dx, dy).Contains(p))
                {
                    return(qbezier.Point3);
                }

                if (ConvexHullBounds.Contains(qbezier, p, dx, dy))
                {
                    return(qbezier);
                }
                return(null);
            }
            else if (shape is XText)
            {
                var text = shape as XText;

                if (GetPointBounds(text.TopLeft, treshold, dx, dy).Contains(p))
                {
                    return(text.TopLeft);
                }

                if (GetPointBounds(text.BottomRight, treshold, dx, dy).Contains(p))
                {
                    return(text.BottomRight);
                }

                if (GetTextBounds(text, dx, dy).Contains(p))
                {
                    return(text);
                }
                return(null);
            }
            else if (shape is XImage)
            {
                var image = shape as XImage;

                if (GetPointBounds(image.TopLeft, treshold, dx, dy).Contains(p))
                {
                    return(image.TopLeft);
                }

                if (GetPointBounds(image.BottomRight, treshold, dx, dy).Contains(p))
                {
                    return(image.BottomRight);
                }

                if (GetImageBounds(image, dx, dy).Contains(p))
                {
                    return(image);
                }
                return(null);
            }
            else if (shape is XPath)
            {
                var path = shape as XPath;

                if (path.Geometry != null)
                {
                    var points = path.GetAllPoints();
                    foreach (var point in points)
                    {
                        if (GetPointBounds(point, treshold, dx, dy).Contains(p))
                        {
                            return(point);
                        }
                    }

                    if (ConvexHullBounds.Contains(points, p, dx, dy))
                    {
                        return(path);
                    }
                }
                return(null);
            }
            else if (shape is XGroup)
            {
                var group = shape as XGroup;

                foreach (var connector in group.Connectors.Reverse())
                {
                    if (GetPointBounds(connector, treshold, dx, dy).Contains(p))
                    {
                        return(connector);
                    }
                }

                var result = HitTest(group.Shapes.Reverse(), p, treshold, dx, dy);
                if (result != null)
                {
                    return(shape);
                }
                return(null);
            }

            return(null);
        }
Beispiel #35
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="shape"></param>
        /// <param name="rect"></param>
        /// <param name="selection"></param>
        /// <param name="builder"></param>
        /// <param name="treshold"></param>
        /// <param name="dx"></param>
        /// <param name="dy"></param>
        /// <returns></returns>
        private static bool HitTest(
            BaseShape shape,
            Rect2 rect,
            Vector2[] selection,
            ImmutableHashSet <BaseShape> .Builder builder,
            double treshold,
            double dx,
            double dy)
        {
            if (shape is XPoint)
            {
                if (GetPointBounds(shape as XPoint, treshold, dx, dy).IntersectsWith(rect))
                {
                    if (builder != null)
                    {
                        builder.Add(shape);
                    }
                    else
                    {
                        return(true);
                    }
                }
                return(false);
            }
            else if (shape is XLine)
            {
                var line = shape as XLine;
                if (GetPointBounds(line.Start, treshold, dx, dy).IntersectsWith(rect) ||
                    GetPointBounds(line.End, treshold, dx, dy).IntersectsWith(rect) ||
                    MathHelpers.LineIntersectsWithRect(rect, new Point2(line.Start.X, line.Start.Y), new Point2(line.End.X, line.End.Y)))
                {
                    if (builder != null)
                    {
                        builder.Add(line);
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
                return(false);
            }
            else if (shape is XEllipse)
            {
                if (GetEllipseBounds(shape as XEllipse, dx, dy).IntersectsWith(rect))
                {
                    if (builder != null)
                    {
                        builder.Add(shape);
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
                return(false);
            }
            else if (shape is XRectangle)
            {
                if (GetRectangleBounds(shape as XRectangle, dx, dy).IntersectsWith(rect))
                {
                    if (builder != null)
                    {
                        builder.Add(shape);
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
                return(false);
            }
            else if (shape is XArc)
            {
                if (GetArcBounds(shape as XArc, dx, dy).IntersectsWith(rect))
                {
                    if (builder != null)
                    {
                        builder.Add(shape);
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
                return(false);
            }
            else if (shape is XBezier)
            {
                if (ConvexHullBounds.Overlap(selection, ConvexHullBounds.GetVertices(shape as XBezier, dx, dy)))
                {
                    if (builder != null)
                    {
                        builder.Add(shape);
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
                return(false);
            }
            else if (shape is XQBezier)
            {
                if (ConvexHullBounds.Overlap(selection, ConvexHullBounds.GetVertices(shape as XQBezier, dx, dy)))
                {
                    if (builder != null)
                    {
                        builder.Add(shape);
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
                return(false);
            }
            else if (shape is XText)
            {
                if (GetTextBounds(shape as XText, dx, dy).IntersectsWith(rect))
                {
                    if (builder != null)
                    {
                        builder.Add(shape);
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
                return(false);
            }
            else if (shape is XImage)
            {
                if (GetImageBounds(shape as XImage, dx, dy).IntersectsWith(rect))
                {
                    if (builder != null)
                    {
                        builder.Add(shape);
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
                return(false);
            }
            else if (shape is XPath)
            {
                if ((shape as XPath).Geometry != null)
                {
                    var points = (shape as XPath).GetAllPoints();
                    if (ConvexHullBounds.Overlap(selection, ConvexHullBounds.GetVertices(points, dx, dy)))
                    {
                        if (builder != null)
                        {
                            builder.Add(shape);
                            return(false);
                        }
                        else
                        {
                            return(true);
                        }
                    }
                }
                return(false);
            }
            else if (shape is XGroup)
            {
                if (HitTest((shape as XGroup).Shapes.Reverse(), rect, selection, null, treshold, dx, dy) == true)
                {
                    if (builder != null)
                    {
                        builder.Add(shape);
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
                return(false);
            }

            return(false);
        }
Beispiel #36
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="shape"></param>
 public override void Finalize(BaseShape shape)
 {
 }
Beispiel #37
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        public override void LeftDown(double x, double y)
        {
            switch (_currentState)
            {
                case State.None:
                    {
                        _editor.Dehover();
                        if (_editor.Renderers[0].State.SelectedShape == null
                            && _editor.Renderers[0].State.SelectedShapes != null)
                        {
                            var result = ShapeBounds.HitTest(_editor.Project.CurrentContainer, new Vector2(x, y), _editor.Project.Options.HitTreshold);
                            if (result != null)
                            {
                                _startX = _editor.Project.Options.SnapToGrid ? Editor.Snap(x, _editor.Project.Options.SnapX) : x;
                                _startY = _editor.Project.Options.SnapToGrid ? Editor.Snap(y, _editor.Project.Options.SnapY) : y;
                                _historyX = _startX;
                                _historyY = _startY;
                                GenerateMoveSelectionCache();
                                _currentState = State.One;
                                _editor.CancelAvailable = true;
                                break;
                            }
                        }

                        if (_editor.TryToSelectShape(_editor.Project.CurrentContainer, x, y))
                        {
                            _startX = _editor.Project.Options.SnapToGrid ? Editor.Snap(x, _editor.Project.Options.SnapX) : x;
                            _startY = _editor.Project.Options.SnapToGrid ? Editor.Snap(y, _editor.Project.Options.SnapY) : y;
                            _historyX = _startX;
                            _historyY = _startY;
                            GenerateMoveSelectionCache();
                            _currentState = State.One;
                            _editor.CancelAvailable = true;
                            break;
                        }

                        _shape = XRectangle.Create(
                            x, y,
                            _editor.Project.Options.SelectionStyle,
                            null,
                            true, true);
                        _editor.Project.CurrentContainer.WorkingLayer.Shapes = _editor.Project.CurrentContainer.WorkingLayer.Shapes.Add(_shape);
                        _editor.Project.CurrentContainer.WorkingLayer.Invalidate();
                        _currentState = State.One;
                        _editor.CancelAvailable = true;
                    }
                    break;
                case State.One:
                    {
                        var rectangle = _shape as XRectangle;
                        if (rectangle != null)
                        {
                            rectangle.BottomRight.X = x;
                            rectangle.BottomRight.Y = y;
                            _editor.Project.CurrentContainer.WorkingLayer.Shapes = _editor.Project.CurrentContainer.WorkingLayer.Shapes.Remove(_shape);
                            _editor.Project.CurrentContainer.WorkingLayer.Invalidate();
                            _currentState = State.None;
                            _editor.CancelAvailable = false;
                        }
                    }
                    break;
            }
        }