// TreeParamView.cpp : implementation file
//

#include "stdafx.h"
#include "pixelwhippro.h"
#include "TreeParamView.h"
#include "EffectListWin.h"
#include "DataParamView.h"
#include "EffectEditWin.h"
#include "CurveEditorFrame.h"
#include <GosFx\GosFx.hpp>
#include <GosFx\ParticleCloud.hpp>
#include <GosFx\SpinningCloud.hpp>

extern CPixelWhipProApp theApp;
extern gosFX::Effect *CurrentEffect;


/////////////////////////////////////////////////////////////////////////////
// CTreeParamView

IMPLEMENT_DYNCREATE(CTreeParamView, CView)

CTreeParamView::CTreeParamView()
{
Initalized=false;
DoUpdate=false;
FirstItem=NULL;
NoRedraw=0;

}

CTreeParamView::~CTreeParamView()
{
}


BEGIN_MESSAGE_MAP(CTreeParamView, CView)
	//{{AFX_MSG_MAP(CTreeParamView)
	ON_WM_CREATE()
	ON_WM_SIZE()
	ON_WM_LBUTTONUP()
	ON_WM_VSCROLL()
	ON_WM_MOUSEWHEEL()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTreeParamView drawing

void CTreeParamView::OnDraw(CDC* pDC)
{
	CDocument* pDoc = GetDocument();
	// TODO: add draw code here
}

/////////////////////////////////////////////////////////////////////////////
// CTreeParamView diagnostics

#ifdef _DEBUG
void CTreeParamView::AssertValid() const
{
	CView::AssertValid();
}

void CTreeParamView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CTreeParamView message handlers

void CTreeParamView::Refresh()
{
if( NoRedraw!=0) return;
Reset();
if( CurrentEffect==NULL || theApp.EListWin->m_EffectList.GetSelectedItem()==NULL) return;
int cnt=0;

NoRedraw++;

gosFX::Effect::Specification *spec;
spec=(gosFX::Effect::Specification *)theApp.EListWin->m_EffectList.GetItemData(theApp.EListWin->m_EffectList.GetSelectedItem());

HTREEITEM Par2,ParItem,CurItem=TVI_ROOT,LastItem=TVI_ROOT;

LastItem=ParItem=m_PTree.InsertItem("Effect Parameters",0,0,TVI_ROOT,TVI_ROOT);
CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
cnt++;

	LastItem=m_PTree.InsertItem("Appearance Style",0,0,ParItem,LastItem);
	CSet[cnt].SetType(CurveSet::MLRSTATEPANEL,(void *) &spec->m_state);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Texture",0,0,ParItem,LastItem);
	CSet[cnt].SetType(CurveSet::TEXTUREBROWSER,(void *) CurrentEffect);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Emitter Life Span",0,0,ParItem,LastItem);
	CSet[cnt].Curve=&(spec->m_lifeSpan);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
//	CSet[cnt].Min=0.0f;
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Minimum Child Seed",0,0,ParItem,LastItem);
	CSet[cnt].Curve=&(spec->m_minimumChildSeed);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Maximun Child Seed",0,0,ParItem,LastItem);
	CSet[cnt].Curve=&(spec->m_maximumChildSeed);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	
RegisteredClass::ClassData *fx_class_data;
fx_class_data=RegisteredClass::FindClassData(spec->GetClassID());

if(fx_class_data->IsDerivedFrom(gosFX::Singleton::DefaultData))	
{

gosFX::Singleton__Specification *tspec;
tspec=Cast_Pointer(gosFX::Singleton__Specification *,spec);
Check_Object(tspec);

	LastItem=ParItem=m_PTree.InsertItem("Singleton Parameters",0,0,TVI_ROOT,LastItem);	
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

		LastItem=m_PTree.InsertItem("Align Z Using X",0,0,ParItem,LastItem);			
		CSet[cnt].SetType(CurveSet::TFPANEL,&(tspec->m_alignZUsingX));
		CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

		LastItem=m_PTree.InsertItem("Align Z Using Y",0,0,ParItem,LastItem);			
		CSet[cnt].SetType(CurveSet::TFPANEL,&(tspec->m_alignZUsingY));
		CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

		LastItem=m_PTree.InsertItem("Random Starting Rotation",0,0,ParItem,LastItem);			
		CSet[cnt].SetType(CurveSet::TFPANEL,&(tspec->m_randomStartingRotation));
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

		LastItem=m_PTree.InsertItem("Spin",0,0,ParItem,LastItem);			
		CSet[cnt].Curve=&(tspec->m_spin);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
		CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

		LastItem=m_PTree.InsertItem("Scale",0,0,ParItem,LastItem);			
		CSet[cnt].Curve=&(tspec->m_scale);
//		CSet[cnt].Min=0.0f;
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
		CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

	LastItem=Par2=m_PTree.InsertItem("Singleton Color",0,0,ParItem,LastItem);
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

		LastItem=m_PTree.InsertItem("Red",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_red);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
			CSet[cnt].Name=m_PTree.GetItemText(LastItem);
m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;
		
		LastItem=m_PTree.InsertItem("Green",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_green);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;
		
		LastItem=m_PTree.InsertItem("Blue",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_blue);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

		LastItem=m_PTree.InsertItem("Alpha",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_alpha);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;


}


if(fx_class_data->IsDerivedFrom(gosFX::ParticleCloud::DefaultData))	
{
gosFX::ParticleCloud__Specification *tspec;
tspec=Cast_Pointer(gosFX::ParticleCloud__Specification *,spec);

	LastItem=ParItem=m_PTree.InsertItem("ParticleCloud Parameters",0,0,TVI_ROOT,LastItem);	
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Maximum Particle Count",0,0,ParItem,LastItem); 			
//	CSet[cnt].Min=1;
	CSet[cnt].SetType(CurveSet::NUMVAL,&(tspec->m_maxParticleCount));
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Particle Drag",0,0,ParItem,LastItem); 			
	CSet[cnt].Curve=&(tspec->m_pDrag);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Particles Per Second",0,0,ParItem,LastItem);	
	CSet[cnt].Curve=&(tspec->m_particlesPerSecond);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Initial Speed",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_startingSpeed);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Minimum Deviation",0,0,ParItem,LastItem);				
	CSet[cnt].Curve=&(tspec->m_minimumDeviation);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Maximum Deviation",0,0,ParItem,LastItem);				
	CSet[cnt].Curve=&(tspec->m_maximumDeviation);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Particle Lifespan",0,0,ParItem,LastItem);		
	CSet[cnt].Curve=&(tspec->m_pLifeSpan);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
//	CSet[cnt].Min=0.0f;
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Starting Population",0,0,ParItem,LastItem);	
	CSet[cnt].Curve=&(tspec->m_startingPopulation);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
//	CSet[cnt].Min=0.0f;
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=Par2=m_PTree.InsertItem("Emmiter Size",0,0,ParItem,LastItem);			
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;
	
		LastItem=m_PTree.InsertItem("X",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_emitterSizeX);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

		LastItem=m_PTree.InsertItem("Y",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_emitterSizeY);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;
		
		LastItem=m_PTree.InsertItem("Z",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_emitterSizeZ);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

	LastItem=Par2=m_PTree.InsertItem("Ether Velocity",0,0,ParItem,LastItem);
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

		LastItem=m_PTree.InsertItem("X",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pEtherVelocityX);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;
		
		LastItem=m_PTree.InsertItem("Y",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pEtherVelocityY);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;
		
		LastItem=m_PTree.InsertItem("Z",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pEtherVelocityZ);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

	LastItem=Par2=m_PTree.InsertItem("Particle Acceleration",0,0,ParItem,LastItem);
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

		LastItem=m_PTree.InsertItem("X",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pAccelerationX);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;
		
		LastItem=m_PTree.InsertItem("Y",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pAccelerationY);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;
		
		LastItem=m_PTree.InsertItem("Z",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pAccelerationZ);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

	LastItem=Par2=m_PTree.InsertItem("Particle Color",0,0,ParItem,LastItem);
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

		LastItem=m_PTree.InsertItem("Red",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pRed);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;
		
		LastItem=m_PTree.InsertItem("Green",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pGreen);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;
		
		LastItem=m_PTree.InsertItem("Blue",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pBlue);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

		LastItem=m_PTree.InsertItem("Alpha",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pAlpha);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;
}

if(fx_class_data->IsDerivedFrom(gosFX::Card::DefaultData))	
{
	gosFX::Card__Specification *tspec;
	tspec=Cast_Pointer(gosFX::Card__Specification *,spec);
	Check_Object(tspec);

	LastItem=ParItem=m_PTree.InsertItem("Card Parameters",0,0,TVI_ROOT,LastItem);	
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;
	
		LastItem=m_PTree.InsertItem("Half Height",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_halfHeight);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Aspect Ratio",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_aspectRatio);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("UOffset",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_UOffset);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("VOffset",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_VOffset);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("UScale",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_USize);
//	CSet[cnt].Min=-100.0f;
//	CSet[cnt].Max=100.0f;
	CSet[cnt].EffSpec=tspec;
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("VScale",0,0,ParItem,LastItem);			
//	CSet[cnt].Min=-100.0f;
//	CSet[cnt].Max=100.0f;
	CSet[cnt].Curve=&(tspec->m_VSize);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Index",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_index);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Animated",0,0,ParItem,LastItem);			
	CSet[cnt].SetType(CurveSet::TFPANEL,&(tspec->m_animated));
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	}

if(fx_class_data->IsDerivedFrom(gosFX::Shape::DefaultData))	
{
	gosFX::Shape__Specification *tspec;
	tspec=Cast_Pointer(gosFX::Shape__Specification *,spec);
	Check_Object(tspec);

	LastItem=ParItem=m_PTree.InsertItem("Shape Parameters",0,0,TVI_ROOT,LastItem);	
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

		LastItem=m_PTree.InsertItem("Shape",0,0,ParItem,LastItem);			
		CSet[cnt].SetType(CurveSet::SHAPEPANEL,tspec);
		CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

	}


// Spinning CLoud
if(fx_class_data->IsDerivedFrom(gosFX::SpinningCloud::DefaultData))	
{
gosFX::SpinningCloud__Specification *tspec;
tspec=Cast_Pointer(gosFX::SpinningCloud__Specification *,spec);
Check_Object(tspec);

LastItem=ParItem=m_PTree.InsertItem("SpinningCloud Parameters",0,0,TVI_ROOT,LastItem);
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

		LastItem=m_PTree.InsertItem("Random Starting Rotation",0,0,ParItem,LastItem);			
		CSet[cnt].SetType(CurveSet::TFPANEL,&(tspec->m_randomStartingRotation));
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

		LastItem=m_PTree.InsertItem("Align Z Using X",0,0,ParItem,LastItem);			
		CSet[cnt].SetType(CurveSet::TFPANEL,&(tspec->m_alignZUsingX));
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

		LastItem=m_PTree.InsertItem("Align Z Using Y",0,0,ParItem,LastItem);			
		CSet[cnt].SetType(CurveSet::TFPANEL,&(tspec->m_alignZUsingY));
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;


		LastItem=m_PTree.InsertItem("Align Y Using Velocity",0,0,ParItem,LastItem);			
		CSet[cnt].SetType(CurveSet::TFPANEL,&(tspec->m_alignYUsingVelocity));
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

		LastItem=m_PTree.InsertItem("Spin",0,0,ParItem,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pSpin);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

		LastItem=m_PTree.InsertItem("Scale",0,0,ParItem,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pScale);
//		CSet[cnt].Min=0.0f;
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;
}

if(fx_class_data->IsDerivedFrom(gosFX::PointLight::DefaultData))	
{
	gosFX::PointLight__Specification *tspec;
	tspec=Cast_Pointer(gosFX::PointLight__Specification *,spec);
		Check_Object(tspec);

	
	LastItem=ParItem=m_PTree.InsertItem("Point Light Parameters",0,0,TVI_ROOT,LastItem);
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;
	
		LastItem=Par2=m_PTree.InsertItem("Light Color",0,0,ParItem,LastItem);
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

		LastItem=m_PTree.InsertItem("Red",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_red);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;
		
		LastItem=m_PTree.InsertItem("Green",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_green);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;
		
		LastItem=m_PTree.InsertItem("Blue",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_blue);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

		LastItem=m_PTree.InsertItem("Intensity",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_intensity);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

	LastItem=m_PTree.InsertItem("Inner Radius",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_innerRadius);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Outer Radius",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_outerRadius);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Two Sided",0,0,ParItem,LastItem);			
	CSet[cnt].SetType(CurveSet::TFPANEL,&(tspec->m_twoSided));
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Vertex Light",0,0,ParItem,LastItem);			
	CSet[cnt].SetType(CurveSet::TFPANEL,&(tspec->m_vertexLight));
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Light Map",0,0,ParItem,LastItem);			
	CSet[cnt].SetType(CurveSet::TEXTUREBROWSER2,&(tspec->m_lightMap));
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	}


if(fx_class_data->IsDerivedFrom(gosFX::Flare::DefaultData))	
{
	gosFX::Flare__Specification *tspec;
	tspec=Cast_Pointer(gosFX::Flare__Specification *,spec);
	Check_Object(tspec);

	LastItem=ParItem=m_PTree.InsertItem("Flare Parameters",0,0,TVI_ROOT,LastItem);
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Fade In Time",0,0,ParItem,LastItem); 			
	CSet[cnt].EffSpec=tspec;
	CSet[cnt].SetType(CurveSet::FLOATVAL,&(tspec->m_fadeInRate));
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Fade Out Time",0,0,ParItem,LastItem); 			
	CSet[cnt].EffSpec=tspec;
	CSet[cnt].SetType(CurveSet::FLOATVAL,&(tspec->m_fadeOutRate));
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("RayCasts Per Second",0,0,ParItem,LastItem); 			
	CSet[cnt].EffSpec=tspec;
	CSet[cnt].SetType(CurveSet::FLOATVAL,&(tspec->m_rayCastTime));
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

}


if(fx_class_data->IsDerivedFrom(gosFX::DebrisCloud::DefaultData))	
{
gosFX::DebrisCloud__Specification *tspec;
tspec=Cast_Pointer(gosFX::DebrisCloud__Specification *,spec);
		Check_Object(tspec);

	
	LastItem=ParItem=m_PTree.InsertItem("Debris Cloud Parameters",0,0,TVI_ROOT,LastItem);
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

		LastItem=m_PTree.InsertItem("Minimum Deviation",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_minimumDeviation);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Maximum Deviation",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_maximumDeviation);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Initial Speed",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_startingSpeed);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Particle Life Span",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_pLifeSpan);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=Par2=m_PTree.InsertItem("Ether Velocity",0,0,ParItem,LastItem);
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

		
		LastItem=m_PTree.InsertItem("Y",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pEtherVelocityY);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

	LastItem=Par2=m_PTree.InsertItem("Particle Acceleration",0,0,ParItem,LastItem);
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

		LastItem=m_PTree.InsertItem("Y",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pAccelerationY);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

	LastItem=m_PTree.InsertItem("Particle Drag",0,0,ParItem,LastItem); 			
	CSet[cnt].Curve=&(tspec->m_pDrag);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Spin",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_pSpin);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=Par2=m_PTree.InsertItem("Particle Color",0,0,ParItem,LastItem);
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;


		LastItem=m_PTree.InsertItem("Alpha",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pAlpha);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

	LastItem=m_PTree.InsertItem("Shape",0,0,ParItem,LastItem);			
	CSet[cnt].SetType(CurveSet::EBFPANEL,tspec);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Center Of Force",0,0,ParItem,LastItem); 			
	CSet[cnt].SetType(CurveSet::POINTPANEL,&(tspec->m_centerOfForce));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

			 }

if(fx_class_data->IsDerivedFrom(gosFX::Tube::DefaultData))	
{
gosFX::Tube__Specification *tspec;
tspec=Cast_Pointer(gosFX::Tube__Specification *,spec);
		Check_Object(tspec);

	 LastItem=ParItem=m_PTree.InsertItem("Tube Parameters",0,0,TVI_ROOT,LastItem);
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Maximum Profile Count",0,0,ParItem,LastItem); 			
	CSet[cnt].EffSpec=tspec;
//	CSet[cnt].Min=2;
	CSet[cnt].SetType(CurveSet::NUMVAL,&(tspec->m_maxProfileCount));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Profile Type",0,0,ParItem,LastItem); 			
	CSet[cnt].SetType(CurveSet::PROFILEPANEL,tspec);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("InsideOut",0,0,ParItem,LastItem);			
	CSet[cnt].SetType(CurveSet::TFPANEL,&(tspec->m_insideOut));
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Random Directions",0,0,ParItem,LastItem);			
	CSet[cnt].SetType(CurveSet::TFPANEL,&(tspec->m_randomDirections));
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Profiles Per Second",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_profilesPerSecond);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Profile Life Span",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_pLifeSpan);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

		LastItem=Par2=m_PTree.InsertItem("Emmiter Size",0,0,ParItem,LastItem);			
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;
	
		LastItem=m_PTree.InsertItem("X",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_emitterSizeX);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

		LastItem=m_PTree.InsertItem("Y",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_emitterSizeY);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;
		
		LastItem=m_PTree.InsertItem("Z",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_emitterSizeZ);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

	LastItem=m_PTree.InsertItem("Minimum Deviation",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_minimumDeviation);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Maximum Deviation",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_maximumDeviation);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Profile Displacement",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_pDisplacement);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Profile Scale",0,0,ParItem,LastItem);			
//	CSet[cnt].Min=0.0f;
	CSet[cnt].Curve=&(tspec->m_pScale);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=Par2=m_PTree.InsertItem("Profile Color",0,0,ParItem,LastItem);
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

		LastItem=m_PTree.InsertItem("Red",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pRed);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;
		
		LastItem=m_PTree.InsertItem("Green",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pGreen);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;
		
		LastItem=m_PTree.InsertItem("Blue",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pBlue);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

		LastItem=m_PTree.InsertItem("Alpha",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pAlpha);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

	LastItem=m_PTree.InsertItem("UOffset",0,0,ParItem,LastItem);			
//	CSet[cnt].Min=-100.0f;
//	CSet[cnt].Max=100.0f;
	CSet[cnt].EffSpec=tspec;
	CSet[cnt].Curve=&(tspec->m_pUOffset);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("VOffset",0,0,ParItem,LastItem);			
//	CSet[cnt].Min=-100.0f;
//	CSet[cnt].Max=100.0f;
	CSet[cnt].Curve=&(tspec->m_pVOffset);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("USize",0,0,ParItem,LastItem);			
	CSet[cnt].EffSpec=tspec;
//	CSet[cnt].Min=-100.0f;
//	CSet[cnt].Max=100.0f;
	CSet[cnt].Curve=&(tspec->m_pUSize);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("VSize",0,0,ParItem,LastItem);			
//	CSet[cnt].Min=-100.0f;
//	CSet[cnt].Max=100.0f;
	CSet[cnt].Curve=&(tspec->m_pVSize);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;


	LastItem=m_PTree.InsertItem("Fade First To Black",0,0,ParItem,LastItem);			
	CSet[cnt].SetType(CurveSet::TFPANEL,&(tspec->m_fadeFirstToBlack));
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;
	
	LastItem=m_PTree.InsertItem("Fade First To White",0,0,ParItem,LastItem);			
	CSet[cnt].SetType(CurveSet::TFPANEL,&(tspec->m_fadeFirstToWhite));
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;


			 }

if(fx_class_data->IsDerivedFrom(gosFX::Beam::DefaultData))	
{
gosFX::Beam__Specification *tspec;
tspec=Cast_Pointer(gosFX::Beam__Specification *,spec);
		Check_Object(tspec);

	 LastItem=ParItem=m_PTree.InsertItem("Beam Parameters",0,0,TVI_ROOT,LastItem);
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Maximum Profile Count",0,0,ParItem,LastItem); 			
	CSet[cnt].EffSpec=tspec;
//	CSet[cnt].Min=2;
	CSet[cnt].SetType(CurveSet::NUMVAL,&(tspec->m_maxProfileCount));
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Profile Type",0,0,ParItem,LastItem); 			
	CSet[cnt].SetType(CurveSet::PROFILEPANEL,tspec);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("InsideOut",0,0,ParItem,LastItem);			
	CSet[cnt].SetType(CurveSet::TFPANEL,&(tspec->m_insideOut));
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Random Directions",0,0,ParItem,LastItem);			
	CSet[cnt].SetType(CurveSet::TFPANEL,&(tspec->m_randomDirections));
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Profiles Per Meter",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_profilesPerMeter);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;


	LastItem=m_PTree.InsertItem("Minimum Deviation",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_minimumDeviation);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Maximum Deviation",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_maximumDeviation);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Profile Displacement",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_pDisplacement);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Profile Scale",0,0,ParItem,LastItem);			
//	CSet[cnt].Min=0.0f;
	CSet[cnt].Curve=&(tspec->m_pScale);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=Par2=m_PTree.InsertItem("Profile Color",0,0,ParItem,LastItem);
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

		LastItem=m_PTree.InsertItem("Red",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pRed);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;
		
		LastItem=m_PTree.InsertItem("Green",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pGreen);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;
		
		LastItem=m_PTree.InsertItem("Blue",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pBlue);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

		LastItem=m_PTree.InsertItem("Alpha",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pAlpha);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

	LastItem=m_PTree.InsertItem("UOffset",0,0,ParItem,LastItem);			
//	CSet[cnt].Min=-100.0f;
//	CSet[cnt].Max=100.0f;
	CSet[cnt].EffSpec=tspec;
	CSet[cnt].Curve=&(tspec->m_pUOffset);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("VOffset",0,0,ParItem,LastItem);			
//	CSet[cnt].Min=-100.0f;
//	CSet[cnt].Max=100.0f;
	CSet[cnt].Curve=&(tspec->m_pVOffset);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("USize",0,0,ParItem,LastItem);			
	CSet[cnt].EffSpec=tspec;
//	CSet[cnt].Min=-100.0f;
//	CSet[cnt].Max=100.0f;
	CSet[cnt].Curve=&(tspec->m_pUSize);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("VSize",0,0,ParItem,LastItem);			
//	CSet[cnt].Min=-100.0f;
//	CSet[cnt].Max=100.0f;
	CSet[cnt].Curve=&(tspec->m_pVSize);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Fire At",0,0,ParItem,LastItem);			
	CSet[cnt].SetType(CurveSet::POINTPANEL,&(theApp.TargetLoc));
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;


			 }


	
if(fx_class_data->IsDerivedFrom(gosFX::EffectCloud::DefaultData))	
{
		gosFX::EffectCloud__Specification *tspec;
		tspec=Cast_Pointer(gosFX::EffectCloud__Specification *,spec);
		Check_Object(tspec);
	
	LastItem=ParItem=m_PTree.InsertItem("EffectCloud Parameters",0,0,TVI_ROOT,LastItem);
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;
		
 }

if(fx_class_data->IsDerivedFrom(gosFX::PointCloud::DefaultData))	
{
gosFX::PointCloud__Specification *tspec;
tspec=Cast_Pointer(gosFX::PointCloud__Specification *,spec);
		Check_Object(tspec);

	LastItem=ParItem=m_PTree.InsertItem("PointCloud Parameters",0,0,TVI_ROOT,LastItem);
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;


			 }


if(fx_class_data->IsDerivedFrom(gosFX::ShardCloud::DefaultData))	
{
gosFX::ShardCloud__Specification *tspec;
tspec=Cast_Pointer(gosFX::ShardCloud__Specification *,spec);
		Check_Object(tspec);

	 LastItem=ParItem=m_PTree.InsertItem("ShardCloud Parameters",0,0,TVI_ROOT,LastItem);
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;


	LastItem=m_PTree.InsertItem("Size",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_size);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;
	
	LastItem=m_PTree.InsertItem("Angularity",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_angularity);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;
			 }

if(fx_class_data->IsDerivedFrom(gosFX::ShapeCloud::DefaultData))	
{
gosFX::ShapeCloud__Specification *tspec;
tspec=Cast_Pointer(gosFX::ShapeCloud__Specification *,spec);
		Check_Object(tspec);

	LastItem=ParItem=m_PTree.InsertItem("ShapeCloud Parameters",0,0,TVI_ROOT,LastItem);
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Shape",0,0,ParItem,LastItem);			
		CSet[cnt].SetType(CurveSet::SHAPECLOUDPANEL,tspec);
		CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;


	 }

if(fx_class_data->IsDerivedFrom(gosFX::PertCloud::DefaultData))	
{
gosFX::PertCloud__Specification *tspec;
tspec=Cast_Pointer(gosFX::PertCloud__Specification *,spec);
		Check_Object(tspec);
	
	 LastItem=ParItem=m_PTree.InsertItem("PertCloud Parameters",0,0,TVI_ROOT,LastItem);
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;


	LastItem=Par2=m_PTree.InsertItem("Center Color",0,0,ParItem,LastItem);
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

		LastItem=m_PTree.InsertItem("Red",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pCenterRed);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
		CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;
		
		LastItem=m_PTree.InsertItem("Green",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pCenterGreen);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;
		
		LastItem=m_PTree.InsertItem("Blue",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pCenterBlue);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

		LastItem=m_PTree.InsertItem("Alpha",0,0,Par2,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pCenterAlpha);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

	LastItem=m_PTree.InsertItem("Size",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_size);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Perturbation",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_perturbation);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;
			 }

if(fx_class_data->IsDerivedFrom(gosFX::SpriteCloud::DefaultData))	
{
	gosFX::SpriteCloud::Specification *tspec;
	tspec=Cast_Pointer(gosFX::SpriteCloud::Specification *,spec);
		Check_Object(tspec);

	LastItem=ParItem=m_PTree.InsertItem("SpriteCloud Parameters",0,0,TVI_ROOT,LastItem);
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

		LastItem=m_PTree.InsertItem("Scale",0,0,ParItem,LastItem);			
		CSet[cnt].Curve=&(tspec->m_pScale);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
		CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;


		LastItem=m_PTree.InsertItem("UOffset",0,0,ParItem,LastItem);			
		CSet[cnt].Curve=&(tspec->m_UOffset);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
		CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

		LastItem=m_PTree.InsertItem("VOffset",0,0,ParItem,LastItem);			
		CSet[cnt].Curve=&(tspec->m_VOffset);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
		CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

		LastItem=m_PTree.InsertItem("USize",0,0,ParItem,LastItem);			
		CSet[cnt].Curve=&(tspec->m_USize);
		CSet[cnt].EffSpec=tspec;
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
		CSet[cnt].EffSpec=tspec;
		CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;

		LastItem=m_PTree.InsertItem("VSize",0,0,ParItem,LastItem);			
		CSet[cnt].Curve=&(tspec->m_VSize);
		CSet[cnt].SetType(CurveSet::CURVEPANEL);
		CSet[cnt].Name=m_PTree.GetItemText(LastItem);
		m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
		cnt++;
}



if(fx_class_data->IsDerivedFrom(gosFX::CardCloud::DefaultData))	
{
gosFX::CardCloud__Specification *tspec;
tspec=Cast_Pointer(gosFX::CardCloud__Specification *,spec);
		Check_Object(tspec);

	LastItem=ParItem=m_PTree.InsertItem("CardCloud Parameters",0,0,TVI_ROOT,LastItem);
	CSet[cnt].SetType(CurveSet::TEXT,(void *)(LPCSTR)m_PTree.GetItemText(LastItem));
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;


	LastItem=m_PTree.InsertItem("Half Height",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_halfHeight);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Aspect Ratio",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_aspectRatio);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("UOffset",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_UOffset);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("VOffset",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_VOffset);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("USize",0,0,ParItem,LastItem);			
//	CSet[cnt].Min=-100.0f;
//	CSet[cnt].Max=100.0f;
	CSet[cnt].Curve=&(tspec->m_USize);
	CSet[cnt].EffSpec=tspec;
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].EffSpec=tspec;
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("VSize",0,0,ParItem,LastItem);			
//	CSet[cnt].Min=-100.0f;
//	CSet[cnt].Max=100.0f;
	CSet[cnt].Curve=&(tspec->m_VSize);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Index",0,0,ParItem,LastItem);			
	CSet[cnt].Curve=&(tspec->m_pIndex);
	CSet[cnt].SetType(CurveSet::CURVEPANEL);
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;

	LastItem=m_PTree.InsertItem("Animated",0,0,ParItem,LastItem);			
	CSet[cnt].SetType(CurveSet::TFPANEL,&(tspec->m_animated));
	CSet[cnt].Name=m_PTree.GetItemText(LastItem);
	m_PTree.SetItemData(LastItem,(DWORD)&CSet[cnt]);
	cnt++;


 }

Verify(cnt<MAXCSETS);

for(int i=0;i<cnt;i++)
{
CSet[i].EffSpec=spec;
	if(CSet[i].Panel)
 CSet[i].Panel->Initalize(theApp.ParamWin->DataPane);
}
m_PTree.ExpandBranch(TVI_ROOT);
NoRedraw--;
theApp.ParamWin->DataPane->Refresh();

}

int CTreeParamView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CView::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	CRect crct;
	GetClientRect(&crct);
	ClientToScreen(&crct);
	m_PTree.Create(TVS_HASBUTTONS|TVS_HASLINES|TVS_SHOWSELALWAYS|TVS_LINESATROOT|TVS_CHECKBOXES,CRect(0,0,200,200),this,NULL);
	Initalized=true;
	m_PTree.SetItemHeight(20);
	m_PTree.ShowWindow(SW_SHOW);
	return 0;
}

BOOL CTreeParamView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) 
{
HRESULT res=CView::OnNotify(wParam, lParam, pResult);

NMHDR *hdr=(NMHDR *)lParam;

	if(hdr->code==NM_CLICK) 
		{
		theApp.CurveWin->m_wndView.UpdateCurveList();
		}

	if(hdr->code==TVN_SELCHANGED) 
	{
		theApp.CurveWin->m_wndView.UpdateCurveList();
	}


	if(hdr->code==TVN_ITEMEXPANDED && NoRedraw==0) 
	{
		theApp.ParamWin->DataPane->Refresh();
	}
	return res;
}

void CTreeParamView::OnSize(UINT nType, int cx, int cy) 
{
	CView::OnSize(nType, cx, cy);
	if(Initalized)
	{
	m_PTree.SetWindowPos(NULL,0,0,cx,cy,SWP_NOZORDER);
	}
	
}

void CTreeParamView::OnLButtonUp(UINT nFlags, CPoint point) 
{
	if(DoUpdate)
	{
	theApp.CurveWin->m_wndView.Refresh();
	DoUpdate=false;
	}
	CView::OnLButtonUp(nFlags, point);
}

void CTreeParamView::Reset()
{

m_PTree.DeleteAllItems();
for(int i=0;i<MAXCSETS;i++) CSet[i].Reset();
theApp.ParamWin->DataPane->Reset();
}

void CTreeParamView::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
{
	theApp.ParamWin->DataPane->UpdateScrollPos();
	CView::OnVScroll(nSBCode, nPos, pScrollBar);
}

BOOL CTreeParamView::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) 
{
theApp.ParamWin->DataPane->UpdateScrollPos();
	
return CView::OnMouseWheel(nFlags, zDelta, pt);;
}

