enlightenment-module-moon/moon.edc

365 lines
8.8 KiB
Plaintext

#define POLICY_NEVER 0
#define POLICY_ALWAYS 1
#define POLICY_ON_MOUSE_OVER 2
images {
image: "e17_about_sky3.png" LOSSY 70;
image: "E-MoonClock-00.png" COMP;
image: "E-MoonClock-01.png" COMP;
image: "E-MoonClock-02.png" COMP;
image: "E-MoonClock-03.png" COMP;
image: "E-MoonClock-04.png" COMP;
image: "E-MoonClock-05.png" COMP;
image: "E-MoonClock-06.png" COMP;
image: "E-MoonClock-07.png" COMP;
image: "E-MoonClock-08.png" COMP;
image: "E-MoonClock-09.png" COMP;
image: "E-MoonClock-10.png" COMP;
image: "E-MoonClock-11.png" COMP;
image: "E-MoonClock-12.png" COMP;
image: "E-MoonClock-13.png" COMP;
image: "E-MoonClock-14.png" COMP;
image: "E-MoonClock-15.png" COMP;
image: "E-MoonClock-16.png" COMP;
image: "E-MoonClock-17.png" COMP;
image: "E-MoonClock-18.png" COMP;
image: "E-MoonClock-19.png" COMP;
image: "E-MoonClock-20.png" COMP;
image: "E-MoonClock-21.png" COMP;
image: "E-MoonClock-22.png" COMP;
image: "E-MoonClock-23.png" COMP;
image: "E-MoonClock-24.png" COMP;
image: "E-MoonClock-25.png" COMP;
image: "E-MoonClock-26.png" COMP;
image: "E-MoonClock-27.png" COMP;
image: "E-MoonClock-28.png" COMP;
image: "E-MoonClock-29.png" COMP;
image: "E-MoonClock-30.png" COMP;
image: "E-MoonClock-31.png" COMP;
image: "E-MoonClock-32.png" COMP;
image: "E-MoonClock-33.png" COMP;
image: "E-MoonClock-34.png" COMP;
image: "E-MoonClock-35.png" COMP;
image: "E-MoonClock-36.png" COMP;
image: "E-MoonClock-37.png" COMP;
image: "E-MoonClock-38.png" COMP;
image: "E-MoonClock-39.png" COMP;
image: "E-MoonClock-40.png" COMP;
image: "E-MoonClock-41.png" COMP;
image: "E-MoonClock-42.png" COMP;
image: "E-MoonClock-43.png" COMP;
image: "E-MoonClock-44.png" COMP;
image: "E-MoonClock-45.png" COMP;
image: "E-MoonClock-46.png" COMP;
image: "E-MoonClock-47.png" COMP;
image: "E-MoonClock-48.png" COMP;
image: "E-MoonClock-38.png" COMP;
image: "E-MoonClock-49.png" COMP;
image: "E-MoonClock-50.png" COMP;
image: "E-MoonClock-51.png" COMP;
image: "E-MoonClock-52.png" COMP;
image: "E-MoonClock-53.png" COMP;
image: "E-MoonClock-54.png" COMP;
image: "E-MoonClock-55.png" COMP;
image: "E-MoonClock-56.png" COMP;
image: "E-MoonClock-57.png" COMP;
image: "E-MoonClock-58.png" COMP;
image: "E-MoonClock-59.png" COMP;
}
collections {
group {
name: "module/moon/main";
min: 10 10;
max: 256 256;
script {
/* Display phase value policy - ALWAYS, NEVER, ON MOUSE OVER */
public global_show_phase_val;
/* Display cloud animations - ALWAYS, NEVER */
public global_show_cloud_anim;
apply_config(a1, a2, a3)
{
set_int(global_show_phase_val, a1);
if ((a1 == POLICY_NEVER) || (a1 == POLICY_ON_MOUSE_OVER))
run_program(PROGRAM:"phasevalue_out");
else if (a1 == POLICY_ALWAYS)
run_program(PROGRAM:"phasevalue_in");
// a2 is now obselete
a2 = a2 + 1
if (a3 != get_int(global_show_cloud_anim))
{
if (a3 == POLICY_ALWAYS)
{
set_state(PART:"sky", "displayed", 0.0);
run_program(PROGRAM:"anim_sky");
}
else if (a3 == POLICY_NEVER)
{
stop_program(PROGRAM:"anim_sky");
set_state(PART:"sky", "default", 0.0);
}
set_int(global_show_cloud_anim, a3);
}
}
public message(Msg_Type:type, id, ...)
{
if (type == MSG_STRING_FLOAT_SET)
{
/* received moon phase information */
new str[100];
getsarg(2, str, 100);
set_text(PART:"phasevalue", str);
set_state(PART:"moonphase", "default", getfarg(3));
}
else if (type == MSG_INT_SET)
{
/* received configuration settings */
if (numargs() != 5)
return;
apply_config(getarg(2), getarg(3), getarg(4));
}
}
}
parts {
part {
name: "moonphase";
mouse_events: 1; // for POLICY_ON_MOUSE_OVER
description {
state: "default" 0.0;
aspect: 1.0 1.0;
aspect_preference: BOTH;
rel1 {
relative: 0.05 0.05;
}
rel2 {
relative: 0.95 0.95;
}
image {
normal: "E-MoonClock-00.png";
}
}
# ifdef PHASE
# undef PHASE
# endif
# define PHASE(NAME) \
description { \
state: "default" (NAME.0 / 60.0); \
inherit: "default" 0.0; \
image { \
normal: "E-MoonClock-"NAME".png"; \
} \
}
PHASE(01)
PHASE(02)
PHASE(03)
PHASE(04)
PHASE(05)
PHASE(06)
PHASE(07)
PHASE(08)
PHASE(09)
PHASE(10)
PHASE(11)
PHASE(12)
PHASE(13)
PHASE(14)
PHASE(15)
PHASE(16)
PHASE(17)
PHASE(18)
PHASE(19)
PHASE(20)
PHASE(21)
PHASE(22)
PHASE(23)
PHASE(24)
PHASE(25)
PHASE(26)
PHASE(27)
PHASE(28)
PHASE(29)
PHASE(30)
PHASE(31)
PHASE(32)
PHASE(33)
PHASE(34)
PHASE(35)
PHASE(36)
PHASE(37)
PHASE(38)
PHASE(39)
PHASE(40)
PHASE(41)
PHASE(42)
PHASE(43)
PHASE(44)
PHASE(45)
PHASE(46)
PHASE(47)
PHASE(48)
PHASE(49)
PHASE(50)
PHASE(51)
PHASE(52)
PHASE(53)
PHASE(54)
PHASE(55)
PHASE(56)
PHASE(57)
PHASE(58)
PHASE(59)
}
part {
name: "sky";
mouse_events: 0;
description {
state: "default" 0.0;
visible: 0;
rel1 {
to: "moonphase";
}
rel2 {
to: "moonphase";
}
image {
normal: "e17_about_sky3.png";
}
fill {
smooth: 0;
size {
relative: 8.53 1.0;
}
}
}
description {
state: "displayed" 0.0;
inherit: "default" 0.0;
visible: 1;
}
description {
state: "drift" 0.0;
inherit: "default" 0.0;
visible: 1;
fill {
origin {
relative: -8.53 0.0;
}
}
}
}
part {
name: "phasevalue";
type: TEXT;
mouse_events: 0;
effect: SHADOW;
description {
state: "default" 0.0;
visible: 1;
min: 12 12;
rel1 {
relative: 0.0 0.0;
offset: 0 1;
to: "moonphase";
}
rel2 {
relative: 1.0 0.20;
to: "moonphase";
}
color: 0 0 0 0;
color3: 0 0 0 0;
text {
text: "Moon Phase";
size: 11;
// min: 1 1;
fit: 1 1;
align: 0.5 0.5;
}
}
description {
state: "displayed" 0.0;
inherit: "default" 0.0;
color: 255 255 255 167;
color3: 0 0 0 32;
}
}
}
programs {
program {
name: "edje_mousein";
signal: "mouse,in";
source: "moonphase";
script
{
new val = get_int(global_show_phase_val);
if (val == POLICY_ON_MOUSE_OVER)
run_program(PROGRAM:"phasevalue_in");
}
}
program {
name: "edje_mouseout";
signal: "mouse,out";
source: "moonphase";
script
{
new val = get_int(global_show_phase_val);
if (val == POLICY_ON_MOUSE_OVER)
run_program(PROGRAM:"phasevalue_out");
}
}
program {
name: "phasevalue_out";
action: STATE_SET "default" 0.0;
transition: LINEAR 0.4;
target: "phasevalue";
}
program {
name: "phasevalue_in";
action: STATE_SET "displayed" 0.0;
transition: SINUSOIDAL 0.4;
target: "phasevalue";
}
program {
name: "anim_sky";
action: STATE_SET "drift" 0.0;
transition: LINEAR 100.0;
target: "sky";
after: "anim_sky_control";
}
program {
name: "anim_sky_control";
action: STATE_SET "displayed" 0.0;
target: "sky";
after: "anim_sky";
/*
signal: "";
source: "";
script
{
new val;
val = get_int(global_show_cloud_anim);
if (val == POLICY_NEVER)
{
stop_program(PROGRAM:"anim_sky");
// uncomment this, and it's segv time
set_state(PART:"sky", "default", 0.0);
}
if (val == POLICY_ALWAYS)
{
set_state(PART:"sky", "displayed", 0.0);
run_program(PROGRAM:"anim_sky");
}
}
*/
}
}
}
}