aboutsummaryrefslogtreecommitdiff
path: root/Src/resources/skins/Winamp Modern/scripts/pltime.m
blob: 0f1ad50d38740d1cc5395a86c972d769d5558e09 (plain) (blame)
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
#include <lib/std.mi>
#include "attribs.m"

Global Layer TimeBG,TimeDisplay;
Global Text PLTime;
Global Group frameGroup;
Global GuiObject SongTicker;
Global Timer callback;

function setSongtickerScrolling();

System.onScriptLoaded() {
	initAttribs();
	frameGroup = getScriptGroup();
	TimeBG = frameGroup.findobject("player.pl.time.left");
	TimeDisplay = frameGroup.findobject("player.pl.time.display.left");
	PLTime = frameGroup.findobject("PLTime");
	callback = new Timer; callback.setDelay(1); callback.start();
}

callback.onTimer() {
	Container c = getContainer("pledit");
	if (c) {
		Layout l = c.getLayout("shade");
		if (l) {
			SongTicker = l.findObject("PESongticker");
		}
	}
	if (SongTicker) callback.stop();
	setSongtickerScrolling();
}

frameGroup.onResize(int x, int y, int w, int h) {
	if (w>394) {
		TimeBG.show();
		TimeDisplay.show();
		PLTime.setXMLParam("x","-215");
		PLTime.setXMLParam("w","90");
	} else {
		TimeBG.hide();
		TimeDisplay.hide();
		PLTime.setXMLParam("x","-180");
		PLTime.setXMLParam("w","55");
	}
}

songticker_scrolling_attrib.onDataChanged() {
	setSongtickerScrolling();
}

setSongtickerScrolling() {
	if (!Songticker)
		return;
	
	if (songticker_scrolling_modern_attrib.getData()=="1") {
		SongTicker.setXMLParam("ticker","bounce");
	} else if (songticker_scrolling_classic_attrib.getData()=="1") {
		SongTicker.setXMLParam("ticker","scroll");
	} else {
		SongTicker.setXMLParam("ticker","off");
	}
}