Sidepanel fixes after layout changes

Picking up #464 

The Sidepanel fold/show logic was actually broken by layout changes on the fly, but is now fixed again.

Layouts that want to use the sidepanel should now declare this inside their layout configuration by adding `"sidepanel" : true`. We formerly allowed to start with a folded sidepanel by adding `"foldSidepanel" : true` to the `main` section of a config file. This is now disabled. Use the layout object to achieve the same thing. `"folded" : true` will do the trick.