188 lines
9.2 KiB
C++
188 lines
9.2 KiB
C++
#include "StdAfx.h"
|
|
#include "VSLManager.h"
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
//defines
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
#define SELECTIONSET_VSL_SPACE 1001001
|
|
|
|
#define DECLAREMETHOD_2fake(classe,ret,method,arg1,arg2) { \
|
|
typedef ret (classe::*fptr)(arg1,arg2); \
|
|
fptr var = FPTR(&classe::method); \
|
|
TPtrToRoutine ptr; \
|
|
ptr.CreateMethodPtr((void**) &var); \
|
|
VSLM->RegisterMethod(#classe,#method,FALSE,FALSE,ptr,VCALLTYPE_STDCALL,2,#ret,"XObjectPointerArray&",#arg2);\
|
|
}
|
|
|
|
#define DECLAREMETHOD_2fake2(classe,ret,method,arg1,arg2) { \
|
|
typedef ret (classe::*fptr)(arg1,arg2); \
|
|
fptr var = FPTR(&classe::method); \
|
|
TPtrToRoutine ptr; \
|
|
ptr.CreateMethodPtr((void**) &var); \
|
|
VSLM->RegisterMethod(#classe,#method,FALSE,FALSE,ptr,VCALLTYPE_STDCALL,2,#ret,#arg1,"IntArray*");\
|
|
}
|
|
|
|
#define DECLAREMETHOD_1fake(classe,ret,method,arg1) { \
|
|
typedef ret (classe::*fptr)(arg1); \
|
|
fptr var = FPTR(&classe::method); \
|
|
TPtrToRoutine ptr; \
|
|
ptr.CreateMethodPtr((void**) &var); \
|
|
VSLM->RegisterMethod(#classe,#method,FALSE,FALSE,ptr,VCALLTYPE_STDCALL,1,#ret,"XObjectPointerArray&");\
|
|
}
|
|
|
|
#define DECLAREMETHOD_5fake(classe,ret,method,arg1,arg2,arg3,arg4,arg5) { \
|
|
typedef ret (classe::*fptr)(arg1,arg2,arg3,arg4,arg5); \
|
|
fptr var = FPTR(&classe::method); \
|
|
TPtrToRoutine ptr; \
|
|
ptr.CreateMethodPtr((void**) &var); \
|
|
VSLM->RegisterMethod(#classe,#method,FALSE,FALSE,ptr,VCALLTYPE_STDCALL,5,#ret,"XObjectPointerArray&",#arg2,#arg3,#arg4,#arg5);\
|
|
}
|
|
|
|
#define DECLAREMETHOD_5_WITH_DEF_VALSfake(classe,ret,method,arg1,defVal1,arg2,defVal2,arg3,defVal3,arg4,defVal4,arg5,defVal5) { \
|
|
typedef ret (classe::*fptr)(arg1,arg2,arg3,arg4,arg5); \
|
|
fptr var = FPTR(&classe::method); \
|
|
TPtrToRoutine ptr; \
|
|
ptr.CreateMethodPtr((void**) &var); \
|
|
VSLM->RegisterMethod(#classe,#method,FALSE,FALSE,ptr,VCALLTYPE_STDCALL,5,#ret,"IntArray*" " = "#defVal1,#arg2" = "#defVal2,#arg3" = "#defVal3,#arg4" = "#defVal4,#arg5" = "#defVal5);\
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// manager bind
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
CKGUID GetSelectionSetManagerGuid()
|
|
{
|
|
return SELECTIONSETMANAGER_GUID;
|
|
}
|
|
|
|
SelectionSetManager* GetSelectionSetManager(ScriptContext& context)
|
|
{
|
|
return (SelectionSetManager*)context.m_Context->GetManagerByGuid(SELECTIONSETMANAGER_GUID);
|
|
}
|
|
|
|
CKERROR SelectionSetManager::Bind()
|
|
{
|
|
//STARTVSLBIND(m_Context);
|
|
using namespace VSL;
|
|
VSLManager *VSLM = (VSLManager *)m_Context->GetManagerByGuid(VSLMANAGER_GUID);
|
|
if (VSLM) {
|
|
//VSLM->RegisterSpace();
|
|
VSLM->m_ClassManager.RegisterSpace(SELECTIONSET_VSL_SPACE);
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
// Register the type
|
|
/////////////////////////////////////////////////////////////////////
|
|
DECLAREPOINTERTYPEALIAS(SelectionSetManager, "SelectionSetManager");
|
|
// DECLAREDOCSDKLINK(CKVideo, "../SDK/Doc/SDKHelp.chm::/Video/CKVideo.html");
|
|
DECLAREINHERITANCESIMPLE("SelectionSetManager", "CKBaseManager");
|
|
//REGISTERVSLGUID(SELECTIONSETMANAGER_GUID, "SelectionSetManager");
|
|
|
|
//BIND MANAGER********************
|
|
//bind get guid func
|
|
DECLAREFUN_C_0(CKGUID,GetSelectionSetManagerGuid);
|
|
DECLAREFUNALIAS_C_1("GetSelectionSetManager",SelectionSetManager*,GetSelectionSetManager,ScriptContext& context);
|
|
//bind cast manager func
|
|
DECLARESTATIC_1(SelectionSetManager, SelectionSetManager*,Cast,CKBaseManager*);
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
// Register the structure
|
|
/////////////////////////////////////////////////////////////////////
|
|
DECLAREPOINTERTYPEALIAS(SelectionSetData, "SelectionSetData" );
|
|
DECLAREMEMBER(SelectionSetData, DWORD, m_Flags );
|
|
DECLAREMEMBER(SelectionSetData, XString, m_Name );
|
|
DECLAREMEMBER(SelectionSetData, XString, m_Path );
|
|
DECLAREMEMBER(SelectionSetData, int, m_Priority );
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
// Register the enumerations
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
DECLAREENUM("ESetLoadResult");
|
|
DECLAREENUMVALUE("ESetLoadResult", "eSetLoad_InvalidParameter", -2);
|
|
DECLAREENUMVALUE("ESetLoadResult", "eSetLoad_Failed", -1);
|
|
DECLAREENUMVALUE("ESetLoadResult", "eSetLoad_Success", 0);
|
|
DECLAREENUMVALUE("ESetLoadResult", "eSetLoad_WebDownload", 1);
|
|
|
|
|
|
DECLAREENUM("ESetFieldChange");
|
|
// DECLAREDOCSDKLINK(CK_CLASSID, "../SDK/Doc/SDKHelp.chm::/Video/CK_VIDEO_TYPE.html");
|
|
DECLAREENUMVALUE("ESetFieldChange", "eSetField_Toggle", -1);
|
|
DECLAREENUMVALUE("ESetFieldChange", "eSetField_Remove", 0);
|
|
DECLAREENUMVALUE("ESetFieldChange", "eSetField_Add", 1);
|
|
|
|
|
|
DECLAREENUM("FSetPart");
|
|
DECLAREENUMVALUE("FSetPart", "fSetPart_Name", 1);
|
|
DECLAREENUMVALUE("FSetPart", "fSetPart_Priority", 2);
|
|
DECLAREENUMVALUE("FSetPart", "fSetPart_Options", 4);
|
|
DECLAREENUMVALUE("FSetPart", "fSetPart_LoadState", 8);
|
|
DECLAREENUMVALUE("FSetPart", "fSetPart_Path", 16);
|
|
DECLAREENUMVALUE("FSetPart", "fSetPart_SourceControl", 32);
|
|
DECLAREENUMVALUE("FSetPart", "fSetPart_Content", 64);
|
|
DECLAREENUMVALUE("FSetPart", "fSetPart_RebuildHierarchy", 128);
|
|
DECLAREENUMVALUE("FSetPart", "fSetPart_LoadWithCmo", 256);
|
|
DECLAREENUMVALUE("FSetPart", "fSetPart_SaveWithCmo", 512);
|
|
DECLAREENUMVALUE("FSetPart", "fSetPart_LoadMode", 1024);
|
|
DECLAREENUMVALUE("FSetPart", "fSetPart_All", 49151);//0x0bfff
|
|
|
|
|
|
DECLAREENUM("FSetFlags");
|
|
DECLAREENUMVALUE("FSetFlags", "fSetFlags_UseGlobalOptions", 0);
|
|
DECLAREENUMVALUE("FSetFlags", "fSetFlags_IgnoreAndNoShare", 0);
|
|
DECLAREENUMVALUE("FSetFlags", "fSetFlags_ForceSaveAsExternal", 1);
|
|
DECLAREENUMVALUE("FSetFlags", "fSetFlags_ForceSaveAsInternal", 2);
|
|
DECLAREENUMVALUE("FSetFlags", "fSetFlags_RebuildHierarchy", 4);
|
|
DECLAREENUMVALUE("FSetFlags", "fSetFlags_LoadWithCmo", 8);
|
|
DECLAREENUMVALUE("FSetFlags", "fSetFlags_SaveWithCmo", 16);
|
|
DECLAREENUMVALUE("FSetFlags", "fSetFlags_ReplaceAndShare", 32);
|
|
DECLAREENUMVALUE("FSetFlags", "fSetFlags_Loaded", 64);
|
|
//DECLAREENUMVALUE("FSetFlags", "fSetFlags_Temp_Recreated", 0x40000000);
|
|
DECLAREENUMVALUE("FSetFlags", "fSetFlags_Temp_External", 0x80000000);
|
|
//DECLAREENUMVALUE("FSetFlags", "fSetFlags_Temp_NotToSave", 0x40000040);
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
// Register the methods
|
|
/////////////////////////////////////////////////////////////////////
|
|
DECLAREMETHOD_4_WITH_DEF_VALS(SelectionSetManager,CKGroup*,CreateSelectionSet,XString* iName,0,XString* iPath,0,BOOL iNotify,TRUE,BOOL iLoaded,TRUE);
|
|
DECLAREMETHOD_5_WITH_DEF_VALSfake(SelectionSetManager,CKGroup*,CreateSelectionSet,XObjectArray* iArray,NODEFAULT,XString* iName,NODEFAULT,XString* iPath,0,BOOL iNotify,TRUE,BOOL iLoaded,TRUE);
|
|
DECLAREMETHOD_2(SelectionSetManager,CKGroup* ,CreateSelectionSet ,CKGroup* iGrp,XString* iPath);
|
|
DECLAREMETHOD_5_WITH_DEF_VALS(SelectionSetManager,ESetLoadResult,LoadSelectionSet ,CKGroup*& ioGrp,NODEFAULT,SelectionSetData* iData,0,BOOL iDynamic,FALSE,BOOL iUserManualLoad,FALSE,XString* oErrorLog,0);
|
|
DECLAREMETHOD_3_WITH_DEF_VALS(SelectionSetManager,BOOL,SaveSelectionSet ,CKGroup* iGrp,NODEFAULT,BOOL iForceNewPath,FALSE,XString* oErrorLog,0);
|
|
|
|
DECLAREMETHOD_2fake(SelectionSetManager, BOOL ,UnloadSets ,XArray<CKGroup*>& iGrps,BOOL iDeleteGroup);
|
|
DECLAREMETHOD_2fake2(SelectionSetManager, BOOL ,AddObjectsToSet ,CKGroup* iGrp ,XObjectArray* iArray);
|
|
DECLAREMETHOD_2fake(SelectionSetManager, void ,GetSelectionSets ,XArray<CKGroup*>& iSets,BOOL iSortedByPriority);
|
|
DECLAREMETHOD_1fake(SelectionSetManager, BOOL ,CompactSets ,XArray<CKGroup*>& iGrps);
|
|
|
|
DECLAREMETHOD_1(SelectionSetManager, CKGroup* ,GetSelectionSetByName ,char* iName);
|
|
DECLAREMETHOD_3(SelectionSetManager, BOOL ,SetSelectionSetName ,CKGroup* iGrp,XString* ioName,BOOL iSendNotification)
|
|
|
|
DECLAREMETHOD_2(SelectionSetManager, BOOL ,GetSelectionSetPath ,CKGroup* iGrp,XString& oPath);
|
|
DECLAREMETHOD_2(SelectionSetManager, BOOL ,SetSelectionSetPath ,CKGroup* iGrp,XString& iPath);
|
|
|
|
//maybe used to check if a group is a set or not
|
|
DECLAREMETHOD_1(SelectionSetManager, SelectionSetData* ,GetSelectionSetData ,CKGroup* iGrp); //Gets the selection sets datas
|
|
|
|
//properties
|
|
DECLAREMETHOD_5fake(SelectionSetManager, CKERROR ,SetField ,XArray<CKGroup*>& iGrps,ESetFieldChange iChange,FSetFlags iDataFlags,BOOL iNotify,FSetPart iViewFlags);
|
|
DECLAREMETHOD_2fake(SelectionSetManager, CKERROR ,SetRebuildHierarchy ,XArray<CKGroup*>& iGrps,ESetFieldChange iChange);
|
|
DECLAREMETHOD_2fake(SelectionSetManager, CKERROR ,SetLoadWithCmo ,XArray<CKGroup*>& iGrps,ESetFieldChange iChange);
|
|
DECLAREMETHOD_2fake(SelectionSetManager, CKERROR ,SetSaveWithCmo ,XArray<CKGroup*>& iGrps,ESetFieldChange iChange);
|
|
DECLAREMETHOD_2fake(SelectionSetManager, CKERROR ,SetSetPriority ,XArray<CKGroup*>& iGrps,int iPriority);
|
|
|
|
}
|
|
|
|
return CK_OK;
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
CKERROR SelectionSetManager::UnBind()
|
|
{
|
|
VSLManager* vslman = (VSLManager*)m_Context->GetManagerByGuid(VSLMANAGER_GUID);
|
|
if (!vslman)
|
|
return CKERR_INVALIDPARAMETER;
|
|
vslman->m_ClassManager.UnregisterSpace(SELECTIONSET_VSL_SPACE);
|
|
return CK_OK;
|
|
}
|