mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-18 02:15:46 -04:00
Initial community commit
This commit is contained in:
88
Src/Wasabi/Lib/application.mi
Normal file
88
Src/Wasabi/Lib/application.mi
Normal file
@ -0,0 +1,88 @@
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
// application.mi
|
||||
//
|
||||
// reflects the api_application object into Maki
|
||||
// some of the functions may not make a lot of sense in the context of skin scripting
|
||||
// they are here for completeness
|
||||
// some of these functions duplicate functionality provided in the system object
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#ifndef __APPLICATION_MI
|
||||
#define __APPLICATION_MI
|
||||
|
||||
extern class @{B8E867B0-2715-4da7-A5BA-53DBA1FCFEAC}@ Object _predecl Application;
|
||||
|
||||
//*****************************************************************************
|
||||
// APPLICATION CLASS
|
||||
//*****************************************************************************
|
||||
/**
|
||||
Application Class.
|
||||
|
||||
@short Application Object
|
||||
@author benski
|
||||
@ver 1.0
|
||||
*/
|
||||
|
||||
// static functions
|
||||
extern String Application.GetApplicationName();
|
||||
extern String Application.GetVersionString();
|
||||
extern String Application.GetVersionNumberString();
|
||||
extern int Application.GetBuildNumber();
|
||||
|
||||
/**
|
||||
A unique ID that represents what GUID this application is
|
||||
Winamp 5 is {4BE592C7-6937-426a-A388-ACF0EBC88E93}
|
||||
other Wasabi-based applications (e.g. ClipX, Winamp3, wasabi.player) will have a different GUID
|
||||
however, this maki class only currently resides in Winamp5, so it's a bit irrevelant :)
|
||||
*/
|
||||
extern String Application.GetGUID();
|
||||
|
||||
/**
|
||||
The commandline that Winamp was called with
|
||||
*/
|
||||
extern String Application.GetCommandLine();
|
||||
|
||||
/**
|
||||
Shuts Winamp down.
|
||||
*/
|
||||
extern Application.Shutdown();
|
||||
|
||||
/**
|
||||
cancels an shutdown in progress
|
||||
see note for IsShuttingDown about the futility of this maki script function
|
||||
*/
|
||||
extern Application.CancelShutdown ();
|
||||
|
||||
/**
|
||||
tests if we're in the middle of shutting down winamp.
|
||||
This is part of the application API in Wasabi, so it's reflected here
|
||||
but it might not be of much use to your script,
|
||||
since you'll likely be unloaded before this function
|
||||
ever gets a chance to return true
|
||||
*/
|
||||
extern boolean Application.IsShuttingDown();
|
||||
|
||||
/**
|
||||
Path where winamp.exe (or studio.exe) lives
|
||||
*/
|
||||
extern String Application.GetApplicationPath();
|
||||
|
||||
/**
|
||||
Path where Winamp stores it's settings (studio.xnf, winamp.ini, etc)
|
||||
*/
|
||||
extern String Application.GetSettingsPath();
|
||||
|
||||
/**
|
||||
Gets the current working path. This is the same path that will open by default
|
||||
in Winamp's "Open File" dialog.
|
||||
Working path persists across Winamp launches
|
||||
*/
|
||||
|
||||
extern String Application.GetWorkingPath();
|
||||
|
||||
/**
|
||||
Sets a new working path.
|
||||
*/
|
||||
extern Application.SetWorkingPath(String working_path);
|
||||
|
||||
#endif
|
119
Src/Wasabi/Lib/colormgr.mi
Normal file
119
Src/Wasabi/Lib/colormgr.mi
Normal file
@ -0,0 +1,119 @@
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
// fileio.mi
|
||||
//
|
||||
// standard handles for file input and output (only xml parsing atm)
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#ifndef __COLORMGR_MI
|
||||
#define __COLORMGR_MI
|
||||
|
||||
extern class @{AEE235FF-EBD1-498f-96AF-D7E0DAD4541A}@ System _predecl &ColorMgr;
|
||||
extern class @{95DDB221-00E3-4e2b-8EA5-833548C13C10}@ Object &Color;
|
||||
extern class @{0D024DB9-9574-42d0-B8C7-26B553F1F987}@ Object &GammaSet;
|
||||
extern class @{B81F004D-ACBA-453d-A06B-30192A1DA17D}@ Object &GammaGroup;
|
||||
|
||||
//*****************************************************************************
|
||||
// ColorMgr CLASS
|
||||
//*****************************************************************************
|
||||
/**
|
||||
ColorMgr Class.
|
||||
|
||||
@short Static Object for handling colors
|
||||
@author Nullsoft Inc.
|
||||
@ver 1.0
|
||||
|
||||
*/
|
||||
|
||||
extern Color ColorMgr.getColor (String colorID);
|
||||
extern Color ColorMgr.enumColor (int n);
|
||||
extern int ColorMgr.getNumColors();
|
||||
|
||||
extern GammaSet ColorMgr.getGammaSet (String colorID);
|
||||
extern GammaSet ColorMgr.enumGammaSet (int n);
|
||||
extern GammaSet ColorMgr.getCurrentGammaSet (); // available after ColorMgr.onLoaded() was called
|
||||
extern GammaSet ColorMgr.newGammaSet(String name);
|
||||
extern int ColorMgr.getNumGammaSets ();
|
||||
|
||||
// for the next callbacks u need to instanciate a ColorMgr object.
|
||||
extern ColorMgr.onBeforeLoadingElements(); // stuff is loading, might not work hehe
|
||||
extern ColorMgr.onGuiLoaded(); // skin gui objects loaded from xml
|
||||
extern ColorMgr.onLoaded(); // all done, new skin in place
|
||||
|
||||
extern ColorMgr.onColorThemesListChanged();
|
||||
extern ColorMgr.onColorThemeChanged(String newtheme);
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
// Color CLASS
|
||||
//*****************************************************************************
|
||||
/**
|
||||
Color Class.
|
||||
|
||||
@short Object for handling colors
|
||||
@author Nullsoft Inc.
|
||||
@ver 1.0
|
||||
|
||||
*/
|
||||
|
||||
extern String Color.getID ();
|
||||
extern int Color.getRed ();
|
||||
extern int Color.getGreen ();
|
||||
extern int Color.getBlue ();
|
||||
extern int Color.getRedWithGamma ();
|
||||
extern int Color.getGreenWithGamma ();
|
||||
extern int Color.getBlueWithGamma ();
|
||||
extern int Color.getAlpha ();
|
||||
extern String Color.getGammagroup ();
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
// GammaSet CLASS
|
||||
//*****************************************************************************
|
||||
/**
|
||||
GammaSet Class.
|
||||
|
||||
@short Object for handling gamma sets
|
||||
@author Nullsoft Inc.
|
||||
@ver 1.0
|
||||
|
||||
*/
|
||||
|
||||
extern String GammaSet.getID();
|
||||
extern GammaSet.apply();
|
||||
extern GammaSet.remove(); // u should still delete the object then
|
||||
extern GammaSet.rename(String newname);
|
||||
extern GammaSet.update(); // Syncs missing groups
|
||||
extern GammaGroup Gammaset.getGeneralGroup();
|
||||
extern int Gammaset.getNumGammaGroups();
|
||||
extern GammaGroup Gammaset.enumGammaGroup(int n);
|
||||
extern GammaGroup Gammaset.getGammaGroup(String name);
|
||||
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
// GammaGroup CLASS
|
||||
//*****************************************************************************
|
||||
/**
|
||||
GammaGroup Class.
|
||||
|
||||
@short Object for handling gamma groups
|
||||
@author Nullsoft Inc.
|
||||
@ver 1.0
|
||||
|
||||
*/
|
||||
|
||||
extern String Gammagroup.getID ();
|
||||
extern int Gammagroup.getRed ();
|
||||
extern int Gammagroup.getGreen ();
|
||||
extern int Gammagroup.getBlue ();
|
||||
extern int Gammagroup.getBoost ();
|
||||
extern int Gammagroup.getGray ();
|
||||
|
||||
extern Gammagroup.setID (String id);
|
||||
extern Gammagroup.setRed (int _color);
|
||||
extern Gammagroup.setGreen (int _color);
|
||||
extern Gammagroup.setBlue (int _color);
|
||||
extern Gammagroup.setBoost (int _color);
|
||||
extern Gammagroup.setGray (int _color);
|
||||
|
||||
#endif
|
100
Src/Wasabi/Lib/com/AutoRepeatButton.m
Normal file
100
Src/Wasabi/Lib/com/AutoRepeatButton.m
Normal file
@ -0,0 +1,100 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
// AutoRepeatButton.m Orginal Code By Will Fisher, Concept By Eric Moore, Rewritten By Will Fisher
|
||||
//
|
||||
// Use like this:
|
||||
// #include </lib/AutoRepeatButton.m>
|
||||
// Global AutoRepeatButton MyButton, MyOtherButton;
|
||||
//
|
||||
// Fill in the buttons function into MyButton.OnLeftClick() as normal.
|
||||
//
|
||||
// Use AutoRepeat_ClickType to find the type of call to MyButton.onLeftClick() where
|
||||
// AutoRepeat_ClickType==1 is the first call to onLeftClick
|
||||
// AutoRepeat_ClickType==2 is a subsequent call to onLeftClick
|
||||
// AutoRepeat_ClickType==0 is an erronious call to onLeftClick, you should usually ignore
|
||||
// MyButton.onLeftClick() in this case
|
||||
// See other functions below:
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Function AutoRepeat_Load(); // ALWAYS call this in System.OnScriptLoaded()
|
||||
Function AutoRepeat_Unload(); // ALWAYS call this in System.OnScriptUnloading()
|
||||
Function AutoRepeat_Stop(); // stop the current button from autorepeating
|
||||
|
||||
Function Button AutoRepeat_GetCurrentButton(); /* returns the currently autorepeating button,
|
||||
returns NULL if no button is autorepeating */
|
||||
|
||||
Function AutoRepeat_SetInitalDelay(int millis); /* set this for the first delay when the button is
|
||||
pressed, defaults to 800ms (no need to use this
|
||||
unless other delay is required) */
|
||||
|
||||
Function AutoRepeat_SetRepeatDelay(int millis); /* set this for the subsequent delay, defaults to
|
||||
80ms (no need to use this unless other delay is
|
||||
required) */
|
||||
|
||||
Function Int AutoRepeat_GetInitalDelay(); // get the first delay length in millisecs
|
||||
Function Int AutoRepeat_GetRepeatDelay(); // get the subsequent delay in millisecs
|
||||
|
||||
Class Button AutoRepeatButton;
|
||||
|
||||
Global Timer _autorepeatTimer;
|
||||
Global Int _InitialDelay;
|
||||
Global Int _RepeatDelay;
|
||||
Global Int AutoRepeat_ClickType;
|
||||
Global Button _Latched;
|
||||
|
||||
AutoRepeatButton.onLeftButtonDown(int x, int y) {
|
||||
_Latched = AutoRepeatButton;
|
||||
AutoRepeat_ClickType = 1; // first click
|
||||
AutoRepeatButton.leftClick();
|
||||
AutoRepeat_ClickType = 0; // no click
|
||||
_autorepeatTimer.setDelay(_InitialDelay);
|
||||
_autorepeatTimer.start();
|
||||
}
|
||||
|
||||
AutoRepeatButton.onLeftButtonUp(int x, int y) {
|
||||
_AutoRepeatTimer.Stop();
|
||||
_Latched = NULL;
|
||||
}
|
||||
|
||||
_AutoRepeatTimer.onTimer() {
|
||||
if(_autorepeatTimer.getDelay() != _RepeatDelay) _autorepeatTimer.setDelay(_RepeatDelay);
|
||||
AutoRepeat_ClickType = 2; // AutoRepeat
|
||||
_Latched.LeftClick();
|
||||
AutoRepeat_ClickType = 0; // no click
|
||||
}
|
||||
|
||||
AutoRepeat_Load() {
|
||||
_autoRepeatTimer = new Timer;
|
||||
_InitialDelay = 800;
|
||||
_RepeatDelay = 80;
|
||||
AutoRepeat_ClickType = 0;
|
||||
}
|
||||
|
||||
AutoRepeat_Unload() {
|
||||
delete _autoRepeatTimer;
|
||||
}
|
||||
|
||||
AutoRepeat_SetInitalDelay(int millis) {
|
||||
_InitialDelay = millis;
|
||||
}
|
||||
|
||||
|
||||
AutoRepeat_SetRepeatDelay(int millis) {
|
||||
_RepeatDelay = millis;
|
||||
}
|
||||
|
||||
AutoRepeat_GetInitalDelay() {
|
||||
return _InitialDelay;
|
||||
}
|
||||
|
||||
AutoRepeat_GetRepeatDelay() {
|
||||
return _repeatDelay;
|
||||
}
|
||||
|
||||
AutoRepeat_Stop() {
|
||||
_autorepeatTimer.stop();
|
||||
_Latched = NULL;
|
||||
}
|
||||
|
||||
AutoRepeat_GetCurrentButton() {
|
||||
return _Latched;
|
||||
}
|
84
Src/Wasabi/Lib/com/centerlayer.m
Normal file
84
Src/Wasabi/Lib/com/centerlayer.m
Normal file
@ -0,0 +1,84 @@
|
||||
// ----------------------------------------------------------------------
|
||||
// centerlayer.m
|
||||
// ----------------------------------------------------------------------
|
||||
// by Brennan
|
||||
// Use like this :
|
||||
// #define CENTER_VAR MyVar
|
||||
// Global MyVar;
|
||||
// #include "centerlayer.h"
|
||||
// Group l = ;
|
||||
// MyVar = l.getObject("something");
|
||||
// _MyVarInit(Layer MyVar, Group l, int centerx, int centery);
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Global GuiObject _##CENTER_VAR##Layer;
|
||||
Global Group _##CENTER_VAR##Group; // parent Layout to center in
|
||||
Global Int _##CENTER_VAR##centerx; // should we center x?
|
||||
Global Int _##CENTER_VAR##centery; // should we center y?
|
||||
Global Int _##CENTER_VAR##addx = 0;
|
||||
Global Int _##CENTER_VAR##addy = 0;
|
||||
Global Int _##CENTER_VAR##addh = 0;
|
||||
Global Int _##CENTER_VAR##addw = 0;
|
||||
|
||||
Function _##CENTER_VAR##Init(GuiObject _layer, Group parentLayout, int centerx, int centery);
|
||||
Function _##CENTER_VAR##handleResize();
|
||||
Function _##CENTER_VAR##setXSpace(int val);
|
||||
Function _##CENTER_VAR##setYSpace(int val);
|
||||
Function _##CENTER_VAR##setWSpace(int val);
|
||||
Function _##CENTER_VAR##setHSpace(int val);
|
||||
Function _##CENTER_VAR##sizeError(boolean iserror);
|
||||
|
||||
_##CENTER_VAR##Init(GuiObject _layer, Group parentLayout, int centerx, int centery) {
|
||||
_##CENTER_VAR##Layer = _layer;
|
||||
_##CENTER_VAR##Group = parentLayout;
|
||||
_##CENTER_VAR##centerx = centerx;
|
||||
_##CENTER_VAR##centery = centery;
|
||||
_##CENTER_VAR##handleResize();
|
||||
}
|
||||
|
||||
_##CENTER_VAR##setXSpace(int val)
|
||||
{
|
||||
_##CENTER_VAR##addx = val;
|
||||
}
|
||||
|
||||
_##CENTER_VAR##setYSpace(int val)
|
||||
{
|
||||
_##CENTER_VAR##addy = val;
|
||||
}
|
||||
_##CENTER_VAR##setHSpace(int val)
|
||||
{
|
||||
_##CENTER_VAR##addh = val;
|
||||
}
|
||||
_##CENTER_VAR##setWSpace(int val)
|
||||
{
|
||||
_##CENTER_VAR##addw = val;
|
||||
}
|
||||
|
||||
_##CENTER_VAR##handleResize() {
|
||||
int myw = _##CENTER_VAR##Group.getWidth();
|
||||
int myh = _##CENTER_VAR##Group.getHeight();
|
||||
|
||||
int layerw = _##CENTER_VAR##Layer.getWidth();
|
||||
int layerh = _##CENTER_VAR##Layer.getHeight();
|
||||
|
||||
int x = _##CENTER_VAR##Layer.getLeft();
|
||||
int y = _##CENTER_VAR##Layer.getTop();
|
||||
|
||||
if (_##CENTER_VAR##centerx) _##CENTER_VAR##Layer.setXmlParam("x", integerToString((myw - layerw)/2 + _##CENTER_VAR##addx + _##CENTER_VAR##addw));
|
||||
if (_##CENTER_VAR##centery) _##CENTER_VAR##Layer.setXmlParam("y", integerToString((myh - layerh)/2 + _##CENTER_VAR##addy + _##CENTER_VAR##addh));
|
||||
|
||||
if (myw < layerw + 2*_##CENTER_VAR##addx - _##CENTER_VAR##addw || myh < layerh + _##CENTER_VAR##addy - _##CENTER_VAR##addh)
|
||||
{
|
||||
_##CENTER_VAR##sizeError(TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
_##CENTER_VAR##sizeError(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
_##CENTER_VAR##sizeError(boolean iserror) {}
|
||||
|
||||
_##CENTER_VAR##Group.onResize(int x, int y, int w, int h) {
|
||||
_##CENTER_VAR##handleResize();
|
||||
}
|
118
Src/Wasabi/Lib/com/customseek.m
Normal file
118
Src/Wasabi/Lib/com/customseek.m
Normal file
@ -0,0 +1,118 @@
|
||||
//----------------------------------------------------------------------------------------
|
||||
//
|
||||
// customseek.m
|
||||
//
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Use like this :
|
||||
// #define CUSTOM_SEEK_VAR MyVar
|
||||
// #include "customseek.m"
|
||||
//
|
||||
//
|
||||
// What you need :
|
||||
// _MyVarInit(Layer seeksurface, Layer seekghost, Map seekmap);
|
||||
// _MyVarShutdown();
|
||||
//
|
||||
|
||||
|
||||
|
||||
Global Layer _##CUSTOM_SEEK_VAR##Surface;
|
||||
Global Layer _##CUSTOM_SEEK_VAR##Ghost;
|
||||
Global Map _##CUSTOM_SEEK_VAR##Map;
|
||||
Global Int _##CUSTOM_SEEK_VAR##Clicked;
|
||||
Global Timer _##CUSTOM_SEEK_VAR##Timer;
|
||||
Global Int _##CUSTOM_SEEK_VAR##CurPos;
|
||||
|
||||
Function _##CUSTOM_SEEK_VAR##Init(Layer s, Layer g, Map m);
|
||||
Function _##CUSTOM_SEEK_VAR##Update(int newpos);
|
||||
Function _##CUSTOM_SEEK_VAR##UpdateXY(int x, int y);
|
||||
Function _##CUSTOM_SEEK_VAR##SeekTo(int x, int y);
|
||||
Function _##CUSTOM_SEEK_VAR##Shutdown();
|
||||
|
||||
_##CUSTOM_SEEK_VAR##Init(Layer s, Layer g, Map m) {
|
||||
_##CUSTOM_SEEK_VAR##Surface = s;
|
||||
_##CUSTOM_SEEK_VAR##Ghost = g;
|
||||
_##CUSTOM_SEEK_VAR##Map = m;
|
||||
_##CUSTOM_SEEK_VAR##Update(0);
|
||||
_##CUSTOM_SEEK_VAR##Timer = new Timer;
|
||||
_##CUSTOM_SEEK_VAR##Timer.setDelay(500);
|
||||
_##CUSTOM_SEEK_VAR##Timer.start();
|
||||
}
|
||||
|
||||
_##CUSTOM_SEEK_VAR##Shutdown() {
|
||||
delete _##CUSTOM_SEEK_VAR##Timer;
|
||||
}
|
||||
|
||||
_##CUSTOM_SEEK_VAR##Surface.onLeftButtonDown(int x, int y) {
|
||||
if (getPlayItemLength() <= 0) return;
|
||||
if (Strleft(getPlayItemString(), 4) == "http") return;
|
||||
_##CUSTOM_SEEK_VAR##Clicked = 1;
|
||||
_##CUSTOM_SEEK_VAR##UpdateXY(x, y);
|
||||
}
|
||||
|
||||
_##CUSTOM_SEEK_VAR##Surface.onMouseMove(int x, int y) {
|
||||
if (_##CUSTOM_SEEK_VAR##Clicked) {
|
||||
if (getPlayItemLength() == 0) {
|
||||
_##CUSTOM_SEEK_VAR##Clicked = 0;
|
||||
return;
|
||||
}
|
||||
_##CUSTOM_SEEK_VAR##UpdateXY(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
_##CUSTOM_SEEK_VAR##Surface.onLeftButtonUp(int x, int y) {
|
||||
if (!_##CUSTOM_SEEK_VAR##Clicked) return;
|
||||
_##CUSTOM_SEEK_VAR##Clicked = 0;
|
||||
_##CUSTOM_SEEK_VAR##SeekTo(x, y);
|
||||
}
|
||||
|
||||
_##CUSTOM_SEEK_VAR##SeekTo(int x, int y) {
|
||||
int n = _##CUSTOM_SEEK_VAR##Map.getValue(x, y);
|
||||
seekTo(getPlayItemLength() * (n / 255));
|
||||
}
|
||||
|
||||
_##CUSTOM_SEEK_VAR##UpdateXY(int x, int y) {
|
||||
int n = _##CUSTOM_SEEK_VAR##Map.getValue(x, y);
|
||||
Region r = new Region;
|
||||
r.loadFromMap(_##CUSTOM_SEEK_VAR##Map, n, 1);
|
||||
r.offset(-_##CUSTOM_SEEK_VAR##Ghost.getLeft(), -_##CUSTOM_SEEK_VAR##Ghost.getTop());
|
||||
_##CUSTOM_SEEK_VAR##Ghost.setRegion(r);
|
||||
#ifdef CUSTOM_SEEK_CALLBACK
|
||||
int n = _##CUSTOM_SEEK_VAR##Map.getValue(x, y);
|
||||
_##CUSTOM_SEEK_VAR##OnUpdate(r, getPlayItemLength() * (n / 255));
|
||||
#endif
|
||||
delete r;
|
||||
}
|
||||
|
||||
_##CUSTOM_SEEK_VAR##Update(int newpos) {
|
||||
float p;
|
||||
int l = getPlayItemLength();
|
||||
if (l == 0) p = 0;
|
||||
else p = newpos / l * 255;
|
||||
Region r = new Region;
|
||||
r.loadFromMap(_##CUSTOM_SEEK_VAR##Map, p, 1);
|
||||
_##CUSTOM_SEEK_VAR##CurPos = p;
|
||||
r.offset(-_##CUSTOM_SEEK_VAR##Ghost.getLeft(), -_##CUSTOM_SEEK_VAR##Ghost.getTop());
|
||||
_##CUSTOM_SEEK_VAR##Ghost.setRegion(r);
|
||||
#ifdef CUSTOM_SEEK_CALLBACK
|
||||
_##CUSTOM_SEEK_VAR##OnUpdate(r, newpos);
|
||||
#endif
|
||||
delete r;
|
||||
}
|
||||
|
||||
_##CUSTOM_SEEK_VAR##Timer.onTimer() {
|
||||
if (_##CUSTOM_SEEK_VAR##Clicked) return;
|
||||
int l = getPlayItemLength();
|
||||
if (l > 0) {
|
||||
int p = getPosition() / l * 255;
|
||||
if (p != _##CUSTOM_SEEK_VAR##CurPos) {
|
||||
_##CUSTOM_SEEK_VAR##Update(getPosition());
|
||||
}
|
||||
} else {
|
||||
if (_##CUSTOM_SEEK_VAR##CurPos != 0)
|
||||
_##CUSTOM_SEEK_VAR##Update(0);
|
||||
_##CUSTOM_SEEK_VAR##CurPos = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
52
Src/Wasabi/Lib/com/debug.m
Normal file
52
Src/Wasabi/Lib/com/debug.m
Normal file
@ -0,0 +1,52 @@
|
||||
/*---------------------------------------------------
|
||||
-----------------------------------------------------
|
||||
Filename: debug.m
|
||||
Version: 1.2
|
||||
|
||||
Type: maki/attrib loader
|
||||
Date: 29. Aug. 2006 - 23:43
|
||||
Author: Martin Poehlmann aka Deimos
|
||||
E-Mail: martin@skinconsortium.com
|
||||
Internet: www.skinconsortium.com
|
||||
www.martin.deimos.de.vu
|
||||
-----------------------------------------------------
|
||||
---------------------------------------------------*/
|
||||
|
||||
#ifndef included
|
||||
#error This script can only be compiled as a #include
|
||||
#endif
|
||||
|
||||
#ifndef DEBUG
|
||||
#define debugString //
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
#define DEBUG_PREFIX "["+ FILE_NAME +": " + getTimeStamp() + "] " +
|
||||
|
||||
Function String getTimeStamp();
|
||||
String getTimeStamp()
|
||||
{
|
||||
int msc = getTimeOfDay();
|
||||
int h = msc / 1000 / 3600;
|
||||
msc -= h * 1000 * 3600;
|
||||
int m = msc / 1000 / 60;
|
||||
msc -= m * 1000 * 60;
|
||||
int s = msc / 1000;
|
||||
msc -= s * 1000;
|
||||
string zeros = "";
|
||||
if (msc < 100)
|
||||
{
|
||||
zeros += "0";
|
||||
}
|
||||
if (msc < 10)
|
||||
{
|
||||
zeros += "0";
|
||||
}
|
||||
return integerToString(h)+":"+integerToString(m)+":"+integerToString(s)+"."+zeros+integerToString(msc);
|
||||
}
|
||||
|
||||
#define D_WTF 9
|
||||
#define D_NWTF 9
|
||||
|
||||
#endif
|
99
Src/Wasabi/Lib/com/dispatch_ifc.m
Normal file
99
Src/Wasabi/Lib/com/dispatch_ifc.m
Normal file
@ -0,0 +1,99 @@
|
||||
/**
|
||||
* dispatch_ifc.m
|
||||
*
|
||||
* defines a function interface for dispatchable messaging
|
||||
* define DISPATCH before loading if you are a message reciever
|
||||
*
|
||||
* @author mpdeimos
|
||||
* @date 2008/10/25
|
||||
* @version 0.1
|
||||
*/
|
||||
|
||||
#ifndef included
|
||||
#error This script can only be compiled as a #include
|
||||
#endif
|
||||
|
||||
Function initDispatcher(); // Call this function on startup to set the parent layout as dispatcher
|
||||
Function setDispatcher(GuiObject dispatcher); // Call this function instead if you want to define a custom
|
||||
|
||||
#ifndef DISPATCH
|
||||
// Sends a message to the parent layout
|
||||
Function int sendMessage(int message, int i0, int i1, int i2, String s0, String s1, GuiObject obj);
|
||||
Function int sendMessageI(int message, int i0);
|
||||
Function int sendMessageI2(int message, int i0, int i1);
|
||||
Function int sendMessageS(int message, String s0);
|
||||
Function int sendMessageO(int message, GuiObject obj);
|
||||
Function int sendMessageV(int message);
|
||||
#endif
|
||||
|
||||
#ifdef DISPATCH
|
||||
// Recieves Messages
|
||||
Function int onMessage(int message, int i0, int i1, int i2, String s0, String s1, GuiObject obj);
|
||||
int onMessage(int message, int i0, int i1, int i2, String s0, String s1, GuiObject obj) {} // STUB! Implement this in your code
|
||||
#endif
|
||||
|
||||
|
||||
///
|
||||
/// IMPLEMENTATION
|
||||
///
|
||||
|
||||
|
||||
Global GuiObject dispatcher;
|
||||
|
||||
initDispatcher()
|
||||
{
|
||||
dispatcher = getScriptGroup().getParentLayout();
|
||||
}
|
||||
|
||||
setDispatcher(GuiObject go)
|
||||
{
|
||||
dispatcher = go;
|
||||
}
|
||||
|
||||
|
||||
#ifndef DISPATCH
|
||||
|
||||
int sendMessage(int message, int i0, int i1, int i2, String s0, String s1, GuiObject obj)
|
||||
{
|
||||
return dispatcher.onAction (s0, s1, message, i0, i1, i2, obj);
|
||||
}
|
||||
|
||||
int sendMessageI(int message, int i0)
|
||||
{
|
||||
GuiObject obj = NULL;
|
||||
return sendMessage(message, i0, i1, 0, "", "", obj);
|
||||
}
|
||||
|
||||
int sendMessageI2(int message, int i0, int i1)
|
||||
{
|
||||
GuiObject obj = NULL;
|
||||
return sendMessage(message, i0, 0, 0, "", "", obj);
|
||||
}
|
||||
|
||||
int sendMessageS(int message, String s0)
|
||||
{
|
||||
GuiObject obj = NULL;
|
||||
return sendMessage(message, 0, 0, 0, s0, "", obj);
|
||||
}
|
||||
|
||||
int sendMessageO(int message, GuiObject obj)
|
||||
{
|
||||
return sendMessage(message, 0, 0, 0, "", "", obj);
|
||||
}
|
||||
|
||||
int sendMessageV(int messagej)
|
||||
{
|
||||
GuiObject obj = NULL;
|
||||
return sendMessage(message, 0, 0, 0, "", "", obj);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef DISPATCH
|
||||
|
||||
dispatcher.onAction(String action, String param, Int message, int y, int p1, int p2, GuiObject source)
|
||||
{
|
||||
return onMessage(message, y, p1, p2, action, param, source);
|
||||
}
|
||||
|
||||
#endif
|
67
Src/Wasabi/Lib/com/dragvolume.m
Normal file
67
Src/Wasabi/Lib/com/dragvolume.m
Normal file
@ -0,0 +1,67 @@
|
||||
//----------------------------------------------------------------------------------------
|
||||
//
|
||||
// dragvolume.m
|
||||
//
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Use like this :
|
||||
// #define DRAG_VOLUME_VAR MyVar
|
||||
// #include "dragvolume.m"
|
||||
//
|
||||
//
|
||||
// _MyVarInit(AnimatedLayer l); // init dragvolume
|
||||
// _MyVarSetMaxDistance(Int nPixels); // set 100% pixel distance
|
||||
//
|
||||
|
||||
|
||||
|
||||
Global AnimatedLayer _##DRAG_VOLUME_VAR##AnimLayer;
|
||||
Global Int _##DRAG_VOLUME_VAR##Clicked;
|
||||
Global Int _##DRAG_VOLUME_VAR##Y;
|
||||
Global Int _##DRAG_VOLUME_VAR##V;
|
||||
Global Int _##DRAG_VOLUME_VAR##Max;
|
||||
|
||||
Function _##DRAG_VOLUME_VAR##Init(AnimatedLayer l);
|
||||
Function _##DRAG_VOLUME_VAR##Update(int vol);
|
||||
Function _##DRAG_VOLUME_VAR##SetMaxDistance(int pixels);
|
||||
Function _##DRAG_VOLUME_VAR##UpdateY(int y);
|
||||
|
||||
_##DRAG_VOLUME_VAR##Init(AnimatedLayer l) {
|
||||
_##DRAG_VOLUME_VAR##AnimLayer = l;
|
||||
_##DRAG_VOLUME_VAR##Update(getVolume());
|
||||
}
|
||||
|
||||
_##DRAG_VOLUME_VAR##AnimLayer.onLeftButtonDown(int x, int y) {
|
||||
_##DRAG_VOLUME_VAR##Clicked = 1;
|
||||
_##DRAG_VOLUME_VAR##Y = y;
|
||||
_##DRAG_VOLUME_VAR##V = getVolume();
|
||||
}
|
||||
|
||||
_##DRAG_VOLUME_VAR##AnimLayer.onMouseMove(int x, int y) {
|
||||
if (_##DRAG_VOLUME_VAR##Clicked) {
|
||||
_##DRAG_VOLUME_VAR##updateY(y);
|
||||
}
|
||||
}
|
||||
|
||||
_##DRAG_VOLUME_VAR##AnimLayer.onLeftButtonUp(int x, int y) {
|
||||
_##DRAG_VOLUME_VAR##Clicked = 0;
|
||||
}
|
||||
|
||||
_##DRAG_VOLUME_VAR##SetMaxDistance(int npix) {
|
||||
_##DRAG_VOLUME_VAR##Max = npix;
|
||||
}
|
||||
|
||||
_##DRAG_VOLUME_VAR##UpdateY(int y) {
|
||||
float p = (_##DRAG_VOLUME_VAR##Y - y) / _##DRAG_VOLUME_VAR##Max;
|
||||
SetVolume(_##DRAG_VOLUME_VAR##V + p * 255); // range is checked
|
||||
}
|
||||
|
||||
_##DRAG_VOLUME_VAR##Update(int vol) {
|
||||
float p = vol / 255;
|
||||
_##DRAG_VOLUME_VAR##AnimLayer.gotoFrame(p * (_##DRAG_VOLUME_VAR##AnimLayer.getLength()-1));
|
||||
}
|
||||
|
||||
#ifndef _##DRAG_VOLUME_VAR##NOSYSTEMHOOK
|
||||
System.onVolumeChanged(int newvol) {
|
||||
_##DRAG_VOLUME_VAR##Update(newvol);
|
||||
}
|
||||
#endif
|
173
Src/Wasabi/Lib/com/fillbar.m
Normal file
173
Src/Wasabi/Lib/com/fillbar.m
Normal file
@ -0,0 +1,173 @@
|
||||
/**
|
||||
* fillbar.m
|
||||
*
|
||||
* Manages custom fillbars.
|
||||
*
|
||||
* @package com.winamp.maki.lib.community.fillbar
|
||||
* @author mpdeimos
|
||||
* @date 08/10/01
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
#ifndef included
|
||||
#error This script can only be compiled as a #include
|
||||
#endif
|
||||
|
||||
Class Layer FillBar;
|
||||
// {
|
||||
Member Map FillBar.fillmap;
|
||||
Member int FillBar.pos;
|
||||
Member boolean Fillbar.reverse;
|
||||
|
||||
// User dragging stuff
|
||||
Member boolean Fillbar.dragable;
|
||||
Member boolean Fillbar.dragging;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param layer that should be handled like a fillbar
|
||||
* @param bitmapID that should be used as region map
|
||||
* @ret FillBar object
|
||||
*/
|
||||
Function FillBar FillBar_construct(Layer l, String bitmapID);
|
||||
Function FillBar_setMap(FillBar fb, String bitmapID);
|
||||
|
||||
/**
|
||||
* destructor, always call on script unloading
|
||||
*
|
||||
*/
|
||||
Function FillBar_destruct(FillBar fb);
|
||||
|
||||
/**
|
||||
* sets the region
|
||||
*
|
||||
* @param fillbar to act on
|
||||
* @param threshold of the map to generate a region
|
||||
*/
|
||||
Function FillBar_setPosition(FillBar fb, int threshold);
|
||||
|
||||
/**
|
||||
* called each time the users drags the fillbar
|
||||
*
|
||||
* @param The dragged FillBar
|
||||
* @param The alue the FillBar was dragged to.
|
||||
* @ret FALSE if you do not want to allow dragging.
|
||||
*/
|
||||
Function boolean FillBar_onDrag(FillBar fb, int pos);
|
||||
|
||||
/*
|
||||
* called each time the users ends dragging the fillbar
|
||||
*
|
||||
* @param The dragged FillBar
|
||||
* @param The alue the FillBar was dragged to.
|
||||
* @ret FALSE if you do not want to allow dragging.
|
||||
*/
|
||||
Function boolean FillBar_onEndDrag(FillBar fb, int pos);
|
||||
|
||||
|
||||
/*
|
||||
* IMPLEMENTATION
|
||||
*/
|
||||
|
||||
FillBar FillBar_construct(Layer l, String bitmapID)
|
||||
{
|
||||
FillBar fb = l;
|
||||
fb.reverse = TRUE;
|
||||
fb.fillmap = new Map;
|
||||
fb.fillmap.loadMap(bitmapID);
|
||||
return fb;
|
||||
}
|
||||
|
||||
FillBar_setMap(Fillbar fb, String bitmapID)
|
||||
{
|
||||
if (fb.fillmap != NULL)
|
||||
{
|
||||
delete fb.fillmap;
|
||||
}
|
||||
|
||||
fb.fillmap = new Map;
|
||||
fb.fillmap.loadMap(bitmapID);
|
||||
}
|
||||
|
||||
FillBar_destruct(FillBar fb)
|
||||
{
|
||||
Map tmp = fb.fillmap;
|
||||
delete tmp;
|
||||
}
|
||||
|
||||
FillBar_setPosition(FillBar fb, int threshold)
|
||||
{
|
||||
fb.pos = threshold;
|
||||
fb.setRegionFromMap(fb.fillmap, threshold, fb.reverse);
|
||||
}
|
||||
|
||||
|
||||
// User dragging handles
|
||||
|
||||
FillBar.onLeftButtonDown (int x, int y)
|
||||
{
|
||||
if (!FillBar.dragable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Fillbar.dragging = TRUE;
|
||||
}
|
||||
|
||||
FillBar.onMouseMove (int x, int y)
|
||||
{
|
||||
if (!FillBar.dragable || !Fillbar.dragging)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int mouseLeft = x - FillBar.getLeft();
|
||||
int mouseTop = y - Fillbar.getTop();
|
||||
|
||||
if (!FillBar.fillMap.inRegion(mouseLeft, mouseTop))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int position = FillBar.fillMap.getValue(mouseLeft, mouseTop);
|
||||
|
||||
int update = FillBar_onDrag(FillBar, position);
|
||||
|
||||
if (update)
|
||||
{
|
||||
FillBar_setPosition(FillBar, position);
|
||||
}
|
||||
}
|
||||
|
||||
Fillbar.onLeftButtonUp (int x, int y)
|
||||
{
|
||||
if (!FillBar.dragable || !Fillbar.dragging)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int mouseLeft = x - FillBar.getLeft();
|
||||
int mouseTop = y - Fillbar.getTop();
|
||||
|
||||
int position = FillBar.fillMap.getValue(mouseLeft, mouseTop);
|
||||
|
||||
if (!FillBar.fillMap.inRegion(mouseLeft, mouseTop))
|
||||
{
|
||||
position = fb.pos;
|
||||
}
|
||||
|
||||
int update = FillBar_onEndDrag(FillBar, position);
|
||||
|
||||
if (update)
|
||||
{
|
||||
FillBar_setPosition(FillBar, position);
|
||||
}
|
||||
|
||||
Fillbar.dragging = FALSE;
|
||||
}
|
||||
|
||||
// Callback Stubs
|
||||
boolean FillBar_onDrag(Fillbar fb, int pos) { return TRUE; }
|
||||
boolean FillBar_onEndDrag(Fillbar fb, int pos) { return TRUE; }
|
||||
// }
|
111
Src/Wasabi/Lib/com/glow.m
Normal file
111
Src/Wasabi/Lib/com/glow.m
Normal file
@ -0,0 +1,111 @@
|
||||
/*---------------------------------------------------
|
||||
-----------------------------------------------------
|
||||
Filename: glow.m
|
||||
Version: 1.0
|
||||
|
||||
Type: maki/glow class
|
||||
Date: 16. Jun. 2007 - 23:13
|
||||
Author: Martin Poehlmann aka Deimos
|
||||
E-Mail: martin@skinconsortium.com
|
||||
Internet: www.skinconsortium.com
|
||||
www.martin.deimos.de.vu
|
||||
|
||||
Usage: 1: #include glow.m
|
||||
2: #define GLOW_OBJECT MyGlow
|
||||
3: call _MyGlow_GlowInit (someObj, otherObj)
|
||||
to init the objects.
|
||||
You can also call _MyGlow_GlowInit (NULL, otherObj)
|
||||
and load a bunch of GuiObjects in _MyGlow_GlowTrigger
|
||||
or load up to 5 objects via _MyGlow_addTarget(obj);
|
||||
|
||||
-----------------------------------------------------
|
||||
---------------------------------------------------*/
|
||||
|
||||
#ifndef included
|
||||
#error This script can only be compiled as a #include
|
||||
#endif
|
||||
|
||||
#ifndef GLOW_OBJECT
|
||||
#error GLOW_OBJECT not defined!
|
||||
#endif
|
||||
|
||||
Class GuiObject _##GLOW_OBJECT##_GlowTrigger;
|
||||
Global _##GLOW_OBJECT##_GlowTrigger _##GLOW_OBJECT##_trigger0, _##GLOW_OBJECT##_trigger1, _##GLOW_OBJECT##_trigger2, _##GLOW_OBJECT##_trigger3, _##GLOW_OBJECT##_trigger4, _##GLOW_OBJECT##_trigger5;
|
||||
Global GuiObject _##GLOW_OBJECT##_glow;
|
||||
Global float _##GLOW_OBJECT##_fdoutspeed;
|
||||
Global boolean _##GLOW_OBJECT##_mouseDown;
|
||||
|
||||
Function _##GLOW_OBJECT##_GlowInit (GuiObject triggerObject, GuiObject glowObject, float fdoutspeed);
|
||||
Function _##GLOW_OBJECT##_addTrigger (GuiObject triggerObject);
|
||||
|
||||
_##GLOW_OBJECT##_GlowInit (GuiObject triggerObject, GuiObject glowObject, float fdoutspeed)
|
||||
{
|
||||
if (triggerObject) _##GLOW_OBJECT##_trigger0 = triggerObject;
|
||||
if (glowObject) _##GLOW_OBJECT##_glow = glowObject;
|
||||
|
||||
_##GLOW_OBJECT##_fdoutspeed = fdoutspeed;
|
||||
}
|
||||
|
||||
_##GLOW_OBJECT##_addTrigger(GuiObject triggerObject)
|
||||
{
|
||||
if (triggerObject)
|
||||
{
|
||||
if (!_##GLOW_OBJECT##_trigger1)
|
||||
{
|
||||
_##GLOW_OBJECT##_trigger1 = triggerObject;
|
||||
return;
|
||||
}
|
||||
if (!_##GLOW_OBJECT##_trigger2)
|
||||
{
|
||||
_##GLOW_OBJECT##_trigger2 = triggerObject;
|
||||
return;
|
||||
}
|
||||
if (!_##GLOW_OBJECT##_trigger3)
|
||||
{
|
||||
_##GLOW_OBJECT##_trigger3 = triggerObject;
|
||||
return;
|
||||
}
|
||||
if (!_##GLOW_OBJECT##_trigger4)
|
||||
{
|
||||
_##GLOW_OBJECT##_trigger4 = triggerObject;
|
||||
return;
|
||||
}
|
||||
if (!_##GLOW_OBJECT##_trigger5)
|
||||
{
|
||||
_##GLOW_OBJECT##_trigger5 = triggerObject;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_##GLOW_OBJECT##_GlowTrigger.onEnterArea ()
|
||||
{
|
||||
_##GLOW_OBJECT##_glow.cancelTarget();
|
||||
_##GLOW_OBJECT##_glow.setAlpha(255);
|
||||
}
|
||||
|
||||
_##GLOW_OBJECT##_GlowTrigger.onLeftButtonDown (int x, int y)
|
||||
{
|
||||
_##GLOW_OBJECT##_mouseDown = 1;
|
||||
_##GLOW_OBJECT##_glow.cancelTarget();
|
||||
_##GLOW_OBJECT##_glow.setAlpha(0);
|
||||
}
|
||||
|
||||
_##GLOW_OBJECT##_GlowTrigger.onLeftButtonUp (int x, int y)
|
||||
{
|
||||
_##GLOW_OBJECT##_mouseDown = 0;
|
||||
_##GLOW_OBJECT##_glow.cancelTarget();
|
||||
if (_##GLOW_OBJECT##_GlowTrigger.isMouseOverRect()) _##GLOW_OBJECT##_glow.setAlpha(255);
|
||||
}
|
||||
|
||||
_##GLOW_OBJECT##_GlowTrigger.onLeaveArea ()
|
||||
{
|
||||
if (_##GLOW_OBJECT##_mouseDown) return;
|
||||
_##GLOW_OBJECT##_glow.cancelTarget();
|
||||
_##GLOW_OBJECT##_glow.setTargetA(0);
|
||||
_##GLOW_OBJECT##_glow.setTargetX(_##GLOW_OBJECT##_glow.getGuiX());
|
||||
_##GLOW_OBJECT##_glow.setTargetSpeed(_##GLOW_OBJECT##_fdoutspeed);
|
||||
_##GLOW_OBJECT##_glow.gotoTarget();
|
||||
}
|
||||
|
||||
#undef GLOW_OBJECT
|
176
Src/Wasabi/Lib/com/glowobject.m
Normal file
176
Src/Wasabi/Lib/com/glowobject.m
Normal file
@ -0,0 +1,176 @@
|
||||
/**
|
||||
* glowobject.m
|
||||
*
|
||||
* @package com.winamp.maki.lib.community.glowobject
|
||||
* @author mpdeimos
|
||||
* @date 18/10/01
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
|
||||
#ifndef included
|
||||
#error This script can only be compiled as a #include
|
||||
#endif
|
||||
|
||||
#define GLOW_TYPE_HOLD 0
|
||||
#define GLOW_TYPE_FLASH 1
|
||||
#define GLOW_TYPE_BOUNCE 2
|
||||
|
||||
Class GuiObject GlowLayer;
|
||||
// {
|
||||
Member GuiObject GlowLayer.trigger;
|
||||
// }
|
||||
|
||||
Class GuiObject GlowObject;
|
||||
// {
|
||||
Member float GlowObject.fadeInSpeed;
|
||||
Member float GlowObject.fadeOutSpeed;
|
||||
Member int GlowObject.glowType;
|
||||
Member boolean GlowObject.glowing;
|
||||
|
||||
Member GuiObject GlowObject.glow;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param GuiObject that will be used to trigger the glow on mouse entering it's region
|
||||
* @param the glowing object
|
||||
* @ret GlowObject object
|
||||
*/
|
||||
Function GlowObject GlowObject_construct(GlowObject trigger, GlowLayer glow);
|
||||
|
||||
/**
|
||||
* sets fade in time
|
||||
*
|
||||
* @param GlowObject to act on
|
||||
* @param milliseconds till the glow is at alpha 255
|
||||
*/
|
||||
Function GlowObject_setFadeInSpeed(GlowObject go, float ms);
|
||||
|
||||
/**
|
||||
* sets fade out time
|
||||
*
|
||||
* @param GlowObject to act on
|
||||
* @param milliseconds till the glow is at alpha 0
|
||||
*/
|
||||
Function GlowObject_setFadeOutSpeed(GlowObject go, float ms);
|
||||
|
||||
/**
|
||||
* sets the glowtype used by this glow button.
|
||||
*
|
||||
* @param GlowObject to act on
|
||||
* @param glowType defined via GLOW_TYPE_*
|
||||
*/
|
||||
Function GlowObject_setGlowType(GlowObject go, int glowType);
|
||||
|
||||
|
||||
/*
|
||||
* IMPLEMENTATION
|
||||
*/
|
||||
|
||||
GlowObject GlowObject_construct(GlowObject trigger, GlowLayer glow)
|
||||
{
|
||||
if (trigger == null)
|
||||
{
|
||||
debug("trigger");
|
||||
}
|
||||
if (glow == NULL)
|
||||
{
|
||||
debug("glow");
|
||||
}
|
||||
|
||||
GlowObject go = trigger;
|
||||
go.fadeInSpeed = 0.3;
|
||||
go.fadeOutSpeed = 0.5;
|
||||
go.glow = glow;
|
||||
go.glowType = GLOW_TYPE_HOLD;
|
||||
go.glowing = false;
|
||||
glow.trigger = trigger;
|
||||
return go;
|
||||
}
|
||||
|
||||
GlowObject_setFadeInSpeed(GlowObject go, float ms)
|
||||
{
|
||||
go.fadeInSpeed = ms;
|
||||
}
|
||||
|
||||
GlowObject_setFadeOutSpeed(GlowObject go, float ms)
|
||||
{
|
||||
go.fadeOutSpeed = ms;
|
||||
}
|
||||
|
||||
GlowObject_setGlowType(GlowObject go, int glowType)
|
||||
{
|
||||
go.glowType = glowType;
|
||||
}
|
||||
|
||||
GlowObject.onEnterArea ()
|
||||
{
|
||||
GlowObject.glowing = true;
|
||||
GlowObject.glow.cancelTarget();
|
||||
GlowObject.glow.setTargetA(255);
|
||||
GlowObject.glow.setTargetSpeed(GlowObject.fadeInSpeed);
|
||||
GlowObject.glow.gotoTarget();
|
||||
}
|
||||
|
||||
GlowObject.onLeaveArea ()
|
||||
{
|
||||
GlowObject.glowing = false;
|
||||
if (GlowObject.glowType != GLOW_TYPE_FLASH)
|
||||
{
|
||||
GlowObject.glow.cancelTarget();
|
||||
GlowObject.glow.setTargetA(0);
|
||||
GlowObject.glow.setTargetSpeed(GlowObject.fadeOutSpeed);
|
||||
GlowObject.glow.gotoTarget();
|
||||
}
|
||||
}
|
||||
|
||||
GlowLayer.onTargetReached ()
|
||||
{
|
||||
GlowObject go = GlowLayer.trigger;
|
||||
if (go.glowType == GLOW_TYPE_HOLD)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (go.glowType == GLOW_TYPE_FLASH)
|
||||
{
|
||||
if (GlowLayer.getAlpha() == 255)
|
||||
{
|
||||
GlowLayer.cancelTarget();
|
||||
GlowLayer.setTargetA(0);
|
||||
GlowLayer.setTargetSpeed(GlowObject.fadeOutSpeed);
|
||||
GlowLayer.gotoTarget();
|
||||
}
|
||||
}
|
||||
else if (go.glowType == GLOW_TYPE_BOUNCE)
|
||||
{
|
||||
if (GlowLayer.getAlpha() == 255)
|
||||
{
|
||||
GlowLayer.cancelTarget();
|
||||
GlowLayer.setTargetA(0);
|
||||
GlowLayer.setTargetSpeed(GlowObject.fadeOutSpeed);
|
||||
GlowLayer.gotoTarget();
|
||||
}
|
||||
else if (GlowLayer.getAlpha() == 0 && go.glowing)
|
||||
{
|
||||
GlowLayer.cancelTarget();
|
||||
GlowLayer.setTargetA(255);
|
||||
GlowLayer.setTargetSpeed(GlowObject.fadeInSpeed);
|
||||
GlowLayer.gotoTarget();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GlowObject.onSetVisible (Boolean onoff)
|
||||
{
|
||||
if (onoff)
|
||||
{
|
||||
GlowObject.glow.show();
|
||||
}
|
||||
else
|
||||
{
|
||||
GlowObject.glow.hide();
|
||||
}
|
||||
|
||||
}
|
||||
// }
|
108
Src/Wasabi/Lib/com/rotationlayer.m
Normal file
108
Src/Wasabi/Lib/com/rotationlayer.m
Normal file
@ -0,0 +1,108 @@
|
||||
//----------------------------------------------------------------------------------------
|
||||
//
|
||||
// rotationlayer.m
|
||||
//
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Use like this :
|
||||
// #define ROTATION_LAYER_VAR MyVar
|
||||
// #include "rotationlayer.m"
|
||||
//
|
||||
// _MyVarInit(Group parentgroup, String layername); // init rotationlayer
|
||||
// _MyVarRotateDegree(double r); // in degrees
|
||||
// _MyVarRotate(double r); // in radians
|
||||
// double _MyVarGetRotationDegree(); // in degrees
|
||||
// double _MyVarGetRotation(); // in radians
|
||||
//
|
||||
|
||||
#ifndef PI
|
||||
#define PI 3.1415926536
|
||||
#endif
|
||||
|
||||
Global Double _##ROTATION_LAYER_VAR##R;
|
||||
Global Layer _##ROTATION_LAYER_VAR##Layer;
|
||||
|
||||
Function _##ROTATION_LAYER_VAR##Init(Group parentgroup, String layername);
|
||||
Function _##ROTATION_LAYER_VAR##RotateDegree(double r);
|
||||
Function _##ROTATION_LAYER_VAR##Rotate(double r);
|
||||
Function double _##ROTATION_LAYER_VAR##GetRotationDegree();
|
||||
Function double _##ROTATION_LAYER_VAR##GetRotation();
|
||||
|
||||
_##ROTATION_LAYER_VAR##RotateDegree(double r) {
|
||||
_##ROTATION_LAYER_VAR##Rotate(r * PI / 180.0);
|
||||
}
|
||||
|
||||
_##ROTATION_LAYER_VAR##Rotate(double r) {
|
||||
_##ROTATION_LAYER_VAR##R = r;
|
||||
_##ROTATION_LAYER_VAR##Layer.fx_update();
|
||||
}
|
||||
|
||||
double _##ROTATION_LAYER_VAR##GetRotationDegree() {
|
||||
return _##ROTATION_LAYER_VAR##R * 180 / PI;
|
||||
}
|
||||
|
||||
double _##ROTATION_LAYER_VAR##GetRotation() {
|
||||
return _##ROTATION_LAYER_VAR##R;
|
||||
}
|
||||
|
||||
_##ROTATION_LAYER_VAR##Init(Group parentgroup, String layername) {
|
||||
_##ROTATION_LAYER_VAR##Layer = parentgroup.getObject(layername);
|
||||
_##ROTATION_LAYER_VAR##Layer.fx_setGridSize(1,1);
|
||||
_##ROTATION_LAYER_VAR##Layer.fx_setBgFx(0);
|
||||
_##ROTATION_LAYER_VAR##Layer.fx_setWrap(1);
|
||||
_##ROTATION_LAYER_VAR##Layer.fx_setBilinear(1);
|
||||
_##ROTATION_LAYER_VAR##Layer.fx_setRect(0);
|
||||
_##ROTATION_LAYER_VAR##Layer.fx_setClear(0);
|
||||
_##ROTATION_LAYER_VAR##Layer.fx_setLocalized(1);
|
||||
_##ROTATION_LAYER_VAR##Layer.fx_setRealtime(0);
|
||||
_##ROTATION_LAYER_VAR##Layer.fx_setEnabled(1);
|
||||
}
|
||||
|
||||
_##ROTATION_LAYER_VAR##Layer.fx_onGetPixelR(double r, double d, double x, double y) {
|
||||
return r + _##ROTATION_LAYER_VAR##R;
|
||||
}
|
||||
|
||||
//--------------------II-----------------
|
||||
Global Double _##ROTATION_LAYER_VARII##R;
|
||||
Global Layer _##ROTATION_LAYER_VARII##Layer;
|
||||
|
||||
Function _##ROTATION_LAYER_VARII##Init(Group parentgroup, String layername);
|
||||
Function _##ROTATION_LAYER_VARII##RotateDegree(double r);
|
||||
Function _##ROTATION_LAYER_VARII##Rotate(double r);
|
||||
Function double _##ROTATION_LAYER_VARII##GetRotationDegree();
|
||||
Function double _##ROTATION_LAYER_VARII##GetRotation();
|
||||
|
||||
_##ROTATION_LAYER_VARII##RotateDegree(double r) {
|
||||
_##ROTATION_LAYER_VARII##Rotate(r * PI / 180.0);
|
||||
}
|
||||
|
||||
_##ROTATION_LAYER_VARII##Rotate(double r) {
|
||||
_##ROTATION_LAYER_VARII##R = r;
|
||||
_##ROTATION_LAYER_VARII##Layer.fx_update();
|
||||
}
|
||||
|
||||
double _##ROTATION_LAYER_VARII##GetRotationDegree() {
|
||||
return _##ROTATION_LAYER_VARII##R * 180 / PI;
|
||||
}
|
||||
|
||||
double _##ROTATION_LAYER_VARII##GetRotation() {
|
||||
return _##ROTATION_LAYER_VARII##R;
|
||||
}
|
||||
|
||||
_##ROTATION_LAYER_VARII##Init(Group parentgroup, String layername) {
|
||||
_##ROTATION_LAYER_VARII##Layer = parentgroup.getObject(layername);
|
||||
_##ROTATION_LAYER_VARII##Layer.fx_setGridSize(1,1);
|
||||
_##ROTATION_LAYER_VARII##Layer.fx_setBgFx(0);
|
||||
_##ROTATION_LAYER_VARII##Layer.fx_setWrap(1);
|
||||
_##ROTATION_LAYER_VARII##Layer.fx_setBilinear(1);
|
||||
_##ROTATION_LAYER_VARII##Layer.fx_setRect(0);
|
||||
_##ROTATION_LAYER_VARII##Layer.fx_setClear(0);
|
||||
_##ROTATION_LAYER_VARII##Layer.fx_setLocalized(1);
|
||||
_##ROTATION_LAYER_VARII##Layer.fx_setRealtime(0);
|
||||
_##ROTATION_LAYER_VARII##Layer.fx_setEnabled(1);
|
||||
|
||||
}
|
||||
|
||||
_##ROTATION_LAYER_VARII##Layer.fx_onGetPixelR(double r, double d, double x, double y) {
|
||||
return r + _##ROTATION_LAYER_VAR##R;
|
||||
}
|
||||
|
104
Src/Wasabi/Lib/com/songinfo.m
Normal file
104
Src/Wasabi/Lib/com/songinfo.m
Normal file
@ -0,0 +1,104 @@
|
||||
/*---------------------------------------------------
|
||||
-----------------------------------------------------
|
||||
Filename: songinfo.m
|
||||
Version: 1.0
|
||||
|
||||
Type: maki/songinfo loading
|
||||
Date: 09. Sept. 2008 - 10:02
|
||||
Author: Martin Poehlmann aka Deimos
|
||||
E-Mail: martin@skinconsortium.com
|
||||
Internet: www.skinconsortium.com
|
||||
-----------------------------------------------------
|
||||
---------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* This library is still in testing phase
|
||||
*/
|
||||
|
||||
#ifndef included
|
||||
#error This script can only be compiled as a #include
|
||||
#endif
|
||||
|
||||
// use this function to reload songinfo (usually do this on system.onTitleChange())
|
||||
Function songinfo_reload();
|
||||
|
||||
// use this vars to get song information (is faster than function calls)
|
||||
Global String songinfo_title;
|
||||
Global String songinfo_artist;
|
||||
Global String songinfo_album;
|
||||
Global String songinfo_location; // url or path on your hd
|
||||
Global String songinfo_displayTitle;
|
||||
|
||||
Global String songinfo_streamTitle; // similar to display title
|
||||
Global String songinfo_streamName; // name of current stream (station title)
|
||||
Global String songinfo_streamURL;
|
||||
Global String songinfo_streamAlbumArt; // _full_ URL to an image on the web, like http://images.play.it/amg/album/cov200/drh200/h238/h23853pph7b.jpg
|
||||
|
||||
Global Boolean songinfo_isStream; // true if current song is a stream
|
||||
|
||||
Global Int songinfo_streamType; // use in conjunction with the values below
|
||||
#define SONGINFO_STREAMTYPE_SHOUTCAST 2
|
||||
#define SONGINFO_STREAMTYPE_AOLRADIO 3
|
||||
#define SONGINFO_STREAMTYPE_CBSRADIO 4
|
||||
#define SONGINFO_STREAMTYPE_SHOUTCAST2 5
|
||||
#define SONGINFO_STREAMTYPE_NOSTREAM 0
|
||||
#define SONGINFO_STREAMTYPE_UNKNOWN 666
|
||||
|
||||
/////////////////////////////////////
|
||||
// IMPLEMENTATION // DO NOT MODIFY //
|
||||
/////////////////////////////////////
|
||||
|
||||
songinfo_reload()
|
||||
{
|
||||
// Fill vars with data
|
||||
songinfo_location = System.getPlayItemString();
|
||||
songinfo_displayTitle = System.getPlayItemDisplayTitle();
|
||||
|
||||
String metaPrefix = ""; // used for streams
|
||||
|
||||
// Check for a stream
|
||||
songinfo_streamType = stringToInteger(getPlayItemMetaDataString("streamtype"));
|
||||
songinfo_isStream = (songinfo_streamType > 0);
|
||||
if (songinfo_isStream) // STREAM!
|
||||
{
|
||||
if (!(songinfo_streamType == SONGINFO_STREAMTYPE_SHOUTCAST
|
||||
|| songinfo_streamType == SONGINFO_STREAMTYPE_AOLRADIO
|
||||
|| songinfo_streamType == SONGINFO_STREAMTYPE_CBSRADIO
|
||||
|| songinfo_streamType == SONGINFO_STREAMTYPE_SHOUTCAST2))
|
||||
{
|
||||
songinfo_streamType = SONGINFO_STREAMTYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
// read stream metadata
|
||||
songinfo_streamName = getPlayItemMetaDataString("streamname");
|
||||
songinfo_streamTitle = getPlayItemMetaDataString("streamtitle");
|
||||
songinfo_streamURL = getPlayItemMetaDataString("streamurl");
|
||||
|
||||
if (songinfo_streamType == SONGINFO_STREAMTYPE_AOLRADIO)
|
||||
{
|
||||
metaPrefix = "uvox/";
|
||||
}
|
||||
else if (songinfo_streamType == SONGINFO_STREAMTYPE_CBSRADIO)
|
||||
{
|
||||
metaPrefix = "cbs/";
|
||||
}
|
||||
|
||||
songinfo_streamAlbumArt = getPlayItemMetaDataString(metaPrefix + "albumart");
|
||||
if (songinfo_streamType == SONGINFO_STREAMTYPE_AOLRADIO)
|
||||
{
|
||||
songinfo_streamAlbumArt = "http://broadband-albumart.music.aol.com/scan/" + songinfo_streamAlbumArt;
|
||||
}
|
||||
}
|
||||
else //NO STREAM!
|
||||
{
|
||||
// resetting stream specific values
|
||||
songinfo_streamName = "";
|
||||
songinfo_streamTitle = "";
|
||||
songinfo_streamURL = "";
|
||||
songinfo_streamAlbumArt = "";
|
||||
}
|
||||
|
||||
songinfo_title = getPlayItemMetaDataString(metaPrefix + "title");
|
||||
songinfo_artist = getPlayItemMetaDataString(metaPrefix + "artist");
|
||||
songinfo_album = getPlayItemMetaDataString(metaPrefix + "album");
|
||||
}
|
29
Src/Wasabi/Lib/config.mi
Normal file
29
Src/Wasabi/Lib/config.mi
Normal file
@ -0,0 +1,29 @@
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
// config.mi
|
||||
//
|
||||
// standard definitions for internal objects
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#ifndef __CONFIG_MI
|
||||
#define __CONFIG_MI
|
||||
|
||||
extern class @{593DBA22-D077-4976-B952-F4713655400B}@ Object _predecl Config;
|
||||
extern class @{D4030282-3AAB-4d87-878D-12326FADFCD5}@ Object ConfigItem;
|
||||
extern class @{24DEC283-B76E-4a36-8CCC-9E24C46B6C73}@ Object ConfigAttribute;
|
||||
|
||||
extern ConfigItem Config.getItem(String item_name);
|
||||
extern ConfigItem Config.getItemByGuid(String item_guid);
|
||||
extern ConfigItem Config.newItem(String item_name, String item_guid);
|
||||
|
||||
extern ConfigAttribute ConfigItem.getAttribute(String attr_name);
|
||||
extern ConfigAttribute ConfigItem.newAttribute(String attr_name, String default_value);
|
||||
extern String ConfigItem.getGuid(String attr_name);
|
||||
extern String ConfigItem.getName(); //TODO
|
||||
|
||||
extern ConfigAttribute.setData(String value);
|
||||
extern String ConfigAttribute.getData();
|
||||
extern ConfigAttribute.onDataChanged();
|
||||
extern ConfigItem ConfigAttribute.getParentItem();
|
||||
extern String ConfigAttribute.getAttributeName();
|
||||
|
||||
#endif
|
81
Src/Wasabi/Lib/core.mi
Normal file
81
Src/Wasabi/Lib/core.mi
Normal file
@ -0,0 +1,81 @@
|
||||
/**
|
||||
Note:
|
||||
This file is a relict of Winamp3/Wasabi.Player.
|
||||
I have tested it and it seems not to work :(
|
||||
If anyone get's this one to work lemme know: martin@skinconsortium.com
|
||||
**/
|
||||
|
||||
extern class @{F857BECA-8E19-41f1-973E-097E39649F03}@ Object _predecl CoreAdmin;
|
||||
extern class @{2825A91B-D488-4245-AAF1-7059CF88437B}@ Object &Core;
|
||||
|
||||
extern Core CoreAdmin.getNamedCore(String name);
|
||||
extern Core CoreAdmin.newNamedCore(String name);
|
||||
extern Int CoreAdmin.freeCore(Core name);
|
||||
extern Int CoreAdmin.freeCoreByName(String name);
|
||||
|
||||
|
||||
extern Core.playFile(String filename);
|
||||
extern Core.stop();
|
||||
extern Core.setVolume(Int volume);
|
||||
extern Core.getStatus();
|
||||
|
||||
// I love keyboard macros.
|
||||
extern Int Core.onStarted();
|
||||
extern Int Core.onStopped();
|
||||
extern Int Core.onPaused();
|
||||
extern Int Core.onUnpaused();
|
||||
extern Int Core.onSeeked(Int newpos);
|
||||
extern Int Core.onVolumeChange(Int newvol);
|
||||
extern Int Core.onPanChange(Int newpan);
|
||||
extern Int Core.onEQStatusChange(Int newval);
|
||||
extern Int Core.onEQPreampChange(Int newval);
|
||||
extern Int Core.onEQBandChange(Int band, Int newval);
|
||||
extern Int Core.onEQAutoChange(Int newval);
|
||||
extern Int Core.onCoreStatusMsg(String msgtext);
|
||||
extern Int Core.onWarningMsg(String msgtext);
|
||||
extern Int Core.onErrorMsg(String msgtext);
|
||||
extern Int Core.onTitleChange(String newtitle);
|
||||
extern Int Core.onTitle2Change(String newtitle2);
|
||||
extern Int Core.onInfoChange(String info);
|
||||
extern Int Core.onUrlChange(String url);
|
||||
extern Int Core.onLengthChange(Int newlength);
|
||||
extern Int Core.onNextFile();
|
||||
extern Int Core.onNeedNextFile(Int fileid);
|
||||
extern Int Core.onSetNextFile(String playstring);
|
||||
extern Int Core.onErrorOccured(Int severity, String errortext);
|
||||
extern Int Core.onAbortCurrentSong();
|
||||
extern Int Core.onEndOfDecode();
|
||||
extern Int Core.onFileComplete(String playstring);
|
||||
extern Int Core.onConvertersChainRebuilt();
|
||||
extern Int Core.onMediaFamilyChange(String newfamily);
|
||||
|
||||
extern Int Core.setNextFile(String pstr);
|
||||
extern Int Core.getStatus();
|
||||
extern String Core.getCurrent();
|
||||
extern Int Core.getCurPlaybackNumber();
|
||||
extern Int Core.getNumTracks();
|
||||
extern Int Core.getPosition();
|
||||
extern Int Core.getWritePosition();
|
||||
extern Int Core.setPosition(Int ms);
|
||||
extern Int Core.getLength();
|
||||
extern Int Core.getVolume();
|
||||
extern Core.setVolume(Int vol);
|
||||
extern Int Core.getPan();
|
||||
extern Core.setPan(Int bal);
|
||||
extern Core.setMute(Int mute);
|
||||
extern Int Core.getMute();
|
||||
extern Int Core.getLeftVuMeter();
|
||||
extern Int Core.getRightVuMeter();
|
||||
extern Core.userButton(Int ubutton);
|
||||
extern Int Core.getEqStatus();
|
||||
extern Core.setEqStatus(Int enable);
|
||||
extern Int Core.getEqPreamp();
|
||||
extern Core.setEqPreamp(Int pre);
|
||||
extern Int Core.getEqBand(Int band);
|
||||
extern Core.setEqBand(Int band, Int val);
|
||||
extern Int Core.getEqAuto();
|
||||
extern Core.setEqAuto(Int enable);
|
||||
extern Core.setCustomMsg(String msgtext);
|
||||
extern Core.setPriority(Int priority);
|
||||
extern Int Core.getPriority();
|
||||
extern Core.rebuildConvertersChain();
|
118
Src/Wasabi/Lib/exd.mi
Normal file
118
Src/Wasabi/Lib/exd.mi
Normal file
@ -0,0 +1,118 @@
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
// exd.mi
|
||||
//
|
||||
// extra definitions for internal objects
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
#ifndef included
|
||||
#error This script can only be compiled as a #include
|
||||
#endif
|
||||
|
||||
#ifndef __EXD_MI
|
||||
#define __EXD_MI
|
||||
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
// String CLASS
|
||||
//*****************************************************************************
|
||||
|
||||
Function String replaceString(string baseString, string toreplace, string replacedby);
|
||||
|
||||
/**
|
||||
replaceString()
|
||||
|
||||
Returns the class name for the object.
|
||||
|
||||
@param baseString The String which you want to modify.
|
||||
@param toreplace The String you want to be replaced.
|
||||
@param replacedby The String instead of 'toreplace'.
|
||||
@ret The replaced string.
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
Function String cutString(string baseString, string toreplace);
|
||||
|
||||
/**
|
||||
cutString()
|
||||
|
||||
Returns the class name for the object.
|
||||
|
||||
@param baseString The String which you want to modify.
|
||||
@param toreplace The String you want to be replaced.
|
||||
@ret The replaced string.
|
||||
*/
|
||||
|
||||
String cutString(string baseString, string toreplace) {
|
||||
if (toreplace == "") return baseString;
|
||||
int i = strsearch(baseString, toreplace);
|
||||
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 + right;
|
||||
}
|
||||
|
||||
Function String fillStringBefore(string baseString, string after, string before);
|
||||
|
||||
/**
|
||||
fillStringBefore()
|
||||
|
||||
Returns the class name for the object.
|
||||
|
||||
@param baseString The String which you want to modify.
|
||||
@param toreplace The String you want to be replaced.
|
||||
@ret The replaced string.
|
||||
*/
|
||||
|
||||
String fillStringBefore(string baseString, string filled, string anchor) {
|
||||
int i = strsearch(baseString, anchor);
|
||||
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);
|
||||
}
|
||||
/* bef.setText(integerToString(i) + " - " + left);
|
||||
aft.setText(integerToString(strlen(basestring) - i) + " - " + right);
|
||||
*/ return left + filled + right;
|
||||
}
|
||||
|
||||
|
||||
Function Int countSubString(string str, string substr);
|
||||
|
||||
int countSubString(string str, string substr) {
|
||||
int n = 0;
|
||||
for ( int i = 0; i < 666; i++ ) {
|
||||
int r = strSearch(str, substr);
|
||||
#ifdef DEBUG
|
||||
debug(integerToString(r));
|
||||
#endif
|
||||
if (r == -1) i = 666;
|
||||
else {
|
||||
str = strright(str, strlen(str) - (r + 1));
|
||||
n++;
|
||||
if (strlen(str) - r == 1) return n;
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
#endif
|
130
Src/Wasabi/Lib/fileio.mi
Normal file
130
Src/Wasabi/Lib/fileio.mi
Normal file
@ -0,0 +1,130 @@
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
// fileio.mi
|
||||
//
|
||||
// standard handles for file input and output (only xml parsing atm)
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#ifndef __FILEIO_MI
|
||||
#define __FILEIO_MI
|
||||
|
||||
|
||||
extern class @{836F8B2E-E0D1-4db4-937F-0D0A04C8DCD1}@ Object &File;
|
||||
extern class @{417FFB69-987F-4be8-8D87-D9965EEEC868}@ File &XmlDoc;
|
||||
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
// File CLASS
|
||||
//*****************************************************************************
|
||||
/**
|
||||
File Class.
|
||||
|
||||
@short Root Object for handling files
|
||||
@author Nullsoft Inc.
|
||||
@ver 1.0
|
||||
*/
|
||||
|
||||
extern File.load (String path); // !Always call this first!
|
||||
extern boolean File.exists ();
|
||||
extern int File.getSize ();
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
// XmlDoc CLASS
|
||||
//*****************************************************************************
|
||||
/**
|
||||
XmlDoc Class.
|
||||
|
||||
@short Root Object for handling xml files
|
||||
@author Nullsoft Inc.
|
||||
@ver 1.0
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
parser_addCallback()
|
||||
|
||||
Add a XML tag to the global callback list for this file. Ensure to load the file first!
|
||||
You can call this function more than once in order to add multiple callbacks (not implemented yet).
|
||||
Use / for subtags and * as wildchar.
|
||||
Example:
|
||||
<main>
|
||||
<cfg>
|
||||
<int id="a" value="1"/>
|
||||
<int id="b" value="2"/>
|
||||
<int id="c" value="3"/>
|
||||
<string id="d" value="bla" />
|
||||
</cfg>
|
||||
<otherstuff what="blabla"/>
|
||||
</main>
|
||||
in order to read all items listed under cfg add this callback:
|
||||
|
||||
Global XmlDoc myDoc;
|
||||
|
||||
System.onScriptLoaded()
|
||||
{
|
||||
myDoc = new XmlDoc;
|
||||
myDoc.load("C:\mycfg.xml");
|
||||
myDoc.parser_addCallback("main/cfg/*");
|
||||
myDoc.parser_addCallback("main/otherstuff");
|
||||
myDoc.parser_start();
|
||||
myDoc.parser_destroy();
|
||||
}
|
||||
|
||||
Note: myDoc.parser_addCallback("*"); will parse everything.
|
||||
|
||||
@param any XML tag you want a callback for
|
||||
*/
|
||||
extern XmlDoc.parser_addCallback (String section);
|
||||
|
||||
|
||||
/**
|
||||
parser_start()
|
||||
|
||||
Start parsing the XmlDoc.
|
||||
*/
|
||||
extern XmlDoc.parser_start ();
|
||||
|
||||
|
||||
/**
|
||||
parser_onCallback()
|
||||
|
||||
Hookable. Called everytime an opening XML tag with a added callback is found.
|
||||
opening XML tags: <sometag id="bla"> or <sometag id="bla"/>
|
||||
|
||||
@param XML path to the XML tag that triggered the callback (uppercase!)
|
||||
@param name of the XML tag that triggered the callback
|
||||
@param List that holds the paramnames
|
||||
@param List that holds the paramvalues (sorted in the same way as List paramname)
|
||||
*/
|
||||
extern String XmlDoc.parser_onCallback (String xmlpath, String xmltag, list paramname, list paramvalue);
|
||||
|
||||
|
||||
/**
|
||||
parser_onCloseCallback()
|
||||
|
||||
Hookable. Called everytime a closing XML tag with an added callback is found.
|
||||
closing XML tag: </sometag> or <sometag id="bla"/>
|
||||
|
||||
@param XML tag that triggered the callback
|
||||
*/
|
||||
extern String XmlDoc.parser_onCloseCallback (String xmlpath, String xmltag);
|
||||
|
||||
|
||||
/**
|
||||
parser_onError()
|
||||
|
||||
due to some API changes filename and incpath will hold an empty string since winamp 5.56
|
||||
*/
|
||||
extern String XmlDoc.parser_onError (String filename, int linenum, String incpath, int errcode, String errstr);
|
||||
|
||||
|
||||
/**
|
||||
parser_destroy()
|
||||
|
||||
Always call this if you are done with parsing, or if you want to reset your callbacks.
|
||||
*/
|
||||
extern String XmlDoc.parser_destroy ();
|
||||
|
||||
|
||||
#endif
|
96
Src/Wasabi/Lib/pldir.mi
Normal file
96
Src/Wasabi/Lib/pldir.mi
Normal file
@ -0,0 +1,96 @@
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
// pldir.mi
|
||||
//
|
||||
// standard handles for PlEdit manipulation
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
extern class @{345BEEBC-0229-4921-90BE-6CB6A49A79D9}@ Object _predecl &PlEdit; // Our Winamp Playlist Editor
|
||||
extern class @{61A7ABAD-7D79-41f6-B1D0-E1808603A4F4}@ Object _predecl PlDir; // <PlEditDirectory/>
|
||||
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
// PlEdit CLASS
|
||||
//*****************************************************************************
|
||||
/**
|
||||
PlEdit Class.
|
||||
|
||||
@short Our main PlEdit Editor.
|
||||
@author Nullsoft Inc.
|
||||
@ver 1.0
|
||||
*/
|
||||
|
||||
// General PlEdit Information
|
||||
extern int PlEdit.getNumTracks (); // Returns total number of tracks
|
||||
extern int PlEdit.getCurrentIndex (); // Index of the currently Playing Item
|
||||
extern int PlEdit.getNumSelectedTracks ();
|
||||
extern int PlEdit.getNextSelectedTrack (int i);
|
||||
|
||||
|
||||
// Manipulate PlEdit View
|
||||
extern PlEdit.showCurrentlyPlayingTrack (); // Scrolls the PL to the currently playling item (mostly used with onKeyDown: space)
|
||||
extern PlEdit.showTrack (int item);
|
||||
|
||||
// Manipulate PlEdit Entries
|
||||
extern PlEdit.enqueueFile (string file); // Enqueues a file at the end of the PL
|
||||
extern PlEdit.clear ();
|
||||
extern PlEdit.removeTrack (int item); // Removes a specific Track from PL
|
||||
extern PlEdit.swapTracks (int item1, int item2); // Changes the position of item1 and item2
|
||||
extern PlEdit.moveUp (int item); // Moves item one position up
|
||||
extern PlEdit.moveDown (int item); // Moves item one position down
|
||||
extern PlEdit.moveTo (int item, int pos); // Moves an item to a new position in our PlEdit (this one is faster as calling multiple swaps in maki)
|
||||
extern PlEdit.playTrack (int item);
|
||||
|
||||
|
||||
// Metadata Stuff
|
||||
extern int PlEdit.getRating (int item);
|
||||
extern PlEdit.setRating (int item, int rating); // Sets Rating of track #item to a value from 0-5
|
||||
extern String PlEdit.getTitle (int item);
|
||||
extern String PlEdit.getLength (int item);
|
||||
extern String PlEdit.getMetaData (int item, String metadatastring); // You know the metadata strings, don't you?
|
||||
extern String PlEdit.getFileName (int item);
|
||||
|
||||
/**
|
||||
Hookable.
|
||||
You need to instanciate a PlEdit object first. so basically it goes like this:
|
||||
|
||||
Global PlEdit PeListener;
|
||||
|
||||
System.onScriptLoaded ()
|
||||
{
|
||||
PeListener = new PlEdit;
|
||||
}
|
||||
|
||||
PeListener.onPleditModified ()
|
||||
{
|
||||
// Do some crazy stuff
|
||||
}
|
||||
*/
|
||||
extern PlEdit.onPleditModified ();
|
||||
|
||||
//*****************************************************************************
|
||||
// PlDir CLASS
|
||||
//*****************************************************************************
|
||||
/**
|
||||
PlDir Class.
|
||||
|
||||
@short Handles for the <PlEditDirectory/> XML object and ML PlEdits view.
|
||||
@author Nullsoft Inc.
|
||||
@ver 1.0
|
||||
*/
|
||||
|
||||
// General PlEdits Information
|
||||
extern int PlDir.getNumItems (); // Returns total number of stored PlEdits in your ml
|
||||
extern String PlDir.getItemName (int item);
|
||||
|
||||
// Manipulate PlDir View
|
||||
extern PlDir.showCurrentlyPlayingEntry (); // Backwards Compatibility (wa3 relict), does the same as PlEdit.showCurrentlyPlayingTrack ()
|
||||
extern PlDir.refresh(); // Not working 100% on ml lists
|
||||
|
||||
// Manipulate PlDir Entries
|
||||
extern PlDir.renameItem (int item, String name);
|
||||
|
||||
// Playback funtions
|
||||
extern PlDir.enqueueItem (int item);
|
||||
extern PlDir.playItem (int item);
|
26
Src/Wasabi/Lib/private.mi
Normal file
26
Src/Wasabi/Lib/private.mi
Normal file
@ -0,0 +1,26 @@
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
// private.mi
|
||||
//
|
||||
// these are our own private calls ;)
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#ifndef __PRIVATE_MI
|
||||
#define __PRIVATE_MI
|
||||
|
||||
extern class @{78BD6ED9-0DBC-4fa5-B5CD-5977E3A912F8}@ Object &Private;
|
||||
|
||||
Global Private WaPrivateCall;
|
||||
//Member boolean WaPrivateCall.t;
|
||||
|
||||
Function initWaPrivateCalls();
|
||||
initWaPrivateCalls ()
|
||||
{
|
||||
WaPrivateCall = new Private;
|
||||
//WaPrivateCall.t = false;
|
||||
//debugInt(WaPrivateCall.t);
|
||||
}
|
||||
|
||||
extern Private.updateLinks(String version, String browserversion);
|
||||
extern Private.onLinksUpdated();
|
||||
|
||||
#endif
|
2778
Src/Wasabi/Lib/std.mi
Normal file
2778
Src/Wasabi/Lib/std.mi
Normal file
File diff suppressed because it is too large
Load Diff
73
Src/Wasabi/Lib/winampconfig.mi
Normal file
73
Src/Wasabi/Lib/winampconfig.mi
Normal file
@ -0,0 +1,73 @@
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
// winampconfig.mi
|
||||
//
|
||||
// your best way to get winamp config states
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#ifndef __WINAMPCONFIG_MI
|
||||
#define __WINAMPCONFIG_MI
|
||||
|
||||
extern class @{B2AD3F2B-31ED-4e31-BC6D-E9951CD555BB}@ Object _predecl WinampConfig;
|
||||
extern class @{FC17844E-C72B-4518-A068-A8F930A5BA80}@ Object WinampConfigGroup;
|
||||
|
||||
|
||||
// WinampConfig
|
||||
|
||||
extern WinampConfigGroup WinampConfig.getGroup(String config_group_guid);
|
||||
|
||||
// WinampConfigGroup
|
||||
|
||||
extern Boolean WinampConfigGroup.getBool(String itemname);
|
||||
extern WinampConfigGroup.setBool(String itemname, Boolean itemvalue);
|
||||
|
||||
extern Int WinampConfigGroup.getInt(String itemname);
|
||||
extern WinampConfigGroup.setInt(String itemname);
|
||||
|
||||
extern String WinampConfigGroup.getString(String itemname);
|
||||
extern WinampConfigGroup.setString(String itemname);
|
||||
|
||||
|
||||
/*
|
||||
BENSKI:
|
||||
basically, make a WinampConfig object, and call getGroup with a guid (see below) and then you can get & set values from the WinampConfigGroup object it returns.
|
||||
|
||||
I plan on adding more types to get/set in the WinampConfigGroup object later... these were just the minimum number to get you your two video options. Once we get this working, I'll add getString, getInt, etc.
|
||||
|
||||
The WinampConfig stuff differs from system.setPrivateString (and family). It sets/gets Winamp configuration items directly. Some items are read-only. You can not store your own values, and it does not save the values to studio.xnf (they are saved wherever the underlying configuration value is saved, normally winamp.ini). There's also no callback if items change.
|
||||
|
||||
Some values to get you started
|
||||
|
||||
Video config group guid: {2135E318-6919-4bcf-99D2-62BE3FCA8FA6}
|
||||
The two config items you requested are named:
|
||||
autoopen
|
||||
autoclose
|
||||
|
||||
Other interesting groups/items (these are read-only for now... If there are any you'd like to have modifiable, let me know)
|
||||
|
||||
more items in the video group:
|
||||
name: "overlay"
|
||||
name: "YV12"
|
||||
name: "vsync"
|
||||
name: "ddraw"
|
||||
name: "gdiplus"
|
||||
description: experimental GDI+ video renderer. Used mainly for video on Vista
|
||||
|
||||
Internet Config Group: {C0A565DC-0CFE-405a-A27C-468B0C8A3A5C}
|
||||
name: "proxy"
|
||||
description: proxy server setting. Won't be retrievable until I make a "getString" function which I will shortly
|
||||
name: "proxy80"
|
||||
description: boolean value as to whether the proxy is only required for port 80
|
||||
|
||||
Playback Config Group: {B6CB4A7C-A8D0-4c55-8E60-9F7A7A23DA0F}
|
||||
name: "bits"
|
||||
name: "mono"
|
||||
name: "surround"
|
||||
name: "dither"
|
||||
name: "replaygain"
|
||||
name: "replaygain_mode"
|
||||
name: "replaygain_source"
|
||||
name: "replaygain_preferred_only"
|
||||
name: "non_replaygain"
|
||||
*/
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user