private void AddDrawingWithMemento(Guid managerId, AbstractDrawing drawing) { // Temporary function. // Once the player screen ui uses the viewport, this event handler should be removed. // The code here should also be in the metadata manipulator until this function is removed. HistoryMementoAddDrawing memento = new HistoryMementoAddDrawing(frameServer.Metadata, managerId, drawing.Id, drawing.ToolDisplayName); frameServer.Metadata.AddDrawing(managerId, drawing); memento.UpdateCommandName(drawing.Name); historyStack.PushNewCommand(memento); }
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); memento.UpdateCommandName(drawing.Name); 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, imagePoint, transformer); } }