AUI-1104 Adding max undo depth to the Undo/Redo module

The user can now specify a maximum undo depth, for memory saving purposes.