381 lines
12 KiB
Plaintext
381 lines
12 KiB
Plaintext
/**
|
|
* E17 Audio Gadget
|
|
*/
|
|
|
|
|
|
#define FIXED_SIZE(_WIDTH, _HEIGHT) \
|
|
min: _WIDTH _HEIGHT; max: _WIDTH _HEIGHT; fixed: 1 1;
|
|
|
|
#define FN "Sans"
|
|
#define FNBD "Sans:style=Bold"
|
|
#define FN_COL_HIGHLIGHT 51 153 255 255; color2: 51 153 255 24; color3: 51 153 255 18
|
|
|
|
|
|
images {
|
|
image: "icon_mixer.png" COMP;
|
|
image: "icon_prev.png" COMP;
|
|
image: "icon_next.png" COMP;
|
|
image: "icon_pause.png" COMP;
|
|
image: "icon_play.png" COMP;
|
|
image: "cover.png" COMP;
|
|
image: "speaker.png" COMP;
|
|
image: "inset_round_hilight.png" COMP;
|
|
image: "inset_round_shadow.png" COMP;
|
|
image: "inset_round_shading.png" COMP;
|
|
image: "led_dot_white.png" COMP;
|
|
}
|
|
|
|
|
|
collections {
|
|
/**
|
|
* API [e/gadget/icon] The group used for the icon of the gadget
|
|
*/
|
|
group { name: "e/gadgets/audio/icon";
|
|
parts {
|
|
part { name: "icon";
|
|
description {
|
|
state: "default" 0.0;
|
|
aspect: 1.0 1.0;
|
|
aspect_preference: BOTH;
|
|
image {
|
|
normal: "icon_mixer.png";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* API [e/gadget/main] The main group of the gadget
|
|
*/
|
|
group { name: "e/gadgets/audio/main";
|
|
max: 160 160;
|
|
min: 16 16;
|
|
script {
|
|
public message(Msg_Type:type, id, ...) {
|
|
if ((type == MSG_INT_SET) && (id == 0)) {
|
|
new m, l, r;
|
|
|
|
m = getarg(2);
|
|
l = getarg(3);
|
|
r = getarg(4);
|
|
|
|
if (m) {
|
|
run_program(PROGRAM:"mute");
|
|
} else {
|
|
run_program(PROGRAM:"unmute");
|
|
}
|
|
|
|
if (l <= 0) {
|
|
run_program(PROGRAM:"l0-off");
|
|
run_program(PROGRAM:"l1-off");
|
|
run_program(PROGRAM:"l2-off");
|
|
run_program(PROGRAM:"l3-off");
|
|
run_program(PROGRAM:"l4-off");
|
|
} else if (l <= 20) {
|
|
run_program(PROGRAM:"l0-on");
|
|
run_program(PROGRAM:"l1-off");
|
|
run_program(PROGRAM:"l2-off");
|
|
run_program(PROGRAM:"l3-off");
|
|
run_program(PROGRAM:"l4-off");
|
|
} else if (l <= 40) {
|
|
run_program(PROGRAM:"l0-on");
|
|
run_program(PROGRAM:"l1-on");
|
|
run_program(PROGRAM:"l2-off");
|
|
run_program(PROGRAM:"l3-off");
|
|
run_program(PROGRAM:"l4-off");
|
|
} else if (l <= 60) {
|
|
run_program(PROGRAM:"l0-on");
|
|
run_program(PROGRAM:"l1-on");
|
|
run_program(PROGRAM:"l2-on");
|
|
run_program(PROGRAM:"l3-off");
|
|
run_program(PROGRAM:"l4-off");
|
|
} else if (l <= 80) {
|
|
run_program(PROGRAM:"l0-on");
|
|
run_program(PROGRAM:"l1-on");
|
|
run_program(PROGRAM:"l2-on");
|
|
run_program(PROGRAM:"l3-on");
|
|
run_program(PROGRAM:"l4-off");
|
|
} else {
|
|
run_program(PROGRAM:"l0-on");
|
|
run_program(PROGRAM:"l1-on");
|
|
run_program(PROGRAM:"l2-on");
|
|
run_program(PROGRAM:"l3-on");
|
|
run_program(PROGRAM:"l4-on");
|
|
}
|
|
|
|
if (r <= 0) {
|
|
run_program(PROGRAM:"r0-off");
|
|
run_program(PROGRAM:"r1-off");
|
|
run_program(PROGRAM:"r2-off");
|
|
run_program(PROGRAM:"r3-off");
|
|
run_program(PROGRAM:"r4-off");
|
|
} else if (r <= 20) {
|
|
run_program(PROGRAM:"r0-on");
|
|
run_program(PROGRAM:"r1-off");
|
|
run_program(PROGRAM:"r2-off");
|
|
run_program(PROGRAM:"r3-off");
|
|
run_program(PROGRAM:"r4-off");
|
|
} else if (r <= 40) {
|
|
run_program(PROGRAM:"r0-on");
|
|
run_program(PROGRAM:"r1-on");
|
|
run_program(PROGRAM:"r2-off");
|
|
run_program(PROGRAM:"r3-off");
|
|
run_program(PROGRAM:"r4-off");
|
|
} else if (r <= 60) {
|
|
run_program(PROGRAM:"r0-on");
|
|
run_program(PROGRAM:"r1-on");
|
|
run_program(PROGRAM:"r2-on");
|
|
run_program(PROGRAM:"r3-off");
|
|
run_program(PROGRAM:"r4-off");
|
|
} else if (r <= 80) {
|
|
run_program(PROGRAM:"r0-on");
|
|
run_program(PROGRAM:"r1-on");
|
|
run_program(PROGRAM:"r2-on");
|
|
run_program(PROGRAM:"r3-on");
|
|
run_program(PROGRAM:"r4-off");
|
|
} else {
|
|
run_program(PROGRAM:"r0-on");
|
|
run_program(PROGRAM:"r1-on");
|
|
run_program(PROGRAM:"r2-on");
|
|
run_program(PROGRAM:"r3-on");
|
|
run_program(PROGRAM:"r4-on");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
parts {
|
|
part { name: "base-sh";
|
|
description { state: "default" 0.0;
|
|
rel1.to: "base";
|
|
rel1.offset: 0 -1;
|
|
rel2.to: "base";
|
|
rel2.offset: -1 -2;
|
|
image.normal: "inset_round_shadow.png";
|
|
}
|
|
}
|
|
part { name: "base-hi";
|
|
description { state: "default" 0.0;
|
|
rel1.to: "base";
|
|
rel1.offset: 0 1;
|
|
rel2.to: "base";
|
|
rel2.offset: -1 0;
|
|
image.normal: "inset_round_hilight.png";
|
|
}
|
|
}
|
|
part { name: "base";
|
|
description { state: "default" 0.0;
|
|
// min: 32 32;
|
|
rel1.relative: (25/380) (25/380);
|
|
rel2.relative: (365/380) (365/380);
|
|
aspect: 1.0 1.0; aspect_preference: BOTH;
|
|
image.normal: "speaker.png";
|
|
}
|
|
}
|
|
part { name: "state"; type: RECT;
|
|
description { state: "default" 0.0;
|
|
rel1.relative: -1.0 -1.0;
|
|
rel2.relative: 2.0 2.0;
|
|
color: 51 153 255 255;
|
|
}
|
|
description { state: "mute" 0.0;
|
|
inherit: "default" 0.0;
|
|
color: 255 153 51 255;
|
|
}
|
|
}
|
|
#define LED(_NAME, _BASE, _X, _SIZE) \
|
|
part { name: _NAME; type: RECT; \
|
|
clip_to: "state"; \
|
|
description { state: "default" 0.0; \
|
|
rel1.relative: ((_BASE+(_X*8))/160) (80/160); \
|
|
rel2.relative: ((_BASE+(_X*8))/160) (80/160); \
|
|
min: 1 1; \
|
|
max: 1 1; \
|
|
visible: 0; \
|
|
color: 255 255 255 0; \
|
|
} \
|
|
description { state: "active" 0.0; \
|
|
inherit: "default" 0.0; \
|
|
visible: 1; \
|
|
color: 255 255 255 255; \
|
|
} \
|
|
} \
|
|
part { name: _NAME"g"; \
|
|
clip_to: "state"; \
|
|
description { state: "default" 0.0; \
|
|
rel1.to: _NAME; \
|
|
rel2.to: _NAME; \
|
|
image.normal: "led_dot_white.png"; \
|
|
min: _SIZE _SIZE; \
|
|
visible: 0; \
|
|
color: 255 255 255 0; \
|
|
} \
|
|
description { state: "active" 0.0; \
|
|
inherit: "default" 0.0; \
|
|
visible: 1; \
|
|
color: 255 255 255 255; \
|
|
} \
|
|
}
|
|
LED("r0", 99, 0, 1)
|
|
LED("r1", 99, 1, 9)
|
|
LED("r2", 99, 2, 15)
|
|
LED("r3", 99, 3, 21)
|
|
LED("r4", 99, 4, 27)
|
|
LED("l0", 61, 0, 1)
|
|
LED("l1", 61, -1, 9)
|
|
LED("l2", 61, -2, 15)
|
|
LED("l3", 61, -3, 21)
|
|
LED("l4", 61, -4, 27)
|
|
#undef LED
|
|
part { name: "over"; type: RECT;
|
|
description { state: "default" 0.0;
|
|
color: 255 255 255 0;
|
|
}
|
|
}
|
|
}
|
|
programs {
|
|
program { name: "mute";
|
|
action: STATE_SET "mute" 0.0;
|
|
transition: LINEAR 0.3;
|
|
target: "state";
|
|
}
|
|
program { name: "unmute";
|
|
action: STATE_SET "default" 0.0;
|
|
transition: LINEAR 0.2;
|
|
target: "state";
|
|
}
|
|
#define PROG(_NAME) \
|
|
program { name: _NAME"-on"; \
|
|
action: STATE_SET "active" 0.0; \
|
|
target: _NAME; \
|
|
target: _NAME"g"; \
|
|
} \
|
|
program { name: _NAME"-off"; \
|
|
action: STATE_SET "default" 0.0; \
|
|
target: _NAME; \
|
|
target: _NAME"g"; \
|
|
}
|
|
PROG("r0")
|
|
PROG("r1")
|
|
PROG("r2")
|
|
PROG("r3")
|
|
PROG("r4")
|
|
PROG("l0")
|
|
PROG("l1")
|
|
PROG("l2")
|
|
PROG("l3")
|
|
PROG("l4")
|
|
#undef PROG
|
|
}
|
|
}
|
|
|
|
group { name: "e/gadgets/audio/player";
|
|
min: 310 100;
|
|
styles {
|
|
style { name: "music_control_metadata_style";
|
|
base: "font="FN" font_size=10 align=left color=#ffff style=shadow,bottom shadow_color=#00000080 wrap=mixed";
|
|
tag: "title" "+ font="FNBD" font_size=12";
|
|
tag: "tag" "+ font_size=8 color=#888f";
|
|
tag: "br" "\n";
|
|
}
|
|
}
|
|
parts {
|
|
part { name: "cover_bg";
|
|
description { state: "default" 0;
|
|
min: 100 100;
|
|
max: 100 100;
|
|
align: 0.0 0.5;
|
|
image.normal: "cover.png";
|
|
}
|
|
}
|
|
part { name: "cover.swallow"; type: SWALLOW;
|
|
description { state: "default" 0;
|
|
rel1.to: "cover_bg";
|
|
rel2.to: "cover_bg";
|
|
}
|
|
}
|
|
part { name: "player_name"; type: TEXT;
|
|
effect: GLOW;
|
|
description { state: "default" 0;
|
|
min: 210 15;
|
|
max: 210 15;
|
|
align: 0.5 0.0;
|
|
color: FN_COL_HIGHLIGHT;
|
|
text {
|
|
size: 12;
|
|
font: FNBD;
|
|
}
|
|
rel1.to_x: "cover_bg";
|
|
rel1.relative: 1.0 0.0;
|
|
rel1.offset: 3 0;
|
|
}
|
|
}
|
|
part { name: "metadata"; type: TEXTBLOCK;
|
|
description { state: "default" 0;
|
|
text {
|
|
style: "music_control_metadata_style";
|
|
text: "Song Title";
|
|
align: 0.0 0.0;
|
|
}
|
|
rel1.to_x: "cover_bg";
|
|
rel1.relative: 1.0 0.0;
|
|
rel1.offset: 3 15;
|
|
}
|
|
}
|
|
part { name: "prev_btn";
|
|
description { state: "default" 0;
|
|
FIXED_SIZE(32, 32)
|
|
rel1.to: "metadata";
|
|
rel2.to: "metadata";
|
|
align: 0.1 1.0;
|
|
image.normal: "icon_prev.png";
|
|
}
|
|
}
|
|
part { name: "play_btn";
|
|
description { state: "default" 0;
|
|
FIXED_SIZE(32, 32)
|
|
rel1.to: "metadata";
|
|
rel2.to: "metadata";
|
|
align: 0.5 1.0;
|
|
image.normal: "icon_pause.png";
|
|
}
|
|
description { state: "play" 0.0;
|
|
inherit: "default" 0.0;
|
|
image.normal: "icon_play.png";
|
|
}
|
|
}
|
|
part { name: "next_btn";
|
|
description { state: "default" 0;
|
|
FIXED_SIZE(32, 32)
|
|
rel1.to: "metadata";
|
|
rel2.to: "metadata";
|
|
align: 0.9 1.0;
|
|
image.normal: "icon_next.png";
|
|
}
|
|
}
|
|
}
|
|
programs {
|
|
program { signal: "state,set,playing"; source: "";
|
|
action: STATE_SET "default" 0.0;
|
|
target: "play_btn";
|
|
}
|
|
program { signal: "state,set,paused"; source: "";
|
|
action: STATE_SET "play" 0.0;
|
|
target: "play_btn";
|
|
}
|
|
program { signal: "mouse,down,1"; source: "play_btn";
|
|
action: SIGNAL_EMIT "act,play" "";
|
|
}
|
|
program { signal: "mouse,down,1"; source: "prev_btn";
|
|
action: SIGNAL_EMIT "act,prev" "";
|
|
}
|
|
program { signal: "mouse,down,1"; source: "next_btn";
|
|
action: SIGNAL_EMIT "act,next" "";
|
|
}
|
|
program { signal: "mouse,down,1"; source: "player_name";
|
|
action: SIGNAL_EMIT "act,rais" "";
|
|
}
|
|
}
|
|
}
|
|
}
|