summaryrefslogtreecommitdiff
path: root/data/elementary/themes/edc/mixer.edc
blob: 802b1b8b3c34e7d9a05b880e73bc8f9cb549d157 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
group { name: "e/modules/mixer/main";
   alias: "e/modules/mixer/main_vert";
   images.image: "speaker.png" COMP;
   images.image: "inset_round_hilight.png" COMP;
   images.image: "inset_round_shadow.png" COMP;
   images.image: "inset_round_shading.png" COMP;
   images.image: "led_dot_white.png" COMP;
   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;
            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; \
            fixed: 1 1; \
            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
   }
}