aboutsummaryrefslogtreecommitdiffstats
path: root/widget_text.c
diff options
context:
space:
mode:
authormichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2007-10-03 05:12:11 +0000
committermichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2007-10-03 05:12:11 +0000
commit40bde26bc2c197093e512f8d5d83e5aeb66cbbbf (patch)
tree6ee1ac4d9ac096cdee20c8a1493298c7199319a8 /widget_text.c
parentb4295fcc844e053df526da8498c4c09501824543 (diff)
downloadlcd4linux-40bde26bc2c197093e512f8d5d83e5aeb66cbbbf.tar.gz
automatic marquee patch from Manuel Grot
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@845 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'widget_text.c')
-rw-r--r--widget_text.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/widget_text.c b/widget_text.c
index 5f3c2c9..2bbb7ae 100644
--- a/widget_text.c
+++ b/widget_text.c
@@ -85,6 +85,11 @@ void widget_text_scroll(void *Self)
if (pad < 0)
pad = 0;
break;
+ case ALIGN_AUTOMATIC:
+ if (len <= width) {
+ pad = 0;
+ break;
+ }
case ALIGN_MARQUEE:
pad = width - T->scroll;
T->scroll++;
@@ -219,7 +224,7 @@ void widget_text_update(void *Self)
/* if there's a marquee scroller active, it has its own */
/* update callback timer, so we do nothing here; otherwise */
/* we simply call this scroll callback directly */
- if (T->align != ALIGN_MARQUEE) {
+ if (T->align != ALIGN_MARQUEE || T->align != ALIGN_AUTOMATIC) {
widget_text_scroll(Self);
}
}
@@ -279,6 +284,9 @@ int widget_text_init(WIDGET * Self)
case 'M':
Text->align = ALIGN_MARQUEE;
break;
+ case 'A':
+ Text->align = ALIGN_AUTOMATIC;
+ break;
default:
error("widget %s has unknown alignment '%s', using 'Left'", section, c);
Text->align = ALIGN_LEFT;
@@ -292,7 +300,7 @@ int widget_text_init(WIDGET * Self)
Text->update = 10;
/* marquee scroller speed: interval (msec), default 500msec */
- if (Text->align == ALIGN_MARQUEE) {
+ if (Text->align == ALIGN_MARQUEE || Text->align == ALIGN_AUTOMATIC) {
cfg_number(section, "speed", 500, 10, -1, &(Text->speed));
}
@@ -306,7 +314,7 @@ int widget_text_init(WIDGET * Self)
timer_add(widget_text_update, Self, Text->update, Text->update == 0);
/* a marquee scroller has its own timer and callback */
- if (Text->align == ALIGN_MARQUEE) {
+ if (Text->align == ALIGN_MARQUEE || Text->align == ALIGN_AUTOMATIC) {
timer_add(widget_text_scroll, Self, Text->speed, 0);
}