private void ParseChronos(XmlReader r, PointF scale) { // TODO: catch empty tag <Chronos/>. r.ReadStartElement(); while (r.NodeType == XmlNodeType.Element) { AbstractDrawing drawing = DrawingSerializer.Deserialize(r, scale, TimeHelper.IdentityTimestampMapper, metadata); metadata.AddDrawing(metadata.ChronoManager.Id, drawing); } r.ReadEndElement(); }
public override HistoryMemento PerformUndo() { HistoryMemento redoMemento = new HistoryMementoAddDrawing(metadata, managerId, drawingId, drawingName); redoMemento.CommandName = commandName; AbstractDrawing drawing = DrawingSerializer.DeserializeMemento(data, metadata); metadata.AddDrawing(managerId, drawing); return(redoMemento); }
private void AddDrawing(PointF imagePoint, int keyframeIndex, int timestampPerFrame, ImageToViewportTransformer transformer) { AbstractDrawing drawing = screenToolManager.ActiveTool.GetNewDrawing(imagePoint, keyframeIndex, timestampPerFrame, transformer); Guid keyframeId = metadata.GetKeyframeId(keyframeIndex); HistoryMementoAddDrawing memento = new HistoryMementoAddDrawing(metadata, keyframeId, drawing.Id, drawing.ToolDisplayName); metadata.AddDrawing(keyframeId, drawing); metadata.HistoryStack.PushNewCommand(memento); // Special cases // TODO: implement the event handler to metadata DrawingAdded and finish the label in the handler. if (screenToolManager.ActiveTool == ToolManager.Tools["Label"]) { if (LabelAdded != null) { LabelAdded(this, new DrawingEventArgs(drawing, keyframeId)); } ((DrawingText)drawing).SetEditMode(true, transformer); } }