--- hatari/src/gui-osx/AlertHooks.m 2019/04/09 08:55:20 1.1.1.5 +++ hatari/src/gui-osx/AlertHooks.m 2019/04/09 08:56:36 1.1.1.6 @@ -30,25 +30,32 @@ int HookedAlertNotice(const char* szMess firstPv = [message rangeOfString:@"'"] ; lastPv = [message rangeOfString:@"'" options:NSBackwardsSearch] ; - if ((cantTOS.location == NSNotFound) || (firstPv.location==lastPv.location)) // traitement normal + if ((cantTOS.location == NSNotFound) || (firstPv.location==lastPv.location)) // TOS can be found return ([NSApp myAlerte:NSInformationalAlertStyle Txt:nil firstB:localize(@"Ok") alternateB:localize(@"Cancel") - otherB:nil informativeTxt:message ] == NSAlertDefaultReturn ); - else // traitement can not load + otherB:nil informativeTxt:message ] == NSAlertFirstButtonReturn + //NSAlertDefaultReturn + ); + else // TOS can be found return ([NSApp myAlerte:NSCriticalAlertStyle Txt:nil firstB:localize(@"Ok") alternateB:nil otherB:nil - informativeTxt:localize(@"Can not load TOS file:") ] == NSAlertDefaultReturn) ; + informativeTxt:localize(@"Can not load TOS file:") ] == NSAlertFirstButtonReturn) ; } -/*-----------------------------------------------------------------------*/ -/* - Displays a Cocoa alert with a choice (OK and Cancel buttons) -*/ +/*----------------------------------------------------------------------*/ +/* Displays a Cocoa alert with a choice (OK and Cancel buttons) */ +/*----------------------------------------------------------------------*/ + int HookedAlertQuery(const char* szMessage) { NSString *message ; + int ret; message = localize([NSString stringWithCString:szMessage encoding:NSASCIIStringEncoding]) ; - return [NSApp myAlerte:NSInformationalAlertStyle Txt:nil firstB:localize(@"Ok") alternateB:localize(@"Cancel") - otherB:nil informativeTxt:message ] ; + ret= [NSApp myAlerte:NSInformationalAlertStyle Txt:nil firstB:localize(@"Ok") alternateB:localize(@"Cancel") + otherB:nil informativeTxt:message ] ; + if(ret==NSAlertFirstButtonReturn) + return true; //OK + else + return false; // otherwise false } #endif