Mac OS 9
TranslationExtensions.h
Go to the documentation of this file.
1 
19 #ifndef __TRANSLATIONEXTENSIONS__
20 #define __TRANSLATIONEXTENSIONS__
21 
22 #ifndef __MACTYPES__
23 #include <MacTypes.h>
24 #endif
25 
26 #ifndef __FILES__
27 #include <Files.h>
28 #endif
29 
30 #ifndef __QUICKDRAW__
31 #include <Quickdraw.h>
32 #endif
33 
34 #ifndef __COMPONENTS__
35 #include <Components.h>
36 #endif
37 
38 #if PRAGMA_ONCE
39 #pragma once
40 #endif
41 
42 #ifdef __cplusplus
43 extern "C"
44 {
45 #endif
46 
47 #if PRAGMA_IMPORT
48 #pragma import on
49 #endif
50 
51 #if PRAGMA_STRUCT_ALIGN
52 #pragma options align = mac68k
53 #elif PRAGMA_STRUCT_PACKPUSH
54 #pragma pack(push, 2)
55 #elif PRAGMA_STRUCT_PACK
56 #pragma pack(2)
57 #endif
58 
59  enum
60  {
61  kSupportsFileTranslation = 1,
62  kSupportsScrapTranslation = 2,
63  kTranslatorCanGenerateFilename = 4
64  };
65 
66  /*******************************************************************************************/
68  typedef OSType FileType;
69  typedef ResType ScrapType;
70  /*******************************************************************************************/
71  typedef UInt32 TranslationAttributes;
72  enum
73  {
74  taDstDocNeedsResourceFork = 1,
75  taDstIsAppTranslation = 2
76  };
77 
78  /*******************************************************************************************/
79  struct FileTypeSpec
80  {
81  FileType format;
82  long hint;
83  TranslationAttributes
84  flags;
85  OSType catInfoType;
86  OSType catInfoCreator;
87  };
88  typedef struct FileTypeSpec FileTypeSpec;
90  {
91  unsigned long modDate;
92  unsigned long groupCount;
93 
102  };
106  /*******************************************************************************************/
108  {
109  ScrapType format;
110  long hint;
111  };
112  typedef struct ScrapTypeSpec ScrapTypeSpec;
114  {
115  unsigned long modDate;
116  unsigned long groupCount;
117 
126  };
130  /********************************************************************************************
131 
132  definition of callbacks to update progress dialog
133 
134  *******************************************************************************************/
135  typedef long TranslationRefNum;
136  /********************************************************************************************
137 
138  This routine sets the advertisement in the top half of the progress dialog.
139  It is called once at the beginning of your DoTranslateFile routine.
140 
141  Enter : refNum Translation reference supplied to
142  DoTranslateFile. advertisement A handle to the picture to display. This must
143  be non-purgable. Before returning from DoTranslateFile, you should dispose of
144  the memory. (Normally, it is in the temp translation heap so it is cleaned up
145  for you.)
146 
147  Exit : returns noErr, paramErr, or memFullErr
148 
149  *******************************************************************************************/
158  OSErr
159  SetTranslationAdvertisement(TranslationRefNum refNum, PicHandle advertisement);
160 
161  /********************************************************************************************
162 
163  This routine updates the progress bar in the progress dialog.
164  It is called repeatedly from within your DoTranslateFile routine.
165  It should be called often, so that the user will get feedback if
166  he tries to cancel.
167 
168  Enter : refNum translation reference supplied to DoTranslateFile.
169  progress percent complete (0-100)
170 
171  Exit : canceled TRUE if the user clicked the Cancel button, FALSE
172  otherwise
173 
174  Return : noErr, paramErr, or memFullErr
175 
176  *******************************************************************************************/
185  OSErr
186  UpdateTranslationProgress(TranslationRefNum refNum, short percentDone,
187  Boolean *canceled);
188 
189  /********************************************************************************************
190 
191  Component Manager component selectors for translation extension routines
192 
193  *******************************************************************************************/
194  enum
195  {
196  kTranslateGetFileTranslationList = 0,
197  kTranslateIdentifyFile = 1,
198  kTranslateTranslateFile = 2,
199  kTranslateGetTranslatedFilename = 3,
200  kTranslateGetScrapTranslationList = 10,
201  kTranslateIdentifyScrap = 11,
202  kTranslateTranslateScrap = 12,
203  kTranslateGetScrapTranslationListConsideringData = 13
204  };
205 
206  /********************************************************************************************
207 
208  routines which implement translation extensions
209 
210  *******************************************************************************************/
211  typedef CALLBACK_API(ComponentResult, DoGetFileTranslationListProcPtr)(
213  typedef CALLBACK_API(ComponentResult,
214  DoIdentifyFileProcPtr)(ComponentInstance self,
215  const FSSpec *theDocument,
216  FileType *docType);
217  typedef CALLBACK_API(ComponentResult, DoTranslateFileProcPtr)(
218  ComponentInstance self, TranslationRefNum refNum,
219  const FSSpec *sourceDocument, FileType srcType, long srcTypeHint,
220  const FSSpec *dstDoc, FileType dstType, long dstTypeHint);
221  typedef CALLBACK_API(ComponentResult,
222  DoGetTranslatedFilenameProcPtr)(ComponentInstance self,
223  FileType dstType,
224  long dstTypeHint,
225  FSSpec *theDocument);
226  typedef CALLBACK_API(ComponentResult, DoGetScrapTranslationListProcPtr)(
228  typedef CALLBACK_API(ComponentResult,
229  DoIdentifyScrapProcPtr)(ComponentInstance self,
230  const void *dataPtr,
231  Size dataLength,
232  ScrapType *dataFormat);
233  typedef CALLBACK_API(ComponentResult, DoTranslateScrapProcPtr)(
234  ComponentInstance self, TranslationRefNum refNum, const void *srcDataPtr,
235  Size srcDataLength, ScrapType srcType, long srcTypeHint, Handle dstData,
236  ScrapType dstType, long dstTypeHint);
237 
238 #if PRAGMA_STRUCT_ALIGN
239 #pragma options align = reset
240 #elif PRAGMA_STRUCT_PACKPUSH
241 #pragma pack(pop)
242 #elif PRAGMA_STRUCT_PACK
243 #pragma pack()
244 #endif
245 
246 #ifdef PRAGMA_IMPORT_OFF
247 #pragma import off
248 #elif PRAGMA_IMPORT
249 #pragma import reset
250 #endif
251 
252 #ifdef __cplusplus
253 }
254 #endif
255 
256 #endif
Component Manager Interfaces.
File Manager (MFS, HFS, and HFS+) Interfaces.
Basic Macintosh data types.
unsigned char Boolean
Definition: MacTypes.h:318
Interface to Quickdraw Graphics.
OSType FileType
Definition: TranslationExtensions.h:68
OSErr UpdateTranslationProgress(TranslationRefNum refNum, short percentDone, Boolean *canceled)
OSErr SetTranslationAdvertisement(TranslationRefNum refNum, PicHandle advertisement)
Definition: Components.h:220
Definition: TranslationExtensions.h:90
Definition: TranslationExtensions.h:80
OSType catInfoType
Definition: TranslationExtensions.h:85
Definition: Quickdraw.h:326
Definition: TranslationExtensions.h:114
Definition: TranslationExtensions.h:108