--- np2/macosx/dialog/macalert.cpp 2003/10/31 16:55:06 1.1 +++ np2/macosx/dialog/macalert.cpp 2003/11/21 16:01:41 1.4 @@ -11,46 +11,42 @@ #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); } 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); + 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,7 +57,23 @@ 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); +} + +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); }