|
|
| version 1.1, 2003/10/31 16:55:06 | version 1.2, 2003/11/06 18:27:59 |
|---|---|
| Line 11 | Line 11 |
| #include "np2.h" | #include "np2.h" |
| #include "macalert.h" | #include "macalert.h" |
| static AlertStdAlertParamRec makeDefaultParam(void) { | static SInt16 showCautionAlert(CFStringRef title, CFStringRef string, CFStringRef button) { |
| AlertStdAlertParamRec param; | DialogRef ret; |
| AlertStdCFStringAlertParamRec param; | |
| DialogItemIndex hit; | |
| GetStandardAlertDefaultParams(¶m, kStdCFStringAlertVersionOne); | |
| param.movable = true; | 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; | param.cancelButton = kAlertStdAlertCancelButton; |
| param.cancelText = param.defaultText; | |
| StandardAlert(kAlertCautionAlert, title, string, ¶m, &ret); | if (button) param.defaultText = button; |
| return(ret); | |
| CreateStandardAlert(kAlertCautionAlert, title, string, ¶m, &ret); | |
| RunStandardAlert(ret, NULL, &hit); | |
| return(hit); | |
| } | } |
| void ResumeErrorDialogProc(void) { | void ResumeErrorDialogProc(void) { |
| SInt16 ret; | DialogRef ret; |
| AlertStdAlertParamRec param = makeDefaultParam(); | AlertStdCFStringAlertParamRec param; |
| StandardAlert(kAlertStopAlert, "\pCouldn't restart", NULL, ¶m, &ret); | DialogItemIndex hit; |
| GetStandardAlertDefaultParams(¶m, kStdCFStringAlertVersionOne); | |
| CreateStandardAlert(kAlertStopAlert, CFCopyLocalizedString(CFSTR("Couldn't restart"), "Resume Error Message"), | |
| CFCopyLocalizedString(CFSTR("A resume error occured when loading the np2.sav file. So Neko Project II couldn't restart."), "Resume Error Description"), | |
| ¶m, &ret); | |
| RunStandardAlert(ret, NULL, &hit); | |
| } | } |
| int ResumeWarningDialogProc(const char *string) { | int ResumeWarningDialogProc(const char *string) { |
| SInt16 ret; | SInt16 ret; |
| Str255 str; | |
| mkstr255(str, string); | ret = showCautionAlert( CFCopyLocalizedString(CFSTR("Save Data Conflict"), "bad data"), |
| ret = showCautionAlert("\pConflict", str, "\pContinue"); | CFStringCreateWithCString(NULL, string, CFStringGetSystemEncoding()), |
| CFCopyLocalizedString(CFSTR("Continue"), "OK")); | |
| if (ret = kAlertStdAlertOKButton) { | if (ret = kAlertStdAlertOKButton) { |
| return(IDOK); | return(IDOK); |
| } | } |
| Line 61 bool ResetWarningDialogProc(void) { | Line 55 bool ResetWarningDialogProc(void) { |
| SInt16 ret; | SInt16 ret; |
| if (np2oscfg.comfirm) { | 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) { | if (ret == kAlertStdAlertCancelButton) { |
| return(false); | return(false); |
| } | } |