Exemplo n.º 1
0
        public ChangeRepresentationObject MakeChangeRepresentationObjectForDelete(FrameworkElement ApbOrDevice)
        {
            ChangeRepresentationObject dataobject = new ChangeRepresentationObject();

            dataobject.Action    = ActionType.Delete;
            dataobject.UiElement = ApbOrDevice;
            return(dataobject);
        }
Exemplo n.º 2
0
        public void RedoPushInUnDoForDelete(FrameworkElement ApbOrDevice)
        {
            ChangeRepresentationObject dataobject = new ChangeRepresentationObject();

            dataobject.Action    = ActionType.Delete;
            dataobject.UiElement = ApbOrDevice;
            _RedoActionsCollection.Push(dataobject);
        }
Exemplo n.º 3
0
 public void InsertObjectforUndoRedo(ChangeRepresentationObject dataobject)
 {
     _UndoActionsCollection.Push(dataobject);
     _RedoActionsCollection.Clear();
     if (EnableDisableUndoRedoFeature != null)
     {
         EnableDisableUndoRedoFeature(null, null);
     }
 }
Exemplo n.º 4
0
        public void Redo(int level)
        {
            for (int i = 1; i <= level; i++)
            {
                if (_RedoActionsCollection.Count == 0)
                {
                    return;
                }

                ChangeRepresentationObject Undostruct = _RedoActionsCollection.Pop();
                if (Undostruct.Action == ActionType.Delete)
                {
                    ((AnnoTier)Container).deleteSegment((AnnoTierLabel)Undostruct.UiElement);

                    ChangeRepresentationObject ChangeRepresentationObjectForDelete = this.MakeChangeRepresentationObjectForDelete(Undostruct.UiElement);
                    _UndoActionsCollection.Push(ChangeRepresentationObjectForDelete);
                }
                else if (Undostruct.Action == ActionType.Insert)
                {
                    AnnoListItem ali = ((AnnoTierLabel)Undostruct.UiElement).Item;
                    ((AnnoTier)Container).AnnoList.AddSorted(ali);
                    AnnoTierLabel at = ((AnnoTier)Container).addSegment(ali);

                    ChangeRepresentationObject ChangeRepresentationObjectForInsert = this.MakeChangeRepresentationObjectForInsert(at);
                    _UndoActionsCollection.Push(ChangeRepresentationObjectForInsert);
                }
                else if (Undostruct.Action == ActionType.Resize)
                {
                    Canvas.SetLeft(Undostruct.UiElement, Undostruct.Margin.X);
                    Undostruct.UiElement.Width = Undostruct.Width;
                    Undostruct.Start           = ((AnnoTierLabel)Undostruct.UiElement).Item.Start;
                    Undostruct.Stop            = ((AnnoTierLabel)Undostruct.UiElement).Item.Stop;
                    Undostruct.Duration        = ((AnnoTierLabel)Undostruct.UiElement).Item.Duration;

                    ChangeRepresentationObject ChangeRepresentationObjectForResize = this.MakeChangeRepresentationObjectForResize(Undostruct.Margin.X, Undostruct.UiElement);
                    _UndoActionsCollection.Push(ChangeRepresentationObjectForResize);
                }
                else if (Undostruct.Action == ActionType.Move)
                {
                    Canvas.SetLeft(Undostruct.UiElement, Undostruct.Margin.X);
                    Undostruct.UiElement.Width = Undostruct.Width;
                    Undostruct.Start           = ((AnnoTierLabel)Undostruct.UiElement).Item.Start;
                    Undostruct.Stop            = ((AnnoTierLabel)Undostruct.UiElement).Item.Stop;
                    Undostruct.Duration        = ((AnnoTierLabel)Undostruct.UiElement).Item.Duration;

                    ChangeRepresentationObject ChangeRepresentationObjectForMove = this.MakeChangeRepresentationObjectForMove(Undostruct.Margin.X, Undostruct.UiElement);
                    _UndoActionsCollection.Push(ChangeRepresentationObjectForMove);
                }
            }
            if (EnableDisableUndoRedoFeature != null)
            {
                EnableDisableUndoRedoFeature(null, null);
            }
        }
Exemplo n.º 5
0
        public void RedoPushInUnDoForResize(double pos, FrameworkElement UIelement)
        {
            ChangeRepresentationObject ResizeStruct = new ChangeRepresentationObject();

            ResizeStruct.Action    = ActionType.Resize;
            ResizeStruct.Margin.X  = pos;
            ResizeStruct.Width     = UIelement.Width;
            ResizeStruct.Start     = ((AnnoTierLabel)UIelement).Item.Start;
            ResizeStruct.Stop      = ((AnnoTierLabel)UIelement).Item.Stop;
            ResizeStruct.Duration  = ((AnnoTierLabel)UIelement).Item.Duration;
            ResizeStruct.UiElement = UIelement;
            _RedoActionsCollection.Push(ResizeStruct);
        }
Exemplo n.º 6
0
        public ChangeRepresentationObject MakeChangeRepresentationObjectForResize(double pos, FrameworkElement UIelement)
        {
            ChangeRepresentationObject ResizeStruct = new ChangeRepresentationObject();

            ResizeStruct.Action    = ActionType.Resize;
            ResizeStruct.Margin.X  = pos;
            ResizeStruct.Width     = UIelement.Width;
            ResizeStruct.Start     = ((AnnoTierLabel)UIelement).Item.Start;
            ResizeStruct.Stop      = ((AnnoTierLabel)UIelement).Item.Stop;
            ResizeStruct.Duration  = ((AnnoTierLabel)UIelement).Item.Duration;
            ResizeStruct.UiElement = UIelement;
            return(ResizeStruct);
        }
Exemplo n.º 7
0
        public void RedoPushInUnDoForMove(double pos, FrameworkElement UIelement)
        {
            ChangeRepresentationObject MoveStruct = new ChangeRepresentationObject();

            MoveStruct.Action    = ActionType.Move;
            MoveStruct.Margin.X  = pos;
            MoveStruct.Width     = UIelement.Width;
            MoveStruct.Start     = ((AnnoTierSegment)UIelement).Item.Start;
            MoveStruct.Stop      = ((AnnoTierSegment)UIelement).Item.Stop;
            MoveStruct.Duration  = ((AnnoTierSegment)UIelement).Item.Duration;
            MoveStruct.UiElement = UIelement;
            _RedoActionsCollection.Push(MoveStruct);
        }
Exemplo n.º 8
0
        public ChangeRepresentationObject MakeChangeRepresentationObjectForMove(double pos, FrameworkElement UIelement)
        {
            ChangeRepresentationObject MoveStruct = new ChangeRepresentationObject();

            MoveStruct.Action    = ActionType.Move;
            MoveStruct.Margin.X  = pos;
            MoveStruct.Width     = UIelement.Width;
            MoveStruct.Start     = ((AnnoTierSegment)UIelement).Item.Start;
            MoveStruct.Stop      = ((AnnoTierSegment)UIelement).Item.Stop;
            MoveStruct.Duration  = ((AnnoTierSegment)UIelement).Item.Duration;
            MoveStruct.UiElement = UIelement;
            return(MoveStruct);
        }
Exemplo n.º 9
0
        public void RedoPushInUnDoForSplit(double pos, FrameworkElement UIelement, FrameworkElement NextUiElement)
        {
            ChangeRepresentationObject SplitStruct = new ChangeRepresentationObject();

            SplitStruct.Action        = ActionType.Split;
            SplitStruct.Margin.X      = pos;
            SplitStruct.Width         = UIelement.Width;
            SplitStruct.Start         = ((AnnoTierSegment)UIelement).Item.Start;
            SplitStruct.Stop          = ((AnnoTierSegment)UIelement).Item.Stop;
            SplitStruct.Duration      = ((AnnoTierSegment)UIelement).Item.Duration;
            SplitStruct.UiElement     = UIelement;
            SplitStruct.NextUiElement = NextUiElement;
            _RedoActionsCollection.Push(SplitStruct);
        }
Exemplo n.º 10
0
        public ChangeRepresentationObject MakeChangeRepresentationObjectForSplit(double pos, FrameworkElement UIelement, FrameworkElement NextUIelement)
        {
            ChangeRepresentationObject SplitStruct = new ChangeRepresentationObject();

            SplitStruct.Action        = ActionType.Split;
            SplitStruct.Margin.X      = pos;
            SplitStruct.Width         = UIelement.Width;
            SplitStruct.Start         = ((AnnoTierSegment)UIelement).Item.Start;
            SplitStruct.Stop          = ((AnnoTierSegment)UIelement).Item.Stop;
            SplitStruct.Duration      = ((AnnoTierSegment)UIelement).Item.Duration;
            SplitStruct.UiElement     = UIelement;
            SplitStruct.NextUiElement = NextUIelement;

            return(SplitStruct);
        }
Exemplo n.º 11
0
        public void Undo(int level)
        {
            for (int i = 1; i <= level; i++)
            {
                if (_UndoActionsCollection.Count == 0)
                {
                    return;
                }

                ChangeRepresentationObject Undostruct = _UndoActionsCollection.Pop();
                if (Undostruct.Action == ActionType.Delete)
                {
                    AnnoListItem ali = ((AnnoTierSegment)Undostruct.UiElement).Item;
                    ((AnnoTier)Container).AnnoList.AddSorted(ali);
                    AnnoTierSegment at = ((AnnoTier)Container).AddSegment(ali);
                    this.RedoPushInUnDoForDelete(at);
                }
                else if (Undostruct.Action == ActionType.Insert)
                {
                    ((AnnoTier)Container).DeleteSegment((AnnoTierSegment)Undostruct.UiElement);
                    this.RedoPushInUnDoForInsert(Undostruct.UiElement);
                }
                else if (Undostruct.Action == ActionType.Resize)
                {
                    this.RedoPushInUnDoForResize(Canvas.GetLeft(Undostruct.UiElement), Undostruct.UiElement);
                    Canvas.SetLeft(Undostruct.UiElement, Undostruct.Margin.X);
                    Undostruct.UiElement.Width = Undostruct.Width;
                    ((AnnoTierSegment)Undostruct.UiElement).Item.Duration = Undostruct.Duration;
                    ((AnnoTierSegment)Undostruct.UiElement).Item.Start    = Undostruct.Start;
                    ((AnnoTierSegment)Undostruct.UiElement).Item.Stop     = Undostruct.Stop;
                }

                else if (Undostruct.Action == ActionType.Move)
                {
                    this.RedoPushInUnDoForMove(Canvas.GetLeft(Undostruct.UiElement), Undostruct.UiElement);
                    Canvas.SetLeft(Undostruct.UiElement, Undostruct.Margin.X);
                    Undostruct.UiElement.Width = Undostruct.Width;
                    ((AnnoTierSegment)Undostruct.UiElement).Item.Duration = Undostruct.Duration;
                    ((AnnoTierSegment)Undostruct.UiElement).Item.Start    = Undostruct.Start;
                    ((AnnoTierSegment)Undostruct.UiElement).Item.Stop     = Undostruct.Stop;
                }
                else if (Undostruct.Action == ActionType.Split)
                {
                    //resize element
                    this.RedoPushInUnDoForSplit(Canvas.GetLeft(Undostruct.UiElement), Undostruct.UiElement, Undostruct.NextUiElement);
                    Canvas.SetLeft(Undostruct.UiElement, Undostruct.Margin.X);
                    Undostruct.UiElement.Width = Undostruct.Width;

                    ((AnnoTierSegment)Undostruct.UiElement).Item.Duration = Undostruct.Duration;
                    ((AnnoTierSegment)Undostruct.UiElement).Item.Start    = Undostruct.Start;
                    ((AnnoTierSegment)Undostruct.UiElement).Item.Stop     = Undostruct.Stop;

                    //delete added element
                    ((AnnoTier)Container).DeleteSegment((AnnoTierSegment)Undostruct.NextUiElement);
                }
            }

            if (EnableDisableUndoRedoFeature != null)
            {
                EnableDisableUndoRedoFeature(null, null);
            }
        }