#include "ortoolplugs_tool.h"
#define ORTOOLPLUGS__CLASS ORTOOLPLUGS__CLASSNAME
#define ORTOOLPLUGS__LABEL "Plugs"
#define ORTOOLPLUGS__DESC "FBSDK - Tool Plugs Description"
ORTOOLPLUGS__LABEL,
ORTOOLPLUGS__DESC,
#define MAX_BUFFER_LINE 15 //Used to determine the maximum line count in the memo
bool ORToolPlugs::FBCreate()
{
StartSize[1] = 415;
SetControl("ConnNotifyLabel", mConnNotifyLabel);
mConnNotifyLabel.Caption = "Connection Notify Events:";
SetControl("ConnNotify", mConnNotify);
SetControl("ConnStateNotifyLabel", mConnStateNotifyLabel);
mConnStateNotifyLabel.Caption = "Connection State Notify Events:";
SetControl("ConnStateNotify", mConnStateNotify);
SetControl("ConnDataNotifyLabel", mConnDataNotifyLabel);
mConnDataNotifyLabel.Caption = "Connection Data Notify Events:";
SetControl("ConnDataNotify", mConnDataNotify);
OnShow.Add(
this, (
FBCallback)&ORToolPlugs::EventToolShow);
OnIdle.Add(
this, (
FBCallback)&ORToolPlugs::EventToolIdle);
OnResize.Add(
this, (
FBCallback)&ORToolPlugs::EventToolResize);
OnPaint.Add(
this, (
FBCallback)&ORToolPlugs::EventToolPaint);
OnInput.Add(
this, (
FBCallback)&ORToolPlugs::EventToolInput);
return true;
}
void ORToolPlugs::FBDestroy()
{
OnShow.Remove (
this, (
FBCallback) &ORToolPlugs::EventToolShow );
OnIdle.Remove (
this, (
FBCallback) &ORToolPlugs::EventToolIdle );
OnPaint.Remove (
this, (
FBCallback) &ORToolPlugs::EventToolPaint );
OnInput.Remove (
this, (
FBCallback) &ORToolPlugs::EventToolInput );
OnResize.Remove (
this, (
FBCallback) &ORToolPlugs::EventToolResize);
}
{
FBEventConnectionNotify lEvent(pEvent);
FBString lText;
char lTmp[32];
FBPlug* lPlug;
static int lCounter = 0;
sprintf( lTmp, "%d", lCounter );
lText += lTmp;
lText += ": Action=";
if (lEvent.SrcPlug)
{
if (lEvent.SrcPlug->Is(FBProperty::TypeInfo))
{
lPlug = lEvent.SrcPlug->GetOwner();
lText += ", Src=";
lText += ((FBComponent*)lPlug)->Name;
lText += ".";
lPlug = lEvent.SrcPlug;
lText += ((FBProperty*)lPlug)->GetName();
lText += "(";
sprintf( lTmp, "%d", (int)lEvent.SrcIndex );
lText += lTmp;
lText += ")";
}
else if (lEvent.SrcPlug->Is(FBComponent::TypeInfo))
{
lPlug = lEvent.SrcPlug;
lText += ", Src=";
lText += ((FBComponent*)lPlug)->Name;
lText += "(";
sprintf( lTmp, "%d", (int)lEvent.SrcIndex );
lText += lTmp;
lText += ")";
}
}
if (lEvent.DstPlug)
{
if (lEvent.DstPlug->Is(FBProperty::TypeInfo))
{
lPlug = lEvent.DstPlug->GetOwner();
lText += ", Dst=";
lText += ((FBComponent*)lPlug)->Name;
lText += ".";
lPlug = lEvent.DstPlug;
lText += ((FBProperty*)lPlug)->GetName();
}
else if (lEvent.DstPlug->Is(FBComponent::TypeInfo))
{
lPlug = lEvent.DstPlug;
lText += ", Dst=";
lText += ((FBComponent*)lPlug)->Name;
}
}
if (lEvent.NewPlug)
{
if (lEvent.NewPlug->Is(FBProperty::TypeInfo))
{
lPlug = lEvent.NewPlug->GetOwner();
lText += ", New=";
lText += ((FBComponent*)lPlug)->Name;
lText += ".";
lPlug = lEvent.NewPlug;
lText += ((FBProperty*)lPlug)->GetName();
}
else if (lEvent.NewPlug->Is(FBComponent::TypeInfo))
{
lPlug = lEvent.NewPlug;
lText += ", New=";
lText += ((FBComponent*)lPlug)->Name;
}
}
lText += ", Type=";
lText += "\n";
FBStringList lLines;
mConnNotify.GetStrings(&lLines);
if( lLines.GetCount() >= MAX_BUFFER_LINE ) lLines.Remove(lLines.GetAt(0));
lLines.Add(lText);
mConnNotify.SetStrings(&lLines);
lCounter++;
mConnNotify.Refresh();
}
{
FBEventConnectionStateNotify lEvent(pEvent);
FBString lText;
char lTmp[32];
FBPlug* lPlug;
static int lCounter = 0;
sprintf( lTmp, "%d", lCounter );
lText += lTmp;
lText += ": Action=";
if (lEvent.Plug)
{
if (lEvent.Plug->Is(FBProperty::TypeInfo))
{
lPlug = lEvent.Plug->GetOwner();
lText += ", Plug=";
lText += ((FBComponent*)lPlug)->Name;
lText += ".";
lPlug = lEvent.Plug;
lText += ((FBProperty*)lPlug)->GetName();
}
else if (lEvent.Plug->Is(FBComponent::TypeInfo))
{
lPlug = lEvent.Plug;
lText += ", Plug=";
lText += ((FBComponent*)lPlug)->Name;
}
}
lText += ", Data=";
sprintf(lTmp, "0x%lX", lEvent.GetData());
lText += lTmp;
lText += ", OldData=";
sprintf(lTmp, "0x%lX", lEvent.GetOldData());
lText += lTmp;
FBStringList lLines;
mConnStateNotify.GetStrings(&lLines);
if( lLines.GetCount() >= MAX_BUFFER_LINE ) lLines.Remove(lLines.GetAt(0));
lLines.Add(lText);
mConnStateNotify.SetStrings(&lLines);
lCounter++;
mConnStateNotify.Refresh();
}
{
FBEventConnectionDataNotify lEvent(pEvent);
FBString lText;
char lTmp[32];
FBPlug* lPlug;
static int lCounter = 0;
sprintf( lTmp, "%d", lCounter );
lText += lTmp;
lText += ": Action=";
if( lEvent.Plug )
{
if (lEvent.Plug->Is(FBProperty::TypeInfo))
{
lPlug = lEvent.Plug->GetOwner();
lText += ", Plug=";
lText += ((FBComponent*)lPlug)->Name;
lText += ".";
lPlug = lEvent.Plug;
lText += ((FBProperty*)lPlug)->GetName();
}
else if (lEvent.Plug->Is(FBComponent::TypeInfo))
{
lPlug = lEvent.Plug;
lText += ", Plug=";
lText += ((FBComponent*)lPlug)->Name;
}
}
lText += ", Data=";
sprintf(lTmp, "0x%lX", lEvent.GetData());
lText += lTmp;
lText += ", OldData=";
sprintf(lTmp, "0x%lX", lEvent.GetOldData());
lText += lTmp;
FBStringList lLines;
mConnDataNotify.GetStrings(&lLines);
if( lLines.GetCount() >= MAX_BUFFER_LINE ) lLines.Remove(lLines.GetAt(0));
lLines.Add(lText);
mConnDataNotify.SetStrings(&lLines);
lCounter++;
mConnDataNotify.Refresh();
}
{
}
{
FBEventShow lEvent( pEvent );
if( lEvent.Shown )
{
FBSystem::TheOne().OnConnectionNotify.Add(
this, (
FBCallback)&ORToolPlugs::EventConnNotify);
FBSystem::TheOne().OnConnectionStateNotify.Add(
this, (
FBCallback)&ORToolPlugs::EventConnStateNotify);
FBSystem::TheOne().OnConnectionDataNotify.Add(
this, (
FBCallback)&ORToolPlugs::EventConnDataNotify);
}
else
{
FBSystem::TheOne().OnConnectionNotify.Remove(
this, (
FBCallback)&ORToolPlugs::EventConnNotify);
FBSystem::TheOne().OnConnectionStateNotify.Remove(
this, (
FBCallback)&ORToolPlugs::EventConnStateNotify);
FBSystem::TheOne().OnConnectionDataNotify.Remove(
this, (
FBCallback)&ORToolPlugs::EventConnDataNotify);
}
}
{
}
{
}
{
}
bool ORToolPlugs::FbxStore ( FBFbxObject* pFbxObject,
kFbxObjectStore pStoreWhat )
{
pFbxObject->FieldWriteBegin( "ORToolPlugsSection" );
{
}
pFbxObject->FieldWriteEnd();
return true;
}
bool ORToolPlugs::FbxRetrieve( FBFbxObject* pFbxObject,
kFbxObjectStore pStoreWhat )
{
pFbxObject->FieldReadBegin( "ORToolPlugsSection" );
{
}
pFbxObject->FieldReadEnd();
return true;
}