Refactor all the UI code, splitting it up.

Now there are separate key and editor files/submodules.

Not entirely happy with how some of it is accessed/updated, but
getting there.