history.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright (c) 2009 Openmoko Inc.
  3. *
  4. * Authors Holger Hans Peter Freyther <zecke@openmoko.org>
  5. * Matt Hsu <matt_hsu@openmoko.org>
  6. *
  7. * This program is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #ifndef WL_HISTORY_H
  21. #define WL_HISTORY_H
  22. #include <inttypes.h>
  23. #include "search.h"
  24. #define HISTORY_RESULT_START 31
  25. //#define HISTORY_RESULT_HEIGHT 10
  26. #define HISTORY_RESULT_HEIGHT 19
  27. #define MAX_HISTORY 256
  28. #define HISTORY_PIXEL_START (HISTORY_RESULT_START - HISTORY_RESULT_HEIGHT + 2)
  29. /*
  30. * Interface for the History feature
  31. */
  32. void history_clear(void);
  33. void history_add(long idx_article, const char *title, int b_keep_pos);
  34. unsigned int history_get_count();
  35. void history_list_init(void);
  36. int history_list_save(int level);
  37. void history_open_article(int new_selection);
  38. void history_reload();
  39. void history_log_y_pos(const long y_pos);
  40. void history_set_y_pos(const long idx_article);
  41. long history_get_y_pos();
  42. void draw_clear_history(int bFlag);
  43. long history_get_previous_idx(long current_idx_article, int b_drop_from_list);
  44. typedef struct __attribute__ ((packed)) _HISTORY {
  45. int32_t idx_article;
  46. int32_t last_y_pos;
  47. char title[MAX_TITLE_ACTUAL];
  48. } HISTORY;
  49. enum history_save_e {
  50. HISTORY_SAVE_NONE,
  51. HISTORY_SAVE_POWER_OFF,
  52. HISTORY_SAVE_NORMAL,
  53. };
  54. #endif