wiki_info.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * Copyright (c) 2009 Openmoko Inc.
  3. *
  4. * Authors Holger Hans Peter Freyther <zecke@openmoko.org>
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef WIKI_INFO_H
  20. #define WIKI_INFO_H
  21. #include "lcd_buf_draw.h"
  22. #define MAX_WIKIS 16
  23. #if !defined(INCLUDED_FROM_KERNEL)
  24. #define MAX_WIKIS_PER_DEVICE MAX_WIKIS
  25. #else
  26. #define MAX_WIKIS_PER_DEVICE 6
  27. #endif
  28. #define MAX_LINKS_IN_LICENSE_TEXT 4
  29. #define LICENSE_LINK_START '['
  30. #define LICENSE_LINK_END ']'
  31. #define NLS_TEXT_REPLACEMENT_START '<'
  32. #define NLS_TEXT_REPLACEMENT_END '>'
  33. #define MAX_LICENSE_TEXT_LEN 1024
  34. #define MAX_LICENSE_TEXT_PIXEL_LINES 512
  35. enum wiki_cat_e {
  36. WIKI_CAT_ENCYCLOPAEDIA,
  37. WIKI_CAT_TRAVEL,
  38. WIKI_CAT_DICTIONARY,
  39. WIKI_CAT_QUOTE,
  40. WIKI_CAT_SOURCE,
  41. };
  42. typedef struct _WIKI_LIST {
  43. int wiki_id;
  44. int wiki_cat;
  45. char wiki_lang[10];
  46. char wiki_folder[10];
  47. } WIKI_LIST;
  48. typedef struct _WIKI_LICENSE_DRAW {
  49. char *buf;
  50. int lines;
  51. int link_count;
  52. ARTICLE_LINK links[MAX_LINKS_IN_LICENSE_TEXT];
  53. } WIKI_LICENSE_DRAW;
  54. extern int nCurrentWiki;
  55. bool wiki_lang_exist(char *lang_link_str);
  56. uint32_t wiki_lang_link_search(char *lang_link_str);
  57. void init_wiki_info(void);
  58. int get_wiki_count(void);
  59. char *get_nls_text(char *key);
  60. char *get_lang_link_display_text(char *lang_link_str);
  61. char *get_wiki_file_path(int nWikiIdx, char *file_name);
  62. char *get_wiki_name(int idx);
  63. void wiki_selection(void);
  64. void set_wiki(int idx);
  65. int get_wiki_idx_from_id(int wiki_id);
  66. int get_wiki_id_from_idx(int wiki_idx);
  67. WIKI_LICENSE_DRAW *wiki_license_draw(void);
  68. bool wiki_is_japanese();
  69. #endif