home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 November / CDVD1105.ISO / Util / Winamp / Skins / Anime_Shogo.wal / scripts / frame.m < prev    next >
Text File  |  2004-08-17  |  6KB  |  197 lines

  1. #include <lib/std.mi>
  2.  
  3. Function UpdateVU(Int LeftFrame, Int RightFrame);
  4.  
  5. Global Group frameGroup, content, titlebar;
  6. Global String x, y, w, h, rx, ry, rw, rh;
  7. Global Layer mouselayer, playleft, playmid, playright, vuleft, vuright;
  8. Global Text titletext;
  9. Global Button Sysmenu;
  10. Global Timer VUTimer;
  11. Global Double LeftLevel, RightLevel;
  12. Global Boolean StdVUState;
  13.  
  14. Function setNewGroup(String groupid);
  15.  
  16. System.onScriptLoaded() {
  17.   frameGroup = getScriptGroup();
  18.   titletext = frameGroup.findObject("window.titlebar.title");
  19.   playleft = frameGroup.findObject("component.play.left");
  20.   playmid = frameGroup.findObject("component.play.middle");
  21.   playright = frameGroup.findObject("component.play.right");
  22.   String param = getParam();
  23.   x = getToken(param, ",", 0);
  24.   y = getToken(param, ",", 1);
  25.   w = getToken(param, ",", 2);
  26.   h = getToken(param, ",", 3);
  27.   rx = getToken(param, ",", 4);
  28.   ry = getToken(param, ",", 5);
  29.   rw = getToken(param, ",", 6);
  30.   rh = getToken(param, ",", 7);
  31.   sysmenu = frameGroup.findObject("sysmenu");
  32.  
  33.   vuleft = frameGroup.findObject("component.vu.left");
  34.   vuright = frameGroup.findObject("component.vu.right");
  35.  
  36.   StdVUState = getPrivateInt(getSkinName(), "StdVU", 1);
  37.  
  38.   VUTimer = new Timer;
  39.   VUTimer.setDelay(30);
  40.  
  41.   VUTimer.start();
  42. }
  43.  
  44. System.onSetXuiParam(String param, String value) {
  45.   if (param == "content") {
  46.     setNewGroup(value);
  47.     titlebar = frameGroup.findObject("wasabi.titlebar");
  48.     mouselayer = titlebar.findObject("mousetrap");
  49.   }
  50.   if (param == "padtitleright" || param == "padtitleleft") {
  51.     if (titlebar != NULL) titlebar.setXmlParam(param, value); 
  52.   }
  53.   if (param == "shade") {
  54.     if (mouselayer != NULL) mouselayer.setXmlParam("dblclickaction", "switch;"+value);
  55.     else messagebox("Cannot set shade parameter for StandardFrame object, no mousetrap found", "Skin Error", 0, "");
  56.   }
  57. }
  58.  
  59. // backward compatibility for prerelease notify trick
  60. frameGroup.onNotify(String cmd, String param, int a, int b) {
  61.   String _command = getToken(cmd, ",", 0);
  62.   String _param = getToken(cmd, ",", 1);
  63.   if (_command == "content" || _command == "padtitleright" || _command == "padtitleleft" || _command == "shade") {
  64.     onSetXuiParam(_command, _param);
  65.   }
  66. }
  67.  
  68. setNewGroup(String groupid) {
  69.   content = newGroup(groupid);
  70.   if (content == NULL) {
  71.     messagebox("group \"" + groupid + "\" not found", "ButtonGroup", 0, "");
  72.     return;
  73.   }
  74.   content.setXmlParam("x", x);
  75.   content.setXmlParam("y", y);
  76.   content.setXmlParam("w", w);
  77.   content.setXmlParam("h", h);
  78.   content.setXmlParam("relatx", rx);
  79.   content.setXmlParam("relaty", ry);
  80.   content.setXmlParam("relatw", rw);
  81.   content.setXmlParam("relath", rh);
  82.   content.init(frameGroup);
  83. }
  84.  
  85. Sysmenu.onLeftClick() {
  86.   LayoutStatus _status = frameGroup.findObject("sysmenu.status");
  87.   _status.callme("{system}");
  88. }
  89.  
  90. playleft.onEnterArea() {
  91.   titletext.setXmlParam("default", "Double Click To Play");
  92.   playleft.setXmlParam("image", "frame.play.left.hover");
  93.   playmid.setXmlParam("image", "frame.play.middle.hover");
  94.   playright.setXmlParam("image", "frame.play.right.hover");
  95. }
  96.  
  97. playmid.onEnterArea() {
  98.   titletext.setXmlParam("default", "Double Click To Play");
  99.   playleft.setXmlParam("image", "frame.play.left.hover");
  100.   playmid.setXmlParam("image", "frame.play.middle.hover");
  101.   playright.setXmlParam("image", "frame.play.right.hover");
  102. }
  103.  
  104. playright.onEnterArea() {
  105.   titletext.setXmlParam("default", "Double Click To Play");
  106.   playleft.setXmlParam("image", "frame.play.left.hover");
  107.   playmid.setXmlParam("image", "frame.play.middle.hover");
  108.   playright.setXmlParam("image", "frame.play.right.hover");
  109. }
  110.  
  111. playleft.onLeaveArea() {
  112.   titletext.setXmlParam("default", ":componentname");
  113.   playleft.setXmlParam("image", "frame.play.left");
  114.   playmid.setXmlParam("image", "frame.play.middle");
  115.   playright.setXmlParam("image", "frame.play.right");
  116. }
  117.  
  118. playmid.onLeaveArea() {
  119.   titletext.setXmlParam("default", ":componentname");
  120.   playleft.setXmlParam("image", "frame.play.left");
  121.   playmid.setXmlParam("image", "frame.play.middle");
  122.   playright.setXmlParam("image", "frame.play.right");
  123. }
  124.  
  125. playright.onLeaveArea() {
  126.   titletext.setXmlParam("default", ":componentname");
  127.   playleft.setXmlParam("image", "frame.play.left");
  128.   playmid.setXmlParam("image", "frame.play.middle");
  129.   playright.setXmlParam("image", "frame.play.right");
  130. }
  131.  
  132. playleft.onLeftButtonDblClk(int x, int y) {
  133.   System.play(); 
  134.   complete;
  135. }
  136.  
  137. playmid.onLeftButtonDblClk(int x, int y) {
  138.   System.play();
  139.   complete;
  140. }
  141.  
  142. playright.onLeftButtonDblClk(int x, int y) {
  143.   System.play();
  144.   complete;
  145. }
  146.  
  147. VUTimer.onTimer() {
  148.   LeftLevel = (System.getLeftVuMeter());
  149.   RightLevel = (System.getRightVuMeter());
  150.  
  151.   if (StdVUState) UpdateVU(LeftLevel, RightLevel);
  152.  
  153. }
  154.  
  155. UpdateVU(Int LeftFrame, Int RightFrame){
  156.   vuleft.setTargetA(LeftFrame);
  157.   vuleft.setTargetSpeed(0.05);
  158.   vuleft.gotoTarget();
  159.  
  160.   vuright.setTargetA(RightFrame);
  161.   vuright.setTargetSpeed(0.05);
  162.   vuright.gotoTarget();
  163. }
  164.  
  165. vuleft.onLeftButtonUp(int x, int y) {
  166.   if (StdVUState) {
  167.     StdVUState = 0;
  168.  
  169.     vuleft.setTargetA(0);
  170.     vuleft.setTargetSpeed(0.5);
  171.     vuleft.gotoTarget();
  172.  
  173.     vuright.setTargetA(0);
  174.     vuright.setTargetSpeed(0.5);
  175.     vuright.gotoTarget();
  176.   } else StdVUState = 1;
  177. }
  178.  
  179. vuright.onLeftButtonUp(int x, int y) {
  180.   if (StdVUState) {
  181.     StdVUState = 0;
  182.  
  183.     vuleft.setTargetA(0);
  184.     vuleft.setTargetSpeed(0.5);
  185.     vuleft.gotoTarget();
  186.  
  187.     vuright.setTargetA(0);
  188.     vuright.setTargetSpeed(0.5);
  189.     vuright.gotoTarget();
  190.   } else StdVUState = 1;
  191. }
  192.  
  193. System.onScriptUnloading() {
  194.   setPrivateInt(getSkinName(), "StdVU", StdVUState);
  195.   VUTimer.stop();
  196.   delete VUTimer;
  197. }