1
0

shadecontrol.m 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. #include <lib/std.mi>
  2. #include "attribs.m"
  3. function setObjects(int w);
  4. function setSongtickerScrolling();
  5. Global Group frameGroup, gX1,gX2,gX3,display,display2,displaytimer,displayticker,displayvis;
  6. Global Button btnExpand,btnReduce,shadeeq;
  7. Global Layout main;
  8. Global Layout main_normal;
  9. Global Layer volumebar;
  10. Global Timer SongTickerTimer;
  11. Global GuiObject SongTicker;
  12. Global text InfoTicker;
  13. Global Button colorthemes;
  14. System.onScriptLoaded() {
  15. initAttribs();
  16. frameGroup = getScriptGroup();
  17. main = frameGroup.getParentLayout();
  18. main_normal = frameGroup.getParentLayout().getContainer().getLayout("normal");
  19. gX1 = frameGroup.findObject("shadeX1");
  20. gX2 = frameGroup.findObject("shadeX2");
  21. gX3 = frameGroup.findObject("shadeX3");
  22. shadeeq = frameGroup.findObject("shadeeq");
  23. display = frameGroup.findObject("shadedisplay");
  24. display2 = frameGroup.findObject("shadedisplay2");
  25. displaytimer = frameGroup.findObject("shadetimer");
  26. displayticker = frameGroup.findObject("shadeticker");
  27. displayvis = frameGroup.findObject("shadevis");
  28. btnExpand = frameGroup.findObject("shade.expand");
  29. btnReduce = frameGroup.findObject("shade.reduce");
  30. colorthemes = frameGroup.findObject("shadect");
  31. SongTicker = frameGroup.findObject("SongtickerShade");
  32. InfoTicker = frameGroup.findObject("infotickerShade");
  33. SongTickerTimer = new Timer;
  34. SongTickerTimer.setDelay(1000);
  35. volumebar = frameGroup.findObject("volumebarShade");
  36. volumebar.setXmlParam("w",integertostring( (system.getVolume()/255) *40 + 5));
  37. setSongtickerScrolling();
  38. }
  39. System.onScriptUnloading() {
  40. delete SongTickerTimer;
  41. }
  42. SongTickerTimer.onTimer() {
  43. SongTicker.show();
  44. InfoTicker.hide();
  45. SongTickerTimer.stop();
  46. }
  47. frameGroup.onResize(int x, int y, int w, int h) {
  48. setObjects(w);
  49. }
  50. shadeeq.onLeftClick() {
  51. eq_visible_attrib.setData("1");
  52. }
  53. setObjects(int w) {
  54. int ShowButtons=getPrivateInt("winamp5", "ShowShadeButtons", 0);
  55. if (ShowButtons) {
  56. btnExpand.show();
  57. btnReduce.hide();
  58. } else {
  59. btnExpand.hide();
  60. btnReduce.show();
  61. }
  62. gX1.hide();
  63. gX2.hide();
  64. gX3.hide();
  65. display.hide();
  66. display2.hide();
  67. displaytimer.hide();
  68. displayticker.hide();
  69. displayvis.hide();
  70. if (w>413) {
  71. int w_display=w-356;
  72. display.setXMLParam("w", integertostring(w_display));
  73. display.show();
  74. displaytimer.show();
  75. if (w>433) {
  76. displayticker.show();
  77. displayticker.setXMLParam("w", integertostring(w_display-13));
  78. if (w>573) {
  79. display.hide();
  80. display2.setXMLParam("w", integertostring(w_display-45));
  81. display2.show();
  82. displayticker.setXMLParam("w", integertostring(w_display-56-13));
  83. if (ShowButtons) {
  84. gX1.setXMLParam("x", "-100");
  85. gX1.show();
  86. if (w>596) {
  87. display2.setXMLParam("w", integertostring(w_display-68));
  88. displayticker.setXMLParam("w", integertostring(w_display-79-13));
  89. gX1.setXMLParam("x", "-123");
  90. gX2.setXMLParam("x", "-80");
  91. gX2.show();
  92. if (w>655) {
  93. display2.setXMLParam("w", integertostring(w_display-127));
  94. displayticker.setXMLParam("w", integertostring(w_display-138-13));
  95. gX1.setXMLParam("x", "-182");
  96. gX2.setXMLParam("x", "-139");
  97. gX3.setXMLParam("x", "-116");
  98. gX3.show();
  99. if (w>673) {
  100. displayvis.setXMLParam("x", integertostring(-257));
  101. displayvis.show();
  102. displayticker.setXMLParam("w", integertostring(w_display-194-13));
  103. }
  104. }
  105. }
  106. } else {
  107. display2.setXMLParam("w", integertostring(w_display));
  108. displayvis.setXMLParam("x", integertostring(-130));
  109. displayvis.show();
  110. displayticker.setXMLParam("w", integertostring(w_display-66-13));
  111. }
  112. }
  113. }
  114. }
  115. }
  116. System.onKeyDown(String key) {
  117. if (StrLeft(key,4) == "ctrl" && StrSearch(key, "+w") != -1 && (main.isActive() || main_normal.isActive())) {
  118. if (main.isVisible())
  119. main.getContainer().switchToLayout("normal");
  120. else
  121. main.getContainer().switchToLayout("shade");
  122. complete;
  123. }
  124. }
  125. btnExpand.onleftClick() {
  126. setPrivateInt("winamp5", "ShowShadeButtons", 0);
  127. setObjects(main.getGUIw());
  128. }
  129. btnReduce.onleftClick() {
  130. setPrivateInt("winamp5", "ShowShadeButtons", 1);
  131. setObjects(main.getGUIw());
  132. }
  133. System.onvolumechanged(int newvol)
  134. {
  135. volumebar.setXmlParam("w",integertostring( (newvol/255) *40 + 5));
  136. SongTickerTimer.start();
  137. SongTicker.hide();
  138. InfoTicker.show();
  139. InfoTicker.setText(translate("Volume") + ": " + integerToString(newvol/2.55) + "%");
  140. }
  141. songticker_scrolling_attrib.onDataChanged() {
  142. setSongtickerScrolling();
  143. }
  144. setSongtickerScrolling() {
  145. if (songticker_scrolling_modern_attrib.getData()=="1") {
  146. SongTicker.setXMLParam("ticker","bounce");
  147. } else if (songticker_scrolling_classic_attrib.getData()=="1") {
  148. SongTicker.setXMLParam("ticker","scroll");
  149. } else {
  150. SongTicker.setXMLParam("ticker","off");
  151. }
  152. }
  153. colorthemes.onRightButtonDown(int x, int y) {
  154. triggerAction(colorthemes, "ThemesSlotsMenu", "");
  155. complete;
  156. }