From 1c5d0b41eebdb4f8c627b1a0e5f7b699f0b08fb8 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Wed, 3 Apr 2013 16:33:23 +0200 Subject: [PATCH] scroll_engine: Rename scroll_stop* functions to be more consistent with the lcd api. Change-Id: I8ada10b96bfb628cca0331689e8b936ae47c7e1c --- apps/debug_menu.c | 2 +- apps/gui/bitmap/list-skinned.c | 4 ++-- apps/gui/bitmap/list.c | 10 ++++---- apps/gui/charcell/list.c | 2 +- apps/gui/quickscreen.c | 4 ++-- apps/gui/skin_engine/skin_render.c | 5 ++-- apps/gui/splash.c | 2 +- apps/gui/usb_screen.c | 4 ++-- apps/gui/viewport.c | 2 +- apps/gui/wps.c | 6 ++--- apps/gui/yesno.c | 4 ++-- apps/plugin.c | 4 ++-- apps/plugin.h | 5 ++-- apps/plugins/boomshine.lua | 2 +- apps/plugins/chessclock.c | 2 +- apps/plugins/lrcplayer.c | 2 +- apps/plugins/resistor.c | 6 ++--- apps/plugins/splitedit.c | 2 +- apps/plugins/superdom.c | 2 +- apps/radio/radio_skin.c | 2 +- apps/screen_access.c | 8 +++---- apps/screen_access.h | 6 ++--- apps/screens.c | 4 ++-- apps/settings.c | 1 + apps/settings_list.c | 1 + firmware/drivers/lcd-16bit-common.c | 8 ++----- firmware/drivers/lcd-1bit-vert.c | 2 +- firmware/drivers/lcd-bitmap-common.c | 10 ++++++-- firmware/drivers/lcd-charcell.c | 6 ++--- firmware/export/lcd-remote.h | 3 --- firmware/export/lcd.h | 4 ---- firmware/export/scroll_engine.h | 24 +++++++++++++------ firmware/rolo.c | 2 +- firmware/scroll_engine.c | 36 ++++++++++++++++------------ 34 files changed, 100 insertions(+), 87 deletions(-) diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 2f50a43825..6f7de6d54e 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -2084,7 +2084,7 @@ static bool cpu_boost_log(void) } } } - lcd_stop_scroll(); + lcd_scroll_stop(); get_action(CONTEXT_STD,TIMEOUT_BLOCK); lcd_setfont(FONT_UI); return false; diff --git a/apps/gui/bitmap/list-skinned.c b/apps/gui/bitmap/list-skinned.c index d0803b5dc8..d6b868ae26 100644 --- a/apps/gui/bitmap/list-skinned.c +++ b/apps/gui/bitmap/list-skinned.c @@ -54,7 +54,7 @@ void skinlist_set_cfg(enum screen_type screen, if (listcfg[screen] != cfg) { if (listcfg[screen]) - screens[screen].scroll_stop(&listcfg[screen]->selected_item_vp.vp); + screens[screen].scroll_stop_viewport(&listcfg[screen]->selected_item_vp.vp); listcfg[screen] = cfg; current_list = NULL; current_column = -1; @@ -269,7 +269,7 @@ bool skinlist_draw(struct screen *display, struct gui_synclist *list) /* force disableing scroll because it breaks later */ if (!is_selected) { - display->scroll_stop(&skin_viewport->vp); + display->scroll_stop_viewport(&skin_viewport->vp); skin_viewport->vp.x = original_x; skin_viewport->vp.y = original_y; } diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c index 191446e186..79eec60b26 100644 --- a/apps/gui/bitmap/list.c +++ b/apps/gui/bitmap/list.c @@ -61,9 +61,9 @@ void gui_synclist_scroll_stop(struct gui_synclist *lists) { FOR_NB_SCREENS(i) { - screens[i].scroll_stop(&list_text[i]); - screens[i].scroll_stop(&title_text[i]); - screens[i].scroll_stop(lists->parent[i]); + screens[i].scroll_stop_viewport(&list_text[i]); + screens[i].scroll_stop_viewport(&title_text[i]); + screens[i].scroll_stop_viewport(lists->parent[i]); } } @@ -100,7 +100,7 @@ static bool draw_title(struct screen *display, struct gui_synclist *list) if (sb_set_title_text(list->title, list->title_icon, screen)) return false; /* the sbs is handling the title */ - display->scroll_stop(title_text_vp); + display->scroll_stop_viewport(title_text_vp); if (!list_display_title(list, screen)) return false; *title_text_vp = *(list->parent[screen]); @@ -160,7 +160,7 @@ void list_draw(struct screen *display, struct gui_synclist *list) line_height = parent->line_height; display->set_viewport(parent); display->clear_viewport(); - display->scroll_stop(list_text_vp); + display->scroll_stop_viewport(list_text_vp); *list_text_vp = *parent; list_text_vp->line_height = line_height; if ((show_title = draw_title(display, list))) diff --git a/apps/gui/charcell/list.c b/apps/gui/charcell/list.c index 3d7f876adc..753b8ff853 100644 --- a/apps/gui/charcell/list.c +++ b/apps/gui/charcell/list.c @@ -43,7 +43,7 @@ void gui_synclist_scroll_stop(struct gui_synclist *lists) (void)lists; FOR_NB_SCREENS(i) { - screens[i].stop_scroll(); + screens[i].scroll_stop(); } } diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c index 5c8a7705ae..64d938d8aa 100644 --- a/apps/gui/quickscreen.c +++ b/apps/gui/quickscreen.c @@ -323,7 +323,7 @@ static bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_ente FOR_NB_SCREENS(i) { screens[i].set_viewport(NULL); - screens[i].stop_scroll(); + screens[i].scroll_stop(); viewportmanager_theme_enable(i, true, &parent[i]); quickscreen_fix_viewports(qs, &screens[i], &parent[i], vps[i], &vp_icons[i]); gui_quickscreen_draw(qs, &screens[i], &parent[i], vps[i], &vp_icons[i]); @@ -368,7 +368,7 @@ static bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_ente FOR_NB_SCREENS(i) { /* stop scrolling before exiting */ for (int j = 0; j < QUICKSCREEN_ITEM_COUNT; j++) - screens[i].scroll_stop(&vps[i][j]); + screens[i].scroll_stop_viewport(&vps[i][j]); viewportmanager_theme_undo(i, true); } diff --git a/apps/gui/skin_engine/skin_render.c b/apps/gui/skin_engine/skin_render.c index d9424b993d..67f1f0f448 100644 --- a/apps/gui/skin_engine/skin_render.c +++ b/apps/gui/skin_engine/skin_render.c @@ -427,7 +427,6 @@ static void do_tags_in_hidden_conditional(struct skin_element* branch, #endif gwps->display->set_viewport(&skin_viewport->vp); gwps->display->clear_viewport(); - gwps->display->scroll_stop(&skin_viewport->vp); gwps->display->set_viewport(&info->skin_vp->vp); skin_viewport->hidden_flags |= VP_DRAW_HIDDEN; @@ -780,7 +779,7 @@ void skin_render_viewport(struct skin_element* viewport, struct gui_wps *gwps, if (refresh_type && needs_update) { if (info.force_redraw) - display->scroll_stop_line(&skin_viewport->vp, info.line_number); + display->scroll_stop_viewport_line(&skin_viewport->vp, info.line_number); write_line(display, align, info.line_number, info.line_scrolls, info.text_style); } @@ -969,7 +968,7 @@ void skin_render_playlistviewer(struct playlistviewer* viewer, if (refresh_type && needs_update) { if (!info.force_redraw) - display->scroll_stop_line(&skin_viewport->vp, info.line_number); + display->scroll_stop_viewport_line(&skin_viewport->vp, info.line_number); write_line(display, align, info.line_number, info.line_scrolls, info.text_style); } diff --git a/apps/gui/splash.c b/apps/gui/splash.c index ad6625fec6..2608a2e02e 100644 --- a/apps/gui/splash.c +++ b/apps/gui/splash.c @@ -133,7 +133,7 @@ static void splash_internal(struct screen * screen, const char *fmt, va_list ap) * First boundaries, then the grey filling, then the black border and finally * the text*/ - screen->stop_scroll(); + screen->scroll_stop(); #ifdef HAVE_LCD_BITMAP diff --git a/apps/gui/usb_screen.c b/apps/gui/usb_screen.c index a02516fefb..e5bc12960e 100644 --- a/apps/gui/usb_screen.c +++ b/apps/gui/usb_screen.c @@ -156,7 +156,7 @@ static void usb_screen_fix_viewports(struct screen *screen, disable = (parent->width < logo_width || parent->height < logo_height); viewportmanager_theme_enable(screen->screen_type, !disable, parent); screen->clear_display(); - screen->stop_scroll(); + screen->scroll_stop(); *logo = *parent; logo->x = parent->x + parent->width - logo_width; @@ -308,7 +308,7 @@ void gui_usb_screen_run(bool early_usb) vp = &usb_screen_vps_ar[i].parent; #endif if (vp) - screens[i].scroll_stop(vp); + screens[i].scroll_stop_viewport(vp); } #ifdef USB_ENABLE_HID if (global_settings.usb_keypad_mode != usb_keypad_mode) diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c index 760e13cff7..0b5441e02b 100644 --- a/apps/gui/viewport.c +++ b/apps/gui/viewport.c @@ -178,7 +178,7 @@ static void toggle_theme(enum screen_type screen, bool force) #if LCD_DEPTH > 1 || (defined(LCD_REMOTE_DEPTH) && LCD_REMOTE_DEPTH > 1) screens[screen].backdrop_show(NULL); #endif - screens[screen].stop_scroll(); + screens[screen].scroll_stop(); skinlist_set_cfg(screen, NULL); } /* let list initialize viewport in case viewport dimensions is changed. */ diff --git a/apps/gui/wps.c b/apps/gui/wps.c index 726df6add4..b4c3f40e9f 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c @@ -358,7 +358,7 @@ bool ffwd_rew(int button) #endif #if CONFIG_KEYPAD == PLAYER_PAD FOR_NB_SCREENS(i) - skin_get_gwps(WPS, i)->display->stop_scroll(); + skin_get_gwps(WPS, i)->display->scroll_stop(); #endif if (direction > 0) status_set_ffmode(STATUS_FASTFORWARD); @@ -639,7 +639,7 @@ static void gwps_leave_wps(void) { FOR_NB_SCREENS(i) { - skin_get_gwps(WPS, i)->display->stop_scroll(); + skin_get_gwps(WPS, i)->display->scroll_stop(); #ifdef HAVE_BACKDROP_IMAGE skin_backdrop_show(sb_get_backdrop(i)); #endif @@ -668,7 +668,7 @@ static void gwps_enter_wps(void) { gwps = skin_get_gwps(WPS, i); display = gwps->display; - display->stop_scroll(); + display->scroll_stop(); viewportmanager_theme_enable(i, skin_has_sbs(i, skin_get_gwps(WPS, i)->data), NULL); /* Update the values in the first (default) viewport - in case the user diff --git a/apps/gui/yesno.c b/apps/gui/yesno.c index 74e3ad05a7..b754d5e477 100644 --- a/apps/gui/yesno.c +++ b/apps/gui/yesno.c @@ -166,7 +166,7 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message, #else viewportmanager_theme_enable(i, true, yn[i].vp); #endif - screens[i].stop_scroll(); + screens[i].scroll_stop(); gui_yesno_draw(&(yn[i])); } @@ -231,7 +231,7 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message, FOR_NB_SCREENS(i) { - screens[i].scroll_stop(yn[i].vp); + screens[i].scroll_stop_viewport(yn[i].vp); viewportmanager_theme_undo(i, true); } diff --git a/apps/plugin.c b/apps/plugin.c index 658064c53e..62f9dd7558 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -143,7 +143,7 @@ static const struct plugin_api rockbox_api = { lcd_puts, lcd_putsf, lcd_puts_scroll, - lcd_stop_scroll, + lcd_scroll_stop, #ifdef HAVE_LCD_CHARCELLS lcd_define_pattern, lcd_get_locked_pattern, @@ -246,7 +246,7 @@ static const struct plugin_api rockbox_api = { lcd_remote_clear_display, lcd_remote_puts, lcd_remote_puts_scroll, - lcd_remote_stop_scroll, + lcd_remote_scroll_stop, lcd_remote_set_drawmode, lcd_remote_get_drawmode, lcd_remote_setfont, diff --git a/apps/plugin.h b/apps/plugin.h index 874b9b4a56..15f7e96946 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -62,6 +62,7 @@ void* plugin_get_buffer(size_t *buffer_size); #include "usb.h" #include "font.h" #include "lcd.h" +#include "scroll_engine.h" #include "metadata.h" #include "sound.h" #include "mpeg.h" @@ -195,7 +196,7 @@ struct plugin_api { void (*lcd_puts)(int x, int y, const unsigned char *string); void (*lcd_putsf)(int x, int y, const unsigned char *fmt, ...); void (*lcd_puts_scroll)(int x, int y, const unsigned char* string); - void (*lcd_stop_scroll)(void); + void (*lcd_scroll_stop)(void); #ifdef HAVE_LCD_CHARCELLS void (*lcd_define_pattern)(unsigned long ucs, const char *pattern); unsigned long (*lcd_get_locked_pattern)(void); @@ -327,7 +328,7 @@ struct plugin_api { void (*lcd_remote_clear_display)(void); void (*lcd_remote_puts)(int x, int y, const unsigned char *string); void (*lcd_remote_puts_scroll)(int x, int y, const unsigned char* string); - void (*lcd_remote_stop_scroll)(void); + void (*lcd_remote_scroll_stop)(void); void (*lcd_remote_set_drawmode)(int mode); int (*lcd_remote_get_drawmode)(void); void (*lcd_remote_setfont)(int font); diff --git a/apps/plugins/boomshine.lua b/apps/plugins/boomshine.lua index fe73e8cb66..2eb43dedbd 100644 --- a/apps/plugins/boomshine.lua +++ b/apps/plugins/boomshine.lua @@ -345,7 +345,7 @@ function display_message(to, ...) rb.sleep(to) end - rb.lcd_stop_scroll() -- Stop our scrolling message + rb.lcd_scroll_stop() -- Stop our scrolling message end if HAS_TOUCHSCREEN then diff --git a/apps/plugins/chessclock.c b/apps/plugins/chessclock.c index be4d90e81a..3a454b7714 100644 --- a/apps/plugins/chessclock.c +++ b/apps/plugins/chessclock.c @@ -776,7 +776,7 @@ static int chessclock_set_int(char* string, *variable = min; } - rb->lcd_stop_scroll(); + rb->lcd_scroll_stop(); return CHCL_OK; } diff --git a/apps/plugins/lrcplayer.c b/apps/plugins/lrcplayer.c index 051d7adbb2..6e0394fa51 100644 --- a/apps/plugins/lrcplayer.c +++ b/apps/plugins/lrcplayer.c @@ -2200,7 +2200,7 @@ static int timetag_editor(void) } FOR_NB_SCREENS(idx) - rb->screens[idx]->stop_scroll(); + rb->screens[idx]->scroll_stop(); if (current.changed_lrc) { diff --git a/apps/plugins/resistor.c b/apps/plugins/resistor.c index 8dea817898..16374b3d18 100644 --- a/apps/plugins/resistor.c +++ b/apps/plugins/resistor.c @@ -771,7 +771,7 @@ static void led_resistance_calc(void) } } display->set_viewport(&text_vp); - rb->lcd_stop_scroll(); + rb->lcd_scroll_stop(); display->set_viewport(&screen_vp); rb->lcd_clear_display(); } @@ -908,7 +908,7 @@ static void resistance_to_color(void) } } display->set_viewport(&text_vp); - rb->lcd_stop_scroll(); + rb->lcd_scroll_stop(); display->set_viewport(&screen_vp); rb->lcd_clear_display(); } @@ -989,7 +989,7 @@ static void color_to_resistance(void) } } display->set_viewport(&text_vp); - rb->lcd_stop_scroll(); + rb->lcd_scroll_stop(); display->set_viewport(&screen_vp); rb->lcd_clear_display(); return; diff --git a/apps/plugins/splitedit.c b/apps/plugins/splitedit.c index d44e2d1f51..1e117b153b 100644 --- a/apps/plugins/splitedit.c +++ b/apps/plugins/splitedit.c @@ -874,7 +874,7 @@ static void save_editor(struct mp3entry *mp3, int splittime) break; case SE_SAVE: - rb->lcd_stop_scroll(); + rb->lcd_scroll_stop(); rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); rb->lcd_fillrect(0, 6*8, LCD_WIDTH, LCD_HEIGHT); rb->lcd_set_drawmode(DRMODE_SOLID); diff --git a/apps/plugins/superdom.c b/apps/plugins/superdom.c index 1ef99dee30..9d06d9a4e3 100644 --- a/apps/plugins/superdom.c +++ b/apps/plugins/superdom.c @@ -889,7 +889,7 @@ static int get_number(char* param, int* value, int max) { rb->lcd_update(); } rb->lcd_setfont(FONT_UI); - rb->lcd_stop_scroll(); + rb->lcd_scroll_stop(); if (ret == RET_VAL_QUIT_ERR) rb->splash(HZ, "Cancelled"); return ret; diff --git a/apps/radio/radio_skin.c b/apps/radio/radio_skin.c index 87bef25d3a..90aa977e56 100644 --- a/apps/radio/radio_skin.c +++ b/apps/radio/radio_skin.c @@ -78,7 +78,7 @@ void fms_fix_displays(enum fms_exiting toggle_state) } else { - screens[i].stop_scroll(); + screens[i].scroll_stop(); #ifdef HAVE_BACKDROP_IMAGE skin_backdrop_show(sb_get_backdrop(i)); #endif diff --git a/apps/screen_access.c b/apps/screen_access.c index 152f96f7fa..161e596aa2 100644 --- a/apps/screen_access.c +++ b/apps/screen_access.c @@ -245,11 +245,11 @@ struct screen screens[NB_SCREENS] = .puts_scroll_offset=&lcd_puts_scroll_offset, .scroll_speed=&lcd_scroll_speed, .scroll_delay=&lcd_scroll_delay, - .stop_scroll=&lcd_stop_scroll, .clear_display=&lcd_clear_display, .clear_viewport=&lcd_clear_viewport, .scroll_stop=&lcd_scroll_stop, - .scroll_stop_line=&lcd_scroll_stop_line, + .scroll_stop_viewport=&lcd_scroll_stop_viewport, + .scroll_stop_viewport_line=&lcd_scroll_stop_viewport_line, .update=&lcd_update, .update_viewport=&lcd_update_viewport, .backlight_on=&backlight_on, @@ -346,11 +346,11 @@ struct screen screens[NB_SCREENS] = .puts_scroll_offset=&lcd_remote_puts_scroll_offset, .scroll_speed=&lcd_remote_scroll_speed, .scroll_delay=&lcd_remote_scroll_delay, - .stop_scroll=&lcd_remote_stop_scroll, .clear_display=&lcd_remote_clear_display, .clear_viewport=&lcd_remote_clear_viewport, .scroll_stop=&lcd_remote_scroll_stop, - .scroll_stop_line=&lcd_remote_scroll_stop_line, + .scroll_stop_viewport=&lcd_remote_scroll_stop_viewport, + .scroll_stop_viewport_line=&lcd_remote_scroll_stop_viewport_line, .update=&lcd_remote_update, .update_viewport=&lcd_remote_update_viewport, .backlight_on=&remote_backlight_on, diff --git a/apps/screen_access.h b/apps/screen_access.h index ea05a2294d..448437c637 100644 --- a/apps/screen_access.h +++ b/apps/screen_access.h @@ -145,11 +145,11 @@ struct screen int x_offset); void (*scroll_speed)(int speed); void (*scroll_delay)(int ms); - void (*stop_scroll)(void); void (*clear_display)(void); void (*clear_viewport)(void); - void (*scroll_stop)(const struct viewport* vp); - void (*scroll_stop_line)(const struct viewport* vp, int y); + void (*scroll_stop)(void); + void (*scroll_stop_viewport)(const struct viewport *vp); + void (*scroll_stop_viewport_line)(const struct viewport *vp, int line); void (*update)(void); void (*update_viewport)(void); void (*backlight_on)(void); diff --git a/apps/screens.c b/apps/screens.c index d02f29b4fe..a069bf19d9 100644 --- a/apps/screens.c +++ b/apps/screens.c @@ -566,7 +566,7 @@ bool set_time_screen(const char* title, struct tm *tm) } } FOR_NB_SCREENS(s) - screens[s].scroll_stop(&viewports[s]); + screens[s].scroll_stop_viewport(&viewports[s]); #ifdef HAVE_TOUCHSCREEN touchscreen_set_mode(old_mode); #endif @@ -581,7 +581,7 @@ bool shutdown_screen(void) bool done = false; long time_entered = current_tick; - lcd_stop_scroll(); + lcd_scroll_stop(); splash(0, str(LANG_CONFIRM_SHUTDOWN)); diff --git a/apps/settings.c b/apps/settings.c index cf51b0793c..1d92df270b 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -72,6 +72,7 @@ #include "viewport.h" #include "statusbar-skinned.h" #include "bootchart.h" +#include "scroll_engine.h" #if CONFIG_CODEC == MAS3507D void dac_line_in(bool enable); diff --git a/apps/settings_list.c b/apps/settings_list.c index 53e79fae04..6ffb2b551b 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -27,6 +27,7 @@ #include "lang.h" #include "talk.h" #include "lcd.h" +#include "scroll_engine.h" #include "button.h" #include "backlight.h" #include "sound.h" diff --git a/firmware/drivers/lcd-16bit-common.c b/firmware/drivers/lcd-16bit-common.c index f8673ec6db..dffc1cf075 100644 --- a/firmware/drivers/lcd-16bit-common.c +++ b/firmware/drivers/lcd-16bit-common.c @@ -144,13 +144,9 @@ void lcd_clear_viewport(void) } if (current_vp == &default_vp) - { - lcd_scroll_info.lines = 0; - } + lcd_scroll_stop(); else - { - lcd_scroll_stop(current_vp); - } + lcd_scroll_stop_viewport(current_vp); } /*** parameter handling ***/ diff --git a/firmware/drivers/lcd-1bit-vert.c b/firmware/drivers/lcd-1bit-vert.c index 5cacf0a740..668c685187 100644 --- a/firmware/drivers/lcd-1bit-vert.c +++ b/firmware/drivers/lcd-1bit-vert.c @@ -226,7 +226,7 @@ void LCDFN(clear_viewport)(void) current_vp->drawmode = oldmode; - LCDFN(scroll_stop)(current_vp); + LCDFN(scroll_stop_viewport)(current_vp); } } diff --git a/firmware/drivers/lcd-bitmap-common.c b/firmware/drivers/lcd-bitmap-common.c index a17ac51006..10a567edf1 100644 --- a/firmware/drivers/lcd-bitmap-common.c +++ b/firmware/drivers/lcd-bitmap-common.c @@ -178,6 +178,12 @@ void LCDFN(set_viewport)(struct viewport* vp) #endif } +struct viewport *LCDFN(get_viewport)(bool *is_default) +{ + *is_default = (current_vp == &default_vp); + return current_vp; +} + void LCDFN(update_viewport)(void) { LCDFN(update_rect)(current_vp->x, current_vp->y, @@ -405,7 +411,7 @@ void LCDFN(puts_style_xyoffset)(int x, int y, const unsigned char *str, int style, int x_offset, int y_offset) { int xpos, ypos, h; - LCDFN(scroll_stop_line)(current_vp, y); + LCDFN(scroll_stop_viewport_line)(current_vp, y); if(!str) return; @@ -491,7 +497,7 @@ void LCDFN(puts_scroll_style_xyoffset)(int x, int y, const unsigned char *string if (restart) { /* remove any previously scrolling line at the same location */ - LCDFN(scroll_stop_line)(current_vp, y); + LCDFN(scroll_stop_viewport_line)(current_vp, y); if (LCDFN(scroll_info).lines >= LCDM(SCROLLABLE_LINES)) return; LCDFN(puts_style_xyoffset)(x, y, string, style, x_offset, y_offset); diff --git a/firmware/drivers/lcd-charcell.c b/firmware/drivers/lcd-charcell.c index b59b270f9b..bdd02de1b6 100644 --- a/firmware/drivers/lcd-charcell.c +++ b/firmware/drivers/lcd-charcell.c @@ -377,7 +377,7 @@ void lcd_clear_viewport(void) for (y = 0; y < current_vp->height; y++) lcd_putxchar(x, y, xspace); - lcd_scroll_stop(current_vp); + lcd_scroll_stop_viewport(current_vp); } } @@ -486,7 +486,7 @@ void lcd_puts_offset(int x, int y, const unsigned char *str, int offset) return; /* make sure scrolling is turned off on the line we are updating */ - lcd_scroll_stop_line(current_vp, y); + lcd_scroll_stop_viewport_line(current_vp, y); x = lcd_putsxyofs(x, y, offset, str); while (x < current_vp->width) @@ -509,7 +509,7 @@ void lcd_puts_scroll_offset(int x, int y, const unsigned char *string, return; /* remove any previously scrolling line at the same location */ - lcd_scroll_stop_line(current_vp, y); + lcd_scroll_stop_viewport_line(current_vp, y); if (lcd_scroll_info.lines >= LCD_SCROLLABLE_LINES) return; diff --git a/firmware/export/lcd-remote.h b/firmware/export/lcd-remote.h index 6a3371fef2..74b668db3d 100644 --- a/firmware/export/lcd-remote.h +++ b/firmware/export/lcd-remote.h @@ -187,9 +187,6 @@ extern void lcd_remote_puts_style_offset(int x, int y, const unsigned char *str, extern void lcd_remote_puts_style_xyoffset(int x, int y, const unsigned char *str, int style, int x_offset, int y_offset); extern void lcd_remote_putc(int x, int y, unsigned short ch); -extern void lcd_remote_stop_scroll(void); -extern void lcd_remote_scroll_speed(int speed); -extern void lcd_remote_scroll_delay(int ms); extern void lcd_remote_puts_scroll(int x, int y, const unsigned char *str); extern void lcd_remote_puts_scroll_style(int x, int y, const unsigned char *str, int style); diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index 5ad2d83513..7ea053f241 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h @@ -207,10 +207,6 @@ extern void lcd_puts_offset(int x, int y, const unsigned char *str, int offset); extern void lcd_puts_scroll_offset(int x, int y, const unsigned char *string, int offset); extern void lcd_putc(int x, int y, unsigned long ucs); -extern void lcd_stop_scroll(void); -extern void lcd_bidir_scroll(int threshold); -extern void lcd_scroll_speed(int speed); -extern void lcd_scroll_delay(int ms); extern void lcd_puts_scroll(int x, int y, const unsigned char* string); extern void lcd_puts_scroll_style(int x, int y, const unsigned char* string, int style); diff --git a/firmware/export/scroll_engine.h b/firmware/export/scroll_engine.h index 55f4120893..01a9a5e33d 100644 --- a/firmware/export/scroll_engine.h +++ b/firmware/export/scroll_engine.h @@ -29,14 +29,24 @@ #include #include "file.h" -void scroll_init(void) INIT_ATTR; -void lcd_scroll_stop(const struct viewport* vp); -void lcd_scroll_stop_line(const struct viewport* vp, int y); -void lcd_scroll_fn(void); +extern void scroll_init(void) INIT_ATTR; + +extern void lcd_bidir_scroll(int threshold); +extern void lcd_scroll_speed(int speed); +extern void lcd_scroll_delay(int ms); + +extern void lcd_scroll_stop(void); +extern void lcd_scroll_stop_viewport(const struct viewport *vp); +extern void lcd_scroll_stop_viewport_line(const struct viewport *vp, int line); +extern void lcd_scroll_fn(void); #ifdef HAVE_REMOTE_LCD -void lcd_remote_scroll_fn(void); -void lcd_remote_scroll_stop(const struct viewport* vp); -void lcd_remote_scroll_stop_line(const struct viewport* vp, int y); +extern void lcd_remote_scroll_speed(int speed); +extern void lcd_remote_scroll_delay(int ms); + +extern void lcd_remote_scroll_stop(void); +extern void lcd_remote_scroll_stop_viewport(const struct viewport *vp); +extern void lcd_remote_scroll_stop_viewport_line(const struct viewport *vp, int line); +extern void lcd_remote_scroll_fn(void); #endif /* internal usage, but in multiple drivers */ diff --git a/firmware/rolo.c b/firmware/rolo.c index 325e17e97f..79969bbbcf 100644 --- a/firmware/rolo.c +++ b/firmware/rolo.c @@ -115,7 +115,7 @@ static void rolo_error(const char *text) button_get(true); button_get(true); button_get(true); - lcd_stop_scroll(); + lcd_scroll_stop(); } #if CONFIG_CPU == SH7034 || CONFIG_CPU == IMX31L || CONFIG_CPU == RK27XX diff --git a/firmware/scroll_engine.c b/firmware/scroll_engine.c index bc356a8281..82af26afa8 100644 --- a/firmware/scroll_engine.c +++ b/firmware/scroll_engine.c @@ -41,6 +41,10 @@ static const char scroll_tick_table[18] = { 100, 80, 64, 50, 40, 32, 25, 20, 16, 12, 10, 8, 6, 5, 4, 3, 2, 1 }; +/* imported private functions from lcd-bitmap-common.c */ +extern struct viewport *lcd_get_viewport(void); +extern struct viewport *lcd_remote_get_viewport(void); + static void scroll_thread(void); static char scroll_stack[DEFAULT_STACK_SIZE*3]; static const char scroll_name[] = "scroll"; @@ -80,20 +84,21 @@ struct scroll_screen_info lcd_remote_scroll_info = }; #endif /* HAVE_REMOTE_LCD */ -void lcd_stop_scroll(void) +void lcd_scroll_stop(void) { lcd_scroll_info.lines = 0; } /* Stop scrolling line y in the specified viewport, or all lines if y < 0 */ -void lcd_scroll_stop_line(const struct viewport* current_vp, int y) +void lcd_scroll_stop_viewport_line(const struct viewport *current_vp, int line) { int i = 0; while (i < lcd_scroll_info.lines) { - if ((lcd_scroll_info.scroll[i].vp == current_vp) && - ((y < 0) || (lcd_scroll_info.scroll[i].y == y))) + struct viewport *vp = lcd_scroll_info.scroll[i].vp; + if (((vp == current_vp)) && + ((line < 0) || (lcd_scroll_info.scroll[i].y == line))) { /* If i is not the last active line in the array, then move the last item to position i */ @@ -106,7 +111,7 @@ void lcd_scroll_stop_line(const struct viewport* current_vp, int y) /* A line can only appear once, so we're done, * unless we are clearing the whole viewport */ - if (y >= 0) + if (line >= 0) return ; } else @@ -117,9 +122,9 @@ void lcd_scroll_stop_line(const struct viewport* current_vp, int y) } /* Stop all scrolling lines in the specified viewport */ -void lcd_scroll_stop(const struct viewport* vp) +void lcd_scroll_stop_viewport(const struct viewport *current_vp) { - lcd_scroll_stop_line(vp, -1); + lcd_scroll_stop_viewport_line(current_vp, -1); } void lcd_scroll_speed(int speed) @@ -157,20 +162,21 @@ void lcd_jump_scroll_delay(int ms) #endif #ifdef HAVE_REMOTE_LCD -void lcd_remote_stop_scroll(void) +void lcd_remote_scroll_stop(void) { lcd_remote_scroll_info.lines = 0; } /* Stop scrolling line y in the specified viewport, or all lines if y < 0 */ -void lcd_remote_scroll_stop_line(const struct viewport* current_vp, int y) +void lcd_remote_scroll_stop_viewport_line(const struct viewport *current_vp, int line) { int i = 0; - while (i < lcd_remote_scroll_info.lines) + while (i < lcd_scroll_info.lines) { - if ((lcd_remote_scroll_info.scroll[i].vp == current_vp) && - ((y < 0) || (lcd_remote_scroll_info.scroll[i].y == y))) + struct viewport *vp = lcd_remote_scroll_info.scroll[i].vp; + if (((vp == current_vp)) && + ((line < 0) || (lcd_remote_scroll_info.scroll[i].y == line))) { /* If i is not the last active line in the array, then move the last item to position i */ @@ -183,7 +189,7 @@ void lcd_remote_scroll_stop_line(const struct viewport* current_vp, int y) /* A line can only appear once, so we're done, * unless we are clearing the whole viewport */ - if (y >= 0) + if (line >= 0) return ; } else @@ -194,9 +200,9 @@ void lcd_remote_scroll_stop_line(const struct viewport* current_vp, int y) } /* Stop all scrolling lines in the specified viewport */ -void lcd_remote_scroll_stop(const struct viewport* vp) +void lcd_remote_scroll_stop_viewport(const struct viewport *current_vp) { - lcd_remote_scroll_stop_line(vp, -1); + lcd_remote_scroll_stop_viewport_line(current_vp, -1); } void lcd_remote_scroll_speed(int speed)