diff options
author | Yoshihisa Uchida <uchida@rockbox.org> | 2010-06-06 08:44:27 +0000 |
---|---|---|
committer | Yoshihisa Uchida <uchida@rockbox.org> | 2010-06-06 08:44:27 +0000 |
commit | 1445c3b8c5a88e5f6e5540c266ffb5ee5bf4a3f7 (patch) | |
tree | 9131d99016b0275d09dd97370868aa2a7f62270d | |
parent | e1a0e2cd7ae6337b8add4fd8c5c87924a94cf169 (diff) | |
download | rockbox-1445c3b8c5a88e5f6e5540c266ffb5ee5bf4a3f7.tar.gz rockbox-1445c3b8c5a88e5f6e5540c266ffb5ee5bf4a3f7.zip |
text viewer: can be selected the number of screens per page.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26613 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/plugins/text_viewer/readme.txt | 2 | ||||
-rw-r--r-- | apps/plugins/text_viewer/text_viewer.c | 8 | ||||
-rw-r--r-- | apps/plugins/text_viewer/tv_menu.c | 15 | ||||
-rw-r--r-- | apps/plugins/text_viewer/tv_preferences.c | 4 | ||||
-rw-r--r-- | apps/plugins/text_viewer/tv_preferences.h | 7 | ||||
-rw-r--r-- | apps/plugins/text_viewer/tv_settings.c | 112 | ||||
-rw-r--r-- | apps/plugins/text_viewer/tv_text_processor.c | 2 | ||||
-rw-r--r-- | apps/plugins/text_viewer/tv_window.c | 21 |
8 files changed, 84 insertions, 87 deletions
diff --git a/apps/plugins/text_viewer/readme.txt b/apps/plugins/text_viewer/readme.txt index f124370bdc..37ba354a71 100644 --- a/apps/plugins/text_viewer/readme.txt +++ b/apps/plugins/text_viewer/readme.txt | |||
@@ -44,8 +44,6 @@ TODO list | |||
44 | 44 | ||
45 | - add History feature. | 45 | - add History feature. |
46 | 46 | ||
47 | - when the WIDE screen, allow to specify the number of screens. | ||
48 | |||
49 | - when the line_mode is reflow, allow to specify indent spaces. | 47 | - when the line_mode is reflow, allow to specify indent spaces. |
50 | 48 | ||
51 | - for the horizontal scroll, allow the select scroll by screen/scroll by column for the settings menu. | 49 | - for the horizontal scroll, allow the select scroll by screen/scroll by column for the settings menu. |
diff --git a/apps/plugins/text_viewer/text_viewer.c b/apps/plugins/text_viewer/text_viewer.c index 7150498b56..452f7108a6 100644 --- a/apps/plugins/text_viewer/text_viewer.c +++ b/apps/plugins/text_viewer/text_viewer.c | |||
@@ -108,12 +108,12 @@ enum plugin_status plugin_start(const void* file) | |||
108 | 108 | ||
109 | case TV_SCREEN_LEFT: | 109 | case TV_SCREEN_LEFT: |
110 | case TV_SCREEN_LEFT | BUTTON_REPEAT: | 110 | case TV_SCREEN_LEFT | BUTTON_REPEAT: |
111 | if (prefs->view_mode == WIDE) | 111 | if (prefs->windows > 1) |
112 | { | 112 | { |
113 | /* Screen left */ | 113 | /* Screen left */ |
114 | tv_scroll_left(TV_HORIZONTAL_SCROLL_WINDOW); | 114 | tv_scroll_left(TV_HORIZONTAL_SCROLL_WINDOW); |
115 | } | 115 | } |
116 | else { /* prefs->view_mode == NARROW */ | 116 | else { /* prefs->windows == 1 */ |
117 | /* scroll to previous page */ | 117 | /* scroll to previous page */ |
118 | tv_scroll_up(TV_VERTICAL_SCROLL_PAGE); | 118 | tv_scroll_up(TV_VERTICAL_SCROLL_PAGE); |
119 | #if 0 | 119 | #if 0 |
@@ -125,12 +125,12 @@ enum plugin_status plugin_start(const void* file) | |||
125 | 125 | ||
126 | case TV_SCREEN_RIGHT: | 126 | case TV_SCREEN_RIGHT: |
127 | case TV_SCREEN_RIGHT | BUTTON_REPEAT: | 127 | case TV_SCREEN_RIGHT | BUTTON_REPEAT: |
128 | if (prefs->view_mode == WIDE) | 128 | if (prefs->windows > 1) |
129 | { | 129 | { |
130 | /* Screen right */ | 130 | /* Screen right */ |
131 | tv_scroll_right(TV_HORIZONTAL_SCROLL_WINDOW); | 131 | tv_scroll_right(TV_HORIZONTAL_SCROLL_WINDOW); |
132 | } | 132 | } |
133 | else { /* prefs->view_mode == NARROW */ | 133 | else { /* prefs->windows == 1 */ |
134 | /* scroll to next page */ | 134 | /* scroll to next page */ |
135 | tv_scroll_down(TV_VERTICAL_SCROLL_PAGE); | 135 | tv_scroll_down(TV_VERTICAL_SCROLL_PAGE); |
136 | #if 0 | 136 | #if 0 |
diff --git a/apps/plugins/text_viewer/tv_menu.c b/apps/plugins/text_viewer/tv_menu.c index f40afb8848..e62b2de4be 100644 --- a/apps/plugins/text_viewer/tv_menu.c +++ b/apps/plugins/text_viewer/tv_menu.c | |||
@@ -69,15 +69,10 @@ static bool tv_line_mode_setting(void) | |||
69 | sizeof(names) / sizeof(names[0]), NULL); | 69 | sizeof(names) / sizeof(names[0]), NULL); |
70 | } | 70 | } |
71 | 71 | ||
72 | static bool tv_view_mode_setting(void) | 72 | static bool tv_windows_setting(void) |
73 | { | 73 | { |
74 | static const struct opt_items names[] = { | 74 | return rb->set_int("Screens Per Page", "", UNIT_INT, |
75 | {"No (Narrow)", -1}, | 75 | &new_prefs.windows, NULL, 1, 1, 5, NULL); |
76 | {"Yes", -1}, | ||
77 | }; | ||
78 | |||
79 | return rb->set_option("Wide View", &new_prefs.view_mode, INT, | ||
80 | names , 2, NULL); | ||
81 | } | 76 | } |
82 | 77 | ||
83 | static bool tv_scroll_mode_setting(void) | 78 | static bool tv_scroll_mode_setting(void) |
@@ -272,7 +267,7 @@ MENUITEM_FUNCTION(word_wrap_item, 0, "Word Wrap", tv_word_wrap_setting, | |||
272 | NULL, NULL, Icon_NOICON); | 267 | NULL, NULL, Icon_NOICON); |
273 | MENUITEM_FUNCTION(line_mode_item, 0, "Line Mode", tv_line_mode_setting, | 268 | MENUITEM_FUNCTION(line_mode_item, 0, "Line Mode", tv_line_mode_setting, |
274 | NULL, NULL, Icon_NOICON); | 269 | NULL, NULL, Icon_NOICON); |
275 | MENUITEM_FUNCTION(view_mode_item, 0, "Wide View", tv_view_mode_setting, | 270 | MENUITEM_FUNCTION(windows_item, 0, "Screens Per Page", tv_windows_setting, |
276 | NULL, NULL, Icon_NOICON); | 271 | NULL, NULL, Icon_NOICON); |
277 | MENUITEM_FUNCTION(alignment_item, 0, "Alignment", tv_alignment_setting, | 272 | MENUITEM_FUNCTION(alignment_item, 0, "Alignment", tv_alignment_setting, |
278 | NULL, NULL, Icon_NOICON); | 273 | NULL, NULL, Icon_NOICON); |
@@ -293,7 +288,7 @@ MENUITEM_FUNCTION(scroll_mode_item, 0, "Scroll Mode", tv_scroll_mode_setting, | |||
293 | MENUITEM_FUNCTION(autoscroll_speed_item, 0, "Auto-Scroll Speed", | 288 | MENUITEM_FUNCTION(autoscroll_speed_item, 0, "Auto-Scroll Speed", |
294 | tv_autoscroll_speed_setting, NULL, NULL, Icon_NOICON); | 289 | tv_autoscroll_speed_setting, NULL, NULL, Icon_NOICON); |
295 | MAKE_MENU(option_menu, "Viewer Options", NULL, Icon_NOICON, | 290 | MAKE_MENU(option_menu, "Viewer Options", NULL, Icon_NOICON, |
296 | &encoding_item, &word_wrap_item, &line_mode_item, &view_mode_item, | 291 | &encoding_item, &word_wrap_item, &line_mode_item, &windows_item, |
297 | &alignment_item, | 292 | &alignment_item, |
298 | #ifdef HAVE_LCD_BITMAP | 293 | #ifdef HAVE_LCD_BITMAP |
299 | &scrollbar_item, &page_mode_item, &header_item, &footer_item, &font_item, | 294 | &scrollbar_item, &page_mode_item, &header_item, &footer_item, &font_item, |
diff --git a/apps/plugins/text_viewer/tv_preferences.c b/apps/plugins/text_viewer/tv_preferences.c index cd3560db93..777f6afdb9 100644 --- a/apps/plugins/text_viewer/tv_preferences.c +++ b/apps/plugins/text_viewer/tv_preferences.c | |||
@@ -46,7 +46,7 @@ static void tv_notify_change_preferences(const struct tv_preferences *oldp, | |||
46 | if ((oldp == NULL) || | 46 | if ((oldp == NULL) || |
47 | (oldp->word_mode != newp->word_mode) || | 47 | (oldp->word_mode != newp->word_mode) || |
48 | (oldp->line_mode != newp->line_mode) || | 48 | (oldp->line_mode != newp->line_mode) || |
49 | (oldp->view_mode != newp->view_mode) || | 49 | (oldp->windows != newp->windows) || |
50 | (oldp->scrollbar_mode != newp->scrollbar_mode) || | 50 | (oldp->scrollbar_mode != newp->scrollbar_mode) || |
51 | (oldp->encoding != newp->encoding) || | 51 | (oldp->encoding != newp->encoding) || |
52 | #ifdef HAVE_LCD_BITMAP | 52 | #ifdef HAVE_LCD_BITMAP |
@@ -91,7 +91,7 @@ void tv_set_default_preferences(struct tv_preferences *p) | |||
91 | { | 91 | { |
92 | p->word_mode = WRAP; | 92 | p->word_mode = WRAP; |
93 | p->line_mode = NORMAL; | 93 | p->line_mode = NORMAL; |
94 | p->view_mode = NARROW; | 94 | p->windows = 1; |
95 | p->alignment = LEFT; | 95 | p->alignment = LEFT; |
96 | p->scroll_mode = PAGE; | 96 | p->scroll_mode = PAGE; |
97 | p->page_mode = NO_OVERLAP; | 97 | p->page_mode = NO_OVERLAP; |
diff --git a/apps/plugins/text_viewer/tv_preferences.h b/apps/plugins/text_viewer/tv_preferences.h index 64ab0d102f..f74e3d7407 100644 --- a/apps/plugins/text_viewer/tv_preferences.h +++ b/apps/plugins/text_viewer/tv_preferences.h | |||
@@ -37,11 +37,6 @@ struct tv_preferences { | |||
37 | } line_mode; | 37 | } line_mode; |
38 | 38 | ||
39 | enum { | 39 | enum { |
40 | NARROW = 0, | ||
41 | WIDE, | ||
42 | } view_mode; | ||
43 | |||
44 | enum { | ||
45 | LEFT = 0, | 40 | LEFT = 0, |
46 | RIGHT, | 41 | RIGHT, |
47 | } alignment; | 42 | } alignment; |
@@ -79,6 +74,8 @@ struct tv_preferences { | |||
79 | 74 | ||
80 | int autoscroll_speed; | 75 | int autoscroll_speed; |
81 | 76 | ||
77 | int windows; | ||
78 | |||
82 | unsigned char font_name[MAX_PATH]; | 79 | unsigned char font_name[MAX_PATH]; |
83 | #ifdef HAVE_LCD_BITMAP | 80 | #ifdef HAVE_LCD_BITMAP |
84 | struct font *font; | 81 | struct font *font; |
diff --git a/apps/plugins/text_viewer/tv_settings.c b/apps/plugins/text_viewer/tv_settings.c index bb4ead7b5d..3b9a684b94 100644 --- a/apps/plugins/text_viewer/tv_settings.c +++ b/apps/plugins/text_viewer/tv_settings.c | |||
@@ -30,30 +30,31 @@ | |||
30 | * | 30 | * |
31 | * setting file format | 31 | * setting file format |
32 | * | 32 | * |
33 | * part byte count | 33 | * part byte count |
34 | * -------------------------------- | 34 | * ------------------------------- |
35 | * 'TVGS' 4 | 35 | * 'TVGS' 4 |
36 | * version 1 | 36 | * version 1 |
37 | * word_mode 1 | 37 | * word_mode 1 |
38 | * line_mode 1 | 38 | * line_mode 1 |
39 | * view_mode 1 | 39 | * windows 1 (when version <= 0x32, this value is view_mode) |
40 | * alignment 1 | 40 | * alignment 1 |
41 | * encoding 1 | 41 | * encoding 1 |
42 | * scrollbar_mode 1 | 42 | * scrollbar_mode 1 |
43 | * (unused) 1 (for compatibility) | 43 | * (unused) 1 (for compatibility) |
44 | * page_mode 1 | 44 | * page_mode 1 |
45 | * page_number_mode 1 | 45 | * page_number_mode 1 |
46 | * title_mode 1 | 46 | * title_mode 1 |
47 | * scroll_mode 1 | 47 | * scroll_mode 1 |
48 | * autoscroll_speed 1 | 48 | * autoscroll_speed 1 |
49 | * font name MAX_PATH | 49 | * (reserved) 16 |
50 | * font name MAX_PATH | ||
50 | */ | 51 | */ |
51 | 52 | ||
52 | #define VIEWER_GLOBAL_SETTINGS_FILE VIEWERS_DIR "/viewer.dat" | 53 | #define VIEWER_GLOBAL_SETTINGS_FILE VIEWERS_DIR "/viewer.dat" |
53 | #define TV_GLOBAL_SETTINGS_FILE VIEWERS_DIR "/tv_global.dat" | 54 | #define TV_GLOBAL_SETTINGS_FILE VIEWERS_DIR "/tv_global.dat" |
54 | 55 | ||
55 | #define TV_GLOBAL_SETTINGS_HEADER "\x54\x56\x47\x53" /* "TVGS" */ | 56 | #define TV_GLOBAL_SETTINGS_HEADER "\x54\x56\x47\x53" /* "TVGS" */ |
56 | #define TV_GLOBAL_SETTINGS_VERSION 0x32 | 57 | #define TV_GLOBAL_SETTINGS_VERSION 0x33 |
57 | #define TV_GLOBAL_SETTINGS_HEADER_SIZE 5 | 58 | #define TV_GLOBAL_SETTINGS_HEADER_SIZE 5 |
58 | #define TV_GLOBAL_SETTINGS_FIRST_VERSION 0x31 | 59 | #define TV_GLOBAL_SETTINGS_FIRST_VERSION 0x31 |
59 | 60 | ||
@@ -62,34 +63,35 @@ | |||
62 | * | 63 | * |
63 | * setting file format | 64 | * setting file format |
64 | * | 65 | * |
65 | * part byte count | 66 | * part byte count |
66 | * -------------------------------- | 67 | * ----------------------------------- |
67 | * 'TVS' 3 | 68 | * 'TVS' 3 |
68 | * version 1 | 69 | * version 1 |
69 | * file count 2 | 70 | * file count 2 |
70 | * [1st file] | 71 | * [1st file] |
71 | * file path MAX_PATH | 72 | * file path MAX_PATH |
72 | * next file pos 2 (prefences size + bookmark count * bookmark size + 1) | 73 | * next file pos 2 (prefences size + bookmark count * bookmark size + 1) |
73 | * [preferences] | 74 | * [preferences] |
74 | * word_mode 1 | 75 | * word_mode 1 |
75 | * line_mode 1 | 76 | * line_mode 1 |
76 | * view_mode 1 | 77 | * windows 1 (when version <= 0x33, this value is view_mode) |
77 | * alignment 1 | 78 | * alignment 1 |
78 | * encoding 1 | 79 | * encoding 1 |
79 | * scrollbar_mode 1 | 80 | * scrollbar_mode 1 |
80 | * (unused) 1 (for compatibility) | 81 | * (unused) 1 (for compatibility) |
81 | * page_mode 1 | 82 | * page_mode 1 |
82 | * header_mode 1 | 83 | * header_mode 1 |
83 | * footer_mode 1 | 84 | * footer_mode 1 |
84 | * scroll_mode 1 | 85 | * scroll_mode 1 |
85 | * autoscroll_speed 1 | 86 | * autoscroll_speed 1 |
86 | * font name MAX_PATH | 87 | * (reserved) 16 |
87 | * bookmark count 1 | 88 | * font name MAX_PATH |
89 | * bookmark count 1 | ||
88 | * [1st bookmark] | 90 | * [1st bookmark] |
89 | * file_position 4 | 91 | * file_position 4 |
90 | * page 2 | 92 | * page 2 |
91 | * line 1 | 93 | * line 1 |
92 | * flag 1 | 94 | * flag 1 |
93 | * [2nd bookmark] | 95 | * [2nd bookmark] |
94 | * ... | 96 | * ... |
95 | * [last bookmark] | 97 | * [last bookmark] |
@@ -104,11 +106,11 @@ | |||
104 | #define TV_SETTINGS_TMP_FILE VIEWERS_DIR "/tv_file.tmp" | 106 | #define TV_SETTINGS_TMP_FILE VIEWERS_DIR "/tv_file.tmp" |
105 | 107 | ||
106 | #define TV_SETTINGS_HEADER "\x54\x56\x53" /* "TVS" */ | 108 | #define TV_SETTINGS_HEADER "\x54\x56\x53" /* "TVS" */ |
107 | #define TV_SETTINGS_VERSION 0x33 | 109 | #define TV_SETTINGS_VERSION 0x34 |
108 | #define TV_SETTINGS_HEADER_SIZE 4 | 110 | #define TV_SETTINGS_HEADER_SIZE 4 |
109 | #define TV_SETTINGS_FIRST_VERSION 0x32 | 111 | #define TV_SETTINGS_FIRST_VERSION 0x32 |
110 | 112 | ||
111 | #define TV_PREFERENCES_SIZE (12 + MAX_PATH) | 113 | #define TV_PREFERENCES_SIZE (28 + MAX_PATH) |
112 | 114 | ||
113 | /* ---------------------------------------------------------------------------- | 115 | /* ---------------------------------------------------------------------------- |
114 | * read/write the preferences | 116 | * read/write the preferences |
@@ -122,18 +124,25 @@ static bool tv_read_preferences(int pfd, int version, struct tv_preferences *pre | |||
122 | int read_size = TV_PREFERENCES_SIZE; | 124 | int read_size = TV_PREFERENCES_SIZE; |
123 | 125 | ||
124 | if (version == 0) | 126 | if (version == 0) |
125 | read_size--; | 127 | read_size -= 17; |
128 | else if (version == 1) | ||
129 | read_size -= 16; | ||
126 | 130 | ||
127 | if (rb->read(pfd, buf, read_size) < 0) | 131 | if (rb->read(pfd, buf, read_size) < 0) |
128 | return false; | 132 | return false; |
129 | 133 | ||
130 | prefs->word_mode = *p++; | 134 | prefs->word_mode = *p++; |
131 | prefs->line_mode = *p++; | 135 | prefs->line_mode = *p++; |
132 | prefs->view_mode = *p++; | 136 | |
137 | prefs->windows = *p++; | ||
138 | if (version <= 1) | ||
139 | prefs->windows++; | ||
140 | |||
133 | if (version > 0) | 141 | if (version > 0) |
134 | prefs->alignment = *p++; | 142 | prefs->alignment = *p++; |
135 | else | 143 | else |
136 | prefs->alignment = LEFT; | 144 | prefs->alignment = LEFT; |
145 | |||
137 | prefs->encoding = *p++; | 146 | prefs->encoding = *p++; |
138 | prefs->scrollbar_mode = *p++; | 147 | prefs->scrollbar_mode = *p++; |
139 | /* skip need_scrollbar */ | 148 | /* skip need_scrollbar */ |
@@ -143,7 +152,9 @@ static bool tv_read_preferences(int pfd, int version, struct tv_preferences *pre | |||
143 | prefs->footer_mode = *p++; | 152 | prefs->footer_mode = *p++; |
144 | prefs->scroll_mode = *p++; | 153 | prefs->scroll_mode = *p++; |
145 | prefs->autoscroll_speed = *p++; | 154 | prefs->autoscroll_speed = *p++; |
146 | rb->memcpy(prefs->font_name, p, MAX_PATH); | 155 | |
156 | rb->memcpy(prefs->font_name, buf + read_size - MAX_PATH, MAX_PATH); | ||
157 | |||
147 | #ifdef HAVE_LCD_BITMAP | 158 | #ifdef HAVE_LCD_BITMAP |
148 | prefs->font = rb->font_get(FONT_UI); | 159 | prefs->font = rb->font_get(FONT_UI); |
149 | #endif | 160 | #endif |
@@ -158,7 +169,7 @@ static bool tv_write_preferences(int pfd, const struct tv_preferences *prefs) | |||
158 | 169 | ||
159 | *p++ = prefs->word_mode; | 170 | *p++ = prefs->word_mode; |
160 | *p++ = prefs->line_mode; | 171 | *p++ = prefs->line_mode; |
161 | *p++ = prefs->view_mode; | 172 | *p++ = prefs->windows; |
162 | *p++ = prefs->alignment; | 173 | *p++ = prefs->alignment; |
163 | *p++ = prefs->encoding; | 174 | *p++ = prefs->encoding; |
164 | *p++ = prefs->scrollbar_mode; | 175 | *p++ = prefs->scrollbar_mode; |
@@ -169,7 +180,8 @@ static bool tv_write_preferences(int pfd, const struct tv_preferences *prefs) | |||
169 | *p++ = prefs->footer_mode; | 180 | *p++ = prefs->footer_mode; |
170 | *p++ = prefs->scroll_mode; | 181 | *p++ = prefs->scroll_mode; |
171 | *p++ = prefs->autoscroll_speed; | 182 | *p++ = prefs->autoscroll_speed; |
172 | rb->memcpy(p, prefs->font_name, MAX_PATH); | 183 | |
184 | rb->memcpy(buf + 28, prefs->font_name, MAX_PATH); | ||
173 | 185 | ||
174 | return (rb->write(pfd, buf, TV_PREFERENCES_SIZE) >= 0); | 186 | return (rb->write(pfd, buf, TV_PREFERENCES_SIZE) >= 0); |
175 | } | 187 | } |
diff --git a/apps/plugins/text_viewer/tv_text_processor.c b/apps/plugins/text_viewer/tv_text_processor.c index 8cdd78df15..f99bfdfd4e 100644 --- a/apps/plugins/text_viewer/tv_text_processor.c +++ b/apps/plugins/text_viewer/tv_text_processor.c | |||
@@ -39,7 +39,7 @@ enum tv_text_type { | |||
39 | #define TV_MAX_CHARS_PER_BLOCK (LCD_WIDTH + 1) | 39 | #define TV_MAX_CHARS_PER_BLOCK (LCD_WIDTH + 1) |
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | #define TV_MAX_BLOCKS 2 | 42 | #define TV_MAX_BLOCKS 5 |
43 | 43 | ||
44 | /* | 44 | /* |
45 | * number of spaces to indent first paragraph | 45 | * number of spaces to indent first paragraph |
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 | { |