summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/plugins/text_viewer/text_viewer.c16
-rw-r--r--apps/plugins/text_viewer/tv_action.c2
-rw-r--r--apps/plugins/text_viewer/tv_bookmark.c10
-rw-r--r--apps/plugins/text_viewer/tv_display.c4
-rw-r--r--apps/plugins/text_viewer/tv_menu.c63
-rw-r--r--apps/plugins/text_viewer/tv_pager.c6
6 files changed, 58 insertions, 43 deletions
diff --git a/apps/plugins/text_viewer/text_viewer.c b/apps/plugins/text_viewer/text_viewer.c
index fea0977c0d..91c3ae9237 100644
--- a/apps/plugins/text_viewer/text_viewer.c
+++ b/apps/plugins/text_viewer/text_viewer.c
@@ -31,7 +31,7 @@
31enum plugin_status plugin_start(const void* file) 31enum plugin_status plugin_start(const void* file)
32{ 32{
33 int button; 33 int button;
34#if defined(TV_AUTOSCROLL_PRE) 34#if defined(TV_AUTOSCROLL_PRE)
35 int lastbutton = BUTTON_NONE; 35 int lastbutton = BUTTON_NONE;
36#endif 36#endif
37 bool autoscroll = false; 37 bool autoscroll = false;
@@ -50,12 +50,20 @@ enum plugin_status plugin_start(const void* file)
50 plugin_buf = rb->plugin_get_buffer(&size); 50 plugin_buf = rb->plugin_get_buffer(&size);
51 51
52 if (!tv_init_action(&plugin_buf, &size)) { 52 if (!tv_init_action(&plugin_buf, &size)) {
53 rb->splash(HZ, "Error initialize"); 53 rb->splashf(HZ, ID2P(LANG_ERROR_FORMATSTR), "initialize");
54 return PLUGIN_ERROR; 54 return PLUGIN_ERROR;
55 } 55 }
56 56
57 /* Voice that we're loading the file... */
58 if (rb->global_settings->talk_menu) {
59 rb->talk_id(LANG_WAIT, true);
60 rb->talk_file_or_spell(NULL, file, NULL, true);
61 rb->talk_force_enqueue_next();
62 }
63// rb->splashf(HZ/2, "%s %s", rb->str(LANG_WAIT), file);
64
57 if (!tv_load_file(file)) { 65 if (!tv_load_file(file)) {
58 rb->splash(HZ, "Error opening file"); 66 rb->splashf(HZ, ID2P(LANG_ERROR_FORMATSTR), "reading file");
59 return PLUGIN_ERROR; 67 return PLUGIN_ERROR;
60 } 68 }
61 69
@@ -215,7 +223,7 @@ enum plugin_status plugin_start(const void* file)
215 } 223 }
216 if (button != BUTTON_NONE) 224 if (button != BUTTON_NONE)
217 { 225 {
218#if defined(TV_AUTOSCROLL_PRE) 226#if defined(TV_AUTOSCROLL_PRE)
219 lastbutton = button; 227 lastbutton = button;
220#endif 228#endif
221 rb->yield(); 229 rb->yield();
diff --git a/apps/plugins/text_viewer/tv_action.c b/apps/plugins/text_viewer/tv_action.c
index 041dee5a50..6d12889123 100644
--- a/apps/plugins/text_viewer/tv_action.c
+++ b/apps/plugins/text_viewer/tv_action.c
@@ -58,7 +58,7 @@ void tv_exit(void)
58 { 58 {
59 DEBUGF("Saving settings\n"); 59 DEBUGF("Saving settings\n");
60 if (!tv_save_settings()) 60 if (!tv_save_settings())
61 rb->splash(HZ, "Can't save preferences and bookmarks"); 61 rb->splash(HZ, "Can't save preferences and bookmarks"); // XXX i18n
62 } 62 }
63 else 63 else
64 DEBUGF("Skip saving settings\n"); 64 DEBUGF("Skip saving settings\n");
diff --git a/apps/plugins/text_viewer/tv_bookmark.c b/apps/plugins/text_viewer/tv_bookmark.c
index 1edad093a9..1ae75d69b5 100644
--- a/apps/plugins/text_viewer/tv_bookmark.c
+++ b/apps/plugins/text_viewer/tv_bookmark.c
@@ -149,13 +149,13 @@ void tv_toggle_bookmark(void)
149 if (idx < 0) 149 if (idx < 0)
150 { 150 {
151 if (tv_add_bookmark(pos) >= 0) 151 if (tv_add_bookmark(pos) >= 0)
152 rb->splash(HZ/2, "Bookmark add"); 152 rb->splash(HZ/2, ID2P(LANG_BOOKMARK_CREATE_SUCCESS));
153 else 153 else
154 rb->splash(HZ/2, "No more add bookmark"); 154 rb->splash(HZ/2, "No more add bookmark"); // XXX i18n
155 return; 155 return;
156 } 156 }
157 tv_remove_bookmark(idx); 157 tv_remove_bookmark(idx);
158 rb->splash(HZ/2, "Bookmark remove"); 158 rb->splash(HZ/2, "Bookmark remove"); // XXX i18n
159} 159}
160 160
161void tv_create_system_bookmark(void) 161void tv_create_system_bookmark(void)
@@ -233,9 +233,9 @@ void tv_select_bookmark(void)
233 tv_copy_screen_pos(&select_pos); 233 tv_copy_screen_pos(&select_pos);
234 234
235 if (select_pos.file_pos == 0) 235 if (select_pos.file_pos == 0)
236 rb->splash(HZ, "Start the first page"); 236 rb->splash(HZ, "Start the first page"); // XXX i18n
237 else 237 else
238 rb->splash(HZ, "Return to the current page"); 238 rb->splash(HZ, "Return to the current page"); // XXX i18n
239 } 239 }
240 } 240 }
241 241
diff --git a/apps/plugins/text_viewer/tv_display.c b/apps/plugins/text_viewer/tv_display.c
index 9ecfd8d709..9eb1151672 100644
--- a/apps/plugins/text_viewer/tv_display.c
+++ b/apps/plugins/text_viewer/tv_display.c
@@ -281,7 +281,7 @@ static bool tv_set_font(const unsigned char *font)
281 tv_change_fontid(rb->font_load(path)); 281 tv_change_fontid(rb->font_load(path));
282 if (preferences->font_id < 0) 282 if (preferences->font_id < 0)
283 { 283 {
284 rb->splash(HZ/2, "font load failed"); 284 rb->splash(HZ/2, "font load failed"); // XXX i18n
285 return false; 285 return false;
286 } 286 }
287 } 287 }
@@ -304,7 +304,7 @@ static int tv_change_preferences(const struct tv_preferences *oldp)
304 { 304 {
305 /* 305 /*
306 * tv_set_font(rb->global_settings->font_file) doesn't fail usually. 306 * tv_set_font(rb->global_settings->font_file) doesn't fail usually.
307 * if it fails, a fatal problem occurs in Rockbox. 307 * if it fails, a fatal problem occurs in Rockbox.
308 */ 308 */
309 if (!rb->strcmp(preferences->font_name, rb->global_settings->font_file)) 309 if (!rb->strcmp(preferences->font_name, rb->global_settings->font_file))
310 return TV_CALLBACK_ERROR; 310 return TV_CALLBACK_ERROR;
diff --git a/apps/plugins/text_viewer/tv_menu.c b/apps/plugins/text_viewer/tv_menu.c
index 74a964ba98..15b684fe08 100644
--- a/apps/plugins/text_viewer/tv_menu.c
+++ b/apps/plugins/text_viewer/tv_menu.c
@@ -42,7 +42,7 @@ static bool tv_horizontal_scrollbar_setting(void)
42static bool tv_horizontal_scroll_mode_setting(void) 42static bool tv_horizontal_scroll_mode_setting(void)
43{ 43{
44 static const struct opt_items names[] = { 44 static const struct opt_items names[] = {
45 {"Scroll by Screen", -1}, 45 {"Scroll by Screen", -1}, // XXX i18n
46 {"Scroll by Column", -1}, 46 {"Scroll by Column", -1},
47 }; 47 };
48 48
@@ -50,12 +50,12 @@ static bool tv_horizontal_scroll_mode_setting(void)
50 names, 2, NULL); 50 names, 2, NULL);
51} 51}
52 52
53MENUITEM_FUNCTION(horizontal_scrollbar_item, 0, "Scrollbar", 53MENUITEM_FUNCTION(horizontal_scrollbar_item, 0, ID2P(LANG_SCROLL_BAR),
54 tv_horizontal_scrollbar_setting, NULL, Icon_NOICON); 54 tv_horizontal_scrollbar_setting, NULL, Icon_NOICON);
55MENUITEM_FUNCTION(horizontal_scroll_mode_item, 0, "Scroll Mode", 55MENUITEM_FUNCTION(horizontal_scroll_mode_item, 0, "Scroll Mode", // XXX i18n
56 tv_horizontal_scroll_mode_setting, NULL, Icon_NOICON); 56 tv_horizontal_scroll_mode_setting, NULL, Icon_NOICON);
57 57
58MAKE_MENU(horizontal_scroll_menu, "Horizontal", NULL, Icon_NOICON, 58MAKE_MENU(horizontal_scroll_menu, "Horizontal", NULL, Icon_NOICON, // XXX i18n
59 &horizontal_scrollbar_item, 59 &horizontal_scrollbar_item,
60 &horizontal_scroll_mode_item); 60 &horizontal_scroll_mode_item);
61 61
@@ -65,43 +65,43 @@ MAKE_MENU(horizontal_scroll_menu, "Horizontal", NULL, Icon_NOICON,
65 65
66static bool tv_vertical_scrollbar_setting(void) 66static bool tv_vertical_scrollbar_setting(void)
67{ 67{
68 return rb->set_bool("Vertical Scrollbar", &new_prefs.vertical_scrollbar); 68 return rb->set_bool("Vertical Scrollbar", &new_prefs.vertical_scrollbar); // XXX i18n
69} 69}
70 70
71static bool tv_vertical_scroll_mode_setting(void) 71static bool tv_vertical_scroll_mode_setting(void)
72{ 72{
73 static const struct opt_items names[] = { 73 static const struct opt_items names[] = {
74 {"Scroll by Page", -1}, 74 {"Scroll by Page", -1}, // XXX i18n
75 {"Scroll by Line", -1}, 75 {"Scroll by Line", -1},
76 }; 76 };
77 77
78 return rb->set_option("Scroll Mode", &new_prefs.vertical_scroll_mode, RB_INT, 78 return rb->set_option("Scroll Mode", &new_prefs.vertical_scroll_mode, RB_INT, // XXX i18n
79 names, 2, NULL); 79 names, 2, NULL);
80} 80}
81 81
82static bool tv_overlap_page_mode_setting(void) 82static bool tv_overlap_page_mode_setting(void)
83{ 83{
84 return rb->set_bool("Overlap Pages", &new_prefs.overlap_page_mode); 84 return rb->set_bool("Overlap Pages", &new_prefs.overlap_page_mode); // XXX i18n
85} 85}
86 86
87static bool tv_autoscroll_speed_setting(void) 87static bool tv_autoscroll_speed_setting(void)
88{ 88{
89 return rb->set_int("Auto-scroll Speed", "", UNIT_INT, 89 return rb->set_int("Auto-scroll Speed", "", UNIT_INT, // XXX i18n
90 &new_prefs.autoscroll_speed, NULL, 1, 1, 10, NULL); 90 &new_prefs.autoscroll_speed, NULL, 1, 1, 10, NULL);
91} 91}
92 92
93static bool tv_narrow_mode_setting(void) 93static bool tv_narrow_mode_setting(void)
94{ 94{
95 static const struct opt_items names[] = { 95 static const struct opt_items names[] = {
96 {"Previous/Next Page", -1}, 96 {"Previous/Next Page", -1}, // XXX i18n
97 {"Top/Bottom Page", -1}, 97 {"Top/Bottom Page", -1},
98 }; 98 };
99 99
100 return rb->set_option("Left/Right Key", &new_prefs.narrow_mode, RB_INT, 100 return rb->set_option("Left/Right Key", &new_prefs.narrow_mode, RB_INT, // XXX i18n
101 names, 2, NULL); 101 names, 2, NULL);
102} 102}
103 103
104MENUITEM_FUNCTION(vertical_scrollbar_item, 0, "Scrollbar", 104MENUITEM_FUNCTION(vertical_scrollbar_item, 0, ID2P(LANG_SCROLL_BAR),
105 tv_vertical_scrollbar_setting, NULL, Icon_NOICON); 105 tv_vertical_scrollbar_setting, NULL, Icon_NOICON);
106MENUITEM_FUNCTION(vertical_scroll_mode_item, 0, "Scroll Mode", 106MENUITEM_FUNCTION(vertical_scroll_mode_item, 0, "Scroll Mode",
107 tv_vertical_scroll_mode_setting, NULL, Icon_NOICON); 107 tv_vertical_scroll_mode_setting, NULL, Icon_NOICON);
@@ -116,11 +116,13 @@ MAKE_MENU(vertical_scroll_menu, "Vertical", NULL, Icon_NOICON,
116 &vertical_scroll_mode_item, &overlap_page_mode_item, &autoscroll_speed_item, 116 &vertical_scroll_mode_item, &overlap_page_mode_item, &autoscroll_speed_item,
117 &narrow_mode_item); 117 &narrow_mode_item);
118 118
119// XXX i18n ^^^
120
119/* */ 121/* */
120/* scroll settings menu */ 122/* scroll settings menu */
121/* */ 123/* */
122 124
123MAKE_MENU(scroll_menu, "Scroll Settings", NULL, Icon_NOICON, 125MAKE_MENU(scroll_menu, "Scroll Settings", NULL, Icon_NOICON, // XXX i18n
124 &horizontal_scroll_menu, &vertical_scroll_menu); 126 &horizontal_scroll_menu, &vertical_scroll_menu);
125 127
126/* */ 128/* */
@@ -145,8 +147,8 @@ static bool tv_encoding_setting(void)
145static bool tv_word_wrap_setting(void) 147static bool tv_word_wrap_setting(void)
146{ 148{
147 static const struct opt_items names[] = { 149 static const struct opt_items names[] = {
148 {"On", -1}, 150 {STR(LANG_ON)},
149 {"Off (Chop Words)", -1}, 151 {"Off (Chop Words)", -1}, // XXX i18n
150 }; 152 };
151 153
152 return rb->set_option("Word Wrap", &new_prefs.word_mode, RB_INT, 154 return rb->set_option("Word Wrap", &new_prefs.word_mode, RB_INT,
@@ -156,31 +158,31 @@ static bool tv_word_wrap_setting(void)
156static bool tv_line_mode_setting(void) 158static bool tv_line_mode_setting(void)
157{ 159{
158 static const struct opt_items names[] = { 160 static const struct opt_items names[] = {
159 {"Normal", -1}, 161 {STR(LANG_NORMAL)},
160 {"Join Lines", -1}, 162 {"Join Lines", -1}, // XXX i18n
161 {"Expand Lines", -1}, 163 {"Expand Lines", -1},
162 {"Reflow Lines", -1}, 164 {"Reflow Lines", -1},
163 }; 165 };
164 166
165 return rb->set_option("Line Mode", &new_prefs.line_mode, RB_INT, names, 167 return rb->set_option("Line Mode", &new_prefs.line_mode, RB_INT, names,
166 sizeof(names) / sizeof(names[0]), NULL); 168 sizeof(names) / sizeof(names[0]), NULL); // XXX i18n
167} 169}
168 170
169static bool tv_windows_setting(void) 171static bool tv_windows_setting(void)
170{ 172{
171 return rb->set_int("Screens Per Page", "", UNIT_INT, 173 return rb->set_int("Screens Per Page", "", UNIT_INT, // XXX i18n
172 &new_prefs.windows, NULL, 1, 1, 5, NULL); 174 &new_prefs.windows, NULL, 1, 1, 5, NULL);
173} 175}
174 176
175static bool tv_alignment_setting(void) 177static bool tv_alignment_setting(void)
176{ 178{
177 static const struct opt_items names[] = { 179 static const struct opt_items names[] = {
178 {"Left", -1}, 180 {STR(LANG_LEFT)},
179 {"Right", -1}, 181 {STR(LANG_RIGHT)},
180 }; 182 };
181 183
182 return rb->set_option("Alignment", &new_prefs.alignment, RB_INT, 184 return rb->set_option("Alignment", &new_prefs.alignment, RB_INT,
183 names , 2, NULL); 185 names , 2, NULL); // XXX i18n
184} 186}
185 187
186static bool tv_header_setting(void) 188static bool tv_header_setting(void)
@@ -206,7 +208,7 @@ static bool tv_font_setting(void)
206 struct browse_context browse = { 208 struct browse_context browse = {
207 .dirfilter = SHOW_FONT, 209 .dirfilter = SHOW_FONT,
208 .flags = BROWSE_SELECTONLY | BROWSE_NO_CONTEXT_MENU, 210 .flags = BROWSE_SELECTONLY | BROWSE_NO_CONTEXT_MENU,
209 .title = "Font", /* XXX: Translate? */ 211 .title = ID2P(LANG_CUSTOM_FONT),
210 .icon = Icon_Menu_setting, 212 .icon = Icon_Menu_setting,
211 .root = FONT_DIR, 213 .root = FONT_DIR,
212 .selected = name, 214 .selected = name,
@@ -229,7 +231,7 @@ static bool tv_font_setting(void)
229 231
230static bool tv_indent_spaces_setting(void) 232static bool tv_indent_spaces_setting(void)
231{ 233{
232 return rb->set_int("Indent Spaces", "", UNIT_INT, 234 return rb->set_int("Indent Spaces", "", UNIT_INT,
233 &new_prefs.indent_spaces, NULL, 1, 0, 5, NULL); 235 &new_prefs.indent_spaces, NULL, 1, 0, 5, NULL);
234} 236}
235 237
@@ -256,7 +258,7 @@ MENUITEM_FUNCTION(footer_item, 0, "Show Footer",
256 tv_footer_setting, NULL, Icon_NOICON); 258 tv_footer_setting, NULL, Icon_NOICON);
257MENUITEM_FUNCTION(statusbar_item, 0, "Show Statusbar", 259MENUITEM_FUNCTION(statusbar_item, 0, "Show Statusbar",
258 tv_statusbar_setting, NULL, Icon_NOICON); 260 tv_statusbar_setting, NULL, Icon_NOICON);
259MENUITEM_FUNCTION(font_item, 0, "Font", 261MENUITEM_FUNCTION(font_item, 0, ID2P(LANG_CUSTOM_FONT),
260 tv_font_setting, NULL, Icon_NOICON); 262 tv_font_setting, NULL, Icon_NOICON);
261MENUITEM_FUNCTION(indent_spaces_item, 0, "Indent Spaces", 263MENUITEM_FUNCTION(indent_spaces_item, 0, "Indent Spaces",
262 tv_indent_spaces_setting, NULL, Icon_NOICON); 264 tv_indent_spaces_setting, NULL, Icon_NOICON);
@@ -274,6 +276,7 @@ MAKE_MENU(option_menu, "Viewer Options", NULL, Icon_NOICON,
274 , &night_mode_item 276 , &night_mode_item
275#endif 277#endif
276 ); 278 );
279// XXX finish i18n ^^^
277 280
278static unsigned tv_options_menu(void) 281static unsigned tv_options_menu(void)
279{ 282{
@@ -290,9 +293,13 @@ unsigned tv_display_menu(void)
290 unsigned result = TV_MENU_RESULT_EXIT_MENU; 293 unsigned result = TV_MENU_RESULT_EXIT_MENU;
291 294
292 MENUITEM_STRINGLIST(menu, "Viewer Menu", NULL, 295 MENUITEM_STRINGLIST(menu, "Viewer Menu", NULL,
293 "Return", "Viewer Options", 296 ID2P(LANG_RETURN),
294 "Show Playback Menu", "Select Bookmark", 297 "Viewer Options",
295 "Global Settings", "Quit"); 298 ID2P(LANG_PLAYBACK_CONTROL),
299 ID2P(LANG_BOOKMARK_SELECT_BOOKMARK),
300 "Global Settings",
301 ID2P(LANG_MENU_QUIT));
302 // XXX finish i18n ^^^
296 303
297 switch (rb->do_menu(&menu, NULL, NULL, false)) 304 switch (rb->do_menu(&menu, NULL, NULL, false))
298 { 305 {
diff --git a/apps/plugins/text_viewer/tv_pager.c b/apps/plugins/text_viewer/tv_pager.c
index e9886e09dd..0e775f6d0d 100644
--- a/apps/plugins/text_viewer/tv_pager.c
+++ b/apps/plugins/text_viewer/tv_pager.c
@@ -218,7 +218,7 @@ void tv_convert_fpos(off_t fpos, struct tv_screen_pos *pos)
218 218
219 tv_seek_page(i, SEEK_SET); 219 tv_seek_page(i, SEEK_SET);
220 while (tv_create_line_positions() && cur_pos.file_pos < fpos) 220 while (tv_create_line_positions() && cur_pos.file_pos < fpos)
221 rb->splashf(0, "converting %ld%%...", 100 * cur_pos.file_pos / fpos); 221 rb->splashf(0, "converting %ld%%...", 100 * cur_pos.file_pos / fpos); // XXX i18n
222 222
223 if (i < max_page) 223 if (i < max_page)
224 cur_pos.page--; 224 cur_pos.page--;
@@ -239,7 +239,7 @@ static void tv_seek_to_bottom_line(void)
239 239
240 tv_seek_page(0, SEEK_END); 240 tv_seek_page(0, SEEK_END);
241 while (tv_create_line_positions()) 241 while (tv_create_line_positions())
242 rb->splashf(0, "loading %ld%%...", 100 * cur_pos.file_pos / total_size); 242 rb->splashf(0, "loading %ld%%...", 100 * cur_pos.file_pos / total_size); // XXX i18n
243 243
244 cur_pos.line = lines_per_page - 1; 244 cur_pos.line = lines_per_page - 1;
245} 245}
@@ -286,7 +286,7 @@ void tv_move_screen(int page_offset, int line_offset, int whence)
286 286
287 tv_seek_page(new_pos.page, SEEK_SET); 287 tv_seek_page(new_pos.page, SEEK_SET);
288 while (cur_pos.page < new_pos.page && tv_create_line_positions()) 288 while (cur_pos.page < new_pos.page && tv_create_line_positions())
289 rb->splashf(0, "loading %d%%...", 100 * cur_pos.page / new_pos.page); 289 rb->splashf(0, "loading %d%%...", 100 * cur_pos.page / new_pos.page); // XXX i18n
290 290
291 if (new_pos.line == 0) 291 if (new_pos.line == 0)
292 return; 292 return;