summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/plugin.c1
-rw-r--r--apps/plugin.h4
-rw-r--r--apps/plugins/viewer.c46
3 files changed, 15 insertions, 36 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index e46e193129..de2dd3f7c7 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -620,6 +620,7 @@ static const struct plugin_api rockbox_api = {
620 /* new stuff at the end, sort into place next time 620 /* new stuff at the end, sort into place next time
621 the API gets incompatible */ 621 the API gets incompatible */
622 get_settings_list, 622 get_settings_list,
623 get_codepage_name,
623}; 624};
624 625
625int plugin_load(const char* plugin, const void* parameter) 626int plugin_load(const char* plugin, const void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index 99a76ad399..fd01e15bbd 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -131,7 +131,7 @@ void* plugin_get_buffer(size_t *buffer_size);
131#define PLUGIN_MAGIC 0x526F634B /* RocK */ 131#define PLUGIN_MAGIC 0x526F634B /* RocK */
132 132
133/* increase this every time the api struct changes */ 133/* increase this every time the api struct changes */
134#define PLUGIN_API_VERSION 127 134#define PLUGIN_API_VERSION 128
135 135
136/* update this to latest version if a change to the api struct breaks 136/* update this to latest version if a change to the api struct breaks
137 backwards compatibility (and please take the opportunity to sort in any 137 backwards compatibility (and please take the opportunity to sort in any
@@ -783,7 +783,7 @@ struct plugin_api {
783 /* new stuff at the end, sort into place next time 783 /* new stuff at the end, sort into place next time
784 the API gets incompatible */ 784 the API gets incompatible */
785 const struct settings_list* (*get_settings_list)(int*count); 785 const struct settings_list* (*get_settings_list)(int*count);
786 786 const char* (*get_codepage_name)(int cp);
787}; 787};
788 788
789/* plugin header */ 789/* plugin header */
diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c
index 76c1d93c1c..4cef7c5879 100644
--- a/apps/plugins/viewer.c
+++ b/apps/plugins/viewer.c
@@ -348,23 +348,7 @@ struct preferences {
348 WIDE, 348 WIDE,
349 } view_mode; 349 } view_mode;
350 350
351 enum { 351 enum codepages encoding;
352 ISO_8859_1=0,
353 ISO_8859_7,
354 ISO_8859_8,
355 CP1251,
356 ISO_8859_11,
357 ISO_8859_6,
358 ISO_8859_9,
359 ISO_8859_2,
360 CP1250,
361 SJIS,
362 GB2312,
363 KSX1001,
364 BIG5,
365 UTF8,
366 ENCODINGS
367 } encoding; /* FIXME: What should default encoding be? */
368 352
369#ifdef HAVE_LCD_BITMAP 353#ifdef HAVE_LCD_BITMAP
370 enum { 354 enum {
@@ -433,16 +417,18 @@ unsigned char* get_ucs(const unsigned char* str, unsigned short* ch)
433 unsigned char utf8_tmp[6]; 417 unsigned char utf8_tmp[6];
434 int count; 418 int count;
435 419
436 if (prefs.encoding == UTF8) 420 if (prefs.encoding == UTF_8)
437 return (unsigned char*)rb->utf8decode(str, ch); 421 return (unsigned char*)rb->utf8decode(str, ch);
438 422
439 count = BUFFER_OOB(str+2)? 1:2; 423 count = BUFFER_OOB(str+2)? 1:2;
440 rb->iso_decode(str, utf8_tmp, prefs.encoding, count); 424 rb->iso_decode(str, utf8_tmp, prefs.encoding, count);
441 rb->utf8decode(utf8_tmp, ch); 425 rb->utf8decode(utf8_tmp, ch);
442 426
427#ifdef HAVE_LCD_BITMAP
443 if ((prefs.encoding == SJIS && *str > 0xA0 && *str < 0xE0) || prefs.encoding < SJIS) 428 if ((prefs.encoding == SJIS && *str > 0xA0 && *str < 0xE0) || prefs.encoding < SJIS)
444 return (unsigned char*)str+1; 429 return (unsigned char*)str+1;
445 else 430 else
431#endif
446 return (unsigned char*)str+2; 432 return (unsigned char*)str+2;
447} 433}
448 434
@@ -1330,22 +1316,14 @@ static int col_limit(int col)
1330 1316
1331static bool encoding_setting(void) 1317static bool encoding_setting(void)
1332{ 1318{
1333 static const struct opt_items names[] = { 1319 static struct opt_items names[NUM_CODEPAGES];
1334 {"ISO-8859-1", -1}, 1320 int idx;
1335 {"ISO-8859-7", -1}, 1321
1336 {"ISO-8859-8", -1}, 1322 for (idx = 0; idx < NUM_CODEPAGES; idx++)
1337 {"CP1251", -1}, 1323 {
1338 {"ISO-8859-11", -1}, 1324 names[idx].string = rb->get_codepage_name(idx);
1339 {"ISO-8859-6", -1}, 1325 names[idx].voice_id = -1;
1340 {"ISO-8859-9", -1}, 1326 }
1341 {"ISO-8859-2", -1},
1342 {"CP1250", -1},
1343 {"SJIS", -1},
1344 {"GB-2312", -1},
1345 {"KSX-1001", -1},
1346 {"BIG5", -1},
1347 {"UTF-8", -1},
1348 };
1349 1327
1350 return rb->set_option("Encoding", &prefs.encoding, INT, names, 1328 return rb->set_option("Encoding", &prefs.encoding, INT, names,
1351 sizeof(names) / sizeof(names[0]), NULL); 1329 sizeof(names) / sizeof(names[0]), NULL);