2
0

CanvasI.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: CanvasI.h /main/18 1996/10/21 13:59:51 cde-hp $ */
  24. /*************************************<+>*************************************
  25. *****************************************************************************
  26. **
  27. ** File: CanvasI.h
  28. **
  29. ** Project:
  30. **
  31. ** Description: Public Header file for Canvas.c
  32. **
  33. ** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992 Hewlett-Packard Company
  34. **
  35. ** (c) Copyright 1993, 1994 Hewlett-Packard Company
  36. ** (c) Copyright 1993, 1994 International Business Machines Corp.
  37. ** (c) Copyright 1993, 1994 Sun Microsystems, Inc.
  38. ** (c) Copyright 1993, 1994 Novell, Inc.
  39. *******************************************************************
  40. *************************************<+>*************************************/
  41. #ifndef _DtCanvasI_h
  42. #define _DtCanvasI_h
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46. #include <stdlib.h>
  47. /******** Internal Defines Declarations ********/
  48. #define _DtCvLINE_HORZ 0
  49. #define _DtCvLINE_VERT 1
  50. /******** Internal Enum Declarations ********/
  51. enum _dtCvTraversalType
  52. {
  53. _DtCvTraversalNone,
  54. _DtCvTraversalLink,
  55. _DtCvTraversalMark
  56. };
  57. /******** Internal Typedef Declarations ********/
  58. #if !defined(_DtCvLinkMgrP_h) && !defined(_DtCvLinkMgrI_h)
  59. typedef struct _dtCvLinkDb* _DtCvLinkDb;
  60. #endif
  61. typedef enum _dtCvTraversalType _DtCvTraversalType;
  62. /* adding this typedef so that debugging can access the structure */
  63. typedef struct _dtCvSegment _DtCvSegmentI;
  64. typedef struct _dtCvSegPts _DtCvSegPtsI;
  65. /******** Internal Structures Declarations ********/
  66. typedef struct _dtCvDspLine {
  67. _DtCvValue processed;
  68. _DtCvUnit text_x;
  69. _DtCvUnit max_x;
  70. _DtCvUnit baseline;
  71. _DtCvUnit descent;
  72. _DtCvUnit ascent;
  73. int byte_index;
  74. int length;
  75. _DtCvSegmentI *seg_ptr;
  76. } _DtCvDspLine;
  77. typedef struct _dtCvLineSeg {
  78. _DtCvValue processed;
  79. short dir;
  80. _DtCvUnit pos_x;
  81. _DtCvUnit max_x;
  82. _DtCvUnit pos_y;
  83. _DtCvUnit max_y;
  84. _DtCvUnit width;
  85. _DtCvPointer data;
  86. } _DtCvLineSeg;
  87. typedef struct _dtCvPointData {
  88. _DtCvUnit x;
  89. _DtCvUnit y; /* baseline of the line */
  90. int line_idx;
  91. int char_idx;
  92. } _DtCvPointData;
  93. typedef struct _dtCvMarkData {
  94. _DtCvValue on;
  95. _DtCvPointer client_data;
  96. _DtCvPointData beg;
  97. _DtCvPointData end;
  98. } _DtCvMarkData;
  99. typedef struct _dtCvTraversalInfo {
  100. _DtCvValue active;
  101. _DtCvTraversalType type; /* the type of the traversal */
  102. int idx; /* the index into the approp. struct */
  103. /* either the txt_lst or marks */
  104. _DtCvUnit x_pos; /* x pos on the line. */
  105. _DtCvUnit y_pos; /* top y pos of bounding box */
  106. _DtCvUnit width; /* width of link on 1st line only */
  107. _DtCvUnit height; /* height of 1st line bounding box */
  108. _DtCvSegmentI *seg_ptr; /* ptr to first seg of link */
  109. } _DtCvTraversalInfo;
  110. typedef struct _dtCvSearchData {
  111. int idx; /* the line index of the search hit */
  112. _DtCvDspLine *lst; /* pointer to the text line list */
  113. } _DtCvSearchData;
  114. typedef struct _dtCanvasStruct {
  115. int error;
  116. long txt_cnt; /* maximum used in txt_list */
  117. int txt_max; /* maximum in txt_list */
  118. int line_cnt; /* maximum used in line_lst */
  119. int line_max; /* maximum in line_lst */
  120. int mark_cnt; /* mark counter */
  121. int mark_max; /* maximum in mark_lst */
  122. int trav_cnt; /* maximum used in trav_lst */
  123. int trav_max; /* maximum in trav_lst */
  124. int cur_trav; /* traversal indicator */
  125. int search_cnt;
  126. int search_max;
  127. int brk_cnt; /* the number of page breaks */
  128. int brk_max; /* the maxium entries */
  129. short mb_length; /* The maximum length of a char */
  130. _DtCvUnit max_x; /* The maximum x position */
  131. _DtCvUnit max_y; /* The maximum y position */
  132. _DtCvValue constraint; /* Indicates if the right
  133. boundary can be breached */
  134. _DtCvValue trav_on; /* Indicates if the traversal
  135. is on or off. */
  136. _DtCvPointer client_data;
  137. _DtCvMetrics metrics;
  138. _DtCvSpaceMetrics link_info;
  139. _DtCvSpaceMetrics traversal_info;
  140. _DtCvLocale locale;
  141. _DtCvSegmentI *element_lst;
  142. _DtCvDspLine *txt_lst;
  143. _DtCvLineSeg *line_lst;
  144. _DtCvTraversalInfo *trav_lst;
  145. _DtCvLinkDb link_data;
  146. _DtCvPointData select_start;
  147. _DtCvPointData select_end;
  148. _DtCvMarkData *marks;
  149. _DtCvSearchData *searchs;
  150. _DtCvUnit *pg_breaks;
  151. _DtCvVirtualInfo virt_functions;
  152. } _DtCanvasStruct;
  153. /******** Internal Structure Typedef Declarations ********/
  154. typedef struct _dtCvPointData _DtCvSelectData;
  155. /******** Internal Macros Declarations ********/
  156. #define _DtCvHasTraversal(x) ((x) & _DtCvTRAVERSAL_FLAG)
  157. /*
  158. * segment type access
  159. */
  160. #define _DtCvIsTypeNoop(x) \
  161. ((((x) & _DtCvPRIMARY_MASK) == _DtCvNOOP) ? 1 : 0)
  162. /*
  163. * Is a flag set
  164. */
  165. #define _DtCvIsSegVisibleLink(x) _DtCvIsSegHyperText(x)
  166. #define _DtCvIsSegALink(x) \
  167. (_DtCvIsSegHyperText(x) || _DtCvIsSegGhostLink(x))
  168. #define _DtCvIsMarkMaskOn(x) \
  169. (((x) & _DtCvACTIVATE_MARK_ON) ? _DtCvTRUE : _DtCvFALSE)
  170. /*
  171. * remove masks
  172. */
  173. #define _DtCvRemoveBeginFlags(x) x &= ~(_DtCvTRAVERSAL_BEGIN | \
  174. _DtCvLINK_BEGIN | \
  175. _DtCvMARK_BEGIN | \
  176. _DtCvSEARCH_BEGIN)
  177. #define _DtCvSetSearchEnd(x,seg) x |= ((seg)->type & _DtCvSEARCH_END)
  178. #define _DtCvSetSearchBegin(x,seg) x |= ((seg)->type & _DtCvSEARCH_BEGIN)
  179. #define _DtCvClearSearchFlags(x) x &= ~(_DtCvSEARCH_FLAG | \
  180. _DtCvSEARCH_BEGIN | \
  181. _DtCvSEARCH_END)
  182. #define _DtCvClearLinkFlags(x) x &= ~(_DtCvLINK_FLAG | \
  183. _DtCvLINK_BEGIN | \
  184. _DtCvLINK_END | \
  185. _DtCvLINK_POP_UP | \
  186. _DtCvLINK_NEW_WINDOW)
  187. #define _DtCvClearProcessed(x) (x).processed = False
  188. #define _DtCvSetProcessed(x) (x).processed = True
  189. #define _DtCvIsProcessed(x) (x).processed
  190. #define _DtCvIsNotProcessed(x) ((False == (x).processed) ? True : False)
  191. #define _DtCvStraddlesPt(pt,min,max) ((min) <= (pt) && (pt) <= (max))
  192. /******** Internal Function Declarations ********/
  193. extern _DtCvUnit _DtCvAdjustForSuperSub(
  194. _DtCanvasStruct *canvas,
  195. _DtCvSegmentI *p_seg,
  196. _DtCvUnit start_x,
  197. _DtCvUnit *script_x,
  198. _DtCvUnit *super_width,
  199. _DtCvUnit *super_y,
  200. _DtCvUnit *sub_width,
  201. _DtCvUnit *sub_y,
  202. _DtCvValue *super_flag,
  203. _DtCvValue *sub_flag);
  204. extern _DtCvUnit _DtCvAdvanceXOfLine (
  205. _DtCanvasStruct *canvas,
  206. _DtCvSegmentI *p_seg,
  207. _DtCvUnit x_pos,
  208. int *link_idx,
  209. _DtCvValue *link_flag);
  210. extern _DtCvStatus _DtCvCheckInfringement (
  211. _DtCvUnit tst_top,
  212. _DtCvUnit tst_bot,
  213. _DtCvUnit obj_top,
  214. _DtCvUnit obj_bot);
  215. extern void _DtCvCheckLineMarks (
  216. _DtCanvasStruct *canvas,
  217. int line_idx,
  218. int char_idx,
  219. int length,
  220. _DtCvUnit dst_x,
  221. _DtCvFlags check_flags,
  222. int *ret_len,
  223. _DtCvFlags *ret_old,
  224. _DtCvFlags *ret_new);
  225. extern void _DtCvClearInternalUse (
  226. _DtCvSegmentI *list,
  227. _DtCvStatus flag);
  228. extern _DtCvUnit _DtCvDrawSegments(
  229. _DtCanvasStruct *canvas,
  230. _DtCvDspLine line,
  231. _DtCvSegmentI *p_seg,
  232. int start_char,
  233. int count,
  234. int *prev_lnk,
  235. _DtCvUnit txt_x,
  236. _DtCvUnit sel_x,
  237. _DtCvUnit *scriptX,
  238. _DtCvUnit *super_width,
  239. _DtCvUnit *super_y,
  240. _DtCvUnit *sub_width,
  241. _DtCvUnit *sub_y,
  242. _DtCvValue *last_was_sub,
  243. _DtCvValue *last_was_super,
  244. _DtCvValue *last_link_vis,
  245. _DtCvFlags old_flag,
  246. _DtCvFlags new_flag,
  247. _DtCvElemType trav_flag,
  248. _DtCvPointer trav_data);
  249. extern int _DtCvGetCharIdx(
  250. _DtCanvasStruct *canvas,
  251. _DtCvDspLine line,
  252. _DtCvUnit find_x);
  253. extern _DtCvUnit _DtCvGetStartXOfLine(
  254. _DtCvDspLine *line,
  255. _DtCvSegmentI **pSeg);
  256. extern void _DtCvGetWidthOfSegment(
  257. _DtCanvasStruct *canvas,
  258. _DtCvSegmentI *p_seg,
  259. int start,
  260. int max_cnt,
  261. int *ret_cnt,
  262. _DtCvUnit *ret_w,
  263. _DtCvValue *ret_trimmed);
  264. extern _DtCvValue _DtCvModifyXpos(
  265. _DtCvSpaceMetrics info,
  266. _DtCvSegmentI *seg,
  267. _DtCvValue tst_result,
  268. _DtCvValue old_result,
  269. int idx,
  270. _DtCvUnit *x_pos);
  271. extern void _DtCvSkipLineChars(
  272. _DtCanvasStruct *canvas,
  273. _DtCvSegmentI *p_seg,
  274. int start,
  275. int max_cnt,
  276. int use_len,
  277. int *ret_start,
  278. _DtCvSegmentI **ret_seg);
  279. #ifdef __cplusplus
  280. } /* Close scope of 'extern "C"' declaration which encloses file. */
  281. #endif
  282. #endif /* _DtCanvasI_h */
  283. /* DON'T ADD ANYTHING AFTER THIS #endif */