home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-02-22 | 2.8 KB | 94 lines | [TEXT/KAHL] |
- // File "aevents.c" - Basic High Level Event Processing
- // This source file is Copyright Matt Slot & Slot-Machines Ltd., © 1993
-
- #include "aevents.h"
- #include "main.h"
-
- // ***********************************************************************************
-
- extern GlobalsRec glob;
-
- // ***********************************************************************************
- // ***********************************************************************************
-
- pascal short AEHandlerOAPP(AppleEvent *event, AppleEvent *reply, long refCon) {
-
- return(0);
- }
-
- // ***********************************************************************************
- // ***********************************************************************************
-
- pascal short AEHandlerODOC(AppleEvent *event, AppleEvent *reply, long refCon) {
- short errorCold, i;
- long count;
- Str63 textBuff;
- Size returnedSize;
- DescType returnedType;
- AEKeyword returnedKeyword;
- AEDescList docList;
- FSSpec theFile;
-
- errorCold = AEGetParamDesc(event, keyDirectObject, typeAEList, &docList);
- if (errorCold) return(errorCold);
-
- errorCold = AECountItems(&docList, &count);
- for(i = 1; i <= count; i++) {
- errorCold = AEGetNthPtr(&docList, i, typeFSS, &returnedKeyword,
- &returnedType, (Ptr) &theFile, sizeof(theFile), &returnedSize);
-
- }
-
- return(0);
- }
-
- // ***********************************************************************************
- // ***********************************************************************************
-
- pascal short AEHandlerPDOC(AppleEvent *event, AppleEvent *reply, long refCon) {
-
- return(0);
- }
-
- // ***********************************************************************************
- // ***********************************************************************************
-
- pascal short AEHandlerQUIT(AppleEvent *event, AppleEvent *reply, long refCon) {
-
- glob.quitting = 1;
- return(0);
- }
-
- // ***********************************************************************************
- // ***********************************************************************************
-
- void InitHLEvents() {
- short i=0, errorCold=0;
- AEHandlers *handlerArray;
-
- handlerArray=(AEHandlers*) NewPtrClear(4 * sizeof(AEHandlers));
-
- handlerArray[0].theClass=kCoreEventClass;
- handlerArray[0].theEvent=kAEOpenApplication;
- handlerArray[0].theProc=AEHandlerOAPP;
-
- handlerArray[1].theClass=kCoreEventClass;
- handlerArray[1].theEvent=kAEOpenDocuments;
- handlerArray[1].theProc=AEHandlerODOC;
-
- handlerArray[2].theClass=kCoreEventClass;
- handlerArray[2].theEvent=kAEPrintDocuments;
- handlerArray[2].theProc=AEHandlerPDOC;
-
- handlerArray[3].theClass=kCoreEventClass;
- handlerArray[3].theEvent=kAEQuitApplication;
- handlerArray[3].theProc=AEHandlerQUIT;
-
- for(i=0; i<4; i++) errorCold=AEInstallEventHandler(handlerArray[i].theClass,
- handlerArray[i].theEvent,handlerArray[i].theProc,0,0);
-
- DisposPtr((Ptr) handlerArray);
- }
-
-
-