Important: The information in this document is obsolete and should not be used for new development.
DoTranslateScrap
A scrap translation extension must respond to thekTranslateTranslateScraprequest 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 theCallComponentFunctionWithStoragefunction and passing it a pointer to a function with the syntax defined by theDoTranslateScrapfunction.
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
hintfield 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
hintfield of the destination document's scrap type specification.DESCRIPTION
TheDoTranslateScrapfunction translates a scrap from one format into another. The scrap to be translated is specified by thesrcDataPtrandsrcDataLengthparameters, and your routine should put the translated data into the block specified by thedstDataparameter. Your function should resize that block as necessary and fill it with the appropriate translated data.The
refNumparameter 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 theSetTranslationAdvertisementfunction, you'll pass that reference number in therefNumparameter.The
DoTranslateScrapfunction 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
SetTranslationAdvertisementfunction to display the progress dialog box and theUpdateTranslationProgressfunction to update the dialog box periodically.RESULT CODES
TheDoTranslateScrapfunction should returnnoErrif successful, or an appropriate result code otherwise.