Initial community commit
This commit is contained in:
parent
537bcbc862
commit
fc06254474
16440 changed files with 4239995 additions and 2 deletions
10
Src/Wasabi/api/service/svcs/svc_accessibility.cpp
Normal file
10
Src/Wasabi/api/service/svcs/svc_accessibility.cpp
Normal file
|
@ -0,0 +1,10 @@
|
|||
#include <precomp.h>
|
||||
#include "svc_accessibility.h"
|
||||
|
||||
#define CBCLASS svc_accessibilityI
|
||||
START_DISPATCH;
|
||||
CB(SVC_ACCESSIBILITY_CREATEACCESSIBLEOBJECT, createAccessibleObject);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
||||
|
43
Src/Wasabi/api/service/svcs/svc_accessibility.h
Normal file
43
Src/Wasabi/api/service/svcs/svc_accessibility.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
#ifndef _SVC_ACCESSIBILITY_H
|
||||
#define _SVC_ACCESSIBILITY_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <api/service/services.h>
|
||||
|
||||
class Accessible;
|
||||
class ifc_window;
|
||||
|
||||
class NOVTABLE svc_accessibility : public Dispatchable {
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::ACCESSIBILITY; }
|
||||
|
||||
Accessible *createAccessibleObject(ifc_window *w);
|
||||
|
||||
enum {
|
||||
SVC_ACCESSIBILITY_CREATEACCESSIBLEOBJECT=10,
|
||||
};
|
||||
};
|
||||
|
||||
inline Accessible *svc_accessibility::createAccessibleObject(ifc_window *w) {
|
||||
return _call(SVC_ACCESSIBILITY_CREATEACCESSIBLEOBJECT, (Accessible *)NULL, w);
|
||||
}
|
||||
|
||||
class NOVTABLE svc_accessibilityI: public svc_accessibility {
|
||||
public:
|
||||
virtual Accessible *createAccessibleObject(ifc_window *w)=0;
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
#include <api/service/servicei.h>
|
||||
template <class T>
|
||||
class AccessibilityCreatorSingle : public waServiceFactoryTSingle<svc_accessibility, T> {
|
||||
public:
|
||||
svc_accessibility *getHandler() {
|
||||
return waServiceFactoryTSingle<svc_accessibility, T>::getSingleService();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif
|
70
Src/Wasabi/api/service/svcs/svc_accroleserver.cpp
Normal file
70
Src/Wasabi/api/service/svcs/svc_accroleserver.cpp
Normal file
|
@ -0,0 +1,70 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "svc_accroleserver.h"
|
||||
#include <api/script/objects/guiobject.h>
|
||||
#include <api/wnd/api_window.h>
|
||||
|
||||
#define CBCLASS svc_accRoleServerI
|
||||
START_DISPATCH;
|
||||
CB(RS_HANDLEROLE, handleRole);
|
||||
CB(RS_CREATEOBJECT, createObject);
|
||||
VCB(RS_DESTROYOBJECT, destroyObject);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
||||
|
||||
#define CBCLASS roleServerObjectI
|
||||
START_DISPATCH;
|
||||
CB(RSO_WNDPROC, wndProc);
|
||||
CB(RSO_GETHWND, gethWnd);
|
||||
CB(RSO_FLATTENCONTENT, flattenContent);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
||||
|
||||
roleServerObjectI::roleServerObjectI(HWND par, api_window *w) {
|
||||
wnd = w;
|
||||
hwnd = NULL;
|
||||
parent = par;
|
||||
triedyet = 0;
|
||||
}
|
||||
|
||||
roleServerObjectI::~roleServerObjectI() {
|
||||
if (hwnd != NULL)
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
api_window *roleServerObjectI::getWnd() {
|
||||
return wnd;
|
||||
}
|
||||
|
||||
HWND roleServerObjectI::gethWnd() {
|
||||
if (!triedyet) {
|
||||
triedyet = 1;
|
||||
hwnd = createWindow(parent);
|
||||
if (hwnd !=NULL)
|
||||
oldproc = (WNDPROC)GetWindowLong(hwnd, GWL_WNDPROC);
|
||||
else
|
||||
oldproc = NULL;
|
||||
}
|
||||
return hwnd;
|
||||
}
|
||||
|
||||
ScriptObject *roleServerObjectI::getScriptObject() {
|
||||
if (wnd == NULL) return NULL;
|
||||
GuiObject *go = wnd->getGuiObject();
|
||||
if (go == NULL) return NULL;
|
||||
return go->guiobject_getScriptObject();
|
||||
}
|
||||
|
||||
WNDPROC roleServerObjectI::getOldProc() {
|
||||
return oldproc;
|
||||
}
|
||||
|
||||
int roleServerObjectI::wndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
return CallWindowProc(oldproc, hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
int roleServerObjectI::flattenContent(HWND *w) {
|
||||
return FLATTENFLAG_ASKPARENT;
|
||||
}
|
132
Src/Wasabi/api/service/svcs/svc_accroleserver.h
Normal file
132
Src/Wasabi/api/service/svcs/svc_accroleserver.h
Normal file
|
@ -0,0 +1,132 @@
|
|||
#ifndef __SVC_ROLESERVER_H
|
||||
#define __SVC_ROLESERVER_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <bfc/string/string.h>
|
||||
#include <bfc/ptrlist.h>
|
||||
#include <api/service/services.h>
|
||||
#include <api/script/scriptobj.h>
|
||||
|
||||
class ifc_window;
|
||||
|
||||
#define FLATTENFLAG_FLATTEN 1
|
||||
#define FLATTENFLAG_UNFLATTEN -1
|
||||
#define FLATTENFLAG_ASKPARENT 0
|
||||
|
||||
class NOVTABLE roleServerObject : public Dispatchable {
|
||||
public:
|
||||
int wndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
HWND gethWnd();
|
||||
int flattenContent(HWND *w);
|
||||
|
||||
enum {
|
||||
RSO_WNDPROC=0,
|
||||
RSO_GETHWND=10,
|
||||
RSO_FLATTENCONTENT=20,
|
||||
};
|
||||
};
|
||||
|
||||
inline int roleServerObject::wndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
return _call(RSO_WNDPROC, 0, hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
inline HWND roleServerObject::gethWnd() {
|
||||
return _call(RSO_GETHWND, (HWND)NULL);
|
||||
}
|
||||
|
||||
inline int roleServerObject::flattenContent(HWND *w) {
|
||||
return _call(RSO_FLATTENCONTENT, 0, w);
|
||||
}
|
||||
|
||||
class roleServerObjectI : public roleServerObject {
|
||||
public:
|
||||
|
||||
roleServerObjectI(HWND parent, ifc_window *w);
|
||||
virtual ~roleServerObjectI();
|
||||
|
||||
virtual int wndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
virtual HWND createWindow(HWND parent)=0;
|
||||
virtual int flattenContent(HWND *w);
|
||||
|
||||
protected:
|
||||
|
||||
ScriptObject *getScriptObject();
|
||||
virtual ifc_window *getWnd();
|
||||
virtual HWND gethWnd();
|
||||
WNDPROC getOldProc();
|
||||
|
||||
HWND hwnd, parent;
|
||||
ifc_window *wnd;
|
||||
long (__stdcall *oldproc)(struct HWND__ *,unsigned int,unsigned int,long);
|
||||
int triedyet;
|
||||
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
class NOVTABLE svc_accRoleServer : public Dispatchable {
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::ACCESSIBILITYROLESERVER; }
|
||||
|
||||
int handleRole(int role);
|
||||
roleServerObject *createObject(HWND parent, ifc_window *attached_wnd);
|
||||
void destroyObject(roleServerObject *obj);
|
||||
|
||||
enum {
|
||||
RS_HANDLEROLE=10,
|
||||
RS_CREATEOBJECT=20,
|
||||
RS_DESTROYOBJECT=30
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
inline int svc_accRoleServer::handleRole(int role) {
|
||||
return _call(RS_HANDLEROLE, 0, role);
|
||||
}
|
||||
|
||||
inline roleServerObject *svc_accRoleServer::createObject(HWND parent, ifc_window *attached_wnd) {
|
||||
return _call(RS_CREATEOBJECT, (roleServerObject *)NULL, parent, attached_wnd);
|
||||
}
|
||||
|
||||
inline void svc_accRoleServer::destroyObject(roleServerObject *obj) {
|
||||
_voidcall(RS_DESTROYOBJECT, obj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
class svc_accRoleServerI : public svc_accRoleServer {
|
||||
|
||||
public:
|
||||
|
||||
virtual int handleRole(int role)=0;
|
||||
virtual roleServerObject *createObject(HWND parent, ifc_window *attached_wnd)=0;
|
||||
virtual void destroyObject(roleServerObject *obj)=0;
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
#include <api/service/servicei.h>
|
||||
template <class T>
|
||||
class AccRoleServerCreatorSingle : public waServiceFactoryTSingle<svc_accRoleServer, T> {
|
||||
public:
|
||||
svc_accRoleServer *getHandler() {
|
||||
return getSingleService();
|
||||
}
|
||||
};
|
||||
|
||||
#include <api/service/svc_enum.h>
|
||||
#include <bfc/string/string.h>
|
||||
|
||||
class AccRoleServerEnum : public SvcEnumT<svc_accRoleServer> {
|
||||
public:
|
||||
AccRoleServerEnum(int role) : roletest(role) { }
|
||||
protected:
|
||||
virtual int testService(svc_accRoleServer *svc) {
|
||||
return (svc->handleRole(roletest));
|
||||
}
|
||||
private:
|
||||
int roletest;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
38
Src/Wasabi/api/service/svcs/svc_action.cpp
Normal file
38
Src/Wasabi/api/service/svcs/svc_action.cpp
Normal file
|
@ -0,0 +1,38 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "svc_action.h"
|
||||
|
||||
#define CBCLASS svc_actionI
|
||||
START_DISPATCH;
|
||||
CB(HASACTION, hasAction);
|
||||
CB(ONACTION, onAction);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
||||
svc_actionI::~svc_actionI()
|
||||
{
|
||||
actions.deleteAll();
|
||||
}
|
||||
|
||||
void svc_actionI::registerAction(const wchar_t *actionid, int pvtid)
|
||||
{
|
||||
ASSERT(actionid != NULL);
|
||||
actions.addItem(new ActionEntry(actionid, pvtid));
|
||||
}
|
||||
|
||||
int svc_actionI::hasAction(const wchar_t *name)
|
||||
{
|
||||
if (name == NULL) return FALSE;
|
||||
return (actions.findItem(name) != NULL);
|
||||
}
|
||||
|
||||
int svc_actionI::onAction(const wchar_t *action, const wchar_t *param, intptr_t p1, intptr_t p2, void *data, size_t datalen, ifc_window *source)
|
||||
{
|
||||
if (action == NULL) return 0;
|
||||
int pos = -1;
|
||||
if (actions.findItem(action, &pos))
|
||||
{
|
||||
return onActionId(actions.enumItem(pos)->getId(), action, param, p1, p2, data, datalen, source);
|
||||
}
|
||||
return 0;
|
||||
}
|
154
Src/Wasabi/api/service/svcs/svc_action.h
Normal file
154
Src/Wasabi/api/service/svcs/svc_action.h
Normal file
|
@ -0,0 +1,154 @@
|
|||
#ifndef _SVC_ACTION_H
|
||||
#define _SVC_ACTION_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <bfc/string/bfcstring.h>
|
||||
#include <bfc/ptrlist.h>
|
||||
|
||||
#include <api/service/services.h>
|
||||
|
||||
class ifc_window;
|
||||
|
||||
class NOVTABLE svc_action : public Dispatchable {
|
||||
protected:
|
||||
svc_action() { }
|
||||
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::ACTION; }
|
||||
|
||||
int hasAction(const wchar_t *name);
|
||||
int onAction(const wchar_t *action, const wchar_t *param=NULL, intptr_t p1=0, intptr_t p2=0, void *data=NULL, size_t datalen=0, ifc_window *source=NULL);
|
||||
|
||||
enum {
|
||||
HASACTION=10,
|
||||
ONACTION=20,
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
inline int svc_action::hasAction(const wchar_t *name) {
|
||||
return _call(HASACTION, 0, name);
|
||||
}
|
||||
|
||||
inline int svc_action::onAction(const wchar_t *action, const wchar_t *param, intptr_t p1, intptr_t p2, void *data, size_t datalen, ifc_window *source) {
|
||||
return _call(ONACTION, 0, action, param, p1, p2, data, datalen, source);
|
||||
}
|
||||
|
||||
class ActionEntry {
|
||||
public:
|
||||
ActionEntry(const wchar_t *_action, int _id) : action(_action), id(_id) {}
|
||||
virtual ~ActionEntry() { }
|
||||
|
||||
const wchar_t *getAction() { return action; }
|
||||
int getId() { return id; }
|
||||
|
||||
private:
|
||||
StringW action;
|
||||
int id;
|
||||
};
|
||||
|
||||
class SortActions {
|
||||
public:
|
||||
static int compareItem(ActionEntry *p1, ActionEntry *p2) {
|
||||
return WCSICMP(p1->getAction(), p2->getAction());
|
||||
}
|
||||
static int compareAttrib(const wchar_t *attrib, ActionEntry *item) {
|
||||
return WCSICMP(attrib, item->getAction());
|
||||
}
|
||||
};
|
||||
|
||||
class NOVTABLE svc_actionI : public svc_action {
|
||||
public:
|
||||
virtual ~svc_actionI();
|
||||
void registerAction(const wchar_t *actionid, int pvtid);
|
||||
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)=0;
|
||||
|
||||
protected:
|
||||
virtual int hasAction(const wchar_t *name);
|
||||
virtual int onAction(const wchar_t *action, const wchar_t *param=NULL, intptr_t p1=0, intptr_t p2=0, void *data=NULL, size_t datalen=0, ifc_window *source=NULL);
|
||||
|
||||
PtrListQuickSorted<ActionEntry, SortActions> actions;
|
||||
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
#include <api/service/servicei.h>
|
||||
template <class T>
|
||||
class ActionCreator : public waServiceFactoryT<svc_action, T> {};
|
||||
template <class T>
|
||||
class ActionCreatorSingle : public waServiceFactoryTSingle<svc_action, T> {
|
||||
public:
|
||||
svc_action *getHandler() {
|
||||
return waServiceFactoryT<svc_action, T>::getSingleService();
|
||||
}
|
||||
};
|
||||
|
||||
#include <api/service/svc_enum.h>
|
||||
#include <bfc/string/StringW.h>
|
||||
|
||||
class ActionEnum : public SvcEnumT<svc_action> {
|
||||
public:
|
||||
ActionEnum(const wchar_t *_action) : action(_action) { }
|
||||
protected:
|
||||
virtual int testService(svc_action *svc) {
|
||||
return (!action.isempty() && svc->hasAction(action));
|
||||
}
|
||||
private:
|
||||
StringW action;
|
||||
};
|
||||
|
||||
class FireAction {
|
||||
public:
|
||||
enum {
|
||||
ACTION_NOT_HANDLED = 0x80000000
|
||||
};
|
||||
/**
|
||||
Fire a named action out into the system with the given parameters.
|
||||
|
||||
This method will only send the action to the first registered handler for that action.
|
||||
|
||||
This prevents the action from being overridden or handled by newer wacs.
|
||||
|
||||
The content and syntax of the generalized params are defined by the handler of the action string.
|
||||
|
||||
Read: Using Wasabi: General Development: Actions
|
||||
|
||||
@see svc_actionI
|
||||
@param action The action string.
|
||||
@param param A string parameter to the action.
|
||||
@param p1 The first integer parameter to the action.
|
||||
@param p2 The second integer parameter to the action.
|
||||
@param data An untyped data buffer parameter to the action.
|
||||
@param datalen The size in bytes of the data buffer parameter.
|
||||
@param source A window object that can be given as the source object, if the action handler is expecting one. Actions bound to guiobjects use that guiobject's rootwnd pointer as the source.
|
||||
@param apply_to_all Send the action to everyone. (If false only sends to first registered)
|
||||
*/
|
||||
FireAction(const wchar_t *action, const wchar_t *param = NULL, intptr_t p1 = 0, intptr_t p2 = 0, void *data = NULL, size_t datalen = 0, ifc_window *source = NULL, int apply_to_all = TRUE) {
|
||||
lastretval = ACTION_NOT_HANDLED;
|
||||
ActionEnum ae(action);
|
||||
svc_action *act;
|
||||
while ((act = ae.getNext()) != NULL) {
|
||||
lastretval = act->onAction(action, param, p1, p2, data, datalen, source);
|
||||
ae.release(act);
|
||||
if (!apply_to_all) break;
|
||||
}
|
||||
}
|
||||
/**
|
||||
More robust retval handling is needed.
|
||||
|
||||
I ought to be grabbing all of the return values into a list an exposing that.
|
||||
|
||||
Later.
|
||||
|
||||
Read: Using Wasabi: General Development: Actions
|
||||
|
||||
@see svc_actionI
|
||||
@ret The return code of the action sent.
|
||||
*/
|
||||
int getLastReturnValue() {
|
||||
return lastretval;
|
||||
}
|
||||
private:
|
||||
int lastretval;
|
||||
};
|
||||
|
||||
#endif
|
70
Src/Wasabi/api/service/svcs/svc_burner.cpp
Normal file
70
Src/Wasabi/api/service/svcs/svc_burner.cpp
Normal file
|
@ -0,0 +1,70 @@
|
|||
#include <precomp.h>
|
||||
#include "svc_burner.h"
|
||||
#include <api/api.h>
|
||||
|
||||
#define CBCLASS svc_mediaRecorderI
|
||||
START_DISPATCH;
|
||||
CB(ISSESSIONSUPPORTED,isSessionSupported)
|
||||
CB(ISMEDIASUPPORTED,isMediaSupported)
|
||||
CB(GETNUMDEVICES,getNumDevices)
|
||||
CB(ENUMDEVICE,enumDevice)
|
||||
VCB(REFRESHDEVICES,refreshDevices)
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
||||
#define CBCLASS MediaRecorder::DeviceI
|
||||
START_DISPATCH;
|
||||
CB(GETDEPENDENCYPTR,getDependencyPtr)
|
||||
CB(GETDEVICENAME,getDeviceName)
|
||||
CB(GETDEVICETYPE,getDeviceType)
|
||||
CB(GETDEVICEDESCRIPTION,getDeviceDescription)
|
||||
CB(ENUMDEVICESPEEDS,enumDeviceSpeeds)
|
||||
CB(GETMEDIASIZE,getMediaSize)
|
||||
CB(GETMEDIAFREE,getMediaFree)
|
||||
VCB(CLEARSESSIONS,clearSessions)
|
||||
CB(ADDSESSION,addSession)
|
||||
CB(GETSESSION,getSession)
|
||||
CB(SETRECORDSPEED,setRecordSpeed)
|
||||
CB(SETTEST,setTest)
|
||||
CB(SETCLOSEDISC,setCloseDisc)
|
||||
CB(CANBURNNOW,canBurnNow)
|
||||
CB(CANCANCEL,canCancel)
|
||||
CB(BEGIN,begin)
|
||||
CB(END,end)
|
||||
CB(CANCEL,cancel)
|
||||
CB(GETSTATUS,getStatus)
|
||||
CB(GETPROGRESS,getProgress)
|
||||
CB(GETSTATUSTEXT,getStatusText)
|
||||
CB(GETLASTERROR,getLastError)
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
||||
#define CBCLASS MediaRecorder::SessionI
|
||||
START_DISPATCH;
|
||||
CB(GETSESSIONTYPE,getSessionType)
|
||||
CB(CLOSESESSION,closeSession)
|
||||
CB(GETNUMENTRIES,getNumEntries)
|
||||
CB(ENUMENTRY,enumEntry)
|
||||
CB(GETTOTALBYTES,getTotalBytes)
|
||||
CB(GETTOTALTIME,getTotalTime)
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
||||
const char *MediaRecorder::RedbookSession::enumEntry(int n) {
|
||||
if( n>=getNumEntries()) return NULL;
|
||||
return m_tracks[n]->getValue();
|
||||
}
|
||||
|
||||
int MediaRecorder::RedbookSession::getTotalBytes() {
|
||||
double length=(double)getTotalTime();
|
||||
return (int)(length*(44100*4)/1000); //always 44khz 16bps stereo
|
||||
}
|
||||
|
||||
int MediaRecorder::RedbookSession::getTotalTime() {
|
||||
int total=0;
|
||||
for(int i=0;i<getNumEntries();i++) {
|
||||
int length=0;
|
||||
if((length=api->metadb_getLength(m_tracks[i]->getValue()))!=-1) total+=length;
|
||||
}
|
||||
return total;
|
||||
}
|
243
Src/Wasabi/api/service/svcs/svc_burner.h
Normal file
243
Src/Wasabi/api/service/svcs/svc_burner.h
Normal file
|
@ -0,0 +1,243 @@
|
|||
#ifndef _SVC_BURNER_H
|
||||
#define _SVC_BURNER_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <bfc/depend.h>
|
||||
#include <bfc/string/string.h>
|
||||
#include <api/service/services.h>
|
||||
|
||||
namespace MediaRecorder {
|
||||
|
||||
class Session : public Dispatchable {
|
||||
protected:
|
||||
Session() {} // protect constructor
|
||||
|
||||
public:
|
||||
int getSessionType() { return _call(GETSESSIONTYPE,0); }
|
||||
enum {
|
||||
Session_REDBOOK, Session_DATA, Session_ISO
|
||||
};
|
||||
int closeSession() { return _call(CLOSESESSION,0); }
|
||||
int getNumEntries() { return _call(GETNUMENTRIES,0); }
|
||||
const char *enumEntry(int n) { return _call(ENUMENTRY,(const char *)NULL,n); }
|
||||
int getTotalBytes() { return _call(GETTOTALBYTES,0); }
|
||||
int getTotalTime() { return _call(GETTOTALTIME,0); }
|
||||
|
||||
enum {
|
||||
GETSESSIONTYPE=10,
|
||||
CLOSESESSION=20,
|
||||
GETNUMENTRIES=30,
|
||||
ENUMENTRY=40,
|
||||
GETTOTALBYTES=50,
|
||||
GETTOTALTIME=60,
|
||||
};
|
||||
};
|
||||
|
||||
// this represents one session on the cd
|
||||
// normal audio cds have 1 redbook session, mixed mode has 2 (or more), with
|
||||
// 1 audio followed by 1 or more data
|
||||
class SessionI : public Session {
|
||||
public:
|
||||
virtual int getSessionType()=0;
|
||||
|
||||
virtual int closeSession()=0;
|
||||
virtual int getNumEntries()=0;
|
||||
virtual const char *enumEntry(int n)=0;
|
||||
virtual int getTotalBytes()=0; //total space used in bytes
|
||||
virtual int getTotalTime()=0; //total time used in ms
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
class RedbookSession : public SessionI {
|
||||
public:
|
||||
virtual ~RedbookSession() { m_tracks.deleteAll(); }
|
||||
|
||||
int getSessionType() { return Session_REDBOOK; }
|
||||
|
||||
int closeSession() { return 1; }
|
||||
|
||||
void addEntry(const char *file) { m_tracks.addItem(new String(file)); }
|
||||
int getNumEntries() { return m_tracks.getNumItems(); }
|
||||
void removeEntry(int n) { m_tracks.deleteItem(n); }
|
||||
void clearEntries() { m_tracks.deleteAll(); }
|
||||
|
||||
const char *enumEntry(int n);
|
||||
int getTotalBytes();
|
||||
int getTotalTime();
|
||||
|
||||
protected:
|
||||
PtrList<String> m_tracks;
|
||||
};
|
||||
|
||||
// this is the physical device
|
||||
class Device : public Dispatchable {
|
||||
protected:
|
||||
Device() {} // protect constructor
|
||||
|
||||
public:
|
||||
static const GUID *depend_getClassGuid() {
|
||||
// {23F48039-455D-4348-86D5-0A82754678FC}
|
||||
static const GUID ret =
|
||||
{ 0x23f48039, 0x455d, 0x4348, { 0x86, 0xd5, 0xa, 0x82, 0x75, 0x46, 0x78, 0xfc } };
|
||||
return &ret;
|
||||
}
|
||||
|
||||
api_dependent *getDependencyPtr() { return _call(GETDEPENDENCYPTR,(api_dependent *)NULL); }
|
||||
|
||||
const char *getDeviceName() { return _call(GETDEVICENAME,(const char *)NULL); }
|
||||
const char *getDeviceType() { return _call(GETDEVICETYPE,(const char *)NULL); }
|
||||
const char *getDeviceDescription() { return _call(GETDEVICEDESCRIPTION,(const char *)NULL); }
|
||||
|
||||
int enumDeviceSpeeds(int n) { return _call(ENUMDEVICESPEEDS,0,n); }
|
||||
|
||||
int getMediaSize() { return _call(GETMEDIASIZE,0); }
|
||||
int getMediaFree() { return _call(GETMEDIAFREE,0); }
|
||||
|
||||
void clearSessions() { _voidcall(CLEARSESSIONS); }
|
||||
int addSession(Session *session) { return _call(ADDSESSION,0,session); }
|
||||
Session *getSession(int num) { return _call(GETSESSION,(Session *)NULL,num); }
|
||||
|
||||
int setRecordSpeed(int kbps) { return _call(SETRECORDSPEED,0,kbps); }
|
||||
int setTest(int testmode) { return _call(SETTEST,0,testmode); }
|
||||
int setCloseDisc(int closedisc) { return _call(SETCLOSEDISC,0,closedisc); }
|
||||
|
||||
int canBurnNow() { return _call(CANBURNNOW,0); }
|
||||
int canCancel() { return _call(CANCANCEL,0); }
|
||||
|
||||
int begin() { return _call(BEGIN,0); }
|
||||
int end() { return _call(END,0); }
|
||||
int cancel() { return _call(CANCEL,0); }
|
||||
|
||||
int getStatus() { return _call(GETSTATUS,0); }
|
||||
enum {
|
||||
Status_IDLE, Status_PREPARING, Status_BURNING, Status_DONE,
|
||||
};
|
||||
|
||||
int getProgress() { return _call(GETPROGRESS,0); }
|
||||
const char *getStatusText() { return _call(GETSTATUSTEXT,(const char *)NULL); }
|
||||
|
||||
const char *getLastError() { return _call(GETLASTERROR,(const char *)NULL); }
|
||||
|
||||
enum {
|
||||
Event_PREPAREBEGIN=100,
|
||||
Event_MEDIATRANSCODED=200, // params is item #
|
||||
Event_PREPAREEND=300,
|
||||
Event_BURNBEGIN=400,
|
||||
Event_ENTRYCOMPLETE=500, // param is the position in bytes
|
||||
Event_SESSIONCOMPLETE=600,
|
||||
Event_BURNEND=700,
|
||||
Event_ERROR=800,
|
||||
Event_MEDIACHANGE=900, // user put in a different disc
|
||||
};
|
||||
|
||||
enum {
|
||||
GETDEPENDENCYPTR=10,
|
||||
GETDEVICENAME=20,
|
||||
GETDEVICETYPE=30,
|
||||
GETDEVICEDESCRIPTION=40,
|
||||
ENUMDEVICESPEEDS=50,
|
||||
GETMEDIASIZE=60,
|
||||
GETMEDIAFREE=70,
|
||||
CLEARSESSIONS=80,
|
||||
ADDSESSION=90,
|
||||
GETSESSION=100,
|
||||
SETRECORDSPEED=110,
|
||||
SETTEST=120,
|
||||
SETCLOSEDISC=130,
|
||||
CANBURNNOW=140,
|
||||
CANCANCEL=150,
|
||||
BEGIN=160,
|
||||
END=170,
|
||||
CANCEL=180,
|
||||
GETSTATUS=190,
|
||||
GETPROGRESS=200,
|
||||
GETSTATUSTEXT=210,
|
||||
GETLASTERROR=220,
|
||||
};
|
||||
};
|
||||
|
||||
class DeviceI : public Device {
|
||||
public:
|
||||
virtual api_dependent *getDependencyPtr()=0; // for events
|
||||
|
||||
virtual const char *getDeviceName()=0; // internal device name
|
||||
virtual const char *getDeviceType()=0; // "CD-R", "CD-RW", "DVD-R" etc
|
||||
virtual const char *getDeviceDescription()=0; // user readable string
|
||||
|
||||
virtual int enumDeviceSpeeds(int n)=0; // in kb/s
|
||||
|
||||
virtual int getMediaSize()=0; // total space in bytes
|
||||
virtual int getMediaFree()=0; // free space in bytes
|
||||
|
||||
virtual void clearSessions()=0;
|
||||
virtual int addSession(Session *session)=0;
|
||||
virtual Session *getSession(int num)=0;
|
||||
|
||||
virtual int setRecordSpeed(int kbps)=0; //kbps==0 means max speed
|
||||
virtual int setTest(int testmode)=0; // if true, don't really burn
|
||||
virtual int setCloseDisc(int closedisc)=0; // if true, close entire disc at end
|
||||
|
||||
virtual int canBurnNow()=0; // return 1 if everything's ready
|
||||
virtual int canCancel()=0; // return 1 if we can cancel (during burning)
|
||||
|
||||
virtual int begin()=0;
|
||||
virtual int end()=0;
|
||||
virtual int cancel()=0;
|
||||
|
||||
virtual int getStatus()=0;
|
||||
virtual int getProgress()=0; // # of bytes written
|
||||
virtual const char *getStatusText()=0; // like "xx% complete" or something
|
||||
|
||||
virtual const char *getLastError()=0;
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
}; // end namespace MediaRecorder
|
||||
|
||||
//don't override this one
|
||||
class NOVTABLE svc_mediaRecorder : public Dispatchable {
|
||||
protected:
|
||||
svc_mediaRecorder() {} // protect constructor
|
||||
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::MEDIARECORDER; }
|
||||
|
||||
int isSessionSupported(MediaRecorder::Session *session) { return _call(ISSESSIONSUPPORTED,0,session); }
|
||||
int isMediaSupported(const char *medianame) { return _call(ISMEDIASUPPORTED,0,medianame); }
|
||||
|
||||
int getNumDevices() { return _call(GETNUMDEVICES,0); }
|
||||
MediaRecorder::Device *enumDevice(int n) { return _call(ENUMDEVICE,(MediaRecorder::Device*)NULL,n); }
|
||||
|
||||
void refreshDevices() { _voidcall(REFRESHDEVICES); }
|
||||
|
||||
enum {
|
||||
ISSESSIONSUPPORTED=10,
|
||||
ISMEDIASUPPORTED=20,
|
||||
GETNUMDEVICES=30,
|
||||
ENUMDEVICE=40,
|
||||
REFRESHDEVICES=50,
|
||||
};
|
||||
};
|
||||
|
||||
// this should be implemented by a given burning lib
|
||||
class NOVTABLE svc_mediaRecorderI : public svc_mediaRecorder {
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::MEDIARECORDER; }
|
||||
|
||||
virtual int isSessionSupported(MediaRecorder::Session *session)=0;
|
||||
virtual int isMediaSupported(const char *medianame)=0;// "CD-R", "DVD-R", etc.
|
||||
|
||||
virtual int getNumDevices()=0;
|
||||
virtual MediaRecorder::Device *enumDevice(int n)=0;
|
||||
|
||||
virtual void refreshDevices()=0;
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
#endif
|
194
Src/Wasabi/api/service/svcs/svc_collection.cpp
Normal file
194
Src/Wasabi/api/service/svcs/svc_collection.cpp
Normal file
|
@ -0,0 +1,194 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "svc_collection.h"
|
||||
|
||||
// an named xml overridable collection of objects
|
||||
|
||||
#define CBCLASS svc_collectionI
|
||||
START_DISPATCH;
|
||||
CB(COLLECTION_TESTTAG, testTag);
|
||||
VCB(COLLECTION_ADDELEMENT, addElement);
|
||||
VCB(COLLECTION_REMOVEELEMENT, removeElement);
|
||||
VCB(COLLECTION_REMOVEALLELEMENTS, removeAllElements);
|
||||
CB(COLLECTION_GETNUMELEMENTS, getNumElements);
|
||||
CB(COLLECTION_GETNUMELEMENTSUNIQUE, getNumElementsUnique);
|
||||
CB(COLLECTION_ENUMELEMENT, enumElement);
|
||||
CB(COLLECTION_ENUMELEMENTUNIQUE, enumElementUnique);
|
||||
CB(COLLECTION_GETELEMENT, getElement);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
||||
#define CBCLASS CollectionElementI
|
||||
START_DISPATCH;
|
||||
CB(COLLECTIONELEMENT_GETID, getId);
|
||||
CB(COLLECTIONELEMENT_GETPARAMVALUE, getParamValue);
|
||||
CB(COLLECTIONELEMENT_GETPARAMVALUEINT, getParamValueInt);
|
||||
CB(COLLECTIONELEMENT_GETINCLUDEPATH, getIncludePath);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
||||
|
||||
svc_collectionI::svc_collectionI() {
|
||||
count = 0;
|
||||
elements.setAutoSort(1);
|
||||
}
|
||||
|
||||
svc_collectionI::~svc_collectionI() {
|
||||
}
|
||||
|
||||
void svc_collectionI::addElement(const char *id, const char *includepath, int incrementalremovalid, skin_xmlreaderparams *params) {
|
||||
CollectionElementI *cei = new CollectionElementI(this, id, params, incrementalremovalid, includepath);
|
||||
elements.addItem(cei);
|
||||
}
|
||||
|
||||
void svc_collectionI::removeElement(int removalid) {
|
||||
for (int i=0;i<elements.getNumItems();i++) {
|
||||
CollectionElementI *e = elements.enumItem(i);
|
||||
if (e->getSecCount() == removalid) {
|
||||
elements.removeItem(e);
|
||||
delete e;
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void svc_collectionI::removeAllElements() {
|
||||
elements.deleteAll();
|
||||
}
|
||||
|
||||
int svc_collectionI::getNumElements() {
|
||||
return elements.getNumItems();
|
||||
}
|
||||
|
||||
int svc_collectionI::getNumElementsUnique() {
|
||||
int i=0;
|
||||
int n=0;
|
||||
const char *previous = NULL;
|
||||
for (i=0;i<elements.getNumItems();i++) {
|
||||
const char *id = elements.enumItem(i)->getId();
|
||||
if (!STRCASEEQLSAFE(id, previous))
|
||||
n++;
|
||||
previous = id;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
CollectionElement *svc_collectionI::enumElementUnique(int n, int *ancestor) {
|
||||
int i=0;
|
||||
int _n=-1;
|
||||
CollectionElement *e=NULL;
|
||||
CollectionElement *previous = NULL;
|
||||
elements.sort(1);
|
||||
for (i=0;i<elements.getNumItems();i++) {
|
||||
CollectionElement *c = elements.enumItem(i);
|
||||
if (!STRCASEEQLSAFE(c->getId(), previous ? previous->getId() : NULL)) {
|
||||
if (_n == n)
|
||||
break;
|
||||
_n++;
|
||||
}
|
||||
previous = c;
|
||||
}
|
||||
if (_n == n)
|
||||
e = previous;
|
||||
else
|
||||
e = NULL;
|
||||
if (ancestor != NULL) {
|
||||
if (e != NULL) {
|
||||
int pos=-1;
|
||||
elements.findItem(static_cast<CollectionElementI*>(e), &pos);
|
||||
if (pos > 0) {
|
||||
CollectionElement *f = elements.enumItem(pos-1);
|
||||
if (!STRCASEEQLSAFE(f ? f->getId() : NULL, e->getId())) *ancestor = -1;
|
||||
} else {
|
||||
*ancestor = -1;
|
||||
e = NULL;
|
||||
}
|
||||
} else
|
||||
*ancestor = -1;
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
CollectionElement *svc_collectionI::enumElement(int n, int *ancestor) {
|
||||
CollectionElement *e = elements.enumItem(n);
|
||||
if (ancestor != NULL) {
|
||||
CollectionElement *a = elements.enumItem(n-1);
|
||||
if (!STRCASEEQL(a->getId(), e->getId())) *ancestor = -1;
|
||||
*ancestor = n-1;
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
CollectionElement *svc_collectionI::getElement(const char *id, int *ancestor) {
|
||||
int pos=-1;
|
||||
CollectionElement *e = elements.findLastItem(id, &pos);
|
||||
if (ancestor != NULL) {
|
||||
CollectionElement *a = elements.enumItem(pos-1);
|
||||
if (!STRCASEEQL(a->getId(), e->getId())) *ancestor = -1;
|
||||
*ancestor = pos-1;
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
CollectionElement *svc_collectionI::getAncestor(CollectionElement *e) {
|
||||
int pos=-1;
|
||||
CollectionElementI *ei = static_cast<CollectionElementI *>(e);
|
||||
elements.findItem(ei, &pos);
|
||||
if (pos >= 0) {
|
||||
pos--;
|
||||
if (STRCASEEQL(elements.enumItem(pos)->getId(), e->getId())) return elements.enumItem(pos);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CollectionElementI::CollectionElementI(svc_collectionI *col, const char *_id, skin_xmlreaderparams *p, int _seccount, const char *_path) {
|
||||
id = _id;
|
||||
for (int i=0;i<p->getNbItems();i++) {
|
||||
Pair < String, String > *pr = new Pair < String, String >("","");
|
||||
pr->a = p->getItemName(i);
|
||||
pr->b = p->getItemValue(i);
|
||||
params.addItem(pr);
|
||||
}
|
||||
seccount = _seccount;
|
||||
collection = col;
|
||||
path = _path;
|
||||
}
|
||||
|
||||
CollectionElementI::~CollectionElementI() {
|
||||
params.deleteAll();
|
||||
}
|
||||
|
||||
const char *CollectionElementI::getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
const char *CollectionElementI::getParamValue(const char *param, CollectionElement **item){
|
||||
CollectionElement *e = getAncestor();
|
||||
const char *a = e ? e->getParamValue(param) : NULL;
|
||||
Pair<String, String> *p = params.findItem(param);
|
||||
a = p ? p->b.getValue() : a;
|
||||
if (item && p != NULL) *item = this;
|
||||
return a;
|
||||
}
|
||||
|
||||
int CollectionElementI::getParamValueInt(const char *param){
|
||||
const char *a = getParamValue(param);
|
||||
return ATOI(a);
|
||||
}
|
||||
|
||||
int CollectionElementI::getSecCount() {
|
||||
return seccount;
|
||||
}
|
||||
|
||||
CollectionElement *CollectionElementI::getAncestor() {
|
||||
return collection->getAncestor(this);
|
||||
}
|
||||
|
||||
const char *CollectionElementI::getIncludePath(const char *param/* =NULL */) {
|
||||
if (param == NULL) return path;
|
||||
CollectionElement *i;
|
||||
if (!getParamValue(param, &i)) return NULL;
|
||||
if (i != NULL)
|
||||
return i->getIncludePath(NULL);
|
||||
return NULL;
|
||||
}
|
226
Src/Wasabi/api/service/svcs/svc_collection.h
Normal file
226
Src/Wasabi/api/service/svcs/svc_collection.h
Normal file
|
@ -0,0 +1,226 @@
|
|||
#ifndef _SVC_COLLECTION_H
|
||||
#define _SVC_COLLECTION_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <bfc/ptrlist.h>
|
||||
#include <bfc/pair.h>
|
||||
#include <api/xml/xmlreader.h>
|
||||
#include <api/service/services.h>
|
||||
|
||||
class CollectionElement;
|
||||
class svc_collectionI;
|
||||
|
||||
class NOVTABLE svc_collection : public Dispatchable
|
||||
{
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::COLLECTION; }
|
||||
int testTag(const wchar_t *xmltag);
|
||||
void addElement(const wchar_t *id, const wchar_t *includepath, int removalid, skin_xmlreaderparams *params);
|
||||
void removeElement(int recored_value);
|
||||
void removeAllElements();
|
||||
int getNumElements();
|
||||
int getNumElementsUnique();
|
||||
CollectionElement *enumElement(int n, int *ancestor);
|
||||
CollectionElement *enumElementUnique(int n, int *ancestor);
|
||||
CollectionElement *getElement(const wchar_t *id, int *ancestor);
|
||||
CollectionElement *getAncestor(CollectionElement *e);
|
||||
|
||||
enum
|
||||
{
|
||||
COLLECTION_TESTTAG=10,
|
||||
COLLECTION_ADDELEMENT=20,
|
||||
COLLECTION_REMOVEELEMENT=30,
|
||||
COLLECTION_REMOVEALLELEMENTS=35,
|
||||
COLLECTION_GETNUMELEMENTS=40,
|
||||
COLLECTION_GETNUMELEMENTSUNIQUE=50,
|
||||
COLLECTION_ENUMELEMENT=60,
|
||||
COLLECTION_ENUMELEMENTUNIQUE=70,
|
||||
COLLECTION_GETELEMENT=80,
|
||||
};
|
||||
};
|
||||
|
||||
inline int svc_collection::testTag(const wchar_t *xmltag) {
|
||||
return _call(COLLECTION_TESTTAG, 0, xmltag);
|
||||
}
|
||||
|
||||
inline void svc_collection::addElement(const wchar_t *id, const wchar_t *includepath, int incrementalremovalid, skin_xmlreaderparams *params) {
|
||||
_voidcall(COLLECTION_ADDELEMENT, id, includepath, incrementalremovalid, params);
|
||||
}
|
||||
|
||||
inline void svc_collection::removeElement(int removalid) {
|
||||
_voidcall(COLLECTION_REMOVEELEMENT, removalid);
|
||||
}
|
||||
|
||||
inline void svc_collection::removeAllElements() {
|
||||
_voidcall(COLLECTION_REMOVEALLELEMENTS);
|
||||
}
|
||||
|
||||
inline int svc_collection::getNumElements() {
|
||||
return _call(COLLECTION_GETNUMELEMENTS, 0);
|
||||
}
|
||||
|
||||
inline int svc_collection::getNumElementsUnique() {
|
||||
return _call(COLLECTION_GETNUMELEMENTSUNIQUE, 0);
|
||||
}
|
||||
|
||||
inline CollectionElement *svc_collection::enumElement(int n, int *ancestor) {
|
||||
return _call(COLLECTION_ENUMELEMENT, (CollectionElement *)NULL, n, ancestor);
|
||||
}
|
||||
|
||||
inline CollectionElement *svc_collection::enumElementUnique(int n, int *ancestor) {
|
||||
return _call(COLLECTION_ENUMELEMENTUNIQUE, (CollectionElement *)NULL, n, ancestor);
|
||||
}
|
||||
|
||||
inline CollectionElement *svc_collection::getElement(const wchar_t *id, int *ancestor) {
|
||||
return _call(COLLECTION_GETELEMENT, (CollectionElement *)NULL, id, ancestor);
|
||||
}
|
||||
|
||||
class SortPairString {
|
||||
public:
|
||||
static int compareItem(Pair<StringW, StringW> *p1, Pair<StringW, StringW> *p2) {
|
||||
return WCSICMP(p1->a, p2->a);
|
||||
}
|
||||
static int compareAttrib(const wchar_t *attrib, Pair<StringW, StringW> *item) {
|
||||
return WCSICMP(attrib, item->a);
|
||||
}
|
||||
};
|
||||
|
||||
class CollectionElement : public Dispatchable {
|
||||
public:
|
||||
const wchar_t *getId();
|
||||
const wchar_t *getParamValue(const wchar_t *param, CollectionElement **item=NULL);
|
||||
int getParamValueInt(const wchar_t *param);
|
||||
const wchar_t *getIncludePath(const wchar_t *param=NULL);
|
||||
CollectionElement *getAncestor();
|
||||
|
||||
enum {
|
||||
COLLECTIONELEMENT_GETID=10,
|
||||
COLLECTIONELEMENT_GETPARAMVALUE=20,
|
||||
COLLECTIONELEMENT_GETPARAMVALUEINT=30,
|
||||
COLLECTIONELEMENT_GETANCESTOR=40,
|
||||
COLLECTIONELEMENT_GETINCLUDEPATH=50,
|
||||
};
|
||||
};
|
||||
|
||||
inline const wchar_t *CollectionElement::getId() {
|
||||
return _call(COLLECTIONELEMENT_GETID, (const wchar_t *)NULL);
|
||||
}
|
||||
|
||||
inline const wchar_t *CollectionElement::getParamValue(const wchar_t *param, CollectionElement **item) {
|
||||
return _call(COLLECTIONELEMENT_GETPARAMVALUE, (const wchar_t *)NULL, param, item);
|
||||
}
|
||||
|
||||
inline int CollectionElement::getParamValueInt(const wchar_t *param) {
|
||||
return _call(COLLECTIONELEMENT_GETPARAMVALUEINT, 0, param);
|
||||
}
|
||||
|
||||
inline CollectionElement *CollectionElement::getAncestor() {
|
||||
return _call(COLLECTIONELEMENT_GETANCESTOR, (CollectionElement *)NULL);
|
||||
}
|
||||
|
||||
inline const wchar_t *CollectionElement::getIncludePath(const wchar_t *param) {
|
||||
return _call(COLLECTIONELEMENT_GETINCLUDEPATH, (const wchar_t *)NULL, param);
|
||||
}
|
||||
|
||||
class CollectionElementI : public CollectionElement {
|
||||
public:
|
||||
CollectionElementI(svc_collectionI *collectionI, const wchar_t *id, skin_xmlreaderparams *params, int seccount, const wchar_t *includepath);
|
||||
virtual ~CollectionElementI();
|
||||
|
||||
virtual const wchar_t *getId();
|
||||
virtual const wchar_t *getParamValue(const wchar_t *param, CollectionElement **item=NULL);
|
||||
virtual int getParamValueInt(const wchar_t *param);
|
||||
virtual CollectionElement *getAncestor();
|
||||
const wchar_t *getIncludePath(const wchar_t *param=NULL); // null returns last override's include path
|
||||
|
||||
int getSecCount();
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
|
||||
PtrListQuickSorted < Pair < StringW, StringW >, SortPairString > params;
|
||||
StringW id;
|
||||
int seccount;
|
||||
svc_collectionI *collection;
|
||||
StringW path;
|
||||
};
|
||||
|
||||
class SortCollectionElementsI {
|
||||
public:
|
||||
static int compareItem(CollectionElementI *p1, CollectionElementI *p2) {
|
||||
int r = WCSICMP(p1->getId(), p2->getId());
|
||||
if (r == 0) {
|
||||
if (p1->getSecCount() < p2->getSecCount()) return -1;
|
||||
if (p1->getSecCount() > p2->getSecCount()) return 1;
|
||||
return 0;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
static int compareAttrib(const wchar_t *attrib, CollectionElementI *item) {
|
||||
return WCSICMP(attrib, item->getId());
|
||||
}
|
||||
};
|
||||
|
||||
// derive from this one
|
||||
class svc_collectionI : public svc_collection {
|
||||
public:
|
||||
svc_collectionI();
|
||||
virtual ~svc_collectionI();
|
||||
virtual int testTag(const wchar_t *xmltag)=0;
|
||||
virtual void addElement(const wchar_t *id, const wchar_t *includepath, int incrementalremovalid, skin_xmlreaderparams *params);
|
||||
virtual void removeElement(int removalid);
|
||||
virtual void removeAllElements();
|
||||
virtual int getNumElements();
|
||||
virtual int getNumElementsUnique();
|
||||
virtual CollectionElement *enumElement(int n, int *ancestor);
|
||||
virtual CollectionElement *enumElementUnique(int n, int *ancestor);
|
||||
virtual CollectionElement *getElement(const wchar_t *id, int *ancestor);
|
||||
virtual CollectionElement *getAncestor(CollectionElement *e);
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
|
||||
PtrListQuickMultiSorted < CollectionElementI, SortCollectionElementsI > elements;
|
||||
int count;
|
||||
};
|
||||
|
||||
#include <api/service/servicei.h>
|
||||
template <class T>
|
||||
class CollectionCreator : public waServiceFactoryTSingle<svc_collection, T> {};
|
||||
|
||||
template <wchar_t TAG[]>
|
||||
class CollectionSvc : public svc_collectionI {
|
||||
public:
|
||||
int testTag(const wchar_t *xmltag) {
|
||||
if (!WCSICMP(xmltag, TAG)) return 1;
|
||||
return 0;
|
||||
}
|
||||
static const char *getServiceName() { return StringPrintf("Collection Service for \"%S\"", TAG); }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class CollectionSvc2 : public svc_collectionI {
|
||||
public:
|
||||
int testTag(const wchar_t *xmltag) {
|
||||
if (STRCASEEQL(xmltag, T::collection_getXmlTag())) return 1;
|
||||
return 0;
|
||||
}
|
||||
static const char *getServiceName() { return StringPrintf("Collection Service for \"%S\"", T::collection_getXmlTag()); }
|
||||
};
|
||||
|
||||
|
||||
#include <api/service/svc_enum.h>
|
||||
#include <bfc/string/StringW.h>
|
||||
class CollectionSvcEnum : public SvcEnumT<svc_collection>
|
||||
{
|
||||
public:
|
||||
CollectionSvcEnum(const wchar_t *xmltag) : tag(xmltag) {}
|
||||
protected:
|
||||
virtual int testService(svc_collection *svc) {
|
||||
return (svc->testTag(tag));
|
||||
}
|
||||
private:
|
||||
StringW tag;
|
||||
};
|
||||
|
||||
#endif
|
10
Src/Wasabi/api/service/svcs/svc_console.cpp
Normal file
10
Src/Wasabi/api/service/svcs/svc_console.cpp
Normal file
|
@ -0,0 +1,10 @@
|
|||
|
||||
#include <svc_console.h>
|
||||
|
||||
#define CBCLASS svc_consoleI
|
||||
START_DISPATCH;
|
||||
CB(ACTIVATED, activated);
|
||||
CB(OUTPUTSTRING, outputString);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
36
Src/Wasabi/api/service/svcs/svc_console.h
Normal file
36
Src/Wasabi/api/service/svcs/svc_console.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
#ifndef _SVC_CONSOLE_H
|
||||
#define _SVC_CONSOLE_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
|
||||
class NOVTABLE svc_console : public Dispatchable
|
||||
{
|
||||
public:
|
||||
int activated();
|
||||
int outputString(int severity, const char *string);
|
||||
|
||||
enum {
|
||||
ACTIVATED=10,
|
||||
OUTPUTSTRING=20,
|
||||
};
|
||||
};
|
||||
|
||||
inline int svc_console::activated() {
|
||||
return _call(ACTIVATED, 0);
|
||||
}
|
||||
|
||||
inline int svc_console::outputString(int severity, const char *string) {
|
||||
return _call(OUTPUTSTRING, 0, severity, string);
|
||||
}
|
||||
|
||||
// derive from this one
|
||||
class svc_consoleI : public svc_console {
|
||||
public:
|
||||
virtual int activated()=0;
|
||||
virtual int outputString(int severity, const char *string)=0;
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
#endif
|
16
Src/Wasabi/api/service/svcs/svc_contextCmd.cpp
Normal file
16
Src/Wasabi/api/service/svcs/svc_contextCmd.cpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "svc_contextcmd.h"
|
||||
|
||||
#define CBCLASS svc_contextCmdI
|
||||
START_DISPATCH;
|
||||
CB(TESTITEM, testItem);
|
||||
CB(GETSUBMENU, getSubMenu);
|
||||
CB(GETSUBMENUTEXT, getSubMenuText);
|
||||
CB(GETCOMMAND, getCommand);
|
||||
CB(GETENABLED, getEnabled);
|
||||
CB(GETCHECKED, getChecked);
|
||||
CB(GETSORTVAL, getSortVal);
|
||||
VCB(ONCOMMAND, onCommand);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
127
Src/Wasabi/api/service/svcs/svc_contextCmd.h
Normal file
127
Src/Wasabi/api/service/svcs/svc_contextCmd.h
Normal file
|
@ -0,0 +1,127 @@
|
|||
#ifndef _SVC_CONTEXTCMD_H
|
||||
#define _SVC_CONTEXTCMD_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <api/service/services.h>
|
||||
|
||||
namespace ContextCmdSortVal {
|
||||
enum ContextCmdSortVal {
|
||||
BEGINNING = 0,
|
||||
MIDDLE = 32767,
|
||||
END = 65535,
|
||||
};
|
||||
};
|
||||
|
||||
class DragItem;
|
||||
|
||||
class NOVTABLE svc_contextCmd : public Dispatchable {
|
||||
protected:
|
||||
svc_contextCmd() {}
|
||||
~svc_contextCmd() {}
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::CONTEXTCMD; }
|
||||
|
||||
int testItem(DragItem *item, const wchar_t *menu_path);
|
||||
|
||||
int getSubMenu(DragItem *item, const wchar_t *menu_path);
|
||||
const wchar_t *getSubMenuText(const wchar_t *menu_path);
|
||||
|
||||
const wchar_t *getCommand(DragItem *item, int n);
|
||||
|
||||
int getEnabled(DragItem *item, int n);
|
||||
int getChecked(DragItem *item, int n);
|
||||
int getSortVal(DragItem *item, int n);
|
||||
|
||||
void onCommand(DragItem *item, int n);
|
||||
|
||||
protected:
|
||||
enum {
|
||||
TESTITEM,
|
||||
GETSUBMENU,
|
||||
GETSUBMENUTEXT,
|
||||
GETCOMMAND,
|
||||
GETENABLED,
|
||||
GETCHECKED,
|
||||
GETSORTVAL,
|
||||
ONCOMMAND,
|
||||
};
|
||||
};
|
||||
|
||||
inline int svc_contextCmd::testItem(DragItem *item, const wchar_t *menu_path) {
|
||||
return _call(TESTITEM, 0, item, menu_path);
|
||||
}
|
||||
|
||||
inline
|
||||
int svc_contextCmd::getSubMenu(DragItem *item, const wchar_t *menu_path) {
|
||||
return _call(GETSUBMENU, 0, item, menu_path);
|
||||
}
|
||||
|
||||
inline
|
||||
const wchar_t *svc_contextCmd::getSubMenuText(const wchar_t *menu_path) {
|
||||
return _call(GETSUBMENUTEXT, (const wchar_t *)NULL, menu_path);
|
||||
}
|
||||
|
||||
inline const wchar_t *svc_contextCmd::getCommand(DragItem *item, int n) {
|
||||
return _call(GETCOMMAND, (const wchar_t *)0, item, n);
|
||||
}
|
||||
|
||||
inline int svc_contextCmd::getEnabled(DragItem *item, int n) {
|
||||
return _call(GETENABLED, TRUE, item, n);
|
||||
}
|
||||
|
||||
inline int svc_contextCmd::getChecked(DragItem *item, int n) {
|
||||
return _call(GETCHECKED, FALSE, item, n);
|
||||
}
|
||||
|
||||
inline int svc_contextCmd::getSortVal(DragItem *item, int n) {
|
||||
return _call(GETSORTVAL, ContextCmdSortVal::MIDDLE, item, n);
|
||||
}
|
||||
|
||||
inline void svc_contextCmd::onCommand(DragItem *item, int n) {
|
||||
_voidcall(ONCOMMAND, item, n);
|
||||
}
|
||||
|
||||
class NOVTABLE svc_contextCmdI : public svc_contextCmd {
|
||||
public:
|
||||
virtual int testItem(DragItem *item, const wchar_t *menu_path)=0;
|
||||
|
||||
virtual int getSubMenu(DragItem *item, const wchar_t *menu_path) { return 0; }
|
||||
virtual const wchar_t *getSubMenuText(const wchar_t *menu_path) { return NULL; }
|
||||
|
||||
virtual const wchar_t *getCommand(DragItem *item, int n)=0;
|
||||
|
||||
// override these as needed
|
||||
virtual int getEnabled(DragItem *item, int n) { return TRUE; }
|
||||
virtual int getChecked(DragItem *item, int n) { return FALSE; }
|
||||
virtual int getSortVal(DragItem *item, int n) { return ContextCmdSortVal::MIDDLE; }
|
||||
|
||||
virtual void onCommand(DragItem *item, int n)=0;
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
#include <api/service/servicei.h>
|
||||
|
||||
template <class T>
|
||||
class ContextCmdCreator : public waServiceFactoryT<svc_contextCmd, T> { };
|
||||
|
||||
#include <api/service/svc_enum.h>
|
||||
#include <bfc/string/stringW.h>
|
||||
|
||||
class ContextCmdEnum : public SvcEnumT<svc_contextCmd> {
|
||||
public:
|
||||
ContextCmdEnum(DragItem *_item, const wchar_t *_menu_path)
|
||||
: item(_item), menu_path(_menu_path) {}
|
||||
|
||||
protected:
|
||||
virtual int testService(svc_contextCmd *svc) {
|
||||
return svc->testItem(item, menu_path);
|
||||
}
|
||||
|
||||
private:
|
||||
DragItem *item;
|
||||
StringW menu_path;
|
||||
};
|
||||
|
||||
#endif
|
70
Src/Wasabi/api/service/svcs/svc_coreadmin.cpp
Normal file
70
Src/Wasabi/api/service/svcs/svc_coreadmin.cpp
Normal file
|
@ -0,0 +1,70 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "svc_coreadmin.h"
|
||||
|
||||
#define CBCLASS svc_coreAdminI
|
||||
START_DISPATCH;
|
||||
CB(CREATECORE,createCore)
|
||||
CB(NAMETOTOKEN,nameToToken)
|
||||
CB(FREECOREBYTOKEN,freeCoreByToken)
|
||||
CB(FREECOREBYNAME,freeCoreByName)
|
||||
CB(VERIFYTOKEN,verifyToken)
|
||||
|
||||
CB(GETSUPPORTEDEXTENSIONS,getSupportedExtensions)
|
||||
CB(GETEXTSUPPORTEDEXTENSIONS,getExtSupportedExtensions)
|
||||
VCB(REGISTEREXTENSION,registerExtension)
|
||||
CB(GETEXTENSIONFAMILY, getExtensionFamily);
|
||||
VCB(UNREGISTEREXTENSION,unregisterExtension)
|
||||
|
||||
CB(SETNEXTFILE,setNextFile)
|
||||
CB(SETNEXTFILEOLD,setNextFile)
|
||||
|
||||
CB(GETSTATUS,getStatus)
|
||||
CB(GETCURRENT,getCurrent)
|
||||
CB(GETCURPLAYBACKNUMBER,getCurPlaybackNumber)
|
||||
CB(GETNUMTRACKS, getNumTracks);
|
||||
CB(GETPOSITION,getPosition)
|
||||
CB(GETWRITEPOSITION,getWritePosition)
|
||||
CB(GETLENGTH,getLength)
|
||||
CB(GETPLUGINDATA,getPluginData)
|
||||
CB(GETVOLUME,getVolume)
|
||||
CB(GETPAN,getPan)
|
||||
CB(GETVISDATA,getVisData)
|
||||
CB(GETLEFTVUMETER,getLeftVuMeter)
|
||||
CB(GETRIGHTVUMETER,getRightVuMeter)
|
||||
CB(GETEQSTATUS,getEqStatus)
|
||||
CB(GETEQPREAMP,getEqPreamp)
|
||||
CB(GETEQBAND,getEqBand)
|
||||
CB(GETEQAUTO,getEqAuto)
|
||||
CB(GETMUTE,getMute)
|
||||
|
||||
CB(SETPOSITION,setPosition)
|
||||
VCB(SETVOLUME,setVolume)
|
||||
VCB(SETPAN,setPan)
|
||||
VCB(SETEQSTATUS,setEqStatus)
|
||||
VCB(SETEQPREAMP,setEqPreamp)
|
||||
VCB(SETEQBAND,setEqBand)
|
||||
VCB(SETEQAUTO,setEqAuto)
|
||||
VCB(SETMUTE,setMute)
|
||||
CB(GETTITLE,getTitle);
|
||||
|
||||
VCB(ADDCALLBACK,addCallback)
|
||||
VCB(DELCALLBACK,delCallback)
|
||||
|
||||
CB(REGISTERSEQUENCER,registerSequencer)
|
||||
CB(DEREGISTERSEQUENCER,deregisterSequencer)
|
||||
CB(GETSEQUENCER,getSequencer)
|
||||
|
||||
VCB(USERBUTTON,userButton)
|
||||
|
||||
VCB(SETCUSTOMMSG, setCustomMsg)
|
||||
|
||||
VCB(SETPRIORITY, setPriority)
|
||||
CB(GETPRIORITY, getPriority)
|
||||
|
||||
VCB(REBUILDCONVERTERSCHAIN, rebuildConvertersChain)
|
||||
CB(SENDCONVERTERSMSG, sendConvertersMsg)
|
||||
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
230
Src/Wasabi/api/service/svcs/svc_coreadmin.h
Normal file
230
Src/Wasabi/api/service/svcs/svc_coreadmin.h
Normal file
|
@ -0,0 +1,230 @@
|
|||
#ifndef _SVC_COREADMIN_H
|
||||
#define _SVC_COREADMIN_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <api/core/corehandle.h>
|
||||
#include <api/core/sequence.h>
|
||||
#include <api/service/services.h>
|
||||
|
||||
// There is only ONE INSTANCE of the coreadmin running in the application
|
||||
class NOVTABLE svc_coreAdmin : public Dispatchable {
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::COREADMIN; }
|
||||
|
||||
// create a new playback core
|
||||
CoreToken createCore(const char *name=NULL) { return _call(CREATECORE,0,name); }
|
||||
|
||||
// (CoreToken)0 is the maincore
|
||||
// "main" is the maincore
|
||||
CoreToken nameToToken(const char *name) { return _call(NAMETOTOKEN,0,name); }
|
||||
|
||||
int freeCoreByToken(CoreToken core) { return _call(FREECOREBYTOKEN,0,core); }
|
||||
int freeCoreByName(const char *name) { return _call(FREECOREBYNAME,0,name); }
|
||||
|
||||
// returns 1 if present, 0 if non existent
|
||||
int verifyToken(CoreToken token) { return _call(VERIFYTOKEN,0,token); }
|
||||
|
||||
//just the *.mp3 or whatever
|
||||
const char *getSupportedExtensions() { return _call(GETSUPPORTEDEXTENSIONS,(const char *)0); }
|
||||
// including names
|
||||
const char *getExtSupportedExtensions() { return _call(GETEXTSUPPORTEDEXTENSIONS,(const char *)0); }
|
||||
void registerExtension(const char *extensions, const char *extension_name, const char *family=NULL) { _voidcall(REGISTEREXTENSION,extensions,extension_name,family); }
|
||||
const char *getExtensionFamily(const char *extension) {
|
||||
return _call(GETEXTENSIONFAMILY, (const char *)0, extension);
|
||||
}
|
||||
void unregisterExtension(const char *extensions) { _voidcall(UNREGISTEREXTENSION,extensions); }
|
||||
|
||||
int setNextFile(CoreToken core, const char *playstring, const char *destination=NULL) { return _call(SETNEXTFILE,0,core,playstring,destination); }
|
||||
// returns -1 if paused, 0 if stopped and 1 if playing
|
||||
int getStatus(CoreToken core) { return _call(GETSTATUS,0,core); }
|
||||
const char *getCurrent(CoreToken core) { return _call(GETCURRENT,(const char *)0,core); }
|
||||
int getCurPlaybackNumber(CoreToken core) { return _call(GETCURPLAYBACKNUMBER,-1,core); }
|
||||
int getNumTracks(CoreToken core) { return _call(GETNUMTRACKS, -1, core); }
|
||||
int getPosition(CoreToken core) { return _call(GETPOSITION,0,core); }
|
||||
int getWritePosition(CoreToken core) { return _call(GETWRITEPOSITION,0,core); }
|
||||
int setPosition(CoreToken core, int ms) { return _call(SETPOSITION,0,core,ms); }
|
||||
int getLength(CoreToken core) { return _call(GETLENGTH,-1,core); }
|
||||
// this method queries the core plugins directly, bypassing the db
|
||||
// returns size of data
|
||||
int getPluginData(const char *playstring, const char *name,
|
||||
char *data, int data_len, int data_type=0) { return _call(GETPLUGINDATA,0,playstring,name,data,data_len,data_type); }
|
||||
unsigned int getVolume(CoreToken core) { return _call(GETVOLUME,0,core); }
|
||||
// 0..255
|
||||
void setVolume(CoreToken core, unsigned int vol) { _voidcall(SETVOLUME,core,vol); }
|
||||
// -127..127
|
||||
int getPan(CoreToken core) { return _call(GETPAN,0,core); }
|
||||
// -127..127
|
||||
void setPan(CoreToken core, int bal) { _voidcall(SETPAN,core,bal); }
|
||||
|
||||
void setMute(CoreToken core, int mute) { _voidcall(SETMUTE,core,mute); }
|
||||
int getMute(CoreToken core) { return _call(GETMUTE,0,core); }
|
||||
|
||||
// register here for general callbacks in core status.
|
||||
void addCallback(CoreToken core, CoreCallback *cb) { _voidcall(ADDCALLBACK,core,cb); }
|
||||
void delCallback(CoreToken core, CoreCallback *cb) { _voidcall(DELCALLBACK,core,cb); }
|
||||
// get visualization data, returns 0 if you should blank out
|
||||
int getVisData(CoreToken core, void *dataptr, int sizedataptr) { return _call(GETVISDATA,0,core,dataptr,sizedataptr); }
|
||||
int getLeftVuMeter(CoreToken core) { return _call(GETLEFTVUMETER,0,core); }
|
||||
int getRightVuMeter(CoreToken core) { return _call(GETRIGHTVUMETER,0,core); }
|
||||
|
||||
int registerSequencer(CoreToken core, ItemSequencer *seq) { return _call(REGISTERSEQUENCER,0,core,seq); }
|
||||
int deregisterSequencer(CoreToken core, ItemSequencer *seq) { return _call(DEREGISTERSEQUENCER,0,core,seq); }
|
||||
ItemSequencer *getSequencer(CoreToken core) { return _call(GETSEQUENCER, (ItemSequencer*)NULL,core); }
|
||||
// see buttons.h
|
||||
void userButton(CoreToken core, int button) { _voidcall(USERBUTTON,core,button); }
|
||||
|
||||
// returns 1 if on, 0 if off
|
||||
int getEqStatus(CoreToken core) { return _call(GETEQSTATUS,0,core); }
|
||||
void setEqStatus(CoreToken core, int enable) { _voidcall(SETEQSTATUS,core,enable); }
|
||||
// -127 to 127 (-20db to +20db)
|
||||
int getEqPreamp(CoreToken core) { return _call(GETEQPREAMP,0,core); }
|
||||
void setEqPreamp(CoreToken core, int pre) { _voidcall(SETEQPREAMP,core,pre); }
|
||||
// band=0-9
|
||||
int getEqBand(CoreToken core, int band) { return _call(GETEQBAND,0,core,band); }
|
||||
void setEqBand(CoreToken core, int band, int val) { _voidcall(SETEQBAND,core,band,val); }
|
||||
// returns 1 if on, 0 if off
|
||||
int getEqAuto(CoreToken core) { return _call(GETEQAUTO,0,core); }
|
||||
void setEqAuto(CoreToken core, int enable) { _voidcall(SETEQAUTO,core,enable); }
|
||||
|
||||
// for status msgs
|
||||
void setCustomMsg(CoreToken core, const char *text) { _voidcall(SETCUSTOMMSG,core,text); }
|
||||
|
||||
void setPriority(CoreToken core, int priority) { _voidcall(SETPRIORITY,core,priority); }
|
||||
int getPriority(CoreToken core) { return _call(GETPRIORITY,0,core); }
|
||||
|
||||
void rebuildConvertersChain(CoreToken core) { _voidcall(REBUILDCONVERTERSCHAIN,core); }
|
||||
|
||||
int sendConvertersMsg(CoreToken core, const char *msg, const char *value) { return _call(SENDCONVERTERSMSG,0,core,msg,value); }
|
||||
const char *getTitle(CoreToken core) { return _call(GETTITLE,(const char *)NULL, core); }
|
||||
|
||||
enum {
|
||||
CREATECORE=10,
|
||||
NAMETOTOKEN=20,
|
||||
FREECOREBYTOKEN=30,
|
||||
FREECOREBYNAME=40,
|
||||
VERIFYTOKEN=50,
|
||||
|
||||
GETSUPPORTEDEXTENSIONS=100,
|
||||
GETEXTSUPPORTEDEXTENSIONS=110,
|
||||
REGISTEREXTENSION=121, //120 retired
|
||||
GETEXTENSIONFAMILY=122,
|
||||
UNREGISTEREXTENSION=130,
|
||||
|
||||
SETNEXTFILEOLD=200,
|
||||
SETNEXTFILE=210,
|
||||
|
||||
GETSTATUS=300,
|
||||
GETCURRENT=310,
|
||||
GETCURPLAYBACKNUMBER=315,
|
||||
GETNUMTRACKS=317,
|
||||
GETPOSITION=320,
|
||||
GETWRITEPOSITION=330,
|
||||
GETLENGTH=340,
|
||||
GETPLUGINDATA=350,
|
||||
GETVOLUME=360,
|
||||
GETPAN=370,
|
||||
GETVISDATA=380,
|
||||
GETLEFTVUMETER=390,
|
||||
GETRIGHTVUMETER=400,
|
||||
GETEQSTATUS=410,
|
||||
GETEQPREAMP=420,
|
||||
GETEQBAND=430,
|
||||
GETEQAUTO=440,
|
||||
GETMUTE=450,
|
||||
|
||||
SETPOSITION=500,
|
||||
SETVOLUME=510,
|
||||
SETPAN=520,
|
||||
SETEQSTATUS=530,
|
||||
SETEQPREAMP=540,
|
||||
SETEQBAND=550,
|
||||
SETEQAUTO=560,
|
||||
SETMUTE=570,
|
||||
|
||||
ADDCALLBACK=700,
|
||||
DELCALLBACK=710,
|
||||
|
||||
REGISTERSEQUENCER=800,
|
||||
DEREGISTERSEQUENCER=810,
|
||||
GETSEQUENCER=812,
|
||||
|
||||
USERBUTTON=820,
|
||||
|
||||
SETCUSTOMMSG=900,
|
||||
|
||||
SETPRIORITY=1000,
|
||||
GETPRIORITY=1100,
|
||||
|
||||
REBUILDCONVERTERSCHAIN=1200,
|
||||
|
||||
SENDCONVERTERSMSG=1300,
|
||||
GETTITLE=1400,
|
||||
};
|
||||
};
|
||||
|
||||
class NOVTABLE svc_coreAdminI : public svc_coreAdmin {
|
||||
public:
|
||||
virtual CoreToken createCore(const char *name=NULL)=0;
|
||||
virtual CoreToken nameToToken(const char *name)=0;
|
||||
virtual int freeCoreByToken(CoreToken core)=0;
|
||||
virtual int freeCoreByName(const char *name)=0;
|
||||
|
||||
virtual int verifyToken(CoreToken token)=0;
|
||||
|
||||
virtual const char *getSupportedExtensions()=0;
|
||||
virtual const char *getExtSupportedExtensions()=0;
|
||||
virtual void registerExtension(const char *extensions, const char *extension_name, const char *family=NULL)=0;
|
||||
virtual const char *getExtensionFamily(const char *extension)=0;
|
||||
virtual void unregisterExtension(const char *extensions)=0;
|
||||
|
||||
virtual int setNextFile(CoreToken core, const char *playstring, const char *destination)=0;
|
||||
virtual int getStatus(CoreToken core)=0;
|
||||
virtual const char *getCurrent(CoreToken core)=0;
|
||||
virtual int getCurPlaybackNumber(CoreToken core)=0;
|
||||
virtual int getNumTracks(CoreToken core)=0;
|
||||
virtual int getPosition(CoreToken core)=0;
|
||||
virtual int getWritePosition(CoreToken core)=0;
|
||||
virtual int setPosition(CoreToken core, int ms)=0;
|
||||
virtual int getLength(CoreToken core)=0;
|
||||
virtual int getPluginData(const char *playstring, const char *name, char *data, int data_len, int data_type=0)=0;
|
||||
virtual unsigned int getVolume(CoreToken core)=0;
|
||||
virtual void setVolume(CoreToken core, unsigned int vol)=0;
|
||||
virtual int getPan(CoreToken core)=0;
|
||||
virtual void setPan(CoreToken core, int bal)=0;
|
||||
virtual void addCallback(CoreToken core, CoreCallback *cb)=0;
|
||||
virtual void delCallback(CoreToken core, CoreCallback *cb)=0;
|
||||
virtual int getVisData(CoreToken core, void *dataptr, int sizedataptr)=0;
|
||||
virtual int getLeftVuMeter(CoreToken core)=0;
|
||||
virtual int getRightVuMeter(CoreToken core)=0;
|
||||
virtual void setMute(CoreToken core, int mute)=0;
|
||||
virtual int getMute(CoreToken core)=0;
|
||||
|
||||
virtual int registerSequencer(CoreToken core, ItemSequencer *seq)=0;
|
||||
virtual int deregisterSequencer(CoreToken core, ItemSequencer *seq)=0;
|
||||
virtual ItemSequencer *getSequencer(CoreToken core)=0;
|
||||
virtual void userButton(CoreToken core, int button)=0;
|
||||
|
||||
virtual int getEqStatus(CoreToken core)=0;
|
||||
virtual void setEqStatus(CoreToken core, int enable)=0;
|
||||
virtual int getEqPreamp(CoreToken core)=0;
|
||||
virtual void setEqPreamp(CoreToken core, int pre)=0;
|
||||
virtual int getEqBand(CoreToken core, int band)=0;
|
||||
virtual void setEqBand(CoreToken core, int band, int val)=0;
|
||||
virtual int getEqAuto(CoreToken core)=0;
|
||||
virtual void setEqAuto(CoreToken core, int enable)=0;
|
||||
|
||||
virtual void setCustomMsg(CoreToken core, const char *text)=0;
|
||||
|
||||
virtual void setPriority(CoreToken core, int priority)=0;
|
||||
virtual int getPriority(CoreToken core)=0;
|
||||
|
||||
virtual void rebuildConvertersChain(CoreToken core)=0;
|
||||
|
||||
virtual int sendConvertersMsg(CoreToken core, const char *msg, const char *value)=0;
|
||||
virtual const char *getTitle(CoreToken core)=0;
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
#endif
|
78
Src/Wasabi/api/service/svcs/svc_db.cpp
Normal file
78
Src/Wasabi/api/service/svcs/svc_db.cpp
Normal file
|
@ -0,0 +1,78 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "svc_db.h"
|
||||
|
||||
#define CBCLASS svc_dbI
|
||||
START_DISPATCH;
|
||||
CB(OPENTABLE, openTable);
|
||||
VCB(CLOSETABLE, closeTable);
|
||||
CB(TESTQUERYFORMAT, testQueryFormat);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
||||
|
||||
#define CBCLASS dbSvcTableI
|
||||
START_DISPATCH;
|
||||
CB(GETSCANNER, getScanner);
|
||||
CB(NEWSCANNER, newScanner);
|
||||
VCB(DELETESCANNER, deleteScanner);
|
||||
VCB(CBNEW, _new);
|
||||
VCB(CBINSERT, insert);
|
||||
VCB(CBCANCEL, cancel);
|
||||
VCB(CBEDIT, edit);
|
||||
VCB(CBPOST, post);
|
||||
VCB(CBDELETE, _delete);
|
||||
CB(EDITING, editing);
|
||||
VCB(SETFIELDBYNAME, setFieldByName);
|
||||
VCB(SETFIELDBYID, setFieldById);
|
||||
VCB(DELETEFIELDBYNAME, deleteFieldByName);
|
||||
VCB(DELETEFIELDBYID, deleteFieldById);
|
||||
VCB(ADDCOLUMN, addColumn);
|
||||
VCB(ADDINDEXBYNAME, addIndexByName);
|
||||
VCB(ADDINDEXBYID, addIndexById);
|
||||
VCB(DROPINDEXBYNAME, dropIndexByName);
|
||||
VCB(DROPINDEXBYID, dropIndexById);
|
||||
VCB(SYNC, sync);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
||||
#define CBCLASS dbSvcScannerI
|
||||
START_DISPATCH;
|
||||
VCB(CBFIRST, first);
|
||||
VCB(CBLAST, last);
|
||||
VCB(CBNEXT, block_next);
|
||||
VCB(CBPREVIOUS, block_previous);
|
||||
CB(CBNEXT2, next);
|
||||
CB(CBPREVIOUS2, previous);
|
||||
VCB(CBPUSH, push);
|
||||
VCB(CBPOP, pop);
|
||||
CB(CBEOF, eof);
|
||||
CB(CBBOF, bof);
|
||||
CB(GETNUMROWS, getNumRows);
|
||||
VCB(MOVETOROW, moveToRow);
|
||||
CB(GETCURROW, getCurRow);
|
||||
CB(LOCATEBYNAME, locateByName);
|
||||
CB(LOCATEBYID, locateById);
|
||||
CB(GETNUMCOLS, getNumCols);
|
||||
CB(ENUMCOL, enumCol);
|
||||
CB(GETCOLBYNAME, getColByName);
|
||||
CB(GETCOLBYID, getColByName);
|
||||
CB(GETFIELDBYNAME, getFieldByName);
|
||||
CB(GETFIELDBYID, getFieldById);
|
||||
VCB(SETINDEXBYNAME, setIndexByName);
|
||||
VCB(SETINDEXBYID, setIndexById);
|
||||
CB(UNIQUEBYNAME, newUniqueScannerByName);
|
||||
CB(UNIQUEBYID, newUniqueScannerById);
|
||||
VCB(DELETEUNIQUE, deleteUniqueScanner);
|
||||
CB(QUERY, query);
|
||||
VCB(CANCELQUERY, cancelQuery);
|
||||
CB(INDEXCHANGED, hasIndexChanged);
|
||||
VCB(CLEARDIRTYBIT, clearDirtyBit);
|
||||
VCB(JOINSCANNER, joinScanner);
|
||||
VCB(UNJOINSCANNER, unjoinScanner);
|
||||
CB(GETLASTQUERY, getLastQuery);
|
||||
VCB(SETBLOCKING, setBlocking);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
||||
|
512
Src/Wasabi/api/service/svcs/svc_db.h
Normal file
512
Src/Wasabi/api/service/svcs/svc_db.h
Normal file
|
@ -0,0 +1,512 @@
|
|||
#ifndef _SVC_DB_H
|
||||
#define _SVC_DB_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <api/service/services.h>
|
||||
|
||||
typedef enum {
|
||||
DBSVC_DATATYPE_UNKNOWN = 0,
|
||||
DBSVC_DATATYPE_INT = 1,
|
||||
DBSVC_DATATYPE_STRING = 2,
|
||||
DBSVC_DATATYPE_BINARY = 3,
|
||||
DBSVC_DATATYPE_GUID = 4,
|
||||
DBSVC_DATATYPE_FLOAT = 5,
|
||||
} dbSvcDatatypeEnum;
|
||||
|
||||
typedef struct {
|
||||
void *data;
|
||||
dbSvcDatatypeEnum datatype;
|
||||
int datalen;
|
||||
} dbSvcDatachunk;
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
dbSvcDatatypeEnum datatype;
|
||||
int id;
|
||||
int indexed;
|
||||
int uniques_indexed;
|
||||
} dbSvcColInfo;
|
||||
|
||||
class dbSvcScanner;
|
||||
|
||||
class NOVTABLE dbSvcScanner : public Dispatchable {
|
||||
|
||||
public:
|
||||
|
||||
void first();
|
||||
void last();
|
||||
void block_next(); // blocking call for baclkward compat
|
||||
void block_previous(); // blocking call for baclkward compat
|
||||
int next(); // if non blocking, returns 0 for "HOLD ON!" and 1 for "GOT A ROW!"
|
||||
int previous(); // if non blocking, returns 0 for "HOLD ON!" and 1 for "GOT A ROW!"
|
||||
void push();
|
||||
void pop();
|
||||
int eof();
|
||||
int bof();
|
||||
|
||||
int getNumRows();
|
||||
void moveToRow(int row);
|
||||
int getCurRow();
|
||||
|
||||
int locateByName(const char *col, int from_row, dbSvcDatachunk *data);
|
||||
int locateById(int id, int from_row, dbSvcDatachunk *data);
|
||||
|
||||
int getNumCols();
|
||||
dbSvcColInfo *enumCol(int n);
|
||||
dbSvcColInfo *getColById(int n);
|
||||
dbSvcColInfo *getColByName(const char *col);
|
||||
|
||||
dbSvcDatachunk *getFieldByName(const char *col);
|
||||
dbSvcDatachunk *getFieldById(int id);
|
||||
|
||||
void setIndexByName(const char *col);
|
||||
void setIndexById(int id);
|
||||
|
||||
dbSvcScanner *newUniqueScannerByName(const char *col);
|
||||
dbSvcScanner *newUniqueScannerById(int colid);
|
||||
void deleteUniqueScanner(dbSvcScanner *);
|
||||
|
||||
int query(const char *query);
|
||||
const char *getLastQuery();
|
||||
void cancelQuery();
|
||||
int hasIndexChanged();
|
||||
void clearDirtyBit();
|
||||
|
||||
void joinScanner(dbSvcScanner *scanner, const char *field);
|
||||
void unjoinScanner(dbSvcScanner *scanner);
|
||||
|
||||
void setBlocking(int b); // blocking is the default behavior
|
||||
|
||||
enum {
|
||||
CBFIRST = 100,
|
||||
CBLAST = 110,
|
||||
CBNEXT = 120, // retired
|
||||
CBPREVIOUS = 130, // retired
|
||||
CBNEXT2 = 121,
|
||||
CBPREVIOUS2 = 131,
|
||||
CBPUSH = 140,
|
||||
CBPOP = 150,
|
||||
CBEOF = 160,
|
||||
CBBOF = 170,
|
||||
GETNUMROWS = 180,
|
||||
MOVETOROW = 190,
|
||||
GETCURROW = 200,
|
||||
LOCATEBYNAME = 210,
|
||||
LOCATEBYID = 220,
|
||||
GETNUMCOLS = 230,
|
||||
ENUMCOL = 240,
|
||||
GETCOLBYID = 250,
|
||||
GETCOLBYNAME = 260,
|
||||
GETFIELDBYNAME = 270,
|
||||
GETFIELDBYID = 280,
|
||||
SETINDEXBYNAME = 290,
|
||||
SETINDEXBYID = 300,
|
||||
QUERY = 310,
|
||||
CANCELQUERY = 320,
|
||||
INDEXCHANGED = 330,
|
||||
CLEARDIRTYBIT = 340,
|
||||
UNIQUEBYNAME = 350,
|
||||
UNIQUEBYID = 360,
|
||||
DELETEUNIQUE = 370,
|
||||
GETLASTQUERY = 380,
|
||||
JOINSCANNER = 390,
|
||||
UNJOINSCANNER = 400,
|
||||
SETBLOCKING = 410,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
inline void dbSvcScanner::first() {
|
||||
_voidcall(CBFIRST);
|
||||
}
|
||||
|
||||
inline void dbSvcScanner::last() {
|
||||
_voidcall(CBLAST);
|
||||
}
|
||||
|
||||
inline void dbSvcScanner::block_next() {
|
||||
_voidcall(CBNEXT);
|
||||
}
|
||||
|
||||
inline int dbSvcScanner::next() {
|
||||
return _call(CBNEXT2, 0);
|
||||
}
|
||||
|
||||
inline void dbSvcScanner::block_previous() {
|
||||
_voidcall(CBPREVIOUS);
|
||||
}
|
||||
|
||||
inline int dbSvcScanner::previous() {
|
||||
return _call(CBPREVIOUS2, 0);
|
||||
}
|
||||
|
||||
inline void dbSvcScanner::push() {
|
||||
_voidcall(CBPUSH);
|
||||
}
|
||||
|
||||
inline void dbSvcScanner::pop() {
|
||||
_voidcall(CBPOP);
|
||||
}
|
||||
|
||||
inline int dbSvcScanner::eof() {
|
||||
return _call(CBEOF, 0);
|
||||
}
|
||||
|
||||
inline int dbSvcScanner::bof() {
|
||||
return _call(CBBOF, 0);
|
||||
}
|
||||
|
||||
inline int dbSvcScanner::getNumRows() {
|
||||
return _call(GETNUMROWS, 0);
|
||||
}
|
||||
|
||||
inline void dbSvcScanner::moveToRow(int row) {
|
||||
_voidcall(MOVETOROW, row);
|
||||
}
|
||||
|
||||
inline int dbSvcScanner::getCurRow() {
|
||||
return _call(GETCURROW, 0);
|
||||
}
|
||||
|
||||
inline int dbSvcScanner::locateByName(const char *col, int from_row, dbSvcDatachunk *data) {
|
||||
return _call(LOCATEBYNAME, 0, col, from_row, data);
|
||||
}
|
||||
|
||||
inline int dbSvcScanner::locateById(int colid, int from_row, dbSvcDatachunk *data) {
|
||||
return _call(LOCATEBYNAME, 0, colid, from_row, data);
|
||||
}
|
||||
|
||||
inline int dbSvcScanner::getNumCols() {
|
||||
return _call(GETNUMCOLS, 0);
|
||||
}
|
||||
|
||||
inline dbSvcColInfo *dbSvcScanner::enumCol(int n) {
|
||||
return _call(ENUMCOL, ((dbSvcColInfo *)NULL), n);
|
||||
}
|
||||
|
||||
inline dbSvcColInfo *dbSvcScanner::getColByName(const char *col) {
|
||||
return _call(GETCOLBYNAME, ((dbSvcColInfo *)NULL), col);
|
||||
}
|
||||
|
||||
inline dbSvcColInfo *dbSvcScanner::getColById(int colid) {
|
||||
return _call(GETCOLBYID, ((dbSvcColInfo *)NULL), colid);
|
||||
}
|
||||
|
||||
inline dbSvcDatachunk *dbSvcScanner::getFieldByName(const char *col) {
|
||||
return _call(GETFIELDBYNAME, ((dbSvcDatachunk *)NULL), col);
|
||||
}
|
||||
|
||||
inline dbSvcDatachunk *dbSvcScanner::getFieldById(int colid) {
|
||||
return _call(GETFIELDBYNAME, ((dbSvcDatachunk *)NULL), colid);
|
||||
}
|
||||
|
||||
inline void dbSvcScanner::setIndexByName(const char *col) {
|
||||
_voidcall(SETINDEXBYNAME, col);
|
||||
}
|
||||
|
||||
inline void dbSvcScanner::setIndexById(int colid) {
|
||||
_voidcall(SETINDEXBYID, colid);
|
||||
}
|
||||
|
||||
inline dbSvcScanner *dbSvcScanner::newUniqueScannerByName(const char *col) {
|
||||
return _call(UNIQUEBYNAME, (dbSvcScanner *)NULL, col);
|
||||
}
|
||||
|
||||
inline dbSvcScanner *dbSvcScanner::newUniqueScannerById(int colid) {
|
||||
return _call(UNIQUEBYID, (dbSvcScanner *)NULL, colid);
|
||||
}
|
||||
|
||||
inline void dbSvcScanner::deleteUniqueScanner(dbSvcScanner *s) {
|
||||
_voidcall(DELETEUNIQUE, s);
|
||||
}
|
||||
|
||||
inline int dbSvcScanner::query(const char *q) {
|
||||
return _call(QUERY, 0, q);
|
||||
}
|
||||
|
||||
inline void dbSvcScanner::cancelQuery() {
|
||||
_voidcall(CANCELQUERY);
|
||||
}
|
||||
|
||||
inline int dbSvcScanner::hasIndexChanged() {
|
||||
return _call(INDEXCHANGED, 0);
|
||||
}
|
||||
|
||||
inline void dbSvcScanner::clearDirtyBit() {
|
||||
_voidcall(CLEARDIRTYBIT);
|
||||
}
|
||||
|
||||
inline const char *dbSvcScanner::getLastQuery() {
|
||||
return _call(GETLASTQUERY, (const char *)NULL);
|
||||
}
|
||||
|
||||
inline void dbSvcScanner::joinScanner(dbSvcScanner *scanner, const char *field) {
|
||||
_voidcall(JOINSCANNER, scanner, field);
|
||||
}
|
||||
|
||||
inline void dbSvcScanner::unjoinScanner(dbSvcScanner *scanner) {
|
||||
_voidcall(UNJOINSCANNER, scanner);
|
||||
}
|
||||
|
||||
inline void dbSvcScanner::setBlocking(int b) {
|
||||
_voidcall(SETBLOCKING, b);
|
||||
}
|
||||
|
||||
class NOVTABLE dbSvcScannerI : public dbSvcScanner {
|
||||
public:
|
||||
virtual void first()=0;
|
||||
virtual void last()=0;
|
||||
virtual void block_next()=0;
|
||||
virtual void block_previous()=0;
|
||||
virtual int next()=0;
|
||||
virtual int previous()=0;
|
||||
virtual void push()=0;
|
||||
virtual void pop()=0;
|
||||
virtual int eof()=0;
|
||||
virtual int bof()=0;
|
||||
virtual int getNumRows()=0;
|
||||
virtual void moveToRow(int row)=0;
|
||||
virtual int getCurRow()=0;
|
||||
virtual int locateByName(const char *col, int from_row, dbSvcDatachunk *data)=0;
|
||||
virtual int locateById(int id, int from_row, dbSvcDatachunk *data)=0;
|
||||
virtual int getNumCols()=0;
|
||||
virtual dbSvcColInfo *enumCol(int n)=0;
|
||||
virtual dbSvcColInfo *getColById(int n)=0;
|
||||
virtual dbSvcColInfo *getColByName(const char *col)=0;
|
||||
virtual dbSvcDatachunk *getFieldByName(const char *col)=0;
|
||||
virtual dbSvcDatachunk *getFieldById(int id)=0;
|
||||
virtual void setIndexByName(const char *col)=0;
|
||||
virtual void setIndexById(int id)=0;
|
||||
virtual dbSvcScanner *newUniqueScannerByName(const char *col)=0;
|
||||
virtual dbSvcScanner *newUniqueScannerById(int colid)=0;
|
||||
virtual void deleteUniqueScanner(dbSvcScanner *)=0;
|
||||
virtual int query(const char *query)=0;
|
||||
virtual void cancelQuery()=0;
|
||||
virtual int hasIndexChanged()=0;
|
||||
virtual void clearDirtyBit()=0;
|
||||
virtual const char *getLastQuery()=0;
|
||||
virtual void joinScanner(dbSvcScanner *scanner, const char *field)=0;
|
||||
virtual void unjoinScanner(dbSvcScanner *scanner)=0;
|
||||
virtual void setBlocking(int block)=0;
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
class NOVTABLE dbSvcTable : public Dispatchable {
|
||||
public:
|
||||
dbSvcScanner *getScanner();
|
||||
dbSvcScanner *newScanner();
|
||||
void deleteScanner(dbSvcScanner *scanner);
|
||||
void _new();
|
||||
void insert();
|
||||
void cancel();
|
||||
void edit();
|
||||
void post();
|
||||
void _delete();
|
||||
int editing();
|
||||
void setFieldByName(const char *col, dbSvcDatachunk *data);
|
||||
void setFieldById(int colid, dbSvcDatachunk *data);
|
||||
void deleteFieldByName(const char *col);
|
||||
void deleteFieldById(int colid);
|
||||
void addColumn(const char *colname, int colid, int datatype, int uniques_indexed);
|
||||
void addIndexByName(const char *col);
|
||||
void addIndexById(int colid);
|
||||
void dropIndexByName(const char *col);
|
||||
void dropIndexById(int colid);
|
||||
void sync();
|
||||
|
||||
enum {
|
||||
GETSCANNER = 100,
|
||||
NEWSCANNER = 110,
|
||||
DELETESCANNER = 111,
|
||||
CBNEW = 120,
|
||||
CBINSERT = 130,
|
||||
CBCANCEL = 140,
|
||||
CBEDIT = 150,
|
||||
CBPOST = 160,
|
||||
CBDELETE = 170,
|
||||
EDITING = 180,
|
||||
SETFIELDBYNAME = 190,
|
||||
SETFIELDBYID = 200,
|
||||
DELETEFIELDBYNAME = 210,
|
||||
DELETEFIELDBYID = 220,
|
||||
ADDCOLUMN = 230,
|
||||
ADDINDEXBYNAME = 240,
|
||||
ADDINDEXBYID = 250,
|
||||
SYNC = 260,
|
||||
DROPINDEXBYNAME = 270,
|
||||
DROPINDEXBYID = 280,
|
||||
};
|
||||
};
|
||||
|
||||
inline dbSvcScanner *dbSvcTable::getScanner() {
|
||||
return _call(GETSCANNER, static_cast<dbSvcScanner *>(NULL));
|
||||
}
|
||||
|
||||
inline dbSvcScanner *dbSvcTable::newScanner() {
|
||||
return _call(NEWSCANNER, static_cast<dbSvcScanner *>(NULL));
|
||||
}
|
||||
|
||||
inline void dbSvcTable::deleteScanner(dbSvcScanner *scanner) {
|
||||
_voidcall(DELETESCANNER, scanner);
|
||||
}
|
||||
|
||||
inline void dbSvcTable::_new() {
|
||||
_voidcall(CBNEW);
|
||||
}
|
||||
|
||||
inline void dbSvcTable::insert() {
|
||||
_voidcall(CBINSERT);
|
||||
}
|
||||
|
||||
inline void dbSvcTable::cancel() {
|
||||
_voidcall(CBCANCEL);
|
||||
}
|
||||
|
||||
inline void dbSvcTable::edit() {
|
||||
_voidcall(CBEDIT);
|
||||
}
|
||||
|
||||
inline void dbSvcTable::post() {
|
||||
_voidcall(CBPOST);
|
||||
}
|
||||
|
||||
inline void dbSvcTable::_delete() {
|
||||
_voidcall(CBDELETE);
|
||||
}
|
||||
|
||||
inline int dbSvcTable::editing() {
|
||||
return _call(EDITING, 0);
|
||||
}
|
||||
|
||||
inline void dbSvcTable::setFieldByName(const char *col, dbSvcDatachunk *data) {
|
||||
_voidcall(SETFIELDBYNAME, col, data);
|
||||
}
|
||||
|
||||
inline void dbSvcTable::setFieldById(int colid, dbSvcDatachunk *data) {
|
||||
_voidcall(SETFIELDBYID, colid, data);
|
||||
}
|
||||
|
||||
inline void dbSvcTable::deleteFieldByName(const char *col) {
|
||||
_voidcall(DELETEFIELDBYNAME, col);
|
||||
}
|
||||
|
||||
inline void dbSvcTable::deleteFieldById(int colid) {
|
||||
_voidcall(DELETEFIELDBYID, colid);
|
||||
}
|
||||
|
||||
inline void dbSvcTable::addColumn(const char *colname, int colid, int datatype, int index_uniques) {
|
||||
_voidcall(ADDCOLUMN, colname, colid, datatype, index_uniques);
|
||||
}
|
||||
|
||||
inline void dbSvcTable::addIndexByName(const char *col) {
|
||||
_voidcall(ADDINDEXBYNAME, col);
|
||||
}
|
||||
|
||||
inline void dbSvcTable::addIndexById(int colid) {
|
||||
_voidcall(ADDINDEXBYID, colid);
|
||||
}
|
||||
|
||||
inline void dbSvcTable::dropIndexByName(const char *col) {
|
||||
_voidcall(DROPINDEXBYNAME, col);
|
||||
}
|
||||
|
||||
inline void dbSvcTable::dropIndexById(int colid) {
|
||||
_voidcall(DROPINDEXBYID, colid);
|
||||
}
|
||||
|
||||
inline void dbSvcTable::sync() {
|
||||
_voidcall(SYNC);
|
||||
}
|
||||
|
||||
class NOVTABLE dbSvcTableI : public dbSvcTable {
|
||||
public:
|
||||
virtual dbSvcScanner *getScanner()=0;
|
||||
virtual dbSvcScanner *newScanner()=0;
|
||||
virtual void deleteScanner(dbSvcScanner *scanner)=0;
|
||||
virtual void _new()=0;
|
||||
virtual void insert()=0;
|
||||
virtual void cancel()=0;
|
||||
virtual void edit()=0;
|
||||
virtual void post()=0;
|
||||
virtual void _delete()=0;
|
||||
virtual int editing()=0;
|
||||
virtual void setFieldByName(const char *col, dbSvcDatachunk *data)=0;
|
||||
virtual void setFieldById(int colid, dbSvcDatachunk *data)=0;
|
||||
virtual void deleteFieldByName(const char *col)=0;
|
||||
virtual void deleteFieldById(int colid)=0;
|
||||
virtual void addColumn(const char *colname, int colid, int datatype, int index_uniques)=0;
|
||||
virtual void addIndexByName(const char *col)=0;
|
||||
virtual void addIndexById(int colid)=0;
|
||||
virtual void dropIndexByName(const char *col)=0;
|
||||
virtual void dropIndexById(int colid)=0;
|
||||
virtual void sync()=0;
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
class NOVTABLE svc_db : public Dispatchable {
|
||||
protected:
|
||||
svc_db() {}
|
||||
~svc_db() {}
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::DB; }
|
||||
|
||||
int testQueryFormat(int queryformat);
|
||||
|
||||
dbSvcTable *openTable(const char *tablefilename, int create_if_not_exist, int cache_in_memory);
|
||||
void closeTable(dbSvcTable *table);
|
||||
|
||||
enum {
|
||||
TESTQUERYFORMAT = 10,
|
||||
OPENTABLE = 20,
|
||||
CLOSETABLE = 30,
|
||||
};
|
||||
};
|
||||
|
||||
inline int svc_db::testQueryFormat(int queryformat) {
|
||||
return _call(TESTQUERYFORMAT, 0, queryformat);
|
||||
}
|
||||
|
||||
inline dbSvcTable *svc_db::openTable(const char *tablename, int create_if_not_exist, int cache_in_memory) {
|
||||
return _call(OPENTABLE, static_cast<dbSvcTable *>(NULL), tablename, create_if_not_exist, cache_in_memory);
|
||||
}
|
||||
|
||||
inline void svc_db::closeTable(dbSvcTable *table) {
|
||||
_voidcall(CLOSETABLE, table);
|
||||
}
|
||||
|
||||
// derive from this one
|
||||
class NOVTABLE svc_dbI : public svc_db{
|
||||
public:
|
||||
virtual int testQueryFormat(int queryformat)=0;
|
||||
virtual dbSvcTable *openTable(const char *filename, int create_if_not_exist, int cache_in_memory)=0;
|
||||
virtual void closeTable(dbSvcTable *table)=0;
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
#include <api/service/svc_enum.h>
|
||||
|
||||
enum {
|
||||
DBQFORMAT_MINIQUERY =1,
|
||||
DBQFORMAT_SQL =2,
|
||||
};
|
||||
|
||||
class DatabaseEnum : public SvcEnumT<svc_db> {
|
||||
public:
|
||||
DatabaseEnum(int queryformat=DBQFORMAT_MINIQUERY) :
|
||||
query_format(queryformat) {}
|
||||
protected:
|
||||
virtual int testService(svc_db *svc) {
|
||||
return svc->testQueryFormat(query_format);
|
||||
}
|
||||
|
||||
private:
|
||||
int query_format;
|
||||
};
|
||||
|
||||
#endif
|
10
Src/Wasabi/api/service/svcs/svc_debuggerui.cpp
Normal file
10
Src/Wasabi/api/service/svcs/svc_debuggerui.cpp
Normal file
|
@ -0,0 +1,10 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "svc_debuggerui.h"
|
||||
|
||||
#define CBCLASS svc_debuggerUII
|
||||
START_DISPATCH;
|
||||
CB(CREATEUI, createUI);
|
||||
VCB(DESTROYUI, destroyUI);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
44
Src/Wasabi/api/service/svcs/svc_debuggerui.h
Normal file
44
Src/Wasabi/api/service/svcs/svc_debuggerui.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
#ifndef _SVC_DEBUGGERUI_H
|
||||
#define _SVC_DEBUGGERUI_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <api/service/services.h>
|
||||
|
||||
class DebuggerUI;
|
||||
|
||||
// {8B055A0D-9A57-428c-BCFC-88F75AEF2CAD}
|
||||
static const GUID SERVICE_DEBUGGERUI =
|
||||
{ 0x8b055a0d, 0x9a57, 0x428c, { 0xbc, 0xfc, 0x88, 0xf7, 0x5a, 0xef, 0x2c, 0xad } };
|
||||
|
||||
class svc_debuggerUI : public Dispatchable {
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::UNIQUE; }
|
||||
|
||||
DebuggerUI *createUI();
|
||||
void destroyUI(DebuggerUI *ui);
|
||||
|
||||
protected:
|
||||
enum {
|
||||
CREATEUI=10,
|
||||
DESTROYUI=20,
|
||||
};
|
||||
};
|
||||
|
||||
inline DebuggerUI *svc_debuggerUI::createUI() {
|
||||
return _call(CREATEUI, (DebuggerUI *)NULL);
|
||||
}
|
||||
|
||||
inline void svc_debuggerUI::destroyUI(DebuggerUI *ui) {
|
||||
_voidcall(DESTROYUI, ui);
|
||||
}
|
||||
|
||||
class svc_debuggerUII : public svc_debuggerUI {
|
||||
public:
|
||||
virtual DebuggerUI *createUI()=0;
|
||||
virtual void destroyUI(DebuggerUI *ui)=0;
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
#endif
|
54
Src/Wasabi/api/service/svcs/svc_device.h
Normal file
54
Src/Wasabi/api/service/svcs/svc_device.h
Normal file
|
@ -0,0 +1,54 @@
|
|||
#ifndef _SVC_DEVICE_H
|
||||
#define _SVC_DEVICE_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
|
||||
// not done at all :) BU
|
||||
|
||||
class NOVTABLE svc_device : public Dispatchable {
|
||||
public:
|
||||
const char *getDeviceName();
|
||||
const char *getDeviceUID(); // some kind of unique per-device id if possible
|
||||
|
||||
// return total storage space and
|
||||
int getDeviceSpace(unsigned int *space, unsigned int *spacefree);
|
||||
// return (estimated) # of seconds stored/available
|
||||
int getDeviceTime(unsigned int *time, unsigned int *timefree);
|
||||
|
||||
// high-level stuff
|
||||
// give us a filename we should use if we transfer object to you
|
||||
// this name will be used as the media conversion pipeline's output
|
||||
// filename so your transfer filter will kick in... of course something
|
||||
// like d:\music\blah.mp3 is fine too
|
||||
int getTargetFilename(const char *playstring, char *fn, int buflen);
|
||||
|
||||
// file/directory enumeration
|
||||
// int opendir(const char *path);
|
||||
// int readdir(const char *path);
|
||||
|
||||
#if 0
|
||||
// return a handle like C-style open
|
||||
int openFile(const char *filename, const char *mode);
|
||||
void closeFile(int handle);
|
||||
|
||||
int writeToFile(int handle, const void *data, int length);
|
||||
int seek(int handle, int
|
||||
|
||||
int putFile(const char *filename, const void *data, unsigned int length);
|
||||
int readFile(const char *filename, void *buffer, unsigned int offset, unsigned int length)=0;
|
||||
int getFileAttrib(const char *filename, const char *name, char *buf, int len);
|
||||
int setFileAttrib(const char *filename, const char *name, const char *buf, int len);
|
||||
#endif
|
||||
|
||||
// playlist manipulation
|
||||
int playlistCreate(const char *playlist_name);
|
||||
int playlistDelete(const char *playlist_name);
|
||||
|
||||
int playlistGetNumItems(const char *playlist_name);
|
||||
int playlistEnumItem(const char *playlist_name, char *playstring, int len);
|
||||
|
||||
int playlistAppendItem(const char *playlist_name, const char *playstring);
|
||||
int playlistRemoveItem(const char *playlist_name, int position);
|
||||
};
|
||||
|
||||
#endif
|
11
Src/Wasabi/api/service/svcs/svc_droptarget.cpp
Normal file
11
Src/Wasabi/api/service/svcs/svc_droptarget.cpp
Normal file
|
@ -0,0 +1,11 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "svc_droptarget.h"
|
||||
|
||||
#define CBCLASS svc_dropTargetI
|
||||
START_DISPATCH;
|
||||
CB(TESTTARGET, testTarget);
|
||||
CB(GETDRAGINTERFACEFORTYPE, getDragInterfaceForType);
|
||||
CB(RELEASEDRAGINTERFACE, releaseDragInterface);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
82
Src/Wasabi/api/service/svcs/svc_droptarget.h
Normal file
82
Src/Wasabi/api/service/svcs/svc_droptarget.h
Normal file
|
@ -0,0 +1,82 @@
|
|||
#ifndef _SVC_DROPTARGET_H
|
||||
#define _SVC_DROPTARGET_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <api/service/services.h>
|
||||
|
||||
class DragInterface; // see bfc/drag.h
|
||||
|
||||
class NOVTABLE svc_dropTarget : public Dispatchable
|
||||
{
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::DROPTARGET; }
|
||||
|
||||
int testTarget(FOURCC type);
|
||||
|
||||
DragInterface *getDragInterfaceForType(FOURCC type);
|
||||
int releaseDragInterface(DragInterface *di);
|
||||
|
||||
protected:
|
||||
enum {
|
||||
TESTTARGET=100,
|
||||
GETDRAGINTERFACEFORTYPE=200,
|
||||
RELEASEDRAGINTERFACE=210,
|
||||
};
|
||||
};
|
||||
|
||||
inline
|
||||
int svc_dropTarget::testTarget(FOURCC type) {
|
||||
return _call(TESTTARGET, 0, type);
|
||||
}
|
||||
|
||||
inline
|
||||
DragInterface *svc_dropTarget::getDragInterfaceForType(FOURCC type) {
|
||||
return _call(GETDRAGINTERFACEFORTYPE, (DragInterface*)NULL, type);
|
||||
}
|
||||
|
||||
inline
|
||||
int svc_dropTarget::releaseDragInterface(DragInterface *di) {
|
||||
return _call(RELEASEDRAGINTERFACE, 0, di);
|
||||
}
|
||||
|
||||
class svc_dropTargetI : public svc_dropTarget {
|
||||
public:
|
||||
virtual int testTarget(FOURCC type)=0;
|
||||
|
||||
virtual DragInterface *getDragInterfaceForType(FOURCC type)=0;
|
||||
virtual int releaseDragInterface(DragInterface *di)=0;
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
#include <api/service/servicei.h>
|
||||
|
||||
template <class T>
|
||||
class DropTargetCreator : public waServiceFactoryTSingle<svc_dropTarget, T> { };
|
||||
|
||||
#include <api/service/svc_enum.h>
|
||||
#include <api/wnd/drag.h>
|
||||
|
||||
class DropTargetEnum : public SvcEnumT<svc_dropTarget> {
|
||||
public:
|
||||
DropTargetEnum(FOURCC type) : dt_type(type) {}
|
||||
static int throwDrop(FOURCC type, ifc_window *sourceWnd, int x=0, int y=0) {
|
||||
DropTargetEnum dte(type);
|
||||
svc_dropTarget *sdt = dte.getFirst();
|
||||
if (sdt == NULL) return 0;
|
||||
DragInterface *di = sdt->getDragInterfaceForType(type);
|
||||
int r = 0;
|
||||
if (di != NULL) r = di->dragDrop(sourceWnd, 0, 0);
|
||||
sdt->releaseDragInterface(di);
|
||||
return r;
|
||||
}
|
||||
protected:
|
||||
virtual int testService(svc_dropTarget *svc) {
|
||||
return (svc->testTarget(dt_type));
|
||||
}
|
||||
private:
|
||||
FOURCC dt_type;
|
||||
};
|
||||
|
||||
#endif
|
11
Src/Wasabi/api/service/svcs/svc_eval.cpp
Normal file
11
Src/Wasabi/api/service/svcs/svc_eval.cpp
Normal file
|
@ -0,0 +1,11 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "svc_eval.h"
|
||||
|
||||
#define CBCLASS svc_evaluatorI
|
||||
START_DISPATCH
|
||||
CB(GETEVALTYPE, getEvalType);
|
||||
CB(SETEVALSTRING, setEvalString);
|
||||
CB(EVALUATE, evaluate);
|
||||
END_DISPATCH
|
||||
#undef CBCLASS
|
64
Src/Wasabi/api/service/svcs/svc_eval.h
Normal file
64
Src/Wasabi/api/service/svcs/svc_eval.h
Normal file
|
@ -0,0 +1,64 @@
|
|||
#ifndef _SVC_EVAL_H
|
||||
#define _SVC_EVAL_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <api/service/services.h>
|
||||
|
||||
class NOVTABLE svc_evaluator : public Dispatchable {
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::EVALUATOR; }
|
||||
|
||||
const char *getEvalType(); // "php", "perl", "math", "xmlgen", etc.
|
||||
|
||||
// these are for future optimization -- BU
|
||||
// void assignVar(const char *name, const char *value);
|
||||
// const char *getVarValue(const char *name);
|
||||
// int getVarIndex(const char *name);
|
||||
// const char *getVarValueByIndex(int pos);
|
||||
|
||||
int setEvalString(const char *string, int length, BOOL isBinary);
|
||||
// free the returned memory with api->sysFree()
|
||||
const char *evaluate(int *length, BOOL *isBinary);
|
||||
|
||||
protected:
|
||||
enum {
|
||||
GETEVALTYPE, ASSIGNVAR, GETVARVALUE, GETVARINDEX, GETVARVALUEBYINDEX,
|
||||
SETEVALSTRING, EVALUATE
|
||||
};
|
||||
};
|
||||
|
||||
inline
|
||||
const char *svc_evaluator::getEvalType() {
|
||||
return _call(GETEVALTYPE, (const char *)NULL);
|
||||
}
|
||||
|
||||
inline
|
||||
int svc_evaluator::setEvalString(const char *string, int length, BOOL isBinary){
|
||||
return _call(SETEVALSTRING, FALSE, string, length, isBinary);
|
||||
}
|
||||
|
||||
inline
|
||||
const char *svc_evaluator::evaluate(int *length, BOOL *isBinary) {
|
||||
return _call(EVALUATE, (const char *)NULL, length, isBinary);
|
||||
}
|
||||
|
||||
// implementor derives from this one
|
||||
class NOVTABLE svc_evaluatorI : public svc_evaluator {
|
||||
public:
|
||||
virtual const char *getEvalType()=0;
|
||||
|
||||
// void assignVar(const char *name, const char *value);
|
||||
// const char *getVarValue(const char *name);
|
||||
// int getVarIndex(const char *name);
|
||||
// const char *getVarValueByIndex(int pos);
|
||||
|
||||
// implementor should make a copy of the string (if needed)
|
||||
virtual int setEvalString(const char *string, int length, BOOL isBinary)=0;
|
||||
// implementor should alloc returned mem w/ api->sysMalloc()
|
||||
virtual const char *evaluate(int *length, BOOL *isBinary)=0;
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
#endif
|
32
Src/Wasabi/api/service/svcs/svc_export.h
Normal file
32
Src/Wasabi/api/service/svcs/svc_export.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
#ifndef _SVC_EXPORT_H
|
||||
#define _SVC_EXPORT_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <api/service/services.h>
|
||||
|
||||
class svc_fileReader;
|
||||
|
||||
class svc_exporter /*: public Dispatchable*/ {
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::EXPORTER; }
|
||||
|
||||
virtual int isMine(const char *exportid, const char *family)=0;
|
||||
|
||||
virtual svc_fileReader *open()=0;
|
||||
virtual close(svc_fileReader *reader)=0;
|
||||
};
|
||||
|
||||
class ExporterEnum : public SvcEnumT<svc_exporter> {
|
||||
public:
|
||||
ExporterEnum(const char *exportid, const char *family=NULL) :
|
||||
id(exportid), fam(family) { }
|
||||
|
||||
virtual int testService(svc_exporter *svc) {
|
||||
return svc->isMine(id, fam);
|
||||
}
|
||||
|
||||
private:
|
||||
String id, fam;
|
||||
};
|
||||
|
||||
#endif
|
30
Src/Wasabi/api/service/svcs/svc_fileread.cpp
Normal file
30
Src/Wasabi/api/service/svcs/svc_fileread.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include <api/filereader/svc_filereadI.h>
|
||||
|
||||
#define CBCLASS svc_fileReaderI
|
||||
START_DISPATCH;
|
||||
CB(ISMINE, isMine);
|
||||
CB(OPEN, open);
|
||||
CB(READ, read);
|
||||
CB(WRITE, write);
|
||||
VCB(CLOSE, close);
|
||||
VCB(ABORT, abort);
|
||||
CB(GETLENGTH, getLength);
|
||||
CB(GETPOS, getPos);
|
||||
CB(CANSEEK, canSeek);
|
||||
CB(SEEK, seek);
|
||||
CB(HASHEADERS,hasHeaders);
|
||||
CB(GETHEADER,getHeader);
|
||||
CB(EXISTS,exists);
|
||||
CB(REMOVE,remove);
|
||||
CB(REMOVEUNDOABLE,removeUndoable);
|
||||
CB(MOVE,move);
|
||||
CB(BYTESAVAILABLE,bytesAvailable);
|
||||
VCB(SETMETADATACALLBACK,setMetaDataCallback);
|
||||
CB(CANPREFETCH,canPrefetch);
|
||||
CB(CANSETEOF, canSetEOF);
|
||||
CB(SETEOF, setEOF);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
199
Src/Wasabi/api/service/svcs/svc_fileread.h
Normal file
199
Src/Wasabi/api/service/svcs/svc_fileread.h
Normal file
|
@ -0,0 +1,199 @@
|
|||
#ifndef _SVC_FILEREAD_H
|
||||
#define _SVC_FILEREAD_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <bfc/platform/types.h>
|
||||
#include <api/service/services.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace SvcFileReader
|
||||
{
|
||||
enum {
|
||||
READ = 1,
|
||||
WRITE = 2,
|
||||
APPEND = 4,
|
||||
PLUS = 8,
|
||||
BINARY = 16,
|
||||
TEXT = 32,
|
||||
};
|
||||
};
|
||||
|
||||
class api_readercallback;
|
||||
|
||||
class NOVTABLE svc_fileReader : public Dispatchable
|
||||
{
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::FILEREADER; }
|
||||
|
||||
int isMine(const wchar_t *filename, int mode = SvcFileReader::READ); //don't really open. returns -1 if "don't know until I open it"
|
||||
int open(const wchar_t *filename, int mode = SvcFileReader::READ);
|
||||
size_t read(int8_t *buffer, size_t length);
|
||||
size_t write(const int8_t *buffer, size_t length);
|
||||
void close(); // safe to call even when not open
|
||||
|
||||
int canSetEOF();
|
||||
/**
|
||||
Asks the file reader to change the file length to newlen. Will fail if file
|
||||
was not opened for writing.
|
||||
@ret 1 on success, 0 on failure, -1 if operation is unsupported by this reader.
|
||||
*/
|
||||
int setEOF(uint64_t newlen);
|
||||
|
||||
void abort();
|
||||
|
||||
uint64_t getLength();
|
||||
uint64_t getPos();
|
||||
|
||||
int canSeek();
|
||||
int seek(uint64_t position);
|
||||
uint64_t bytesAvailable(uint64_t requested);
|
||||
|
||||
int hasHeaders();
|
||||
const char *getHeader(const char *header);
|
||||
|
||||
int exists(const wchar_t *filename);
|
||||
|
||||
int remove(const wchar_t *filename);
|
||||
|
||||
int removeUndoable(const wchar_t *filename);
|
||||
|
||||
int move(const wchar_t *filename, const wchar_t *destfilename);
|
||||
|
||||
int canPrefetch();
|
||||
|
||||
void setMetaDataCallback(api_readercallback *cb);
|
||||
|
||||
enum
|
||||
{
|
||||
ISMINE = 0,
|
||||
OPEN = 10,
|
||||
READ = 20,
|
||||
WRITE = 30,
|
||||
CLOSE = 40,
|
||||
ABORT = 50,
|
||||
GETLENGTH = 60,
|
||||
GETPOS = 70,
|
||||
CANSEEK = 80,
|
||||
SEEK = 90,
|
||||
HASHEADERS = 100,
|
||||
GETHEADER = 110,
|
||||
EXISTS = 120,
|
||||
REMOVE = 130,
|
||||
REMOVEUNDOABLE = 135,
|
||||
BYTESAVAILABLE = 140,
|
||||
SETMETADATACALLBACK = 150,
|
||||
MOVE = 160,
|
||||
CANPREFETCH = 170,
|
||||
CANSETEOF = 180,
|
||||
SETEOF = 190,
|
||||
};
|
||||
};
|
||||
|
||||
inline
|
||||
int svc_fileReader::isMine(const wchar_t *filename, int mode)
|
||||
{
|
||||
return _call(ISMINE, -1, filename, mode);
|
||||
}
|
||||
|
||||
inline int svc_fileReader::open(const wchar_t *filename, int mode)
|
||||
{
|
||||
return _call(OPEN, 0, filename, mode);
|
||||
}
|
||||
|
||||
inline size_t svc_fileReader::read(int8_t *buffer, size_t length)
|
||||
{
|
||||
return _call(READ, 0, buffer, length);
|
||||
}
|
||||
|
||||
inline size_t svc_fileReader::write(const int8_t *buffer, size_t length)
|
||||
{
|
||||
return _call(WRITE, 0, buffer, length);
|
||||
}
|
||||
|
||||
inline void svc_fileReader::close()
|
||||
{
|
||||
_voidcall(CLOSE);
|
||||
}
|
||||
|
||||
inline int svc_fileReader::canSetEOF()
|
||||
{
|
||||
return _call(CANSETEOF, 0);
|
||||
}
|
||||
|
||||
inline int svc_fileReader::setEOF(uint64_t newlen)
|
||||
{
|
||||
return _call(SETEOF, -1, newlen);
|
||||
}
|
||||
|
||||
inline void svc_fileReader::abort()
|
||||
{
|
||||
_voidcall(ABORT);
|
||||
}
|
||||
|
||||
inline uint64_t svc_fileReader::getLength()
|
||||
{
|
||||
return _call(GETLENGTH, (uint64_t)-1);
|
||||
}
|
||||
|
||||
inline uint64_t svc_fileReader::getPos()
|
||||
{
|
||||
return _call(GETPOS, (uint64_t)0);
|
||||
}
|
||||
|
||||
inline int svc_fileReader::canSeek()
|
||||
{
|
||||
return _call(CANSEEK, 0);
|
||||
}
|
||||
|
||||
inline int svc_fileReader::seek(uint64_t position)
|
||||
{
|
||||
return _call(SEEK, 0, position);
|
||||
}
|
||||
|
||||
inline uint64_t svc_fileReader::bytesAvailable(uint64_t requested)
|
||||
{
|
||||
return _call(BYTESAVAILABLE, requested, requested);
|
||||
}
|
||||
|
||||
inline int svc_fileReader::hasHeaders()
|
||||
{
|
||||
return _call(HASHEADERS, 0);
|
||||
}
|
||||
|
||||
inline const char *svc_fileReader::getHeader(const char *header)
|
||||
{
|
||||
return _call(GETHEADER, (const char *)NULL, header);
|
||||
}
|
||||
|
||||
inline int svc_fileReader::exists(const wchar_t *filename)
|
||||
{
|
||||
return _call(EXISTS, -1, filename);
|
||||
}
|
||||
|
||||
inline int svc_fileReader::remove(const wchar_t *filename)
|
||||
{
|
||||
return _call(REMOVE, 0, filename);
|
||||
}
|
||||
|
||||
inline
|
||||
int svc_fileReader::removeUndoable(const wchar_t *filename)
|
||||
{
|
||||
return _call(REMOVEUNDOABLE, -1, filename);
|
||||
}
|
||||
|
||||
inline int svc_fileReader::move(const wchar_t *filename, const wchar_t *destfilename)
|
||||
{
|
||||
return _call(MOVE, 0, filename, destfilename);
|
||||
}
|
||||
|
||||
inline void svc_fileReader::setMetaDataCallback(api_readercallback *cb)
|
||||
{
|
||||
_voidcall(SETMETADATACALLBACK, cb);
|
||||
}
|
||||
|
||||
inline int svc_fileReader::canPrefetch()
|
||||
{
|
||||
return _call(CANPREFETCH, 1);
|
||||
}
|
||||
|
||||
#endif
|
15
Src/Wasabi/api/service/svcs/svc_filesel.cpp
Normal file
15
Src/Wasabi/api/service/svcs/svc_filesel.cpp
Normal file
|
@ -0,0 +1,15 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "svc_filesel.h"
|
||||
|
||||
#define CBCLASS svc_fileSelectorI
|
||||
START_DISPATCH;
|
||||
CB(TESTPREFIX, testPrefix);
|
||||
CB(GETPREFIX, getPrefix);
|
||||
CB(SETEXTLIST, setExtList);
|
||||
CB(RUNSELECTOR, runSelector);
|
||||
CB(GETNUMFILESSELECTED, getNumFilesSelected);
|
||||
CB(ENUMFILENAME, enumFilename);
|
||||
CB(GETDIRECTORY, getDirectory);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
89
Src/Wasabi/api/service/svcs/svc_filesel.h
Normal file
89
Src/Wasabi/api/service/svcs/svc_filesel.h
Normal file
|
@ -0,0 +1,89 @@
|
|||
#ifndef _SVC_FILESEL_H
|
||||
#define _SVC_FILESEL_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <api/service/services.h>
|
||||
|
||||
class ifc_window;
|
||||
|
||||
class NOVTABLE svc_fileSelector : public Dispatchable {
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::FILESELECTOR; }
|
||||
|
||||
int testPrefix(const wchar_t *prefix) {
|
||||
return _call(TESTPREFIX, 0, prefix);
|
||||
}
|
||||
const wchar_t *getPrefix() {
|
||||
return _call(GETPREFIX, L"");
|
||||
}
|
||||
int setTitle(const wchar_t *title) {
|
||||
return _call(SETTITLE, 0, title);
|
||||
}
|
||||
int setExtList(const wchar_t *ext) {
|
||||
return _call(SETEXTLIST, 0, ext);
|
||||
}
|
||||
int runSelector(ifc_window *parWnd, int type, int allow_multiple, const wchar_t *ident=NULL, const wchar_t *default_dir=NULL) {
|
||||
return _call(RUNSELECTOR, 0, parWnd, type, allow_multiple, ident, default_dir);
|
||||
}
|
||||
int getNumFilesSelected() {
|
||||
return _call(GETNUMFILESSELECTED, 0);
|
||||
}
|
||||
const wchar_t *enumFilename(int n) {
|
||||
return _call(ENUMFILENAME, L"", n);
|
||||
}
|
||||
const wchar_t *getDirectory() {
|
||||
return _call(GETDIRECTORY, L"");
|
||||
}
|
||||
|
||||
protected:
|
||||
enum {
|
||||
TESTPREFIX=0,
|
||||
GETPREFIX=10,
|
||||
SETTITLE=20,
|
||||
SETEXTLIST=30,
|
||||
RUNSELECTOR=40,
|
||||
GETNUMFILESSELECTED=50,
|
||||
ENUMFILENAME=60,
|
||||
GETDIRECTORY=70,
|
||||
};
|
||||
};
|
||||
|
||||
namespace FileSel {
|
||||
enum {
|
||||
OPEN=1, SAVEAS=2,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
class NOVTABLE svc_fileSelectorI : public svc_fileSelector {
|
||||
public:
|
||||
virtual int testPrefix(const wchar_t *prefix)=0;
|
||||
virtual const wchar_t *getPrefix()=0;
|
||||
virtual int setTitle(const wchar_t *title) { return 0; }
|
||||
virtual int setExtList(const wchar_t *ext) { return 0; }
|
||||
virtual int runSelector(ifc_window *parWnd, int type, int allow_multiple, const wchar_t *ident=NULL, const wchar_t *default_dir=NULL)=0;
|
||||
virtual int getNumFilesSelected()=0;
|
||||
virtual const wchar_t *enumFilename(int n)=0;
|
||||
virtual const wchar_t *getDirectory()=0;
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
#include <api/service/svc_enum.h>
|
||||
#include <bfc/string/StringW.h>
|
||||
|
||||
class FileSelectorEnum : public SvcEnumT<svc_fileSelector> {
|
||||
public:
|
||||
FileSelectorEnum(const wchar_t *_prefix=L"files") : prefix(_prefix) { }
|
||||
|
||||
protected:
|
||||
virtual int testService(svc_fileSelector *svc) {
|
||||
return prefix.isempty() || svc->testPrefix(prefix);
|
||||
}
|
||||
|
||||
private:
|
||||
StringW prefix;
|
||||
};
|
||||
|
||||
#endif
|
27
Src/Wasabi/api/service/svcs/svc_font.cpp
Normal file
27
Src/Wasabi/api/service/svcs/svc_font.cpp
Normal file
|
@ -0,0 +1,27 @@
|
|||
#include <precomp.h>
|
||||
#include <api/font/svc_fonti.h>
|
||||
|
||||
#define CBCLASS svc_fontI
|
||||
START_DISPATCH
|
||||
VCB(TEXTOUT, textOut);
|
||||
VCB(TEXTOUT2, textOut2);
|
||||
VCB(TEXTOUTELLIPSED, textOutEllipsed);
|
||||
VCB(TEXTOUTWRAPPED, textOutWrapped);
|
||||
VCB(TEXTOUTWRAPPEDPATHED, textOutWrappedPathed);
|
||||
VCB(TEXTOUTCENTERED, textOutCentered);
|
||||
CB(GETTEXTWIDTH, getTextWidth);
|
||||
CB(GETTEXTHEIGHT, getTextHeight);
|
||||
CB(GETTEXTHEIGHT2, getTextHeight2);
|
||||
VCB(GETTEXTEXTENT, getTextExtent);
|
||||
VCB(SETFONTID, setFontId);
|
||||
CB(GETFONTID, getFontId);
|
||||
CB(GETFACENAME_, getFaceName);
|
||||
CB(ISBITMAP, isBitmap);
|
||||
CB(GETSCRIPTID, getScriptId);
|
||||
VCB(SETSCRIPTID, setScriptId);
|
||||
VCB(SETFONTFACE, setFontFace);
|
||||
CB(ADDFONTRESOURCE, addFontResource);
|
||||
CB(ADDFONTRESOURCE2, addFontResource2);
|
||||
CB(GETFONTSVCNAME, getFontSvcName);
|
||||
END_DISPATCH
|
||||
#undef CBCLASS
|
178
Src/Wasabi/api/service/svcs/svc_font.h
Normal file
178
Src/Wasabi/api/service/svcs/svc_font.h
Normal file
|
@ -0,0 +1,178 @@
|
|||
#ifndef _SVC_FONT_H
|
||||
#define _SVC_FONT_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <bfc/std_file.h>
|
||||
#include <stdio.h>
|
||||
#include <api/service/services.h>
|
||||
//#include <api/service/servicei.h>
|
||||
|
||||
class ifc_canvas;
|
||||
|
||||
#ifdef _WIN32
|
||||
enum
|
||||
{
|
||||
STDFONT_LEFT = DT_LEFT,
|
||||
STDFONT_RIGHT = DT_RIGHT,
|
||||
STDFONT_CENTER = DT_CENTER,
|
||||
};
|
||||
#else
|
||||
#warning TODO: find good values for these
|
||||
enum
|
||||
{
|
||||
STDFONT_RIGHT = 1,
|
||||
STDFONT_CENTER = 2,
|
||||
STDFONT_LEFT = 4,
|
||||
};
|
||||
#endif
|
||||
|
||||
class NOVTABLE svc_font : public Dispatchable
|
||||
{
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::FONTRENDER; }
|
||||
|
||||
void textOut(ifc_canvas *c, int x, int y, const wchar_t *txt, int size, int bold, int opaque, int underline, int italic, ARGB32 color, ARGB32 bkcolor, int xoffset, int yoffset, int antialias); // abstract interface
|
||||
void textOut(ifc_canvas *c, int x, int y, int w, int h, const wchar_t *txt, int size, int bold, int opaque, int underline, int italic, int align, ARGB32 color, ARGB32 bkcolor, int xoffset, int yoffset, int antialias);
|
||||
void textOutEllipsed(ifc_canvas *c, int x, int y, int w, int h, const wchar_t *txt, int size, int bold, int opaque, int underline, int italic, int align, ARGB32 color, ARGB32 bkcolor, int xoffset, int yoffset, int antialias);
|
||||
void textOutWrapped(ifc_canvas *c, int x, int y, int w, int h, const wchar_t *txt, int size, int bold, int opaque, int underline, int italic, int align, ARGB32 color, ARGB32 bkcolor, int xoffset, int yoffset, int antialias);
|
||||
void textOutWrappedPathed(ifc_canvas *c, int x, int y, int w, const wchar_t *txt, int size, int bold, int opaque, int underline, int italic, int align, ARGB32 color, ARGB32 bkcolor, int xoffset, int yoffset, int antialias);
|
||||
void textOutCentered(ifc_canvas *c, RECT *r, const wchar_t *txt, int size, int bold, int opaque, int underline, int italic, int align, ARGB32 color, ARGB32 bkcolor, int xoffset, int yoffset, int antialias);
|
||||
int getTextWidth(ifc_canvas *c, const wchar_t *text, int size, int bold, int underline, int italic, int antialias);
|
||||
int getTextHeight(ifc_canvas *c, const wchar_t *text, int size, int bold, int underline, int italic, int antialias);
|
||||
int getTextHeight(ifc_canvas *c, int size, int bold, int underline, int italic, int antialias);
|
||||
void getTextExtent(ifc_canvas *c, const wchar_t *text, int *w, int *h, int size, int bold, int underline, int italic, int antialias);
|
||||
|
||||
void setFontId(const wchar_t *id);
|
||||
const wchar_t *getFontId();
|
||||
const wchar_t *getFaceName();
|
||||
int isBitmap();
|
||||
int getScriptId();
|
||||
void setScriptId(int id);
|
||||
|
||||
void setFontFace(const wchar_t *face);
|
||||
int addFontResource(HANDLE f, const wchar_t *name);
|
||||
int addFontResource2(void *mem, int datalen, const wchar_t *name);
|
||||
|
||||
const wchar_t *getFontSvcName();
|
||||
|
||||
protected:
|
||||
enum {
|
||||
TEXTOUT,
|
||||
TEXTOUT2,
|
||||
TEXTOUTELLIPSED,
|
||||
TEXTOUTWRAPPED,
|
||||
TEXTOUTWRAPPEDPATHED,
|
||||
TEXTOUTCENTERED,
|
||||
GETTEXTWIDTH,
|
||||
GETTEXTHEIGHT,
|
||||
GETTEXTHEIGHT2,
|
||||
GETTEXTEXTENT,
|
||||
SETFONTID,
|
||||
GETFONTID,
|
||||
GETFACENAME_, // GETFACENAME is taken in win32
|
||||
ISBITMAP,
|
||||
GETSCRIPTID,
|
||||
SETSCRIPTID,
|
||||
SETFONTFACE,
|
||||
ADDFONTRESOURCE,
|
||||
ADDFONTRESOURCE2,
|
||||
GETFONTSVCNAME,
|
||||
};
|
||||
};
|
||||
|
||||
inline void svc_font::textOut(ifc_canvas *c, int x, int y, const wchar_t *txt, int size, int bold, int opaque, int underline, int italic, ARGB32 color, ARGB32 bkcolor, int xoffset, int yoffset, int antialias)
|
||||
{
|
||||
_voidcall(TEXTOUT, c, x, y, txt, size, bold, opaque, underline, italic, color, bkcolor, xoffset, yoffset, antialias);
|
||||
}
|
||||
|
||||
inline void svc_font::textOut(ifc_canvas *c, int x, int y, int w, int h, const wchar_t *txt, int size, int bold, int opaque, int underline, int italic, int align, ARGB32 color, ARGB32 bkcolor, int xoffset, int yoffset, int antialias)
|
||||
{
|
||||
_voidcall(TEXTOUT2, c, x, y, w, h, txt, size, bold, opaque, underline, italic, align, color, bkcolor, xoffset, yoffset, antialias);
|
||||
}
|
||||
|
||||
inline void svc_font::textOutEllipsed(ifc_canvas *c, int x, int y, int w, int h, const wchar_t *txt, int size, int bold, int opaque, int underline, int italic, int align, ARGB32 color, ARGB32 bkcolor, int xoffset, int yoffset, int antialias)
|
||||
{
|
||||
_voidcall(TEXTOUTELLIPSED, c, x, y, w, h, txt, size, bold, opaque, underline, italic, align, color, bkcolor, xoffset, yoffset, antialias);
|
||||
}
|
||||
|
||||
inline void svc_font::textOutWrapped(ifc_canvas *c, int x, int y, int w, int h, const wchar_t *txt, int size, int bold, int opaque, int underline, int italic, int align, ARGB32 color, ARGB32 bkcolor, int xoffset, int yoffset, int antialias)
|
||||
{
|
||||
_voidcall(TEXTOUTWRAPPED, c, x, y, w, h, txt, size, bold, opaque, underline, italic, align, color, bkcolor, xoffset, yoffset, antialias);
|
||||
}
|
||||
|
||||
inline void svc_font::textOutWrappedPathed(ifc_canvas *c, int x, int y, int w, const wchar_t *txt, int size, int bold, int opaque, int underline, int italic, int align, ARGB32 color, ARGB32 bkcolor, int xoffset, int yoffset, int antialias)
|
||||
{
|
||||
_voidcall(TEXTOUTWRAPPEDPATHED, c, x, y, w, txt, size, bold, opaque, underline, italic, align, color, bkcolor, xoffset, yoffset, antialias);
|
||||
}
|
||||
|
||||
inline void svc_font::textOutCentered(ifc_canvas *c, RECT *r, const wchar_t *txt, int size, int bold, int opaque, int underline, int italic, int align, ARGB32 color, ARGB32 bkcolor, int xoffset, int yoffset, int antialias)
|
||||
{
|
||||
_voidcall(TEXTOUTCENTERED, c, r, txt, size, bold, opaque, underline, italic, align, color, bkcolor, xoffset, yoffset, antialias);
|
||||
}
|
||||
|
||||
inline int svc_font::getTextWidth(ifc_canvas *c, const wchar_t *text, int size, int bold, int underline, int italic, int antialias)
|
||||
{
|
||||
return _call(GETTEXTWIDTH, (int)0, c, text, size, bold, underline, italic, antialias);
|
||||
}
|
||||
|
||||
inline int svc_font::getTextHeight(ifc_canvas *c, const wchar_t *text, int size, int bold, int underline, int italic, int antialias) {
|
||||
return _call(GETTEXTHEIGHT, (int)0, c, text, size, bold, underline, italic, antialias);
|
||||
}
|
||||
|
||||
inline int svc_font::getTextHeight(ifc_canvas *c, int size, int bold, int underline, int italic, int antialias) {
|
||||
return _call(GETTEXTHEIGHT, (int)0, c, size, bold, underline, italic, antialias);
|
||||
}
|
||||
|
||||
inline void svc_font::getTextExtent(ifc_canvas *c, const wchar_t *text, int *w, int *h, int size, int bold, int underline, int italic, int antialias) {
|
||||
_voidcall(GETTEXTEXTENT, c, text, w, h, size, bold, underline, italic, antialias);
|
||||
}
|
||||
|
||||
inline void svc_font::setFontId(const wchar_t *id) {
|
||||
_voidcall(SETFONTID, id);
|
||||
}
|
||||
|
||||
inline const wchar_t *svc_font::getFontId()
|
||||
{
|
||||
return _call(GETFONTID, (const wchar_t *)0);
|
||||
}
|
||||
|
||||
inline const wchar_t *svc_font::getFaceName()
|
||||
{
|
||||
return _call(GETFACENAME_, (const wchar_t *)0);
|
||||
}
|
||||
|
||||
inline int svc_font::isBitmap() {
|
||||
return _call(ISBITMAP, (int)0);
|
||||
}
|
||||
|
||||
inline int svc_font::getScriptId() {
|
||||
return _call(GETSCRIPTID, (int)0);
|
||||
}
|
||||
|
||||
inline void svc_font::setScriptId(int id) {
|
||||
_voidcall(SETSCRIPTID, id);
|
||||
}
|
||||
|
||||
inline void svc_font::setFontFace(const wchar_t *face)
|
||||
{
|
||||
_voidcall(SETFONTFACE, face);
|
||||
}
|
||||
|
||||
inline int svc_font::addFontResource(HANDLE f, const wchar_t *name) {
|
||||
return _call(ADDFONTRESOURCE, (int)0, f, name);
|
||||
}
|
||||
|
||||
inline int svc_font::addFontResource2(void *mem, int datalen, const wchar_t *name) {
|
||||
return _call(ADDFONTRESOURCE2, (int)0, mem, datalen, name);
|
||||
}
|
||||
|
||||
inline const wchar_t *svc_font::getFontSvcName() {
|
||||
return _call(GETFONTSVCNAME, (const wchar_t *)0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _SVC_FONT_H
|
9
Src/Wasabi/api/service/svcs/svc_fontmaker.cpp
Normal file
9
Src/Wasabi/api/service/svcs/svc_fontmaker.cpp
Normal file
|
@ -0,0 +1,9 @@
|
|||
#include "svc_fontmaker.h"
|
||||
|
||||
#define CBCLASS svc_fontMakerI
|
||||
START_DISPATCH
|
||||
CB(GETFONTMAKERNAME, getFontMakerName);
|
||||
CB(NEWTRUETYPEFONT, newTrueTypeFont);
|
||||
CB(DELETETRUETYPEFONT, deleteTrueTypeFont);
|
||||
END_DISPATCH
|
||||
#undef CBCLASS
|
73
Src/Wasabi/api/service/svcs/svc_fontmaker.h
Normal file
73
Src/Wasabi/api/service/svcs/svc_fontmaker.h
Normal file
|
@ -0,0 +1,73 @@
|
|||
#ifndef _SVC_FONTMAKER_H
|
||||
#define _SVC_FONTMAKER_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <bfc/string/string.h>
|
||||
#include <api/service/svc_enum.h>
|
||||
#include <api/service/services.h>
|
||||
#include <api/service/servicei.h>
|
||||
|
||||
class svc_font;
|
||||
|
||||
//
|
||||
// This class doesn't do anything fantastic. It's just the way
|
||||
// you make your OS-Specific font class available to the system.
|
||||
|
||||
class NOVTABLE svc_fontMaker : public Dispatchable {
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::FONTRENDER; }
|
||||
|
||||
// You implement these:
|
||||
const char *getFontMakerName();
|
||||
svc_font *newTrueTypeFont();
|
||||
int deleteTrueTypeFont(svc_font *font);
|
||||
|
||||
protected:
|
||||
enum {
|
||||
GETFONTMAKERNAME,
|
||||
NEWTRUETYPEFONT,
|
||||
DELETETRUETYPEFONT,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
inline const char *svc_fontMaker::getFontMakerName() {
|
||||
return _call(GETFONTMAKERNAME, (const char *)0);
|
||||
}
|
||||
|
||||
inline svc_font *svc_fontMaker::newTrueTypeFont() {
|
||||
return _call(NEWTRUETYPEFONT, (svc_font *)0);
|
||||
}
|
||||
|
||||
inline int svc_fontMaker::deleteTrueTypeFont(svc_font *font) {
|
||||
return _call(DELETETRUETYPEFONT, (int)0, font);
|
||||
}
|
||||
|
||||
// implementor derives from this one
|
||||
class NOVTABLE svc_fontMakerI : public svc_fontMaker {
|
||||
public:
|
||||
virtual const char *getFontMakerName() = 0;
|
||||
virtual svc_font *newTrueTypeFont() = 0;
|
||||
virtual int deleteTrueTypeFont(svc_font *font) = 0;
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
class FontMakerEnum : public SvcEnumT<svc_fontMaker> {
|
||||
public:
|
||||
FontMakerEnum(const char *_maker_name = NULL) : maker_name(_maker_name) {}
|
||||
protected:
|
||||
virtual int testService(svc_fontMaker *svc) {
|
||||
if (!maker_name.len()) return 1; // blank name returns all services.
|
||||
return (STRCASEEQL(svc->getFontMakerName(),maker_name));
|
||||
}
|
||||
private:
|
||||
String maker_name;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class FontMakerCreator : public waServiceFactoryTSingle<svc_fontMaker, T> {};
|
||||
|
||||
|
||||
#endif // _SVC_FONTMAKER_H
|
16
Src/Wasabi/api/service/svcs/svc_fontrender.cpp
Normal file
16
Src/Wasabi/api/service/svcs/svc_fontrender.cpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
#include "svc_fontrender.h"
|
||||
|
||||
#define CBCLASS svc_fontRenderI
|
||||
START_DISPATCH
|
||||
CB(ISNAMED, isNamed);
|
||||
VCB(INSTALLTRUETYPEFONT, installTrueTypeFont);
|
||||
VCB(INSTALLBITMAPFONT, installBitmapFont);
|
||||
VCB(UNINSTALLALL, uninstallAll);
|
||||
VCB(UNINSTALLBYSCRIPTID, uninstallByScriptId);
|
||||
CB(REQUESTSKINFONT, requestSkinFont);
|
||||
VCB(DISPATCHTEXTOUT, dispatchTextOut);
|
||||
CB(DISPATCHGETINFO, dispatchGetInfo);
|
||||
CB(USETRUETYPEOVERRIDE, useTrueTypeOverride);
|
||||
CB(GETTRUETYPEOVERRIDE, getTrueTypeOverride);
|
||||
END_DISPATCH
|
||||
#undef CBCLASS
|
126
Src/Wasabi/api/service/svcs/svc_fontrender.h
Normal file
126
Src/Wasabi/api/service/svcs/svc_fontrender.h
Normal file
|
@ -0,0 +1,126 @@
|
|||
#ifndef _svc_fONTRENDER_H
|
||||
#define _svc_fONTRENDER_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <bfc/string/string.h>
|
||||
#include <api/service/svc_enum.h>
|
||||
#include <api/service/services.h>
|
||||
#include <api/service/servicei.h>
|
||||
|
||||
class svc_font;
|
||||
class ifc_canvas;
|
||||
|
||||
class NOVTABLE svc_fontRender : public Dispatchable {
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::FONTRENDER; }
|
||||
|
||||
// test the type.
|
||||
int isNamed(const char *renderer_name);
|
||||
|
||||
// static methods from Font::
|
||||
void installTrueTypeFont(const char *filename, const char *path, const char *id, int scriptid); // call this to install a new font
|
||||
void installBitmapFont(const char *filename, const char *path, const char *id, int charwidth, int charheight, int hspacing, int vspacing, int scriptid);
|
||||
void uninstallAll();
|
||||
void uninstallByScriptId(int scriptid);
|
||||
svc_font *requestSkinFont(const char *id); // call this to get a Font pointer to a font id
|
||||
void dispatchTextOut(ifc_canvas *c, int style, int x, int y, int w, int h, const char *txt);
|
||||
int dispatchGetInfo(ifc_canvas *c, const char *font, int infoid, const char *txt, int *w, int *h);
|
||||
int useTrueTypeOverride();
|
||||
const char *getTrueTypeOverride();
|
||||
|
||||
|
||||
protected:
|
||||
enum {
|
||||
ISNAMED,
|
||||
INSTALLTRUETYPEFONT,
|
||||
INSTALLBITMAPFONT,
|
||||
UNINSTALLALL,
|
||||
UNINSTALLBYSCRIPTID,
|
||||
REQUESTSKINFONT,
|
||||
DISPATCHTEXTOUT,
|
||||
DISPATCHGETINFO,
|
||||
USETRUETYPEOVERRIDE,
|
||||
GETTRUETYPEOVERRIDE,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
inline int svc_fontRender::isNamed(const char *renderer_name) {
|
||||
return _call(ISNAMED, (int)0, renderer_name);
|
||||
}
|
||||
|
||||
inline void svc_fontRender::installTrueTypeFont(const char *filename, const char *path, const char *id, int scriptid) {
|
||||
_voidcall(INSTALLTRUETYPEFONT, filename, path, id, scriptid);
|
||||
}
|
||||
|
||||
inline void svc_fontRender::installBitmapFont(const char *filename, const char *path, const char *id, int charwidth, int charheight, int hspacing, int vspacing, int scriptid) {
|
||||
_voidcall(INSTALLBITMAPFONT, filename, path, id, charwidth, charheight, hspacing, vspacing, scriptid);
|
||||
}
|
||||
|
||||
inline void svc_fontRender::uninstallAll() {
|
||||
_voidcall(UNINSTALLALL);
|
||||
}
|
||||
|
||||
inline void svc_fontRender::uninstallByScriptId(int scriptid) {
|
||||
_voidcall(UNINSTALLBYSCRIPTID, scriptid);
|
||||
}
|
||||
|
||||
inline svc_font *svc_fontRender::requestSkinFont(const char *id) {
|
||||
return _call(REQUESTSKINFONT, (svc_font *)0, id);
|
||||
}
|
||||
|
||||
inline void svc_fontRender::dispatchTextOut(ifc_canvas *c, int style, int x, int y, int w, int h, const char *txt) {
|
||||
_voidcall(DISPATCHTEXTOUT, c, style, x, y, w, h, txt);
|
||||
}
|
||||
|
||||
inline int svc_fontRender::dispatchGetInfo(ifc_canvas *c, const char *font, int infoid, const char *txt, int *w, int *h) {
|
||||
return _call(DISPATCHGETINFO, (int)0, c, font, infoid, txt, w, h );
|
||||
}
|
||||
|
||||
inline int svc_fontRender::useTrueTypeOverride() {
|
||||
return _call(USETRUETYPEOVERRIDE, (int)0);
|
||||
}
|
||||
|
||||
inline const char *svc_fontRender::getTrueTypeOverride() {
|
||||
return _call(GETTRUETYPEOVERRIDE, (const char *)0);
|
||||
}
|
||||
|
||||
// implementor derives from this one
|
||||
class NOVTABLE svc_fontRenderI : public svc_fontRender {
|
||||
public:
|
||||
|
||||
// test the type
|
||||
virtual int isNamed(const char *renderer_name) = 0;
|
||||
|
||||
// static methods from Font::
|
||||
virtual void installTrueTypeFont(const char *filename, const char *path, const char *id, int scriptid) = 0;
|
||||
virtual void installBitmapFont(const char *filename, const char *path, const char *id, int charwidth, int charheight, int hspacing, int vspacing, int scriptid) = 0;
|
||||
virtual void uninstallAll() = 0;
|
||||
virtual void uninstallByScriptId(int scriptid) = 0;
|
||||
virtual svc_font *requestSkinFont(const char *id) = 0; // call this to get a Font pointer to a font id
|
||||
virtual void dispatchTextOut(ifc_canvas *c, int style, int x, int y, int w, int h, const char *txt) = 0;
|
||||
virtual int dispatchGetInfo(ifc_canvas *c, const char *font, int infoid, const char *txt, int *w, int *h) = 0;
|
||||
virtual int useTrueTypeOverride() = 0;
|
||||
virtual const char *getTrueTypeOverride() = 0;
|
||||
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
class FontRenderEnum : public SvcEnumT<svc_fontRender> {
|
||||
public:
|
||||
FontRenderEnum(const char *_renderer_name = NULL) : renderer_name(_renderer_name) {}
|
||||
protected:
|
||||
virtual int testService(svc_fontRender *svc) {
|
||||
return (svc->isNamed(renderer_name));
|
||||
}
|
||||
private:
|
||||
String renderer_name;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class FontRenderCreator : public waServiceFactoryTSingle<svc_fontRender, T> {};
|
||||
|
||||
|
||||
#endif // _svc_fONTRENDER_H
|
11
Src/Wasabi/api/service/svcs/svc_imggen.cpp
Normal file
11
Src/Wasabi/api/service/svcs/svc_imggen.cpp
Normal file
|
@ -0,0 +1,11 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "svc_imggen.h"
|
||||
|
||||
#define CBCLASS svc_imageGeneratorI
|
||||
START_DISPATCH;
|
||||
CB(TESTDESC, testDesc);
|
||||
CB(GENIMAGE, genImage);
|
||||
CB(OUTPUTCACHEABLE, outputCacheable);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
68
Src/Wasabi/api/service/svcs/svc_imggen.h
Normal file
68
Src/Wasabi/api/service/svcs/svc_imggen.h
Normal file
|
@ -0,0 +1,68 @@
|
|||
#ifndef _SVC_IMGGEN_H
|
||||
#define _SVC_IMGGEN_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <api/service/services.h>
|
||||
|
||||
|
||||
class NOVTABLE svc_imageGenerator : public Dispatchable
|
||||
{
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::IMAGEGENERATOR; }
|
||||
int testDesc(const wchar_t *desc);
|
||||
ARGB32 *genImage(const wchar_t *desc, int *has_alpha, int *w, int *h, ifc_xmlreaderparams *params = NULL);
|
||||
int outputCacheable();
|
||||
|
||||
enum {
|
||||
TESTDESC = 10,
|
||||
GENIMAGE = 30,
|
||||
OUTPUTCACHEABLE = 40,
|
||||
};
|
||||
};
|
||||
|
||||
inline int svc_imageGenerator::testDesc(const wchar_t *desc)
|
||||
{
|
||||
return _call(TESTDESC, 0, desc);
|
||||
}
|
||||
|
||||
inline ARGB32 *svc_imageGenerator::genImage(const wchar_t *desc, int *has_alpha, int *w, int *h, ifc_xmlreaderparams *params)
|
||||
{
|
||||
return _call(GENIMAGE, (ARGB32 *)0, desc, has_alpha, w, h, params);
|
||||
}
|
||||
|
||||
inline int svc_imageGenerator::outputCacheable()
|
||||
{
|
||||
return _call(OUTPUTCACHEABLE, 0);
|
||||
}
|
||||
|
||||
// derive from this one
|
||||
class NOVTABLE svc_imageGeneratorI : public svc_imageGenerator
|
||||
{
|
||||
public:
|
||||
virtual int testDesc(const wchar_t *desc) = 0;
|
||||
virtual ARGB32 *genImage(const wchar_t *desc, int *has_alpha, int *w, int *h, ifc_xmlreaderparams *params = NULL) = 0;
|
||||
virtual int outputCacheable() { return 0; }
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
#include <api/service/svc_enum.h>
|
||||
#include <bfc/string/StringW.h>
|
||||
|
||||
class ImgGeneratorEnum : public SvcEnumT<svc_imageGenerator>
|
||||
{
|
||||
public:
|
||||
ImgGeneratorEnum(const wchar_t *_desc) : desc(_desc) { }
|
||||
|
||||
protected:
|
||||
virtual int testService(svc_imageGenerator *svc)
|
||||
{
|
||||
return svc->testDesc(desc);
|
||||
}
|
||||
|
||||
private:
|
||||
StringW desc;
|
||||
};
|
||||
|
||||
#endif
|
14
Src/Wasabi/api/service/svcs/svc_imgload.cpp
Normal file
14
Src/Wasabi/api/service/svcs/svc_imgload.cpp
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "svc_imgload.h"
|
||||
|
||||
#define CBCLASS svc_imageLoaderI
|
||||
START_DISPATCH;
|
||||
CB(ISMINE, isMine);
|
||||
CB(TESTDATA, testData);
|
||||
CB(GETHEADERSIZE, getHeaderSize);
|
||||
CB(GETDIMENSIONS, getDimensions);
|
||||
CB(LOADIMAGE, loadImage);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
101
Src/Wasabi/api/service/svcs/svc_imgload.h
Normal file
101
Src/Wasabi/api/service/svcs/svc_imgload.h
Normal file
|
@ -0,0 +1,101 @@
|
|||
#ifndef _SVC_IMGLOAD_H
|
||||
#define _SVC_IMGLOAD_H
|
||||
|
||||
#include <api/service/services.h>
|
||||
#include <bfc/platform/platform.h>
|
||||
#include <bfc/dispatch.h>
|
||||
|
||||
|
||||
class ifc_xmlreaderparams;
|
||||
|
||||
class NOVTABLE svc_imageLoader : public Dispatchable
|
||||
{
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::IMAGELOADER; }
|
||||
|
||||
// assuming there is an extension of this type, is it yours?
|
||||
int isMine(const wchar_t *filename);
|
||||
|
||||
// returns the mime type for this type of image
|
||||
const wchar_t *mimeType();
|
||||
|
||||
// returns how many bytes needed to get image info
|
||||
int getHeaderSize();
|
||||
|
||||
// test image data, return TRUE if you can load it
|
||||
int testData(const void *data, int datalen);
|
||||
|
||||
// just gets the width and height from the data, if possible
|
||||
int getDimensions(const void *data, int datalen, int *w, int *h);
|
||||
|
||||
// converts the data into pixels + premultiply, use api->sysFree to deallocate
|
||||
ARGB32 *loadImage(const void *data, int datalen, int *w, int *h, ifc_xmlreaderparams *params=NULL);\
|
||||
|
||||
// converts the data into pixels, use api->sysFree to deallocate
|
||||
ARGB32 *loadImageData(const void *data, int datalen, int *w, int *h, ifc_xmlreaderparams *params=NULL);
|
||||
|
||||
enum {
|
||||
ISMINE=50,
|
||||
MIMETYPE=75,
|
||||
GETHEADERSIZE=100,
|
||||
TESTDATA=200,
|
||||
GETDIMENSIONS=300,
|
||||
LOADIMAGE=400,
|
||||
LOADIMAGEDATA=500,
|
||||
};
|
||||
};
|
||||
|
||||
inline int svc_imageLoader::isMine(const wchar_t *filename) {
|
||||
return _call(ISMINE, 0, filename);
|
||||
}
|
||||
|
||||
inline const wchar_t *svc_imageLoader::mimeType() {
|
||||
return _call(MIMETYPE, L"");
|
||||
}
|
||||
|
||||
inline int svc_imageLoader::getHeaderSize() {
|
||||
return _call(GETHEADERSIZE, -1);
|
||||
}
|
||||
|
||||
inline int svc_imageLoader::testData(const void *data, int datalen) {
|
||||
return _call(TESTDATA, 0, data, datalen);
|
||||
}
|
||||
|
||||
inline int svc_imageLoader::getDimensions(const void *data, int datalen, int *w, int *h) {
|
||||
return _call(GETDIMENSIONS, 0, data, datalen, w, h);
|
||||
}
|
||||
|
||||
inline ARGB32 *svc_imageLoader::loadImage(const void *data, int datalen, int *w, int *h, ifc_xmlreaderparams *params) {
|
||||
return _call(LOADIMAGE, (ARGB32*)0, data, datalen, w, h, params);
|
||||
}
|
||||
|
||||
inline ARGB32 *svc_imageLoader::loadImageData(const void *data, int datalen, int *w, int *h, ifc_xmlreaderparams *params) {
|
||||
return _call(LOADIMAGEDATA, (ARGB32*)0, data, datalen, w, h, params);
|
||||
}
|
||||
|
||||
// derive from this one
|
||||
class NOVTABLE svc_imageLoaderI : public svc_imageLoader
|
||||
{
|
||||
public:
|
||||
virtual int isMine(const wchar_t *filename)=0;
|
||||
virtual const wchar_t *mimeType(void)=0;
|
||||
// return the header size needed to get w/h and determine if it can be loaded
|
||||
virtual int getHeaderSize() { return -1; }//don't know
|
||||
// test image data, return TRUE if you can load it
|
||||
virtual int testData(const void *data, int datalen)=0;
|
||||
// just gets the width and height from the data, if possible
|
||||
virtual int getDimensions(const void *data, int datalen, int *w, int *h) { return 0; }
|
||||
// converts the data into pixels + premultiply, use api->sysFree to deallocate
|
||||
virtual ARGB32 *loadImage(const void *data, int datalen, int *w, int *h, ifc_xmlreaderparams *params=NULL)=0;
|
||||
#if 0
|
||||
// converts the data into pixels, use api->sysFree to deallocate
|
||||
virtual ARGB32 *loadImageData(const void *data, int datalen, int *w, int *h, ifc_xmlreaderparams *params=NULL)=0;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
101
Src/Wasabi/api/service/svcs/svc_imgwrite.h
Normal file
101
Src/Wasabi/api/service/svcs/svc_imgwrite.h
Normal file
|
@ -0,0 +1,101 @@
|
|||
#ifndef _SVC_IMGWRITE_H
|
||||
#define _SVC_IMGWRITE_H
|
||||
|
||||
#include <api/service/services.h>
|
||||
#include <bfc/platform/platform.h>
|
||||
#include <bfc/dispatch.h>
|
||||
|
||||
class NOVTABLE svc_imageWriter : public Dispatchable {
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::IMAGEWRITER; }
|
||||
|
||||
// returns a human readable string about the format. eg "JPEG"
|
||||
const wchar_t * getImageTypeName();
|
||||
|
||||
// returns a semi-colon delimited list of file extensions for this format. eg "jpg;jpeg"
|
||||
// MUST BE LOWER CASE
|
||||
const wchar_t * getExtensions();
|
||||
|
||||
// valid items include "quality" for jpeg files with value "0" to "100"
|
||||
// return value is 1 if the config item is supported, 0 if it is not.
|
||||
int setConfig(const wchar_t * item, const wchar_t * value);
|
||||
|
||||
// valid items include "quality" for jpeg files with value "0" to "100", "lossless" returns "1" if it is "0" otherwise
|
||||
// return value is 1 if the config item is supported, 0 if it is not.
|
||||
int getConfig(const wchar_t * item, wchar_t * value, int valuelen);
|
||||
|
||||
// returns 1 if the bit depth is supported (eg 32 for ARGB32, 24 for RGB24)
|
||||
// ARGB32 MUST be supported
|
||||
int bitDepthSupported(int depth);
|
||||
|
||||
// returns the image in our format, free the returned buffer with api_memmgr::sysFree()
|
||||
void * convert(const void *pixels, int bitDepth, int w, int h, int *length);
|
||||
|
||||
enum {
|
||||
GETIMAGETYPENAME=10,
|
||||
GETEXTENSIONS=20,
|
||||
SETCONFIG=30,
|
||||
GETCONFIG=40,
|
||||
BITDEPTHSUPPORTED=50,
|
||||
CONVERT=60,
|
||||
};
|
||||
};
|
||||
|
||||
inline const wchar_t *svc_imageWriter::getImageTypeName() {
|
||||
return _call(GETIMAGETYPENAME, L"");
|
||||
}
|
||||
|
||||
inline const wchar_t *svc_imageWriter::getExtensions() {
|
||||
return _call(GETEXTENSIONS, L"");
|
||||
}
|
||||
|
||||
inline int svc_imageWriter::setConfig(const wchar_t * item, const wchar_t * value) {
|
||||
return _call(SETCONFIG, (int)0, item, value);
|
||||
}
|
||||
|
||||
inline int svc_imageWriter::getConfig(const wchar_t * item, wchar_t * value, int valuelen) {
|
||||
return _call(GETCONFIG, (int)0, item, value, valuelen);
|
||||
}
|
||||
|
||||
inline int svc_imageWriter::bitDepthSupported(int depth) {
|
||||
return _call(BITDEPTHSUPPORTED, (int)0, depth);
|
||||
}
|
||||
|
||||
inline void * svc_imageWriter::convert(const void *pixels, int bitDepth, int w, int h, int *length) {
|
||||
return _call(CONVERT, (void*)0, pixels, bitDepth, w, h, length);
|
||||
}
|
||||
|
||||
// derive from this one
|
||||
class NOVTABLE svc_imageWriterI : public svc_imageWriter {
|
||||
public:
|
||||
virtual const wchar_t * getExtensions()=0;
|
||||
virtual const wchar_t * getImageTypeName()=0;
|
||||
virtual int setConfig(const wchar_t * item, const wchar_t * value){return 0;}
|
||||
virtual int getConfig(const wchar_t * item, wchar_t * value, int valuelen){return 0;}
|
||||
virtual int bitDepthSupported(int depth)=0;
|
||||
virtual void * convert(const void *pixels, int bitDepth, int w, int h, int *length)=0;
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
/* do we still use svc_enum?
|
||||
#include <bfc/svc_enum.h>
|
||||
|
||||
class ImgWriterEnum : public SvcEnumT<svc_imageWriter> {
|
||||
public:
|
||||
ImgWriterEnum(const char *_ext=NULL) : ext(_ext) { }
|
||||
|
||||
protected:
|
||||
virtual int testService(svc_imageWriter *svc) {
|
||||
if (ext.isempty()) return 1;
|
||||
else {
|
||||
PathParser pp(svc->getExtensions(), ";");
|
||||
for (int i = 0; i < pp.getNumStrings(); i++)
|
||||
if (STRCASEEQL(ext, pp.enumString(i))) return 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
String ext;
|
||||
};
|
||||
*/
|
||||
#endif
|
20
Src/Wasabi/api/service/svcs/svc_itemmgr.cpp
Normal file
20
Src/Wasabi/api/service/svcs/svc_itemmgr.cpp
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "svc_itemmgr.h"
|
||||
|
||||
#define CBCLASS svc_itemMgrI
|
||||
START_DISPATCH;
|
||||
CB(ISMINE, isMine);
|
||||
CB(OPTIMIZEPLAYSTRING, optimizePlaystring);
|
||||
CB(CREATEINITIALNAME, createInitialName);
|
||||
CB(OPTIMIZEFILEDATA, optimizeFileData);
|
||||
CB(ONDATABASEADD, onDatabaseAdd);
|
||||
CB(ONDATABASEDEL, onDatabaseDel);
|
||||
CB(ONTITLECHANGE, onTitleChange);
|
||||
CB(ONTITLE2CHANGE, onTitle2Change);
|
||||
VCB(ONNEXTFILE, onNextFile);
|
||||
VCB(ONFILECOMPLETE, onFileComplete);
|
||||
CB(WANTSCANDATA, wantScanData);
|
||||
CB(GETSORTORDER, getSortOrder);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
112
Src/Wasabi/api/service/svcs/svc_itemmgr.h
Normal file
112
Src/Wasabi/api/service/svcs/svc_itemmgr.h
Normal file
|
@ -0,0 +1,112 @@
|
|||
#ifndef _SVC_ITEMMGR_H
|
||||
#define _SVC_ITEMMGR_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <api/service/services.h>
|
||||
|
||||
class NOVTABLE svc_itemMgr : public Dispatchable {
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::ITEMMANAGER; }
|
||||
|
||||
int isMine(const char *playstring) { return _call(ISMINE, 0, playstring); }
|
||||
|
||||
int optimizePlaystring(char *playstring) {
|
||||
return _call(OPTIMIZEPLAYSTRING, 0, playstring);
|
||||
}
|
||||
int createInitialName(const char *playstring, char *buf, int buflen) {
|
||||
return _call(CREATEINITIALNAME, 0, playstring, buf, buflen);
|
||||
}
|
||||
int optimizeFileData(const char *playstring, const char *fieldname, int datatype, char *data, int datalen) {
|
||||
return _call(OPTIMIZEFILEDATA, -1, playstring, fieldname, datatype, data, datalen);
|
||||
}
|
||||
|
||||
int onDatabaseAdd(const char *playstring) {
|
||||
return _call(ONDATABASEADD, 0, playstring);
|
||||
}
|
||||
int onDatabaseDel(const char *playstring) {
|
||||
return _call(ONDATABASEDEL, 0, playstring);
|
||||
}
|
||||
|
||||
//return 1 if changed
|
||||
int onTitleChange(const char *playstring, const char *newtitle) {
|
||||
return _call(ONTITLECHANGE, 0, playstring, newtitle);
|
||||
}
|
||||
int onTitle2Change(const char *playstring, const char *newtitle) {
|
||||
return _call(ONTITLE2CHANGE, 0, playstring, newtitle);
|
||||
}
|
||||
|
||||
void onNextFile(const char *playstring) {
|
||||
_voidcall(ONNEXTFILE, playstring);
|
||||
}
|
||||
|
||||
void onFileComplete(const char *playstring) {
|
||||
_voidcall(ONFILECOMPLETE, playstring);
|
||||
}
|
||||
|
||||
int wantScanData(const char *playstring) {
|
||||
return _call(WANTSCANDATA, 1, playstring);
|
||||
}
|
||||
|
||||
int getSortOrder() {
|
||||
return _call(GETSORTORDER, 0);
|
||||
}
|
||||
|
||||
enum {
|
||||
ISMINE=100,
|
||||
OPTIMIZEPLAYSTRING=200,
|
||||
OPTIMIZEFILEDATA=211, //210 retired
|
||||
CREATEINITIALNAME=300,
|
||||
ONDATABASEADD=400,
|
||||
ONDATABASEDEL=401,
|
||||
ONTITLECHANGE=600,
|
||||
ONTITLE2CHANGE=601,
|
||||
ONNEXTFILE=700,
|
||||
ONFILECOMPLETE=800,
|
||||
WANTSCANDATA=900,
|
||||
GETSORTORDER=1000,
|
||||
};
|
||||
};
|
||||
|
||||
// derive from this one
|
||||
class NOVTABLE svc_itemMgrI : public svc_itemMgr {
|
||||
public:
|
||||
virtual int isMine(const char *playstring)=0;
|
||||
virtual int optimizePlaystring(char *playstring) { return 0; }
|
||||
virtual int createInitialName(const char *playstring, char *buf, int buflen) { return 0; }
|
||||
virtual int optimizeFileData(const char *playstring, const char *fieldname, int datatype, char *data, int datalen) { return -1; }
|
||||
virtual int onDatabaseAdd(const char *playstring) { return 0; }
|
||||
virtual int onDatabaseDel(const char *playstring) { return 0; }
|
||||
virtual int onTitleChange(const char *playstring, const char *newtitle) { return 0; }
|
||||
virtual int onTitle2Change(const char *playstring, const char *newtitle) { return 0; }
|
||||
virtual void onNextFile(const char *playstring) { }
|
||||
virtual void onFileComplete(const char *playstring) { }
|
||||
|
||||
virtual int wantScanData(const char *playstring) { return 1; }
|
||||
|
||||
virtual int getSortOrder() { return 0; }
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
#include <bfc/named.h>
|
||||
#include <api/service/svc_enum.h>
|
||||
|
||||
class ItemMgrEnum : private Named, public SvcEnumT<svc_itemMgr> {
|
||||
public:
|
||||
ItemMgrEnum(const char *ps) : Named(ps) { }
|
||||
|
||||
void setPlaystring(const char *ps) { Named::setName(ps); }
|
||||
|
||||
protected:
|
||||
virtual int testService(svc_itemMgr *svc) {
|
||||
return svc->isMine(getName());
|
||||
}
|
||||
};
|
||||
|
||||
#include <api/service/servicei.h>
|
||||
|
||||
template <class T>
|
||||
class ItemMgrCreator : public waServiceFactoryTSingle<svc_itemMgr, T> { };
|
||||
|
||||
#endif
|
16
Src/Wasabi/api/service/svcs/svc_loadlib.h
Normal file
16
Src/Wasabi/api/service/svcs/svc_loadlib.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
#ifndef _LOADLIB_H
|
||||
#define _LOADLIB_H
|
||||
|
||||
//UNDER CONSTRUCTION
|
||||
|
||||
class NOVTABLE svc_loadLib
|
||||
{
|
||||
public:
|
||||
int isMine(const char *filename);
|
||||
|
||||
int load(const char *filename);
|
||||
void unload();
|
||||
void *getProcAddress(const char *name);
|
||||
};
|
||||
|
||||
#endif
|
23
Src/Wasabi/api/service/svcs/svc_mediaconverter.cpp
Normal file
23
Src/Wasabi/api/service/svcs/svc_mediaconverter.cpp
Normal file
|
@ -0,0 +1,23 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "svc_mediaconverter.h"
|
||||
|
||||
#define CBCLASS svc_mediaConverterNI
|
||||
START_DISPATCH;
|
||||
CB(CANCONVERTFROM,canConvertFrom)
|
||||
CB(GETCONVERTERTO,getConverterTo)
|
||||
CB(GETINFOS,getInfos)
|
||||
CB(SETINFOS,setInfos)
|
||||
CB(GETINFOSXMLGROUP,getInfosXmlGroup)
|
||||
CB(PROCESSDATA,processData)
|
||||
CB(GETPOSITION,getPosition)
|
||||
CB(GETLATENCY,getLatency)
|
||||
CB(GETCORECALLBACK,getCoreCallback)
|
||||
CB(SORTPLACEMENT,sortPlacement)
|
||||
CB(ISSELECTABLEOUTPUT,isSelectableOutput)
|
||||
CB(CANSUPPORTCONTENTTYPE,canSupportContentType)
|
||||
VCB(SETCORETOKEN,setCoreToken)
|
||||
CB(ONCOREUSERMSG,onCoreUserMsg)
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
161
Src/Wasabi/api/service/svcs/svc_mediaconverter.h
Normal file
161
Src/Wasabi/api/service/svcs/svc_mediaconverter.h
Normal file
|
@ -0,0 +1,161 @@
|
|||
#ifndef _SVC_MEDIACONVERTER_H
|
||||
#define _SVC_MEDIACONVERTER_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
|
||||
#include <api/core/chunklist.h>
|
||||
#include <api/core/mediainfo.h>
|
||||
#include <api/syscb/callbacks/corecbi.h>
|
||||
|
||||
#include <api/service/services.h>
|
||||
|
||||
// do NOT derive from these ones
|
||||
class NOVTABLE svc_mediaConverter : public Dispatchable {
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::MEDIACONVERTER; }
|
||||
|
||||
// test if the converter can handle that stream, filename or chunktype:
|
||||
// if your converter can accept streams depending on the data stream you should
|
||||
// test the file thru the reader interface (like to test if the file header is ok)
|
||||
// if your converter can accept files thru a test on the filename string, you should
|
||||
// test the name string (like tone://... or *.wav)
|
||||
// if your converter can accept depending on the chunktype, you should test the chunktype
|
||||
// (like MP3, PCM, etc...)
|
||||
// returns 1 if ok
|
||||
int canConvertFrom(svc_fileReader *reader, const char *name, const char *chunktype) { return _call(CANCONVERTFROM,0,reader,name,chunktype); }
|
||||
|
||||
// returns the chunk type that the converter will convert to
|
||||
// (PCM, MP3, etc...)
|
||||
const char *getConverterTo() { return _call(GETCONVERTERTO,""); }
|
||||
|
||||
// override this one if your converter can decode depending on a "Content-Type:" HTTP header
|
||||
int canSupportContentType(const char *contenttype) { return _call(CANSUPPORTCONTENTTYPE,0,contenttype); }
|
||||
|
||||
// fills up the infos class
|
||||
int getInfos(MediaInfo *infos) { return _call(GETINFOS,0,infos); }
|
||||
|
||||
// writes back the infos on the file.
|
||||
// note: the reader you get in the infos class has the filename opened in read/write mode
|
||||
// return 1 if update succeeded, 0 if error
|
||||
int setInfos(MediaInfo *infos) { return _call(SETINFOS,0,infos); }
|
||||
|
||||
// returns the id of the xml group the media info editor will use for displaying/editing infos
|
||||
const char *getInfosXmlGroup() { return _call(GETINFOSXMLGROUP,(const char *)NULL); }
|
||||
|
||||
// process current file data
|
||||
// returns 1 if ok, 0 when file/stream has ended
|
||||
int processData(MediaInfo *infos, ChunkList *chunk_list, bool *killswitch) { return _call(PROCESSDATA,0,infos,chunk_list,killswitch); }
|
||||
|
||||
// returns the current position in ms
|
||||
// usually the position is automatically calculated with the amount of PCM data converters send back to the core
|
||||
// so you don't have to override this function. however, if you want to force the position, return a value other than -1
|
||||
int getPosition(void) { return _call(GETPOSITION,-1); }
|
||||
|
||||
// returns the latency of the converter in ms
|
||||
int getLatency(void) { return _call(GETLATENCY,0); }
|
||||
|
||||
// sort function to be able to specify where you want your converter placed in the converter list
|
||||
// (like if you want to be before or after the crossfader for example, override this function)
|
||||
// return -1 to be placed before "otherconverter", 1 to be placed after "otherconverter", otherwise 0
|
||||
int sortPlacement(const char *otherconverter) { return _call(SORTPLACEMENT,0,otherconverter); }
|
||||
|
||||
// return 1 if you want this converter to be selectable as output in prefs->audio
|
||||
int isSelectableOutput(void) { return _call(ISSELECTABLEOUTPUT,0); }
|
||||
|
||||
// message received by sendConvertersMsg() in the core
|
||||
int onCoreUserMsg(const char *msg, const char *value) { return _call(ONCOREUSERMSG,0,msg,value); }
|
||||
|
||||
|
||||
// internally used by wasabi
|
||||
CoreCallback *getCoreCallback(void) { return _call(GETCORECALLBACK,(CoreCallback *)0); }
|
||||
void setCoreToken(CoreToken t) { _voidcall(SETCORETOKEN,t); }
|
||||
|
||||
enum {
|
||||
CANCONVERTFROM=10,
|
||||
GETCONVERTERTO=20,
|
||||
GETINFOS=30,
|
||||
PROCESSDATA=40,
|
||||
GETPOSITION=50,
|
||||
GETLATENCY=60,
|
||||
GETCORECALLBACK=70,
|
||||
SORTPLACEMENT=80,
|
||||
CANSUPPORTCONTENTTYPE=90,
|
||||
SETCORETOKEN=100,
|
||||
SETINFOS=110,
|
||||
GETINFOSXMLGROUP=120,
|
||||
ISSELECTABLEOUTPUT=130,
|
||||
ONCOREUSERMSG=140,
|
||||
};
|
||||
};
|
||||
|
||||
class NOVTABLE svc_mediaConverterNI : public svc_mediaConverter {
|
||||
public:
|
||||
virtual int canConvertFrom(svc_fileReader *reader, const char *name, const char *chunktype)=0;
|
||||
virtual const char *getConverterTo()=0;
|
||||
virtual int canSupportContentType(const char *contenttype) { return 0; }
|
||||
|
||||
virtual int getInfos(MediaInfo *infos)=0;
|
||||
|
||||
virtual int setInfos(MediaInfo *infos)=0;
|
||||
|
||||
virtual const char *getInfosXmlGroup()=0;
|
||||
|
||||
virtual int processData(MediaInfo *infos, ChunkList *chunk_list, bool *killswitch)=0;
|
||||
|
||||
virtual int getPosition(void) { return -1; }
|
||||
|
||||
virtual int getLatency(void) { return 0; }
|
||||
|
||||
virtual int sortPlacement(const char *otherconverter) { return 0; }
|
||||
|
||||
virtual int isSelectableOutput(void) { return 0; }
|
||||
|
||||
virtual int onCoreUserMsg(const char *msg, const char *value) { return 0; }
|
||||
|
||||
virtual CoreCallback *getCoreCallback(void)=0;
|
||||
|
||||
virtual void setCoreToken(CoreToken t)=0;
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
// derive from this one
|
||||
class NOVTABLE svc_mediaConverterI : public svc_mediaConverterNI, public CoreCallbackI {
|
||||
public:
|
||||
svc_mediaConverterI() : m_coretoken(0) { }
|
||||
|
||||
virtual int canConvertFrom(svc_fileReader *reader, const char *name, const char *chunktype)=0;
|
||||
virtual const char *getConverterTo()=0;
|
||||
virtual int canSupportContentType(const char *contenttype) { return 0; }
|
||||
|
||||
virtual int getInfos(MediaInfo *infos)=0;
|
||||
|
||||
virtual int setInfos(MediaInfo *infos) { return 0; }
|
||||
|
||||
virtual const char *getInfosXmlGroup() { return (const char *)NULL; }
|
||||
|
||||
virtual int processData(MediaInfo *infos, ChunkList *chunk_list, bool *killswitch)=0;
|
||||
|
||||
virtual int getPosition(void) { return -1; }
|
||||
|
||||
virtual int getLatency(void) { return 0; }
|
||||
|
||||
virtual int sortPlacement(const char *otherconverter) { return 0; }
|
||||
|
||||
virtual int isSelectableOutput(void) { return 0; }
|
||||
|
||||
virtual int onCoreUserMsg(const char *msg, const char *value) { return 0; }
|
||||
|
||||
virtual CoreCallback *getCoreCallback(void) { return this; }
|
||||
|
||||
virtual void setCoreToken(CoreToken t) { m_coretoken=t; }
|
||||
|
||||
protected:
|
||||
CoreToken m_coretoken;
|
||||
};
|
||||
|
||||
#include <api/service/servicei.h>
|
||||
template <class T>
|
||||
class MediaConverterCreator : public waServiceFactoryT<svc_mediaConverter, T> { };
|
||||
|
||||
#endif
|
45
Src/Wasabi/api/service/svcs/svc_mediacore.cpp
Normal file
45
Src/Wasabi/api/service/svcs/svc_mediacore.cpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "svc_mediacore.h"
|
||||
|
||||
#define CBCLASS svc_mediaCoreI
|
||||
START_DISPATCH;
|
||||
VCB(SETCALLBACK,setCallback);
|
||||
VCB(SETNEXTFILE,setNextFile);
|
||||
VCB(START,start);
|
||||
VCB(PAUSE,pause);
|
||||
VCB(SETPOSITION,setPosition);
|
||||
VCB(SETVOLUME,setVolume);
|
||||
VCB(SETPAN,setPan);
|
||||
VCB(ABORTCURRENTSONG,abortCurrentSong);
|
||||
VCB(STOP,stop);
|
||||
CB(GETPLAYING,getPlaying);
|
||||
CB(GETPOSITION,getPosition);
|
||||
CB(GETWRITEPOSITION,getWritePosition);
|
||||
CB(GETTITLE,getTitle);
|
||||
VCB(GETINFO,getInfo);
|
||||
CB(GETLENGTH,getLength);
|
||||
CB(GETVOLUME,getVolume);
|
||||
CB(GETPAN,getPan);
|
||||
VCB(SETEQSTATUS,setEQStatus);
|
||||
CB(GETEQSTATUS,getEQStatus);
|
||||
VCB(SETEQPREAMP,setEQPreamp);
|
||||
CB(GETEQPREAMP,getEQPreamp);
|
||||
VCB(SETEQBAND,setEQBand);
|
||||
CB(GETEQBAND,getEQBand);
|
||||
VCB(SETEQBANDS,setEQBands);
|
||||
VCB(GETEQBANDS,getEQBands);
|
||||
VCB(SETEQ,setEQ);
|
||||
VCB(GETEQ,getEQ);
|
||||
CB(GETMETADATA,getMetaData);
|
||||
CB(GETVISDATA,getVisData);
|
||||
VCB(MUTE,mute);
|
||||
CB(ISMUTED,isMuted);
|
||||
VCB(SETCORETOKEN,setCoreToken);
|
||||
VCB(SETPRIORITY,setPriority);
|
||||
CB(GETPRIORITY,getPriority);
|
||||
VCB(REBUILDCONVERTERSCHAIN, rebuildConvertersChain)
|
||||
CB(SENDCONVERTERSMSG, sendConvertersMsg)
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
172
Src/Wasabi/api/service/svcs/svc_mediacore.h
Normal file
172
Src/Wasabi/api/service/svcs/svc_mediacore.h
Normal file
|
@ -0,0 +1,172 @@
|
|||
#ifndef _SVC_MEDIACORE_H
|
||||
#define _SVC_MEDIACORE_H
|
||||
|
||||
#include <api/service/services.h>
|
||||
#include <bfc/dispatch.h>
|
||||
#include <api/syscb/callbacks/corecbi.h>
|
||||
|
||||
class NOVTABLE svc_mediaCore : public Dispatchable {
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::MEDIACORE; }
|
||||
|
||||
void setCallback(CoreCallback *callback) { _voidcall(SETCALLBACK,callback); }
|
||||
void setCoreToken(CoreToken t) { _voidcall(SETCORETOKEN,t); }
|
||||
|
||||
void setNextFile(const char *file, const char *to=NULL, int uniqueid=0) { _voidcall(SETNEXTFILE,file,to,uniqueid); }
|
||||
|
||||
void start(void) { _voidcall(START); }
|
||||
void pause(int pause) { _voidcall(PAUSE,pause); }
|
||||
void setPosition(int ms) { _voidcall(SETPOSITION,ms); }
|
||||
|
||||
void setVolume(int volume) { _voidcall(SETVOLUME,volume); }
|
||||
void setPan(int pan) { _voidcall(SETPAN,pan); }
|
||||
|
||||
void abortCurrentSong() { _voidcall(ABORTCURRENTSONG); }
|
||||
void stop(int suppress_callback=FALSE) { _voidcall(STOP,suppress_callback); }
|
||||
|
||||
int getPlaying(void) { return _call(GETPLAYING,0); }
|
||||
int getPosition(void) { return _call(GETPOSITION,0); }
|
||||
int getWritePosition(void) { return _call(GETWRITEPOSITION,0); }
|
||||
|
||||
int getTitle(char *title, int maxlen) { return _call(GETTITLE,0,title,maxlen); }
|
||||
void getInfo(char *info, int maxlen) { _voidcall(GETINFO,info,maxlen); }
|
||||
int getLength(void) { return _call(GETLENGTH,0); }
|
||||
|
||||
int getVolume(void) { return _call(GETVOLUME,0); }
|
||||
int getPan(void) { return _call(GETPAN,0); }
|
||||
|
||||
void mute(int mute) { _voidcall(MUTE,mute); }
|
||||
int isMuted() { return _call(ISMUTED,0); }
|
||||
|
||||
void setEQStatus(int enable) { _voidcall(SETEQSTATUS,enable); }
|
||||
int getEQStatus() { return _call(GETEQSTATUS,0); }
|
||||
void setEQPreamp(char pre) { _voidcall(SETEQPREAMP,pre); }
|
||||
char getEQPreamp() { return _call(GETEQPREAMP,0); }
|
||||
void setEQBand(int band, char val) { _voidcall(SETEQBAND,band,val); }
|
||||
char getEQBand(int band) { return _call(GETEQBAND,0,band); }
|
||||
void setEQBands(char tab[10]) { _voidcall(SETEQBANDS,tab); }
|
||||
void getEQBands(char *tab) { _voidcall(GETEQBANDS,tab); }
|
||||
|
||||
void setEQ(int enable, char pre, char tab[10]) { _voidcall(SETEQ,enable,pre,tab); }
|
||||
void getEQ(int *enable, char *pre, char *tab) { _voidcall(GETEQ,enable,pre,tab); }
|
||||
|
||||
int getMetaData(const char *name, char *data, int data_len) { return _call(GETMETADATA,0,name,data,data_len); }
|
||||
|
||||
int getVisData(void *dataptr, int sizedataptr) { return _call(GETVISDATA,0,dataptr,sizedataptr); }
|
||||
|
||||
void setPriority(int priority) { _voidcall(SETPRIORITY,priority); }
|
||||
int getPriority() { return _call(GETPRIORITY,0); }
|
||||
|
||||
void rebuildConvertersChain() { _voidcall(REBUILDCONVERTERSCHAIN); }
|
||||
|
||||
int sendConvertersMsg(const char *msg, const char *value) { return _call(SENDCONVERTERSMSG,0,msg,value); }
|
||||
|
||||
enum {
|
||||
SETCALLBACK=10,
|
||||
SETNEXTFILE=20,
|
||||
START=30,
|
||||
PAUSE=40,
|
||||
SETPOSITION=50,
|
||||
SETVOLUME=60,
|
||||
SETPAN=70,
|
||||
ABORTCURRENTSONG=80,
|
||||
STOP=90,
|
||||
GETPLAYING=100,
|
||||
GETPOSITION=110,
|
||||
GETWRITEPOSITION=120,
|
||||
GETTITLE=130,
|
||||
GETINFO=140,
|
||||
GETLENGTH=150,
|
||||
GETVOLUME=160,
|
||||
GETPAN=170,
|
||||
SETEQSTATUS=180,
|
||||
GETEQSTATUS=190,
|
||||
SETEQPREAMP=200,
|
||||
GETEQPREAMP=210,
|
||||
SETEQBAND=220,
|
||||
GETEQBAND=230,
|
||||
SETEQBANDS=240,
|
||||
GETEQBANDS=250,
|
||||
SETEQ=260,
|
||||
GETEQ=270,
|
||||
GETMETADATA=280,
|
||||
GETVISDATA=290,
|
||||
MUTE=300,
|
||||
ISMUTED=310,
|
||||
SETCORETOKEN=320,
|
||||
SETPRIORITY=330,
|
||||
GETPRIORITY=340,
|
||||
REBUILDCONVERTERSCHAIN=350,
|
||||
SENDCONVERTERSMSG=360,
|
||||
};
|
||||
};
|
||||
|
||||
// derive from this one
|
||||
class NOVTABLE svc_mediaCoreI : public svc_mediaCore {
|
||||
public:
|
||||
svc_mediaCoreI() : m_coretoken(0) { }
|
||||
|
||||
virtual void setCallback(CoreCallback *callback)=0;
|
||||
virtual void setCoreToken(CoreToken t) { m_coretoken=t; }
|
||||
|
||||
virtual void setNextFile(const char *file, const char *to=NULL, int uniqueid=0)=0;
|
||||
/* call to specify next file from WCM_NEEDNEXTFILE, or before calling start() */
|
||||
|
||||
virtual void start(void)=0; /* start playback */
|
||||
virtual void pause(int pause)=0; /* set/unset paused state (nonzero is paused, zero is unpaused) */
|
||||
virtual void setPosition(int ms)=0; /* set position of current stream in ms */
|
||||
|
||||
virtual void setVolume(int volume)=0; /* volume is 0 to 255 */
|
||||
virtual void setPan(int pan)=0; /* pan is -127 to 127 */
|
||||
virtual void abortCurrentSong()=0; /* abort decoding of current song and start playing the next one */
|
||||
virtual void stop(int suppress_callback=FALSE)=0;
|
||||
|
||||
virtual int getPlaying(void)=0; /* 0 is not playing, 1 is playing, -1 is paused */
|
||||
virtual int getPosition(void)=0; /* get position of current stream in ms */
|
||||
virtual int getWritePosition(void)=0; /* get written position of current stream in ms */
|
||||
|
||||
virtual int getTitle(char *title, int maxlen)=0; // returns uniqueid
|
||||
virtual void getInfo(char *info, int maxlen)=0;
|
||||
virtual int getLength(void)=0; /* get length of track in ms. -1 indicates infinite/unknown */
|
||||
|
||||
virtual int getVolume(void)=0; /* get volume (0-255) */
|
||||
virtual int getPan(void)=0; /* get panning (-127 to 127) */
|
||||
|
||||
virtual void mute(int mute)=0;
|
||||
virtual int isMuted()=0;
|
||||
|
||||
virtual void setEQStatus(int enable)=0; /* 0 if off, 1 if on */
|
||||
virtual int getEQStatus()=0; /* 0 if off, 1 if on */
|
||||
virtual void setEQPreamp(char pre)=0; /* -127 to 127 (-20db to +20db) */
|
||||
virtual char getEQPreamp()=0; /* -127 to 127 (-20db to +20db) */
|
||||
virtual void setEQBand(int band, char val)=0; /* band=0-9 */
|
||||
virtual char getEQBand(int band)=0; /* band=0-9 */
|
||||
virtual void setEQBands(char tab[10])=0; /* eq values are -127 to 127 (-20db to +20db) */
|
||||
virtual void getEQBands(char *tab)=0; /* eq values are -127 to 127 (-20db to +20db) */
|
||||
|
||||
virtual void setEQ(int enable, char pre, char tab[10])=0;
|
||||
virtual void getEQ(int *enable, char *pre, char *tab)=0;
|
||||
|
||||
virtual int getMetaData(const char *name, char *data, int data_len)=0; // returns size of data
|
||||
|
||||
virtual int getVisData(void *dataptr, int sizedataptr)=0; // returns size of data it wanted to copy, if any.
|
||||
|
||||
virtual void setPriority(int priority)=0;
|
||||
virtual int getPriority()=0;
|
||||
|
||||
virtual void rebuildConvertersChain()=0;
|
||||
|
||||
virtual int sendConvertersMsg(const char *msg, const char *value)=0;
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
|
||||
CoreToken m_coretoken;
|
||||
};
|
||||
|
||||
#include <api/service/servicei.h>
|
||||
|
||||
template <class T>
|
||||
class MediaCoreCreator : public waServiceFactoryT<svc_mediaCore, T> { };
|
||||
|
||||
#endif
|
14
Src/Wasabi/api/service/svcs/svc_metadata.cpp
Normal file
14
Src/Wasabi/api/service/svcs/svc_metadata.cpp
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "svc_metadata.h"
|
||||
|
||||
#define CBCLASS svc_metaDataI
|
||||
START_DISPATCH;
|
||||
CB(ENUMMETADATA, enumMetaData);
|
||||
CB(HASMETADATA, hasMetaData);
|
||||
CB(ALLOWOPERATION, allowOperation);
|
||||
CB(GETGUID, getGUID);
|
||||
CB(GETMETANAME, getMetaTableName);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
97
Src/Wasabi/api/service/svcs/svc_metadata.h
Normal file
97
Src/Wasabi/api/service/svcs/svc_metadata.h
Normal file
|
@ -0,0 +1,97 @@
|
|||
#ifndef _SVC_METADATA_H
|
||||
#define _SVC_METADATA_H
|
||||
|
||||
// see helper class in common/metadatasvc.h to implement this
|
||||
|
||||
#include <api/service/services.h>
|
||||
#include <bfc/dispatch.h>
|
||||
#include <bfc/string/string.h>
|
||||
#include <api/db/metatags.h>
|
||||
|
||||
class NOVTABLE svc_metaData : public Dispatchable {
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::METADATA; }
|
||||
|
||||
int enumMetaData(int n, char *mdName, int mdNameMaxLength, int *mdType, BOOL *mdIndexed, BOOL *mdMaintainUniques);
|
||||
int hasMetaData(const char *name, int type);
|
||||
int allowOperation(GUID whom, const char *playstring, int op, char *field, void *data, int data_len);
|
||||
GUID getGUID();
|
||||
const char *getMetaTableName();
|
||||
|
||||
enum {
|
||||
HASMETADATA=10,
|
||||
ENUMMETADATA=20,
|
||||
ALLOWOPERATION=30,
|
||||
GETGUID=40,
|
||||
GETMETANAME=50,
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
inline int svc_metaData::hasMetaData(const char *name, int type) {
|
||||
return _call(HASMETADATA, 0, name, type);
|
||||
}
|
||||
|
||||
inline int svc_metaData::enumMetaData(int n, char *mdName, int mdNameMaxLength, int *mdType, BOOL *mdIndexed, BOOL *mdMaintainUniques) {
|
||||
return _call(ENUMMETADATA, 0, n, mdName, mdNameMaxLength, mdType, mdIndexed, mdMaintainUniques);
|
||||
}
|
||||
|
||||
inline int svc_metaData::allowOperation(GUID whom, const char *playstring, int op, char *field, void *data, int data_len) {
|
||||
return _call(ALLOWOPERATION, 0, whom, playstring, op, field, data, data_len);
|
||||
}
|
||||
|
||||
inline GUID svc_metaData::getGUID() {
|
||||
return _call(GETGUID, INVALID_GUID);
|
||||
}
|
||||
|
||||
inline const char *svc_metaData::getMetaTableName() {
|
||||
return _call(GETMETANAME, (const char *)NULL);
|
||||
}
|
||||
|
||||
// see helper class in common/metadatasvc.h to implement this
|
||||
class NOVTABLE svc_metaDataI : public svc_metaData {
|
||||
public:
|
||||
virtual int enumMetaData(int n, char *mdName, int mdNameMaxLength, int *mdType, BOOL *mdIndexed, BOOL *mdMaintainUniques)=0;
|
||||
virtual int hasMetaData(const char *name, int type)=0;
|
||||
virtual int allowOperation(GUID whom, const char *playstring, int op, char *field, void *data, int data_len)=0;
|
||||
virtual GUID getGUID()=0;
|
||||
virtual const char *getMetaTableName()=0;
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
#include <api/service/servicei.h>
|
||||
|
||||
// if you want to use class MetaDataSvc (instead of deriving from
|
||||
// svc_metaDataI yourself) use class MetaDataSvcFactory in common/metadatasvc.h
|
||||
template <class T>
|
||||
class MetaDataSvcCreator : public waServiceFactoryTSingle<svc_metaData, T> {};
|
||||
|
||||
#include <api/service/svc_enum.h>
|
||||
|
||||
class MetaDataSvcEnum : public SvcEnumT<svc_metaData> {
|
||||
public:
|
||||
MetaDataSvcEnum(const char *metadata=NULL, int mdtype=MDT_NONE) : md(metadata), type(mdtype) {}
|
||||
protected:
|
||||
virtual int testService(svc_metaData *svc) {
|
||||
if (md.isempty() || type == MDT_NONE) return TRUE;
|
||||
return svc->hasMetaData(md, type);
|
||||
}
|
||||
private:
|
||||
String md;
|
||||
int type;
|
||||
};
|
||||
|
||||
class MetaDataSvcEnumGuid : public SvcEnumT<svc_metaData> {
|
||||
public:
|
||||
MetaDataSvcEnumGuid(GUID g) : guid(g) {}
|
||||
protected:
|
||||
virtual int testService(svc_metaData *svc) {
|
||||
return (svc->getGUID() == guid);
|
||||
}
|
||||
private:
|
||||
GUID guid;
|
||||
};
|
||||
|
||||
#endif
|
12
Src/Wasabi/api/service/svcs/svc_minibrowser.cpp
Normal file
12
Src/Wasabi/api/service/svcs/svc_minibrowser.cpp
Normal file
|
@ -0,0 +1,12 @@
|
|||
#include <precomp.h>
|
||||
#include "svc_minibrowser.h"
|
||||
|
||||
#define CBCLASS svc_miniBrowserI
|
||||
START_DISPATCH;
|
||||
CB(TESTGUID, testGuid);
|
||||
CB(CREATEMINIBROWSER, createMiniBrowser);
|
||||
VCB(DESTROYMINIBROWSER, destroyMiniBrowser);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
||||
|
69
Src/Wasabi/api/service/svcs/svc_minibrowser.h
Normal file
69
Src/Wasabi/api/service/svcs/svc_minibrowser.h
Normal file
|
@ -0,0 +1,69 @@
|
|||
#ifndef _SVC_MINIBROWSER_H
|
||||
#define _SVC_MINIBROWSER_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <api/service/services.h>
|
||||
|
||||
class MiniBrowser;
|
||||
|
||||
#include <bfc/nsguid.h>
|
||||
|
||||
// {2E41D2E8-19A5-4029-9339-8FDF7481000A}
|
||||
static const GUID GUID_MINIBROWSER_ANY =
|
||||
{ 0x00000000, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
|
||||
|
||||
// {C0A3D1AC-2430-45a7-B51B-AB04B74DD9EA}
|
||||
static const GUID GUID_MINIBROWSER_IEACTIVEX =
|
||||
{ 0xc0a3d1ac, 0x2430, 0x45a7, { 0xb5, 0x1b, 0xab, 0x4, 0xb7, 0x4d, 0xd9, 0xea } };
|
||||
|
||||
class NOVTABLE svc_miniBrowser : public Dispatchable {
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::MINIBROWSER; }
|
||||
|
||||
int testGuid(GUID g);
|
||||
MiniBrowser *createMiniBrowser();
|
||||
void destroyMiniBrowser(MiniBrowser *b);
|
||||
|
||||
enum {
|
||||
TESTGUID =10,
|
||||
CREATEMINIBROWSER =20,
|
||||
DESTROYMINIBROWSER =30,
|
||||
};
|
||||
};
|
||||
|
||||
inline int svc_miniBrowser::testGuid(GUID g) {
|
||||
return _call(TESTGUID, 0, g);
|
||||
}
|
||||
|
||||
inline MiniBrowser *svc_miniBrowser::createMiniBrowser() {
|
||||
return _call(CREATEMINIBROWSER, (MiniBrowser *)0);
|
||||
}
|
||||
|
||||
inline void svc_miniBrowser::destroyMiniBrowser(MiniBrowser *b) {
|
||||
_voidcall(DESTROYMINIBROWSER, b);
|
||||
}
|
||||
|
||||
class NOVTABLE svc_miniBrowserI : public svc_miniBrowser {
|
||||
public:
|
||||
virtual int testGuid(GUID g)=0;
|
||||
virtual MiniBrowser *createMiniBrowser()=0;
|
||||
virtual void destroyMiniBrowser(MiniBrowser *b)=0;
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
#include <api/service/svc_enum.h>
|
||||
|
||||
class MiniBrowserSvcEnum : public SvcEnumT<svc_miniBrowser> {
|
||||
public:
|
||||
MiniBrowserSvcEnum(GUID g) : guid(g) {}
|
||||
protected:
|
||||
virtual int testService(svc_miniBrowser *svc) {
|
||||
return (svc->testGuid(guid));
|
||||
}
|
||||
private:
|
||||
GUID guid;
|
||||
};
|
||||
|
||||
#endif
|
32
Src/Wasabi/api/service/svcs/svc_objectdir.cpp
Normal file
32
Src/Wasabi/api/service/svcs/svc_objectdir.cpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "svc_objectdir.h"
|
||||
#include <api/api.h>
|
||||
|
||||
#define CBCLASS svc_objectDirI
|
||||
START_DISPATCH;
|
||||
CB(GETDEPENDENCYPTR, getDependencyPtr);
|
||||
CB(GETDIRTYPE, getDirType);
|
||||
CB(GETNUMOBJECTS, getNumObjects);
|
||||
CB(ENUMOBJECT, enumObject);
|
||||
CB(GETOBJECT, getObject);
|
||||
CB(GETOBJECTLABEL, getObjectLabel);
|
||||
CB(SETOBJECTLABEL, setObjectLabel);
|
||||
CB(INSERTOBJECT, insertObject);
|
||||
CB(REMOVEOBJECT, removeObject);
|
||||
VCB(CLEARALL, clearAll);
|
||||
CB(ONACTION, onAction);
|
||||
VCB(ONPRERENDER, onPrerender);
|
||||
VCB(ONPOSTRENDER, onPostrender);
|
||||
CB(GETOBJECTPATH, getObjectPath);
|
||||
CB(GETOBJECTDISPLAYGROUP, getObjectDisplayGroup);
|
||||
CB(GETOBJECTICON, getObjectIcon);
|
||||
CB(GETOBJECTSELECTABLE, getObjectSelectable);
|
||||
CB(GETOBJECTSORTORDER, getObjectSortOrder);
|
||||
CB(TAGOBJECT, tagObject);
|
||||
CB(UNTAGOBJECT, untagObject);
|
||||
CB(ENUMOBJECTBYTAG, enumObjectByTag);
|
||||
CB(ISTAGGED, isTagged);
|
||||
CB(CONTEXTMENU, contextMenu);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
294
Src/Wasabi/api/service/svcs/svc_objectdir.h
Normal file
294
Src/Wasabi/api/service/svcs/svc_objectdir.h
Normal file
|
@ -0,0 +1,294 @@
|
|||
#ifndef _SVC_OBJECTDIR_H
|
||||
#define _SVC_OBJECTDIR_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <bfc/string/StringW.h>
|
||||
#include <api/service/services.h>
|
||||
#include <api/syscb/callbacks/runlevelcb.h>
|
||||
|
||||
// there is class ObjectDir in bfc/wnds, you should derive from it
|
||||
// also class ContextCmdObjDir
|
||||
|
||||
typedef size_t ObjectHandle;
|
||||
#define INVALID_OBJECT_HANDLE ((ObjectHandle)0)
|
||||
|
||||
#define DD_OBJECTDIR L"service:svc_objectDir"
|
||||
|
||||
class ifc_window;
|
||||
class ifc_dependent;
|
||||
class BaseCanvas;
|
||||
|
||||
class svc_objectDir : public Dispatchable
|
||||
{
|
||||
public:
|
||||
static int getServiceType() { return WaSvc::OBJECTDIR; }
|
||||
static const wchar_t *dragitem_getDatatype() { return DD_OBJECTDIR; }
|
||||
static const GUID *depend_getClassGuid() {
|
||||
// {2364D110-0F12-40d4-BBAE-D2DA174751B5}
|
||||
static const GUID ret =
|
||||
{ 0x2364d110, 0xf12, 0x40d4, { 0xbb, 0xae, 0xd2, 0xda, 0x17, 0x47, 0x51, 0xb5 } };
|
||||
return &ret;
|
||||
}
|
||||
|
||||
api_dependent *getDependencyPtr();
|
||||
|
||||
const wchar_t *getDirType();
|
||||
|
||||
int getNumObjects();
|
||||
ObjectHandle enumObject(int n);
|
||||
|
||||
void *getObject(ObjectHandle handle);
|
||||
|
||||
const wchar_t *getObjectLabel(ObjectHandle handle);
|
||||
int setObjectLabel(ObjectHandle handle, const wchar_t *newlabel);
|
||||
|
||||
ObjectHandle insertObject(const wchar_t *parameter=NULL, const wchar_t *label=NULL, const wchar_t *path=NULL);
|
||||
int removeObject(ObjectHandle handle);
|
||||
|
||||
void clearAll();
|
||||
|
||||
const wchar_t *getObjectPath(ObjectHandle handle);
|
||||
const wchar_t *getObjectDisplayGroup(ObjectHandle handle);
|
||||
const wchar_t *getObjectIcon(ObjectHandle handle);
|
||||
int getObjectSelectable(ObjectHandle handle);
|
||||
int getObjectSortOrder(ObjectHandle handle); // -32767..32767
|
||||
|
||||
// tagging
|
||||
int tagObject(const wchar_t *tag, ObjectHandle handle, int exclusive=FALSE);
|
||||
int untagObject(const wchar_t *tag, ObjectHandle handle);
|
||||
ObjectHandle enumObjectByTag(const wchar_t *tag, int n);
|
||||
int isTagged(const wchar_t *tag, ObjectHandle handle);
|
||||
|
||||
int onAction(int action, ifc_window *from, const wchar_t *target, ObjectHandle handle);
|
||||
enum {
|
||||
ODACTION_SELECTED=100,
|
||||
ODACTION_DESELECTED=200,
|
||||
ODACTION_CONTEXTMENU=300,
|
||||
};
|
||||
|
||||
int contextMenu(ifc_window *from, int x, int y, ObjectHandle handle);
|
||||
|
||||
void onPrerender(ObjectHandle handle, const RECT *r, BaseCanvas *c, int style);
|
||||
void onPostrender(ObjectHandle handle, const RECT *r, BaseCanvas *c, int style);
|
||||
// render styles
|
||||
enum {
|
||||
RENDERSTYLE_TREEWND=10,
|
||||
};
|
||||
|
||||
// dependency events, param is handle of object in question
|
||||
enum {
|
||||
Event_OBJECT_ADDED=100,
|
||||
Event_OBJECT_REMOVED=110,
|
||||
Event_OBJECT_LABELCHANGE=200,
|
||||
Event_OBJECT_ICONCHANGE=300,
|
||||
Event_OBJECT_PATHCHANGE=400,
|
||||
Event_OBJECT_SELECTABLECHANGE=500,
|
||||
Event_OBJECT_SORTORDERCHANGE=600,
|
||||
Event_OBJECT_TAGCHANGE=700,
|
||||
};
|
||||
|
||||
// dispatchable codes
|
||||
enum {
|
||||
GETDEPENDENCYPTR=100,
|
||||
GETNUMOBJECTS=200,
|
||||
ENUMOBJECT=300,
|
||||
GETOBJECT=400,
|
||||
GETOBJECTLABEL=500,
|
||||
SETOBJECTLABEL=510,
|
||||
INSERTOBJECT=600,
|
||||
REMOVEOBJECT=610,
|
||||
CLEARALL=700,
|
||||
GETDIRTYPE=800,
|
||||
ONACTION=900,
|
||||
ONPRERENDER=1000,
|
||||
ONPOSTRENDER=1010,
|
||||
GETOBJECTPATH=1100,
|
||||
GETOBJECTDISPLAYGROUP=1200,
|
||||
GETOBJECTICON=1300,
|
||||
GETOBJECTSELECTABLE=1400,
|
||||
GETOBJECTSORTORDER=1500,
|
||||
TAGOBJECT=1600,
|
||||
UNTAGOBJECT=1700,
|
||||
ENUMOBJECTBYTAG=1800,
|
||||
ISTAGGED=1900,
|
||||
CONTEXTMENU=3000,
|
||||
};
|
||||
};
|
||||
|
||||
inline
|
||||
api_dependent *svc_objectDir::getDependencyPtr() {
|
||||
return _call(GETDEPENDENCYPTR, (api_dependent*)NULL);
|
||||
}
|
||||
|
||||
inline
|
||||
const wchar_t *svc_objectDir::getDirType() {
|
||||
return _call(GETDIRTYPE, (const wchar_t *)NULL);
|
||||
}
|
||||
|
||||
inline
|
||||
int svc_objectDir::getNumObjects() {
|
||||
return _call(GETNUMOBJECTS, 0);
|
||||
}
|
||||
|
||||
inline
|
||||
ObjectHandle svc_objectDir::enumObject(int n) {
|
||||
return _call(ENUMOBJECT, INVALID_OBJECT_HANDLE, n);
|
||||
}
|
||||
|
||||
inline
|
||||
void *svc_objectDir::getObject(ObjectHandle handle) {
|
||||
return _call(GETOBJECT, (void*)NULL, handle);
|
||||
}
|
||||
|
||||
inline
|
||||
const wchar_t *svc_objectDir::getObjectLabel(ObjectHandle handle) {
|
||||
return _call(GETOBJECTLABEL, (const wchar_t *)NULL, handle);
|
||||
}
|
||||
|
||||
inline
|
||||
int svc_objectDir::setObjectLabel(ObjectHandle handle, const wchar_t *newlabel) {
|
||||
return _call(SETOBJECTLABEL, 0, handle, newlabel);
|
||||
}
|
||||
|
||||
inline
|
||||
ObjectHandle svc_objectDir::insertObject(const wchar_t *parameter, const wchar_t *label, const wchar_t *path) {
|
||||
return _call(INSERTOBJECT, INVALID_OBJECT_HANDLE, parameter, label, path);
|
||||
}
|
||||
|
||||
inline
|
||||
int svc_objectDir::removeObject(ObjectHandle handle) {
|
||||
return _call(REMOVEOBJECT, 0, handle);
|
||||
}
|
||||
|
||||
inline
|
||||
void svc_objectDir::clearAll() {
|
||||
_voidcall(CLEARALL);
|
||||
}
|
||||
|
||||
inline
|
||||
const wchar_t *svc_objectDir::getObjectPath(ObjectHandle handle) {
|
||||
return _call(GETOBJECTPATH, (const wchar_t *)NULL, handle);
|
||||
}
|
||||
|
||||
inline
|
||||
const wchar_t *svc_objectDir::getObjectDisplayGroup(ObjectHandle handle) {
|
||||
return _call(GETOBJECTDISPLAYGROUP, L"", handle);
|
||||
}
|
||||
|
||||
inline
|
||||
const wchar_t *svc_objectDir::getObjectIcon(ObjectHandle handle) {
|
||||
return _call(GETOBJECTICON, (const wchar_t *)NULL, handle);
|
||||
}
|
||||
|
||||
inline
|
||||
int svc_objectDir::getObjectSelectable(ObjectHandle handle) {
|
||||
return _call(GETOBJECTSELECTABLE, TRUE, handle);
|
||||
}
|
||||
|
||||
inline
|
||||
int svc_objectDir::getObjectSortOrder(ObjectHandle handle) {
|
||||
return _call(GETOBJECTSORTORDER, 0, handle);
|
||||
}
|
||||
|
||||
inline
|
||||
int svc_objectDir::tagObject(const wchar_t *tag, ObjectHandle handle, int exclusive) {
|
||||
return _call(TAGOBJECT, 0, tag, handle, exclusive);
|
||||
}
|
||||
inline
|
||||
int svc_objectDir::untagObject(const wchar_t *tag, ObjectHandle handle) {
|
||||
return _call(UNTAGOBJECT, 0, tag, handle);
|
||||
}
|
||||
inline
|
||||
ObjectHandle svc_objectDir::enumObjectByTag(const wchar_t *tag, int n) {
|
||||
return _call(ENUMOBJECTBYTAG, INVALID_OBJECT_HANDLE, tag, n);
|
||||
}
|
||||
inline
|
||||
int svc_objectDir::isTagged(const wchar_t *tag, ObjectHandle handle) {
|
||||
return _call(ISTAGGED, 0, tag, handle);
|
||||
}
|
||||
|
||||
inline
|
||||
int svc_objectDir::onAction(int action, ifc_window *from, const wchar_t *target, ObjectHandle handle) {
|
||||
return _call(ONACTION, 0, action, from, target, handle);
|
||||
}
|
||||
|
||||
inline
|
||||
int svc_objectDir::contextMenu(ifc_window *from, int x, int y, ObjectHandle handle) {
|
||||
return _call(CONTEXTMENU, 0, from, x, y, handle);
|
||||
}
|
||||
|
||||
inline
|
||||
void svc_objectDir::onPrerender(ObjectHandle handle, const RECT *r, BaseCanvas *c, int style) {
|
||||
_voidcall(ONPRERENDER, handle, r, c, style);
|
||||
}
|
||||
inline
|
||||
void svc_objectDir::onPostrender(ObjectHandle handle, const RECT *r, BaseCanvas *c, int style) {
|
||||
_voidcall(ONPOSTRENDER, handle, r, c, style);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Service implementation. Usually you'll derive from ObjectDir, not this.
|
||||
You can still derive from this if you want to fully implement the interface yourself for some reason though.
|
||||
@see ObjectDir
|
||||
*/
|
||||
class svc_objectDirI : public svc_objectDir {
|
||||
public:
|
||||
virtual api_dependent *getDependencyPtr()=0;
|
||||
|
||||
virtual const wchar_t *getDirType()=0;
|
||||
|
||||
virtual int getNumObjects()=0;
|
||||
virtual ObjectHandle enumObject(int n)=0;
|
||||
|
||||
virtual void *getObject(ObjectHandle handle)=0;
|
||||
|
||||
virtual const wchar_t *getObjectLabel(ObjectHandle handle)=0;
|
||||
virtual int setObjectLabel(ObjectHandle handle, const wchar_t *newlabel)=0;
|
||||
|
||||
virtual ObjectHandle insertObject(const wchar_t *parameter=NULL, const wchar_t *label=NULL, const wchar_t *path=NULL)=0;
|
||||
virtual int removeObject(ObjectHandle handle)=0;
|
||||
|
||||
virtual void clearAll()=0;
|
||||
|
||||
virtual const wchar_t *getObjectPath(ObjectHandle handle)=0;
|
||||
virtual const wchar_t *getObjectDisplayGroup(ObjectHandle handle)=0;
|
||||
virtual const wchar_t *getObjectIcon(ObjectHandle handle)=0;
|
||||
virtual int getObjectSelectable(ObjectHandle handle)=0;
|
||||
virtual int getObjectSortOrder(ObjectHandle handle)=0;
|
||||
|
||||
virtual int tagObject(const wchar_t *tag, ObjectHandle handle, int exclusive=FALSE)=0;
|
||||
virtual int untagObject(const wchar_t *tag, ObjectHandle handle)=0;
|
||||
virtual ObjectHandle enumObjectByTag(const wchar_t *tag, int n)=0;
|
||||
virtual int isTagged(const wchar_t *tag, ObjectHandle handle)=0;
|
||||
|
||||
virtual int onAction(int action, ifc_window *from, const wchar_t *target, ObjectHandle handle)=0;
|
||||
|
||||
// return -1 to request renaming the item, 0 normally
|
||||
virtual int contextMenu(ifc_window *from, int x, int y, ObjectHandle handle)=0;
|
||||
|
||||
virtual void onPrerender(ObjectHandle handle, const RECT *r, BaseCanvas *c, int style) { }
|
||||
virtual void onPostrender(ObjectHandle handle, const RECT *r, BaseCanvas *c, int style) { }
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
#include <api/service/servicei.h>
|
||||
|
||||
template <class T>
|
||||
class ObjectDirCreator : public waServiceFactoryTSingle<svc_objectDir, T> { };
|
||||
|
||||
#include <api/service/svc_enum.h>
|
||||
|
||||
class ObjectDirEnum : public SvcEnumT<svc_objectDir> {
|
||||
public:
|
||||
ObjectDirEnum(const wchar_t *_name) : name(_name) {}
|
||||
virtual int testService(svc_objectDir *svc) {
|
||||
return !WCSICMP(svc->getDirType(), name);
|
||||
}
|
||||
private:
|
||||
StringW name;
|
||||
};
|
||||
|
||||
#endif
|
35
Src/Wasabi/api/service/svcs/svc_player.h
Normal file
35
Src/Wasabi/api/service/svcs/svc_player.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
#ifndef _SVC_PLAYER_H
|
||||
#define _SVC_PLAYER_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
|
||||
#include <api/service/services.h>
|
||||
|
||||
class api_window;
|
||||
|
||||
class svc_player {
|
||||
public:
|
||||
static const char *getServiceName() { return "Standard player service"; }
|
||||
static int getServiceType() { return WaSvc::UNIQUE; }
|
||||
static GUID getServiceGuid() {
|
||||
// {9DE79C4A-B9E6-46f4-9AE2-40E0F09CCA51}
|
||||
const GUID guid =
|
||||
{ 0x9de79c4a, 0xb9e6, 0x46f4, { 0x9a, 0xe2, 0x40, 0xe0, 0xf0, 0x9c, 0xca, 0x51 } };
|
||||
return guid;
|
||||
}
|
||||
virtual void openFile(const char *filename, FOURCC droptarg=MK3CC('d','e','f'))=0;
|
||||
virtual void openFiles(api_window *parent=NULL, const char *type=NULL, FOURCC droptarg=MK3CC('d','e','f'))=0;
|
||||
};
|
||||
|
||||
class svc_playerI : public svc_player {
|
||||
};
|
||||
|
||||
#include <api/service/servicei.h>
|
||||
|
||||
template <class T>
|
||||
class PlayerCreator : public waServiceFactoryTSingle<svc_player, T> {
|
||||
public:
|
||||
PlayerCreator() : waServiceFactoryTSingle<svc_player, T>(svc_player::getServiceGuid()) {}
|
||||
};
|
||||
|
||||
#endif
|
28
Src/Wasabi/api/service/svcs/svc_playlist.cpp
Normal file
28
Src/Wasabi/api/service/svcs/svc_playlist.cpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "svc_playlist.h"
|
||||
|
||||
#define CBCLASS svc_playlistReaderI
|
||||
START_DISPATCH;
|
||||
CB(GETEXTENSION, getExtension);
|
||||
CB(TESTFILENAME, testFilename);
|
||||
CB(GETDESCRIPTION, getDescription);
|
||||
CB(READPLAYLIST, readPlaylist);
|
||||
CB(GETLABEL, getLabel);
|
||||
CB(GETNUMENTRIES, getNumEntries);
|
||||
CB(ENUMENTRY, enumEntry);
|
||||
VCB(ENABLEDATABASEADD, enableDatabaseAdd);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
||||
#define CBCLASS svc_playlistWriterI
|
||||
START_DISPATCH;
|
||||
CB(GETEXTENSION, getExtension);
|
||||
CB(GETDESCRIPTION, getDescription);
|
||||
CB(WRITEPLAYLIST, writePlaylist);
|
||||
CB(BEGINWRITE, beginWrite);
|
||||
VCB(WRITEENTRY, writeEntry);
|
||||
VCB(ENDWRITE, endWrite);
|
||||
VCB(ENABLEMETADATA, enableMetadata);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
216
Src/Wasabi/api/service/svcs/svc_playlist.h
Normal file
216
Src/Wasabi/api/service/svcs/svc_playlist.h
Normal file
|
@ -0,0 +1,216 @@
|
|||
#ifndef _SVC_PLAYLIST_H
|
||||
#define _SVC_PLAYLIST_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <api/service/services.h>
|
||||
|
||||
class Playlist;
|
||||
|
||||
class NOVTABLE svc_playlistReader : public Dispatchable {
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::PLAYLISTREADER; }
|
||||
|
||||
const char *getExtension();
|
||||
int testFilename(const char *filename);
|
||||
const char *getDescription();
|
||||
|
||||
void setAllowedMetadataColumns(const char *columnslist); // "a;b;c" ""=all
|
||||
void setBannedMetadataColumns(const char *columnslist); // "a;b;c" ""==all
|
||||
|
||||
void enableDatabaseAdd(int enabled); // defaults to TRUE
|
||||
// void enableMetadata(int enabled); // defaults to TRUE
|
||||
|
||||
int readPlaylist(const char *filename);
|
||||
|
||||
const char *getLabel();
|
||||
int getNumEntries();
|
||||
const char *enumEntry(int n);
|
||||
|
||||
protected:
|
||||
enum {
|
||||
GETEXTENSION=0, READPLAYLIST=1, GETLABEL=2, GETNUMENTRIES=3, ENUMENTRY=4,
|
||||
TESTFILENAME=100,
|
||||
GETDESCRIPTION=110,
|
||||
ENABLEDATABASEADD=200,
|
||||
};
|
||||
};
|
||||
|
||||
inline
|
||||
const char *svc_playlistReader::getExtension() {
|
||||
return _call(GETEXTENSION, "");
|
||||
}
|
||||
|
||||
inline
|
||||
int svc_playlistReader::testFilename(const char *filename) {
|
||||
return _call(TESTFILENAME, -1, filename);
|
||||
}
|
||||
|
||||
inline
|
||||
const char *svc_playlistReader::getDescription() {
|
||||
return _call(GETDESCRIPTION, (const char *)NULL);
|
||||
}
|
||||
|
||||
inline
|
||||
void svc_playlistReader::enableDatabaseAdd(int enabled) {
|
||||
_voidcall(ENABLEDATABASEADD, enabled);
|
||||
}
|
||||
|
||||
inline
|
||||
int svc_playlistReader::readPlaylist(const char *filename) {
|
||||
return _call(READPLAYLIST, 0, filename);
|
||||
}
|
||||
|
||||
inline
|
||||
const char *svc_playlistReader::getLabel() {
|
||||
return _call(GETLABEL, (const char *)0);
|
||||
}
|
||||
|
||||
inline
|
||||
int svc_playlistReader::getNumEntries() {
|
||||
return _call(GETNUMENTRIES, 0);
|
||||
}
|
||||
|
||||
inline
|
||||
const char *svc_playlistReader::enumEntry(int n) {
|
||||
return _call(ENUMENTRY, (const char *)NULL, n);
|
||||
}
|
||||
|
||||
class NOVTABLE svc_playlistReaderI : public svc_playlistReader {
|
||||
public:
|
||||
virtual const char *getExtension()=0;
|
||||
virtual int testFilename(const char *filename) { return -1; }
|
||||
virtual const char *getDescription() { return NULL; }
|
||||
|
||||
virtual void enableDatabaseAdd(int enabled)=0;
|
||||
|
||||
virtual int readPlaylist(const char *filename)=0;
|
||||
|
||||
virtual const char *getLabel()=0;
|
||||
virtual int getNumEntries()=0;
|
||||
virtual const char *enumEntry(int n)=0;
|
||||
|
||||
private:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
class NOVTABLE svc_playlistWriter : public Dispatchable {
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::PLAYLISTWRITER; }
|
||||
|
||||
const char *getExtension();
|
||||
const char *getDescription();
|
||||
|
||||
void enableMetadata(int enabled);
|
||||
|
||||
int writePlaylist(const char *filename, Playlist *pl, int full_data, int first, int last);
|
||||
|
||||
// old-style, DEPRECATED
|
||||
int beginWrite(const char *filename, int n, const char *label);
|
||||
void writeEntry(const char *playstring);
|
||||
void endWrite();
|
||||
|
||||
protected:
|
||||
enum {
|
||||
GETEXTENSION=0,
|
||||
GETDESCRIPTION=1,
|
||||
BEGINWRITE=2,
|
||||
WRITEENTRY=3,
|
||||
ENDWRITE=4,
|
||||
WRITEPLAYLIST=100,
|
||||
ENABLEMETADATA=200,
|
||||
};
|
||||
};
|
||||
|
||||
inline
|
||||
const char *svc_playlistWriter::getExtension() {
|
||||
return _call(GETEXTENSION, (const char *)0);
|
||||
}
|
||||
|
||||
inline
|
||||
const char *svc_playlistWriter::getDescription() {
|
||||
return _call(GETDESCRIPTION, (const char *)0);
|
||||
}
|
||||
|
||||
inline
|
||||
void svc_playlistWriter::enableMetadata(int enabled) {
|
||||
_voidcall(ENABLEMETADATA, enabled);
|
||||
}
|
||||
|
||||
inline
|
||||
int svc_playlistWriter::writePlaylist(const char *filename, Playlist *pl, int full_data, int first, int last) {
|
||||
return _call(WRITEPLAYLIST, -1, filename, pl, full_data, first, last);
|
||||
}
|
||||
|
||||
inline
|
||||
int svc_playlistWriter::beginWrite(const char *filename, int n, const char *label) {
|
||||
return _call(BEGINWRITE, 0, filename, n, label);
|
||||
}
|
||||
|
||||
inline
|
||||
void svc_playlistWriter::writeEntry(const char *playstring) {
|
||||
_voidcall(WRITEENTRY, playstring);
|
||||
}
|
||||
|
||||
inline
|
||||
void svc_playlistWriter::endWrite() {
|
||||
_voidcall(ENDWRITE);
|
||||
}
|
||||
|
||||
class NOVTABLE svc_playlistWriterI : public svc_playlistWriter {
|
||||
public:
|
||||
virtual const char *getExtension()=0;
|
||||
virtual const char *getDescription() { return NULL; }
|
||||
|
||||
virtual void enableMetadata(int enabled) { }
|
||||
|
||||
virtual int writePlaylist(const char *filename, Playlist *pl, int full_data, int first, int last) { return -1; }
|
||||
|
||||
// old-style, DEPRECATED
|
||||
virtual int beginWrite(const char *filename, int n, const char *label) { return 0; }
|
||||
virtual void writeEntry(const char *playstring) { }
|
||||
virtual void endWrite() { }
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
#include <api/service/servicei.h>
|
||||
|
||||
template <class T>
|
||||
class PlaylistReaderCreator : public waServiceFactoryT<svc_playlistReader, T> {};
|
||||
|
||||
template <class T>
|
||||
class PlaylistWriterCreator : public waServiceFactoryT<svc_playlistWriter, T> {};
|
||||
|
||||
#include <api/service/svc_enum.h>
|
||||
#include <bfc/string/string.h>
|
||||
|
||||
class PlaylistReaderEnum : public SvcEnumT<svc_playlistReader> {
|
||||
public:
|
||||
PlaylistReaderEnum(const char *filename) : fn(filename) {}
|
||||
|
||||
protected:
|
||||
virtual int testService(svc_playlistReader *svc) {
|
||||
int r = svc->testFilename(fn);
|
||||
if (r == -1) return STRCASEEQL(svc->getExtension(), Std::extension(fn));
|
||||
return r;
|
||||
}
|
||||
|
||||
private:
|
||||
String fn;
|
||||
};
|
||||
|
||||
class PlaylistWriterEnum : public SvcEnumT<svc_playlistWriter> {
|
||||
public:
|
||||
PlaylistWriterEnum(const char *filename) :
|
||||
ext(Std::extension(filename)) {}
|
||||
protected:
|
||||
virtual int testService(svc_playlistWriter *svc) {
|
||||
return STRCASEEQL(svc->getExtension(), ext);
|
||||
}
|
||||
|
||||
private:
|
||||
String ext;
|
||||
};
|
||||
|
||||
#endif
|
10
Src/Wasabi/api/service/svcs/svc_redir.cpp
Normal file
10
Src/Wasabi/api/service/svcs/svc_redir.cpp
Normal file
|
@ -0,0 +1,10 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "svc_redir.h"
|
||||
|
||||
#define CBCLASS svc_redirectI
|
||||
START_DISPATCH;
|
||||
CB(ISMINE, isMine);
|
||||
CB(REDIRECT, redirect);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
63
Src/Wasabi/api/service/svcs/svc_redir.h
Normal file
63
Src/Wasabi/api/service/svcs/svc_redir.h
Normal file
|
@ -0,0 +1,63 @@
|
|||
#ifndef _SVC_REDIR_H
|
||||
#define _SVC_REDIR_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <api/service/services.h>
|
||||
|
||||
/* Domains:
|
||||
"Filename"
|
||||
"Url"
|
||||
*/
|
||||
|
||||
// if you want to redirect a string easily, look at RedirString in
|
||||
// bfc/util/redirstr.h
|
||||
|
||||
class svc_redirect : public Dispatchable
|
||||
{
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::REDIRECT; }
|
||||
|
||||
int isMine(const wchar_t *str, const wchar_t *domain);
|
||||
int redirect(const wchar_t *orig_str, const wchar_t *domain, wchar_t *buf, int buflen);
|
||||
|
||||
protected:
|
||||
enum {
|
||||
ISMINE=100,
|
||||
REDIRECT=200,
|
||||
};
|
||||
};
|
||||
|
||||
inline int svc_redirect::isMine(const wchar_t *str, const wchar_t *domain) {
|
||||
return _call(ISMINE, 0, str, domain);
|
||||
}
|
||||
|
||||
inline int svc_redirect::redirect(const wchar_t *orig_str, const wchar_t *domain, wchar_t *buf, int buflen) {
|
||||
return _call(REDIRECT, 0, orig_str, domain, buf, buflen);
|
||||
}
|
||||
|
||||
class svc_redirectI : public svc_redirect {
|
||||
public:
|
||||
virtual int isMine(const wchar_t *str, const wchar_t *domain)=0;
|
||||
virtual int redirect(const wchar_t *orig_str, const wchar_t *domain, wchar_t *buf, int buflen)=0;
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
#include <api/service/svc_enum.h>
|
||||
|
||||
class RedirectEnum : public SvcEnumT<svc_redirect> {
|
||||
public:
|
||||
RedirectEnum(const wchar_t *filename, const wchar_t *domain=L"Filename") :
|
||||
fn(filename), dom(domain) {
|
||||
}
|
||||
|
||||
virtual int testService(svc_redirect *svc) {
|
||||
if (svc->isMine(fn, dom)) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
const wchar_t *fn, *dom;
|
||||
};
|
||||
#endif
|
10
Src/Wasabi/api/service/svcs/svc_scriptobj.cpp
Normal file
10
Src/Wasabi/api/service/svcs/svc_scriptobj.cpp
Normal file
|
@ -0,0 +1,10 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "svc_scriptobji.h"
|
||||
|
||||
#define CBCLASS svc_scriptObjectI
|
||||
START_DISPATCH;
|
||||
CB(GETCONTROLLER, getController);
|
||||
VCB(ONREGISTER, onRegisterClasses);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
29
Src/Wasabi/api/service/svcs/svc_scriptobj.h
Normal file
29
Src/Wasabi/api/service/svcs/svc_scriptobj.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
#ifndef _SVC_SCRIPTOBJECT_H
|
||||
#define _SVC_SCRIPTOBJECT_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <api/service/services.h>
|
||||
|
||||
class ScriptObjectController;
|
||||
|
||||
class svc_scriptObject : public Dispatchable {
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::SCRIPTOBJECT; }
|
||||
ScriptObjectController *getController(int n);
|
||||
void onRegisterClasses(ScriptObjectController *rootController);
|
||||
|
||||
enum {
|
||||
GETCONTROLLER=10,
|
||||
ONREGISTER=20,
|
||||
};
|
||||
};
|
||||
|
||||
inline ScriptObjectController *svc_scriptObject::getController(int n) {
|
||||
return _call(GETCONTROLLER, (ScriptObjectController *)0, n);
|
||||
}
|
||||
|
||||
inline void svc_scriptObject::onRegisterClasses(ScriptObjectController *rootController) {
|
||||
_voidcall(ONREGISTER, rootController);
|
||||
}
|
||||
|
||||
#endif
|
51
Src/Wasabi/api/service/svcs/svc_scriptobji.h
Normal file
51
Src/Wasabi/api/service/svcs/svc_scriptobji.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
#pragma once
|
||||
#include "svc_scriptobji.h"
|
||||
// derive from this one
|
||||
class svc_scriptObjectI : public svc_scriptObject {
|
||||
public:
|
||||
virtual ScriptObjectController *getController(int n)=0;
|
||||
virtual void onRegisterClasses(ScriptObjectController *rootController) {};
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class ScriptObjectControllerCreator : public svc_scriptObjectI {
|
||||
public:
|
||||
static const char *getServiceName() { return "ScriptObjectControllerCreator"; }
|
||||
|
||||
ScriptObjectControllerCreator()
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~ScriptObjectControllerCreator()
|
||||
{
|
||||
}
|
||||
|
||||
virtual ScriptObjectController *getController(int n)
|
||||
{
|
||||
if (n == 0) return &single_controller;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
private:
|
||||
T single_controller;
|
||||
};
|
||||
|
||||
#include <api/service/servicei.h>
|
||||
template <class T>
|
||||
class ScriptObjectCreator : public waServiceFactoryTSingle<svc_scriptObject, T> {};
|
||||
|
||||
#include <api/service/svc_enum.h>
|
||||
|
||||
class ExternalScriptObjectEnum : public SvcEnumT<svc_scriptObject> {
|
||||
public:
|
||||
ExternalScriptObjectEnum() { }
|
||||
|
||||
protected:
|
||||
virtual int testService(svc_scriptObject*svc) {
|
||||
return (svc->getController(0) != NULL);
|
||||
}
|
||||
};
|
||||
|
10
Src/Wasabi/api/service/svcs/svc_skinfilter.cpp
Normal file
10
Src/Wasabi/api/service/svcs/svc_skinfilter.cpp
Normal file
|
@ -0,0 +1,10 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "svc_skinfilter.h"
|
||||
|
||||
#define CBCLASS svc_skinFilterI
|
||||
START_DISPATCH;
|
||||
CB(FILTERBITMAP, filterBitmap);
|
||||
CB(FILTERCOLOR, filterColor);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
56
Src/Wasabi/api/service/svcs/svc_skinfilter.h
Normal file
56
Src/Wasabi/api/service/svcs/svc_skinfilter.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
#ifndef _SVC_SKINFILTER_H
|
||||
#define _SVC_SKINFILTER_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <api/service/services.h>
|
||||
|
||||
// TODO: make some sort of ifc_bitmap so we can do OS-level manipulations if necessary
|
||||
|
||||
class NOVTABLE svc_skinFilter : public Dispatchable {
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::SKINFILTER; }
|
||||
int filterBitmap(uint8_t *bits, int w, int h, int bpp, const wchar_t *element_id, const wchar_t *forcegroup=NULL);
|
||||
ARGB32 filterColor(ARGB32 color, const wchar_t *element_id, const wchar_t *forcegroup=NULL);
|
||||
|
||||
enum {
|
||||
FILTERBITMAP=100,
|
||||
FILTERCOLOR=200,
|
||||
};
|
||||
};
|
||||
|
||||
inline int svc_skinFilter::filterBitmap(uint8_t *bits, int w, int h, int bpp, const wchar_t *element_id, const wchar_t *forcegroup) {
|
||||
return _call(FILTERBITMAP, 0, bits, w, h, bpp, element_id, forcegroup);
|
||||
}
|
||||
|
||||
inline ARGB32 svc_skinFilter::filterColor(ARGB32 color, const wchar_t *element_id, const wchar_t *forcegroup) {
|
||||
return _call(FILTERCOLOR, (ARGB32)0, color, element_id, forcegroup);
|
||||
}
|
||||
|
||||
// derive from this one
|
||||
class NOVTABLE svc_skinFilterI : public svc_skinFilter
|
||||
{
|
||||
public:
|
||||
virtual int filterBitmap(uint8_t *bits, int w, int h, int bpp, const wchar_t *element_id, const wchar_t *forcegroup=NULL)=0;
|
||||
virtual ARGB32 filterColor(ARGB32 color, const wchar_t *element_id, const wchar_t *forcegroup=NULL)
|
||||
{
|
||||
// easy cheesy helper
|
||||
filterBitmap((uint8_t *)&color, 1, 1, 32, element_id, forcegroup);
|
||||
return color;
|
||||
}
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
#include <api/service/svc_enum.h>
|
||||
|
||||
class SkinFilterEnum : public SvcEnumT<svc_skinFilter> {
|
||||
public:
|
||||
SkinFilterEnum() {}
|
||||
protected:
|
||||
virtual int testService(svc_skinFilter* svc) {
|
||||
return TRUE;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
30
Src/Wasabi/api/service/svcs/svc_storagevolenum.cpp
Normal file
30
Src/Wasabi/api/service/svcs/svc_storagevolenum.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
#include <precomp.h>
|
||||
#include "svc_storagevolenum.h"
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
|
||||
#define CBCLASS StorageVolumeI
|
||||
START_DISPATCH;
|
||||
CB(GETVOLUMENAME, getVolumeName);
|
||||
CB(GETMOUNTPATH, getMountPath);
|
||||
CB(GETLABEL, getLabel);
|
||||
CB(GETTYPE, getType);
|
||||
CB(ISREMOVABLE, isRemovable);
|
||||
CB(ISWRITABLE, isWritable);
|
||||
CB(GETFREESPACE, getFreeSpace);
|
||||
CB(GETSIZE, getSize);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
|
||||
#define CBCLASS svc_storageVolumeEnumI
|
||||
START_DISPATCH;
|
||||
CB(GETNUMVOLUMES, getNumVolumes);
|
||||
CB(ENUMVOLUME, enumVolume);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
|
||||
|
96
Src/Wasabi/api/service/svcs/svc_storagevolenum.h
Normal file
96
Src/Wasabi/api/service/svcs/svc_storagevolenum.h
Normal file
|
@ -0,0 +1,96 @@
|
|||
#ifndef __SVC_STORAGEVOLENUM_H
|
||||
#define __SVC_STORAGEVOLENUM_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <api/service/services.h>
|
||||
|
||||
enum StorageVolumeTypes {
|
||||
NOT_VALID = 0, //Not a valid Volume.
|
||||
UNKNOWN = 1, //Unknown Drive Type.
|
||||
LOCAL = 1<<1, //Local (Fixed) Hard Drive.
|
||||
REMOVABLE = 1<<2, //Removable Drive (Floppy, LS-120, Zip, USB FlashCard Reader, etc.)
|
||||
NETWORK = 1<<3, //Network Drive (SMB, NFS, etc.)
|
||||
CDROM = 1<<4, //CD / DVD ROM, WRITER, Re-WRITER, etc.
|
||||
RAMDISK = 1<<5, //RAM Drive.
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
|
||||
class NOVTABLE StorageVolume : public Dispatchable {
|
||||
public:
|
||||
const char *getVolumeName() { return _call(GETVOLUMENAME, (const char *) NULL); }
|
||||
const char *getMountPath() { return _call(GETMOUNTPATH, (const char *) NULL); }
|
||||
const char *getLabel() { return _call(GETLABEL, (const char *) NULL); }
|
||||
|
||||
int getType() { return _call(GETTYPE, 0); }
|
||||
|
||||
int isRemovable() { return _call(ISREMOVABLE, -1); }
|
||||
int isWritable() { return _call(ISWRITABLE, -1); }
|
||||
|
||||
__int64 getFreeSpace() { return _call(GETFREESPACE, -1); }
|
||||
__int64 getSize() { return _call(GETSIZE, -1); }
|
||||
|
||||
enum {
|
||||
GETVOLUMENAME = 10,
|
||||
GETMOUNTPATH = 20,
|
||||
GETLABEL = 30,
|
||||
GETTYPE = 40,
|
||||
ISREMOVABLE = 50,
|
||||
ISWRITABLE = 60,
|
||||
GETFREESPACE = 70,
|
||||
GETSIZE = 80
|
||||
};
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
|
||||
class StorageVolumeI : public StorageVolume {
|
||||
public:
|
||||
virtual const char *getVolumeName()=0;
|
||||
virtual const char *getMountPath()=0;
|
||||
virtual const char *getLabel()=0;
|
||||
|
||||
virtual int getType()=0;
|
||||
|
||||
virtual int isRemovable()=0;
|
||||
virtual int isWritable()=0;
|
||||
|
||||
virtual __int64 getFreeSpace()=0;
|
||||
virtual __int64 getSize()=0;
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
|
||||
class NOVTABLE svc_storageVolumeEnum : public Dispatchable
|
||||
{
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::STORAGEVOLENUM; }
|
||||
|
||||
int getNumVolumes() { return _call(GETNUMVOLUMES, (int) 0); }
|
||||
StorageVolume *enumVolume(int which) { return _call(ENUMVOLUME, (StorageVolume *)NULL); }
|
||||
|
||||
enum {
|
||||
GETNUMVOLUMES = 10,
|
||||
ENUMVOLUME = 20,
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
|
||||
class svc_storageVolumeEnumI : public svc_storageVolumeEnum {
|
||||
public:
|
||||
virtual int getNumVolumes()=0; //Get the number of Storage Volumes.
|
||||
//Enum a Storage Volume.
|
||||
virtual StorageVolume *enumVolume(int which)=0;
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
|
||||
};
|
||||
|
||||
#endif //__SVC_STORAGEVOLENUM_H
|
12
Src/Wasabi/api/service/svcs/svc_stringconverter.cpp
Normal file
12
Src/Wasabi/api/service/svcs/svc_stringconverter.cpp
Normal file
|
@ -0,0 +1,12 @@
|
|||
#include <precomp.h>
|
||||
#include "svc_stringconverter.h"
|
||||
|
||||
#define CBCLASS svc_stringConverterI
|
||||
START_DISPATCH
|
||||
CB(CANCONVERT, canConvert);
|
||||
CB(CONVERTTOUTF8, convertToUTF8);
|
||||
CB(PREFLIGHTTOUTF8, preflightToUTF8);
|
||||
CB(CONVERTFROMUTF8, convertFromUTF8);
|
||||
CB(PREFLIGHTFROMUTF8, preflightFromUTF8);
|
||||
END_DISPATCH
|
||||
#undef CBCLASS
|
94
Src/Wasabi/api/service/svcs/svc_stringconverter.h
Normal file
94
Src/Wasabi/api/service/svcs/svc_stringconverter.h
Normal file
|
@ -0,0 +1,94 @@
|
|||
#ifndef _SVC_STRINGCONVERTER_H
|
||||
#define _SVC_STRINGCONVERTER_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <api/service/services.h>
|
||||
#include <api/service/svcs/svc_stringtypes.h>
|
||||
|
||||
// Porting Rule: A new service to respond to at least OSNATIVE and UTF16 shall be
|
||||
// provided for every new platform. This service should provide transcoding
|
||||
// to and from the platform's native internationalized string encoding format
|
||||
// (ie: MBCS under Win9x, WorldScript on the Mac, etc etc etc).and to and from
|
||||
// UTF16. If the OSNATIVE string _IS_ UTF16, just respond that you can convert
|
||||
// both.
|
||||
|
||||
class NOVTABLE svc_stringConverter : public Dispatchable {
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::STRINGCONVERTER; }
|
||||
|
||||
// test the type.
|
||||
int canConvert(FOURCC encoding_type);
|
||||
|
||||
// The return code is the number of bytes written to the output buffer, or the error.
|
||||
// A return code of 0 is not an error, other than you passing NULL or a size 0 buffer won't do much interesting.
|
||||
int convertToUTF8(FOURCC encoding_type, const void *in_buffer, int size_in_bytes, char *out_buffer, int size_out_bytes);
|
||||
int preflightToUTF8(FOURCC encoding_type, const void *in_buffer, int size_in_bytes);
|
||||
int convertFromUTF8(FOURCC encoding_type, const char *in_buffer, int size_in_bytes, void *out_buffer, int size_out_bytes);
|
||||
int preflightFromUTF8(FOURCC encoding_type, const char *in_buffer, int size_in_bytes);
|
||||
|
||||
protected:
|
||||
enum {
|
||||
CANCONVERT,
|
||||
CONVERTTOUTF8,
|
||||
PREFLIGHTTOUTF8,
|
||||
CONVERTFROMUTF8,
|
||||
PREFLIGHTFROMUTF8
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
inline
|
||||
int svc_stringConverter::canConvert(FOURCC encoding_type) {
|
||||
return _call(CANCONVERT, (int)0, encoding_type);
|
||||
}
|
||||
|
||||
inline
|
||||
int svc_stringConverter::convertToUTF8(FOURCC encoding_type, const void *in_buffer, int size_in_bytes, char *out_buffer, int size_out_bytes) {
|
||||
return _call(CONVERTTOUTF8, (int)0, encoding_type, in_buffer, size_in_bytes, out_buffer, size_out_bytes);
|
||||
}
|
||||
|
||||
inline
|
||||
int svc_stringConverter::preflightToUTF8(FOURCC encoding_type, const void *in_buffer, int size_in_bytes) {
|
||||
return _call(PREFLIGHTTOUTF8, (int)0, encoding_type, in_buffer, size_in_bytes);
|
||||
}
|
||||
|
||||
inline
|
||||
int svc_stringConverter::convertFromUTF8(FOURCC encoding_type, const char *in_buffer, int size_in_bytes, void *out_buffer, int size_out_bytes) {
|
||||
return _call(CONVERTFROMUTF8, (int)0, encoding_type, in_buffer, size_in_bytes, out_buffer, size_out_bytes);
|
||||
}
|
||||
|
||||
inline
|
||||
int svc_stringConverter::preflightFromUTF8(FOURCC encoding_type, const char *in_buffer, int size_in_bytes) {
|
||||
return _call(PREFLIGHTFROMUTF8, (int)0, encoding_type, in_buffer, size_in_bytes);
|
||||
}
|
||||
|
||||
// implementor derives from this one
|
||||
class NOVTABLE svc_stringConverterI : public svc_stringConverter {
|
||||
public:
|
||||
|
||||
// test the type
|
||||
virtual int canConvert(FOURCC encoding_type) = 0;
|
||||
|
||||
virtual int convertToUTF8(FOURCC encoding_type, const void *in_buffer, int size_in_bytes, char *out_buffer, int size_out_bytes) = 0;
|
||||
virtual int preflightToUTF8(FOURCC encoding_type, const void *in_buffer, int size_in_bytes) = 0;
|
||||
virtual int convertFromUTF8(FOURCC encoding_type, const char *in_buffer, int size_in_bytes, void *out_buffer, int size_out_bytes) = 0;
|
||||
virtual int preflightFromUTF8(FOURCC encoding_type, const char *in_buffer, int size_in_bytes) = 0;
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
#include <api/service/svc_enum.h>
|
||||
|
||||
class StringConverterEnum : public SvcEnumT<svc_stringConverter> {
|
||||
public:
|
||||
StringConverterEnum(FOURCC enc_type) : encoding_type(enc_type) {}
|
||||
protected:
|
||||
virtual int testService(svc_stringConverter *svc) {
|
||||
return (svc->canConvert(encoding_type));
|
||||
}
|
||||
private:
|
||||
FOURCC encoding_type;
|
||||
};
|
||||
|
||||
#endif // _SVC_STRINGCONVERTER_H
|
35
Src/Wasabi/api/service/svcs/svc_stringtypes.h
Normal file
35
Src/Wasabi/api/service/svcs/svc_stringtypes.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
#ifndef _SVC_STRINGTYPES_H
|
||||
#define _SVC_STRINGTYPES_H
|
||||
|
||||
// Here, you look like you're in need of some error codes.
|
||||
namespace SvcStrCnv {
|
||||
typedef enum {
|
||||
// The conversion failed for some generic 'fatal' reason, not covered by the
|
||||
// other reasons below. (Possibly a bug in the service implementation).
|
||||
ERROR_FATAL = -1,
|
||||
|
||||
// The conversion failed because your output buffer was too small.
|
||||
ERROR_BUFFER_OVERRUN = -2,
|
||||
|
||||
// The conversion failed because your input string had unrecoverable errors in it
|
||||
ERROR_INPUT = -3,
|
||||
|
||||
// The service instance does not support that type of encoding for conversion
|
||||
ERROR_INVALID = -4,
|
||||
|
||||
// The service instance isn't available (ONLY generated by EncodedStr.cpp, obviously)
|
||||
ERROR_UNAVAILABLE = -5,
|
||||
|
||||
} ConvertErrors;
|
||||
|
||||
// These types MUST be supported by the platform port for this service.
|
||||
typedef enum {
|
||||
OSNATIVE=MK4CC('n','a','t','v'),
|
||||
UTF16=MK4CC('u','-','1','6'),
|
||||
} EncodingTypes;
|
||||
// Other service instances may implement other encoding types.
|
||||
// They all should provide their own FOURCC #define or enum in their headers.
|
||||
}
|
||||
|
||||
|
||||
#endif // _SVC_STRINGTYPES_H
|
18
Src/Wasabi/api/service/svcs/svc_textfeed.cpp
Normal file
18
Src/Wasabi/api/service/svcs/svc_textfeed.cpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "svc_textfeed.h"
|
||||
#include <bfc/depend.h>
|
||||
|
||||
#define CBCLASS svc_textFeedI
|
||||
START_DISPATCH;
|
||||
CB(SVCTEXTFEED_HASFEED, hasFeed);
|
||||
CB(SVCTEXTFEED_GETFEEDTEXT, getFeedText);
|
||||
CB(SVCTEXTFEED_GETFEEDDESC, getFeedDescription);
|
||||
CB(SVCTEXTFEED_GETDEPENDENCYPTR, getDependencyPtr);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
||||
void *svc_textFeedI::dependent_getInterface(const GUID *classguid) {
|
||||
HANDLEGETINTERFACE(svc_textFeed);
|
||||
return NULL;
|
||||
}
|
21
Src/Wasabi/api/service/svcs/svc_textfeed.h
Normal file
21
Src/Wasabi/api/service/svcs/svc_textfeed.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef _SVC_TEXTFEED_H
|
||||
#define _SVC_TEXTFEED_H
|
||||
|
||||
//#include <api/service/services.h>
|
||||
#include <api/skin/feeds/api_textfeed.h>
|
||||
|
||||
class NOVTABLE svc_textFeedI : public svc_textFeed
|
||||
{
|
||||
public:
|
||||
virtual int hasFeed(const wchar_t *name) = 0;
|
||||
virtual const wchar_t *getFeedText(const wchar_t *name) = 0;
|
||||
virtual const wchar_t *getFeedDescription(const wchar_t *name) = 0;
|
||||
virtual api_dependent *getDependencyPtr() = 0;
|
||||
virtual void *dependent_getInterface(const GUID *classguid); //implemented for you
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
10
Src/Wasabi/api/service/svcs/svc_tooltips.cpp
Normal file
10
Src/Wasabi/api/service/svcs/svc_tooltips.cpp
Normal file
|
@ -0,0 +1,10 @@
|
|||
#include <precomp.h>
|
||||
#include "svc_tooltips.h"
|
||||
|
||||
#define CBCLASS svc_toolTipsRendererI
|
||||
START_DISPATCH;
|
||||
CB(SPAWNTOOLTIP, spawnTooltip);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
||||
|
30
Src/Wasabi/api/service/svcs/svc_tooltips.h
Normal file
30
Src/Wasabi/api/service/svcs/svc_tooltips.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
#ifndef _SVC_TOOLTIPS_H
|
||||
#define _SVC_TOOLTIPS_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <api/service/services.h>
|
||||
|
||||
class NOVTABLE svc_toolTipsRenderer : public Dispatchable {
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::TOOLTIPSRENDERER; }
|
||||
|
||||
int spawnTooltip(const wchar_t *text);
|
||||
|
||||
enum {
|
||||
SPAWNTOOLTIP =10,
|
||||
};
|
||||
};
|
||||
|
||||
inline int svc_toolTipsRenderer::spawnTooltip(const wchar_t *text) {
|
||||
return _call(SPAWNTOOLTIP, 0, text);
|
||||
}
|
||||
|
||||
class NOVTABLE svc_toolTipsRendererI : public svc_toolTipsRenderer {
|
||||
public:
|
||||
virtual int spawnTooltip(const wchar_t *text)=0;
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
#endif
|
16
Src/Wasabi/api/service/svcs/svc_wndcreate.cpp
Normal file
16
Src/Wasabi/api/service/svcs/svc_wndcreate.cpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "svc_wndcreate.h"
|
||||
|
||||
#define CBCLASS svc_windowCreateI
|
||||
START_DISPATCH;
|
||||
CB(TESTGUID, testGuid);
|
||||
CB(CREATEWINDOWBYGUID, createWindowByGuid);
|
||||
CB(TESTTYPE, testType);
|
||||
CB(CREATEWINDOWOFTYPE, createWindowOfType);
|
||||
CB(DESTROYWINDOW, destroyWindow);
|
||||
CB(REFCOUNT, refcount);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
||||
|
||||
|
120
Src/Wasabi/api/service/svcs/svc_wndcreate.h
Normal file
120
Src/Wasabi/api/service/svcs/svc_wndcreate.h
Normal file
|
@ -0,0 +1,120 @@
|
|||
#ifndef _SVC_WNDCREATE_H
|
||||
#define _SVC_WNDCREATE_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <api/service/services.h>
|
||||
|
||||
#define BUCKETITEM L"buck"
|
||||
#define PLAYLISTSIDECAR L"plsc"
|
||||
|
||||
class ifc_window;
|
||||
|
||||
class NOVTABLE svc_windowCreate : public Dispatchable
|
||||
{
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::WINDOWCREATE; }
|
||||
|
||||
int testGuid(GUID g);
|
||||
ifc_window *createWindowByGuid(GUID g, ifc_window *parent);
|
||||
int testType(const wchar_t *windowtype);
|
||||
ifc_window *createWindowOfType(const wchar_t *windowtype, ifc_window *parent, int n = 0);
|
||||
int destroyWindow(ifc_window *w);
|
||||
|
||||
int refcount(); // how many windows created
|
||||
|
||||
enum {
|
||||
TESTGUID = 100,
|
||||
CREATEWINDOWBYGUID = 200,
|
||||
TESTTYPE = 301,
|
||||
CREATEWINDOWOFTYPE = 402,
|
||||
DESTROYWINDOW = 500,
|
||||
REFCOUNT = 600,
|
||||
};
|
||||
};
|
||||
|
||||
inline int svc_windowCreate::testGuid(GUID g)
|
||||
{
|
||||
return _call(TESTGUID, 0, g);
|
||||
}
|
||||
|
||||
inline ifc_window *svc_windowCreate::createWindowByGuid(GUID g, ifc_window *parent)
|
||||
{
|
||||
return _call(CREATEWINDOWBYGUID, (ifc_window*)0, g, parent);
|
||||
}
|
||||
|
||||
inline int svc_windowCreate::destroyWindow(ifc_window *w)
|
||||
{
|
||||
return _call(DESTROYWINDOW, 0, w);
|
||||
}
|
||||
|
||||
inline int svc_windowCreate::testType(const wchar_t *windowtype)
|
||||
{
|
||||
return _call(TESTTYPE, 0, windowtype);
|
||||
}
|
||||
|
||||
inline ifc_window *svc_windowCreate::createWindowOfType(const wchar_t * windowtype, ifc_window *parent, int n)
|
||||
{
|
||||
return _call(CREATEWINDOWOFTYPE, (ifc_window*)0, windowtype, parent, n);
|
||||
}
|
||||
|
||||
inline int svc_windowCreate::refcount()
|
||||
{
|
||||
return _call(REFCOUNT, -1);
|
||||
}
|
||||
|
||||
class NOVTABLE svc_windowCreateI : public svc_windowCreate
|
||||
{
|
||||
public:
|
||||
virtual ~svc_windowCreateI() { }
|
||||
virtual int testGuid(GUID g) { return 0; }
|
||||
virtual ifc_window *createWindowByGuid(GUID g, ifc_window *parent) { return NULL; }
|
||||
virtual int testType(const wchar_t *windowtype) { return 0; }
|
||||
virtual ifc_window *createWindowOfType(const wchar_t *windowtype, ifc_window *parent, int n) { return NULL; }
|
||||
virtual int destroyWindow(ifc_window *w) = 0;
|
||||
|
||||
virtual int refcount() { return -1; } // FUCKO: make pure abstract
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
#include <api/service/servicei.h>
|
||||
template <class T>
|
||||
class WndCreateCreator : public waServiceFactoryT<svc_windowCreate, T> {};
|
||||
|
||||
template <class T>
|
||||
class WndCreateCreatorSingle : public waServiceFactoryTSingle<svc_windowCreate, T> {};
|
||||
|
||||
#include <api/service/svc_enum.h>
|
||||
#include <bfc/string/StringW.h>
|
||||
|
||||
class WindowCreateByGuidEnum : public SvcEnumT<svc_windowCreate>
|
||||
{
|
||||
public:
|
||||
WindowCreateByGuidEnum(GUID _g) : targetguid(_g) { }
|
||||
|
||||
protected:
|
||||
virtual int testService(svc_windowCreate *svc)
|
||||
{
|
||||
return svc->testGuid(targetguid);
|
||||
}
|
||||
|
||||
private:
|
||||
GUID targetguid;
|
||||
};
|
||||
|
||||
class WindowCreateByTypeEnum : public SvcEnumT<svc_windowCreate>
|
||||
{
|
||||
public:
|
||||
WindowCreateByTypeEnum(const wchar_t *_wtype) : wtype(_wtype) { }
|
||||
|
||||
protected:
|
||||
virtual int testService(svc_windowCreate *svc)
|
||||
{
|
||||
return svc->testType(wtype);
|
||||
}
|
||||
|
||||
private:
|
||||
StringW wtype;
|
||||
};
|
||||
#endif
|
10
Src/Wasabi/api/service/svcs/svc_xmlprov.cpp
Normal file
10
Src/Wasabi/api/service/svcs/svc_xmlprov.cpp
Normal file
|
@ -0,0 +1,10 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "svc_xmlprov.h"
|
||||
|
||||
#define CBCLASS svc_xmlProviderI
|
||||
START_DISPATCH;
|
||||
CB(TESTDESC, testDesc);
|
||||
CB(GETXMLDATA, getXmlData);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
56
Src/Wasabi/api/service/svcs/svc_xmlprov.h
Normal file
56
Src/Wasabi/api/service/svcs/svc_xmlprov.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
#ifndef _SVC_XMLPROVIDER_H
|
||||
#define _SVC_XMLPROVIDER_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <api/service/services.h>
|
||||
|
||||
class skin_xmlreaderparams;
|
||||
|
||||
class NOVTABLE svc_xmlProvider : public Dispatchable {
|
||||
public:
|
||||
static FOURCC getServiceType() { return WaSvc::XMLPROVIDER; }
|
||||
|
||||
int testDesc(const wchar_t *desc);
|
||||
const wchar_t *getXmlData(const wchar_t *desc, const wchar_t *incpath, skin_xmlreaderparams *params=NULL);
|
||||
|
||||
enum {
|
||||
TESTDESC=10,
|
||||
GETXMLDATA=20,
|
||||
};
|
||||
};
|
||||
|
||||
inline int svc_xmlProvider::testDesc(const wchar_t *desc) {
|
||||
return _call(TESTDESC, 0, desc);
|
||||
}
|
||||
|
||||
inline const wchar_t *svc_xmlProvider::getXmlData(const wchar_t *desc, const wchar_t *incpath, skin_xmlreaderparams *params) {
|
||||
return _call(GETXMLDATA, (const wchar_t *)0, desc, incpath, params);
|
||||
}
|
||||
|
||||
// derive from this one
|
||||
class NOVTABLE svc_xmlProviderI : public svc_xmlProvider {
|
||||
public:
|
||||
virtual int testDesc(const wchar_t *desc)=0;
|
||||
virtual const wchar_t *getXmlData(const wchar_t *desc, const wchar_t *incpath, skin_xmlreaderparams *params=NULL)=0;
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
#include <api/service/svc_enum.h>
|
||||
#include <bfc/string/StringW.h>
|
||||
|
||||
class XmlProviderEnum : public SvcEnumT<svc_xmlProvider> {
|
||||
public:
|
||||
XmlProviderEnum(const wchar_t *_desc) : desc(_desc) { }
|
||||
|
||||
protected:
|
||||
virtual int testService(svc_xmlProvider *svc) {
|
||||
return svc->testDesc(desc);
|
||||
}
|
||||
|
||||
private:
|
||||
StringW desc;
|
||||
};
|
||||
|
||||
#endif
|
12
Src/Wasabi/api/service/svcs/svc_xuiobject.cpp
Normal file
12
Src/Wasabi/api/service/svcs/svc_xuiobject.cpp
Normal file
|
@ -0,0 +1,12 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#include "svc_xuiobject.h"
|
||||
|
||||
#define CBCLASS svc_xuiObjectI
|
||||
START_DISPATCH;
|
||||
CB(XUI_TESTTAG, testTag);
|
||||
// CB(XUI_INSTANTIATE, instantiate);
|
||||
CB(XUI_INSTANTIATEWITHPARAMS, instantiate);
|
||||
VCB(XUI_DESTROY, destroy);
|
||||
END_DISPATCH;
|
||||
#undef CBCLASS
|
76
Src/Wasabi/api/service/svcs/svc_xuiobject.h
Normal file
76
Src/Wasabi/api/service/svcs/svc_xuiobject.h
Normal file
|
@ -0,0 +1,76 @@
|
|||
#ifndef _SVC_XUIOBJECT_H
|
||||
#define _SVC_XUIOBJECT_H
|
||||
|
||||
#include <bfc/dispatch.h>
|
||||
#include <api/service/services.h>
|
||||
#include <bfc/platform/platform.h>
|
||||
#include <bfc/string/StringW.h>
|
||||
class GuiObject;
|
||||
class skin_xmlreaderparams;
|
||||
|
||||
class NOVTABLE svc_xuiObject : public Dispatchable
|
||||
{
|
||||
public:
|
||||
static FOURCC getServiceType()
|
||||
{
|
||||
return WaSvc::XUIOBJECT;
|
||||
}
|
||||
int testTag( const wchar_t *xmltag );
|
||||
GuiObject *instantiate( const wchar_t *xmltag, ifc_xmlreaderparams *params = NULL );
|
||||
void destroy( GuiObject *g );
|
||||
|
||||
enum
|
||||
{
|
||||
XUI_TESTTAG = 10,
|
||||
//XUI_INSTANTIATE=20, // RETIRED
|
||||
XUI_INSTANTIATEWITHPARAMS = 25,
|
||||
XUI_DESTROY = 30,
|
||||
};
|
||||
};
|
||||
|
||||
inline int svc_xuiObject::testTag(const wchar_t *xmltag) {
|
||||
return _call(XUI_TESTTAG, 0, xmltag);
|
||||
}
|
||||
|
||||
inline GuiObject *svc_xuiObject::instantiate(const wchar_t *xmltag, ifc_xmlreaderparams *params) {
|
||||
return _call(XUI_INSTANTIATEWITHPARAMS, (GuiObject *)NULL, xmltag, params);
|
||||
}
|
||||
|
||||
inline void svc_xuiObject::destroy(GuiObject *o) {
|
||||
_voidcall(XUI_DESTROY, o);
|
||||
}
|
||||
|
||||
// derive from this one
|
||||
class svc_xuiObjectI : public svc_xuiObject
|
||||
{
|
||||
public:
|
||||
virtual int testTag(const wchar_t *xmltag)=0;
|
||||
virtual GuiObject *instantiate(const wchar_t *xmltag, ifc_xmlreaderparams *params=NULL)=0;
|
||||
virtual void destroy(GuiObject *o)=0;
|
||||
|
||||
protected:
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
#include <api/service/servicei.h>
|
||||
template <class T>
|
||||
class XuiObjectCreator : public waServiceFactoryTSingle<svc_xuiObject, T> {
|
||||
public:
|
||||
virtual const wchar_t *svc_getTestString() { return T::xuisvc_getXmlTag(); }
|
||||
};
|
||||
|
||||
#include <api/service/svc_enum.h>
|
||||
#include <bfc/string/StringW.h>
|
||||
|
||||
class XuiObjectSvcEnum : public SvcEnumT<svc_xuiObject> {
|
||||
public:
|
||||
XuiObjectSvcEnum(const wchar_t *xmltag) : tag(xmltag) {}
|
||||
protected:
|
||||
virtual int testService(svc_xuiObject *svc) {
|
||||
return (svc->testTag(tag));
|
||||
}
|
||||
private:
|
||||
StringW tag;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue