pltime.m 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #include <lib/std.mi>
  2. #include "attribs.m"
  3. Global Layer TimeBG,TimeDisplay;
  4. Global Text PLTime;
  5. Global Group frameGroup;
  6. Global GuiObject SongTicker;
  7. Global Timer callback;
  8. function setSongtickerScrolling();
  9. System.onScriptLoaded() {
  10. initAttribs();
  11. frameGroup = getScriptGroup();
  12. TimeBG = frameGroup.findobject("player.pl.time.left");
  13. TimeDisplay = frameGroup.findobject("player.pl.time.display.left");
  14. PLTime = frameGroup.findobject("PLTime");
  15. callback = new Timer; callback.setDelay(1); callback.start();
  16. }
  17. callback.onTimer() {
  18. Container c = getContainer("pledit");
  19. if (c) {
  20. Layout l = c.getLayout("shade");
  21. if (l) {
  22. SongTicker = l.findObject("PESongticker");
  23. }
  24. }
  25. if (SongTicker) callback.stop();
  26. setSongtickerScrolling();
  27. }
  28. frameGroup.onResize(int x, int y, int w, int h) {
  29. if (w>394) {
  30. TimeBG.show();
  31. TimeDisplay.show();
  32. PLTime.setXMLParam("x","-215");
  33. PLTime.setXMLParam("w","90");
  34. } else {
  35. TimeBG.hide();
  36. TimeDisplay.hide();
  37. PLTime.setXMLParam("x","-180");
  38. PLTime.setXMLParam("w","55");
  39. }
  40. }
  41. songticker_scrolling_attrib.onDataChanged() {
  42. setSongtickerScrolling();
  43. }
  44. setSongtickerScrolling() {
  45. if (!Songticker)
  46. return;
  47. if (songticker_scrolling_modern_attrib.getData()=="1") {
  48. SongTicker.setXMLParam("ticker","bounce");
  49. } else if (songticker_scrolling_classic_attrib.getData()=="1") {
  50. SongTicker.setXMLParam("ticker","scroll");
  51. } else {
  52. SongTicker.setXMLParam("ticker","off");
  53. }
  54. }