home *** CD-ROM | disk | FTP | other *** search
- /* File: ScriptScrap.h */
-
- /* ========================== Window & Menu Constants ============================= */
-
- #define kAppleMenu 1001
- enum {
- cAbout = 1
- };
-
- #define kFileMenu 1002
- enum {
- cNew = 1,
- cOpen,
- cClose,
- /* --- */
- cQuit = 5
- };
-
- #define kEditMenu 1003
-
- /* Constants for windows and dialogs */
- #define kDisplayWindow 1001
- #define kAboutDialog 1001
-
- /* ========================== Window Information ============================= */
-
- /* Each window has a copy of the following structure (stored in a relocatable block) */
- /* attached through the window's refCon. It contains basic information used to keep */
- /* the window's display current. */
-
- typedef struct {
- FSSpec fileSpec; /* The FSSpec for our file */
- short fRefNum; /* 0 if the file's not open, otherwise the refNum */
- /* of the resource fork */
- ControlHandle selectionBar; /* the scroll bar which determines which item is */
- /* displayed */
- short numEntries, /* How many entries do we have? */
- currEntryNum; /* Which entry is being displayed? */
- ResType currEntryType; /* What type should we use for the display? */
- Rect drawingArea; /* This is where the image is drawn */
- Rect statusArea; /* The area at the bottom which lists the number */
- /* and types of items in this entry */
- } WindowInfo, *wiPtr, **wiHand;
-
-
- /* ========================== Error Checking ============================= */
-
- /* One of these values will be returned by the pointer and handle checking functions. */
- enum {kPointerOK = 0,
- kPointerNULL,
- kPointerOdd
- };
-
- /* If you pass in "kIsFatal" as an option to the error checking code, the code will */
- /* call ExitToShell() after reporting the error. */
- #ifndef kIsFatal
- #define kIsFatal true
- #define kNonFatal false
- #endif
-
- /* ========================== Apple Event Object Classes ============================= */
-
- /* Constants for the 2 new classes defined by this application */
- #define cEntry 'NTRY'
- #define cScrapItem 'ITEM'
-
- /* ========================== Tokens ============================= */
-
- /* Token type flags */
- #define kObjectToken 0x0001
- #define kPropToken 0x0002
-
-
- /* As mentioned in the article, you can combine multiple token definitions into one */
- /* or more larger tokens. We've done that with the 5 object classes in our hierarchy */
- /* (application, document/window, entry, and item) and have come up with the structure */
- /* below. */
- struct ourToken {
- DescType dispatchClass; /* If this token represents an object, then this */
- /* is the object's class. If this token represents */
- /* a property, then this is the class of the object */
- /* containing the property. */
- short flags; /* A set of bit flags, defined above */
- long objectIndex; /* Our position within the container */
- DescType propertyCode; /* If the user wants a property, this tells which one */
- WindowPtr docWindow; /* The window containing this document (if any) */
- FSSpec fileSpec;
- short fRefNum; /* If this is a document (or some element of a document), here's the refNum */
- short resID; /* If this is an item, what is the resource ID number? */
- ResType itemType; /* What type of item should we get from the entry */
- };
-
- typedef struct ourToken ourToken, *tokenPtr, **tokenHand;
-
- /* The following definitions make it easier to get at the fields of our token */
- #define tokenDispatchClass(tokenDesc) ((**(tokenHand)((tokenDesc).dataHandle)).dispatchClass)
- #define tokenFlags(tokenDesc) (**(tokenHand)((tokenDesc).dataHandle)).flags
- #define tokenObjectIndex(tokenDesc) (**(tokenHand)((tokenDesc).dataHandle)).objectIndex
- #define tokenPropCode(tokenDesc) (**(tokenHand)((tokenDesc).dataHandle)).propertyCode
- #define tokenWindow(tokenDesc) (**(tokenHand)((tokenDesc).dataHandle)).docWindow
- #define tokenFileSpec(tokenDesc) (**(tokenHand)((tokenDesc).dataHandle)).fileSpec
- #define tokenFRefNum(tokenDesc) (**(tokenHand)((tokenDesc).dataHandle)).fRefNum
- #define tokenSlotNum(tokenDesc) (**(tokenHand)((tokenDesc).dataHandle)).slotNum
- #define tokenResID(tokenDesc) (**(tokenHand)((tokenDesc).dataHandle)).resID
- #define tokenItemType(tokenDesc) (**(tokenHand)((tokenDesc).dataHandle)).itemType
-
- /* ========================== Scrapbook data types ============================= */
-
- typedef unsigned char smap[256]; /* This is a "scrapbook map" -- See ScrapTools.c for more information */
- typedef smap **smapHand;
-
- /* ========================== Global variables ============================= */
-
- #ifdef __Main__
- #define global
- #else
- #define global extern
- #endif
-
- global Boolean gDone; /* quit program flag */
- global Boolean gInFront; /* Are we the frontmost application?? */
- global AEAddressDesc gSelfAddressDesc; /* Used when sending Apple events bck to this app */
-