123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293 |
- /*---------------------------------------------------
- -----------------------------------------------------
- Filename: cbuttons.m
- Version: 1.0
- Type: maki
- Date: 03. Nov. 2006 - 17:02
- Author: Martin Poehlmann aka Deimos
- E-Mail: [email protected]
- Internet: www.skinconsortium.com
- www.martin.deimos.de.vu
- -----------------------------------------------------
- ---------------------------------------------------*/
- #include <lib/std.mi>
- #include <lib/pldir.mi>
- #define GLOW_OBJECT Prev
- #include <lib/com/glow.m>
- #define GLOW_OBJECT Next
- #include <lib/com/glow.m>
- #define GLOW_OBJECT Play
- #include <lib/com/glow.m>
- #define GLOW_OBJECT Pause
- #include <lib/com/glow.m>
- #define GLOW_OBJECT Stop
- #include <lib/com/glow.m>
- #define GLOW_OBJECT Eject
- #include <lib/com/glow.m>
- #define GLOW_OBJECT Repeat
- #include <lib/com/glow.m>
- #define GLOW_OBJECT Shuffle
- #include <lib/com/glow.m>
- #define GLOW_OBJECT Bolt
- #include <lib/com/glow.m>
- Class Button InfoButton;
- Class ToggleButton InfoToggleButton;
- Global InfoButton b_play, b_pause, b_eject, b_prev, b_next, b_stop, b_bolt;
- Global InfoToggleButton b_repeat, b_shuffle;
- Global GuiObject SongTicker;
- Global Group buttongroup;
- Global GuiObject shuffleActive, repeatActive, boltGlow;
- Global Int shuffleActive_Y, repeatActive_Y, minW, boltX, grabbX;
- Global Layer mainframe_grabber;
- Global Timer beatvis;
- System.onScriptLoaded ()
- {
- buttongroup = getScriptGroup().findObject("player.cbuttons");
- b_play = buttongroup.getObject("Play");
- b_pause = buttongroup.getObject("Pause");
- b_eject = buttongroup.getObject("Eject");
- b_prev = buttongroup.getObject("Prev");
- b_next = buttongroup.getObject("Next");
- b_stop = buttongroup.getObject("Stop");
- b_repeat = buttongroup.getObject("repeat");
- b_shuffle = buttongroup.getObject("shuffle");
- b_bolt = buttongroup.getParentLayout().getObject("bolt");
- boltGlow = buttongroup.getParentLayout().getObject("bolt.glow");
- shuffleActive = getScriptGroup().findObject("shuffle.active");
- shuffleActive_Y = shuffleActive.getGuiY();
- repeatActive = getScriptGroup().findObject("repeat.active");
- repeatActive_Y = repeatActive.getGuiY();
- mainframe_grabber = buttongroup.getParentLayout().getObject("player.mainframe.grabber");
- beatvis = new Timer;
- beatvis.setDelay(33);
- minW = stringToInteger(getParam());
- boltX = b_bolt.getGuiX();
- grabbX = mainframe_grabber.getGuiX();
- b_bolt.setXmlParam("x", integerToString(boltX + buttongroup.GetWidth() - minW));
- boltGlow.setXmlParam("x", integerToString(boltX + buttongroup.GetWidth() - minW));
- mainframe_grabber.setXmlParam("x", integerToString(grabbX + buttongroup.GetWidth() - minW));
- _Play_GlowInit (b_play, buttongroup.findObject("Play.glow"), 0.3);
- _Pause_GlowInit (b_pause, buttongroup.findObject("Pause.glow"), 0.3);
- _Stop_GlowInit (b_stop, buttongroup.findObject("Stop.glow"), 0.3);
- _Prev_GlowInit (b_prev, buttongroup.findObject("Prev.glow"), 0.3);
- _Next_GlowInit (b_next, buttongroup.findObject("Next.glow"), 0.3);
- _Eject_GlowInit (b_eject, buttongroup.findObject("Eject.glow"), 0.3);
- _Repeat_GlowInit (b_repeat, buttongroup.findObject("repeat.glow"), 0.3);
- _Shuffle_GlowInit (b_shuffle, buttongroup.findObject("shuffle.glow"), 0.3);
- _Bolt_GlowInit (b_bolt, buttongroup.getParentLayout().getObject("bolt.glow"), 0.7);
- SongTicker = buttongroup.getParentLayout().findObject("songticker");
- }
- system.onScriptUnloading ()
- {
- beatvis.stop();
- delete beatvis;
- }
- InfoButton.onLeftButtonDown (int x, int y)
- {
- if (InfoButton == b_play)
- {
- if (getStatus() == -1)
- {
- SongTicker.sendAction("showinfo", "Resume Playback", 0, 0, 0, 0);
- }
- else if (getStatus() == 0)
- {
- SongTicker.sendAction("showinfo", "Start Playback", 0, 0, 0, 0);
- }
- else if (getStatus() == 1)
- {
- SongTicker.sendAction("showinfo", "Restart Playback", 0, 0, 0, 0);
- }
- }
- else if (InfoButton == b_pause)
- {
- if (getStatus() == -1)
- {
- SongTicker.sendAction("showinfo", "Resume Playback", 0, 0, 0, 0);
- }
- else if (getStatus() == 1)
- {
- SongTicker.sendAction("showinfo", "Pause Playback", 0, 0, 0, 0);
- }
- }
- else if (InfoButton == b_pause)
- {
- if (getStatus() == 1)
- {
- SongTicker.sendAction("showinfo", "Pause Playback", 0, 0, 0, 0);
- }
- }
- else
- {
- string info = InfoButton.getXmlParam("tooltip");
- SongTicker.sendAction("showinfo", info, 0, 0, 0, 0);
- }
- }
- InfoToggleButton.onLeftButtonDown (int x, int y)
- {
- if (InfoToggleButton == b_shuffle)
- {
- if (getCurCfgVal() == 1)
- {
- SongTicker.sendAction("showinfo", "Shuffle: On", 0, 0, 0, 0);
- }
- else
- {
- SongTicker.sendAction("showinfo", "Shuffle: Off", 0, 0, 0, 0);
- }
- }
- else if (InfoToggleButton == b_repeat)
- {
- if (getCurCfgVal() == 1)
- {
- SongTicker.sendAction("showinfo", "Repeat: Playlist", 0, 0, 0, 0);
- }
- else if (getCurCfgVal() == -1)
- {
- SongTicker.sendAction("showinfo", "Repeat: Track", 0, 0, 0, 0);
- }
- else if (getCurCfgVal() == 0)
- {
- SongTicker.sendAction("showinfo", "Repeat: Off", 0, 0, 0, 0);
- }
- }
- }
- InfoToggleButton.onLeftButtonUp (int x, int y)
- {
- if (InfoToggleButton == b_shuffle)
- {
- if (getCurCfgVal() == 1)
- {
- SongTicker.sendAction("showinfo", "Shuffle: On", 0, 0, 0, 0);
- }
- else
- {
- SongTicker.sendAction("showinfo", "Shuffle: Off", 0, 0, 0, 0);
- }
- }
- else if (InfoToggleButton == b_repeat)
- {
- if (getCurCfgVal() == 1)
- {
- SongTicker.sendAction("showinfo", "Repeat: Playlist", 0, 0, 0, 0);
- }
- else if (getCurCfgVal() == -1)
- {
- SongTicker.sendAction("showinfo", "Repeat: Track", 0, 0, 0, 0);
- }
- else if (getCurCfgVal() == 0)
- {
- SongTicker.sendAction("showinfo", "Repeat: Off", 0, 0, 0, 0);
- }
- }
- }
- Global Boolean shuffleDown, repeatDown;
- b_shuffle.onLeftButtonDown (int x, int y)
- {
- shuffleDown = 1;
- shuffleActive.setXmlParam("y", integerToString(shuffleActive_Y+1));
- }
- b_shuffle.onLeftButtonUp (int x, int y)
- {
- shuffleDown = 0;
- shuffleActive.setXmlParam("y", integerToString(shuffleActive_Y));
- }
- b_shuffle.onleaveArea ()
- {
- shuffleActive.setXmlParam("y", integerToString(shuffleActive_Y));
- }
- b_shuffle.onEnterArea ()
- {
- if (shuffleDown) shuffleActive.setXmlParam("y", integerToString(shuffleActive_Y+1));
- }
- b_repeat.onLeftButtonDown (int x, int y)
- {
- repeatDown = 1;
- repeatActive.setXmlParam("y", integerToString(repeatActive_Y+1));
- }
- b_repeat.onLeftButtonUp (int x, int y)
- {
- repeatDown = 0;
- repeatActive.setXmlParam("y", integerToString(repeatActive_Y));
- }
- b_repeat.onleaveArea ()
- {
- repeatActive.setXmlParam("y", integerToString(repeatActive_Y));
- }
- b_repeat.onEnterArea ()
- {
- if (repeatDown) repeatActive.setXmlParam("y", integerToString(repeatActive_Y+1));
- }
- buttongroup.onResize (int x, int y, int w, int h)
- {
- b_bolt.setXmlParam("x", integerToString(boltX + buttongroup.GetWidth() - minW));
- boltGlow.setXmlParam("x", integerToString(boltX + buttongroup.GetWidth() - minW));
- mainframe_grabber.setXmlParam("x", integerToString(grabbX + buttongroup.GetWidth() - minW));
- }
- b_bolt.onLeftButtonUp (int x, int y)
- {
- if (isKeyDown(VK_ALT) && isKeyDown(VK_SHIFT) && isKeyDown(VK_CONTROL))
- {
- if (beatvis.isRunning())
- {
- beatvis.stop();
- }
- else
- {
- beatvis.start();
- }
- complete;
- }
- }
- beatvis.onTimer ()
- {
- int value = (getRightVuMeter() + getLeftVuMeter()) / 2;
- boltGlow.setAlpha(value);
- }
- /*
- System.onKeyDown (String key)
- {
- if (key == "space")
- {
- PlEdit.showCurrentlyPlayingTrack();
- complete;
- }
- }*/
- System.onAccelerator (String action, String section, String key)
- {
- if (strupper(action) == "SHOW_CURRENT_TRACK")
- {
- PlEdit.showCurrentlyPlayingTrack();
- complete;
- }
- }
|