home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / CIncludes / TranslationExtensions.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-11  |  6.0 KB  |  182 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        TranslationExtensions.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __TRANSLATIONEXTENSIONS__
  18. #define __TRANSLATIONEXTENSIONS__
  19.  
  20. #define kSupportsFileTranslation        1
  21. #define kSupportsScrapTranslation        2
  22. #define kTranslatorCanGenerateFilename    4
  23.  
  24. #ifndef REZ
  25.  
  26. #ifndef __MEMORY__
  27. #include <Memory.h>
  28. #endif
  29. /*    #include <Types.h>                                            */
  30. /*        #include <ConditionalMacros.h>                            */
  31. /*    #include <MixedMode.h>                                        */
  32.  
  33. #ifndef __FILES__
  34. #include <Files.h>
  35. #endif
  36. /*    #include <OSUtils.h>                                        */
  37.  
  38. #ifndef __QUICKDRAW__
  39. #include <Quickdraw.h>
  40. #endif
  41. /*    #include <QuickdrawText.h>                                    */
  42.  
  43. #ifndef __COMPONENTS__
  44. #include <Components.h>
  45. #endif
  46.  
  47. #ifdef __cplusplus
  48. extern "C" {
  49. #endif
  50.  
  51. #if GENERATINGPOWERPC
  52. #pragma options align=mac68k
  53. #endif
  54.  
  55. #ifdef __CFM68K__
  56. #pragma lib_export on
  57. #endif
  58.  
  59. typedef OSType FileType;
  60.  
  61. typedef ResType ScrapType;
  62.  
  63. typedef unsigned long TranslationAttributes;
  64.  
  65.  
  66. enum {
  67.     taDstDocNeedsResourceFork    = 1,
  68.     taDstIsAppTranslation        = 2
  69. };
  70.  
  71. struct FileTypeSpec {
  72.     FileType                        format;
  73.     long                            hint;
  74.     TranslationAttributes            flags;                        /* taDstDocNeedsResourceFork, taDstIsAppTranslation*/
  75.     OSType                            catInfoType;
  76.     OSType                            catInfoCreator;
  77. };
  78. typedef struct FileTypeSpec FileTypeSpec;
  79.  
  80. struct FileTranslationList {
  81.     unsigned long                    modDate;
  82.     unsigned long                    groupCount;
  83. /*     unsigned long    group1SrcCount;*/
  84. /*     unsigned long    group1SrcEntrySize = sizeof(FileTypeSpec);*/
  85. /*  FileTypeSpec    group1SrcTypes[group1SrcCount]*/
  86. /*  unsigned long    group1DstCount;*/
  87. /*  unsigned long    group1DstEntrySize = sizeof(FileTypeSpec);*/
  88. /*  FileTypeSpec    group1DstTypes[group1DstCount]*/
  89. };
  90. typedef struct FileTranslationList FileTranslationList;
  91.  
  92. typedef FileTranslationList *FileTranslationListPtr, **FileTranslationListHandle;
  93.  
  94. struct ScrapTypeSpec {
  95.     ScrapType                        format;
  96.     long                            hint;
  97. };
  98. typedef struct ScrapTypeSpec ScrapTypeSpec;
  99.  
  100. struct ScrapTranslationList {
  101.     unsigned long                    modDate;
  102.     unsigned long                    groupCount;
  103. /*     unsigned long        group1SrcCount;*/
  104. /*     unsigned long        group1SrcEntrySize = sizeof(ScrapTypeSpec);*/
  105. /*  ScrapTypeSpec        group1SrcTypes[group1SrcCount]*/
  106. /*  unsigned long        group1DstCount;*/
  107. /*     unsigned long        group1DstEntrySize = sizeof(ScrapTypeSpec);*/
  108. /*  ScrapTypeSpec        group1DstTypes[group1DstCount]*/
  109. };
  110. typedef struct ScrapTranslationList ScrapTranslationList;
  111.  
  112. typedef ScrapTranslationList *ScrapTranslationListPtr, **ScrapTranslationListHandle;
  113.  
  114. /* definition of callbacks to update progress dialog*/
  115. typedef long TranslationRefNum;
  116.  
  117. /*****************************************************************************************
  118. *
  119. * This routine sets the advertisement in the top half of the progress dialog.
  120. * It is called once at the beginning of your DoTranslateFile routine.
  121. *
  122. * Enter:    refNum            Translation reference supplied to DoTranslateFile.
  123. *            advertisement    A handle to the picture to display.  This must be non-purgable.
  124. *                            Before returning from DoTranslateFile, you should dispose
  125. *                            of the memory.  (Normally, it is in the temp translation heap
  126. *                            so it is cleaned up for you.)
  127. *
  128. * Exit:    returns            noErr, paramErr, or memFullErr
  129. */
  130. extern pascal OSErr SetTranslationAdvertisement(TranslationRefNum refNum, PicHandle advertisement)
  131.  TWOWORDINLINE(0x7002, 0xABFC);
  132. /*****************************************************************************************
  133. *
  134. * This routine updates the progress bar in the progress dialog.
  135. * It is called repeatedly from within your DoTranslateFile routine.
  136. * It should be called often, so that the user will get feedback if he tries to cancel.
  137. *
  138. * Enter:    refNum        translation reference supplied to DoTranslateFile.
  139. *            progress    percent complete (0-100)
  140. *
  141. * Exit:        canceled    TRUE if the user clicked the Cancel button, FALSE otherwise
  142. *            returns        noErr, paramErr, or memFullErr
  143. */
  144. extern pascal OSErr UpdateTranslationProgress(TranslationRefNum refNum, short percentDone, Boolean *canceled)
  145.  TWOWORDINLINE(0x7001, 0xABFC);
  146. /* ComponentMgr selectors for routines*/
  147.  
  148. enum {
  149.     kTranslateGetFileTranslationList = 0,                        /* component selectors*/
  150.     kTranslateIdentifyFile,
  151.     kTranslateTranslateFile,
  152.     kTranslateGetTranslatedFilename,
  153.     kTranslateGetScrapTranslationList = 10,                        /* skip to scrap routines*/
  154.     kTranslateIdentifyScrap,
  155.     kTranslateTranslateScrap
  156. };
  157.  
  158. /* Routines to implment in a file translation extension*/
  159. typedef pascal ComponentResult (*DoGetFileTranslationListProcPtr)(ComponentInstance self, FileTranslationListHandle translationList);
  160. typedef pascal ComponentResult (*DoIdentifyFileProcPtr)(ComponentInstance self, const FSSpec *theDocument, FileType *docType);
  161. typedef pascal ComponentResult (*DoTranslateFileProcPtr)(ComponentInstance self, TranslationRefNum refNum, const FSSpec *sourceDocument, FileType srcType, long srcTypeHint, const FSSpec *dstDoc, FileType dstType, long dstTypeHint);
  162. typedef pascal ComponentResult (*DoGetTranslatedFilenameProcPtr)(ComponentInstance self, FileType dstType, long dstTypeHint, FSSpec *theDocument);
  163. /* Routine to implement in a scrap translation extension*/
  164. typedef pascal ComponentResult (*DoGetScrapTranslationListProcPtr)(ComponentInstance self, ScrapTranslationListHandle list);
  165. typedef pascal ComponentResult (*DoIdentifyScrapProcPtr)(ComponentInstance self, const void *dataPtr, Size dataLength, ScrapType *dataFormat);
  166. typedef pascal ComponentResult (*DoTranslateScrapProcPtr)(ComponentInstance self, TranslationRefNum refNum, const void *srcDataPtr, Size srcDataLength, ScrapType srcType, long srcTypeHint, Handle dstData, ScrapType dstType, long dstTypeHint);
  167.  
  168. #ifdef __CFM68K__
  169. #pragma lib_export off
  170. #endif
  171.  
  172. #if GENERATINGPOWERPC
  173. #pragma options align=reset
  174. #endif
  175.  
  176. #ifdef __cplusplus
  177. }
  178. #endif
  179.  
  180. #endif /* REZ */
  181. #endif /* __TRANSLATIONEXTENSIONS__ */
  182.