home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Developer Kits / Quark XTLite / CopyDesk XTLite / XTLite.h < prev   
Encoding:
C/C++ Source or Header  |  1994-03-11  |  9.4 KB  |  235 lines  |  [TEXT/KAHL]

  1. /**************************************************************************\
  2. **
  3. **  XTLite.h
  4. **
  5. **  Header file needed for all QuarkXPress XTLite XTensions.
  6. **
  7. **
  8. **  Copyright © 1993,1994 Quark Incorporated
  9. **  All Rights Reserved
  10. **
  11. \**************************************************************************/
  12.  
  13. #ifndef PLATFORMPOWERPC
  14. #define PLATFORMPOWERPC 0
  15. #endif
  16. #ifndef PLATFORMMAC
  17. #define PLATFORMMAC 1
  18. #endif
  19.  
  20. #ifndef __NEWTYPES
  21. #define __NEWTYPES
  22. /* Replacement types */
  23. /* Apple SANE numeric formats */
  24. typedef short double float64;
  25. typedef double float96;
  26. /* Signed things */
  27. typedef char int8;
  28. typedef short int16;
  29. typedef long int32;
  30. /* Unsigned things */
  31. typedef unsigned int ubitfield;
  32. typedef unsigned char uint8;
  33. typedef unsigned char uchar;
  34. typedef Boolean bool8;
  35. typedef int16 bool16;
  36. typedef unsigned short uint16;
  37. typedef unsigned long uint32;
  38. typedef unsigned bitfield;
  39.  
  40. #define BOOL bool16
  41. #endif /* __NEWTYPES */
  42.  
  43. #if PLATFORMPOWERPC
  44. /* Don't allow the old types to be used. These can be
  45. ** undef'ed in any file that requires them. */
  46. #define int DieINT
  47. #define long DieLONG
  48. #define unsigned DieUNSIGNED
  49. #define Boolean DieBOOLEAN
  50.  
  51. #define main xtmain
  52.  
  53. #define TRUE 1
  54. #define FALSE 0
  55. #define OK 1
  56. #define Cancel 2
  57. #endif    /* PLATFORMPOWERPC */
  58.  
  59. #define ISSPECIAL(z) (((15L<<commandMark)>>(z))&1 != 0)
  60. #define ISLINECHAR(z) ((z) <= RETURNCHAR && ((z) >= PARAGRAPH || (z) == HARDRETURN))
  61. #define ISPARACHAR(z) ((z) <= RETURNCHAR && (z) >= PARAGRAPH)
  62.  
  63. /***************************************************************************/
  64. /*                                                                         */
  65. /* line justification values                                               */
  66. /*                                                                         */
  67. /***************************************************************************/
  68. #define LEFT 0
  69. #define CENTER 1
  70. #define RIGHT 2
  71. #define JUST 3
  72.  
  73. /***************************************************************************/
  74. /*                                                                         */
  75. /* tab alignment values                                                       */
  76. /*                                                                         */
  77. /***************************************************************************/
  78. #define TABLEFT 0
  79. #define TABCENTER 1
  80. #define TABRIGHT 2
  81. #define TABALIGNON 3
  82. #define TABDECIMAL 3            /* for backward compatibility */
  83.  
  84. /***************************************************************************/
  85. /*                                                                         */
  86. /* constants for character styles                                           */
  87. /*                                                                         */
  88. /***************************************************************************/
  89. #define PLAIN 0
  90. #define SUPERSCRIPT 0x20
  91. #define SUBSCRIPT 0x40
  92. #define NONBREAKING 0x80
  93. #define SUPERIOR 0x100
  94. #define STRIKETHRU 0x200
  95. #define ALLCAPS 0x400
  96. #define SMALLCAPS 0x800
  97. #define WUNDERLINE 0x1000
  98.  
  99. /***************************************************************************/
  100. /*                                                                         */
  101. /* special characters                                                       */
  102. /*                                                                         */
  103. /***************************************************************************/
  104. #define BREAKCHAR 0x00                /* Special marker for conditional line breaks */
  105. #define HARDRETURN 0x07                /* hard return */
  106. #define TABCHAR ('I'-64)            /* tab character */
  107. #define PARAGRAPH 0x0B                /* PARAGRAPH..RETURNCHAR are paragraph markers */
  108. #define NEWCOLUMN 0x0B                /* new column character */
  109. #define NEWBOX 0x0C                    /* new box character */
  110. #define RETURNCHAR 0x0D                /* end of paragraph mark */
  111. #define DISCRETIONARYRETURN 0x1D    /* discretionary return character */
  112. #define TEMPMARGIN 0x1E                /* Temporary margin character (indent here) */
  113. #define INVISCHAR ('U'-64)            /* ASCII code of first invisible character */
  114. #define SOFTHYPHEN 0x1F                /* discretionary hyphen character */
  115. #define NSPACECHAR 0xCA                /* en space character */
  116. #define FLEXSPACECHAR 0x0F            /* Flex space (normally quarter of an em space) */
  117. #define PUNCSPACECHAR 0x10            /* space the width of a '.' */
  118.  
  119.  
  120. /***************************************************************************/
  121. /*                                                                         */
  122. /* Min and Max values for attributes                                       */
  123. /*                                                                         */
  124. /***************************************************************************/
  125. #define MINSIZE (2L<<16)
  126. #define MAXSIZE (720L<<16)
  127. #define MINSCALE (40L<<8)
  128. #define MAXSCALE (4L<<16)
  129. #define MINSHADE (0L)
  130. #define MAXSHADE (1L<<16)
  131. #define MINKERN (-500L<<16)
  132. #define MAXKERN (500L<<16)
  133. #define MINTRACK MINKERN
  134. #define MAXTRACK MAXKERN
  135.  
  136. /***************************************************************************/
  137. /*                                                                         */
  138. /* Text Attributes record                                                   */
  139. /*                                                                         */
  140. /***************************************************************************/
  141. typedef struct {
  142.     int16 font;                                    /* Font id */
  143.     int16 face;                                    /* Face (style) flags */
  144.     Fixed size;                                    /* Font size (between 2 and 720 pt) */
  145.     Fixed hscale;                                /* Horizontal scale factor between 25 and 400% (1.0 is 100%) */
  146.     Fixed shade;                                /* 1.0 is 100% (between 0 and 100%) */
  147.     Fixed kern;                                    /* Fractional 200ths em (-500 to 500) */
  148.     Fixed track;                                /* Fractional 200ths em (-500 to 500) */
  149. } filtertxtattrib,*filtertxtattribptr,**filtertxtattribhandle;
  150.  
  151. /***************************************************************************/
  152. /*                                                                         */
  153. /* Text Attributes defines                                                   */
  154. /*                                                                         */
  155. /***************************************************************************/
  156. #define T_FONT 1
  157. #define T_FACE 2
  158. #define T_SIZE 3
  159. #define T_HSCALE 4
  160. #define T_SHADE 7
  161. #define T_KERN 8
  162. #define T_TRACK 9
  163.  
  164. /***************************************************************************/
  165. /*                                                                         */
  166. /* Tab Specifications record                                               */
  167. /*                                                                         */
  168. /***************************************************************************/
  169. typedef struct {
  170.     Byte tabjust;                                /* TABLEFT,TABCENTER,TABRIGHT,TABALIGNON */
  171.     Byte alignon;                                /* byte to align on when TABALIGNON */
  172.     Byte tablead;                                /* character to fill tab with */
  173.     Fixed tabindent;                            /* Offset to tab */
  174. } filtertabspec;
  175.  
  176. /***************************************************************************/
  177. /*                                                                         */
  178. /* Paragraph Attributes record                                               */
  179. /*                                                                         */
  180. /***************************************************************************/
  181. typedef struct {
  182.     bool8 relative;                            /* Boolean attributes */
  183.     Byte just;                                /* LEFT, CENTER, RIGHT, JUSTified */
  184.     Fixed leftindent;                        /* Left Indent (relative to column/box left edge) */
  185.     Fixed firstindent;                        /* First Line Indent (relative to "leftindent") */
  186.     Fixed rightindent;                        /* Right Indent (relative to column/box right edge) */
  187.     Fixed leading;                            /* 0 means “auto” leading */
  188.     Fixed spcbefore;                        /* Space Before paragraph */
  189.     Fixed spcafter;                            /* Space After paragraph */
  190.     filtertabspec tabs[];                    /* User tabs */
  191. } filterparaattrib,*filterparaattribptr,**filterparaattribhandle;
  192.  
  193. /***************************************************************************/
  194. /*                                                                         */
  195. /* Paragraph Attributes defines                                               */
  196. /*                                                                         */
  197. /***************************************************************************/
  198. #define P_RELATIVE 3
  199. #define P_JUST 18
  200. #define P_LEFTINDENT 26
  201. #define P_FIRSTINDENT 27
  202. #define P_RIGHTINDENT 28
  203. #define P_LEADING 29
  204. #define P_SPCBEFORE 30
  205. #define P_SPCAFTER 31
  206.  
  207. /* function prototypes */
  208. void setupfilter(OSType *,OSType *,bool8 *,bool8 *,Str255,Str255,Str255);
  209. bool8 setupmenu(Str255);
  210. bool8 setupidle(void);
  211. void startread(int16);
  212. void readtext(int16, Str255, int32 *, filtertxtattrib *, filterparaattrib *, RGBColor *);
  213. void endread(int16);
  214. void startwrite(int16);
  215. void writetext(int16, Str255, int32, filtertxtattrib *, filterparaattrib *, RGBColor *);
  216. void endwrite(int16);
  217. int16 convertcolor(uint16,uint16,uint16);
  218. int16 maxnumoftabs(void);
  219. void menucall(void);
  220. void idlecall(EventRecord *);
  221.  
  222. bool8 istextboxcurrent(void);
  223. bool8 gettextinfo(int32 *selectionstart,int32 *selectionend,int32 *totallength);
  224. bool8 inserttext(int32 numberofcharacters,uchar *textstr,int32 offset);
  225. bool8 gettext(int32 offset,int32 numberofcharacters,uchar *textstr);
  226. bool8 deletetext(int32 offset,int32 numberofcharacters);
  227. bool8 gettextattribute(int16 whichattribute,Fixed *attribute,int32 startoffset,int32 endoffset);
  228. bool8 settextattribute(int16 whichattribute,Fixed attribute,int32 startoffset,int32 endoffset,
  229.                               bool16 redrawtext);
  230. bool8 getparaattribute(int16 whichattribute,Fixed *attribute,int32 startoffset,int32 endoffset);
  231. bool8 setparaattribute(int16 whichattribute,Fixed attribute,int32 startoffset,int32 endoffset,
  232.                               bool16 redrawtext);
  233. bool8 turnofftextselection(void);
  234. bool8 settextselection(int32 startoffset,int32 endoffset);
  235.