summaryrefslogtreecommitdiff
path: root/apps/plugins/text_viewer/tv_menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/text_viewer/tv_menu.c')
-rw-r--r--apps/plugins/text_viewer/tv_menu.c53
1 files changed, 18 insertions, 35 deletions
diff --git a/apps/plugins/text_viewer/tv_menu.c b/apps/plugins/text_viewer/tv_menu.c
index ce85dc9325..c90386aabc 100644
--- a/apps/plugins/text_viewer/tv_menu.c
+++ b/apps/plugins/text_viewer/tv_menu.c
@@ -219,44 +219,30 @@ static bool tv_alignment_setting(void)
219#ifdef HAVE_LCD_BITMAP 219#ifdef HAVE_LCD_BITMAP
220static bool tv_header_setting(void) 220static bool tv_header_setting(void)
221{ 221{
222 int len = (rb->global_settings->statusbar == STATUSBAR_TOP)? 4 : 2; 222 static const struct opt_items names[4] =
223 struct opt_items names[len];
224
225 names[0].string = "None";
226 names[0].voice_id = -1;
227 names[1].string = "File path";
228 names[1].voice_id = -1;
229
230 if (rb->global_settings->statusbar == STATUSBAR_TOP)
231 { 223 {
232 names[2].string = "Status bar"; 224 {"None", -1},
233 names[2].voice_id = -1; 225 {"File path", -1},
234 names[3].string = "Both"; 226 {"Status bar", -1},
235 names[3].voice_id = -1; 227 {"Both", -1},
236 } 228 };
237 229
230 int len = (rb->global_settings->statusbar == STATUSBAR_TOP)? 4 : 2;
238 return rb->set_option("Show Header", &new_prefs.header_mode, INT, 231 return rb->set_option("Show Header", &new_prefs.header_mode, INT,
239 names, len, NULL); 232 names, len, NULL);
240} 233}
241 234
242static bool tv_footer_setting(void) 235static bool tv_footer_setting(void)
243{ 236{
244 int len = (rb->global_settings->statusbar == STATUSBAR_BOTTOM)? 4 : 2; 237 static const struct opt_items names[4] =
245 struct opt_items names[len];
246
247 names[0].string = "None";
248 names[0].voice_id = -1;
249 names[1].string = "Page Num";
250 names[1].voice_id = -1;
251
252 if (rb->global_settings->statusbar == STATUSBAR_BOTTOM)
253 { 238 {
254 names[2].string = "Status bar"; 239 {"None", -1},
255 names[2].voice_id = -1; 240 {"Page Num", -1},
256 names[3].string = "Both"; 241 {"Status bar", -1},
257 names[3].voice_id = -1; 242 {"Both", -1},
258 } 243 };
259 244
245 int len = (rb->global_settings->statusbar == STATUSBAR_BOTTOM)? 4 : 2;
260 return rb->set_option("Show Footer", &new_prefs.footer_mode, INT, 246 return rb->set_option("Show Footer", &new_prefs.footer_mode, INT,
261 names, len, NULL); 247 names, len, NULL);
262} 248}
@@ -304,10 +290,7 @@ static bool tv_font_setting(void)
304 names, count, NULL); 290 names, count, NULL);
305 291
306 if (new_font != old_font) 292 if (new_font != old_font)
307 {
308 rb->memset(new_prefs.font_name, 0, MAX_PATH);
309 rb->strlcpy(new_prefs.font_name, names[new_font].string, MAX_PATH); 293 rb->strlcpy(new_prefs.font_name, names[new_font].string, MAX_PATH);
310 }
311 294
312 *tree = backup; 295 *tree = backup;
313 rb->set_current_file(backup.currdir); 296 rb->set_current_file(backup.currdir);
@@ -350,9 +333,9 @@ MAKE_MENU(option_menu, "Viewer Options", NULL, Icon_NOICON,
350#endif 333#endif
351 &scroll_menu, &indent_spaces_item); 334 &scroll_menu, &indent_spaces_item);
352 335
353static enum tv_menu_result tv_options_menu(void) 336static unsigned tv_options_menu(void)
354{ 337{
355 enum tv_menu_result result = TV_MENU_RESULT_EXIT_MENU; 338 unsigned result = TV_MENU_RESULT_EXIT_MENU;
356 339
357 if (rb->do_menu(&option_menu, NULL, NULL, false) == MENU_ATTACHED_USB) 340 if (rb->do_menu(&option_menu, NULL, NULL, false) == MENU_ATTACHED_USB)
358 result = TV_MENU_RESULT_ATTACHED_USB; 341 result = TV_MENU_RESULT_ATTACHED_USB;
@@ -360,9 +343,9 @@ static enum tv_menu_result tv_options_menu(void)
360 return result; 343 return result;
361} 344}
362 345
363enum tv_menu_result tv_display_menu(void) 346unsigned tv_display_menu(void)
364{ 347{
365 enum tv_menu_result result = TV_MENU_RESULT_EXIT_MENU; 348 unsigned result = TV_MENU_RESULT_EXIT_MENU;
366 349
367 MENUITEM_STRINGLIST(menu, "Viewer Menu", NULL, 350 MENUITEM_STRINGLIST(menu, "Viewer Menu", NULL,
368 "Return", "Viewer Options", 351 "Return", "Viewer Options",