forked from len0rd/rockbox
Horizontal screen scrolling part 3 (by Shachar Liberman)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8414 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
bfe740712a
commit
d3a03b679f
10 changed files with 191 additions and 197 deletions
172
apps/gui/list.c
172
apps/gui/list.c
|
@ -37,8 +37,13 @@
|
||||||
#define SCROLL_LIMIT 2
|
#define SCROLL_LIMIT 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int offset_step = 15;
|
#ifdef HAVE_LCD_BITMAP
|
||||||
static bool offset_outof_view = false;
|
static int offset_step = 16; /* pixels per screen scroll step */
|
||||||
|
/* should lines scroll out of the screen */
|
||||||
|
static bool offset_out_of_view = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void gui_list_init(struct gui_list * gui_list,
|
void gui_list_init(struct gui_list * gui_list,
|
||||||
list_get_name callback_get_item_name,
|
list_get_name callback_get_item_name,
|
||||||
|
@ -54,7 +59,9 @@ void gui_list_init(struct gui_list * gui_list,
|
||||||
gui_list->limit_scroll = false;
|
gui_list->limit_scroll = false;
|
||||||
gui_list->data=data;
|
gui_list->data=data;
|
||||||
gui_list->cursor_flash_state=false;
|
gui_list->cursor_flash_state=false;
|
||||||
gui_list->offsetval = 0;
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
gui_list->offset_position = 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void gui_list_set_display(struct gui_list * gui_list, struct screen * display)
|
void gui_list_set_display(struct gui_list * gui_list, struct screen * display)
|
||||||
|
@ -181,47 +188,43 @@ void gui_list_draw(struct gui_list * gui_list)
|
||||||
entry_name = gui_list->callback_get_item_name(current_item,
|
entry_name = gui_list->callback_get_item_name(current_item,
|
||||||
gui_list->data,
|
gui_list->data,
|
||||||
entry_buffer);
|
entry_buffer);
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
/* position the string at the right offset place */
|
/* position the string at the correct offset place */
|
||||||
int item_offset;
|
int item_offset;
|
||||||
int str_width,h;
|
int item_width,h;
|
||||||
display->getstringsize(entry_name, &str_width, &h);
|
display->getstringsize(entry_name, &item_width, &h);
|
||||||
|
|
||||||
if (offset_outof_view)
|
if (offset_out_of_view)
|
||||||
item_offset = gui_list->offsetval;
|
item_offset = gui_list->offset_position;
|
||||||
else
|
|
||||||
/* if text is smaller then view */
|
|
||||||
if (str_width <= display->width - text_pos)
|
|
||||||
item_offset = 0;
|
|
||||||
else
|
else
|
||||||
/* if text got out of view */
|
/* if text is smaller then view */
|
||||||
if (gui_list->offsetval > str_width - (display->width - text_pos))
|
if (item_width <= display->width - text_pos)
|
||||||
item_offset = str_width - (display->width - text_pos);
|
item_offset = 0;
|
||||||
else
|
else
|
||||||
item_offset = gui_list->offsetval;
|
/* if text got out of view */
|
||||||
|
if (gui_list->offset_position >
|
||||||
#endif
|
item_width - (display->width - text_pos))
|
||||||
|
item_offset = item_width - (display->width - text_pos);
|
||||||
|
else
|
||||||
|
item_offset = gui_list->offset_position;
|
||||||
|
|
||||||
|
#endif
|
||||||
if(current_item == gui_list->selected_item) {
|
if(current_item == gui_list->selected_item) {
|
||||||
/* The selected item must be displayed scrolling */
|
/* The selected item must be displayed scrolling */
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
if (global_settings.invert_cursor) /* Display inverted-line-style*/
|
if (global_settings.invert_cursor)/* Display inverted-line-style*/
|
||||||
|
|
||||||
/* if text got out of view */
|
/* if text got out of view */
|
||||||
if (item_offset > str_width - (display->width - text_pos))
|
if (item_offset > item_width - (display->width - text_pos))
|
||||||
/* don't scroll */
|
/* don't scroll */
|
||||||
display->puts_style_offset(0, i, entry_name, STYLE_INVERT,item_offset);
|
display->puts_style_offset(0, i, entry_name, STYLE_INVERT,item_offset);
|
||||||
else
|
else
|
||||||
display->puts_scroll_style_offset(0, i, entry_name, STYLE_INVERT,item_offset);
|
display->puts_scroll_style_offset(0, i, entry_name, STYLE_INVERT,item_offset);
|
||||||
|
|
||||||
else /* if (global_settings.invert_cursor) */
|
|
||||||
|
|
||||||
if (item_offset > str_width - (display->width - text_pos))
|
|
||||||
display->puts_offset(0, i, entry_name,item_offset);
|
|
||||||
else
|
|
||||||
display->puts_scroll_offset(0, i, entry_name,item_offset);
|
|
||||||
|
|
||||||
|
else /* if (!global_settings.invert_cursor) */
|
||||||
|
if (item_offset > item_width - (display->width - text_pos))
|
||||||
|
display->puts_offset(0, i, entry_name,item_offset);
|
||||||
|
else
|
||||||
|
display->puts_scroll_offset(0, i, entry_name,item_offset);
|
||||||
#else
|
#else
|
||||||
display->puts_scroll(text_pos, i, entry_name);
|
display->puts_scroll(text_pos, i, entry_name);
|
||||||
#endif
|
#endif
|
||||||
|
@ -264,40 +267,6 @@ void gui_list_draw(struct gui_list * gui_list)
|
||||||
gui_textarea_update(display);
|
gui_textarea_update(display);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
void gui_list_screen_scroll_step(int ofs)
|
|
||||||
{
|
|
||||||
offset_step = ofs;
|
|
||||||
}
|
|
||||||
|
|
||||||
void gui_list_screen_scroll_out_of_view(bool enable)
|
|
||||||
{
|
|
||||||
if (enable)
|
|
||||||
offset_outof_view = true;
|
|
||||||
else
|
|
||||||
offset_outof_view = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void gui_list_offset_right(struct gui_list * gui_list)
|
|
||||||
{
|
|
||||||
/* there should be a callback to find out what's the longest item on the list,
|
|
||||||
* and then, by finding out the width with get_stringsize, we would stop the
|
|
||||||
* list from scrolling at that point */
|
|
||||||
|
|
||||||
gui_list->offsetval+=offset_step;
|
|
||||||
if (gui_list->offsetval > 1000)
|
|
||||||
gui_list->offsetval = 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
void gui_list_offset_left(struct gui_list * gui_list)
|
|
||||||
{
|
|
||||||
gui_list->offsetval-=offset_step;
|
|
||||||
if (gui_list->offsetval < 0)
|
|
||||||
gui_list->offsetval = 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif /* HAVE_LCD_BITMAP */
|
|
||||||
|
|
||||||
void gui_list_select_item(struct gui_list * gui_list, int item_number)
|
void gui_list_select_item(struct gui_list * gui_list, int item_number)
|
||||||
{
|
{
|
||||||
if( item_number > gui_list->nb_items-1 || item_number < 0 )
|
if( item_number > gui_list->nb_items-1 || item_number < 0 )
|
||||||
|
@ -428,6 +397,37 @@ void gui_list_del_item(struct gui_list * gui_list)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
void gui_list_scroll_right(struct gui_list * gui_list)
|
||||||
|
{
|
||||||
|
/* FIXME: This is a fake right boundry limiter. there should be some
|
||||||
|
* callback function to find the longest item on the list in pixels,
|
||||||
|
* to stop the list from scrolling past that point */
|
||||||
|
gui_list->offset_position+=offset_step;
|
||||||
|
if (gui_list->offset_position > 1000)
|
||||||
|
gui_list->offset_position = 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gui_list_scroll_left(struct gui_list * gui_list)
|
||||||
|
{
|
||||||
|
gui_list->offset_position-=offset_step;
|
||||||
|
if (gui_list->offset_position < 0)
|
||||||
|
gui_list->offset_position = 0;
|
||||||
|
}
|
||||||
|
void gui_list_screen_scroll_step(int ofs)
|
||||||
|
{
|
||||||
|
offset_step = ofs;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gui_list_screen_scroll_out_of_view(bool enable)
|
||||||
|
{
|
||||||
|
if (enable)
|
||||||
|
offset_out_of_view = true;
|
||||||
|
else
|
||||||
|
offset_out_of_view = false;
|
||||||
|
}
|
||||||
|
#endif /* HAVE_LCD_BITMAP */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Synchronized lists stuffs
|
* Synchronized lists stuffs
|
||||||
*/
|
*/
|
||||||
|
@ -453,7 +453,9 @@ void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items)
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
{
|
{
|
||||||
gui_list_set_nb_items(&(lists->gui_list[i]), nb_items);
|
gui_list_set_nb_items(&(lists->gui_list[i]), nb_items);
|
||||||
lists->gui_list[i].offsetval = 0;
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
lists->gui_list[i].offset_position = 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void gui_synclist_set_icon_callback(struct gui_synclist * lists, list_get_icon icon_callback)
|
void gui_synclist_set_icon_callback(struct gui_synclist * lists, list_get_icon icon_callback)
|
||||||
|
@ -502,22 +504,6 @@ void gui_synclist_select_next_page(struct gui_synclist * lists,
|
||||||
screens[screen].nb_lines);
|
screens[screen].nb_lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
void gui_synclist_offset_right(struct gui_synclist * lists)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
FOR_NB_SCREENS(i)
|
|
||||||
gui_list_offset_right(&(lists->gui_list[i]));
|
|
||||||
}
|
|
||||||
|
|
||||||
void gui_synclist_offset_left(struct gui_synclist * lists)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
FOR_NB_SCREENS(i)
|
|
||||||
gui_list_offset_left(&(lists->gui_list[i]));
|
|
||||||
}
|
|
||||||
#endif /* HAVE_LCD_BITMAP */
|
|
||||||
|
|
||||||
void gui_synclist_select_previous_page(struct gui_synclist * lists,
|
void gui_synclist_select_previous_page(struct gui_synclist * lists,
|
||||||
enum screen_type screen)
|
enum screen_type screen)
|
||||||
{
|
{
|
||||||
|
@ -555,6 +541,22 @@ void gui_synclist_flash(struct gui_synclist * lists)
|
||||||
gui_list_flash(&(lists->gui_list[i]));
|
gui_list_flash(&(lists->gui_list[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
void gui_synclist_scroll_right(struct gui_synclist * lists)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
FOR_NB_SCREENS(i)
|
||||||
|
gui_list_scroll_right(&(lists->gui_list[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
void gui_synclist_scroll_left(struct gui_synclist * lists)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
FOR_NB_SCREENS(i)
|
||||||
|
gui_list_scroll_left(&(lists->gui_list[i]));
|
||||||
|
}
|
||||||
|
#endif /* HAVE_LCD_BITMAP */
|
||||||
|
|
||||||
unsigned gui_synclist_do_button(struct gui_synclist * lists, unsigned button)
|
unsigned gui_synclist_do_button(struct gui_synclist * lists, unsigned button)
|
||||||
{
|
{
|
||||||
gui_synclist_limit_scroll(lists, true);
|
gui_synclist_limit_scroll(lists, true);
|
||||||
|
@ -588,7 +590,7 @@ unsigned gui_synclist_do_button(struct gui_synclist * lists, unsigned button)
|
||||||
gui_synclist_select_next(lists);
|
gui_synclist_select_next(lists);
|
||||||
gui_synclist_draw(lists);
|
gui_synclist_draw(lists);
|
||||||
return LIST_NEXT;
|
return LIST_NEXT;
|
||||||
|
|
||||||
#ifdef LIST_PGRIGHT
|
#ifdef LIST_PGRIGHT
|
||||||
case LIST_PGRIGHT:
|
case LIST_PGRIGHT:
|
||||||
case LIST_PGRIGHT | BUTTON_REPEAT:
|
case LIST_PGRIGHT | BUTTON_REPEAT:
|
||||||
|
@ -596,7 +598,7 @@ unsigned gui_synclist_do_button(struct gui_synclist * lists, unsigned button)
|
||||||
case LIST_RC_PGRIGHT:
|
case LIST_RC_PGRIGHT:
|
||||||
case LIST_RC_PGRIGHT | BUTTON_REPEAT:
|
case LIST_RC_PGRIGHT | BUTTON_REPEAT:
|
||||||
#endif
|
#endif
|
||||||
gui_synclist_offset_right(lists);
|
gui_synclist_scroll_right(lists);
|
||||||
gui_synclist_draw(lists);
|
gui_synclist_draw(lists);
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
@ -608,7 +610,7 @@ unsigned gui_synclist_do_button(struct gui_synclist * lists, unsigned button)
|
||||||
case LIST_RC_PGLEFT:
|
case LIST_RC_PGLEFT:
|
||||||
case LIST_RC_PGLEFT | BUTTON_REPEAT:
|
case LIST_RC_PGLEFT | BUTTON_REPEAT:
|
||||||
#endif
|
#endif
|
||||||
gui_synclist_offset_left(lists);
|
gui_synclist_scroll_left(lists);
|
||||||
gui_synclist_draw(lists);
|
gui_synclist_draw(lists);
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -126,19 +126,20 @@ typedef void list_get_icon(int selected_item,
|
||||||
* a buffer when it's not necessary)
|
* a buffer when it's not necessary)
|
||||||
* Returns a pointer to a string that contains the text to display
|
* Returns a pointer to a string that contains the text to display
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef char * list_get_name(int selected_item,
|
typedef char * list_get_name(int selected_item,
|
||||||
void * data,
|
void * data,
|
||||||
char *buffer);
|
char *buffer);
|
||||||
|
|
||||||
struct gui_list
|
struct gui_list
|
||||||
{
|
{
|
||||||
int offsetval; /* value of screen offset */
|
|
||||||
int nb_items;
|
int nb_items;
|
||||||
int selected_item;
|
int selected_item;
|
||||||
bool cursor_flash_state;
|
bool cursor_flash_state;
|
||||||
int start_item; /* the item that is displayed at the top of the screen */
|
int start_item; /* the item that is displayed at the top of the screen */
|
||||||
|
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
int offset_position; /* the list's screen scroll placement in pixels */
|
||||||
|
#endif
|
||||||
list_get_icon *callback_get_item_icon;
|
list_get_icon *callback_get_item_icon;
|
||||||
list_get_name *callback_get_item_name;
|
list_get_name *callback_get_item_name;
|
||||||
|
|
||||||
|
@ -234,13 +235,6 @@ extern void gui_list_draw(struct gui_list * gui_list);
|
||||||
* (Item 0 gets selected if the end of the list is reached)
|
* (Item 0 gets selected if the end of the list is reached)
|
||||||
* - gui_list : the list structure
|
* - gui_list : the list structure
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern void gui_list_screen_scroll_step(int ofs);
|
|
||||||
/* parse global setting to static int */
|
|
||||||
|
|
||||||
extern void gui_list_screen_scroll_out_of_view(bool enable);
|
|
||||||
/* parse global setting to static bool */
|
|
||||||
|
|
||||||
extern void gui_list_select_next(struct gui_list * gui_list);
|
extern void gui_list_select_next(struct gui_list * gui_list);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -250,27 +244,32 @@ extern void gui_list_select_next(struct gui_list * gui_list);
|
||||||
*/
|
*/
|
||||||
extern void gui_list_select_previous(struct gui_list * gui_list);
|
extern void gui_list_select_previous(struct gui_list * gui_list);
|
||||||
|
|
||||||
/*
|
#ifdef HAVE_LCD_BITMAP
|
||||||
* Go to next page if any, else selects the last item in the list
|
|
||||||
* - gui_list : the list structure
|
|
||||||
* - nb_lines : the number of lines to try to move the cursor
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern void gui_list_offset_right(struct gui_list * gui_list);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Makes all the item in the list scroll by one step to the right.
|
* Makes all the item in the list scroll by one step to the right.
|
||||||
* Should stop increasing the value when reaching the widest item value
|
* Should stop increasing the value when reaching the widest item value
|
||||||
* in the list.
|
* in the list.
|
||||||
*/
|
*/
|
||||||
|
void gui_list_scroll_right(struct gui_list * gui_list);
|
||||||
extern void gui_list_offset_left(struct gui_list * gui_list);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Makes all the item in the list scroll by one step to the left.
|
* Makes all the item in the list scroll by one step to the left.
|
||||||
* stops at starting position.
|
* stops at starting position.
|
||||||
*/
|
*/
|
||||||
|
void gui_list_scroll_left(struct gui_list * gui_list);
|
||||||
|
|
||||||
|
/* parse global setting to static int */
|
||||||
|
extern void gui_list_screen_scroll_step(int ofs);
|
||||||
|
|
||||||
|
/* parse global setting to static bool */
|
||||||
|
extern void gui_list_screen_scroll_out_of_view(bool enable);
|
||||||
|
#endif /* HAVE_LCD_BITMAP */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Go to next page if any, else selects the last item in the list
|
||||||
|
* - gui_list : the list structure
|
||||||
|
* - nb_lines : the number of lines to try to move the cursor
|
||||||
|
*/
|
||||||
extern void gui_list_select_next_page(struct gui_list * gui_list,
|
extern void gui_list_select_next_page(struct gui_list * gui_list,
|
||||||
int nb_lines);
|
int nb_lines);
|
||||||
|
|
||||||
|
@ -347,8 +346,6 @@ extern void gui_synclist_select_item(struct gui_synclist * lists,
|
||||||
int item_number);
|
int item_number);
|
||||||
extern void gui_synclist_select_next(struct gui_synclist * lists);
|
extern void gui_synclist_select_next(struct gui_synclist * lists);
|
||||||
extern void gui_synclist_select_previous(struct gui_synclist * lists);
|
extern void gui_synclist_select_previous(struct gui_synclist * lists);
|
||||||
extern void gui_synclist_offset_right(struct gui_synclist * lists);
|
|
||||||
extern void gui_synclist_offset_left(struct gui_synclist * lists);
|
|
||||||
extern void gui_synclist_select_next_page(struct gui_synclist * lists,
|
extern void gui_synclist_select_next_page(struct gui_synclist * lists,
|
||||||
enum screen_type screen);
|
enum screen_type screen);
|
||||||
extern void gui_synclist_select_previous_page(struct gui_synclist * lists,
|
extern void gui_synclist_select_previous_page(struct gui_synclist * lists,
|
||||||
|
@ -357,6 +354,8 @@ extern void gui_synclist_add_item(struct gui_synclist * lists);
|
||||||
extern void gui_synclist_del_item(struct gui_synclist * lists);
|
extern void gui_synclist_del_item(struct gui_synclist * lists);
|
||||||
extern void gui_synclist_limit_scroll(struct gui_synclist * lists, bool scroll);
|
extern void gui_synclist_limit_scroll(struct gui_synclist * lists, bool scroll);
|
||||||
extern void gui_synclist_flash(struct gui_synclist * lists);
|
extern void gui_synclist_flash(struct gui_synclist * lists);
|
||||||
|
void gui_synclist_scroll_right(struct gui_synclist * lists);
|
||||||
|
void gui_synclist_scroll_left(struct gui_synclist * lists);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Do the action implied by the given button,
|
* Do the action implied by the given button,
|
||||||
|
|
|
@ -67,15 +67,13 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
|
||||||
screen->scroll_delay=&lcd_remote_scroll_delay;
|
screen->scroll_delay=&lcd_remote_scroll_delay;
|
||||||
screen->scroll_step=&lcd_remote_scroll_step;
|
screen->scroll_step=&lcd_remote_scroll_step;
|
||||||
screen->invertscroll=&lcd_remote_invertscroll;
|
screen->invertscroll=&lcd_remote_invertscroll;
|
||||||
|
#endif /* LCD_REMOTE_DEPTH > 1 */
|
||||||
screen->puts_scroll_style=&lcd_remote_puts_scroll_style;
|
screen->puts_offset=&lcd_remote_puts_offset;
|
||||||
|
screen->puts_style_offset=&lcd_remote_puts_style_offset;
|
||||||
|
screen->puts_scroll_style=&lcd_remote_puts_scroll_style;
|
||||||
screen->puts_scroll_offset=&lcd_remote_puts_scroll_offset;
|
screen->puts_scroll_offset=&lcd_remote_puts_scroll_offset;
|
||||||
screen->puts_scroll_style_offset=&lcd_remote_puts_scroll_style_offset;
|
screen->puts_scroll_style_offset=&lcd_remote_puts_scroll_style_offset;
|
||||||
|
|
||||||
screen->puts_offset=&lcd_remote_puts_offset;
|
|
||||||
screen->puts_style=&lcd_remote_puts_style;
|
|
||||||
screen->puts_style_offset=&lcd_remote_puts_style_offset;
|
|
||||||
#endif /* LCD_REMOTE_DEPTH > 1 */
|
|
||||||
#if 0 /* no charcell remote LCDs so far */
|
#if 0 /* no charcell remote LCDs so far */
|
||||||
screen->width=11;
|
screen->width=11;
|
||||||
screen->height=2;
|
screen->height=2;
|
||||||
|
@ -99,7 +97,6 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
|
||||||
screen->backlight_on=&remote_backlight_on;
|
screen->backlight_on=&remote_backlight_on;
|
||||||
screen->backlight_off=&remote_backlight_off;
|
screen->backlight_off=&remote_backlight_off;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#endif /* HAVE_REMOTE_LCD */
|
#endif /* HAVE_REMOTE_LCD */
|
||||||
|
|
||||||
case SCREEN_MAIN:
|
case SCREEN_MAIN:
|
||||||
|
@ -136,13 +133,11 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
|
||||||
screen->scroll_delay=&lcd_scroll_delay;
|
screen->scroll_delay=&lcd_scroll_delay;
|
||||||
screen->scroll_step=&lcd_scroll_step;
|
screen->scroll_step=&lcd_scroll_step;
|
||||||
screen->invertscroll=&lcd_invertscroll;
|
screen->invertscroll=&lcd_invertscroll;
|
||||||
|
|
||||||
screen->puts_scroll_offset=&lcd_puts_scroll_offset;
|
|
||||||
screen->puts_scroll_style_offset=&lcd_puts_scroll_style_offset;
|
|
||||||
|
|
||||||
screen->puts_offset=&lcd_puts_offset;
|
screen->puts_offset=&lcd_puts_offset;
|
||||||
screen->puts_style_offset=&lcd_puts_style_offset;
|
screen->puts_style_offset=&lcd_puts_style_offset;
|
||||||
screen->puts_style=&lcd_puts_style;
|
screen->puts_scroll_style=&lcd_puts_scroll_offset;
|
||||||
|
screen->puts_scroll_offset=&lcd_puts_scroll_style;
|
||||||
|
screen->puts_scroll_style_offset=&lcd_puts_scroll_style_offset;
|
||||||
#endif /* HAVE_LCD_BITMAP */
|
#endif /* HAVE_LCD_BITMAP */
|
||||||
|
|
||||||
#ifdef HAVE_LCD_CHARCELLS
|
#ifdef HAVE_LCD_CHARCELLS
|
||||||
|
|
|
@ -69,23 +69,17 @@ struct screen
|
||||||
void (*setfont)(int newfont);
|
void (*setfont)(int newfont);
|
||||||
int (*getstringsize)(const unsigned char *str, int *w, int *h);
|
int (*getstringsize)(const unsigned char *str, int *w, int *h);
|
||||||
void (*putsxy)(int x, int y, const unsigned char *str);
|
void (*putsxy)(int x, int y, const unsigned char *str);
|
||||||
|
|
||||||
void (*scroll_step)(int pixels);
|
void (*scroll_step)(int pixels);
|
||||||
|
void (*puts_offset)(int x, int y, const unsigned char *str, int offset);
|
||||||
|
void (*puts_style_offset)(int x, int y, const unsigned char *str,
|
||||||
|
int style, int offset);
|
||||||
void (*puts_scroll_style)(int x, int y, const unsigned char *string,
|
void (*puts_scroll_style)(int x, int y, const unsigned char *string,
|
||||||
int style);
|
int style);
|
||||||
void (*puts_scroll_offset)(int x, int y, const unsigned char *string,
|
void (*puts_scroll_offset)(int x, int y, const unsigned char *string,
|
||||||
int offset);
|
int offset);
|
||||||
void (*puts_scroll_style_offset)(int x, int y, const unsigned char *string,
|
void (*puts_scroll_style_offset)(int x, int y, const unsigned char *string,
|
||||||
int style, int offset);
|
int style, int offset);
|
||||||
|
|
||||||
void (*puts_offset)(int x, int y, const unsigned char *str, int offset);
|
|
||||||
void (*puts_style)(int x, int y, const unsigned char *string, int style);
|
|
||||||
void (*puts_style_offset)(int x, int y, const unsigned char *str,
|
|
||||||
int style, int offset);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void (*mono_bitmap)(const unsigned char *src,
|
void (*mono_bitmap)(const unsigned char *src,
|
||||||
int x, int y, int width, int height);
|
int x, int y, int width, int height);
|
||||||
void (*set_drawmode)(int mode);
|
void (*set_drawmode)(int mode);
|
||||||
|
|
|
@ -319,8 +319,10 @@ struct user_settings
|
||||||
int bidir_limit; /* bidir scroll length limit */
|
int bidir_limit; /* bidir scroll length limit */
|
||||||
int scroll_delay; /* delay (in 1/10s) before starting scroll */
|
int scroll_delay; /* delay (in 1/10s) before starting scroll */
|
||||||
int scroll_step; /* pixels to advance per update */
|
int scroll_step; /* pixels to advance per update */
|
||||||
bool offset_out_of_view; /* should lines scroll out of the screen */
|
#ifdef HAVE_LCD_BITMAP
|
||||||
int screen_scroll_step; /* pixels to advance screen view*/
|
bool offset_out_of_view;
|
||||||
|
int screen_scroll_step;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* auto bookmark settings */
|
/* auto bookmark settings */
|
||||||
int autoloadbookmark; /* auto load option: 0=off, 1=ask, 2=on */
|
int autoloadbookmark; /* auto load option: 0=off, 1=ask, 2=on */
|
||||||
|
|
|
@ -1515,9 +1515,9 @@ static bool scroll_settings_menu(void)
|
||||||
|
|
||||||
static const struct menu_item items[] = {
|
static const struct menu_item items[] = {
|
||||||
{ ID2P(LANG_SCROLL_SPEED), scroll_speed },
|
{ ID2P(LANG_SCROLL_SPEED), scroll_speed },
|
||||||
{ ID2P(LANG_SCROLL_DELAY), scroll_delay },
|
{ ID2P(LANG_SCROLL_DELAY), scroll_delay },
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
{ ID2P(LANG_SCROLL_STEP), scroll_step },
|
{ ID2P(LANG_SCROLL_STEP), scroll_step },
|
||||||
#endif
|
#endif
|
||||||
{ ID2P(LANG_BIDIR_SCROLL), bidir_limit },
|
{ ID2P(LANG_BIDIR_SCROLL), bidir_limit },
|
||||||
#ifdef HAVE_LCD_CHARCELLS
|
#ifdef HAVE_LCD_CHARCELLS
|
||||||
|
@ -1526,7 +1526,7 @@ static bool scroll_settings_menu(void)
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
{ ID2P(LANG_SCREEN_SCROLL_VIEW), screen_scroll },
|
{ ID2P(LANG_SCREEN_SCROLL_VIEW), screen_scroll },
|
||||||
{ ID2P(LANG_SCREEN_SCROLL_STEP), screen_scroll_step },
|
{ ID2P(LANG_SCREEN_SCROLL_STEP), screen_scroll_step },
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1138,7 +1138,7 @@ void lcd_remote_putsxy(int x, int y, const unsigned char *str)
|
||||||
/* put a string at a given char position */
|
/* put a string at a given char position */
|
||||||
void lcd_remote_puts(int x, int y, const unsigned char *str)
|
void lcd_remote_puts(int x, int y, const unsigned char *str)
|
||||||
{
|
{
|
||||||
lcd_remote_puts_style(x, y, str, STYLE_DEFAULT);
|
lcd_remote_puts_style_offset(x, y, str, STYLE_DEFAULT, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_remote_puts_style(int x, int y, const unsigned char *str, int style)
|
void lcd_remote_puts_style(int x, int y, const unsigned char *str, int style)
|
||||||
|
@ -1151,7 +1151,8 @@ void lcd_remote_puts_offset(int x, int y, const unsigned char *str, int offset)
|
||||||
lcd_remote_puts_style_offset(x, y, str, STYLE_DEFAULT, offset);
|
lcd_remote_puts_style_offset(x, y, str, STYLE_DEFAULT, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* put a string at a given char position at a given style and with a given offset */
|
/* put a string at a given char position, style, and pixel position,
|
||||||
|
* skipping first offset pixel columns */
|
||||||
void lcd_remote_puts_style_offset(int x, int y, const unsigned char *str, int style, int offset)
|
void lcd_remote_puts_style_offset(int x, int y, const unsigned char *str, int style, int offset)
|
||||||
{
|
{
|
||||||
int xpos,ypos,w,h;
|
int xpos,ypos,w,h;
|
||||||
|
@ -1223,16 +1224,16 @@ void lcd_remote_puts_scroll(int x, int y, const unsigned char *string)
|
||||||
|
|
||||||
void lcd_remote_puts_scroll_style(int x, int y, const unsigned char *string, int style)
|
void lcd_remote_puts_scroll_style(int x, int y, const unsigned char *string, int style)
|
||||||
{
|
{
|
||||||
lcd_remote_puts_scroll_style_offset(x, y, string, style, 0);
|
lcd_remote_puts_scroll_style_offset(x, y, string, style, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_remote_puts_scroll_offset(int x, int y, const unsigned char *string, int offset)
|
void lcd_remote_puts_scroll_offset(int x, int y, const unsigned char *string, int offset)
|
||||||
{
|
{
|
||||||
lcd_remote_puts_scroll_style_offset(x, y, string, STYLE_DEFAULT, offset);
|
lcd_remote_puts_scroll_style_offset(x, y, string, STYLE_DEFAULT, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_remote_puts_scroll_style_offset(int x, int y, const unsigned char *string,
|
void lcd_remote_puts_scroll_style_offset(int x, int y, const unsigned char *string,
|
||||||
int style, int offset)
|
int style, int offset)
|
||||||
{
|
{
|
||||||
struct scrollinfo* s;
|
struct scrollinfo* s;
|
||||||
int w, h;
|
int w, h;
|
||||||
|
@ -1289,7 +1290,6 @@ void lcd_remote_puts_scroll_style_offset(int x, int y, const unsigned char *stri
|
||||||
scrolling_lines &= ~(1<<y);
|
scrolling_lines &= ~(1<<y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void scroll_thread(void)
|
static void scroll_thread(void)
|
||||||
{
|
{
|
||||||
struct font* pf;
|
struct font* pf;
|
||||||
|
|
|
@ -1057,9 +1057,26 @@ void lcd_putsxy(int x, int y, const unsigned char *str)
|
||||||
|
|
||||||
/*** line oriented text output ***/
|
/*** line oriented text output ***/
|
||||||
|
|
||||||
/* put a string at a given char position at a given style and with a given pixel position */
|
/* put a string at a given char position */
|
||||||
void lcd_puts_style_offset(int x, int y, const unsigned char *str, int style,
|
void lcd_puts(int x, int y, const unsigned char *str)
|
||||||
int offset)
|
{
|
||||||
|
lcd_puts_style_offset(x, y, str, STYLE_DEFAULT, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void lcd_puts_style(int x, int y, const unsigned char *str, int style)
|
||||||
|
{
|
||||||
|
lcd_puts_style_offset(x, y, str, style, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void lcd_puts_offset(int x, int y, const unsigned char *str, int offset)
|
||||||
|
{
|
||||||
|
lcd_puts_style_offset(x, y, str, STYLE_DEFAULT, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* put a string at a given char position, style, and pixel position,
|
||||||
|
* skipping first offset pixel columns */
|
||||||
|
void lcd_puts_style_offset(int x, int y, const unsigned char *str,
|
||||||
|
int style, int offset)
|
||||||
{
|
{
|
||||||
int xpos,ypos,w,h;
|
int xpos,ypos,w,h;
|
||||||
int lastmode = drawmode;
|
int lastmode = drawmode;
|
||||||
|
@ -1083,22 +1100,6 @@ void lcd_puts_style_offset(int x, int y, const unsigned char *str, int style,
|
||||||
}
|
}
|
||||||
drawmode = lastmode;
|
drawmode = lastmode;
|
||||||
}
|
}
|
||||||
void lcd_puts_style(int x, int y, const unsigned char *str, int style)
|
|
||||||
{
|
|
||||||
lcd_puts_style_offset(x, y, str, style, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* put a string at a given char position at a given offset mark */
|
|
||||||
void lcd_puts_offset(int x, int y, const unsigned char *str, int offset)
|
|
||||||
{
|
|
||||||
lcd_puts_style_offset(x, y, str, STYLE_DEFAULT, offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* put a string at a given char position */
|
|
||||||
void lcd_puts(int x, int y, const unsigned char *str)
|
|
||||||
{
|
|
||||||
lcd_puts_style(x, y, str, STYLE_DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** scrolling ***/
|
/*** scrolling ***/
|
||||||
|
|
||||||
|
@ -1226,7 +1227,7 @@ static void scroll_thread(void)
|
||||||
while ( 1 ) {
|
while ( 1 ) {
|
||||||
for ( index = 0; index < SCROLLABLE_LINES; index++ ) {
|
for ( index = 0; index < SCROLLABLE_LINES; index++ ) {
|
||||||
/* really scroll? */
|
/* really scroll? */
|
||||||
if ( !(scrolling_lines&(1<<index)))
|
if ( !(scrolling_lines&(1<<index)) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
s = &scroll[index];
|
s = &scroll[index];
|
||||||
|
@ -1269,7 +1270,8 @@ static void scroll_thread(void)
|
||||||
lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
|
lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
|
||||||
drawmode = DRMODE_SOLID;
|
drawmode = DRMODE_SOLID;
|
||||||
lcd_putsxyofs(xpos, ypos, s->offset, (unsigned char *)s->line);
|
lcd_putsxyofs(xpos, ypos, s->offset, (unsigned char *)s->line);
|
||||||
if (s->invert) {
|
if (s->invert)
|
||||||
|
{
|
||||||
drawmode = DRMODE_COMPLEMENT;
|
drawmode = DRMODE_COMPLEMENT;
|
||||||
lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
|
lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
|
||||||
}
|
}
|
||||||
|
|
|
@ -917,9 +917,26 @@ void lcd_putsxy(int x, int y, const unsigned char *str)
|
||||||
|
|
||||||
/*** Line oriented text output ***/
|
/*** Line oriented text output ***/
|
||||||
|
|
||||||
/* put a string at a given char position at a given style and with a given pixel position */
|
/* put a string at a given char position */
|
||||||
void lcd_puts_style_offset(int x, int y, const unsigned char *str, int style,
|
void lcd_puts(int x, int y, const unsigned char *str)
|
||||||
int offset)
|
{
|
||||||
|
lcd_puts_style_offset(x, y, str, STYLE_DEFAULT, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void lcd_puts_style(int x, int y, const unsigned char *str, int style)
|
||||||
|
{
|
||||||
|
lcd_puts_style_offset(x, y, str, style, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void lcd_puts_offset(int x, int y, const unsigned char *str, int offset)
|
||||||
|
{
|
||||||
|
lcd_puts_style_offset(x, y, str, STYLE_DEFAULT, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* put a string at a given char position, style, and pixel position,
|
||||||
|
* skipping first offset pixel columns */
|
||||||
|
void lcd_puts_style_offset(int x, int y, const unsigned char *str,
|
||||||
|
int style, int offset)
|
||||||
{
|
{
|
||||||
int xpos,ypos,w,h;
|
int xpos,ypos,w,h;
|
||||||
int lastmode = drawmode;
|
int lastmode = drawmode;
|
||||||
|
@ -944,23 +961,6 @@ void lcd_puts_style_offset(int x, int y, const unsigned char *str, int style,
|
||||||
drawmode = lastmode;
|
drawmode = lastmode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_puts_style(int x, int y, const unsigned char *str, int style)
|
|
||||||
{
|
|
||||||
lcd_puts_style_offset(x, y, str, style, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* put a string at a given char position at a given offset mark */
|
|
||||||
void lcd_puts_offset(int x, int y, const unsigned char *str, int offset)
|
|
||||||
{
|
|
||||||
lcd_puts_style_offset(x, y, str, STYLE_DEFAULT, offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* put a string at a given char position */
|
|
||||||
void lcd_puts(int x, int y, const unsigned char *str)
|
|
||||||
{
|
|
||||||
lcd_puts_style_offset(x, y, str, STYLE_DEFAULT, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** scrolling ***/
|
/*** scrolling ***/
|
||||||
|
|
||||||
/* Reverse the invert setting of the scrolling line (if any) at given char
|
/* Reverse the invert setting of the scrolling line (if any) at given char
|
||||||
|
@ -1002,20 +1002,21 @@ void lcd_bidir_scroll(int percent)
|
||||||
|
|
||||||
void lcd_puts_scroll(int x, int y, const unsigned char *string)
|
void lcd_puts_scroll(int x, int y, const unsigned char *string)
|
||||||
{
|
{
|
||||||
lcd_puts_scroll_style_offset(x, y, string, STYLE_DEFAULT, 0);
|
lcd_puts_scroll_style(x, y, string, STYLE_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_puts_scroll_offset(int x, int y, const unsigned char *string, int offset)
|
|
||||||
{
|
|
||||||
lcd_puts_scroll_style_offset(x, y, string, STYLE_DEFAULT, offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
void lcd_puts_scroll_style(int x, int y, const unsigned char *string, int style)
|
void lcd_puts_scroll_style(int x, int y, const unsigned char *string, int style)
|
||||||
{
|
{
|
||||||
lcd_puts_scroll_style_offset(x, y, string, style, 0);
|
lcd_puts_scroll_style_offset(x, y, string, style, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string,
|
void lcd_puts_scroll_offset(int x, int y, const unsigned char *string,
|
||||||
|
int offset)
|
||||||
|
{
|
||||||
|
lcd_puts_scroll_style_offset(x, y, string, STYLE_DEFAULT, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string,
|
||||||
int style, int offset)
|
int style, int offset)
|
||||||
{
|
{
|
||||||
struct scrollinfo* s;
|
struct scrollinfo* s;
|
||||||
|
@ -1130,7 +1131,8 @@ static void scroll_thread(void)
|
||||||
lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
|
lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
|
||||||
drawmode = DRMODE_SOLID;
|
drawmode = DRMODE_SOLID;
|
||||||
lcd_putsxyofs(xpos, ypos, s->offset, s->line);
|
lcd_putsxyofs(xpos, ypos, s->offset, s->line);
|
||||||
if (s->invert) {
|
if (s->invert)
|
||||||
|
{
|
||||||
drawmode = DRMODE_COMPLEMENT;
|
drawmode = DRMODE_COMPLEMENT;
|
||||||
lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
|
lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,13 +37,11 @@ extern void lcd_remote_emireduce(bool state);
|
||||||
extern void lcd_remote_clear_display(void);
|
extern void lcd_remote_clear_display(void);
|
||||||
extern void lcd_remote_puts(int x, int y, const unsigned char *string);
|
extern void lcd_remote_puts(int x, int y, const unsigned char *string);
|
||||||
extern void lcd_remote_puts_style(int x, int y, const unsigned char *string,
|
extern void lcd_remote_puts_style(int x, int y, const unsigned char *string,
|
||||||
int style);
|
int style);
|
||||||
extern void lcd_remote_puts_offset(int x, int y, const unsigned char *str, int offset);
|
extern void lcd_remote_puts_offset(int x, int y, const unsigned char *str, int offset);
|
||||||
extern void lcd_remote_puts_style_offset(int x, int y, const unsigned char *str, int style, int offset);
|
extern void lcd_remote_puts_style_offset(int x, int y, const unsigned char *str, int style, int offset);
|
||||||
|
|
||||||
extern void lcd_remote_putc(int x, int y, unsigned short ch);
|
extern void lcd_remote_putc(int x, int y, unsigned short ch);
|
||||||
extern void lcd_remote_stop_scroll(void);
|
extern void lcd_remote_stop_scroll(void);
|
||||||
|
|
||||||
extern void lcd_remote_scroll_speed(int speed);
|
extern void lcd_remote_scroll_speed(int speed);
|
||||||
extern void lcd_remote_scroll_delay(int ms);
|
extern void lcd_remote_scroll_delay(int ms);
|
||||||
extern void lcd_remote_puts_scroll(int x, int y, const unsigned char* string);
|
extern void lcd_remote_puts_scroll(int x, int y, const unsigned char* string);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue