add missing clock stuff.
authorCarsten Haitzler <raster@rasterman.com>
Sun, 4 Nov 2012 12:14:00 +0000 (12:14 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Sun, 4 Nov 2012 12:14:00 +0000 (12:14 +0000)
SVN revision: 78899

52 files changed:
data/themes/Makefile.am
data/themes/default.edc
data/themes/edc/O/clock.edc [new file with mode: 0644]
data/themes/img/O/ch-h1-2.png [new file with mode: 0644]
data/themes/img/O/ch-h1-3.png [new file with mode: 0644]
data/themes/img/O/ch-h1.png [new file with mode: 0644]
data/themes/img/O/ch-h2-2.png [new file with mode: 0644]
data/themes/img/O/ch-h2-3.png [new file with mode: 0644]
data/themes/img/O/ch-h2.png [new file with mode: 0644]
data/themes/img/O/ch-m1-2.png [new file with mode: 0644]
data/themes/img/O/ch-m1-3.png [new file with mode: 0644]
data/themes/img/O/ch-m1.png [new file with mode: 0644]
data/themes/img/O/ch-m2-2.png [new file with mode: 0644]
data/themes/img/O/ch-m2-3.png [new file with mode: 0644]
data/themes/img/O/ch-m2.png [new file with mode: 0644]
data/themes/img/O/ch-s1-2.png [new file with mode: 0644]
data/themes/img/O/ch-s1-3.png [new file with mode: 0644]
data/themes/img/O/ch-s1.png [new file with mode: 0644]
data/themes/img/O/ch-s2-2.png [new file with mode: 0644]
data/themes/img/O/ch-s2-3.png [new file with mode: 0644]
data/themes/img/O/ch-s2.png [new file with mode: 0644]
data/themes/img/O/clock_base.png [new file with mode: 0644]
data/themes/img/O/flip_0b.png [new file with mode: 0644]
data/themes/img/O/flip_0t.png [new file with mode: 0644]
data/themes/img/O/flip_1b.png [new file with mode: 0644]
data/themes/img/O/flip_1t.png [new file with mode: 0644]
data/themes/img/O/flip_2b.png [new file with mode: 0644]
data/themes/img/O/flip_2t.png [new file with mode: 0644]
data/themes/img/O/flip_3b.png [new file with mode: 0644]
data/themes/img/O/flip_3t.png [new file with mode: 0644]
data/themes/img/O/flip_4b.png [new file with mode: 0644]
data/themes/img/O/flip_4t.png [new file with mode: 0644]
data/themes/img/O/flip_5b.png [new file with mode: 0644]
data/themes/img/O/flip_5t.png [new file with mode: 0644]
data/themes/img/O/flip_6b.png [new file with mode: 0644]
data/themes/img/O/flip_6t.png [new file with mode: 0644]
data/themes/img/O/flip_7b.png [new file with mode: 0644]
data/themes/img/O/flip_7t.png [new file with mode: 0644]
data/themes/img/O/flip_8b.png [new file with mode: 0644]
data/themes/img/O/flip_8t.png [new file with mode: 0644]
data/themes/img/O/flip_9b.png [new file with mode: 0644]
data/themes/img/O/flip_9t.png [new file with mode: 0644]
data/themes/img/O/flip_amb.png [new file with mode: 0644]
data/themes/img/O/flip_amt.png [new file with mode: 0644]
data/themes/img/O/flip_b.png [new file with mode: 0644]
data/themes/img/O/flip_base.png [new file with mode: 0644]
data/themes/img/O/flip_base_shad.png [new file with mode: 0644]
data/themes/img/O/flip_colon.png [new file with mode: 0644]
data/themes/img/O/flip_pmb.png [new file with mode: 0644]
data/themes/img/O/flip_pmt.png [new file with mode: 0644]
data/themes/img/O/flip_shad.png [new file with mode: 0644]
data/themes/img/O/flip_t.png [new file with mode: 0644]

index fed82eb..eb4b5c0 100644 (file)
@@ -52,6 +52,7 @@ edc/O/about.edc \
 edc/O/backlight.edc \
 edc/O/battery.edc \
 edc/O/border_icons.edc \
+edc/O/clock.edc \
 edc/O/colors.edc \
 edc/O/conf_gad.edc \
 edc/O/cpufreq.edc \
@@ -206,6 +207,55 @@ img/wifi_sig_2.png \
 img/wifi_sig_3.png \
 img/win_glow.png \
 img/win_shadow.png \
+img/O/ch-h1-2.png \
+img/O/ch-h1-3.png \
+img/O/ch-h1.png \
+img/O/ch-h2-2.png \
+img/O/ch-h2-3.png \
+img/O/ch-h2.png \
+img/O/ch-m1-2.png \
+img/O/ch-m1-3.png \
+img/O/ch-m1.png \
+img/O/ch-m2-2.png \
+img/O/ch-m2-3.png \
+img/O/ch-m2.png \
+img/O/ch-s1-2.png \
+img/O/ch-s1-3.png \
+img/O/ch-s1.png \
+img/O/ch-s2-2.png \
+img/O/ch-s2-3.png \
+img/O/ch-s2.png \
+img/O/clock_base.png \
+img/O/flip_0b.png \
+img/O/flip_0t.png \
+img/O/flip_1b.png \
+img/O/flip_1t.png \
+img/O/flip_2b.png \
+img/O/flip_2t.png \
+img/O/flip_3b.png \
+img/O/flip_3t.png \
+img/O/flip_4b.png \
+img/O/flip_4t.png \
+img/O/flip_5b.png \
+img/O/flip_5t.png \
+img/O/flip_6b.png \
+img/O/flip_6t.png \
+img/O/flip_7b.png \
+img/O/flip_7t.png \
+img/O/flip_8b.png \
+img/O/flip_8t.png \
+img/O/flip_9b.png \
+img/O/flip_9t.png \
+img/O/flip_amb.png \
+img/O/flip_amt.png \
+img/O/flip_base.png \
+img/O/flip_base_shad.png \
+img/O/flip_b.png \
+img/O/flip_colon.png \
+img/O/flip_pmb.png \
+img/O/flip_pmt.png \
+img/O/flip_shad.png \
+img/O/flip_t.png \
 img/O/about_bot.png \
 img/O/about_mid.png \
 img/O/about_top.png \
index 8b0673b..906befd 100644 (file)
@@ -42,6 +42,7 @@ collections {
 #include "edc/O/backlight.edc"
 #include "edc/O/battery.edc"
 #include "edc/O/border_icons.edc"
+#include "edc/O/clock.edc"
 #include "edc/O/colors.edc"
 #include "edc/O/conf_gad.edc"
 #include "edc/O/cpufreq.edc"
diff --git a/data/themes/edc/O/clock.edc b/data/themes/edc/O/clock.edc
new file mode 100644 (file)
index 0000000..e8da5a8
--- /dev/null
@@ -0,0 +1,1365 @@
+/*** MOD: CLOCK ***/
+   group { name: "e/modules/clock/digital";
+      min: 56 16;
+      max: 512 128;
+      images {
+         image: "O/flip_base.png" COMP;
+         image: "O/flip_base_shad.png" COMP;
+         image: "O/flip_shad.png" COMP;
+         image: "O/flip_0t.png" COMP;
+         image: "O/flip_0b.png" COMP;
+         image: "O/flip_1t.png" COMP;
+         image: "O/flip_1b.png" COMP;
+         image: "O/flip_2t.png" COMP;
+         image: "O/flip_2b.png" COMP;
+         image: "O/flip_3t.png" COMP;
+         image: "O/flip_3b.png" COMP;
+         image: "O/flip_4t.png" COMP;
+         image: "O/flip_4b.png" COMP;
+         image: "O/flip_5t.png" COMP;
+         image: "O/flip_5b.png" COMP;
+         image: "O/flip_6t.png" COMP;
+         image: "O/flip_6b.png" COMP;
+         image: "O/flip_7t.png" COMP;
+         image: "O/flip_7b.png" COMP;
+         image: "O/flip_8t.png" COMP;
+         image: "O/flip_8b.png" COMP;
+         image: "O/flip_9t.png" COMP;
+         image: "O/flip_9b.png" COMP;
+         image: "O/flip_amt.png" COMP;
+         image: "O/flip_amb.png" COMP;
+         image: "O/flip_pmt.png" COMP;
+         image: "O/flip_pmb.png" COMP;
+         image: "O/flip_colon.png" COMP;
+      }
+      script {
+#define DIGPRG(nom, ns) \
+         public ns ## v0_cur, ns ## v0_pre, ns ## v0_lock, ns ## v0_next; \
+         public ns ## animator2(val, Float:pos) { \
+            new st1[11], st2[11], v; \
+            v = get_int(ns ## v0_cur); \
+            snprintf(st1, 10, "%ih", v); \
+            snprintf(st2, 10, "%i", v); \
+            set_tween_state(PART:nom"bot", pos, st1, 0.0, st2, 0.0); \
+            set_tween_state(PART:nom"sh", pos, "half", 0.0, "full", 0.0); \
+            if (pos >= 1.0) { \
+               set_state(PART:nom"sh", "default", 0.0); \
+               set_int(ns ## v0_lock, 0); \
+            } \
+         } \
+         public ns ## animator1(val, Float:pos) { \
+            new st1[11], st2[11], v; \
+            v = get_int(ns ## v0_pre); \
+            snprintf(st1, 10, "%i", v); \
+            snprintf(st2, 10, "%ih", v); \
+            set_tween_state(PART:nom"top", pos, st1, 0.0, st2, 0.0); \
+            set_tween_state(PART:nom"sh", pos, "default", 0.0, "half", 0.0); \
+            if (pos >= 1.0) anim(0.1, #ns"animator2", val); \
+         } \
+         public ns ## valset(value) { \
+            new v, buf[11]; \
+            v = get_int(ns ## v0_cur); \
+            if (v == value) return; \
+            if (get_int(ns ## v0_lock) == 1) { \
+               set_state(PART:nom"sh", "default", 0.0); \
+            } \
+            set_int(ns ## v0_pre, v); \
+            set_int(ns ## v0_cur, value); \
+            set_int(ns ## v0_lock, 1); \
+            snprintf(buf, 10, "%i", get_int(ns ## v0_pre)); \
+            set_state(PART:nom"bot0", buf, 0.0); \
+            snprintf(buf, 10, "%ih", get_int(ns ## v0_cur)); \
+            set_state(PART:nom"bot", buf, 0.0); \
+            snprintf(buf, 10, "%i", get_int(ns ## v0_cur)); \
+            set_state(PART:nom"top0", buf, 0.0); \
+            snprintf(buf, 10, "%i", get_int(ns ## v0_pre)); \
+            set_state(PART:nom"top", buf, 0.0); \
+            set_state(PART:nom"sh", "default", 0.0); \
+            anim(0.1, #ns"animator1", 1); \
+         }
+
+         DIGPRG("s1", s1)
+         DIGPRG("s2", s2)
+
+         DIGPRG("m1", m1)
+         DIGPRG("m2", m2)
+
+         DIGPRG("h1", h1)
+         DIGPRG("h2", h2)
+
+         DIGPRG("ap", ap)
+                           
+         public do_seconds, do_24h, tick_timer;
+         
+         public clock_cb(val) {
+            new year, month, day, yearday, weekday, hour, minute;
+            new Float:second;
+            new v, dosec, do24h, tim;
+
+            date(year, month, day, yearday, weekday, hour, minute, second);
+            dosec = get_int(do_seconds);
+            if (dosec) {
+               v = round(second);
+               tim = timer(1.0 - (second - v), "clock_cb", 1);
+               // set seconds to v
+               s1valset(v / 10);
+               s2valset(v % 10);
+            }
+            else {
+               tim = timer(60.0 - (second), "clock_cb", 1);
+            }
+            set_int(tick_timer, tim);
+
+            // set minutes to minute
+            m1valset(minute / 10);
+            m2valset(minute % 10);
+
+            // set hours to hour
+            do24h = get_int(do_24h);
+            if (do24h) {
+               h1valset(hour / 10);
+               h2valset(hour % 10);
+            }
+            else {
+               new pm;
+               
+               // if 12 or later, its pm
+               if (hour >= 12) {
+                  pm = 1;
+                  // if we are after 12 (1, 2, 3 etc.) then mod by 12
+                  if (hour > 12) hour = hour % 12;
+               }
+               else {
+                  pm = 0;
+                  // make after midnight be 12:XX AM :)
+                  if (hour == 0) hour = 12;
+               }
+               h1valset(hour / 10);
+               h2valset(hour % 10);
+               apvalset(pm);
+            }
+         }
+         
+         public eval_fields() {
+            new do24h, dosec;
+            
+            dosec = get_int(do_seconds);
+            do24h = get_int(do_24h);
+            custom_state(PART:"hours1", "default", 0.0);
+            custom_state(PART:"hours2", "default", 0.0);
+            custom_state(PART:"mins1", "default", 0.0);
+            custom_state(PART:"mins2", "default", 0.0);
+            custom_state(PART:"secs1", "default", 0.0);
+            custom_state(PART:"secs2", "default", 0.0);
+            custom_state(PART:"ampm", "default", 0.0);
+            if ((dosec) && (!do24h)) { // sec + ampm
+               set_state_val(PART:"hours1", STATE_REL1, (0.0/16.0), 0.0);
+               set_state_val(PART:"hours1", STATE_REL2, (2.0/16.0), 1.0);
+               set_state_val(PART:"hours2", STATE_REL1, (2.0/16.0), 0.0);
+               set_state_val(PART:"hours2", STATE_REL2, (4.0/16.0), 1.0);
+               set_state_val(PART:"mins1", STATE_REL1, (5.0/16.0), 0.0);
+               set_state_val(PART:"mins1", STATE_REL2, (7.0/16.0), 1.0);
+               set_state_val(PART:"mins2", STATE_REL1, (7.0/16.0), 0.0);
+               set_state_val(PART:"mins2", STATE_REL2, (9.0/16.0), 1.0);
+               set_state_val(PART:"secs1", STATE_REL1, (10.0/16.0), 0.0);
+               set_state_val(PART:"secs1", STATE_REL2, (12.0/16.0), 1.0);
+               set_state_val(PART:"secs2", STATE_REL1, (12.0/16.0), 0.0);
+               set_state_val(PART:"secs2", STATE_REL2, (14.0/16.0), 1.0);
+               set_state_val(PART:"ampm", STATE_REL1, (14.0/16.0), 0.0);
+               set_state_val(PART:"ampm", STATE_REL2, (16.0/16.0), 1.0);
+               set_min_size(16 * 4, 16);
+               set_max_size(16 * 32, 128);
+            }
+            else if ((dosec) && (do24h)) { // sec + -
+               set_state_val(PART:"hours1", STATE_REL1, (0.0/14.0), 0.0);
+               set_state_val(PART:"hours1", STATE_REL2, (2.0/14.0), 1.0);
+               set_state_val(PART:"hours2", STATE_REL1, (2.0/14.0), 0.0);
+               set_state_val(PART:"hours2", STATE_REL2, (4.0/14.0), 1.0);
+               set_state_val(PART:"mins1", STATE_REL1, (5.0/14.0), 0.0);
+               set_state_val(PART:"mins1", STATE_REL2, (7.0/14.0), 1.0);
+               set_state_val(PART:"mins2", STATE_REL1, (7.0/14.0), 0.0);
+               set_state_val(PART:"mins2", STATE_REL2, (9.0/14.0), 1.0);
+               set_state_val(PART:"secs1", STATE_REL1, (10.0/14.0), 0.0);
+               set_state_val(PART:"secs1", STATE_REL2, (12.0/14.0), 1.0);
+               set_state_val(PART:"secs2", STATE_REL1, (12.0/14.0), 0.0);
+               set_state_val(PART:"secs2", STATE_REL2, (14.0/14.0), 1.0);
+               set_state_val(PART:"ampm", STATE_REL1, (0.0/1.0), 0.0);
+               set_state_val(PART:"ampm", STATE_REL2, (0.0/1.0), 1.0);
+               set_min_size(14 * 4, 16);
+               set_max_size(14 * 32, 128);
+            }
+            else if ((!dosec) && (!do24h)) { // - + ampm
+               set_state_val(PART:"hours1", STATE_REL1, (0.0/11.0), 0.0);
+               set_state_val(PART:"hours1", STATE_REL2, (2.0/11.0), 1.0);
+               set_state_val(PART:"hours2", STATE_REL1, (2.0/11.0), 0.0);
+               set_state_val(PART:"hours2", STATE_REL2, (4.0/11.0), 1.0);
+               set_state_val(PART:"mins1", STATE_REL1, (5.0/11.0), 0.0);
+               set_state_val(PART:"mins1", STATE_REL2, (7.0/11.0), 1.0);
+               set_state_val(PART:"mins2", STATE_REL1, (7.0/11.0), 0.0);
+               set_state_val(PART:"mins2", STATE_REL2, (9.0/11.0), 1.0);
+               set_state_val(PART:"secs1", STATE_REL1, (0.0/1.0), 0.0);
+               set_state_val(PART:"secs1", STATE_REL2, (0.0/1.0), 1.0);
+               set_state_val(PART:"secs2", STATE_REL1, (0.0/1.0), 0.0);
+               set_state_val(PART:"secs2", STATE_REL2, (0.0/1.0), 1.0);
+               set_state_val(PART:"ampm", STATE_REL1, (9.0/11.0), 0.0);
+               set_state_val(PART:"ampm", STATE_REL2, (11.0/11.0), 1.0);
+               set_min_size(11 * 4, 16);
+               set_max_size(11 * 32, 128);
+            }
+            else if ((!dosec) && (do24h)) { // - + -
+               set_state_val(PART:"hours1", STATE_REL1, (0.0/9.0), 0.0);
+               set_state_val(PART:"hours1", STATE_REL2, (2.0/9.0), 1.0);
+               set_state_val(PART:"hours2", STATE_REL1, (2.0/9.0), 0.0);
+               set_state_val(PART:"hours2", STATE_REL2, (4.0/9.0), 1.0);
+               set_state_val(PART:"mins1", STATE_REL1, (5.0/9.0), 0.0);
+               set_state_val(PART:"mins1", STATE_REL2, (7.0/9.0), 1.0);
+               set_state_val(PART:"mins2", STATE_REL1, (7.0/9.0), 0.0);
+               set_state_val(PART:"mins2", STATE_REL2, (9.0/9.0), 1.0);
+               set_state_val(PART:"secs1", STATE_REL1, (0.0/1.0), 0.0);
+               set_state_val(PART:"secs1", STATE_REL2, (0.0/1.0), 1.0);
+               set_state_val(PART:"secs2", STATE_REL1, (0.0/1.0), 0.0);
+               set_state_val(PART:"secs2", STATE_REL2, (0.0/1.0), 1.0);
+               set_state_val(PART:"ampm", STATE_REL1, (0.0/1.0), 0.0);
+               set_state_val(PART:"ampm", STATE_REL2, (0.0/1.0), 1.0);
+               set_min_size(9 * 4, 16);
+               set_max_size(9 * 32, 128);
+            }
+            set_state(PART:"hours1", "custom", 0.0);
+            set_state(PART:"hours2", "custom", 0.0);
+            set_state(PART:"mins1", "custom", 0.0);
+            set_state(PART:"mins2", "custom", 0.0);
+            set_state(PART:"secs1", "custom", 0.0);
+            set_state(PART:"secs2", "custom", 0.0);
+            set_state(PART:"ampm", "custom", 0.0);
+            emit("e,state,sizing,changed", "");
+         }
+      }
+      parts {
+         part { name: "hclip"; type: RECT;
+            description { state: "default" 0.0;
+            }
+            description { state: "hidden" 0.0;
+               visible: 0;
+            }
+         }
+         part { name: "mclip"; type: RECT;
+            description { state: "default" 0.0;
+            }
+            description { state: "hidden" 0.0;
+               visible: 0;
+            }
+         }
+         part { name: "sclip"; type: RECT;
+            description { state: "default" 0.0;
+            }
+            description { state: "hidden" 0.0;
+               visible: 0;
+            }
+         }
+         part { name: "ampmclip"; type: RECT;
+            description { state: "default" 0.0;
+            }
+            description { state: "hidden" 0.0;
+               visible: 0;
+            }
+         }
+         part { name: "hours1"; type: RECT;
+            description { state: "default" 0.0;
+               visible: 0;
+               rel1.relative: (0/16) 0.0;
+               rel2.relative: (2/16) 1.0;
+            }
+         }
+         part { name: "hours2"; type: RECT;
+            description { state: "default" 0.0;
+               visible: 0;
+               rel1.relative: (2/16) 0.0;
+               rel2.relative: (4/16) 1.0;
+            }
+         }
+         part { name: "hcolon1";
+            clip_to: "mclip";
+            description { state: "default" 0.0;
+               rel1.to: "hours2";
+               rel1.relative: 1.0 0.0;
+               rel1.offset: 1 1;
+               rel2.to: "mins1";
+               rel2.relative: 0.0 1.0;
+               rel2.offset: 0 0;
+               image.normal: "O/flip_colon.png";
+               min: 2 4;
+               aspect: 0.25 0.25;
+               aspect_preference: BOTH;
+            }
+         }
+         part { name: "hcolon2";
+            clip_to: "mclip";
+            description { state: "default" 0.0;
+               rel1.to: "hcolon1";
+               rel1.offset: -1 -1;
+               rel2.to: "hcolon1";
+               rel2.offset: -2 -2;
+               color: 0 0 0 255;
+               image.normal: "O/flip_colon.png";
+            }
+         }
+         part { name: "mins1"; type: RECT;
+            description { state: "default" 0.0;
+               visible: 0;
+               rel1.relative: (5/16) 0.0;
+               rel2.relative: (7/16) 1.0;
+            }
+         }
+         part { name: "mins2"; type: RECT;
+            description { state: "default" 0.0;
+               visible: 0;
+               rel1.relative: (7/16) 0.0;
+               rel2.relative: (9/16) 1.0;
+            }
+         }
+         part { name: "mcolon1";
+            clip_to: "sclip";
+            description { state: "default" 0.0;
+               rel1.to: "mins2";
+               rel1.relative: 1.0 0.0;
+               rel1.offset: 1 1;
+               rel2.to: "secs1";
+               rel2.relative: 0.0 1.0;
+               rel2.offset: 0 0;
+               image.normal: "O/flip_colon.png";
+               min: 2 4;
+               aspect: 0.25 0.25;
+               aspect_preference: BOTH;
+            }
+         }
+         part { name: "mcolon2";
+            clip_to: "sclip";
+            description { state: "default" 0.0;
+               rel1.to: "mcolon1";
+               rel1.offset: -1 -1;
+               rel2.to: "mcolon1";
+               rel2.offset: -2 -2;
+               color: 0 0 0 255;
+               image.normal: "O/flip_colon.png";
+            }
+         }
+         part { name: "secs1"; type: RECT;
+            description { state: "default" 0.0;
+               visible: 0;
+               rel1.relative: (10/16) 0.0;
+               rel2.relative: (12/16) 1.0;
+           }
+         }
+         part { name: "secs2"; type: RECT;
+            description { state: "default" 0.0;
+               visible: 0;
+               rel1.relative: (12/16) 0.0;
+               rel2.relative: (14/16) 1.0;
+           }
+         }
+         part { name: "ampm"; type: RECT;
+            description { state: "default" 0.0;
+               visible: 0;
+               rel1.relative: (14/16) 0.0;
+               rel2.relative: (16/16) 1.0;
+            }
+         }
+         
+#define DIGIT(nom, relto, clipto) \
+         part { name: nom"base"; \
+            scale: 1; \
+            description { state: "default" 0.0; \
+               rel1.to: relto; \
+               rel1.offset: 1 1; \
+               rel2.to: relto; \
+               rel2.offset: -2 -2; \
+               min: 2 4; \
+               aspect: 0.5 0.5; \
+               aspect_preference: BOTH; \
+            } \
+         } \
+         part { name: nom"shad"; \
+            clip_to: clipto; \
+            description { state: "default" 0.0; \
+               rel1.offset: -4 -4; \
+               rel1.to: nom"base"; \
+               rel2.offset: 3 3; \
+               rel2.to: nom"base"; \
+               image { \
+                  normal: "O/flip_base_shad.png"; \
+                  border: 8 8 8 8; \
+               } \
+            } \
+         } \
+         part { name: nom"b"; type: RECT; \
+            description { state: "default" 0.0; \
+               visible: 0; \
+               rel1.to: nom"base"; \
+               rel1.relative: 0.0 0.5; \
+               rel2.to: nom"base"; \
+            } \
+         } \
+         part { name: nom"t"; type: RECT; \
+            description { state: "default" 0.0; \
+               visible: 0; \
+               rel1.to: nom"base"; \
+               rel2.to: nom"base"; \
+               rel2.relative: 1.0 0.5; \
+            } \
+         } \
+         part { name: nom"bot0"; \
+            clip_to: clipto; \
+            description { state: "default" 0.0; \
+               rel1.to: nom"b"; \
+               rel2.to: nom"b"; \
+               image.normal: "O/flip_0b.png"; \
+            } \
+            description { state: "0" 0.0; \
+               inherit: "default" 0.0; \
+               image.normal: "O/flip_0b.png"; \
+            } \
+            description { state: "1" 0.0; \
+               inherit: "default" 0.0; \
+               image.normal: "O/flip_1b.png"; \
+            } \
+            description { state: "2" 0.0; \
+               inherit: "default" 0.0; \
+               image.normal: "O/flip_2b.png"; \
+            } \
+            description { state: "3" 0.0; \
+               inherit: "default" 0.0; \
+               image.normal: "O/flip_3b.png"; \
+            } \
+            description { state: "4" 0.0; \
+               inherit: "default" 0.0; \
+               image.normal: "O/flip_4b.png"; \
+            } \
+            description { state: "5" 0.0; \
+               inherit: "default" 0.0; \
+               image.normal: "O/flip_5b.png"; \
+            } \
+            description { state: "6" 0.0; \
+               inherit: "default" 0.0; \
+               image.normal: "O/flip_6b.png"; \
+            } \
+            description { state: "7" 0.0; \
+               inherit: "default" 0.0; \
+               image.normal: "O/flip_7b.png"; \
+            } \
+            description { state: "8" 0.0; \
+               inherit: "default" 0.0; \
+               image.normal: "O/flip_8b.png"; \
+            } \
+            description { state: "9" 0.0; \
+               inherit: "default" 0.0; \
+               image.normal: "O/flip_9b.png"; \
+            } \
+         } \
+         part { name: nom"sh"; \
+            clip_to: clipto; \
+            description { state: "default" 0.0; \
+               rel1.to: nom"b"; \
+               rel2.to: nom"b"; \
+               rel2.relative: 1.0 0.0; \
+               image.normal: "O/flip_shad.png"; \
+            } \
+            description { state: "half" 0.0; \
+               inherit: "default" 0.0; \
+               rel2.relative: 1.0 0.5; \
+            } \
+            description { state: "full" 0.0; \
+               inherit: "default" 0.0; \
+               rel2.relative: 1.0 1.0; \
+            } \
+         } \
+         part { name: nom"bot"; \
+            clip_to: clipto; \
+            description { state: "default" 0.0; \
+               rel1.to: nom"b"; \
+               rel2.to: nom"b"; \
+               image.normal: "O/flip_0b.png"; \
+            } \
+            description { state: "0" 0.0; \
+               inherit: "default" 0.0; \
+               rel2.relative: 1.0 1.0; \
+               image.normal: "O/flip_0b.png"; \
+            } \
+            description { state: "0h" 0.0; \
+               inherit: "default" 0.0; \
+               visible: 0; \
+               rel2.relative: 1.0 0.0; \
+               image.normal: "O/flip_0b.png"; \
+            } \
+            description { state: "1" 0.0; \
+               inherit: "default" 0.0; \
+               rel2.relative: 1.0 1.0; \
+               image.normal: "O/flip_1b.png"; \
+            } \
+            description { state: "1h" 0.0; \
+               inherit: "default" 0.0; \
+               visible: 0; \
+               rel2.relative: 1.0 0.0; \
+               image.normal: "O/flip_1b.png"; \
+            } \
+            description { state: "2" 0.0; \
+               inherit: "default" 0.0; \
+               rel2.relative: 1.0 1.0; \
+               image.normal: "O/flip_2b.png"; \
+            } \
+            description { state: "2h" 0.0; \
+               inherit: "default" 0.0; \
+               visible: 0; \
+               rel2.relative: 1.0 0.0; \
+               image.normal: "O/flip_2b.png"; \
+            } \
+            description { state: "3" 0.0; \
+               inherit: "default" 0.0; \
+               rel2.relative: 1.0 1.0; \
+               image.normal: "O/flip_3b.png"; \
+            } \
+            description { state: "3h" 0.0; \
+               inherit: "default" 0.0; \
+               visible: 0; \
+               rel2.relative: 1.0 0.0; \
+               image.normal: "O/flip_3b.png"; \
+            } \
+            description { state: "4" 0.0; \
+               inherit: "default" 0.0; \
+               rel2.relative: 1.0 1.0; \
+               image.normal: "O/flip_4b.png"; \
+            } \
+            description { state: "4h" 0.0; \
+               inherit: "default" 0.0; \
+               visible: 0; \
+               rel2.relative: 1.0 0.0; \
+               image.normal: "O/flip_4b.png"; \
+            } \
+            description { state: "5" 0.0; \
+               inherit: "default" 0.0; \
+               rel2.relative: 1.0 1.0; \
+               image.normal: "O/flip_5b.png"; \
+            } \
+            description { state: "5h" 0.0; \
+               inherit: "default" 0.0; \
+               visible: 0; \
+               rel2.relative: 1.0 0.0; \
+               image.normal: "O/flip_5b.png"; \
+            } \
+            description { state: "6" 0.0; \
+               inherit: "default" 0.0; \
+               rel2.relative: 1.0 1.0; \
+               image.normal: "O/flip_6b.png"; \
+            } \
+            description { state: "6h" 0.0; \
+               inherit: "default" 0.0; \
+               visible: 0; \
+               rel2.relative: 1.0 0.0; \
+               image.normal: "O/flip_6b.png"; \
+            } \
+            description { state: "7" 0.0; \
+               inherit: "default" 0.0; \
+               rel2.relative: 1.0 1.0; \
+               image.normal: "O/flip_7b.png"; \
+            } \
+            description { state: "7h" 0.0; \
+               inherit: "default" 0.0; \
+               visible: 0; \
+               rel2.relative: 1.0 0.0; \
+               image.normal: "O/flip_7b.png"; \
+            } \
+            description { state: "8" 0.0; \
+               inherit: "default" 0.0; \
+               rel2.relative: 1.0 1.0; \
+               image.normal: "O/flip_8b.png"; \
+            } \
+            description { state: "8h" 0.0; \
+               inherit: "default" 0.0; \
+               visible: 0; \
+               rel2.relative: 1.0 0.0; \
+               image.normal: "O/flip_8b.png"; \
+            } \
+            description { state: "9" 0.0; \
+               inherit: "default" 0.0; \
+               rel2.relative: 1.0 1.0; \
+               image.normal: "O/flip_9b.png"; \
+            } \
+            description { state: "9h" 0.0; \
+               inherit: "default" 0.0; \
+               visible: 0; \
+               rel2.relative: 1.0 0.0; \
+               image.normal: "O/flip_9b.png"; \
+            } \
+         } \
+         part { name: nom"top0"; \
+            clip_to: clipto; \
+            description { state: "default" 0.0; \
+               rel1.to: nom"t"; \
+               rel2.to: nom"t"; \
+               image.normal: "O/flip_0t.png"; \
+            } \
+            description { state: "0" 0.0; \
+               inherit: "default" 0.0; \
+               image.normal: "O/flip_0t.png"; \
+            } \
+            description { state: "1" 0.0; \
+               inherit: "default" 0.0; \
+               image.normal: "O/flip_1t.png"; \
+            } \
+            description { state: "2" 0.0; \
+               inherit: "default" 0.0; \
+               image.normal: "O/flip_2t.png"; \
+            } \
+            description { state: "3" 0.0; \
+               inherit: "default" 0.0; \
+               image.normal: "O/flip_3t.png"; \
+            } \
+            description { state: "4" 0.0; \
+               inherit: "default" 0.0; \
+               image.normal: "O/flip_4t.png"; \
+            } \
+            description { state: "5" 0.0; \
+               inherit: "default" 0.0; \
+               image.normal: "O/flip_5t.png"; \
+            } \
+            description { state: "6" 0.0; \
+               inherit: "default" 0.0; \
+               image.normal: "O/flip_6t.png"; \
+            } \
+            description { state: "7" 0.0; \
+               inherit: "default" 0.0; \
+               image.normal: "O/flip_7t.png"; \
+            } \
+            description { state: "8" 0.0; \
+               inherit: "default" 0.0; \
+               image.normal: "O/flip_8t.png"; \
+            } \
+            description { state: "9" 0.0; \
+               inherit: "default" 0.0; \
+               image.normal: "O/flip_9t.png"; \
+            } \
+         } \
+         part { name: nom"top"; \
+            clip_to: clipto; \
+            description { state: "default" 0.0; \
+               rel1.to: nom"t"; \
+               rel2.to: nom"t"; \
+               image.normal: "O/flip_0t.png"; \
+            } \
+            description { state: "0" 0.0; \
+               inherit: "default" 0.0; \
+               rel1.relative: 0.0 0.0; \
+               image.normal: "O/flip_0t.png"; \
+            } \
+            description { state: "0h" 0.0; \
+               inherit: "default" 0.0; \
+               color: 128 128 128 255; \
+               visible: 0; \
+               rel1.relative: 0.0 1.0; \
+               image.normal: "O/flip_0t.png"; \
+            } \
+            description { state: "1" 0.0; \
+               inherit: "default" 0.0; \
+               rel1.relative: 0.0 0.0; \
+               image.normal: "O/flip_1t.png"; \
+            } \
+            description { state: "1h" 0.0; \
+               inherit: "default" 0.0; \
+               color: 128 128 128 255; \
+               visible: 0; \
+               rel1.relative: 0.0 1.0; \
+               image.normal: "O/flip_1t.png"; \
+            } \
+            description { state: "2" 0.0; \
+               inherit: "default" 0.0; \
+               rel1.relative: 0.0 0.0; \
+               image.normal: "O/flip_2t.png"; \
+            } \
+            description { state: "2h" 0.0; \
+               inherit: "default" 0.0; \
+               color: 128 128 128 255; \
+               visible: 0; \
+               rel1.relative: 0.0 1.0; \
+               image.normal: "O/flip_2t.png"; \
+            } \
+            description { state: "3" 0.0; \
+               inherit: "default" 0.0; \
+               rel1.relative: 0.0 0.0; \
+               image.normal: "O/flip_3t.png"; \
+            } \
+            description { state: "3h" 0.0; \
+               inherit: "default" 0.0; \
+               color: 128 128 128 255; \
+               visible: 0; \
+               rel1.relative: 0.0 1.0; \
+               image.normal: "O/flip_3t.png"; \
+            } \
+            description { state: "4" 0.0; \
+               inherit: "default" 0.0; \
+               rel1.relative: 0.0 0.0; \
+               image.normal: "O/flip_4t.png"; \
+            } \
+            description { state: "4h" 0.0; \
+               inherit: "default" 0.0; \
+               color: 128 128 128 255; \
+               visible: 0; \
+               rel1.relative: 0.0 1.0; \
+               image.normal: "O/flip_4t.png"; \
+            } \
+            description { state: "5" 0.0; \
+               inherit: "default" 0.0; \
+               rel1.relative: 0.0 0.0; \
+               image.normal: "O/flip_5t.png"; \
+            } \
+            description { state: "5h" 0.0; \
+               inherit: "default" 0.0; \
+               color: 128 128 128 255; \
+               visible: 0; \
+               rel1.relative: 0.0 1.0; \
+               image.normal: "O/flip_5t.png"; \
+            } \
+            description { state: "6" 0.0; \
+               inherit: "default" 0.0; \
+               rel1.relative: 0.0 0.0; \
+               image.normal: "O/flip_6t.png"; \
+            } \
+            description { state: "6h" 0.0; \
+               inherit: "default" 0.0; \
+               color: 128 128 128 255; \
+               visible: 0; \
+               rel1.relative: 0.0 1.0; \
+               image.normal: "O/flip_6t.png"; \
+            } \
+            description { state: "7" 0.0; \
+               inherit: "default" 0.0; \
+               rel1.relative: 0.0 0.0; \
+               image.normal: "O/flip_7t.png"; \
+            } \
+            description { state: "7h" 0.0; \
+               inherit: "default" 0.0; \
+               color: 128 128 128 255; \
+               visible: 0; \
+               rel1.relative: 0.0 1.0; \
+               image.normal: "O/flip_7t.png"; \
+            } \
+            description { state: "8" 0.0; \
+               inherit: "default" 0.0; \
+               rel1.relative: 0.0 0.0; \
+               image.normal: "O/flip_8t.png"; \
+            } \
+            description { state: "8h" 0.0; \
+               inherit: "default" 0.0; \
+               color: 128 128 128 255; \
+               visible: 0; \
+               rel1.relative: 0.0 1.0; \
+               image.normal: "O/flip_8t.png"; \
+            } \
+            description { state: "9" 0.0; \
+               inherit: "default" 0.0; \
+               rel1.relative: 0.0 0.0; \
+               image.normal: "O/flip_9t.png"; \
+            } \
+            description { state: "9h" 0.0; \
+               inherit: "default" 0.0; \
+               color: 128 128 128 255; \
+               visible: 0; \
+               rel1.relative: 0.0 1.0; \
+               image.normal: "O/flip_9t.png"; \
+            } \
+         }
+         
+         DIGIT("h1", "hours1", "hclip");
+         DIGIT("h2", "hours2", "hclip");
+
+         DIGIT("m1", "mins1", "mclip");
+         DIGIT("m2", "mins2", "mclip");
+
+         DIGIT("s1", "secs1", "sclip");
+         DIGIT("s2", "secs2", "sclip");
+
+#define DIGAP(nom, relto, clipto) \
+         part { name: nom"base"; \
+            scale: 1; \
+            description { state: "default" 0.0; \
+               rel1.to: relto; \
+               rel1.offset: 1 1; \
+               rel2.to: relto; \
+               rel2.offset: -2 -2; \
+               min: 2 4; \
+               aspect: 0.5 0.5; \
+               aspect_preference: BOTH; \
+            } \
+         } \
+         part { name: nom"shad"; \
+            clip_to: clipto; \
+            description { state: "default" 0.0; \
+               rel1.offset: -4 -4; \
+               rel1.to: nom"base"; \
+               rel2.offset: 3 3; \
+               rel2.to: nom"base"; \
+               image { \
+                  normal: "O/flip_base_shad.png"; \
+                  border: 8 8 8 8; \
+               } \
+            } \
+         } \
+         part { name: nom"b"; type: RECT; \
+            description { state: "default" 0.0; \
+               visible: 0; \
+               rel1.to: nom"base"; \
+               rel1.relative: 0.0 0.5; \
+               rel2.to: nom"base"; \
+            } \
+         } \
+         part { name: nom"t"; type: RECT; \
+            description { state: "default" 0.0; \
+               visible: 0; \
+               rel1.to: nom"base"; \
+               rel2.to: nom"base"; \
+               rel2.relative: 1.0 0.5; \
+            } \
+         } \
+         part { name: nom"bot0"; \
+            clip_to: clipto; \
+            description { state: "default" 0.0; \
+               rel1.to: nom"b"; \
+               rel2.to: nom"b"; \
+               image.normal: "O/flip_amb.png"; \
+            } \
+            description { state: "0" 0.0; \
+               inherit: "default" 0.0; \
+               image.normal: "O/flip_amb.png"; \
+            } \
+            description { state: "1" 0.0; \
+               inherit: "default" 0.0; \
+               image.normal: "O/flip_pmb.png"; \
+            } \
+         } \
+         part { name: nom"sh"; \
+            clip_to: clipto; \
+            description { state: "default" 0.0; \
+               rel1.to: nom"b"; \
+               rel2.to: nom"b"; \
+               rel2.relative: 1.0 0.0; \
+               image.normal: "O/flip_shad.png"; \
+            } \
+            description { state: "half" 0.0; \
+               inherit: "default" 0.0; \
+               rel2.relative: 1.0 0.5; \
+            } \
+            description { state: "full" 0.0; \
+               inherit: "default" 0.0; \
+               rel2.relative: 1.0 1.0; \
+            } \
+         } \
+         part { name: nom"bot"; \
+            clip_to: clipto; \
+            description { state: "default" 0.0; \
+               rel1.to: nom"b"; \
+               rel2.to: nom"b"; \
+               image.normal: "O/flip_amb.png"; \
+            } \
+            description { state: "0" 0.0; \
+               inherit: "default" 0.0; \
+               rel2.relative: 1.0 1.0; \
+               image.normal: "O/flip_amb.png"; \
+            } \
+            description { state: "0h" 0.0; \
+               inherit: "default" 0.0; \
+               visible: 0; \
+               rel2.relative: 1.0 0.0; \
+               image.normal: "O/flip_amb.png"; \
+            } \
+            description { state: "1" 0.0; \
+               inherit: "default" 0.0; \
+               rel2.relative: 1.0 1.0; \
+               image.normal: "O/flip_pmb.png"; \
+            } \
+            description { state: "1h" 0.0; \
+               inherit: "default" 0.0; \
+               visible: 0; \
+               rel2.relative: 1.0 0.0; \
+               image.normal: "O/flip_pmb.png"; \
+            } \
+         } \
+         part { name: nom"top0"; \
+            clip_to: clipto; \
+            description { state: "default" 0.0; \
+               rel1.to: nom"t"; \
+               rel2.to: nom"t"; \
+               image.normal: "O/flip_amt.png"; \
+            } \
+            description { state: "0" 0.0; \
+               inherit: "default" 0.0; \
+               image.normal: "O/flip_amt.png"; \
+            } \
+            description { state: "1" 0.0; \
+               inherit: "default" 0.0; \
+               image.normal: "O/flip_pmt.png"; \
+            } \
+         } \
+         part { name: nom"top"; \
+            clip_to: clipto; \
+            description { state: "default" 0.0; \
+               rel1.to: nom"t"; \
+               rel2.to: nom"t"; \
+               image.normal: "O/flip_amt.png"; \
+            } \
+            description { state: "0" 0.0; \
+               inherit: "default" 0.0; \
+               rel1.relative: 0.0 0.0; \
+               image.normal: "O/flip_amt.png"; \
+            } \
+            description { state: "0h" 0.0; \
+               inherit: "default" 0.0; \
+               color: 128 128 128 255; \
+               visible: 0; \
+               rel1.relative: 0.0 1.0; \
+               image.normal: "O/flip_amt.png"; \
+            } \
+            description { state: "1" 0.0; \
+               inherit: "default" 0.0; \
+               rel1.relative: 0.0 0.0; \
+               image.normal: "O/flip_pmt.png"; \
+            } \
+            description { state: "1h" 0.0; \
+               inherit: "default" 0.0; \
+               color: 128 128 128 255; \
+               visible: 0; \
+               rel1.relative: 0.0 1.0; \
+               image.normal: "O/flip_pmt.png"; \
+            } \
+         }
+
+         DIGAP("ap", "ampm", "ampmclip");
+         
+///////////////////////////////////////////////////////////////////         
+         
+         part { name: "event"; type: RECT;
+            mouse_events: 1;
+            description { state: "default" 0.0;
+               color: 0 0 0 0;
+            }
+         }
+      }
+      programs {
+         program { name: "init";
+            signal: "load";
+            source: "";
+            script {
+               clock_cb(0);
+            }
+         }
+         program { name: "secon";
+            signal: "e,state,seconds,on";
+            source: "e";
+            action: STATE_SET "default" 0.0;
+            target: "secs1";
+            after: "sec2";
+         }
+         program { name: "sec2";
+            script {
+               new tim;
+               
+               set_int(do_seconds, 1);
+               set_state(PART:"sclip", "default", 0.0);
+               eval_fields();
+               tim = get_int(tick_timer);
+               if (tim) {
+                  cancel_timer(tim);
+                  set_int(tick_timer, 0);
+               }
+               clock_cb(0);
+            }
+         }
+         program { name: "secoff";
+            signal: "e,state,seconds,off";
+            source: "e";
+            action: STATE_SET "default" 0.0;
+            target: "secs1";
+            after: "sec3";
+         }
+         program { name: "sec3";
+            script {
+               new tim;
+               
+               set_int(do_seconds, 0);
+               set_state(PART:"sclip", "hidden", 0.0);
+               eval_fields();
+               tim = get_int(tick_timer);
+               if (tim) {
+                  cancel_timer(tim);
+                  set_int(tick_timer, 0);
+               }
+               clock_cb(0);
+            }
+         }
+         program { name: "24h";
+            signal: "e,state,24h,on";
+            source: "e";
+            script {
+               new tim;
+               
+               set_int(do_24h, 1);
+               set_state(PART:"ampmclip", "hidden", 0.0);
+               eval_fields();
+               tim = get_int(tick_timer);
+               if (tim) {
+                  cancel_timer(tim);
+                  set_int(tick_timer, 0);
+               }
+               clock_cb(0);
+            }
+         }
+         program { name: "12h";
+            signal: "e,state,24h,off";
+            source: "e";
+            script {
+               new tim;
+               
+               set_int(do_24h, 0);
+               set_state(PART:"ampmclip", "default", 0.0);
+               eval_fields();
+               tim = get_int(tick_timer);
+               if (tim) {
+                  cancel_timer(tim);
+                  set_int(tick_timer, 0);
+               }
+               clock_cb(0);
+            }
+         }
+      }
+   }
+   group { name: "e/modules/clock/main";
+      images {
+         image: "O/clock_base.png" COMP;
+         image: "O/tacho_fg.png" COMP;
+         image: "O/ch-h1.png" COMP;
+         image: "O/ch-h2.png" COMP;
+         image: "O/ch-m1.png" COMP;
+         image: "O/ch-m2.png" COMP;
+         image: "O/ch-s1.png" COMP;
+         image: "O/ch-s2.png" COMP;
+         image: "O/ch-h1-2.png" COMP;
+         image: "O/ch-h2-2.png" COMP;
+         image: "O/ch-m1-2.png" COMP;
+         image: "O/ch-m2-2.png" COMP;
+         image: "O/ch-s1-2.png" COMP;
+         image: "O/ch-s2-2.png" COMP;
+         image: "O/ch-h1-3.png" COMP;
+         image: "O/ch-h2-3.png" COMP;
+         image: "O/ch-m1-3.png" COMP;
+         image: "O/ch-m2-3.png" COMP;
+         image: "O/ch-s1-3.png" COMP;
+         image: "O/ch-s2-3.png" COMP;
+      }
+      min: 16 16;
+      max: 128 128;
+      script {
+         public do_seconds, tick_timer;
+         
+         public clock_cb(val) {
+            new year, month, day, yearday, weekday, hour, minute;
+            new Float:second;
+            new v, dosec, tim;
+            new x, y, w, h;
+
+            date(year, month, day, yearday, weekday, hour, minute, second);
+            get_geometry(PART:"hour", x, y, w, h);
+            dosec = get_int(do_seconds);
+            if (dosec) {
+               v = round(second);
+               tim = timer(1.0 - (second - v), "clock_cb", 1);
+               
+               custom_state(PART:"seconds", "default", 0.0);
+               set_state_val(PART:"seconds", STATE_MAP_ROT_Z, (v * 360.0) / 60.0);
+               if (h < 22) 
+                  set_state_val(PART:"seconds", STATE_IMAGE, IMAGE:"O/ch-s1-3.png");
+               else if (h < 44) 
+                  set_state_val(PART:"seconds", STATE_IMAGE, IMAGE:"O/ch-s1-2.png");
+               else 
+                  set_state_val(PART:"seconds", STATE_IMAGE, IMAGE:"O/ch-s1.png");
+               set_state(PART:"seconds", "custom", 0.0);
+               
+               custom_state(PART:"seconds-sh", "default", 0.0);
+               set_state_val(PART:"seconds-sh", STATE_MAP_ROT_Z, (v * 360.0) / 60.0);
+               if (h < 22) 
+                  set_state_val(PART:"seconds-sh", STATE_IMAGE, IMAGE:"O/ch-s2-3.png");
+               else if (h < 44) 
+                  set_state_val(PART:"seconds-sh", STATE_IMAGE, IMAGE:"O/ch-s2-2.png");
+               else 
+                  set_state_val(PART:"seconds-sh", STATE_IMAGE, IMAGE:"O/ch-s2.png");
+               set_state(PART:"seconds-sh", "custom", 0.0);
+            }
+            else {
+               tim = timer(60.0 - (second), "clock_cb", 1);
+            }
+            set_int(tick_timer, tim);
+
+            custom_state(PART:"minutes", "default", 0.0);
+            set_state_val(PART:"minutes", STATE_MAP_ROT_Z, (float(minute) * 360.0) / 60.0);
+            if (h < 22) 
+               set_state_val(PART:"minutes", STATE_IMAGE, IMAGE:"O/ch-m1-3.png");
+            else if (h < 44) 
+               set_state_val(PART:"minutes", STATE_IMAGE, IMAGE:"O/ch-m1-2.png");
+            else 
+               set_state_val(PART:"minutes", STATE_IMAGE, IMAGE:"O/ch-m1.png");
+            set_state(PART:"minutes", "custom", 0.0);
+
+            custom_state(PART:"minutes-sh", "default", 0.0);
+            set_state_val(PART:"minutes-sh", STATE_MAP_ROT_Z, (float(minute) * 360.0) / 60.0);
+            if (h < 22) 
+               set_state_val(PART:"minutes-sh", STATE_IMAGE, IMAGE:"O/ch-m2-3.png");
+            else if (h < 44) 
+               set_state_val(PART:"minutes-sh", STATE_IMAGE, IMAGE:"O/ch-m2-2.png");
+            else 
+               set_state_val(PART:"minutes-sh", STATE_IMAGE, IMAGE:"O/ch-m2.png");
+            set_state(PART:"minutes-sh", "custom", 0.0);
+
+            custom_state(PART:"hour", "default", 0.0);
+            set_state_val(PART:"hour", STATE_MAP_ROT_Z, ((float(hour) + (float(minute) / 60.0)) * 360.0) / 12.0);
+            if (h < 22) 
+               set_state_val(PART:"hour", STATE_IMAGE, IMAGE:"O/ch-h1-3.png");
+            else if (h < 44) 
+               set_state_val(PART:"hour", STATE_IMAGE, IMAGE:"O/ch-h1-2.png");
+            else 
+               set_state_val(PART:"hour", STATE_IMAGE, IMAGE:"O/ch-h1.png");
+            set_state(PART:"hour", "custom", 0.0);
+            
+            custom_state(PART:"hour-sh", "default", 0.0);
+            set_state_val(PART:"hour-sh", STATE_MAP_ROT_Z, ((float(hour) + (float(minute) / 60.0)) * 360.0) / 12.0);
+            if (h < 22) 
+               set_state_val(PART:"hour-sh", STATE_IMAGE, IMAGE:"O/ch-h2-3.png");
+            else if (h < 44) 
+               set_state_val(PART:"hour-sh", STATE_IMAGE, IMAGE:"O/ch-h2-2.png");
+            else 
+               set_state_val(PART:"hour-sh", STATE_IMAGE, IMAGE:"O/ch-h2.png");
+            set_state(PART:"hour-sh", "custom", 0.0);
+         }
+      }
+      parts {
+         part {
+            name: "base";
+            description {
+               state: "default" 0.0;
+               aspect: 1.0 1.0;
+               image.normal: "O/clock_base.png";
+            }
+         }
+         part {
+            name: "base2";
+            type: RECT;
+            mouse_events: 0;
+            description {
+               state: "default" 0.0;
+               visible: 0;
+               rel1 {
+                  to: "base";
+                  relative: (2.0/128.0) (2.0/128.0);
+               }
+               rel2 {
+                  to: "base";
+                  relative: (1.0+(2.0/128.0)) (1.0+(2.0/128.0));
+               }
+            }
+         }
+         part {
+            name: "seconds-sh";
+            mouse_events: 0;
+            description { state: "default" 0.0;
+               rel1 {
+                  to: "base2";
+                  relative: 0.3125 0.0;
+               }
+               rel2 {
+                  to: "base2";
+                  relative: 0.6875 0.6875;
+               }
+               image.normal: "O/ch-s2.png";
+               map {
+                  on: 1;
+                  rotation {
+                     center: "base2";
+                  }
+               }
+            }
+            description { state: "hidden" 0.0;
+               inherit: "default" 0.0;
+               visible: 0;
+            }
+         }
+         part {
+            name: "seconds";
+            mouse_events: 0;
+            description { state: "default" 0.0;
+               rel1 {
+                  to: "base";
+                  relative: 0.3125 0.0;
+               }
+               rel2 {
+                  to: "base";
+                  relative: 0.6875 0.6875;
+               }
+               image.normal: "O/ch-s1.png";
+               map {
+                  on: 1;
+                  rotation {
+                     center: "base";
+                  }
+               }
+            }
+            description { state: "hidden" 0.0;
+               inherit: "default" 0.0;
+               visible: 0;
+            }
+         }
+         part {
+            name: "minutes-sh";
+            mouse_events: 0;
+            description {
+               state: "default" 0.0;
+               rel1 {
+                  to: "base2";
+                  relative: 0.3125 0.0;
+               }
+               rel2 {
+                  to: "base2";
+                  relative: 0.6875 0.6875;
+               }
+               image.normal: "O/ch-m2.png";
+               map {
+                  on: 1;
+                  rotation {
+                     center: "base2";
+                  }
+               }
+            }
+         }
+         part {
+            name: "minutes";
+            mouse_events: 0;
+            description {
+               state: "default" 0.0;
+               rel1 {
+                  to: "base";
+                  relative: 0.3125 0.0;
+               }
+               rel2 {
+                  to: "base";
+                  relative: 0.6875 0.6875;
+               }
+               image.normal: "O/ch-m1.png";
+               map {
+                  on: 1;
+                  rotation {
+                     center: "base";
+                  }
+               }
+            }
+         }
+         part {
+            name: "hour-sh";
+            mouse_events: 0;
+            description {
+               state: "default" 0.0;
+               rel1 {
+                  to: "base2";
+                  relative: 0.3125 0.0;
+               }
+               rel2 {
+                  to: "base2";
+                  relative: 0.6875 0.6875;
+               }
+               image.normal: "O/ch-h2.png";
+               map {
+                  on: 1;
+                  rotation {
+                     center: "base2";
+                  }
+               }
+            }
+         }
+         part {
+            name: "hour";
+            mouse_events: 0;
+            description {
+               state: "default" 0.0;
+               rel1 {
+                  to: "base";
+                  relative: 0.3125 0.0;
+               }
+               rel2 {
+                  to: "base";
+                  relative: 0.6875 0.6875;
+               }
+               image.normal: "O/ch-h1.png";
+               map {
+                  on: 1;
+                  rotation {
+                     center: "base";
+                  }
+               }
+            }
+         }
+         part {
+            name: "over";
+            mouse_events: 0;
+            description {
+               state: "default" 0.0;
+               rel1.to: "base";
+               rel2.to: "base";
+               image.normal: "O/tacho_fg.png";
+            }
+         }
+      }
+      programs {
+         program { name: "init";
+            signal: "load";
+            source: "";
+            script {
+               clock_cb(0);
+            }
+         }
+         program { name: "secon";
+            signal: "e,state,seconds,on";
+            source: "e";
+            action: STATE_SET "default" 0.0;
+            target: "seconds";
+            target: "seconds-sh";
+            after: "sec2";
+         }
+         program { name: "sec2";
+            script {
+               new tim;
+               
+               set_int(do_seconds, 1);
+               tim = get_int(tick_timer);
+               if (tim) {
+                  cancel_timer(tim);
+                  set_int(tick_timer, 0);
+               }
+               clock_cb(0);
+            }
+         }
+         program { name: "secoff";
+            signal: "e,state,seconds,off";
+            source: "e";
+            action: STATE_SET "hidden" 0.0;
+            target: "seconds";
+            target: "seconds-sh";
+            after: "sec3";
+         }
+         program { name: "sec3";
+            script {
+               new tim;
+               
+               set_int(do_seconds, 0);
+               tim = get_int(tick_timer);
+               if (tim) {
+                  cancel_timer(tim);
+                  set_int(tick_timer, 0);
+               }
+               clock_cb(0);
+            }
+         }
+      }
+   }
diff --git a/data/themes/img/O/ch-h1-2.png b/data/themes/img/O/ch-h1-2.png
new file mode 100644 (file)
index 0000000..779dbcb
Binary files /dev/null and b/data/themes/img/O/ch-h1-2.png differ
diff --git a/data/themes/img/O/ch-h1-3.png b/data/themes/img/O/ch-h1-3.png
new file mode 100644 (file)
index 0000000..fc55358
Binary files /dev/null and b/data/themes/img/O/ch-h1-3.png differ
diff --git a/data/themes/img/O/ch-h1.png b/data/themes/img/O/ch-h1.png
new file mode 100644 (file)
index 0000000..25dd268
Binary files /dev/null and b/data/themes/img/O/ch-h1.png differ
diff --git a/data/themes/img/O/ch-h2-2.png b/data/themes/img/O/ch-h2-2.png
new file mode 100644 (file)
index 0000000..ebdc0ce
Binary files /dev/null and b/data/themes/img/O/ch-h2-2.png differ
diff --git a/data/themes/img/O/ch-h2-3.png b/data/themes/img/O/ch-h2-3.png
new file mode 100644 (file)
index 0000000..fecb654
Binary files /dev/null and b/data/themes/img/O/ch-h2-3.png differ
diff --git a/data/themes/img/O/ch-h2.png b/data/themes/img/O/ch-h2.png
new file mode 100644 (file)
index 0000000..9edee57
Binary files /dev/null and b/data/themes/img/O/ch-h2.png differ
diff --git a/data/themes/img/O/ch-m1-2.png b/data/themes/img/O/ch-m1-2.png
new file mode 100644 (file)
index 0000000..18f463a
Binary files /dev/null and b/data/themes/img/O/ch-m1-2.png differ
diff --git a/data/themes/img/O/ch-m1-3.png b/data/themes/img/O/ch-m1-3.png
new file mode 100644 (file)
index 0000000..3a967e4
Binary files /dev/null and b/data/themes/img/O/ch-m1-3.png differ
diff --git a/data/themes/img/O/ch-m1.png b/data/themes/img/O/ch-m1.png
new file mode 100644 (file)
index 0000000..5a3dff4
Binary files /dev/null and b/data/themes/img/O/ch-m1.png differ
diff --git a/data/themes/img/O/ch-m2-2.png b/data/themes/img/O/ch-m2-2.png
new file mode 100644 (file)
index 0000000..13f26a7
Binary files /dev/null and b/data/themes/img/O/ch-m2-2.png differ
diff --git a/data/themes/img/O/ch-m2-3.png b/data/themes/img/O/ch-m2-3.png
new file mode 100644 (file)
index 0000000..fe0e8f0
Binary files /dev/null and b/data/themes/img/O/ch-m2-3.png differ
diff --git a/data/themes/img/O/ch-m2.png b/data/themes/img/O/ch-m2.png
new file mode 100644 (file)
index 0000000..a04a8b7
Binary files /dev/null and b/data/themes/img/O/ch-m2.png differ
diff --git a/data/themes/img/O/ch-s1-2.png b/data/themes/img/O/ch-s1-2.png
new file mode 100644 (file)
index 0000000..57cd5ae
Binary files /dev/null and b/data/themes/img/O/ch-s1-2.png differ
diff --git a/data/themes/img/O/ch-s1-3.png b/data/themes/img/O/ch-s1-3.png
new file mode 100644 (file)
index 0000000..75ddbf5
Binary files /dev/null and b/data/themes/img/O/ch-s1-3.png differ
diff --git a/data/themes/img/O/ch-s1.png b/data/themes/img/O/ch-s1.png
new file mode 100644 (file)
index 0000000..5ef6adc
Binary files /dev/null and b/data/themes/img/O/ch-s1.png differ
diff --git a/data/themes/img/O/ch-s2-2.png b/data/themes/img/O/ch-s2-2.png
new file mode 100644 (file)
index 0000000..bc4ee9e
Binary files /dev/null and b/data/themes/img/O/ch-s2-2.png differ
diff --git a/data/themes/img/O/ch-s2-3.png b/data/themes/img/O/ch-s2-3.png
new file mode 100644 (file)
index 0000000..11aac51
Binary files /dev/null and b/data/themes/img/O/ch-s2-3.png differ
diff --git a/data/themes/img/O/ch-s2.png b/data/themes/img/O/ch-s2.png
new file mode 100644 (file)
index 0000000..4acd928
Binary files /dev/null and b/data/themes/img/O/ch-s2.png differ
diff --git a/data/themes/img/O/clock_base.png b/data/themes/img/O/clock_base.png
new file mode 100644 (file)
index 0000000..79d76d7
Binary files /dev/null and b/data/themes/img/O/clock_base.png differ
diff --git a/data/themes/img/O/flip_0b.png b/data/themes/img/O/flip_0b.png
new file mode 100644 (file)
index 0000000..8a6ae9e
Binary files /dev/null and b/data/themes/img/O/flip_0b.png differ
diff --git a/data/themes/img/O/flip_0t.png b/data/themes/img/O/flip_0t.png
new file mode 100644 (file)
index 0000000..72506aa
Binary files /dev/null and b/data/themes/img/O/flip_0t.png differ
diff --git a/data/themes/img/O/flip_1b.png b/data/themes/img/O/flip_1b.png
new file mode 100644 (file)
index 0000000..ed80e8b
Binary files /dev/null and b/data/themes/img/O/flip_1b.png differ
diff --git a/data/themes/img/O/flip_1t.png b/data/themes/img/O/flip_1t.png
new file mode 100644 (file)
index 0000000..6c1fba8
Binary files /dev/null and b/data/themes/img/O/flip_1t.png differ
diff --git a/data/themes/img/O/flip_2b.png b/data/themes/img/O/flip_2b.png
new file mode 100644 (file)
index 0000000..3183b59
Binary files /dev/null and b/data/themes/img/O/flip_2b.png differ
diff --git a/data/themes/img/O/flip_2t.png b/data/themes/img/O/flip_2t.png
new file mode 100644 (file)
index 0000000..3453e3d
Binary files /dev/null and b/data/themes/img/O/flip_2t.png differ
diff --git a/data/themes/img/O/flip_3b.png b/data/themes/img/O/flip_3b.png
new file mode 100644 (file)
index 0000000..2eca7d4
Binary files /dev/null and b/data/themes/img/O/flip_3b.png differ
diff --git a/data/themes/img/O/flip_3t.png b/data/themes/img/O/flip_3t.png
new file mode 100644 (file)
index 0000000..4de9804
Binary files /dev/null and b/data/themes/img/O/flip_3t.png differ
diff --git a/data/themes/img/O/flip_4b.png b/data/themes/img/O/flip_4b.png
new file mode 100644 (file)
index 0000000..23484c9
Binary files /dev/null and b/data/themes/img/O/flip_4b.png differ
diff --git a/data/themes/img/O/flip_4t.png b/data/themes/img/O/flip_4t.png
new file mode 100644 (file)
index 0000000..2029161
Binary files /dev/null and b/data/themes/img/O/flip_4t.png differ
diff --git a/data/themes/img/O/flip_5b.png b/data/themes/img/O/flip_5b.png
new file mode 100644 (file)
index 0000000..8d9312a
Binary files /dev/null and b/data/themes/img/O/flip_5b.png differ
diff --git a/data/themes/img/O/flip_5t.png b/data/themes/img/O/flip_5t.png
new file mode 100644 (file)
index 0000000..df43929
Binary files /dev/null and b/data/themes/img/O/flip_5t.png differ
diff --git a/data/themes/img/O/flip_6b.png b/data/themes/img/O/flip_6b.png
new file mode 100644 (file)
index 0000000..09393e6
Binary files /dev/null and b/data/themes/img/O/flip_6b.png differ
diff --git a/data/themes/img/O/flip_6t.png b/data/themes/img/O/flip_6t.png
new file mode 100644 (file)
index 0000000..3cc4061
Binary files /dev/null and b/data/themes/img/O/flip_6t.png differ
diff --git a/data/themes/img/O/flip_7b.png b/data/themes/img/O/flip_7b.png
new file mode 100644 (file)
index 0000000..9afc419
Binary files /dev/null and b/data/themes/img/O/flip_7b.png differ
diff --git a/data/themes/img/O/flip_7t.png b/data/themes/img/O/flip_7t.png
new file mode 100644 (file)
index 0000000..abe1bc9
Binary files /dev/null and b/data/themes/img/O/flip_7t.png differ
diff --git a/data/themes/img/O/flip_8b.png b/data/themes/img/O/flip_8b.png
new file mode 100644 (file)
index 0000000..2185ee9
Binary files /dev/null and b/data/themes/img/O/flip_8b.png differ
diff --git a/data/themes/img/O/flip_8t.png b/data/themes/img/O/flip_8t.png
new file mode 100644 (file)
index 0000000..718e484
Binary files /dev/null and b/data/themes/img/O/flip_8t.png differ
diff --git a/data/themes/img/O/flip_9b.png b/data/themes/img/O/flip_9b.png
new file mode 100644 (file)
index 0000000..f867aea
Binary files /dev/null and b/data/themes/img/O/flip_9b.png differ
diff --git a/data/themes/img/O/flip_9t.png b/data/themes/img/O/flip_9t.png
new file mode 100644 (file)
index 0000000..5800a4c
Binary files /dev/null and b/data/themes/img/O/flip_9t.png differ
diff --git a/data/themes/img/O/flip_amb.png b/data/themes/img/O/flip_amb.png
new file mode 100644 (file)
index 0000000..e7b3b17
Binary files /dev/null and b/data/themes/img/O/flip_amb.png differ
diff --git a/data/themes/img/O/flip_amt.png b/data/themes/img/O/flip_amt.png
new file mode 100644 (file)
index 0000000..bc6a715
Binary files /dev/null and b/data/themes/img/O/flip_amt.png differ
diff --git a/data/themes/img/O/flip_b.png b/data/themes/img/O/flip_b.png
new file mode 100644 (file)
index 0000000..bb7c7e7
Binary files /dev/null and b/data/themes/img/O/flip_b.png differ
diff --git a/data/themes/img/O/flip_base.png b/data/themes/img/O/flip_base.png
new file mode 100644 (file)
index 0000000..607fba9
Binary files /dev/null and b/data/themes/img/O/flip_base.png differ
diff --git a/data/themes/img/O/flip_base_shad.png b/data/themes/img/O/flip_base_shad.png
new file mode 100644 (file)
index 0000000..0569977
Binary files /dev/null and b/data/themes/img/O/flip_base_shad.png differ
diff --git a/data/themes/img/O/flip_colon.png b/data/themes/img/O/flip_colon.png
new file mode 100644 (file)
index 0000000..3a674de
Binary files /dev/null and b/data/themes/img/O/flip_colon.png differ
diff --git a/data/themes/img/O/flip_pmb.png b/data/themes/img/O/flip_pmb.png
new file mode 100644 (file)
index 0000000..de14fa5
Binary files /dev/null and b/data/themes/img/O/flip_pmb.png differ
diff --git a/data/themes/img/O/flip_pmt.png b/data/themes/img/O/flip_pmt.png
new file mode 100644 (file)
index 0000000..8a72655
Binary files /dev/null and b/data/themes/img/O/flip_pmt.png differ
diff --git a/data/themes/img/O/flip_shad.png b/data/themes/img/O/flip_shad.png
new file mode 100644 (file)
index 0000000..3d74cea
Binary files /dev/null and b/data/themes/img/O/flip_shad.png differ
diff --git a/data/themes/img/O/flip_t.png b/data/themes/img/O/flip_t.png
new file mode 100644 (file)
index 0000000..74ed50d
Binary files /dev/null and b/data/themes/img/O/flip_t.png differ