diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/plugins/text_viewer/tv_display.c | 41 | ||||
-rw-r--r-- | apps/plugins/text_viewer/tv_menu.c | 25 | ||||
-rw-r--r-- | apps/plugins/text_viewer/tv_preferences.c | 7 | ||||
-rw-r--r-- | apps/plugins/text_viewer/tv_preferences.h | 6 | ||||
-rw-r--r-- | apps/plugins/text_viewer/tv_settings.c | 48 | ||||
-rw-r--r-- | apps/plugins/text_viewer/tv_window.c | 44 |
6 files changed, 82 insertions, 89 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 | ||
diff --git a/apps/plugins/text_viewer/tv_menu.c b/apps/plugins/text_viewer/tv_menu.c index c90386aabc..2e3a26d785 100644 --- a/apps/plugins/text_viewer/tv_menu.c +++ b/apps/plugins/text_viewer/tv_menu.c | |||
@@ -223,13 +223,10 @@ static bool tv_header_setting(void) | |||
223 | { | 223 | { |
224 | {"None", -1}, | 224 | {"None", -1}, |
225 | {"File path", -1}, | 225 | {"File path", -1}, |
226 | {"Status bar", -1}, | ||
227 | {"Both", -1}, | ||
228 | }; | 226 | }; |
229 | 227 | ||
230 | int len = (rb->global_settings->statusbar == STATUSBAR_TOP)? 4 : 2; | ||
231 | return rb->set_option("Show Header", &new_prefs.header_mode, INT, | 228 | return rb->set_option("Show Header", &new_prefs.header_mode, INT, |
232 | names, len, NULL); | 229 | names, 2, NULL); |
233 | } | 230 | } |
234 | 231 | ||
235 | static bool tv_footer_setting(void) | 232 | static bool tv_footer_setting(void) |
@@ -238,13 +235,21 @@ static bool tv_footer_setting(void) | |||
238 | { | 235 | { |
239 | {"None", -1}, | 236 | {"None", -1}, |
240 | {"Page Num", -1}, | 237 | {"Page Num", -1}, |
241 | {"Status bar", -1}, | ||
242 | {"Both", -1}, | ||
243 | }; | 238 | }; |
244 | 239 | ||
245 | int len = (rb->global_settings->statusbar == STATUSBAR_BOTTOM)? 4 : 2; | ||
246 | return rb->set_option("Show Footer", &new_prefs.footer_mode, INT, | 240 | return rb->set_option("Show Footer", &new_prefs.footer_mode, INT, |
247 | names, len, NULL); | 241 | names, 2, NULL); |
242 | } | ||
243 | |||
244 | static bool tv_statusbar_setting(void) | ||
245 | { | ||
246 | static const struct opt_items names[] = { | ||
247 | {"No", -1}, | ||
248 | {"Yes", -1}, | ||
249 | }; | ||
250 | |||
251 | return rb->set_option("Show Statusbar", &new_prefs.statusbar, BOOL, | ||
252 | names, 2, NULL); | ||
248 | } | 253 | } |
249 | 254 | ||
250 | static bool tv_font_setting(void) | 255 | static bool tv_font_setting(void) |
@@ -319,6 +324,8 @@ MENUITEM_FUNCTION(header_item, 0, "Show Header", tv_header_setting, | |||
319 | NULL, NULL, Icon_NOICON); | 324 | NULL, NULL, Icon_NOICON); |
320 | MENUITEM_FUNCTION(footer_item, 0, "Show Footer", tv_footer_setting, | 325 | MENUITEM_FUNCTION(footer_item, 0, "Show Footer", tv_footer_setting, |
321 | NULL, NULL, Icon_NOICON); | 326 | NULL, NULL, Icon_NOICON); |
327 | MENUITEM_FUNCTION(statusbar_item, 0, "Show Statusbar", tv_statusbar_setting, | ||
328 | NULL, NULL, Icon_NOICON); | ||
322 | MENUITEM_FUNCTION(font_item, 0, "Font", tv_font_setting, | 329 | MENUITEM_FUNCTION(font_item, 0, "Font", tv_font_setting, |
323 | NULL, NULL, Icon_NOICON); | 330 | NULL, NULL, Icon_NOICON); |
324 | #endif | 331 | #endif |
@@ -329,7 +336,7 @@ MAKE_MENU(option_menu, "Viewer Options", NULL, Icon_NOICON, | |||
329 | &encoding_item, &word_wrap_item, &line_mode_item, &windows_item, | 336 | &encoding_item, &word_wrap_item, &line_mode_item, &windows_item, |
330 | &alignment_item, | 337 | &alignment_item, |
331 | #ifdef HAVE_LCD_BITMAP | 338 | #ifdef HAVE_LCD_BITMAP |
332 | &header_item, &footer_item, &font_item, | 339 | &header_item, &footer_item, &font_item, &statusbar_item, |
333 | #endif | 340 | #endif |
334 | &scroll_menu, &indent_spaces_item); | 341 | &scroll_menu, &indent_spaces_item); |
335 | 342 | ||
diff --git a/apps/plugins/text_viewer/tv_preferences.c b/apps/plugins/text_viewer/tv_preferences.c index 72cda9d00f..a90c72d8e9 100644 --- a/apps/plugins/text_viewer/tv_preferences.c +++ b/apps/plugins/text_viewer/tv_preferences.c | |||
@@ -58,6 +58,7 @@ static void tv_notify_change_preferences(const struct tv_preferences *oldp) | |||
58 | #ifdef HAVE_LCD_BITMAP | 58 | #ifdef HAVE_LCD_BITMAP |
59 | (oldp->header_mode != preferences->header_mode) || | 59 | (oldp->header_mode != preferences->header_mode) || |
60 | (oldp->footer_mode != preferences->footer_mode) || | 60 | (oldp->footer_mode != preferences->footer_mode) || |
61 | (oldp->statusbar != preferences->statusbar) || | ||
61 | (rb->strcmp(oldp->font_name, preferences->font_name)) || | 62 | (rb->strcmp(oldp->font_name, preferences->font_name)) || |
62 | #endif | 63 | #endif |
63 | (rb->strcmp(oldp->file_name, preferences->file_name))) | 64 | (rb->strcmp(oldp->file_name, preferences->file_name))) |
@@ -99,13 +100,15 @@ void tv_set_default_preferences(struct tv_preferences *p) | |||
99 | p->horizontal_scrollbar = SB_OFF; | 100 | p->horizontal_scrollbar = SB_OFF; |
100 | p->vertical_scrollbar = SB_OFF; | 101 | p->vertical_scrollbar = SB_OFF; |
101 | #ifdef HAVE_LCD_BITMAP | 102 | #ifdef HAVE_LCD_BITMAP |
102 | p->header_mode = HD_BOTH; | 103 | p->header_mode = HD_PATH; |
103 | p->footer_mode = FT_BOTH; | 104 | p->footer_mode = FT_PAGE; |
105 | p->statusbar = true; | ||
104 | rb->strlcpy(p->font_name, rb->global_settings->font_file, MAX_PATH); | 106 | rb->strlcpy(p->font_name, rb->global_settings->font_file, MAX_PATH); |
105 | p->font = rb->font_get(FONT_UI); | 107 | p->font = rb->font_get(FONT_UI); |
106 | #else | 108 | #else |
107 | p->header_mode = HD_NONE; | 109 | p->header_mode = HD_NONE; |
108 | p->footer_mode = FT_NONE; | 110 | p->footer_mode = FT_NONE; |
111 | p->statusbar = false; | ||
109 | #endif | 112 | #endif |
110 | p->autoscroll_speed = 1; | 113 | p->autoscroll_speed = 1; |
111 | p->narrow_mode = NM_PAGE; | 114 | p->narrow_mode = NM_PAGE; |
diff --git a/apps/plugins/text_viewer/tv_preferences.h b/apps/plugins/text_viewer/tv_preferences.h index ee861ee6b6..d1ba7f25b4 100644 --- a/apps/plugins/text_viewer/tv_preferences.h +++ b/apps/plugins/text_viewer/tv_preferences.h | |||
@@ -59,8 +59,6 @@ enum { | |||
59 | enum { | 59 | enum { |
60 | HD_NONE = 0, | 60 | HD_NONE = 0, |
61 | HD_PATH, | 61 | HD_PATH, |
62 | HD_SBAR, | ||
63 | HD_BOTH, | ||
64 | }; | 62 | }; |
65 | 63 | ||
66 | /* footer_mode */ | 64 | /* footer_mode */ |
@@ -68,8 +66,6 @@ enum { | |||
68 | 66 | ||
69 | FT_NONE = 0, | 67 | FT_NONE = 0, |
70 | FT_PAGE, | 68 | FT_PAGE, |
71 | FT_SBAR, | ||
72 | FT_BOTH, | ||
73 | }; | 69 | }; |
74 | 70 | ||
75 | /* horizontal_scroll_mode */ | 71 | /* horizontal_scroll_mode */ |
@@ -114,6 +110,8 @@ struct tv_preferences { | |||
114 | 110 | ||
115 | unsigned indent_spaces; | 111 | unsigned indent_spaces; |
116 | 112 | ||
113 | bool statusbar; | ||
114 | |||
117 | #ifdef HAVE_LCD_BITMAP | 115 | #ifdef HAVE_LCD_BITMAP |
118 | unsigned char font_name[MAX_PATH]; | 116 | unsigned char font_name[MAX_PATH]; |
119 | struct font *font; | 117 | struct font *font; |
diff --git a/apps/plugins/text_viewer/tv_settings.c b/apps/plugins/text_viewer/tv_settings.c index 93f16b5a66..56c0bbe7ce 100644 --- a/apps/plugins/text_viewer/tv_settings.c +++ b/apps/plugins/text_viewer/tv_settings.c | |||
@@ -42,15 +42,16 @@ | |||
42 | * vertical_scrollbar 1 | 42 | * vertical_scrollbar 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 | * header_mode 1 |
46 | * title_mode 1 | 46 | * footer_mode 1 |
47 | * scroll_mode 1 | 47 | * scroll_mode 1 |
48 | * autoscroll_speed 1 | 48 | * autoscroll_speed 1 |
49 | * horizontal_scrollbar 1 | 49 | * horizontal_scrollbar 1 |
50 | * horizontal_scroll_mode 1 | 50 | * horizontal_scroll_mode 1 |
51 | * narrow_mode 1 | 51 | * narrow_mode 1 |
52 | * indent_spaces 1 | 52 | * indent_spaces 1 |
53 | * (reserved) 12 | 53 | * statusbar 1 |
54 | * (reserved) 11 | ||
54 | * font name MAX_PATH | 55 | * font name MAX_PATH |
55 | */ | 56 | */ |
56 | 57 | ||
@@ -58,7 +59,7 @@ | |||
58 | #define TV_GLOBAL_SETTINGS_FILE VIEWERS_DIR "/tv_global.dat" | 59 | #define TV_GLOBAL_SETTINGS_FILE VIEWERS_DIR "/tv_global.dat" |
59 | 60 | ||
60 | #define TV_GLOBAL_SETTINGS_HEADER "\x54\x56\x47\x53" /* "TVGS" */ | 61 | #define TV_GLOBAL_SETTINGS_HEADER "\x54\x56\x47\x53" /* "TVGS" */ |
61 | #define TV_GLOBAL_SETTINGS_VERSION 0x37 | 62 | #define TV_GLOBAL_SETTINGS_VERSION 0x38 |
62 | #define TV_GLOBAL_SETTINGS_HEADER_SIZE 5 | 63 | #define TV_GLOBAL_SETTINGS_HEADER_SIZE 5 |
63 | #define TV_GLOBAL_SETTINGS_FIRST_VERSION 0x31 | 64 | #define TV_GLOBAL_SETTINGS_FIRST_VERSION 0x31 |
64 | 65 | ||
@@ -92,7 +93,8 @@ | |||
92 | * horizontal_scroll_mode 1 | 93 | * horizontal_scroll_mode 1 |
93 | * narrow_mode 1 | 94 | * narrow_mode 1 |
94 | * indent_spaces 1 | 95 | * indent_spaces 1 |
95 | * (reserved) 12 | 96 | * statusbar 1 |
97 | * (reserved) 11 | ||
96 | * font name MAX_PATH | 98 | * font name MAX_PATH |
97 | * bookmark count 1 | 99 | * bookmark count 1 |
98 | * [1st bookmark] | 100 | * [1st bookmark] |
@@ -114,7 +116,7 @@ | |||
114 | #define TV_SETTINGS_TMP_FILE VIEWERS_DIR "/tv_file.tmp" | 116 | #define TV_SETTINGS_TMP_FILE VIEWERS_DIR "/tv_file.tmp" |
115 | 117 | ||
116 | #define TV_SETTINGS_HEADER "\x54\x56\x53" /* "TVS" */ | 118 | #define TV_SETTINGS_HEADER "\x54\x56\x53" /* "TVS" */ |
117 | #define TV_SETTINGS_VERSION 0x38 | 119 | #define TV_SETTINGS_VERSION 0x39 |
118 | #define TV_SETTINGS_HEADER_SIZE 4 | 120 | #define TV_SETTINGS_HEADER_SIZE 4 |
119 | #define TV_SETTINGS_FIRST_VERSION 0x32 | 121 | #define TV_SETTINGS_FIRST_VERSION 0x32 |
120 | 122 | ||
@@ -156,8 +158,34 @@ static bool tv_read_preferences(int pfd, int version, struct tv_preferences *pre | |||
156 | /* skip need_scrollbar */ | 158 | /* skip need_scrollbar */ |
157 | p++; | 159 | p++; |
158 | prefs->page_mode = *p++; | 160 | prefs->page_mode = *p++; |
159 | prefs->header_mode = *p++; | 161 | |
160 | prefs->footer_mode = *p++; | 162 | if (version < 7) |
163 | { | ||
164 | prefs->statusbar = false; | ||
165 | if (*p > 1) | ||
166 | { | ||
167 | prefs->header_mode = (*p & 1); | ||
168 | prefs->statusbar = true; | ||
169 | } | ||
170 | else | ||
171 | prefs->header_mode = *p; | ||
172 | |||
173 | if (*(++p) > 1) | ||
174 | { | ||
175 | prefs->footer_mode = (*p & 1); | ||
176 | prefs->statusbar = true; | ||
177 | } | ||
178 | else | ||
179 | prefs->footer_mode = *p; | ||
180 | |||
181 | p++; | ||
182 | } | ||
183 | else | ||
184 | { | ||
185 | prefs->header_mode = *p++; | ||
186 | prefs->footer_mode = *p++; | ||
187 | } | ||
188 | |||
161 | prefs->vertical_scroll_mode = *p++; | 189 | prefs->vertical_scroll_mode = *p++; |
162 | prefs->autoscroll_speed = *p++; | 190 | prefs->autoscroll_speed = *p++; |
163 | 191 | ||
@@ -181,6 +209,9 @@ static bool tv_read_preferences(int pfd, int version, struct tv_preferences *pre | |||
181 | else | 209 | else |
182 | prefs->indent_spaces = 2; | 210 | prefs->indent_spaces = 2; |
183 | 211 | ||
212 | if (version > 6) | ||
213 | prefs->statusbar = (*p++ != 0); | ||
214 | |||
184 | #ifdef HAVE_LCD_BITMAP | 215 | #ifdef HAVE_LCD_BITMAP |
185 | rb->memcpy(prefs->font_name, buf + read_size - MAX_PATH, MAX_PATH); | 216 | rb->memcpy(prefs->font_name, buf + read_size - MAX_PATH, MAX_PATH); |
186 | 217 | ||
@@ -212,6 +243,7 @@ static bool tv_write_preferences(int pfd, const struct tv_preferences *prefs) | |||
212 | *p++ = prefs->horizontal_scroll_mode; | 243 | *p++ = prefs->horizontal_scroll_mode; |
213 | *p++ = prefs->narrow_mode; | 244 | *p++ = prefs->narrow_mode; |
214 | *p++ = prefs->indent_spaces; | 245 | *p++ = prefs->indent_spaces; |
246 | *p++ = prefs->statusbar; | ||
215 | 247 | ||
216 | #ifdef HAVE_LCD_BITMAP | 248 | #ifdef HAVE_LCD_BITMAP |
217 | rb->memcpy(buf + 28, prefs->font_name, MAX_PATH); | 249 | rb->memcpy(buf + 28, prefs->font_name, MAX_PATH); |
diff --git a/apps/plugins/text_viewer/tv_window.c b/apps/plugins/text_viewer/tv_window.c index df3951aa28..16be8845ef 100644 --- a/apps/plugins/text_viewer/tv_window.c +++ b/apps/plugins/text_viewer/tv_window.c | |||
@@ -52,40 +52,6 @@ static bool tv_set_font(const unsigned char *font) | |||
52 | } | 52 | } |
53 | return true; | 53 | return true; |
54 | } | 54 | } |
55 | |||
56 | static bool tv_check_header_and_footer(struct tv_preferences *new_prefs) | ||
57 | { | ||
58 | bool change_prefs = false; | ||
59 | |||
60 | if (rb->global_settings->statusbar != STATUSBAR_TOP) | ||
61 | { | ||
62 | if (new_prefs->header_mode == HD_SBAR) | ||
63 | { | ||
64 | new_prefs->header_mode = HD_NONE; | ||
65 | change_prefs = true; | ||
66 | } | ||
67 | else if (new_prefs->header_mode == HD_BOTH) | ||
68 | { | ||
69 | new_prefs->header_mode = HD_PATH; | ||
70 | change_prefs = true; | ||
71 | } | ||
72 | } | ||
73 | if (rb->global_settings->statusbar != STATUSBAR_BOTTOM) | ||
74 | { | ||
75 | if (new_prefs->footer_mode == FT_SBAR) | ||
76 | { | ||
77 | new_prefs->footer_mode = FT_NONE; | ||
78 | change_prefs = true; | ||
79 | } | ||
80 | else if (new_prefs->footer_mode == FT_BOTH) | ||
81 | { | ||
82 | new_prefs->footer_mode = FT_PAGE; | ||
83 | change_prefs = true; | ||
84 | } | ||
85 | } | ||
86 | |||
87 | return change_prefs; | ||
88 | } | ||
89 | #endif | 55 | #endif |
90 | 56 | ||
91 | static void tv_show_bookmarks(const struct tv_screen_pos *top_pos) | 57 | static void tv_show_bookmarks(const struct tv_screen_pos *top_pos) |
@@ -177,7 +143,6 @@ static void tv_change_preferences(const struct tv_preferences *oldp) | |||
177 | #else | 143 | #else |
178 | static bool font_changing = false; | 144 | static bool font_changing = false; |
179 | const unsigned char *font_str; | 145 | const unsigned char *font_str; |
180 | bool change_prefs = false; | ||
181 | bool need_vertical_scrollbar; | 146 | bool need_vertical_scrollbar; |
182 | struct tv_preferences new_prefs; | 147 | struct tv_preferences new_prefs; |
183 | tv_copy_preferences(&new_prefs); | 148 | tv_copy_preferences(&new_prefs); |
@@ -191,16 +156,11 @@ static void tv_change_preferences(const struct tv_preferences *oldp) | |||
191 | if (!tv_set_font(preferences->font_name)) | 156 | if (!tv_set_font(preferences->font_name)) |
192 | { | 157 | { |
193 | rb->strlcpy(new_prefs.font_name, font_str, MAX_PATH); | 158 | rb->strlcpy(new_prefs.font_name, font_str, MAX_PATH); |
194 | change_prefs = true; | 159 | tv_set_preferences(&new_prefs); |
160 | return; | ||
195 | } | 161 | } |
196 | } | 162 | } |
197 | 163 | ||
198 | if (tv_check_header_and_footer(&new_prefs) || change_prefs) | ||
199 | { | ||
200 | tv_set_preferences(&new_prefs); | ||
201 | return; | ||
202 | } | ||
203 | |||
204 | font_changing = false; | 164 | font_changing = false; |
205 | #endif | 165 | #endif |
206 | 166 | ||