diff options
Diffstat (limited to 'Src/resources/skins/Winamp Modern/scripts')
61 files changed, 5126 insertions, 0 deletions
diff --git a/Src/resources/skins/Winamp Modern/scripts/albumart.m b/Src/resources/skins/Winamp Modern/scripts/albumart.m new file mode 100644 index 00000000..2ef9ce27 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/albumart.m @@ -0,0 +1,113 @@ +#include <lib/std.mi> +#include "attribs.m" + +Global AlbumArtLayer waaa; +Global Layout aalayout; + +System.onScriptLoaded() +{ + initAttribs(); + Container albumart = System.getContainer("winamp.albumart"); + aalayout = albumart.getLayout("normal"); + waaa = getScriptGroup().findObject(getParam()); +} + +system.onScriptUnloading () +{ + if (!aalayout) return; + setPrivateInt("Winamp Modern", "Album Art XPos", aalayout.getLeft()); + setPrivateInt("Winamp Modern", "Album Art YPos", aalayout.getTop()); +} + +aalayout.onStartup () +{ + resize(getPrivateInt("Winamp Modern", "Album Art XPos", 0), getPrivateInt("Winamp Modern", "Album Art YPos", 0), getWidth(), getHeight()); +} + +aalayout.onSetVisible (Boolean onoff) +{ + if (!onoff) + { + albumart_visible_attrib.setData("0"); + } + else + { + albumart_visible_attrib.setData("1"); + } +} + +albumart_visible_attrib.onDataChanged () +{ + if (getData() == "1") + { + aalayout.show(); + } + else + { + aalayout.hide(); + } +} + +System.onKeyDown(String key) +{ + if (key == "alt+a") + { + if (albumart_visible_attrib.getData() == "0") + albumart_visible_attrib.setData("1"); + else + albumart_visible_attrib.setData("0"); + complete; + } +} + +waaa.onRightButtonDown (int x, int y) +{ + popupmenu p = new popupmenu; + + p.addCommand("Refresh Album Art", 1, 0, 0); + String path = getPath(getPlayItemMetaDataString("filename")); + if(path != "") + { + p.addCommand("Open Folder", 2, 0, 0); + } + + int result = p.popatmouse(); + delete p; + + if (result == 1) + { + waaa.refresh(); + } + else if (result == 2) + { + if(path != "") + { + System.navigateUrl(path); + } + else + { + String url = getPlayItemMetaDataString("streamurl"); + if(url != "") + { + System.navigateUrl(url); + } + } + } +} + +waaa.onLeftButtonDblClk (int x, int y) +{ + String path = getPath(getPlayItemMetaDataString("filename")); + if(path != "") + { + System.navigateUrl(path); + } + else + { + String url = getPlayItemMetaDataString("streamurl"); + if(url != "") + { + System.navigateUrl(url); + } + } +}
\ No newline at end of file diff --git a/Src/resources/skins/Winamp Modern/scripts/albumart.maki b/Src/resources/skins/Winamp Modern/scripts/albumart.maki Binary files differnew file mode 100644 index 00000000..02bdf775 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/albumart.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/attribs.m b/Src/resources/skins/Winamp Modern/scripts/attribs.m new file mode 100644 index 00000000..8304496f --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/attribs.m @@ -0,0 +1,319 @@ +#ifndef included +#error This script can only be compiled as a #include +#endif + +#ifndef __ATTRIBS_M +#define __ATTRIBS_M + +#include <lib/config.mi> + +// ----------------------------------------------------------------------------------------------------------------- + +// this is the page that maps its items to the options menu, you can add attribs or more pages (submenus) +#define CUSTOM_OPTIONSMENU_ITEMS "{1828D28F-78DD-4647-8532-EBA504B8FC04}" + +// this is the page that maps its items to the windows menu (aka View), you can add attribs or more pages (submenus) +#define CUSTOM_WINDOWSMENU_ITEMS "{6559CA61-7EB2-4415-A8A9-A2AEEF762B7F}" + +// custom options submenu item page, you can add more, just use guidgen and Config.newItem() +#define CUSTOM_PAGE "{26E26319-AECA-4433-B8F1-F4A5BF2A9ED5}" + +// drawer config page +#define CUSTOM_PAGE_DRAWER "{C338B30F-2A04-4b10-871F-4E9D52D62806}" + +// menubars config page +#define CUSTOM_PAGE_MENUBARS "{12ED320E-6813-45ac-9F8E-78EE5B2B5F6D}" + +// main windowshade config page +#define CUSTOM_PAGE_WINDOWSHADE "{58F07E21-AE96-4899-B7BC-3640B40029FB}" + +// vis button config page +#define CUSTOM_PAGE_VISCMD "{D70E3ABF-D2FF-4b82-9A70-4B5DF1A5D942}" + +// notifier config page +#define CUSTOM_PAGE_NOTIFIER "{1AB968B3-8687-4a35-BA70-FCF6D92FB57F}" + +// songticker config page +#define CUSTOM_PAGE_SONGTICKER "{7061FDE0-0E12-11D8-BB41-0050DA442EF3}" + +// non exposed attribs page +#define CUSTOM_PAGE_NONEXPOSED "{E9C2D926-53CA-400f-9A4D-85E31755A4CF}" + + +// ----------------------------------------------------------------------------------------------------------------- + +Function initAttribs(); + +// ----------------------------------------------------------------------------------------------------------------- + +Global ConfigAttribute scrolldrawerattrib; +Global ConfigAttribute scrollconfigdrawerattrib; + +Global ConfigAttribute vis_detach_attrib; +Global ConfigAttribute video_detach_attrib; + +Global ConfigAttribute drawer_directiontop_attrib; +Global ConfigAttribute drawer_directionbottom_attrib; +Global ConfigAttribute drawer_directionbypass_attrib; + +Global ConfigAttribute eq_visible_attrib, albumart_visible_attrib; + +Global ConfigAttribute menubar_main_attrib; +Global ConfigAttribute menubar_pe_attrib; +Global ConfigAttribute menubar_ml_attrib; + +Global ConfigAttribute windowshade_linkall_attrib; +Global ConfigAttribute windowshade_linkposition_attrib; +Global ConfigAttribute windowshade_linknone_attrib; + +Global ConfigAttribute beatvisualization_attrib; + +Global ConfigAttribute viscmd_config_attrib; +Global ConfigAttribute viscmd_menu_attrib; + +Global ConfigAttribute notifier_minimized_attrib; +Global ConfigAttribute notifier_windowshade_attrib; +Global ConfigAttribute notifier_always_attrib; +Global ConfigAttribute notifier_never_attrib; +Global ConfigAttribute notifier_fadeintime_attrib; +Global ConfigAttribute notifier_fadeouttime_attrib; +Global ConfigAttribute notifier_holdtime_attrib; +Global ConfigAttribute notifier_disablefullscreen_attrib; +//Global ConfigAttribute notifier_opennowplaying_attrib; +Global ConfigAttribute notifier_artworkinnotification_attrib; + +Class ConfigAttribute songticker_scrolling_attrib; +Global songticker_scrolling_attrib songticker_scrolling_modern_attrib; +Global songticker_scrolling_attrib songticker_scrolling_classic_attrib; +Global songticker_scrolling_attrib songticker_scrolling_disabled_attrib; + +// ----------------------------------------------------------------------------------------------------------------- + +initAttribs() { + + // create the custom cfgpage for this session (if it does exist, it just returns it) + ConfigItem custom_page = Config.newItem("Winamp Modern", CUSTOM_PAGE); + ConfigItem custom_page_drawer = Config.newItem("Drawers", CUSTOM_PAGE_DRAWER); + ConfigItem custom_page_menubars = Config.newItem("Menus", CUSTOM_PAGE_MENUBARS); + ConfigItem custom_page_windowshade = Config.newItem("Main Windowshade Mode", CUSTOM_PAGE_WINDOWSHADE); + ConfigItem custom_page_viscmd = Config.newItem("Vis Buttons", CUSTOM_PAGE_VISCMD); + ConfigItem custom_page_notifier = Config.newItem("Notifications", CUSTOM_PAGE_NOTIFIER); + ConfigItem custom_page_songticker = Config.newItem("Songticker", CUSTOM_PAGE_SONGTICKER); + + ConfigItem custom_page_nonexposed = Config.newItem("Hidden", CUSTOM_PAGE_NONEXPOSED); + + // load up the cfgpage in which we'll insert our custom page + ConfigItem custom_options_page = Config.getItem(CUSTOM_OPTIONSMENU_ITEMS); + ConfigItem custom_windows_page = Config.getItem(CUSTOM_WINDOWSMENU_ITEMS); + + // this creates a submenu for this attribute + ConfigAttribute submenuattrib = custom_options_page.newAttribute("Winamp Modern", ""); + submenuattrib.setData(CUSTOM_PAGE); // discard any default value and point at our custom cfgpage + + ConfigAttribute drawersubmenu = custom_page.newAttribute("Drawers", ""); + drawersubmenu.setData(CUSTOM_PAGE_DRAWER); + + ConfigAttribute menubarssubmenu = custom_page.newAttribute("Menus", ""); + menubarssubmenu.setData(CUSTOM_PAGE_MENUBARS); + + ConfigAttribute windowshadesubmenu = custom_page.newAttribute("Main Windowshade Mode", ""); + windowshadesubmenu.setData(CUSTOM_PAGE_WINDOWSHADE); + + ConfigAttribute viscmdsubmenu = custom_page.newAttribute("Vis Shortcut Button", ""); + viscmdsubmenu.setData(CUSTOM_PAGE_VISCMD); + + ConfigAttribute notifiersubmenu = custom_page.newAttribute("Notifications", ""); + notifiersubmenu.setData(CUSTOM_PAGE_NOTIFIER); + + ConfigAttribute songtickersubmenu = custom_page.newAttribute("Songticker", ""); + songtickersubmenu.setData(CUSTOM_PAGE_SONGTICKER); + + + scrolldrawerattrib = custom_page_drawer.newAttribute("Animate Video/Vis Drawer (disabled if opacity < 100%)", "0"); + scrollconfigdrawerattrib = custom_page_drawer.newAttribute("Animate Config Drawer", "0"); + ConfigAttribute sep = custom_page_drawer.newAttribute("sep1", ""); sep.setData("-"); + drawer_directiontop_attrib = custom_page_drawer.newAttribute("Open Video/Vis from the top", "0"); + drawer_directionbottom_attrib = custom_page_drawer.newAttribute("Open Video/Vis from the bottom", "1"); + drawer_directionbypass_attrib = custom_page_drawer.newAttribute("Bypass setting to keep in screen", "1"); + if (drawer_directiontop_attrib.getData() == "1") drawer_directiontop_attrib.onDataChanged(); else drawer_directionbottom_attrib.onDataChanged(); + + menubar_main_attrib = custom_page_menubars.newAttribute("Show Menus in Main Window", "1"); + menubar_pe_attrib = custom_page_menubars.newAttribute("Show Menus in Playlist Editor", "1"); + menubar_ml_attrib = custom_page_menubars.newAttribute("Show Menus in Media Library", "1"); + + // create an attribute for each of our options, if the attribute already exists, it is returned + sep = custom_page.newAttribute("sep1", ""); sep.setData("-"); + vis_detach_attrib = custom_page.newAttribute("Detach Vis Window", "0"); + video_detach_attrib = custom_page.newAttribute("Detach Video Window", "0"); + eq_visible_attrib = custom_windows_page.newAttribute("Equalizer\tAlt+G", "0"); + albumart_visible_attrib = custom_windows_page.newAttribute("Album Art\tAlt+A", "1"); + + sep = custom_page.newAttribute("sep2", ""); sep.setData("-"); + beatvisualization_attrib = custom_page.newAttribute("Enable Beat Visualization", "1"); + + windowshade_linkall_attrib = custom_page_windowshade.newAttribute("Link Position and Width", "1"); + windowshade_linkposition_attrib = custom_page_windowshade.newAttribute("Link Position, Unlink Width", "0"); + windowshade_linknone_attrib = custom_page_windowshade.newAttribute("Unlink Position and Width", "0"); + + viscmd_menu_attrib = custom_page_viscmd.newAttribute("Open Context Menu", "1"); + viscmd_config_attrib = custom_page_viscmd.newAttribute("Open Configuration", "0"); + + notifier_always_attrib = custom_page_notifier.newAttribute("Show always", "0"); + notifier_windowshade_attrib = custom_page_notifier.newAttribute("Show with windowshade and when minimized", "0"); + notifier_minimized_attrib = custom_page_notifier.newAttribute("Show only when minimized", "0"); + notifier_never_attrib = custom_page_notifier.newAttribute("Never show", "1"); + sep = custom_page_notifier.newAttribute("sep1", ""); sep.setData("-"); + notifier_disablefullscreen_attrib = custom_page_notifier.newAttribute("Disable in fullscreen", "1"); + sep = custom_page_notifier.newAttribute("sep666", ""); sep.setData("-"); + //notifier_opennowplaying_attrib = custom_page_notifier.newAttribute("Open Now Playing on Click", "1"); + sep = custom_page_notifier.newAttribute("sep333", ""); sep.setData("-"); + notifier_artworkinnotification_attrib = custom_page_notifier.newAttribute("Show Now Playing Artwork", "1"); + + notifier_fadeintime_attrib = custom_page_nonexposed.newAttribute("Notifications fade in time", "1000"); + notifier_fadeouttime_attrib = custom_page_nonexposed.newAttribute("Notifications fade out time", "5000"); + notifier_holdtime_attrib = custom_page_nonexposed.newAttribute("Notifications display time", "2000"); + + songticker_scrolling_disabled_attrib = custom_page_songticker.newAttribute("Disable Songticker scrolling", "0"); + if (songticker_scrolling_disabled_attrib.getData() == "0") songticker_scrolling_modern_attrib = custom_page_songticker.newAttribute("Modern Songticker scrolling", "1"); + else songticker_scrolling_modern_attrib = custom_page_songticker.newAttribute("Modern Songticker scrolling", "0"); + songticker_scrolling_classic_attrib = custom_page_songticker.newAttribute("Classic Songticker scrolling", "0"); +} + +// ----------------------------------------------------------------------------------------------------------------- + +#ifdef MAIN_ATTRIBS_MGR + +Global Int attribs_mychange; + +#define NOOFF if (getData()=="0") { setData("1"); return; } + +drawer_directiontop_attrib.onDataChanged() { + if (attribs_mychange) return; + NOOFF + attribs_mychange = 1; + drawer_directionbottom_attrib.setData("0"); + drawer_directiontop_attrib.setData("1"); + attribs_mychange = 0; +} + +drawer_directionbottom_attrib.onDataChanged() { + if (attribs_mychange) return; + NOOFF + attribs_mychange = 1; + drawer_directiontop_attrib.setData("0"); + drawer_directionbottom_attrib.setData("1"); + attribs_mychange = 0; +} + +windowshade_linkall_attrib.onDataChanged() { + if (attribs_mychange) return; + NOOFF + attribs_mychange = 1; + windowshade_linkposition_attrib.setData("0"); + windowshade_linknone_attrib.setData("0"); + attribs_mychange = 0; +} + +windowshade_linkposition_attrib.onDataChanged() { + if (attribs_mychange) return; + NOOFF + attribs_mychange = 1; + windowshade_linkall_attrib.setData("0"); + windowshade_linknone_attrib.setData("0"); + attribs_mychange = 0; +} + +windowshade_linknone_attrib.onDataChanged() { + if (attribs_mychange) return; + NOOFF + attribs_mychange = 1; + windowshade_linkall_attrib.setData("0"); + windowshade_linkposition_attrib.setData("0"); + attribs_mychange = 0; +} + +viscmd_menu_attrib.onDataChanged() { + if (attribs_mychange) return; + NOOFF + attribs_mychange = 1; + viscmd_config_attrib.setData("0"); + attribs_mychange = 0; + updateVisCmd(); +} + +viscmd_config_attrib.onDataChanged() { + if (attribs_mychange) return; + NOOFF + attribs_mychange = 1; + viscmd_menu_attrib.setData("0"); + attribs_mychange = 0; + updateVisCmd(); +} + +notifier_always_attrib.onDataChanged() { + if (attribs_mychange) return; + NOOFF + attribs_mychange = 1; + notifier_never_attrib.setData("0"); + notifier_windowshade_attrib.setData("0"); + notifier_minimized_attrib.setData("0"); + attribs_mychange = 0; +} + +notifier_never_attrib.onDataChanged() { + if (attribs_mychange) return; + NOOFF + attribs_mychange = 1; + notifier_always_attrib.setData("0"); + notifier_windowshade_attrib.setData("0"); + notifier_minimized_attrib.setData("0"); + attribs_mychange = 0; +} + +notifier_minimized_attrib.onDataChanged() { + if (attribs_mychange) return; + NOOFF + attribs_mychange = 1; + notifier_never_attrib.setData("0"); + notifier_windowshade_attrib.setData("0"); + notifier_always_attrib.setData("0"); + attribs_mychange = 0; +} + +notifier_windowshade_attrib.onDataChanged() { + if (attribs_mychange) return; + NOOFF + attribs_mychange = 1; + notifier_never_attrib.setData("0"); + notifier_always_attrib.setData("0"); + notifier_minimized_attrib.setData("0"); + attribs_mychange = 0; +} + +songticker_scrolling_modern_attrib.onDataChanged() { + if (attribs_mychange) return; + NOOFF + attribs_mychange = 1; + songticker_scrolling_disabled_attrib.setData("0"); + songticker_scrolling_classic_attrib.setData("0"); + attribs_mychange = 0; +} +songticker_scrolling_disabled_attrib.onDataChanged() { + if (attribs_mychange) return; + NOOFF + attribs_mychange = 1; + songticker_scrolling_modern_attrib.setData("0"); + songticker_scrolling_classic_attrib.setData("0"); + attribs_mychange = 0; +} +songticker_scrolling_classic_attrib.onDataChanged() { + if (attribs_mychange) return; + NOOFF + attribs_mychange = 1; + songticker_scrolling_modern_attrib.setData("0"); + songticker_scrolling_disabled_attrib.setData("0"); + attribs_mychange = 0; +} +#endif + +#endif diff --git a/Src/resources/skins/Winamp Modern/scripts/beatvisualization.m b/Src/resources/skins/Winamp Modern/scripts/beatvisualization.m new file mode 100644 index 00000000..af142e9d --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/beatvisualization.m @@ -0,0 +1,139 @@ +#include <lib/std.mi> +#include "attribs.m" + +Function setObjects(); + +Global Group frameGroup,beatdisplay; +Global Layer beatOverlay,DisplayRight,DisplayRightOverlay,DisplaySongtickerBG,VisOverlay; +Global Timer refreshEQ; +Global AnimatedLayer beatbarLeft,beatbarRight; +Global int lastBeatLeft,lastBeatRight; +Global Button Toggler,Toggler2; +Global Int dobeat2; + +System.onScriptLoaded() { + initAttribs(); + frameGroup = getScriptGroup(); + beatdisplay = frameGroup.findObject("player.normal.display.beatvisualization"); + beatOverlay = frameGroup.findObject("beatdisplayoverlay"); + beatbarLeft = frameGroup.findObject("beatleft"); + beatbarRight = frameGroup.findObject("beatright"); + + Toggler = frameGroup.findObject("beatvisualization"); + Toggler2 = frameGroup.findObject("beatvisualization2"); + + DisplayRight = frameGroup.findObject("display.right"); + DisplayRightOverlay = frameGroup.findObject("display.right.overlay2"); + DisplaySongtickerBG = frameGroup.findObject("display.st.right"); + VisOverlay = frameGroup.findObject("visualization.overlay"); + + lastBeatLeft = 0; + lastBeatRight = 0; + + refreshEQ = new Timer; + refreshEQ.setDelay(10); +} + +System.onscriptunloading() { + delete refreshEQ; +} + +setObjects() { + int group_width = frameGroup.getWidth(); + + if ( group_width % 2 !=0 ) { + DisplayRight.setXmlParam("image","player.display.right"); + DisplayRightOverlay.setXmlParam("image","player.display.right"); + DisplaySongtickerBG.setXmlParam("image","player.display.songticker.bg.right"); + VisOverlay.setXmlParam("image","player.visualization.overlay"); + } else { + DisplayRight.setXmlParam("image","player.display.right2"); + DisplayRightOverlay.setXmlParam("image","player.display.right2"); + DisplaySongtickerBG.setXmlParam("image","player.display.songticker.bg.right2"); + VisOverlay.setXmlParam("image","player.visualization.overlay2"); + } + + if ( group_width > 480 ) { + int newXpos = (group_width-60)/2; + beatdisplay.setXmlParam("x", IntegerToString(newXpos)); + beatdisplay.show(); + + if ( beatvisualization_attrib.getData()=="1" ) { + refreshEQ.stop(); + refreshEQ.start(); + } else { + refreshEQ.stop(); + beatbarLeft.gotoframe(0); + beatbarRight.gotoframe(0); + } + } else { + beatdisplay.hide(); + refreshEQ.stop(); + } +} + +frameGroup.onResize(int x, int y, int w, int h) { + setObjects(); +} + +refreshEQ.onTimer() { + int beatLeft= System.getLeftVuMeter(); + int beatRight= System.getRightVuMeter(); + + int frameLeft=beatLeft/16; + int frameRight=beatRight/16; + + if (frameLeft>14) frameLeft=14; + if (frameRight>14) frameRight=14; + + if (frameLeft<lastBeatLeft) { + frameLeft=lastBeatLeft-1; + if (frameLeft<0) frameLeft=0; + } + + if (frameRight<lastBeatRight) { + frameRight=lastBeatRight-1; + if (frameRight<0) frameRight=0; + } + + lastBeatLeft=frameLeft; + lastBeatRight=frameRight; + + beatbarLeft.gotoframe(frameLeft); + beatbarRight.gotoframe(frameRight); +} + +beatvisualization_attrib.onDataChanged() { + setObjects(); +} + +System.onKeyDown(String key) { + if (key == "shift+ctrl+alt") { + dobeat2 = 1; + complete; + } else dobeat2 = 0; +} + +Toggler.onLeftClick() { + if ( beatvisualization_attrib.getData()=="1" ) { + beatvisualization_attrib.setData("0"); + } else { + beatvisualization_attrib.setData("1"); + } +} + +Toggler2.onActivate(boolean on) { + if (!dobeat2) { Toggler.leftClick(); return; } + refreshEQ.stop(); + + if (on) { + beatbarLeft.setXMLParam("image","player.display.beat.left2"); + beatbarRight.setXMLParam("image","player.display.beat.right2"); + beatOverlay.hide(); + } else { + beatbarLeft.setXMLParam("image","player.display.beat.left"); + beatbarRight.setXMLParam("image","player.display.beat.right"); + beatOverlay.show(); + } + setObjects(); +} diff --git a/Src/resources/skins/Winamp Modern/scripts/beatvisualization.maki b/Src/resources/skins/Winamp Modern/scripts/beatvisualization.maki Binary files differnew file mode 100644 index 00000000..fc710ebe --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/beatvisualization.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/buildall.bat b/Src/resources/skins/Winamp Modern/scripts/buildall.bat new file mode 100644 index 00000000..e7095811 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/buildall.bat @@ -0,0 +1,2 @@ +for %%a in (*.m) do "H:\Program Files\Nullsoft\sandbox\wasabi\mc.exe" %%a +pause diff --git a/Src/resources/skins/Winamp Modern/scripts/configtabs.m b/Src/resources/skins/Winamp Modern/scripts/configtabs.m new file mode 100644 index 00000000..8cd803c8 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/configtabs.m @@ -0,0 +1,280 @@ +#include <lib/std.mi> +#include "attribs.m" + +function setTabs(int tabstate); +function setTabContent(int contentstate); + +function OpenDrawer(int animate); +function CloseDrawer(int animate); +function updateAttribs(); + +function ShowDrawer(); +function adjustSnapPoints(int DrawerOpen); + +Global Group frameGroup,PlayerMain,VideoVisGroup; +Global Group tabs,tEQon,tEQoff,tOPTIONSon,tOPTIONSoff,tCOLORTHEMESon,tCOLORTHEMESoff; +Global Group ContentEQ,ContentOPTIONS,ContentCOLORTHEMES; +Global Layer mouseLayerEQ,mouseLayerOPTIONS,mouseLayerCOLORTHEMES; +Global Button btnClose,btnOpen; +Global Group Drawer,DrawerShadow,DrawerContent; +Global GuiObject ColorThemes; +Global Layout main; +Global Int mychange; +Global Boolean loaded=0; +Global Timer deferred_opendrawer; + +System.onScriptLoaded() { + initAttribs(); + + frameGroup = getScriptGroup(); + main = frameGroup.getParentLayout(); + + tabs=frameGroup.findObject("config.tabs"); + tEQon=frameGroup.findObject("config.tab.eq.on"); + tEQoff=frameGroup.findObject("config.tab.eq.off"); + tOPTIONSon=frameGroup.findObject("config.tab.options.on"); + tOPTIONSoff=frameGroup.findObject("config.tab.options.off"); + tCOLORTHEMESon=frameGroup.findObject("config.tab.colorthemes.on"); + tCOLORTHEMESoff=frameGroup.findObject("config.tab.colorthemes.off"); + + ColorThemes=frameGroup.findObject("colorthemes"); + PlayerMain=frameGroup.findObject("player.main"); + VideoVisGroup = frameGroup.findObject("AVSGroup"); + + ContentEQ=frameGroup.findObject("player.normal.drawer.eq"); + ContentOPTIONS=frameGroup.findObject("player.normal.drawer.options"); + ContentCOLORTHEMES=frameGroup.findObject("player.normal.drawer.colorthemes"); + + mouseLayerEQ=frameGroup.findObject("mousetrapTabEQ"); + mouseLayerOPTIONS=frameGroup.findObject("mousetrapTabOPTIONS"); + mouseLayerCOLORTHEMES=frameGroup.findObject("mousetrapTabCOLORTHEMES"); + + btnClose = frameGroup.findObject("drawer.button.close"); + btnOpen = frameGroup.findObject("drawer.button.open"); + drawer = frameGroup.findObject("player.normal.drawer"); + DrawerShadow = frameGroup.findObject("player.normal.drawer.shadow"); + DrawerContent = frameGroup.findObject("player.normal.drawer.content"); + + int tabEQwidth=tEQon.getWidth(); + int tabOPTIONSwidth=tOPTIONSon.getWidth(); + + int tOPTIONSx=tabEQwidth-3; + int tCOLORTHEMESx=tabEQwidth+tabOPTIONSwidth-6; + + tOPTIONSon.setXmlParam("x",integertostring(tOPTIONSx)); + tOPTIONSoff.setXmlParam("x",integertostring(tOPTIONSx)); + tCOLORTHEMESoff.setXmlParam("x",integertostring(tCOLORTHEMESx)); + tCOLORTHEMESon.setXmlParam("x",integertostring(tCOLORTHEMESx)); + + mychange = 1; + setTabs(getPrivateInt("winamp5", "ConfigTab", 1)); + mychange = 0; + if (getPrivateInt("winamp5", "DrawerOpen", 0)) { + OpenDrawer(0); + adjustSnapPoints(1); + } else { + adjustSnapPoints(0); + } + loaded=1; + deferred_opendrawer = new Timer; + deferred_opendrawer.setDelay(250); +} + +System.onScriptUnloading() { + delete deferred_opendrawer; +} + +setTabs(int tabstate) { + + tEQon.hide(); + tOPTIONSon.hide(); + tCOLORTHEMESon.hide(); + + if (tabstate==1) { + tEQon.show(); + } + if (tabstate==2) { + tOPTIONSon.show(); + } + if (tabstate==3) { + tCOLORTHEMESon.show(); + } + + setTabContent(tabstate); + setPrivateInt("winamp5", "ConfigTab", tabstate); + updateAttribs(); +} + +setTabContent(int contentstate) { + if (contentstate==1) { + ContentEQ.show(); + ContentOPTIONS.hide(); + ContentCOLORTHEMES.hide(); + } + if (contentstate==2) { + ContentEQ.hide(); + ContentOPTIONS.show(); + ContentCOLORTHEMES.hide(); + } + if (contentstate==3) { + ContentEQ.hide(); + ContentOPTIONS.hide(); + ContentCOLORTHEMES.show(); + } +} + +mouseLayerEQ.onLeftButtonDown(int x, int y) { + setTabs(1); +} + +mouseLayerOPTIONS.onLeftButtonDown(int x, int y) { + setTabs(2); +} + +mouseLayerCOLORTHEMES.onLeftButtonDown(int x, int y) { + setTabs(3); +} + +OpenDrawer(int animate) { + btnOpen.hide(); + btnClose.show(); + main.beforeRedock(); + if (animate && scrollconfigdrawerattrib.getData() == "1") { + lockUI(); + drawer.setTargetX(drawer.getGuiX()); + drawer.setTargetY(-147); + drawer.setTargetW(drawer.getGuiW()); + drawer.setTargetH(drawer.getGuiH()); + drawer.setTargetSpeed(1); + drawer.gotoTarget(); + } else { + drawer.setXMLParam("y","-147"); + setPrivateInt("winamp5", "DrawerOpen", 1); + ColorThemes.show(); + adjustSnapPoints(1); + updateAttribs(); + main.Redock(); + } + DrawerShadow.show(); +// main.setXmlParam("minimum_h", "397"); +} + +closeDrawer(int animate) { + main.beforeRedock(); +// main.setXmlParam("minimum_h", "280"); + ColorThemes.hide(); + + btnClose.hide(); + btnOpen.show(); + if (animate && scrollconfigdrawerattrib.getData() == "1") { + lockUI(); + drawer.setTargetX(drawer.getGuiX()); + drawer.setTargetY(-263); + drawer.setTargetW(drawer.getGuiW()); + drawer.setTargetH(drawer.getGuiH()); + drawer.setTargetSpeed(1); + drawer.gotoTarget(); + } else { + drawer.setXMLParam("y","-263"); + DrawerShadow.hide(); + setPrivateInt("winamp5", "DrawerOpen", 0); + adjustSnapPoints(0); + updateAttribs(); + main.redock(); + } +} + +btnClose.onLeftClick() { + closeDrawer(1); +} + +btnOpen.onLeftClick() { + openDrawer(1); +} + +drawer.onTargetReached() { + if (btnClose.isVisible()) { + setPrivateInt("winamp5", "DrawerOpen", 1); + ColorThemes.show(); + adjustSnapPoints(1); + } else { + DrawerShadow.hide(); + setPrivateInt("winamp5", "DrawerOpen", 0); + adjustSnapPoints(0); + } + updateAttribs(); + main.redock(); + unlockUI(); +} + +ShowDrawer() { + drawer.setXmlParam("y", "-147"); + ColorThemes.show(); + btnOpen.hide(); + btnClose.show(); + DrawerShadow.show(); + adjustSnapPoints(1); +} + +adjustSnapPoints(int DrawerOpen) { + int menuHeight=0; + if (menubar_main_attrib.getData() == "0") menuHeight=17; + if (DrawerOpen) { + main.snapAdjust(0,0,0,0+menuHeight); + } else { + main.snapAdjust(0,0,0,116+menuHeight); + } +} + +menubar_main_attrib.onDataChanged() { + int menuHeight=0; + if (getData() == "0") menuHeight=17; + main.beforeRedock(); + int DrawerOpen=getPrivateInt("winamp5", "DrawerOpen", 0); + if (DrawerOpen) { + main.snapAdjust(0,0,0,0+menuHeight); + } else { + main.snapAdjust(0,0,0,116+menuHeight); + } + main.Redock(); +} + +main.onResize(int x, int y, int w, int h) { + int newXpos=w/2-163; + DrawerContent.setXmlParam("x",integertostring(newXpos)); +} + +eq_visible_attrib.onDataChanged() { + if (mychange) return; + mychange = 1; + if (getData() == "1") { + main.getContainer().switchToLayout("normal"); // instead of main.show(), or linkwidth wont work + deferred_opendrawer.start(); + } if (getData() == "0") { + closeDrawer(1); + } + mychange = 0; +} + +deferred_opendrawer.onTimer() { + stop(); + setTabs(1); + if (btnOpen.isVisible()) openDrawer(1); +} + +updateAttribs() { + if (mychange) return; + mychange = 1; + if (tabstate == 1 && !btnOpen.isVisible()) eq_visible_attrib.setData("1"); else eq_visible_attrib.setData("0"); + mychange = 0; +} + +System.onKeyDown(String key) { + if (key == "alt+g") { + if (eq_visible_attrib.getData() == "0") + eq_visible_attrib.setData("1"); + else + eq_visible_attrib.setData("0"); + complete; + } +} diff --git a/Src/resources/skins/Winamp Modern/scripts/configtabs.maki b/Src/resources/skins/Winamp Modern/scripts/configtabs.maki Binary files differnew file mode 100644 index 00000000..d12d33d0 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/configtabs.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/configtarget.m b/Src/resources/skins/Winamp Modern/scripts/configtarget.m new file mode 100644 index 00000000..2aad82e2 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/configtarget.m @@ -0,0 +1,97 @@ +#include <lib/std.mi> + +// ------------------------------------------------------------------------------------ +Global GuiObject target; +Global ComponentBucket buck; +// ------------------------------------------------------------------------------------ +Function turnAllOffExcept(GuiObject except); +Function turnOn(GuiObject obj); +Function turnOff(GuiObject obj); +// ------------------------------------------------------------------------------------ + + +// ------------------------------------------------------------------------------------ +// init +// ------------------------------------------------------------------------------------ +System.onScriptLoaded() { + target = getScriptGroup().findObject("skin.config.target"); + buck = getScriptGroup().findObject("my.bucket"); + + // turn off all + GuiObject o = NULL; + turnAllOffExcept(o); +} + +// ------------------------------------------------------------------------------------ +// save scroller position +// ------------------------------------------------------------------------------------ +System.onScriptUnloading() { + if (buck) { + setPrivateInt("configmenu", "last_scroll", buck.getScroll()); + } +} + +// ------------------------------------------------------------------------------------ +// turn on last open +// ------------------------------------------------------------------------------------ +buck.onStartup() { + setScroll(getPrivateInt("configmenu", "last_scroll", 0)); + Group g = buck.enumChildren(getPrivateInt("configmenu", "last_page", 0)); + if (!g) g = buck.enumChildren(0); + if (!g) return; + ToggleButton btn = g.getObject("btn"); + if (btn) btn.leftClick(); +} + +// ------------------------------------------------------------------------------------ +// this is called by the bucket button to switch to a new group +// ------------------------------------------------------------------------------------ +target.onAction(String action, String param, int x, int y, int p1, int p2, GuiObject source) { + if (getToken(action,";",0) == "switchto") { + String grp = getToken(action, ";", 1); + String is_subpage = getToken(action, ";", 2); + target.setXmlParam("groupid", grp); + + if (is_subpage!="subpage") turnAllOffExcept(source.getParent()); // getParent because the source is the button itself, the parent is the whole group item in the bucket + } +} + +// ------------------------------------------------------------------------------------ +// turn off all buttons except for the parameter, also save last_page param based on param item +// ------------------------------------------------------------------------------------ +turnAllOffExcept(GuiObject except) { + if (!buck) return; + int i=0; + // enumerate all inserted groups, turn them off if they're not our exception + while (i<buck.getNumChildren()) { + GuiObject obj = buck.enumChildren(i); + if (obj == except) { // otherwise record last page + setPrivateInt("configmenu", "last_page", i); + i++; + continue; + } + if (obj == NULL) { break; } // shoundnt happen + turnOff(obj); + i++; + } + // turn on the clicked item + if (except) turnOn(except); +} + +// ------------------------------------------------------------------------------------ +turnOn(GuiObject obj) { + Group gobj = obj; + + // otherwise we just need this : + ToggleButton tg = gobj.getObject("btn"); + tg.setActivated(1); +} + +// ------------------------------------------------------------------------------------ +turnOff(GuiObject obj) { + Group gobj = obj; + + // otherwise we just need this : + ToggleButton tg = gobj.getObject("btn"); + tg.setActivated(0); +} diff --git a/Src/resources/skins/Winamp Modern/scripts/configtarget.maki b/Src/resources/skins/Winamp Modern/scripts/configtarget.maki Binary files differnew file mode 100644 index 00000000..a2cc4f18 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/configtarget.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/crossfade.m b/Src/resources/skins/Winamp Modern/scripts/crossfade.m new file mode 100644 index 00000000..9c915997 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/crossfade.m @@ -0,0 +1,55 @@ +#include <lib/std.mi> + +Global Group frameGroup; +Global Slider slidercb; +Global Text fadertext; +Global Button CFIncrease, CFDecrease; +Global ToggleButton Crossfade; +Global Layer DisplayOverlay; + +System.onScriptLoaded() { + frameGroup = getScriptGroup(); + slidercb = frameGroup.findObject("sCrossfade"); + fadertext = frameGroup.findObject("CFDisplay"); + CFIncrease = frameGroup.findObject("CrossfadeIncrease"); + CFDecrease = frameGroup.findObject("CrossfadeDecrease"); + Crossfade = frameGroup.findObject("Crossfade"); + DisplayOverlay = frameGroup.findObject("crossfade.display.overlay"); + slidercb.onSetPosition(slidercb.getPosition()); + + Crossfade.onToggle(Crossfade.getActivated()); +} + +slidercb.onSetPosition(int val) { + String s = IntegerToString(val); + fadertext.setText(s); +} + +CFIncrease.onLeftClick() { + slidercb.SetPosition(slidercb.getPosition()+1); +} + +CFDecrease.onLeftClick() { + slidercb.SetPosition(slidercb.getPosition()-1); +} + +Crossfade.onToggle(boolean on) { + if (!on) + { + fadertext.setAlpha(150); + CFIncrease.setAlpha(150); + CFDecrease.setXmlParam("ghost" , "1"); + CFDecrease.setAlpha(150); + CFIncrease.setXmlParam("ghost" , "1"); + DisplayOverlay.show(); + } + else + { + fadertext.setAlpha(255); + CFIncrease.setAlpha(255); + CFDecrease.setAlpha(255); + CFIncrease.setXmlParam("ghost" , "0"); + CFDecrease.setXmlParam("ghost" , "0"); + DisplayOverlay.hide(); + } +}
\ No newline at end of file diff --git a/Src/resources/skins/Winamp Modern/scripts/crossfade.maki b/Src/resources/skins/Winamp Modern/scripts/crossfade.maki Binary files differnew file mode 100644 index 00000000..0a8289e3 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/crossfade.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/display.m b/Src/resources/skins/Winamp Modern/scripts/display.m new file mode 100644 index 00000000..0ed9e1ef --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/display.m @@ -0,0 +1,120 @@ +#include <lib/std.mi> +#include "attribs.m" + +Global Group frameGroup; +Global Togglebutton ShuffleBtn,RepeatBtn,ShuffleBtn2,RepeatBtn2; +Global Timer SongTickerTimer; +Global Text InfoTicker; +Global GuiObject SongTicker; +Global Slider Balance; +Global Layout normal; + +function setSongtickerScrolling(); + +System.onScriptLoaded() { + initAttribs(); + frameGroup = getScriptGroup(); + SongTicker = frameGroup.findObject("songticker"); + InfoTicker = frameGroup.findObject("infoticker"); + normal = frameGroup.getParentLayout(); + + SongTickerTimer = new Timer; + SongTickerTimer.setDelay(1000); + + RepeatBtn = frameGroup.findObject("Repeat"); + ShuffleBtn = frameGroup.findObject("Shuffle"); + RepeatBtn2 = frameGroup.findObject("RepeatDisplay"); + ShuffleBtn2 = frameGroup.findObject("ShuffleDisplay"); + + Balance = frameGroup.findObject("Balance"); + setSongtickerScrolling(); +} + +normal.onAction (String action, String param, Int x, int y, int p1, int p2, GuiObject source) +{ + if (strlower(action) == "showinfo") + { + SongTicker.hide(); + SongTickerTimer.start(); + InfoTicker.setText(param); + InfoTicker.show(); + + } + else if (strlower(action) == "cancelinfo") + { + SongTickerTimer.onTimer (); + } +} + +SongTickerTimer.onTimer() { + SongTicker.show(); + InfoTicker.hide(); + SongTickerTimer.stop(); +} + +System.onScriptUnloading() { + delete SongTickerTimer; +} + +Balance.onSetPosition(int newpos) +{ + string t=translate("Balance")+":"; + if (newpos==127) t+= " " + translate("Center"); + if (newpos<127) t += " " + integerToString((100-(newpos/127)*100))+"% "+translate("Left"); + if (newpos>127) t += " " + integerToString(((newpos-127)/127)*100)+"% "+translate("Right"); + + SongTickerTimer.start(); + SongTicker.hide(); + InfoTicker.show(); + InfoTicker.setText(t); +} + +RepeatBtn.onToggle(boolean on) { + SongTickerTimer.start(); + int v = getCurCfgVal(); + SongTicker.hide(); + InfoTicker.show(); + if (v == 0) InfoTicker.setText("Repeat: OFF"); + else if (v > 0) InfoTicker.setText("Repeat: ALL"); + else if (v < 0) InfoTicker.setText("Repeat: TRACK"); +} + +ShuffleBtn.onToggle(boolean on) { + SongTickerTimer.start(); + SongTicker.hide(); + InfoTicker.show(); + if (on) InfoTicker.setText("Playlist Shuffling: ON"); else InfoTicker.setText("Playlist Shuffling: OFF"); +} + +RepeatBtn2.onToggle(boolean on) { + SongTickerTimer.start(); + int v = getCurCfgVal(); + SongTicker.hide(); + InfoTicker.show(); + if (v == 0) InfoTicker.setText("Repeat: OFF"); + else if (v > 0) InfoTicker.setText("Repeat: ALL"); + else if (v < 0) InfoTicker.setText("Repeat: TRACK"); +} + +ShuffleBtn2.onToggle(boolean on) { + SongTickerTimer.start(); + SongTicker.hide(); + InfoTicker.show(); + if (on) InfoTicker.setText("Playlist Shuffling: ON"); else InfoTicker.setText("Playlist Shuffling: OFF"); +} + +songticker_scrolling_attrib.onDataChanged() { + setSongtickerScrolling(); +} + +setSongtickerScrolling() { + if (songticker_scrolling_modern_attrib.getData()=="1") { + SongTicker.setXMLParam("ticker","bounce"); + } + else if (songticker_scrolling_classic_attrib.getData()=="1") { + SongTicker.setXMLParam("ticker","scroll"); + } + else { + SongTicker.setXMLParam("ticker","off"); + } +}
\ No newline at end of file diff --git a/Src/resources/skins/Winamp Modern/scripts/display.maki b/Src/resources/skins/Winamp Modern/scripts/display.maki Binary files differnew file mode 100644 index 00000000..e9190556 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/display.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/drawer.m b/Src/resources/skins/Winamp Modern/scripts/drawer.m new file mode 100644 index 00000000..7e5c3698 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/drawer.m @@ -0,0 +1,1059 @@ +// ----------------------------------------------------------------------- +// Generic Video/Vis Application Drawer, by Nullsoft. +// +// Please #include this script, and override the appropriate events +// (see end of file), rather than modifying this script into your own +// version. +// +// *You should not have to edit this file*, it's just a bad idea, period. +// If you need something that is not supported in this version, we +// recommend that you contact Nullsoft to suggest the feature. +// +// Satisfying user experience depends on *fully working* scripts, if you +// insist on taking this file and modifying it for yourself, be sure to +// *thoroughly* test its behavior once you are done. +// +// If you do add a feature, please contact us so that your extention can +// be made available to others without each skin developper making its +// own (potentially broken) implementation. +// +// Note: this script requires mc 1.1.2+ to compile, and wa5.8+ to run. +// ----------------------------------------------------------------------- + +#ifndef included +#error This script can only be compiled as a #include +#endif + +#include <lib/std.mi> +#include <lib/config.mi> +#include <lib/winampconfig.mi> + +// call these -- the first two are mandatory +Function initDrawer(Layout lay, String id); // call in your onScriptLoaded(); +Function shutdownDrawer(); // call in your onScriptUnloading(); +Function openDrawer(); // opens the drawer to the last page unless video plays, in which case it opens to it. does animations according to attribs +Function openDrawerForVideo(); // opens the drawer to the video page, does animations according to attribs +Function openDrawerForVis(); // opens the drawer to the vis page, does animations according to attribs +Function openDrawerForNothing(); // opens the drawer without putting anything in it, does animations according to attribs +Function closeDrawer(); // closes the drawer, does animations according to attribs +Function detachVis(); +Function attachVis(); +Function detachVideo(); +Function attachVideo(); +Function switchToVis(); +Function switchToVideo(); +Function Int getDrawerState(); // returns OPEN or CLOSED +Function Int getDrawerContent(); // returns CONTENT_VIDEO, CONTENT_VIS or CONTENT_NOTHING +Function maximizeWindow(); +Function restoreWindow(); +Function Int isDrawerToTop(); // returns 1 if the drawer will open to the top or will close from the top, rather than the normal to/from bottom +// whenever the main window is resized while its drawer is closed, you should compute a new layout +// height for the next opening of the drawer, this will avoid opening to a gigantic height after +// closing a big video and resizing the player horizontally. return -1 if you do not want this feature +Function Int getDrawerOpenAutoHeight(int layoutwidth); + +// implement these -- mandatory +Function WindowHolder getVideoWindowHolder(); +Function WindowHolder getVisWindowHolder(); +Function Int getDrawerClosedHeight(); +Function Int getDefaultDrawerOpenHeight(); + +// override these -- optional +Function onBeforeOpeningDrawer(); +Function onBeforeClosingDrawer(); +Function onDoneOpeningDrawer(); +Function onDoneClosingDrawer(); +Function onShowVis(); +Function onHideVis(); +Function onShowVideo(); +Function onHideVideo(); +Function onAttachVideo(); +Function onDetachVideo(); +Function onAttachVis(); +Function onDetachVis(); +Function onBeforeMaximize(); +Function onAfterMaximize(); +Function onBeforeRestore(); +Function onAfterRestore(); +Function onCancelMaximize(); + +// bind these -- mandatory (they don't have to be exposed in the menus) +Global ConfigAttribute __drawer_directiontop_attrib; +Global ConfigAttribute __scrolldrawerattrib; +Global ConfigAttribute __drawer_directionbypass_attrib; +Global ConfigAttribute __vis_detach_attrib; +Global ConfigAttribute __video_detach_attrib; + +// ----------------------------------------------------------------------- + +#define VIDEO_GUID "{F0816D7B-FFFC-4343-80F2-E8199AA15CC3}" +#define VIS_GUID "{0000000A-000C-0010-FF7B-01014263450C}" + +// this is used to temporarilly disable playback stop on video window close, in case it's set +#define SKINTWEAKS_CFGPAGE "{0542AFA4-48D9-4c9f-8900-5739D52C114F}" + +// this is used to handle video auto fullscreen on play when the video window is attached to the drawer +#define VIDEO_CONFIG_GROUP "{2135E318-6919-4bcf-99D2-62BE3FCA8FA6}" + +#define DEBUG + +#ifdef FALSE +#undef FALSE +#endif +#define FALSE 0 +#ifdef TRUE +#undef TRUE +#endif +#define TRUE -1 + +#define CLOSED 0 +#define OPEN 1 + +#define DIRECTION_NONE 0 +#define DIRECTION_OPENING 1 +#define DIRECTION_CLOSING 2 + +#define CONTENT_NOTHING 0 +#define CONTENT_VIDEO 1 +#define CONTENT_VIS 2 + +#define DETACHED_VIS 1 +#define DETACHED_VIDEO 2 + +// avoid calling these functions directly. if you do so, be sure to know what +// you're doing, and to test your script thoroughly. + +Function drawer_expandWindow(int withdrawer); +Function drawer_reduceWindow(int withdrawer); +Function drawer_showWindowContent(); +Function drawer_hideWindowContent(); +Function drawer_hideVis(); +Function drawer_showVis(); +Function drawer_hideVideo(); +Function drawer_showVideo(); +Function drawer_dc_showVis(); +Function drawer_dc_showVideo(); +Function drawer_dc_hideVis(); +Function drawer_dc_hideVideo(); +Function drawer_dc_linkup_showVis(); +Function drawer_dc_linkup_showVideo(); +Function drawer_doDetachVis(); +Function drawer_doAttachVis(); +Function drawer_doDetachVideo(); +Function drawer_doAttachVideo(); +Function drawer_disablePSOVC(); +Function drawer_enablePSOVC(); +Function drawer_linkup_showVis(); +Function drawer_linkup_showVideo(); +Function drawer_doMaximizeWindow(int notif); + +Global Int __drawer_direction; + +Global Timer __callbackTimer; +Global Int __callback_vis_show, __callback_video_show, __callback_vis_hide, __callback_video_hide; +Global Timer __callbackTimer2; +Global Int __callback2_what; +Global Timer __PSOVCTimer; +Global Int __bypasscancel; +Global Int __isinited; +Global Int __play_auto_fs_video; + +Global Int __hiding_video, __hiding_vis, __showing_vis, __showing_video; +Global Int __last_forcedbottom, __last_forcedtop; +Global Timer __tempDisable; + +Global Layout __main; +Global Container __maincontainer; + +Global String __myname; +Global Int __windowshade_openvid; +Global Int __windowshade_openvis; + +Global int __maximized; +Global int __oldx,__oldy,__oldw,__oldh; + +// ----------------------------------------------------------------------- +initDrawer(Layout lay, String name) { + // todo: test all attribs assigned + + __isinited = 0; + __play_auto_fs_video = 0; + + __main = lay; + __maincontainer = __main.getContainer(); + + if (name == "") __myname = "Drawer"; + else __myname = name; + __drawer_direction = DIRECTION_NONE; + + drawer_hideVis(); + drawer_hideVideo(); + + __callbackTimer = new Timer; + __callbackTimer.setDelay(1); + __callbackTimer2 = new Timer; + __callbackTimer2.setDelay(1); + __PSOVCTimer = new Timer; + __PSOVCTimer.setDelay(1000); + __tempDisable = new Timer; + __tempDisable.setDelay(50); + + __maximized = getPrivateInt("winamp5", __myname+"Maximized", 0); + if (__maximized) { + onBeforeMaximize(); + onAfterMaximize(); + } + + __oldx=getPrivateInt("winamp5", __myname+"ox", 0); + __oldy=getPrivateInt("winamp5", __myname+"oy", 0); + __oldw=getPrivateInt("winamp5", __myname+"ow", 0); + __oldh=getPrivateInt("winamp5", __myname+"oh", 0); + __last_forcedtop = getPrivateInt("winamp5", __myname+"ForcedTop", 0); + __last_forcedbottom = getPrivateInt("winamp5", __myname+"ForcedBottom", 0); +} + +// ----------------------------------------------------------------------- +shutdownDrawer() { + delete __callbackTimer; + delete __callbackTimer2; + delete __PSOVCTimer; + delete __tempDisable; +} + +// ----------------------------------------------------------------------- +Int isDrawerToTop() { + int fromtop = 0; + if (__drawer_directiontop_attrib.getData() =="1") fromtop = 1; + if (__drawer_directionbypass_attrib.getData() == "0") return fromtop; + + int curstate = getPrivateInt("winamp5", __myname+"OpenState", CLOSED); + if (curstate != CLOSED) return __last_forcedtop; + + int h=getPrivateInt("winamp5", __myname+"Height", getDefaultDrawerOpenHeight()); + if (h == getDrawerClosedHeight()) h = getDefaultDrawerOpenHeight(); + if (__maximized) h = getViewportHeight()+__main.getSnapAdjustBottom(); + + __last_forcedbottom = 0; + __last_forcedtop = 0; + + // clienttoscreen auto adjusts for render ratio + if (fromtop) { + int y = __main.getGuiY(); + int curh = __main.clientToScreenH(__main.getGuiH()); + if (y + curh < __main.clientToScreenH(h) + getViewportTop()) { + int offset = __main.getSnapAdjustBottom(); + if (!(y + __main.clientToScreenH(h-offset) > getViewPortTop()+getViewPortHeight())) { + __last_forcedbottom = 1; + return 0; + } + } + } else { + int offset = __main.getSnapAdjustBottom(); + int y = __main.getGuiY(); + if (y + __main.clientToScreenH(h-offset) > getViewPortTop()+getViewPortHeight()) { + int curh = __main.clientToScreenH(__main.getGuiH()); + if (!(y + curh < __main.clientToScreenH(h) + getViewportTop())) { + __last_forcedtop = 1; + return 1; + } + } + } + return fromtop; +} + +// ----------------------------------------------------------------------- +__main.onTargetReached() { + unlockUI(); + if (__drawer_directiontop_attrib.getData() =="1") __main.reverseTarget(0); + if (__drawer_direction == DIRECTION_OPENING) { + setPrivateInt("winamp5", __myname+"OpenState", OPEN); + drawer_showWindowContent(); + onDoneOpeningDrawer(); + } else if (__drawer_direction == DIRECTION_CLOSING) { + setPrivateInt("winamp5", __myname+"OpenState", CLOSED); + onDoneClosingDrawer(); + } + __drawer_direction = DIRECTION_NONE; +} + +// ----------------------------------------------------------------------- +drawer_expandWindow(int withdrawer) { + int curstate = getPrivateInt("winamp5", __myname+"OpenState", CLOSED); +#ifdef DEBUG + debugstring("expand - curstate = " + integertostring(curstate), 0); +#endif + if (curstate == OPEN) { + drawer_showWindowContent(); + onBeforeOpeningDrawer(); + onDoneOpeningDrawer(); + return; + } + int fromtop = isDrawerToTop(); + setPrivateInt("winamp5", __myname+"OpenState", OPEN); + + int h=getPrivateInt("winamp5", __myname+"Height", getDefaultDrawerOpenHeight()); + if (h == getDrawerClosedHeight()) h = getDefaultDrawerOpenHeight(); + if (__maximized) h = getViewportHeight()+__main.getSnapAdjustBottom(); + int w = __main.getGuiW(); + + if (h == __main.getHeight()) withdrawer = 0; + + onBeforeOpeningDrawer(); + + int delay = 0; + if (!__main.isLayoutAnimationSafe()) withdrawer = 0; + if (withdrawer && StringToInteger(__scrolldrawerattrib.getData())) delay = 1; + + __drawer_direction = DIRECTION_OPENING; + __main.setTargetX(__main.getGuiX()); + __main.setTargetY(__main.getGuiY()); + __main.setTargetW(w); + __main.setTargetH(h); + __main.reverseTarget(fromtop); + __main.setTargetSpeed(delay); + __main.gotoTarget(); + lockUI(); + + if (!__maximized) + setPrivateInt("winamp5", __myname+"Height", h); + setPrivateInt("winamp5", __myname+"ForcedBottom", __last_forcedBottom); + setPrivateInt("winamp5", __myname+"ForcedTop", __last_forcedtop); +} + +// ----------------------------------------------------------------------- +drawer_reduceWindow(int withdrawer) { +#ifdef DEBUG + debugstring("reduce", 0); +#endif + drawer_hideVis(); + drawer_hideVideo(); + setPrivateInt("winamp5", __myname+"OpenState", CLOSED); + if (__drawer_direction == DIRECTION_NONE && !__maximized) { // avoid saving new size if we're currenly opening + int h=__main.getHeight(); + setPrivateInt("winamp5", __myname+"Height", h); + } + + drawer_hideWindowContent(); + onBeforeClosingDrawer(); + + int fromtop=0; + if (__drawer_directiontop_attrib.getData() =="1") fromtop = 1; + + int delay = 0; + if (!__main.isLayoutAnimationSafe()) withdrawer = 0; + if (withdrawer && StringToInteger(__scrolldrawerattrib.getData())) delay = 1; + + if (__drawer_directionbypass_attrib.getData() == "1") { + if (__last_forcedtop) fromtop = 1; + if (__last_forcedbottom) fromtop = 0; + } + + __drawer_direction = DIRECTION_CLOSING; + __main.setTargetX(__main.getGuiX()); + __main.setTargetY(__main.getGuiY()); + __main.setTargetW(__main.getGuiW()); + __main.setTargetH(getDrawerClosedHeight()); + __main.reverseTarget(fromtop); + __main.setTargetSpeed(delay); + __main.gotoTarget(); + lockUI(); + __last_forcedtop = 0; + __last_forcedbottom = 0; + setPrivateInt("winamp5", __myname+"ForcedBottom", 0); + setPrivateInt("winamp5", __myname+"ForcedTop", 0); +} + +// ----------------------------------------------------------------------- +openDrawer() { + if (__tempDisable.isRunning()) return; + __tempDisable.start(); + int s = getStatus(); + if (s == STATUS_PLAYING || s == STATUS_PAUSED) { + if (!isVideo()) { + if (__vis_detach_attrib.getData() == "0") { + openDrawerForVis(); + } else if (__video_detach_attrib.getData() == "0") { + openDrawerForVideo(); + } else { + openDrawerForNothing(); + } + } else { + if (__video_detach_attrib.getData() == "0") { + openDrawerForVideo(); + } else if (__vis_detach_attrib.getData() == "0") { + openDrawerForVis(); + } else { + openDrawerForNothing(); + } + } + } else { + int Window_Content=getPrivateInt("winamp5", __myname+"State", CONTENT_VIS); + if (window_content == CONTENT_VIS && __vis_detach_attrib.getData() == "0") { + openDrawerForVis(); + } else if (window_content == CONTENT_VIDEO && __video_detach_attrib.getData() == "0") { + openDrawerForVideo(); + } else if (__vis_detach_attrib.getData() == "0") { + openDrawerForVis(); + } else if (__video_detach_attrib.getData() == "0") { + openDrawerForVideo(); + } else { + openDrawerForNothing(); + } + } +} + +// ----------------------------------------------------------------------- +closeDrawer() { + drawer_reduceWindow(1); +} + +// ----------------------------------------------------------------------- +System.onPlay() { + // needed to handle video auto fullscreen on play in drawer_showVideo() + WinampConfigGroup vidwcg = WinampConfig.getGroup(VIDEO_CONFIG_GROUP); + boolean auto_fs = vidwcg.getBool("auto_fs"); + if (auto_fs && __video_detach_attrib.getData() == "0") __play_auto_fs_video = 1; + else __play_auto_fs_video = 0; +} + +System.onTitleChange(String newtitle) { + // needed to handle video auto fullscreen on play in drawer_showVideo() + WinampConfigGroup vidwcg = WinampConfig.getGroup(VIDEO_CONFIG_GROUP); + boolean auto_fs = vidwcg.getBool("auto_fs"); + if (auto_fs && __video_detach_attrib.getData() == "0") __play_auto_fs_video = 1; + else __play_auto_fs_video = 0; +} + +// ----------------------------------------------------------------------- +System.onPause() { + __play_auto_fs_video = 0; +} + +// ----------------------------------------------------------------------- +System.onResume() { + __play_auto_fs_video = 0; +} + +// ----------------------------------------------------------------------- +System.onStop() { + __play_auto_fs_video = 0; +} + +// ----------------------------------------------------------------------- +// The heart of the machine, here we detect when a window wants to open +// or close, and we decide what to do about it. When we return FALSE, the +// window performs what it notified us about. When we return TRUE, the +// showing/hiding of the window is cancelled, and it is now up to us to +// show or hide the window once we're done with our animations. +// To show the window ourselves, we later show a windowholder with the +// autoopen="1" param, and to hide the window, we simply hide the +// windowholder, and its autoclose="1" param will do the rest +// ----------------------------------------------------------------------- +System.onGetCancelComponent(String guid, boolean goingvisible) { +#ifdef DEBUG + DebugString("+", 0); +#endif + + // fix for when the UI sometimes is locked after switching video file in fullscreen + unlockUI(); + + // isVideo() hasn't been set yet in System.onPlay and System.onTitleChange, so we check it here instead. + if (__play_auto_fs_video && !isVideo()) __play_auto_fs_video = 0; + + if (__bypasscancel) return FALSE; + if (guid == VIDEO_GUID && !goingvisible && __hiding_video) return FALSE; + if (guid == VIS_GUID && !goingvisible && __hiding_vis) return FALSE; + if (guid == VIDEO_GUID && goingvisible && __showing_video) return FALSE; + if (guid == VIS_GUID && goingvisible && __showing_vis) return FALSE; + +#ifdef DEBUG + DebugString("--------------- onGetCancelComponent ----------------", 0); + DebugString(" GUID : " + guid, 0); + if (goingvisible) DebugString(" Going Visible", 0); else DebugString(" Going Invisible", 0); + DebugString(" Last Content : " + IntegerToString(getPrivateInt("winamp5", __myname+"State", CONTENT_VIS)), 0); + DebugString(" Drawer State : " + IntegerToString(getPrivateInt("winamp5", __myname+"OpenState", CLOSED)), 0); + DebugString("-----------------------------------------------------", 0); +#endif + + if (!__main.isVisible()) return FALSE; + + int Window_Content=getPrivateInt("winamp5", __myname+"State", CONTENT_VIS); + int window_status =getPrivateInt("winamp5", __myname+"OpenState", CLOSED); + + if (window_status == CLOSED) { + if (guid == VIDEO_GUID) { + if (__video_detach_attrib.getData() == "0") { + if (goingvisible) { + openDrawerForVideo(); + return TRUE; + } + } + } + if (guid == VIS_GUID) { + if (__vis_detach_attrib.getData() == "0") { + if (goingvisible) { + openDrawerForVis(); + return TRUE; + } + } + } + } else if (window_status == OPEN) { + if (goingvisible) { + if (guid == VIDEO_GUID && window_content == CONTENT_VIS) { + if (__video_detach_attrib.getData() == "0") { + window_content = CONTENT_VIDEO; + drawer_hideVis(); + drawer_dc_showVideo(); + return TRUE; + } + } else if (guid == VIS_GUID && window_content == CONTENT_VIDEO) { + if (__vis_detach_attrib.getData() == "0") { + window_content = CONTENT_VIS; + drawer_disablePSOVC(); + drawer_hideVideo(); + drawer_dc_showVis(); + return TRUE; + } + } + } + } + if (!goingvisible && window_status == OPEN) { +#ifdef DEBUG + DebugString("closing " + guid, 0); +#endif + if (guid == VIDEO_GUID && window_content == CONTENT_VIDEO) { + drawer_hideVideo(); + drawer_reduceWindow(1); + return FALSE; + } + if (guid == VIS_GUID && window_content == CONTENT_VIS) { + drawer_hideVis(); + if ((getStatus() == STATUS_PLAYING || + getStatus() == STATUS_PAUSED) && + isVideo() && + __video_detach_attrib.getData() == "0") { + drawer_dc_showVideo(); + } else { + drawer_reduceWindow(1); + } + return FALSE; + } + } +#ifdef DEBUG + DebugString("Went thru", 0); +#endif + return FALSE; +} + +// ----------------------------------------------------------------------- +drawer_showVis() { +#ifdef DEBUG + DebugString("drawer_showVis",0 ); +#endif + __showing_vis = 1; + setPrivateInt("winamp5", __myname+"OpenState", OPEN); + setPrivateInt("winamp5", __myname+"State", CONTENT_VIS); + GuiObject o = getVisWindowHolder(); + if (o != NULL) { __bypasscancel = 1; o.show(); __bypasscancel = 0; } +#ifdef DEBUG + else DebugString("vis object not provided (show)", 0); +#endif + onShowVis(); + __showing_vis = 0; +} + +// ----------------------------------------------------------------------- +drawer_hideVis() { + __callback_vis_show = 0; +#ifdef DEBUG + DebugString("drawer_hideVis",0 ); +#endif + __hiding_vis = 1; + GuiObject o = getVisWindowHolder(); + if (o != NULL) { __bypasscancel = 1; o.hide(); __bypasscancel = 0; } +#ifdef DEBUG + else DebugString("video object not found (hide)", 0); +#endif + onHideVis(); + __hiding_vis = 0; +} + +// ----------------------------------------------------------------------- +drawer_showVideo() { +#ifdef DEBUG + DebugString("drawer_showVideo",0 ); +#endif + __showing_video = 1; + setPrivateInt("winamp5", __myname+"OpenState", OPEN); + setPrivateInt("winamp5", __myname+"State", CONTENT_VIDEO); + GuiObject o = getVideoWindowHolder(); + if (o != NULL) { + __bypasscancel = 1; + + // hack to fix bug for auto fullscreen on play + if (__play_auto_fs_video) setVideoFullscreen(FALSE); + + o.show(); + + // hack to fix bug for auto fullscreen on play + if (__play_auto_fs_video) setVideoFullscreen(TRUE); + + __bypasscancel = 0; + } +#ifdef DEBUG + else DebugString("vis object not found (show)", 0); +#endif + onShowVideo(); + __play_auto_fs_video = 0; + __showing_video = 0; +} + +// ----------------------------------------------------------------------- +drawer_hideVideo() { + __callback_video_show = 0; +#ifdef DEBUG + DebugString("drawer_hideVideo",0 ); +#endif + __hiding_video = 1; + GuiObject o = getVideoWindowHolder(); + if (o != NULL) { __bypasscancel = 1; o.hide(); __bypasscancel = 0; } +#ifdef DEBUG + else DebugString("video object not found (hide)", 0); +#endif + onHideVideo(); + __hiding_video = 0; +} + +// ----------------------------------------------------------------------- +__callbackTimer.onTimer() { + stop(); + int cvds = __callback_video_show; + int cvss = __callback_vis_show; + int cvdh = __callback_video_hide; + int cvsh = __callback_vis_hide; + __callback_video_show = 0; + __callback_vis_show = 0; + __callback_video_hide = 0; + __callback_vis_hide = 0; + if (cvds == 1) drawer_showVideo(); + if (cvss == 1) drawer_showVis(); + if (cvsh == 1) drawer_hideVis(); + if (cvdh == 1) drawer_hideVideo(); +} + +// ----------------------------------------------------------------------- +drawer_dc_showVideo() { + __callback_video_show = 1; + __callback_video_hide = 0; + __callbackTimer.start(); +} + +// ----------------------------------------------------------------------- +drawer_dc_showVis() { + __callback_vis_show = 1; + __callback_vis_hide = 0; + __callbackTimer.start(); +} + +// ----------------------------------------------------------------------- +drawer_dc_hideVideo() { + __callback_video_show = 0; + __callback_video_hide = 1; + __callbackTimer.start(); +} + +// ----------------------------------------------------------------------- +drawer_dc_hideVis() { + __callback_vis_show = 0; + __callback_vis_hide = 1; + __callbackTimer.start(); +} + +// ----------------------------------------------------------------------- +drawer_showWindowContent() { + int lastWindowContent=getPrivateInt("winamp5", __myname+"State", 2); +#ifdef DEBUG + DebugString("drawer_showWindowContent = " + IntegerToString(lastWindowContent), 0); +#endif + if (lastWindowContent==CONTENT_VIDEO) drawer_dc_showVideo(); + if (lastWindowContent==CONTENT_VIS) drawer_dc_showVis(); +} + +// ----------------------------------------------------------------------- +drawer_hideWindowContent() { + int lastWindowContent=getPrivateInt("winamp5", __myname+"State", 2); +#ifdef DEBUG + DebugString("drawer_hideWindowContent = " + IntegerToString(lastWindowContent), 0); +#endif + /*if (lastWindowContent==CONTENT_VIDEO)*/ drawer_hideVideo(); + /*if (lastWindowContent==CONTENT_VIS)*/ drawer_hideVis(); +} + +// ----------------------------------------------------------------------- +OpenDrawerForVideo() { + setPrivateInt("winamp5", __myname+"State", CONTENT_VIDEO); + drawer_expandWindow(1); +} + +// ----------------------------------------------------------------------- +OpenDrawerForVis() { + setPrivateInt("winamp5", __myname+"State", CONTENT_VIS); + drawer_expandWindow(1); +} + +// ----------------------------------------------------------------------- +OpenDrawerForNothing() { + setPrivateInt("winamp5", __myname+"State", CONTENT_NOTHING); + drawer_expandWindow(1); +} + +// ----------------------------------------------------------------------- +__main.onResize(int x, int y, int w, int h) { + if (!isGoingToTarget() && !__isinited) { + __isinited = 1; + if (h > getDrawerClosedHeight()) { setPrivateInt("winamp5", __myname+"OpenState", OPEN); drawer_expandWindow(0); } + else setPrivateInt("winamp5", __myname+"OpenState", CLOSED); + } +} + +// ----------------------------------------------------------------------- +__main.onUserResize(int x, int y, int w, int h) { + int window_status=getPrivateInt("winamp5", __myname+"OpenState", CLOSED); + if (window_status == OPEN) { + int h = getHeight(); + if (h != getDrawerClosedHeight()) { +#ifdef DEBUG + DebugString("h = "+integerTostring(h), 0); +#endif + if (!__maximized) + setPrivateInt("winamp5", __myname+"Height", h); + } + } else if (window_status == CLOSED) { + int h = getDrawerOpenAutoHeight(w); + if (h != -1) { + setPrivateInt("winamp5", __myname+"Height", h); + } + } + if (__maximized) { + __maximized = 0; + setPrivateInt("winamp5", __myname+"Maximized", 0); + onCancelMaximize(); + } +} + +// ----------------------------------------------------------------------- +switchToVideo() { + if (__callbackTimer.isRunning()) return; + if (__callbackTimer2.isRunning()) return; + if (__tempDisable.isRunning()) return; + __tempDisable.start(); + drawer_hideVis(); + drawer_showVideo(); +} + +// ----------------------------------------------------------------------- +switchToVis() { + if (__callbackTimer.isRunning()) return; + if (__callbackTimer2.isRunning()) return; + if (__tempDisable.isRunning()) return; + __tempDisable.start(); + drawer_disablePSOVC(); + drawer_hideVideo(); + drawer_showVis(); +} + +// ----------------------------------------------------------------------- +__tempDisable.onTimer() { + stop(); +} + +// ----------------------------------------------------------------------- +detachVis() { + if (__tempDisable.isRunning()) return; + __tempDisable.start(); + __vis_detach_attrib.setData("1"); +} + +// ----------------------------------------------------------------------- +detachVideo() { + if (__tempDisable.isRunning()) return; + __tempDisable.start(); + __video_detach_attrib.setData("1"); +} + +// ----------------------------------------------------------------------- +attachVis() { + if (__tempDisable.isRunning()) return; + __tempDisable.start(); + __vis_detach_attrib.setData("0"); +} + +// ----------------------------------------------------------------------- +attachVideo() { + if (__tempDisable.isRunning()) return; + __tempDisable.start(); + __video_detach_attrib.setData("0"); +} + +// ----------------------------------------------------------------------- +__video_detach_attrib.onDataChanged() { +#ifdef DEBUG + DebugString("detach video changed", 0); +#endif + if (getData() == "1") { + drawer_doDetachVideo(); + onDetachVideo(); + } else { + if (getData() == "0") { + drawer_doAttachVideo(); + onAttachVideo(); + } + } +} + +// ----------------------------------------------------------------------- +__vis_detach_attrib.onDataChanged() { +#ifdef DEBUG + DebugString("detach vis changed", 0); +#endif + if (getData() == "1") { + drawer_doDetachVis(); + onDetachVis(); + } else { + if (getData() == "0") { + drawer_doAttachVis(); + onAttachVis(); + } + } +} + +// ----------------------------------------------------------------------- +drawer_doDetachVideo() { + int wasvisible = isNamedWindowVisible(VIDEO_GUID); + int lastWindowContent=getPrivateInt("winamp5", __myname+"State", 2); + int window_status =getPrivateInt("winamp5", __myname+"OpenState", CLOSED); + if (!wasvisible) return; + if (lastWindowContent != CONTENT_VIDEO) return; + if (window_status == OPEN) { + drawer_disablePSOVC(); + drawer_reduceWindow(1); + } + drawer_dc_linkup_showVideo(); +} + +// ----------------------------------------------------------------------- +drawer_doDetachVis() { + int lastWindowContent=getPrivateInt("winamp5", __myname+"State", 2); + int window_status =getPrivateInt("winamp5", __myname+"OpenState", CLOSED); + if (lastWindowContent != CONTENT_VIS) return; + int wasvisible = isNamedWindowVisible(VIS_GUID); + if (!wasvisible) return; + if (window_status == OPEN) { + drawer_hideVis(); + if ((getStatus() == STATUS_PLAYING || + getStatus() == STATUS_PAUSED) && isVideo() && + __video_detach_attrib.getData() == "0") { + setPrivateInt("winamp5", __myname+"State", CONTENT_VIDEO); + drawer_dc_showVideo(); + } else { + drawer_reduceWindow(1); + } + } + drawer_dc_linkup_showVis(); +} + +// ----------------------------------------------------------------------- +drawer_doAttachVideo() { + drawer_disablePSOVC(); + int wasvisible = isNamedWindowVisible(VIDEO_GUID); + if (wasvisible) { + hideNamedWindow(VIDEO_GUID); + int window_status =getPrivateInt("winamp5", __myname+"OpenState", CLOSED); + int window_content=getPrivateInt("winamp5", __myname+"State", 2); + if (window_content == CONTENT_VIS) drawer_hideVis(); + if (window_status == CLOSED) openDrawerForVideo(); + else drawer_dc_showVideo(); + } +} + +// ----------------------------------------------------------------------- +drawer_doAttachVis() { + drawer_disablePSOVC(); + int wasvisible = isNamedWindowVisible(VIS_GUID); + if (wasvisible) { + hideNamedWindow(VIS_GUID); + int window_status =getPrivateInt("winamp5", __myname+"OpenState", CLOSED); + int window_content=getPrivateInt("winamp5", __myname+"State", 2); + if (window_content == CONTENT_VIDEO) drawer_hideVideo(); + if (window_status == CLOSED) openDrawerForVis(); + else drawer_dc_showVis(); + } +} + +// ----------------------------------------------------------------------- +__callbackTimer2.onTimer() { + stop(); + if (__callback2_what == DETACHED_VIDEO) drawer_linkup_showVideo(); + if (__callback2_what == DETACHED_VIS) drawer_linkup_showVis(); +} + +// ----------------------------------------------------------------------- +drawer_dc_linkup_showVis() { + __callback2_what = DETACHED_VIS; + __callbackTimer2.start(); +} + +// ----------------------------------------------------------------------- +drawer_dc_linkup_showVideo() { + __callback2_what = DETACHED_VIDEO; + __callbackTimer2.start(); +} + +// ----------------------------------------------------------------------- +drawer_linkup_showVis() { +#ifdef DEBUG + DebugString("show detached vis",0 ); +#endif + showWindow(VIS_GUID, "", 0); +} + +// ----------------------------------------------------------------------- +drawer_linkup_showVideo() { +#ifdef DEBUG + DebugString("show detached video",0 ); +#endif + showWindow(VIDEO_GUID, "", 0); + drawer_enablePSOVC(); +} + +// ----------------------------------------------------------------------- +drawer_disablePSOVC() { +#ifdef DEBUG + DebugString("disabling stop on video close",0 ); +#endif + ConfigItem item = Config.getItem(SKINTWEAKS_CFGPAGE); + if (item) { + ConfigAttribute attr = item.getAttribute("Prevent video playback Stop on video window Close"); + if (attr) attr.setData("1"); + } + __PSOVCTimer.start(); +} + +// ----------------------------------------------------------------------- +drawer_enablePSOVC() { +#ifdef DEBUG + DebugString("enabling stop on video close",0 ); +#endif + __PSOVCTimer.stop(); + ConfigItem item = Config.getItem(SKINTWEAKS_CFGPAGE); + if (item) { + ConfigAttribute attr = item.getAttribute("Prevent video playback Stop on video window Close"); + if (attr) attr.setData("0"); + } +} + +// ----------------------------------------------------------------------- +__PSOVCTimer.onTimer() { + drawer_enablePSOVC(); +} + +// ----------------------------------------------------------------------- +__maincontainer.onBeforeSwitchToLayout(Layout oldl, Layout newl) { + int window_status =getPrivateInt("winamp5", __myname+"OpenState", CLOSED); + int window_content=getPrivateInt("winamp5", __myname+"State", 2); + if (oldl == __main && window_status == OPEN && window_content == CONTENT_VIDEO && getStatus() == STATUS_PLAYING && isVideo()) { + drawer_disablePSOVC(); + __windowshade_openvid = 1; + } + if (oldl == __main && window_status == OPEN && window_content == CONTENT_VIS) { + __windowshade_openvis = 1; + } +} + +// ----------------------------------------------------------------------- +__maincontainer.onSwitchToLayout(Layout newl) { + // these do not call drawer_doDetachVis or drawer_doDetachVideo but showDetachVis and showDetachVideo so that the change is temporary + if (__windowshade_openvid) { + __windowshade_openvid = 0; + drawer_linkup_showVideo(); + } + if (__windowshade_openvis) { + __windowshade_openvis = 0; + drawer_linkup_showVis(); + } +} + +// ----------------------------------------------------------------------- +Int getDrawerState() { + return getPrivateInt("winamp5", __myname+"OpenState", CLOSED); +} + +// ----------------------------------------------------------------------- +Int getDrawerContent() { + return getPrivateInt("winamp5", __myname+"State", CONTENT_VIS); +} + +// ----------------------------------------------------------------------- +maximizeWindow() { + __oldx=__main.getGuiX(); + __oldy=__main.getGuiY(); + __oldw=__main.getGuiW(); + __oldh=__main.getGuiH(); + + setPrivateInt("winamp5", __myname+"ox", __oldx); + setPrivateInt("winamp5", __myname+"oy", __oldy); + setPrivateInt("winamp5", __myname+"ow", __oldw); + setPrivateInt("winamp5", __myname+"oh", __oldh); + + drawer_doMaximizeWindow(1); +} + +// ----------------------------------------------------------------------- +drawer_doMaximizeWindow(int notif) { + int vx=getViewportLeft(); + int vy=getViewportTop(); + int vw=getViewportWidth(); + int vh=getViewportHeight(); + + if (notif) onBeforeMaximize(); + __maximized = 1; + setPrivateInt("winamp5", __myname+"Maximized", 1); + __main.resize(vx, vy, vw, vh+__main.getSnapAdjustBottom()); + if (notif) onAfterMaximize(); +} + +// ----------------------------------------------------------------------- +__main.onSnapAdjustChanged() { + if (__maximized) + drawer_doMaximizeWindow(0); +} + +// ----------------------------------------------------------------------- +restoreWindow() { + onBeforeRestore(); + __maximized = 0; + setPrivateInt("winamp5", __myname+"Maximized", 0); + __main.resize(__oldx, __oldy, __oldw, __oldh); + onAfterRestore(); +} + +// ----------------------------------------------------------------------- +// default events implementations - override them in your script +// ----------------------------------------------------------------------- +onBeforeOpeningDrawer() {} +onBeforeClosingDrawer() {} +onDoneOpeningDrawer() {} +onDoneClosingDrawer() {} +onShowVis() {} +onHideVis() {} +onShowVideo() {} +onHideVideo() {} +onAttachVideo() {} +onDetachVideo() {} +onAttachVis() {} +onDetachVis() {} +onBeforeMaximize() {} +onBeforeRestore() {} +onAfterMaximize() {} +onAfterRestore() {} +onCancelMaximize() {} diff --git a/Src/resources/skins/Winamp Modern/scripts/eq.m b/Src/resources/skins/Winamp Modern/scripts/eq.m new file mode 100644 index 00000000..8a062181 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/eq.m @@ -0,0 +1,90 @@ +#include <lib/std.mi> +#include <lib/winampconfig.mi> + +Global Group frameGroup, use; +Global Button btnEQp12,btnEQ0,btnEQm12; +Global Layer eqBand; +Global Boolean manual_set; + +Global Layout normal; + +#define ISOBANDS "31.5 Hz,63 Hz,125 Hz,250 Hz,500 Hz,1 KHz,2 KHz,4 KHz,8 KHz,16 KHz" +#define WINAMPBANDS "70 Hz,180 Hz,320 Hz,600 Hz,1 KHz,3 KHz,6 KHz,12 KHz,14 KHz,16 KHz" + +System.onScriptLoaded() { + WinampConfigGroup eqwcg = WinampConfig.getGroup("{72409F84-BAF1-4448-8211-D84A30A1591A}"); + int freqmode = eqwcg.getInt("frequencies"); // returns 0 for classical winamp levels, 1 for ISO levels + + frameGroup = getScriptGroup(); + normal = frameGroup.getParentLayout(); + btnEQp12 = frameGroup.findObject("EQ_p12"); + btnEQ0 = frameGroup.findObject("EQ_0"); + btnEQm12 = frameGroup.findObject("EQ_m12"); + eqBand = frameGroup.findObject("equalizer.band.label"); + + system.onEqFreqChanged(freqmode); +} + +btnEQp12.onLeftClick() { + manual_set = 1; + for(int i=0; i<10; i++) setEqBand(i, 127); + manual_set = 0; +} + +btnEQ0.onLeftClick() { + manual_set = 1; + for(int i=0; i<10; i++) setEqBand(i, 0); + manual_set = 0; +} + +btnEQm12.onLeftClick() { + manual_set = 1; + for(int i=0; i<10; i++) setEqBand(i, -127); + manual_set = 0; +} + +System.onEqFreqChanged (boolean isoonoff) +{ + if (isoonoff == 1) + { + eqBand.setXmlParam("image", "drawer.eq.label.iso"); + for(int i=0; i<10; i++) frameGroup.findObject("eq"+integerToString(i+1)).setXmlParam("tooltip", getToken(ISOBANDS,",",i)); + } + else + { + eqBand.setXmlParam("image", "drawer.eq.label.winamp"); + for(int i=0; i<10; i++) frameGroup.findObject("eq"+integerToString(i+1)).setXmlParam("tooltip", getToken(WINAMPBANDS,",",i)); + } +} + +system.onEqBandChanged(int band, int value) +{ + if (manual_set) return; + String t; + Float f = value; + f = f / 10.5; + WinampConfigGroup eqwcg = WinampConfig.getGroup("{72409F84-BAF1-4448-8211-D84A30A1591A}"); + if (eqwcg.getInt("frequencies") == 1) { + if (f >= 0) t = "EQ: " + translate(getToken(ISOBANDS,",",band)) + ": +" + floattostring(f, 1) + " "+ translate("dB"); + else t = "EQ: " + translate(getToken(ISOBANDS,",",band)) + ": " + floattostring(f, 1) + " "+ translate("dB"); + } + else { + if (f >= 0) t = "EQ: " + translate(getToken(WINAMPBANDS,",",band)) + ": +" + floattostring(f, 1) + " "+ translate("dB"); + else t = "EQ: " + translate(getToken(WINAMPBANDS,",",band)) + ": " + floattostring(f, 1) + " "+ translate("dB"); + } + + normal.sendAction("showinfo", t, 0,0,0,0); +} + +system.onEqPreampChanged(int value) +{ + slider s = getScriptGroup().findObject("preamp"); + value = s.getPosition(); // Somehow this function returns a range from [-127;125] with hotpos -3, so we take the slider instead + String t = "EQ: " + translate("Preamp:") + " "; + Float f = value; + f = f / 10.5; + if (f >= -3) t += "+"+floattostring(f, 1) + " "+ translate("dB"); + else t += floattostring(f, 1) + " "+ translate("dB"); + + normal.sendAction("showinfo", t, 0,0,0,0); +}
\ No newline at end of file diff --git a/Src/resources/skins/Winamp Modern/scripts/eq.maki b/Src/resources/skins/Winamp Modern/scripts/eq.maki Binary files differnew file mode 100644 index 00000000..da7663c6 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/eq.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/init_Playlist.m b/Src/resources/skins/Winamp Modern/scripts/init_Playlist.m new file mode 100644 index 00000000..bb5f41ba --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/init_Playlist.m @@ -0,0 +1,34 @@ +#ifndef included +#error This script can only be compiled as a #include +#endif + +#include "gen_pageguids.m" + + +Function initAttribs_Playlist(); + +#define COSTUM_PAGE_PLAYLIST "{0167CFD9-5D35-404a-8F03-80ED5B89DEDF}" + +Global ConfigAttribute playlist_search_attrib; + +initAttribs_Playlist(){ + initPages(); + + ConfigItem custom_page_playlist = addConfigSubMenu(optionsmenu_page, "Playlist", COSTUM_PAGE_PLAYLIST); + + playlist_search_attrib = custom_page_playlist.newAttribute("Show Playlist Search box", "1"); + //addMenuSeparator(custom_page_autoresize); +} + +#ifdef MAIN_ATTRIBS_MGR +/* +playlist_search_attrib.onDataChanged() +{ + if (attribs_mychange) return; + NOOFF + attribs_mychange = 1; + if (getData() == "1") playlist_search_attrib.setData("0"); + if (getData() == "0") playlist_search_attrib.setData("1"); + attribs_mychange = 0; +}*/ +#endif
\ No newline at end of file diff --git a/Src/resources/skins/Winamp Modern/scripts/mainmenu.m b/Src/resources/skins/Winamp Modern/scripts/mainmenu.m new file mode 100644 index 00000000..73efe5be --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/mainmenu.m @@ -0,0 +1,50 @@ +#include <lib/std.mi> +#include "attribs.m" + +System.onScriptLoaded() { + initAttribs(); + menubar_main_attrib.onDataChanged(); +} + +menubar_main_attrib.onDataChanged() { + Group Player = getscriptgroup().findobject("player.content.dummy.group"); + Group MenuBar = getscriptgroup().findobject("wasabi.menubar"); + if (getData() == "1") { + Player.setXmlParam("y","0"); + MenuBar.show(); + } else { + Player.setXmlParam("y","-17"); + MenuBar.hide(); + } +} + +System.onAccelerator(String action, String section, String key) { + if (menubar_main_attrib.getData() == "0") return; + Layout l = getScriptGroup().getParentLayout(); + if (!l.isActive()) return; + if (action == "MENUHOTKEY_FILE") + { + getScriptGroup().findObject("File.menu").sendAction("open", "", 0, 0, 0, 0); + complete; + } + if (action == "MENUHOTKEY_PLAY") + { + getScriptGroup().findObject("Play.menu").sendAction("open", "", 0, 0, 0, 0); + complete; + } + if (action == "MENUHOTKEY_OPTIONS") + { + getScriptGroup().findObject("Options.menu").sendAction("open", "", 0, 0, 0, 0); + complete; + } + if (action == "MENUHOTKEY_VIEW") + { + getScriptGroup().findObject("View.menu").sendAction("open", "", 0, 0, 0, 0); + complete; + } + if (action == "MENUHOTKEY_HELP") + { + getScriptGroup().findObject("Help.menu").sendAction("open", "", 0, 0, 0, 0); + complete; + } +}
\ No newline at end of file diff --git a/Src/resources/skins/Winamp Modern/scripts/mainmenu.maki b/Src/resources/skins/Winamp Modern/scripts/mainmenu.maki Binary files differnew file mode 100644 index 00000000..6bf1a69b --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/mainmenu.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/mainmenuoverlay.m b/Src/resources/skins/Winamp Modern/scripts/mainmenuoverlay.m new file mode 100644 index 00000000..fba5e658 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/mainmenuoverlay.m @@ -0,0 +1,25 @@ +#include <lib/std.mi> +#include "attribs.m" + +Function setOverlay(); + +Global Layer VideoVisTextOverlay; + +System.onScriptLoaded() { + initAttribs(); + VideoVisTextOverlay=getScriptGroup().findObject("menubar.right.textoverlay"); + setOverlay(); +} + +video_detach_attrib.onDataChanged() { + setOverlay(); +} + +vis_detach_attrib.onDataChanged() { + setOverlay(); +} + +setOverlay() { + if (vis_detach_attrib.getData() == "1" && video_detach_attrib.getData() == "1") VideoVisTextOverlay.hide(); + else VideoVisTextOverlay.show(); +}
\ No newline at end of file diff --git a/Src/resources/skins/Winamp Modern/scripts/mainmenuoverlay.maki b/Src/resources/skins/Winamp Modern/scripts/mainmenuoverlay.maki Binary files differnew file mode 100644 index 00000000..f07c1fb1 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/mainmenuoverlay.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/menualign.m b/Src/resources/skins/Winamp Modern/scripts/menualign.m new file mode 100644 index 00000000..b325c181 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/menualign.m @@ -0,0 +1,14 @@ +#include <lib/std.mi> + +System.onScriptLoaded() { + group sg = getScriptGroup(); + string params = getParam(); + int offset = 0; + + for (int a = 0; getToken(params,",",a) != ""; a++ ) + { + guiobject tmp = sg.getObject(getToken(params,",",a)); + tmp.setXMLparam("x",integertostring(offset)); + offset += tmp.getAutoWidth(); + } +}
\ No newline at end of file diff --git a/Src/resources/skins/Winamp Modern/scripts/menualign.maki b/Src/resources/skins/Winamp Modern/scripts/menualign.maki Binary files differnew file mode 100644 index 00000000..0709e016 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/menualign.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/mlmenu.m b/Src/resources/skins/Winamp Modern/scripts/mlmenu.m new file mode 100644 index 00000000..c558a089 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/mlmenu.m @@ -0,0 +1,50 @@ +#include <lib/std.mi> +#include "attribs.m" + +System.onScriptLoaded() { + initAttribs(); + menubar_ml_attrib.onDataChanged(); +} + +menubar_ml_attrib.onDataChanged() { + Group Player = getscriptgroup().findobject("player.content.ml.dummy.group"); + Group MenuBar = getscriptgroup().findobject("wasabi.menubar.ml"); + Layout main = getscriptgroup().getParentLayout(); + + main.beforeRedock(); + if (getData() == "1") { + Player.setXmlParam("y","17"); + MenuBar.show(); + main.snapAdjust(0,0,0,0); + } + else { + Player.setXmlParam("y","0"); + MenuBar.hide(); + main.snapAdjust(0,0,0,17); + } + main.Redock(); +} + +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 == "ML_MENUHOTKEY_FILE") + { + getScriptGroup().findObject("ML_File.menu").sendAction("open", "", 0, 0, 0, 0); + complete; + } + if (action == "MENUHOTKEY_VIEW" || action == "ML_MENUHOTKEY_VIEW") + { + getScriptGroup().findObject("ML_View.menu").sendAction("open", "", 0, 0, 0, 0); + complete; + } + if (action == "MENUHOTKEY_HELP" || action == "ML_MENUHOTKEY_HELP") + { + getScriptGroup().findObject("ML_Help.menu").sendAction("open", "", 0, 0, 0, 0); + complete; + } +}
\ No newline at end of file diff --git a/Src/resources/skins/Winamp Modern/scripts/mlmenu.maki b/Src/resources/skins/Winamp Modern/scripts/mlmenu.maki Binary files differnew file mode 100644 index 00000000..946a2460 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/mlmenu.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/mute.m b/Src/resources/skins/Winamp Modern/scripts/mute.m new file mode 100644 index 00000000..864286a0 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/mute.m @@ -0,0 +1,125 @@ +#include <lib/std.mi> + +Function updateVolume(int v); + +Global Group frameGroup; +Global Togglebutton MuteBtn,MuteBtnShade; +Global Timer SongTickerTimer; +Global Text InfoTicker; +Global GuiObject SongTicker; +Global Float VolumeLevel; +Global Boolean Muted,BtnPressed; +Global Layer volumebar; +Global Timer callback; + +System.onScriptLoaded() { + Muted = getPrivateInt("winamp5", "muted", 0); + VolumeLevel = getPrivateInt("winamp5", "old_volume", 0); + frameGroup = getScriptGroup(); + + MuteBtn = frameGroup.findObject("mute"); + MuteBtn.setActivated(Muted); + + callback = new Timer; callback.setDelay(5); callback.start(); + SongTicker = frameGroup.findObject("songticker"); + InfoTicker = frameGroup.findObject("infoticker"); + + volumebar = frameGroup.findObject("volumebar"); + volumebar.setXmlParam("w",integertostring( (system.getVolume()/255) *70 + 5)); + + SongTickerTimer = new Timer; + SongTickerTimer.setDelay(1000); + if (Muted) { + SongTickerTimer.start(); + SongTicker.hide(); + InfoTicker.show(); + InfoTicker.setText("Mute ON"); + } + BtnPressed = 0; +} + +System.onScriptUnloading() { + setPrivateInt("winamp5", "muted", Muted); + setPrivateInt("winamp5", "old_volume", VolumeLevel); + delete callback; +} + +callback.onTimer() { + MuteBtnShade = getcontainer("main").getlayout("shade").findObject("shademute"); + if (MuteBtnShade != NULL) { + MuteBtnShade.setActivated(Muted); + stop(); + } +} + +SongTickerTimer.onTimer() { + SongTicker.show(); + InfoTicker.hide(); + SongTickerTimer.stop(); +} + +MuteBtn.onLeftClick() { + BtnPressed = 1; + if (!Muted) { + VolumeLevel = System.getVolume(); + System.setVolume(0); + Muted = 1; + SongTickerTimer.start(); + SongTicker.hide(); + InfoTicker.show(); + InfoTicker.setText("Mute ON"); + MuteBtnShade.setActivated(1); + } else { + System.setVolume(VolumeLevel); + Muted = 0; + SongTickerTimer.start(); + SongTicker.hide(); + InfoTicker.show(); + InfoTicker.setText("Mute OFF"); + MuteBtnShade.setActivated(0); + } +} + +MuteBtnShade.onLeftClick() { + BtnPressed = 1; + if (!Muted) { + VolumeLevel = System.getVolume(); + System.setVolume(0); + Muted = 1; + SongTickerTimer.start(); + SongTicker.hide(); + InfoTicker.show(); + InfoTicker.setText("Mute ON"); + MuteBtn.setActivated(1); + } else { + System.setVolume(VolumeLevel); + Muted = 0; + SongTickerTimer.start(); + SongTicker.hide(); + InfoTicker.show(); + InfoTicker.setText("Mute OFF"); + MuteBtn.setActivated(0); + } +} + +System.onScriptUnloading() { + delete SongTickerTimer; +} + +System.onvolumechanged(int newvol) +{ + volumebar.setXmlParam("w",integertostring( (newvol/255) *70 + 5)); + if (!BtnPressed) { + SongTickerTimer.start(); + SongTicker.hide(); + InfoTicker.show(); + InfoTicker.setText(translate("Volume") + ": " + integerToString(newvol/2.55) + "%"); + + if (Muted) { + MuteBtn.setActivated(0); + MuteBtnShade.setActivated(0); + Muted = 0; + } + } + BtnPressed = 0; +}
\ No newline at end of file diff --git a/Src/resources/skins/Winamp Modern/scripts/mute.maki b/Src/resources/skins/Winamp Modern/scripts/mute.maki Binary files differnew file mode 100644 index 00000000..3dfdd215 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/mute.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/notifications_fade_times.maki b/Src/resources/skins/Winamp Modern/scripts/notifications_fade_times.maki Binary files differnew file mode 100644 index 00000000..e8e35a97 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/notifications_fade_times.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/notifier.m b/Src/resources/skins/Winamp Modern/scripts/notifier.m new file mode 100644 index 00000000..4144add7 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/notifier.m @@ -0,0 +1,615 @@ +#include <lib/std.mi> +#include "attribs.m" + +Function reset(); +Function createNotifier(boolean cancel); +Function showNotifier(Int w); +Function onNext(); +function cancelAnimation(); + +Function Int fillNextTrackInfo(String corneroverride); +Function Int fillCustomInfo(String customstring); +Function prepareAlbumArtNotifier(); + +Function checkPref(int bypassfs); + +Function String getArtist(); + +Function onAlbumArt(Boolean success); + +Global Container notifier_container; +Global Layout notifier_layout; +Global Timer notifier_timer; +Global String last_autotitle, cur_status; + +Global AlbumArtLayer cover; +Global boolean handleAACalback = false; + +Global Boolean triggerBug; //BUGFIX remove this +Global Timer fallbackTempFix; //BUGFIX remove this + +Global Boolean b_tohide = 0; +Global int width = 0; +Global int left = 0; + +#define WEBCOVER_SHOUTCAST "winamp.cover.shoutcast" +#define FORCE_BUG_MODE + +// ------------------------------------------------------------------------------ +// init +// ------------------------------------------------------------------------------ +System.onScriptLoaded() { + initAttribs(); + notifier_timer = new Timer; + fallbackTempFix = new Timer; //BUGFIX remove this + fallbackTempFix.setDelay(3000); //BUGFIX remove this / Time that onAlbumArtLoaded have to execute before bug mode is ON +} + +// ------------------------------------------------------------------------------ +// shutdown +// ------------------------------------------------------------------------------ +System.onScriptUnloading() { + delete notifier_timer; + delete fallbackTempFix; //BUGFIX remove this +} + +// ------------------------------------------------------------------------------ +// called by the system when the global hotkey for notification is pressed +// ------------------------------------------------------------------------------ +System.onShowNotification() { + //if (checkPref(1)) return; --mp: if we push the hotkey, we want to show the notifier, no matter what the pref settings are. + createNotifier(false); + if (getStatus() == STATUS_PLAYING) cur_status = "Playing"; + if (getStatus() == STATUS_PAUSED) cur_status = "Playback Paused"; + if (getStatus() == STATUS_STOPPED) cur_status = "Playback Stopped"; + prepareAlbumArtNotifier(); + complete; // prevents other scripts from getting the message + return 1; // tells anybody else that might watch the returned value that, yes, we implemented that +} + +// ------------------------------------------------------------------------------ +// called by the system when the title for the playing item changes, this could be the result of the player +// going to the next track, or of an update in the track title +// ------------------------------------------------------------------------------ +System.onTitleChange(String newtitle) { + if (last_autotitle == newtitle) return; + if (StrLeft(newtitle, 1) == "[") { + if (StrLeft(newtitle, 7) == "[Buffer" || + StrLeft(newtitle, 4) == "[ICY") return; + } + last_autotitle = newtitle; + onNext(); + + fallbackTempFix.stop(); //BUGFIX remove later + fallbackTempFix.start(); //BUGFIX remove later +} + +// ------------------------------------------------------------------------------ +// called by the system when the user clicks the next button +// ------------------------------------------------------------------------------ +onNext() { + if (checkPref(0)) return; + createNotifier(false); + cur_status = ""; + prepareAlbumArtNotifier(); +} + +// ------------------------------------------------------------------------------ +// called by the system when the user clicks the play button +// ------------------------------------------------------------------------------ +System.onPlay() { + if (checkPref(0)) return; + createNotifier(false); + cur_status = "Playing"; + prepareAlbumArtNotifier(); +} + +// ------------------------------------------------------------------------------ +// called by the system when the user clicks the pause button +// ------------------------------------------------------------------------------ +System.onPause() { + if (checkPref(0)) return; + DebugString("onPause",9); + createNotifier(true); + showNotifier(fillCustomInfo("Playback Paused")); +} + +// ------------------------------------------------------------------------------ +// called by the system when the user clicks the pause button again +// ------------------------------------------------------------------------------ +System.onResume() { + if (checkPref(0)) return; + DebugString("onResume",9); + createNotifier(false); + cur_status = "Resuming Playback"; + prepareAlbumArtNotifier(); +} + +// ------------------------------------------------------------------------------ +// called by the system when the user clicks the play button +// ------------------------------------------------------------------------------ +System.onStop() { + if (checkPref(0)) return; + createNotifier(true); + showNotifier(fillCustomInfo("End of Playback")); +} + +// ------------------------------------------------------------------------------ +// checks if we should display anything +// ------------------------------------------------------------------------------ +Int checkPref(int bypassfs) { + if (!bypassfs && notifier_disablefullscreen_attrib.getData() == "1" && isVideoFullscreen()) return 1; + if (notifier_never_attrib.getData() == "1") return 1; + if (notifier_minimized_attrib.getData() == "1" && !isMinimized()) return 1; + if (notifier_windowshade_attrib.getData() == "1") { + if (isMinimized()) return 0; + Container c = getContainer("main"); + if (!c) return 1; + Layout l = c.getCurLayout(); + if (!l) return 1; + if (l.getId() != "shade") return 1; + } + return 0; +} + +// ------------------------------------------------------------------------------ +// fade in/out completed +// ------------------------------------------------------------------------------ +notifier_layout.onTargetReached() { + int a = notifier_layout.getAlpha(); + if (a == 255) { + notifier_timer.setDelay(StringToInteger(notifier_holdtime_attrib.getData())); + notifier_timer.start(); + } + else if (a == 0) { + reset(); + } +} + +// ------------------------------------------------------------------------------ +// hold time elapsed +// ------------------------------------------------------------------------------ +notifier_timer.onTimer() { + stop(); + if (notifier_layout.isTransparencySafe()) { + notifier_layout.setTargetA(0); + notifier_layout.setTargetSpeed(StringToInteger(notifier_fadeouttime_attrib.getData()) / 1000); + notifier_layout.gotoTarget(); + } else { + reset(); + } +} + +// ------------------------------------------------------------------------------ +// when notifier is clicked, bring back the app from minimized state if its minimized and focus it +// ------------------------------------------------------------------------------ +notifier_layout.onLeftButtonDown(int x, int y) { + cancelAnimation(); + + restoreApplication(); + activateApplication(); + /*if (notifier_opennowplaying_attrib.getData() == "1") + { + String artist = getArtist(); + if (artist == "") return; + System.navigateUrlBrowser("http://client.winamp.com/nowplaying/artist/?icid=notifiermodern&artistName=" + artist); + }*/ + + reset(); +} + +notifier_layout.onRightButtonUp(int x, int y) { + cancelAnimation(); + reset(); + complete; + return; +} + +//TODO merge w/ code below +String getArtist () +{ + String artist = getPlayItemMetaDataString("artist"); + if (artist == "") artist = getPlayItemMetaDataString("uvox/artist"); + if (artist == "") artist = getPlayItemMetaDataString("cbs/artist"); + if (artist == "") artist = getPlayItemMetaDataString("streamtitle"); + if (artist == "") artist = getPlayItemDisplayTitle(); + + return artist; +} + +// ------------------------------------------------------------------------------ +// close the notifier window, destroys the container automatically because it's dynamic +// ------------------------------------------------------------------------------ +reset() { + notifier_container.close(); + notifier_container = NULL; + notifier_layout = NULL; + handleAACalback = FALSE; +} + +// ------------------------------------------------------------------------------ +createNotifier(boolean cancel) { + if (notifier_container == NULL) { + notifier_container = newDynamicContainer("notifier"); + if (!notifier_container) return; // reinstall duh! + if (isDesktopAlphaAvailable()) + notifier_layout = notifier_container.getLayout("desktopalpha"); + else + notifier_layout = notifier_container.getLayout("normal"); + if (!notifier_layout) return; // reinstall twice, man + } else if (cancel) { + cancelAnimation(); + } +} + +cancelAnimation() +{ + notifier_layout.cancelTarget(); + notifier_timer.stop(); +} + +// ------------------------------------------------------------------------------ +showNotifier(int w) { + w = w + 32; + + Layout m = getContainer("main").getCurLayout(); + int x = left = getViewportWidthFromGuiObject(m) + getViewportLeftFromGuiObject(m) - w - 2; + int y = getViewportHeightFromGuiObject(m) + getViewportTopFromGuiObject(m) - 80 - 2; + + // show if not there or if already shown then lets resize on the fly (bento style) + if (!notifier_layout.isVisible()) { + notifier_layout.resize(x, y, w, 80); + } + else { + notifier_layout.resize(notifier_layout.getguiX(), y, notifier_layout.getGuiW(), 80); + } + + if (notifier_layout.isTransparencySafe()) { + notifier_layout.show(); + notifier_layout.setTargetA(255); + notifier_layout.setTargetX(x); + notifier_layout.setTargetY(y); + notifier_layout.setTargetW(w); + notifier_layout.setTargetH(80); + notifier_layout.setTargetSpeed(StringToInteger(notifier_fadeintime_attrib.getData()) / 1000); + notifier_layout.gotoTarget(); + } else { + notifier_layout.setAlpha(255); + notifier_layout.show(); + notifier_timer.setDelay(StringToInteger(notifier_holdtime_attrib.getData())); + notifier_timer.start(); + } +} + +// ------------------------------------------------------------------------------ + +prepareAlbumArtNotifier() +{ + if (!notifier_layout) return; + Group g_albumart = notifier_layout.findObject("notifier.albumart"); + + DebugString("prepareAlbumArtNotifier: handleAACalback="+integerToString(handleAACalback), 9); + if (g_albumart) + { + cover = g_albumart.findObject("notifier.cover"); + DebugString("prepareAlbumArtNotifier: cover.isLoading="+integerToString(cover.isLoading()), 9); + DebugString("prepareAlbumArtNotifier: cover.isInvalid="+integerToString(cover.isInvalid()), 9); + handleAACalback = true; + cover.refresh(); + } +} + +cover.onAlbumArtLoaded(boolean success) +{ + /* + Created a seperate function for the code that was here because for some reason I couldn't force this + event (from the fallbackTempFix.onTimer) with cover.onAlbumArtLoaded(success) after the Winamp bug appears. + Weird, yes. + */ + FORCE_BUG_MODE onAlbumArt(success); +} + +// ------------------------------------------------------------------------------ +Int fillNextTrackInfo(String corneroverride) { + Int maxv = 0; + Int stream = 0; + + if (!notifier_layout) return 0; + + Group g_text = notifier_layout.findObject("notifier.text"); + Group g_albumart = notifier_layout.findObject("notifier.albumart"); + + Text plentry = g_text.findObject("plentry"); + Text nexttrack = g_text.findObject("nexttrack"); + Text _title = g_text.findObject("title"); + Text album = g_text.findObject("album"); + Text artist = g_text.findObject("artist"); + Text endofplayback = notifier_layout.findObject("endofplayback"); + + DebugString("got callback for " + getPlayItemString(), 0); + + // Get Stream Name - if no stream returns "" + string s = getPlayItemMetaDataString("streamname"); + string stype = getPlayItemMetaDataString("streamtype"); //"streamtype" will return "2" for SHOUTcast and "5" for SHOUTcast 2 + if (stype == "2" || stype == "5") stream = 1; + + if (endofplayback) endofplayback.hide(); + + if (plentry) + { + plentry.setText(integerToString(getPlaylistIndex()+1)+translate(" of ")+integerToString(getPlaylistLength())); + plentry.show(); + } + if (nexttrack) { + if (corneroverride == "") { + if (!stream) { + if (!isVideo()) + { + nexttrack.setText("New track"); + } + else + { + nexttrack.setText("New video"); + } + } + else + { + nexttrack.setText("On air"); + } + } + else + { + nexttrack.setText(corneroverride); + } + nexttrack.show(); + } + + string set_artist = ""; + string set = ""; + if (_title) { + String str; + if (!stream) + { + _title.setXmlParam("ticker", "0"); + _title.setXmlParam("display", ""); + + str = getPlayitemMetaDataString("title"); + if (str == "") str = getPlayitemDisplayTitle(); + String l = getPlayItemMetaDataString("length"); + if (l != "") { + str += " (" + integerToTime(stringtointeger(l)) + ")"; + } + _title.setText(str); + } + else + { + if (str = getPlayItemMetaDataString("streamtitle") != "") + { + int v = strsearch(str, " - "); // We divide the string by a " - " sublimiter - no luck for old / wrong tagged stations + if (v > 0) { + set_artist = strleft (str, v); // Store artist + string str = strright (str, strlen(str) - 3 - v); + _title.setText(str); + } + else + { + _title.setXmlParam("ticker", "1"); // These titles can be _very_ long + _title.setText(str); + } + } else + { + _title.setXmlParam("ticker", "1"); + _title.setXmlParam("display", "songtitle"); + _title.setText(""); + } + } + _title.show(); + } + + if (artist) { + if (!stream) { + if (isVideo()) + { + artist.setText(""); + } + else + { + artist.setText(getPlayitemMetaDataString("artist")); + } + } + else + { + // Perhaps we've stored the artist before? + if (set_artist != "") + { + artist.setText(set_artist); + } + // Then display the station name + else if (s != "") + { + artist.setText(s); + } + // So, we've had no luck - just display a static text :( + else + { + if (isVideo()) + { + artist.setText("Internet TV"); + } + else + { + artist.setText("Internet Radio"); + } + } + } + artist.show(); + } + + if (album) { + String str; + if (!stream && !isVideo()) { + album.setXmlParam("display", ""); + str = getPlayitemMetaDataString("album"); + String l = getPlayitemMetaDataString("track"); + if (l != "" && l != "-1") str += " (" + translate("Track ") + l + ")"; + album.setText(str); + } + else + { + album.setXmlParam("display", ""); + // we have divided the songname - let's display the station name + if (set_artist != "" && s != "") + { + album.setText(s); + } + // no luck either... + else + { + album.setText(""); + album.setXmlParam("display", "songinfo_localise"); + } + } + album.show(); + } + + // Album Art Stuff + + Layer webcover; + if (g_albumart) + { + cover = g_albumart.findObject("notifier.cover"); + webcover = g_albumart.findObject("notifier.webcover"); + } + + Boolean showAlbumArt = FALSE; + + if (cover != NULL && webcover != NULL && notifier_artworkinnotification_attrib.getData() == "1") + { + if (stream) + { + if(stype == "2" || stype == "5" && cover.isInvalid()) + { + webcover.setXMLParam("image", WEBCOVER_SHOUTCAST); + cover.hide(); + webcover.show(); + showAlbumArt = TRUE; + } + else if(stype == "5" && !cover.isInvalid()) + { + webcover.hide(); + cover.show(); + showAlbumArt = TRUE; + } + } + else + { + if (cover.isInvalid()) // Check if the album art obj shows a pic + { + showAlbumArt = FALSE; + } + else + { + webcover.hide(); + cover.show(); + showAlbumArt = TRUE; + } + } + } + + if (showAlbumArt) + { + if (g_albumart) g_albumart.show(); + if (g_text) g_text.setXmlParam("x", "75"); + if (g_text) g_text.setXmlParam("w", "-95"); + } + else + { + if (g_albumart) g_albumart.hide(); + if (g_text) g_text.setXmlParam("x", "15"); + if (g_text) g_text.setXmlParam("w", "-35"); + } + + if (g_text) g_text.show(); + + maxv = artist.getAutoWidth(); + if (maxv < album.getAutoWidth()) maxv = album.getAutoWidth(); + if (maxv < _title.getAutoWidth()) maxv = _title.getAutoWidth(); + if (maxv < (nexttrack.getAutoWidth() + plentry.getAutoWidth() - 5) ) maxv = nexttrack.getAutoWidth() + plentry.getAutoWidth() - 5; + if (maxv < 128) maxv = 128; + Layout m = getContainer("main").getCurLayout(); + if (maxv > getViewportWidthFromGuiObject(m)/4) maxv = getViewportWidthFromGuiObject(m)/4; + + width = maxv; + + return maxv + ( showAlbumArt * 91 ); +} + +// ------------------------------------------------------------------------------ +Int fillCustomInfo(String customtext) +{ + Group p = notifier_layout; + Group g_text = p.findObject("notifier.text"); + Group g_albumart = p.findObject("notifier.albumart"); + Text plentry = p.findObject("plentry"); + Text nexttrack = p.findObject("nexttrack"); + Text _title = p.findObject("title"); + Text album = p.findObject("album"); + Text artist = p.findObject("artist"); + Text endofplayback = p.findObject("endofplayback"); + + if (g_text) { g_text.hide(); } + if (g_albumart) g_albumart.hide(); + + if (plentry) { plentry.hide(); } + if (nexttrack) nexttrack.hide(); + if (_title) { _title.hide(); } + if (artist) { artist.hide(); } + if (album) { album.hide(); } + + if (endofplayback != NULL /*&& s_endofplayback != NULL*/) { + endofplayback.setText(translate(customtext)+" "); + //s_endofplayback.setText(translate(customtext)+" "); + int aw = endofplayback.getAutoWidth(); + endofplayback.show(); + //s_endofplayback.show(); + if (aw > 128) + return aw; + } + return 128; +} + +//BUGFIX remove this timer later +fallbackTempFix.onTimer() //As soon as this timer runs, bug mode is ON ;) +{ + if (checkPref(0)) return; + + if (!notifier_layout) onNext(); + + if(!triggerBug) + { + triggerBug = true; + + onAlbumArt(cover.isInvalid()); //First time we see the bug + fallbackTempFix.setDelay(30); + + DebugString("Hello Bug", 9); + } + else if(triggerBug && !cover.isLoading()) onAlbumArt(cover.isInvalid()); +} + +onAlbumArt(Boolean success){ + fallbackTempFix.stop(); //BUGFIX remove later + + DebugString("onAlbumArtLoaded: success="+integerToString(success), 9); + DebugString("onAlbumArtLoaded: handleAACalback="+integerToString(handleAACalback), 9); + DebugString("onAlbumArtLoaded: cover.isLoading="+integerToString(cover.isLoading()), 9); + DebugString("onAlbumArtLoaded: cover.isInvalid="+integerToString(cover.isInvalid()), 9); + if (!handleAACalback || !notifier_layout /*|| isLoading()*/) + { + return; + } + + handleAACalback = cover.isLoading(); + cancelAnimation(); + showNotifier(fillNextTrackInfo(cur_status)); +} diff --git a/Src/resources/skins/Winamp Modern/scripts/notifier.maki b/Src/resources/skins/Winamp Modern/scripts/notifier.maki Binary files differnew file mode 100644 index 00000000..68d2845f --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/notifier.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/playlistpro.m b/Src/resources/skins/Winamp Modern/scripts/playlistpro.m new file mode 100644 index 00000000..1a73c987 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/playlistpro.m @@ -0,0 +1,426 @@ +/* + +PlaylistPro build 005 +Originally done by pjn123 (www.skinconsortium.com) for the Classic Pro plugin + +*/ + +#include "lib/std.mi" +#include "lib/pldir.mi" +#include "init_Playlist.m" + +Function resizeResults(int items); +Function doSearch(String input); +Function setSearchBox(boolean onOff); +Function clearSearchBox(); +Function int getPlEntry(int search_item); +Function String replaceString(string baseString, string toreplace, string replacedby); + +Global Group frameGroup, topbar; +Global Edit searchBox; +Global Text helpSearch, searchNews;// fakeText; +Global GuiObject fakeSB, searchXUI, searchButtonXui; +Global Button searchButton, clearButton, clearButtonText; +Global GuiList searchResults; +Global Boolean foundsomething; +Global int tn, h_tune; +Global String temptoken; +Global Windowholder plwh; +GLobal Timer refreshActiveCheck; +Global PopupMenu search_rc; + +Global Container results_container; +Global Layout results_layout, main_layout; + +System.onScriptLoaded() { + frameGroup = getScriptGroup(); + topbar = frameGroup.findObject("PlaylistPro.topbar"); + plwh = frameGroup.findObject("wdh.playlist"); + + searchBox = frameGroup.findObject("wasabi.edit.box"); + searchXUI = frameGroup.findObject("pl.search.edit"); + searchButton = frameGroup.findObject("pl.search.go"); + searchButtonXui = frameGroup.findObject("pl.search.go"); + fakeSB = frameGroup.findObject("pl.search.edit.rect"); + clearButton = frameGroup.findObject("pl.search.edit.clear"); + clearButtonText = frameGroup.findObject("pl.search.edit.clear.text"); + helpSearch = frameGroup.findObject("pl.search.edit.searchhelp"); + //fakeText = frameGroup.findObject("pl.search.go.text.fake"); + + results_container = newDynamicContainer("searchresults"); + results_layout = results_container.getLayout("normal"); + searchResults = results_layout.findObject("PlaylistPro.list"); + searchResults.setFontSize(16); + searchNews = results_layout.findObject("PlaylistPro.list.news"); + + main_layout = getContainer("Pledit").getLayout("normal"); + + initAttribs_Playlist(); + + //translation workaround + /*searchButtonXui.setXmlParam("text", System.translate("Search")); + searchButtonXui.setXmlParam("x", integerToString(-1*fakeText.getAutoWidth()-4)); + searchButtonXui.setXmlParam("w", integerToString(fakeText.getAutoWidth()+2)); + searchXUI.setXmlParam("w", integerToString(-1*fakeText.getAutoWidth()-9));*/ + + refreshActiveCheck = new Timer; + refreshActiveCheck.setDelay(100); +} +System.onScriptUnLoading() { + delete refreshActiveCheck; +} + +refreshActiveCheck.onTimer(){ + if((!System.isAppActive() || System.isMinimized()) && results_layout.isVisible() ) results_layout.hide(); +} + +results_layout.onSetVisible(boolean onOff){ + if(onOff){ + refreshActiveCheck.start(); + } + else{ + refreshActiveCheck.stop(); + } +} + +System.onShowLayout(Layout _layout){ + if(main_layout.isVisible()) results_layout.setXmlParam("ontop", "1"); +} + +frameGroup.onSetVisible(boolean onOff){ + if(!onOff) clearSearchBox(); +} + +searchButton.onLeftClick(){ + doSearch(searchBox.getText()); +} + +resizeResults(int items){ + /*results_layout.setTargetX(results_layout.getLeft()); + results_layout.setTargetY(results_layout.getTop()); + results_layout.setTargetW(results_layout.getWidth()); + results_layout.setTargetH(500); + results_layout.setTargetSpeed(1); + results_layout.gotoTarget();*/ + + //items++; //temp add one extra for info... xx items found + if(items>20) items=20; + + + if(items>=1) h_tune=29; + else h_tune=25; + + //results_layout.setXmlParam("h", integerToString(20+items*18)); + + /*results_layout.setTargetX(results_layout.getLeft()); + results_layout.setTargetY(results_layout.getTop()); + results_layout.setTargetW(results_layout.getWidth()); + results_layout.setTargetH(h_tune+items*16); + results_layout.setTargetSpeed(0.3); + results_layout.gotoTarget();*/ + results_layout.resize(results_layout.getLeft(), results_layout.getTop(), results_layout.getWidth(), h_tune+items*16); +} + +searchBox.onEnter(){ + doSearch(searchBox.getText()); +} + +doSearch(String input){ + if(input==""){ + clearSearchBox(); + return; + } + + //search history stuff + String history = getPublicString("cPro.PlaylistPro.history", ""); + history = replaceString(history, input, ""); + history = replaceString(history, ";;", ";"); + if(strleft(history, 1)==";") history = strright(history, strlen(history)-1); + if(strright(history, 1)==";") history = strleft(history, strlen(history)-1); + if(history=="") history= input; + else history= input+";"+history; + + String output = getToken(history, ";", 0); + for(int i = 1; i<15; i++){ + if(getToken(history, ";", i)=="") break; + output+=";"+getToken(history, ";", i); + } + setPublicString("cPro.PlaylistPro.history", history); + + + int itemsfound = 0; + input = strlower(input); + + results_layout.setXmlParam("x", integerToString(fakeSB.clientToScreenX(fakeSB.getLeft()-2))); + results_layout.setXmlParam("y", integerToString(fakeSB.clientToScreenY(fakeSB.getTop() + fakeSB.getHeight()))); + results_layout.setXmlParam("w", integerToString(frameGroup.getWidth()-19)); + + if(!results_layout.isVisible()) results_layout.setXmlParam("h", "1"); + + searchResults.deleteAllItems(); + searchResults.scrollToItem(0); + + for(int i = 0; i<PlEdit.getNumTracks(); i++){ + foundsomething=false; + + for(tn = 0; tn<10; tn++){ + if(getToken(input, " ", tn)==""){ + break; + } + + temptoken = getToken(input, " ", tn); + if(strsearch(strlower(PlEdit.getTitle(i) + " " + PlEdit.getFileName(i)), temptoken)>=0){ + foundsomething=true; + } + else{ + foundsomething=false; + } + + if(!foundsomething){ + break; + } + } + + if(foundsomething){ + itemsfound++; + searchResults.addItem(integerToString(i+1)+". " + PlEdit.getTitle(i)); + if(itemsfound>500){ + searchNews.setText("Search result limited to 500 items"); + break; + } + } + } + + if(itemsfound==0){ + searchNews.setText("Nothing was found"); + } + else if(itemsfound<=500){ + searchNews.setText(System.translate("Items found: ") +integerToString(itemsfound)); + } + + if(!results_layout.isVisible()) results_layout.show(); + + // Fix if always on top is enabled.. it just refresh the ontop ;) + results_layout.setXmlParam("ontop", "1"); + + resizeResults(itemsfound); +} + +searchResults.onDoubleClick(Int itemnum){ + PlEdit.playTrack (getPlEntry(itemnum)); + setSearchBox(false); +} + +searchResults.onRightClick(Int itemnum){ + search_rc = new PopupMenu; + search_rc.addCommand("Move selected to top", 1, 0, 0); + search_rc.addCommand("Move selected to bottom", 2, 0, 0); + search_rc.addCommand("Move selected after current", 3, 0, 0); + search_rc.addCommand("Move selected together", 4, 0, 0); + search_rc.addSeparator(); + search_rc.addCommand("Remove selected from playlist", 5, 0, 0); + int result = search_rc.popAtMouse(); + delete search_rc; + + int lastselected = searchResults.getFirstItemSelected(); + int itemcounter = 1; + + if(result==1){ + PlEdit.moveTo (getPlEntry(lastselected), 0); + while(searchResults.getNextItemSelected(lastselected) != -1){ + lastselected = searchResults.getNextItemSelected(lastselected); + PlEdit.moveTo (getPlEntry(lastselected), itemcounter); + itemcounter++; + } + PlEdit.showTrack(0); + } + else if(result==2){ + PlEdit.moveTo (getPlEntry(lastselected), PlEdit.getNumTracks ()-1); + while(searchResults.getNextItemSelected(lastselected) != -1){ + lastselected = searchResults.getNextItemSelected(lastselected); + PlEdit.moveTo (getPlEntry(lastselected)-itemcounter, PlEdit.getNumTracks ()-1); + itemcounter++; + } + PlEdit.showTrack(PlEdit.getNumTracks ()-1); + } + else if(result==3){ + int align = 0; + int orignalPos = PlEdit.getCurrentIndex(); + int temp = getPlEntry(lastselected); + if(PlEdit.getCurrentIndex() > temp) align++; + + if(orignalPos > getPlEntry(lastselected)) PlEdit.moveTo (getPlEntry(lastselected), PlEdit.getCurrentIndex()); + else PlEdit.moveTo (getPlEntry(lastselected), PlEdit.getCurrentIndex()+1); + + while(searchResults.getNextItemSelected(lastselected) != -1){ + lastselected = searchResults.getNextItemSelected(lastselected); + + if(orignalPos != getPlEntry(lastselected)){ + if(orignalPos > getPlEntry(lastselected)){ + PlEdit.moveTo (getPlEntry(lastselected)-align, PlEdit.getCurrentIndex()+itemcounter); + } + else{ + PlEdit.moveTo (getPlEntry(lastselected), PlEdit.getCurrentIndex()+itemcounter+1); + } + + temp = getPlEntry(lastselected); + if(orignalPos > temp) align++; + itemcounter++; + } + } + PlEdit.showCurrentlyPlayingTrack(); + } + else if(result==4){ + int startpos = getPlEntry(lastselected); + while(searchResults.getNextItemSelected(lastselected) != -1){ + lastselected = searchResults.getNextItemSelected(lastselected); + PlEdit.moveTo (getPlEntry(lastselected), startpos+itemcounter); + itemcounter++; + } + PlEdit.showTrack(startpos); + } + else if(result==5){ + PlEdit.removeTrack (getPlEntry(lastselected)); + while(searchResults.getNextItemSelected(lastselected) != -1){ + lastselected = searchResults.getNextItemSelected(lastselected); + PlEdit.removeTrack (getPlEntry(lastselected)-itemcounter); + itemcounter++; + } + } + + else return; + + //hides the search + setSearchBox(false); +} + +int getPlEntry(int search_item){ + return stringToInteger(getToken(searchResults.getItemLabel(search_item,0), ". ", 0))-1; +} + +setSearchBox(boolean onOff){ + if(onOff){ + searchBox.show(); + clearButton.show(); + clearButtonText.show(); + helpSearch.hide(); + searchBox.setFocus(); + } + else{ + searchBox.hide(); + clearButton.hide(); + clearButtonText.hide(); + helpSearch.show(); + results_layout.hide(); + } +} + +fakeSB.onLeftButtonDown(int x, int y){ + setSearchBox(true); +} +fakeSB.onRightButtonDown(int x, int y){ + search_rc = new PopupMenu; + search_rc.addCommand("** Search history **", 0, 0, 1); + search_rc.addSeparator(); + + String history = getPublicString("cPro.PlaylistPro.history", ""); + boolean historyfound=false; + for(int i=0;i<15;i++){ + String historyitem = getToken(history, ";", i); + if(historyitem==""){ + if(i>0) historyfound=true; + break; + } + search_rc.addCommand(historyitem, i+1, 0, 0); + } + if(historyfound) search_rc.addSeparator(); + search_rc.addCommand("Clear History", 100, 0, 0); + + int result = search_rc.popAtMouse(); + delete search_rc; + + if(result>0 && result<100){ + setSearchBox(true); + searchBox.setText(getToken(history, ";", result-1)); + searchButton.leftClick(); + } + else if(result==100){ + setPublicString("cPro.PlaylistPro.history", ""); + } +} + +clearSearchBox(){ + searchBox.setText(""); + setSearchBox(false); +} + +main_layout.onMove(){ + if(results_layout.isVisible()){ + results_layout.setXmlParam("x", integerToString(fakeSB.clientToScreenX(fakeSB.getLeft()-2))); + results_layout.setXmlParam("y", integerToString(fakeSB.clientToScreenY(fakeSB.getTop() + fakeSB.getHeight()))); + results_layout.setXmlParam("ontop", "1"); + } +} +main_layout.onResize(int x, int y, int w, int h){ + if(results_layout.isVisible()) clearSearchBox(); +} + +frameGroup.onResize(int x, int y, int w, int h){ + if(results_layout.isVisible()) clearSearchBox(); + + //if(playlist_search_attib.getData()=="0") return; + + if(h<102 || playlist_search_attrib.getData()=="0"){ + + if(!topbar.isVisible()) return; //Don't do the same code over and over + + topbar.hide(); + plwh.setXmlParam("y", "0"); + plwh.setXmlParam("h", "0"); + } + else{ + if(topbar.isVisible()) return; //Don't do the same code over and over + + topbar.show(); + plwh.setXmlParam("y", "30"); + plwh.setXmlParam("h", "-30"); + } +} + +clearButton.onLeftClick(){ + clearSearchBox(); +} + +playlist_search_attrib.onDataChanged(){ + frameGroup.onResize(frameGroup.getLeft(), frameGroup.getTop(), frameGroup.getWidth(), frameGroup.getHeight()); + //debug("abc " + getData()); + + if (getData() == "0"){ + topbar.hide(); + plwh.setXMLParam("y", "0"); + plwh.setXMLParam("h", "0"); + } + else if(getData() == "1"){ + + topbar.show(); + plwh.setXMLParam("y", "30"); + plwh.setXMLParam("h", "-30"); + + } +} + + + +String replaceString(string baseString, string toreplace, string replacedby){ + if (toreplace == "") return baseString; + string sf1 = strupper(baseString); + string sf2 = strupper(toreplace); + int i = strsearch(sf1, sf2); + if (i == -1) return baseString; + string left = "", right = ""; + if (i != 0) left = strleft(baseString, i); + if (strlen(basestring) - i - strlen(toreplace) != 0) { + right = strright(basestring, strlen(basestring) - i - strlen(toreplace)); + } + return left + replacedby + right; +}
\ No newline at end of file diff --git a/Src/resources/skins/Winamp Modern/scripts/playlistpro.maki b/Src/resources/skins/Winamp Modern/scripts/playlistpro.maki Binary files differnew file mode 100644 index 00000000..92cdd793 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/playlistpro.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/plmenu.m b/Src/resources/skins/Winamp Modern/scripts/plmenu.m new file mode 100644 index 00000000..18fcfbdf --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/plmenu.m @@ -0,0 +1,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; + } +}
\ No newline at end of file diff --git a/Src/resources/skins/Winamp Modern/scripts/plmenu.maki b/Src/resources/skins/Winamp Modern/scripts/plmenu.maki Binary files differnew file mode 100644 index 00000000..0e0666be --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/plmenu.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/pltime.m b/Src/resources/skins/Winamp Modern/scripts/pltime.m new file mode 100644 index 00000000..0f1ad50d --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/pltime.m @@ -0,0 +1,62 @@ +#include <lib/std.mi> +#include "attribs.m" + +Global Layer TimeBG,TimeDisplay; +Global Text PLTime; +Global Group frameGroup; +Global GuiObject SongTicker; +Global Timer callback; + +function setSongtickerScrolling(); + +System.onScriptLoaded() { + initAttribs(); + frameGroup = getScriptGroup(); + TimeBG = frameGroup.findobject("player.pl.time.left"); + TimeDisplay = frameGroup.findobject("player.pl.time.display.left"); + PLTime = frameGroup.findobject("PLTime"); + callback = new Timer; callback.setDelay(1); callback.start(); +} + +callback.onTimer() { + Container c = getContainer("pledit"); + if (c) { + Layout l = c.getLayout("shade"); + if (l) { + SongTicker = l.findObject("PESongticker"); + } + } + if (SongTicker) callback.stop(); + setSongtickerScrolling(); +} + +frameGroup.onResize(int x, int y, int w, int h) { + if (w>394) { + TimeBG.show(); + TimeDisplay.show(); + PLTime.setXMLParam("x","-215"); + PLTime.setXMLParam("w","90"); + } else { + TimeBG.hide(); + TimeDisplay.hide(); + PLTime.setXMLParam("x","-180"); + PLTime.setXMLParam("w","55"); + } +} + +songticker_scrolling_attrib.onDataChanged() { + setSongtickerScrolling(); +} + +setSongtickerScrolling() { + if (!Songticker) + return; + + if (songticker_scrolling_modern_attrib.getData()=="1") { + SongTicker.setXMLParam("ticker","bounce"); + } else if (songticker_scrolling_classic_attrib.getData()=="1") { + SongTicker.setXMLParam("ticker","scroll"); + } else { + SongTicker.setXMLParam("ticker","off"); + } +} diff --git a/Src/resources/skins/Winamp Modern/scripts/pltime.maki b/Src/resources/skins/Winamp Modern/scripts/pltime.maki Binary files differnew file mode 100644 index 00000000..76b24211 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/pltime.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/seek.m b/Src/resources/skins/Winamp Modern/scripts/seek.m new file mode 100644 index 00000000..3356d3b1 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/seek.m @@ -0,0 +1,65 @@ +#include <lib/std.mi> + +Global Group frameGroup; +Global Slider Seeker; +Global Int Seeking; +Global Timer SongTickerTimer; +Global Text InfoTicker; +Global GuiObject SongTicker; +Global layer SeekPos; + +System.onScriptLoaded() { + + frameGroup = getScriptGroup(); + Seeker = frameGroup.findObject("SeekerGhost"); + SongTicker = frameGroup.findObject("songticker"); + SeekPos = frameGroup.findObject("player.seekbar.pos"); + InfoTicker = frameGroup.findObject("infoticker"); + + SongTickerTimer = new Timer; + SongTickerTimer.setDelay(1000); +} + +SongTickerTimer.onTimer() { + SongTicker.show(); + InfoTicker.hide(); + SongTickerTimer.stop(); +} + +System.onScriptUnloading() { + delete SongTickerTimer; +} + + +Seeker.onSetPosition(int p) { + if (seeking) { + Float f; + f = p; + f = f / 255 * 100; + Float len = getPlayItemLength(); + if (len != 0) { + int np = len * f / 100; + SongTickerTimer.start(); + SongTicker.hide(); + InfoTicker.show(); + InfoTicker.setText(translate("Seek") + ":" + integerToTime(np) + "/" + integerToTime(len) + " (" + integerToString(f) + "%) "); + } + } +} + +Seeker.onLeftButtonDown(int x, int y) { + seeking = 1; +} + +Seeker.onLeftButtonUp(int x, int y) { + seeking = 0; + SongTickerTimer.start(); + SongTicker.show(); + InfoTicker.hide(); +} + +Seeker.onSetFinalPosition(int p) { + SongTickerTimer.start(); + SongTicker.show(); + InfoTicker.hide(); +}
\ No newline at end of file diff --git a/Src/resources/skins/Winamp Modern/scripts/seek.maki b/Src/resources/skins/Winamp Modern/scripts/seek.maki Binary files differnew file mode 100644 index 00000000..09e8f613 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/seek.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/seekshade.m b/Src/resources/skins/Winamp Modern/scripts/seekshade.m new file mode 100644 index 00000000..9edfa8c5 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/seekshade.m @@ -0,0 +1,64 @@ +#include <lib/std.mi> + +Global Group frameGroup; +Class Slider Seeker; +Global Seeker Seeker1, Seeker2; +Global Int Seeking; +Global Timer SongTickerTimer; +Global GuiObject SongTicker; +Global Text InfoTicker; + +System.onScriptLoaded() { + frameGroup = getScriptGroup(); + Seeker1 = frameGroup.findObject("shadeSeekerGhost"); + Seeker2 = frameGroup.findObject("shadeSeekerGhost2"); + SongTicker = frameGroup.findObject("SongtickerShade"); + InfoTicker = frameGroup.findObject("infotickerShade"); + + SongTickerTimer = new Timer; + SongTickerTimer.setDelay(1000); +} + +SongTickerTimer.onTimer() { + SongTicker.show(); + InfoTicker.hide(); + SongTickerTimer.stop(); +} + +System.onScriptUnloading() { + delete SongTickerTimer; +} + + +Seeker.onSetPosition(int p) { + if (seeking) { + Float f; + f = p; + f = f / 255 * 100; + Float len = getPlayItemLength(); + if (len != 0) { + int np = len * f / 100; + SongTickerTimer.start(); + SongTicker.hide(); + InfoTicker.show(); + InfoTicker.setText(translate("Seek") + ":" + integerToTime(np) + "/" + integerToTime(len) + " (" + integerToString(f) + "%) "); + } + } +} + +Seeker.onLeftButtonDown(int x, int y) { + seeking = 1; +} + +Seeker.onLeftButtonUp(int x, int y) { + seeking = 0; + SongTickerTimer.start(); + SongTicker.show(); + InfoTicker.hide(); +} + +Seeker.onSetFinalPosition(int p) { + SongTickerTimer.start(); + SongTicker.show(); + InfoTicker.hide(); +}
\ No newline at end of file diff --git a/Src/resources/skins/Winamp Modern/scripts/seekshade.maki b/Src/resources/skins/Winamp Modern/scripts/seekshade.maki Binary files differnew file mode 100644 index 00000000..77298182 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/seekshade.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/shadecontrol.m b/Src/resources/skins/Winamp Modern/scripts/shadecontrol.m new file mode 100644 index 00000000..1fc4cce0 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/shadecontrol.m @@ -0,0 +1,190 @@ +#include <lib/std.mi> +#include "attribs.m" + +function setObjects(int w); +function setSongtickerScrolling(); + +Global Group frameGroup, gX1,gX2,gX3,display,display2,displaytimer,displayticker,displayvis; +Global Button btnExpand,btnReduce,shadeeq; +Global Layout main; +Global Layout main_normal; +Global Layer volumebar; +Global Timer SongTickerTimer; +Global GuiObject SongTicker; +Global text InfoTicker; +Global Button colorthemes; + +System.onScriptLoaded() { + initAttribs(); + + frameGroup = getScriptGroup(); + main = frameGroup.getParentLayout(); + main_normal = frameGroup.getParentLayout().getContainer().getLayout("normal"); + gX1 = frameGroup.findObject("shadeX1"); + gX2 = frameGroup.findObject("shadeX2"); + gX3 = frameGroup.findObject("shadeX3"); + shadeeq = frameGroup.findObject("shadeeq"); + display = frameGroup.findObject("shadedisplay"); + display2 = frameGroup.findObject("shadedisplay2"); + displaytimer = frameGroup.findObject("shadetimer"); + displayticker = frameGroup.findObject("shadeticker"); + displayvis = frameGroup.findObject("shadevis"); + btnExpand = frameGroup.findObject("shade.expand"); + btnReduce = frameGroup.findObject("shade.reduce"); + colorthemes = frameGroup.findObject("shadect"); + + SongTicker = frameGroup.findObject("SongtickerShade"); + InfoTicker = frameGroup.findObject("infotickerShade"); + SongTickerTimer = new Timer; + SongTickerTimer.setDelay(1000); + + volumebar = frameGroup.findObject("volumebarShade"); + volumebar.setXmlParam("w",integertostring( (system.getVolume()/255) *40 + 5)); + + setSongtickerScrolling(); +} + +System.onScriptUnloading() { + delete SongTickerTimer; +} + +SongTickerTimer.onTimer() { + SongTicker.show(); + InfoTicker.hide(); + SongTickerTimer.stop(); +} + +frameGroup.onResize(int x, int y, int w, int h) { + setObjects(w); +} + +shadeeq.onLeftClick() { + eq_visible_attrib.setData("1"); +} + +setObjects(int w) { + + int ShowButtons=getPrivateInt("winamp5", "ShowShadeButtons", 0); + + if (ShowButtons) { + btnExpand.show(); + btnReduce.hide(); + } else { + btnExpand.hide(); + btnReduce.show(); + } + + gX1.hide(); + gX2.hide(); + gX3.hide(); + display.hide(); + display2.hide(); + displaytimer.hide(); + displayticker.hide(); + displayvis.hide(); + + if (w>413) { + int w_display=w-356; + display.setXMLParam("w", integertostring(w_display)); + display.show(); + displaytimer.show(); + + if (w>433) { + displayticker.show(); + displayticker.setXMLParam("w", integertostring(w_display-13)); + + if (w>573) { + display.hide(); + display2.setXMLParam("w", integertostring(w_display-45)); + display2.show(); + displayticker.setXMLParam("w", integertostring(w_display-56-13)); + + if (ShowButtons) { + gX1.setXMLParam("x", "-100"); + gX1.show(); + + if (w>596) { + display2.setXMLParam("w", integertostring(w_display-68)); + displayticker.setXMLParam("w", integertostring(w_display-79-13)); + + gX1.setXMLParam("x", "-123"); + + gX2.setXMLParam("x", "-80"); + gX2.show(); + + if (w>655) { + display2.setXMLParam("w", integertostring(w_display-127)); + displayticker.setXMLParam("w", integertostring(w_display-138-13)); + + gX1.setXMLParam("x", "-182"); + + gX2.setXMLParam("x", "-139"); + + gX3.setXMLParam("x", "-116"); + gX3.show(); + + if (w>673) { + displayvis.setXMLParam("x", integertostring(-257)); + displayvis.show(); + displayticker.setXMLParam("w", integertostring(w_display-194-13)); + } + } + } + } else { + display2.setXMLParam("w", integertostring(w_display)); + displayvis.setXMLParam("x", integertostring(-130)); + displayvis.show(); + displayticker.setXMLParam("w", integertostring(w_display-66-13)); + } + } + } + } +} + +System.onKeyDown(String key) { + if (StrLeft(key,4) == "ctrl" && StrSearch(key, "+w") != -1 && (main.isActive() || main_normal.isActive())) { + if (main.isVisible()) + main.getContainer().switchToLayout("normal"); + else + main.getContainer().switchToLayout("shade"); + complete; + } +} + +btnExpand.onleftClick() { + setPrivateInt("winamp5", "ShowShadeButtons", 0); + setObjects(main.getGUIw()); +} + +btnReduce.onleftClick() { + setPrivateInt("winamp5", "ShowShadeButtons", 1); + setObjects(main.getGUIw()); +} + +System.onvolumechanged(int newvol) +{ + volumebar.setXmlParam("w",integertostring( (newvol/255) *40 + 5)); + SongTickerTimer.start(); + SongTicker.hide(); + InfoTicker.show(); + InfoTicker.setText(translate("Volume") + ": " + integerToString(newvol/2.55) + "%"); +} + +songticker_scrolling_attrib.onDataChanged() { + setSongtickerScrolling(); +} + +setSongtickerScrolling() { + if (songticker_scrolling_modern_attrib.getData()=="1") { + SongTicker.setXMLParam("ticker","bounce"); + } else if (songticker_scrolling_classic_attrib.getData()=="1") { + SongTicker.setXMLParam("ticker","scroll"); + } else { + SongTicker.setXMLParam("ticker","off"); + } +} + +colorthemes.onRightButtonDown(int x, int y) { + triggerAction(colorthemes, "ThemesSlotsMenu", ""); + complete; +}
\ No newline at end of file diff --git a/Src/resources/skins/Winamp Modern/scripts/shadecontrol.maki b/Src/resources/skins/Winamp Modern/scripts/shadecontrol.maki Binary files differnew file mode 100644 index 00000000..6a47037e --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/shadecontrol.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/shadelinks.m b/Src/resources/skins/Winamp Modern/scripts/shadelinks.m new file mode 100644 index 00000000..0bca63f3 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/shadelinks.m @@ -0,0 +1,45 @@ +/*--------------------------------------------------- +----------------------------------------------------- +Filename: syncbutton.m +Version: 1.0 + +Type: maki +Date: 25. Jun. 2007 - 14:04 +Author: Martin Poehlmann aka Deimos +E-Mail: martin@skinconsortium.com +Internet: www.skinconsortium.com + www.martin.deimos.de.vu +----------------------------------------------------- +---------------------------------------------------*/ + +#include <lib/std.mi> + +Function String getArtist (); + +Global Button nowplaying; + +System.onScriptLoaded () +{ + nowplaying = getScriptGroup().getObject("nowplaying"); +} + +nowplaying.onLeftClick () +{ + String artist = getArtist(); + if (artist == "") return; + + String icid = "winshadeiconmodern"; + + System.navigateUrlBrowser("http://client.winamp.com/nowplaying/artist/?icid="+ icid +"&artistName=" + artist); +} + +String getArtist () +{ + String artist = getPlayItemMetaDataString("artist"); + if (artist == "") artist = getPlayItemMetaDataString("uvox/artist"); + if (artist == "") artist = getPlayItemMetaDataString("cbs/artist"); + if (artist == "") artist = getPlayItemMetaDataString("streamtitle"); + if (artist == "") artist = getPlayItemDisplayTitle(); + + return artist; +}
\ No newline at end of file diff --git a/Src/resources/skins/Winamp Modern/scripts/shadelinks.maki b/Src/resources/skins/Winamp Modern/scripts/shadelinks.maki Binary files differnew file mode 100644 index 00000000..13c24afe --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/shadelinks.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/shadesizepos.m b/Src/resources/skins/Winamp Modern/scripts/shadesizepos.m new file mode 100644 index 00000000..9712239a --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/shadesizepos.m @@ -0,0 +1,41 @@ +#include <lib/std.mi> +#include "attribs.m" + +Function updateLinkage(int type); + +System.onScriptLoaded() { + initAttribs(); + if (windowshade_linkall_attrib.getData() == "1") windowshade_linkall_attrib.onDataChanged(); + if (windowshade_linkposition_attrib.getData() == "1") windowshade_linkposition_attrib.onDataChanged(); + if (windowshade_linknone_attrib.getData() == "1") windowshade_linknone_attrib.onDataChanged(); +} + +windowshade_linkall_attrib.onDataChanged() { + if (getData() == "1") updateLinkage(2); +} + +windowshade_linkposition_attrib.onDataChanged() { + if (getData() == "1") updateLinkage(1); +} + +windowshade_linknone_attrib.onDataChanged() { + if (getData() == "1") updateLinkage(0); +} + +updateLinkage(int type) { + Layout shade = getScriptGroup().getParentLayout(); + Layout normal = shade.getContainer().getLayout("normal"); + if (type == 0) { + shade.setXmlParam("unlinked", "1"); + shade.setXmlParam("linkwidth", ""); + normal.setXmlParam("linkwidth", ""); + } else if (type == 1) { + shade.setXmlParam("unlinked", "0"); + shade.setXmlParam("linkwidth", ""); + normal.setXmlParam("linkwidth", ""); + } else if (type == 2) { + shade.setXmlParam("unlinked", "0"); + shade.setXmlParam("linkwidth", "normal"); + normal.setXmlParam("linkwidth", "shade"); + } +} diff --git a/Src/resources/skins/Winamp Modern/scripts/shadesizepos.maki b/Src/resources/skins/Winamp Modern/scripts/shadesizepos.maki Binary files differnew file mode 100644 index 00000000..b3b51c8e --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/shadesizepos.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/songinfo.m b/Src/resources/skins/Winamp Modern/scripts/songinfo.m new file mode 100644 index 00000000..d216b1a3 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/songinfo.m @@ -0,0 +1,165 @@ +#include <lib/std.mi> + +Function string tokenizeSongInfo(String tkn, String sinfo); +Function getSonginfo(String SongInfoString); +Function loadPlaylistArtWork(); + +Global Group frameGroup; +Global Layer channelDisplay; +Global Text bitrateText, FrequencyText; +Global Timer songInfoTimer; +Global String SongInfoString; +Global AlbumArtLayer waaa; +Global Int waaaRetries = 0; + +System.onScriptLoaded(){ + frameGroup = getScriptGroup(); + + bitrateText = frameGroup.findObject("Bitrate"); + frequencyText = frameGroup.findObject("Frequency"); + + channelDisplay = frameGroup.findObject("channels"); + + songInfoTimer = new Timer; + songInfoTimer.setDelay(1000); + + if (getStatus() == STATUS_PLAYING) { + String sit = getSongInfoText(); + waaaRetries = 0; + if (sit != "") getSonginfo(sit); + else songInfoTimer.setDelay(50); // goes to 1000 once info is available + songInfoTimer.start(); + } else if (getStatus() == STATUS_PAUSED) { + getSonginfo(getSongInfoText()); + } +} + +loadPlaylistArtWork() +{ + Container albumart = System.getContainer("winamp.albumart"); + if(albumart) + { + Layout aalayout = albumart.getLayout("normal"); + if(aalayout) + { + waaa = aalayout.findObject("waaa"); + } + } +} + +System.onScriptUnloading(){ + delete songInfoTimer; +} + +System.onPlay(){ + String sit = getSongInfoText(); + waaaRetries = 0; + if (sit != "") getSonginfo(sit); + else songInfoTimer.setDelay(50); // goes to 1000 once info is available + songInfoTimer.start(); +} + +System.onStop(){ + waaaRetries = 0; + songInfoTimer.stop(); + frequencyText.setText("(__)"); + bitrateText.setText("(___)"); + channelDisplay.setXmlParam("image", "player.songinfo.none"); +} + +System.onResume(){ + String sit = getSongInfoText(); + if (sit != "") getSonginfo(sit); + else songInfoTimer.setDelay(50); // goes to 1000 once info is available + songInfoTimer.start(); +} + +System.onPause(){ + songInfoTimer.stop(); +} + +songInfoTimer.onTimer(){ + String sit = getSongInfoText(); + if (sit == "") return; + songInfoTimer.setDelay(1000); + getSonginfo(sit); + + if(!waaa) loadPlaylistArtWork(); + if(waaa) + { + if(waaa.isInvalid() && waaaRetries < 5) + { + waaaRetries += 1; + waaa.refresh(); + waaa.show(); + } + else if(!waaa.isInvalid()) + { + waaaRetries = 0; + } + } +} + +String tokenizeSongInfo(String tkn, String sinfo){ + int searchResult; + String rtn; + if (tkn=="Bitrate"){ + for (int i = 0; i < 5; i++) { + rtn = getToken(sinfo, " ", i); + searchResult = strsearch(rtn, "kbps"); + if (searchResult>0) return StrMid(rtn, 0, searchResult); + } + return ""; + } + + if (tkn=="Channels"){ + for (int i = 0; i < 5; i++) { + rtn = getToken(sinfo, " ", i); + searchResult = strsearch(rtn, "tereo"); + if (searchResult>0) return "stereo"; + searchResult = strsearch(rtn, "ono"); + if (searchResult>0) return "mono"; + // Martin: surround > 3, stereo = 2,3 + searchResult = strsearch(rtn, "annels"); + if (searchResult>0) + { + int pos = strsearch(getSongInfoText(), "annels"); + pos = stringToInteger(strmid(getSongInfoText(), pos - 4, 1)); + if (pos > 3) return "surround"; + if (pos > 1 && pos < 4) return "stereo"; + else return "mono"; + } + } + return "none"; + } + + if (tkn=="Frequency"){ + for (int i = 0; i < 5; i++) { + rtn = getToken(sinfo, " ", i); + searchResult = strsearch(strlower(rtn), "khz"); + if (searchResult>0) { + String r = StrMid(rtn, 0, searchResult); + int dot = StrSearch(r, "."); + if (dot == -1) dot = StrSearch(r, ","); + if (dot != -1) return StrMid(r, 0, dot); + return r; + } + + } + return ""; + } + else return ""; +} + +getSonginfo(String SongInfoString) { + String tkn; + + tkn = tokenizeSongInfo("Bitrate", SongInfoString); + if(tkn != "") {bitrateText.setText("["+tkn+"]");} + + tkn = tokenizeSongInfo("Channels", SongInfoString); + channelDisplay.setXmlParam("image", "player.songinfo." + tkn); + + tkn = tokenizeSongInfo("Frequency", SongInfoString); + if(tkn != "") {frequencyText.setText("["+tkn+"]");} +}
\ No newline at end of file diff --git a/Src/resources/skins/Winamp Modern/scripts/songinfo.maki b/Src/resources/skins/Winamp Modern/scripts/songinfo.maki Binary files differnew file mode 100644 index 00000000..2d943cd2 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/songinfo.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/standardframe.m b/Src/resources/skins/Winamp Modern/scripts/standardframe.m new file mode 100644 index 00000000..7e6a8a57 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/standardframe.m @@ -0,0 +1,68 @@ +#include <lib/std.mi> + +Global Group frameGroup, content, titlebar; +Global String x, y, w, h, rx, ry, rw, rh; +Global Layer mouselayer; +Global Button Sysmenu; + +Function setNewGroup(String groupid); + +System.onScriptLoaded() { + frameGroup = getScriptGroup(); + String param = getParam(); + x = getToken(param, ",", 0); + y = getToken(param, ",", 1); + w = getToken(param, ",", 2); + h = getToken(param, ",", 3); + rx = getToken(param, ",", 4); + ry = getToken(param, ",", 5); + rw = getToken(param, ",", 6); + rh = getToken(param, ",", 7); + sysmenu = frameGroup.findObject("sysmenu"); +} + +System.onSetXuiParam(String param, String value) { + if (param == "content") { + setNewGroup(value); + titlebar = frameGroup.findObject("wasabi.titlebar"); + mouselayer = titlebar.findObject("mousetrap"); + } + if (param == "padtitleright" || param == "padtitleleft") { + if (titlebar != NULL) titlebar.setXmlParam(param, value); + } + if (param == "shade") { + if (mouselayer != NULL) mouselayer.setXmlParam("dblclickaction", "switch;"+value); + else messagebox("Cannot set shade parameter for StandardFrame object, no mousetrap found", "Skin Error", 0, ""); + } +} + +// backward compatibility for prerelease notify trick +frameGroup.onNotify(String cmd, String param, int a, int b) { + String _command = getToken(cmd, ",", 0); + String _param = getToken(cmd, ",", 1); + if (_command == "content" || _command == "padtitleright" || _command == "padtitleleft" || _command == "shade") { + onSetXuiParam(_command, _param); + } +} + +setNewGroup(String groupid) { + content = newGroup(groupid); + if (content == NULL) { + messagebox("group \"" + groupid + "\" not found", "ButtonGroup", 0, ""); + return; + } + content.setXmlParam("x", x); + content.setXmlParam("y", y); + content.setXmlParam("w", w); + content.setXmlParam("h", h); + content.setXmlParam("relatx", rx); + content.setXmlParam("relaty", ry); + content.setXmlParam("relatw", rw); + content.setXmlParam("relath", rh); + content.init(frameGroup); +} + +Sysmenu.onLeftClick() { + LayoutStatus _status = frameGroup.findObject("sysmenu.status"); + _status.callme("{system}"); +} diff --git a/Src/resources/skins/Winamp Modern/scripts/standardframe.maki b/Src/resources/skins/Winamp Modern/scripts/standardframe.maki Binary files differnew file mode 100644 index 00000000..252fee66 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/standardframe.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/titlebar.m b/Src/resources/skins/Winamp Modern/scripts/titlebar.m new file mode 100644 index 00000000..5d28307c --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/titlebar.m @@ -0,0 +1,104 @@ +#include <lib/std.mi> + +#define MARGIN 0 + +Function resizeObjects(); + +Global GuiObject left, right, center; +Global Text tcenter; +Global Layer lcenter; +Global Group sg; +Global int padleft, padright; + +System.onScriptLoaded() { + + padleft = 0; + padright = 0; + + sg = getScriptGroup(); + + if (sg == NULL) { + messageBox("titlebar.maki can only run within a group", "Error", 0, ""); + return; + } + + left = sg.findObject(getToken(getParam(), ";", 0)); + center = sg.findObject(getToken(getParam(), ";", 1)); + if (center != NULL) { + tcenter = center.findObject("window.titlebar.title"); + lcenter = center.findObject("window.titlebar.title.overlay"); + } + right = sg.findObject(getToken(getParam(), ";", 2)); +} + +// backward compatibility with prerelease notify trick +sg.onNotify(String cmd, String param, int a, int b) { + String _command = getToken(cmd, ",", 0); + String _param = getToken(cmd, ",", 1); + if (_command == "padtitleright" || _command == "padtitleright") + onSetXuiParam(_command, _param); +} + +System.onSetXuiParam(String param, String value) { + if (param == "padtitleright") { + padright = padright + StringToInteger(value); + resizeObjects(); + } + if (param == "padtitleleft") { + padleft = padleft + StringToInteger(value); + resizeObjects(); + } +} + +resizeObjects() { + int text_width = 0; + int layout_width = 0; + int group_width = sg.getWidth(); + + Layout l = sg.getParentLayout(); + layout_width = l.getWidth(); + + if (center != NULL) { + text_width = center.getAutoWidth(); + } + + int lx = (layout_width - text_width) / 2; + lx = l.clientToScreenX(lx); + lx = sg.screenToClientX(lx); + lx = lx - sg.getLeft(); + + if (center != NULL) { + center.setXmlParam("x", IntegerToString(lx)); + center.setXmlParam("relatx", "0"); + center.setXmlParam("w", IntegerToString(text_width)); + center.setXmlParam("relatw", "0"); + + lcenter.setXmlParam("x", IntegerToString(lx)); + lcenter.setXmlParam("relatx", "0"); + lcenter.setXmlParam("w", IntegerToString(text_width)); + lcenter.setXmlParam("relatw", "0"); + + } + + if (left != NULL) { + left.setXmlParam("x", IntegerToString(padleft)); + left.setXmlParam("relatx", "0"); + left.setXmlParam("w", IntegerToString(lx-padleft-MARGIN)); + left.setXmlParam("relatw", "0"); + } + if (right != NULL) { + right.setXmlParam("x", IntegerToString(lx+text_width+MARGIN+1)); + right.setXmlParam("relatx", "0"); + right.setXmlParam("w", "-" + IntegerToString(lx+text_width+1+padright+MARGIN+1)); //IntegerToString(group_width-(lx+text_width))); + right.setXmlParam("relatw", "1"); + } +} + +tcenter.onTextChanged(string newtext) { + resizeObjects(); +} + +sg.onResize(int x, int y, int w, int h) { + resizeObjects(); +} + diff --git a/Src/resources/skins/Winamp Modern/scripts/titlebar.maki b/Src/resources/skins/Winamp Modern/scripts/titlebar.maki Binary files differnew file mode 100644 index 00000000..316a777a --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/titlebar.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/video.m b/Src/resources/skins/Winamp Modern/scripts/video.m new file mode 100644 index 00000000..5cd0723d --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/video.m @@ -0,0 +1,15 @@ +#include <lib/std.mi> +#include "attribs.m" + +Global Button btnVideoReattach; + +System.onScriptLoaded() { + initAttribs(); + BtnVideoReattach = getScriptGroup().findObject("button.video.reattach"); +} + +BtnVideoReattach.onLeftClick() { + Container c = getContainer("main"); + if (c.getLayout("shade").isVisible()) c.switchToLayout("normal"); + video_detach_attrib.setData("0"); +} diff --git a/Src/resources/skins/Winamp Modern/scripts/video.maki b/Src/resources/skins/Winamp Modern/scripts/video.maki Binary files differnew file mode 100644 index 00000000..734ae90c --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/video.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/videoavs.m b/Src/resources/skins/Winamp Modern/scripts/videoavs.m new file mode 100644 index 00000000..32ce21cb --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/videoavs.m @@ -0,0 +1,313 @@ +#include <lib/std.mi> +#include <lib/config.mi> + +#define MAIN_ATTRIBS_MGR + +Function updateVisCmd(); +Function updateOpenCloseDirection(); + +// this implements the main app drawer +#include "drawer.m" + +// this loads the skin config attributes definitions +#include "attribs.m" + +Global Layout main, shade; +Global Container maincontainer; +Global Group frameGroup, ButtonsVideo,ButtonsVis,ButtonsVideoDetach,ButtonsVisDetach,ButtonsVideoSwitchto,ButtonsVisSwitchto; +Global Button btnOpen,btnClose,btnMaximize,btnRestore, btnVisDetach, btnVideoDetach, btnVisSwitchto, btnVideoSwitchto; +Global Layer resizer,resizerDrawer,OpenCloseHider; +Global GuiObject VideoVisGroup; +Global Int evershown; +Global Int ismaximized; +Global Int lasttotop; + +//------------------------------------------------------------------------ +// script startup +//------------------------------------------------------------------------ +System.onScriptLoaded() { + // init skin attributes for this script + + initAttribs(); + + // bind objects + + frameGroup = getScriptGroup(); + btnOpen = frameGroup.findObject("videoavs.open"); + btnClose = frameGroup.findObject("videoavs.close"); + btnMaximize = frameGroup.findObject("button.vid.max"); + btnRestore = frameGroup.findObject("button.vid.restore"); + resizer = frameGroup.findObject("player.main.resizer"); + resizerDrawer = frameGroup.findObject("drawer.resizer"); + + ButtonsVideo = frameGroup.findObject("buttons.video"); + ButtonsVis = frameGroup.findObject("buttons.vis"); + + ButtonsVideoDetach = frameGroup.findObject("buttons.video.detach"); + ButtonsVisDetach = frameGroup.findObject("buttons.vis.detach"); + BtnVisDetach = ButtonsVisDetach.findObject("button.vis.detach"); + BtnVideoDetach = ButtonsVideoDetach.findObject("button.vid.detach"); + + ButtonsVideoSwitchto = frameGroup.findObject("buttons.video.switchto"); + ButtonsVisSwitchto = frameGroup.findObject("buttons.vis.switchto"); + + BtnVisSwitchto = ButtonsVisSwitchto.findObject("button.vis.Switchto"); + BtnVideoSwitchto = ButtonsVideoSwitchto.findObject("button.vid.Switchto"); + + OpenCloseHider=frameGroup.findObject("openclosehider"); + + main = frameGroup.getParentLayout(); + maincontainer = main.getContainer(); + VideoVisGroup = frameGroup.findObject("AVSGroup"); + + VideoVisGroup.hide(); + + // bind drawer script attribs to our attribs + + __drawer_directiontop_attrib = drawer_directiontop_attrib; + __scrolldrawerattrib = scrolldrawerattrib; + __drawer_directionbypass_attrib = drawer_directionbypass_attrib; + __vis_detach_attrib = vis_detach_attrib; + __video_detach_attrib = video_detach_attrib; + + // startup drawer script + + initDrawer(main, "VideoAVS"); + + // more init + + if (vis_detach_attrib.getData() == "1" && video_detach_attrib.getData() == "1") OpenCloseHider.show(); + else OpenCloseHider.hide(); + + lasttotop = 0; +} + +//------------------------------------------------------------------------ +// grab a handle to the windowshade layout, can't get it in onScriptLoaded since it doesn't exists yet +// also, first time we are shown, we update the viscmd button's action +//------------------------------------------------------------------------ +main.onSetVisible(int show) { + if (!evershown) { + evershown = 1; + if (!shade) { + shade = maincontainer.getLayout("shade"); + } + updateVisCmd(); + updateOpenCloseDirection(); + } +} + +//------------------------------------------------------------------------ +// script shutdown +//------------------------------------------------------------------------ +System.onScriptUnloading() { + + // shutdown the drawer script + + shutdownDrawer(); +} + +//------------------------------------------------------------------------ +// drawer script backend +//------------------------------------------------------------------------ + +Int getDrawerClosedHeight() { + return 280; // this is the size of the layout when the drawer is closed +} + +Int getDefaultDrawerOpenHeight() { + return 510; // this is the default size of the layout, used when it opens the first time +} + +// whenever the main window is resized while its drawer is closed, we change the height of the drawer the +// next time it opens so that video will fit 4:3 +Int getDrawerOpenAutoHeight(int layoutwidth) { + return (layoutwidth-6)*(3/4)+55+270; +} + +WindowHolder getVisWindowHolder() { + WindowHolder wh = getScriptGroup().findObject("myviswnd"); + return wh; // we return our vis windowholder object +} + +WindowHolder getVideoWindowHolder() { + WindowHolder wh = getScriptGroup().findObject("myvideownd"); + return wh; // we return our video windowholder object +} + +//------------------------------------------------------------------------ +// optional drawer events +//------------------------------------------------------------------------ + +onDoneOpeningDrawer() { + // nothing to do +} + +onDoneClosingDrawer() { + VideoVisGroup.hide(); +} + +onBeforeOpeningDrawer() { + resizer.setXmlParam("resize", "bottomright"); + resizerDrawer.setXmlParam("resize", "bottomright"); + btnOpen.hide(); + main.setXmlParam("minimum_h", "380"); + + VideoVisGroup.show(); +} + +onBeforeClosingDrawer() { + resizer.setXmlParam("resize", "right"); + resizerDrawer.setXmlParam("resize", "right"); + main.setXmlParam("minimum_h", "280"); + btnOpen.show(); +} + +onShowVis() { + ButtonsVideo.hide(); + ButtonsVideoDetach.hide(); + ButtonsVideoSwitchto.hide(); + ButtonsVis.show(); + ButtonsVisDetach.show(); + if (video_detach_attrib.getData() == "0") ButtonsVisSwitchto.show(); +} + +onHideVis() { + ButtonsVis.hide(); + ButtonsVisDetach.hide(); + ButtonsVisSwitchto.hide(); +} + +onShowVideo() { + ButtonsVis.hide(); + ButtonsVisDetach.hide(); + ButtonsVisSwitchto.hide(); + ButtonsVideo.show(); + ButtonsVideoDetach.show(); + if (vis_detach_attrib.getData() == "0") ButtonsVideoSwitchto.show(); +} + +onHideVideo() { + ButtonsVideo.hide(); + ButtonsVideoDetach.hide(); + ButtonsVideoSwitchto.hide(); +} + +onDetachVideo() { + ButtonsVisSwitchto.hide(); + if (vis_detach_attrib.getData() == "1") OpenCloseHider.show(); +} + +onAttachVideo() { + ButtonsVisSwitchto.show(); + OpenCloseHider.hide(); +} + +onDetachVis() { + ButtonsVideoSwitchto.hide(); + if (video_detach_attrib.getData() == "1") OpenCloseHider.show(); +} + +onAttachVis() { + ButtonsVideoSwitchto.show(); + OpenCloseHider.hide(); +} + +onBeforeRestore() { + btnMaximize.show(); + btnRestore.hide(); +} + +onBeforeMaximize() { + btnRestore.show(); + btnMaximize.hide(); +} + +onCancelMaximize() { + btnMaximize.show(); + btnRestore.hide(); +} + +// ----------------------------------------------------------------------- +// drawer control +// ----------------------------------------------------------------------- + +btnOpen.onLeftClick() { + openDrawer(); +} + +btnClose.onLeftClick() { + closeDrawer(); +} + +btnMaximize.onLeftClick() { + maximizeWindow(); +} + +btnRestore.onLeftClick() { + restoreWindow(); +} + +BtnVisDetach.onLeftClick() { + detachVis(); +} + +BtnVideoDetach.onLeftClick() { + detachVideo(); +} + +BtnVisSwitchto.onLeftClick() { + switchToVideo(); +} + +BtnVideoSwitchto.onLeftClick() { + switchToVis(); +} + +// ----------------------------------------------------------------------- +// when the player window is moved on the screen, we should update the up/down arrow for the open/close buttons since the +// drawer may have changed the direction it will open depending on user settings +// ----------------------------------------------------------------------- +main.onMove() { + updateOpenCloseDirection(); +} + +// ----------------------------------------------------------------------- +// just invert the images when the direction is to top and restore them otherwise +// ----------------------------------------------------------------------- +updateOpenCloseDirection() { + if (isDrawerToTop()) { + if (!lasttotop) { + btnClose.setXmlParam("image", "player.button.videoavs"); + btnClose.setXmlParam("downimage", "player.button.videoavs.pressed"); + btnClose.setXmlParam("hoverImage", "player.button.videoavs.hover"); + btnOpen.setXmlParam("image", "player.button.videoavs.up"); + btnOpen.setXmlParam("downimage", "player.button.videoavs.up.pressed"); + btnOpen.setXmlParam("hoverImage", "player.button.videoavs.up.hover"); + lasttotop = 1; + } + } else { + if (lasttotop) { + btnOpen.setXmlParam("image", "player.button.videoavs"); + btnOpen.setXmlParam("downimage", "player.button.videoavs.pressed"); + btnOpen.setXmlParam("hoverImage", "player.button.videoavs.hover"); + btnClose.setXmlParam("image", "player.button.videoavs.up"); + btnClose.setXmlParam("downimage", "player.button.videoavs.up.pressed"); + btnClose.setXmlParam("hoverImage", "player.button.videoavs.up.hover"); + lasttotop = 0; + } + } +} + +// ----------------------------------------------------------------------- +updateVisCmd() { + Button btn = getScriptGroup().findObject("button.vis.misc"); + if (btn) { + if (viscmd_menu_attrib.getData() == "1") { + btn.setXmlParam("action", "Vis_Menu"); + } else { + btn.setXmlParam("action", "Vis_Cfg"); + } + } +} + diff --git a/Src/resources/skins/Winamp Modern/scripts/videoavs.maki b/Src/resources/skins/Winamp Modern/scripts/videoavs.maki Binary files differnew file mode 100644 index 00000000..13a3f501 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/videoavs.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/vis.m b/Src/resources/skins/Winamp Modern/scripts/vis.m new file mode 100644 index 00000000..f80f8335 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/vis.m @@ -0,0 +1,42 @@ +#include <lib/std.mi> +#include "attribs.m" + +Function updateVisCmd(); + +Global Button btnVisReattach; +Global Layout thislayout; +Global Int evershown; + +System.onScriptLoaded() { + initAttribs(); + thislayout = getScriptGroup().getParentLayout(); + BtnVisReattach = getScriptGroup().findObject("button.vis.reattach"); +} + +thisLayout.onSetVisible(int show) { + if (!evershown) { + evershown = 1; + updateVisCmd(); + } +} + +BtnVisReattach.onLeftClick() { + Container c = getContainer("main"); + if (c.getLayout("shade").isVisible()) c.switchToLayout("normal"); + vis_detach_attrib.setData("0"); +} + +viscmd_menu_attrib.onDataChanged() { + updateVisCmd(); +} + +updateVisCmd() { + Button btn = getScriptGroup().findObject("button.vis.misc"); + if (btn) { + if (viscmd_menu_attrib.getData() == "1") { + btn.setXmlParam("action", "Vis_Menu"); + } else { + btn.setXmlParam("action", "Vis_Cfg"); + } + } +}
\ No newline at end of file diff --git a/Src/resources/skins/Winamp Modern/scripts/vis.maki b/Src/resources/skins/Winamp Modern/scripts/vis.maki Binary files differnew file mode 100644 index 00000000..e1983f3d --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/vis.maki diff --git a/Src/resources/skins/Winamp Modern/scripts/visualizer.m b/Src/resources/skins/Winamp Modern/scripts/visualizer.m new file mode 100644 index 00000000..1d2fccc1 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/visualizer.m @@ -0,0 +1,267 @@ +/*--------------------------------------------------- +----------------------------------------------------- +Filename: visualizer.m +Version: 1.4 + +Type: maki +Date: 07. Okt. 2007 - 19:56 +Author: Martin Poehlmann aka Deimos +E-Mail: martin@skinconsortium.com +Internet: www.skinconsortium.com + www.martin.deimos.de.vu + +Note: This script handles also the timer reflection +----------------------------------------------------- +---------------------------------------------------*/ + +#include <lib/std.mi> + +Function refreshVisSettings(); +Function setVis (int mode); +Function ProcessMenuResult (int a); + +Global Group scriptGroup; +Global Vis visualizer; +Global Text tmr; + +Global PopUpMenu visMenu; +Global PopUpMenu specmenu; +Global PopUpMenu oscmenu; +Global PopUpMenu pksmenu; +Global PopUpMenu anamenu; +Global PopUpMenu stylemenu; + +Global Int currentMode, a_falloffspeed, p_falloffspeed, a_coloring; +Global Boolean show_peaks, isShade; +Global layer trigger; + +Global Layout thislayout; +Global Container main; + +System.onScriptLoaded() +{ + scriptGroup = getScriptGroup(); + thislayout = scriptGroup.getParentLayout(); + main = thislayout.getContainer(); + + visualizer = scriptGroup.findObject("visual"); + + trigger = scriptGroup.findObject("main.vis.trigger"); + + visualizer.setXmlParam("peaks", integerToString(show_peaks)); + visualizer.setXmlParam("peakfalloff", integerToString(p_falloffspeed)); + visualizer.setXmlParam("falloff", integerToString(a_falloffspeed)); + + refreshVisSettings (); +} + +refreshVisSettings () +{ + currentMode = getPrivateInt(getSkinName(), "Visualizer Mode", 1); + show_peaks = getPrivateInt(getSkinName(), "Visualizer show Peaks", 1); + a_falloffspeed = getPrivateInt(getSkinName(), "Visualizer analyzer falloff", 3); + p_falloffspeed = getPrivateInt(getSkinName(), "Visualizer peaks falloff", 2); + a_coloring = getPrivateInt(getSkinName(), "Visualizer analyzer coloring", 0); + + visualizer.setXmlParam("peaks", integerToString(show_peaks)); + visualizer.setXmlParam("peakfalloff", integerToString(p_falloffspeed)); + visualizer.setXmlParam("falloff", integerToString(a_falloffspeed)); + + if (a_coloring == 0) + { + visualizer.setXmlParam("coloring", "Normal"); + } + else if (a_coloring == 1) + { + visualizer.setXmlParam("coloring", "Normal"); + } + else if (a_coloring == 2) + { + visualizer.setXmlParam("coloring", "Fire"); + } + else if (a_coloring == 3) + { + visualizer.setXmlParam("coloring", "Line"); + } + + setVis (currentMode); +} + +trigger.onLeftButtonDown (int x, int y) +{ + if (isKeyDown(VK_ALT) && isKeyDown(VK_SHIFT) && isKeyDown(VK_CONTROL)) + { + if (visualizer.getXmlParam("fliph") == "1") + { + visualizer.setXmlParam("fliph", "0"); + } + else + { + visualizer.setXmlParam("fliph", "1"); + } + return; + } + + currentMode++; + + if (currentMode == 6) + { + currentMode = 0; + } + + setVis (currentMode); + complete; +} + +trigger.onRightButtonUp (int x, int y) +{ + visMenu = new PopUpMenu; + specmenu = new PopUpMenu; + oscmenu = new PopUpMenu; + pksmenu = new PopUpMenu; + anamenu = new PopUpMenu; + stylemenu = new PopUpMenu; + + visMenu.addCommand("Presets:", 999, 0, 1); + visMenu.addCommand("No Visualization", 100, currentMode == 0, 0); + specmenu.addCommand("Thick Bands", 1, currentMode == 1, 0); + specmenu.addCommand("Thin Bands", 2, currentMode == 2, 0); + visMenu.addSubMenu(specmenu, "Spectrum Analyzer"); + + oscmenu.addCommand("Solid", 3, currentMode == 3, 0); + oscmenu.addCommand("Dots", 4, currentMode == 4, 0); + oscmenu.addCommand("Lines", 5, currentMode == 5, 0); + visMenu.addSubMenu(oscmenu, "Oscilloscope"); + + visMenu.addSeparator(); + visMenu.addCommand("Options:", 102, 0, 1); + visMenu.addCommand("Show Peaks", 101, show_peaks == 1, 0); + pksmenu.addCommand("Slower", 200, p_falloffspeed == 0, 0); + pksmenu.addCommand("Slow", 201, p_falloffspeed == 1, 0); + pksmenu.addCommand("Moderate", 202, p_falloffspeed == 2, 0); + pksmenu.addCommand("Fast", 203, p_falloffspeed == 3, 0); + pksmenu.addCommand("Faster", 204, p_falloffspeed == 4, 0); + visMenu.addSubMenu(pksmenu, "Peak Falloff Speed"); + anamenu.addCommand("Slower", 300, a_falloffspeed == 0, 0); + anamenu.addCommand("Slow", 301, a_falloffspeed == 1, 0); + anamenu.addCommand("Moderate", 302, a_falloffspeed == 2, 0); + anamenu.addCommand("Fast", 303, a_falloffspeed == 3, 0); + anamenu.addCommand("Faster", 304, a_falloffspeed == 4, 0); + visMenu.addSubMenu(anamenu, "Analyzer Falloff Speed"); + stylemenu.addCommand("Normal", 400, a_coloring == 0, 0); + stylemenu.addCommand("Fire", 402, a_coloring == 2, 0); + stylemenu.addCommand("Line", 403, a_coloring == 3, 0); + //visMenu.addSubMenu(stylemenu, "Analyzer Coloring"); + + ProcessMenuResult (visMenu.popAtMouse()); + + delete visMenu; + delete specmenu; + delete oscmenu; + delete pksmenu; + delete anamenu; + delete stylemenu; + + complete; +} + +ProcessMenuResult (int a) +{ + if (a < 1) return; + + if (a > 0 && a <= 6 || a == 100) + { + if (a == 100) a = 0; + setVis(a); + } + + else if (a == 101) + { + show_peaks = (show_peaks - 1) * (-1); + visualizer.setXmlParam("peaks", integerToString(show_peaks)); + setPrivateInt(getSkinName(), "Visualizer show Peaks", show_peaks); + } + + else if (a >= 200 && a <= 204) + { + p_falloffspeed = a - 200; + visualizer.setXmlParam("peakfalloff", integerToString(p_falloffspeed)); + setPrivateInt(getSkinName(), "Visualizer peaks falloff", p_falloffspeed); + } + + else if (a >= 300 && a <= 304) + { + a_falloffspeed = a - 300; + visualizer.setXmlParam("falloff", integerToString(a_falloffspeed)); + setPrivateInt(getSkinName(), "Visualizer analyzer falloff", a_falloffspeed); + } + + else if (a >= 400 && a <= 403) + { + a_coloring = a - 400; + if (a_coloring == 0) + { + visualizer.setXmlParam("coloring", "Normal"); + } + else if (a_coloring == 1) + { + visualizer.setXmlParam("coloring", "Normal"); + } + else if (a_coloring == 2) + { + visualizer.setXmlParam("coloring", "Fire"); + } + else if (a_coloring == 3) + { + visualizer.setXmlParam("coloring", "Line"); + } + setPrivateInt(getSkinName(), "Visualizer analyzer coloring", a_coloring); + } +} + +setVis (int mode) +{ + setPrivateInt(getSkinName(), "Visualizer Mode", mode); + if (mode == 0) + { + visualizer.setMode(0); + } + else if (mode == 1) + { + visualizer.setXmlParam("bandwidth", "wide"); + visualizer.setMode(1); + } + else if (mode == 2) + { + visualizer.setXmlParam("bandwidth", "thin"); + visualizer.setMode(1); + } + else if (mode == 3) + { + visualizer.setXmlParam("oscstyle", "solid"); + visualizer.setMode(2); + } + else if (mode == 4) + { + visualizer.setXmlParam("oscstyle", "dots"); + visualizer.setMode(2); + } + else if (mode == 5) + { + visualizer.setXmlParam("oscstyle", "lines"); + visualizer.setMode(2); + } + currentMode = mode; +} + +// Sync Normal and Shade Layout + +main.onBeforeSwitchToLayout(Layout oldlayout, Layout newlayout) +{ + if (newlayout != thislayout) + { + return; + } + + refreshVisSettings(); +}
\ No newline at end of file diff --git a/Src/resources/skins/Winamp Modern/scripts/visualizer.maki b/Src/resources/skins/Winamp Modern/scripts/visualizer.maki Binary files differnew file mode 100644 index 00000000..4b90d855 --- /dev/null +++ b/Src/resources/skins/Winamp Modern/scripts/visualizer.maki |