Ejemplo n.º 1
0
        public bool addTool(bool execute, Tool tool)
        {
            bool done = execute ? tool.doTool() : true;

            if (done)
            {
                if (undoList.Count == 0)
                {
                    undoList.Add(tool);
                }
                else
                {
                    Tool last = undoList[undoList.Count - 1];
                    if (last.getTimeStamp() < tool.getTimeStamp() - 1500 || !last.combine(tool))
                    {
                        undoList.Add(tool);
                    }
                }
                redoList.Clear();
                if (notifyController)
                {
                    Controller.getInstance().dataModified();
                }

                if (!tool.canUndo())
                {
                    undoList.Clear();
                }
            }
            return(done);
        }
Ejemplo n.º 2
0
 public bool redoTool()
 {
     if (redoList.Count > 0)
     {
         Tool temp = redoList[redoList.Count - 1];
         redoList.RemoveAt(redoList.Count - 1);
         bool done = temp.redoTool();
         if (done)
         {
             undoList.Add(temp);
             if (!temp.canUndo())
             {
                 undoList.Clear();
             }
         }
         return(done);
     }
     return(false);
 }