seekshade.m 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #include <lib/std.mi>
  2. Global Group frameGroup;
  3. Class Slider Seeker;
  4. Global Seeker Seeker1, Seeker2;
  5. Global Int Seeking;
  6. Global Timer SongTickerTimer;
  7. Global GuiObject SongTicker;
  8. Global Text InfoTicker;
  9. System.onScriptLoaded() {
  10. frameGroup = getScriptGroup();
  11. Seeker1 = frameGroup.findObject("shadeSeekerGhost");
  12. Seeker2 = frameGroup.findObject("shadeSeekerGhost2");
  13. SongTicker = frameGroup.findObject("SongtickerShade");
  14. InfoTicker = frameGroup.findObject("infotickerShade");
  15. SongTickerTimer = new Timer;
  16. SongTickerTimer.setDelay(1000);
  17. }
  18. SongTickerTimer.onTimer() {
  19. SongTicker.show();
  20. InfoTicker.hide();
  21. SongTickerTimer.stop();
  22. }
  23. System.onScriptUnloading() {
  24. delete SongTickerTimer;
  25. }
  26. Seeker.onSetPosition(int p) {
  27. if (seeking) {
  28. Float f;
  29. f = p;
  30. f = f / 255 * 100;
  31. Float len = getPlayItemLength();
  32. if (len != 0) {
  33. int np = len * f / 100;
  34. SongTickerTimer.start();
  35. SongTicker.hide();
  36. InfoTicker.show();
  37. InfoTicker.setText(translate("Seek") + ":" + integerToTime(np) + "/" + integerToTime(len) + " (" + integerToString(f) + "%) ");
  38. }
  39. }
  40. }
  41. Seeker.onLeftButtonDown(int x, int y) {
  42. seeking = 1;
  43. }
  44. Seeker.onLeftButtonUp(int x, int y) {
  45. seeking = 0;
  46. SongTickerTimer.start();
  47. SongTicker.show();
  48. InfoTicker.hide();
  49. }
  50. Seeker.onSetFinalPosition(int p) {
  51. SongTickerTimer.start();
  52. SongTicker.show();
  53. InfoTicker.hide();
  54. }