diff options
Diffstat (limited to 'apps/plugins/text_viewer/tv_display.c')
-rw-r--r-- | apps/plugins/text_viewer/tv_display.c | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/apps/plugins/text_viewer/tv_display.c b/apps/plugins/text_viewer/tv_display.c index 78b5b4b074..253bb0b222 100644 --- a/apps/plugins/text_viewer/tv_display.c +++ b/apps/plugins/text_viewer/tv_display.c | |||
@@ -48,14 +48,12 @@ | |||
48 | * |statusbar (6) | | 48 | * |statusbar (6) | |
49 | * +-------------------------+ | 49 | * +-------------------------+ |
50 | * | 50 | * |
51 | * (1) displays when rb->global_settings->statusbar == STATUSBAR_TOP | 51 | * (1) displays when rb->global_settings->statusbar == STATUSBAR_TOP. |
52 | * and preferences->header_mode is HD_SBAR or HD_BOTH. | 52 | * (2) displays when preferences->header_mode is HD_PATH. |
53 | * (2) displays when preferences->header_mode is HD_PATH or HD_BOTH. | ||
54 | * (3) displays when preferences->vertical_scrollbar is SB_ON. | 53 | * (3) displays when preferences->vertical_scrollbar is SB_ON. |
55 | * (4) displays when preferences->horizontal_scrollbar is SB_ON. | 54 | * (4) displays when preferences->horizontal_scrollbar is SB_ON. |
56 | * (5) displays when preferences->footer_mode is FT_PAGE or FT_BOTH. | 55 | * (5) displays when preferences->footer_mode is FT_PAGE. |
57 | * (6) displays when rb->global_settings->statusbar == STATUSBAR_BOTTOM | 56 | * (6) displays when rb->global_settings->statusbar == STATUSBAR_BOTTOM. |
58 | * and preferences->footer_mode is FT_SBAR or FT_BOTH. | ||
59 | * | 57 | * |
60 | * | 58 | * |
61 | * when isn't defined HAVE_LCD_BITMAP | 59 | * when isn't defined HAVE_LCD_BITMAP |
@@ -115,7 +113,7 @@ void tv_show_header(void) | |||
115 | { | 113 | { |
116 | unsigned header_mode = header_mode; | 114 | unsigned header_mode = header_mode; |
117 | 115 | ||
118 | if (preferences->header_mode == HD_PATH || preferences->header_mode == HD_BOTH) | 116 | if (preferences->header_mode == HD_PATH) |
119 | display->putsxy(header.x, header.y, preferences->file_name); | 117 | display->putsxy(header.x, header.y, preferences->file_name); |
120 | } | 118 | } |
121 | 119 | ||
@@ -124,13 +122,13 @@ void tv_show_footer(const struct tv_screen_pos *pos) | |||
124 | unsigned char buf[12]; | 122 | unsigned char buf[12]; |
125 | unsigned footer_mode = preferences->footer_mode; | 123 | unsigned footer_mode = preferences->footer_mode; |
126 | 124 | ||
127 | if (footer_mode == FT_PAGE || footer_mode == FT_BOTH) | 125 | if (footer_mode == FT_PAGE) |
128 | { | 126 | { |
129 | if (pos->line == 0) | 127 | if (pos->line == 0) |
130 | rb->snprintf(buf, sizeof(buf), "%d", pos->page + 1); | 128 | rb->snprintf(buf, sizeof(buf), "%d", pos->page + 1); |
131 | else | 129 | else |
132 | rb->snprintf(buf, sizeof(buf), "%d - %d", pos->page + 1, pos->page + 2); | 130 | rb->snprintf(buf, sizeof(buf), "%d - %d", pos->page + 1, pos->page + 2); |
133 | display->putsxy(footer.x, footer.y, buf); | 131 | display->putsxy(footer.x, footer.y + 1, buf); |
134 | } | 132 | } |
135 | } | 133 | } |
136 | 134 | ||
@@ -153,7 +151,7 @@ void tv_show_scrollbar(int window, int col, off_t cur_pos, int size) | |||
153 | max_shown = min_shown + display_columns; | 151 | max_shown = min_shown + display_columns; |
154 | 152 | ||
155 | rb->gui_scrollbar_draw(display, | 153 | rb->gui_scrollbar_draw(display, |
156 | horizontal_scrollbar.x, horizontal_scrollbar.y, | 154 | horizontal_scrollbar.x, horizontal_scrollbar.y + 1, |
157 | horizontal_scrollbar.w, TV_SCROLLBAR_HEIGHT, | 155 | horizontal_scrollbar.w, TV_SCROLLBAR_HEIGHT, |
158 | items, min_shown, max_shown, HORIZONTAL); | 156 | items, min_shown, max_shown, HORIZONTAL); |
159 | } | 157 | } |
@@ -166,7 +164,7 @@ void tv_show_scrollbar(int window, int col, off_t cur_pos, int size) | |||
166 | 164 | ||
167 | rb->gui_scrollbar_draw(display, | 165 | rb->gui_scrollbar_draw(display, |
168 | vertical_scrollbar.x, vertical_scrollbar.y, | 166 | vertical_scrollbar.x, vertical_scrollbar.y, |
169 | TV_SCROLLBAR_WIDTH-1, vertical_scrollbar.h, | 167 | TV_SCROLLBAR_WIDTH, vertical_scrollbar.h, |
170 | items, min_shown, max_shown, VERTICAL); | 168 | items, min_shown, max_shown, VERTICAL); |
171 | } | 169 | } |
172 | } | 170 | } |
@@ -236,6 +234,7 @@ void tv_end_display(void) | |||
236 | 234 | ||
237 | void tv_clear_display(void) | 235 | void tv_clear_display(void) |
238 | { | 236 | { |
237 | rb->lcd_set_backdrop(NULL); | ||
239 | display->clear_viewport(); | 238 | display->clear_viewport(); |
240 | } | 239 | } |
241 | 240 | ||
@@ -251,22 +250,20 @@ void tv_set_layout(int col_w) | |||
251 | #endif | 250 | #endif |
252 | { | 251 | { |
253 | #ifdef HAVE_LCD_BITMAP | 252 | #ifdef HAVE_LCD_BITMAP |
254 | int scrollbar_width = (show_scrollbar)? TV_SCROLLBAR_WIDTH : 0; | 253 | int scrollbar_width = (show_scrollbar)? TV_SCROLLBAR_WIDTH + 1 : 0; |
255 | int scrollbar_height = (preferences->horizontal_scrollbar)? TV_SCROLLBAR_HEIGHT : 0; | 254 | int scrollbar_height = (preferences->horizontal_scrollbar)? TV_SCROLLBAR_HEIGHT + 1 : 0; |
256 | unsigned header_mode = preferences->header_mode; | ||
257 | unsigned footer_mode = preferences->footer_mode; | ||
258 | 255 | ||
259 | row_height = preferences->font->height; | 256 | row_height = preferences->font->height; |
260 | 257 | ||
261 | header.x = 0; | 258 | header.x = 0; |
262 | header.y = 0; | 259 | header.y = 1; |
263 | header.w = vp_info.width; | 260 | header.w = vp_info.width; |
264 | header.h = (header_mode == HD_PATH || header_mode == HD_BOTH)? row_height : 0; | 261 | header.h = (preferences->header_mode == HD_PATH)? row_height + 1 : 0; |
265 | 262 | ||
266 | footer.x = 0; | 263 | footer.x = 0; |
267 | footer.w = vp_info.width; | 264 | footer.w = vp_info.width; |
268 | footer.h = (footer_mode == FT_PAGE || footer_mode == FT_BOTH)? row_height : 0; | 265 | footer.h = (preferences->footer_mode == FT_PAGE)? row_height + 1 : 0; |
269 | footer.y = vp_info.height - footer.h; | 266 | footer.y = vp_info.height - 1 - footer.h; |
270 | 267 | ||
271 | drawarea.x = scrollbar_width; | 268 | drawarea.x = scrollbar_width; |
272 | drawarea.y = header.y + header.h; | 269 | drawarea.y = header.y + header.h; |
@@ -312,17 +309,13 @@ void tv_change_viewport(void) | |||
312 | { | 309 | { |
313 | #ifdef HAVE_LCD_BITMAP | 310 | #ifdef HAVE_LCD_BITMAP |
314 | struct viewport vp; | 311 | struct viewport vp; |
315 | bool show_statusbar = (preferences->header_mode == HD_SBAR || | ||
316 | preferences->header_mode == HD_BOTH || | ||
317 | preferences->footer_mode == FT_SBAR || | ||
318 | preferences->footer_mode == FT_BOTH); | ||
319 | 312 | ||
320 | if (is_initialized_vp) | 313 | if (is_initialized_vp) |
321 | tv_undo_viewport(); | 314 | tv_undo_viewport(); |
322 | else | 315 | else |
323 | is_initialized_vp = true; | 316 | is_initialized_vp = true; |
324 | 317 | ||
325 | rb->viewportmanager_theme_enable(SCREEN_MAIN, show_statusbar, &vp); | 318 | rb->viewportmanager_theme_enable(SCREEN_MAIN, preferences->statusbar, &vp); |
326 | vp_info = vp; | 319 | vp_info = vp; |
327 | vp_info.flags &= ~VP_FLAG_ALIGNMENT_MASK; | 320 | vp_info.flags &= ~VP_FLAG_ALIGNMENT_MASK; |
328 | 321 | ||