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
|
/*---------------------------------------------------
-----------------------------------------------------
Filename: mute.m
Version: 1.1
Type: maki
Date: 13. Jun. 2007 - 12:39
Author: Martin Poehlmann aka Deimos
E-Mail: martin@skinconsortium.com
Internet: www.skinconsortium.com
www.martin.deimos.de.vu
Note: This script is based on mute.m
from Winamp Modern
-----------------------------------------------------
---------------------------------------------------*/
#include <lib/std.mi>
#define GLOW_OBJECT MuteButton
#include <lib/com/glow.m>
Class Button GlowButton;
Global int VOLUME_FILL_MAX_W;
Global Group frameGroup;
Global Button MuteBtn, DeMuteBtn;
Global GuiObject SongTicker;
Global Float VolumeLevel;
Global Boolean Muted,BtnPressed;
Global GuiObject fill;
Global GuiObject muteActive;
Global Int muteActive_Y;
Global Boolean demuteDown;
Global Boolean isShade;
System.onScriptLoaded()
{
frameGroup = system.getScriptGroup();
isShade = (frameGroup.getParentlayout().getID() == "shade");
MuteBtn = frameGroup.findObject("mute");
DeMuteBtn = frameGroup.findObject("etum");
fill = frameGroup.findObject("player.volume.fill");
muteActive = frameGroup.findObject("mute.active");
SongTicker = frameGroup.findObject("songticker");
if (!isShade) muteActive_Y = muteActive.getGuiY();
if (!isShade) _MuteButton_GlowInit (MuteBtn, frameGroup.findObject("mute.glow"), 0.3);
if (!isShade) _MuteButton_addTrigger (DeMuteBtn);
Muted = getPrivateInt("winamp5", "muted", 0);
VolumeLevel = getPrivateInt("winamp5", "old_volume", 0);
VOLUME_FILL_MAX_W = stringToInteger(getParam());
fill.setXmlParam("w", integerToString(VOLUME_FILL_MAX_W*getVolume()/255));
if (Muted)
{
SongTicker.sendAction("showinfo", "Mute ON", 0, 0, 0, 0);
MuteBtn.hide();
DeMuteBtn.show();
if (!isShade) muteActive.show();
}
else
{
MuteBtn.show();
DeMuteBtn.hide();
if (!isShade) muteActive.hide();
}
BtnPressed = 0;
}
System.onScriptUnloading()
{
setPrivateInt("winamp5", "muted", Muted);
setPrivateInt("winamp5", "old_volume", VolumeLevel);
}
MuteBtn.onLeftClick()
{
BtnPressed = 1;
VolumeLevel = System.getVolume();
System.setVolume(0);
Muted = 1;
DeMuteBtn.show();
MuteBtn.hide();
if (!isShade) muteActive.show();
}
MuteBtn.onLeftButtonDown (int x, int y)
{
SongTicker.sendAction("showinfo", "Mute: Off", 0, 0, 0, 0);
}
DeMuteBtn.onLeftButtonDown (int x, int y)
{
SongTicker.sendAction("showinfo", "Mute: On", 0, 0, 0, 0);
if (!isShade) demuteDown = 1;
if (!isShade) muteActive.setXmlParam("y", integerToString(muteActive_Y+1));
}
MuteBtn.onLeftButtonUp (int x, int y)
{
if (Muted) SongTicker.sendAction("showinfo", "Mute: On", 0, 0, 0, 0);
}
DeMuteBtn.onLeftButtonUp (int x, int y)
{
if (!Muted) SongTicker.sendAction("showinfo", "Mute: Off", 0, 0, 0, 0);
if (!isShade) demuteDown = 0;
if (!isShade) muteActive.setXmlParam("y", integerToString(muteActive_Y));
}
DeMuteBtn.onLeftClick()
{
BtnPressed = 1;
System.setVolume(VolumeLevel);
Muted = 0;
DeMuteBtn.hide();
MuteBtn.show();
if (!isShade) muteActive.hide();
}
DeMuteBtn.onleaveArea ()
{
if (!isShade) muteActive.setXmlParam("y", integerToString(muteActive_Y));
}
DeMuteBtn.onEnterArea ()
{
if (!isShade && demuteDown) muteActive.setXmlParam("y", integerToString(muteActive_Y+1));
}
System.onvolumechanged(int newvol)
{
fill.setXmlParam("w", integerToString(VOLUME_FILL_MAX_W*getVolume()/255));
if (!BtnPressed)
{
SongTicker.sendAction
(
"showinfo",
translate("Volume") + ": " + integerToString(newvol/2.55) + "%",
0, 0, 0, 0
);
if (Muted)
{
Muted = 0;
MuteBtn.show();
DeMuteBtn.hide();
if (!isShade) muteActive.hide();
}
}
BtnPressed = 0;
}
|