Restore save/load last-used settings for selection toolbar

Had to disable this during window manager implementation, but it should
be fine now
Don't allocate variables in the key hook function unless absolutely necessary
Fix the Duplicate Image command to work with the new window manager
Fix modal dialogs

Tentatively fixes #97.

All .Show events have been replaced by a call to a custom showPDDialog
function.  This function handles proper z-order of modal dialogs, as
well as some other tricks to make sure window order is correct whenever
a dialog needs to be displayed.  It also interacts with the window
manager to make sure top-most dialogs are properly deactivated if the
user switches to another application mid-dialog.

As with all these window issues, more testing is necessary to ensure all
behavior is correct, particularly on XP.
Improve comments