108 lines
2.4 KiB
C++
108 lines
2.4 KiB
C++
// DoubleParamPlugin.cpp : Defines the entry point for the console application.
|
|
//
|
|
|
|
#include "DoubleParamDialog.h"
|
|
|
|
void RegisterBehaviorDeclarations(XObjectDeclarationArray *reg)
|
|
{
|
|
}
|
|
|
|
int CKGetPluginInfoCount() { return 1; }
|
|
|
|
CKPluginInfo g_PluginInfo;
|
|
CKGUID DOUBLE_PLUGIN_GUID(0x12345678, 0x2693b6c5);
|
|
CKGUID CKPGUID_DOUBLE (0x05461395, 0x17854632);
|
|
|
|
|
|
CKERROR CKDoubleCreator(CKParameter *param) {
|
|
|
|
if (!param) return CKERR_INVALIDPARAMETER;
|
|
double d = 0.0;
|
|
param->SetValue(&d);
|
|
return CK_OK;
|
|
}
|
|
|
|
int CKStringFunc (CKParameter *p,CKSTRING value,CKBOOL ReadFrom) {
|
|
if (!p) return 0;
|
|
double d;
|
|
if (ReadFrom) {
|
|
if (value) {
|
|
sscanf(value,"%lf",&d);
|
|
p->SetValue(&d);
|
|
return 0;
|
|
}
|
|
} else {
|
|
char temp[64];
|
|
p->GetValue((void*)&d,FALSE);
|
|
sprintf(temp,"%lf",d);
|
|
if (value)
|
|
strcpy(value,temp);
|
|
return strlen(temp)+1;
|
|
}
|
|
return 0;
|
|
|
|
}
|
|
|
|
WIN_HANDLE CKDoubleUIFunc (CKParameter *param,WIN_HANDLE ParentWindow,CKRECT *rect) {
|
|
|
|
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
|
DoubleParamDialog* dlg_modeless=new DoubleParamDialog(param);
|
|
dlg_modeless->Create(IDD_DIALOG1,CWnd::FromHandle((HWND)ParentWindow));
|
|
return dlg_modeless->GetSafeHwnd();
|
|
}
|
|
|
|
CKERROR InitInstance(CKContext* context) {
|
|
CKParameterManager* pm = context->GetParameterManager();
|
|
|
|
CKParameterTypeDesc pDouble;
|
|
pDouble.Guid = CKPGUID_DOUBLE;
|
|
pDouble.DerivedFrom = CKGUID(0,0);
|
|
pDouble.TypeName = "Double";
|
|
pDouble.DefaultSize = sizeof(double);
|
|
pDouble.CreateDefaultFunction = CKDoubleCreator;
|
|
pDouble.DeleteFunction = NULL;
|
|
pDouble.SaveLoadFunction = NULL;
|
|
pDouble.CheckFunction = NULL;
|
|
pDouble.StringFunction = CKStringFunc;
|
|
pDouble.UICreatorFunction = CKDoubleUIFunc;
|
|
|
|
pm->RegisterParameterType(&pDouble);
|
|
|
|
return CK_OK;
|
|
}
|
|
|
|
CKERROR ExitInstance(CKContext* context)
|
|
{
|
|
CKParameterManager* pm = context->GetParameterManager();
|
|
|
|
return CK_OK;
|
|
}
|
|
|
|
|
|
|
|
CKPluginInfo* CKGetPluginInfo(int Index)
|
|
{
|
|
|
|
switch (Index)
|
|
{
|
|
case (0) :
|
|
{
|
|
g_PluginInfo.m_Author = "Virtools";
|
|
g_PluginInfo.m_Description = "Sample of new Parameter for Virtools";
|
|
g_PluginInfo.m_Extension = "";
|
|
g_PluginInfo.m_Type = CKPLUGIN_EXTENSION_DLL;
|
|
g_PluginInfo.m_Version = 0x000001;
|
|
g_PluginInfo.m_InitInstanceFct = InitInstance;
|
|
g_PluginInfo.m_ExitInstanceFct = ExitInstance;
|
|
g_PluginInfo.m_GUID = DOUBLE_PLUGIN_GUID;
|
|
g_PluginInfo.m_Summary = "Interface Behaviors";
|
|
}
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
|
|
return &g_PluginInfo;
|
|
}
|