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.c133
1 files changed, 90 insertions, 43 deletions
diff --git a/apps/plugins/text_viewer/tv_menu.c b/apps/plugins/text_viewer/tv_menu.c
index ff2d6758a4..38c4af1f96 100644
--- a/apps/plugins/text_viewer/tv_menu.c
+++ b/apps/plugins/text_viewer/tv_menu.c
@@ -30,7 +30,10 @@
30 30
31static struct tv_preferences new_prefs; 31static struct tv_preferences new_prefs;
32 32
33/* scrollbar menu */ 33/* */
34/* horizontal scroll settings menu */
35/* */
36
34#ifdef HAVE_LCD_BITMAP 37#ifdef HAVE_LCD_BITMAP
35static bool tv_horizontal_scrollbar_setting(void) 38static bool tv_horizontal_scrollbar_setting(void)
36{ 39{
@@ -42,7 +45,38 @@ static bool tv_horizontal_scrollbar_setting(void)
42 return rb->set_option("Horizontal Scrollbar", &new_prefs.horizontal_scrollbar, INT, 45 return rb->set_option("Horizontal Scrollbar", &new_prefs.horizontal_scrollbar, INT,
43 names, 2, NULL); 46 names, 2, NULL);
44} 47}
48#endif
49
50static bool tv_horizontal_scroll_mode_setting(void)
51{
52 static const struct opt_items names[] = {
53 {"Scroll by Screen", -1},
54 {"Scroll by Column", -1},
55 };
56
57 return rb->set_option("Scroll Mode", &new_prefs.horizontal_scroll_mode, INT,
58 names, 2, NULL);
59}
45 60
61#ifdef HAVE_LCD_BITMAP
62MENUITEM_FUNCTION(horizontal_scrollbar_item, 0, "Scrollbar",
63 tv_horizontal_scrollbar_setting,
64 NULL, NULL, Icon_NOICON);
65#endif
66MENUITEM_FUNCTION(horizontal_scroll_mode_item, 0, "Scroll Mode",
67 tv_horizontal_scroll_mode_setting, NULL, NULL, Icon_NOICON);
68
69MAKE_MENU(horizontal_scroll_menu, "Horizontal", NULL, Icon_NOICON,
70#ifdef HAVE_LCD_BITMAP
71 &horizontal_scrollbar_item,
72#endif
73 &horizontal_scroll_mode_item);
74
75/* */
76/* vertical scroll settings menu */
77/* */
78
79#ifdef HAVE_LCD_BITMAP
46static bool tv_vertical_scrollbar_setting(void) 80static bool tv_vertical_scrollbar_setting(void)
47{ 81{
48 static const struct opt_items names[] = { 82 static const struct opt_items names[] = {
@@ -53,18 +87,64 @@ static bool tv_vertical_scrollbar_setting(void)
53 return rb->set_option("Vertical Scrollbar", &new_prefs.vertical_scrollbar, INT, 87 return rb->set_option("Vertical Scrollbar", &new_prefs.vertical_scrollbar, INT,
54 names, 2, NULL); 88 names, 2, NULL);
55} 89}
90#endif
56 91
57MENUITEM_FUNCTION(horizontal_scrollbar_item, 0, "Horizontal", 92static bool tv_vertical_scroll_mode_setting(void)
58 tv_horizontal_scrollbar_setting, 93{
59 NULL, NULL, Icon_NOICON); 94 static const struct opt_items names[] = {
60MENUITEM_FUNCTION(vertical_scrollbar_item, 0, "Vertical", 95 {"Scroll by Page", -1},
96 {"Scroll by Line", -1},
97 };
98
99 return rb->set_option("Scroll Mode", &new_prefs.vertical_scroll_mode, INT,
100 names, 2, NULL);
101}
102
103static bool tv_page_mode_setting(void)
104{
105 static const struct opt_items names[] = {
106 {"No", -1},
107 {"Yes", -1},
108 };
109
110 return rb->set_option("Overlap Pages", &new_prefs.page_mode, INT,
111 names, 2, NULL);
112}
113
114static bool tv_autoscroll_speed_setting(void)
115{
116 return rb->set_int("Auto-scroll Speed", "", UNIT_INT,
117 &new_prefs.autoscroll_speed, NULL, 1, 1, 10, NULL);
118}
119
120#ifdef HAVE_LCD_BITMAP
121MENUITEM_FUNCTION(vertical_scrollbar_item, 0, "Scrollbar",
61 tv_vertical_scrollbar_setting, 122 tv_vertical_scrollbar_setting,
62 NULL, NULL, Icon_NOICON); 123 NULL, NULL, Icon_NOICON);
63MAKE_MENU(scrollbar_menu, "Scrollbar", NULL, Icon_NOICON,
64 &horizontal_scrollbar_item, &vertical_scrollbar_item);
65#endif 124#endif
125MENUITEM_FUNCTION(vertical_scroll_mode_item, 0, "Scroll Mode",
126 tv_vertical_scroll_mode_setting, NULL, NULL, Icon_NOICON);
127MENUITEM_FUNCTION(page_mode_item, 0, "Overlap Pages", tv_page_mode_setting,
128 NULL, NULL, Icon_NOICON);
129MENUITEM_FUNCTION(autoscroll_speed_item, 0, "Auto-Scroll Speed",
130 tv_autoscroll_speed_setting, NULL, NULL, Icon_NOICON);
131
132MAKE_MENU(vertical_scroll_menu, "Vertical", NULL, Icon_NOICON,
133#ifdef HAVE_LCD_BITMAP
134 &vertical_scrollbar_item,
135#endif
136 &vertical_scroll_mode_item, &page_mode_item, &autoscroll_speed_item);
137
138/* */
139/* scroll settings menu */
140/* */
66 141
142MAKE_MENU(scroll_menu, "Scroll Settings", NULL, Icon_NOICON,
143 &horizontal_scroll_menu, &vertical_scroll_menu);
144
145/* */
67/* main menu */ 146/* main menu */
147/* */
68 148
69static bool tv_encoding_setting(void) 149static bool tv_encoding_setting(void)
70{ 150{
@@ -111,17 +191,6 @@ static bool tv_windows_setting(void)
111 &new_prefs.windows, NULL, 1, 1, 5, NULL); 191 &new_prefs.windows, NULL, 1, 1, 5, NULL);
112} 192}
113 193
114static bool tv_scroll_mode_setting(void)
115{
116 static const struct opt_items names[] = {
117 {"Scroll by Page", -1},
118 {"Scroll by Line", -1},
119 };
120
121 return rb->set_option("Scroll Mode", &new_prefs.scroll_mode, INT,
122 names, 2, NULL);
123}
124
125static bool tv_alignment_setting(void) 194static bool tv_alignment_setting(void)
126{ 195{
127 static const struct opt_items names[] = { 196 static const struct opt_items names[] = {
@@ -134,17 +203,6 @@ static bool tv_alignment_setting(void)
134} 203}
135 204
136#ifdef HAVE_LCD_BITMAP 205#ifdef HAVE_LCD_BITMAP
137static bool tv_page_mode_setting(void)
138{
139 static const struct opt_items names[] = {
140 {"No", -1},
141 {"Yes", -1},
142 };
143
144 return rb->set_option("Overlap Pages", &new_prefs.page_mode, INT,
145 names, 2, NULL);
146}
147
148static bool tv_header_setting(void) 206static bool tv_header_setting(void)
149{ 207{
150 int len = (rb->global_settings->statusbar == STATUSBAR_TOP)? 4 : 2; 208 int len = (rb->global_settings->statusbar == STATUSBAR_TOP)? 4 : 2;
@@ -280,12 +338,6 @@ static bool tv_font_setting(void)
280} 338}
281#endif 339#endif
282 340
283static bool tv_autoscroll_speed_setting(void)
284{
285 return rb->set_int("Auto-scroll Speed", "", UNIT_INT,
286 &new_prefs.autoscroll_speed, NULL, 1, 1, 10, NULL);
287}
288
289MENUITEM_FUNCTION(encoding_item, 0, "Encoding", tv_encoding_setting, 341MENUITEM_FUNCTION(encoding_item, 0, "Encoding", tv_encoding_setting,
290 NULL, NULL, Icon_NOICON); 342 NULL, NULL, Icon_NOICON);
291MENUITEM_FUNCTION(word_wrap_item, 0, "Word Wrap", tv_word_wrap_setting, 343MENUITEM_FUNCTION(word_wrap_item, 0, "Word Wrap", tv_word_wrap_setting,
@@ -297,8 +349,6 @@ MENUITEM_FUNCTION(windows_item, 0, "Screens Per Page", tv_windows_setting,
297MENUITEM_FUNCTION(alignment_item, 0, "Alignment", tv_alignment_setting, 349MENUITEM_FUNCTION(alignment_item, 0, "Alignment", tv_alignment_setting,
298 NULL, NULL, Icon_NOICON); 350 NULL, NULL, Icon_NOICON);
299#ifdef HAVE_LCD_BITMAP 351#ifdef HAVE_LCD_BITMAP
300MENUITEM_FUNCTION(page_mode_item, 0, "Overlap Pages", tv_page_mode_setting,
301 NULL, NULL, Icon_NOICON);
302MENUITEM_FUNCTION(header_item, 0, "Show Header", tv_header_setting, 352MENUITEM_FUNCTION(header_item, 0, "Show Header", tv_header_setting,
303 NULL, NULL, Icon_NOICON); 353 NULL, NULL, Icon_NOICON);
304MENUITEM_FUNCTION(footer_item, 0, "Show Footer", tv_footer_setting, 354MENUITEM_FUNCTION(footer_item, 0, "Show Footer", tv_footer_setting,
@@ -306,17 +356,14 @@ MENUITEM_FUNCTION(footer_item, 0, "Show Footer", tv_footer_setting,
306MENUITEM_FUNCTION(font_item, 0, "Font", tv_font_setting, 356MENUITEM_FUNCTION(font_item, 0, "Font", tv_font_setting,
307 NULL, NULL, Icon_NOICON); 357 NULL, NULL, Icon_NOICON);
308#endif 358#endif
309MENUITEM_FUNCTION(scroll_mode_item, 0, "Scroll Mode", tv_scroll_mode_setting, 359
310 NULL, NULL, Icon_NOICON);
311MENUITEM_FUNCTION(autoscroll_speed_item, 0, "Auto-Scroll Speed",
312 tv_autoscroll_speed_setting, NULL, NULL, Icon_NOICON);
313MAKE_MENU(option_menu, "Viewer Options", NULL, Icon_NOICON, 360MAKE_MENU(option_menu, "Viewer Options", NULL, Icon_NOICON,
314 &encoding_item, &word_wrap_item, &line_mode_item, &windows_item, 361 &encoding_item, &word_wrap_item, &line_mode_item, &windows_item,
315 &alignment_item, 362 &alignment_item,
316#ifdef HAVE_LCD_BITMAP 363#ifdef HAVE_LCD_BITMAP
317 &scrollbar_menu, &page_mode_item, &header_item, &footer_item, &font_item, 364 &header_item, &footer_item, &font_item,
318#endif 365#endif
319 &scroll_mode_item, &autoscroll_speed_item); 366 &scroll_menu);
320 367
321static enum tv_menu_result tv_options_menu(void) 368static enum tv_menu_result tv_options_menu(void)
322{ 369{