plmenu.m 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #include <lib/std.mi>
  2. #include "attribs.m"
  3. Global Layout pl_normal;
  4. Global Layout pl_shade;
  5. System.onScriptLoaded() {
  6. initAttribs();
  7. menubar_pe_attrib.onDataChanged();
  8. pl_normal = getScriptGroup().getParentLayout();
  9. }
  10. menubar_pe_attrib.onDataChanged() {
  11. Group Player = getscriptgroup().findobject("player.content.pl.dummy.group");
  12. Group MenuBar = getscriptgroup().findobject("wasabi.menubar.pl");
  13. Layout main = getscriptgroup().getParentLayout();
  14. main.beforeRedock();
  15. if (getData() == "1") {
  16. Player.setXmlParam("y","16");
  17. MenuBar.show();
  18. main.snapAdjust(0,0,0,0);
  19. }
  20. else {
  21. Player.setXmlParam("y","0");
  22. MenuBar.hide();
  23. main.snapAdjust(0,0,0,16);
  24. }
  25. main.Redock();
  26. }
  27. System.onKeyDown(String k) {
  28. if (pl_shade == NULL)
  29. pl_shade = pl_normal.getContainer().getLayout("shade");
  30. if (StrLeft(k,4) == "ctrl" && StrSearch(k, "+w") != -1 && (pl_normal.isActive() || pl_shade.isActive())) {
  31. if (pl_normal.isVisible())
  32. pl_normal.getContainer().switchToLayout("shade");
  33. else
  34. pl_normal.getContainer().switchToLayout("normal");
  35. complete;
  36. }
  37. }
  38. System.onAccelerator(String action, String section, String key) {
  39. if (menubar_main_attrib.getData() == "0") return;
  40. Layout l = getScriptGroup().getParentLayout();
  41. if (!l.isActive()) return;
  42. // we use the general accelerators otherwise use specific ones
  43. // will allow the skin to cope with variations in localisations
  44. if (action == "MENUHOTKEY_FILE" || action == "PL_MENUHOTKEY_FILE")
  45. {
  46. getScriptGroup().findObject("PE_File.menu").sendAction("open", "", 0, 0, 0, 0);
  47. complete;
  48. }
  49. if (action == "MENUHOTKEY_PLAY" || action == "PL_MENUHOTKEY_PLAYLIST")
  50. {
  51. getScriptGroup().findObject("PE_Playlist.menu").sendAction("open", "", 0, 0, 0, 0);
  52. complete;
  53. }
  54. if (action == "PL_MENUHOTKEY_SORT")
  55. {
  56. getScriptGroup().findObject("PE_Sort.menu").sendAction("open", "", 0, 0, 0, 0);
  57. complete;
  58. }
  59. if (action == "MENUHOTKEY_HELP" || action == "PL_MENUHOTKEY_HELP")
  60. {
  61. getScriptGroup().findObject("PE_Help.menu").sendAction("open", "", 0, 0, 0, 0);
  62. complete;
  63. }
  64. }