예제 #1
0
        public override HistoryMemento OnExecute(IHistoryWorkspace historyWorkspace)
        {
            CompoundHistoryMemento chm = new CompoundHistoryMemento(this.historyName, this.undoImage);

            if (!historyWorkspace.Selection.IsEmpty)
            {
                DeselectFunction df = new DeselectFunction();
                EnterCriticalRegion();
                HistoryMemento hm = df.Execute(historyWorkspace);
                chm.PushNewAction(hm);
            }

            FlipLayerHistoryMemento flha = new FlipLayerHistoryMemento(
                null,
                null,
                historyWorkspace,
                this.layerIndex,
                this.flipType);

            EnterCriticalRegion();
            HistoryMemento flha2 = flha.PerformUndo();
            chm.PushNewAction(flha);

            return chm;
        }
예제 #2
0
        protected override HistoryMemento OnUndo(ProgressEventHandler progressCallback)
        {
            FlipLayerHistoryMemento memento = new FlipLayerHistoryMemento(base.Name, base.Image, this.historyWorkspace, this.layerIndex, this.flipType);
            BitmapLayer             layer   = (BitmapLayer)this.historyWorkspace.Document.Layers[this.layerIndex];

            FlipInPlace(layer.Surface, this.flipType);
            layer.Invalidate();
            return(memento);
        }
예제 #3
0
        protected override HistoryMemento OnUndo()
        {
            FlipLayerHistoryMemento fha = new FlipLayerHistoryMemento(this.Name, this.Image, 
                this.historyWorkspace, layerIndex, flipType);

            BitmapLayer layer = (BitmapLayer)this.historyWorkspace.Document.Layers[layerIndex];
            Flip(layer.Surface);
            layer.Invalidate();
            return fha;
        }
        protected override HistoryMemento OnUndo()
        {
            FlipLayerHistoryMemento fha = new FlipLayerHistoryMemento(this.Name, this.Image,
                                                                      this.historyWorkspace, layerIndex, flipType);

            BitmapLayer layer = (BitmapLayer)this.historyWorkspace.Document.Layers[layerIndex];

            Flip(layer.Surface);
            layer.Invalidate();
            return(fha);
        }
예제 #5
0
        public override HistoryMemento OnExecute(IHistoryWorkspace historyWorkspace)
        {
            List<HistoryMemento> actions = new List<HistoryMemento>();

            if (!historyWorkspace.Selection.IsEmpty)
            {
                DeselectFunction da = new DeselectFunction();
                EnterCriticalRegion();
                HistoryMemento hm = da.Execute(historyWorkspace);
                actions.Add(hm);
            }

            int count = historyWorkspace.Document.Layers.Count;

            for (int i = 0; i < count; ++i)
            {
                HistoryMemento memento = new FlipLayerHistoryMemento(this.historyName, undoImage, historyWorkspace, i, flipType);
                EnterCriticalRegion();
                HistoryMemento mementoToAdd = memento.PerformUndo();
                actions.Add(mementoToAdd);
            }

            return new CompoundHistoryMemento(this.historyName, undoImage, actions);
        }