237 lines
7.6 KiB
C++
237 lines
7.6 KiB
C++
#include "StdAfx.h"
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// functions prototypes
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
CKERROR CreateGetSelectionSetPropertiesProto(CKBehaviorPrototype **pproto);
|
|
int GetSelectionSetPropertiesBB(const CKBehaviorContext& behcontext);
|
|
CKERROR GetSelectionSetPropertiesBBCallBack(const CKBehaviorContext& behcontext);
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// enums
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
enum INS
|
|
{
|
|
eINS_IN,
|
|
};
|
|
|
|
enum OUTS
|
|
{
|
|
eOUTS_SUCCESS,
|
|
eOUTS_FAILED,
|
|
};
|
|
|
|
enum PINS
|
|
{
|
|
ePINS_NAME,
|
|
};
|
|
|
|
enum POUTS
|
|
{
|
|
ePOUT_GROUP,
|
|
ePOUT_PRIORITY,
|
|
ePOUT_EXTERNAL,
|
|
ePOUT_LOADED,
|
|
ePOUT_HIERARCHYREBUILD,
|
|
ePOUT_PATH,
|
|
ePOUT_LOADWITHCMO,
|
|
ePOUT_SAVEWITHCMO,
|
|
#ifdef ENABLE_REPLACE_AND_SHARE
|
|
ePOUT_LOADMODE,
|
|
#endif
|
|
};
|
|
|
|
enum PSETTINGS
|
|
{
|
|
//ePSETTINGS_TARGETBYNAME, //use group instead of name
|
|
ePSETTINGS_FLAGS,
|
|
};
|
|
|
|
enum PROPERTIESFLAGS
|
|
{
|
|
ePF_GROUP = 0,
|
|
ePF_PRIORITY = 1,
|
|
ePF_EXTERNAL = 2,
|
|
ePF_LOADED = 4,
|
|
ePF_HIERARCHYREBUILD = 8,
|
|
ePF_PATH = 16,
|
|
ePF_LOADWITHCMO = 32,
|
|
ePF_SAVEWITHCMO = 64,
|
|
#ifdef ENABLE_REPLACE_AND_SHARE
|
|
ePF_LOADMODE = 128,
|
|
#endif
|
|
};
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// behavior
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
CKObjectDeclaration* FillBehaviorGetSelectionSetProperties()
|
|
{
|
|
CKObjectDeclaration *od = CreateCKObjectDeclaration(NAME_GETSELECTIONSETPROPERTIES);
|
|
od->SetDescription("Get a Selection Set's Properties.");
|
|
|
|
/* rem:
|
|
<SPAN CLASS=in>On : </SPAN>Activates the Progression Bar.<BR>
|
|
<SPAN CLASS=in>Off : </SPAN>Deactivates the Progression Bar.<BR>
|
|
<SPAN CLASS=in>Pause/Resume : </SPAN>Pause/Resume the Progression Bar.<BR>
|
|
<BR>
|
|
<SPAN CLASS=out>Exit On : </SPAN>This output is activated after entering by 'On'.<BR>
|
|
<SPAN CLASS=out>Exit Off : </SPAN>This output is activated after entering by 'Off'.<BR>
|
|
<SPAN CLASS=out>Exit Off : </SPAN>This output is activated after entering by 'Pause/Resume'.<BR>
|
|
<BR>
|
|
<SPAN CLASS=setting>Size Mode : </SPAN> - <BR>
|
|
<SPAN CLASS=setting>Orientation : </SPAN> - <BR>
|
|
<BR>
|
|
*/
|
|
/* Note:
|
|
Activate the "on" entry each time the target of the behavior is modified.
|
|
*/
|
|
od->SetType( CKDLL_BEHAVIORPROTOTYPE);
|
|
od->SetGuid(BBGUID_GETSELECTIONSETPROPERTIES);
|
|
od->SetAuthorGuid(VIRTOOLS_GUID);
|
|
od->SetAuthorName("Virtools");
|
|
od->SetVersion(0x00010000);
|
|
od->SetCreationFunction(CreateGetSelectionSetPropertiesProto);
|
|
od->SetCompatibleClassId(CKCID_BEOBJECT);
|
|
od->SetCategory("Selection Set");
|
|
return od;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
CKERROR CreateGetSelectionSetPropertiesProto(CKBehaviorPrototype **pproto)
|
|
{
|
|
CKBehaviorPrototype *proto = CreateCKBehaviorPrototype(NAME_GETSELECTIONSETPROPERTIES);
|
|
if(!proto) return CKERR_OUTOFMEMORY;
|
|
|
|
proto->DeclareInput("Save");
|
|
proto->DeclareOutput("Success");
|
|
proto->DeclareOutput("Failed");
|
|
|
|
proto->DeclareInParameter(STR_SELECTIONSET, CKPGUID_SELECTIONSET,0);
|
|
|
|
proto->DeclareOutParameter("Group",CKPGUID_GROUP,0);
|
|
proto->DeclareOutParameter("Priority",CKPGUID_INT,0);
|
|
proto->DeclareOutParameter("External",CKPGUID_BOOL,0);
|
|
proto->DeclareOutParameter("Loaded",CKPGUID_BOOL,0);
|
|
proto->DeclareOutParameter("Hierarchy Rebuild",CKPGUID_BOOL,0);
|
|
proto->DeclareOutParameter("Path",CKPGUID_STRING,0);
|
|
proto->DeclareOutParameter("Load with cmo",CKPGUID_BOOL,0);
|
|
proto->DeclareOutParameter("Save with cmo",CKPGUID_BOOL,0);
|
|
#ifdef ENABLE_REPLACE_AND_SHARE
|
|
proto->DeclareOutParameter("Replace&Share",CKPGUID_BOOL,0);
|
|
#endif
|
|
|
|
//proto->DeclareSetting(STR_BYNAME,CKPGUID_BOOL,FALSE);
|
|
proto->DeclareSetting("Properties",PARAMGUID_SETPROPERTIES,"External,Loaded,Path,Load with cmo,Save with cmo");
|
|
|
|
proto->SetFunction(GetSelectionSetPropertiesBB);
|
|
proto->SetBehaviorCallbackFct(GetSelectionSetPropertiesBBCallBack);
|
|
proto->SetBehaviorFlags(BBFLAGS);
|
|
|
|
*pproto = proto;
|
|
return CK_OK;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
int GetSelectionSetPropertiesBB(const CKBehaviorContext& behcontext)
|
|
{
|
|
CKBehavior* beh = behcontext.Behavior;
|
|
SelectionSetManager* setmgr = (SelectionSetManager*)behcontext.Context->GetManagerByGuid(SELECTIONSETMANAGER_GUID);
|
|
|
|
if(beh->IsInputActive(eINS_IN))
|
|
{
|
|
//BOOL byname=FALSE;
|
|
CKGroup* set = GetSetTarget();//(beh,setmgr,byname);
|
|
//if (!byname)
|
|
beh->SetOutputParameterObject(ePOUT_GROUP,set);
|
|
|
|
SelectionSetData* data = setmgr->GetSelectionSetData(set);
|
|
if (data)
|
|
{
|
|
beh->ActivateOutput(eOUTS_SUCCESS); //success
|
|
|
|
DWORD flags;
|
|
beh->GetLocalParameterValue(ePSETTINGS_FLAGS,&flags);
|
|
if (flags & ePF_PRIORITY)
|
|
beh->SetOutputParameterValue(ePOUT_PRIORITY,&data->m_Priority);
|
|
if (flags & ePF_EXTERNAL)
|
|
{
|
|
BOOL external = data->CheckSaveExternal(setmgr);
|
|
beh->SetOutputParameterValue(ePOUT_EXTERNAL,&external);
|
|
}
|
|
if (flags & ePF_LOADED)
|
|
{
|
|
BOOL loaded = (data->HasFlags(SelectionSetData::fSetFlags_Loaded))?TRUE:FALSE;
|
|
beh->SetOutputParameterValue(ePOUT_LOADED,&loaded);
|
|
}
|
|
if (flags & ePF_HIERARCHYREBUILD)
|
|
{
|
|
BOOL hierarchy = (data->HasFlags(SelectionSetData::fSetFlags_RebuildHierarchy))?TRUE:FALSE;
|
|
beh->SetOutputParameterValue(ePOUT_HIERARCHYREBUILD,&hierarchy);
|
|
}
|
|
if (flags & ePF_PATH)
|
|
{
|
|
beh->SetOutputParameterValue(ePOUT_PATH,data->m_Path.Str());
|
|
}
|
|
if (flags & ePF_LOADWITHCMO)
|
|
{
|
|
BOOL loadwithcmo = (data->HasFlags(SelectionSetData::fSetFlags_LoadWithCmo))?TRUE:FALSE;
|
|
beh->SetOutputParameterValue(ePOUT_LOADWITHCMO,&loadwithcmo);
|
|
}
|
|
if (flags & ePF_SAVEWITHCMO)
|
|
{
|
|
BOOL savewithcmo = (data->HasFlags(SelectionSetData::fSetFlags_SaveWithCmo))?TRUE:FALSE;
|
|
beh->SetOutputParameterValue(ePOUT_SAVEWITHCMO,&savewithcmo);
|
|
}
|
|
#ifdef ENABLE_REPLACE_AND_SHARE
|
|
if (flags & ePF_LOADMODE)
|
|
{
|
|
BOOL replaceshare = (data->HasFlags(SelectionSetData::fSetFlags_ReplaceAndShare))?TRUE:FALSE;
|
|
beh->SetOutputParameterValue(ePOUT_LOADMODE,&replaceshare);
|
|
}
|
|
#endif
|
|
}
|
|
else
|
|
beh->ActivateOutput(eOUTS_FAILED); //incomplete yet
|
|
}
|
|
return CKBR_OK;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
CKERROR GetSelectionSetPropertiesBBCallBack(const CKBehaviorContext& behcontext)
|
|
{
|
|
CKBehavior *beh = behcontext.Behavior;
|
|
switch(behcontext.CallbackMessage)
|
|
{
|
|
case CKM_BEHAVIORLOAD:
|
|
case CKM_BEHAVIORSETTINGSEDITED:
|
|
{
|
|
DWORD flags;
|
|
beh->GetLocalParameterValue(ePSETTINGS_FLAGS,&flags);
|
|
|
|
beh->EnableOutputParameter(ePOUT_PRIORITY ,flags & ePF_PRIORITY);
|
|
beh->EnableOutputParameter(ePOUT_EXTERNAL ,flags & ePF_EXTERNAL);
|
|
beh->EnableOutputParameter(ePOUT_LOADED ,flags & ePF_LOADED);
|
|
beh->EnableOutputParameter(ePOUT_HIERARCHYREBUILD ,flags & ePF_HIERARCHYREBUILD);
|
|
beh->EnableOutputParameter(ePOUT_PATH ,flags & ePF_PATH);
|
|
beh->EnableOutputParameter(ePOUT_LOADWITHCMO ,flags & ePF_LOADWITHCMO);
|
|
beh->EnableOutputParameter(ePOUT_SAVEWITHCMO ,flags & ePF_SAVEWITHCMO);
|
|
#ifdef ENABLE_REPLACE_AND_SHARE
|
|
beh->EnableOutputParameter(ePOUT_LOADMODE ,flags & ePF_LOADMODE);
|
|
#endif
|
|
//TargetableSelectionSetBBCallBack(behcontext);
|
|
}
|
|
break;
|
|
}
|
|
return CKBR_OK;
|
|
}
|