Handle open document Apple Event

Double-clicking on a project in the Finder will now open that project.
This commit is contained in:
Dietrich Epp 2023-05-07 21:46:55 -04:00
parent 1396fb1cbf
commit 59e3376f8c

View File

@ -301,10 +301,40 @@ static pascal OSErr HandleOpenApplication(const AppleEvent *event,
static pascal OSErr HandleOpenDocuments(const AppleEvent *event, static pascal OSErr HandleOpenDocuments(const AppleEvent *event,
AppleEvent *reply, unsigned long refCon) AppleEvent *reply, unsigned long refCon)
{ {
(void)event; OSErr err;
AEDescList docList;
long count, i;
FSSpec file;
Size size;
AEKeyword keyword;
DescType type;
(void)reply; (void)reply;
(void)refCon; (void)refCon;
return 0; err = AEGetParamDesc(event, keyDirectObject, typeAEList, &docList);
if (err != 0) {
return err;
}
err = CheckRequiredParams(event);
if (err != 0) {
goto done;
}
err = AECountItems(&docList, &count);
if (err != 0) {
goto done;
}
for (i = 1; i <= count; i++) {
err = AEGetNthPtr(&docList, i, typeFSS, &keyword, &type, &file,
sizeof(file), &size);
if (err != 0) {
goto done;
}
ProjectOpen(&file, smSystemScript);
}
done:
AEDisposeDesc(&docList);
return err;
} }
static pascal OSErr HandlePrintDocuments(const AppleEvent *event, static pascal OSErr HandlePrintDocuments(const AppleEvent *event,