summaryrefslogtreecommitdiff
path: root/apps/plugins/text_viewer/tv_display.c
diff options
context:
space:
mode:
authorYoshihisa Uchida <uchida@rockbox.org>2010-07-01 11:31:28 +0000
committerYoshihisa Uchida <uchida@rockbox.org>2010-07-01 11:31:28 +0000
commitea0960801264cc78407dbdfaa64018a76ba5d61f (patch)
tree58df28ee9f0fd20d8303382975b6c7a19dca2450 /apps/plugins/text_viewer/tv_display.c
parentaa1a126772609033ee6f16c11bafcf2f3890fa41 (diff)
downloadrockbox-ea0960801264cc78407dbdfaa64018a76ba5d61f.tar.gz
rockbox-ea0960801264cc78407dbdfaa64018a76ba5d61f.zip
text viewer:
- if the file fits on one screen, there is no horizontal scrollbar. - the callback function in tv_reader doesn't do useless processing when the preferences changes. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27212 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/text_viewer/tv_display.c')
-rw-r--r--apps/plugins/text_viewer/tv_display.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/apps/plugins/text_viewer/tv_display.c b/apps/plugins/text_viewer/tv_display.c
index 7c6fdcb760..8cf7e11419 100644
--- a/apps/plugins/text_viewer/tv_display.c
+++ b/apps/plugins/text_viewer/tv_display.c
@@ -100,6 +100,7 @@ static struct tv_rect bookmark;
100#endif 100#endif
101static struct tv_rect drawarea; 101static struct tv_rect drawarea;
102 102
103static bool show_horizontal_scrollbar;
103static bool show_vertical_scrollbar; 104static bool show_vertical_scrollbar;
104 105
105static int display_columns; 106static int display_columns;
@@ -138,7 +139,7 @@ static void tv_show_scrollbar(int window, int col, off_t cur_pos, int size)
138 int min_shown; 139 int min_shown;
139 int max_shown; 140 int max_shown;
140 141
141 if (preferences->horizontal_scrollbar) 142 if (show_horizontal_scrollbar)
142 { 143 {
143 items = preferences->windows * display_columns; 144 items = preferences->windows * display_columns;
144 min_shown = window * display_columns + col; 145 min_shown = window * display_columns + col;
@@ -168,7 +169,8 @@ static void tv_show_scrollbar(int window, int col, off_t cur_pos, int size)
168void tv_init_scrollbar(off_t total, bool show_scrollbar) 169void tv_init_scrollbar(off_t total, bool show_scrollbar)
169{ 170{
170 totalsize = total; 171 totalsize = total;
171 show_vertical_scrollbar = show_scrollbar; 172 show_horizontal_scrollbar = (show_scrollbar && preferences->horizontal_scrollbar);
173 show_vertical_scrollbar = (show_scrollbar && preferences->vertical_scrollbar);
172} 174}
173 175
174void tv_show_bookmarks(const int *rows, int count) 176void tv_show_bookmarks(const int *rows, int count)
@@ -251,8 +253,10 @@ void tv_end_display(void)
251void tv_set_layout(bool show_scrollbar) 253void tv_set_layout(bool show_scrollbar)
252{ 254{
253#ifdef HAVE_LCD_BITMAP 255#ifdef HAVE_LCD_BITMAP
254 int scrollbar_width = (show_scrollbar)? TV_SCROLLBAR_WIDTH + 1 : 0; 256 int scrollbar_width = (show_scrollbar && preferences->vertical_scrollbar)?
255 int scrollbar_height = (preferences->horizontal_scrollbar)? TV_SCROLLBAR_HEIGHT + 1 : 0; 257 TV_SCROLLBAR_WIDTH + 1 : 0;
258 int scrollbar_height = (show_scrollbar && preferences->horizontal_scrollbar)?
259 TV_SCROLLBAR_HEIGHT + 1 : 0;
256 260
257 row_height = preferences->font->height; 261 row_height = preferences->font->height;
258 262