Initial community commit

This commit is contained in:
Jef
2024-09-24 14:54:57 +02:00
parent 537bcbc862
commit 20d28e80a5
16810 changed files with 4640254 additions and 2 deletions

View 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
View 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

View 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;
}

View 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();
}

View 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;
}
}

View 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

View 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

View 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

View 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
View 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

View 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();
}
}
// }

View 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;
}

View 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
View 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
View 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
View 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
View 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
View 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
View 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

File diff suppressed because it is too large Load Diff

View 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

40
Src/Wasabi/Wasabi.sln Normal file
View File

@ -0,0 +1,40 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29424.173
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Wasabi", "Wasabi.vcxproj", "{3E0BFA8A-B86A-42E9-A33F-EC294F823F7F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bfc", "bfc\bfc.vcxproj", "{D0EC862E-DDDD-4F4F-934F-B75DC9062DC1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3E0BFA8A-B86A-42E9-A33F-EC294F823F7F}.Debug|Win32.ActiveCfg = Debug|Win32
{3E0BFA8A-B86A-42E9-A33F-EC294F823F7F}.Debug|Win32.Build.0 = Debug|Win32
{3E0BFA8A-B86A-42E9-A33F-EC294F823F7F}.Debug|x64.ActiveCfg = Debug|x64
{3E0BFA8A-B86A-42E9-A33F-EC294F823F7F}.Debug|x64.Build.0 = Debug|x64
{3E0BFA8A-B86A-42E9-A33F-EC294F823F7F}.Release|Win32.ActiveCfg = Release|Win32
{3E0BFA8A-B86A-42E9-A33F-EC294F823F7F}.Release|Win32.Build.0 = Release|Win32
{3E0BFA8A-B86A-42E9-A33F-EC294F823F7F}.Release|x64.ActiveCfg = Release|x64
{3E0BFA8A-B86A-42E9-A33F-EC294F823F7F}.Release|x64.Build.0 = Release|x64
{D0EC862E-DDDD-4F4F-934F-B75DC9062DC1}.Debug|Win32.ActiveCfg = Debug|Win32
{D0EC862E-DDDD-4F4F-934F-B75DC9062DC1}.Debug|Win32.Build.0 = Debug|Win32
{D0EC862E-DDDD-4F4F-934F-B75DC9062DC1}.Debug|x64.ActiveCfg = Debug|x64
{D0EC862E-DDDD-4F4F-934F-B75DC9062DC1}.Debug|x64.Build.0 = Debug|x64
{D0EC862E-DDDD-4F4F-934F-B75DC9062DC1}.Release|Win32.ActiveCfg = Release|Win32
{D0EC862E-DDDD-4F4F-934F-B75DC9062DC1}.Release|Win32.Build.0 = Release|Win32
{D0EC862E-DDDD-4F4F-934F-B75DC9062DC1}.Release|x64.ActiveCfg = Release|x64
{D0EC862E-DDDD-4F4F-934F-B75DC9062DC1}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0E7F9665-971C-48B6-BF28-5952406042A2}
EndGlobalSection
EndGlobal

281
Src/Wasabi/Wasabi.vcxproj Normal file
View File

@ -0,0 +1,281 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{3E0BFA8A-B86A-42E9-A33F-EC294F823F7F}</ProjectGuid>
<RootNamespace>Wasabi</RootNamespace>
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Label="Vcpkg">
<VcpkgEnableManifest>false</VcpkgEnableManifest>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<VcpkgInstalledDir>
</VcpkgInstalledDir>
<VcpkgUseStatic>false</VcpkgUseStatic>
<VcpkgConfiguration>Debug</VcpkgConfiguration>
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<VcpkgInstalledDir>
</VcpkgInstalledDir>
<VcpkgUseStatic>false</VcpkgUseStatic>
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<VcpkgInstalledDir>
</VcpkgInstalledDir>
<VcpkgUseStatic>false</VcpkgUseStatic>
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
<VcpkgConfiguration>Debug</VcpkgConfiguration>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<VcpkgInstalledDir>
</VcpkgInstalledDir>
<VcpkgUseStatic>false</VcpkgUseStatic>
<VcpkgTriplet>x86-windows-static-md</VcpkgTriplet>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WIN32_WINNT=0x0601;WINVER=0x0601;_UNICODE;UNICODE;WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4302;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WIN32_WINNT=0x0601;WINVER=0x0601;_UNICODE;UNICODE;WIN64;_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4302;4311;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MinSpace</Optimization>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>.;..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WIN32_WINNT=0x0601;WINVER=0x0601;_UNICODE;UNICODE;WIN32;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>None</DebugInformationFormat>
<DisableSpecificWarnings>4302;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<Optimization>MinSpace</Optimization>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>.;..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WIN32_WINNT=0x0601;WINVER=0x0601;_UNICODE;UNICODE;WIN64;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>None</DebugInformationFormat>
<DisableSpecificWarnings>4302;4311;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ProjectReference Include="..\replicant\nu\nu.vcxproj">
<Project>{f1f5cd60-0d5b-4cea-9eeb-2f87ff9aa915}</Project>
</ProjectReference>
<ProjectReference Include="bfc\bfc.vcxproj">
<Project>{d0ec862e-dddd-4f4f-934f-b75dc9062dc1}</Project>
<CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClCompile Include="api\config\items\attribute.cpp" />
<ClCompile Include="api\config\items\cfgitemi.cpp" />
<ClCompile Include="api\config\items\cfgitemx.cpp" />
<ClCompile Include="api\script\objcontroller.cpp" />
<ClCompile Include="api\script\objects\c_script\c_checkbox.cpp" />
<ClCompile Include="api\script\objects\c_script\c_container.cpp" />
<ClCompile Include="api\script\objects\c_script\c_edit.cpp" />
<ClCompile Include="api\script\objects\c_script\c_group.cpp" />
<ClCompile Include="api\script\objects\c_script\c_guiobject.cpp" />
<ClCompile Include="api\script\objects\c_script\c_layout.cpp" />
<ClCompile Include="api\script\objects\c_script\c_rootobj.cpp" />
<ClCompile Include="api\script\objects\c_script\c_slider.cpp" />
<ClCompile Include="api\script\objects\c_script\c_text.cpp" />
<ClCompile Include="api\script\objects\c_script\h_checkbox.cpp" />
<ClCompile Include="api\script\objects\c_script\h_edit.cpp" />
<ClCompile Include="api\script\objects\c_script\h_guiobject.cpp" />
<ClCompile Include="api\script\objects\c_script\h_rootobj.cpp" />
<ClCompile Include="api\script\objects\c_script\h_slider.cpp" />
<ClCompile Include="api\script\objects\c_script\scripthook.cpp" />
<ClCompile Include="api\script\objects\rootobj.cpp" />
<ClCompile Include="api\script\objects\rootobjcbx.cpp" />
<ClCompile Include="api\script\scriptobj.cpp" />
<ClCompile Include="api\script\scriptobji.cpp" />
<ClCompile Include="api\script\scriptobjx.cpp" />
<ClCompile Include="api\service\api_service.cpp" />
<ClCompile Include="api\service\svcenum.cpp" />
<ClCompile Include="api\service\svcs\svc_wndcreate.cpp" />
<ClCompile Include="api\service\svcs\svc_xuiobject.cpp" />
<ClCompile Include="api\service\svc_enum.cpp" />
<ClCompile Include="api\service\waservicefactoryx.cpp" />
<ClCompile Include="api\skin\nakedobject.cpp" />
<ClCompile Include="api\syscb\callbacks\skincb.cpp" />
<ClCompile Include="api\syscb\callbacks\syscbx.cpp" />
<ClCompile Include="api\timer\timerclient.cpp" />
<ClCompile Include="api\wndmgr\skinwnd.cpp" />
<ClCompile Include="api\wnd\basewnd.cpp" />
<ClCompile Include="api\wnd\di.cpp" />
<ClCompile Include="api\wnd\findobjectcb.cpp" />
<ClCompile Include="api\wnd\popup.cpp" />
<ClCompile Include="api\wnd\rootwnd.cpp" />
<ClCompile Include="api\wnd\virtualwnd.cpp" />
<ClCompile Include="api\wnd\wndclass\abstractwndhold.cpp" />
<ClCompile Include="api\wnd\wndclass\appbarwnd.cpp" />
<ClCompile Include="api\wnd\wndclass\buttwnd.cpp" />
<ClCompile Include="api\wnd\wndclass\clickwnd.cpp" />
<ClCompile Include="api\wnd\wndclass\guiobjwnd.cpp" />
<ClCompile Include="api\wnd\wndclass\labelwnd.cpp" />
<ClCompile Include="api\wnd\wndclass\listwnd.cpp" />
<ClCompile Include="api\wnd\wndclass\rootwndholder.cpp" />
<ClCompile Include="api\wnd\wndclass\scbkgwnd.cpp" />
<ClCompile Include="api\wnd\wndclass\scrollbar.cpp" />
<ClCompile Include="api\wnd\wndclass\SelItemList.cpp" />
<ClCompile Include="api\wnd\wndclass\sepwnd.cpp" />
<ClCompile Include="api\wnd\wndclass\svcwndhold.cpp" />
<ClCompile Include="api\wnd\wndclass\tooltip.cpp" />
<ClCompile Include="bfc\std_file.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="api.h" />
<ClInclude Include="api\service\api_service.h" />
<ClInclude Include="api\wnd\bltcanvas.h" />
<ClInclude Include="api\wnd\canvas.h" />
<ClInclude Include="api\wnd\wndclass\guiobjwnd.h" />
<ClInclude Include="bfc\std_file.h" />
<ClInclude Include="precomp.h" />
<ClInclude Include="wasabicfg.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,273 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="api\service\api_service.cpp">
<Filter>Source Files\api\service</Filter>
</ClCompile>
<ClCompile Include="api\wnd\wndclass\abstractwndhold.cpp">
<Filter>Source Files\api\wnd\wndclass</Filter>
</ClCompile>
<ClCompile Include="api\wnd\wndclass\appbarwnd.cpp">
<Filter>Source Files\api\wnd\wndclass</Filter>
</ClCompile>
<ClCompile Include="api\config\items\attribute.cpp">
<Filter>Source Files\api\config\items</Filter>
</ClCompile>
<ClCompile Include="api\wnd\basewnd.cpp">
<Filter>Source Files\api\wnd</Filter>
</ClCompile>
<ClCompile Include="api\wnd\wndclass\buttwnd.cpp">
<Filter>Source Files\api\wnd\wndclass</Filter>
</ClCompile>
<ClCompile Include="api\script\objects\c_script\c_checkbox.cpp">
<Filter>Source Files\api\script\objects\c_script</Filter>
</ClCompile>
<ClCompile Include="api\script\objects\c_script\c_container.cpp">
<Filter>Source Files\api\script\objects\c_script</Filter>
</ClCompile>
<ClCompile Include="api\script\objects\c_script\c_text.cpp">
<Filter>Source Files\api\script\objects\c_script</Filter>
</ClCompile>
<ClCompile Include="api\script\objects\c_script\c_edit.cpp">
<Filter>Source Files\api\script\objects\c_script</Filter>
</ClCompile>
<ClCompile Include="api\script\objects\c_script\c_group.cpp">
<Filter>Source Files\api\script\objects\c_script</Filter>
</ClCompile>
<ClCompile Include="api\script\objects\c_script\c_guiobject.cpp">
<Filter>Source Files\api\script\objects\c_script</Filter>
</ClCompile>
<ClCompile Include="api\script\objects\c_script\c_layout.cpp">
<Filter>Source Files\api\script\objects\c_script</Filter>
</ClCompile>
<ClCompile Include="api\script\objects\c_script\c_rootobj.cpp">
<Filter>Source Files\api\script\objects\c_script</Filter>
</ClCompile>
<ClCompile Include="api\script\objects\c_script\c_slider.cpp">
<Filter>Source Files\api\script\objects\c_script</Filter>
</ClCompile>
<ClCompile Include="api\config\items\cfgitemi.cpp">
<Filter>Source Files\api\config\items</Filter>
</ClCompile>
<ClCompile Include="api\config\items\cfgitemx.cpp">
<Filter>Source Files\api\config\items</Filter>
</ClCompile>
<ClCompile Include="api\wnd\wndclass\clickwnd.cpp">
<Filter>Source Files\api\wnd\wndclass</Filter>
</ClCompile>
<ClCompile Include="api\wnd\di.cpp">
<Filter>Source Files\api\wnd</Filter>
</ClCompile>
<ClCompile Include="api\wnd\findobjectcb.cpp">
<Filter>Source Files\api\wnd</Filter>
</ClCompile>
<ClCompile Include="api\wnd\wndclass\guiobjwnd.cpp">
<Filter>Source Files\api\wnd\wndclass</Filter>
</ClCompile>
<ClCompile Include="api\script\objects\c_script\h_slider.cpp">
<Filter>Source Files\api\script\objects\c_script</Filter>
</ClCompile>
<ClCompile Include="api\script\objects\c_script\h_checkbox.cpp">
<Filter>Source Files\api\script\objects\c_script</Filter>
</ClCompile>
<ClCompile Include="api\script\objects\c_script\h_edit.cpp">
<Filter>Source Files\api\script\objects\c_script</Filter>
</ClCompile>
<ClCompile Include="api\script\objects\c_script\h_guiobject.cpp">
<Filter>Source Files\api\script\objects\c_script</Filter>
</ClCompile>
<ClCompile Include="api\script\objects\c_script\h_rootobj.cpp">
<Filter>Source Files\api\script\objects\c_script</Filter>
</ClCompile>
<ClCompile Include="api\wnd\wndclass\labelwnd.cpp">
<Filter>Source Files\api\wnd\wndclass</Filter>
</ClCompile>
<ClCompile Include="api\wnd\wndclass\listwnd.cpp">
<Filter>Source Files\api\wnd\wndclass</Filter>
</ClCompile>
<ClCompile Include="api\skin\nakedobject.cpp">
<Filter>Source Files\api\skin</Filter>
</ClCompile>
<ClCompile Include="api\script\objcontroller.cpp">
<Filter>Source Files\api\script</Filter>
</ClCompile>
<ClCompile Include="api\wnd\popup.cpp">
<Filter>Source Files\api\wnd</Filter>
</ClCompile>
<ClCompile Include="api\script\objects\rootobj.cpp">
<Filter>Source Files\api\script\objects</Filter>
</ClCompile>
<ClCompile Include="api\script\objects\rootobjcbx.cpp">
<Filter>Source Files\api\script\objects</Filter>
</ClCompile>
<ClCompile Include="api\wnd\rootwnd.cpp">
<Filter>Source Files\api\wnd</Filter>
</ClCompile>
<ClCompile Include="api\wnd\wndclass\rootwndholder.cpp">
<Filter>Source Files\api\wnd\wndclass</Filter>
</ClCompile>
<ClCompile Include="api\wnd\wndclass\scbkgwnd.cpp">
<Filter>Source Files\api\wnd\wndclass</Filter>
</ClCompile>
<ClCompile Include="api\script\objects\c_script\scripthook.cpp">
<Filter>Source Files\api\script\objects\c_script</Filter>
</ClCompile>
<ClCompile Include="api\script\scriptobj.cpp">
<Filter>Source Files\api\script</Filter>
</ClCompile>
<ClCompile Include="api\script\scriptobji.cpp">
<Filter>Source Files\api\script</Filter>
</ClCompile>
<ClCompile Include="api\script\scriptobjx.cpp">
<Filter>Source Files\api\script</Filter>
</ClCompile>
<ClCompile Include="api\wnd\wndclass\scrollbar.cpp">
<Filter>Source Files\api\wnd\wndclass</Filter>
</ClCompile>
<ClCompile Include="api\wnd\wndclass\SelItemList.cpp">
<Filter>Source Files\api\wnd\wndclass</Filter>
</ClCompile>
<ClCompile Include="api\wnd\wndclass\sepwnd.cpp">
<Filter>Source Files\api\wnd\wndclass</Filter>
</ClCompile>
<ClCompile Include="api\syscb\callbacks\skincb.cpp">
<Filter>Source Files\api\syscb\callbacks</Filter>
</ClCompile>
<ClCompile Include="api\wndmgr\skinwnd.cpp">
<Filter>Source Files\api\wndmgr</Filter>
</ClCompile>
<ClCompile Include="api\service\svc_enum.cpp">
<Filter>Source Files\api\service</Filter>
</ClCompile>
<ClCompile Include="api\service\svcs\svc_wndcreate.cpp">
<Filter>Source Files\api\service\svcs</Filter>
</ClCompile>
<ClCompile Include="api\service\svcs\svc_xuiobject.cpp">
<Filter>Source Files\api\service\svcs</Filter>
</ClCompile>
<ClCompile Include="api\service\svcenum.cpp">
<Filter>Source Files\api\service</Filter>
</ClCompile>
<ClCompile Include="api\wnd\wndclass\svcwndhold.cpp">
<Filter>Source Files\api\wnd\wndclass</Filter>
</ClCompile>
<ClCompile Include="api\syscb\callbacks\syscbx.cpp">
<Filter>Source Files\api\syscb\callbacks</Filter>
</ClCompile>
<ClCompile Include="api\timer\timerclient.cpp">
<Filter>Source Files\api\timer</Filter>
</ClCompile>
<ClCompile Include="api\wnd\wndclass\tooltip.cpp">
<Filter>Source Files\api\wnd\wndclass</Filter>
</ClCompile>
<ClCompile Include="api\wnd\virtualwnd.cpp">
<Filter>Source Files\api\wnd</Filter>
</ClCompile>
<ClCompile Include="api\service\waservicefactoryx.cpp">
<Filter>Source Files\api\service</Filter>
</ClCompile>
<ClCompile Include="bfc\std_file.cpp">
<Filter>Source Files\bfc</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="api.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="precomp.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="wasabicfg.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="api\service\api_service.h">
<Filter>Header Files\api\service</Filter>
</ClInclude>
<ClInclude Include="api\wnd\canvas.h">
<Filter>Header Files\api\wnd</Filter>
</ClInclude>
<ClInclude Include="api\wnd\bltcanvas.h">
<Filter>Header Files\api\wnd</Filter>
</ClInclude>
<ClInclude Include="api\wnd\wndclass\guiobjwnd.h">
<Filter>Header Files\api\wnd\wndclass</Filter>
</ClInclude>
<ClInclude Include="bfc\std_file.h">
<Filter>Header Files\bfc</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="Header Files">
<UniqueIdentifier>{dbf13851-c318-4a95-aff6-3b6055c6a205}</UniqueIdentifier>
</Filter>
<Filter Include="Ressource Files">
<UniqueIdentifier>{539a23c0-6b45-4ecc-b700-1517b9a2090b}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files">
<UniqueIdentifier>{b9f7a0c5-e7f3-4c5e-951a-cc659749236f}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\api">
<UniqueIdentifier>{49e93f95-1142-4fd3-b901-d2e697a6f748}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\api">
<UniqueIdentifier>{c29b7e0a-c700-40e7-b9f1-e1a12b4c4344}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\api\service">
<UniqueIdentifier>{6de55f05-d29e-4425-ac5c-4ba0206f2428}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\api\service">
<UniqueIdentifier>{970810fc-bf0a-4538-a27d-a6cf74c9019f}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\api\wnd">
<UniqueIdentifier>{5a3833d7-80e1-4bc5-ba8a-e45af67493c8}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\api\wnd\wndclass">
<UniqueIdentifier>{5a032a3e-0249-401d-affc-8f861417d7f4}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\api\wnd">
<UniqueIdentifier>{f8a52c4e-ae5b-480b-a9c3-2ee541f6a0b2}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\api\wnd\wndclass">
<UniqueIdentifier>{6976ca4e-861e-420a-829b-be7dd6d64c6f}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\api\config">
<UniqueIdentifier>{56085077-5e0d-483d-bb6e-13e8032838af}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\api\config\items">
<UniqueIdentifier>{0fef4cd4-2600-4334-915e-d5604319e199}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\api\script">
<UniqueIdentifier>{4a5572b3-b76f-4ea3-9bda-6aa43a581d23}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\api\script\objects">
<UniqueIdentifier>{1d14d1fd-a6a2-4301-a32a-4a04e6f089f3}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\api\script\objects\c_script">
<UniqueIdentifier>{6c231033-c54d-440b-9b95-e1d40014b9dc}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\api\skin">
<UniqueIdentifier>{7c03ecf2-ff49-4552-88ca-22e05b4dca52}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\api\syscb">
<UniqueIdentifier>{ba806104-cc0c-4e8d-b485-714dbfae1202}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\api\syscb\callbacks">
<UniqueIdentifier>{e9a18113-73d0-4870-873e-d3de2e9eea9b}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\api\wndmgr">
<UniqueIdentifier>{37ccb88f-129a-4a2f-a4c1-d84e93e3497c}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\api\service\svcs">
<UniqueIdentifier>{7dc06802-d3ba-43c2-a0a8-4ee6be05fa4a}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\api\timer">
<UniqueIdentifier>{89dea900-93ab-4dd9-b005-127a49043617}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\bfc">
<UniqueIdentifier>{a95c28e4-88d9-4680-af04-41dc336ce90c}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\bfc">
<UniqueIdentifier>{b92f23f7-906b-4003-8b9c-fb5492e25090}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>

File diff suppressed because it is too large Load Diff

54
Src/Wasabi/api.h Normal file
View File

@ -0,0 +1,54 @@
#ifndef NULLSOFT_WASABI_API_H
#define NULLSOFT_WASABI_API_H
#include <api/syscb/api_syscb.h>
#define WASABI_API_SYSCB sysCallbackApi
#include <api/wndmgr/api_wndmgr.h>
#define WASABI_API_WNDMGR wndManagerApi
#include "api/config/api_config.h"
#define WASABI_API_CONFIG configApi
#include "api/service/api_service.h"
#include <api/application/api_application.h>
#define WASABI_API_APP applicationApi
#include <api/skin/api_skin.h>
#define WASABI_API_SKIN skinApi
#include <api/script/api_maki.h>
#define WASABI_API_MAKI makiApi
#include <api/wnd/api_wnd.h>
#define WASABI_API_WND wndApi
#include <api/timer/api_timer.h>
#define WASABI_API_TIMER timerApi
#include <api/font/api_font.h>
#define WASABI_API_FONT fontApi
#include <api/imgldr/api_imgldr.h>
#define WASABI_API_IMGLDR imgLoaderApi
#include <api/memmgr/api_memmgr.h>
extern api_memmgr *memmgrApi;
#define WASABI_API_MEMMGR memmgrApi
#include <api/filereader/api_filereader.h>
#define WASABI_API_FILE fileApi
#include <api/skin/api_colorthemes.h>
#define WASABI_API_COLORTHEMES colorThemesApi
#include <api/skin/api_palette.h>
extern api_palette *paletteManagerApi;
#define WASABI_API_PALETTE paletteManagerApi
#include "../nu/threadpool/api_threadpool.h"
extern api_threadpool *threadPoolApi;
#define WASABI_API_THREADPOOL threadPoolApi
#endif

176
Src/Wasabi/api/apiconfig.h Normal file
View File

@ -0,0 +1,176 @@
#ifndef __API_DEF_CFG_H
#define __API_DEF_CFG_H
#define WASABINOMAINAPI
#ifdef WASABI_COMPILE_APP
# define WASABI_API_APP applicationApi
#endif
#ifdef WASABI_COMPILE_SVC
# define WASABI_API_SVC serviceApi
#endif
#ifdef WASABI_COMPILE_SYSCB
# define WASABI_API_SYSCB sysCallbackApi
#endif
#ifdef WASABI_COMPILE_COMPONENTS
# define WASABI_API_COMPONENT componentApi
#endif
#ifdef WASABI_COMPILE_SCRIPT
# define WASABI_API_MAKI makiApi
#endif
#ifdef WASABI_COMPILE_UTF
# define WASABI_API_UTF utfApi
#endif
#ifdef WASABI_COMPILE_WND
# define WASABI_API_WND wndApi
#endif
#ifdef WASABI_COMPILE_IMGLDR
# define WASABI_API_IMGLDR imgLoaderApi
#endif
#ifdef WASABI_COMPILE_FILEREADER
# define WASABI_API_FILE fileApi
#endif
#ifdef WASABI_COMPILE_TIMERS
# define WASABI_API_TIMER timerApi
#endif
#ifdef WASABI_COMPILE_WNDMGR
# define WASABI_API_WNDMGR wndManagerApi
#endif
#ifdef WASABI_COMPILE_SKIN
# define WASABI_API_SKIN skinApi
#endif
#ifdef WASABI_COMPILE_METADB
# define WASABI_API_METADB metadbApi
#endif
#ifdef WASABI_COMPILE_LOCALES
# define WASABI_API_LOCALE localeApi
#endif
#ifdef WASABI_COMPILE_CONFIG
# define WASABI_API_CONFIG configApi
#endif
#ifdef WASABI_COMPILE_FONTS
# define WASABI_API_FONT fontApi
// This sets the static font renderer. If you are compiling with api_config, the attribute to set is { 0x280876cf, 0x48c0, 0x40bc, { 0x8e, 0x86, 0x73, 0xce, 0x6b, 0xb4, 0x62, 0xe5 } }, "Font Renderer"
# if defined(WASABI_FONT_RENDERER_USE_WIN32)
# define WASABI_FONT_RENDERER "" // "" is Win32
# elif defined(WASABI_FONT_RENDERER_USE_FREETYPE)
# define WASABI_FONT_RENDERER "Freetype" // Freetype lib
# else
# define WASABI_FONT_RENDERER "" // "" default for OS
# endif
#endif
#ifdef WASABI_COMPILE_MEMMGR
# define WASABI_API_MEMMGR memmgrApi
#endif
#ifdef WASABI_COMPILE_XMLPARSER
# define WASABI_API_XML xmlApi
#endif
#ifdef WASABI_COMPILE_MEDIACORE
# define WASABI_API_MEDIACORE coreApi
#endif
#ifdef WASABI_COMPILE_TEXTMODE
# define WASABI_API_TEXTMODE textmodeApi
#endif
#ifdef LINUX
# define WASABI_COMPILE_LINUX
# define WASABI_API_LINUX linuxApi
#endif
#ifdef WASABI_COMPILE_STATSWND
# if defined(_DEBUG) | defined(WASABI_DEBUG)
# define WASABI_COMPILE_STATSWND
# ifndef WASABI_DEBUG
# define WASABI_DEBUG
# endif
# endif
#endif
#ifdef WASABI_COMPILE_APP
# include <api/application/api_application.h>
#endif
#ifdef WASABI_COMPILE_SVC
# include <api/service/api_service.h>
#endif
#ifdef WASABI_COMPILE_SYSCB
# include <api/syscb/api_syscb.h>
#endif
#ifdef WASABI_COMPILE_MEMMGR
# include <api/memmgr/api_memmgr.h>
#endif
#ifdef WASABI_COMPILE_SCRIPT
# include <api/script/api_maki.h>
#endif
#ifdef WASABI_COMPILE_FONTS
# include <api/font/api_font.h>
#endif
#ifdef WASABI_COMPILE_WND
# include <api/wnd/api_wnd.h>
#endif
#ifdef WASABI_COMPILE_IMGLDR
# include <api/imgldr/api_imgldr.h>
#endif
#ifdef WASABI_COMPILE_FILEREADER
# include <api/filereader/api_filereader.h>
#endif
#ifdef WASABI_COMPILE_TIMERS
# include <api/timer/api_timer.h>
#endif
#ifdef WASABI_COMPILE_WNDMGR
# include <api/wndmgr/api_wndmgr.h>
#endif
#ifdef WASABI_COMPILE_LOCALES
# include <api/locales/api_locales.h>
#endif
#ifdef WASABI_COMPILE_CONFIG
# include <api/config/api_config.h>
#endif
#ifdef WASABI_COMPILE_SKIN
# include <api/skin/api_skin.h>
#endif
#ifdef WASABI_COMPILE_MAKIDEBUG
# include <api/script/debugger/api_makidebug.h>
#endif
#ifdef WASABI_COMPILE_TEXTMODE
# include <api/textmode/api_textmode.h>
#endif
#ifdef WASABI_API_LINUX
#include <api/linux/api_linux.h>
#endif
#endif

548
Src/Wasabi/api/apiinit.cpp Normal file
View File

@ -0,0 +1,548 @@
#include "./wndmgr/layout.h"
#include <tataki/export.h>
//<?#include "<class data="implementationheader"/>"
#include "apiinit.h"
//?>
#include <api/memmgr/api_memmgr.h>
#define WASABI_SAYMYNAME
#include <wasabicfg.h>
#undef WASABI_SAYMYNAME
#include <api/service/servicei.h>
#include <api/locales/api_localesi.h>
#include <api/config/api_configi.h>
#include <api/config/items/cfgitem.h>
#ifdef WASABI_COMPILE_FONTS
#include <api/font/FontCreator.h>
#include <api/font/fontapi.h>
#endif
#include <api/skin/skinapi.h>
#include <api/skin/groupwndcreate.h>
#include <api/script/makiapi.h>
#include <api/script/objecttable.h>
#include <api/wnd/wndapi.h>
#include <api/wnd/wndclass/foreignwnd.h>
#include <api/wnd/wndclass/clickwnd.h>
#include <api/imgldr/imgldrapi.h>
#ifdef WASABI_COMPILE_FONTS
#ifdef WIN32
# include <api/font/win32/truetypefont_win32.h>
#elif defined(LINUX)
# include <api/font/linux/truetypefont_linux.h>
#else
# error port me
#endif // platform
#endif // fonts
#include <api/wndmgr/wndmgrapi.h>
#ifdef WASABI_COMPILE_MAKIDEBUG
#include <api/script/debugger/debugapi.h>
#endif
#ifdef WASABI_COMPILE_MAKIDEBUG
#include <api/core/api_core.h>
#endif
#ifdef WASABI_COMPILE_FILEREADER
#include <api/filereader/filereaderapi.h>
#ifdef WASABI_COMPILE_ZIPREADER
#include <api/filereader/zip/zipread.h>
#endif
#endif
#ifdef WASABI_COMPILE_LINUX
#include <api/linux/api_linuxi.h>
#endif
#ifdef WASABI_COMPILE_TEXTMODE
#if defined(WIN32)
#include <api/textmode/textmode_win32.h>
#elif defined(LINUX)
#include <api/textmode/textmode_ncurses.h>
#else // dummy
#include <api/textmode/api_textmodeI.h>
#endif
#endif
#if defined(WASABI_COMPILE_COMPONENTS) | defined(GEN_FF) // MULTIAPI-FIXME
#include <api/wac/compon.h>
#endif
#include <api/wndmgr/gc.h>
#include <api/application/api_application.h>
#ifndef WASABI_CUSTOM_MODULE_SVCMGR
DECLARE_MODULE_SVCMGR;
#endif
#ifdef _WIN32
extern HINSTANCE hInstance;
#endif
extern StringW g_resourcepath;
api_application *applicationApi = NULL;
timer_api *timerApi = NULL;
int ApiInit::init(OSMODULEHANDLE hinstance, OSWINDOWHANDLE mainwnd, api_service *wa5_svc)
{
Tataki::Init(wa5_svc);
serviceApi = wa5_svc;
initcount++;
#ifndef WA3COMPATIBILITY
// ------------------------------------------------------------------------
// Init callback system
// ------------------------------------------------------------------------
waServiceFactory *sf = WASABI_API_SVC->service_getServiceByGuid(syscbApiServiceGuid);
if (sf) sysCallbackApi = reinterpret_cast<api_syscb *>(sf->getInterface());
// ------------------------------------------------------------------------
// Init application API
// ------------------------------------------------------------------------
sf = WASABI_API_SVC->service_getServiceByGuid(applicationApiServiceGuid);
if (sf) applicationApi = reinterpret_cast<api_application *>(sf->getInterface());
g_resourcepath = StringPathCombine(WASABI_API_APP->path_getAppPath(), WASABI_RESOURCES_SUBDIRECTORY);
// ------------------------------------------------------------------------
// Init centralized memory manager api
// ------------------------------------------------------------------------
sf = WASABI_API_SVC->service_getServiceByGuid(memMgrApiServiceGuid);
if (sf) WASABI_API_MEMMGR = reinterpret_cast<api_memmgr *>(sf->getInterface());
#ifdef WASABI_COMPILE_FILEREADER
// ------------------------------------------------------------------------
// Init file reader api and optional file readers
// ------------------------------------------------------------------------
fr = new FileReaderApi();
fileApi = fr;
WASABI_API_SVC->service_register(frapisvc = new FileReaderApiService());
//WASABI_API_SVC->service_register(&diskReader);
// set up custom file readers
#ifdef WASABI_COMPILE_ZIPREADER
zipRead = new waServiceTSingle<svc_fileReader, ZipRead>;
#endif
#ifdef WASABI_COMPILE_ZIPREADER
WASABI_API_SVC->service_register(zipRead);
#endif
#endif // WASABI_COMPILE_FILEREADER
// ------------------------------------------------------------------------
// Init config api and register optional config items
// ------------------------------------------------------------------------
#ifdef WASABI_COMPILE_CONFIG
cfg = new api_configI();
configApi = cfg;
WASABI_API_SVC->service_register(cfgapisvc = new ConfigApiService());
#endif
// if no static service was ever declared, we need to init it so we don't hit null
INIT_MODULE_SVCMGR();
DebugStringW(L"Auto-initializing %d services (system pass)\n", staticServiceMgr->__m_modules2.getNumItems());
MODULE_SVCMGR_ONINIT2();
#ifdef WASABI_COMPILE_IMGLDR
// ------------------------------------------------------------------------
// Init image loading api and optional image formats
// ------------------------------------------------------------------------
img = new ImgLdrApi();
imgLoaderApi = img;
WASABI_API_SVC->service_register(imgldrapisvc = new ImgLdrApiService());
#endif
#ifdef WASABI_COMPILE_FONTS
// ------------------------------------------------------------------------
// Init font rendering api
// ------------------------------------------------------------------------
font = new FontApi();
fontApi = font;
win32Font = new FontCreator<TrueTypeFont_Win32>;
WASABI_API_SVC->service_register(win32Font);
WASABI_API_SVC->service_register(fontapisvc = new FontApiService());
#endif
#ifdef WASABI_COMPILE_LOCALES
// ------------------------------------------------------------------------
// Init localization
// ------------------------------------------------------------------------
loc = new api_localesI();
localesApi = loc;
WASABI_API_SVC->service_register(localesapisvc = new LocalesApiService());
#endif
// ------------------------------------------------------------------------
// Init timer api
// ------------------------------------------------------------------------
sf = WASABI_API_SVC->service_getServiceByGuid(timerApiServiceGuid);
if (sf) timerApi = reinterpret_cast<timer_api *>(sf->getInterface());
#ifdef WASABI_COMPILE_WND
// ------------------------------------------------------------------------
// Init window api
// ------------------------------------------------------------------------
wnd = new WndApi();
wndApi = wnd;
#ifdef _WIN32
if (mainwnd != NULL)
{
mainWnd = new ForeignWnd(mainwnd, hInstance);
DebugStringW(L"main wnd handle is %x\n", mainWnd->gethWnd());
wnd->main_setRootWnd(mainWnd);
}
else
{
default_mainWnd = new ClickWnd();
default_mainWnd->init(hInstance, NULL, TRUE);
wnd->main_setRootWnd(default_mainWnd);
}
#endif
WASABI_API_SVC->service_register(wndapisvc = new WndApiService());
#endif
// ------------------------------------------------------------------------
// Init media core api
// ------------------------------------------------------------------------
#ifdef WASABI_COMPILE_MEDIACORE
#ifndef WA3COMPATIBILITY
#ifdef WASABI_CUSTOMIMPL_MEDIACORE
coreApi = createCustomCoreApi();
#else
#error "not done yet"
#endif
#endif
WASABI_API_SVC->service_register(coreapisvc = new CoreApiService());
#endif
#ifdef WASABI_COMPILE_WNDMGR
// ------------------------------------------------------------------------
// Init window manager api
// ------------------------------------------------------------------------
wndmgr = new WndMgrApi ();
wndManagerApi = wndmgr;
WASABI_API_SVC->service_register(wndmgrapisvc = new WndMgrApiService());
#endif
#ifdef WASABI_COMPILE_SKIN
// ------------------------------------------------------------------------
// Init skin
// ------------------------------------------------------------------------
skin = new SkinApi();
skinApi = skin;
#ifdef WASABI_COMPILE_COMPONENTS
groupcreate = new waServiceTSingle<svc_windowCreate, GroupWndCreateSvc>;
WASABI_API_SVC->service_register(groupcreate);
#endif
WASABI_API_SVC->service_register(skinapisvc = new SkinApiService());
#endif
#ifdef WASABI_COMPILE_MAKIDEBUG
// ------------------------------------------------------------------------
// Init script debugger api
// ------------------------------------------------------------------------
debug = new MakiDebuggerApi();
debugApi = debug;
WASABI_API_SVC->service_register(makidebugapisvc = new MakiDebugApiService());
#endif
#ifdef WASABI_COMPILE_SKIN
widgets = new Widgets();
#endif
#endif
DebugStringW(L"Auto-initializing %d services (user pass)\n", staticServiceMgr->__m_modules.getNumItems());
MODULE_SVCMGR_ONINIT();
#ifndef WA3COMPATIBILITY
#ifdef WASABI_COMPILE_SCRIPT
// ------------------------------------------------------------------------
// Init scripting api
// ------------------------------------------------------------------------
maki = new api_makiI();
makiApi = maki;
WASABI_API_SVC->service_register(makiapisvc = new MakiApiService());
maki->init();
#ifdef WASABI_COMPILE_WNDMGR
garbageCollector = new GarbageCollector();
#endif
ObjectTable::start();
#endif
#endif //wa3compat
return 1; // success
}
int ApiInit::shutdown()
{
#ifndef WA3COMPATIBILITY
garbageCollector->gccb_onGarbageCollect();
delete garbageCollector;
#ifdef WASABI_COMPILE_SKIN
skin->preShutdown();
#endif
MODULE_SVCMGR_ONSHUTDOWN();
#ifdef _WIN32
ComponentManager::unloadAll();
#else
#warning port me?
#endif
WASABI_API_SVC->service_deregister(skinapisvc);
delete skin;
skinApi = NULL;
delete skinapisvc;
skinapisvc = 0;
#ifdef WASABI_COMPILE_SCRIPT
ObjectTable::shutdown();
#endif
#ifdef WASABI_COMPILE_SKIN
delete widgets;
widgets = NULL;
#endif
WASABI_API_SVC->service_deregister(makiapisvc);
delete maki;
makiApi = NULL;
delete makiapisvc;
makiapisvc = 0;
#ifdef WASABI_COMPILE_COMPONENTS
WASABI_API_SVC->service_deregister(groupcreate);
delete groupcreate;
groupcreate = 0;
#endif
WASABI_API_SVC->service_deregister(win32Font);
delete win32Font;
win32Font = 0;
#ifdef WASABI_COMPILE_MEDIACORE
#ifndef WA3COMPATIBILITY
#ifdef WASABI_CUSTOMIMPL_MEDIACORE
destroyCustomCoreApi(coreApi);
#else
#error "not done yet"
#endif
#endif
WASABI_API_SVC->service_deregister(coreapisvc);
delete coreapisvc;
coreapisvc = 0;
#endif
WASABI_API_SVC->service_deregister(wndmgrapisvc);
delete wndmgr;
wndManagerApi = NULL;
delete wndmgrapisvc;
wndmgrapisvc = 0;
delete loc;
localesApi = NULL;
WASABI_API_SVC->service_deregister(localesapisvc);
delete localesapisvc;
localesapisvc = 0;
#ifdef WASABI_COMPILE_FILEREADER
#ifdef WASABI_COMPILE_ZIPREADER
WASABI_API_SVC->service_deregister(zipRead);
delete zipRead;
#endif
delete fr;
fileApi = NULL;
WASABI_API_SVC->service_deregister(frapisvc);
delete frapisvc;
frapisvc = 0;
#endif
#endif
delete mainWnd;
mainWnd = NULL;
delete default_mainWnd;
default_mainWnd = NULL;
WASABI_API_SVC->service_deregister(wndapisvc);
delete wnd;
wndApi = NULL;
delete wndapisvc;
wndapisvc = 0;
#ifdef WASABI_COMPILE_FONTS
WASABI_API_SVC->service_deregister(fontapisvc);
delete font;
fontApi = NULL;
delete fontapisvc;
fontapisvc = 0;
#endif
#ifndef WA3COMPATIBILITY
delete img;
imgLoaderApi = NULL;
WASABI_API_SVC->service_deregister(imgldrapisvc);
delete imgldrapisvc;
imgldrapisvc = 0;
#ifdef WASABI_COMPILE_CONFIG
WASABI_API_SVC->service_deregister(cfgapisvc);
delete cfg;
configApi = NULL;
delete cfgapisvc;
cfgapisvc = 0;
#endif
MODULE_SVCMGR_ONSHUTDOWN2();
WASABI_API_MEMMGR = NULL;
applicationApi=NULL;
#endif //wa3compatibility
#ifdef WASABI_COMPILE_MAKIDEBUG
delete debug;
debugApi = NULL;
WASABI_API_SVC->service_deregister(makidebugapisvc);
delete makidebugapisvc;
makidebugapisvc = 0;
#endif
if (alphaMgr)
delete alphaMgr;
alphaMgr=0;
// TODO: releaseInterface
timerApi = NULL;
Tataki::Quit();
sysCallbackApi = NULL;
return 1; // success
}
int ApiInit::getInitCount()
{
return initcount;
}
#ifdef WASABI_COMPILE_SKIN
#ifdef WASABI_COMPILE_COMPONENTS
waServiceFactoryI * ApiInit::groupcreate = NULL;
#endif
#endif //WASABI_COMPILE_SKIN
#ifdef WASABI_COMPILE_FONTS
waServiceFactoryI * ApiInit::win32Font = NULL;
FontApiService *ApiInit::fontapisvc = NULL;
#endif //WASABI_COMPILE_FONTS
#ifdef WASABI_COMPILE_SKIN
Widgets * ApiInit::widgets = NULL;
SkinApiService *ApiInit::skinapisvc = NULL;
#endif
#ifdef WASABI_COMPILE_CONFIG
api_configI * ApiInit::cfg = NULL;
ConfigApiService *ApiInit::cfgapisvc = NULL;
#endif
#ifdef WASABI_COMPILE_IMGLDR
ImgLdrApi * ApiInit::img = NULL;
ImgLdrApiService *ApiInit::imgldrapisvc = NULL;
#endif
#ifdef WASABI_COMPILE_FONTS
FontApi * ApiInit::font = NULL;
#endif
#ifdef WASABI_COMPILE_FILEREADER
FileReaderApi * ApiInit::fr = NULL;
#ifdef WASABI_COMPILE_ZIPREADER
waServiceFactoryI * ApiInit::zipRead = NULL;
#endif
FileReaderApiService *ApiInit::frapisvc = NULL;
#endif
#ifdef WASABI_COMPILE_LOCALES
api_localesI * ApiInit::loc = NULL;
LocalesApiService *ApiInit::localesapisvc = NULL;
#endif
#ifdef WASABI_COMPILE_WND
WndApi * ApiInit::wnd = NULL;
ForeignWnd * ApiInit::mainWnd = NULL;
ClickWnd * ApiInit::default_mainWnd = NULL;
WndApiService *ApiInit::wndapisvc = NULL;
#endif
#ifdef WASABI_COMPILE_WNDMGR
WndMgrApi * ApiInit::wndmgr = NULL;
WndMgrApiService *ApiInit::wndmgrapisvc = NULL;
#endif
#ifdef WASABI_COMPILE_SCRIPT
api_makiI * ApiInit::maki = NULL;
MakiApiService *ApiInit::makiapisvc = NULL;
#endif
#ifdef WASABI_COMPILE_SKIN
SkinApi * ApiInit::skin = NULL;
#endif
#ifdef WASABI_COMPILE_MAKIDEBUG
MakiDebuggerApi * ApiInit::debug = NULL;
MakiDebugApiService *ApiInit::makidebugapisvc = NULL;
#endif
#ifdef WASABI_COMPILE_MEDIACORE
CoreApiService *ApiInit::coreapisvc = NULL;
#endif
int ApiInit::initcount = 0;
api_memmgr *memmgrApi = NULL;

255
Src/Wasabi/api/apiinit.h Normal file
View File

@ -0,0 +1,255 @@
#ifndef __API_INIT_H
#define __API_INIT_H
#include <bfc/platform/platform.h>
#include <api/skin/widgets.h>
#include <bfc/string/bfcstring.h>
#include <api/syscb/api_syscbi.h>
#include <api/service/service.h>
class api_configI;
class SkinApi;
class api_makiI;
class MemMgrApi;
class TimerApi;
class WndApi;
class ForeignWnd;
class ClickWnd;
class ImgLdrApi;
#ifdef WASABI_COMPILE_FONTS
class FontApi;
#endif
#ifdef WASABI_COMPILE_WNDMGR
class WndMgrApi;
#endif
#ifdef WASABI_COMPILE_MAKIDEBUG
class MakiDebuggerApi;
#endif
#ifdef WASABI_COMPILE_FILEREADER
class FileReaderApi;
#endif
#ifdef WASABI_COMPILE_LOCALES
class api_localesI;
#endif
#ifndef WA3COMPATIBILITY
#ifdef WASABI_COMPILE_MEDIACORE
class Core;
#endif
#endif
#include <api/syscb/api_syscb.h>
#ifdef WASABI_COMPILE_MEDIACORE
#include <api/core/api_core.h>
class CoreApiService : public waServiceBase<api_core, CoreApiService> {
public:
CoreApiService() : waServiceBase<api_core, CoreApiService>(coreApiServiceGuid) {}
static const char *getServiceName() { return "Core API"; }
virtual api_core *getService() { return coreApi; }
static FOURCC getServiceType() { return WaSvc::UNIQUE; }
};
#endif // WASABI_COMPILE_MEDIACORE
#ifdef WASABI_COMPILE_FILEREADER
#include <api/filereader/api_filereader.h>
class FileReaderApiService : public waServiceBase<api_fileReader, FileReaderApiService> {
public:
FileReaderApiService() : waServiceBase<api_fileReader, FileReaderApiService>(fileReaderApiServiceGuid) {}
static const char *getServiceName() { return "FileReader API"; }
virtual api_fileReader *getService() { return fileApi; }
static FOURCC getServiceType() { return WaSvc::UNIQUE; }
};
#endif // WASABI_COMPILE_FILEREADER
#ifdef WASABI_COMPILE_CONFIG
#include <api/config/api_config.h>
class ConfigApiService : public waServiceBase<api_config, ConfigApiService> {
public:
ConfigApiService() : waServiceBase<api_config, ConfigApiService>(configApiServiceGuid) {}
static const char *getServiceName() { return "Config API"; }
virtual api_config *getService() { return configApi; }
static FOURCC getServiceType() { return WaSvc::UNIQUE; }
};
#endif // WASABI_COMPILE_CONFIG
#ifdef WASABI_COMPILE_IMGLDR
#include <api/imgldr/api_imgldr.h>
class ImgLdrApiService: public waServiceBase<imgldr_api, ImgLdrApiService> {
public:
ImgLdrApiService() : waServiceBase<imgldr_api, ImgLdrApiService>(imgLdrApiServiceGuid) {}
static const char *getServiceName() { return "Image Loading API"; }
virtual imgldr_api *getService() { return imgLoaderApi; }
static FOURCC getServiceType() { return WaSvc::UNIQUE; }
};
#endif // WASABI_COMPILE_IMGLDR
#ifdef WASABI_COMPILE_FONTS
#include <api/font/api_font.h>
class FontApiService : public waServiceBase<api_font, FontApiService> {
public:
FontApiService() : waServiceBase<api_font, FontApiService>(fontApiServiceGuid) {}
static const char *getServiceName() { return "Font Rendering API"; }
virtual api_font *getService() { return fontApi; }
static FOURCC getServiceType() { return WaSvc::UNIQUE; }
};
#endif // WASABI_COMPILE_FONT
#include <api/locales/api_locales.h>
class LocalesApiService : public waServiceBase<api_locales, LocalesApiService> {
public:
LocalesApiService() : waServiceBase<api_locales, LocalesApiService>(localesApiServiceGuid) {}
static const char *getServiceName() { return "Locales API"; }
virtual api_locales *getService() { return localesApi; }
static FOURCC getServiceType() { return WaSvc::UNIQUE; }
};
#include <api/wnd/api_wnd.h>
class WndApiService : public waServiceBase<wnd_api, WndApiService> {
public:
WndApiService() : waServiceBase<wnd_api, WndApiService>(wndApiServiceGuid) {}
static const char *getServiceName() { return "Windowing API"; }
virtual wnd_api *getService() { return wndApi; }
static FOURCC getServiceType() { return WaSvc::UNIQUE; }
};
#include <api/wndmgr/api_wndmgr.h>
class WndMgrApiService : public waServiceBase<wndmgr_api, WndMgrApiService> {
public:
WndMgrApiService() : waServiceBase<wndmgr_api, WndMgrApiService>(wndMgrApiServiceGuid) {}
static const char *getServiceName() { return "Window Manager API"; }
virtual wndmgr_api *getService() { return wndManagerApi; }
static FOURCC getServiceType() { return WaSvc::UNIQUE; }
};
#include <api/skin/api_skin.h>
class SkinApiService : public waServiceBase<api_skin, SkinApiService> {
public:
SkinApiService() : waServiceBase<api_skin, SkinApiService>(skinApiServiceGuid) {}
static const char *getServiceName() { return "Skinning API"; }
virtual api_skin *getService() { return skinApi; }
static FOURCC getServiceType() { return WaSvc::UNIQUE; }
};
#include <api/script/api_maki.h>
class MakiApiService : public waServiceBase<api_maki, MakiApiService> {
public:
MakiApiService() : waServiceBase<api_maki, MakiApiService>(makiApiServiceGuid) {}
static const char *getServiceName() { return "MAKI Scripting API"; }
virtual api_maki *getService() { return makiApi; }
static FOURCC getServiceType() { return WaSvc::UNIQUE; }
};
#ifdef WASABI_COMPILE_MAKIDEBUG
#include <api/script/debugger/api_makidebug.h>
class MakiDebugApiService : public waServiceBase<api_makiDebugger, MakiDebugApiService> {
public:
MakiDebugApiService() : waServiceBase<api_makiDebugger, MakiDebugApiService>(makiDebugApiServiceGuid) {}
static const char *getServiceName() { return "MAKI Debugger API"; }
virtual api_makiDebugger *getService() { return debugApi; }
static FOURCC getServiceType() { return WaSvc::UNIQUE; }
};
#endif // WASABI_COMPILE_SKIN
class ApiInit
{
public:
static int init(OSMODULEHANDLE hinstance, OSWINDOWHANDLE mainwnd, api_service *wa5_svc); // 0 == error, 1 == success
static int shutdown(); // 0 == error, 1 == success
static int getInitCount(); // if you do init / shutdown more than once in the session, this may be useful to invalid some caches
private:
#ifdef WASABI_COMPILE_SKIN
#ifdef WASABI_COMPILE_COMPONENTS
static waServiceFactoryI * groupcreate;
#endif //WASABI_COMPILE_COMPONENTS
#endif //WASABI_COMPILE_SKIN
static waServiceFactoryI * win32Font;
static FontApiService *fontapisvc;
public:
static Widgets * widgets;
private:
static SkinApiService *skinapisvc;
static api_configI * cfg;
static ConfigApiService *cfgapisvc;
static ImgLdrApi * img;
static ImgLdrApiService *imgldrapisvc;
#ifdef WASABI_COMPILE_FONTS
static FontApi * font;
#endif
#ifdef WASABI_COMPILE_FILEREADER
static FileReaderApi * fr;
#ifdef WASABI_COMPILE_ZIPREADER
static waServiceFactoryI * zipRead;
#endif
static FileReaderApiService *frapisvc;
#endif
static api_localesI *loc;
static LocalesApiService *localesapisvc;
static WndApi * wnd;
static ForeignWnd * mainWnd;
static ClickWnd * default_mainWnd;
static WndApiService *wndapisvc;
static WndMgrApi * wndmgr;
static WndMgrApiService *wndmgrapisvc;
static api_makiI * maki;
static MakiApiService *makiapisvc;
static SkinApi * skin;
#ifdef WASABI_COMPILE_MAKIDEBUG
static MakiDebuggerApi * debug;
static MakiDebugApiService *makidebugapisvc;
#endif
#ifdef WASABI_COMPILE_MEDIACORE
static CoreApiService *coreapisvc;
#endif
static int initcount;
};
#endif

View File

@ -0,0 +1,12 @@
// ----------------------------------------------------------------------------
// Generated by InterfaceFactory [Wed May 07 00:55:56 2003]
//
// File : api_application.cpp
// Class : api_application
// class layer : Dispatchable Interface
// ----------------------------------------------------------------------------
#include <precomp.h>
#include "api_application.h"

View File

@ -0,0 +1,416 @@
// ----------------------------------------------------------------------------
// Generated by InterfaceFactory [Wed May 07 00:55:56 2003]
//
// File : api_application.h
// Class : api_application
// class layer : Dispatchable Interface
// ----------------------------------------------------------------------------
#ifndef __API_APPLICATION_H
#define __API_APPLICATION_H
#include <bfc/dispatch.h>
#include <bfc/platform/guid.h>
#include <bfc/platform/platform.h>
#ifdef _WIN32
#include "ifc_messageprocessor.h"
#endif
// ----------------------------------------------------------------------------
enum
{
API_APPLICATION_SUCCESS = 0,
API_APPLICATION_FAILURE = 1,
};
enum
{
TRANSLATE_MODE_NORMAL = 0,
TRANSLATE_MODE_GLOBAL = 1,
TRANSLATE_MODE_CHILD = 2,
};
class NOVTABLE api_application: public Dispatchable
{
protected:
api_application() {}
~api_application() {}
public:
const wchar_t *main_getAppName(); // returns (e.g.) "Winamp"
const wchar_t *main_getVersionString(); // returns (e.g.) "Winamp 5.12"
const wchar_t *main_getVersionNumString(); // returns (e.g.) "5.12"
unsigned int main_getBuildNumber(); // returns (e.g.) 666
GUID main_getGUID();
#ifdef _WIN32
HANDLE main_getMainThreadHandle(); // This actually gives you a DuplicateHandle, so call CloseHandle() when you are done.
HINSTANCE main_gethInstance();
#endif // !_WIN32
const wchar_t *main_getCommandLine();
void main_shutdown( int deferred = TRUE );
void main_cancelShutdown();
int main_isShuttingDown();
const wchar_t *path_getAppPath();
const wchar_t *path_getUserSettingsPath();
// added for 5.58+ so gen_ff can fill @SKINSPATH@ in scripts correctly
const wchar_t *path_getSkinSettingsPath();
int app_getInitCount();
intptr_t app_messageLoopStep();
#ifdef _WIN32
void app_addMessageProcessor( ifc_messageprocessor *processor );
void app_removeMessageProcessor( ifc_messageprocessor *processor );
/* accelerators are 5.53+ */
void app_addAccelerators( HWND hwnd, HACCEL *phAccel, INT cAccel, UINT translateMode );
void app_removeAccelerators( HWND hwnd );
bool app_translateAccelerators( MSG *msg );
int app_getAccelerators( HWND hwnd, HACCEL *phAccel, INT cchAccelMax, BOOL bGlobal ); // phAccel == NULL && cchAccelMax == 0 -> returns accels count
/* register window as part of winamp global group (5.54+) */
void app_registerGlobalWindow( HWND hwnd );
void app_unregisterGlobalWindow( HWND hwnd );
/* 5.58 + */
bool DirectMouseWheel_RegisterSkipClass( ATOM klass );
bool DirectMouseWheel_UnregisterSkipClass( ATOM klass );
bool DirectMouseWheel_EnableConvertToMouseWheel( HWND hwnd, BOOL enable ); // !!! must be disabled before window destroyed !!!
/* 5.64 + */
BOOL DirectMouseWheel_ProcessDialogMessage( HWND hwnd, unsigned int uMsg, WPARAM wParam, LPARAM lParam, const int controls[], int controlslen );
/* 5.61 + */
void ActiveDialog_Register( HWND hwnd );
void ActiveDialog_Unregister( HWND hwnd );
HWND ActiveDialog_Get();
/* 5.64 + */
const wchar_t *getATFString(); // returns the current ATF formatting string
/* 5.66 + */
// used for dpi scaling so we're consistent in usage throughout the UI, etc
int getScaleX( int x );
int getScaleY( int y );
#endif // !_WIN32
/*
note: on windows, these two functions DON'T call Set/GetCurrentDirectory, Winamp maintains it's own path
because calling SetCurrentDirectory locks the folder
Added for 5.34
*/
const wchar_t *path_getWorkingPath(); // useful to call for populating lpstrInitialDir in GetOpenFileName
void path_setWorkingPath(const wchar_t *newPath); // useful to call for populating lpstrInitialDir in GetOpenFileName
/*
The following three function return you unique IDs you can use if you need
They are created anonymously, so information cannot be tracked back to a specific person
The main reason for their existence is that a few third party libraries require them
and some online media providers require this info for billing.
You can call this functions with a pointer to any 16 byte data structure cast to a GUID *
Added for 5.35
*/
// returns an ID unique to this computer, but not unique to the logged in user (two windows accts would share this ID)
int GetMachineID( GUID *id );
// returns an ID unique to this user. Another user logged in to the computer will have a different ID
// note that if Winamp was installed with "shared settings", the IDs of multiple users will probably be identical
// as we're just storing it in winamp.ini for now
int GetUserID( GUID *id );
// returns a unique ID for this session. Generated on the fly the first time someone calls this function
int GetSessionID( GUID *id );
/* 5.54 + */
size_t AllocateThreadStorage(); // returns an index, -1 for error
void *GetThreadStorage(size_t index);
void SetThreadStorage(size_t index, void *value);
protected:
enum
{
API_APPLICATION_MAIN_GETAPPNAME = 10,
API_APPLICATION_MAIN_GETVERSIONSTRING = 20,
API_APPLICATION_MAIN_GETVERSIONSTRING2 = 21,
API_APPLICATION_MAIN_GETBUILDNUMBER = 30,
API_APPLICATION_MAIN_GETGUID = 40,
API_APPLICATION_MAIN_GETMAINTHREADHANDLE = 50,
API_APPLICATION_MAIN_GETHINSTANCE = 60,
API_APPLICATION_MAIN_GETCOMMANDLINE = 70,
API_APPLICATION_MAIN_SHUTDOWN = 80,
API_APPLICATION_MAIN_CANCELSHUTDOWN = 90,
API_APPLICATION_MAIN_ISSHUTTINGDOWN = 100,
API_APPLICATION_PATH_GETAPPPATH = 110,
API_APPLICATION_PATH_GETUSERSETTINGSPATH = 120,
API_APPLICATION_APP_GETINITCOUNT = 130,
API_APPLICATION_APP_MESSAGELOOPSTEP = 140,
API_APPLICATION_APP_ADDMESSAGEPROCESSOR = 150,
API_APPLICATION_APP_REMOVEMESSAGEPROCESSOR = 160,
API_APPLICATION_APP_ADDMODELESSDIALOG = 170,
API_APPLICATION_APP_REMOVEMODELESSDIALOG = 180,
API_APPLICATION_PATH_GETWORKINGPATH = 190,
API_APPLICATION_PATH_SETWORKINGPATH = 200,
API_APPLICATION_GETMACHINEID = 210,
API_APPLICATION_GETUSERID = 220,
API_APPLICATION_GETSESSIONID = 230,
API_APPLICATION_APP_ADDACCELERATORS = 240,
API_APPLICATION_APP_REMOVEACCELERATORS = 250,
API_APPLICATION_APP_TRANSLATEACCELERATORS = 260,
API_APPLICATION_APP_GETACCELERATORS = 270,
API_APPLICATION_APP_REGISTERGLOBALWINDOW = 280,
API_APPLICATION_APP_UNREGISTERGLOBALWINDOW = 290,
API_APPLICATION_ALLOCATETHREADSTORAGE = 300,
API_APPLICATION_GETTHREADSTORAGE = 310,
API_APPLICATION_SETTHREADSTORAGE = 320,
API_APPLICATION_PATH_GETSKINSETTINGSPATH = 330,
API_APPLICATION_DIRECTMOUSEWHEEL_REGISTERSKIPCLASS = 340,
API_APPLICATION_DIRECTMOUSEWHEEL_UNREGISTERSKIPCLASS = 350,
API_APPLICATION_DIRECTMOUSEWHEEL_ENABLECONVERTTOMOUSEWHEEL = 360,
API_APPLICATION_DIRECTMOUSEWHEEL_PROCESSDIALOGMESSAGE = 365,
API_APPLICATION_ACTIVEDIALOG_REGISTER = 370,
API_APPLICATION_ACTIVEDIALOG_UNREGISTER = 380,
API_APPLICATION_ACTIVEDIALOG_GET = 390,
API_APPLICATION_GETATFSTRING = 400,
API_APPLICATION_GETSCALEX = 500,
API_APPLICATION_GETSCALEY = 510,
};
};
// ----------------------------------------------------------------------------
inline const wchar_t *api_application::main_getAppName()
{
const wchar_t *__retval = _call(API_APPLICATION_MAIN_GETAPPNAME, (const wchar_t *)0);
return __retval;
}
inline const wchar_t *api_application::main_getVersionString()
{
const wchar_t *__retval = _call(API_APPLICATION_MAIN_GETVERSIONSTRING, (const wchar_t *)0);
return __retval;
}
inline const wchar_t *api_application::main_getVersionNumString()
{
return _call(API_APPLICATION_MAIN_GETVERSIONSTRING2, (const wchar_t *)0);
}
inline unsigned int api_application::main_getBuildNumber()
{
return _call(API_APPLICATION_MAIN_GETBUILDNUMBER, 0);
}
inline GUID api_application::main_getGUID()
{
GUID __retval = _call(API_APPLICATION_MAIN_GETGUID, INVALID_GUID);
return __retval;
}
#ifdef _WIN32
inline HANDLE api_application::main_getMainThreadHandle()
{
HANDLE __retval = _call(API_APPLICATION_MAIN_GETMAINTHREADHANDLE, (HANDLE)NULL);
return __retval;
}
inline HINSTANCE api_application::main_gethInstance()
{
HINSTANCE __retval = _call(API_APPLICATION_MAIN_GETHINSTANCE, (HINSTANCE)NULL);
return __retval;
}
#endif
inline const wchar_t *api_application::main_getCommandLine()
{
const wchar_t *__retval = _call(API_APPLICATION_MAIN_GETCOMMANDLINE, (const wchar_t *)0);
return __retval;
}
inline void api_application::main_shutdown(int deferred)
{
_voidcall(API_APPLICATION_MAIN_SHUTDOWN, deferred);
}
inline void api_application::main_cancelShutdown()
{
_voidcall(API_APPLICATION_MAIN_CANCELSHUTDOWN);
}
inline int api_application::main_isShuttingDown()
{
int __retval = _call(API_APPLICATION_MAIN_ISSHUTTINGDOWN, (int)0);
return __retval;
}
inline const wchar_t *api_application::path_getAppPath()
{
const wchar_t *__retval = _call(API_APPLICATION_PATH_GETAPPPATH, (const wchar_t *)0);
return __retval;
}
inline const wchar_t *api_application::path_getUserSettingsPath()
{
return _call(API_APPLICATION_PATH_GETUSERSETTINGSPATH, (const wchar_t *)0);
}
inline const wchar_t *api_application::path_getSkinSettingsPath()
{
return _call(API_APPLICATION_PATH_GETSKINSETTINGSPATH, (const wchar_t *)0);
}
inline int api_application::app_getInitCount()
{
int __retval = _call(API_APPLICATION_APP_GETINITCOUNT, 0);
return __retval;
}
inline intptr_t api_application::app_messageLoopStep()
{
return _call(API_APPLICATION_APP_MESSAGELOOPSTEP, (intptr_t)1);
}
#ifdef _WIN32
inline void api_application::app_addMessageProcessor(ifc_messageprocessor *processor)
{
_voidcall(API_APPLICATION_APP_ADDMESSAGEPROCESSOR, processor);
}
inline void api_application::app_removeMessageProcessor(ifc_messageprocessor *processor)
{
_voidcall(API_APPLICATION_APP_REMOVEMESSAGEPROCESSOR, processor);
}
inline void api_application::app_addAccelerators(HWND hwnd, HACCEL *phAccel, INT cAccel, UINT translateMode)
{
_voidcall(API_APPLICATION_APP_ADDACCELERATORS, hwnd, phAccel, cAccel, translateMode);
}
inline void api_application::app_removeAccelerators(HWND hwnd)
{
_voidcall(API_APPLICATION_APP_REMOVEACCELERATORS, hwnd);
}
inline bool api_application::app_translateAccelerators(MSG *msg)
{
return _call(API_APPLICATION_APP_TRANSLATEACCELERATORS, (bool)false, msg);
}
inline int api_application::app_getAccelerators(HWND hwnd, HACCEL *phAccel, INT cchAccelMax, BOOL bGlobal)
{
return _call(API_APPLICATION_APP_GETACCELERATORS, (int)0, hwnd, phAccel, cchAccelMax, bGlobal);
}
inline void api_application::app_registerGlobalWindow(HWND hwnd)
{
_voidcall(API_APPLICATION_APP_REGISTERGLOBALWINDOW, hwnd);
}
inline void api_application::app_unregisterGlobalWindow(HWND hwnd)
{
_voidcall(API_APPLICATION_APP_UNREGISTERGLOBALWINDOW, hwnd);
}
inline bool api_application::DirectMouseWheel_RegisterSkipClass(ATOM klass)
{
return _call(API_APPLICATION_DIRECTMOUSEWHEEL_REGISTERSKIPCLASS, (bool)false, klass);
}
inline bool api_application::DirectMouseWheel_UnregisterSkipClass(ATOM klass)
{
return _call(API_APPLICATION_DIRECTMOUSEWHEEL_UNREGISTERSKIPCLASS, (bool)false, klass);
}
inline bool api_application::DirectMouseWheel_EnableConvertToMouseWheel(HWND hwnd, BOOL enable)
{
return _call(API_APPLICATION_DIRECTMOUSEWHEEL_ENABLECONVERTTOMOUSEWHEEL, (bool)false, hwnd, enable);
}
inline BOOL api_application::DirectMouseWheel_ProcessDialogMessage(HWND hwnd, unsigned int uMsg, WPARAM wParam, LPARAM lParam, const int controls[], int controlslen)
{
return _call(API_APPLICATION_DIRECTMOUSEWHEEL_PROCESSDIALOGMESSAGE, (BOOL)FALSE, hwnd, uMsg, wParam, lParam, controls, controlslen);
}
inline void api_application::ActiveDialog_Register(HWND hwnd)
{
_voidcall(API_APPLICATION_ACTIVEDIALOG_REGISTER, hwnd);
}
inline void api_application::ActiveDialog_Unregister(HWND hwnd)
{
_voidcall(API_APPLICATION_ACTIVEDIALOG_UNREGISTER, hwnd);
}
inline HWND api_application::ActiveDialog_Get()
{
return _call(API_APPLICATION_ACTIVEDIALOG_GET, (HWND)NULL);
}
inline const wchar_t *api_application::getATFString()
{
return _call(API_APPLICATION_GETATFSTRING, (wchar_t *)0);
}
inline int api_application::getScaleX(int x)
{
return _call(API_APPLICATION_GETSCALEX, (int)0, x);
}
inline int api_application::getScaleY(int y)
{
return _call(API_APPLICATION_GETSCALEY, (int)0, y);
}
#endif
inline const wchar_t *api_application::path_getWorkingPath()
{
return _call(API_APPLICATION_PATH_GETWORKINGPATH, (wchar_t *)0);
}
inline void api_application::path_setWorkingPath(const wchar_t *newPath)
{
_voidcall(API_APPLICATION_PATH_SETWORKINGPATH, newPath);
}
inline int api_application::GetMachineID(GUID *id)
{
return _call(API_APPLICATION_GETMACHINEID, (int)API_APPLICATION_FAILURE, id);
}
inline int api_application::GetUserID(GUID *id)
{
return _call(API_APPLICATION_GETUSERID, (int)API_APPLICATION_FAILURE, id);
}
inline int api_application::GetSessionID(GUID *id)
{
return _call(API_APPLICATION_GETSESSIONID, (int)API_APPLICATION_FAILURE, id);
}
inline size_t api_application::AllocateThreadStorage()
{
return _call(API_APPLICATION_ALLOCATETHREADSTORAGE, (size_t)-1);
}
inline void *api_application::GetThreadStorage(size_t index)
{
return _call(API_APPLICATION_GETTHREADSTORAGE, (void *)0, index);
}
inline void api_application::SetThreadStorage(size_t index, void *value)
{
_voidcall(API_APPLICATION_SETTHREADSTORAGE, index, value);
}
// ----------------------------------------------------------------------------
// {23B96771-09D7-46d3-9AE2-20DCEA6C86EA}
static const GUID applicationApiServiceGuid =
{
0x23b96771, 0x9d7, 0x46d3, { 0x9a, 0xe2, 0x20, 0xdc, 0xea, 0x6c, 0x86, 0xea }
};
extern api_application *applicationApi;
#endif // __API_APPLICATION_H

View File

@ -0,0 +1,204 @@
#include <precomp.h>
//<?#include "<class data="implementationheader"/>"
#include "api_applicationi.h"
//?>
#include <wasabicfg.h>
#include <api/application/pathmgr.h>
#include <api/application/version.h>
#include <api/apiinit.h>
#ifdef WA3COMPATIBILITY
#include <runtime/main.h> // CUT!
#include <wndmgr/layout.h> // CUT!
#include <skin/skinparse.h>
#endif
StringW g_resourcepath;
// {3CBD4483-DC44-11d3-B608-000086340885}
static const GUID _baseGUID =
{ 0x3cbd4483, 0xdc44, 0x11d3, { 0xb6, 0x8, 0x0, 0x0, 0x86, 0x34, 0x8, 0x85 } };
api_application *applicationApi = NULL;
api_applicationI::api_applicationI(HINSTANCE instance, const wchar_t *_userPath)
: appInstance(instance), mainthread(0), shuttingdown(0)
{
userPath = _userPath;
#ifndef _WASABIRUNTIME
#ifdef WASABI_DIRS_FROMEXEPATH
HINSTANCE hInst = GetModuleHandle(0);
#else
HINSTANCE hInst = appInstance;
#endif
StringW path;
{
wchar_t g[WA_MAX_PATH];
GetModuleFileNameW(hInst, g, WA_MAX_PATH - 1);
wchar_t *p = wcsrchr(g, '\\');
if (p) *p = 0;
path = g;
}
#ifdef WIN32
g_resourcepath = path;
#elif defined(LINUX)
g_resourcepath = "/usr/local/share/";
g_resourcepath += WasabiVersion::getAppName();
#endif
#ifdef LINUX
//char *file = getenv( "WASABI_LOG_FILE" );
//if (!ACCESS(file, 0)) UNLINK(file);
#endif
apppath = path;
g_resourcepath.AddBackslash();
#if defined(WASABI_COMPILE_SKIN) || defined(WASABI_COMPILE_IMGLDR)
g_resourcepath.AppendPath(WASABI_RESOURCES_SUBDIRECTORY);
#endif
#endif
#ifdef WIN32
HANDLE h = NULL;
DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &h, 0, FALSE, DUPLICATE_SAME_ACCESS);
mainthread = h; // 32-bit writes assumed atomic
#endif
#ifdef LINUX
DebugString("portme: api main thread handle dup\n");
#endif
}
api_applicationI::~api_applicationI()
{
g_resourcepath.purge();
}
const wchar_t *api_applicationI::main_getAppName()
{
return WasabiVersion::getAppName();
}
const wchar_t *api_applicationI::main_getVersionString()
{
return WasabiVersion::getVersionString();
}
unsigned int api_applicationI::main_getBuildNumber()
{
return WasabiVersion::getBuildNumber();
}
GUID api_applicationI::main_getGUID()
{
return guid;
}
HANDLE api_applicationI::main_getMainThreadHandle()
{
if (mainthread == 0) return (HANDLE)0;
HANDLE h = (HANDLE)0;
#ifdef WIN32
DuplicateHandle(GetCurrentProcess(), mainthread, GetCurrentProcess(), &h, 0, FALSE, DUPLICATE_SAME_ACCESS);
#endif
#ifdef LINUX
DebugString("portme: dup handle\n");
#endif
return h;
}
HINSTANCE api_applicationI::main_gethInstance()
{
return appInstance;
}
const wchar_t *api_applicationI::main_getCommandLine()
{
return cmdLine;
}
void api_applicationI::main_shutdown(int deferred)
{
int x = 1;
#ifdef WASABI_CHECK_CAN_EXIT
WASABI_CHECK_CAN_EXIT(x)
#endif
if (!x) return ;
shuttingdown = 1;
#ifdef _WASABIRUNTIME
Main::doAction(ACTION_CLOSE, deferred);
#endif
#ifdef WASABI_CUSTOM_QUIT
WASABI_CUSTOM_QUITFN
#endif
}
void api_applicationI::main_cancelShutdown()
{
#ifdef _WASABIRUNTIME
Main::cancelShutdown();
#endif
shuttingdown = 0;
}
int api_applicationI::main_isShuttingDown()
{
return shuttingdown;
}
const wchar_t *api_applicationI::path_getAppPath()
{
#ifdef _WASABIRUNTIME
return Main::getMainAppPath();
#endif
return apppath;
}
const wchar_t *api_applicationI::path_getUserSettingsPath()
{
return userPath;
//return PathMgr::getUserSettingsPath();
}
void api_applicationI::setHInstance(HINSTANCE instance)
{
appInstance = instance;
};
void api_applicationI::setCommandLine(const wchar_t *cmdline)
{
cmdLine = cmdline;
}
void api_applicationI::setGUID(GUID g)
{
guid = g;
}
int api_applicationI::app_getInitCount()
{
return ApiInit::getInitCount();
}
int api_applicationI::app_messageLoopStep()
{
#if defined(WASABI_COMPILE_TIMERS) || defined(WASABI_COMPILE_WND)
MSG msg;
if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
{
if (!GetMessage( &msg, NULL, 0, 0 )) return 0;
#ifdef WASABI_COMPILE_WND
TranslateMessage( &msg );
#endif
DispatchMessage( &msg );
}
#endif
return 1;
}

View File

@ -0,0 +1,49 @@
#ifndef __API_APPLICATIONI_IMPL_H
#define __API_APPLICATIONI_IMPL_H
/*<?<autoheader/>*/
#include "api_application.h"
#include "api_applicationx.h"
/*?>*/
/*[interface.header.h]
#include "common/nsGUID.h"
class String;
*/
class api_applicationI : public api_applicationX {
public:
NODISPATCH api_applicationI(HINSTANCE instance, const wchar_t *_userPath);
NODISPATCH virtual ~api_applicationI();
DISPATCH(10) const wchar_t *main_getAppName();
DISPATCH(20) const wchar_t *main_getVersionString();
DISPATCH(30) unsigned int main_getBuildNumber();
DISPATCH(40) GUID main_getGUID();
DISPATCH(50) HANDLE main_getMainThreadHandle();
DISPATCH(60) HINSTANCE main_gethInstance();
DISPATCH(70) const wchar_t *main_getCommandLine();
DISPATCH(80) void main_shutdown(int deferred = TRUE);
DISPATCH(90) void main_cancelShutdown();
DISPATCH(100) int main_isShuttingDown();
DISPATCH(110) const wchar_t *path_getAppPath();
DISPATCH(120) const wchar_t *path_getUserSettingsPath();
DISPATCH(130) int app_getInitCount();
DISPATCH(140) int app_messageLoopStep();
NODISPATCH void setHInstance(HINSTANCE instance);
NODISPATCH void setCommandLine(const wchar_t *cmdline);
NODISPATCH void setGUID(GUID g);
protected:
HINSTANCE appInstance;
StringW cmdLine;
StringW userPath;
HANDLE mainthread;
GUID guid;
int shuttingdown;
StringW apppath;
};
#endif // __API_APPLICATIONI_IMPL_H

View File

@ -0,0 +1,33 @@
// ----------------------------------------------------------------------------
// Generated by InterfaceFactory [Wed May 07 00:55:56 2003]
//
// File : api_applicationx.cpp
// Class : api_application
// class layer : Dispatchable Receiver
// ----------------------------------------------------------------------------
#include <precomp.h>
#include "api_applicationx.h"
#ifdef CBCLASS
#undef CBCLASS
#endif
#define CBCLASS api_applicationX
START_DISPATCH;
CB(API_APPLICATION_MAIN_GETAPPNAME, main_getAppName);
CB(API_APPLICATION_MAIN_GETVERSIONSTRING, main_getVersionString);
CB(API_APPLICATION_MAIN_GETBUILDNUMBER, main_getBuildNumber);
CB(API_APPLICATION_MAIN_GETGUID, main_getGUID);
CB(API_APPLICATION_MAIN_GETMAINTHREADHANDLE, main_getMainThreadHandle);
CB(API_APPLICATION_MAIN_GETHINSTANCE, main_gethInstance);
CB(API_APPLICATION_MAIN_GETCOMMANDLINE, main_getCommandLine);
VCB(API_APPLICATION_MAIN_SHUTDOWN, main_shutdown);
VCB(API_APPLICATION_MAIN_CANCELSHUTDOWN, main_cancelShutdown);
CB(API_APPLICATION_MAIN_ISSHUTTINGDOWN, main_isShuttingDown);
CB(API_APPLICATION_PATH_GETAPPPATH, path_getAppPath);
CB(API_APPLICATION_PATH_GETUSERSETTINGSPATH, path_getUserSettingsPath);
CB(API_APPLICATION_APP_GETINITCOUNT, app_getInitCount);
CB(API_APPLICATION_APP_MESSAGELOOPSTEP, app_messageLoopStep);
END_DISPATCH;
#undef CBCLASS

View File

@ -0,0 +1,42 @@
// ----------------------------------------------------------------------------
// Generated by InterfaceFactory [Wed May 07 00:55:56 2003]
//
// File : api_applicationx.h
// Class : api_application
// class layer : Dispatchable Receiver
// ----------------------------------------------------------------------------
#ifndef __API_APPLICATIONX_H
#define __API_APPLICATIONX_H
#include "api_application.h"
// ----------------------------------------------------------------------------
class api_applicationX : public api_application {
protected:
api_applicationX() {}
public:
virtual const wchar_t *main_getAppName()=0;
virtual const wchar_t *main_getVersionString()=0;
virtual unsigned int main_getBuildNumber()=0;
virtual GUID main_getGUID()=0;
virtual HANDLE main_getMainThreadHandle()=0;
virtual HINSTANCE main_gethInstance()=0;
virtual const wchar_t *main_getCommandLine()=0;
virtual void main_shutdown(int deferred = TRUE)=0;
virtual void main_cancelShutdown()=0;
virtual int main_isShuttingDown()=0;
virtual const wchar_t *path_getAppPath()=0;
virtual const wchar_t *path_getUserSettingsPath()=0;
virtual int app_getInitCount()=0;
virtual int app_messageLoopStep()=0;
protected:
RECVS_DISPATCH;
};
#endif // __API_APPLICATIONX_H

View File

@ -0,0 +1 @@
#include "api_messageprocessor.h"

View File

@ -0,0 +1,26 @@
#ifndef __WASABI_IFC_MESSAGEPROCESSOR_H
#define __WASABI_IFC_MESSAGEPROCESSOR_H
#include <bfc/dispatch.h>
#include <windows.h>
class ifc_messageprocessor : public Dispatchable
{
protected:
ifc_messageprocessor() {}
~ifc_messageprocessor() {}
public:
bool ProcessMessage(MSG *msg); // return true to 'eat' the message
public:
DISPATCH_CODES
{
IFC_MESSAGEPROCESSOR_PROCESS_MESSAGE = 10,
};
};
inline bool ifc_messageprocessor::ProcessMessage(MSG *msg)
{
return _call(IFC_MESSAGEPROCESSOR_PROCESS_MESSAGE, false, msg);
}
typedef ifc_messageprocessor api_messageprocessor; // TODO: CUT!
#endif

View File

@ -0,0 +1,7 @@
#include "ifc_messageprocessori.h"
#define CBCLASS ifc_messageprocessorI
START_DISPATCH;
CB(IFC_MESSAGEPROCESSOR_PROCESS_MESSAGE, ProcessMessage)
END_DISPATCH;
#undef CBCLASS

View File

@ -0,0 +1,13 @@
#ifndef NULLSOFT_WASABI_MESSAGEPROCESSORI_H
#define NULLSOFT_WASABI_MESSAGEPROCESSORI_H
#include <api/application/ifc_messageprocessor.h>
class ifc_messageprocessorI: public ifc_messageprocessor
{
public:
virtual bool ProcessMessage(MSG *msg)=0;
protected:
RECVS_DISPATCH;
};
#endif

View File

@ -0,0 +1,97 @@
#include <precomp.h>
#ifdef WASABI_API_COMPONENT
#include <api/wac/main.h> //CUT!!!
#endif
#include "ipcs.h"
#ifdef LINUX
#include <api/linux/linuxapi.h>
#endif
using namespace IpcsCommand;
#ifdef WIN32
IpcsPtr::IpcsPtr(HWND h) {
hwnd = h;
}
#else
IpcsPtr::IpcsPtr(int q) {
qid = q;
}
#endif
void IpcsPtr::moveToForeground() {
#ifdef WIN32
if (IsIconic(hwnd)) ShowWindow(hwnd, SW_RESTORE);
// ShowWindow(hwnd,SW_SHOW); //FG> SW_RESTORE should take care of it and is trapped for taskbar button hiding. Explicitly showing the window will make an iconless button reapear if studio is set to not have a taskbar button
SetForegroundWindow(hwnd);
#else
DebugString( "portme -- IpcsPtr::moveToForeground\n" );
#endif
}
void IpcsPtr::sendWasabiCommand(int command, void *param, int paramlen) {
#ifdef WIN32
COPYDATASTRUCT cd;
cd.dwData=command;
cd.cbData=paramlen;
cd.lpData=param;
SendMessage(hwnd, WM_COPYDATA, NULL, (long)&cd);
#else
wa_msgbuf msg;
msg.mtype = command;
ASSERT( paramlen < IPC_MSGMAX - 4 );
msg.paramlen = paramlen;
MEMCPY( msg.param, param, paramlen );
if ( msgsnd( qid , &msg, IPC_MSGMAX, 0 ) == 1 ) {
perror( "msgsnd" );
}
#endif
}
void IpcsPtr::sendWasabiCommand(int command, const char *param) {
sendWasabiCommand(command, (void *)param, STRLEN(param)+1);
}
IpcsPtr *Ipcs::getOtherWasabiInstance() {
extern String ipcWindowClassName;
#ifdef WIN32
HWND hwnd_instance=FindWindow(ipcWindowClassName,NULL);
if(!hwnd_instance) return NULL;
return(new IpcsPtr(hwnd_instance));
#else
int key = ftok( ".", 'w' );
int qid = msgget( key, 0 );
if ( qid == -1 && errno == ENOENT ) {
qid = msgget( key, IPC_CREAT | IPC_EXCL | 0660 );
LinuxAPI::setIPCId( qid );
return NULL;
} else if ( qid == -1 ) {
return NULL;
} else {
return new IpcsPtr( qid );
}
#endif
}
#pragma warning(push)
#pragma warning(disable: 4060)
int Ipcs::onIpcsMessage(int command, void *param, int paramlen) {
switch(command) {
#ifdef WASABI_API_COMPONENT
case IPC_COMMANDLINE:
Main::processCommandLine((const char *)param);
return 0;
#endif
}
return 0;
}
#pragma warning(pop)

View File

@ -0,0 +1,60 @@
#ifndef _IPCS_H
#define _IPCS_H
// same value as winamp 2.x
#define WM_WA_IPC WM_USER
#ifdef LINUX
// Stolen from a webpage, I think Linux's is higher, but to be safe...
#define IPC_MSGMAX 4056
struct wa_msgbuf {
long mtype;
int paramlen;
char param[IPC_MSGMAX - 4];
};
#endif
namespace IpcsCommand {
enum {
#ifdef WASABI_API_MEDIACORE
// wa2.x IPC messages
IPC_PLAYFILE=100,
#endif
#ifdef WASABI_API_COMPONENT
// wa3 IPC messages
IPC_COMMANDLINE=1000,
#endif
};
};
class IpcsPtr {
public:
#ifdef WIN32
IpcsPtr(HWND hwnd);
#else
IpcsPtr(int qid);
#endif
void sendWasabiCommand(int command, void *param=0, int paramlen=0);
void sendWasabiCommand(int command, const char *param);
void moveToForeground();
private:
#ifdef WIN32
HWND hwnd;
#else
int qid;
#endif
};
class Ipcs {
public:
static IpcsPtr *getOtherWasabiInstance();
static int onIpcsMessage(int command, void *param, int paramlen);
};
#endif

View File

@ -0,0 +1,14 @@
#include <precomp.h>
#include "pathmgr.h"
#include <api/api.h>
#include <bfc/util/inifile.h>
#if !defined(WIN32) && !defined(LINUX)
#error port me
#endif
#ifdef WIN32
#include <shlobj.h>
#endif

View File

@ -0,0 +1,15 @@
#ifndef _PATHMGR_H
#define _PATHMGR_H
#include <bfc/std.h>
class PathMgr
{
public:
//static const char *getUserSettingsPath();
#ifdef WASABI_COMPILE_COMPONENTS
static const wchar_t *getComponentDataPath(GUID g);
#endif
};
#endif

View File

@ -0,0 +1,47 @@
#include <precomp.h>
#include "version.h"
#include <bfc/parse/pathparse.h>
static int buildno = -1;
static const wchar_t *WASABI_VERSION = L"";
#define STRFILEVER "1, 0, 0, 502\0"
static StringW version_string;
void WasabiVersion::setAppName(const wchar_t *name)
{
appname = name;
}
const wchar_t *WasabiVersion::getAppName()
{
return appname;
}
const wchar_t *WasabiVersion::getVersionString()
{
if (appname.isempty())
appname=L"";
if (version_string.isempty())
{
if (!appname.isempty())
version_string = appname.getValue();
if (wcslen(WASABI_VERSION))
{
version_string.cat(L" ");
version_string.cat(WASABI_VERSION);
}
}
return version_string;
}
unsigned int WasabiVersion::getBuildNumber()
{
if (buildno == -1)
{
PathParser pp(STRFILEVER, ",");
buildno = ATOI(pp.enumString(3));
}
return buildno;
}

View File

@ -0,0 +1,12 @@
#ifndef _VERSION_H
#define _VERSION_H
/*
class WasabiVersion {
public:
static void setAppName(const wchar_t *name);
static const wchar_t *getAppName();
static const wchar_t *getVersionString();
static unsigned int getBuildNumber();
};*/
#endif

View File

@ -0,0 +1,12 @@
#include <precomp.h>
#include "wkc.h"
#define CBCLASS WasabiKernelControllerI
START_DISPATCH;
CB(TESTCOMPONENT, testComponent);
CB(TESTSCRIPT, testScript);
CB(TESTSKIN, testSkin);
CB(TESTSKINFILE, testSkinFile);
END_DISPATCH;
#undef CBCLASS

View File

@ -0,0 +1,61 @@
#ifndef _WKC_H
#define _WKC_H
#include <bfc/dispatch.h>
/**
A callback class for the loader so it can determine which resources wasabi.dll should load.
*/
class NOVTABLE WasabiKernelController : public Dispatchable {
public:
/**
Check if a component should load.
*/
int testComponent(const char *filename);
int testScript(const char *filename, void *data, int datalen);
int testSkin(const char *skinname);
int testSkinFile(const char *filename);
protected:
enum {
TESTCOMPONENT=1000,
TESTSCRIPT=2000,
TESTSKIN=3000,
TESTSKINFILE=4000,
};
};
inline
int WasabiKernelController::testComponent(const char *filename) {
return _call(TESTCOMPONENT, TRUE, filename);
}
inline
int WasabiKernelController::testScript(const char *filename, void *data, int datalen) {
return _call(TESTSCRIPT, TRUE, filename, data, datalen);
}
inline
int WasabiKernelController::testSkin(const char *skinname) {
return _call(TESTSKIN, TRUE, skinname);
}
inline
int WasabiKernelController::testSkinFile(const char *filename) {
return _call(TESTSKINFILE, TRUE, filename);
}
// implementors derive from this one
class WasabiKernelControllerI : public WasabiKernelController {
public:
// default to OK
virtual int testComponent(const char *filename) { return 1; }
virtual int testScript(const char *filename, void *data, int datalen) { return 1; }
virtual int testSkin(const char *skinname) { return 1; }
virtual int testSkinFile(const char *filename) { return 1; }
protected:
RECVS_DISPATCH;
};
#endif

View File

@ -0,0 +1,12 @@
// ----------------------------------------------------------------------------
// Generated by InterfaceFactory [Thu May 15 21:06:24 2003]
//
// File : api_config.cpp
// Class : api_config
// class layer : Dispatchable Interface
// ----------------------------------------------------------------------------
#include <precomp.h>
#include "api_config.h"

View File

@ -0,0 +1,149 @@
// ----------------------------------------------------------------------------
// Generated by InterfaceFactory [Thu May 15 21:06:24 2003]
//
// File : api_config.h
// Class : api_config
// class layer : Dispatchable Interface
// ----------------------------------------------------------------------------
#ifndef __API_CONFIG_H
#define __API_CONFIG_H
#include <bfc/dispatch.h>
#include <bfc/platform/types.h>
class CfgItem;
class ConfigFile;
// ----------------------------------------------------------------------------
class NOVTABLE api_config: public Dispatchable
{
protected:
api_config() {}
~api_config() {}
public:
void config_registerCfgItem(CfgItem *cfgitem);
void config_deregisterCfgItem(CfgItem *cfgitem);
int config_getNumCfgItems();
CfgItem *config_enumCfgItem(int n);
CfgItem *config_getCfgItemByGuid(GUID g);
void setIntPrivate(const wchar_t *name, int val);
int getIntPrivate(const wchar_t *name, int def_val);
void setIntArrayPrivate(const wchar_t *name, const int *val, int nval);
int getIntArrayPrivate(const wchar_t *name, int *val, int nval);
void setStringPrivate(const wchar_t *name, const wchar_t *str);
int getStringPrivate(const wchar_t *name, wchar_t *buf, int buf_len, const wchar_t *default_str);
int getStringPrivateLen(const wchar_t *name);
void setIntPublic(const wchar_t *name, int val);
int getIntPublic(const wchar_t *name, int def_val);
void setStringPublic(const wchar_t *name, const wchar_t *str);
int getStringPublic(const wchar_t *name, wchar_t *buf, int buf_len, const wchar_t *default_str);
protected:
enum {
API_CONFIG_CONFIG_REGISTERCFGITEM = 10,
API_CONFIG_CONFIG_DEREGISTERCFGITEM = 20,
API_CONFIG_CONFIG_GETNUMCFGITEMS = 30,
API_CONFIG_CONFIG_ENUMCFGITEM = 40,
API_CONFIG_CONFIG_GETCFGITEMBYGUID = 50,
API_CONFIG_SETINTPRIVATE = 60,
API_CONFIG_GETINTPRIVATE = 70,
API_CONFIG_SETINTARRAYPRIVATE = 80,
API_CONFIG_GETINTARRAYPRIVATE = 90,
API_CONFIG_SETSTRINGPRIVATE = 100,
API_CONFIG_GETSTRINGPRIVATE = 110,
API_CONFIG_GETSTRINGPRIVATELEN = 120,
API_CONFIG_SETINTPUBLIC = 130,
API_CONFIG_GETINTPUBLIC = 140,
API_CONFIG_SETSTRINGPUBLIC = 150,
API_CONFIG_GETSTRINGPUBLIC = 160,
};
};
// ----------------------------------------------------------------------------
inline void api_config::config_registerCfgItem(CfgItem *cfgitem) {
_voidcall(API_CONFIG_CONFIG_REGISTERCFGITEM, cfgitem);
}
inline void api_config::config_deregisterCfgItem(CfgItem *cfgitem) {
_voidcall(API_CONFIG_CONFIG_DEREGISTERCFGITEM, cfgitem);
}
inline int api_config::config_getNumCfgItems() {
int __retval = _call(API_CONFIG_CONFIG_GETNUMCFGITEMS, (int)0);
return __retval;
}
inline CfgItem *api_config::config_enumCfgItem(int n) {
CfgItem *__retval = _call(API_CONFIG_CONFIG_ENUMCFGITEM, (CfgItem *)NULL, n);
return __retval;
}
inline CfgItem *api_config::config_getCfgItemByGuid(GUID g) {
CfgItem *__retval = _call(API_CONFIG_CONFIG_GETCFGITEMBYGUID, (CfgItem *)NULL, g);
return __retval;
}
inline void api_config::setIntPrivate(const wchar_t *name, int val) {
_voidcall(API_CONFIG_SETINTPRIVATE, name, val);
}
inline int api_config::getIntPrivate(const wchar_t *name, int def_val) {
int __retval = _call(API_CONFIG_GETINTPRIVATE, (int)0, name, def_val);
return __retval;
}
inline void api_config::setIntArrayPrivate(const wchar_t *name, const int *val, int nval) {
_voidcall(API_CONFIG_SETINTARRAYPRIVATE, name, val, nval);
}
inline int api_config::getIntArrayPrivate(const wchar_t *name, int *val, int nval) {
int __retval = _call(API_CONFIG_GETINTARRAYPRIVATE, (int)0, name, val, nval);
return __retval;
}
inline void api_config::setStringPrivate(const wchar_t *name, const wchar_t *str) {
_voidcall(API_CONFIG_SETSTRINGPRIVATE, name, str);
}
inline int api_config::getStringPrivate(const wchar_t *name, wchar_t *buf, int buf_len, const wchar_t *default_str) {
int __retval = _call(API_CONFIG_GETSTRINGPRIVATE, (int)0, name, buf, buf_len, default_str);
return __retval;
}
inline int api_config::getStringPrivateLen(const wchar_t *name) {
int __retval = _call(API_CONFIG_GETSTRINGPRIVATELEN, (int)0, name);
return __retval;
}
inline void api_config::setIntPublic(const wchar_t *name, int val) {
_voidcall(API_CONFIG_SETINTPUBLIC, name, val);
}
inline int api_config::getIntPublic(const wchar_t *name, int def_val) {
int __retval = _call(API_CONFIG_GETINTPUBLIC, (int)0, name, def_val);
return __retval;
}
inline void api_config::setStringPublic(const wchar_t *name, const wchar_t *str) {
_voidcall(API_CONFIG_SETSTRINGPUBLIC, name, str);
}
inline int api_config::getStringPublic(const wchar_t *name, wchar_t *buf, int buf_len, const wchar_t *default_str) {
int __retval = _call(API_CONFIG_GETSTRINGPUBLIC, (int)0, name, buf, buf_len, default_str);
return __retval;
}
// ----------------------------------------------------------------------------
// {470B890C-4747-4113-ABA5-A8F8F4F8AB7E}
static const GUID configApiServiceGuid =
{ 0x470b890c, 0x4747, 0x4113, { 0xab, 0xa5, 0xa8, 0xf8, 0xf4, 0xf8, 0xab, 0x7e } };
extern api_config *configApi;
#endif // __API_CONFIG_H

View File

@ -0,0 +1,124 @@
#include <precomp.h>
//<?#include "<class data="implementationheader"/>"
#include "api_configi.h"
//?>
#include <bfc/parse/pathparse.h>
#include <api/config/cfglist.h>
static CfgList cfglist;
api_config *configApi = NULL;
api_configI::api_configI()
: public_config(StringPrintfW(INVALID_GUID), L"public data")
{
public_config.initialize();
}
api_configI::~api_configI()
{
}
void api_configI::config_registerCfgItem(CfgItem *cfgitem)
{
cfglist.addItem(cfgitem);
}
void api_configI::config_deregisterCfgItem(CfgItem *cfgitem)
{
cfglist.delItem(cfgitem);
}
int api_configI::config_getNumCfgItems()
{
return cfglist.getNumItems();
}
CfgItem *api_configI::config_enumCfgItem(int n)
{
return cfglist.enumItem(n);
}
CfgItem *api_configI::config_getCfgItemByGuid(GUID g)
{
return cfglist.getByGuid(g);
}
// The private config functions are currently pointing at the public config item, this is because
// only the monolithic api gets instantiated once per component and thus can know its GUID, this
// version of the config api should eventually be instantiated once per component as well when
// we start making them use the modular apis
void api_configI::setIntPrivate(const wchar_t *name, int val)
{
public_config.setInt(name, val);
}
int api_configI::getIntPrivate(const wchar_t *name, int def_val)
{
int ret = public_config.getInt(name, def_val);
return ret;
}
void api_configI::setIntArrayPrivate(const wchar_t *name, const int *val, int nval)
{
if (nval > 256) return;
wchar_t buf[12*256]=L"";
for (int i = 0; i < nval; i++)
{
wcscat(buf, StringPrintfW(L"%d", val[i]));
if (i != nval-1)
wcscat(buf, L",");
}
public_config.setString(name, buf);
}
int api_configI::getIntArrayPrivate(const wchar_t *name, int *val, int nval)
{
wchar_t buf[12*256]=L"";
public_config.getString(name, buf, sizeof(buf)/sizeof(*buf), L"");
PathParserW pp(buf, L",");
if (pp.getNumStrings() != nval) return 0;
for (int i = 0; i < nval; i++) {
*val = WTOI(pp.enumString(i));
val ++;
}
return 1;
}
void api_configI::setStringPrivate(const wchar_t *name, const wchar_t *str)
{
public_config.setString(name, str);
}
int api_configI::getStringPrivate(const wchar_t *name, wchar_t *buf, int buf_len, const wchar_t *default_str)
{
int ret = public_config.getString(name, buf, buf_len, default_str);
return ret;
}
int api_configI::getStringPrivateLen(const wchar_t *name)
{
return public_config.getStringLen(name);
}
void api_configI::setIntPublic(const wchar_t *name, int val)
{
public_config.setInt(name, val);
}
int api_configI::getIntPublic(const wchar_t *name, int def_val)
{
return public_config.getInt(name, def_val);
}
void api_configI::setStringPublic(const wchar_t *name, const wchar_t *str)
{
public_config.setString(name, str);
}
int api_configI::getStringPublic(const wchar_t *name, wchar_t *buf, int buf_len, const wchar_t *default_str)
{
return public_config.getString(name, buf, buf_len, default_str);
}

View File

@ -0,0 +1,46 @@
#ifndef __API_CONFIG_IMPL_H
#define __API_CONFIG_IMPL_H
/*<?<autoheader/>*/
#include "api_config.h"
#include "api_configx.h"
#include <api/config/config.h>
class CfgItem;
/*?>*/
class api_configI : public api_configX
{
public:
api_configI();
virtual ~api_configI();
DISPATCH(10) virtual void config_registerCfgItem(CfgItem *cfgitem);
DISPATCH(20) virtual void config_deregisterCfgItem(CfgItem *cfgitem);
DISPATCH(30) virtual int config_getNumCfgItems();
DISPATCH(40) virtual CfgItem *config_enumCfgItem(int n);
DISPATCH(50) virtual CfgItem *config_getCfgItemByGuid(GUID g);
DISPATCH(60) virtual void setIntPrivate(const wchar_t *name, int val);
DISPATCH(70) virtual int getIntPrivate(const wchar_t *name, int def_val);
DISPATCH(80) virtual void setIntArrayPrivate(const wchar_t *name, const int *val, int nval);
DISPATCH(90) virtual int getIntArrayPrivate(const wchar_t *name, int *val, int nval);
DISPATCH(100) virtual void setStringPrivate(const wchar_t *name, const wchar_t *str);
DISPATCH(110) virtual int getStringPrivate(const wchar_t *name, wchar_t *buf, int buf_len, const wchar_t *default_str);
DISPATCH(120) virtual int getStringPrivateLen(const wchar_t *name);
DISPATCH(130) virtual void setIntPublic(const wchar_t *name, int val);
DISPATCH(140) virtual int getIntPublic(const wchar_t *name, int def_val);
DISPATCH(150) virtual void setStringPublic(const wchar_t *name, const wchar_t *str);
DISPATCH(160) virtual int getStringPublic(const wchar_t *name, wchar_t *buf, int buf_len, const wchar_t *default_str);
private:
ConfigFile public_config;
};
/*[interface.footer.h]
// {470B890C-4747-4113-ABA5-A8F8F4F8AB7E}
static const GUID configApiServiceGuid =
{ 0x470b890c, 0x4747, 0x4113, { 0xab, 0xa5, 0xa8, 0xf8, 0xf4, 0xf8, 0xab, 0x7e } };
extern api_config *configApi;
*/
#endif // __API_CONFIG_IMPL_H

View File

@ -0,0 +1,37 @@
// ----------------------------------------------------------------------------
// Generated by InterfaceFactory [Thu May 15 21:06:25 2003]
//
// File : api_configx.cpp
// Class : api_config
// class layer : Dispatchable Receiver
// ----------------------------------------------------------------------------
#include <precomp.h>
#include "api_configx.h"
#include "api_configi.h"
#ifdef CBCLASS
#undef CBCLASS
#endif
#define CBCLASS api_configX
START_DISPATCH;
VCB(API_CONFIG_CONFIG_REGISTERCFGITEM, config_registerCfgItem);
VCB(API_CONFIG_CONFIG_DEREGISTERCFGITEM, config_deregisterCfgItem);
CB(API_CONFIG_CONFIG_GETNUMCFGITEMS, config_getNumCfgItems);
CB(API_CONFIG_CONFIG_ENUMCFGITEM, config_enumCfgItem);
CB(API_CONFIG_CONFIG_GETCFGITEMBYGUID, config_getCfgItemByGuid);
VCB(API_CONFIG_SETINTPRIVATE, setIntPrivate);
CB(API_CONFIG_GETINTPRIVATE, getIntPrivate);
VCB(API_CONFIG_SETINTARRAYPRIVATE, setIntArrayPrivate);
CB(API_CONFIG_GETINTARRAYPRIVATE, getIntArrayPrivate);
VCB(API_CONFIG_SETSTRINGPRIVATE, setStringPrivate);
CB(API_CONFIG_GETSTRINGPRIVATE, getStringPrivate);
CB(API_CONFIG_GETSTRINGPRIVATELEN, getStringPrivateLen);
VCB(API_CONFIG_SETINTPUBLIC, setIntPublic);
CB(API_CONFIG_GETINTPUBLIC, getIntPublic);
VCB(API_CONFIG_SETSTRINGPUBLIC, setStringPublic);
CB(API_CONFIG_GETSTRINGPUBLIC, getStringPublic);
END_DISPATCH;
#undef CBCLASS

View File

@ -0,0 +1,44 @@
// ----------------------------------------------------------------------------
// Generated by InterfaceFactory [Thu May 15 21:06:24 2003]
//
// File : api_configx.h
// Class : api_config
// class layer : Dispatchable Receiver
// ----------------------------------------------------------------------------
#ifndef __API_CONFIGX_H
#define __API_CONFIGX_H
#include "api_config.h"
class CfgItem;
class ConfigFile;
// ----------------------------------------------------------------------------
class api_configX : public api_config {
protected:
api_configX() {}
public:
virtual void config_registerCfgItem(CfgItem *cfgitem)=0;
virtual void config_deregisterCfgItem(CfgItem *cfgitem)=0;
virtual int config_getNumCfgItems()=0;
virtual CfgItem *config_enumCfgItem(int n)=0;
virtual CfgItem *config_getCfgItemByGuid(GUID g)=0;
virtual void setIntPrivate(const wchar_t *name, int val)=0;
virtual int getIntPrivate(const wchar_t *name, int def_val)=0;
virtual void setIntArrayPrivate(const wchar_t *name, const int *val, int nval)=0;
virtual int getIntArrayPrivate(const wchar_t *name, int *val, int nval)=0;
virtual void setStringPrivate(const wchar_t *name, const wchar_t *str)=0;
virtual int getStringPrivate(const wchar_t *name, wchar_t *buf, int buf_len, const wchar_t *default_str)=0;
virtual int getStringPrivateLen(const wchar_t *name)=0;
virtual void setIntPublic(const wchar_t *name, int val)=0;
virtual int getIntPublic(const wchar_t *name, int def_val)=0;
virtual void setStringPublic(const wchar_t *name, const wchar_t *str)=0;
virtual int getStringPublic(const wchar_t *name, wchar_t *buf, int buf_len, const wchar_t *default_str)=0;
protected:
RECVS_DISPATCH;
};
#endif // __API_CONFIGX_H

View File

@ -0,0 +1,50 @@
#include <precomp.h>
#include "cfglist.h"
#include <bfc/ptrlist.h>
void CfgList::addItem(CfgItem *cfgitem)
{
if (cfgitem == NULL ||
cfgitem->getGuid() == INVALID_GUID ||
list.haveItem(cfgitem)) return;
viewer_addViewItem(cfgitem);
list.addItem(cfgitem);
cfgitem->onRegister(); // recurses children
}
void CfgList::delItem(CfgItem *cfgitem)
{
if (cfgitem == NULL || !list.haveItem(cfgitem)) return;
list.removeItem(cfgitem);
viewer_delViewItem(cfgitem);
cfgitem->onDeregister(); // recurses children
}
int CfgList::getNumItems()
{
return list.getNumItems();
}
CfgItem *CfgList::enumItem(int n)
{
return list[n];
}
CfgItem *CfgList::getByGuid(GUID g)
{
if (g == INVALID_GUID) return NULL;
foreach(list)
if (list.getfor()->getGuid() == g) return list.getfor();
endfor
return NULL;
}
int CfgList::viewer_onItemDeleted(CfgItem *item)
{
list.removeItem(item);
return 1;
}

View File

@ -0,0 +1,23 @@
#ifndef _CFGLIST_H
#define _CFGLIST_H
#include <bfc/wasabi_std.h>
#include <bfc/depview.h>
#include <api/config/items/cfgitem.h>
class CfgList : public DependentViewerTPtr<CfgItem> {
public:
void addItem(CfgItem *cfgitem);
void delItem(CfgItem *cfgitem);
int getNumItems();
CfgItem *enumItem(int n);
CfgItem *getByGuid(GUID g);
virtual int viewer_onItemDeleted(CfgItem *item);
private:
PtrList<CfgItem> list;
};
#endif

View File

@ -0,0 +1,371 @@
#include <precomp.h>
#include "cfgscriptobj.h"
#include <api/config/items/cfgitemi.h>
#ifndef _WASABIRUNTIME
BEGIN_SERVICES(ConfigObject_Svc);
DECLARE_SERVICE(ScriptObjectCreator<ConfigScriptObjectSvc>);
END_SERVICES(ConfigObject_Svc, _ConfigObject_Svc);
#ifdef _X86_
extern "C" { int _link_ConfigObjectSvc; }
#else
extern "C" { int __link_ConfigObjectSvc; }
#endif
#endif
static ConfigScriptObjectController _configController;
ScriptObjectController *configController = &_configController;
static ConfigItemScriptObjectController _configItemController;
ScriptObjectController *configItemController = &_configItemController;
static ConfigAttributeScriptObjectController _configAttributeController;
ScriptObjectController *configAttributeController = &_configAttributeController;
// -----------------------------------------------------------------------------------------------------
// Service
ScriptObjectController *ConfigScriptObjectSvc::getController(int n)
{
switch (n) {
case 0:
return configController;
case 1:
return configItemController;
case 2:
return configAttributeController;
}
return NULL;
}
// -----------------------------------------------------------------------------------------------------
// ConfigObject
ConfigObject::ConfigObject() {
numobjects++;
getScriptObject()->vcpu_setInterface(CONFIG_SCRIPTOBJECT_GUID, (void *)static_cast<ConfigObject *>(this));
getScriptObject()->vcpu_setClassName(L"Config");
getScriptObject()->vcpu_setController(configController);
}
ConfigObject::~ConfigObject() {
numobjects--;
mylist.deleteAll();
if (numobjects == 0) {
foreach(ouraddeditems)
WASABI_API_CONFIG->config_deregisterCfgItem(ouraddeditems.getfor());
endfor
ouraddeditems.deleteAll();
}
}
PtrList<CfgItemI> ConfigObject::ouraddeditems;
int ConfigObject::numobjects=0;
function_descriptor_struct ConfigScriptObjectController::exportedFunction[] = {
{L"getItem", 1, (void*)ConfigObject::config_getItem},
{L"getItemByGuid", 1, (void*)ConfigObject::config_getItemByGuid},
{L"newItem", 2, (void*)ConfigObject::config_newItem},
};
int ConfigScriptObjectController::getNumFunctions() {
return sizeof(exportedFunction) / sizeof(function_descriptor_struct);
}
scriptVar ConfigObject::config_newItem(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar configitem_name, scriptVar configitem_guid)
{
SCRIPT_FUNCTION_INIT
ConfigObject *co = static_cast<ConfigObject*>(o->vcpu_getInterface(CONFIG_SCRIPTOBJECT_GUID));
ConfigItemObject *ret=getItem(GET_SCRIPT_STRING(configitem_name), co);
if (!ret)
ret = getItem(GET_SCRIPT_STRING(configitem_guid), co);
if (ret)
return MAKE_SCRIPT_OBJECT(ret->getScriptObject());
CfgItemI *item = new CfgItemI(GET_SCRIPT_STRING(configitem_name), nsGUID::fromCharW(GET_SCRIPT_STRING(configitem_guid)));
ConfigObject::ouraddeditems.addItem(item);
WASABI_API_CONFIG->config_registerCfgItem(item);
ret = new ConfigItemObject(item);
co->mylist.addItem(ret);
return MAKE_SCRIPT_OBJECT(ret->getScriptObject());
}
ConfigItemObject *ConfigObject::getItem(const wchar_t *nameorguid, ConfigObject *co) {
int i=0;
ConfigItemObject *ret=NULL;
GUID g = nsGUID::fromCharW(nameorguid);
for (i=0;;i++) {
CfgItem *item = WASABI_API_CONFIG->config_enumCfgItem(i);
if (!item) break;
GUID ig = item->getGuid();
if (g == ig || WCSCASEEQLSAFE(nameorguid, item->getName()))
{
ret = new ConfigItemObject(item);
co->mylist.addItem(ret);
break;
}
#if 0//CUT
for (int j=0;j<item->getNumChildren();j++) {
if (STRCASEEQL(nameorguid, item->enumChild(j)->getName())) {
ret = new ConfigItemObject(item->enumChild(j));
co->mylist.addItem(ret);
break;
}
}
#endif
}
return ret;
}
scriptVar ConfigObject::config_getItem(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar cfgitem_name)
{
SCRIPT_FUNCTION_INIT
ConfigObject *co = static_cast<ConfigObject*>(o->vcpu_getInterface(CONFIG_SCRIPTOBJECT_GUID));
ConfigItemObject *ret=getItem(GET_SCRIPT_STRING(cfgitem_name), co);
return MAKE_SCRIPT_OBJECT(ret ? ret->getScriptObject() : NULL);
}
scriptVar ConfigObject::config_getItemByGuid(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar cfgitem_guid)
{
SCRIPT_FUNCTION_INIT
// GUID g = nsGUID::fromChar(GET_SCRIPT_STRING(guid));
// api->
int i=0;
ConfigItemObject *ret=NULL;
ConfigObject *co = static_cast<ConfigObject*>(o->vcpu_getInterface(CONFIG_SCRIPTOBJECT_GUID));
const wchar_t *p = GET_SCRIPT_STRING(cfgitem_guid);
if (p == NULL) {
RETURN_SCRIPT_ZERO;
}
GUID g = nsGUID::fromCharW(p);
for (i=0;;i++) {
CfgItem *item = WASABI_API_CONFIG->config_enumCfgItem(i);
if (!item) break;
if (g == item->getGuid()) {
ret = new ConfigItemObject(item);
co->mylist.addItem(ret);
break;
}
#if 0//CUT
for (int j=0;j<item->getNumChildren();j++) {
if (g == item->enumChild(j)->getName()) {
ret = new ConfigItemObject(item->enumChild(j));
co->mylist.addItem(ret);
break;
}
}
#endif
}
return MAKE_SCRIPT_OBJECT(ret ? ret->getScriptObject() : NULL);
}
ScriptObject *ConfigScriptObjectController::instantiate() {
ConfigObject *c = new ConfigObject;
if (!c) return NULL;
return c->getScriptObject();
}
void ConfigScriptObjectController::destroy(ScriptObject *o) {
ConfigObject *obj = static_cast<ConfigObject *>(o->vcpu_getInterface(CONFIG_SCRIPTOBJECT_GUID));
ASSERT(obj != NULL);
delete obj;
}
void *ConfigScriptObjectController::encapsulate(ScriptObject *o) {
return NULL; // no encapsulation for config
}
void ConfigScriptObjectController::deencapsulate(void *) {
}
// -----------------------------------------------------------------------------------------------------
// ConfigItem
function_descriptor_struct ConfigItemScriptObjectController::exportedFunction[] = {
{L"getAttribute", 1, (void*)ConfigItemObject::configItem_getAttribute},
{L"getGuid", 0, (void*)ConfigItemObject::configItem_getGuid},
{L"newAttribute", 2, (void*)ConfigItemObject::configItem_newAttribute},
};
int ConfigItemScriptObjectController::getNumFunctions() {
return sizeof(exportedFunction) / sizeof(function_descriptor_struct);
}
ConfigItemObject::ConfigItemObject(CfgItem *_item)
{
getScriptObject()->vcpu_setInterface(CONFIGITEM_SCRIPTOBJECT_GUID, (void *)static_cast<ConfigItemObject *>(this));
getScriptObject()->vcpu_setClassName(L"ConfigItem");
getScriptObject()->vcpu_setController(configItemController);
wchar_t strguid[256];
nsGUID::toCharW(_item->getGuid(), strguid);
guid = strguid;
item = _item;
}
ConfigAttributeObject *ConfigItemObject::getAttribute(const wchar_t *name)
{
if (!item) return NULL;
for (int i=0;i<item->getNumAttributes();i++)
{
if (!WCSICMP(item->enumAttribute(i), name))
{
ConfigAttributeObject *o = new ConfigAttributeObject(item, name, this);
mylist.addItem(o);
return o;
}
}
return NULL;
}
ConfigAttributeObject *ConfigItemObject::newAttribute(const wchar_t *name, const wchar_t *defaultvalue)
{
if (!item) return NULL;
ConfigAttributeObject *o = getAttribute(name);
if (o != NULL) return o;
item->addAttribute(name, defaultvalue);
ConfigAttributeObject *cao = getAttribute(name);
cao->setAutoDelete();
return cao;
}
ConfigItemObject::~ConfigItemObject()
{
mylist.deleteAll();
}
scriptVar ConfigItemObject::configItem_getAttribute(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar name)
{
SCRIPT_FUNCTION_INIT
ConfigItemObject *cio = static_cast<ConfigItemObject *>(o->vcpu_getInterface(CONFIGITEM_SCRIPTOBJECT_GUID));
ConfigAttributeObject *cao = NULL;
if (cio)
cao = cio->getAttribute(GET_SCRIPT_STRING(name));
return MAKE_SCRIPT_OBJECT(cao ? cao->getScriptObject() : NULL);
}
scriptVar ConfigItemObject::configItem_getGuid(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
{
SCRIPT_FUNCTION_INIT
ConfigItemObject *cio = static_cast<ConfigItemObject *>(o->vcpu_getInterface(CONFIGITEM_SCRIPTOBJECT_GUID));
if (cio) return MAKE_SCRIPT_STRING(cio->getGuid());
return MAKE_SCRIPT_STRING(L"");
}
scriptVar ConfigItemObject::configItem_newAttribute(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar name, scriptVar defval) {
SCRIPT_FUNCTION_INIT
ConfigItemObject *cio = static_cast<ConfigItemObject *>(o->vcpu_getInterface(CONFIGITEM_SCRIPTOBJECT_GUID));
ConfigAttributeObject *cao = NULL;
if (cio)
cao = cio->newAttribute(GET_SCRIPT_STRING(name), GET_SCRIPT_STRING(defval));
return MAKE_SCRIPT_OBJECT(cao ? cao->getScriptObject() : NULL);
}
// -----------------------------------------------------------------------------------------------------
// ConfigAttribute
function_descriptor_struct ConfigAttributeScriptObjectController::exportedFunction[] = {
{L"getData", 0, (void*)ConfigAttributeObject::configAttr_getData},
{L"setData", 1, (void*)ConfigAttributeObject::configAttr_setData},
{L"onDataChanged", 0, (void*)ConfigAttributeObject::configAttr_onDataChanged},
{L"getParentItem", 0, (void*)ConfigAttributeObject::configAttr_getParentItem},
{L"getAttributeName", 0, (void*)ConfigAttributeObject::configAttr_getAttributeName},
};
int ConfigAttributeScriptObjectController::getNumFunctions() {
return sizeof(exportedFunction) / sizeof(function_descriptor_struct);
}
void ConfigAttributeObject::setData(const wchar_t *data)
{
if (!item || !attr) return;
item->setData(attr, data);
}
const wchar_t *ConfigAttributeObject::getData()
{
if (!item || !attr) return NULL;
static wchar_t t[WA_MAX_PATH];
item->getData(attr, t, WA_MAX_PATH);
return t;
}
ConfigAttributeObject::ConfigAttributeObject(CfgItem *_item, const wchar_t *_attr, ConfigItemObject *_parent)
{
getScriptObject()->vcpu_setInterface(CONFIGATTRIBUTE_SCRIPTOBJECT_GUID, (void *)static_cast<ConfigAttributeObject *>(this));
getScriptObject()->vcpu_setClassName(L"ConfigAttribute");
getScriptObject()->vcpu_setController(configAttributeController);
attr = _attr;
item = _item;
parent = _parent;
viewer_addViewItem(item);
autodelete = 0;
}
ConfigAttributeObject::~ConfigAttributeObject() {
if (autodelete) getParentItem()->getCfgItem()->delAttribute(attr);
}
int ConfigAttributeObject::viewer_onEvent(CfgItem *item, int event, intptr_t param, void *ptr, size_t ptrlen)
{
if (event == CfgItem::Event_ATTRIBUTE_CHANGED)
{
const wchar_t *_attr = reinterpret_cast<const wchar_t *>(ptr);
if (!WCSICMP(attr, _attr))
configAttr_onDataChanged(SCRIPT_CALL, getScriptObject());
}
return 1;
}
scriptVar ConfigAttributeObject::configAttr_setData(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar val)
{
SCRIPT_FUNCTION_INIT
ConfigAttributeObject *cao = static_cast<ConfigAttributeObject *>(o->vcpu_getInterface(CONFIGATTRIBUTE_SCRIPTOBJECT_GUID));
if (cao)
cao->setData(GET_SCRIPT_STRING(val));
RETURN_SCRIPT_VOID;
}
scriptVar ConfigAttributeObject::configAttr_getData(SCRIPT_FUNCTION_PARAMS, ScriptObject *o) {
SCRIPT_FUNCTION_INIT
ConfigAttributeObject *cao = static_cast<ConfigAttributeObject *>(o->vcpu_getInterface(CONFIGATTRIBUTE_SCRIPTOBJECT_GUID));
if (cao)
return MAKE_SCRIPT_STRING(cao->getData());
return MAKE_SCRIPT_STRING(L"");
}
scriptVar ConfigAttributeObject::configAttr_onDataChanged(SCRIPT_FUNCTION_PARAMS, ScriptObject *o) {
SCRIPT_FUNCTION_INIT
PROCESS_HOOKS0(o, configAttributeController);
SCRIPT_FUNCTION_CHECKABORTEVENT;
SCRIPT_EXEC_EVENT0(o);
}
scriptVar ConfigAttributeObject::configAttr_getParentItem(SCRIPT_FUNCTION_PARAMS, ScriptObject *o) {
SCRIPT_FUNCTION_INIT
ConfigAttributeObject *cao = static_cast<ConfigAttributeObject *>(o->vcpu_getInterface(CONFIGATTRIBUTE_SCRIPTOBJECT_GUID));
if (cao) return MAKE_SCRIPT_OBJECT(cao->getParentItem()->getScriptObject());
return MAKE_SCRIPT_OBJECT(NULL);
}
scriptVar ConfigAttributeObject::configAttr_getAttributeName(SCRIPT_FUNCTION_PARAMS, ScriptObject *o) {
SCRIPT_FUNCTION_INIT
ConfigAttributeObject *cao = static_cast<ConfigAttributeObject *>(o->vcpu_getInterface(CONFIGATTRIBUTE_SCRIPTOBJECT_GUID));
if (cao)
return MAKE_SCRIPT_STRING(cao->getAttributeName());
return MAKE_SCRIPT_STRING(L"");
}

View File

@ -0,0 +1,198 @@
#ifndef __CFGSCRIPTOBJ_H
#define __CFGSCRIPTOBJ_H
#include <api/script/objects/rootobj.h>
#include <api/script/objcontroller.h>
#include <api/script/scriptobj.h>
#include <bfc/depview.h>
#include <api/service/svcs/svc_scriptobji.h>
#include <api/config/items/attribs.h>
class CfgItem;
class ConfigObject;
class ConfigItemObject;
class ConfigAttributeObject;
extern ScriptObjectController *configController;
extern ScriptObjectController *configItemController;
extern ScriptObjectController *configAttributeController;
enum cfgtypes {
CFG_INT = 0,
CFG_BOOL = 1,
CFG_FLOAT = 2,
CFG_STRING = 3,
};
// -----------------------------------------------------------------------------------------------------
// ScriptObject Provider Service
class ConfigScriptObjectSvc : public svc_scriptObjectI {
public:
ConfigScriptObjectSvc() {};
virtual ~ConfigScriptObjectSvc() {};
static const char *getServiceName() { return "Config maki object"; }
virtual ScriptObjectController *getController(int n);
static void addItemObject(ConfigItemObject *item);
static void addAttrObject(ConfigAttributeObject *attr);
static void removeItemObject(ConfigItemObject *item);
static void removeAttrObject(ConfigAttributeObject *attr);
};
// -----------------------------------------------------------------------------------------------------
// Script classes GUIDS
// {593DBA22-D077-4976-B952-F4713655400B}
static const GUID CONFIG_SCRIPTOBJECT_GUID =
{ 0x593dba22, 0xd077, 0x4976, { 0xb9, 0x52, 0xf4, 0x71, 0x36, 0x55, 0x40, 0xb } };
// {D4030282-3AAB-4d87-878D-12326FADFCD5}
static const GUID CONFIGITEM_SCRIPTOBJECT_GUID =
{ 0xd4030282, 0x3aab, 0x4d87, { 0x87, 0x8d, 0x12, 0x32, 0x6f, 0xad, 0xfc, 0xd5 } };
// {24DEC283-B76E-4a36-8CCC-9E24C46B6C73}
static const GUID CONFIGATTRIBUTE_SCRIPTOBJECT_GUID =
{ 0x24dec283, 0xb76e, 0x4a36, { 0x8c, 0xcc, 0x9e, 0x24, 0xc4, 0x6b, 0x6c, 0x73 } };
// -----------------------------------------------------------------------------------------------------
// ScriptObject Interfaces
// Config
class ConfigObject : public RootObjectInstance {
public:
ConfigObject();
virtual ~ConfigObject();
static scriptVar config_getItem(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar configitem_name);
static scriptVar config_getItemByGuid(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar configitem_name);
static scriptVar config_newItem(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar configitem_name, scriptVar guid);
private:
static ConfigItemObject *getItem(const wchar_t *nameorguid, ConfigObject *co);
PtrList<ConfigItemObject> mylist;
static PtrList<CfgItemI> ouraddeditems;
static int numobjects;
};
// ConfigItem
class ConfigItemObject : public RootObjectInstance {
public:
ConfigItemObject(CfgItem *item);
virtual ~ConfigItemObject();
ConfigAttributeObject *getAttribute(const wchar_t *name);
const wchar_t *getGuid() { return guid; }
ConfigAttributeObject *newAttribute(const wchar_t *name, const wchar_t *defval);
CfgItem *getCfgItem() { return item; }
static scriptVar configItem_getAttribute(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar attr_name);
static scriptVar configItem_getGuid(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
static scriptVar configItem_newAttribute(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar attr_name, scriptVar defval);
private:
CfgItem *item;
StringW guid;
PtrList<ConfigAttributeObject> mylist;
};
// ConfigAttribute
class ConfigAttributeObject : public RootObjectInstance, public DependentViewerTPtr<CfgItem> {
public:
ConfigAttributeObject(CfgItem *item, const wchar_t *attr, ConfigItemObject *parent);
virtual ~ConfigAttributeObject();
void setData(const wchar_t *data);
const wchar_t *getData();
ConfigItemObject *getParentItem() { return parent; }
const wchar_t *getAttributeName() { return attr; }
void setAutoDelete() { autodelete = 1; }
virtual int viewer_onEvent(CfgItem *item, int event, intptr_t param, void *ptr, size_t ptrlen);
static scriptVar configAttr_getData(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
static scriptVar configAttr_setData(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar val);
static scriptVar configAttr_onDataChanged(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
static scriptVar configAttr_getParentItem(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
static scriptVar configAttr_getAttributeName(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
private:
CfgItem *item;
StringW attr;
ConfigItemObject *parent;
int autodelete;
};
// -----------------------------------------------------------------------------------------------------
// ScriptObjectControllers for our script classes
// Config
class ConfigScriptObjectController : public ScriptObjectControllerI {
public:
virtual const wchar_t *getClassName() { return L"Config"; }
virtual const wchar_t *getAncestorClassName() { return L"Object"; }
virtual ScriptObjectController *getAncestorController() { return NULL; }
virtual int getNumFunctions();
virtual const function_descriptor_struct *getExportedFunctions() { return exportedFunction; }
virtual GUID getClassGuid() { return CONFIG_SCRIPTOBJECT_GUID; }
virtual int getInstantiable() { return 0; }
virtual int getReferenceable() { return 0; }
virtual ScriptObject *instantiate();
virtual void destroy(ScriptObject *o);
virtual void *encapsulate(ScriptObject *o);
virtual void deencapsulate(void *o);
private:
static function_descriptor_struct exportedFunction[];
};
// ConfigItem
class ConfigItemScriptObjectController : public ScriptObjectControllerI {
public:
virtual const wchar_t *getClassName() { return L"ConfigItem"; }
virtual const wchar_t *getAncestorClassName() { return L"Object"; }
virtual ScriptObjectController *getAncestorController() { return NULL; }
virtual int getNumFunctions();
virtual const function_descriptor_struct *getExportedFunctions() { return exportedFunction; }
virtual GUID getClassGuid() { return CONFIGITEM_SCRIPTOBJECT_GUID; }
virtual int getInstantiable() { return 0; }
virtual int getReferenceable() { return 1; }
virtual ScriptObject *instantiate() { return NULL; };
virtual void destroy(ScriptObject *o) { };
virtual void *encapsulate(ScriptObject *o) { return NULL; };
virtual void deencapsulate(void *o) { };
private:
static function_descriptor_struct exportedFunction[];
};
// ConfigAttribute
class ConfigAttributeScriptObjectController : public ScriptObjectControllerI {
public:
virtual const wchar_t *getClassName() { return L"ConfigAttribute"; }
virtual const wchar_t *getAncestorClassName() { return L"Object"; }
virtual ScriptObjectController *getAncestorController() { return NULL; }
virtual int getNumFunctions();
virtual const function_descriptor_struct *getExportedFunctions() { return exportedFunction; }
virtual GUID getClassGuid() { return CONFIGATTRIBUTE_SCRIPTOBJECT_GUID; }
virtual int getInstantiable() { return 0; }
virtual int getReferenceable() { return 1; }
virtual ScriptObject *instantiate() { return NULL; };
virtual void destroy(ScriptObject *o) { };
virtual void *encapsulate(ScriptObject *o) { return NULL; };
virtual void deencapsulate(void *o) { };
private:
static function_descriptor_struct exportedFunction[];
};
#endif

View File

@ -0,0 +1,329 @@
#include <precomp.h>
#include "config.h"
#include <bfc/pair.h>
#include <bfc/ptrlist.h>
#include <bfc/parse/pathparse.h>
#include <api/xml/xmlwrite.h>
#include "../xml/ifc_xmlreadercallbackI.h"
#include "../xml/obj_xml.h"
#include <bfc/string/url.h>
#include <api/service/waservicefactory.h>
static StringW iniFile;
#define XNFNAME L"studio.xnf"
class StringPairCompare
{
public:
static int compareItem(StringPair *p1, StringPair *p2)
{
int r = wcscmp(p1->a.getValue(), p2->a.getValue());
if (r == 0)
return CMP3(p1, p2);
else
return r;
}
static int compareAttrib(const wchar_t *attrib, StringPair *item)
{
return wcscmp(attrib, item->a.getValue());
}
};
static PtrListQuickSorted<StringPair, StringPairCompare> strings;
class Reader : public ifc_xmlreadercallbackI
{
public:
~Reader();
void xmlReaderOnStartElementCallback(const wchar_t *xmlpath, const wchar_t *xmltag, ifc_xmlreaderparams *params);
void xmlReaderOnEndElementCallback(const wchar_t *xmlpath, const wchar_t *xmltag);
void readem();
private:
PtrList<StringW> sections;
};
Reader::~Reader()
{
sections.deleteAll();
}
void Reader::xmlReaderOnStartElementCallback(const wchar_t *xmlpath, const wchar_t *xmltag, ifc_xmlreaderparams *params)
{
if (!WCSICMP(xmltag, L"section"))
{
const wchar_t *name = params->getItemValue(L"name");
if (name == NULL)
return ;
StringW *strName = new StringW(name);
Url::decode(*strName);
sections.addItem(strName);
}
else if (!WCSICMP(xmltag, L"entry"))
{
const wchar_t *name = params->getItemValue(L"name");
const wchar_t *value = params->getItemValue(L"value");
// just in case
if (!WCSICMP(name, L"(null)")) name = NULL;
if (!WCSICMP(value, L"(null)")) value = NULL;
if (name == NULL /*| !*name */ || value == NULL /*|| !*value*/) return ;
StringW strName = name;
Url::decode(strName);
StringW strValue = value;
Url::decode(strValue);
StringW n;
for (int i = 0; i < sections.getNumItems(); i++)
{
n.catPostSeparator(*sections[i], '/');
}
n += strName;
StringPair *p = new StringPair(n, strValue);
strings.addItem(p);
}
}
void Reader::xmlReaderOnEndElementCallback(const wchar_t *xmlpath, const wchar_t *xmltag)
{
if (!WCSICMP(xmltag, L"section"))
{
StringW *last = sections.getLast();
sections.removeLastItem();
delete last;
}
}
void LoadXmlFile(obj_xml *parser, const wchar_t *filename);
void Reader::readem()
{
strings.deleteAll();
if (iniFile.isempty())
{
iniFile = StringPathCombine(WASABI_API_APP->path_getUserSettingsPath(), XNFNAME);
}
waServiceFactory *parserFactory = WASABI_API_SVC->service_getServiceByGuid(obj_xmlGUID);
if (parserFactory)
{
obj_xml *parser = (obj_xml *)parserFactory->getInterface();
if (parser)
{
parser->xmlreader_registerCallback(L"WinampXML\fconfiguration\f*", this);
parser->xmlreader_registerCallback(L"WasabiXML\fconfiguration\f*", this);
parser->xmlreader_open();
LoadXmlFile(parser, iniFile);
parser->xmlreader_unregisterCallback(this);
parser->xmlreader_close();
parserFactory->releaseInterface(parser);
parser = 0;
}
}
}
StringPair *ConfigFile::getPair(const wchar_t *name)
{
ASSERT(!sectionname.isempty());
StringW nname;
nname.catPostSeparator(sectionname.getValue(), '/');
nname.cat(name);
return strings.findItem(nname.getValue()); // cast to make PtrListSorted happy
}
StringPair *ConfigFile::makePair(const wchar_t *name, const wchar_t *value)
{
StringPair *ret = getPair(name);
if (ret == NULL)
{
StringW nname;
nname.catPostSeparator(sectionname.getValue(), '/');
nname.cat(name);
ret = new StringPair(nname, value);
strings.addItem(ret);
}
else
{
ret->b.setValue(value);
}
return ret;
}
static int ninstances, inited;
ConfigFile::ConfigFile(const wchar_t *section, const wchar_t *name)
{
sectionname = section;
prettyname = name;
ninstances++;
}
void ConfigFile::initialize()
{
Reader().readem();
}
ConfigFile::~ConfigFile()
{
ninstances--;
if (ninstances == 0)
{
FILE *fp = _wfopen(iniFile, WF_WRITE_TEXT);
if (fp != NULL)
{
// write out the file
XMLWrite xml(fp, L"WasabiXML");
const wchar_t *app = WASABI_API_APP->main_getVersionString();
if (!app)
app = L"thousands of irascible butt monkeys";
xml.comment(StringPrintfW(L"Generated by: %s (%d)", app, WASABI_API_APP->main_getBuildNumber()));
xml.pushCategory(L"configuration");
PtrList<StringW> cats;
for (int i = 0; i < strings.getNumItems(); i++)
{
StringPair *p = strings[i];
PathParserW pp(p->a);
int climit = MIN(pp.getNumStrings() - 1, cats.getNumItems());
int j;
for (j = 0; j < climit; j++)
{
if (WCSICMP(*cats[j], pp.enumString(j)))
{
climit = j;
break;
}
}
while (cats.getNumItems() > climit)
{
StringW *s = cats.getLast();
xml.popCategory();
cats.removeLastItem();
delete s;
}
for (j = climit; j < pp.getNumStrings() - 1; j++)
{
StringW *s = cats.addItem(new StringW(pp.enumString(j)));
xml.pushCategoryAttrib(L"section");
StringW enc = *s;
Url::encode(enc, FALSE, URLENCODE_EXCLUDE_ABOVEEQ32);
xml.writeCategoryAttrib(L"name", enc);
xml.closeCategoryAttrib();
}
xml.pushCategoryAttrib(L"entry", TRUE);
StringW enc = pp.getLastString();
Url::encode(enc, FALSE, URLENCODE_EXCLUDE_ABOVEEQ32);
xml.writeCategoryAttrib(L"name", enc);
enc = p->b;
Url::encode(enc, FALSE, URLENCODE_EXCLUDE_ABOVEEQ32);
if (enc.iscaseequal(L"(null)") || enc.getValue() == NULL)
enc.setValue(L"");
xml.writeCategoryAttrib(L"value", enc);
xml.closeCategoryAttrib();
xml.popCategory();
}
while (xml.popCategory()) ;
strings.deleteAll();
fclose(fp);
} // fp != NULL
} // ninstances==0
}
int verifyName(const wchar_t *str)
{
for (const wchar_t *p = str; *p; p++)
{
if (!ISALPHA(*p) &&
!ISDIGIT(*p) &&
!ISPUNCT(*p) &&
!ISSPACE(*p) &&
*p != '|' && *p != '_')
return 0;
}
return 1;
}
void ConfigFile::setInt(const wchar_t *name, int val)
{
INCRITICALSECTION(cs);
if (name == NULL) return ;
if (!verifyName(name))
{
DebugStringW(L"illegal name given\n");
//__asm { int 3 };
return ;
}
makePair(name, StringPrintfW(val));
}
int ConfigFile::getInt(const wchar_t *name, int def_val)
{
INCRITICALSECTION(cs);
if (name == NULL) return def_val;
StringPair *p = getPair(name);
if (p == NULL) return def_val;
return WTOI(p->b.getValue());
}
void ConfigFile::setString(const wchar_t *name, const wchar_t *str)
{
INCRITICALSECTION(cs);
if (name == NULL) return ;
if (!verifyName(name))
{
DebugStringW(L"illegal name given\n");
return ;
}
if (str == NULL)
{
StringPair *p = getPair(name);
if (p != NULL)
{
strings.delItem(p);
delete p;
return ;
}
}
makePair(name, str);
}
int ConfigFile::getString(const wchar_t *name, wchar_t *buf, int buf_len, const wchar_t *def_str)
{
INCRITICALSECTION(cs);
if (name == NULL || buf == NULL) return -1;
if (def_str == NULL)
def_str = L"";
StringPair *p = getPair(name);
if (p == NULL)
WCSCPYN(buf, def_str, buf_len);
else
WCSCPYN(buf, p->b.getValueSafe(), buf_len);
return 1;
}
int ConfigFile::getStringLen(const wchar_t *name)
{
INCRITICALSECTION(cs);
if (name == NULL) return -1;
StringPair *p = getPair(name);
if (p == NULL) return -1;
return wcslen(p->b.getValue());
}

View File

@ -0,0 +1,43 @@
#ifndef _CONFIG_H
#define _CONFIG_H
#include <bfc/string/bfcstring.h>
#include <bfc/pair.h>
#include <bfc/critsec.h>
#include <bfc/string/StringW.h>
class StringPair : public Pair<StringW, StringW>
{
public:
StringPair(StringW &_a, const wchar_t *_b)
{
b=_b;
a.swap(_a);
}
};
class ConfigFile
{
public:
ConfigFile(const wchar_t *section, const wchar_t *name);
~ConfigFile();
static void initialize();
void setInt(const wchar_t *name, int val);
int getInt(const wchar_t *name, int default_val);
void setString(const wchar_t *name, const wchar_t *str);
int getString(const wchar_t *name, wchar_t *buf, int buf_len, const wchar_t *default_str);
int getStringLen(const wchar_t *name);
private:
StringW sectionname;
StringW prettyname;
StringPair *getPair(const wchar_t *name);
StringPair *makePair(const wchar_t *name, const wchar_t *value);
CriticalSection cs;
};
#endif

View File

@ -0,0 +1,95 @@
#include "precomp.h"
#include "configapi.h"
#include "../../studio/config.h"
#include "../../studio/cfglist.h"
config_api *configApi = NULL;
static CfgList cfglist;
void ConfigApi::config_registerCfgItem(CfgItem *cfgitem) {
cfglist.addItem(cfgitem);
}
void ConfigApi::config_deregisterCfgItem(CfgItem *cfgitem) {
cfglist.delItem(cfgitem);
}
int ConfigApi::config_getNumCfgItems() {
return cfglist.getNumItems();
}
CfgItem *ConfigApi::config_enumCfgItem(int n) {
return cfglist.enumItem(n);
}
CfgItem *ConfigApi::config_getCfgItemByGuid(GUID g) {
return NULL;//cfglist.getByGuid(g);
}
void ConfigApi::setIntPrivate(const char *name, int val) {
//config->setInt(name, val);
}
int ConfigApi::getIntPrivate(const char *name, int def_val) {
/* int ret = config->getInt(name, def_val);
return ret;*/
return 0;
}
void ConfigApi::setIntArrayPrivate(const char *name, const int *val, int nval) {
/*if (nval > 256) return;
char buf[12*256]="";
for (int i = 0; i < nval; i++) {
STRCAT(buf, StringPrintf("%d", val[i]));
if (i != nval-1) STRCAT(buf, ",");
}
config->setString(name, buf);*/
}
int ConfigApi::getIntArrayPrivate(const char *name, int *val, int nval) {
/* char buf[12*256]="";
config->getString(name, buf, sizeof(buf), "");
PathParser pp(buf, ",");
if (pp.getNumStrings() != nval) return 0;
for (int i = 0; i < nval; i++) {
*val = ATOI(pp.enumString(i));
val ++;
}
return 1;*/
return 1;
}
void ConfigApi::setStringPrivate(const char *name, const char *str) {
//config->setString(name, str);
}
int ConfigApi::getStringPrivate(const char *name, char *buf, int buf_len, const char *default_str) {
/* int ret = config->getString(name, buf, buf_len, default_str);
return ret;*/
return 0;
}
int ConfigApi::getStringPrivateLen(const char *name) {
//return config->getStringLen(name);
return 0;
}
void ConfigApi::setIntPublic(const char *name, int val) {
//public_config->setInt(name, val);
}
int ConfigApi::getIntPublic(const char *name, int def_val) {
//return public_config->getInt(name, def_val);
return 0;
}
void ConfigApi::setStringPublic(const char *name, const char *str) {
// public_config->setString(name, str);
}
int ConfigApi::getStringPublic(const char *name, char *buf, int buf_len, const char *default_str) {
// return public_config->getString(name, buf, buf_len, default_str);
return 0;
}

View File

@ -0,0 +1,32 @@
#ifndef __CONFIG_API_H
#define __CONFIG_API_H
#include "../../bfc/api/api_configi.h"
class ConfigApi : public config_apiI {
public:
ConfigApi() {}
virtual ~ConfigApi() {}
virtual void config_registerCfgItem(CfgItem *cfgitem);
virtual void config_deregisterCfgItem(CfgItem *cfgitem);
virtual int config_getNumCfgItems();
virtual CfgItem *config_enumCfgItem(int n);
virtual CfgItem *config_getCfgItemByGuid(GUID g);
virtual void setIntPrivate(const wchar_t *name, int val);
virtual int getIntPrivate(const wchar_t *name, int def_val);
virtual void setIntArrayPrivate(const wchar_t *name, const int *val, int nval);
virtual int getIntArrayPrivate(const wchar_t *name, int *val, int nval);
virtual void setStringPrivate(const wchar_t *name, const wchar_t *str);
virtual int getStringPrivate(const wchar_t *name, wchar_t *buf, int buf_len, const wchar_t *default_str);
virtual int getStringPrivateLen(const wchar_t *name);
virtual void setIntPublic(const wchar_t *name, int val);
virtual int getIntPublic(const wchar_t *name, int def_val);
virtual void setStringPublic(const wchar_t *name, const wchar_t *str);
virtual int getStringPublic(const wchar_t *name, wchar_t *buf, int buf_len, const wchar_t *default_str);
protected:
};
#endif

View File

@ -0,0 +1,576 @@
#include "precomp.h"
#include "filetypes.h"
#include "api.h"
#include "main.h"
#include "core.h"
#include <bfc/attribs/attribs.h>
#include <bfc/attribs/attrcb.h>
#include "../common/locales.h"
#include "../bfc/paramparser.h"
// {DB26AA7F-0CF4-4e48-8AC8-49F9B9855A98}
static const GUID winampa_guid =
{ 0xdb26aa7f, 0xcf4, 0x4e48, { 0x8a, 0xc8, 0x49, 0xf9, 0xb9, 0x85, 0x5a, 0x98 } };
class Filetypes;
class ExtensionAttrCallback : public AttrCallback {
public:
ExtensionAttrCallback(const char *extname, Filetypes *ft) : ext(extname), filetypes(ft) {}
virtual void onValueChange(Attribute *attr) {
Filetypes::registerExtension(ext, attr->getValueAsInt());
api->cmd_sendCommand(winampa_guid,"extchange",0,0,attr,sizeof(attr)); // CT> notifies winampa.wac of the change
// (dunno if there is a better method)
filetypes->updateKeepers();
}
private:
String ext;
Filetypes *filetypes;
};
class KeepersCB : public AttrCallback {
public:
KeepersCB(CfgItemI *_par) : par(_par) { }
virtual void onValueChange(Attribute *attr) {
//CT> This is REAL SLOW, for each attribute modified, you reregister them all, this needs to have
// an old list and just register/unregister what's new
char bufero[WA_MAX_PATH]="";
char data[WA_MAX_PATH]="";
attr->getData(bufero, WA_MAX_PATH-1);
ParamParser pp(bufero);
const char *ext=api->core_getSupportedExtensions();
const char *p=ext;
while(*p!=0 && *(p+1)!=0) {
if(*p) {
int v = !!pp.hasString(p);
int r = par->cfgitem_getData(StringPrintf("extension/%s", p), data, WA_MAX_PATH-1);
if (r == 0 || (!!ATOI(data) != v)) {
par->cfgitem_setData(StringPrintf("extension/%s", p), StringPrintf(v));
}
}
while(*p!=0) p++;
p++;
}
}
private:
CfgItemI *par;
};
#ifdef WIN32
static void DCM_cb(int v) {
if (v) {
HKEY mp3Key;
char programname[MAX_PATH];
GetModuleFileName(Main::gethInstance(),programname,sizeof(programname));
if (RegCreateKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Classes\\Directory\\shell\\Winamp3.Play",&mp3Key) == ERROR_SUCCESS) {
const char *str=_("&Play in Winamp");
RegSetValueEx(mp3Key, NULL,0,REG_SZ,(unsigned char*)str,strlen(str) + 1);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Classes\\Directory\\shell\\Winamp3.Play\\command",&mp3Key) == ERROR_SUCCESS) {
StringPrintf mstr("\"%s\" \"%%1\"", programname);
const char *blah = mstr;
const unsigned char *microsoft_sucks_ass = (const unsigned char*)blah;
RegSetValueEx(mp3Key, NULL,0,REG_SZ,microsoft_sucks_ass,mstr.len() + 1);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Classes\\Directory\\shell\\Winamp3.Enqueue",&mp3Key) == ERROR_SUCCESS) {
const char *str=_("&Enqueue in Winamp");
RegSetValueEx(mp3Key, NULL,0,REG_SZ,(unsigned char*)str,strlen(str) + 1);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Classes\\Directory\\shell\\Winamp3.Enqueue\\command",&mp3Key) == ERROR_SUCCESS) {
StringPrintf mstr("\"%s\" /ADD \"%%1\"", programname);
const char *blah = mstr;
const unsigned char *microsoft_sucks_ass = (const unsigned char*)blah;
RegSetValueEx(mp3Key, NULL,0,REG_SZ,microsoft_sucks_ass,mstr.len() + 1);
RegCloseKey(mp3Key);
}
} else {
Filetypes::myRegDeleteKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Classes\\Directory\\shell\\Winamp3.Play");
Filetypes::myRegDeleteKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Classes\\Directory\\shell\\Winamp3.Enqueue");
}
}
#endif
// {C30C97E6-77E6-4da4-9F4F-C7F848F8F641}
const GUID filetypes_guid =
{ 0xc30c97e6, 0x77e6, 0x4da4, { 0x9f, 0x4f, 0xc7, 0xf8, 0x48, 0xf8, 0xf6, 0x41 } };
Filetypes::Filetypes() : CfgItemI("Filetypes", filetypes_guid) { }
void Filetypes::registerAttributes() {
const char *ext=api->core_getSupportedExtensions();
if (ext == NULL) return; //BU
_bool *wantExtensions;
registerAttribute(wantExtensions = new _bool("Register associations on Winamp startup", TRUE));
const char *p=ext;
while(*p!=0 && *(p+1)!=0) {
if(*p) {
_bool *extenabled;
registerAttribute(extenabled = new _bool(StringPrintf("extension/%s", p), FALSE), new ExtensionAttrCallback(p, this));
if (*wantExtensions) registerExtension(p, *extenabled);
} while(*p!=0) p++;
p++;
}
registerAttribute(new _string("keepers"), new KeepersCB(this));
#ifdef WIN32
registerAttribute(new _bool("Directory context menus", TRUE), new int_attrCB(DCM_cb));
#endif
// Always steal the ".wal" extension.
CfgItem *cift=WASABI_API_CONFIG->config_getCfgItemByGuid(filetypes_guid);
if (cift) {
cift->setDataAsInt("extension/wal",1);
}
updateKeepers();
}
void Filetypes::updateKeepers() {
static int reentry=0;
if (reentry) return;
const char *ext=api->core_getSupportedExtensions();
if (ext == NULL) return; //BU
reentry = 1;
const char *p=ext;
String kstr;
while(*p!=0 && *(p+1)!=0) {
if(*p) {
_bool *extenabled = static_cast<_bool *>(getAttributeByName(StringPrintf("extension/%s", p)));
if (*extenabled) {
if (!kstr.isempty()) kstr += ";";
kstr += p;
}
} while(*p!=0) p++;
p++;
}
_string *k = static_cast<_string *>(getAttributeByName("keepers"));
k->setValue(kstr);
reentry = 0;
}
LONG Filetypes::myRegDeleteKeyEx(HKEY thiskey, LPCTSTR lpSubKey)
{
#ifdef WIN32
HKEY key;
int retval=RegOpenKey(thiskey,lpSubKey,&key);
if (retval==ERROR_SUCCESS)
{
char buffer[1024];
while (RegEnumKey(key,0,buffer,1024)==ERROR_SUCCESS)
if ((retval=myRegDeleteKeyEx(key,buffer)) != ERROR_SUCCESS) break;
RegCloseKey(key);
retval=RegDeleteKey(thiskey,lpSubKey);
}
return retval;
#else
DebugString( "portme -- Filetypes::myRegDeleteKeyEx\n" );
return 0;
#endif
}
int Filetypes::isRegistered(const char *ext) {
char b[256];
int rval=0;
unsigned long vt,s=sizeof(b);
HKEY key;
SPRINTF(b,".%s",ext);
#ifdef WIN32
if (RegOpenKey(HKEY_CLASSES_ROOT,b,&key) != ERROR_SUCCESS) return 0;
if (RegQueryValueEx(key,NULL,0,&vt,b,&s) == ERROR_SUCCESS) {
if (vt != REG_SZ || (strcmp(b,"Winamp3.File") && strcmp(b,"Winamp3.PlayList") && strcmp(b,"Winamp3.SkinZip"))) rval=0;
else rval=1;
} else rval=0;
RegCloseKey(key);
#else
DebugString( "portme -- FileTypes::isRegistered\n" );
#endif
return rval;
}
void Filetypes::regmimetype(const char *mtype, const char *programname, const char *ext, int nsonly) {
#ifdef WIN32
HKEY mp3Key;
if (!nsonly) {
char s[MAX_PATH];
// Changed these to create rather than just open the mimetypes in the database.
if (RegCreateKey(HKEY_CLASSES_ROOT,ext,&mp3Key) == ERROR_SUCCESS) {
RegSetValueEx(mp3Key,"Content Type",0,REG_SZ,mtype,STRLEN(mtype) + 1);
RegCloseKey(mp3Key);
}
wsprintf(s,"MIME\\Database\\Content Type\\%s",mtype);
if (RegCreateKey(HKEY_CLASSES_ROOT,s,&mp3Key) == ERROR_SUCCESS) {
RegDeleteValue(mp3Key,"CLSID");
RegSetValueEx(mp3Key,"Extension",0,REG_SZ,ext,strlen(ext) + 1);
RegCloseKey(mp3Key);
}
}
if (RegOpenKey(HKEY_CURRENT_USER,"Software\\Netscape\\Netscape Navigator\\Viewers",&mp3Key) == ERROR_SUCCESS) {
int x;
RegSetValueEx(mp3Key, mtype,0,REG_SZ,programname,strlen(programname) + 1);
for (x = 0; x < 999; x ++) {
char st[100];
DWORD vt;
DWORD s=128;
char b[128];
wsprintf(st,"TYPE%d",x);
if (RegQueryValueEx(mp3Key,st,0,&vt,b,&s) == ERROR_SUCCESS) {
if (!strcmp(b,mtype)) break;
} else {
RegSetValueEx(mp3Key,st,0,REG_SZ,mtype,strlen(mtype)+1);
break;
}
}
RegCloseKey(mp3Key);
}
#else
DebugString( "portme -- Filetypes::regmimetype\n" );
#endif
}
void Filetypes::registerExtension(const char *ext, int reg) {
#ifdef WIN32
createWinampTypes();
char b[128];
HKEY mp3Key;
char *which_str="Winamp3.File";
if (!_stricmp(ext,"m3u") || !_stricmp(ext,"pls")) which_str="Winamp3.PlayList";
if (!_stricmp(ext,"wsz") || !_stricmp(ext,"wpz") || !_stricmp(ext,"wal"))
which_str="Winamp3.SkinZip";
wsprintf(b,".%s",ext);
if (reg && !_stricmp(ext,"pls")) {
char programname[MAX_PATH];
GetModuleFileName(Main::gethInstance(),programname,sizeof(programname));
regmimetype("audio/x-scpls", programname,".pls",1);
regmimetype("audio/scpls", programname,".pls",1);
}
if (reg && !_stricmp(ext,"wma")) {
char programname[MAX_PATH];
GetModuleFileName(Main::gethInstance(),programname,sizeof(programname));
regmimetype("audio/x-ms-wma", programname,".wma",1);
regmimetype("application/x-msdownload", programname,".wma",1);
}
if (reg && !_stricmp(ext,"m3u")) {
char programname[MAX_PATH];
GetModuleFileName(Main::gethInstance(),programname,sizeof(programname));
regmimetype("audio/x-mpegurl", programname,".m3u",1);
regmimetype("audio/mpegurl", programname,".m3u",1);
}
if (reg && !_stricmp(ext,"mp3")) {
char programname[MAX_PATH];
GetModuleFileName(Main::gethInstance(),programname,sizeof(programname));
regmimetype("audio/x-mpeg", programname,".mp3",1);
regmimetype("audio/x-mp3", programname,".mp3",1);
regmimetype("audio/x-mpg", programname,".mp3",1);
regmimetype("audio/mp3", programname,".mp3",1);
regmimetype("audio/mpg", programname,".mp3",1);
regmimetype("audio/mpeg", programname,".mp3",1);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,b,&mp3Key) == ERROR_SUCCESS) {
if (reg) {
unsigned long s=sizeof(b);
if (RegQueryValueEx(mp3Key,NULL,0,NULL,b,&s) == ERROR_SUCCESS) {
if (strcmp(b,which_str)) {
RegSetValueEx(mp3Key,"Winamp_Back",0,REG_SZ,b,strlen(b)+1);
RegSetValueEx(mp3Key,NULL,0,REG_SZ,which_str,strlen(which_str)+1);
}
} else RegSetValueEx(mp3Key,NULL,0,REG_SZ,which_str,strlen(which_str)+1);
} else {
unsigned long s=sizeof(b);
if (RegQueryValueEx(mp3Key,NULL,0,NULL,b,&s) == ERROR_SUCCESS) {
if (!strcmp(b,which_str)) {
s=sizeof(b);
if (RegQueryValueEx(mp3Key,"Winamp_Back",0,NULL,b,&s) == ERROR_SUCCESS) {
if (RegSetValueEx(mp3Key, NULL,0,REG_SZ,b,strlen(b)+1) == ERROR_SUCCESS)
RegDeleteValue(mp3Key,"Winamp_Back");
} else {
RegDeleteValue(mp3Key,NULL);
RegCloseKey(mp3Key);
mp3Key=NULL;
wsprintf(b,".%s",ext);
myRegDeleteKeyEx(HKEY_CLASSES_ROOT,b);
}
}
}
}
if (mp3Key) RegCloseKey(mp3Key);
}
#else
DebugString( "portme -- Filetypes::registerExtensions\n" );
#endif
}
void Filetypes::createWinampTypes() {
#ifdef WIN32
HKEY mp3Key;
char programname[MAX_PATH];
char str[MAX_PATH+32];
char buf[128]="Winamp3.File";
char buf2[128]="Winamp3.PlayList";
char buf3[128]="Winamp3.SkinZip";
if (!GetModuleFileName(Main::gethInstance(),programname,sizeof(programname))) return;
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.File",&mp3Key) == ERROR_SUCCESS) {
strcpy(str,"Winamp media file");
RegSetValueEx(mp3Key, NULL,0,REG_SZ,str,strlen(str)+1);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.File\\DefaultIcon",&mp3Key) == ERROR_SUCCESS) {
wsprintf(str,"%s,%d",programname,whichicon);
RegSetValueEx(mp3Key, NULL,0,REG_SZ,str,strlen(str)+1);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.File\\shell",&mp3Key) == ERROR_SUCCESS) {
if (addtolist)
RegSetValueEx(mp3Key, NULL,0,REG_SZ,"Enqueue",8);
else
RegSetValueEx(mp3Key, NULL,0,REG_SZ,"Play",5);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.File\\shell\\Play",&mp3Key) == ERROR_SUCCESS) {
const char *str=_("&Play in Winamp");
RegSetValueEx(mp3Key, NULL,0,REG_SZ,str,strlen(str)+1);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.File\\shell\\Play\\command",&mp3Key) == ERROR_SUCCESS) {
wsprintf(str,"\"%s\" \"%%1\"",programname);
RegSetValueEx(mp3Key, NULL,0,REG_SZ,str,strlen(str) + 1);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.File\\shell\\open",&mp3Key) == ERROR_SUCCESS) {
RegSetValueEx(mp3Key, NULL,0,REG_SZ,"",1);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.File\\shell\\open\\command",&mp3Key) == ERROR_SUCCESS) {
wsprintf(str,"\"%s\" \"%%1\"",programname);
RegSetValueEx(mp3Key, NULL,0,REG_SZ,str,strlen(str) + 1);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.File\\shell\\Enqueue",&mp3Key) == ERROR_SUCCESS) {
const char *str=_("&Enqueue in Winamp");
RegSetValueEx(mp3Key, NULL,0,REG_SZ,str,strlen(str) + 1);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.File\\shell\\Enqueue\\command",&mp3Key) == ERROR_SUCCESS) {
wsprintf(str,"\"%s\" /ADD \"%%1\"",programname);
RegSetValueEx(mp3Key, NULL,0,REG_SZ,str,strlen(str) + 1);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.File\\shell\\ListBookmark",&mp3Key) == ERROR_SUCCESS) {
const char *str=_("Add to Winamp's &Bookmark list");
RegSetValueEx(mp3Key, NULL,0,REG_SZ,str,strlen(str) + 1);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.File\\shell\\ListBookmark\\command",&mp3Key) == ERROR_SUCCESS) {
wsprintf(str,"\"%s\" /BOOKMARK \"%%1\"",programname);
RegSetValueEx(mp3Key, NULL,0,REG_SZ,str,strlen(str) + 1);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.Playlist",&mp3Key) == ERROR_SUCCESS) {
strcpy(str,"Winamp playlist file");
RegSetValueEx(mp3Key, NULL,0,REG_SZ,str,strlen(str)+1);
str[0]=0;
str[1]=0;
str[2]=1;
str[3]=0;
RegSetValueEx(mp3Key, "EditFlags",0,REG_BINARY,str,4);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.PlayList\\DefaultIcon",&mp3Key) == ERROR_SUCCESS) {
wsprintf(str,"%s,%d",programname,whichicon2);
RegSetValueEx(mp3Key, NULL,0,REG_SZ,str,strlen(str)+1);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.PlayList\\shell",&mp3Key) == ERROR_SUCCESS) {
if (addtolist)
RegSetValueEx(mp3Key, NULL,0,REG_SZ,"Enqueue",8);
else
RegSetValueEx(mp3Key, NULL,0,REG_SZ,"Play",5);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.PlayList\\shell\\Play",&mp3Key) == ERROR_SUCCESS) {
const char *str=_("&Play in Winamp");
RegSetValueEx(mp3Key, NULL,0,REG_SZ,str,strlen(str)+1);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.PlayList\\shell\\Play\\command",&mp3Key) == ERROR_SUCCESS) {
wsprintf(str,"\"%s\" \"%%1\"",programname);
RegSetValueEx(mp3Key, NULL,0,REG_SZ,str,strlen(str) + 1);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.PlayList\\shell\\open",&mp3Key) == ERROR_SUCCESS) {
RegSetValueEx(mp3Key, NULL,0,REG_SZ,"",1);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.PlayList\\shell\\open\\command",&mp3Key) == ERROR_SUCCESS) {
wsprintf(str,"\"%s\" \"%%1\"",programname);
RegSetValueEx(mp3Key, NULL,0,REG_SZ,str,strlen(str) + 1);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.PlayList\\shell\\Enqueue",&mp3Key) == ERROR_SUCCESS) {
const char *str=_("&Enqueue in Winamp");
RegSetValueEx(mp3Key, NULL,0,REG_SZ,str,strlen(str)+1);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.PlayList\\shell\\Enqueue\\command",&mp3Key) == ERROR_SUCCESS) {
wsprintf(str,"\"%s\" /ADD \"%%1\"",programname);
RegSetValueEx(mp3Key, NULL,0,REG_SZ,str,strlen(str) + 1);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.PlayList\\shell\\ListBookmark",&mp3Key) == ERROR_SUCCESS) {
const char *str=_("Add to Winamp's &Bookmark list");
RegSetValueEx(mp3Key, NULL,0,REG_SZ,str,strlen(str)+1);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.PlayList\\shell\\ListBookmark\\command",&mp3Key) == ERROR_SUCCESS) {
wsprintf(str,"\"%s\" /BOOKMARK \"%%1\"",programname);
RegSetValueEx(mp3Key, NULL,0,REG_SZ,str,strlen(str) + 1);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.SkinZip",&mp3Key) == ERROR_SUCCESS) {
strcpy(str,"Winamp3 skin file");
RegSetValueEx(mp3Key, NULL,0,REG_SZ,str,strlen(str)+1);
str[0]=0;
str[1]=0;
str[2]=1;
str[3]=0;
RegSetValueEx(mp3Key, "EditFlags",0,REG_BINARY,str,4);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.SkinZip\\DefaultIcon",&mp3Key) == ERROR_SUCCESS) {
wsprintf(str,"%s,%d",programname,whichicon);
RegSetValueEx(mp3Key, NULL,0,REG_SZ,str,strlen(str)+1);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.SkinZip\\shell",&mp3Key) == ERROR_SUCCESS) {
RegSetValueEx(mp3Key, NULL,0,REG_SZ,"Install and switch to",8);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.SkinZip\\shell\\install",&mp3Key) == ERROR_SUCCESS) {
RegSetValueEx(mp3Key, NULL,0,REG_SZ,"",1);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.SkinZip\\shell\\install\\command",&mp3Key) == ERROR_SUCCESS) {
wsprintf(str,"\"%s\" \"/installskin=%%1\"",programname);
RegSetValueEx(mp3Key, NULL,0,REG_SZ,str,strlen(str) + 1);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.SkinZip\\shell\\open",&mp3Key) == ERROR_SUCCESS) {
RegSetValueEx(mp3Key, NULL,0,REG_SZ,"",1);
RegCloseKey(mp3Key);
}
if (RegCreateKey(HKEY_CLASSES_ROOT,"Winamp3.SkinZip\\shell\\open\\command",&mp3Key) == ERROR_SUCCESS) {
wsprintf(str,"\"%s\" \"/installskin=%%1\"",programname);
RegSetValueEx(mp3Key, NULL,0,REG_SZ,str,strlen(str) + 1);
RegCloseKey(mp3Key);
}
// Register the mimetypes to act like .wal files?
// regmimetype("interface/x-winamp-skin", programname,".wsz",0);
regmimetype("interface/x-winamp-skin", programname,".wal",0);
// regmimetype("interface/x-winamp3-skin", programname,".wsz",0);
regmimetype("interface/x-winamp3-skin", programname,".wal",0);
// regmimetype("application/x-winamp-plugin", programname,"wpz",0);
#else
DebugString( "portme -- Filetypes::createWinampTypes\n" );
#endif
}
int Filetypes::isCdPlayer() {
int r=0;
#ifdef WIN32
unsigned long s;
HKEY mp3Key;
char buf[MAX_PATH],buf2[MAX_PATH]="\"";
if (!GetModuleFileName(Main::gethInstance(),buf2+1,sizeof(buf2)-8)) return 0;
if (RegOpenKey(HKEY_CLASSES_ROOT,"AudioCD\\shell\\play\\command",&mp3Key) != ERROR_SUCCESS) return 0;
strcat(buf2,"\" /CDA:%1");
s=sizeof(buf);
if (RegQueryValueEx(mp3Key,NULL,0,NULL,buf,&s) == ERROR_SUCCESS)
{
if (!lstrcmpi(buf,buf2)) r=1;
}
RegCloseKey(mp3Key);
#else
DebugString( "portme -- Filetypes::isCdPlayer\n" );
#endif
return r;
}
void Filetypes::registerCdPlayer(int reg) {
#ifdef WIN32
char b[MAX_PATH];
char buf2[MAX_PATH]="\"";
HKEY mp3Key;
if (!GetModuleFileName(Main::gethInstance(),buf2+1,sizeof(buf2)-8)) return;
strcat(buf2,"\" /CDA:%1");
if (RegOpenKey(HKEY_CLASSES_ROOT,"AudioCD\\shell\\play\\command",&mp3Key) == ERROR_SUCCESS)
{
if (reg)
{
unsigned long s=sizeof(b);
if (RegQueryValueEx(mp3Key,NULL,0,NULL,b,&s) == ERROR_SUCCESS)
{
if (_stricmp(b,buf2))
{
char buf3[MAX_PATH];
unsigned long st=sizeof(buf3);
if (RegQueryValueEx(mp3Key,"Winamp_Back",0,NULL,buf3,&st) != ERROR_SUCCESS ||
_stricmp(buf3,b))
{
RegSetValueEx(mp3Key,"Winamp_Back",0,REG_SZ,b,strlen(b)+1);
}
RegSetValueEx(mp3Key,NULL,0,REG_SZ,buf2,strlen(buf2)+1);
}
} else RegSetValueEx(mp3Key,NULL,0,REG_SZ,buf2,strlen(buf2)+1);
}
else
{
unsigned long s=sizeof(b);
if (RegQueryValueEx(mp3Key,NULL,0,NULL,b,&s) == ERROR_SUCCESS)
{
if (!strcmp(b,buf2))
{
s=sizeof(b);
if (RegQueryValueEx(mp3Key,"Winamp_Back",0,NULL,b,&s) == ERROR_SUCCESS)
{
if (!_stricmp(b,buf2)) b[0]=0;
if (RegSetValueEx(mp3Key, NULL,0,REG_SZ,b,strlen(b)+1) == ERROR_SUCCESS)
RegDeleteValue(mp3Key,"Winamp_Back");
}
else
{
buf2[0]=0;
RegSetValueEx(mp3Key,NULL,0,REG_SZ,buf2,strlen(buf2)+1);
}
}
}
}
RegCloseKey(mp3Key);
}
#else
DebugString( "portme -- Filetypes::isCdPlayer\n" );
#endif
}
int Filetypes::whichicon=1;
int Filetypes::whichicon2=1;
int Filetypes::addtolist=0;

View File

@ -0,0 +1,46 @@
#ifndef _FILETYPES_H
#define _FILETYPES_H
#include <api/config/items/cfgitemi.h>
#define FILETYPES_PARENT CfgItemI
class Filetypes : public FILETYPES_PARENT {
public:
Filetypes();
void registerAttributes();
static int isRegistered(const char *ext);
static void registerExtension(const char *ext, int reg);
static int isCdPlayer();
static void registerCdPlayer(int reg);
void updateKeepers();
private:
static void createWinampTypes();
static void regmimetype(const char *mtype, const char *programname, const char *ext, int nsonly);
// workaround for (damn) c++ type checking
static LONG RegQueryValueEx(HKEY hKey, LPTSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, char *lpData, LPDWORD lpcbData) {
#ifdef WIN32
return ::RegQueryValueEx(hKey, lpValueName, lpReserved, lpType, (unsigned char *)lpData, lpcbData);
#endif
}
static LONG RegSetValueEx(HKEY hKey, LPCTSTR lpValueName, DWORD Reserved, DWORD dwType, char *lpData, DWORD cbData) {
#ifdef WIN32
return ::RegSetValueEx(hKey, lpValueName, Reserved, dwType, (const unsigned char *)lpData, cbData);
#endif
}
static LONG RegSetValueEx(HKEY hKey, LPCTSTR lpValueName, DWORD Reserved, DWORD dwType, const char *lpData, DWORD cbData) {
#ifdef WIN32
return ::RegSetValueEx(hKey, lpValueName, Reserved, dwType, (const unsigned char *)lpData, cbData);
#endif
}
public:
static LONG myRegDeleteKeyEx(HKEY thiskey, LPCTSTR lpSubKey);
static int whichicon, whichicon2, addtolist;
};
#endif

View File

@ -0,0 +1,65 @@
#ifndef _ATTRBOOL_H
#define _ATTRBOOL_H
#include "attribute.h"
// inherit from this one, or just use it
/**
Boolean configuration attributes have two values, true or false.
They can be used like any other config item.
@short Boolean configuration attribute.
@ver 1.0
@author Nullsoft
@see _int
@see _string
@see _float
*/
class _bool : public Attribute {
public:
/**
Optionally set the name and default value of
your configuration attribute during construction.
@param name Name of the configuration attribute.
@param default_val Default value.
*/
_bool(const wchar_t *name=NULL, int default_val=0) : Attribute(name) {
setValueAsInt(!!default_val, true);
}
// convenience operators
/**
Get the value of the attribute.
*/
operator bool() { return !!getValueAsInt(); }
/**
Set the value of the attribute.
*/
bool operator =(int newval) { setValueAsInt(!!newval); return *this; }
// from Attribute
/**
Get the attribute type. This will return
a constant representing the attribute type.
These constants can be: BOOL, FLOAT, STRING and INT.
@see AttributeType
@ret The attribute type.
*/
virtual int getAttributeType() { return AttributeType::BOOL; }
/**
Get the configuration group to be used to represent
this attribute in the registry.
@ret Config group to be used.
*/
virtual const wchar_t *getConfigGroup() { return L"studio.configgroup.bool"; }
};
#endif

View File

@ -0,0 +1,127 @@
#ifndef _ATTRCB_H
#define _ATTRCB_H
#include "attribute.h"
/**
Enables you to register callbacks on
a specific attribute to monitor if it's
value has been changed by the user or other.
This class is not meant to be used on it's own.
Please derive from it instead.
@short Attribute callback
@ver 1.0
@author Nullsoft
@see Attribute
@see int_attrCB
@see _int
@see _float
@see _string
@see _bool
*/
class AttrCallback {
public:
/**
Does nothing.
*/
virtual ~AttrCallback() {}
/**
Event triggered when the value of the attribute,
for which this callback has been registered, changes.
This is a pure virtual, please override to implement
your custom behavior.
@param attr Attribute for which the value has changed.
*/
virtual void onValueChange(Attribute *attr)=0;
};
/**
Enables you to register callbacks on a specific
integer or boolean attribute to monitor if the
value has been changed by the user or other.
@short Integer or Boolean attribute Callback.
@ver 1.0
@author Nullsoft
@see Attribute
@see _int
@see _bool
*/
class int_attrCB : public AttrCallback {
typedef void (*fnPtrType)(int);
public:
/**
Upon construction, you must specify which
function will be called when the value of
the attribute has indeed changed.
This is done using a pointer to the function.
The function must accept one parameter of type
int, like so: void myfunc(int val);
@param _fn Pointer to the function to use on value change.
*/
int_attrCB(fnPtrType _fn) { fnptr = _fn; }
/**
Event triggered when the value of the attribute,
for which this callback has been registered, changes.
Override this to implement your own behavior.
The default is to send the new value of the attribute
to a function which you specify upon construction
of this object.
@param attr Attribute for which the value has changed.
*/
virtual void onValueChange(Attribute *attr) {
ASSERT(attr->getAttributeType() == AttributeType::INT ||
attr->getAttributeType() == AttributeType::BOOL);
(*fnptr)(attr->getValueAsInt());
}
private:
fnPtrType fnptr;
};
class string_attrCB : public AttrCallback {
typedef void (*fnPtrType)(const wchar_t *);
public:
/**
Upon construction, you must specify which
function will be called when the value of
the attribute has indeed changed.
This is done using a pointer to the function.
The function must accept one parameter of type
int, like so: void myfunc(const char *val);
@param _fn Pointer to the function to use on value change.
*/
string_attrCB(fnPtrType _fn) { fnptr = _fn; }
/**
Event triggered when the value of the attribute,
for which this callback has been registered, changes.
Override this to implement your own behavior.
The default is to send the name of the attribute
to a function which you specify upon construction
of this object.
@param attr Attribute for which the value has changed.
*/
virtual void onValueChange(Attribute *attr)
{
ASSERT(attr->getAttributeType() == AttributeType::STRING);
(*fnptr)(attr->getAttributeName());
}
private:
fnPtrType fnptr;
};
#endif

View File

@ -0,0 +1,52 @@
#ifndef _ATTRFLOAT_H
#define _ATTRFLOAT_H
#include "attribute.h"
// actually it's a double :)
class _float : public Attribute {
public:
/**
Optionally set the name and default value of
your configuration attribute during construction.
@param name Name of the configuration attribute.
@param default_val Default value.
*/
_float(const wchar_t *name=NULL, double default_val=0.f) : Attribute(name) {
setValueAsDouble(default_val, true);
}
/**
Get the attribute type. This will return
a constant representing the attribute type.
These constants can be: BOOL, FLOAT, STRING and INT.
@see AttributeType
@ret The attribute type.
*/
virtual int getAttributeType() { return AttributeType::FLOAT; }
/**
Get the configuration group to be used to represent
this attribute in the registry.
@ret Config group to be used.
*/
virtual const wchar_t *getConfigGroup() { return L"studio.configgroup.float"; }
// convenience operators
/**
Get the value of the attribute.
*/
operator double() { return getValueAsDouble(); }
/**
Set the value of the attribute.
*/
double operator =(double newval) { return setValueAsDouble(newval) ? newval : getValueAsDouble(); }
};
#endif

View File

@ -0,0 +1,15 @@
#ifndef _ATTRFN_H
#define _ATTRFN_H
#include "attrstr.h"
class _filename : public _string {
public:
_filename(const wchar_t *name, const wchar_t *default_val=L"")
: _string(name, default_val) { }
virtual int getAttributeType() { return AttributeType::FILENAME; }
virtual const wchar_t *getConfigGroup() { return L"studio.configgroup.filename"; }
};
#endif

View File

@ -0,0 +1,129 @@
//!## An object to multiplex the callbacks of multiple attributes.
#ifndef _ATTRHANDLER_H
#define _ATTRHANDLER_H
// This class is meant to be subclassed. The methods you must provide
// are given as pure virtuals. See ExampleAttrib for more details, and
// an example subclass that you can copy for your own use.
#include "attrcb.h"
#include "attribs.h"
#include <bfc/map.h>
//
// Forward References
class WAComponentClient;
class Attribute;
//
// Class Definition
template <class TCallback>
class AttrHandler {
protected:
// Heh, oops. Can't have one AttrCallback handle lots of different attribs, anymore. I fix.
class AttrHandlerChild : public AttrCallback {
public:
AttrHandlerChild(AttrHandler *_parent) : AttrCallback() {
ASSERT(_parent != NULL);
recursion = 0;
callback = NULL;
parent = _parent;
}
// Here is where we split out the different value types
virtual void onValueChange(Attribute *attr) {
if (!recursion) {
// protect our programmers from stack overflow, please.
recursion = 1;
if ((callback != NULL) && (parent != NULL)) {
int id;
// find the id from the map (friendly)
int success = parent->attribmap.getItem(attr,&id);
if (success) {
// and send it to the proper handling function (poorman's RTTI)
switch (attr->getAttributeType()) {
case AttributeType::INT:
callback->onIntChange(id,*static_cast<_int *>(attr));
break;
case AttributeType::BOOL:
callback->onBoolChange(id, *static_cast<_bool *>(attr));
break;
case AttributeType::FLOAT:
callback->onFloatChange(id, *static_cast<_float *>(attr));
break;
case AttributeType::STRING:
callback->onStringChange(id, *static_cast<_string *>(attr));
break;
}
}
}
recursion = 0;
}
}
virtual void bindCallbackObj(TCallback *callbackobj) {
// Be advised, this may be null. That's okay, we test for it above.
callback = callbackobj;
}
private:
int recursion;
TCallback *callback;
AttrHandler *parent;
};
public:
AttrHandler() {
component = NULL;
callback = NULL;
}
// Call this method to bind your component (in your component's constructor)
virtual void bindComponent(WAComponentClient *parentcomponent) {
component = parentcomponent;
}
// Call this method to bind your callback object (usually your window in its constructor)
virtual void bindCallbackObj(TCallback *callbackobj) {
// Bind ourselves.
callback = callbackobj;
// Then go through and rebind any children.
int i, num = attrchildren.getNumItems();
for (i = 0; i < num; i++) {
AttrHandlerChild *child = attrchildren.enumItem(i);
child->bindCallbackObj(callback);
}
}
// Call this method to register each attribute.
virtual void registerAttribute(Attribute *attr, int id) {
ASSERTPR(component != NULL, "BIND YOUR COMPONENT before registering Attributes to a Handler.");
// register the attrib with a child object as its callback
AttrHandlerChild *child = new AttrHandlerChild(this);
attrchildren.addItem(child);
component->registerAttribute(attr, child);
// and save its id mapping
attribmap.addItem(attr, id);
}
#if 0
// Your callback object (probably your primary window class) must implement
// its own versions of these methods here. They will be called by the
// switch statement below.
virtual void onIntChange(int id, int *attr);
virtual void onBoolChange(int id, bool *attr);
virtual void onFloatChange(int id, double *attr);
virtual void onStringChange(int id, const char *attr);
#endif
private:
friend AttrHandlerChild;
TCallback *callback;
WAComponentClient *component;
Map< Attribute *, int > attribmap;
PtrList<AttrHandlerChild> attrchildren;
};
#endif // _ATTRHANDLER_H

View File

@ -0,0 +1,12 @@
#ifndef _ATTRIBS_H
#define _ATTRIBS_H
// a convenience header to get all the attrib types in one whack
#include "attrbool.h"
#include "attrfloat.h"
#include "attrint.h"
#include "attrstr.h"
#include "attrfn.h"
#endif

View File

@ -0,0 +1,131 @@
#include <precomp.h>
#include "attribute.h"
#include <api/config/items/cfgitemi.h>
Attribute::Attribute(const wchar_t *newname, const wchar_t *_desc) :
NamedW(newname), desc(_desc), cfgitemi(NULL), private_storage(NULL) { }
Attribute::~Attribute() {
delete private_storage;
}
const wchar_t *Attribute::getAttributeName() {
return NamedW::getName();
}
const wchar_t *Attribute::getAttributeDesc() {
return desc;
}
int Attribute::getValueAsInt()
{
wchar_t buf[1024]=L"";
getData(buf, 1024);
return WTOI(buf);
}
int Attribute::setValueAsInt(int newval, bool def)
{
return setData(StringPrintfW(newval), def);
}
double Attribute::getValueAsDouble()
{
wchar_t buf[1024] = {0};
getData(buf, 1024);
return WTOF(buf);
}
double Attribute::setValueAsDouble(double newval, bool def)
{
return setData(StringPrintfW(newval), def);
}
int Attribute::getDataLen() {
if (private_storage != NULL)
return (int)private_storage->len()+1;
ASSERTPR(WASABI_API_CONFIG != NULL, "getDataLen() before API");
int r = WASABI_API_CONFIG->getStringPrivateLen(mkTag());
if (r < 0) {
r = (int)default_val.len()+1;
}
return r;
}
int Attribute::getData(wchar_t *data, int data_len)
{
if (data == NULL || data_len < 0)
return 0;
if (private_storage != NULL)
{
if (private_storage->isempty())
{
if (data_len >= 1) {
*data = 0;
return 1;
}
return 0;
}
WCSCPYN(data, private_storage->getValue(), data_len);
return MIN((int)private_storage->len(), data_len);
}
ASSERTPR(WASABI_API_CONFIG != NULL, "can't get without api");
if (WASABI_API_CONFIG == NULL) return 0;
int r = WASABI_API_CONFIG->getStringPrivate(mkTag(), data, data_len, default_val.isempty() ? L"" : default_val.getValue());
return r;
}
int Attribute::setData(const wchar_t *data, bool def)
{
if (def) { // setting default value
default_val = data;
return 1;
}
ASSERTPR(WASABI_API_CONFIG != NULL, "can't set data before api");
if (WASABI_API_CONFIG == NULL) return 0;
int r = setDataNoCB(data);
if (r && cfgitemi != NULL) cfgitemi->cfgitem_onAttribSetValue(this);
return r;
}
int Attribute::setDataNoCB(const wchar_t *data)
{
if (private_storage != NULL) {
private_storage->setValue(data);
} else {
WASABI_API_CONFIG->setStringPrivate(mkTag(), data);
}
dependent_sendEvent(Attribute::depend_getClassGuid(), Event_DATACHANGE);
return 1;
}
void Attribute::setCfgItem(CfgItemI *item)
{
delete private_storage; private_storage = NULL;
ASSERT(cfgitemi == NULL || item == NULL);
cfgitemi = item;
if (cfgitemi != NULL)
{
if (cfgitemi->cfgitem_usePrivateStorage())
private_storage = new StringW;
}
}
StringW Attribute::mkTag()
{
StringW ret;
if (cfgitemi)
{
ret = cfgitemi->cfgitem_getPrefix();
}
ret.cat(getName());
return ret;
}
void Attribute::disconnect() {
setCfgItem(NULL);
}

View File

@ -0,0 +1,218 @@
#ifndef _ATTRIBUTE_H
#define _ATTRIBUTE_H
#include <bfc/depend.h>
#include <bfc/named.h>
#include <bfc/common.h>
#include <bfc/string/StringW.h>
class CfgItemI;
// lowercase types are reserved for official Nullsoft use
// uppercase are 3rd-party defined
namespace AttributeType {
/**
Attribute types.
*/
enum {
NONE = 0,
INT = MK3CC('i','n','t'), // attrint.h
STRING = MK3CC('s','t','r'), // attrstr.h
BOOL = MK4CC('b','o','o','l'), // attrbool.h
FLOAT = MK4CC('f','l','o','t'), // attrfloat.h
FILENAME = MK2CC('f','n'), // attrfn.h
};
};
/**
Generic configuration attribute.
Configuration attributes enable you to store
uniquely identifiable values that get pushed
to a configuration file automatically upon shutdown
of any Wasabi application.
You shouldn't normally use this on
it's own, look at the CfgItemI class
instead.
@short Generic configuration attribute.
@ver 1.0
@author Nullsoft
@see _float
@see _int
@see _bool
@see _string
@see CfgItemI
*/
class NOVTABLE Attribute : public DependentI, private NamedW
{
public:
static const GUID *depend_getClassGuid() {
// {5AB601D4-1628-4604-808A-7ED899849BEB}
static const GUID ret =
{ 0x5ab601d4, 0x1628, 0x4604, { 0x80, 0x8a, 0x7e, 0xd8, 0x99, 0x84, 0x9b, 0xeb } };
return &ret;
}
protected:
/**
Optionally set the name and default value of
your configuration attribute during construction.
@param name Name of the configuration attribute.
@param default_val Default value.
*/
Attribute(const wchar_t *name=NULL, const wchar_t *desc=NULL);
public:
virtual ~Attribute();
/**
Set the name of the configuration
attribute.
@param newname Name of the attribute.
*/
void setName(const wchar_t *newname);
/**
Get the name of the configuration
attribute.
@ret Name of the attribute.
*/
const wchar_t *getAttributeName();
/**
Get the attribute's description.
@ret Attribute's description.
*/
const wchar_t *getAttributeDesc();
/**
Get the attribute type. Override
this for your custom attribute type.
@ret Attribute type.
*/
virtual int getAttributeType()=0; // override me
/**
Get the configuration group to be used to represent
this attribute in the registry.
This is only called if the kernel doesn't have a default
config group set for your type already.
@ret Config group to be used.
*/
virtual const wchar_t *getConfigGroup() { return NULL; } // override me
/**
Get the attribute's value as signed integer.
@ret Attribute value, as a signed integer.
*/
int getValueAsInt();
/**
Set the attribute's value with a signed integer while
also being able to replace the default value previously
set.
@param newval Attribute's new value.
@param def true, replace the current default value; false, leave the default value unchanged;
*/
int setValueAsInt(int newval, bool def=false);
/**
Get the attribute's value as signed double.
@ret Attribute value, as a signed double.
*/
double getValueAsDouble();
/**
Set the attribute's value with a signed double while
also being able to replace the default value previously
set.
@param newval Attribute's new value.
@param def true, replace the current default value; false, leave the default value unchanged;
*/
double setValueAsDouble(double newval, bool def=false);
/**
Get the length of the attribute's value (data)
in bytes.
@ret Attribute value (data) length, in bytes.
*/
int getDataLen();
/**
Get the attribute's raw data.
This will return the data the attribute is storing
in a char buffer you hand to it.
@ret Attribute value, as a signed double.
@param data Pointer to a char buffer.
@param data_len The maximum amount of bytes the char buffer can hold.
*/
int getData(wchar_t *data, int data_len);
/**
Set the attribute's value with a zero terminated string. Also
enables you to replace the default value previously
set.
@param newval Attribute's new value.
@param def true, replace the current default value; false, leave the default value unchanged;
*/
int setData(const wchar_t *data, bool def=false);
void disconnect();
enum {
Event_DATACHANGE=100,
};
protected:
friend class CfgItemI;
/**
Set the attribute's value without causing
a callback.
@ret 1.
@param data Attribute's new value.
*/
int setDataNoCB(const wchar_t *data);
/**
Set the configuration item associated with this
attribute.
*/
void setCfgItem(CfgItemI *item);
StringW mkTag();
private:
StringW desc;
StringW default_val, *private_storage;
CfgItemI *cfgitemi;
};
#define ATTR_PERM_READ 1
#define ATTR_PERM_WRITE 2
#define ATTR_PERM_ALL (~0)
// render hints for getRenderHint
enum {
ATTR_RENDER_HINT_INT_CHECKMARK
};
#endif

View File

@ -0,0 +1,65 @@
#ifndef _ATTRINT_H
#define _ATTRINT_H
#include "attribute.h"
// inherit from this one, or just use it
/**
Boolean configuration attributes have two values, true or false.
They can be used like any other config item.
@short Integer configuration attribute.
@ver 1.0
@author Nullsoft
@see CfgItemI
@see _bool
@see _string
@see _float
*/
class _int : public Attribute {
public:
/**
Optionally set the name and default value of
your configuration attribute during construction.
@param name Name of the configuration attribute.
@param default_val Default value.
*/
_int(const wchar_t *name=NULL, int default_val=0) : Attribute(name) {
setValueAsInt(default_val, true);
}
// from AttributeI
/**
Get the attribute type. This will return
a constant representing the attribute type.
These constants can be: BOOL, FLOAT, STRING and INT.
@see AttributeType
@ret The attribute type.
*/
virtual int getAttributeType() { return AttributeType::INT; }
/**
Get the configuration group to be used to represent
this attribute in the registry.
@ret Config group to be used.
*/
virtual const wchar_t *getConfigGroup() { return L"studio.configgroup.int"; }
// virtual int getPermissions();
// convenience operators
/**
Get the value of the attribute.
*/
operator int() { return getValueAsInt(); }
/**
Set the value of the attribute.
*/
int operator =(int newval) { return setValueAsInt(newval) ? newval : getValueAsInt(); }
};
#endif

View File

@ -0,0 +1,14 @@
#include <precomp.h>
#include "attrstr.h"
#include <bfc/memblock.h>
const wchar_t *_string::getValue()
{
int l = getDataLen();
if (l <= 0) return L"";
MemBlock<wchar_t> mb(l+2);
getData(mb.getMemory(), l+2);
returnval = mb;
return returnval;
}

View File

@ -0,0 +1,85 @@
#ifndef _ATTRSTR_H
#define _ATTRSTR_H
#include "attribute.h"
#include <bfc/string/bfcstring.h>
#include <bfc/common.h>
/**
String configuration attributes, can have any string value
of any length. They can be used like any other config item.
@short String configuration attribute.
@ver 1.0
@author Nullsoft
@see _int
@see _bool
@see _float
*/
class _string : public Attribute {
public:
/**
Optionally set the name and default value of
your configuration attribute during construction.
@param name
@param default_val
*/
_string(const wchar_t *name=NULL, const wchar_t *default_val=NULL)
: Attribute(name) {
setData(default_val, true);
}
/**
Get the attribute type. This will return
a constant representing the attribute type.
These constants can be: BOOL, FLOAT, STRING and INT.
@see AttributeType
@ret The attribute type.
*/
virtual int getAttributeType() { return AttributeType::STRING; }
/**
Get the configuration group to be used to represent
this attribute in the registry.
@ret Config group to be used.
*/
virtual const wchar_t *getConfigGroup() { return L"studio.configgroup.string"; }
//CUT virtual int getPermissions() { return ATTR_PERM_ALL; }
/**
Get the value of the attribute.
@ret The value of the attribute
*/
const wchar_t *getValue();
/**
Set the value of the attribute.
@param val The value you want to set.
@ret 1, success; 0, failure;
*/
int setValue(const wchar_t *val) { return setData(val); }
// convenience operators
/**
Get the value of the attribute.
*/
operator const wchar_t *() { return getValue(); }
/**
Set the value of the attribute.
*/
const wchar_t *operator =(const wchar_t *newval) { return setValue(newval) ? newval : getValue(); }
private:
StringW returnval;
};
#endif

View File

@ -0,0 +1,233 @@
#ifndef _CFGITEM_H
#define _CFGITEM_H
#include <bfc/dispatch.h>
#include <bfc/platform/types.h>
#include <bfc/platform/guid.h>
#include <bfc/wasabi_std.h>
class ifc_dependent;
class ifc_window;
/* A CfgItem is a named, possibly unique (if GUID is set) interface to
an object with 0 or more named attributes. If offers api_dependent-based callbacks
when those attributes change.
*/
// abstract base class presented to the world
/**
@short Base Config Item
@ver 1.0
@author Nullsoft
@see CfgItemI
*/
class NOVTABLE CfgItem : public Dispatchable
{
public:
/**
*/
static const GUID *depend_getClassGuid() {
// {B4BE480E-2005-457c-A445-294F12387E74}
static const GUID ret =
{ 0xb4be480e, 0x2005, 0x457c, { 0xa4, 0x45, 0x29, 0x4f, 0x12, 0x38, 0x7e, 0x74 } };
return &ret;
}
const wchar_t *getName();
/**
Get the GUID
*/
GUID getGuid();
/**
Get the number of attributes
associated with this configuration
item.
@ret Number of attributes for this configuration item.
*/
int getNumAttributes();
const wchar_t *enumAttribute(int n);
// so people can watch you for changes
ifc_dependent *getDependencyPtr();
// return * to your config xml if you want to specify it
const wchar_t *getConfigXML();
void onCfgGroupCreate(ifc_window *cfggroup, const wchar_t *attrname=NULL);
void onCfgGroupDelete(ifc_window *cfggroup);
// if you have child cfgitems, list them here
int getNumChildren();
CfgItem *enumChild(int n);
GUID getParentGuid();
void onRegister(); // kernel calls these
void onDeregister();
int getAttributeType(const wchar_t *name);
const wchar_t *getAttributeConfigGroup(const wchar_t *name);
int getDataLen(const wchar_t *name);
int getData(const wchar_t *name, wchar_t *data, int data_len);
int setData(const wchar_t *name, const wchar_t *data);
int getDataAsInt(const wchar_t *name, int def_val=0)
{
wchar_t buf[256];
if (getData(name, buf, sizeof(buf))==-1) return def_val;
return WTOI(buf);
}
void setDataAsInt(const wchar_t *name, int val) {
wchar_t buf[256];
WCSNPRINTF(buf, 256, L"%d", val); // this uses SPRINTF ON PURPOSE, motherfucker BU
setData(name, buf);
}
double getDataAsFloat(const wchar_t *name, double def_val=0) {
wchar_t buf[256];
if (getData(name, buf, sizeof(buf))==-1) return def_val;
return WTOF(buf);
}
void setDataAsFloat(const wchar_t *name, double val) {
wchar_t buf[256];
WCSNPRINTF(buf, 256, L"%f", val); // this uses SPRINTF ON PURPOSE, motherfucker BU
setData(name, buf);
}
int addAttribute(const wchar_t *name, const wchar_t *defval);
int delAttribute(const wchar_t *name);
enum {
Event_ATTRIBUTE_ADDED=100, // ptr is name of attrib
Event_ATTRIBUTE_REMOVED=200,// ptr is name of attrib
Event_ATTRIBUTE_CHANGED=300, // ptr is name of attrib
Event_NAMECHANGE=400,
};
protected:
enum {
CFGITEM_GETNAME=100,
CFGITEM_GETGUID=110,
CFGITEM_GETNUMATTRIBUTES=200,
CFGITEM_ENUMATTRIBUTE=210,
CFGITEM_GETDEPENDENCYPTR=300,
CFGITEM_GETNUMCHILDREN=400,
CFGITEM_ENUMCHILD=410,
CFGITEM_GETPARENTGUID=420,
CFGITEM_ONREGISTER=500,
CFGITEM_ONDEREGISTER=510,
CFGITEM_GETCONFIGXML=600,
CFGITEM_ONCFGGROUPCREATE=610,
CFGITEM_ONCFGGROUPDELETE=620,
CFGITEM_GETATTRIBUTETYPE=700,
CFGITEM_GETATTRIBUTECONFIGGROUP=710,
CFGITEM_GETDATALEN=800,
CFGITEM_GETDATA=810,
CFGITEM_SETDATA=820,
CFGITEM_ADDATTRIB=830,
CFGITEM_DELATTRIB=840,
};
};
inline const wchar_t *CfgItem::getName() {
return _call(CFGITEM_GETNAME, L"");
}
inline GUID CfgItem::getGuid() {
return _call(CFGITEM_GETGUID, INVALID_GUID);
}
inline int CfgItem::getNumAttributes() {
return _call(CFGITEM_GETNUMATTRIBUTES, 0);
}
inline const wchar_t *CfgItem::enumAttribute(int n) {
return _call(CFGITEM_ENUMATTRIBUTE, (const wchar_t *)NULL, n);
}
inline ifc_dependent *CfgItem::getDependencyPtr() {
return _call(CFGITEM_GETDEPENDENCYPTR, (ifc_dependent*)NULL);
}
inline const wchar_t *CfgItem::getConfigXML() {
return _call(CFGITEM_GETCONFIGXML, (const wchar_t*)NULL);
}
inline void CfgItem::onCfgGroupCreate(ifc_window *cfggroup, const wchar_t *attrname) {
_voidcall(CFGITEM_ONCFGGROUPCREATE, cfggroup, attrname);
}
inline void CfgItem::onCfgGroupDelete(ifc_window *cfggroup) {
_voidcall(CFGITEM_ONCFGGROUPDELETE, cfggroup);
}
inline int CfgItem::getNumChildren() {
return _call(CFGITEM_GETNUMCHILDREN, 0);
}
inline CfgItem *CfgItem::enumChild(int n) {
return _call(CFGITEM_ENUMCHILD, (CfgItem*)NULL, n);
}
inline
GUID CfgItem::getParentGuid() {
return _call(CFGITEM_GETPARENTGUID, INVALID_GUID);
}
inline void CfgItem::onRegister() { _voidcall(CFGITEM_ONREGISTER); }
inline void CfgItem::onDeregister() { _voidcall(CFGITEM_ONDEREGISTER); }
inline
int CfgItem::getAttributeType(const wchar_t *name) {
return _call(CFGITEM_GETATTRIBUTETYPE, 0, name);
}
inline
const wchar_t *CfgItem::getAttributeConfigGroup(const wchar_t *name) {
return _call(CFGITEM_GETATTRIBUTECONFIGGROUP, (const wchar_t *)NULL, name);
}
inline
int CfgItem::getDataLen(const wchar_t *name) {
return _call(CFGITEM_GETDATALEN, -1, name);
}
inline
int CfgItem::getData(const wchar_t *name, wchar_t *data, int data_len) {
return _call(CFGITEM_GETDATA, -1, name, data, data_len);
}
inline
int CfgItem::setData(const wchar_t *name, const wchar_t *data) {
return _call(CFGITEM_SETDATA, -1, name, data);
}
inline
int CfgItem::addAttribute(const wchar_t *name, const wchar_t *defval) {
return _call(CFGITEM_ADDATTRIB, 0, name, defval);
}
inline
int CfgItem::delAttribute(const wchar_t *name) {
return _call(CFGITEM_DELATTRIB, 0, name);
}
inline int _intVal(CfgItem *cfgitem, const wchar_t *name, int def_val=0) {
if (cfgitem == NULL) return def_val;
return cfgitem->getDataAsInt(name, def_val);
}
#define _int_getValue _intVal
//CUT kill these
inline void _int_setValue(CfgItem *cfgitem, const wchar_t *name, int val) {
cfgitem->setDataAsInt(name, val);
}
// CfgItemI is in cfgitemi.h if you need it
#endif

View File

@ -0,0 +1,274 @@
#include <precomp.h>
#include "cfgitemi.h"
#include <api/config/items/attrcb.h>
#include <api/config/items/attribs.h>
#include <bfc/wasabi_std.h>
#include <bfc/memblock.h>
CfgItemI::CfgItemI(const wchar_t *name, GUID guid)
:NamedW(name), myguid(guid), parent_guid(INVALID_GUID) { }
CfgItemI::~CfgItemI()
{
deregisterAll();
}
const wchar_t *CfgItemI::cfgitem_getName()
{
return NamedW::getName();
}
GUID CfgItemI::cfgitem_getGuid()
{
return myguid;
}
void CfgItemI::cfgitem_setPrefix(const wchar_t *_prefix)
{
prefix = _prefix;
}
const wchar_t *CfgItemI::cfgitem_getPrefix()
{
return prefix.c_str();
}
int CfgItemI::cfgitem_getNumAttributes()
{
return attributes.getNumItems();
}
const wchar_t *CfgItemI::cfgitem_enumAttribute(int n)
{
Attribute *attr = attributes[n];
if (attr) return attr->getAttributeName();
return NULL;
}
const wchar_t *CfgItemI::cfgitem_getConfigXML()
{
return cfgxml.c_str();
}
int CfgItemI::cfgitem_getNumChildren()
{
return children.getNumItems();
}
CfgItem *CfgItemI::cfgitem_enumChild(int n)
{
return children[n];
}
GUID CfgItemI::cfgitem_getParentGuid()
{
return parent_guid;
}
void CfgItemI::cfgitem_onRegister()
{
foreach(children)
WASABI_API_CONFIG->config_registerCfgItem(children.getfor());
endfor
}
void CfgItemI::cfgitem_onDeregister()
{
foreach(children)
WASABI_API_CONFIG->config_deregisterCfgItem(children.getfor());
endfor
}
Attribute *CfgItemI::getAttributeByName(const wchar_t *name)
{
Attribute *attr;
foreach(attributes)
attr = attributes.getfor();
if (!WCSICMP(name, attr->getAttributeName())) return attr;
endfor
return NULL;
}
int CfgItemI::cfgitem_getAttributeType(const wchar_t *name)
{
Attribute *attr = getAttributeByName(name);
if (attr == NULL) return AttributeType::NONE;
return attr->getAttributeType();
}
const wchar_t *CfgItemI::cfgitem_getAttributeConfigGroup(const wchar_t *name)
{
Attribute *attr = getAttributeByName(name);
if (attr == NULL) return NULL;
return attr->getConfigGroup();
}
int CfgItemI::cfgitem_getDataLen(const wchar_t *name)
{
Attribute *attr = getAttributeByName(name);
if (attr == NULL) return -1;
return attr->getDataLen();
}
int CfgItemI::cfgitem_getData(const wchar_t *name, wchar_t *data, int data_len)
{
Attribute *attr = getAttributeByName(name);
if (attr == NULL) return -1;
return attr->getData(data, data_len);
}
int CfgItemI::cfgitem_setData(const wchar_t *name, const wchar_t *data)
{
Attribute *attr = getAttributeByName(name);
if (attr == NULL) return -1;
int ret = attr->setDataNoCB(data);
if (ret) cfgitem_onAttribSetValue(attr);
return ret;
}
int CfgItemI::cfgitem_onAttribSetValue(Attribute *attr)
{
// notify dependency watchers that an attribute changed
dependent_sendEvent(CfgItem::depend_getClassGuid(), Event_ATTRIBUTE_CHANGED, 0, (void*)attr->getAttributeName());
//for (int i = 0; ; i++)
//{
// AttrCallback *acb;
// if (!callbacks.multiGetItem(attr, i, &acb))
// break;
//
// acb->onValueChange(attr);
//}
auto elements = callbacks.equal_range(attr);
for (auto& it = elements.first; it != elements.second; ++it)
{
AttrCallback* acb = it->second;
if (acb)
{
acb->onValueChange(attr);
}
}
return 0;
}
void CfgItemI::cfgitem_setGUID(GUID guid)
{
myguid = guid;
}
int CfgItemI::setName(const wchar_t *name)
{
NamedW::setName(name);
// notify dependency watchers that name changed?
dependent_sendEvent(CfgItem::depend_getClassGuid(), Event_NAMECHANGE);
return 1;
}
int CfgItemI::registerAttribute(Attribute *attr, AttrCallback *acb)
{
if (attributes.haveItem(attr)) return 0;
int ret = attributes.addItem(attr) != NULL;
if (!ret) return ret;
attr->setCfgItem(this);
// set optional callback
if (acb != NULL)
{
addCallback(attr, acb);
}
// notify dependency watchers of new attribute
dependent_sendEvent(CfgItem::depend_getClassGuid(), Event_ATTRIBUTE_ADDED, 0, (void*)attr->getAttributeName());
return ret;
}
int CfgItemI::deregisterAttribute(Attribute *attr)
{
if (!attributes.haveItem(attr)) return 0;
int ret = attributes.removeItem(attr);
// notify dependency watchers of attribute going away
dependent_sendEvent(CfgItem::depend_getClassGuid(), Event_ATTRIBUTE_REMOVED, 0, (void*)attr->getAttributeName());
// remove callbacks
//callbacks.multiDelAllForItem(attr, TRUE);
auto elements = callbacks.equal_range(attr);
for (auto& it = elements.first; it != elements.second; ++it)
{
AttrCallback* acb = it->second;
if (acb)
{
delete acb;
}
}
callbacks.erase(attr);
attr->disconnect();
return ret;
}
void CfgItemI::addCallback(Attribute *attr, AttrCallback *acb)
{
ASSERT(attr != NULL);
ASSERT(acb != NULL);
//callbacks.multiAddItem(attr, acb);
callbacks.insert({ attr, acb });
}
void CfgItemI::deregisterAll()
{
foreach(children)
children.getfor()->deregisterAll();
endfor
while (attributes.getNumItems()) deregisterAttribute(attributes[0]);
}
void CfgItemI::addChildItem(CfgItemI *child)
{
ASSERT(child != NULL);
if (!children.haveItem(child))
{
children.addItem(child);
child->setParentGuid(myguid);
}
}
void CfgItemI::setCfgXml(const wchar_t *groupname)
{
cfgxml = groupname;
}
void CfgItemI::setParentGuid(GUID guid)
{
parent_guid = guid;
}
void *CfgItemI::dependent_getInterface(const GUID *classguid)
{
HANDLEGETINTERFACE(CfgItem);
return NULL;
}
int CfgItemI::cfgitem_addAttribute(const wchar_t *name, const wchar_t *defval)
{
if (getAttributeByName(name)) return 0;
registerAttribute(newattribs.addItem(new _string(name, defval)));
return 1;
}
int CfgItemI::cfgitem_delAttribute(const wchar_t *name)
{
Attribute *attr = getAttributeByName(name);
if (!newattribs.haveItem(attr)) return 0;
deregisterAttribute(attr);
delete attr;
newattribs.removeItem(attr);
return 1;
}

View File

@ -0,0 +1,158 @@
#ifndef _CFGITEMI_H
#define _CFGITEMI_H
#include "cfgitemx.h"
#include <bfc/named.h>
#include <bfc/ptrlist.h>
#include <bfc/depend.h>
#include <map>
#include <string>
class AttrCallback;
class Attribute;
// this is the one you inherit from/use
/**
@short Configuration Item
@ver 1.0
@author Nullsoft
@see Attribute
@see _bool
@see _int
@see _float
@see _string
*/
class CfgItemI : public CfgItemX, public DependentI, private NamedW
{
public:
/**
Optionally sets the name and the GUID of the
configuration item if they are specified
upon creation of the object.
@param name Name of the configuration item.
@param guid GUID of the configuration item.
*/
CfgItemI(const wchar_t *name=NULL, GUID guid=INVALID_GUID);
/**
Does nothing.
*/
virtual ~CfgItemI();
/**
Get the name of the configuration item.
@ret Name of the configuration item.
*/
const wchar_t *cfgitem_getName();
/**
Get the GUID of the configuration item.
@ret GUID of the configuration item.
*/
GUID cfgitem_getGuid();
/**
Sets the prefix to be prepended in the config file for all attributes
of this item.
@see cfgitem_getPrefix
@param prefix The prefix.
*/
void cfgitem_setPrefix(const wchar_t *prefix);
/**
Gets the config prefix, if any was set.
@see cfgitem_setPrefix
@ret Pointer to the config prefix.
*/
const wchar_t *cfgitem_getPrefix();
/**
Get the number of attributes registered
to this configuration item.
@ret Number of attributes.
*/
int cfgitem_getNumAttributes();
/**
Enumerate the attributes registered
with this configuration item.
@ret
*/
const wchar_t *cfgitem_enumAttribute(int n);
const wchar_t *cfgitem_getConfigXML();
virtual void cfgitem_onCfgGroupCreate(ifc_window *cfggroup, const wchar_t *attrname) {}
virtual void cfgitem_onCfgGroupDelete(ifc_window *cfggroup) {}
virtual int cfgitem_getNumChildren();
virtual CfgItem *cfgitem_enumChild(int n);
virtual GUID cfgitem_getParentGuid();
virtual void cfgitem_onRegister();
virtual void cfgitem_onDeregister();
int cfgitem_getAttributeType(const wchar_t *name);
const wchar_t *cfgitem_getAttributeConfigGroup(const wchar_t *name);
int cfgitem_getDataLen(const wchar_t *name);
int cfgitem_getData(const wchar_t *name, wchar_t *data, int data_len);
int cfgitem_setData(const wchar_t *name, const wchar_t *data);
// override these to catch notifications from attribs, call down
virtual int cfgitem_onAttribSetValue(Attribute *attr);
virtual int cfgitem_usePrivateStorage() { return 0; } //override and return 1 to keep stuff out of system settings
protected:
void cfgitem_setGUID(GUID guid);
public:
int setName(const wchar_t *name);
int registerAttribute(Attribute *attr, AttrCallback *acb=NULL);
// does not call delete on the attribute
int deregisterAttribute(Attribute *attr);
void deregisterAll();
void addCallback(Attribute *attr, AttrCallback *acb);
int cfgitem_addAttribute(const wchar_t *name, const wchar_t *defval);
int cfgitem_delAttribute(const wchar_t *name);
protected:
// derived classes can override this to catch name changes
virtual void cfgitem_onSetName() { }
Attribute *getAttributeByName(const wchar_t *name);
void addChildItem(CfgItemI *child);
void setCfgXml(const wchar_t *groupname);
void setParentGuid(GUID guid);
private:
api_dependent *cfgitem_getDependencyPtr() { return this; };
virtual void *dependent_getInterface(const GUID *classguid);
// from Named
virtual void onSetName() { cfgitem_onSetName(); }
std::wstring prefix;
PtrList<Attribute> attributes;
std::multimap<Attribute*, AttrCallback*> callbacks; //CUT
PtrList<CfgItemI> children;
std::wstring cfgxml;
GUID myguid, parent_guid;
PtrList<Attribute> newattribs;
};
#endif

View File

@ -0,0 +1,27 @@
#include <precomp.h>
#include "cfgitemx.h"
#define CBCLASS CfgItemX
START_DISPATCH
CB(CFGITEM_GETNAME, cfgitem_getName);
CB(CFGITEM_GETGUID, cfgitem_getGuid);
CB(CFGITEM_GETNUMATTRIBUTES, cfgitem_getNumAttributes);
CB(CFGITEM_ENUMATTRIBUTE, cfgitem_enumAttribute);
CB(CFGITEM_GETCONFIGXML, cfgitem_getConfigXML);
VCB(CFGITEM_ONCFGGROUPCREATE, cfgitem_onCfgGroupCreate);
VCB(CFGITEM_ONCFGGROUPDELETE, cfgitem_onCfgGroupDelete);
CB(CFGITEM_GETNUMCHILDREN, cfgitem_getNumChildren);
CB(CFGITEM_ENUMCHILD, cfgitem_enumChild);
CB(CFGITEM_GETPARENTGUID, cfgitem_getParentGuid);
VCB(CFGITEM_ONREGISTER, cfgitem_onRegister);
VCB(CFGITEM_ONDEREGISTER, cfgitem_onDeregister);
CB(CFGITEM_GETATTRIBUTETYPE, cfgitem_getAttributeType);
CB(CFGITEM_GETATTRIBUTECONFIGGROUP, cfgitem_getAttributeConfigGroup);
CB(CFGITEM_GETDATALEN, cfgitem_getDataLen);
CB(CFGITEM_GETDATA, cfgitem_getData);
CB(CFGITEM_SETDATA, cfgitem_setData);
CB(CFGITEM_GETDEPENDENCYPTR, cfgitem_getDependencyPtr);
CB(CFGITEM_ADDATTRIB, cfgitem_addAttribute);
CB(CFGITEM_DELATTRIB, cfgitem_delAttribute);
END_DISPATCH
#undef CBCLASS

View File

@ -0,0 +1,42 @@
#ifndef NULLSOFT_WASABI_CFGITEMX_H
#define NULLSOFT_WASABI_CFGITEMX_H
#include "cfgitem.h"
class CfgItemX : public CfgItem
{
public:
virtual ~CfgItemX() {}
virtual const wchar_t *cfgitem_getName()=0;
virtual GUID cfgitem_getGuid()=0;
virtual int cfgitem_getNumAttributes()=0;
virtual const wchar_t *cfgitem_enumAttribute(int n)=0;
virtual const wchar_t *cfgitem_getConfigXML()=0;
virtual void cfgitem_onCfgGroupCreate(ifc_window *cfggroup, const wchar_t *attrname)=0;
virtual void cfgitem_onCfgGroupDelete(ifc_window *cfggroup)=0;
virtual int cfgitem_getNumChildren()=0;
virtual CfgItem *cfgitem_enumChild(int n)=0;
virtual GUID cfgitem_getParentGuid()=0;
virtual void cfgitem_onRegister()=0;
virtual void cfgitem_onDeregister()=0;
virtual int cfgitem_getAttributeType(const wchar_t *name)=0;
virtual const wchar_t *cfgitem_getAttributeConfigGroup(const wchar_t *name)=0;
virtual int cfgitem_getDataLen(const wchar_t *name)=0;
virtual int cfgitem_getData(const wchar_t *name, wchar_t *data, int data_len)=0;
virtual int cfgitem_setData(const wchar_t *name, const wchar_t *data)=0;
virtual ifc_dependent *cfgitem_getDependencyPtr()=0;
virtual int cfgitem_delAttribute(const wchar_t *name)=0;
virtual int cfgitem_addAttribute(const wchar_t *name, const wchar_t *defval)=0;
protected:
RECVS_DISPATCH;
};
#endif

View File

@ -0,0 +1,49 @@
#include <precomp.h>
#include "intarray.h"
enum { MAX_ARRAY=8 };
int IntArray::read(const wchar_t *name, int *x1, int *x2, int *x3, int *x4, int *x5, int *x6, int *x7, int *x8) {
PtrList<int> list;
if (x1) { list.addItem(x1); }
if (x2) { list.addItem(x2); }
if (x3) { list.addItem(x3); }
if (x4) { list.addItem(x4); }
if (x5) { list.addItem(x5); }
if (x6) { list.addItem(x6); }
if (x7) { list.addItem(x7); }
if (x8) { list.addItem(x8); }
ASSERT(list.getNumItems() >= 1);
int array[MAX_ARRAY]; // gcc rules, msvc drools
for (int i = 0; i < list.getNumItems(); i++) {
if (list[i]) array[i] = *list[i];
}
if (!WASABI_API_CONFIG->getIntArrayPrivate(name, array, list.getNumItems())) return 0;
for (int j = 0; j < list.getNumItems(); j++) {
if (list[j]) *list[j] = array[j];
}
return 1;
}
void IntArray::write(const wchar_t *name, int x1) {
int array[] = { x1 };
WASABI_API_CONFIG->setIntArrayPrivate(name, array, sizeof(array)/sizeof(int));
}
void IntArray::write(const wchar_t *name, int x1, int x2) {
int array[] = { x1, x2 };
WASABI_API_CONFIG->setIntArrayPrivate(name, array, sizeof(array)/sizeof(int));
}
void IntArray::write(const wchar_t *name, int x1, int x2, int x3) {
int array[] = { x1, x2, x3 };
WASABI_API_CONFIG->setIntArrayPrivate(name, array, sizeof(array)/sizeof(int));
}
void IntArray::write(const wchar_t *name, int x1, int x2, int x3, int x4) {
int array[] = { x1, x2, x3, x4 };
WASABI_API_CONFIG->setIntArrayPrivate(name, array, sizeof(array)/sizeof(int));
}

View File

@ -0,0 +1,18 @@
#ifndef _INTARRAY_H
#define _INTARRAY_H
#include <bfc/common.h>
#include <bfc/named.h>
#include <bfc/ptrlist.h>
class IntArray
{
public:
static int read(const wchar_t *name, int *x1, int *x2=NULL, int *x3=NULL, int *x4=NULL, int *x5=NULL, int *x6=NULL, int *x7=NULL, int *x8=NULL);
static void write(const wchar_t *name, int x1);
static void write(const wchar_t *name, int x1, int x2);
static void write(const wchar_t *name, int x1, int x2, int x3);
static void write(const wchar_t *name, int x1, int x2, int x3, int x4);
};
#endif

View File

@ -0,0 +1,211 @@
#include <precomp.h>
#include "options.h"
//#include <api/wac/main.h>//CUT!!
#include <api/wnd/wndtrack.h>
#include <bfc/util/inifile.h>
#include <api/config/items/attribs.h>
#include <api/config/items/attrcb.h>
#include <bfc/wasabi_std_wnd.h>
#include <api/locales/localesmgr.h>
#include <api/font/font.h>
#define ININAME "wasabi.ini"
// {280876CF-48C0-40bc-8E86-73CE6BB462E5}
const GUID options_guid =
{ 0x280876cf, 0x48c0, 0x40bc, { 0x8e, 0x86, 0x73, 0xce, 0x6b, 0xb4, 0x62, 0xe5 } };
#ifndef GEN_FF
static void setMultipleInstance(int val)
{
StringPrintf fn("%s%s%s", WASABI_API_APP->path_getAppPath(), DIRCHARSTR, ININAME);
IniFile(fn).setBool("Wasabi", "MultipleInstance", val);
}
_int forward_skip_time("Forward skip time", 5000);
_int reverse_skip_time("Reverse skip time", 5000);
#endif
_bool cfg_options_altfonts(L"Alternate Fonts", FALSE);
_bool cfg_options_allowbitmapfonts(L"Use bitmap fonts (no international support)", FALSE);
_string cfg_options_defaultfont(L"Default font", WASABI_DEFAULT_FONTNAMEW L".ttf");
_int cfg_options_defaultfontscale(L"Default font scale", 100);
_string cfg_options_ttfoverridefont(L"TTF font override", WASABI_DEFAULT_FONTNAMEW L".ttf");
_int cfg_options_ttfoverridescale(L"TTF Override Scale", 100);
_bool cfg_options_no7bitsttfoverride(L"No 7-bit TTF override", TRUE);
_bool cfg_options_noalt7bitsttfoverride(L"No 7-bit TTF AltFonts", TRUE);
_bool cfg_options_usefontmapper(L"Enable Font Mapper", FALSE);
#ifdef USEAPPBAR
_bool cfg_options_appbarondrag(L"Dock Appbars on Window Drag", FALSE);
_int cfg_options_appbardockingdistance(L"Appbars Docking Distance", 5);
#endif
void invalidateAll(int b) {
#ifdef WASABI_COMPILE_WNDMGR
WASABI_API_WNDMGR->wndTrackInvalidateAll();
#endif
}
void onDefaultFontChanged(const wchar_t *attribute) {
Font::uninstallAll(1);
Wasabi::Std::setDefaultFont(cfg_options_defaultfont.getValue());
invalidateAll(1);
}
void onOverrideFontChanged(const wchar_t *attribute) {
Font::uninstallAll(1);
invalidateAll(1);
}
void onDefaultFontScaleChanged(int scale) {
Wasabi::Std::setDefaultFontScale(scale);
invalidateAll(1);
}
void onOverrideFontScaleChanged(int scale) {
invalidateAll(1);
}
void onFontRendererChanged(const wchar_t *s) {
Font::uninstallAll(1);
invalidateAll(1);
}
void onFontMapperChanged(int b) {
Font::uninstallAll(1);
invalidateAll(1);
}
_bool cfg_audiooptions_crossfader(L"Enable crossfading", DEFAULT_CROSSFADE_ENABLED);
_bool cfg_options_alwaysontop(L"Always on top", FALSE);
_bool cfg_options_docking(L"Enable docking", TRUE);
_int cfg_options_dockingdistance(L"Docking distance", DEFAULT_DOCK_DIST);
_string cfg_options_fontrenderer(L"Font Renderer", WASABI_FONT_RENDERER);
_int cfg_options_freetypecharmap(L"Character mapping", -1);
Options::Options() : CfgItemI(L"Options", options_guid)
{
#ifdef _WASABIRUNTIME
registerAttribute(&cfg_options_alwaysontop, new int_attrCB(Main::setOnTop));
#else
extern void setOnTop(int ontop);
registerAttribute(&cfg_options_alwaysontop, new int_attrCB(setOnTop));
#endif
/* TODO: benski> move to wndmgr.w5s (or wherever it's final home is */
registerAttribute(&cfg_options_dockingdistance, new int_attrCB(WindowTracker::setDockDistance));
registerAttribute(&cfg_options_docking, new int_attrCB(WindowTracker::setEnableDocking));
/* --- END TO MOVE --- */
registerAttribute(new _bool(L"Find open rect", FALSE));
registerAttribute(new _bool(L"Animated rects", TRUE));
registerAttribute(&cfg_options_fontrenderer, new string_attrCB(onFontRendererChanged));
registerAttribute(&cfg_options_allowbitmapfonts, new int_attrCB(invalidateAll));
registerAttribute(&cfg_options_altfonts, new int_attrCB(invalidateAll));
registerAttribute(&cfg_options_defaultfont, new string_attrCB(onDefaultFontChanged));
registerAttribute(&cfg_options_ttfoverridefont, new string_attrCB(onOverrideFontChanged));
registerAttribute(&cfg_options_ttfoverridescale, new int_attrCB(onOverrideFontScaleChanged));
registerAttribute(&cfg_options_defaultfontscale, new int_attrCB(onDefaultFontScaleChanged));
registerAttribute(&cfg_options_freetypecharmap, new int_attrCB(invalidateAll));
registerAttribute(&cfg_options_no7bitsttfoverride, new int_attrCB(invalidateAll));
registerAttribute(&cfg_options_noalt7bitsttfoverride, new int_attrCB(invalidateAll));
registerAttribute(&cfg_options_usefontmapper, new int_attrCB(onFontMapperChanged));
#ifdef USEAPPBAR
registerAttribute(&cfg_options_appbarondrag);
registerAttribute(&cfg_options_appbardockingdistance);
#endif
#ifdef _WASABIRUNTIME
registerAttribute(new _bool(L"Allow multiple instances", FALSE), new int_attrCB(setMultipleInstance));
registerAttribute(new _int(L"Icon mode", 1), new int_attrCB(Main::setIconMode));
registerAttribute(new _bool(L"Auto-play at startup", FALSE));
registerAttribute(new _string(L"Language", "English"), new LanguageCB(this));
#ifdef WIN32
registerAttribute(new _bool("Associate with audio CDs", TRUE), new int_attrCB(Filetypes::registerCdPlayer));
#endif
registerAttribute(new _string("Monitor aspect ratio", "4:3"));
registerAttribute(new _int("Internet connection",3)); //3==autodetect
registerAttribute(&forward_skip_time);
registerAttribute(&reverse_skip_time);
#endif
//registerAttribute(new _bool("Use Mozilla instead of IE for minibrowser", FALSE)); // TODO:move into minibrowser component
/* registerAttribute(new _bool("Force antialias on all TTF", FALSE));*/
addChildItem(&audio_options);
addChildItem(&ui_options);
}
void Options::checkCd() {
#ifdef _WASABIRUNTIME
#ifdef WIN32
if(getDataAsInt("Associate with audio CDs") && !Filetypes::isCdPlayer()) setDataAsInt("Associate with audio CDs",false);
#endif
#endif
}
// {FC3EAF78-C66E-4ed2-A0AA-1494DFCC13FF}
static const GUID audio_options_guid =
{ 0xfc3eaf78, 0xc66e, 0x4ed2, { 0xa0, 0xaa, 0x14, 0x94, 0xdf, 0xcc, 0x13, 0xff } };
AudioOptions::AudioOptions() : CfgItemI(L"Audio options", audio_options_guid)
{
#ifdef GEN_FF
#ifdef WASABI_COMPILE_MEDIACORE
extern void setCrossfader(int crossfade);
registerAttribute(&cfg_audiooptions_crossfader, new int_attrCB(setCrossfader));
#endif
#endif
#ifdef _WASABIRUNTIME
registerAttribute(&cfg_audiooptions_crossfader);
int use_dsound=0;
#ifdef WIN32
//check for Windows version for whether we make DSOUND default
DWORD dwVersion = GetVersion();
DWORD dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
if (dwVersion < 0x80000000) {
if(dwWindowsMajorVersion<=4) use_dsound=0; // no dsound on NT4/3.51
else use_dsound=1; // dsound yes on 2000/XP
} else
use_dsound=0; // no dsound by default on win9x (per PP)
#endif
registerAttribute(new _bool("DirectSound output", use_dsound));
#endif
}
#ifdef _WASABIRUNTIME
// {C1BD5354-5EC4-406c-B5C0-549718D3AF45}
static const GUID setup_guid =
{ 0xc1bd5354, 0x5ec4, 0x406c, { 0xb5, 0xc0, 0x54, 0x97, 0x18, 0xd3, 0xaf, 0x45 } };
SetupOptions::SetupOptions() : CfgItemI("Setup", setup_guid) {
#ifdef WIN32
addChildItem(&filetypes);
#endif
}
// {99CFD75C-1CA7-49e5-B8C0-7D78AA443C10}
static const GUID installed_guid =
{ 0x99cfd75c, 0x1ca7, 0x49e5, { 0xb8, 0xc0, 0x7d, 0x78, 0xaa, 0x44, 0x3c, 0x10 } };
InstalledComponents::InstalledComponents() : CfgItemI("Installed components", installed_guid) {
//CUT setCfgXml("config.components");
}
void LanguageCB::onValueChange(Attribute *attr) {
char bufero[WA_MAX_PATH]="";
attr->getData(bufero, WA_MAX_PATH-1);
const char *locname;
for(int i=0;locname=LocalesManager::enumLoadableLocales(i);i++) {
if (STRCASEEQLSAFE(bufero, locname)) {
LocalesManager::setNewLocaleNum(i);
return;
}
}
WASABI_API_WNDMGR->messageBox(StringPrintf("Internal problem switching to language %s, the language name couldn't be found in the list of loaded resources", bufero), "Error", 0, NULL, NULL);
}
#endif

View File

@ -0,0 +1,64 @@
#ifndef _OPTIONS_H
#define _OPTIONS_H
#include <api/config/items/cfgitemi.h>
#include <api/config/items/attrcb.h>
//#include <api/config/filetypes.h>
#include <api/config/uioptions.h>
class Options;
class _string;
class _int;
class _bool;
extern _string cfg_options_defaultfont;
extern _int cfg_options_ttfoverridescale;
extern _bool cfg_options_no7bitsttfoverride;
extern _bool cfg_options_allowbitmapfonts;
extern _string cfg_options_fontrenderer;
#ifdef _WASABIRUNTIME
class SetupOptions : public CfgItemI {
public:
SetupOptions();
Filetypes filetypes;
};
class InstalledComponents : public CfgItemI {
public:
InstalledComponents();
};
#endif
class AudioOptions : public CfgItemI {
public:
AudioOptions();
};
#define OPTIONS_PARENT CfgItemI
class Options : public OPTIONS_PARENT {
public:
Options();
void checkCd();
AudioOptions audio_options;
UIOptions ui_options;
};
#ifdef _WASABIRUNTIME
class LanguageCB : public AttrCallback {
public:
LanguageCB(CfgItemI *_par) : par(_par) { }
virtual void onValueChange(Attribute *attr);
private:
CfgItemI *par;
};
#endif
#endif

View File

@ -0,0 +1,109 @@
#include <precomp.h>
#include "uioptions.h"
#include <api/wndmgr/layout.h>
#include <api/config/items/attribs.h>
#include <api/config/items/attrcb.h>
#include <api/skin/skinparse.h>
#include <api/wndmgr/alphamgr.h>
// {9149C445-3C30-4e04-8433-5A518ED0FDDE}
const GUID uioptions_guid =
{ 0x9149c445, 0x3c30, 0x4e04, { 0x84, 0x33, 0x5a, 0x51, 0x8e, 0xd0, 0xfd, 0xde } };
_bool cfg_uioptions_desktopalpha(L"Enable desktop alpha", DEFAULT_DESKTOPALPHA);
_bool cfg_uioptions_linkratio(L"Link layouts scale", DEFAULT_LINKLAYOUTSCALE);
_bool cfg_uioptions_linkalpha(L"Link layouts alpha", DEFAULT_LINKLAYOUTSALPHA);
_bool cfg_uioptions_linkallalpha(L"Link All layouts alpha", DEFAULT_LINKALLALPHA);
_bool cfg_uioptions_linkallratio(L"Link All layouts scale", DEFAULT_LINKALLRATIO);
_int cfg_uioptions_linkedalpha(L"Linked layouts alpha", DEFAULT_LINKEDALPHA);
_int cfg_uioptions_autoopacitytime(L"Auto Opacity hold time", DEFAULT_AUTOOPACITYTIME);
_int cfg_uioptions_autoopacityfadein(L"Auto Opacity fade in time", DEFAULT_AUTOOPACITYFADEIN);
_int cfg_uioptions_autoopacityfadeout(L"Auto Opacity fade out time", DEFAULT_AUTOOPACITYFADEOUT);
_int cfg_uioptions_autoopacitylinked(L"Use Auto Opacity", DEFAULT_AUTOOPACITYTYPE);
_int cfg_uioptions_extendautoopacity(L"Auto Opacity extend by", DEFAULT_EXTENDAUTOOPACITY);
_bool cfg_uioptions_uselocks(L"Use layout scale locks", DEFAULT_USERATIOLOCKS);
_int cfg_uioptions_timerresolution(L"Multiplexed timers resolution", DEFAULT_TIMERRESOLUTION);
_bool cfg_uioptions_tooltips(L"Enable tooltips", DEFAULT_TOOLTIPS);
_float cfg_uioptions_textspeed(L"Text Ticker Speed", DEFAULT_TEXTSPEED);
_int cfg_uioptions_textincrement(L"Text Ticker Increment", DEFAULT_TEXTINCREMENT);
_int cfg_uioptions_appbarshidetime(L"Appbar Hide Time", DEFAULT_APPBARHIDETIME);
_int cfg_uioptions_appbarsshowtime(L"Appbar Show Time", DEFAULT_APPBARSHOWTIME);
void onSetOpacityTime(int n) {
Layout *l = SkinParser::getMainLayout();
if (l) l->getAlphaMgr()->setHoldTime(n);
}
void onSetOpacityFadeIn(int n) {
Layout *l = SkinParser::getMainLayout();
if (l) l->getAlphaMgr()->setFadeInTime(n);
}
void onSetOpacityFadeOut(int n) {
Layout *l = SkinParser::getMainLayout();
if (l) l->getAlphaMgr()->setFadeOutTime(n);
}
void onSetAllRatio(int on) {
if (on) {
Layout *l = SkinParser::getMainLayout();
if (l) l->setRenderRatio(l->getRenderRatio());
}
}
void onSetAllAlpha(int on) {
Layout *l = SkinParser::getMainLayout();
if (l) l->getAlphaMgr()->setAllLinked(on);
}
void onSetLinkedAlpha(int a) {
Layout *l = SkinParser::getMainLayout();
if (l) l->getAlphaMgr()->setGlobalAlpha(a);
}
void onSetLinkedAuto100(int v) {
Layout *l = SkinParser::getMainLayout();
if (l) l->getAlphaMgr()->setAutoOpacify(v);
}
void onSetExtendAutoOpacity(int v) {
Layout *l = SkinParser::getMainLayout();
if (l) l->getAlphaMgr()->setExtendAutoOpacity(v);
}
UIOptions::UIOptions(const wchar_t *name) : CfgItemI(name ? name : L"Skins and UI Tweaks", uioptions_guid)
{
registerAttribute(&cfg_uioptions_linkratio);
registerAttribute(&cfg_uioptions_linkalpha);
registerAttribute(&cfg_uioptions_uselocks);
registerAttribute(&cfg_uioptions_autoopacitylinked, new int_attrCB(onSetLinkedAuto100));
registerAttribute(&cfg_uioptions_linkallratio, new int_attrCB(onSetAllRatio));
registerAttribute(&cfg_uioptions_linkallalpha, new int_attrCB(onSetAllAlpha));
registerAttribute(&cfg_uioptions_desktopalpha, new int_attrCB(Layout::onGlobalEnableDesktopAlpha));
registerAttribute(&cfg_uioptions_linkedalpha, new int_attrCB(onSetLinkedAlpha));
registerAttribute(&cfg_uioptions_tooltips);
registerAttribute(&cfg_uioptions_timerresolution);
registerAttribute(&cfg_uioptions_textspeed);
registerAttribute(&cfg_uioptions_textincrement);
registerAttribute(&cfg_uioptions_appbarshidetime);
registerAttribute(&cfg_uioptions_appbarsshowtime);
registerAttribute(&cfg_uioptions_autoopacitytime, new int_attrCB(onSetOpacityTime));
registerAttribute(&cfg_uioptions_autoopacityfadein, new int_attrCB(onSetOpacityFadeIn));
registerAttribute(&cfg_uioptions_autoopacityfadeout, new int_attrCB(onSetOpacityFadeOut));
registerAttribute(&cfg_uioptions_extendautoopacity, new int_attrCB(onSetExtendAutoOpacity));
registerAttribute(new _int(L"Timer refresh rate", 30), new int_attrCB(onTimerRefreshRate));
registerAttribute(new _int(L"Popup menu alpha", 240));
registerAttribute(new _int(L"Spectrum analyzer mode",1));
}
void UIOptions::onTimerRefreshRate(int rate) {
if(rate==0 || rate<9 || rate>70) return;
int res=1000/rate;
CfgItem *ci=WASABI_API_CONFIG->config_getCfgItemByGuid(uioptions_guid);
if(!ci) return;
ci->setDataAsInt(L"Multiplexed timers resolution",res);
}

View File

@ -0,0 +1,13 @@
#ifndef _UIOPTIONS_H
#define _UIOPTIONS_H
#include <api/config/items/cfgitemi.h>
#define UIOPTIONS_PARENT CfgItemI
class UIOptions : public UIOPTIONS_PARENT {
public:
UIOptions(const wchar_t *name=NULL);
static void onTimerRefreshRate(int rate);
};
#endif

View File

@ -0,0 +1,33 @@
#include "console.h"
#include <api/service/svcs/svc_console.h>
#include <api/service/svc_enum.h>
void Console::outputString(int severity, const char *string) {
if (!console) {
console = new ConsoleEnum;
}
if (needscan) {
needscan=0;
console->reset();
svc_console *con = console->getNext();
noconsole = (con == NULL);
}
if (noconsole) return;
console->reset();
svc_console *con = console->getNext();
while (con) {
con->outputString(severity, string);
con = console->getNext();
}
}
void Console::reset() {
needscan=1;
}
int Console::needscan=1;
int Console::noconsole=0;
ConsoleEnum *Console::console = NULL;

View File

@ -0,0 +1,19 @@
#ifndef __CONSOLE_H
#define __CONSOLE_H
class ConsoleEnum;
class Console {
public:
static void outputString(int severity, const char *string);
static void reset();
private:
static ConsoleEnum *console;
static int needscan;
static int noconsole;
};
#endif

View File

@ -0,0 +1,51 @@
#include <precomp.h>
#include "api_core.h"
#ifdef CBCLASS
#undef CBCLASS
#endif
#define CBCLASS api_coreI
START_DISPATCH;
CB(API_CORE_GETSUPPORTEDEXTENSIONS, core_getSupportedExtensions);
CB(API_CORE_GETEXTSUPPORTEDEXTENSIONS, core_getExtSupportedExtensions);
CB(API_CORE_CREATE, core_create);
CB(API_CORE_FREE, core_free);
CB(API_CORE_SETNEXTFILE, core_setNextFile);
CB(API_CORE_GETSTATUS, core_getStatus);
CB(API_CORE_GETCURRENT, core_getCurrent);
CB(API_CORE_GETCURPLAYBACKNUMBER, core_getCurPlaybackNumber);
CB(API_CORE_GETPOSITION, core_getPosition);
CB(API_CORE_GETWRITEPOSITION, core_getWritePosition);
CB(API_CORE_SETPOSITION, core_setPosition);
CB(API_CORE_GETLENGTH, core_getLength);
CB(API_CORE_GETPLUGINDATA, core_getPluginData);
CB(API_CORE_GETVOLUME, core_getVolume);
VCB(API_CORE_SETVOLUME, core_setVolume);
CB(API_CORE_GETPAN, core_getPan);
VCB(API_CORE_SETPAN, core_setPan);
VCB(API_CORE_ADDCALLBACK, core_addCallback);
VCB(API_CORE_DELCALLBACK, core_delCallback);
CB(API_CORE_GETVISDATA, core_getVisData);
CB(API_CORE_GETLEFTVUMETER, core_getLeftVuMeter);
CB(API_CORE_GETRIGHTVUMETER, core_getRightVuMeter);
CB(API_CORE_REGISTERSEQUENCER, core_registerSequencer);
CB(API_CORE_DEREGISTERSEQUENCER, core_deregisterSequencer);
VCB(API_CORE_USERBUTTON, core_userButton);
CB(API_CORE_GETEQSTATUS, core_getEqStatus);
VCB(API_CORE_SETEQSTATUS, core_setEqStatus);
CB(API_CORE_GETEQPREAMP, core_getEqPreamp);
VCB(API_CORE_SETEQPREAMP, core_setEqPreamp);
CB(API_CORE_GETEQBAND, core_getEqBand);
VCB(API_CORE_SETEQBAND, core_setEqBand);
CB(API_CORE_GETEQAUTO, core_getEqAuto);
VCB(API_CORE_SETEQAUTO, core_setEqAuto);
VCB(API_CORE_SETCUSTOMMSG, core_setCustomMsg);
VCB(API_CORE_REGISTEREXTENSION, core_registerExtension);
CB(API_CORE_GETEXTENSIONFAMILY, core_getExtensionFamily);
VCB(API_CORE_UNREGISTEREXTENSION, core_unregisterExtension);
CB(API_CORE_GETTITLE, core_getTitle);
CB(API_CORE_GETRATING, core_getRating);
VCB(API_CORE_SETRATING, core_setRating);
CB(API_CORE_GETDECODERNAME, core_getDecoderName);
VCB(API_CORE_SETTITLE, core_setTitle);
END_DISPATCH;

View File

@ -0,0 +1,371 @@
#ifndef __API_CORE_H
#define __API_CORE_H
#include <bfc/dispatch.h>
typedef unsigned int CoreToken;
class CoreCallback;
class ItemSequencer;
class NOVTABLE api_core : public Dispatchable
{
public:
const wchar_t *core_getSupportedExtensions();
const wchar_t *core_getExtSupportedExtensions();
CoreToken core_create();
int core_free(CoreToken core);
int core_setNextFile(CoreToken core, const wchar_t *playstring);
int core_getStatus(CoreToken core);
const wchar_t *core_getCurrent(CoreToken core);
int core_getCurPlaybackNumber(CoreToken core);
int core_getPosition(CoreToken core);
int core_getWritePosition(CoreToken core);
int core_setPosition(CoreToken core, int ms);
int core_getLength(CoreToken core);
int core_getPluginData(const wchar_t *playstring, const wchar_t *name, wchar_t *data, int data_len, int data_type = 0);
unsigned int core_getVolume(CoreToken core);
void core_setVolume(CoreToken core, unsigned int vol);
int core_getPan(CoreToken core);
void core_setPan(CoreToken core, int val);
void core_addCallback(CoreToken core, CoreCallback *cb);
void core_delCallback(CoreToken core, CoreCallback *cb);
int core_getVisData(CoreToken core, void *dataptr, int sizedataptr);
int core_getLeftVuMeter(CoreToken core);
int core_getRightVuMeter(CoreToken core);
int core_registerSequencer(CoreToken core, ItemSequencer *seq);
int core_deregisterSequencer(CoreToken core, ItemSequencer *seq);
void core_userButton(CoreToken core, int button);
int core_getEqStatus(CoreToken core);
void core_setEqStatus(CoreToken core, int enable);
int core_getEqPreamp(CoreToken core);
void core_setEqPreamp(CoreToken core, int pre);
int core_getEqBand(CoreToken core, int band);
void core_setEqBand(CoreToken core, int band, int val);
int core_getEqAuto(CoreToken core);
void core_setEqAuto(CoreToken core, int enable);
void core_setCustomMsg(CoreToken core, const wchar_t *text);
void core_registerExtension(const wchar_t *extensions, const wchar_t *extension_name, const wchar_t *family = NULL);
const wchar_t *core_getExtensionFamily(const wchar_t *extension);
void core_unregisterExtension(const wchar_t *extensions);
const wchar_t *core_getTitle(CoreToken core);
void core_setTitle(const wchar_t *new_title);
const wchar_t *core_getDecoderName(const wchar_t *filename);
// these don't necessarily belong here, but api_core is already over-bloated :)
int core_getRating();
void core_setRating(int newRating);
enum
{
API_CORE_GETSUPPORTEDEXTENSIONS = 0,
API_CORE_GETEXTSUPPORTEDEXTENSIONS = 10,
API_CORE_CREATE = 20,
API_CORE_FREE = 30,
API_CORE_SETNEXTFILE = 40,
API_CORE_GETSTATUS = 50,
API_CORE_GETCURRENT = 60,
API_CORE_GETCURPLAYBACKNUMBER = 70,
API_CORE_GETPOSITION = 80,
API_CORE_GETWRITEPOSITION = 90,
API_CORE_SETPOSITION = 100,
API_CORE_GETLENGTH = 110,
API_CORE_GETPLUGINDATA = 120,
API_CORE_GETVOLUME = 130,
API_CORE_SETVOLUME = 140,
API_CORE_GETPAN = 150,
API_CORE_SETPAN = 160,
API_CORE_ADDCALLBACK = 170,
API_CORE_DELCALLBACK = 180,
API_CORE_GETVISDATA = 190,
API_CORE_GETLEFTVUMETER = 200,
API_CORE_GETRIGHTVUMETER = 210,
API_CORE_REGISTERSEQUENCER = 220,
API_CORE_DEREGISTERSEQUENCER = 230,
API_CORE_USERBUTTON = 240,
API_CORE_GETEQSTATUS = 250,
API_CORE_SETEQSTATUS = 260,
API_CORE_GETEQPREAMP = 270,
API_CORE_SETEQPREAMP = 280,
API_CORE_GETEQBAND = 290,
API_CORE_SETEQBAND = 300,
API_CORE_GETEQAUTO = 310,
API_CORE_SETEQAUTO = 320,
API_CORE_SETCUSTOMMSG = 330,
API_CORE_REGISTEREXTENSION = 340,
API_CORE_GETEXTENSIONFAMILY = 350,
API_CORE_UNREGISTEREXTENSION = 360,
API_CORE_GETTITLE = 370,
API_CORE_GETRATING = 380,
API_CORE_SETRATING = 390,
API_CORE_GETDECODERNAME = 400,
API_CORE_SETTITLE = 410,
};
};
inline const wchar_t *api_core::core_getSupportedExtensions()
{
return _call(API_CORE_GETSUPPORTEDEXTENSIONS, (const wchar_t *)0);
}
inline const wchar_t *api_core::core_getExtSupportedExtensions()
{
return _call(API_CORE_GETEXTSUPPORTEDEXTENSIONS, (const wchar_t *)0);
}
inline CoreToken api_core::core_create()
{
return _call(API_CORE_CREATE, (CoreToken)NULL);
}
inline int api_core::core_free(CoreToken core)
{
return _call(API_CORE_FREE, (int)0, core);
}
inline int api_core::core_setNextFile(CoreToken core, const wchar_t *playstring)
{
return _call(API_CORE_SETNEXTFILE, (int)0, core, playstring);
}
inline int api_core::core_getStatus(CoreToken core)
{
return _call(API_CORE_GETSTATUS, (int)0, core);
}
inline const wchar_t *api_core::core_getCurrent(CoreToken core)
{
return _call(API_CORE_GETCURRENT, (const wchar_t *)0, core);
}
inline int api_core::core_getCurPlaybackNumber(CoreToken core)
{
return _call(API_CORE_GETCURPLAYBACKNUMBER, (int)0, core);
}
inline int api_core::core_getPosition(CoreToken core)
{
return _call(API_CORE_GETPOSITION, (int)0, core);
}
inline int api_core::core_getWritePosition(CoreToken core)
{
return _call(API_CORE_GETWRITEPOSITION, (int)0, core);
}
inline int api_core::core_setPosition(CoreToken core, int ms)
{
return _call(API_CORE_SETPOSITION, (int)0, core, ms);
}
inline int api_core::core_getLength(CoreToken core)
{
return _call(API_CORE_GETLENGTH, (int)0, core);
}
inline int api_core::core_getPluginData(const wchar_t *playstring, const wchar_t *name, wchar_t *data, int data_len, int data_type)
{
return _call(API_CORE_GETPLUGINDATA, (int)0, playstring, name, data, data_len, data_type);
}
inline unsigned int api_core::core_getVolume(CoreToken core)
{
return _call(API_CORE_GETVOLUME, (unsigned int)0, core);
}
inline void api_core::core_setVolume(CoreToken core, unsigned int vol)
{
_voidcall(API_CORE_SETVOLUME, core, vol);
}
inline int api_core::core_getPan(CoreToken core)
{
return _call(API_CORE_GETPAN, (int)0, core);
}
inline void api_core::core_setPan(CoreToken core, int val)
{
_voidcall(API_CORE_SETPAN, core, val);
}
inline void api_core::core_addCallback(CoreToken core, CoreCallback *cb)
{
_voidcall(API_CORE_ADDCALLBACK, core, cb);
}
inline void api_core::core_delCallback(CoreToken core, CoreCallback *cb)
{
_voidcall(API_CORE_DELCALLBACK, core, cb);
}
inline int api_core::core_getVisData(CoreToken core, void *dataptr, int sizedataptr)
{
return _call(API_CORE_GETVISDATA, (int)0, core, dataptr, sizedataptr);
}
inline int api_core::core_getLeftVuMeter(CoreToken core)
{
return _call(API_CORE_GETLEFTVUMETER, (int)0, core);
}
inline int api_core::core_getRightVuMeter(CoreToken core)
{
return _call(API_CORE_GETRIGHTVUMETER, (int)0, core);
}
inline int api_core::core_registerSequencer(CoreToken core, ItemSequencer *seq)
{
return _call(API_CORE_REGISTERSEQUENCER, (int)0, core, seq);
}
inline int api_core::core_deregisterSequencer(CoreToken core, ItemSequencer *seq)
{
return _call(API_CORE_DEREGISTERSEQUENCER, (int)0, core, seq);
}
inline void api_core::core_userButton(CoreToken core, int button)
{
_voidcall(API_CORE_USERBUTTON, core, button);
}
inline int api_core::core_getEqStatus(CoreToken core)
{
return _call(API_CORE_GETEQSTATUS, (int)0, core);
}
inline void api_core::core_setEqStatus(CoreToken core, int enable)
{
_voidcall(API_CORE_SETEQSTATUS, core, enable);
}
inline int api_core::core_getEqPreamp(CoreToken core)
{
return _call(API_CORE_GETEQPREAMP, (int)0, core);
}
inline void api_core::core_setEqPreamp(CoreToken core, int pre)
{
_voidcall(API_CORE_SETEQPREAMP, core, pre);
}
inline int api_core::core_getEqBand(CoreToken core, int band)
{
return _call(API_CORE_GETEQBAND, (int)0, core, band);
}
inline void api_core::core_setEqBand(CoreToken core, int band, int val)
{
_voidcall(API_CORE_SETEQBAND, core, band, val);
}
inline int api_core::core_getEqAuto(CoreToken core)
{
return _call(API_CORE_GETEQAUTO, (int)0, core);
}
inline void api_core::core_setEqAuto(CoreToken core, int enable)
{
_voidcall(API_CORE_SETEQAUTO, core, enable);
}
inline void api_core::core_setCustomMsg(CoreToken core, const wchar_t *text)
{
_voidcall(API_CORE_SETCUSTOMMSG, core, text);
}
inline void api_core::core_registerExtension(const wchar_t *extensions, const wchar_t *extension_name, const wchar_t *family)
{
_voidcall(API_CORE_REGISTEREXTENSION, extensions, extension_name, family);
}
inline const wchar_t *api_core::core_getExtensionFamily(const wchar_t *extension)
{
return _call(API_CORE_GETEXTENSIONFAMILY, (const wchar_t *)0, extension);
}
inline void api_core::core_unregisterExtension(const wchar_t *extensions)
{
_voidcall(API_CORE_UNREGISTEREXTENSION, extensions);
}
inline const wchar_t *api_core::core_getTitle(CoreToken core)
{
return _call(API_CORE_GETTITLE, (const wchar_t *)0, core);
}
inline void api_core::core_setTitle(const wchar_t *new_title)
{
_voidcall(API_CORE_SETTITLE, new_title);
}
inline int api_core::core_getRating()
{
return _call(API_CORE_GETRATING, (int)0);
}
inline void api_core::core_setRating(int newRating)
{
_voidcall(API_CORE_SETRATING, newRating);
}
inline const wchar_t *api_core::core_getDecoderName(const wchar_t *filename)
{
return _call(API_CORE_GETDECODERNAME, (const wchar_t *)0, filename);
}
class api_coreI : public api_core
{
public:
virtual const wchar_t *core_getSupportedExtensions() = 0;
virtual const wchar_t *core_getExtSupportedExtensions() = 0;
virtual CoreToken core_create() = 0;
virtual int core_free(CoreToken core) = 0;
virtual int core_setNextFile(CoreToken core, const wchar_t *playstring) = 0;
virtual int core_getStatus(CoreToken core) = 0;
virtual const wchar_t *core_getCurrent(CoreToken core) = 0;
virtual int core_getCurPlaybackNumber(CoreToken core) = 0;
virtual int core_getPosition(CoreToken core) = 0;
virtual int core_getWritePosition(CoreToken core) = 0;
virtual int core_setPosition(CoreToken core, int ms) = 0;
virtual int core_getLength(CoreToken core) = 0;
virtual int core_getPluginData(const wchar_t *playstring, const wchar_t *name, wchar_t *data, int data_len, int data_type = 0) = 0;
virtual unsigned int core_getVolume(CoreToken core) = 0;
virtual void core_setVolume(CoreToken core, unsigned int vol) = 0;
virtual int core_getPan(CoreToken core) = 0;
virtual void core_setPan(CoreToken core, int val) = 0;
virtual void core_addCallback(CoreToken core, CoreCallback *cb) = 0;
virtual void core_delCallback(CoreToken core, CoreCallback *cb) = 0;
virtual int core_getVisData(CoreToken core, void *dataptr, int sizedataptr) = 0;
virtual int core_getLeftVuMeter(CoreToken core) = 0;
virtual int core_getRightVuMeter(CoreToken core) = 0;
virtual int core_registerSequencer(CoreToken core, ItemSequencer *seq) = 0;
virtual int core_deregisterSequencer(CoreToken core, ItemSequencer *seq) = 0;
virtual void core_userButton(CoreToken core, int button) = 0;
virtual int core_getEqStatus(CoreToken core) = 0;
virtual void core_setEqStatus(CoreToken core, int enable) = 0;
virtual int core_getEqPreamp(CoreToken core) = 0;
virtual void core_setEqPreamp(CoreToken core, int pre) = 0;
virtual int core_getEqBand(CoreToken core, int band) = 0;
virtual void core_setEqBand(CoreToken core, int band, int val) = 0;
virtual int core_getEqAuto(CoreToken core) = 0;
virtual void core_setEqAuto(CoreToken core, int enable) = 0;
virtual void core_setCustomMsg(CoreToken core, const wchar_t *text) = 0;
virtual void core_registerExtension(const wchar_t *extensions, const wchar_t *extension_name, const wchar_t *family = NULL) = 0;
virtual const wchar_t *core_getExtensionFamily(const wchar_t *extension) = 0;
virtual void core_unregisterExtension(const wchar_t *extensions) = 0;
virtual const wchar_t *core_getTitle(CoreToken core) = 0;
virtual void core_setTitle(const wchar_t *new_title) = 0;
virtual int core_getRating()=0;
virtual void core_setRating(int newRating)=0;
virtual const wchar_t *core_getDecoderName(const wchar_t *filename)=0;
protected:
RECVS_DISPATCH;
};
// {966E3DA1-C2C5-43a9-A931-EB5F8B040A4F}
static const GUID coreApiServiceGuid =
{ 0x966e3da1, 0xc2c5, 0x43a9, { 0xa9, 0x31, 0xeb, 0x5f, 0x8b, 0x4, 0xa, 0x4f } };
extern api_core *coreApi;
#endif

View File

@ -0,0 +1,18 @@
#ifndef _BUTTONS_H
#define _BUTTONS_H
// codes for
namespace UserButton {
enum {
PREV=0,
PLAY,
PAUSE,
STOP,
NEXT,
};
const int first = PREV;
const int last = NEXT;
};
#endif

View File

@ -0,0 +1,181 @@
#include <precomp.h>
#include "coreactions.h"
#include <api/config/items/cfgitem.h>
#include <api/core/buttons.h>
#include <api/api.h>
#include <api/core/corehandle.h>
#include <api/service/svcs/svc_player.h>
#include <api/locales/xlatstr.h>
CoreActions::CoreActions() {
registerAction("prev", ACTION_PREV);
registerAction("play", ACTION_PLAY);
registerAction("pause", ACTION_PAUSE);
registerAction("stop", ACTION_STOP);
registerAction("next", ACTION_NEXT);
registerAction("eject", ACTION_EJECT);
registerAction("eject_url", ACTION_EJECTURL);
registerAction("eject_dir", ACTION_EJECTDIR);
registerAction("seek", ACTION_SEEK);
registerAction("volume", ACTION_VOLUME);
registerAction("pan", ACTION_PAN);
registerAction("volume_up", ACTION_VOLUME_UP);
registerAction("volume_down", ACTION_VOLUME_DOWN);
registerAction("rewind_5s", ACTION_REWIND_5S);
registerAction("ffwd_5s", ACTION_FFWD_5S);
registerAction("toggle_repeat", ACTION_TOGGLE_REPEAT);
registerAction("toggle_shuffle", ACTION_TOGGLE_SHUFFLE);
registerAction("toggle_crossfader", ACTION_TOGGLE_CROSSFADER);
registerAction("mute", ACTION_MUTE);
registerAction("eq_preamp", ACTION_EQ_PREAMP);
registerAction("eq_band", ACTION_EQ_BAND);
registerAction("eq_auto", ACTION_EQ_AUTO);
registerAction("eq_reset", ACTION_EQ_RESET);
registerAction("toggle_repeat", ACTION_TOGGLE_REPEAT);
registerAction("toggle_shuffle", ACTION_TOGGLE_SHUFFLE);
registerAction("toggle_crossfader", ACTION_TOGGLE_CROSSFADER);
registerAction("eq_toggle", ACTION_EQ_TOGGLE);
for (int i=0;i<4;i++)
registerAction(StringPrintf("play_cd%d", i+1), ACTION_PLAY_CD+i);
}
CoreActions::~CoreActions() {
}
int CoreActions::onActionId(int pvtid, const char *action, const char *param/* =NULL */, int p1/* =0 */, int p2/* =0 */, void *data/* =NULL */, int datalen/* =0 */, api_window *source/* =NULL */) {
int d = ATOI(param);
CoreHandle ch("main");
switch(pvtid) {
case ACTION_PREV: { if (d==0) ch.prev(); } break;
case ACTION_PLAY: { if (d==0) ch.play(); } break;
case ACTION_PAUSE: { if (d==0) ch.pause(); } break;
case ACTION_STOP: { if (d==0) ch.stop(); } break;
case ACTION_NEXT: { if (d==0) ch.next(); } break;
case ACTION_EJECT: {
svc_player *sp = SvcEnumByGuid<svc_player>();
if (d == 0) {
if (sp) sp->openFiles(source, "files");
} else {
if (sp) sp->openFiles(source);
}
WASABI_API_SVC->service_release(sp);
}
break;
case ACTION_EJECTURL: if (d==0) {
svc_player *sp = SvcEnumByGuid<svc_player>();
if (sp) sp->openFiles(source, "location");
api->service_release(sp);
}
break;
case ACTION_EJECTDIR: if (d==0) {
svc_player *sp = SvcEnumByGuid<svc_player>();
if (sp) sp->openFiles(source, "directory");
api->service_release(sp);
}
break;
case ACTION_VOLUME_UP: if (d==0) {
int v=ch.getVolume();
ch.setVolume(MIN(255,(v+5)));
}
break;
case ACTION_VOLUME_DOWN: if (d==0) {
int v=ch.getVolume();
ch.setVolume(MAX(0,(v-5)));
}
break;
case ACTION_REWIND_5S: if (d==0) {
int p=ch.getPosition();
ch.setPosition(MAX(0,(p-5000)));
}
break;
case ACTION_FFWD_5S: if (d==0) {
int p=ch.getPosition();
int mp=ch.getLength();
ch.setPosition(MIN(mp,(p+5000)));
}
break;
case ACTION_EQ_AUTO:
if (d==0) ch.setEqAuto(!ch.getEqAuto());
break;
case ACTION_EQ_RESET: {
if (d==0) for(int i=0;i<10;i++) ch.setEqBand(i,0);
}
break;
case ACTION_EQ_TOGGLE: if (d==0) ch.setEqStatus(!ch.getEqStatus()); break;
case ACTION_MUTE: if (d==0) {
ch.setMute(!ch.getMute());;
}
break;
case ACTION_TOGGLE_REPEAT:
case ACTION_TOGGLE_SHUFFLE: if (d==0) {
// {45F3F7C1-A6F3-4ee6-A15E-125E92FC3F8D}
const GUID pledit_guid =
{ 0x45f3f7c1, 0xa6f3, 0x4ee6, { 0xa1, 0x5e, 0x12, 0x5e, 0x92, 0xfc, 0x3f, 0x8d } };
CfgItem *pli=WASABI_API_CONFIG->config_getCfgItemByGuid(pledit_guid);
if(pli) {
if(pvtid==ACTION_TOGGLE_REPEAT) pli->setDataAsInt("Repeat",!pli->getDataAsInt("Repeat"));
if(pvtid==ACTION_TOGGLE_SHUFFLE) pli->setDataAsInt("Shuffle",!pli->getDataAsInt("Shuffle"));
}
}
break;
case ACTION_TOGGLE_CROSSFADER: if (d==0) {
// {FC3EAF78-C66E-4ED2-A0AA-1494DFCC13FF}
const GUID xfade_guid =
{ 0xFC3EAF78, 0xC66E, 0x4ED2, { 0xA0, 0xAA, 0x14, 0x94, 0xDF, 0xCC, 0x13, 0xFF } };
CfgItem *pli=WASABI_API_CONFIG->config_getCfgItemByGuid(xfade_guid);
if(pli) pli->setDataAsInt("Enable crossfading",!pli->getDataAsInt("Enable crossfading"));
}
break;
}
if (pvtid >= ACTION_PLAY_CD && pvtid < ACTION_PLAY_CD+16) if (d==0) {
const GUID cdda_guid =
{ 0x86b40069, 0x126f, 0x4e11, { 0xa8, 0x7f, 0x55, 0x8f, 0xfa, 0x3d, 0xff, 0xa8 } };
#if 0//BU: need some api to send messages like this
ComponentManager::sendNotify(cdda_guid, 12345, pvtid-ACTION_PLAY_CD);
#endif
}
return 1;
}
const char *CoreActions::getHelp(int action) {
static String name;
switch (action) {
case ACTION_PREV: name = _("Previous track"); break;
case ACTION_PAUSE: name = _("Pause/Resume playback"); break;
case ACTION_STOP: name = _("Stop playback"); break;
case ACTION_NEXT: name = _("Next track"); break;
case ACTION_EJECT: name = _("Load file"); break;
case ACTION_EJECTURL: name = _("Load URL"); break;
case ACTION_EJECTDIR: name = _("Load directory"); break;
case ACTION_SEEK: name = _("Seek"); break;
case ACTION_VOLUME: name = _("Volume"); break;
case ACTION_PAN: name = _("Panning"); break;
case ACTION_EQ_TOGGLE: name = _("Toggle equalizer"); break;
case ACTION_EQ_PREAMP: name = _("Toggle preamplifier"); break;
case ACTION_EQ_BAND: name = _("Change equalizer band"); break;
case ACTION_EQ_AUTO: name = _("Auto equalizer"); break;
case ACTION_EQ_RESET: name = _("Reset equalizer"); break;
case ACTION_VOLUME_UP: name = _("Volume up"); break;
case ACTION_VOLUME_DOWN: name = _("Volume down"); break;
case ACTION_REWIND_5S: name = _("Rewind 5 seconds"); break;
case ACTION_FFWD_5S: name = _("Fast forward 5 seconds"); break;
case ACTION_MUTE: name = _("Mute/Unmute sound"); break;
case ACTION_TOGGLE_REPEAT: name = _("Toggle repeat"); break;
case ACTION_TOGGLE_SHUFFLE: name = _("Toggle shuffle"); break;
case ACTION_TOGGLE_CROSSFADER: name = _("Toggle crossfader"); break;
}
return name;
}

View File

@ -0,0 +1,47 @@
#ifndef __COREACTIONS_H
#define __COREACTIONS_H
#include <api/service/svcs/svc_action.h>
class CoreActions : public svc_actionI {
public :
CoreActions();
virtual ~CoreActions();
static const char *getServiceName() { return "Core Actions"; }
virtual int onActionId(int pvtid, const wchar_t *action, const wchar_t *param=NULL, int p1=0, int p2=0, void *data=NULL, int datalen=0, ifc_window *source=NULL);
virtual const wchar_t *getHelp(int action);
private:
enum {
ACTION_PREV = 0,
ACTION_PLAY,
ACTION_PAUSE,
ACTION_STOP,
ACTION_NEXT,
ACTION_EJECT,
ACTION_EJECTURL,
ACTION_EJECTDIR,
ACTION_SEEK,
ACTION_VOLUME,
ACTION_EQ_TOGGLE,
ACTION_EQ_PREAMP,
ACTION_EQ_BAND,
ACTION_VOLUME_UP,
ACTION_VOLUME_DOWN,
ACTION_REWIND_5S,
ACTION_FFWD_5S,
ACTION_PLAY_CD,
ACTION_EQ_AUTO = ACTION_PLAY_CD+16,
ACTION_EQ_RESET,
ACTION_PAN,
ACTION_MUTE,
ACTION_TOGGLE_REPEAT,
ACTION_TOGGLE_SHUFFLE,
ACTION_TOGGLE_CROSSFADER,
ACTION_PREFS,
};
};
#endif

View File

@ -0,0 +1,304 @@
#include <precomp.h>
#include "corehandle.h"
#include <api/api.h>
#include <api/core/buttons.h>
#include <api/service/svcs/svc_coreadmin.h>
#include <api/service/svc_enum.h> // for castService
using namespace UserButton;
static svc_coreAdmin *da_coreadmin=NULL;
static int instancecount=0;
static void initDaCoreAdmin() {
if(!da_coreadmin) {
if (WASABI_API_SVC != NULL) {
waServiceFactory *s=WASABI_API_SVC->service_enumService(WaSvc::COREADMIN,0);
if (s != NULL) {
//CUT ASSERTPR(s,"Core Admin non present!");
da_coreadmin=castService<svc_coreAdmin>(s);
}
}
}
}
CoreHandle::CoreHandle(CoreToken tok) {
initDaCoreAdmin();
instancecount++;
createdcore=0;
token = NO_CORE_TOKEN;
if (da_coreadmin) {
if(da_coreadmin->verifyToken(tok)) token=tok;
else {
token=da_coreadmin->createCore();
createdcore=1;
}
}
}
CoreHandle::CoreHandle(const char *name) {
initDaCoreAdmin();
instancecount++;
createdcore=0;
token = NO_CORE_TOKEN;
if (da_coreadmin) {
token=da_coreadmin->nameToToken(name);
if(token==-1) {
token=da_coreadmin->createCore(name);
createdcore=1;
}
}
}
CoreHandle::~CoreHandle() {
instancecount--;
if (da_coreadmin) {
if(createdcore) da_coreadmin->freeCoreByToken(token);
if(!instancecount) {
WASABI_API_SVC->service_release(da_coreadmin);
da_coreadmin=NULL;
}
}
}
int CoreHandle::isCoreLoaded() {
if (!da_coreadmin) return FALSE;
return TRUE;
}
int CoreHandle::setNextFile(const char *playstring, const char *destination) {
if (da_coreadmin == NULL) return 0;
return da_coreadmin->setNextFile(token, playstring, destination);
}
void CoreHandle::prev() {
userButton(PREV);
}
void CoreHandle::play() {
userButton(PLAY);
}
void CoreHandle::pause() {
userButton(PAUSE);
}
void CoreHandle::stop() {
userButton(STOP);
}
void CoreHandle::next() {
userButton(NEXT);
}
void CoreHandle::userButton(int button) {
if (da_coreadmin == NULL) return;
da_coreadmin->userButton(token, button);
}
const char *CoreHandle::getSupportedExtensions() {
if (da_coreadmin == NULL) return "";
return da_coreadmin->getSupportedExtensions();
}
const char *CoreHandle::getExtSupportedExtensions() {
if (da_coreadmin == NULL) return "";
return da_coreadmin->getExtSupportedExtensions();
}
const char *CoreHandle::getExtensionFamily(const char *extension) {
if (da_coreadmin == NULL) return "";
return da_coreadmin->getExtensionFamily(extension);
}
void CoreHandle::registerExtension(const char *extensions, const char *extension_name) {
if (da_coreadmin == NULL) return;
da_coreadmin->registerExtension(extensions, extension_name);
}
void CoreHandle::unregisterExtension(const char *extensions) {
if (da_coreadmin == NULL) return;
da_coreadmin->unregisterExtension(extensions);
}
String CoreHandle::getTitle() {
if (da_coreadmin == NULL) return String("");
return String(da_coreadmin->getTitle(token));
}
int CoreHandle::getStatus() {
if (da_coreadmin == NULL) return 0;
return da_coreadmin->getStatus(token);
}
const char *CoreHandle::getCurrent() {
if (da_coreadmin == NULL) return "";
return da_coreadmin->getCurrent(token);
}
int CoreHandle::getNumTracks() {
if (da_coreadmin == NULL) return 0;
return da_coreadmin->getNumTracks(token);
}
int CoreHandle::getCurPlaybackNumber() {
if (da_coreadmin == NULL) return 0;
return da_coreadmin->getCurPlaybackNumber(token);
}
int CoreHandle::getPosition() {
if (da_coreadmin == NULL) return 0;
return da_coreadmin->getPosition(token);
}
int CoreHandle::getWritePosition() {
if (da_coreadmin == NULL) return 0;
return da_coreadmin->getWritePosition(token);
}
int CoreHandle::setPosition(int ms) {
if (da_coreadmin == NULL) return 0;
return da_coreadmin->setPosition(token,ms);
}
int CoreHandle::getLength() {
if (da_coreadmin == NULL) return 0;
return da_coreadmin->getLength(token);
}
int CoreHandle::getPluginData(const char *playstring, const char *name, char *data, int data_len, int data_type) {
if (da_coreadmin == NULL) return 0;
return da_coreadmin->getPluginData(playstring, name, data, data_len, data_type);
}
unsigned int CoreHandle::getVolume() {
if (da_coreadmin == NULL) return 0;
return da_coreadmin->getVolume(token);
}
void CoreHandle::setVolume(unsigned int vol) {
if (da_coreadmin == NULL) return;
da_coreadmin->setVolume(token, vol);
}
int CoreHandle::getPan() {
if (da_coreadmin == NULL) return 0;
return da_coreadmin->getPan(token);
}
void CoreHandle::setPan(int bal) {
if (da_coreadmin == NULL) return;
da_coreadmin->setPan(token, bal);
}
void CoreHandle::setMute(int mute) {
if (da_coreadmin == NULL) return;
da_coreadmin->setMute(token, mute);
}
int CoreHandle::getMute() {
if (da_coreadmin == NULL) return 0;
return da_coreadmin->getMute(token);
}
void CoreHandle::addCallback(CoreCallback *cb) {
if (da_coreadmin == NULL) return;
da_coreadmin->addCallback(token, cb);
}
void CoreHandle::delCallback(CoreCallback *cb) {
if (da_coreadmin == NULL) return;
da_coreadmin->delCallback(token, cb);
}
int CoreHandle::getVisData(void *dataptr, int sizedataptr) {
if (da_coreadmin == NULL) return 0;
return da_coreadmin->getVisData(token, dataptr, sizedataptr);
}
int CoreHandle::getLeftVuMeter() {
if (da_coreadmin == NULL) return 0;
return da_coreadmin->getLeftVuMeter(token);
}
int CoreHandle::getRightVuMeter() {
if (da_coreadmin == NULL) return 0;
return da_coreadmin->getRightVuMeter(token);
}
int CoreHandle::registerSequencer(ItemSequencer *seq) {
if (da_coreadmin == NULL) return 0;
return da_coreadmin->registerSequencer(token, seq);
}
int CoreHandle::deregisterSequencer(ItemSequencer *seq) {
if (da_coreadmin == NULL) return 0;
return da_coreadmin->deregisterSequencer(token, seq);
}
ItemSequencer *CoreHandle::getSequencer() {
if (da_coreadmin == NULL) return NULL;
return da_coreadmin->getSequencer(token);
}
int CoreHandle::getEqStatus() {
if (da_coreadmin == NULL) return 0;
return da_coreadmin->getEqStatus(token);
}
void CoreHandle::setEqStatus(int enable) {
if (da_coreadmin == NULL) return;
da_coreadmin->setEqStatus(token, enable);
}
int CoreHandle::getEqPreamp() {
if (da_coreadmin == NULL) return 0;
return da_coreadmin->getEqPreamp(token);
}
void CoreHandle::setEqPreamp(int pre) {
if (da_coreadmin == NULL) return;
da_coreadmin->setEqPreamp(token, pre);
}
int CoreHandle::getEqBand(int band) {
if (da_coreadmin == NULL) return 0;
return da_coreadmin->getEqBand(token, band);
}
void CoreHandle::setEqBand(int band, int val) {
if (da_coreadmin == NULL) return;
da_coreadmin->setEqBand(token, band, val);
}
int CoreHandle::getEqAuto() {
if (da_coreadmin == NULL) return 0;
return da_coreadmin->getEqAuto(token);
}
void CoreHandle::setEqAuto(int enable) {
if (da_coreadmin == NULL) return;
da_coreadmin->setEqAuto(token, enable);
}
void CoreHandle::setPriority(int priority) {
if (da_coreadmin == NULL) return;
da_coreadmin->setPriority(token, priority);
}
int CoreHandle::getPriority() {
if (da_coreadmin == NULL) return 0;
return da_coreadmin->getPriority(token);
}
void CoreHandle::rebuildConvertersChain() {
if (da_coreadmin == NULL) return;
da_coreadmin->rebuildConvertersChain(token);
}
int CoreHandle::sendConvertersMsg(const char *msg, const char *value) {
if (da_coreadmin == NULL) return 0;
return da_coreadmin->sendConvertersMsg(token, msg, value);
}

View File

@ -0,0 +1,560 @@
#ifndef _COREHANDLE_H
#define _COREHANDLE_H
#include <api/syscb/callbacks/corecb.h>
// a helper class to access the playback cores within an object for you
typedef unsigned int CoreToken;
#define NO_CORE_TOKEN (CoreToken)(0xffffffff)
// Fwd References
class CfgItem;
class ItemSequencer;
/**
Helper class to access the currently instantiated
playback cores.
To create a corehandle on the main playback core
use the core token value from the enum ("maincore_token") or
the core name "main".
Here is an example:
CoreHandle * ch = new CoreHandle("main");
@short Access playback cores.
@author Nullsoft
@ver 1.0
@see Core
*/
class CoreHandle {
public:
enum { maincore_token=0 };
/**
Create a new CoreHandle while optionally
setting the core token to be used.
Core tokens are handles to cores
currently instantiated.
@see CoreHandle(const char *name)
@param token Core token of the core to attach to.
*/
CoreHandle(CoreToken token=maincore_token);
/**
Create a new CoreHandle for a core
using it's name.
The main core name is "main".
@see CoreHandle(CoreToken toke=maincore_token)
@param name Name of the core to attach to.
*/
CoreHandle(const wchar_t *name);
/**
Detaches the CoreHandle from the Core.
*/
virtual ~CoreHandle();
int isCoreLoaded(); // are we attached to a core?
/**
Get the list of supported extensions
from the core. This is a zero delimited list
with double zero termination.
@see getExtSupportedExtensions()
@see getExtensionFamily()
@ret List of supported extensions.
*/
const char *getSupportedExtensions(); //just the *.mp3 or whatever
/**
Get the extended list of supported extensions
from the core. This will include the proper
names of the extensions, for example:
"MP3 Files (*.mp3)".
This is returned as a zero delimited list with double
zero termination.
@see getSupportedExtensions()
@see getExtensionFamily()
@ret Extended list of supported extensions.
*/
const char *getExtSupportedExtensions(); // including names
/**
Get the family name to which the extension
is associated with (Families are "Audio", "Video", etc.)
@see getExtSupportedExtensions()
@see getSupportedExtensions()
@ret Family name of the extension.
@param extension Extension to get family name of.
*/
const wchar_t *getExtensionFamily(const wchar_t *extension);
/**
Register an extension with the core.
@see unregisterExtension()
@see getExtSupportedExtensions()
@see getSupportedExtensions()
@see getExtensionFamily()
@param extensions Extension to register.
@param extension_name Name of the extension.
*/
void registerExtension(const char *extensions, const char *extension_name);
/**
Unregister an extension with the core.
@see registerExtension()
@see getExtSupportedExtensions()
@see getSupportedExtensions()
@see getExtensionFamily()
@param extensions Extension to unregister.
*/
void unregisterExtension(const char *extensions);
String getTitle();
/**
Set the next file to be played by the core.
You can manually select the output of this
file. Either "WAVEOUT" or "DIRECTSOUND". If
you do not specify one, it will be automatically
selected for you.
@ret 1, success; 0, failure;
@param playstring Playstring of the next file to be played.
@param destination Output to be used for the next file.
*/
int setNextFile(const char *playstring, const char *destination=NULL);
/**
Get the playback status of the core.
@see pause()
@see play()
@see stop()
@ret -1, Paused; 0, Stopped; 1, Playing;
*/
int getStatus(); // returns -1 if paused, 0 if stopped and 1 if playing
/**
Get the playstring of the currently playing
item.
@ret Playstring of the currently playing item.
*/
const char *getCurrent();
/**
Get the number of items (tracks) present
in the currently registered sequencer.
@see getCurPlaybackNumber()
@ret Number of items present in the sequencer.
*/
int getNumTracks();
/**
Get the index number of the currently
playing item of the currently registered
sequencer.
@see getNumTracks()
@ret Index number (in the sequencer) of the item playing.
*/
int getCurPlaybackNumber();
/**
Get the playback position of the currently
playing file.
@see getWritePosition()
@see getLength()
@see setPosition()
@ret Position in the file (in milliseconds).
*/
int getPosition();
/**
Help?
@see getPosition()
@see getLength()
@see setPosition()
@ret Current write position (in milliseconds).
*/
int getWritePosition();
/**
Seek to a specific position in the
currently playing item.
@see getPosition()
@see getLength()
@see getWritePosition()
@ret 1, Success; 0, Failure;
@param ms Position in the file (in milliseconds, 0 being the beginning).
*/
int setPosition(int ms);
/**
Get the length of the currently
playing item.
@see getPosition()
@see setPosition()
@see getWritePosition()
@ret Length of the item (in milliseconds).
*/
int getLength();
// this method queries the core plugins directly, bypassing the db
/**
*/
int getPluginData(const char *playstring, const char *name,
char *data, int data_len, int data_type=0); // returns size of data
/**
Get the volume of the core.
@see setVolume()
@see getMute()
@see setMute()
@ret Volume (0 to 255).
*/
unsigned int getVolume(); // 0..255
/**
Set the volume of the core.
@see getVolume()
@see getMute()
@see setMute()
@param vol Volume (0 to 255).
*/
void setVolume(unsigned int vol); // 0..255
/**
Get the panning value of the core.
@see setPan()
@ret Panning value (-127 [left] to 127 [right]).
*/
int getPan(); // -127..127
/**
Set the panning value of the core.
@see getPan()
@param bal Panning value (-127 [left] to 127 [right])
*/
void setPan(int bal); // -127..127
/**
Mute the output.
@see getVolume()
@see setVolume()
@see getMute()
@param mute 0, No muting; 1, Mute;
*/
void setMute(int mute);
/**
Get the mute state of the output.
@see getVolume()
@see setVolume()
@see setMute()
@ret 0, Not muted; 1, Muted;
*/
int getMute();
// register here for general callbacks in core status.
/**
Register a callback with the core to
receive core status callbacks.
@see delCallback()
@param cb Core Callback to register.
*/
void addCallback(CoreCallback *cb);
/**
Unregister a callback with the core.
@see addCallback()
@param cb Core Callback to unregister.
*/
void delCallback(CoreCallback *cb);
// get visualization data, returns 0 if you should blank out
/**
Get visualization data for the currently
playing item.
We suggest using a struct like this to read the vis
data:
typedef struct {
enum {
LEFT = 0,
RIGHT = 1
};
unsigned char spectrumData[2][576];
char waveformData[2][576];
} VisData;
A call using this struct would like so:
getVisData(&myVisData, sizeof(VisData));
@see getLeftVuMeter()
@see getRightVuMeter()
@ret 0, If there is no VIS data; > 0, VIS data available;
@param dataptr Buffer to receive VIS data.
@param sizedataptr Size of the buffer.
*/
int getVisData(void *dataptr, int sizedataptr);
/**
Get the value of the left VU meter.
@see getVisData()
@see getRightVuMeter()
@ret Value of the left VU meter (0 to 255).
*/
int getLeftVuMeter();
/**
Get the value of the left VU meter.
@see getVisData()
@see getLeftVuMeter()
@ret Value of the right VU meter (0 to 255).
*/
int getRightVuMeter();
/**
Register an item sequencer with the core.
The item sequencer feeds the playstrings
of the next item to be played to the core.
@see deregisterSequencer()
@ret 1, Success; 0, Failure;
@param seq Sequencer to register.
*/
int registerSequencer(ItemSequencer *seq);
/**
Unregister a sequencer with the core.
@see registerSequencer()
@ret 1, Success; 0, Failure;
@param seq Sequencer to unregister.
*/
int deregisterSequencer(ItemSequencer *seq);
ItemSequencer *getSequencer();
/**
Get the EQ status.
@see setEqStatus()
@see getEqPreamp()
@see setEqPreamp()
@see getEqBand()
@see setEqBand()
@ret 1, On; 0, Off;
*/
int getEqStatus(); // returns 1 if on, 0 if off
/**
Set the EQ state.
@see getEqStatus()
@see getEqPreamp()
@see setEqPreamp()
@see getEqBand()
@see setEqBand()
@param enable 1, On; 0, Off;
*/
void setEqStatus(int enable);
/**
Get the pre-amp value of the EQ.
@see setEqStatus()
@see getEqStatus()
@see setEqPreamp()
@see getEqBand()
@see setEqBand()
@ret Pre-amp value (-127 [-20dB] to 127 [+20dB]).
*/
int getEqPreamp(); // -127 to 127 (-20db to +20db)
/**
Set the pre-amp value of the EQ.
@see setEqStatus()
@see getEqStatus()
@see getEqPreamp()
@see getEqBand()
@see setEqBand()
@param pre Pre-amp value (-127 [-20dB] to 127 [+20dB]).
*/
void setEqPreamp(int pre);
/**
Get the value of an EQ band. There
are 10 bands available.
Here is the list:
0 - 60 Hz 1 - 170 Hz
2 - 310 Hz 3 - 600 Hz
4 - 1 kHz 5 - 3 kHz
6 - 6 kHz 7 - 12 kHz
8 - 14 kHz 9 - 16 kHz
@see setEqStatus()
@see getEqStatus()
@see getEqPreamp()
@see setEqBand()
@ret EQ band value (-127 [-20dB] to 127 [+20dB]).
@param band EQ band to read (0 to 9).
*/
int getEqBand(int band); // band=0-9
/**
Set the value of an EQ band. There
are 10 bands available.
Here is the list:
0 - 60 Hz 1 - 170 Hz
2 - 310 Hz 3 - 600 Hz
4 - 1 kHz 5 - 3 kHz
6 - 6 kHz 7 - 12 kHz
8 - 14 kHz 9 - 16 kHz
@see setEqStatus()
@see getEqStatus()
@see getEqPreamp()
@see setEqBand()
@param band EQ band to set (0 to 9)
@param val EQ band value (-127 [-20dB] to 127 [+20dB]).
*/
void setEqBand(int band, int val);
/**
Get the automatic EQ preset loading state.
@see setEqAuto()
@ret 1, On; 0, Off;
*/
int getEqAuto(); // returns 1 if on, 0 if off
/**
Set the automatic EQ preset loading.
@see getEqAuto()
@param enable 1, On; 0, Off;
*/
void setEqAuto(int enable);
/**
Trigger the previous event.
@see next()
@see play()
@see stop()
@see pause()
*/
void prev();
/**
Trigger the play event.
@see prev()
@see next()
@see stop()
@see pause()
*/
void play();
/**
Trigger the pause event.
@see prev()
@see next()
@see stop()
@see play()
*/
void pause();
/**
Trigger the stop event.
*/
void stop();
/**
Trigger the next event.
@see prev()
@see stop()
@see play()
@see pause()
*/
void next();
/**
Set the thread priority of the core.
@see getPriority()
@param priority Thread priority.
*/
void setPriority(int priority);
/**
Get the thread priority of the core.
@see setPriority()
@ret Thread priority level.
*/
int getPriority();
/**
As the function name implies, rebuilds the converters chain (no shit?)
*/
void rebuildConvertersChain();
/**
Send a message to all converters in the current
playback chain of a core.
It's possible to pass any pointer using this messanging
system, as long as the pointer is valid across dll boundries.
@param msg Message.
@param value Message value.
*/
int sendConvertersMsg(const char *msg, const char *value);
private:
void userButton(int button);
CoreToken token;
int createdcore;
};
#endif

View File

@ -0,0 +1,92 @@
#include "precomp.h"
#include "sequence.h"
#define CBCLASS ItemSequencerI
START_DISPATCH;
CB(GETDEPENDENCYPTR, getDependencyPtr);
CB(GETNEXTPLAYITEM, getNextPlayItem);
CB(GETCURRENTPLAYBACKNUMBER, getCurrentPlaybackNumber);
CB(GETNUMITEMS, getNumItems);
CB(REWIND, rewind);
CB(FORWARD, forward);
CB(ONNOTIFY, onNotify);
END_DISPATCH;
#undef CBCLASS
int ItemSequencerI::onNotify(int msg, int param1, int param2) {
switch (msg) {
case SEQNOTIFY_ONREGISTER: return onRegister();
case SEQNOTIFY_ONDEREGISTER: return onDeregister();
case SEQNOTIFY_ONNEXTFILE: return onNextFile();
case SEQNOTIFY_ONTITLECHANGE: return onTitleChange();
case SEQNOTIFY_ONSTARTED: return onStarted();
case SEQNOTIFY_ONSTOPPED: return onStopped();
case SEQNOTIFY_ONPAUSED: return onPaused();
case SEQNOTIFY_ONUNPAUSED: return onUnpaused();
}
return 0;
}
const char *ListSequencer::getNextPlayItem() {
int pos;
const char *ret;
pos = getCurrent();
if (pos < 0) return NULL;
ret = enumItem(pos);
setCurrent(pos);
return ret;
}
int ListSequencer::rewind() {
int pos;
pos = getCurrent();
if (pos < 0) return 0;
pos--;
if (pos < 0) {
if (loop()) {
pos = getNumEntries()-1;
} else {
pos++;
}
}
setCurrent(pos);
return 1;
}
int ListSequencer::forward() {
int pos;
pos = getCurrent();
if (pos < 0) return 0;
pos++;
if (pos >= getNumEntries()) {
if (loop()) {
pos = 0;
} else {
return 0;
}
}
setCurrent(pos);
return 1;
}
int ListSequencer::getNumItems() {
return getNumEntries();
}

View File

@ -0,0 +1,123 @@
//PORTABLE
#ifndef _SEQUENCE_H
#define _SEQUENCE_H
#include <bfc/dispatch.h>
#include <bfc/depend.h>
// abstracted version of a playback order
class ItemSequencer : public Dispatchable {
public:
api_dependent *getDependencyPtr();
const char *getNextPlayItem();
int getCurrentPlaybackNumber(); // 0-based, -1 if you don't know
int getNumItems(); // -1 if you don't know
int rewind();
int forward();
int onNotify(int msg, int param1=0, int param2=0);
protected:
enum {
GETNEXTPLAYITEM=100,
GETCURRENTPLAYBACKNUMBER=101,
GETNUMITEMS=102,
REWIND=200,
FORWARD=210,
ONNOTIFY=300,
GETDEPENDENCYPTR=400,
};
};
inline api_dependent *ItemSequencer::getDependencyPtr() {
return _call(GETDEPENDENCYPTR, (api_dependent*)NULL);
}
inline const char *ItemSequencer::getNextPlayItem() {
return _call(GETNEXTPLAYITEM, (const char *)NULL);
}
inline
int ItemSequencer::getCurrentPlaybackNumber() {
return _call(GETCURRENTPLAYBACKNUMBER, -1);
}
inline
int ItemSequencer::getNumItems() {
return _call(GETNUMITEMS, -1);
}
inline int ItemSequencer::rewind() {
return _call(REWIND, 0);
}
inline int ItemSequencer::forward() {
return _call(FORWARD, 0);
}
inline int ItemSequencer::onNotify(int msg, int param1, int param2) {
return _call(ONNOTIFY, 0, msg, param1, param2);
}
#define SEQNOTIFY_ONREGISTER 10
#define SEQNOTIFY_ONDEREGISTER 20
#define SEQNOTIFY_ONNEXTFILE 30
#define SEQNOTIFY_ONTITLECHANGE 40
#define SEQNOTIFY_ONSTARTED 50
#define SEQNOTIFY_ONSTOPPED 60
#define SEQNOTIFY_ONPAUSED 70
#define SEQNOTIFY_ONUNPAUSED 80
// override this one
class ItemSequencerI : public ItemSequencer, public DependentI {
public:
api_dependent *getDependencyPtr() { return this; }
virtual int rewind()=0;
virtual int forward()=0;
virtual const char *getNextPlayItem()=0;
virtual int getCurrentPlaybackNumber() { return -1; }
virtual int getNumItems() { return -1; }
// these are optional callbacks
virtual int onRegister() { return 0; };
virtual int onDeregister() { return 0; };
virtual int onNextFile() { return 0; }// on transition
virtual int onTitleChange() { return 0; }
virtual int onStarted() { return 0; }
virtual int onStopped() { return 0; }
virtual int onPaused() { return 0; }
virtual int onUnpaused() { return 0; }
protected:
// default implementation calls above callback methods based on msg
virtual int onNotify(int msg, int param1, int param2);
RECVS_DISPATCH;
};
// also somewhat abstract, but implements playing through some arbitrary
// list. just override the protected stuff
class ListSequencer : public ItemSequencerI {
public:
virtual const char *getNextPlayItem();
virtual int rewind();
virtual int forward();
protected:
// override these 4 only
virtual int getNumEntries()=0;
virtual const char *enumItem(int pos)=0;
virtual int getCurrent()=0;
virtual int setCurrent(int cur)=0;
protected:
virtual int loop() { return 0; } // override as necessary
private:
virtual int getNumItems(); // calls getNumEntries()
};
#endif

View File

@ -0,0 +1,2 @@
#include <precomp.h>
#include "api_dependent.h"

View File

@ -0,0 +1,54 @@
#ifndef __WASABI_API_DEPENDENT_H
#define __WASABI_API_DEPENDENT_H
#include <bfc/dispatch.h>
#include "api_dependentviewer.h"
// we define some common event codes here. if your object needs more send
// them as parameters to OBJECTSPECIFIC
// some system-level codes for cb param. You can implement your own events
// with DEPCB_EVENT and the parameters
namespace DependentCB
{
enum {
DEPCB_NOP = 0,
DEPCB_DELETED = 100, // object being deleted
DEPCB_EVENT = 1000, // object-specific event. use param1 etc to send your messages
};
};
class NOVTABLE ifc_dependent : public Dispatchable
{
protected:
ifc_dependent() {}
~ifc_dependent() {}
public:
void dependent_regViewer(ifc_dependentviewer *viewer, int add) ;
void *dependent_getInterface(const GUID *classguid);
DISPATCH_CODES
{
API_DEPENDENT_REGVIEWER = 10,
API_DEPENDENT_GETINTERFACE = 20,
};
};
inline void ifc_dependent::dependent_regViewer(api_dependentviewer *viewer, int add)
{
_voidcall(API_DEPENDENT_REGVIEWER, viewer, add);
}
inline void *ifc_dependent::dependent_getInterface(const GUID *classguid)
{
return _call(API_DEPENDENT_GETINTERFACE, (void *)0, classguid);
}
// this is a helper for dependent_getInterface
#define HANDLEGETINTERFACE(x) { \
if (*classguid == *x::depend_getClassGuid()) return static_cast<x *>(this); \
}
typedef ifc_dependent api_dependent;
#endif

View File

@ -0,0 +1,2 @@
#include <precomp.h>
#include "api_dependentviewer.h"

View File

@ -0,0 +1,30 @@
#ifndef __WASABI_API_DEPENDENTVIEWER_H
#define __WASABI_API_DEPENDENTVIEWER_H
#include <bfc/dispatch.h>
#include <bfc/platform/types.h>
class ifc_dependent;
class NOVTABLE ifc_dependentviewer : public Dispatchable
{
protected:
ifc_dependentviewer() {}
~ifc_dependentviewer() {}
public:
// item calls when it changes or disappears, or whatever
int dependentViewer_callback(ifc_dependent *item, const GUID *classguid, int cb, intptr_t param1 = 0, intptr_t param2 = 0, void *ptr = NULL, size_t ptrlen = 0);
DISPATCH_CODES
{
DEPENDENTVIEWER_CALLBACK = 10,
};
};
inline int ifc_dependentviewer::dependentViewer_callback(ifc_dependent *item, const GUID *classguid, int cb, intptr_t param1 , intptr_t param2 , void *ptr , size_t ptrlen)
{
return _call(DEPENDENTVIEWER_CALLBACK, (int)0, item, classguid, cb, param1, param2, ptr, ptrlen);
}
typedef ifc_dependentviewer api_dependentviewer;
#endif

Some files were not shown because too many files have changed in this diff Show More