Done with keeping track of the view used by a given file and this for all possible modes (closes #306).

Also some minor cleaning up here and there, as well as various
improvements to the code. Finally, also fixed an issue with changing
modes not retrieving the ‘old’ view for the ‘new’ mode, this for a
given file.