added newline and support for "Don't show again" dialog boxes. Untested.

This commit is contained in:
Steve Checkoway
2003-07-15 13:35:07 +00:00
parent 3cf629dac0
commit 6930149e7f
2 changed files with 17 additions and 14 deletions
@@ -10,6 +10,7 @@
#include "global.h" #include "global.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "ArchHooks_darwin.h" #include "ArchHooks_darwin.h"
#include "RageLog.h"
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
const unsigned maxLogMessages = 10; /* Follow the windows example */ const unsigned maxLogMessages = 10; /* Follow the windows example */
@@ -34,33 +35,35 @@ void ArchHooks_darwin::MessageBoxOK(CString sMessage, CString ID) {
if (allowHush && MessageIsIgnored(ID)) if (allowHush && MessageIsIgnored(ID))
return; return;
Str255 boxName = "\pDon't show again."; CFStringRef boxName = CFStringCreateWithCString(NULL, "Don't show again", kCFStringEncodingASCII);
CFStringRef error = CFStringCreateWithCString(NULL, sMessage.c_str(), kCFStringEncodingASCII); CFStringRef error = CFStringCreateWithCString(NULL, sMessage.c_str(), kCFStringEncodingASCII);
CFStringRef OK = CFStringCreateWithCString(NULL, "OK", kCFStringEncodingASCII); CFStringRef OK = CFStringCreateWithCString(NULL, "OK", kCFStringEncodingASCII);
struct AlertStdCFStringAlertParamRec params = {kStdCFStringAlertVersionOne, true, false, OK, NULL, NULL, struct AlertStdCFStringAlertParamRec params = {kStdCFStringAlertVersionOne, true, false, OK, NULL, NULL,
kAlertStdAlertOKButton, NULL, kWindowAlertPositionParentWindowScreen, NULL}; kAlertStdAlertOKButton, NULL, kWindowAlertPositionParentWindowScreen, NULL};
DialogRef dialog; DialogRef dialog;
CreateStandardAlert(kAlertNoteAlert, error, NULL, &params, &dialog); CreateStandardAlert(kAlertNoteAlert, error, NULL, &params, &dialog);
Rect boxBounds = {20, 40, 300, 25}; /* again, whatever */
DialogItemIndex unused, index = CountDITL(dialog);
OSErr err; OSErr err;
ControlRef box;
SInt16 unused;
/*if (allowHush) { if (allowHush) {
err = InsertCheckBoxDialogItem(dialog, CountDITL(dialog), &boxBounds, true, boxName); Rect boxBounds = {20, 40, 300, 25}; /* again, whatever */
ASSERT(err == noErr); CreateCheckBoxControl(GetDialogWindow(dialog), &boxBounds, boxName, 0, true, &box);
}*/ GetBestControlRect(box, &boxBounds, &unused);
OSStatus status = InsertDialogItem(dialog, 0, kCheckBoxDialogItem, (Handle)box, &boxBounds);
ASSERT(status == noErr);
}
err = AutoSizeDialog(dialog); err = AutoSizeDialog(dialog);
ASSERT(err == noErr); ASSERT(err == noErr);
RunStandardAlert(dialog, NULL, &unused); RunStandardAlert(dialog, NULL, &unused);
/*if (allowHush) { if (allowHush && GetControl32BitValue(box)){
ControlRef box; LOG->Trace("Ignore dialog ID, \"%s\"", ID.c_str());
GetDialogItemAsControl(dialog, (SInt16)index, &box);
if (GetControl32BitValue(box))
IgnoreMessage(ID); IgnoreMessage(ID);
}*/ }
CFRelease(error); CFRelease(error);
CFRelease(OK); CFRelease(OK);
CFRelease(boxName);
} }
ArchHooks::MessageBoxResult ArchHooks_darwin::MessageBoxAbortRetryIgnore(CString sMessage, CString ID) { ArchHooks::MessageBoxResult ArchHooks_darwin::MessageBoxAbortRetryIgnore(CString sMessage, CString ID) {