diff options
Diffstat (limited to 'apps/plugins/text_viewer/tv_window.c')
-rw-r--r-- | apps/plugins/text_viewer/tv_window.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/apps/plugins/text_viewer/tv_window.c b/apps/plugins/text_viewer/tv_window.c index 43a24ca4bc..bf27e2cfd5 100644 --- a/apps/plugins/text_viewer/tv_window.c +++ b/apps/plugins/text_viewer/tv_window.c | |||
@@ -27,8 +27,6 @@ | |||
27 | #include "tv_text_reader.h" | 27 | #include "tv_text_reader.h" |
28 | #include "tv_window.h" | 28 | #include "tv_window.h" |
29 | 29 | ||
30 | #define TV_WINDOWS_PER_SCREEN 2 | ||
31 | |||
32 | #define TV_SCROLLBAR_WIDTH rb->global_settings->scrollbar_width | 30 | #define TV_SCROLLBAR_WIDTH rb->global_settings->scrollbar_width |
33 | 31 | ||
34 | #ifndef HAVE_LCD_BITMAP | 32 | #ifndef HAVE_LCD_BITMAP |
@@ -48,8 +46,6 @@ static int window_width; | |||
48 | static int window_columns; | 46 | static int window_columns; |
49 | static int col_width; | 47 | static int col_width; |
50 | 48 | ||
51 | static int max_windows; | ||
52 | |||
53 | static int cur_window; | 49 | static int cur_window; |
54 | static int cur_column; | 50 | static int cur_column; |
55 | 51 | ||
@@ -204,7 +200,7 @@ void tv_draw_window(void) | |||
204 | int offset = cur_column * col_width; | 200 | int offset = cur_column * col_width; |
205 | int size = 0; | 201 | int size = 0; |
206 | int line_width; | 202 | int line_width; |
207 | int draw_width = (max_windows - cur_window) * LCD_WIDTH - offset; | 203 | int draw_width = (prefs->windows - cur_window) * LCD_WIDTH - offset; |
208 | int dx = start_width - offset; | 204 | int dx = start_width - offset; |
209 | 205 | ||
210 | tv_copy_screen_pos(&pos); | 206 | tv_copy_screen_pos(&pos); |
@@ -213,7 +209,7 @@ void tv_draw_window(void) | |||
213 | if (prefs->alignment == LEFT) | 209 | if (prefs->alignment == LEFT) |
214 | tv_read_start(cur_window, (cur_column > 0)); | 210 | tv_read_start(cur_window, (cur_column > 0)); |
215 | else | 211 | else |
216 | tv_read_start(0, prefs->view_mode == WIDE); | 212 | tv_read_start(0, prefs->windows > 1); |
217 | 213 | ||
218 | for (line = 0; line < display_lines; line++) | 214 | for (line = 0; line < display_lines; line++) |
219 | { | 215 | { |
@@ -313,8 +309,7 @@ static void tv_change_preferences(const struct tv_preferences *oldp) | |||
313 | col_width = 1; | 309 | col_width = 1; |
314 | #endif | 310 | #endif |
315 | 311 | ||
316 | max_windows = (prefs->view_mode == NARROW)? 1: TV_WINDOWS_PER_SCREEN; | 312 | if (cur_window >= prefs->windows) |
317 | if (cur_window >= max_windows) | ||
318 | cur_window = 0; | 313 | cur_window = 0; |
319 | 314 | ||
320 | window_width = LCD_WIDTH; | 315 | window_width = LCD_WIDTH; |
@@ -322,7 +317,7 @@ static void tv_change_preferences(const struct tv_preferences *oldp) | |||
322 | need_scrollbar = false; | 317 | need_scrollbar = false; |
323 | start_width = 0; | 318 | start_width = 0; |
324 | tv_seek_top(); | 319 | tv_seek_top(); |
325 | tv_set_read_conditions(max_windows, window_width); | 320 | tv_set_read_conditions(prefs->windows, window_width); |
326 | if (tv_traverse_lines() && prefs->scrollbar_mode) | 321 | if (tv_traverse_lines() && prefs->scrollbar_mode) |
327 | { | 322 | { |
328 | need_scrollbar = true; | 323 | need_scrollbar = true; |
@@ -337,7 +332,7 @@ static void tv_change_preferences(const struct tv_preferences *oldp) | |||
337 | 332 | ||
338 | cur_column = 0; | 333 | cur_column = 0; |
339 | 334 | ||
340 | tv_set_read_conditions(max_windows, window_width); | 335 | tv_set_read_conditions(prefs->windows, window_width); |
341 | } | 336 | } |
342 | 337 | ||
343 | bool tv_init_window(unsigned char *buf, size_t bufsize, size_t *used_size) | 338 | bool tv_init_window(unsigned char *buf, size_t bufsize, size_t *used_size) |
@@ -365,9 +360,9 @@ void tv_move_window(int window_delta, int column_delta) | |||
365 | cur_window = 0; | 360 | cur_window = 0; |
366 | cur_column = 0; | 361 | cur_column = 0; |
367 | } | 362 | } |
368 | else if (cur_window >= max_windows) | 363 | else if (cur_window >= prefs->windows) |
369 | { | 364 | { |
370 | cur_window = max_windows - 1; | 365 | cur_window = prefs->windows - 1; |
371 | cur_column = 0; | 366 | cur_column = 0; |
372 | } | 367 | } |
373 | 368 | ||
@@ -383,7 +378,7 @@ void tv_move_window(int window_delta, int column_delta) | |||
383 | } | 378 | } |
384 | else | 379 | else |
385 | { | 380 | { |
386 | if (cur_window == max_windows - 1) | 381 | if (cur_window == prefs->windows - 1) |
387 | cur_column = 0; | 382 | cur_column = 0; |
388 | else if (cur_column >= window_columns) | 383 | else if (cur_column >= window_columns) |
389 | { | 384 | { |