Exemplo n.º 1
0
        public static void Redo(ICanvas canvas, IDiagramCreator creator, bool pushUndo)
        {
            var history = Get(canvas);
            var undo    = history.Undo;
            var redo    = history.Redo;

            if (redo.Count <= 0)
            {
                return;
            }

            // save current model
            if (pushUndo == true)
            {
                var current = ModelEditor.GenerateDiagram(canvas, null, canvas.GetProperties());
                undo.Push(current);
            }

            // restore previous model
            var model = redo.Pop();

            ModelEditor.Clear(canvas);
            ModelEditor.Parse(model,
                              canvas, creator,
                              0, 0,
                              false, true, false, true);

            NotifyCanvasHistoryChanged(new CanvasHistoryChangedEventArgs()
            {
                Canvas = canvas,
                Undo   = undo,
                Redo   = redo
            });
        }
Exemplo n.º 2
0
        public void Copy()
        {
            var    canvas = Context.CurrentCanvas;
            string model  = ModelEditor.Generate(ModelEditor.GetSelected(canvas));

            if (model.Length == 0)
            {
                model = ModelEditor.GenerateDiagram(canvas, null, canvas.GetProperties());
            }

            ClipboardSetText(model);
        }
Exemplo n.º 3
0
        public static string Add(ICanvas canvas)
        {
            var history = Get(canvas);
            var undo    = history.Undo;
            var redo    = history.Redo;

            var model = ModelEditor.GenerateDiagram(canvas, null, canvas.GetProperties());

            undo.Push(model);
            redo.Clear();

            NotifyCanvasHistoryChanged(new CanvasHistoryChangedEventArgs()
            {
                Canvas = canvas,
                Undo   = undo,
                Redo   = redo
            });

            return(model);
        }
Exemplo n.º 4
0
 public void SaveDiagram(string fileName, ICanvas canvas)
 {
     ModelEditor.Save(fileName, ModelEditor.GenerateDiagram(canvas, null, canvas.GetProperties()));
 }