1
0

albumart.m 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #include <lib/std.mi>
  2. #include "attribs.m"
  3. Global AlbumArtLayer waaa;
  4. Global Layout aalayout;
  5. System.onScriptLoaded()
  6. {
  7. initAttribs();
  8. Container albumart = System.getContainer("winamp.albumart");
  9. aalayout = albumart.getLayout("normal");
  10. waaa = getScriptGroup().findObject(getParam());
  11. }
  12. system.onScriptUnloading ()
  13. {
  14. if (!aalayout) return;
  15. setPrivateInt("Winamp Modern", "Album Art XPos", aalayout.getLeft());
  16. setPrivateInt("Winamp Modern", "Album Art YPos", aalayout.getTop());
  17. }
  18. aalayout.onStartup ()
  19. {
  20. resize(getPrivateInt("Winamp Modern", "Album Art XPos", 0), getPrivateInt("Winamp Modern", "Album Art YPos", 0), getWidth(), getHeight());
  21. }
  22. aalayout.onSetVisible (Boolean onoff)
  23. {
  24. if (!onoff)
  25. {
  26. albumart_visible_attrib.setData("0");
  27. }
  28. else
  29. {
  30. albumart_visible_attrib.setData("1");
  31. }
  32. }
  33. albumart_visible_attrib.onDataChanged ()
  34. {
  35. if (getData() == "1")
  36. {
  37. aalayout.show();
  38. }
  39. else
  40. {
  41. aalayout.hide();
  42. }
  43. }
  44. System.onKeyDown(String key)
  45. {
  46. if (key == "alt+a")
  47. {
  48. if (albumart_visible_attrib.getData() == "0")
  49. albumart_visible_attrib.setData("1");
  50. else
  51. albumart_visible_attrib.setData("0");
  52. complete;
  53. }
  54. }
  55. waaa.onRightButtonDown (int x, int y)
  56. {
  57. popupmenu p = new popupmenu;
  58. p.addCommand("Refresh Album Art", 1, 0, 0);
  59. String path = getPath(getPlayItemMetaDataString("filename"));
  60. if(path != "")
  61. {
  62. p.addCommand("Open Folder", 2, 0, 0);
  63. }
  64. int result = p.popatmouse();
  65. delete p;
  66. if (result == 1)
  67. {
  68. waaa.refresh();
  69. }
  70. else if (result == 2)
  71. {
  72. if(path != "")
  73. {
  74. System.navigateUrl(path);
  75. }
  76. else
  77. {
  78. String url = getPlayItemMetaDataString("streamurl");
  79. if(url != "")
  80. {
  81. System.navigateUrl(url);
  82. }
  83. }
  84. }
  85. }
  86. waaa.onLeftButtonDblClk (int x, int y)
  87. {
  88. String path = getPath(getPlayItemMetaDataString("filename"));
  89. if(path != "")
  90. {
  91. System.navigateUrl(path);
  92. }
  93. else
  94. {
  95. String url = getPlayItemMetaDataString("streamurl");
  96. if(url != "")
  97. {
  98. System.navigateUrl(url);
  99. }
  100. }
  101. }