1group { name: "e/modules/battery/main"; 2 images.image: "bat_shadow.png" COMP; 3 images.image: "bat_base.png" COMP; 4 images.image: "bat_shine.png" COMP; 5 images.image: "bat_bottom0.png" COMP; 6 images.image: "bat_bottom1.png" COMP; 7 images.image: "bat_top0.png" COMP; 8 images.image: "bat_top1.png" COMP; 9 images.image: "glow_med_white.png" COMP; 10 script { 11 public message(Msg_Type:type, id, ...) { 12 if ((type == MSG_FLOAT) && (id == 1)) { 13 new Float:val; 14 new r = 51, g = 153, b = 255; 15 new lr = 255, lg = 0, lb = 0; 16 17 val = getfarg(2); 18 if (val < 0.35) { 19 new Float:val1, Float:val2; 20 21 val1 = (val - 0.10) / 0.25; 22 val2 = 1.0 - val1; 23 r = round((r * val1) + (lr * val2), ROUND); 24 g = round((g * val1) + (lg * val2), ROUND); 25 b = round((b * val1) + (lb * val2), ROUND); 26 } 27 custom_state(PART:"fill", "default", 0.0); 28 set_state_val(PART:"fill", STATE_COLOR, r, g, b, 255); 29 set_state_val(PART:"fill", STATE_COLOR, r, g, b, 255); 30 set_state_val(PART:"fill", STATE_COLOR, r, g, b, 255); 31 set_state_val(PART:"fill", STATE_REL1, 0.0, 1.0 - val); 32 set_state(PART:"fill", "custom", 0.0); 33 } 34 } 35 } 36 parts { 37 part { name: "fade_clip"; type: RECT; 38 description { state: "default" 0.0; 39 color: 255 255 255 255; 40 } 41 description { state: "faded" 0.0; 42 color: 128 128 128 255; 43 } 44 } 45 part { name: "info_clip"; type: RECT; 46 clip_to: "fade_clip"; 47 description { state: "default" 0.0; 48 color: 255 255 255 0; 49 } 50 description { state: "visible" 0.0; 51 color: 255 255 255 255; 52 } 53 } 54 part { name: "pulse_clip"; type: RECT; 55 clip_to: "fade_clip"; 56 description { state: "default" 0.0; 57 color: 255 255 255 255; 58 } 59 description { state: "faded" 1.0; 60 color: 255 255 255 255; 61 } 62 description { state: "faded" 0.0; 63 color: 255 255 255 64; 64 } 65 } 66 part { name: "fill_region"; type: SPACER; 67 description { state: "default" 0.0; 68 rel1.to: "bg"; 69 rel2.to: "bg"; 70 } 71 } 72 part { name: "pwr"; type: SPACER; 73 description { state: "default" 0.0; 74 rel1.to: "bg"; 75 rel1.relative: 0.40 0.40; 76 rel2.to: "bg"; 77 rel2.relative: 0.60 0.60; 78 aspect: 1.0 1.0; aspect_preference: BOTH; 79 step: 5 5; 80 } 81 } 82 part { name: "base"; type: SPACER; 83 description { state: "default" 0.0; 84 aspect: 1.0 1.0; aspect_preference: BOTH; 85 } 86 } 87 part { name: "shadow"; 88 clip_to: "pulse_clip"; 89 description { state: "default" 0.0; 90 rel1.to: "top"; 91 rel1.offset: -4 0; 92 rel2.to: "bottom"; 93 rel2.offset: 3 3; 94 image.normal: "bat_shadow.png"; 95 } 96 } 97 part { name: "bg"; 98 clip_to: "pulse_clip"; 99 description { state: "default" 0.0; 100 rel1.to: "top"; 101 rel1.relative: 0.0 1.0; 102 rel2.to: "bottom"; 103 rel2.relative: 1.0 0.0; 104 image.normal: "bat_base.png"; 105 fill.smooth: 0; 106 } 107 } 108 part { name: "top"; 109 clip_to: "pulse_clip"; 110 description { state: "default" 0.0; 111 rel1.to: "base"; 112 rel1.offset: 6 4; 113 rel2.to: "base"; 114 rel2.offset: -7 4; 115 rel2.relative: 1.0 0.0; 116 aspect: (112/24) (112/24); aspect_preference: HORIZONTAL; 117 align: 0.5 0.0; 118 image.normal: "bat_top0.png"; 119 } 120 } 121 part { name: "bottom"; 122 clip_to: "pulse_clip"; 123 description { state: "default" 0.0; 124 rel1.to: "base"; 125 rel1.offset: 6 -5; 126 rel2.to: "base"; 127 rel2.offset: -7 -5; 128 aspect: (112/12) (112/12); aspect_preference: HORIZONTAL; 129 align: 0.5 1.0; 130 image.normal: "bat_bottom0.png"; 131 } 132 } 133 part { name: "fill"; mouse_events: 0; 134 clip_to: "pulse_clip"; 135 description { state: "default" 0.0; 136 rel1.to: "fill_region"; 137 rel1.offset: -5 -5; 138 rel2.to: "fill_region"; 139 rel2.offset: 4 4; 140 image.normal: "glow_med_white.png"; 141 image.border: 10 10 10 10; 142 color: 51 153 255 255; 143 } 144 } 145 part { name: "top-shine"; 146 clip_to: "pulse_clip"; 147 description { state: "default" 0.0; 148 rel1.to: "top"; 149 rel2.to: "top"; 150 image.normal: "bat_top1.png"; 151 } 152 } 153 part { name: "bottom-shine"; 154 clip_to: "pulse_clip"; 155 description { state: "default" 0.0; 156 rel1.to: "bottom"; 157 rel2.to: "bottom"; 158 image.normal: "bat_bottom1.png"; 159 } 160 } 161 part { name: "shine"; 162 clip_to: "pulse_clip"; 163 description { state: "default" 0.0; 164 rel1.to: "bg"; 165 rel1.offset: 0 -6; 166 rel2.to: "bg"; 167 rel2.offset: -1 5; 168 image.normal: "bat_shine.png"; 169 image.border: 0 0 7 7; 170 } 171 } 172 part { name: "pwr1"; 173 clip_to: "pulse_clip"; 174 description { state: "default" 0.0; 175 rel1.to: "pwr"; 176 rel1.relative: (2/5) 0.0; 177 rel1.offset: -5 -5; 178 rel2.to: "pwr"; 179 rel2.relative: (3/5) 1.0; 180 rel2.offset: 4 4; 181 image.normal: "glow_med_white.png"; 182 image.border: 5 5 5 5; 183 fill.smooth: 0; 184 visible: 0; 185 } 186 description { state: "visible" 0.0; 187 inherit: "default" 0.0; 188 visible: 1; 189 } 190 } 191 part { name: "pwr2"; 192 clip_to: "pulse_clip"; 193 description { state: "default" 0.0; 194 rel1.to: "pwr"; 195 rel1.relative: 0.0 (2/5); 196 rel1.offset: -5 -5; 197 rel2.to: "pwr"; 198 rel2.relative: 1.0 (3/5); 199 rel2.offset: 4 4; 200 image.normal: "glow_med_white.png"; 201 image.border: 5 5 5 5; 202 fill.smooth: 0; 203 visible: 0; 204 } 205 description { state: "visible" 0.0; 206 inherit: "default" 0.0; 207 visible: 1; 208 } 209 } 210 part { name: "e.text.reading"; type: TEXT; mouse_events: 0; 211 scale: 1; 212 clip_to: "info_clip"; 213 description { state: "default" 0.0; 214 align: 0.5 0.0; 215 rel1.to: "bg"; 216 rel1.offset: 0 -2; 217 rel2.relative: 1.0 0.0; 218 rel2.to_x: "bg"; 219 rel2.to_y: "pwr"; 220 rel2.offset: -1 2; 221 color_class: "module_label_plain"; 222 color3: 255 255 255 255; 223 text { font: "Sans"; 224 fit: 1 1; 225 ellipsis: -1; 226 align: 0.5 0.5; 227 text_class: "module_small"; 228 } 229 } 230 } 231 part { name: "e.text.time"; type: TEXT; mouse_events: 0; 232 scale: 1; 233 clip_to: "info_clip"; 234 description { state: "default" 0.0; 235 align: 0.5 1.0; 236 rel1.relative: 0.0 1.0; 237 rel1.offset: 0 -2; 238 rel1.to_x: "bg"; 239 rel1.to_y: "pwr"; 240 rel2.offset: -1 1; 241 rel2.to: "bg"; 242 color_class: "module_label_plain"; 243 color3: 255 255 255 255; 244 text { font: "Sans"; 245 fit: 1 1; 246 ellipsis: -1; 247 align: 0.5 0.5; 248 text_class: "module_small"; 249 } 250 } 251 } 252 part { name: "over"; type: RECT; 253 description { state: "default" 0.0; 254 color: 0 0 0 0; 255 } 256 } 257 } 258 programs { 259 program { 260 signal: "mouse,in"; source: "over"; 261 action: STATE_SET "visible" 0.0; 262 transition: LINEAR 0.3; 263 target: "info_clip"; 264 } 265 program { 266 signal: "mouse,out"; source: "over"; 267 action: STATE_SET "default" 0.0; 268 transition: LINEAR 0.3; 269 target: "info_clip"; 270 } 271 program { 272 signal: "e,state,charging"; source: "e"; 273 action: STATE_SET "visible" 0.0; 274 target: "pwr1"; 275 target: "pwr2"; 276 } 277 program { 278 signal: "e,state,discharging"; source: "e"; 279 action: STATE_SET "default" 0.0; 280 target: "pwr1"; 281 target: "pwr2"; 282 } 283 program { 284 signal: "e,state,unknown"; source: "e"; 285 action: STATE_SET "faded" 0.0; 286 target: "fade_clip"; 287 } 288 program { name: "pulse"; 289 signal: "e,action,pulse,start"; source: "e"; 290 action: STATE_SET "faded" 0.0; 291 transition: ACCELERATE 0.3; 292 after: "pulse2"; 293 target: "pulse_clip"; 294 } 295 program { name: "pulse2"; 296 action: STATE_SET "faded" 1.0; transition: ACCELERATE 0.1; 297 target: "pulse_clip"; 298 } 299 program { 300 signal: "e,action,pulse,stop"; source: "e"; 301 action: STATE_SET "default" 0.0; 302 target: "pulse_clip"; 303 } 304 } 305} 306 307group { name: "e/modules/battery/popup"; 308 min: 240 60; 309 parts { 310 part { name: "e.swallow.battery"; type: SWALLOW; 311 description { state: "default" 0.0; 312 aspect: 1.0 1.0; aspect_preference: VERTICAL; 313 min: 1 1; 314 max: 160 160; 315 align: 0.0 0.5; 316 } 317 } 318 part { name: "e.text.title"; type: TEXT; 319 effect: SHADOW BOTTOM; 320 scale: 1; 321 description { state: "default" 0.0; 322 rel1.relative: 1.0 0.0; 323 rel1.to_x: "e.swallow.battery"; 324 rel2.relative: 1.0 0.5; 325 color: FN_COL_DEFAULT; 326 text { font: "Sans:style=Bold"; size: 10; 327 text: "Your battery is low!"; 328 min: 1 1; 329 ellipsis: -1; 330 text_class: "module_large"; 331 } 332 } 333 } 334 part { name: "e.text.label"; type: TEXT; 335 effect: SHADOW BOTTOM; 336 scale: 1; 337 description { state: "default" 0.0; 338 rel1.relative: 1.0 0.5; 339 rel1.to_x: "e.swallow.battery"; 340 color: FN_COL_DEFAULT; 341 text { font: "Sans"; size: 10; 342 text: "AC power is recommended."; 343 min: 1 1; 344 ellipsis: -1; 345 text_class: "module_normal"; 346 } 347 } 348 } 349 } 350} 351