gel_text.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. /** @file
  2. * GEL text related control API.
  3. *
  4. * @author mandy.wu 2010/08/31 (Add new marquee style GEL_MARQUEE_CIRCLE)
  5. * @author tzungming.lin
  6. * @version 0.1
  7. */
  8. #ifndef __GEL_TEXT__
  9. #define __GEL_TEXT__
  10. #include "device_font.h"
  11. /** Dynamic string types. */
  12. typedef enum {
  13. GEL_DYN_STR_NATIVE, /**< Follow the code page for static string */
  14. GEL_DYN_STR_EPG, /**< Dynamic strings will be regarded as epg strings */
  15. GEL_DYN_STR_UTF8, /**< Dynamic strings will be regarded as utf8 strings */
  16. GEL_DYN_STR_UTF16_LE, /**< Dynamic strings will be regarded as utf16 little endian strings */
  17. GEL_DYN_STR_UTF16_BE, /**< Dynamic strings will be regarded as utf16 big endian strings */
  18. GEL_DYN_STR_LAST
  19. } GEL_DynStrType_e;
  20. /** Marquee style. */
  21. typedef enum GEL_Marquee_Style_e_
  22. {
  23. GEL_MARQUEE_SCROLL_ONEWAY = 0, /**< */
  24. GEL_MARQUEE_SCROLL = 0x10000000, /**< */
  25. GEL_MARQUEE_ALTERNATE_ONEWAY =0x20000000, /**< */
  26. GEL_MARQUEE_ALTERNATE = 0x30000000, /**< */
  27. GEL_MARQUEE_CIRCLE = 0x40000000, /**< */
  28. GEL_MARQUEE_MAX = 0x40000000
  29. } GEL_Marquee_Style_e;
  30. /** Text alignment in horizontal. */
  31. typedef enum {
  32. GEL_TEXT_ALIGN_LEFT = 0, /**< Left aligned */
  33. GEL_TEXT_ALIGN_CENTER, /**< Center aligned */
  34. GEL_TEXT_ALIGN_RIGHT, /**< Right aligned */
  35. GEL_TEXT_ALIGN_CP_DIR, /**< Codepage display direction aligned */
  36. GEL_TEXT_ALIGN_LAST
  37. } GEL_TextAlign_e;
  38. /** Border text style. */
  39. typedef enum {
  40. GEL_TEXT_BORD_THIN = 0, /**< Thin text border */
  41. GEL_TEXT_BORD_MIDDLE, /**< Middle text border */
  42. GEL_TEXT_BORD_THICK, /**< Thick text border */
  43. GEL_TEXT_BORD_LAST
  44. } GEL_TextBordType_e;
  45. typedef enum {
  46. GEL_TEXT_STYLE_NORMAL = 0,
  47. GEL_TEXT_STYLE_BOLD,
  48. GEL_TEXT_STYLE_ITALIC,
  49. GEL_TEXT_STYLE_BOLD_ITALIC,
  50. GEL_TEXT_STYLE_BORDERING,
  51. GEL_TEXT_STYLE_LAST
  52. } GEL_TextStyle_e;
  53. typedef enum {
  54. GEL_TEXT_END_NO_POINT = 1, // Sync. value with DrawPoint_e
  55. GEL_TEXT_END_THREE_POINT,
  56. GEL_TEXT_END_NOT_ENOUGH,
  57. GEL_TEXT_END_STYLE_LAST
  58. } GEL_TextEndStyle_e;
  59. typedef enum {
  60. GEL_AALEVEL_NONE = 0,
  61. GEL_AALEVEL_4,
  62. GEL_AALEVEL_8,
  63. GEL_AALEVEL_FULL,
  64. GEL_AALEVEL_LAST
  65. } GEL_AALevel_e;
  66. /** GEL text info struct */
  67. typedef struct {
  68. BOOLEAN bDrawBorder; /**< Draw border or not. */
  69. UINT8 bBordColor; /**< The color index value for text border. */
  70. UINT8 bTextFgColor; /**< The color index value for text foreground filling. */
  71. UINT8 bTextBgColor; /**< The color index value for text background filling. */
  72. #if 0
  73. UINT32 dFontSize; /**< The font size to be used. */
  74. #else
  75. FontStyle_e eFontStyle; /**< The font style to be used. */
  76. #endif
  77. GEL_TextAlign_e eTextAlign; /**< The text alignment style. */
  78. GEL_TextBordType_e eBordType; /**< The type of text border. */
  79. } GEL_TextInfo_t;
  80. /** Vector font infor struct */
  81. typedef struct {
  82. FONTSize_t bFontSize; /**< The font size in 'pt' (only support for vector font config). */
  83. GEL_TextStyle_e eTextStyle; /**< The text style to be applied */
  84. GEL_AALevel_e eAALevel; /**< Grayscale color levels for AA. */
  85. GEL_AAEntry_t* pStartIndices; /**< List of start indices of each group. */
  86. UINT8 bAAGroupNum : 4;/**< Number of groups of grayscale colors for AA. */
  87. UINT8 bAAGroupIdx : 4;/**< Index of desired group. */
  88. UINT8 bAADisable : 4;/**< Force disable AA effect. If true, AA is disabled. */
  89. UINT8 bGenPal : 4;/**< Generate palette from vfont or not. */
  90. } GEL_VFInfo_t;
  91. #ifdef CONFIG_ENABLE_UMF_LANGUAGE_MODULES
  92. typedef INT32 (*LoadLangfun)(INT8 eLangName);
  93. void GEL_RegLoadGlobalLangCB (LoadLangfun fun);
  94. #endif
  95. /**
  96. * Set font information to GUI engine.
  97. *
  98. * @param pFontInfo Pointer of the font information array generated by tool.
  99. * @param dFontBlockNum The font block number generated by tool.
  100. * @param dFontSizeNum The font size number generated by tool.
  101. * @param bLangNum The language number generated by tool.
  102. * @return GUI_SUCCESS if succeed, error codes otherwise.
  103. */
  104. GUIResult_e GEL_SetFontInfo(FONTInfo_t *pFontInfo, UINT32 dFontStyleNum, OSDStringInfo_t *pStr,
  105. UINT16 usStrIDNum, UINT8 ucBasicBmpSize, UINT8 ucLangNum, UINT8 ucCharSpacing)__attribute__ ((warn_unused_result));
  106. /**
  107. * Set global language information to the whole project.
  108. *
  109. * @param sdLangName The language name to be set for global settings.
  110. * @return GUI_SUCCESS if succeed, error codes otherwise.
  111. */
  112. GUIResult_e GEL_SetGlobalLang (UiLANGName_t sdLangName)__attribute__ ((warn_unused_result));
  113. /**
  114. * Get global language information to the whole project.
  115. *
  116. * @param sdLangName Returned language name.
  117. * @return GUI_SUCCESS if succeed, error codes otherwise.
  118. */
  119. GUIResult_e GEL_GetGlobalLang (UiLANGName_t *sdLangName)__attribute__ ((warn_unused_result));
  120. /**
  121. * Set current language information of specific menu/popup.
  122. */
  123. GUIResult_e GEL_SetLang(WinControl_t *pWinCtrl, UiLANGName_t eLangName);
  124. /**
  125. * Get current language information of specific menu/popup.
  126. *
  127. * @param pWinCtrl A WinControl_t pointer to a WINDOW/POPUP.
  128. * @param pLangInfo Returned language information.
  129. * @return GUI_SUCCESS if succeed, error codes otherwise.
  130. */
  131. GUIResult_e GEL_GetLang(WinControl_t *pWinCtrl, UiLANGName_t *pLangInfo)__attribute__ ((warn_unused_result));
  132. /**
  133. * Set string type of dynamic strings.
  134. * GUI engine will display dynamic strings according to the set type.
  135. *
  136. * @param pHandle Handle to a control object.
  137. * @param eStringType The string type to be set (DYNStringType_t).
  138. * @return GUI_SUCCESS if succeed, error codes otherwise.
  139. * @see GEL_GetStrType()
  140. */
  141. GUIResult_e GEL_SetStrType (HWND pHandle, GEL_DynStrType_e eStringType)__attribute__ ((warn_unused_result));
  142. /**
  143. * Get string type of dynamic strings.
  144. * GUI engine will display dynamic strings according to the set type.
  145. *
  146. * @param pHandle Handle to a control object.
  147. * @param pStringType Return the current dynamic string type to be regarded as.
  148. * @return GUI_SUCCESS if succeed, error codes otherwise.
  149. * @see GEL_SetStrType()
  150. */
  151. GUIResult_e GEL_GetStrType (HWND pHandle, GEL_DynStrType_e *pStringType)__attribute__ ((warn_unused_result));
  152. /**
  153. * Get string data from a static string id.
  154. *
  155. * @param sdstrId A valid string id in the string list.
  156. * @param ppStr Pointer to a pointer of a string.
  157. * @return GUI_SUCCESS if succeed, error codes otherwise.
  158. */
  159. GUIResult_e GEL_GetStr(String_id_t sdstrId, UINT8 **ppStr)__attribute__ ((warn_unused_result));
  160. /**
  161. * Get string width and height according to the font configuration.
  162. *
  163. * @param pStr Pointer to a string.
  164. * @param pstTextInfo Text info of the string.
  165. * @param pWidth Return the string width.
  166. * @param pHeight Return the string height.
  167. * @return GUI_SUCCESS if succeed, error codes otherwise.
  168. */
  169. GUIResult_e GEL_GetStrSize(UINT8 *pStr, GEL_TextInfo_t *pstTextInfo,
  170. UINT16 *pWidth, UINT16 *pHeight)__attribute__ ((warn_unused_result));
  171. #if 0
  172. /**
  173. * Set marquee fps(frame per second).
  174. *
  175. * @param bFps Fps for marquee to be set.
  176. * @return GUI_SUCCESS if succeed, error codes otherwise.
  177. */
  178. GUIResult_e GEL_SetMarqueeFps(UINT8 bFps)__attribute__ ((warn_unused_result));
  179. #endif
  180. /**
  181. * Set marquee fps(frame per second) and move step.
  182. *
  183. * @param bFps Fps for marquee to be set.
  184. * @param step move step.
  185. * @return GUI_SUCCESS if succeed, error codes otherwise.
  186. */
  187. GUIResult_e GEL_SetMarqueeFpsAndStep(UINT8 bFps, INT16 step)__attribute__ ((warn_unused_result));
  188. /**
  189. * Set marquee style to a specific control.
  190. *
  191. * @param pHandle Handle to a control object.
  192. * @param eStyle The marquee style to be set.
  193. * @return GUI_SUCCESS if succeed, error codes otherwise.
  194. */
  195. GUIResult_e GEL_SetMarqueeStyle(HWND pHandle, GEL_Marquee_Style_e eStyle)__attribute__ ((warn_unused_result));
  196. /**
  197. * Release ebook related buffer.
  198. * @return GUI_SUCCESS if succeed, error codes otherwise.
  199. */
  200. GUIResult_e GEL_EBK_Finalize(void)__attribute__ ((warn_unused_result));
  201. /**
  202. * Accumulate the total lines according to the input string. This function would run on
  203. * caller's task.
  204. *
  205. * @param pHandle Handle to a CLASS_TEXT control widget with S_TXT_EBK style.
  206. * @param pString Desired string buffer.
  207. * @return GUI_SUCCESS if success, error codes otherwise.
  208. */
  209. GUIResult_e GEL_EBK_AccumPages(HWND handle, UINT8* pString,UINT32 bufferindex)__attribute__ ((warn_unused_result));
  210. /**
  211. * Reset the related attributes. Note that this function would ignore ebk_info->bSync flag.
  212. *
  213. * @param pHandle Handle to a CLASS_TEXT control widget with S_TXT_EBK style.
  214. * @return GUI_SUCCESS if success, error codes otherwise.
  215. */
  216. GUIResult_e GEL_EBK_Reset(HWND pHandle)__attribute__ ((warn_unused_result));
  217. /**
  218. * Perform ebook goto-page functionality. This function would run on
  219. * caller's task.
  220. *
  221. * @param pHandle Handle to a CLASS_TEXT control widget with S_TXT_EBK style.
  222. * @param dPage Desired page number.
  223. * @param sdBufIndex Returned buffer index related to text file.
  224. * @param bDataExist Returned flag that indicate whether the content of dPage exists in current loaded string buffer or not.
  225. * @return GUI_SUCCESS if success, error codes otherwise.
  226. */
  227. GUIResult_e GEL_EBK_Goto(HWND pHandle, UINT32 dPage, INT32 *sdBufIndex, BOOLEAN *bDataExist)__attribute__ ((warn_unused_result));
  228. GUIResult_e GEL_EBK_GetPageOffset(HWND handle, UINT32 dPage, UINT32 *pdFcpOffset,UINT32 *pdBufferIndex);
  229. GUIResult_e GEL_EBK_GetPagebyOffset(HWND handle, UINT32 dFcpOffset, UINT32 dBufferIndex, UINT32 *pdPage);
  230. /**
  231. * Check if given handle(textbox) is at synchronized condition. If not,
  232. * AP should reload the desired string buffer.
  233. *
  234. * @param pHandle Handle to a CLASS_TEXT control widget with S_TXT_EBK style.
  235. * @return TRUE or FALSE.
  236. */
  237. BOOLEAN GEL_EBK_IsSync(HWND pHandle)__attribute__ ((warn_unused_result));
  238. /**
  239. * AP notifies GUI engine that the data of buffer is synchronized now, and
  240. * engine would unlock the designate textbox.
  241. *
  242. * @param pHandle Handle to a CLASS_TEXT control widget with S_TXT_EBK style.
  243. * @return GUI_SUCCESS if success, error codes otherwise.
  244. */
  245. UINT32 GEL_EBK_Notify(HWND handle, UINT8 *pString, UINT32 *Stroffset,UINT32 *sdBufIndex);
  246. //<gunking>
  247. /**
  248. * Set how to show unknown character
  249. *
  250. * @param UnknownChar unknown character by user configuration
  251. * @return GUI_SUCCESS if succeed, error codes otherwise.
  252. */
  253. GUIResult_e GEL_SetUnknownChar(UINT16 chUnknownChar)__attribute__ ((warn_unused_result));
  254. //</gunking>
  255. GUIResult_e GEL_EBK_Preview(HWND handle);
  256. typedef BOOL (*EBookGetPartialCode_t)(UINT8 *pSrcStr,UINT32 uiSrcBufLen, UINT32 *pOffset);
  257. void GEL_RegPartialCodeCheckCallBackFunc(EBookGetPartialCode_t pGEL_EbookPartialCodeCheckCallBackFunc);
  258. typedef UINT8* (*EBookConvert_t)(UINT8* pSrcStr, INT32* puiLen);
  259. void GEL_RegConvertCodeCallBackFunc(EBookConvert_t pGEl_EBook_ConvertCodeCallBackFunc);
  260. void GEL_UnRegConvertCodeCallBackFunc(void);
  261. void GEL_UnRegPartialCodeCheckCallBackFunc(void);
  262. #endif /* __GEL_TEXT__ */