diff --git a/data/themes/Makefile.am b/data/themes/Makefile.am index 31f424c14..2f22c6adb 100644 --- a/data/themes/Makefile.am +++ b/data/themes/Makefile.am @@ -164,6 +164,7 @@ img/digit_8.png \ img/digit_9.png \ img/digit_am.png \ img/digit_na.png \ +img/digit_nm.png \ img/digit_pm.png \ img/dot_pattern.png \ img/downlight_glow.png \ diff --git a/data/themes/edc/clock.edc b/data/themes/edc/clock.edc index 6ed0c7d60..9be577a70 100644 --- a/data/themes/edc/clock.edc +++ b/data/themes/edc/clock.edc @@ -2,6 +2,7 @@ group { name: "e/modules/clock/digital"; min: 64 16; max: 512 128; images.image: "digit_na.png" COMP; + images.image: "digit_nm.png" COMP; images.image: "digit_0.png" COMP; images.image: "digit_1.png" COMP; images.image: "digit_2.png" COMP; @@ -16,22 +17,8 @@ group { name: "e/modules/clock/digital"; images.image: "digit_pm.png" COMP; images.image: "hole_tiny.png" COMP; script { - public do_seconds, do_24h, do_date; - new tick_timer; + public do_seconds, do_24h, do_date, tick_timer; - valset(id, v) { - if ((v >= 0) && (v <= 9)) { - new buf[20]; - snprintf(buf, 20, "%i", v); - set_state(id, buf, 0.0); - } else { - set_state(id, "default", 0.0); - } - } - apvalset(id, pm) { - if (pm) set_state(id, "active", 0.0); - else set_state(id, "default", 0.0); - } evalsize() { new do24h, dosec, v[14], i, tot, mul; new parts[] = { @@ -49,7 +36,7 @@ group { name: "e/modules/clock/digital"; mul = 3; } - for (i = 0; i < 14; i += 2) { + for (i = 12; i < 14; i += 2) { custom_state(parts[i], "default", 0.0); } v[0] = 0; v[1] = 2; v[2] = 2; v[3] = 4; // hrs @@ -102,7 +89,23 @@ group { name: "e/modules/clock/digital"; } clock_cb(0); } - + valset(name[], v) { + new buf[20], i; + + for (i = 0; i < 10; i++) { + if (i == v) { + snprintf(buf, 20, "show,%s-%i", name, i); + } + else { + snprintf(buf, 20, "hide,%s-%i", name, i); + } + emit(buf, "c"); + } + } + apvalset(id, pm) { + if (pm) set_state(id, "active", 0.0); + else set_state(id, "default", 0.0); + } public clock_cb(val) { new year, month, day, yearday, weekday, hour, minute; new Float:second; @@ -115,8 +118,8 @@ group { name: "e/modules/clock/digital"; v = round(second); tim = timer(1.0 - (second - v), "clock_cb", 1); // set seconds to v - valset(PART:"s0", v / 10); - valset(PART:"s1", v % 10); + valset("s0", v / 10); + valset("s1", v % 10); } else { tim = timer(60.0 - (second), "clock_cb", 1); @@ -124,14 +127,14 @@ group { name: "e/modules/clock/digital"; set_int(tick_timer, tim); // set minutes to minute - valset(PART:"m0", minute / 10); - valset(PART:"m1", minute % 10); + valset("m0", minute / 10); + valset("m1", minute % 10); // set hours to hour do24h = get_int(do_24h); if (do24h) { - valset(PART:"h0", hour / 10); - valset(PART:"h1", hour % 10); + valset("h0", hour / 10); + valset("h1", hour % 10); } else { new pm; @@ -147,8 +150,8 @@ group { name: "e/modules/clock/digital"; // make after midnight be 12:XX AM :) if (hour == 0) hour = 12; } - valset(PART:"h0", hour / 10); - valset(PART:"h1", hour % 10); + valset("h0", hour / 10); + valset("h1", hour % 10); apvalset(PART:"ap", pm); } } @@ -298,43 +301,60 @@ group { name: "e/modules/clock/digital"; image.normal: "hole_tiny.png"; } } -#define DIGIT(_NAME, _TO) \ +#define ELEM(_NAME, _TO, _DIGIT) \ part { name: _NAME; \ description { state: "default" 0.0; \ rel1.to: _TO; rel2.to: _TO; \ aspect: (52/72) (52/72); aspect_preference: BOTH; \ - image.normal: "digit_na.png"; \ + image.normal: "digit_"_DIGIT".png"; \ + visible: 0; \ + color: 255 255 255 0; \ + } \ + description { state: "active" 0.0; \ + inherit: "default" 0.0; \ + visible: 1; \ + color: 255 255 255 255; \ } \ - description { state: "0" 0.0; inherit: "default" 0.0; image.normal: "digit_0.png"; } \ - description { state: "1" 0.0; inherit: "default" 0.0; image.normal: "digit_1.png"; } \ - description { state: "2" 0.0; inherit: "default" 0.0; image.normal: "digit_2.png"; } \ - description { state: "3" 0.0; inherit: "default" 0.0; image.normal: "digit_3.png"; } \ - description { state: "4" 0.0; inherit: "default" 0.0; image.normal: "digit_4.png"; } \ - description { state: "5" 0.0; inherit: "default" 0.0; image.normal: "digit_5.png"; } \ - description { state: "6" 0.0; inherit: "default" 0.0; image.normal: "digit_6.png"; } \ - description { state: "7" 0.0; inherit: "default" 0.0; image.normal: "digit_7.png"; } \ - description { state: "8" 0.0; inherit: "default" 0.0; image.normal: "digit_8.png"; } \ - description { state: "9" 0.0; inherit: "default" 0.0; image.normal: "digit_9.png"; } \ } -#define DIGITC(_NAME, _TO, _CLIP) \ +#define DIGIT(_NAME, _TO) \ + ELEM(_NAME"-0", _TO, "0") \ + ELEM(_NAME"-1", _TO, "1") \ + ELEM(_NAME"-2", _TO, "2") \ + ELEM(_NAME"-3", _TO, "3") \ + ELEM(_NAME"-4", _TO, "4") \ + ELEM(_NAME"-5", _TO, "5") \ + ELEM(_NAME"-6", _TO, "6") \ + ELEM(_NAME"-7", _TO, "7") \ + ELEM(_NAME"-8", _TO, "8") \ + ELEM(_NAME"-9", _TO, "9") +#define ELEMC(_NAME, _TO, _DIGIT, _CLIP) \ part { name: _NAME; \ clip_to: _CLIP; \ description { state: "default" 0.0; \ rel1.to: _TO; rel2.to: _TO; \ aspect: (52/72) (52/72); aspect_preference: BOTH; \ - image.normal: "digit_na.png"; \ + image.normal: "digit_"_DIGIT".png"; \ + visible: 0; \ + color: 255 255 255 0; \ + } \ + description { state: "active" 0.0; \ + inherit: "default" 0.0; \ + visible: 1; \ + color: 255 255 255 255; \ } \ - description { state: "0" 0.0; inherit: "default" 0.0; image.normal: "digit_0.png"; } \ - description { state: "1" 0.0; inherit: "default" 0.0; image.normal: "digit_1.png"; } \ - description { state: "2" 0.0; inherit: "default" 0.0; image.normal: "digit_2.png"; } \ - description { state: "3" 0.0; inherit: "default" 0.0; image.normal: "digit_3.png"; } \ - description { state: "4" 0.0; inherit: "default" 0.0; image.normal: "digit_4.png"; } \ - description { state: "5" 0.0; inherit: "default" 0.0; image.normal: "digit_5.png"; } \ - description { state: "6" 0.0; inherit: "default" 0.0; image.normal: "digit_6.png"; } \ - description { state: "7" 0.0; inherit: "default" 0.0; image.normal: "digit_7.png"; } \ - description { state: "8" 0.0; inherit: "default" 0.0; image.normal: "digit_8.png"; } \ - description { state: "9" 0.0; inherit: "default" 0.0; image.normal: "digit_9.png"; } \ } +#define DIGITC(_NAME, _TO, _CLIP) \ + ELEMC(_NAME"-0", _TO, "0", _CLIP) \ + ELEMC(_NAME"-1", _TO, "1", _CLIP) \ + ELEMC(_NAME"-2", _TO, "2", _CLIP) \ + ELEMC(_NAME"-3", _TO, "3", _CLIP) \ + ELEMC(_NAME"-4", _TO, "4", _CLIP) \ + ELEMC(_NAME"-5", _TO, "5", _CLIP) \ + ELEMC(_NAME"-6", _TO, "6", _CLIP) \ + ELEMC(_NAME"-7", _TO, "7", _CLIP) \ + ELEMC(_NAME"-8", _TO, "8", _CLIP) \ + ELEMC(_NAME"-9", _TO, "9", _CLIP) + #define TAG(_NAME, _TO, _CLIP) \ part { name: _NAME; \ clip_to: _CLIP; \ @@ -348,7 +368,35 @@ group { name: "e/modules/clock/digital"; image.normal: "digit_pm.png"; \ } \ } +#define BASE(_NAME, _BASE, _IMG) \ + part { name: _NAME; \ + description { state: "default" 0.0; \ + rel1.to: _BASE; \ + rel2.to: _BASE; \ + image.normal: _IMG; \ + color: 255 255 255 128; \ + } \ + } +#define BASEC(_NAME, _CLIP, _BASE, _IMG) \ + part { name: _NAME; \ + clip_to: _CLIP; \ + description { state: "default" 0.0; \ + rel1.to: _BASE; \ + rel2.to: _BASE; \ + image.normal: _IMG; \ + color: 255 255 255 128; \ + } \ + } + BASE ("ha", "h0-0", "digit_na.png") + BASE ("hb", "h1-0", "digit_na.png") + BASE ("ma", "m0-0", "digit_na.png") + BASE ("mb", "m1-0", "digit_na.png") + + BASEC("sa", "secclip", "s0-0", "digit_na.png") + BASEC("sb", "secclip", "s1-0", "digit_na.png") + BASEC("aa", "ampmclip", "ap", "digit_nm.png") + DIGIT ("h0", "hours1") DIGIT ("h1", "hours2") DIGIT ("m0", "mins1") @@ -357,7 +405,13 @@ group { name: "e/modules/clock/digital"; DIGITC("s1", "secs2", "secclip") TAG("ap", "ampm", "ampmclip") #undef TAG -#undef DIGIT +#undef TAG +#undef ELEM +#undef ELEMC +#undef BASE +#undef BASEC +#undef DIGIT +#undef DIGITC part { name: "e.text.today"; type: TEXT; effect: GLOW; @@ -388,7 +442,7 @@ group { name: "e/modules/clock/digital"; program { signal: "load"; source: ""; script { - clock_cb(0); + reset(); } } program { @@ -439,6 +493,39 @@ group { name: "e/modules/clock/digital"; reset(); } } +#define DIGPRG(_NAME) \ + program { \ + signal: "show,"_NAME; source: "c"; \ + action: STATE_SET "active" 0.0; \ + transition: BOUNCE 0.3 0.5 2; \ + target: _NAME; \ + } \ + program { \ + signal: "hide,"_NAME; source: "c"; \ + action: STATE_SET "default" 0.0; \ + transition: DECELERATE 0.3; \ + target: _NAME; \ + } +#define DIGPRGS(_NAME) \ + DIGPRG(_NAME"-0") \ + DIGPRG(_NAME"-1") \ + DIGPRG(_NAME"-2") \ + DIGPRG(_NAME"-3") \ + DIGPRG(_NAME"-4") \ + DIGPRG(_NAME"-5") \ + DIGPRG(_NAME"-6") \ + DIGPRG(_NAME"-7") \ + DIGPRG(_NAME"-8") \ + DIGPRG(_NAME"-9") + + DIGPRGS("h0") + DIGPRGS("h1") + DIGPRGS("m0") + DIGPRGS("m1") + DIGPRGS("s0") + DIGPRGS("s1") +#undef DIGPRG +#undef DIGPRGS } } diff --git a/data/themes/img/digit_0.png b/data/themes/img/digit_0.png index 5913ef263..9cdc3b189 100644 Binary files a/data/themes/img/digit_0.png and b/data/themes/img/digit_0.png differ diff --git a/data/themes/img/digit_1.png b/data/themes/img/digit_1.png index 91b9614a5..e68ef0a62 100644 Binary files a/data/themes/img/digit_1.png and b/data/themes/img/digit_1.png differ diff --git a/data/themes/img/digit_2.png b/data/themes/img/digit_2.png index 84ffad86b..463a6a1ac 100644 Binary files a/data/themes/img/digit_2.png and b/data/themes/img/digit_2.png differ diff --git a/data/themes/img/digit_3.png b/data/themes/img/digit_3.png index 81bd1f74a..1f9c5f443 100644 Binary files a/data/themes/img/digit_3.png and b/data/themes/img/digit_3.png differ diff --git a/data/themes/img/digit_4.png b/data/themes/img/digit_4.png index 0e2e57aa7..58b1c0723 100644 Binary files a/data/themes/img/digit_4.png and b/data/themes/img/digit_4.png differ diff --git a/data/themes/img/digit_5.png b/data/themes/img/digit_5.png index 61d5909f2..d9f648323 100644 Binary files a/data/themes/img/digit_5.png and b/data/themes/img/digit_5.png differ diff --git a/data/themes/img/digit_6.png b/data/themes/img/digit_6.png index 3b0af99c3..0f5a55d42 100644 Binary files a/data/themes/img/digit_6.png and b/data/themes/img/digit_6.png differ diff --git a/data/themes/img/digit_7.png b/data/themes/img/digit_7.png index 8029af3d4..0d36ec28e 100644 Binary files a/data/themes/img/digit_7.png and b/data/themes/img/digit_7.png differ diff --git a/data/themes/img/digit_8.png b/data/themes/img/digit_8.png index e56bda495..cd24056eb 100644 Binary files a/data/themes/img/digit_8.png and b/data/themes/img/digit_8.png differ diff --git a/data/themes/img/digit_9.png b/data/themes/img/digit_9.png index 5509c057c..4691191f4 100644 Binary files a/data/themes/img/digit_9.png and b/data/themes/img/digit_9.png differ diff --git a/data/themes/img/digit_na.png b/data/themes/img/digit_na.png index 643bd0b58..e8652ef03 100644 Binary files a/data/themes/img/digit_na.png and b/data/themes/img/digit_na.png differ diff --git a/data/themes/img/digit_nm.png b/data/themes/img/digit_nm.png new file mode 100644 index 000000000..292a2a3b6 Binary files /dev/null and b/data/themes/img/digit_nm.png differ diff --git a/data/themes/img/digit_pm.png b/data/themes/img/digit_pm.png index 03b731d2a..e3ccf7777 100644 Binary files a/data/themes/img/digit_pm.png and b/data/themes/img/digit_pm.png differ