summaryrefslogtreecommitdiffstats
path: root/firmware/scroll_engine.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/scroll_engine.c')
-rw-r--r--firmware/scroll_engine.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/firmware/scroll_engine.c b/firmware/scroll_engine.c
index 599e7f58b5..4783e9f1ef 100644
--- a/firmware/scroll_engine.c
+++ b/firmware/scroll_engine.c
@@ -82,6 +82,40 @@ void lcd_stop_scroll(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(struct viewport* current_vp, int y)
+{
+ 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)))
+ {
+ /* If i is not the last active line in the array, then move
+ the last item to position i */
+ if ((i + 1) != lcd_scroll_info.lines)
+ {
+ lcd_scroll_info.scroll[i] = lcd_scroll_info.scroll[lcd_scroll_info.lines-1];
+ }
+ lcd_scroll_info.lines--;
+
+ /* A line can only appear once, so we're done. */
+ return ;
+ }
+ else
+ {
+ i++;
+ }
+ }
+}
+
+/* Stop all scrolling lines in the specified viewport */
+void lcd_scroll_stop(struct viewport* vp)
+{
+ lcd_scroll_stop_line(vp, -1);
+}
+
void lcd_scroll_speed(int speed)
{
lcd_scroll_info.ticks = scroll_tick_table[speed];
@@ -122,6 +156,40 @@ void lcd_remote_stop_scroll(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(struct viewport* current_vp, int y)
+{
+ int i = 0;
+
+ while (i < lcd_remote_scroll_info.lines)
+ {
+ if ((lcd_remote_scroll_info.scroll[i].vp == current_vp) &&
+ ((y < 0) || (lcd_remote_scroll_info.scroll[i].y == y)))
+ {
+ /* If i is not the last active line in the array, then move
+ the last item to position i */
+ if ((i + 1) != lcd_remote_scroll_info.lines)
+ {
+ lcd_remote_scroll_info.scroll[i] = lcd_remote_scroll_info.scroll[lcd_remote_scroll_info.lines-1];
+ }
+ lcd_remote_scroll_info.lines--;
+
+ /* A line can only appear once, so we're done. */
+ return ;
+ }
+ else
+ {
+ i++;
+ }
+ }
+}
+
+/* Stop all scrolling lines in the specified viewport */
+void lcd_remote_scroll_stop(struct viewport* vp)
+{
+ lcd_remote_scroll_stop_line(vp, -1);
+}
+
void lcd_remote_scroll_speed(int speed)
{
lcd_remote_scroll_info.ticks = scroll_tick_table[speed];