aboutsummaryrefslogtreecommitdiff
path: root/Src/resources/skins/Winamp Modern/scripts/plmenu.m
blob: 18fcfbdfecbfcb26d70eb53116ff4e621a31a4ed (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include <lib/std.mi>
#include "attribs.m"

Global Layout pl_normal;
Global Layout pl_shade;

System.onScriptLoaded() {
  initAttribs();
  menubar_pe_attrib.onDataChanged();
  pl_normal = getScriptGroup().getParentLayout();
}

menubar_pe_attrib.onDataChanged() {
  Group Player = getscriptgroup().findobject("player.content.pl.dummy.group");
  Group MenuBar = getscriptgroup().findobject("wasabi.menubar.pl");
  Layout main = getscriptgroup().getParentLayout();

  main.beforeRedock();
  if (getData() == "1") {
    Player.setXmlParam("y","16");
    MenuBar.show();
    main.snapAdjust(0,0,0,0);
  }
  else {
    Player.setXmlParam("y","0");
    MenuBar.hide();
    main.snapAdjust(0,0,0,16);
  }
  main.Redock();
}

System.onKeyDown(String k) {
  if (pl_shade == NULL)
    pl_shade = pl_normal.getContainer().getLayout("shade");

  if (StrLeft(k,4) == "ctrl" && StrSearch(k, "+w") != -1 && (pl_normal.isActive() || pl_shade.isActive())) {
    if (pl_normal.isVisible())
      pl_normal.getContainer().switchToLayout("shade");
    else
      pl_normal.getContainer().switchToLayout("normal");
    complete;
  }
}

System.onAccelerator(String action, String section, String key) {
  if (menubar_main_attrib.getData() == "0") return;
  Layout l = getScriptGroup().getParentLayout();
  if (!l.isActive()) return;

  // we use the general accelerators otherwise use specific ones
  // will allow the skin to cope with variations in localisations
  if (action == "MENUHOTKEY_FILE" || action == "PL_MENUHOTKEY_FILE")
  {
    getScriptGroup().findObject("PE_File.menu").sendAction("open", "", 0, 0, 0, 0);
    complete;
  }
  if (action == "MENUHOTKEY_PLAY" || action == "PL_MENUHOTKEY_PLAYLIST")
  {
    getScriptGroup().findObject("PE_Playlist.menu").sendAction("open", "", 0, 0, 0, 0);
    complete;
  }
  if (action == "PL_MENUHOTKEY_SORT")
  {
    getScriptGroup().findObject("PE_Sort.menu").sendAction("open", "", 0, 0, 0, 0);
    complete;
  }
  if (action == "MENUHOTKEY_HELP" || action == "PL_MENUHOTKEY_HELP")
  {
    getScriptGroup().findObject("PE_Help.menu").sendAction("open", "", 0, 0, 0, 0);
    complete;
  }
}