Added texture sorting (needs an icon, though)

If at least two textures are selected, the sort will be performed in the
selection; otherwise (only one or no texture selected), the sort is
performed on the entire texture list.
Make sure duplicated names have unique keys.

This also makes the sort stable.
Tweaks to archive functions

Allow entryIndex to start from arbitrary point, so as not to iterate
over all the entries every time.
Override of detectNamespace which works with index value instead of
entry pointer.
The generic detectNamespace functions is moved to Archive to remove code
duplication.
Added flat hack detection routine to WadArchive.
Implemented entry sorting, with a lot of hacks

This would have been a lot simpler if maps were self-contained single
lumps. Really, this single point forced to establish mechanisms to
enforce that certain assumptions could be relied upon.
Merge pull request #92 from Gaerzi/master

Sync with my fork.