serge-rgb / milton

An infinite-canvas paint program
GNU General Public License v3.0
1.53k stars 133 forks source link

Add Yes/No/Cancel Dialog For MacOS #155

Closed etscrivner closed 5 years ago

etscrivner commented 5 years ago

DESCRIPTION Closes #149

On macOS the file objc/objc.h defines macros YES and NO as part of the Objective-C BOOL type definition. Milton also defines its own YesNoCancelAnswer enumeration type containing values YES and NO.

On macOS this causes a conflict where the compiler attempts macro expansion on the definitions of YesNoCancelAnswer::YES and YesNoCancelAnswer::NO. This leads to compilation failure.

To fix this failure, this change renames the constants of YesNoCancelAnswer from YES to YES_, NO to NO_, and for consistency from CANCEL to CANCEL_. All occurrences of the previous constants are replaced.

In addition, this change adds the required function platform_dialog_yesnocancel to src/platform_mac.mm. This displays a Yes/No/Cancel dialog box on macOS and returns the users response.

TESTED

serge-rgb commented 5 years ago

Thanks!