Esempio n. 1
0
 public virtual void OnTrack(GVGraphViewContext context)
 {
     if (context.TrackedObject != null && !context.TrackedObject.AcceptsTracker(this))
     {
         context.TrackedObject = null;
     }
 }
Esempio n. 2
0
 public virtual void OnDraw(GVGraphViewContext context, RectangleF paintRect)
 {
     if (GetTrackerIcon() != null)
     {
         context.Graphics.DrawImage(GetTrackerIcon(), paintRect);
     }
 }
Esempio n. 3
0
 public override void PaintContent(GVGraphViewContext context, RectangleF rect, Pen penBorder)
 {
     context.Graphics.DrawRectangle(penBorder, rect.X, rect.Y, rect.Width, rect.Height);
     if (Action != null)
     {
         context.Graphics.DrawString(Action.Name, GVGraphics.ActionTitleFont, Brushes.Black, rect.X + 4, rect.Y + 4);
         for (int i = 0; i < Action.ParametersCount; i++)
         {
             GVDeclarationDataEntry ap = Action.GetParameter(i);
             context.Graphics.DrawLine(Pens.LightGray, rect.X + 4, rect.Y + p_titleheight + i * p_rowheight,
                                       rect.X + p_titlewidth - 4, rect.Y + p_titleheight + i * p_rowheight);
             context.Graphics.DrawString(ap.Name, GVGraphics.ActionPropertyFont, Brushes.Black, rect.X + 8, rect.Y + p_titleheight + i * p_rowheight + 4);
             context.Graphics.DrawString(ap.Value, GVGraphics.ActionPropertyFont, Brushes.DarkGreen, rect.X + p_row1width + 4, rect.Y + p_titleheight + i * p_rowheight + 4);
         }
         context.Graphics.DrawLine(Pens.LightGray, rect.X + 4, rect.Y + p_titleheight + Action.ParametersCount * p_rowheight,
                                   rect.X + p_titlewidth - 4, rect.Y + p_titleheight + Action.ParametersCount * p_rowheight);
         context.Graphics.DrawLine(Pens.LightGray, rect.X + 4, rect.Y + p_titleheight, rect.X + 4,
                                   rect.Y + p_titleheight + Action.ParametersCount * p_rowheight);
         context.Graphics.DrawLine(Pens.LightGray, rect.X + p_row1width, rect.Y + p_titleheight,
                                   rect.X + p_row1width, rect.Y + p_titleheight + Action.ParametersCount * p_rowheight);
         context.Graphics.DrawLine(Pens.LightGray, rect.X + p_titlewidth - 4, rect.Y + p_titleheight,
                                   rect.X + p_titlewidth - 4, rect.Y + p_titleheight + Action.ParametersCount * p_rowheight);
     }
     else
     {
         context.Graphics.DrawString("<action>", GVGraphics.ActionTitleFont, Brushes.Black, rect.X + 4, rect.Y + 4);
     }
     //base.PaintContent(context, rect, penBorder);
 }
Esempio n. 4
0
        public override void OnTrack(GVGraphViewContext p_context)
        {
            base.OnTrack(p_context);

            // move only selected object
            p_context.MovedObjectTempOffset.X = p_context.mouseMovePoint.X - p_context.mouseDownPoint.X;
            p_context.MovedObjectTempOffset.Y = p_context.mouseMovePoint.Y - p_context.mouseDownPoint.Y;
        }
Esempio n. 5
0
 public virtual RectangleF GetBounds(GVGraphViewContext context)
 {
     if (Autosize)
     {
         return(new RectangleF(Bounds.Location, GetBoundsSize(context)));
     }
     else
     {
         return(Bounds);
     }
 }
Esempio n. 6
0
 public virtual SizeF GetBoundsSize(GVGraphViewContext context)
 {
     if (Autosize)
     {
         SizeF f = context.Graphics.MeasureString(GetTitle(), SystemFonts.MenuFont);
         f.Width  += 2 * DEFAULT_PADDING;
         f.Height += 2 * DEFAULT_PADDING;
         return(f);
     }
     else
     {
         return(this.Bounds.Size);
     }
 }
Esempio n. 7
0
        public override void OnTouchEnd(GVGraphViewContext context)
        {
            // source and target have to be of appropriate types
            //
            if (context.TrackedObject.AcceptsTracker(this))
            {
            }
            else
            {
                context.TrackedObject = null;
            }

            base.OnTouchEnd(context);
        }
Esempio n. 8
0
        public override void OnTouchEnd(GVGraphViewContext context)
        {
            if (context.TrackedObject != null && context.TrackedObject.AcceptsTracker(this))
            {
                GVGraphConnection gc = GetLinkType(context.Graph);
                gc.Source = context.SelectedObject;
                gc.Target = context.TrackedObject;

                if (context.Delegate == null || context.Delegate.WillInsertConnection(context, gc))
                {
                    context.Graph.Connections.Add(gc);
                    context.Delegate.DidInsertConnection(gc);
                }
            }
        }
Esempio n. 9
0
        public override void OnDraw(GVGraphViewContext context, RectangleF paintRect)
        {
            base.OnDraw(context, paintRect);

            context.Graphics.DrawImage(GetTrackerIcon(), paintRect);
            if (StatusHighlighted && !context.SelectedObject.PaintedRect.Contains(context.mouseMovePoint))
            {
                if (context.TrackedObject != null && context.TrackedObject.AcceptsTracker(this))
                {
                    GVGraphics.DrawRectangleLine(context.Graphics, Pens.Black, context.SelectedObject.PaintedRect,
                                                 context.TrackedObject.PaintedRect);
                }
                else
                {
                    GVGraphics.DrawRectangleLine(context.Graphics, Pens.Black,
                                                 context.SelectedObject.PaintedRect, context.mouseMovePoint);
                }
            }
        }
Esempio n. 10
0
        public override SizeF GetBoundsSize(GVGraphViewContext context)
        {
            if (Action == null)
            {
                return(context.Graphics.MeasureString("<action>", SystemFonts.MenuFont));
            }
            else
            {
                float r1 = 16, r2 = 16;
                float rh        = 0;
                SizeF cellSize  = SizeF.Empty;
                SizeF titleSize = context.Graphics.MeasureString(Action.Name, GVGraphics.ActionTitleFont);
                int   count     = Action.ParametersCount;
                for (int a = 0; a < count; a++)
                {
                    GVDeclarationDataEntry ap = Action.GetParameter(a);
                    cellSize = context.Graphics.MeasureString(ap.Name, GVGraphics.ActionPropertyFont);
                    r1       = Math.Max(r1, cellSize.Width + 12);
                    rh       = Math.Max(rh, cellSize.Height);
                    cellSize = context.Graphics.MeasureString(ap.Value, GVGraphics.ActionPropertyFont);
                    r2       = Math.Max(r2, cellSize.Width + 12);
                    rh       = Math.Max(rh, cellSize.Height);
                }

                if (r1 + r2 > titleSize.Width + 8)
                {
                    p_titlewidth = r1 + r2;
                }
                else
                {
                    p_titlewidth = titleSize.Width + 8;
                    float d = (p_titlewidth - r1 - r2) / 2;
                    r1 += d;
                    r2 += d;
                }
                p_titleheight = titleSize.Height + 12;
                p_row1width   = r1;
                p_row2width   = r2;
                p_rowheight   = rh + 8;

                return(new SizeF(p_titlewidth, p_titleheight + p_rowheight * count + 4));
            }
        }
Esempio n. 11
0
        public virtual void Paint(GVGraphViewContext context)
        {
            RectangleF rectA = Source.PaintedRect;
            RectangleF rectB = Target.PaintedRect;
            RectSide   rsa, rsb;
            PointF     border1 = GVGraphics.GetConnectorPoint(rectA, GVGraphics.GetCenterPoint(rectB), out rsa);
            PointF     border2 = GVGraphics.GetConnectorPoint(rectB, GVGraphics.GetCenterPoint(rectA), out rsb);

            context.Graphics.DrawLine(LinePen, border1, border2);
            if (ArrowSize > 0)
            {
                GVGraphics.DrawArrowEnd(context.Graphics, border1, border2, LinePen.Color, ArrowSize);
            }


            TitleRectangle = GetRectangleForSize(context.Graphics.MeasureString(Title, SystemFonts.MenuFont),
                                                 GVGraphics.GetCenterPoint(border1, border2));
            context.Graphics.FillRectangle(SystemBrushes.Control, TitleRectangle.X, TitleRectangle.Y,
                                           TitleRectangle.Width, TitleRectangle.Height);
            context.Graphics.DrawString(Title, SystemFonts.MenuFont, Brushes.Black, TitleRectangle.Location);
        }
Esempio n. 12
0
        public void Paint(GVGraphViewContext p_drawContext, float relativeOriginX, float relativeOriginY)
        {
            Graphics   g         = p_drawContext.Graphics;
            Pen        penBorder = Pens.Black;
            RectangleF rect      = this.GetBounds(p_drawContext);
            string     title     = this.GetTitle();

            rect.X *= p_drawContext.Scale;
            rect.Y *= p_drawContext.Scale;
            if (!Autosize)
            {
                rect.Width  *= p_drawContext.Scale;
                rect.Height *= p_drawContext.Scale;
            }

            if (ParentObject == null)
            {
                rect.Offset(p_drawContext.Offset);
                rect.Offset(p_drawContext.DiagramTempOffset);
            }
            rect.Offset(relativeOriginX, relativeOriginY);

            if (p_drawContext.MovedObject == this && ParentObject == null)
            {
                rect.Offset(p_drawContext.MovedObjectTempOffset);
            }

            if (p_drawContext.SelectedObject == this ||
                p_drawContext.TrackedObject == this)
            {
                penBorder = Pens.Blue;
            }

            if (p_drawContext.SelectedObject == this)
            {
                List <GVTrackerBase> tracks = this.getTrackers();
                if (tracks != null)
                {
                    float      x         = rect.X;
                    float      y         = rect.Y - TRACKER_SIZE - TRACKER_DISTANCE;
                    RectangleF paintRect = new RectangleF(x, y, TRACKER_SIZE, TRACKER_SIZE);
                    foreach (GVTrackerBase ot in tracks)
                    {
                        p_drawContext.Graphics.FillRectangle(ot.GetBackgroundBrush(), paintRect);
                        ot.OnDraw(p_drawContext, paintRect);
                        ot.drawRect  = paintRect;
                        paintRect.X += TRACKER_SIZE + TRACKER_DISTANCE;
                    }
                }
            }

            PaintContent(p_drawContext, rect, penBorder);

            this.PaintedRect = rect;

            // drawing
            foreach (GVGraphObject go in this.Objects)
            {
                go.Paint(p_drawContext, rect.X, rect.Y);
            }
        }
Esempio n. 13
0
        public override void OnDraw(GVGraphViewContext context, RectangleF paintRect)
        {
            base.OnDraw(context, paintRect);

            context.Graphics.DrawImage(Properties.Resources.TrackerMoveIcon, paintRect);
        }
Esempio n. 14
0
 public virtual void OnTouchBegin(GVGraphViewContext context)
 {
     StatusHighlighted  = true;
     context.downObject = context.SelectedObject;
 }
Esempio n. 15
0
 public override void OnTouchBegin(GVGraphViewContext context)
 {
     base.OnTouchBegin(context);
     context.MovedObject = context.SelectedObject;
 }
Esempio n. 16
0
 public override void OnTouchEnd(GVGraphViewContext p_context)
 {
     p_context.MovedObject.X += p_context.MovedObjectTempOffset.X / p_context.Scale;
     p_context.MovedObject.Y += p_context.MovedObjectTempOffset.Y / p_context.Scale;
     base.OnTouchEnd(p_context);
 }
Esempio n. 17
0
 public virtual void OnTouchEnd(GVGraphViewContext context)
 {
 }
Esempio n. 18
0
 public override void OnTouchEnd(GVGraphViewContext context)
 {
     base.OnTouchEnd(context);
 }
Esempio n. 19
0
 public virtual void OnClick(GVGraphViewContext context)
 {
 }
Esempio n. 20
0
 public virtual void PaintContent(GVGraphViewContext context, RectangleF rect, Pen penBorder)
 {
     context.Graphics.DrawRectangle(penBorder, rect.X, rect.Y, rect.Width, rect.Height);
     context.Graphics.DrawString(this.GetTitle(), SystemFonts.DefaultFont, Brushes.Black, rect.X + DEFAULT_PADDING, rect.Y + DEFAULT_PADDING);
 }