Important: The information in this document is obsolete and should not be used for new development.
DoTranslateScrapA scrap translation extension must respond to the
kTranslateTranslateScraprequest 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 the
CallComponentFunctionWithStoragefunction and passing it a pointer to a function with the syntax defined by the
FUNCTION DoTranslateScrap (self: ComponentInstance; refNum: TranslationRefNum; srcDataPtr: Ptr; srcDataLength: Size; srcType: ScrapType; srcTypeHint: LongInt; dstData: Handle; dstType: ScrapType; dstTypeHint: LongInt) : ComponentResult;
- A component instance that identifies the component containing the translation extension.
- The translation reference number for this translation.
- A pointer to the scrap to be translated.
- The size of the scrap to be translated.
- The format of the scrap to be translated.
- The value in the
hintfield of the source document's scrap type specification.
- A handle to the destination to be filled in.
- The format into which to translate the source scrap.
- The value in the
hintfield of the destination document's scrap type specification.
DoTranslateScrapfunction translates a scrap from one format into another. The scrap to be translated is specified by the
srcDataLengthparameters, and your routine should put the translated data into the block specified by the
dstDataparameter. Your function should resize that block as necessary and fill it with the appropriate translated data.
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 the
SetTranslationAdvertisementfunction, you'll pass that reference number in 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 from
Your translation extension should call the
SetTranslationAdvertisementfunction to display the progress dialog box and the
UpdateTranslationProgressfunction to update the dialog box periodically.
DoTranslateScrapfunction should return
noErrif successful, or an appropriate result code otherwise.