Foundation Editor Callback Reference

The shell callback functions are to be used for all resource access and
manipulation.  There should be no reason for your editor to make direct
Resource Manager calls, especially considering the complexity of editing
resources outside the context of their own file. Several other calls are
provided here to make your life easier.


Editor Housekeeping Callbacks

                    fAddPrivateData          $001A (26)
                    fGetEditorStatus         $0021 (33)
                    fGetKernalID             $0028 (40)
                    fGetPrivateData          $000F (15)
                    fGetWindowTitle          $001D (29)
                    fRelPrivateData          $001B (27)
                    fRequestEdit             $000E (14)
                    fResourceConverter       $0018 (24)
                    fSetPrivateData          $0010 (16)

Resource Access Callbacks

                    fAddResource             $0001  (1)
                    fCountResources          $0012 (18)
                    fDetachResource          $0005  (5)
                    fGetIndResource          $0013 (19)
                    fGetResourceAttr         $0016 (22)
                    fGetResourceName         $0008  (8)
                    fGetResourceSize         $0014 (20)
                    fLoadResource            $0003  (3)
                    fReleaseResource         $0004  (4)
                    fRemoveResource          $0002  (2)
                    fSetResourceAttr         $0017 (23)
                    fSetResourceID           $0015 (21)
                    fSetResourceName         $0009  (9)
                    fUniqueResourceID        $0011 (17)
                    fWriteResource           $0006  (6)

Special Dependency Callbacks

                    fBuildLinkHand           $000B (11)
                    fCopyResource            $0019 (25)
                    fDisposeLinkHand         $001A (28)
                    fExtendLinkHand          $000A (10)
                    fFindHostLink            $0024 (36)
                    fQueryLinkHand           $000C (12)
                    fSpecialMagic            $001E (30)

Foundation Shell Tools

                    fColorPalette            $0027 (39)
                    fGetStdTypeName          $0007  (7)
                    fLoadFileData            $000D (13)
                    fLoadScrap               $001F (31)
                    fMarquee                 $0026 (38)
                    fSaveScrap               $0020 (32)
                    fSelectorRequest         $0022 (34)
                    fSelectorMenu            $0023 (35)
                    fSpinCursor              $0025 (37)




                    Callback                  Number

                    fAddPrivateData          $001A (26)
                    fAddResource             $0001  (1)
                    fBuildLinkHand           $000B (11)
                    fColorPalette            $0027 (39)
                    fCopyResource            $0019 (25)
                    fCountResources          $0012 (18)
                    fDetachResource          $0005  (5)
                    fDisposeLinkHand         $001A (28)
                    fExtendLinkHand          $000A (10)
                    fFindHostLink            $0024 (36)
                    fGetEditorStatus         $0021 (33)
                    fGetIndResource          $0013 (19)
                    fGetKernalID             $0028 (40)
                    fGetPrivateData          $000F (15)
                    fGetResourceAttr         $0016 (22)
                    fGetResourceName         $0008  (8)
                    fGetResourceSize         $0014 (20)
                    fGetStdTypeName          $0007  (7)
                    fGetWindowTitle          $001D (29)
                    fLoadFileData            $000D (13)
                    fLoadResource            $0003  (3)
                    fLoadScrap               $001F (31)
                    fMarquee                 $0026 (38)
                    fQueryLinkHand           $000C (12)
                    fRelPrivateData          $001B (27)
                    fReleaseResource         $0004  (4)
                    fRemoveResource          $0002  (2)
                    fRequestEdit             $000E (14)
                    fResourceConverter       $0018 (24)
                    fSaveScrap               $0020 (32)
                    fSelectorRequest         $0022 (34)
                    fSelectorMenu            $0023 (35)
                    fSetPrivateData          $0010 (16)
                    fSetResourceAttr         $0017 (23)
                    fSetResourceID           $0015 (21)
                    fSetResourceName         $0009  (9)
                    fSpecialMagic            $001E (30)
                    fSpinCursor              $0025 (37)
                    fUniqueResourceID        $0011 (17)
                    fWriteResource           $0006  (6)


$001A (26)      fAddPrivateData


Description:    Initializes an editor window for subsequent dispatching in the
                Foundation environment.  The editor may assign any private data
                associated with the new window, and to set a special TaskMask
                value for use when this editor window is active. Different
                TaskMasks may be set for each window. Use fGetPrivateData to
                recall this data.


Warning:        THIS CALL MUST BE MADE BY AN EDITOR FOR EVERY MODELESS WINDOW
                THAT IT OPENS!  If your editor recieves a REM_OPEN call with
                the OpenSilent bit set, fAddPrivateData should not be called,
                since you have no window open for editing.


Parameters:    $00 pCount               word input- 7
               $02 winPtr               pointer input- window pointer of the
                                        current editor's window.
               $06 remTaskMask          long input- TaskMask for use while this
                                        window is active. To use Foundation's
                                        standard TaskMask, set this to NIL.
               $0A remSignature         word input- private signature assigned
                                        by the editor.
               $0C Data                 handle input- editor's private data
                                        handle.
               $10 groupSignature       word input- see below.
               $12 resType              word input- resource type of editor.
               $14 resID                long input- resource ID.


               groupSignature:

                  $0010 - Window is a dedicated selector.
                  $0020 - Window is, or is associated with, a dedicated editor.
                  $0040 - Window is, or is associated with, the ScriptEdit REM.
                  $0060 - Window is, or is associated with, the HexEdit REM.


Errors:        $0004     invalidPcount
               $00FD     fBadGroupError;
               $1E13     resInvalidTypeOrID;


C:             word fAddPrivateData(ParamBlockPtr)
               fPrivateDataRecPtr ParamBlockPtr;




$0001 (1)       fAddResource


Description:    Adds a resource.  You may specify the attributes of the resource
                in the special parameter.  You may also supply a pointer to a
                resource name pString (32 bytes maximum).  The handle becomes
                the property of the Resource Manager and should not be disposed
                of by the editor.


Parameters:    $00 pCount               word input- minimum = 3
               $02 resType              word input- resource type being added.
               $04 resID                long input- ID of the resource.  This
                                        value may be in use.  If so the ID
                                        will be replaced with an new ID, which
                                        is returned here.
               $08 resData              handle input- resource data handle.
               $0A special              word input- resource attributes.
               $0C resFileID            word input- resource file ID for use
                                        when adding a resource to a file other
                                        than the current file.
               $0E resName              pointer input- pointer to a pString
                                        containing a name for the resource.
                                        Set resFileID to NIL if you are naming
                                        a resource in the current file.


Errors:        $0004     invalidPcount
               $1E03     resNoConverter
               $1E04     resNoCurFile
               $1E05     resDupID
               $1E06     resNotFound
               $1E07     resFileNotFound
               $1E0E     resDiskFull
                         Memory Manager Errors
                         GS/OS Errors


C:             word fAddResource(ParamBlockPtr)
               fResDataRecPtr ParamBlockPtr;




$000B (11)      fBuildLinkHand


Description:    This call allows the editor to request the creation of a
                special link handle for use with the fQueryLinkHand call.


Parameters:    $00 pCount               word input- 4 or 8
               $02 index                word output- total number of dependents.
               $04 linkHndl             handle output- to be passed in the
                                        fQueryLinkHand parameter block.
               $08 hostType             word input- resource type of dependent
                                        owner.
               $0A HostID               long input- resource ID of dependent
                                        owner.
               $0E resType              word ignored
               $10 resID                long ignored
               $14 resChanged           word ignored
               $16 resFileID            word input- resource file ID of the
                                        owner file if other than the current
                                        file.


Errors:        $0004     invalidPcount
                         GetLink errors


C:             word fBuildLinkHand(ParamBlockPtr)
               fResLinkRecPtr ParamBlockPtr;




$0019 (25)      fCopyResource


Description:    Copies a resource within the same file, or between files.
                Resource ID conflicts are resolved.


Parameters:    $00 pCount               word input- minimum = 3
               $02 resType              word input- resource type you are
                                        copying.
               $04 resID                long input- ID of the source resource.
               $08 newID                long input- ID of the target resource.  If NIL the source ID will be used.  A unique ID will be assigned if the ID is in use.
               $0C attr                 word input- attributes assigned to the
                                        target resource.  If $FFFF, this
                                        parameter is ignored and the source
                                        attributes a assigned.
               $0E resFileID            word input- source resource file ID.
                                        If NIL the current file is used.
               $10 newFileID            word input- target resource file ID.
                                        If NIL the current file is used.
               $12 newName              pointer input- pointer to a pString
                                        containing a name for the target
                                        resource.


Errors:        $0004     invalidPcount
               $1E03     resNoConverter
               $1E04     resNoCurFile
               $1E05     resDupID
               $1E06     resNotFound
               $1E07     resFileNotFound
               $1E0E     resDiskFull
                         Memory Manager Errors
                         GS/OS Errors


C:             word fCopyResource(ParamBlockPtr)
               fResCopyRecPtr ParamBlockPtr;




$0012 (18)      fCountResources


Description:    Returns the number of resources of the specified type.


Parameters:    $00 pCount               word input- minimum = 3
               $02 resType              word input- resource type.
               $04 resID                long ignored
               $08 result               long output- count of resources.
               $0C resFileID            word input- resource file ID if other
                                        than the current file.


Errors:        $0004     invalidPcount
               $1E07     resFileNotFound


C:             word fCountResources(ParamBlockPtr)
               fResData2RecPtr ParamBlockPtr;




$0005 (5)       fDetachResource


Description:    Detaches the reference between a handle in memory and the
                resource it originated from.  The editor becomes responsible
                for disposing this handle when finished with it.


Parameters:    $00 pCount               word input- minimum = 2
               $02 resType              word input- resource type.
               $04 resID                long input- ID of the resource to be
                                        detached.
               $08 resFileID            word input- resource file ID for the
                                        file containing the resource being
                                        detached if not the current file.


Errors:        $0004     invalidPcount
               $1E06     resNotFound
               $1E07     resFileNotFound
               $1E0C     resHasChanged


C:             word fDetachResource(ParamBlockPtr)
               fResRefRecPtr ParamBlockPtr;




$001A (28)      fDisposeLinkHand


Description:    This call must be made after using a fBuildLinkHand generated
                link handle.  Do not use this call on the link handle passed in
                the REM_ACTIVATE parameter block.


Parameters:    $00 pCount               word input- 2
               $02 index                word ignored
               $04 linkHndl             handle input- returned in the
                                        fBuildLinkHand parameter block.


Errors:        $0004     invalidPcount
                         Memory Manager errors


C:             word fDisposeLinkHand(ParamBlockPtr)
               fResLinkRecPtr ParamBlockPtr;




$000A (10)      fExtendLinkHand


Description:    This call allows the editor to tell the shell about dependent
                resources.  This call should only be made within the context
                of the REM_GETLINK routine, which passes a special link handle
                used by this call.


Parameters:    $00 pCount               word input- 6
               $02 index                word reserved
               $04 linkHndl             handle input- passed in the REM_GETLINK
                                        parameter block.
               $08 hostType             word input- resource type of dependent's
                                        owner.
               $0A HostID               long input- resource ID of dependent's
                                        owner.
               $0E resType              word input- dependent resource type.
               $10 resID                long input- dependent resource ID.


Errors:        $0004     invalidPcount
                         Memory Manager Errors


C:             word fExtendLinkHand(ParamBlockPtr)
               fResLinkRecPtr ParamBlockPtr;




$0024 (36)      fFindHostLink


Description:    Returns a single entry link handle for use with fQueryLinkHand
                containing the immediate parent of the requested resource.  If
                there is no parent the parameter block index value will be null.


Parameters:    $00 pCount               word input- minimum = 6
               $02 index                word output- will be 1 or 0.
               $04 linkHndl             handle input- passed in the REM_GETLINK
                                        parameter block.
               $08 hostType             word input- resource type of dependent's
                                        owner.
               $0A HostID               long input- resource ID of dependent's
                                        owner.
               $0E resType              word input- dependent resource type.
               $10 resID                long input- dependent resource ID.
               $14 resChanged           word output- shows whether the resource
                                        is newer than the parent.
               $16 resFileID            word input- resource file ID if other
                                        than the current file.


Errors:        $0004     invalidPcount
                         Memory Manager Errors
                         Resource Manager Errors

C:             word fFindHostLink(ParamBlockPtr)
               fResLinkRecPtr ParamBlockPtr;


$0021 (33)      fGetEditorStatus


Description:    Returns the availability of an editor for the specified type.
                Also returns whether the specified resource is currently being
                edited.


Parameters:    $00 pCount               word input- minimum = 3
               $02 resType              word input- resource type.
               $04 resID                long input- resource ID.
               $08 result               long output- status (see below).
               $0C resFileID            word input- resource file ID if other
                                        than the current file.


          Values from the result parameter are:

               $xxxx0020 - dedicated editor available for this type.
               $xxxx0060 - HexEdit or ScriptEdit only available for this type.
               $0000xxxx - item not being edited.
               $0020xxxx - item being edited by a dedicated editor.
               $0040xxxx - item being edited by ScriptEdit.
               $0060xxxx - item being edited by HexEdit.


Errors:        $0004     invalidPcount


C:             word fGetEditorStatus(ParamBlockPtr)
               fResData2RecPtr ParamBlockPtr;




$0013 (19)      fGetIndResource


Description:    Returns an indexed resource ID for the specified type.


Parameters:    $00 pCount               word input- minimum = 3
               $02 resType              word input- resource type.
               $04 resID                long output- resource ID.
               $08 result               long input- index value (1 based).
               $0C resFileID            word input- resource file ID if other
                                        than the current file.


Errors:        $0004     invalidPcount
               $1E07     resFileNotFound
               $1E0A     resIndexRange


C:             word fGetIndResource(ParamBlockPtr)
               fResData2RecPtr ParamBlockPtr;




$0040 (28)      fGetKernalID


Description:    Returns Foundtion shell release level.


Parameters:    none


Returns:       A BCD word where the high byte is the major version and the
               low byte is the minor release level.  Version 1.0 returns
               $0100 (2.15 would return $0215.)  This is the only callback
               that uses the reutrn value for something other than an error.


C:             word fGetKernalID(void)




$000F (15)      fGetPrivateData


Description:    Returns editor assigned data associated with the current editor
                window.  Use fSetPrivateData to assign the data.


Parameters:    $00 pCount               word input- 2 or 4
               $02 winPtr               pointer input- window pointer of the
                                        current editor's window.
               $06 remTaskMask          long output- the current TaskMask
                                        assigned by the editor (or the shell)
                                        for this window.
               $0A remSignature         word output- private signature assigned
                                        by the editor.
               $0C Data                 handle output- editor's private data
                                        handle.


Errors:        $0004     invalidPcount


C:             word fGetPrivateData(ParamBlockPtr)
               fPrivateDataRecPtr ParamBlockPtr;




$0016 (22)      fGetResourceAttr


Description:    Returns the attributes word for a resource.


Parameters:    $00 pCount               word input- 4 or 5
               $02 resType              word input- resource type.
               $04 resID                long input- ID of the resource.
               $08 resData              long ignored
               $0A special              word output- resource attributes.
               $0C resFileID            word input- resource file ID for use
                                        to access a resource in a file other
                                        than the current file.


Errors:        $0004     invalidPcount
               $1E06     resNotFound
               $1E07     resFileNotFound


C:             word fGetResource(fResDataRecPtr ParamBlockPtr)
               fResDataRecPtr ParamBlockPtr;




$0008 (8)       fGetResourceName


Description:    Returns the name of the resource.  If no name exists, a
                zero-length pString is returned.


Parameters:    $00 pCount               word input- 3
               $02 resType              word input- resource type.
               $04 resID                long input- ID of the resource.
               $08 resName              pointer input- pointer to a 32 byte
                                        buffer to receive the name pString.


Errors:        $0004     invalidPcount
               $1E06     resNotFound


C:             word fGetResourceName(ParamBlockPtr)
               fResNameRecPtr ParamBlockPtr;




$0014 (20)      fGetResourceSize


Description:    Returns the size of a resource.


Parameters:    $00 pCount               word input- minimum = 3
               $02 resType              word input- resource type.
               $04 resID                long input- resource ID.
               $08 result               long output- resource size.
               $0C resFileID            word input- resource file ID if other
                                        than the current file.


Errors:        $0004     invalidPcount
               $1E06     resNotFound
               $1E07     resFileNotFound


C:             word fGetResourceSize(ParamBlockPtr)
               fResData2RecPtr ParamBlockPtr;




$0007 (7)       fGetStdTypeName


Description:    Returns the standard name for a resource type.  If no standard
                name exists, a Foundation substitute string is provided.


Parameters:    $00 pCount               word input- 3
               $02 resType              word input- resource type.
               $04 resID                long ignored.
               $08 resName              pointer input- pointer to a 32 byte
                                        buffer to receive the type name pString.


Errors:        $0004     invalidPcount
               $1E13     resInvalidTypeOrID


C:             word fGetStdTypeName(ParamBlockPtr)
               fResNameRecPtr ParamBlockPtr;




$001D (29)      fGetWindowTitle


Description:    Returns a standard window title string containing the type, ID,
                name (if any) and current file number for the specified
                resource.  This allows the primary editor window to appear
                consistent with other Foundation windows.  This call should
                be made whenever you get a REM_EVENT call with a task code of
                app3Evt (resname changed).


Parameters:    $00 pCount               word input- 3
               $02 resType              word input- resource type.
               $04 resID                long input- ID of the resource.
               $08 resName              pointer input- pointer to a 128 byte
                                        buffer to receive the title pString.


Errors:        $0004     invalidPcount
               $1E13     resInvalidTypeOrID


C:             word fGetWindowTitle(ParamBlockPtr)
               fResNameRecPtr ParamBlockPtr;




$000D (13)      fLoadFileData


Description:    Presents an SFGetFile2 dialog to choose a file and returns a
                handle containing the contents of that file's data fork.  You
                must supply a pointer to a new-style reply record and a
                promptRef pString. You may also supply pointers to a filterProc
                and/or a typeList record.  These structures are discussed in
                Volume 3 of the Apple IIGS Toolbox Reference, chapter 48,
                Standard File Operations Tool Set Update.


Parameters:    $00 pCount               word input- minimum = 3
               $02 fileData             handle output- handle to the file data.
               $06 sfGet2ReplyRecPtr    long input- pointer to the new-style
                                        reply record.
               $0A sfGet2PromptRefPtr   long input- pointer to the prompt
                                        pString.
               $0E sfGet2FileTypeRecPtr long input- pointer to the FileType
                                        record.
               $12 sfGet2FilterProcPtr  long input- pointer to a filter
                                        procedure.


Errors:        $0004     invalidPcount
                         Memory Manager Errors
                         GS/OS Errors


C:             word fLoadFileData(ParamBlockPtr)
               fGetFileRecPtr ParamBlockPtr;




$0003 (3)       fLoadResource


Description:    Loads a resource into memory and returns a handle to that
                location.  If you request the resource name and no name exists
                resource a zero-length pString is returned.


Parameters:    $00 pCount               word input- minimum = 3
               $02 resType              word input- resource type to load.
               $04 resID                long input- ID of the resource.  This
                                        value may be in use.  If so the ID will
                                        be replaced with an new ID, which is
                                        returned here.
               $08 resData              handle output- handle to the resource
                                        data loaded.
               $0A special              word output- resource attributes.  If
                                        $FFFF, the resource is loaded and you
                                        should detach or release when done as
                                        appropriate.  However, if this value
                                        is other than $FFFF, the resource is
                                        already active elsewhere. You should
                                        note this and You MUST NOT release or
                                        detach it- rather make a local copy
                                        before working with it.
               $0C resFileID            word input- resource file ID for use
                                        when adding a resource to a file other
                                        than the current file.
               $0E resName              pointer input- optional pointer to a 32
                                        byte buffer to receive a pString
                                        containing a name for the resource.


Errors:        $0004     invalidPcount
               $1E03     resNoConverter
               $1E06     resNotFound
               $1E07     resFileNotFound
                         Memory Manager Errors
                         GS/OS Errors


C:             word fLoadResource(ParamBlockPtr)
               fResDataRecPtr ParamBlockPtr;




$001F (31)      fLoadScrap     (Projected - not implemented in 1.0b1)

Description:    Returns either a handle containing a standard text scrap,
                picture scrap, or a Foundation dependency linkHndl scrap
                (to be defined).

Parameters:    $00 pCount          word input- 5
               $02 resType         word input- host resource type or NIL.
               $04 resID           long input- ID of the host resource or NIL.
               $08 resData         handle output- scrap handle.
               $0A special         word input- scrap type.
               $0C resFileID       word output- if the scrap type was a link handle, then this is the ID of the resource fork containing the resources found in the link handle (see fQueryLinkHand).

Errors:        $0004     invalidPcount
                         (to be defined)

C:             word fLoadScrap(ParamBlockPtr)
               fResDataRecPtr ParamBlockPtr;




$0026 (38)      fMarquee


$000C (12)      fQueryLinkHand


Description:    This call provides the editor with total dependent resource
                information, such as type and ID as well as an indication that
                the dependent resource has or has not been modified since the
                last time the owner received an activate event.  This call uses
                the special link handle provided in the REM_ACTIVATE parameter
                block or generated with the fBuildLinkHand call.  Each time this
                call is made the information about a single dependent and its
                owner is returned, the index is incremented for the next call.
                This call must be executed repeatedly to provide the complete
                dependency structure.  Check for error $00FE (fLinkExhausted) to
                determine when the structure is complete.  If the list handle
                was created with fBuildLink, you must call fDisposeLinkHand
                when finished.


Parameters:    $00 pCount               word input- minimum = 6
               $02 index                word input- initially set to 0.
               $04 linkHndl             handle input- from the REM_ACTIVATE or
                                        fBuildLink parameter blocks.
               $08 hostType             word output- owner resource type.
               $0A HostID               long output- owner resource ID.
               $0E resType              word output- dependent resource type.
               $10 resID                long output- dependent resource ID.
               $14 resChanged           word output- non-zero if dependent
                                        changed since caller's last activate
                                        event.
               $16 resFileID            word input- resource file ID of the
                                        owner file if other than the current
                                        file.


Errors:        $0004     invalidPcount
               $00FF     fBadLinkIndex
               $00FE     fLinkExhausted


C:             word fQueryLinkHand(ParamBlockPtr)
               fResLinkRecPtr ParamBlockPtr;




$0004 (4)       fReleaseResource


Description:    Sets the purge level of the memory used by a resource.


Parameters:    $00 pCount               word input- minimum = 2
               $02 resType              word input- resource type.
               $04 resID                long input- ID of the resource to be
                                        released.
               $08 resFileID            word input- resource file ID for
                                        releasing a resource from a file other
                                        than the current file.


Errors:        $0004     invalidPcount
               $1E06     resNotFound
               $1E0C     resHasChanged


C:             word fReleaseResource(ParamBlockPtr)
               fResRefRecPtr ParamBlockPtr;




$001B (27)      fRelPrivateData


Description:    Releases the private data structure associated with an editor
                window.  You must call this prior to closing the window.
                Additionally, if you placed a handle in the structure during
                the fAddPrivateData or fSetPrivateData calls you must dispose
                of that handle prior to making this call.

                The editor writer is responsible for releasing any data in the
                private data's Data Handle.


Parameters:    $00 pCount               word input- 1
               $02 winPtr               pointer input- window pointer of the
                                        current editor's window.


Errors:        $0004     invalidPcount
               $00FD     fBadGroupError;


C:             word fRelPrivateData(ParamBlockPtr)
               fPrivateDataRecPtr ParamBlockPtr;




$0002 (2)       fRemoveResource


Description:    Deletes a resource.  Any memory used by that resource is
                released.


Parameters:    $00 pCount               word input- minimum = 2
               $02 resType              word input- resource type.
               $04 resID                long input- ID of the resource to be
                                        removed.
               $08 resFileID            word input- resource file ID for
                                        removing a resource from a file other
                                        than the current file.


Errors:        $0004     invalidPcount
               $1E06     resNotFound
               $1E07     resFileNotFound
               $1E0E     resDiskFull
                         Memory Manager Errors


C:             word fRemoveResource(ParamBlockPtr)
               fResRefRecPtr ParamBlockPtr;




$000E (14)      fRequestEdit


Description:    Allows an editor to issue an Open call to another editor to
                allow creating or editing of dependent resources by a more
                appropriate editor.   This call simply causes Foundation to call
                the REM_OPEN function of the target editor.  The target will
                create or load the requested resource.  As discussed in the
                Editor Reference section on REM_OPEN, there are four possible
                editing scenarios which may be initiated by this call.

                    o  An existing resource needs to be edited.

                    o  A new item is created from scratch.

                    o  A new item is created with default data provided by the
                       parameter block used by this call.

                    o  A new item is created, but the editor simply makes it
                       and returns without opening an editor window.

                This call will return immediately upon completion of the target
                editor's REM_OPEN call with a resource opened or created as
                requested.  However, due to the non-modal nature of Foundation,
                no editing activity will have occurred.  Your editor will get
                a deactivate event next as the target editor's window opens.
                The only exception is the last case above (OpenSilent), in which
                the target editor's entire operation is accomplished without
                actually opening an editor window.

                We strongly encourage you to have your editor call
                fGetEditorStatus to determine what type of editor will work
                with your data and to determine if the resource is currently
                being edited by another editor.


Parameters:    $00 pCount               word input- 2, 3 or 4
               $02 resType              word input- resource type to edit.
               $04 resID                long input- ID of the resource.  This
                                        value may be NIL.  If so, the resource
                                        will be created and its ID will be
                                        returned here.
               $08 resData              handle input- default data handle. If
                                        NIL, the target editor should provide
                                        its default data.
               $0A special              word input- edit request specification
                                        (see below).


                Bit values for the special parameter are:

                    bits 15-13     reserved
                    bit 12         use ScriptEdit REM
                    bit 11         use HexEdit REM
                    bit 10         reserved
                    bit 9          resData provides resource data
                    bit 8          create resource without opening window
                    bits 7-0       reserved


Errors:        $0004     invalidPcount
                         REM_OPEN errors


C:             word fRequestEdit(ParamBlockPtr)
               fResDataRecPtr ParamBlockPtr;




$0018 (24)      fResourceConverter


Description:    Installs or removes a converter routine from either  the
                application or system converter list. It should be called in
                your editor's REM_STARTUP and REM_SHUTDOWN if your resource
                type requires a converter.  Refer to Volume 3 of the Apple IIGS
                Toolbox Reference, chapter 45, Resource Manager (page 45-21)
                for information on this call's usage.


Parameters:    $00 pCount               word input- 3
               $02 resType              word input- resource type.
               $04 converterProc        long input- pointer to converter
                                        routine.
               $08 logFlags             word input- flag governing action and
                                        list to access.


Errors:        $0004     invalidPcount
               $1E0D     resDiffConverter


C:             word fResourceConverter(ParamBlockPtr)
               fResConverterrEcpTr ParamBlockPtr;




$0020 (32)      fSaveScrap     (Projected - not implemented in 1.0b1)


Description:    Either stores a handle containing a standard text or picture
                scrap, or builds a Foundation dependency linkHndl scrap and
                stores it (to be defined).

Parameters:    $00 pCount               word input- 4
               $02 resType              word input- host resource type or NIL.
               $04 resID                long input- ID of the host resource or
                                        NIL.
               $08 resData              handle input- scrap or NIL.
               $0A special              word input- scrap type.

Errors:        $0004     invalidPcount
                         (to be defined)

C:             word fSaveScrap(ParamBlockPtr)
               fResDataRecPtr ParamBlockPtr;




$0023 (35)      fSelectorMenu


Description:    Allows a selector to install a menu in the Foundation MenuBar
                containing, at minimum the seven standard selector functions:
                Edit Item, Edit Using ScriptEdit, Edit Using HexEdit,
                Item Attributes, Delete Item, Export Item, Find Parent, Find
                Dependents.  This call should be used to provide consistent
                operation to the user.  This call has no effect if not issued
                by a selector.


Parameters:    $00 pCount               word input- 5
               $02 resType              word input- resource type referenced
                                        by selector.
               $04 resID                long input- ID of the menu resource.
               $08 resData              long ignored
               $0A special              word input- non-zero indicates count
                                        of additional rMenuItem resources
                                        referenced by array contained in
                                        resType/ID.
               $0C resFileID            word input- resource file ID of the REM
                                        file containing the REM and its Menu.


Errors:        $0004     invalidPcount
                         REM_OPEN errors
                         Resource Manager Errors
                         Memory Manager Errors
                         Menu Manager Errors



$0022 (34)      fSelectorRequest


Description:    Allows a selector to call the seven standard selector
                functions: Edit Item, Edit Using ScriptEdit, Edit Using HexEdit,
                Item Attributes, Delete Item, Export Item, Find Parent and Find
                Dependents.  While all except Item Attributes, Export Item,
                Find Parent and Find Dependents could be handled through other
                callbacks, this call should be used to provide consistent
                operation to the user.  This call has no effect if not issued
                by a selector.


Parameters:    $00 pCount               word input- 4
               $02 resType              word input- resource type to be worked
                                        upon.
               $04 resID                long input- ID of the resource to be
                                        worked upon.
               $08 resData              long ignored
               $0A special              word input- selector function.


               Selector Functions:

                    $0000 - Edit Item:  calls a dedicated editor with the
                            specified resource.  If there is no editor for the
                            type specified, the ScriptEdit REM will let the
                            user choose a script or the HexEdit REM.
                    $0001 - Edit Using ScriptEdit:  calls the ScriptEdit REM.
                    $0002 - Edit Using HexEdit:  calls the HexEdit REM.
                    $0003 - Edit Attributes:  opens the Edit Attributes window.
                    $0004 - Delete Item:  removes the specified resource from
                            the current file, allowing optional deletion of that
                            resource's dependents.
                    $0005 - Export Item:  allows the specified resource to be
                            written as an external file.  The resource data is
                            placed in that file's data fork.
                    $0006-  Find Parent: displays a window showing the parent
                            of the specified resource.
                    $0007-  Find Dependents: displays a window showing any
                            resources used by the specified resource.

                    Note that fSelectorMenu returns the above items with IDs
                    in the range $2F0 - $2F7 sequentially to the editor. These
                    values need not be converted to the above range.


Errors:        $0004     invalidPcount
                         REM_OPEN errors
                         Resource Manager Errors
                         Memory Manager Errors
                         GS/OS Errors


C:             word fSelectorRequest(fResDataRecPtr ParamBlockPtr)
               fResDataRecPtr ParamBlockPtr;




$0010 (16)      fSetPrivateData


Description:    Assigns data associated with the current editor window, and
                allows you to set a special TaskMask value for use when this
                editor window is active. An editor may set different TaskMasks
                for each window they use.  Use fGetPrivateData to recall this
                data.



Parameters:    $00 pCount               word input- 2 or 4
               $02 winPtr               pointer input- window pointer of the
                                        current editor's window.
               $06 remTaskMask          long input- TaskMask for use while this
                                        window is active. To retain the current
                                        mask, set this to $FFFFFFFF.  To use
                                        Foundation's standard TaskMask, set
                                        this to NIL.
               $0A remSignature         word input- private signature assigned
                                        by the editor.
               $0C Data                 handle input- editor's private data
                                        handle.


Errors:        $0004     invalidPcount


C:             word fSetPrivateData(ParamBlockPtr)
               fPrivateDataRecPtr ParamBlockPtr;




$0017 (23)      fSetResourceAttr


Description:    Sets the attributes word for a resource.


Parameters:    $00 pCount               word input- 4 or 5
               $02 resType              word input- resource type.
               $04 resID                long input- ID of the resource.
               $08 resData              long ignored
               $0A special              word input- resource attributes.
               $0C resFileID            word input- resource file ID for use
                                        to access a resource in a file other
                                        than the current file.


Errors:        $0004     invalidPcount
               $1E06     resNotFound
               $1E07     resFileNotFound

C:             word fGetResource(fResDataRecPtr ParamBlockPtr)
               fResDataRecPtr ParamBlockPtr;




$0015 (21)      fSetResourceID


Description:    Changes the ID of a resource.  If the new resource ID is already
                in use, error $1E05 (resDupID) is returned and the ID remains
                unchanged.


Warning:        If the resource is a dependent of another resource, this call
                can have catastrophic effects unless you resolve the reference
                in the host.


Parameters:    $00 pCount          word input- minimum = 3
               $02 resType         word input- resource type.
               $04 resID           long input- resource ID.
               $08 result          long output- new resource ID.
               $0C resFileID       word input- resource file ID if other than the current file.


Errors:        $0004     invalidPcount
               $1E05     resDupID
               $1E06     resNotFound
               $1E07     resFileNotFound


C:             word fGetResourceSize(ParamBlockPtr)
               fResData2RecPtr ParamBlockPtr;




$0009 (9)       fSetResourceName


Description:    Assigns a name to a resource.  To delete an existing name,
                provide a zero-length pString.


Parameters:    $00 pCount          word input- 3
               $02 resType         word input- resource type.
               $04 resID           long input- ID of the resource.
               $08 resName         pointer input- pointer to a 32 byte buffer containing the name pString.


Errors:        $0004     invalidPcount


C:             word fSetResourceName(ParamBlockPtr)
               fResNameRecPtr ParamBlockPtr;




$001E (30)      fSpecialMagic

Description:    fSpecialMagic performs four operations:

                o   Loads the specified resource returning a detached handle to
                    that resource.  If that resource contains any dependent
                    resources, they are loaded, and references to them are
                    converted from "by resource" to "by handle", the dependent
                    ID references are replaced with the loaded dependents
                    handles.  This call will load the entire structure,
                    including items referenced by referenced items, etc.  This
                    call was designed to allow editors to use their own
                    resources in ToolBox calls.

               o    Locks the resource handle and all associated dependent
                    handles.

               o    Unlocks the resource handle and all associated dependent
                    handles.

               o    Disposes of the resource handle and all associated
                    dependent handles.

               This call will work with all resource types. However, resource
               dependency resolution is limited to the following:

                         $8003     rControlList
                         $8004     rControlTemplate (see below)
                         $8008     rMenuBar
                         $8009     rMenu
                         $800A     rMenuItem
                         $800E     rWindParam1
                         $8028     rItemStruct

               This call will not bring in the complete structure of List
               controls (not possible to resolve reference to the rListRef
               referenced pStrings to a Handle), TextEdit controls containing
               a rStyleBlock, and, of course, custom control templates.

Parameters:    $00 pCount               word input- 5
               $02 resType              word input- resource type.
               $04 resID                long input- ID of the resource.
               $08 resData              handle output- handle of resource data.
               $0A special              word input- the action that this call
                                        is to perform (see below).
               $0C resFileID            word input- resource file ID for use
                                        when referencing a resource in a file
                                        other than the current file.


               Values for the special parameter are:

                    $0000 - load/convert to data handles
                    $0001 - lock all data
                    $0002 - unlock all data
                    $0003 - dispose of all data


Errors:        $0004     invalidPcount
               $1E03     resNoConverter
               $1E06     resNotFound
               $1E07     resFileNotFound
                         Memory Manager Errors
                         GS/OS Errors

C:             word fspEcialmaGic(ParamBlockPtr)
               fResDataRecPtr ParamBlockPtr;




$0025 (37)      fSpinCursor

Description:    fSpinCursor causes the Foundation "Rotating Moon" cursor to be
                shown and rotated.  To use it for the first time, simply call
                it.  Then, place calls to fSpinCursor in your code as
                appropriate to rotate the moon through its various phases.
                To restore the cursor to its previous state, call either
                InitCursor or SetCursor to a custom cursor as appropriate.

                fSpinCursor is designed to provide user feedback that your
                editor is actually still functioning though little or no other
                activity is apparent due to the time needed to perform lengthy
                operations.  We recommend utilizing it whenever you have a
                function that takes more than 3 - 4 seconds in real time.

                fSpinCursor is the only callback that does not use a parameter
                block.

Parameters:    None


Errors:        None


C:             word fSpinCursor(void)



$0006 (6)       fWriteResource


Description:    Writes the resource back to disk.  Note that you can not cause
                a resource to be written to a different file by specifying the
                resFileID parameter.  This parameter is only for setting the
                correct resource fork if the resource does not belong to the
                current file.


Parameters:    $00 pCount               word input- minimum = 2
               $02 resType              word input- resource type.
               $04 resID                long input- ID of the resource to be
                                        written.
               $08 resFileID            word input- resource file ID of the
                                        owner file if other than the current
                                        file.


Errors:        $0004     invalidPcount
               $1E03     resNoConverter
               $1E06     resNotFound
               $1E07     resFileNotFound
               $1E0E     resDiskFull
                         GS/OS Errors


C:             word fWriteResource(ParamBlockPtr)
               fResRefRecPtr ParamBlockPtr;




$0011 (17)      fUniqueResourceID


Description:    Returns a unique resource ID for the specified type.


Parameters:    $00 pCount               word input- minimum = 2
               $02 resType              word input- resource type.
               $04 resID                long output- new resource ID
               $08 resFileID            word input- resource file ID if other
                                        than the current file.


Errors:        $0004     invalidPcount
               $1E04     resNoCurFile
               $1E07     resFileNotFound
               $1E09     resNoUniqueID


C:             word fUniqueResource(ParamBlockPtr)
               fResRefRecPtr ParamBlockPtr;
