Ticket 33 v2

Essentially this cherry picks the changes to CMainFrame::RefreshTreeView from a098d47 that were partially over-written and restores them.

This is my second attempt at this - now based on a version which builds OK and has no nasty roll backs.