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 override void Initialize() { PCanvas canvas = Canvas; PPath circle = PPath.CreateEllipse(0, 0, 100, 100); circle.Pen = new Pen(Color.Yellow, 10); circle.Brush = Brushes.Yellow; PPath rectangle = PPath.CreateRectangle(-100, -50, 100, 100); rectangle.Pen = new Pen(Color.Orange, 15); rectangle.Brush = Brushes.Orange; PNodeCache cache = new PNodeCache(); cache.AddChild(circle); cache.AddChild(rectangle); cache.InvalidateCache(); canvas.Layer.AddChild(cache); canvas.RemoveInputEventListener(canvas.PanEventHandler); canvas.AddInputEventListener(new PDragEventHandler()); }
/// <summary> /// Create and show a new error /// </summary> /// <param Name="error">The text to display to the user</param> /// <param Name="camera">The camera to display the error on</param> /// <param Name="duration">How long to display the error for</param> public Error(string error, PCamera camera, int duration = 3000) { //Slightly shade the background to bring attention to the error PPath background = PPath.CreateRectangle(0, 0, camera.ViewBounds.Width, camera.ViewBounds.Height); background.Brush = new SolidBrush(Color.FromArgb(30, 220, 220, 220)); AddChild(background); //Add the error text to the center of the screen PText errorText = new PText(error); errorText.ConstrainWidthToTextWidth = false; errorText.Font = new Font("Century Gothic", 18); errorText.TextAlignment = StringAlignment.Center; float height = errorText.Font.Height; float width = camera.Canvas.FindForm().Width; float y = (camera.Canvas.FindForm().Height - height) / 2; errorText.Bounds = new RectangleF(0, y, width, height); AddChild(errorText); //Display the error camera.AddChild(this); //Remove the error after the required time PActivity dissapear = new PActivity(duration); dissapear.ActivityFinished += activityFinished; camera.Canvas.Root.AddActivity(dissapear); }
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 = Color.Yellow; n1.Pen = new System.Drawing.Pen(System.Drawing.Brushes.Red, 5); n2.Pen = new System.Drawing.Pen(System.Drawing.Brushes.Black, 0); //Fixed width stroke n3.Pen = new System.Drawing.Pen(System.Drawing.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()); }
/// <summary> /// Draw around the outside of the page /// </summary> private void DrawBorder() { //Border = PPath.CreateRectangle(X, Y, PageSize.A4.Width, PageSize.A4.Height); Border = PPath.CreateRectangle(X, Y, Width, Height); Border.Pen = Pens.Black; AddChild(Border); }
public PendingNode(int idx, float x, float y, IMEPackage p, PathingGraphEditor grapheditor) : base(idx, p, grapheditor) { string s = export.ObjectName; // = getType(s); float w = 50; float h = 50; shape = PPath.CreateRectangle(0, 0, w, h); outlinePen = new Pen(color); shape.Pen = outlinePen; shape.Brush = actorNodeBrush; shape.Pickable = false; this.AddChild(shape); this.Bounds = new RectangleF(0, 0, w, h); val = new SText(idx.ToString()); val.Pickable = false; val.TextAlignment = StringAlignment.Center; val.X = w / 2 - val.Width / 2; val.Y = h / 2 - val.Height / 2; this.AddChild(val); var props = export.GetProperties(); this.TranslateBy(x, y); }
public override void Initialize() { PRoot root = Canvas.Root; PLayer layer = Canvas.Layer; PNode n = PPath.CreateRectangle(0, 0, 100, 80); PNode sticky = PPath.CreateRectangle(0, 0, 50, 50); PBoundsHandle.AddBoundsHandlesTo(n); sticky.Brush = Color.Yellow; PBoundsHandle.AddBoundsHandlesTo(sticky); layer.AddChild(n); Canvas.Camera.AddChild(sticky); PCamera otherCamera = new PCamera(); otherCamera.AddLayer(layer); root.AddChild(otherCamera); PCanvas other = new PCanvas(); other.Camera = otherCamera; PForm result = new PForm(false, other); result.StartPosition = FormStartPosition.Manual; result.Location = new System.Drawing.Point(this.Location.X + this.Width, this.Location.Y); result.Size = this.Size; result.Show(); }
public EverythingElseNode(int idx, float x, float y, IMEPackage p, PathingGraphEditor grapheditor) : base(idx, p, grapheditor) { string s = export.ObjectName; // = getType(s); float w = 50; float h = 50; shape = PPath.CreateRectangle(0, 0, w, h); outlinePen = new Pen(color); shape.Pen = outlinePen; shape.Brush = backgroundBrush; shape.Pickable = false; this.AddChild(shape); this.Bounds = new RectangleF(0, 0, w, h); val = new SText(idx.ToString()); val.Pickable = false; val.TextAlignment = StringAlignment.Center; val.X = w / 2 - val.Width / 2; val.Y = h / 2 - val.Height / 2; this.AddChild(val); this.TranslateBy(x, y); if (comment.Text != "") { s += "\n"; } comment.Text = s + comment.Text; }
public override void Initialize() { for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { PNode rect = PPath.CreateRectangle(i * 60, j * 60, 50, 50); rect.Brush = Brushes.Blue; Canvas.Layer.AddChild(rect); } } // Turn off default navigation event handlers Canvas.RemoveInputEventListener(Canvas.PanEventHandler); Canvas.RemoveInputEventListener(Canvas.ZoomEventHandler); // Create a selection event handler PSelectionEventHandler selectionEventHandler = new PSelectionEventHandler(Canvas.Layer, Canvas.Layer); Canvas.AddInputEventListener(selectionEventHandler); Canvas.Root.DefaultInputManager.KeyboardFocus = Canvas.Camera.ToPickPath(); PNotificationCenter.DefaultCenter.AddListener(this, "selectionChanged", PSelectionEventHandler.SELECTION_CHANGED_NOTIFICATION, selectionEventHandler); }
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 = (XnaGraphicsPath)ppath.PathReference.Clone(); positionPathActivity.LoopCount = int.MaxValue; // add the activity animatedNode.AddActivity(positionPathActivity); }
public BlockingVolumeNode(int idx, float x, float y, IMEPackage p, PathingGraphEditor grapheditor) : base(idx, p, grapheditor) { string s = export.ObjectName; if (grapheditor.showVolumeBrushes && grapheditor.showVolume_BlockingVolume) { var TShape = get3DBrushShape(); if (TShape != null) { shape = PPath.CreatePolygon(TShape); } else { shape = PPath.CreateRectangle(0, 0, 50, 50); } } else { shape = PPath.CreateRectangle(0, 0, 50, 50); } outlinePen = new Pen(color); shape.Pen = outlinePen; shape.Brush = actorNodeBrush; shape.Pickable = false; this.AddChild(shape); this.Bounds = new RectangleF(0, 0, 50, 50); val = new SText(idx.ToString()); val.Pickable = false; val.TextAlignment = StringAlignment.Center; val.X = 50 / 2 - val.Width / 2; val.Y = 50 / 2 - val.Height / 2; this.AddChild(val); this.TranslateBy(x, 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 override void Initialize() { PPath sticky = PPath.CreateRectangle(0, 0, 50, 50);; sticky.Brush = Color.Yellow; sticky.Pen = null; PBoundsHandle.AddBoundsHandlesTo(sticky); Canvas.Layer.AddChild(PPath.CreateRectangle(0, 0, 100, 80)); Canvas.Camera.AddChild(sticky); }
/// <summary> /// Ensure the border to the auxillary box always contains the contents of the box /// </summary> protected void UpdateAuxillaryBoxBorder() { //If there is already a border, remove it if (AuxillaryBoxBorder != null && AuxillaryBox.IndexOfChild(AuxillaryBoxBorder) > 0) { AuxillaryBox.RemoveChild(AuxillaryBoxBorder); } //Create a new border that contains the contents of the box AuxillaryBoxBorder = PPath.CreateRectangle(Background.Bounds.Left, Background.Bounds.Bottom, Background.Bounds.Width, AuxillaryBox.UnionOfChildrenBounds.Height); AuxillaryBox.AddChild(AuxillaryBoxBorder); AuxillaryBoxBorder.MoveToBack(); }
public override void Initialize() { PClip clip = new PClip(); clip.AddEllipse(0, 0, 100, 100); clip.Brush = Brushes.Red; clip.AddChild(PPath.CreateRectangle(20, 20, 100, 50)); Canvas.Layer.AddChild(clip); Canvas.RemoveInputEventListener(Canvas.PanEventHandler); Canvas.AddInputEventListener(new PDragEventHandler()); }
protected void GetOutputLinks() { Outlinks = new List <OutputLink>(); OutputLink l = new OutputLink(); l.Link = new Tuple <char, int>('s', conv.StartingList[index]); l.Desc = Convert.ToString(l.Link); l.node = PPath.CreateRectangle(-4, 0, 8, 10); //l.node.Brush = outputBrush; l.node.Pickable = false; Outlinks.Add(l); }
public override void Initialize() { Canvas.RemoveInputEventListener(Canvas.PanEventHandler); // Create a decorator group that is NOT volatile DecoratorGroup dg = new DecoratorGroup(); dg.Brush = Brushes.Magenta; // Put some nodes under the group for it to decorate PPath p1 = PPath.CreateEllipse(25, 25, 75, 75); p1.Brush = Brushes.Red; PPath p2 = PPath.CreateRectangle(125, 75, 50, 50); p2.Brush = Brushes.Blue; // Add everything to the Piccolo hierarchy dg.AddChild(p1); dg.AddChild(p2); Canvas.Layer.AddChild(dg); // Create a decorator group that IS volatile VolatileDecoratorGroup vdg = new VolatileDecoratorGroup(Canvas.Camera); vdg.Brush = Brushes.Cyan; // Put some nodes under the group for it to decorate PPath p3 = PPath.CreateEllipse(275, 175, 50, 50); p3.Brush = Brushes.Blue; PPath p4 = PPath.CreateRectangle(175, 175, 75, 75); p4.Brush = Brushes.Green; // Add everything to the Piccolo hierarchy vdg.AddChild(p3); vdg.AddChild(p4); Canvas.Layer.AddChild(vdg); // Create a selection handler so we can see that the decorator actually works PNodeList selectableParents = new PNodeList(); selectableParents.Add(dg); selectableParents.Add(vdg); PSelectionEventHandler ps = new PSelectionEventHandler(Canvas.Layer, selectableParents); Canvas.AddInputEventListener(ps); }
public PNode CreateHierarchy(int level) { PPath result = PPath.CreateRectangle(0, 0, 100, 100); if (level > 0) { PNode child = CreateHierarchy(level - 1); child.ScaleBy(0.5f); result.AddChild(child); child.OffsetBy(25, 25); } return(result); }
public override void Initialize() { PCanvas c = Canvas; PLayer l = c.Layer; PCamera cam = c.Camera; cam.ScaleViewBy(2.0f); PPath path = PPath.CreateRectangle(0, 0, 100, 100); l.AddChild(path); path.TranslateBy(100, 10); path.ScaleBy(0.2f); cam.AnimateViewToCenterBounds(path.GlobalFullBounds, true, 1000); }
// So far we have just been using PNode, but of course PNode has many // subclasses that you can try out to. public void CreateNodeUsingExistingClasses() { PLayer layer = Canvas.Layer; layer.AddChild(PPath.CreateEllipse(0, 0, 100, 100)); layer.AddChild(PPath.CreateRectangle(0, 100, 100, 100)); layer.AddChild(new PText("Hello World")); // Here we create an image node that displays a thumbnail // image of the root node. Note that you can easily get a thumbnail // of any node by using PNode.ToImage(). PImage image = new PImage(layer.ToImage(300, 300, Color.Transparent)); layer.AddChild(image); }
public override void Initialize() { PLayer layer = Canvas.Layer; PNode a = PPath.CreateRectangle(0, 0, 100, 80); PNode b = PPath.CreateRectangle(0, 0, 100, 80); layer.AddChild(a); layer.AddChild(b); PActivity a1 = a.AnimateToPositionScaleRotation(200, 200, 1, 0, 5000); PActivity a2 = b.AnimateToPositionScaleRotation(200, 200, 1, 0, 5000); a2.StartAfter(a1); }
// This method demonstrates the kinds of things that can be done with any node. public void NodeDemo() { PLayer layer = Canvas.Layer; PNode aNode = PPath.CreateRectangle(0, 0, 100, 80); // A node needs to be a descendent of the root to be displayed on the screen. layer.AddChild(aNode); // The default color for a node is blue, but you can change that with // the setPaint method. aNode.Brush = Color.Red; // A node can have children nodes added to it. aNode.AddChild(PPath.CreateRectangle(0, 0, 100, 80)); // The base bounds of a node is easy to change. Note that changing the base // bounds of a node will not change it's children. aNode.SetBounds(-10, -10, 200, 110); // Each node has a transform that can be used to transform the node, and // all its children on the screen. aNode.TranslateBy(100, 100); aNode.ScaleBy(1.5f); aNode.RotateBy(45); // The transparency of any node can be set, this transparency will be // applied to any of the nodes children as well. //aNode.setTransparency(0.75f); // Its easy to copy nodes. PNode aCopy = (PNode)aNode.Clone(); // Make is so that the copies children are not pickable. For this example // that means you will not be able to grab the child and remove it from // its parent. aNode.ChildrenPickable = false; // Change the look of the copy aNode.Brush = Color.Green; //aNode.setTransparency(1.0f); // Let's add the copy to the root, and translate it so that it does not // cover the original node. layer.AddChild(aCopy); aCopy.SetOffset(0, 0); aCopy.RotateBy(-45); }
public override void Initialize() { PLayer layer = Canvas.Layer; PNode aNode = new PNode(); aNode.MouseDown += new PInputEventHandler(aNode_MouseDown); aNode.MouseDrag += new PInputEventHandler(aNode_MouseDrag); aNode.MouseUp += new PInputEventHandler(aNode_MouseUp); aNode.SetBounds(0, 0, 200, 200); aNode.Brush = new SolidBrush(Color.Green); // add another node to the canvas that does not handle events as a reference // point, so that we can make sure that our green node is getting dragged. layer.AddChild(PPath.CreateRectangle(0, 0, 100, 80)); layer.AddChild(aNode); }
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); }
public override void Initialize() { PNode n1 = PPath.CreateRectangle(0, 0, 100, 80);; PNode n2 = PPath.CreateRectangle(0, 0, 100, 80);; Canvas.Layer.AddChild(n1); Canvas.Layer.AddChild(n2); n2.ScaleBy(2.0f); n2.RotateBy(90); //n2.Scale = 2.0f; //n2.Scale = 1.0f; n2.ScaleBy(0.5f); n2.Brush = Brushes.Red; n1.OffsetBy(100, 0); n2.OffsetBy(100, 0); }
public override void Initialize() { PCanvas c = Canvas; PActivity updateHandles = new PActivity(-1, 0); updateHandles.ActivityStepped = new ActivitySteppedDelegate(ActivityStepped); PPath rect = PPath.CreateRectangle(0, 0, 100, 100); rect.Brush = Color.Red; c.Layer.AddChild(rect); c.Camera.AddChild(new PBoundsHandle(PBoundsLocator.CreateNorthEastLocator(rect))); c.Camera.AddChild(new PBoundsHandle(PBoundsLocator.CreateNorthWestLocator(rect))); c.Camera.AddChild(new PBoundsHandle(PBoundsLocator.CreateSouthEastLocator(rect))); c.Camera.AddChild(new PBoundsHandle(PBoundsLocator.CreateSouthWestLocator(rect))); c.Root.ActivityScheduler.AddActivity(updateHandles, true); }
public override void Initialize() { PLayer layer = Canvas.Layer; Random r = new Random(); for (int i = 0; i < 1000; i++) { PPath each = PPath.CreateRectangle(0, 0, 100, 80); each.ScaleBy((float)r.NextDouble() * 2); each.OffsetBy((float)r.NextDouble() * 10000, (float)r.NextDouble() * 10000); each.Brush = Color.FromNonPremultiplied((int)(255 * r.NextDouble()), (int)(255 * r.NextDouble()), (int)(255 * r.NextDouble()), 255); each.Pen = new System.Drawing.Pen(System.Drawing.Color.FromArgb((int)(255 * r.NextDouble()), (int)(255 * r.NextDouble()), (int)(255 * r.NextDouble())), (float)(1 + (10 * (float)r.NextDouble()))); layer.AddChild(each); } Canvas.RemoveInputEventListener(Canvas.PanEventHandler); Canvas.AddInputEventListener(new PNavigationEventHandler()); }
public override void Initialize() { PLayer layer = Canvas.Layer; Random r = new Random(); for (int i = 0; i < 20; i++) { PPath each = PPath.CreateRectangle(0, 0, 100, 80); each.ScaleBy((float)r.NextDouble() * 2); each.OffsetBy((float)r.NextDouble() * 1000, (float)r.NextDouble() * 1000); each.Brush = new SolidBrush(Color.FromArgb((int)(255 * r.NextDouble()), (int)(255 * r.NextDouble()), (int)(255 * r.NextDouble()))); each.Pen = new Pen(Color.FromArgb((int)(255 * r.NextDouble()), (int)(255 * r.NextDouble()), (int)(255 * r.NextDouble()))); layer.AddChild(each); } Canvas.AddInputEventListener(new PNavigationEventHandler()); base.Initialize(); }
public override void Initialize() { //create bar layers PLayer rowBarLayer = new PLayer(); PLayer colBarLayer = new PLayer(); //create bar nodes for (int i = 0; i < 10; i++) { //create row bar with node row1, row2,...row10 PText p = new PText("Row " + i); p.X = 0; p.Y = NODE_HEIGHT * i + NODE_HEIGHT; p.Brush = Color.White; colBarLayer.AddChild(p); //create col bar with node col1, col2,...col10 p = new PText("Col " + i); p.X = NODE_WIDTH * i + NODE_WIDTH; p.Y = 0; p.Brush = Color.White; rowBarLayer.AddChild(p); } //add bar layers to camera Canvas.Camera.AddChild(rowBarLayer); Canvas.Camera.AddChild(colBarLayer); //create matrix nodes for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { PPath path = PPath.CreateRectangle(NODE_WIDTH * j + NODE_WIDTH, NODE_HEIGHT * i + NODE_HEIGHT, NODE_WIDTH - 1, NODE_HEIGHT - 1); Canvas.Layer.AddChild(path); } } //catch drag event and move bars corresponding Canvas.AddInputEventListener(new BarDragEventHandler(Canvas, rowBarLayer, colBarLayer)); }
/// <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); }