Added Undo and Redo functionality

Also fixed a memory leak in the WaveEditApp class.