Terminal: use BPopUpMenu in BMenuFields.

Using a BMenu works, but it doesn't look as good.
Thanks to Diver for noticing this.
Fix std::isnan and friends for gcc2.

gcc2 was relying on the c99 functions being there, but they are not in
the std namespace.
* Disable the C99 functions and macros in C++ mode
* Redefine them as inline functions in cmath in the std namespace.

Fixes #7396.