//**************************************************************** // Basic Shapes - Methods used for creating common paths. //**************************************************************** /// <summary> /// Creates a new PPath with the shape of a line specified by the given coordinates. /// </summary> /// <param name="x1">The x-coordinate of the start-point of the line.</param> /// <param name="y1">The y-coordinate of the start-point of the line.</param> /// <param name="x2">The x-coordinate of the end-point of the line.</param> /// <param name="y2">The y-coordinate of the end-point of the line.</param> /// <returns>The new PPath node.</returns> public static PPath CreateLine(float x1, float y1, float x2, float y2) { PPath result = new PPath(); result.AddLine(x1, y1, x2, y2); return(result); }
public override void Initialize() { PPath n1 = PPath.CreateRectangle(0, 0, 100, 80); PPath n2 = PPath.CreateEllipse(100, 100, 200, 34); PPath n3 = new PPath(); n3.AddLine(0, 0, 20, 40); n3.AddLine(20, 40, 10, 200); n3.AddLine(10, 200, 155.444f, 33.232f); n3.CloseFigure(); n3.Brush = Brushes.Yellow; n1.Pen = new Pen(Brushes.Red, 5); n2.Pen = new Pen(Brushes.Black, 0); //Fixed width stroke n3.Pen = new Pen(Brushes.Black, 0); //Fixed width stroke Canvas.Layer.AddChild(n1); Canvas.Layer.AddChild(n2); Canvas.Layer.AddChild(n3); // create a set of bounds handles for reshaping n3, and make them // sticky relative to the getCanvas().getCamera(). PStickyHandleManager sm = new PStickyHandleManager(Canvas.Camera, n3); Canvas.RemoveInputEventListener(Canvas.PanEventHandler); Canvas.AddInputEventListener(new PDragEventHandler()); }
public static void UpdateEdge(PPath edge) { // Note that the node's "FullBounds" must be used (instead of just the "Bound") // because the nodes have non-identity transforms which must be included when // determining their position. ArrayList nodes = (ArrayList)edge.Tag; PNode node1 = (PNode)nodes[0]; PNode node2 = (PNode)nodes[1]; PointF start = node1.GlobalBounds.Location; PointF end = node2.GlobalBounds.Location; float h1x, h1y, h2x; if (nodes.Count > 2 && (int)nodes[2] == -1) //var link { start.X += node1.GlobalBounds.Width * 0.5f; start.Y += node1.GlobalBounds.Height; h1x = h2x = 0; h1y = end.Y > start.Y ? 200 * (float)Math.Log10((end.Y - start.Y) / 200 + 1) : 200 * (float)Math.Log10((start.Y - end.Y) / 100 + 1); end.X += node2.GlobalBounds.Width / 2; end.Y += node2.GlobalBounds.Height / 2; } else { start.X += node1.GlobalBounds.Width; start.Y += node1.GlobalBounds.Height * 0.5f; end.Y += node2.GlobalBounds.Height * 0.5f; h1x = h2x = end.X > start.X ? 200 * (float)Math.Log10((end.X - start.X)/200 + 1) : 200 * (float)Math.Log10((start.X - end.X) / 100 + 1); h1y = 0; } edge.Reset(); //edge.AddLine(start.X, start.Y, end.X, end.Y); edge.AddBezier(start.X, start.Y, start.X + h1x, start.Y + h1y, end.X - h2x, end.Y, end.X, end.Y); }
protected override void OnStartDrag(object sender, PInputEventArgs e) { base.OnStartDrag (sender, e); squiggle = new PPath(); lastPoint = e.Position; squiggle.Pen = new Pen(Brushes.Black, (float)(1/ e.Camera.ViewScale)); layer.AddChild(squiggle); }
/// <summary> /// Creates a new PPath with the shape of the polygon specified by the given dimension. /// </summary> /// <param name="points">The points in the desired polygon.</param> /// <returns>The new PPath node.</returns> public static PPath CreatePolygon(PointF[] points) { PPath result = new PPath(); result.AddPolygon(points); result.Brush = Brushes.White; return(result); }
/// <summary> /// Creates a new PPath with the shape of the ellipse specified by the given dimensions. /// </summary> /// <param name="x"> /// The x-coordinate of the top left corner of the bounding box of the ellipse. /// </param> /// <param name="y"> /// The y-coordinate of the top left corner of the bounding box of the ellipse. /// </param> /// <param name="width">The width of the ellipse.</param> /// <param name="height">The height of the ellipse.</param> /// <returns>The new PPath node.</returns> public static PPath CreateEllipse(float x, float y, float width, float height) { PPath result = new PPath(); result.AddEllipse(x, y, width, height); result.Brush = Brushes.White; return(result); }
public override void Initialize() { Canvas.PanEventHandler = null; Canvas.AddInputEventListener(new PDragEventHandler()); node1 = PPath.CreateEllipse(0, 0, 100, 100); node2 = PPath.CreateEllipse(0, 0, 100, 100); link = PPath.CreateLine(50, 50, 50, 50); link.Pickable = false; Canvas.Layer.AddChild(node1); Canvas.Layer.AddChild(node2); Canvas.Layer.AddChild(link); node2.TranslateBy(200, 200); node1.FullBoundsChanged += new PPropertyEventHandler(node1_FullBoundsChanged); node2.FullBoundsChanged += new PPropertyEventHandler(node2_FullBoundsChanged); }
public InterpData() : base() { InterpGroups = new List<InterpGroup>(); TimelineView = new PNode(); AddChild(TimelineView); TimelineView.MoveToBack(); TimelineView.Pickable = false; //TimelineView.Brush = new SolidBrush(Color.FromArgb(60, 60, 60)); TimelineView.SetBounds(0, 0, 3600, Height); TimelineView.TranslateBy(Timeline.ListWidth, 0); TimeScale = PPath.CreateRectangle(0, 0, 3600, Timeline.InfoHeight); TimeScale.TranslateBy(Timeline.ListWidth, 0); TimeScale.Pickable = false; TimeScale.Brush = new SolidBrush(Color.FromArgb(80, 80, 80)); AddChild(TimeScale); TimeScale.MoveToFront(); //seperationLine = PPath.CreateLine(Timeline.ListWidth, 0, Timeline.ListWidth, 10); //seperationLine.Pickable = false; //AddChild(seperationLine); }
public void CreateConnections(ref List<DlgObj> objects) { for (int i = 0; i < Outlinks.Count; i++) { for (int j = 0; j < objects.Count; j++) if (objects[j].Id == Outlinks[i].Link) { PPath p1 = Outlinks[i].node; DlgObj p2 = (DlgObj)dv.nodeLayer[j]; PPath edge = new PPath(); if (p1.Tag == null) p1.Tag = new ArrayList(); if (p2.Tag == null) p2.Tag = new ArrayList(); ((ArrayList)p1.Tag).Add(edge); ((ArrayList)p2.Tag).Add(edge); edge.Tag = new ArrayList(); ((ArrayList)edge.Tag).Add(p1); ((ArrayList)edge.Tag).Add(p2); dv.addEdge(edge); } } }
public override void Initialize() { PLayer layer = Canvas.Layer; PNode animatedNode = PPath.CreateRectangle(0, 0, 100, 80); layer.AddChild(animatedNode); // create node to display animation path PPath ppath = new PPath(); // create animation path ppath.AddLine(0, 0, 300, 300); ppath.AddLine(300, 300, 300, 0); ppath.AddArc(0, 0, 300, 300, -90, 90); ppath.CloseFigure(); // add the path to the scene graph layer.AddChild(ppath); PPositionPathActivity positionPathActivity = new PPositionPathActivity(5000, 0, new PositionPathTarget(animatedNode)); positionPathActivity.PositionPath = (GraphicsPath)ppath.PathReference.Clone(); positionPathActivity.LoopCount = int.MaxValue; // add the activity animatedNode.AddActivity(positionPathActivity); }
protected override void OnStartDrag(object sender, PInputEventArgs e) { e.PickedNode.Parent.Parent.Parent.Parent.MoveToBack(); e.Handled = true; PNode p1 = ((PNode)sender).Parent; PNode p2 = (PNode)sender; PPath edge = new PPath(); if (p1.Tag == null) p1.Tag = new ArrayList(); if (p2.Tag == null) p2.Tag = new ArrayList(); ((ArrayList)p1.Tag).Add(edge); ((ArrayList)p2.Tag).Add(edge); edge.Tag = new ArrayList(); ((ArrayList)edge.Tag).Add(p1); ((ArrayList)edge.Tag).Add(p2); ((ArrayList)edge.Tag).Add(-1); ((SBox)e.PickedNode.Parent.Parent.Parent.Parent).g.addEdge(edge); base.OnStartDrag(sender, e); draggingVarlink = true; }
protected override void OnEndDrag(object sender, PInputEventArgs e) { base.OnEndDrag (sender, e); UpdateSquiggle(e); squiggle = null; }
public static void UpdateEdge(PPath edge) { // Note that the node's "FullBounds" must be used (instead of just the "Bound") // because the nodes have non-identity transforms which must be included when // determining their position. ArrayList nodes = (ArrayList)edge.Tag; PNode node1 = (PNode)nodes[0]; PNode node2 = (PNode)nodes[1]; PointF start = PUtil.CenterOfRectangle(node1.FullBounds); PointF end = PUtil.CenterOfRectangle(node2.FullBounds); edge.Reset(); edge.AddLine(start.X, start.Y, end.X, end.Y); }
/// <summary> /// Sets some initial values for the marquee including it's brush and pen. /// </summary> /// <param name="e">A PInputEventArgs that contains the event data.</param> protected virtual void InitializeMarquee(PInputEventArgs e) { marquee = PPath.CreateRectangle(presspt.X, presspt.Y, 0, 0); marquee.Brush = marqueeBrush; marquee.Pen = pens[0]; marqueeParent.AddChild(marquee); marqueeMap.Clear(); }
public void LoadInterpData(int idx, PCCObject pccobject) { TimeScale.RemoveAllChildren(); TimeScale.Width = 3600; TimelineView.RemoveAllChildren(); TimelineView.Width = 3600; scrollbarH.Maximum = 3600; PPath line; SText text; for (int i = 0; i < TimeScale.Width; i += 60) { line = PPath.CreateLine(i, 1, i, Timeline.InfoHeight); line.Pickable = false; line.Pen = new Pen(Color.FromArgb(110, 110, 110)); TimeScale.AddChild(line); text = new SText(i / 60 - 1 + ".00", Color.FromArgb(175, 175, 175), false); text.Pickable = false; text.TranslateBy(i + 2, Timeline.InfoHeight - text.Height); TimeScale.AddChild(text); } pcc = pccobject; index = idx; foreach (InterpGroup g in InterpGroups) RemoveChild(g.listEntry); InterpGroups.Clear(); BitConverter.IsLittleEndian = true; List<PropertyReader.Property> props = PropertyReader.getPropList(pcc, pcc.Exports[index].Data); List<int> groups = new List<int>(); foreach (PropertyReader.Property p in props) { if (pcc.getNameEntry(p.Name) == "InterpLength") InterpLength = BitConverter.ToSingle(p.raw, 24); if (pcc.getNameEntry(p.Name) == "EdSectionStart") EdSectionStart = BitConverter.ToSingle(p.raw, 24); if (pcc.getNameEntry(p.Name) == "EdSectionEnd") EdSectionEnd = BitConverter.ToSingle(p.raw, 24); if (pcc.getNameEntry(p.Name) == "m_nBioCutSceneVersion") m_nBioCutSceneVersion = p.Value.IntValue; if (pcc.getNameEntry(p.Name) == "m_pSFXSceneData") m_pSFXSceneData = p.Value.IntValue; if (pcc.getNameEntry(p.Name) == "ObjInstanceVersion") ObjInstanceVersion = p.Value.IntValue; if (pcc.getNameEntry(p.Name) == "ParentSequence") ParentSequence = p.Value.IntValue; if (pcc.getNameEntry(p.Name) == "InterpGroups") { for (int i = 0; i < p.Value.Array.Count; i += 4) groups.Add(BitConverter.ToInt32(new byte[] { (byte)p.Value.Array[i].IntValue, (byte)p.Value.Array[i + 1].IntValue, (byte)p.Value.Array[i + 2].IntValue, (byte)p.Value.Array[i + 3].IntValue }, 0) - 1); } } foreach(int i in groups) { if(pcc.Exports[i].ClassName.StartsWith("InterpGroup")) addGroup(new InterpGroup(i, pcc)); } TimeScale.MoveToFront(); PPath startmark = PPath.CreatePolygon(53,1, 61,1, 61,9); startmark.Pen = null; startmark.Brush = new SolidBrush(Color.FromArgb(255,80,80)); startmark.Pickable = false; TimeScale.AddChild(startmark); endmark = PPath.CreatePolygon(InterpLength * 60 + 61, 1, InterpLength * 60 + 69, 1, InterpLength * 60 + 61, 9); endmark.Pen = null; endmark.Brush = startmark.Brush; TimeScale.AddChild(endmark); foreach (InterpGroup g in InterpGroups) { foreach (InterpTrack t in g.InterpTracks) { t.GetKeyFrames(); t.DrawKeyFrames(); TimelineView.AddChild(t.timelineEntry); } } }
protected float GetTitleBox(string s, float w) { s = "#" + index.ToString() + " : " + s; SText title = new SText(s,titleBrush); title.TextAlignment = StringAlignment.Center; title.ConstrainWidthToTextWidth = false; if (title.Width + 20 > w) { w = title.Width + 20; } title.Width = w; title.X = 0; title.Y = 3; title.Pickable = false; titleBox = PPath.CreateRectangle(0, 0, w, title.Height + 5); titleBox.Pen = outlinePen; titleBox.Brush = titleBoxBrush; titleBox.AddChild(title); titleBox.Pickable = false; return w; }
public SVar(int idx, float x, float y, PCCObject p, GraphEditor grapheditor) : base(idx, x, y, p, grapheditor) { string s = pcc.Exports[index].ObjectName; s = s.Replace("BioSeqVar_", ""); s = s.Replace("SFXSeqVar_", ""); s = s.Replace("SeqVar_", ""); type = getType(s); float w = 60; float h = 60; shape = PPath.CreateEllipse(0, 0, w, h); outlinePen = new Pen(getColor(type)); shape.Pen = outlinePen; shape.Brush = nodeBrush; shape.Pickable = false; this.AddChild(shape); this.Bounds = new RectangleF(0, 0, w, h); val = new SText(GetValue()); val.Pickable = false; val.TextAlignment = StringAlignment.Center; val.X = w / 2 - val.Width / 2; val.Y = h / 2 - val.Height / 2; this.AddChild(val); List<SaltPropertyReader.Property> props = SaltPropertyReader.getPropList(pcc, pcc.Exports[index].Data); foreach (SaltPropertyReader.Property prop in props) { if (prop.Name == "VarName" || prop.Name == "varName") { SText VarName = new SText(prop.Value.StringValue, Color.Red, false); VarName.Pickable = false; VarName.TextAlignment = StringAlignment.Center; VarName.X = w / 2 - VarName.Width / 2; VarName.Y = h; this.AddChild(VarName); break; } } this.TranslateBy(x, y); this.MouseEnter += new PInputEventHandler(OnMouseEnter); this.MouseLeave += new PInputEventHandler(OnMouseLeave); }
public void addEdge(PPath p) { edgeLayer.AddChild(p); UpdateEdge(p); }
public override void OnMouseDown(object sender, PInputEventArgs e) { base.OnMouseDown (sender, e); PLayer layer = canvas.Layer; // Initialize the locations. pressPoint = e.Position; dragPoint = pressPoint; // create a new rectangle and add it to the canvas layer so that // we can see it. rectangle = new PPath(); rectangle.Pen = new Pen(Brushes.Black, (float)(1/ e.Camera.ViewScale)); layer.AddChild(rectangle); // update the rectangle shape. UpdateRectangle(); }
public override void OnMouseUp(object sender, PInputEventArgs e) { base.OnMouseUp (sender, e); // update the rectangle shape. UpdateRectangle(); rectangle = null; }
/// <summary> /// Constructs a new PLens. /// </summary> public PLens() { dragBar = PPath.CreateRectangle(0, 0, 100, 100); // Drag bar gets resized to fit the available space, so any rectangle will do here dragBar.Brush = DEFAULT_DRAGBAR_BRUSH; dragBar.Pickable = false; // This forces drag events to percolate up to PLens object AddChild(dragBar); camera = new PCamera(); camera.Brush = DEFAULT_LENS_BRUSH; AddChild(camera); // Create an event handler to drag the lens around. Note that this event // handler consumes events in case another conflicting event handler has been // installed higher up in the heirarchy. lensDragger = new LensDragHandler(); AddInputEventListener(lensDragger); // When this PLens is dragged around adjust the camera's view transform. TransformChanged += new PPropertyEventHandler(PLens_TransformChanged); }
public GraphEditor(int width, int height) { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); this.Size = new Size(width, height); int numNodes = 50; int numEdges = 50; // Initialize, and create a layer for the edges (always underneath the nodes) PLayer nodeLayer = this.Layer; PLayer edgeLayer = new PLayer(); Root.AddChild(edgeLayer); this.Camera.AddLayer(0, edgeLayer); Random rnd = new Random(); // Create some random nodes // Each node's Tag has an ArrayList used to store associated edges for (int i=0; i<numNodes; i++) { float x = (float)(this.ClientSize.Width * rnd.NextDouble()); float y = (float)(this.ClientSize.Height * rnd.NextDouble()); PPath path = PPath.CreateEllipse(x, y, 20, 20); path.Tag = new ArrayList(); nodeLayer.AddChild(path); } // Create some random edges // Each edge's Tag has an ArrayList used to store associated nodes for (int i=0; i<numEdges; i++) { int n1 = rnd.Next(numNodes); int n2 = n1; while (n2 == n1) { n2 = rnd.Next(numNodes); // Make sure we have two distinct nodes. } PNode node1 = nodeLayer[n1]; PNode node2 = nodeLayer[n2]; PPath edge = new PPath(); ((ArrayList)node1.Tag).Add(edge); ((ArrayList)node2.Tag).Add(edge); edge.Tag = new ArrayList(); ((ArrayList)edge.Tag).Add(node1); ((ArrayList)edge.Tag).Add(node2); edgeLayer.AddChild(edge); UpdateEdge(edge); } // Create event handler to move nodes and update edges nodeLayer.AddInputEventListener(new NodeDragHandler()); }
public SEvent(int idx, float x, float y, PCCObject p, GraphEditor grapheditor) : base(idx, x, y, p, grapheditor) { outlinePen = new Pen(Color.FromArgb(214, 30, 28)); string s = pcc.Exports[index].ObjectName; s = s.Replace("BioSeqEvt_", ""); s = s.Replace("SFXSeqEvt_", ""); s = s.Replace("SeqEvt_", ""); s = s.Replace("SeqEvent_", ""); float starty = 0; float w = 15; float midW = 0; varLinkBox = new PPath(); GetVarLinks(); for (int i = 0; i < Varlinks.Count; i++) { string d = ""; foreach (int l in Varlinks[i].Links) d = d + "#" + l + ","; d = d.Remove(d.Length - 1); SText t2 = new SText( d + "\n" + Varlinks[i].Desc); t2.X = w; t2.Y = 0; w += t2.Width + 20; t2.Pickable = false; Varlinks[i].node.TranslateBy(t2.X + t2.Width / 2, t2.Y + t2.Height); t2.AddChild(Varlinks[i].node); varLinkBox.AddChild(t2); } if(Varlinks.Count != 0) varLinkBox.AddRectangle(0, 0, w, varLinkBox[0].Height); varLinkBox.Pickable = false; varLinkBox.Pen = outlinePen; varLinkBox.Brush = nodeBrush; GetOutputLinks(); outLinkBox = new PPath(); for (int i = 0; i < Outlinks.Count(); i++) { SText t2 = new SText(Outlinks[i].Desc); if(t2.Width + 10 > midW) midW = t2.Width + 10; //t2.TextAlignment = StringAlignment.Far; //t2.ConstrainWidthToTextWidth = false; t2.X = 0 - t2.Width; t2.Y = starty + 3; starty += t2.Height + 6; t2.Pickable = false; Outlinks[i].node.TranslateBy(0, t2.Y + t2.Height / 2); t2.AddChild(Outlinks[i].node); outLinkBox.AddChild(t2); } outLinkBox.AddPolygon(new PointF[] { new PointF(0, 0), new PointF(0, starty), new PointF(-0.5f*midW, starty+30), new PointF(0 - midW, starty), new PointF(0 - midW, 0), new PointF(midW/-2, -30) }); outLinkBox.Pickable = false; outLinkBox.Pen = outlinePen; outLinkBox.Brush = nodeBrush; List<SaltPropertyReader.Property> props = SaltPropertyReader.getPropList(pcc, pcc.Exports[index].Data); foreach (SaltPropertyReader.Property prop in props) { if (prop.Name.Contains("EventName") || prop.Name == "sScriptName") s += "\n\"" + prop.Value.IntValue + "\""; else if (prop.Name == "InputLabel" || prop.Name == "sEvent") s += "\n\"" + prop.Value.StringValue + "\""; } float tW = GetTitleBox(s, w); if (tW > w) { if (midW > tW) { w = midW; titleBox.Width = w; } else { w = tW; } varLinkBox.Width = w; } float h = titleBox.Height + 1; outLinkBox.TranslateBy(titleBox.Width/2 + midW/2, h + 30); h += outLinkBox.Height + 1; varLinkBox.TranslateBy(0, h); h += varLinkBox.Height; this.bounds = new RectangleF(0, 0, w, h); this.AddChild(titleBox); this.AddChild(varLinkBox); this.AddChild(outLinkBox); this.TranslateBy(x, y); }
public override void Layout(float x, float y) { if (originalX != -1) x = originalX; if (originalY != -1) y = originalY; outlinePen = new Pen(Color.Black); string s = pcc.Exports[index].ObjectName; s = s.Replace("BioSeqAct_", ""); s = s.Replace("SFXSeqAct_", ""); s = s.Replace("SeqAct_", ""); s = s.Replace("SeqCond_", ""); float starty = 8; float w = 20; varLinkBox = new PPath(); for (int i = 0; i < Varlinks.Count(); i++) { string d = ""; foreach (int l in Varlinks[i].Links) d = d + "#" + l + ","; d = d.Remove(d.Length - 1); SText t2 = new SText(d + "\n" + Varlinks[i].Desc); t2.X = w; t2.Y = 0; w += t2.Width + 20; t2.Pickable = false; Varlinks[i].node.TranslateBy(t2.X + t2.Width / 2, t2.Y + t2.Height); t2.AddChild(Varlinks[i].node); varLinkBox.AddChild(t2); } if (Varlinks.Count != 0) varLinkBox.Height = varLinkBox[0].Height; varLinkBox.Width = w; varLinkBox.Pickable = false; outLinkBox = new PPath(); float outW = 0; for (int i = 0; i < Outlinks.Count(); i++) { SText t2 = new SText(Outlinks[i].Desc); if (t2.Width + 10 > outW) outW = t2.Width + 10; t2.X = 0 - t2.Width; t2.Y = starty; starty += t2.Height; t2.Pickable = false; Outlinks[i].node.TranslateBy(0, t2.Y + t2.Height / 2); t2.AddChild(Outlinks[i].node); outLinkBox.AddChild(t2); } outLinkBox.Pickable = false; inputLinkBox = new PNode(); GetInputLinks(); float inW = 0; float inY = 8; for (int i = 0; i < InLinks.Count(); i++) { SText t2 = new SText(InLinks[i].Desc); if (t2.Width > inW) inW = t2.Width; t2.X = 3; t2.Y = inY; inY += t2.Height; t2.Pickable = false; InLinks[i].node.X = -10; InLinks[i].node.Y = t2.Y + t2.Height / 2 - 5; t2.AddChild(InLinks[i].node); inputLinkBox.AddChild(t2); } inputLinkBox.Pickable = false; if (inY > starty) starty = inY; if (inW + outW + 10 > w) w = inW + outW + 10; List<SaltPropertyReader.Property> props = SaltPropertyReader.getPropList(pcc, pcc.Exports[index].Data); foreach (SaltPropertyReader.Property prop in props) { if (prop.Name == "oSequenceReference") s += "\n\"" + pcc.Exports[prop.Value.IntValue - 1].ObjectName + "\""; else if (prop.Name == "EventName" || prop.Name == "StateName") s += "\n\"" + prop.Value.IntValue + "\""; else if (prop.Name == "OutputLabel" || prop.Name == "m_sMovieName") s += "\n\"" + prop.Value.StringValue + "\""; else if (prop.Name == "m_pEffect") if(prop.Value.IntValue > 0) s += "\n\"" + pcc.Exports[prop.Value.IntValue - 1].ObjectName + "\""; else s += "\n\"" + pcc.Imports[-prop.Value.IntValue - 1].Name + "\""; } float tW = GetTitleBox(s, w); if (tW > w) { w = tW; titleBox.Width = w; } titleBox.X = 0; titleBox.Y = 0; float h = titleBox.Height + 2; inputLinkBox.TranslateBy(0, h); outLinkBox.TranslateBy(w, h); h += starty + 8; varLinkBox.TranslateBy(varLinkBox.Width < w ? (w - varLinkBox.Width) / 2 : 0, h); h += varLinkBox.Height; box = PPath.CreateRectangle(0, titleBox.Height + 2, w, h - (titleBox.Height + 2)); box.Brush = nodeBrush; box.Pen = outlinePen; box.Pickable = false; this.Bounds = new RectangleF(0, 0, w, h); this.AddChild(box); this.AddChild(titleBox); this.AddChild(varLinkBox); this.AddChild(outLinkBox); this.AddChild(inputLinkBox); this.TranslateBy(x, y); }
protected void MakeTitleBox(string s) { s = "#" + index + " : " + s; SText title = new SText(s, Color.FromArgb(255, 255, 128)); title.TextAlignment = StringAlignment.Center; title.ConstrainWidthToTextWidth = false; title.Width += 20; title.X = 0; title.Y = 3; title.Pickable = false; titleBox = PPath.CreateRectangle(0, 0, title.Width, title.Height + 5); titleBox.Pen = outlinePen; titleBox.Brush = new SolidBrush(Color.FromArgb(112, 112, 112)); titleBox.AddChild(title); titleBox.Pickable = false; }
public override void CreateConnections(ref List<SObj> objects) { for (int i = 0; i < Outlinks.Count; i++) { for (int j = 0; j < objects.Count; j++) for (int k = 0; k < Outlinks[i].Links.Count; k++ ) if (objects[j].Index == Outlinks[i].Links[k]) { PPath p1 = Outlinks[i].node; SObj p2 = (SObj)g.nodeLayer[j]; PPath edge = new PPath(); if (p1.Tag == null) p1.Tag = new ArrayList(); if (p2.Tag == null) p2.Tag = new ArrayList(); ((ArrayList)p1.Tag).Add(edge); ((ArrayList)p2.Tag).Add(edge); edge.Tag = new ArrayList(); ((ArrayList)edge.Tag).Add(p1); ((ArrayList)edge.Tag).Add(p2); ((ArrayList)edge.Tag).Add(Outlinks[i].InputIndices[k]); g.addEdge(edge); } } for (int i = 0; i < Varlinks.Count; i++) { for (int j = 0; j < objects.Count(); j++) for (int k = 0; k < Varlinks[i].Links.Count; k++ ) if (objects[j].Index == Varlinks[i].Links[k]) { PPath p1 = Varlinks[i].node; PNode p2 = g.nodeLayer[j]; PPath edge = new PPath(); if (p1.Tag == null) p1.Tag = new ArrayList(); if (p2.Tag == null) p2.Tag = new ArrayList(); ((ArrayList)p1.Tag).Add(edge); ((ArrayList)p2.Tag).Add(edge); edge.Tag = new ArrayList(); if(p2.ChildrenCount > 1) edge.Pen = ((PPath)p2[1]).Pen; ((ArrayList)edge.Tag).Add(p1); ((ArrayList)edge.Tag).Add(p2); ((ArrayList)edge.Tag).Add(-1);//is a var link g.addEdge(edge); } } }
//**************************************************************** // Basic Shapes - Methods used for creating common paths. //**************************************************************** /// <summary> /// Creates a new PPath with the shape of a line specified by the given coordinates. /// </summary> /// <param name="x1">The x-coordinate of the start-point of the line.</param> /// <param name="y1">The y-coordinate of the start-point of the line.</param> /// <param name="x2">The x-coordinate of the end-point of the line.</param> /// <param name="y2">The y-coordinate of the end-point of the line.</param> /// <returns>The new PPath node.</returns> public static PPath CreateLine(float x1, float y1, float x2, float y2) { PPath result = new PPath(); result.AddLine(x1, y1, x2, y2); return result; }
/// <summary> /// Creates a new PPath with the shape of the ellipse specified by the given dimensions. /// </summary> /// <param name="x"> /// The x-coordinate of the top left corner of the bounding box of the ellipse. /// </param> /// <param name="y"> /// The y-coordinate of the top left corner of the bounding box of the ellipse. /// </param> /// <param name="width">The width of the ellipse.</param> /// <param name="height">The height of the ellipse.</param> /// <returns>The new PPath node.</returns> public static PPath CreateEllipse(float x, float y, float width, float height) { PPath result = new PPath(); result.AddEllipse(x, y, width, height); result.Brush = Brushes.White; return result; }
/// <summary> /// Creates a new PPath with the shape of the polygon specified by the given dimension. /// </summary> /// <param name="points">The points in the desired polygon.</param> /// <returns>The new PPath node.</returns> public static PPath CreatePolygon(PointF[] points) { PPath result = new PPath(); result.AddPolygon(points); result.Brush = Brushes.White; return result; }
public InterpGroup(int idx, PCCObject pccobj) : base() { index = idx; pcc = pccobj; title = new SText(""); if (pcc.Exports[index].ClassName == "InterpGroupDirector") GroupName = "DirGroup"; listEntry = PPath.CreateRectangle(0, 0, Timeline.ListWidth, Timeline.TrackHeight); listEntry.Brush = GroupBrush; listEntry.Pen = null; PPath p = PPath.CreatePolygon(7,5, 12,10, 7,15); p.Brush = Brushes.Black; listEntry.AddChild(p); listEntry.AddChild(PPath.CreateLine(0, listEntry.Bounds.Bottom, Timeline.ListWidth, listEntry.Bounds.Bottom)); colorAccent = new PNode(); colorAccent.Brush = null; colorAccent.Bounds = new RectangleF(Timeline.ListWidth - 10, 0, 10, listEntry.Bounds.Bottom); listEntry.AddChild(colorAccent); title.TranslateBy(20, 3); listEntry.AddChild(title); listEntry.MouseDown += listEntry_MouseDown; collapsed = true; InterpTracks = new List<InterpTrack>(); LoadData(); }
public SFrame(int idx, float x, float y, IMEPackage p, GraphEditor grapheditor) : base(idx, p, grapheditor) { string s = export.ObjectName; float w = 0; float h = 0; var props = export.GetProperties(); foreach (var prop in props) { if (prop.Name == "SizeX") { w = (prop as IntProperty); } if (prop.Name == "SizeY") { h = (prop as IntProperty); } } MakeTitleBox(s); shape = PPath.CreateRectangle(0, -titleBox.Height, w, h + titleBox.Height); outlinePen = new Pen(Color.Black); shape.Pen = outlinePen; shape.Brush = new SolidBrush(Color.Transparent); shape.Pickable = false; this.AddChild(shape); titleBox.TranslateBy(0, -titleBox.Height); this.AddChild(titleBox); comment.Y -= titleBox.Height; this.Bounds = new RectangleF(0, -titleBox.Height, titleBox.Width, titleBox.Height); this.TranslateBy(x, y); }
/// <summary> /// Ends a marquee selection sequence. /// </summary> /// <param name="e">A PInputEventArgs that contains the event data.</param> /// <remarks> /// <b>Notes to Inheritors:</b> Subclasses can override this method to be notified /// at the End of a marquee selection sequence. /// <para> /// Overriding methods must still call <c>base.EndMarqueeSelection()</c> for correct /// behavior. /// </para> /// </remarks> protected virtual void EndMarqueeSelection(PInputEventArgs e) { // Remove marquee marquee.RemoveFromParent(); marquee = null; }
public DlgStart(int idx, float x, float y, ME3BioConversation bc, DialogVis dialogvis) : base(idx, x, y, bc, dialogvis) { outlinePen = new Pen(Color.Black); GetOutputLinks(); SText title = new SText("Start: " + index, titleBrush); title.TextAlignment = StringAlignment.Center; title.X = 5; title.Y = 3; title.Pickable = false; box = PPath.CreateRectangle(0, 0, title.Width + 10, title.Height + 5); box.Pen = outlinePen; box.Brush = nodeBrush; box.AddChild(title); this.AddChild(box); this.TranslateBy(x, y); }