1
0

display.m 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #include <lib/std.mi>
  2. #include "attribs.m"
  3. Global Group frameGroup;
  4. Global Togglebutton ShuffleBtn,RepeatBtn,ShuffleBtn2,RepeatBtn2;
  5. Global Timer SongTickerTimer;
  6. Global Text InfoTicker;
  7. Global GuiObject SongTicker;
  8. Global Slider Balance;
  9. Global Layout normal;
  10. function setSongtickerScrolling();
  11. System.onScriptLoaded() {
  12. initAttribs();
  13. frameGroup = getScriptGroup();
  14. SongTicker = frameGroup.findObject("songticker");
  15. InfoTicker = frameGroup.findObject("infoticker");
  16. normal = frameGroup.getParentLayout();
  17. SongTickerTimer = new Timer;
  18. SongTickerTimer.setDelay(1000);
  19. RepeatBtn = frameGroup.findObject("Repeat");
  20. ShuffleBtn = frameGroup.findObject("Shuffle");
  21. RepeatBtn2 = frameGroup.findObject("RepeatDisplay");
  22. ShuffleBtn2 = frameGroup.findObject("ShuffleDisplay");
  23. Balance = frameGroup.findObject("Balance");
  24. setSongtickerScrolling();
  25. }
  26. normal.onAction (String action, String param, Int x, int y, int p1, int p2, GuiObject source)
  27. {
  28. if (strlower(action) == "showinfo")
  29. {
  30. SongTicker.hide();
  31. SongTickerTimer.start();
  32. InfoTicker.setText(param);
  33. InfoTicker.show();
  34. }
  35. else if (strlower(action) == "cancelinfo")
  36. {
  37. SongTickerTimer.onTimer ();
  38. }
  39. }
  40. SongTickerTimer.onTimer() {
  41. SongTicker.show();
  42. InfoTicker.hide();
  43. SongTickerTimer.stop();
  44. }
  45. System.onScriptUnloading() {
  46. delete SongTickerTimer;
  47. }
  48. Balance.onSetPosition(int newpos)
  49. {
  50. string t=translate("Balance")+":";
  51. if (newpos==127) t+= " " + translate("Center");
  52. if (newpos<127) t += " " + integerToString((100-(newpos/127)*100))+"% "+translate("Left");
  53. if (newpos>127) t += " " + integerToString(((newpos-127)/127)*100)+"% "+translate("Right");
  54. SongTickerTimer.start();
  55. SongTicker.hide();
  56. InfoTicker.show();
  57. InfoTicker.setText(t);
  58. }
  59. RepeatBtn.onToggle(boolean on) {
  60. SongTickerTimer.start();
  61. int v = getCurCfgVal();
  62. SongTicker.hide();
  63. InfoTicker.show();
  64. if (v == 0) InfoTicker.setText("Repeat: OFF");
  65. else if (v > 0) InfoTicker.setText("Repeat: ALL");
  66. else if (v < 0) InfoTicker.setText("Repeat: TRACK");
  67. }
  68. ShuffleBtn.onToggle(boolean on) {
  69. SongTickerTimer.start();
  70. SongTicker.hide();
  71. InfoTicker.show();
  72. if (on) InfoTicker.setText("Playlist Shuffling: ON"); else InfoTicker.setText("Playlist Shuffling: OFF");
  73. }
  74. RepeatBtn2.onToggle(boolean on) {
  75. SongTickerTimer.start();
  76. int v = getCurCfgVal();
  77. SongTicker.hide();
  78. InfoTicker.show();
  79. if (v == 0) InfoTicker.setText("Repeat: OFF");
  80. else if (v > 0) InfoTicker.setText("Repeat: ALL");
  81. else if (v < 0) InfoTicker.setText("Repeat: TRACK");
  82. }
  83. ShuffleBtn2.onToggle(boolean on) {
  84. SongTickerTimer.start();
  85. SongTicker.hide();
  86. InfoTicker.show();
  87. if (on) InfoTicker.setText("Playlist Shuffling: ON"); else InfoTicker.setText("Playlist Shuffling: OFF");
  88. }
  89. songticker_scrolling_attrib.onDataChanged() {
  90. setSongtickerScrolling();
  91. }
  92. setSongtickerScrolling() {
  93. if (songticker_scrolling_modern_attrib.getData()=="1") {
  94. SongTicker.setXMLParam("ticker","bounce");
  95. }
  96. else if (songticker_scrolling_classic_attrib.getData()=="1") {
  97. SongTicker.setXMLParam("ticker","scroll");
  98. }
  99. else {
  100. SongTicker.setXMLParam("ticker","off");
  101. }
  102. }