mainmenu.m 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /*---------------------------------------------------
  2. -----------------------------------------------------
  3. Filename: songinfo.m
  4. Version: 1.0
  5. Type: maki
  6. Date: 20. Nov. 2006 - 22:47
  7. Author: Martin Poehlmann aka Deimos
  8. E-Mail: [email protected]
  9. Internet: www.skinconsortium.com
  10. www.martin.deimos.de.vu
  11. -----------------------------------------------------
  12. ---------------------------------------------------*/
  13. #include <lib/std.mi>
  14. #include attribs/init_appearance.m
  15. Class Layer LinkedLayer;
  16. Function initLL(linkedLayer l);
  17. Function fadeLL(linkedLayer l, boolean in);
  18. Function setLL(linkedLayer l, boolean in);
  19. Global Group MenuBar;
  20. Global GuiObject mousetrap;
  21. Global Int texth;
  22. Global LinkedLayer _play, _options, _file, _view, _help;
  23. Global int xpos;
  24. Global guiObject titlebargrid;
  25. System.onScriptLoaded()
  26. {
  27. initAttribs_Appearance();
  28. MenuBar = getscriptgroup().findobject("player.mainmenu");
  29. xpos = 0;
  30. titlebargrid = getScriptGroup().findObject("titlebar.grid.right");
  31. _file = MenuBar.getObject("menu.text.file");
  32. initLL(_file);
  33. _play = MenuBar.getObject("menu.text.play");
  34. initLL(_play);
  35. _options = MenuBar.getObject("menu.text.options");
  36. initLL(_options);
  37. _view = MenuBar.getObject("menu.text.view");
  38. initLL(_view);
  39. _help = MenuBar.getObject("menu.text.help");
  40. initLL(_help);
  41. mousetrap = MenuBar.findObjecT("menu.hidden.mousetrap");
  42. texth = _file.getGuiH();
  43. if (menubar_main_attrib.getData() == "1")
  44. {
  45. _options.setXmlParam("h", integerToString(texth));
  46. _file.setXmlParam("h", integerToString(texth));
  47. _help.setXmlParam("h", integerToString(texth));
  48. _view.setXmlParam("h", integerToString(texth));
  49. _play.setXmlParam("h", integerToString(texth));
  50. mousetrap.hide();
  51. }
  52. else
  53. {
  54. _options.setXmlParam("h", "0");
  55. _file.setXmlParam("h", "0");
  56. _help.setXmlParam("h", "0");
  57. _view.setXmlParam("h", "0");
  58. _play.setXmlParam("h", "0");
  59. mousetrap.show();
  60. }
  61. }
  62. menubar_main_attrib.onDataChanged() {
  63. if (getData() == "1")
  64. {
  65. mousetrap.hide();
  66. fadeLL(_play, 1);
  67. fadeLL(_view, 1);
  68. fadeLL(_help, 1);
  69. fadeLL(_file, 1);
  70. fadeLL(_options, 1);
  71. }
  72. else
  73. {
  74. mousetrap.show();
  75. fadeLL(_play, 0);
  76. fadeLL(_view, 0);
  77. fadeLL(_help, 0);
  78. fadeLL(_file, 0);
  79. fadeLL(_options, 0);
  80. }
  81. }
  82. System.onAccelerator(String action, String section, String key) {
  83. if (menubar_main_attrib.getData() == "0") return;
  84. Layout l = getScriptGroup().getParentLayout();
  85. if (!l.isActive()) return;
  86. if (action == "MENUHOTKEY_FILE")
  87. {
  88. MenuBar.findObject("file.menu").sendAction("open", "", 0, 0, 0, 0);
  89. complete;
  90. }
  91. if (action == "MENUHOTKEY_PLAY")
  92. {
  93. MenuBar.findObject("play.menu").sendAction("open", "", 0, 0, 0, 0);
  94. complete;
  95. }
  96. if (action == "MENUHOTKEY_OPTIONS")
  97. {
  98. MenuBar.findObject("options.menu").sendAction("open", "", 0, 0, 0, 0);
  99. complete;
  100. }
  101. if (action == "MENUHOTKEY_VIEW")
  102. {
  103. MenuBar.findObject("view.menu").sendAction("open", "", 0, 0, 0, 0);
  104. complete;
  105. }
  106. if (action == "MENUHOTKEY_HELP")
  107. {
  108. MenuBar.findObject("help.menu").sendAction("open", "", 0, 0, 0, 0);
  109. complete;
  110. }
  111. }
  112. initLL (LinkedLayer l)
  113. {
  114. int w = l.getAutoWidth();
  115. String id = getToken(l.getId(), ".", 2);
  116. GuiObject o = MenuBar.findObject("menu.layer." + id + ".normal");
  117. if (o) o.setXmlParam("w", integerToString(w));
  118. if (o) o.setXmlParam("x", integerToString(xpos));
  119. o = MenuBar.findObject("menu.layer." + id + ".hover");
  120. if (o) o.setXmlParam("w", integerToString(w));
  121. if (o) o.setXmlParam("x", integerToString(xpos));
  122. o = MenuBar.findObject("menu.layer." + id + ".down");
  123. if (o) o.setXmlParam("w", integerToString(w));
  124. if (o) o.setXmlParam("x", integerToString(xpos));
  125. Menu m = MenuBar.findObject(id + ".menu");
  126. if (m) m.setXmlParam("w", integerToString(w));
  127. if (m) m.setXmlParam("x", integerToString(xpos));
  128. l.setXmlParam("x", integerToString(xpos));
  129. xpos += w;
  130. }
  131. fadeLL (linkedLayer l, boolean in)
  132. {
  133. l.cancelTarget();
  134. l.setTargetH(texth*in);
  135. l.setTargetSpeed(0.5);
  136. l.gotoTarget();
  137. }