123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- #include <lib/std.mi>
- #include "attribs.m"
- Global Group frameGroup;
- Global Togglebutton ShuffleBtn,RepeatBtn,ShuffleBtn2,RepeatBtn2;
- Global Timer SongTickerTimer;
- Global Text InfoTicker;
- Global GuiObject SongTicker;
- Global Slider Balance;
- Global Layout normal;
- function setSongtickerScrolling();
- System.onScriptLoaded() {
- initAttribs();
- frameGroup = getScriptGroup();
- SongTicker = frameGroup.findObject("songticker");
- InfoTicker = frameGroup.findObject("infoticker");
- normal = frameGroup.getParentLayout();
- SongTickerTimer = new Timer;
- SongTickerTimer.setDelay(1000);
- RepeatBtn = frameGroup.findObject("Repeat");
- ShuffleBtn = frameGroup.findObject("Shuffle");
- RepeatBtn2 = frameGroup.findObject("RepeatDisplay");
- ShuffleBtn2 = frameGroup.findObject("ShuffleDisplay");
- Balance = frameGroup.findObject("Balance");
- setSongtickerScrolling();
- }
- normal.onAction (String action, String param, Int x, int y, int p1, int p2, GuiObject source)
- {
- if (strlower(action) == "showinfo")
- {
- SongTicker.hide();
- SongTickerTimer.start();
- InfoTicker.setText(param);
- InfoTicker.show();
- }
- else if (strlower(action) == "cancelinfo")
- {
- SongTickerTimer.onTimer ();
- }
- }
- SongTickerTimer.onTimer() {
- SongTicker.show();
- InfoTicker.hide();
- SongTickerTimer.stop();
- }
- System.onScriptUnloading() {
- delete SongTickerTimer;
- }
- Balance.onSetPosition(int newpos)
- {
- string t=translate("Balance")+":";
- if (newpos==127) t+= " " + translate("Center");
- if (newpos<127) t += " " + integerToString((100-(newpos/127)*100))+"% "+translate("Left");
- if (newpos>127) t += " " + integerToString(((newpos-127)/127)*100)+"% "+translate("Right");
- SongTickerTimer.start();
- SongTicker.hide();
- InfoTicker.show();
- InfoTicker.setText(t);
- }
- RepeatBtn.onToggle(boolean on) {
- SongTickerTimer.start();
- int v = getCurCfgVal();
- SongTicker.hide();
- InfoTicker.show();
- if (v == 0) InfoTicker.setText("Repeat: OFF");
- else if (v > 0) InfoTicker.setText("Repeat: ALL");
- else if (v < 0) InfoTicker.setText("Repeat: TRACK");
- }
- ShuffleBtn.onToggle(boolean on) {
- SongTickerTimer.start();
- SongTicker.hide();
- InfoTicker.show();
- if (on) InfoTicker.setText("Playlist Shuffling: ON"); else InfoTicker.setText("Playlist Shuffling: OFF");
- }
- RepeatBtn2.onToggle(boolean on) {
- SongTickerTimer.start();
- int v = getCurCfgVal();
- SongTicker.hide();
- InfoTicker.show();
- if (v == 0) InfoTicker.setText("Repeat: OFF");
- else if (v > 0) InfoTicker.setText("Repeat: ALL");
- else if (v < 0) InfoTicker.setText("Repeat: TRACK");
- }
- ShuffleBtn2.onToggle(boolean on) {
- SongTickerTimer.start();
- SongTicker.hide();
- InfoTicker.show();
- if (on) InfoTicker.setText("Playlist Shuffling: ON"); else InfoTicker.setText("Playlist Shuffling: OFF");
- }
- songticker_scrolling_attrib.onDataChanged() {
- setSongtickerScrolling();
- }
- setSongtickerScrolling() {
- 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");
- }
- }
|