public virtual void OnTrack(GVGraphViewContext context) { if (context.TrackedObject != null && !context.TrackedObject.AcceptsTracker(this)) { context.TrackedObject = null; } }
public virtual void OnDraw(GVGraphViewContext context, RectangleF paintRect) { if (GetTrackerIcon() != null) { context.Graphics.DrawImage(GetTrackerIcon(), paintRect); } }
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); }
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; }
public virtual RectangleF GetBounds(GVGraphViewContext context) { if (Autosize) { return(new RectangleF(Bounds.Location, GetBoundsSize(context))); } else { return(Bounds); } }
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); } }
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); }
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); } } }
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); } } }
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)); } }
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); }
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); } }
public override void OnDraw(GVGraphViewContext context, RectangleF paintRect) { base.OnDraw(context, paintRect); context.Graphics.DrawImage(Properties.Resources.TrackerMoveIcon, paintRect); }
public virtual void OnTouchBegin(GVGraphViewContext context) { StatusHighlighted = true; context.downObject = context.SelectedObject; }
public override void OnTouchBegin(GVGraphViewContext context) { base.OnTouchBegin(context); context.MovedObject = context.SelectedObject; }
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); }
public virtual void OnTouchEnd(GVGraphViewContext context) { }
public override void OnTouchEnd(GVGraphViewContext context) { base.OnTouchEnd(context); }
public virtual void OnClick(GVGraphViewContext context) { }
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); }