public override void AddRequiredReferences(Action <Datum> fnAdd, Mapping mapID) { base.AddRequiredReferences(fnAdd, mapID); fnAdd.Invoke(Sound?.Content); }
public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID) { base.CopyFrom(other, depth, mapID); Debug.Fail("there is no reason to be using SelectionBox.CopyFrom"); }
public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID) { // this is slightly flaky for Undo still, in that the scriptable must be put into the transaction FIRST // (otherwise it will refernce differing copies of the contained element) base.CopyFrom(other, depth, mapID); Scriptable scriptable = (Scriptable)other; if (depth > CopyDepth.Transform) { CopyPresentationFrom(scriptable, false); } //Debug.WriteLine("Scriptable.CopyFrom, depth=" + depth + " ID=" + scriptable.SAWID); // contained element. Works like ShapeStack containment - Element is tightly bound within this if (depth == CopyDepth.Transform && Element != null) { // first time must copy reference, below if (Element != scriptable.Element) { Element?.CopyFrom(scriptable.Element, depth, mapID); } } else // if (depth == CopyDepth.Duplicate) { if (mapID?.ContainsKey(scriptable.Element.ID) ?? false) { Element = (Shape)mapID[scriptable.Element.ID]; } else { Element = (Shape)scriptable.Element.Clone(mapID ?? new Mapping()); // use actual mapID if there is one, otherwise need a real one as Container aspects of Item don't like Ignore } Element.Parent = this; } //else //{ // Element = scriptable.Element; //} ////else if (depth == CopyDepth.Duplicate) ////{ //// if (mapID == null) //// mapID = Mapping.Ignore; //// Element = (Shape)scriptable.Element.Clone(mapID); //// Element.Parent = this; ////} //else //{ // // undo requires all shapes are copied, because they could later be edited by styling changes // //Element = Shape.CreateShape(scriptable.Element.ShapeCode); // <- this is inadequate as it doesn't clone contents of the items which leaves some reference problems // //Element.CopyFrom(scriptable.Element, depth, null); // Element = (Shape)scriptable.Element.Clone(mapID ?? new Mapping()); // use actual mapID if there is one, otherwise need a real one as Container aspects of Item don't like Ignore // Element.Parent = this; //} // other fields: if (depth > CopyDepth.Transform) { SAWID = scriptable.SAWID; Popup = scriptable.Popup; Shown = scriptable.Shown; AutoRepeat = scriptable.AutoRepeat; RepeatTimeout = scriptable.RepeatTimeout; for (int i = 0; i < Scripts.Length; i++) { Scripts[i] = scriptable.Scripts[i]?.Clone(); } } m_Bounds = RectangleF.Empty; // because content may have moved - especially on Undo }
public override void CopyFrom(Datum other, CopyDepth depth, Mapping mapID) { base.CopyFrom(other, depth, mapID); m_Closed = ((Pencil)other).m_Closed; }