diff options
| author | Rafaël Carré <rafael.carre@gmail.com> | 2010-06-20 21:53:47 +0000 |
|---|---|---|
| committer | Rafaël Carré <rafael.carre@gmail.com> | 2010-06-20 21:53:47 +0000 |
| commit | 298316d19297eea82869b63235b535e5904fc0dd (patch) | |
| tree | 0426e9c8cecac7532a88888e78e5e54ea9bb6145 /apps/plugins/text_viewer/text_viewer.c | |
| parent | 17a2f9d8d2dfddd8d2d81ff638e21302efef1c8e (diff) | |
| download | rockbox-298316d19297eea82869b63235b535e5904fc0dd.zip rockbox-298316d19297eea82869b63235b535e5904fc0dd.tar.gz rockbox-298316d19297eea82869b63235b535e5904fc0dd.tar.bz2 rockbox-298316d19297eea82869b63235b535e5904fc0dd.tar.xz | |
text_viewer: cleanup & bugfix
cleanup:
- don't use enum in struct / return values
- don't use a getter for preferences but a global pointer
- explicitely make enums start at 0
- use static tables for header/footer settings
- remove unneeded memset before strlcpy
- use static buffer allocation, not dynamic
- check header/footer preferences before using the callbacks
- don't include font filename in archos player preferences (break
file format)
bugfix:
- statically allocate old preferences in tv_set_preferences()
Sometimes I can read a file on Clipv2, but it still aborts quite often
refs: FS#11399
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26998 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/text_viewer/text_viewer.c')
| -rw-r--r-- | apps/plugins/text_viewer/text_viewer.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/apps/plugins/text_viewer/text_viewer.c b/apps/plugins/text_viewer/text_viewer.c index fae2f07..4817710 100644 --- a/apps/plugins/text_viewer/text_viewer.c +++ b/apps/plugins/text_viewer/text_viewer.c @@ -35,7 +35,6 @@ enum plugin_status plugin_start(const void* file) long old_tick; bool done = false; bool display_update = true; - const struct tv_preferences *prefs = tv_get_preferences(); old_tick = *rb->current_tick; @@ -66,7 +65,7 @@ enum plugin_status plugin_start(const void* file) case TV_MENU2: #endif { - enum tv_menu_result res = tv_menu(); + unsigned res = tv_menu(); if (res != TV_MENU_RESULT_EXIT_MENU) { @@ -108,13 +107,13 @@ enum plugin_status plugin_start(const void* file) case TV_SCREEN_LEFT: case TV_SCREEN_LEFT | BUTTON_REPEAT: - if (prefs->windows > 1) + if (preferences->windows > 1) { /* Screen left */ tv_scroll_left(TV_HORIZONTAL_SCROLL_PREFS); } else { /* prefs->windows == 1 */ - if (prefs->narrow_mode == NM_PAGE) + if (preferences->narrow_mode == NM_PAGE) { /* scroll to previous page */ tv_scroll_up(TV_VERTICAL_SCROLL_PAGE); @@ -129,13 +128,13 @@ enum plugin_status plugin_start(const void* file) case TV_SCREEN_RIGHT: case TV_SCREEN_RIGHT | BUTTON_REPEAT: - if (prefs->windows > 1) + if (preferences->windows > 1) { /* Screen right */ tv_scroll_right(TV_HORIZONTAL_SCROLL_PREFS); } else { /* prefs->windows == 1 */ - if (prefs->narrow_mode == NM_PAGE) + if (preferences->narrow_mode == NM_PAGE) { /* scroll to next page */ tv_scroll_down(TV_VERTICAL_SCROLL_PAGE); @@ -206,7 +205,7 @@ enum plugin_status plugin_start(const void* file) } if (autoscroll) { - if(old_tick <= *rb->current_tick - (110 - prefs->autoscroll_speed * 10)) + if(old_tick <= *rb->current_tick - (110 - preferences->autoscroll_speed * 10)) { tv_scroll_down(TV_VERTICAL_SCROLL_PREFS); old_tick = *rb->current_tick; |