--- np2/macosx/dialog/macalert.cpp 2003/10/31 16:55:06 1.1 +++ np2/macosx/dialog/macalert.cpp 2004/03/02 23:23:06 1.6 @@ -11,46 +11,57 @@ #include "np2.h" #include "macalert.h" -static AlertStdAlertParamRec makeDefaultParam(void) { - AlertStdAlertParamRec param; +static SInt16 showCautionAlert(CFStringRef title, CFStringRef string, CFStringRef button) { + DialogRef ret; + AlertStdCFStringAlertParamRec param; + DialogItemIndex hit; + GetStandardAlertDefaultParams(¶m, kStdCFStringAlertVersionOne); param.movable = true; - param.helpButton = false; - param.filterProc = NULL; - param.defaultText = (ConstStringPtr)kAlertDefaultOKText; - param.cancelText = NULL; - param.otherText = NULL; - param.defaultButton = kAlertStdAlertOKButton; - param.cancelButton = NULL; - param.position = kWindowDefaultPosition; - - return(param); -} - -static SInt16 showCautionAlert(const Str255 title, Str255 string, const Str255 button) { - SInt16 ret; - AlertStdAlertParamRec param = makeDefaultParam(); - - param.defaultText = button; - param.cancelText = (ConstStringPtr)kAlertDefaultCancelText; param.cancelButton = kAlertStdAlertCancelButton; - - StandardAlert(kAlertCautionAlert, title, string, ¶m, &ret); - return(ret); + param.cancelText = param.defaultText; + if (button) param.defaultText = button; + + CreateStandardAlert(kAlertCautionAlert, title, string, ¶m, &ret); + SysBeep(0); + RunStandardAlert(ret, NULL, &hit); + return(hit); } - +/* +#if defined(CPUCORE_IA32) +void msgbox (char* title, char* msg) { + DialogItemIndex hit; + CFStringRef cftitle, cfmsg; + + cftitle = CFSTRj(title); + cfmsg = CFSTRj(msg); + hit = showCautionAlert(cftitle, cfmsg, NULL); + if (cftitle) CFRelease(cftitle); + if (cfmsg) CFRelease(cfmsg); + return; +} +#endif +*/ void ResumeErrorDialogProc(void) { - SInt16 ret; - AlertStdAlertParamRec param = makeDefaultParam(); - StandardAlert(kAlertStopAlert, "\pCouldn't restart", NULL, ¶m, &ret); + DialogRef ret; + AlertStdCFStringAlertParamRec param; + DialogItemIndex hit; + + GetStandardAlertDefaultParams(¶m, kStdCFStringAlertVersionOne); + param.movable = true; + CreateStandardAlert(kAlertStopAlert, CFCopyLocalizedString(CFSTR("Couldn't restart"), "Resume Error Message"), + CFCopyLocalizedString(CFSTR("An error occured when reading the np2.sav file. Neko Project IIx couldn't restart."), "Resume Error Description"), + ¶m, &ret); + SysBeep(0); + RunStandardAlert(ret, NULL, &hit); } int ResumeWarningDialogProc(const char *string) { SInt16 ret; - Str255 str; - mkstr255(str, string); - ret = showCautionAlert("\pConflict", str, "\pContinue"); + ret = showCautionAlert( CFCopyLocalizedString(CFSTR("The Save Data file is conflicting"), "bad data"), + CFStringCreateWithCString(NULL, string, CFStringGetSystemEncoding()), + CFCopyLocalizedString(CFSTR("Continue"), "OK")); if (ret = kAlertStdAlertOKButton) { return(IDOK); } @@ -61,10 +72,26 @@ bool ResetWarningDialogProc(void) { SInt16 ret; if (np2oscfg.comfirm) { - ret = showCautionAlert("\pReset", NULL, "\pReset"); + ret = showCautionAlert( CFCopyLocalizedString(CFSTR("Reset"), "Reset title"), + CFCopyLocalizedString(CFSTR("Are you sure you want to reset?"), "Reset causion string"), + NULL); if (ret == kAlertStdAlertCancelButton) { return(false); } } return(true); -} \ No newline at end of file +} + +bool QuitWarningDialogProc(void) { + SInt16 ret; + + if (np2oscfg.comfirm) { + ret = showCautionAlert( CFCopyLocalizedString(CFSTR("Quit"), "Quit title"), + CFCopyLocalizedString(CFSTR("Are you sure you want to quit?"), "Quit causion string"), + NULL); + if (ret == kAlertStdAlertCancelButton) { + return(false); + } + } + return(true); +}