123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- /*---------------------------------------------------
- -----------------------------------------------------
- Filename: songticker.m
- Version: 1.0
- Type: maki
- Date: 18. Nov. 2006 - 16:08
- Author: Martin Poehlmann aka Deimos
- E-Mail: [email protected]
- Internet: www.skinconsortium.com
- www.martin.deimos.de.vu
- -----------------------------------------------------
- ---------------------------------------------------*/
- #include <lib/std.mi>
- #include attribs/init_songticker.m
- Function setTextW();
- Function updateTickerScrolling();
- Global Timer SongTickerTimer;
- Global GuiObject SongTicker;
- Global Text SongTime, InfoDisplay;
- Global int SongTicker_x, SongTicker_w, total_w;
- Global int SongTime_x, SongTime_w, offset_x;
- Global Boolean isShade, byPassTimer;
- System.onScriptLoaded ()
- {
- initAttribs_Songticker();
- group sg = getScriptGroup();
- if (sg.getParentLayout().getID() == "shade") isShade = TRUE;
- SongTicker = sg.findObject("songticker");
- InfoDisplay = sg.findObject("InfoDisplay");
- SongTickerTimer = new Timer;
- SongTickerTimer.setDelay(666);
- SongTime = sg.findObject("SongTime");
- SongTicker_x = SongTicker.getGuiX();
- SongTicker_w = SongTicker.getGuiW();
- total_w = SongTicker_x + SongTicker_w;
- SongTime_x = SongTime.getGuiX();
- SongTime_w = SongTime.getTextWidth();
- offset_x = stringToInteger(getParam());
- setTextW();
- updateTickerScrolling();
- }
- System.onScriptUnloading ()
- {
- SongTickerTimer.stop();
- delete SongTickerTimer;
- }
- SongTicker.onAction (String action, String param, Int x, int y, int p1, int p2, GuiObject source)
- {
- if (strlower(action) == "showinfo")
- {
- InfoDisplay.cancelTarget();
- Songticker.cancelTarget();
- SongTickerTimer.stop();
- SongTickerTimer.start();
- InfoDisplay.setText(param);
- InfoDisplay.setAlpha(255);
- SongTicker.setAlpha(0);
- }
- else if (strlower(action) == "cancelinfo")
- {
- SongTickerTimer.onTimer ();
- }
- else if (strlower(action) == "setguix")
- {
- byPassTimer = TRUE;
- SongTicker_X = x;
- SongTicker_W = total_w - SongTicker_X;
- SongTicker.setXmlParam("x", integerToString(SongTicker_X));
- InfoDisplay.setXmlParam("x", integerToString(SongTicker_X));
- SongTicker.setXmlParam("w", integerToString(SongTicker_W));
- InfoDisplay.setXmlParam("w", integerToString(SongTicker_W));
- }
- else if (strlower(action) == "restoreguix")
- {
- byPassTimer = FALSE;
- setTextW ();
- }
- }
- SongTickerTimer.onTimer ()
- {
- SongTickerTimer.stop();
- InfoDisplay.cancelTarget();
- InfoDisplay.setTargetA(0);
- InfoDisplay.setTargetSpeed(0.3);
- InfoDisplay.gotoTarget();
- }
- InfoDisplay.onTargetReached ()
- {
- if (InfoDisplay.getAlpha() == 0)
- {
- setTextW ();
- Songticker.cancelTarget();
- Songticker.setTargetA(255);
- Songticker.setTargetX(Songticker.getGuiX());
- Songticker.setTargetW(Songticker.getGuiW());
- Songticker.setTargetSpeed(0.3);
- Songticker.gotoTarget();
- }
- }
- /* Changing TickerScrolling via Config Attrib */
- ScrollingAttribute.onDataChanged ()
- {
- setTextW ();
- updateTickerScrolling();
- }
- updateTickerScrolling ()
- {
- if (Songticker == NULL)
- {
- return;
- }
- if (songticker_scrolling_disabled_attrib.getData() == "1") SongTicker.setXMLParam("ticker", "off");
- if (songticker_style_modern_attrib.getData() == "1") SongTicker.setXMLParam("ticker", "bounce");
- if (songticker_style_old_attrib.getData() == "1") SongTicker.setXMLParam("ticker", "scroll");
- }
- /* set Songticker Position */
- setTextW ()
- {
- if (byPassTimer) return;
- if (Songticker == NULL || InfoDisplay == NULL)
- {
- return;
- }
- SongTicker_X = SongTime_X + SongTime_w + offset_x;
- SongTicker_W = total_w - SongTicker_X;
- /*if (!isShade)
- {
- if (SongTime_w > 89)
- {
- SongTime.setXmlParam("x", "0");
- SongTicker_X = SongTime_X + SongTime_w + offset_x - 11;
- SongTicker_W = total_w - SongTicker_X + 11;
- }
- else
- {
- SongTime.setXmlParam("x", "10");
- }
- }*/
- // debugString(system.getScriptGroup().getParentLayout().getID() + " -- x: " + integerToString(SongTicker_X) + " -- w: " + integerToString(SongTicker_W), 9);
- Songticker.setXmlParam("x", integerToString(SongTicker_X));
- Songticker.setXmlParam("w", integerToString(SongTicker_W));
- InfoDisplay.setXmlParam("x", integerToString(SongTicker_X));
- InfoDisplay.setXmlParam("w", integerToString(SongTicker_W));
- }
- SongTime.onTextChanged (String newtxt)
- {
- int temp_w = SongTime.getTextWidth();
- if (SongTime_w == temp_w) return;
- SongTime_w = temp_w;
- setTextW ();
- }
- songticker.onTargetReached ()
- {
- setTextW ();
- }
|