Localise some variables.
Fix a call to a non-existing function.
whitespace fixings
Globalise some locals
Move global locals out of the submodule function.
localise the two separate editing flags.
Push editing variables into locals to help prevent badness.
Localise most of the rest of the dialog locals.
Some local hiding.
Nasty little USB keyboard entry bug fixed.  Some keys wouldn't register quite properly.
Minor cleanup and formatting changes.  Nothing functional.