To make  buildable across platforms

1. max/min are Windows-specific macros. To use max(A,B) across platforms write either
(std::max)(A,B), or
std::max(A,B), and define NOMINMAX in Win32
The second option is used to fix ncedit.cpp. Defining NOMINMAX helps to avoid same problem in the future.

2. VK_CONTROL/VK_SHIFT are undefined on UNIX (though VK_LCONROL, etc are). They are enclosed into ifdefwin.

3. My editor removes trailing spaces in the code. Too many lines are reported as changed. Sorry.