/*------------------------------------------------------------------------------*
 * File Name:				 													*
 * Creation: 																	*
 * Purpose: OriginC Source C file												*
 * Copyright (c) ABCD Corp.	2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010		*
 * All Rights Reserved															*
 * 																				*
 * Modification Log:															*
 * Iris 12/31/03 v8.0790 ADD_PCLAMPFILE_POINTER									*
 * EJP 2006-06-08 v8.0422 PLCAMP_IMPORT_NEED_RETURN_ERR							*
 *------------------------------------------------------------------------------*/
 
////////////////////////////////////////////////////////////////////////////////////
// Including the system header file Origin.h should be sufficient for most Origin
// applications and is recommended. Origin.h includes many of the most common system
// header files and is automatically pre-compiled when Origin runs the first time.
// Programs including Origin.h subsequently compile much more quickly as long as
// the size and number of other included header files is minimized. All NAG header
// files are now included in Origin.h and no longer need be separately included.
//
// Right-click on the line below and select 'Open "Origin.h"' to open the Origin.h
// system header file.
#include <Origin.h>
////////////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////////////////////
// Include your own header files here.
#include "pCLAMPImport.h"
#include <GetNBox.h>
////////////////////////////////////////////////////////////////////////////////////
// Start your functions here.

///---Sim 09-19-2006 SEEMS_NO_USE
//#define IMPORT_ERROR_INRO		"Fail to import pCalmp!"
//#define DLGINFO_VARIED			"Varied"
//class pCLAMPDialog
//{
//public:
	//pCLAMPDialog()
	//{
	//}
	//
	//~pCLAMPDialog()
	//{
	//}
	//
//public:
	//void	SetMultipleFiles(BOOL bOn)	{m_bMultipleFiles = bOn;}
	//
//public:
	//BOOL	DoDialog(LPCSTR lpcszFileName = NULL, int nChannels = -1, int nSweeps = -1, int nSweepSize = -1, float fInterval = -1)
	//{
		//GETN_TREE(myTree)			
		//
		//GETN_OPTION_GRIDLINE(flexGridFlatVert) //--- 1. divider line
		//string strChannels = nChannels;
		//string strSweeps = nSweeps;
		//string strSweepSize = nSweepSize;
		//string strInterval = fInterval;
		//GETN_BEGIN_BRANCH(FileInfo, "pCLAMP Information")
			//GETN_OPTION_BRANCH(GETNBRANCH_OPEN | GETNBRANCH_KEEP_SIZE_ON_COLLAPSE)
			//GETN_STR(FileName, "File Name", m_bMultipleFiles ? "Multiple Files" : lpcszFileName)
			//GETN_READ_ONLY
			//GETN_STR(NumberOfChannels, "Number of Channels", nChannels < 0 ? DLGINFO_VARIED : strChannels)
			//GETN_READ_ONLY
			//GETN_STR(NumberOfSweeps, "Number of Sweeps", nSweeps < 0 ? DLGINFO_VARIED : strSweeps)
			//GETN_READ_ONLY
			//GETN_STR(SweepSize, "Sweep Size", nSweepSize < 0 ? DLGINFO_VARIED : strSweepSize)
			//GETN_READ_ONLY
			//GETN_STR(Interval, "Interval", fInterval < 0 ? DLGINFO_VARIED : strInterval)
			//GETN_READ_ONLY
		//GETN_END_BRANCH(FileInfo)
		//GETN_LIST(ImportMode, "Import mode", 0, "Channels|Sweeps")
		//GETN_NUM(ImportChannelNo, "Channel is(-1: All,  0 offset):", -1)
		//GETN_NUM(ImportSweepNo, "Sweep is(-1: All,  0 offset):", -1)
		//
		//if( GetNBox(myTree, "Import Axon Binary File") )
		//{
			////Set Import Mode
			//if(0 == myTree.ImportMode.nVal)
			//{
				//m_uImportMode = IMPORT_MODE_CHANNELS;
			//}
			//else
			//{
				//m_uImportMode = IMPORT_MODE_SWEEPS;
			//}
			//
			////Set Channel No and Sweep No.
			//m_nChannelNo = myTree.ImportChannelNo.nVal;
			//m_nSweepNo = myTree.ImportSweepNo.nVal;
			//return TRUE;
		//}
		//
//
		//return FALSE;
	//}
	//
//public:
	//UINT GetImportMode()
	//{
		//return m_uImportMode;
	//}
	//
	//int GetChannelNo()
	//{
		//return m_nChannelNo;
	//}
	//
	//int GetSweepNo()
	//{
		//return m_nSweepNo;
	//}
	//
	//
//private:
	//BOOL	m_bMultipleFiles;
	//UINT	m_uImportMode;
	//int		m_nChannelNo;
	//int		m_nSweepNo;
//};
//
//
////void PclampImport()
////void pClampImport()	//Iris 01/01/04
///// EJP 2006-06-08 v8.0422 PLCAMP_IMPORT_NEED_RETURN_ERR 
/////void pCLAMPImport()
//int pCLAMPImport()
///// end PLCAMP_IMPORT_NEED_RTURN_ERR
//{
	//string strPath;
	//StringArray saFiletypes;
	//saFiletypes.SetSize( 3 );
	//saFiletypes[0]="[*.ABF]*.ABF";
	//saFiletypes[1]="[*.DAT]*.DAT";
	//saFiletypes[2]="[All File(*.*)] *.*";	
//
	//StringArray saFilePath;
	//if(!GetMultiOpenBox( saFilePath, saFiletypes, NULL, NULL, "Open pCLAMP File", false))
	//{
		///// EJP 2006-06-08 v8.0422 PLCAMP_IMPORT_NEED_RETURN_ERR 
		/////return;
		//return 0; // user canceled
		///// end PLCAMP_IMPORT_NEED_RTURN_ERR
	//}
	//
	//UINT nFileCount = saFilePath.GetSize();
	//if(0 == nFileCount)
	//{
		///// EJP 2006-06-08 v8.0422 PLCAMP_IMPORT_NEED_RETURN_ERR 
		/////return;
		//return 1;
		///// end PLCAMP_IMPORT_NEED_RTURN_ERR
	//}
	//
	//pCLAMPDialog pClampDlg;
	//pClampImport pClampImp(saFilePath);
	//
	////vector<int> vnImportMode; //Iris 12/31/03 not used.
	//vector<int> vnChannelNum;
	//vector<int> vnSweepNum;
	//vector<int> vnSweepSize;
	//vector<float> vfInterval;
	//
	////vnImportMode.SetSize(nFileCount);//Iris 01/01/04 not used.
	//vnChannelNum.SetSize(nFileCount);
	//vnSweepNum.SetSize(nFileCount);
	//vnSweepSize.SetSize(nFileCount);
	//vfInterval.SetSize(nFileCount);
	//
	//for(int ii=0; ii<nFileCount; ii++)
	//{
		/////Iris 12/31/03 v8.0790 ADD_PCLAMPFILE_POINTER
		///*
		//vnChannelNum[ii] = pClampImp.GetChannelNum(saFilePath[ii]);
		//vnSweepNum[ii] = pClampImp.GetSweepNum(saFilePath[ii]);
		//vnSweepSize[ii] = pClampImp.GetSweepSize(saFilePath[ii]);
		//vfInterval[ii] = pClampImp.GetSampleInterval(saFilePath[ii]);
		//*/
		//vnChannelNum[ii] = pClampImp.GetChannelNum(ii);
		//vnSweepNum[ii] = pClampImp.GetSweepNum(ii);
		//vnSweepSize[ii] = pClampImp.GetSweepSize(ii);
		//vfInterval[ii] = pClampImp.GetSampleInterval(ii);
		/////End ADD_PCLAMPFILE_POINTER
	//}
	//
	//
	//bool bDlgRet;
	//if(nFileCount>1)
	//{
		//pClampDlg.SetMultipleFiles(TRUE);
		//bDlgRet = pClampDlg.DoDialog();
	//}
	//else
	//{
		//pClampDlg.SetMultipleFiles(FALSE);	
		//bDlgRet = pClampDlg.DoDialog(saFilePath[0], vnChannelNum[0], vnSweepNum[0], vnSweepSize[0], vfInterval[0]);
	//}
	//
	//if(bDlgRet)
	//{
		//
		///////////////////////////////////	
		//vector<int> vTemp;
		//vTemp.SetSize(saFilePath.GetSize());
		//
		////Set Import Mode
		//vTemp = pClampDlg.GetImportMode();
		//pClampImp.SetImportMode(vTemp);
		//
		////Set Channel No
		//vTemp = pClampDlg.GetChannelNo();
		//pClampImp.SetChannelNo(vTemp);
		//
		////Set Sweep No
		//vTemp = pClampDlg.GetSweepNo();
		//pClampImp.SetSweepNo(vTemp);
		//
		////Import data from pCalmp file into worksheet window
		///// EJP 2006-06-08 v8.0422 PLCAMP_IMPORT_NEED_RETURN_ERR 
		/////	if(!pClampImp.ImportPClamp())
		/////	{
		/////		MessageBox(GetWindow(),"Fail to Import pClamp file!","Notice");
		/////	}
		//if( pClampImp.ImportPClamp() )
			//return 0; // success
		///// end PLCAMP_IMPORT_NEED_RTURN_ERR
		/////////////////////////////////////////
	//}
//
	///// EJP 2006-06-08 v8.0422 PLCAMP_IMPORT_NEED_RETURN_ERR 
	//return 1; // error
	///// end PLCAMP_IMPORT_NEED_RTURN_ERR
//}
///---END SEEMS_NO_USE
