]> git.webhop.me Git - lcd4linux.git/commitdiff
icon frame patch by Marcus Brown
authormichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Tue, 19 May 2009 10:42:01 +0000 (10:42 +0000)
committermichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Tue, 19 May 2009 10:42:01 +0000 (10:42 +0000)
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1035 3ae390bd-cb1e-0410-b409-cd5a39f66f1f

widget_icon.c
widget_icon.h

index 83afbaced7d7f7b1004f1dc560b4e7d059d8d20e..c7853898b8be04d34b3eff0c66110c848855304d 100644 (file)
@@ -101,11 +101,18 @@ void widget_icon_update(void *Self)
        /* evaluate properties */
        property_eval(&Icon->speed);
        property_eval(&Icon->visible);
-
-       /* rotate icon bitmap */
-       Icon->curmap++;
-       if (Icon->curmap >= Icon->maxmap)
-           Icon->curmap = 0;
+       property_eval(&Icon->frame);
+
+       int frame = P2N(&Icon->frame);
+       if ( (frame >= 0) && (frame <= Icon->maxmap) ) {
+           /* select icon bitmap by evaluated frame number */
+           Icon->curmap = frame;
+       } else {
+           /* rotate icon bitmap */
+           Icon->curmap++;
+           if (Icon->curmap >= Icon->maxmap)
+               Icon->curmap = 0;
+       }
     }
 
     /* finally, draw it! */
@@ -140,6 +147,7 @@ int widget_icon_init(WIDGET * Self)
        /* load properties */
        property_load(section, "speed", "100", &Icon->speed);
        property_load(section, "visible", "1", &Icon->visible);
+       property_load(section, "frame", "-1", &Icon->frame);
 
        /* read bitmap */
        widget_icon_read_bitmap(section, Icon);
index 72df8bec3d657e03ef9f75c7812c346ce17ad64d..2eb2f08eb391a688eac824154fc6c228c1e21d6f 100644 (file)
@@ -33,6 +33,7 @@
 typedef struct WIDGET_ICON {
     PROPERTY speed;            /* update interval (msec) */
     PROPERTY visible;          /* icon visible? */
+    PROPERTY frame;            /* evaluated expression of frame number (optional) */
     int ascii;                 /* ascii code of icon (depends on the driver) */
     int curmap;                        /* current bitmap sequence */
     int prvmap;                        /* previous bitmap sequence  */