Наследование: MonoBehaviour
Пример #1
0
        public override void Paint(Graphics g, GoView view)
        {
            base.Paint(g, view);
            GoStroke s = this;

            if (mySeg >= s.PointsCount - 1)
            {
                mySeg = 0;
            }
            PointF a   = s.GetPoint(mySeg);
            PointF b   = s.GetPoint(mySeg + 1);
            float  len = (float)Math.Sqrt((b.X - a.X) * (b.X - a.X) + (b.Y - a.Y) * (b.Y - a.Y));
            float  x   = b.X;
            float  y   = b.Y;

            if (myDist >= len)
            {
                mySeg++;
                myDist = 0;
            }
            else if (len >= 1)
            {
                x = a.X + (b.X - a.X) * myDist / len;
                y = a.Y + (b.Y - a.Y) * myDist / len;
            }
            GoShape.DrawEllipse(g, view, null, Brushes.Red, x - 3, y - 3, 7, 7);
        }
Пример #2
0
        private GoLink DrawEdge(GoNodeWrapper nodeWrapper, GoView myView, InstructionNode backNode, GoLayer layer, Pen pen)
        {
            GoLink link            = new GoLink();
            var    backNodeWrapper = GetNodeWrapper(backNode);

            link.Pen    = pen;
            link.ToPort = nodeWrapper.Node.LeftPort;
            if (backNodeWrapper.Node == nodeWrapper.Node)
            {
                link.FromPort = backNodeWrapper.Node.RightPort;
                link.Style    = GoStrokeStyle.Bezier;
                link.CalculateRoute();
                foreach (int index in new[] { 1, 2 })
                {
                    link.SetPoint(index, new PointF(link.GetPoint(index).X, link.GetPoint(index).Y - 40));
                }
            }
            else
            {
                link.FromPort = backNodeWrapper.Node.RightPort;
            }
            layer.Add(link);
            link.PenWidth = 3;
            return(link);
        }
Пример #3
0
 /// <summary>
 /// Consider any shadow when calculating the actual paint bounds.
 /// </summary>
 /// <param name="rect"></param>
 /// <param name="view"></param>
 /// <returns></returns>
 public override RectangleF ExpandPaintBounds(RectangleF rect, GoView view)
 {
     if (Shadowed)
     {
         SizeF shadowOffset = GetShadowOffset(view);
         if (shadowOffset.Width < 0f)
         {
             rect.X     += shadowOffset.Width;
             rect.Width -= shadowOffset.Width;
         }
         else
         {
             rect.Width += shadowOffset.Width;
         }
         if (shadowOffset.Height < 0f)
         {
             rect.Y      += shadowOffset.Height;
             rect.Height -= shadowOffset.Height;
         }
         else
         {
             rect.Height += shadowOffset.Height;
         }
     }
     return(rect);
 }
Пример #4
0
        /// <summary>
        /// Bring up a FlowBlock specific context menu.
        /// </summary>
        /// <param name="evt"></param>
        /// <param name="view"></param>
        /// <returns></returns>
        public override GoContextMenu GetContextMenu(GoView view)
        {
            if (view is GoOverview)
            {
                return(null);
            }
            if (!(view.Document is FlowDocument))
            {
                return(null);
            }
            GoContextMenu cm = new GoContextMenu(view);

            if (!((FlowDocument)view.Document).IsReadOnly && this.IsPredecessor)
            {
                cm.MenuItems.Add(new MenuItem("Draw Link", new EventHandler(this.DrawRelationship_Command)));
                cm.MenuItems.Add(new MenuItem("-"));
            }
            if (CanDelete())
            {
                cm.MenuItems.Add(new MenuItem("Cut", new EventHandler(this.Cut_Command)));
            }
            if (CanCopy())
            {
                cm.MenuItems.Add(new MenuItem("Copy", new EventHandler(this.Copy_Command)));
            }
            if (CanDelete())
            {
                cm.MenuItems.Add(new MenuItem("Delete", new EventHandler(this.Delete_Command)));
            }

            return(cm);
        }
Пример #5
0
        public override GoContextMenu GetContextMenu(GoView view)
        {
            if (view is GoOverview)
            {
                return(null);
            }
            var cm = new GoContextMenu(view);

            if (_buckets?.Any() ?? false)
            {
                bool first = true;
                foreach (var bucket in _buckets)
                {
                    if (first)
                    {
                        first = false;
                    }
                    else
                    {
                        cm.MenuItems.Add(new MenuItem("-"));
                    }
                    AddMenu(cm, _actions[bucket]);
                }
            }

            return(cm);
        }
Пример #6
0
 /// <summary>
 /// The expanded paint bounds for a shape includes any Pen width and miter
 /// limit and any drop shadow.
 /// </summary>
 /// <param name="rect"></param>
 /// <param name="view"></param>
 /// <returns></returns>
 public override RectangleF ExpandPaintBounds(RectangleF rect, GoView view)
 {
     rect = base.ExpandPaintBounds(rect, view);
     if (Style != 0 && base.Parent != null && base.Parent.Shadowed)
     {
         SizeF shadowOffset = GetShadowOffset(view);
         if (shadowOffset.Width < 0f)
         {
             rect.X     += shadowOffset.Width;
             rect.Width -= shadowOffset.Width;
         }
         else
         {
             rect.Width += shadowOffset.Width;
         }
         if (shadowOffset.Height < 0f)
         {
             rect.Y      += shadowOffset.Height;
             rect.Height -= shadowOffset.Height;
         }
         else
         {
             rect.Height += shadowOffset.Height;
         }
     }
     return(rect);
 }
Пример #7
0
        private void removeFromSelection(GoObject obj)
        {
            GoObject primary = Primary;

            myObjTable.Remove(obj);
            base.Remove(obj);
            GoView view = View;

            if (view == null)
            {
                return;
            }
            if (obj.IsInDocument)
            {
                obj.OnLostSelection(this);
            }
            view.RaiseObjectLostSelection(obj);
            if (primary == obj && primary.IsInDocument)
            {
                primary = Primary;
                if (primary != null)
                {
                    primary.OnLostSelection(this);
                    view.RaiseObjectLostSelection(primary);
                    primary.OnGotSelection(this);
                    view.RaiseObjectGotSelection(primary);
                }
            }
        }
Пример #8
0
        /// <summary>
        /// Make the box keep the aspect ratio of the observed view.
        /// </summary>
        /// <returns></returns>
        public override Rectangle ComputeRubberBandBox()
        {
            Point viewPoint  = base.FirstInput.ViewPoint;
            Point viewPoint2 = base.LastInput.ViewPoint;

            checked
            {
                int    num        = viewPoint2.X - viewPoint.X;
                int    num2       = viewPoint2.Y - viewPoint.Y;
                GoView zoomedView = ZoomedView;
                if (zoomedView == null || zoomedView.DisplayRectangle.Height == 0 || num2 == 0)
                {
                    return(new Rectangle(Math.Min(viewPoint2.X, viewPoint.X), Math.Min(viewPoint2.Y, viewPoint.Y), Math.Abs(viewPoint2.X - viewPoint.X), Math.Abs(viewPoint2.Y - viewPoint.Y)));
                }
                Rectangle displayRectangle = zoomedView.DisplayRectangle;
                float     num3             = (float)displayRectangle.Width / (float)displayRectangle.Height;
                int       num4;
                int       num5;
                if (Math.Abs((float)num / (float)num2) < num3)
                {
                    num4 = viewPoint.X + num;
                    num5 = viewPoint.Y + (int)Math.Ceiling((float)Math.Abs(num) / num3) * ((num2 >= 0) ? 1 : (-1));
                }
                else
                {
                    num4 = viewPoint.X + (int)Math.Ceiling((float)Math.Abs(num2) * num3) * ((num >= 0) ? 1 : (-1));
                    num5 = viewPoint.Y + num2;
                }
                return(new Rectangle(Math.Min(num4, viewPoint.X), Math.Min(num5, viewPoint.Y), Math.Abs(num4 - viewPoint.X), Math.Abs(num5 - viewPoint.Y)));
            }
        }
Пример #9
0
        public static void AddRectangleHandles(GoObject myObject, RectangleF rect, PointF center, float angle, GoSelection sel, GoObject selectedObj)
        {
            GoView view  = sel.View;
            bool   flag  = view?.CanResizeObjects() ?? true;
            bool   flag2 = view?.CanReshapeObjects() ?? true;

            if (myObject.CanResize() && flag)
            {
                float  x      = rect.X;
                float  x2     = rect.X + rect.Width / 2f;
                float  x3     = rect.X + rect.Width;
                float  y      = rect.Y;
                float  y2     = rect.Y + rect.Height / 2f;
                float  y3     = rect.Y + rect.Height;
                double num    = (double)angle * Math.PI / 180.0;
                double cosine = Math.Cos(num);
                double sine   = Math.Sin(num);
                SetResizeCursor(sel.CreateResizeHandle(myObject, selectedObj, RotatePoint(new PointF(x, y), center, cosine, sine), 2, filled: true), angle);
                SetResizeCursor(sel.CreateResizeHandle(myObject, selectedObj, RotatePoint(new PointF(x3, y), center, cosine, sine), 4, filled: true), angle);
                SetResizeCursor(sel.CreateResizeHandle(myObject, selectedObj, RotatePoint(new PointF(x3, y3), center, cosine, sine), 8, filled: true), angle);
                SetResizeCursor(sel.CreateResizeHandle(myObject, selectedObj, RotatePoint(new PointF(x, y3), center, cosine, sine), 16, filled: true), angle);
                if (myObject.CanReshape() && flag2)
                {
                    SetResizeCursor(sel.CreateResizeHandle(myObject, selectedObj, RotatePoint(new PointF(x2, y), center, cosine, sine), 32, filled: true), angle);
                    SetResizeCursor(sel.CreateResizeHandle(myObject, selectedObj, RotatePoint(new PointF(x3, y2), center, cosine, sine), 64, filled: true), angle);
                    SetResizeCursor(sel.CreateResizeHandle(myObject, selectedObj, RotatePoint(new PointF(x2, y3), center, cosine, sine), 128, filled: true), angle);
                    SetResizeCursor(sel.CreateResizeHandle(myObject, selectedObj, RotatePoint(new PointF(x, y2), center, cosine, sine), 256, filled: true), angle);
                }
            }
        }
Пример #10
0
        /// <summary>
        /// This method is called repeatedly by <see cref="M:Northwoods.Go.GoBalloon.DoResize(Northwoods.Go.GoView,System.Drawing.RectangleF,System.Drawing.PointF,System.Int32,Northwoods.Go.GoInputState,System.Drawing.SizeF,System.Drawing.SizeF)" /> while
        /// the user is dragging the <see cref="F:Northwoods.Go.GoBalloon.AnchorHandle" /> resize handle.
        /// </summary>
        /// <param name="p">the point (in document coordinates) currently specified by the user's mouse</param>
        /// <param name="view"></param>
        /// <param name="evttype"></param>
        /// <remarks>
        /// When <paramref name="evttype" /> is <c>GoInputState.</c><see cref="F:Northwoods.Go.GoInputState.Finish" />,
        /// this calls <see cref="M:Northwoods.Go.GoView.PickObject(System.Boolean,System.Boolean,System.Drawing.PointF,System.Boolean)" /> to
        /// find the selectable document object at the given point <paramref name="p" />.
        /// The <see cref="P:Northwoods.Go.GoBalloon.Anchor" /> is set to that object.
        /// If no object is found at that point, the <see cref="P:Northwoods.Go.GoBalloon.Anchor" /> is set to null
        /// and the <see cref="P:Northwoods.Go.GoBalloon.UnanchoredOffset" /> is set to the offset between that
        /// point and the <see cref="P:Northwoods.Go.GoComment.Label" />'s Position.
        /// If the user tries to reanchor this balloon to itself, no change is made.
        /// This method does nothing unless the <paramref name="evttype" /> is <see cref="F:Northwoods.Go.GoInputState.Finish" />.
        /// </remarks>
        protected virtual void PickNewAnchor(PointF p, GoView view, GoInputState evttype)
        {
            if (evttype != GoInputState.Finish)
            {
                return;
            }
            GoObject goObject = view.PickObject(doc: true, view: false, p, selectableOnly: true);

            if (goObject == this)
            {
                return;
            }
            Anchor = goObject;
            if (goObject == null)
            {
                if (Label != null)
                {
                    UnanchoredOffset = GoTool.SubtractPoints(p, Label.Position);
                }
                else
                {
                    UnanchoredOffset = GoTool.SubtractPoints(p, base.Position);
                }
            }
        }
Пример #11
0
        /// <summary>
        /// Support allowing the user to move the angle control handles.
        /// </summary>
        /// <param name="view"></param>
        /// <param name="origRect"></param>
        /// <param name="newPoint"></param>
        /// <param name="whichHandle"></param>
        /// <param name="evttype"></param>
        /// <param name="min"></param>
        /// <param name="max"></param>
        public override void DoResize(GoView view, RectangleF origRect, PointF newPoint, int whichHandle, GoInputState evttype, SizeF min, SizeF max)
        {
            if ((whichHandle == 1039 || whichHandle == 1040) && (ResizesRealtime || evttype == GoInputState.Finish || evttype == GoInputState.Cancel))
            {
                switch (whichHandle)
                {
                case 1039:
                {
                    RectangleF bounds2 = Bounds;
                    float      num6    = bounds2.Width / 2f;
                    float      num7    = bounds2.Height / 2f;
                    float      num8    = bounds2.X + num6;
                    float      num9    = bounds2.Y + num7;
                    float      angle   = GoStroke.GetAngle(newPoint.X - num8, newPoint.Y - num9);
                    float      num10   = SweepAngle - (angle - StartAngle);
                    if (SweepAngle >= 0f)
                    {
                        if (num10 < 0f)
                        {
                            num10 += 360f;
                        }
                    }
                    else if (num10 >= 0f)
                    {
                        num10 -= 360f;
                    }
                    SweepAngle = num10;
                    StartAngle = angle;
                    break;
                }

                case 1040:
                {
                    RectangleF bounds = Bounds;
                    float      num    = bounds.Width / 2f;
                    float      num2   = bounds.Height / 2f;
                    float      num3   = bounds.X + num;
                    float      num4   = bounds.Y + num2;
                    float      num5   = GoStroke.GetAngle(newPoint.X - num3, newPoint.Y - num4) - StartAngle;
                    if (SweepAngle >= 0f)
                    {
                        if (num5 < 0f)
                        {
                            num5 += 360f;
                        }
                    }
                    else if (num5 >= 0f)
                    {
                        num5 -= 360f;
                    }
                    SweepAngle = num5;
                    break;
                }
                }
            }
            else
            {
                base.DoResize(view, origRect, newPoint, whichHandle, evttype, min, max);
            }
        }
Пример #12
0
        /// <summary>
        /// Implement the single-click behavior for this handle, to toggle the
        /// expansion state of the <see cref="T:Northwoods.Go.IGoCollapsible" /> that this handle is in.
        /// </summary>
        /// <param name="evt"></param>
        /// <param name="view"></param>
        /// <returns>true if the parent <see cref="P:Northwoods.Go.IGoCollapsible.Collapsible" /> property is true</returns>
        /// <remarks>
        /// If <see cref="P:Northwoods.Go.IGoCollapsible.IsExpanded" /> is true, this calls <see cref="M:Northwoods.Go.IGoCollapsible.Collapse" />;
        /// otherwise this calls <see cref="M:Northwoods.Go.IGoCollapsible.Expand" />.
        /// If the view is non-null, this method calls <see cref="M:Northwoods.Go.GoView.StartTransaction" />
        /// and <see cref="M:Northwoods.Go.GoView.FinishTransaction(System.String)" />, with a transaction name specified by
        /// the value of <see cref="F:Northwoods.Go.GoUndoManager.CollapsedName" /> or <see cref="F:Northwoods.Go.GoUndoManager.ExpandedName" />.
        /// </remarks>
        public override bool OnSingleClick(GoInputEventArgs evt, GoView view)
        {
            IGoCollapsible goCollapsible = FindCollapsible();

            if (goCollapsible == null)
            {
                return(false);
            }
            string tname = null;

            try
            {
                view?.StartTransaction();
                if (goCollapsible.IsExpanded)
                {
                    goCollapsible.Collapse();
                    tname = "Collapsed";
                }
                else
                {
                    goCollapsible.Expand();
                    tname = "Expanded";
                }
            }
            finally
            {
                view?.FinishTransaction(tname);
            }
            return(true);
        }
Пример #13
0
 /// <summary>
 /// Start editing the label.
 /// </summary>
 /// <param name="view"></param>
 public override void DoBeginEdit(GoView view)
 {
     if (Label != null)
     {
         Label.DoBeginEdit(view);
     }
 }
Пример #14
0
        /// <summary>
        /// This is responsible for creating and initializing a <c>Control</c>
        /// and adding it to a view, if does not already exist.
        /// </summary>
        /// <param name="view">must not be null,
        /// and either <c>this.View == view</c> or <c>this.Document == view.Document</c>
        /// </param>
        /// <returns>A <c>Control</c>, added to the <pararef name="view" />.</returns>
        /// <remarks>
        /// This calls <see cref="M:Northwoods.Go.GoControl.FindControl(Northwoods.Go.GoView)" />.
        /// If the result is null, this calls <see cref="M:Northwoods.Go.GoControl.CreateControl(Northwoods.Go.GoView)" /> and
        /// remembers the resulting <c>Control</c> in the <see cref="P:Northwoods.Go.GoControl.Map" />,
        /// for <see cref="M:Northwoods.Go.GoControl.FindControl(Northwoods.Go.GoView)" /> to return.
        /// </remarks>
        public virtual Control GetControl(GoView view)
        {
            if (view == null)
            {
                return(null);
            }
            if (base.IsInView && base.View != view)
            {
                return(null);
            }
            if (base.IsInDocument && base.Document != view.Document)
            {
                return(null);
            }
            Control control = FindControl(view);

            if (control == null)
            {
                control = CreateControl(view);
                if (control != null)
                {
                    Map[view] = control;
                    view.AddGoControl(this, control);
                }
            }
            return(control);
        }
Пример #15
0
        /// <summary>
        /// As the user drags this rectangle around, change the observed view's
        /// DocPosition property.
        /// </summary>
        /// <param name="old"></param>
        /// <remarks>
        /// This basically just does <c>ObservedView.DocPosition = Position</c>,
        /// although it can also set the ObservedView.DocScale property
        /// when this rectangle's size changes.
        /// It ignores changes caused by a change in the observed view
        /// by not changing the ObservedView's DocPosition or DocScale when
        /// <see cref="P:Northwoods.Go.GoObject.Initializing" /> is true.
        /// </remarks>
        protected override void OnBoundsChanged(RectangleF old)
        {
            base.OnBoundsChanged(old);
            GoView observedView = ObservedView;

            if (observedView == null)
            {
                return;
            }
            if (base.View != null)
            {
                AddSelectionHandles(base.View.Selection, this);
            }
            if (!base.Initializing)
            {
                base.Initializing        = true;
                observedView.DocPosition = base.Position;
                if (old.Width != base.Width || old.Height != base.Height)
                {
                    Size size = observedView.DisplayRectangle.Size;
                    observedView.DocScale = Math.Min((float)size.Width / base.Width, (float)size.Height / base.Height);
                }
                base.Initializing = false;
            }
        }
Пример #16
0
 /// <summary>
 /// When a GoControl is added to a document, we need to add corresponding
 /// Controls to all of its views; when it is removed from a document, we
 /// need to remove all of its Controls in all of its views.
 /// </summary>
 /// <param name="oldlayer"></param>
 /// <param name="newlayer"></param>
 /// <param name="mainObj"></param>
 protected override void OnLayerChanged(GoLayer oldlayer, GoLayer newlayer, GoObject mainObj)
 {
     base.OnLayerChanged(oldlayer, newlayer, mainObj);
     if (oldlayer != null && newlayer == null && oldlayer.IsInDocument)
     {
         foreach (KeyValuePair <GoView, Control> item in Map)
         {
             GoView  key   = item.Key;
             Control value = item.Value;
             if (key != null && value != null)
             {
                 DisposeControl(value, key);
             }
         }
         Map.Clear();
     }
     else
     {
         if (oldlayer == null || newlayer != null || !oldlayer.IsInView)
         {
             return;
         }
         GoView  view    = oldlayer.View;
         Control control = FindControl(view);
         if (control != null)
         {
             Map.Remove(view);
             if (control != null)
             {
                 DisposeControl(control, view);
             }
         }
     }
 }
Пример #17
0
 /// <summary>
 /// If <see cref="P:Northwoods.Go.GoButton.AutoRepeating" /> is true, have the <see cref="T:Northwoods.Go.GoToolAction" />
 /// tool start calling <see cref="M:Northwoods.Go.GoButton.OnActionAdjusted(Northwoods.Go.GoView,Northwoods.Go.GoInputEventArgs)" /> repeatedly while
 /// the mouse is down.
 /// </summary>
 /// <param name="view"></param>
 /// <param name="e"></param>
 public virtual void OnActionActivated(GoView view, GoInputEventArgs e)
 {
     if (AutoRepeating && view != null)
     {
         (view.Tool as GoToolAction)?.StartAutoAdjusting();
     }
 }
Пример #18
0
        /// <summary>
        /// Call all of the Action event handlers.
        /// </summary>
        /// <param name="view">the <see cref="T:Northwoods.Go.GoView" /> that is handling input events for this <see cref="T:Northwoods.Go.IGoActionObject" /></param>
        /// <param name="e">assumed to be the same as the <paramref name="view" />'s <see cref="P:Northwoods.Go.GoView.LastInput" /></param>
        /// <remarks>
        /// This method is called when the user does a mouse press and release
        /// on this button.
        /// If the mouse point is no longer over this object, no Action
        /// event handlers are called, and <see cref="M:Northwoods.Go.GoButton.OnActionCancelled(Northwoods.Go.GoView)" />
        /// is called instead.
        /// </remarks>
        public virtual void OnAction(GoView view, GoInputEventArgs e)
        {
            if (view == null)
            {
                return;
            }
            GoToolAction    goToolAction   = view.Tool as GoToolAction;
            IGoActionObject goActionObject = this;

            if (goToolAction != null)
            {
                goActionObject = goToolAction.PickActionObject();
            }
            if (goActionObject == this)
            {
                if (myActionEvent != null)
                {
                    myActionEvent(this, e);
                }
            }
            else
            {
                OnActionCancelled(view);
            }
        }
Пример #19
0
        /// <summary>
        /// Unlike a regular <see cref="T:Northwoods.Go.GoCollapsibleHandle" />, subgraph handles
        /// treat a Ctrl-click when expanding as a command to call <see cref="M:Northwoods.Go.GoSubGraph.ExpandAll" />.
        /// </summary>
        /// <param name="evt"></param>
        /// <param name="view"></param>
        /// <returns></returns>
        public override bool OnSingleClick(GoInputEventArgs evt, GoView view)
        {
            GoSubGraph goSubGraph = base.Parent as GoSubGraph;

            if (goSubGraph == null || !goSubGraph.Collapsible)
            {
                return(false);
            }
            view?.StartTransaction();
            string text = null;

            if (goSubGraph.IsExpanded)
            {
                goSubGraph.Collapse();
                text = "Collapsed SubGraph";
            }
            else if (evt.Control)
            {
                goSubGraph.ExpandAll();
                text = "Expanded All SubGraphs";
            }
            else
            {
                goSubGraph.Expand();
                text = "Expanded SubGraph";
            }
            view?.FinishTransaction(text);
            return(true);
        }
Пример #20
0
        /// <summary>
        /// The overview rectangle should only appear selected if the <see cref="T:Northwoods.Go.GoOverview" />
        /// supports resizing (i.e. <see cref="P:Northwoods.Go.GoView.AllowSelect" /> and <see cref="P:Northwoods.Go.GoView.AllowResize" /> are true),
        /// and even then the handles will not be seen since their <see cref="T:Northwoods.Go.GoHandle" />.<see cref="T:Northwoods.Go.GoHandleStyle" />
        /// is <see cref="F:Northwoods.Go.GoHandleStyle.None" />.
        /// </summary>
        /// <param name="sel"></param>
        /// <param name="selectedObj"></param>
        public override void AddSelectionHandles(GoSelection sel, GoObject selectedObj)
        {
            GoView view = sel.View;

            if (view != null && view.CanSelectObjects() && view.CanResizeObjects())
            {
                view.ResizeHandleSize = new SizeF(4f / view.DocScale, 4f / view.DocScale);
                RemoveSelectionHandles(sel);
                RectangleF bounds   = Bounds;
                GoHandle   goHandle = sel.CreateResizeHandle(this, selectedObj, new PointF(bounds.Left, bounds.Top), 2, filled: true) as GoHandle;
                if (goHandle != null)
                {
                    goHandle.Style = GoHandleStyle.None;
                }
                goHandle = (sel.CreateResizeHandle(this, selectedObj, new PointF(bounds.Right, bounds.Top), 4, filled: true) as GoHandle);
                if (goHandle != null)
                {
                    goHandle.Style = GoHandleStyle.None;
                }
                goHandle = (sel.CreateResizeHandle(this, selectedObj, new PointF(bounds.Right, bounds.Bottom), 8, filled: true) as GoHandle);
                if (goHandle != null)
                {
                    goHandle.Style = GoHandleStyle.None;
                }
                goHandle = (sel.CreateResizeHandle(this, selectedObj, new PointF(bounds.Left, bounds.Bottom), 16, filled: true) as GoHandle);
                if (goHandle != null)
                {
                    goHandle.Style = GoHandleStyle.None;
                }
            }
        }
Пример #21
0
        /// <summary>
        /// Prevent user resizing of this image beyond the <see cref="P:Northwoods.Go.GoNodeIcon.MinimumIconSize" />
        /// and <see cref="P:Northwoods.Go.GoNodeIcon.MaximumIconSize" />.
        /// </summary>
        /// <param name="view"></param>
        /// <param name="origRect"></param>
        /// <param name="newPoint"></param>
        /// <param name="whichHandle"></param>
        /// <param name="evttype"></param>
        /// <param name="min"></param>
        /// <param name="max"></param>
        public override void DoResize(GoView view, RectangleF origRect, PointF newPoint, int whichHandle, GoInputState evttype, SizeF min, SizeF max)
        {
            IGoNodeIconConstraint constraint = Constraint;
            SizeF minimumIconSize            = constraint.MinimumIconSize;
            SizeF maximumIconSize            = constraint.MaximumIconSize;

            base.DoResize(view, origRect, newPoint, whichHandle, evttype, minimumIconSize, maximumIconSize);
        }
Пример #22
0
        public override RectangleF ExpandPaintBounds(RectangleF rect, GoView view)
        {
            RectangleF a        = RotateHelper.GetRotatedBounds(rect, Angle);
            float      penWidth = PenWidth;

            GoObject.InflateRect(ref a, penWidth, penWidth);
            return(RectangleF.Union(rect, a));
        }
Пример #23
0
 /// <summary>
 /// This returns the <c>Control</c> that exists for this object
 /// in the given <paramref name="view" />.
 /// </summary>
 /// <param name="view"></param>
 /// <returns>a <c>Control</c>, or null if <see cref="M:Northwoods.Go.GoControl.GetControl(Northwoods.Go.GoView)" />
 /// hasn't been called or if <see cref="M:Northwoods.Go.GoControl.CreateControl(Northwoods.Go.GoView)" /> returned null</returns>
 public virtual Control FindControl(GoView view)
 {
     if (Map.TryGetValue(view, out Control value))
     {
         return(value);
     }
     return(null);
 }
Пример #24
0
 /// <summary>
 /// The constructor associates a view with the tool.
 /// </summary>
 /// <param name="view">
 /// This <see cref="T:Northwoods.Go.GoView" /> must not be null.
 /// </param>
 protected GoTool(GoView view)
 {
     if (view == null)
     {
         throw new ArgumentNullException("view");
     }
     myView = view;
 }
Пример #25
0
        public void Copy_Command(Object sender, EventArgs e)
        {
            GoView v = GoContextMenu.FindView(sender as ToolStripMenuItem);

            if (v != null)
            {
                v.EditCopy();
            }
        }
Пример #26
0
        public void Delete_Command(Object sender, EventArgs e)
        {
            GoView v = GoContextMenu.FindView(sender as MenuItem);

            if (v != null)
            {
                v.EditDelete();
            }
        }
Пример #27
0
        private void btnPaste_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            GoView view = GetCurrentGoView();

            if (view != null && view.CanEditPaste())
            {
                view.EditPaste();
            }
        }
Пример #28
0
        private void btnDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            GoView view = GetCurrentGoView();

            if (view != null && view.Selection.Count >= 1 && view.CanEditDelete())
            {
                view.EditDelete();
            }
        }
Пример #29
0
        private void btnSelectAll_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            GoView view = GetCurrentGoView();

            if (view != null)
            {
                view.SelectAll();
            }
        }
Пример #30
0
        public override string GetToolTip(GoView view)
        {
            if (Node.IsAnImplementationOf <SimpleContainerNode>() && !Node.IsAnImplementationOf <MultiPortContainerNode>())
            {
                return(ToolTips.BuildingBlockSpatialStructure.HowToCreateNeighborhood);
            }

            return(base.GetToolTip(view));
        }
Пример #31
0
        public override GoPartInfo GetPartInfo(GoView view, IGoPartInfoRenderer renderer)
        {
            if (this.Label != null)
            {
                renderer.AddPartInfo(this.Label);
            }

            GoPartInfo info = renderer.CreatePartInfo();
            if (this.PartID != -1) info["ID"] = this.PartID;
            info.Text = this.Text;
            info.SingleClick = "EditLink()";
            renderer.AssociatePartInfo(this.RealLink, info);

            return null;
        }
Пример #32
0
 public override void Paint(Graphics g, GoView view)
 {
     GoLabeledLink l = this.LabeledLink;
     Color c = this.ConnectionColor;
     if (l != null && c != Color.Empty)
     {
         Pen pen = new Pen(c);
         PointF cp = this.LinkLabelConnectionPoint;
         PointF center = this.Center;
         GoShape.DrawLine(g, view, pen, center.X, center.Y, cp.X, cp.Y);
         pen.Dispose();
     }
     base.Paint(g, view);
 }
Пример #33
0
 public override RectangleF ExpandPaintBounds(RectangleF rect, GoView view)
 {
     Color c = this.ConnectionColor;
     rect = base.ExpandPaintBounds(rect, view);
     if (c != Color.Empty)
     {
         PointF cp = this.LinkLabelConnectionPoint;
         rect = RectangleF.Union(rect, new RectangleF(cp.X, cp.Y, 1, 1));
     }
     return rect;
 }
Пример #34
0
        public override void Paint(Graphics g, GoView view)
        {
            base.Paint(g, view);

            // draw name inside polygon
            // use bounds for now (can be incorrect, proper method involves centering among n vertices)

            // we had to convert Web FontInfo to Windows Forms Font - may have issues
            Font cvtFont = new Font(view.Font.Name, (float)view.Font.Size.Unit.Value);
            g.DrawString(this.NodeName, cvtFont, Brushes.Black, new PointF(this.Left + this.Bounds.Width / 2, this.Top + this.Bounds.Height / 2));
        }
Пример #35
0
 public PolygonDrawingTool(GoView view) : base(view) { }
Пример #36
0
 public override void Paint(Graphics g, GoView view)
 {
     SetLinkDashStyle();
     base.Paint(g, view);
 }
Пример #37
0
 public override GoContextMenu GetContextMenu(GoView view)
 {
     GoContextMenu cm = new GoContextMenu(view);
     foreach (LINK_TYPE lt in Enum.GetValues(typeof(LINK_TYPE)))
     {
         if (lt.Equals(linkType))
         {
             cm.MenuItems.Add(
                 new Northwoods.GoWeb.MenuItem(String.Format("Set Is {0}", lt.ToString().ToUpperInvariant()),
                 new EventHandler(SetLinkType)));
         }
     }
     return cm;
 }
Пример #38
0
 public DiagramPolygon(GoView v)
     : base()
 {
     myDiagram = v;
     this.ResizesRealtime = true; // for autoscrolling when resizing
 }
Пример #39
0
        public override void Paint(Graphics g, GoView view)
        {
            base.Paint(g, view);

            // draw name inside polygon
            // use bounds for now (can be incorrect, proper method involves centering among n vertices)
            g.DrawString(this.NodeName, view.Font, Brushes.Black, new PointF(this.Left+this.Bounds.Width/2, this.Top+this.Bounds.Height/2));
        }
Пример #40
0
 public override void DoResize(GoView view, RectangleF origRect, PointF newPoint, int whichHandle, GoInputState evttype, SizeF min, SizeF max)
 {
     this.myDiagram.DoAutoScroll(this.myDiagram.LastInput.ViewPoint);
     base.DoResize(view, origRect, newPoint, whichHandle, evttype, min, max);
 }
Пример #41
0
 public DiagramPolygon(GoView v,int p_nodeID, int p_linkID, String p_name, String p_type, String p_parameterName)
     : this(v)
 {
     this.LinkID = p_linkID;
     this.NodeType = p_type;
     this.NodeID = p_nodeID;
     this.NodeName = p_name;
     this.ParameterName = p_parameterName;
     functions = new List<Function>();
 }
Пример #42
0
 public override String GetToolTip(GoView view)
 {
     view.ToolTip.AutoPopDelay = 10000;
     view.ToolTip.InitialDelay = 2000;
     view.ToolTip.ReshowDelay = 2000;
     return base.GetToolTip(view);
 }
Пример #43
0
    void Awake()
    {
        Content = this;
        Layers = new Dictionary<string, GoLayer>();

        if (camera == null)
            camera = Camera.main;
    }
Пример #44
0
 // resizing updates the values for Begin and End
 public override void DoResize(GoView view, RectangleF origRect, PointF newPoint, int whichHandle,
                               GoInputState evttype, SizeF min, SizeF max)
 {
     var line = Parent as Lifeline;
     if (line != null)
     {
         RectangleF box = ComputeResize(origRect, newPoint, whichHandle, min, max, true);
         Rectangle viewbox = view.ConvertDocToView(box);
         view.DrawXorBox(viewbox, evttype != GoInputState.Finish);
         if (evttype == GoInputState.Finish)
         {
             Begin = line.GetStep(box.Top);
             End = line.GetStep(box.Bottom);
             line.LayoutChildren(this);
             line.Port.LinksOnPortChanged(ChangedBounds, 0, null, NullRect, 0, null, NullRect);
         }
     }
     else
     {
         base.DoResize(view, origRect, newPoint, whichHandle, evttype, min, max);
     }
 }
Пример #45
0
 public override string GetToolTip(GoView view)
 {
     return _msg;
 }
Пример #46
0
 public override bool OnDoubleClick(GoInputEventArgs evt, GoView view)
 {
     InvokeClicked(new LifeLineClickedArgs());
     return base.OnDoubleClick(evt, view);
 }
Пример #47
0
 public override bool OnDoubleClick(GoInputEventArgs evt, GoView view)
 {
     InvokeClicked(new MessageClickedArgs());
     return false;
 }
Пример #48
0
 public override GoContextMenu GetContextMenu(GoView view)
 {
     GoContextMenu cm = new GoContextMenu(view);  
     return cm;
 }