Add some missing casts
Fix warning about printing SEL directly.
Update calls for sheet management to non-deprecated versions
Update NSFileManager usage + error checking
Fix "dangling else" warning
Fix "direct comparison undefined" warning

Also adds pretty defines for magic values.
Remove workaround for 10.5