mirror of
https://github.com/depp/syncfiles.git
synced 2024-11-21 12:30:58 +00:00
Fix button text for alerts
It turns out that ParamText does not substitute text in buttons. To make alerts with different button text, there are now multiple alert resources.
This commit is contained in:
parent
08e5f10ce4
commit
4cf55bffbc
@ -12,12 +12,8 @@
|
|||||||
#include <TextUtils.h>
|
#include <TextUtils.h>
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
// OK
|
|
||||||
kStrOK = 1,
|
|
||||||
// Quit
|
|
||||||
kStrQuit,
|
|
||||||
// An error of type ^2 occurred.
|
// An error of type ^2 occurred.
|
||||||
kStrErrorCode,
|
kStrErrorCode = 1,
|
||||||
// Error at: ^1:^2
|
// Error at: ^1:^2
|
||||||
kStrErrorAt,
|
kStrErrorAt,
|
||||||
// Assertion: ^1
|
// Assertion: ^1
|
||||||
@ -69,13 +65,10 @@ static void AppendError2(struct PStrBuilder *str, int sep, int strNum,
|
|||||||
AppendErrorArray(str, sep, strNum, 2, params);
|
AppendErrorArray(str, sep, strNum, 2, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ShowErrorAlert(const unsigned char *message, int button)
|
static void ShowErrorAlert(const unsigned char *message, int id)
|
||||||
{
|
{
|
||||||
Str255 buttonText;
|
ParamText(message, NULL, NULL, NULL);
|
||||||
|
Alert(id, NULL);
|
||||||
GetIndString(buttonText, rSTRS_Errors, button);
|
|
||||||
ParamText(message, buttonText, NULL, NULL);
|
|
||||||
Alert(rAlrtError, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExitAssert(const unsigned char *file, int line,
|
void ExitAssert(const unsigned char *file, int line,
|
||||||
@ -91,7 +84,7 @@ void ExitAssert(const unsigned char *file, int line,
|
|||||||
if (assertion != NULL) {
|
if (assertion != NULL) {
|
||||||
AppendError1(&str, '\r', kStrAssertion, assertion);
|
AppendError1(&str, '\r', kStrAssertion, assertion);
|
||||||
}
|
}
|
||||||
ShowErrorAlert(str.data, kStrQuit);
|
ShowErrorAlert(str.data, rAlrtFatal);
|
||||||
QuitApp();
|
QuitApp();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,7 +106,7 @@ void ShowError(ErrorCode err1, ErrorCode err2, short osErr,
|
|||||||
if (str.data[0] == 0) {
|
if (str.data[0] == 0) {
|
||||||
AppendError0(&str, ' ', kStrUnknown);
|
AppendError0(&str, ' ', kStrUnknown);
|
||||||
}
|
}
|
||||||
ShowErrorAlert(str.data, kStrOK);
|
ShowErrorAlert(str.data, rAlrtError);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowMemError(void)
|
void ShowMemError(void)
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
/* ALRT Error dialog */
|
/* ALRT Error dialog */
|
||||||
#define rAlrtError 128
|
#define rAlrtError 128
|
||||||
|
#define rAlrtFatal 129
|
||||||
|
|
||||||
/* CNTL Controls */
|
/* CNTL Controls */
|
||||||
#define rCNTL_ChooseFolder 128
|
#define rCNTL_ChooseFolder 128
|
||||||
|
@ -18,12 +18,24 @@ resource 'ALRT' (rAlrtError, purgeable) {
|
|||||||
centerMainScreen
|
centerMainScreen
|
||||||
};
|
};
|
||||||
|
|
||||||
|
resource 'ALRT' (rAlrtFatal, purgeable) {
|
||||||
|
{ 40, 40, 141, 360 },
|
||||||
|
129, /* DITL ID */
|
||||||
|
{
|
||||||
|
OK, visible, sound1,
|
||||||
|
OK, visible, sound1,
|
||||||
|
OK, visible, sound1,
|
||||||
|
OK, visible, sound1,
|
||||||
|
},
|
||||||
|
centerMainScreen
|
||||||
|
};
|
||||||
|
|
||||||
/* See Macintosh Human Interface Guidelines (1992) p. 197 "Basic Dialog Box Layout" */
|
/* See Macintosh Human Interface Guidelines (1992) p. 197 "Basic Dialog Box Layout" */
|
||||||
/* Note that there are an extra 3px of margin for "free" on the dialog border. */
|
/* Note that there are an extra 3px of margin for "free" on the dialog border. */
|
||||||
resource 'DITL' (128, purgeable) {{
|
resource 'DITL' (128, purgeable) {{
|
||||||
/* Quit button: 13px margin */
|
/* Quit button: 13px margin */
|
||||||
{ 71, 240, 91, 310 },
|
{ 71, 240, 91, 310 },
|
||||||
Button { enabled, "Quit" },
|
Button { enabled, "OK" },
|
||||||
/* Error text: 13px margin, 3 lines @ 16px line height */
|
/* Error text: 13px margin, 3 lines @ 16px line height */
|
||||||
{ 10, 75, 58, 310 },
|
{ 10, 75, 58, 310 },
|
||||||
StaticText { enabled, "^0" },
|
StaticText { enabled, "^0" },
|
||||||
@ -32,6 +44,15 @@ resource 'DITL' (128, purgeable) {{
|
|||||||
Icon { enabled, 0 },
|
Icon { enabled, 0 },
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
resource 'DITL' (129, purgeable) {{
|
||||||
|
{ 71, 240, 91, 310 },
|
||||||
|
Button { enabled, "Quit" },
|
||||||
|
{ 10, 75, 58, 310 },
|
||||||
|
StaticText { enabled, "^0" },
|
||||||
|
{ 10, 20, 42, 52 },
|
||||||
|
Icon { enabled, 0 },
|
||||||
|
}};
|
||||||
|
|
||||||
resource 'DLOG' (rDLOG_OpenFolder, purgeable) {
|
resource 'DLOG' (rDLOG_OpenFolder, purgeable) {
|
||||||
/* Height += 31 */
|
/* Height += 31 */
|
||||||
{0, 0, 197, 344},
|
{0, 0, 197, 344},
|
||||||
@ -39,13 +60,13 @@ resource 'DLOG' (rDLOG_OpenFolder, purgeable) {
|
|||||||
invisible,
|
invisible,
|
||||||
noGoAway,
|
noGoAway,
|
||||||
0,
|
0,
|
||||||
129,
|
130,
|
||||||
"",
|
"",
|
||||||
noAutoCenter,
|
noAutoCenter,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Open Folder, based on system -6042 */
|
/* Open Folder, based on system -6042 */
|
||||||
resource 'DITL' (129, purgeable) {{
|
resource 'DITL' (130, purgeable) {{
|
||||||
/* Standard file (do not change, see IM: Files 3-18) */
|
/* Standard file (do not change, see IM: Files 3-18) */
|
||||||
{135, 252, 155, 332},
|
{135, 252, 155, 332},
|
||||||
Button {enabled, "Open"},
|
Button {enabled, "Open"},
|
||||||
@ -119,8 +140,6 @@ resource 'BNDL' (128, purgeable) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
resource 'STR#' (rSTRS_Errors) {{
|
resource 'STR#' (rSTRS_Errors) {{
|
||||||
"OK",
|
|
||||||
"Quit",
|
|
||||||
"An error of type ^2 occurred.",
|
"An error of type ^2 occurred.",
|
||||||
"Error at: ^1:^2",
|
"Error at: ^1:^2",
|
||||||
"Assertion: ^1",
|
"Assertion: ^1",
|
||||||
|
Loading…
Reference in New Issue
Block a user