From a62603f668789cd98d17e65f08cce62340676977 Mon Sep 17 00:00:00 2001 From: louis Date: Thu, 3 Oct 2013 11:24:09 +0200 Subject: Configurable Menu Item Scroll Mode --- menuitem.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'menuitem.c') diff --git a/menuitem.c b/menuitem.c index cf6dca1..d2cf730 100644 --- a/menuitem.c +++ b/menuitem.c @@ -115,6 +115,8 @@ void cNopacityMenuItem::DrawDelimiter(const char *del, const char *icon, eBackgr } void cNopacityMenuItem::Action(void) { + bool carriageReturn = (config.scrollMode == 0) ? true : false; + int scrollDelta = 1; int scrollDelay = config.menuScrollDelay * 1000; DoSleep(scrollDelay); cPixmap::Lock(); @@ -133,11 +135,21 @@ void cNopacityMenuItem::Action(void) { uint64_t Now = cTimeMs::Now(); cPixmap::Lock(); drawPortX = pixmapTextScroller->DrawPort().X(); - drawPortX -= 1; + drawPortX -= scrollDelta; cPixmap::Unlock(); + if (abs(drawPortX) > maxX) { DoSleep(scrollDelay); - drawPortX = 0; + if (carriageReturn) + drawPortX = 0; + else { + scrollDelta *= -1; + drawPortX -= scrollDelta; + } + doSleep = true; + } + if (!carriageReturn && (drawPortX == 0)) { + scrollDelta *= -1; doSleep = true; } cPixmap::Lock(); -- cgit v1.2.3