summaryrefslogtreecommitdiff
path: root/data/elementary/themes/edc/mixer.edc
blob: 9387a1c039a686b47c7dc870b0da641753f9c019 (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
group { name: "e/modules/mixer/main";
   set { name: "speaker_clip";
      image { image: "speaker-clip-160.png"  COMP; size: 81 81 99999 99999; }
      image { image: "speaker-clip-080.png"  COMP; size: 41 41 80 80 99999; }
      image { image: "speaker-clip-040.png"  COMP; size:  0  0 40 40; }
   }
   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");
            }

            custom_state(PART:"vol-l", "default", 0.0);
            set_state_val(PART:"vol-l", STATE_REL1,
                          (float(100 - l) * 0.5) / 100.0,
                          (float(100 - l) * 1.0) / 100.0);
            set_state_val(PART:"vol-l", STATE_REL2,
                          float(50 + ((l + 1) / 2)) / 100.0,
                          1.0);
            set_state(PART:"vol-l", "custom", 0.0);

            custom_state(PART:"vol-r", "default", 0.0);
            set_state_val(PART:"vol-r", STATE_REL1,
                          (float(100 - r) * 0.5) / 100.0,
                          (float(100 - r) * 1.0) / 100.0);
            set_state_val(PART:"vol-r", STATE_REL2,
                          float(50 + ((r + 1) / 2)) / 100.0,
                          1.0);
            set_state(PART:"vol-r", "custom", 0.0);
         }
      }
   }
   parts {
      part { name: "base";
         description { state: "default" 0.0;
            image.normal: "clock_base";
            aspect: 1.0 1.0; aspect_preference: BOTH;
            color_class: "/bg/normal/gadgets/mixer/base";
         }
      }
      part { name: "middle";
         description { state: "default" 0.0;
            rel.to: "base";
            rel1.relative: 0.3 0.3;
            rel2.relative: 0.7 0.7;
            image.normal: "clock_base";
            color_class: "/bg/normal/gadgets/mixer/middle";
         }
      }
      part { name: "state"; type: RECT;
         description { state: "default" 0.0;
            color_class: "/fg/normal/gadgets/mixer/volume/normal";
         }
         description { state: "mute" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/normal/gadgets/mixer/volume/mute";
         }
      }
      part { name: "state-l"; type: RECT;
         clip_to: "state";
         description { state: "default" 0.0;
            rel1.relative: 0.0 0.0;
            rel2.relative: 0.5 1.0;
         }
      }
      part { name: "state-r"; type: RECT;
         clip_to: "state";
         description { state: "default" 0.0;
            rel1.relative: 0.5 0.0;
            rel2.relative: 1.0 1.0;
         }
      }
      part { name: "vclip-l";
         clip_to: "state-l";
         description { state: "default" 0.0;
            rel.to: "base";
            image.normal: "speaker_clip";
         }
      }
      part { name: "vclip-r";
         clip_to: "state-r";
         description { state: "default" 0.0;
            rel.to: "base";
            image.normal: "speaker_clip";
         }
      }
      part { name: "vol-l";
         clip_to: "vclip-l";
         description { state: "default" 0.0;
            rel.to: "base";
            image.normal: "clock_base";
         }
      }
      part { name: "vol-r";
         clip_to: "vclip-r";
         description { state: "default" 0.0;
            rel.to: "base";
            image.normal: "clock_base";
         }
      }
      part { name: "over"; type: RECT;
         description { state: "default" 0.0;
            color: 0 0 0 0; // no cc
         }
      }
   }
   programs {
      program { name: "mute";
         action: STATE_SET "mute" 0.0;
         transition: LINEAR 0.3 USE_DURATION_FACTOR 1;
         target: "state";
      }
      program { name: "unmute";
         action: STATE_SET "default" 0.0;
         transition: LINEAR 0.2 USE_DURATION_FACTOR 1;
         target: "state";
      }
   }
}