Lots of little changes.

Added merging, fixed undo/redo with timeshift, fixed single-track
rerendering, added some more helper functions (which should maybe be
moved to the View object...).