TranslationExtensions.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:8k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       TranslationExtensions.h
  3.  
  4.      Contains:   Macintosh Easy Open Translation Extension Interfaces.
  5.  
  6.      Version:    Technology: Macintosh Easy Open 1.1
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1989-2001 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __TRANSLATIONEXTENSIONS__
  18. #define __TRANSLATIONEXTENSIONS__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #ifndef __FILES__
  23. #include "Files.h"
  24. #endif
  25. #ifndef __QUICKDRAW__
  26. #include "Quickdraw.h"
  27. #endif
  28. #ifndef __COMPONENTS__
  29. #include "Components.h"
  30. #endif
  31. #if PRAGMA_ONCE
  32. #pragma once
  33. #endif
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37. #if PRAGMA_IMPORT
  38. #pragma import on
  39. #endif
  40. #if PRAGMA_STRUCT_ALIGN
  41.     #pragma options align=mac68k
  42. #elif PRAGMA_STRUCT_PACKPUSH
  43.     #pragma pack(push, 2)
  44. #elif PRAGMA_STRUCT_PACK
  45.     #pragma pack(2)
  46. #endif
  47. enum {
  48.     kSupportsFileTranslation    = 1,
  49.     kSupportsScrapTranslation   = 2,
  50.     kTranslatorCanGenerateFilename = 4
  51. };
  52. /* better names for 4-char codes*/
  53. typedef OSType                          FileType;
  54. typedef ResType                         ScrapType;
  55. typedef unsigned long                   TranslationAttributes;
  56. enum {
  57.     taDstDocNeedsResourceFork   = 1,
  58.     taDstIsAppTranslation       = 2
  59. };
  60. struct FileTypeSpec {
  61.     FileType                        format;
  62.     long                            hint;
  63.     TranslationAttributes           flags;                      /* taDstDocNeedsResourceFork, taDstIsAppTranslation*/
  64.     OSType                          catInfoType;
  65.     OSType                          catInfoCreator;
  66. };
  67. typedef struct FileTypeSpec             FileTypeSpec;
  68. struct FileTranslationList {
  69.     unsigned long                   modDate;
  70.     unsigned long                   groupCount;
  71.                                                                 /*    unsigned long group1SrcCount;*/
  72.                                                                 /*    unsigned long group1SrcEntrySize = sizeof(FileTypeSpec);*/
  73.                                                                 /*  FileTypeSpec  group1SrcTypes[group1SrcCount]*/
  74.                                                                 /*  unsigned long group1DstCount;*/
  75.                                                                 /*  unsigned long group1DstEntrySize = sizeof(FileTypeSpec);*/
  76.                                                                 /*  FileTypeSpec  group1DstTypes[group1DstCount]*/
  77. };
  78. typedef struct FileTranslationList      FileTranslationList;
  79. typedef FileTranslationList *           FileTranslationListPtr;
  80. typedef FileTranslationListPtr *        FileTranslationListHandle;
  81. struct ScrapTypeSpec {
  82.     ScrapType                       format;
  83.     long                            hint;
  84. };
  85. typedef struct ScrapTypeSpec            ScrapTypeSpec;
  86. struct ScrapTranslationList {
  87.     unsigned long                   modDate;
  88.     unsigned long                   groupCount;
  89.                                                                 /*    unsigned long     group1SrcCount;*/
  90.                                                                 /*    unsigned long     group1SrcEntrySize = sizeof(ScrapTypeSpec);*/
  91.                                                                 /*  ScrapTypeSpec     group1SrcTypes[group1SrcCount]*/
  92.                                                                 /*  unsigned long     group1DstCount;*/
  93.                                                                 /*    unsigned long     group1DstEntrySize = sizeof(ScrapTypeSpec);*/
  94.                                                                 /*  ScrapTypeSpec     group1DstTypes[group1DstCount]*/
  95. };
  96. typedef struct ScrapTranslationList     ScrapTranslationList;
  97. typedef ScrapTranslationList *          ScrapTranslationListPtr;
  98. typedef ScrapTranslationListPtr *       ScrapTranslationListHandle;
  99. /* definition of callbacks to update progress dialog*/
  100. typedef long                            TranslationRefNum;
  101. /*****************************************************************************************
  102. *
  103. * This routine sets the advertisement in the top half of the progress dialog.
  104. * It is called once at the beginning of your DoTranslateFile routine.
  105. *
  106. * Enter:    refNum          Translation reference supplied to DoTranslateFile.
  107. *           advertisement   A handle to the picture to display.  This must be non-purgable.
  108. *                           Before returning from DoTranslateFile, you should dispose
  109. *                           of the memory.  (Normally, it is in the temp translation heap
  110. *                           so it is cleaned up for you.)
  111. *
  112. * Exit: returns         noErr, paramErr, or memFullErr
  113. */
  114. EXTERN_API( OSErr )
  115. SetTranslationAdvertisement     (TranslationRefNum      refNum,
  116.                                  PicHandle              advertisement)                      TWOWORDINLINE(0x7002, 0xABFC);
  117. /*****************************************************************************************
  118. *
  119. * This routine updates the progress bar in the progress dialog.
  120. * It is called repeatedly from within your DoTranslateFile routine.
  121. * It should be called often, so that the user will get feedback if he tries to cancel.
  122. *
  123. * Enter:    refNum      translation reference supplied to DoTranslateFile.
  124. *           progress    percent complete (0-100)
  125. *
  126. * Exit:     canceled    TRUE if the user clicked the Cancel button, FALSE otherwise
  127. *           returns     noErr, paramErr, or memFullErr
  128. */
  129. EXTERN_API( OSErr )
  130. UpdateTranslationProgress       (TranslationRefNum      refNum,
  131.                                  short                  percentDone,
  132.                                  Boolean *              canceled)                           TWOWORDINLINE(0x7001, 0xABFC);
  133. /* ComponentMgr selectors for routines*/
  134. enum {
  135.     kTranslateGetFileTranslationList = 0,                       /* component selectors*/
  136.     kTranslateIdentifyFile      = 1,
  137.     kTranslateTranslateFile     = 2,
  138.     kTranslateGetTranslatedFilename = 3,
  139.     kTranslateGetScrapTranslationList = 10,                     /* skip to scrap routines*/
  140.     kTranslateIdentifyScrap     = 11,
  141.     kTranslateTranslateScrap    = 12,
  142.     kTranslateGetScrapTranslationListConsideringData = 13
  143. };
  144. /* Routines to implment in a file translation extension*/
  145. typedef CALLBACK_API( ComponentResult , DoGetFileTranslationListProcPtr )(ComponentInstance self, FileTranslationListHandle translationList);
  146. typedef CALLBACK_API( ComponentResult , DoIdentifyFileProcPtr )(ComponentInstance self, const FSSpec *theDocument, FileType *docType);
  147. typedef CALLBACK_API( ComponentResult , DoTranslateFileProcPtr )(ComponentInstance self, TranslationRefNum refNum, const FSSpec *sourceDocument, FileType srcType, long srcTypeHint, const FSSpec *dstDoc, FileType dstType, long dstTypeHint);
  148. typedef CALLBACK_API( ComponentResult , DoGetTranslatedFilenameProcPtr )(ComponentInstance self, FileType dstType, long dstTypeHint, FSSpec *theDocument);
  149. /* Routine to implement in a scrap translation extension*/
  150. typedef CALLBACK_API( ComponentResult , DoGetScrapTranslationListProcPtr )(ComponentInstance self, ScrapTranslationListHandle list);
  151. typedef CALLBACK_API( ComponentResult , DoIdentifyScrapProcPtr )(ComponentInstance self, const void *dataPtr, Size dataLength, ScrapType *dataFormat);
  152. typedef CALLBACK_API( ComponentResult , DoTranslateScrapProcPtr )(ComponentInstance self, TranslationRefNum refNum, const void *srcDataPtr, Size srcDataLength, ScrapType srcType, long srcTypeHint, Handle dstData, ScrapType dstType, long dstTypeHint);
  153. #if PRAGMA_STRUCT_ALIGN
  154.     #pragma options align=reset
  155. #elif PRAGMA_STRUCT_PACKPUSH
  156.     #pragma pack(pop)
  157. #elif PRAGMA_STRUCT_PACK
  158.     #pragma pack()
  159. #endif
  160. #ifdef PRAGMA_IMPORT_OFF
  161. #pragma import off
  162. #elif PRAGMA_IMPORT
  163. #pragma import reset
  164. #endif
  165. #ifdef __cplusplus
  166. }
  167. #endif
  168. #endif /* __TRANSLATIONEXTENSIONS__ */