public Shape Clone(Scene parentScene) { Shape clone = parentScene.CreateShape(this.Name); clone.Template = this.Template; clone.EditTemplateMode = this.EditTemplateMode; IList<ShapeCircle> circles = this.Circles; IList<ShapeCircle> cloneCircles = clone.Circles; for(int index = 0; index < circles.Count; ++index) { ShapeCircle circle = circles[index]; ShapeCircle cloneCircle = cloneCircles[index]; cloneCircle.Position = circle.Position; cloneCircle.Radius = circle.Radius; cloneCircle.Angle = circle.Angle; } Dictionary<string, IProperty> cloneProperties = clone.UserProperties; foreach(var kvp in this.UserProperties) { IProperty property = cloneProperties[kvp.Key]; property.TrySetValue(kvp.Value.ToString()); } clone.ZOrder = this.ZOrder; return clone; }
private static void LoadScene(DataElement sceneElement, Scene scene, ShapeTemplatesSet templates) { scene.Size = Vector2f.Parse(sceneElement.GetAttribValue("size")); DataElement shapesEl = sceneElement.GetChild("shapes"); foreach(DataElement shapeEl in shapesEl.CollectChildren("shape")) { string name = shapeEl.GetAttribValue("name"); Shape shape = scene.CreateShape(name); LoadShape(shapeEl, shape, templates); } DataElement propertiesContainer = sceneElement.GetChild("properties"); if(propertiesContainer != null) { LoadUserProperties(propertiesContainer, scene); } }
private static void SaveScene(DataElement sceneElement, Scene scene) { sceneElement.CreateAttribute("size", scene.Size.ToString()); DataElement sceneObjectContainer = sceneElement.CreateChild("shapes"); foreach(Shape shape in scene.Shapes) { DataElement shapeEl = sceneObjectContainer.CreateChild("shape"); shapeEl.CreateAttribute("name", shape.Name); SaveShape(shapeEl, shape); } DataElement propertiesContainer = sceneElement.CreateChild("properties"); SaveUserProperties(propertiesContainer, scene); }
public SizeProperty(Scene owner) { m_Owner = owner; m_Owner.SizeChanged += this.OnOwnerSizeChanged; }
private void OnSelectedSceneChanged(IEditor sender, Scene.Scene previous) { if(previous != null) { TreeNodeEx node = this.ProjectNode.Nodes.FindFirstByTag(previous); if(node != null) { node.BackColor = node.BackDefaultColor; } } if(sender.SelectedScene != null) { TreeNodeEx node = this.ProjectNode.Nodes.FindFirstByTag(sender.SelectedScene); node.Select(); node.BackColor = Color.Yellow; } }
public NameProperty(Scene owner) { m_Owner = owner; m_Owner.NameChanged += this.OnOwnerRenamed; }
private void OnShapeAdded(Scene.Scene sender, Shape shape) { TreeNodeEx sceneNode = this.ProjectNode.Nodes.FindFirstByTag(sender); sceneNode.Nodes.Add(shape.Name, shape); sceneNode.Expand(); }
private void OnShapeRemoved(Scene.Scene sender, Shape shape) { TreeNodeEx sceneNode = this.ProjectNode.Nodes.FindFirstByTag(sender); TreeNodeEx shapeNode = sceneNode.Nodes.FindFirstByTag(shape); shapeNode.Remove(); }
private void OnSceneAdded(ScenesSet sender, Scene.Scene scene) { TreeNodeEx node = this.ProjectNode.Nodes.Add(scene.Name, scene); RebuildSceneNode(node); AddScene(scene); node.Select(); }
private void OnSceneRemoved(ScenesSet sender, Scene.Scene scene) { RemoveScene(scene); TreeNodeEx node = this.ProjectNode.Nodes.FindFirstByText(scene.Name); node.Remove(); }
private void RemoveScene(Scene.Scene scene) { scene.ShapeAdded -= this.OnShapeAdded; scene.ShapeRemoved -= this.OnShapeRemoved; }
private void AddScene(Scene.Scene scene) { scene.ShapeAdded += this.OnShapeAdded; scene.ShapeRemoved += this.OnShapeRemoved; }
private void OnSceneRemoved(ScenesSet sender, Scene.Scene scene) { if(this.SelectedScene == scene) { this.SelectedScene = null; } }
private void OnSceneSizeChanged(Scene.Scene sender, Vector2f previous) { UpdateSceneSize(); }
private void OnSelectedSceneChanged(IEditor sender, Scene.Scene previous) { if(previous != null) { previous.SizeChanged -= this.OnSceneSizeChanged; } if(this.SelectedScene != null) { this.SelectedScene.SizeChanged += this.OnSceneSizeChanged; } UpdateSceneSize(); Invalidate(); }