Example #1
0
 public void ProcessUndo(EquationAction action)
 {
     Type type = action.GetType();
     if (type == typeof(RowContainerAction))
     {
         ProcessRowContainerAction(action);
         IsSelecting = false;
     }
     else if (type == typeof(RowContainerTextAction))
     {
         ProcessRowContainerTextAction(action);
     }
     else if (type == typeof(RowContainerPasteAction))
     {
         ProcessRowContainerPasteAction(action);
     }
     else if (type == typeof(RowContainerFormatAction))
     {
         ProcessRowContainerFormatAction(action);
     }
     else if (type == typeof(RowContainerRemoveAction))
     {
         ProcessRowContainerRemoveAction(action);
     }
     CalculateSize();
     ParentEquation.ChildCompletedUndo(this);
 }
Example #2
0
 public void ProcessUndo(EquationAction action)
 {
     if (action.GetType() == typeof(TextAction))
     {
         ProcessTextEquation(action);
     }
     else if (action.GetType() == typeof(TextFormatAction))
     {
         TextFormatAction tfa = action as TextFormatAction;
         caretIndex = tfa.Index;
         formats.RemoveRange(tfa.Index, tfa.NewFormats.Length);
         IsSelecting = true;
         if (tfa.UndoFlag)
         {
             for (int i = 0; i < tfa.OldFormats.Length; i++)
             {
                 tfa.OldFormats[i] = textManager.GetFormatIdForNewSize(tfa.OldFormats[i], FontSize);
             }
             formats.InsertRange(tfa.Index, tfa.OldFormats);
         }
         else
         {
             for (int i = 0; i < tfa.NewFormats.Length; i++)
             {
                 tfa.NewFormats[i] = textManager.GetFormatIdForNewSize(tfa.NewFormats[i], FontSize);
             }
             formats.InsertRange(tfa.Index, tfa.NewFormats);
         }
     }
     else if (action.GetType() == typeof(ModeChangeAction))
     {
         ModeChangeAction mca = action as ModeChangeAction;
         caretIndex = mca.Index;
         modes.RemoveRange(mca.Index, mca.NewModes.Length);
         if (mca.UndoFlag)
         {
             modes.InsertRange(mca.Index, mca.OldModes);
         }
         else
         {
             modes.InsertRange(mca.Index, mca.NewModes);
         }
     }
     else if (action.GetType() == typeof(DecorationAction))
     {
         DecorationAction da = action as DecorationAction;
         if (da.UndoFlag)
         {
             foreach (var cdi in da.CharacterDecorations)
             {
                 decorations.Remove(cdi);
             }
         }
         else
         {
             decorations.AddRange(da.CharacterDecorations);
         }
     }
     else
     {
         ProcessTextRemoveAction(action);
     }
     FormatText();
     ParentEquation.ChildCompletedUndo(this);
 }
Example #3
0
 public void ProcessUndo(EquationAction action)
 {
     deleteable = null;
     if (action.GetType() == typeof(RowAction))
     {
         ProcessRowAction(action);
         IsSelecting = false;
     }
     else if (action.GetType() == typeof(EquationRowPasteAction))
     {
         ProcessRowPasteAction(action);
     }
     else if (action.GetType() == typeof(EquationRowFormatAction))
     {
         ProcessEquationRowFormatAction(action);
     }
     else
     {
         ProcessRowRemoveAction(action);
     }
     CalculateSize();
     if (ParentEquation != null)
     {
         ParentEquation.ChildCompletedUndo(this);
     }
 }