Important: The information in this document is obsolete and should not be used for new development.
DoTranslateScrap
A scrap translation extension must respond to thekTranslateTranslateScrap
request code. The Translation Manager sends this request code to allow the extension to translate scraps from one format to another. You can handle this request by calling theCallComponentFunctionWithStorage
function and passing it a pointer to a function with the syntax defined by theDoTranslateScrap
function.
FUNCTION DoTranslateScrap (self: ComponentInstance; refNum: TranslationRefNum; srcDataPtr: Ptr; srcDataLength: Size; srcType: ScrapType; srcTypeHint: LongInt; dstData: Handle; dstType: ScrapType; dstTypeHint: LongInt) : ComponentResult;
self
- A component instance that identifies the component containing the translation extension.
refNum
- The translation reference number for this translation.
srcDataPtr
- A pointer to the scrap to be translated.
srcDataLength
- The size of the scrap to be translated.
srcType
- The format of the scrap to be translated.
srcTypeHint
- The value in the
hint
field of the source document's scrap type specification.dstData
- A handle to the destination to be filled in.
dstType
- The format into which to translate the source scrap.
dstTypeHint
- The value in the
hint
field of the destination document's scrap type specification.DESCRIPTION
TheDoTranslateScrap
function translates a scrap from one format into another. The scrap to be translated is specified by thesrcDataPtr
andsrcDataLength
parameters, and your routine should put the translated data into the block specified by thedstData
parameter. Your function should resize that block as necessary and fill it with the appropriate translated data.The
refNum
parameter is a reference number that Macintosh Easy Open assigns to the translation. Each translation is assigned a unique number to distinguish the translation from any other translations that might be occurring. You need to pass this reference number to any Macintosh Easy Open routines you call from within the scrap translation extension; for instance, if you display the progress dialog box by calling theSetTranslationAdvertisement
function, you'll pass that reference number in therefNum
parameter.The
DoTranslateScrap
function can translate the source file itself or rely upon external translators. If it cannot translate the source scrap, your function should return a result code different fromnoErr
.Your translation extension should call the
SetTranslationAdvertisement
function to display the progress dialog box and theUpdateTranslationProgress
function to update the dialog box periodically.RESULT CODES
TheDoTranslateScrap
function should returnnoErr
if successful, or an appropriate result code otherwise.