File: MacAE.c

package info (click to toggle)
audacity 2.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 86,844 kB
  • sloc: ansic: 225,005; cpp: 221,240; sh: 27,327; python: 16,896; makefile: 8,186; lisp: 8,002; perl: 317; xml: 307; sed: 16
file content (58 lines) | stat: -rw-r--r-- 1,783 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* Handle required apple events -EAD */

#include <Files.h>
#include <string.h>
#include <AppleEvents.h>
#include "macstuff.h"
#include "MacCommandWin.h"
#include "MacFileUtils.h"
//#include "MiscellaneousUtilities.h"

#define TEXTREC		(*hTERec)	// the command 
extern TEHandle hTERec;			// window text record 


//=========================================================================
// Handle quit apple event
//=========================================================================

pascal OSErr AEQuit (AppleEvent *theAppleEvent, AppleEvent *theReply, long Refcon)
{
    osfinish();
}

//=========================================================================
// Handle Open Document apple event by trying to load it.
//=========================================================================
extern xlload (char *, int, int);
extern xlabort(char *);

pascal OSErr AEOpenFiles(AppleEvent *theAppleEvent, AppleEvent *theReply,
                         long Refcon)
{
    AEDescList docList;
    AEKeyword keywd;
    DescType returnedType;
    Size actualSize;
    long itemsInList;
    FSSpec theSpec;
    CInfoPBRec pb;
    Str255 name;
    short i;
    
    if (AEGetParamDesc(theAppleEvent, keyDirectObject, typeAEList, &docList) !=
        noErr) return;
    if (AECountItems (&docList, &itemsInList) != noErr) return;
    
    SetSelection (TEXTREC->teLength, TEXTREC->teLength);
    for (i = 1; i <= itemsInList; i++) {
        AEGetNthPtr (&docList, i, typeFSS, &keywd, &returnedType, 
            (Ptr) &theSpec, sizeof(theSpec), &actualSize);
        
        GetFullPath(&theSpec, name);
        P2CStr(name); // was: pstrterm(name);
        if (xlload ((char *)name + 1, 1, 0) == 0) xlabort ("load error");
    }
    macputs ("> ");
    PrepareForInput ();
}