From ca8fa65ab7489e3bfca84af8fb242e60846c6412 Mon Sep 17 00:00:00 2001 From: Karl Kurbjun Date: Sat, 3 Jun 2006 07:04:02 +0000 Subject: Fix wide view mode on viewer git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10036 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/viewer.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'apps/plugins/viewer.c') diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c index ebb8865ff9..4e72aa13bf 100644 --- a/apps/plugins/viewer.c +++ b/apps/plugins/viewer.c @@ -265,8 +265,9 @@ unsigned char* get_ucs(const unsigned char* str, unsigned short* ch) bool done = false; int col = 0; -#define ADVANCE_COUNTERS(c) do { width += glyph_width(c); k++; } while(0) -#define LINE_IS_FULL ((k>MAX_COLUMNS-1) || (width > draw_columns)) +#define ADVANCE_COUNTERS(c) { width += glyph_width(c); k++; } +#define LINE_IS_FULL ((k draw_columns)) +#define LINE_IS_NOT_FULL ((kiso_decode(scratch_buffer + col, utf8_buffer, - prefs.encoding, k-col); + prefs.encoding, draw_columns/glyph_width('a')); *endptr = 0; } } @@ -836,18 +837,26 @@ static void viewer_draw(int col) if (line_width > col) { str = oldstr = line_begin; k = col; - while (k > draw_columns) { + while (k > 0) { str = crop_at_width(str); - k -= draw_columns; + k-=draw_columns; } + + oldstr=line_begin=str; + width = 0; - while (width <= k) { - oldstr = str; - str = get_ucs(str, &ch); + while( (widthiso_decode(oldstr, utf8_buffer, - prefs.encoding, line_end-oldstr); + + if(prefs.view_mode==WIDE) + endptr = rb->iso_decode(line_begin, utf8_buffer, + prefs.encoding, oldstr-line_begin); + else + endptr = rb->iso_decode(line_begin, utf8_buffer, + prefs.encoding, line_end-line_begin); *endptr = 0; } } -- cgit v1.2.3