Logf display: add ability to scroll through messages

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20743 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Maurus Cuelenaere 2009-04-19 15:48:26 +00:00
parent c147d39bb5
commit 19fde6c0c0

View file

@ -33,18 +33,19 @@
#include "logf.h" #include "logf.h"
#include "settings.h" #include "settings.h"
#include "logfdisp.h" #include "logfdisp.h"
#include "action.h"
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
bool logfdisplay(void) bool logfdisplay(void)
{ {
int w, h; int w, h;
int lines; int lines;
int columns; int columns;
int i; int i;
int action;
bool lcd = false; /* fixed atm */ bool lcd = false; /* fixed atm */
int index; int index, user_index=0;
lcd_getstringsize("A", &w, &h); lcd_getstringsize("A", &w, &h);
lines = (lcd? lines = (lcd?
@ -68,10 +69,10 @@ bool logfdisplay(void)
if(!lines) if(!lines)
return false; return false;
do {
lcd_clear_display(); lcd_clear_display();
do { index = logfindex + user_index;
index = logfindex;
for(i = lines-1; i>=0; i--) { for(i = lines-1; i>=0; i--) {
unsigned char buffer[columns + 1]; unsigned char buffer[columns + 1];
@ -92,7 +93,34 @@ bool logfdisplay(void)
lcd_puts(0, i, buffer); lcd_puts(0, i, buffer);
} }
lcd_update(); lcd_update();
} while(!action_userabort(HZ));
action = get_action(CONTEXT_STD, HZ);
if(action == ACTION_STD_NEXT)
user_index++;
else if(action == ACTION_STD_PREV)
user_index--;
else if(action == ACTION_STD_OK)
user_index = 0;
#ifdef HAVE_TOUCHSCREEN
else if(action == ACTION_TOUCHSCREEN)
{
short x, y;
static int prev_y;
action = action_get_touchscreen_press(&x, &y);
if(action & BUTTON_REL)
prev_y = 0;
else
{
if(prev_y != 0)
user_index += (prev_y - y) / h;
prev_y = y;
}
}
#endif
} while(action != ACTION_STD_CANCEL);
return false; return false;
} }