cleanup layout module and use menu

This adds all the bits and pieces needed in the layout module to use
the new menu infrastructure. The core changes where only the new
modules. As with the menu module before, there are some kinks that
still need working out and the code is already documented a bit.