Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

235 lines
8.9 KiB

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