From f97594443d38bb34c63b653886247a64f4a2069f Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Wed, 2 Oct 2002 11:37:37 +0000 Subject: ON now acts as page scroll modifier. OFF/STOP exits. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2474 a1c6a512-1295-4272-9138-f99709370657 --- apps/viewer.c | 169 +++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 131 insertions(+), 38 deletions(-) diff --git a/apps/viewer.c b/apps/viewer.c index d986ce2dcf..1572cbef48 100644 --- a/apps/viewer.c +++ b/apps/viewer.c @@ -42,6 +42,8 @@ static int file_size; static char buffer[BUFFER_SIZE+1]; static int buffer_pos; /* Position of the buffer in the file */ +static char display_lines; /* number of lines on the display */ +static char display_columns; /* number of columns on the display */ static int begin_line; /* Index of the first line displayed on the lcd */ static int end_line; /* Index of the last line displayed on the lcd */ static int begin_line_pos; /* Position of the first_line in the bufffer */ @@ -53,17 +55,16 @@ static int end_line_pos; /* Position of the last_line in the buffer */ * buffer size (only happens with very long lines). */ -static int display_line_count(void) +static void display_line_count(void) { #ifdef HAVE_LCD_BITMAP - int fh; - fh = font_get(FONT_UI)->height; - if (global_settings.statusbar) - return (LCD_HEIGHT - STATUSBAR_HEIGHT) / fh; - else - return LCD_HEIGHT/fh; + int w,h; + lcd_getstringsize("M", &w, &h); + display_lines = LCD_HEIGHT / h; + display_columns = LCD_WIDTH / w; #else - return 2; + display_lines = 2; + display_columns = 11; #endif } @@ -127,11 +128,10 @@ static void viewer_draw(int col) line_pos = begin_line_pos; - for (i=0; - i<=end_line-begin_line && - line_pos!=OUTSIDE_BUFFER && - line_pos!=OUTSIDE_FILE; - i++) { + for (i=0; i <= end_line - begin_line; i++) { + if (line_pos == OUTSIDE_BUFFER || + line_pos == OUTSIDE_FILE) + break; str = buffer + line_pos + 1; for (j=0; j