#include <origin.h>
#include <GetNBox.h>
#include <xfutils.h>

//put additional include files here
#include <GetNbox.h> ///---Sim 11-20-2006 SUPPORT_DND_OPEN_DIALOG
#include <..\OriginLab\fu_utils.h> ///---Sim 11-1-2006 ERROR_MESSAGE
#include <..\OriginLab\minitab.h>
///Cheney 2006-12-28 ADD_IMPORT_MODE
#include <..\originlab\import_utils.h> 
#include <..\originlab\XFunctionEx.h> 
///end ADD_IMPORT_MODE

///////////////////////////////////////////////////////////////////////
//////// modification log
/// Hong 03/28/07 v8.0591 CENTRALIZE_CHECK_CALID_RANGE
/// Hong 04/10/07 v8.0597b IGNORE_FNAME$_WHEN_FROM_MENU
/// Sim 06-25-2007 UPDATE_ORGANIZER
/// Hong 09/26/07 8.0709 CLEAN_OPEN_SAVE_DIALOG_TITLE_TO_DEFAULT
/// Hong QA80-9255 v8.0878 MINITAB_DEFAULT_KEEP_SHEET_NAME_FROM_FILE
///////////////////////////////////////////////////////////////////////
//put your own support static functions here

///---Sim 11-16-2006 RELIABLE_OK_ENABLE
static bool s_bFileValid = true;
static bool s_bRangeValid = true;
#define OK_SURE(_OK_ENABLE) _OK_ENABLE = (s_bFileValid && s_bRangeValid);
//#define OK_SURE(_OK_ENABLE) _OK_ENABLE = s_bFileValid; //also can be _OK_ENABLE = s_bFileValid && s_bSetting
///---END RELIABLE_OK_ENABLE

///Cheney 2006-12-28 ADD_IMPORT_MODE
enum {
	IML_REPLACE = 0, // ASCIMP_MODE_REPLACE_DATA,
	IML_NEW_BK, // ASCIMP_MODE_NEW_BOOKS,
	IML_NEW_SHT, // ASCIMP_MODE_NEW_SHEETS,
};
///end ADD_IMPORT_MODE

///---Sim 11-07-2006 HANDLE_ERR_MESSAGE_USE_DLL
// change the internal error message of MiniTab import function to external error code of DLL
static void _shift_error_code(int& nRet)
{
		switch ( nRet )
		{
		case MNTB_ERR_FAILED_TO_READ_FILE_TO_TREE:
		case MNTB_ERR_FAILED_TO_GET_DATA_FROM_STREAM:
		case MNTB_ERR_FAILED_TO_GET_SUBVEC_FROM_BYTE_VECTOR:
			nRet = IMPERR_FAILED_OPEN;
			break;
		case MNTB_ERR_COLUMN_SYNCHRONIZATION_FAILURE_V12:
		case MNTB_ERR_COLUMN_SYNCHRONIZATION_FAILURE:
			nRet = IMPERR_MNTB_INVALID_COLUMN_DATA;
			break;
		case MNTB_ERR_UNKNOWN_DATA_TYPE:
			nRet = IMPERR_UNKNOW_TYPE;
			break;
		case MNTB_ERR_FILE_TOO_SMALL:
			nRet = IMPERR_FILE_TOO_SMALL;
			break;
		case MNTB_ERR_UNSUPPORT_VERSION:
			nRet = IMPERR_UNSUPPORT_VERSION;
			break;
		case MNTB_ERR_FAILED_TO_GET_FILE_HEADER:
		case MNTB_ERR_FAILED_TO_GET_DATA_HEADER:
			nRet = IMPERR_HEADER;
			break;
		case MNTB_ERR_FAILED_TO_GET_DATA:
		case MNTB_ERR_FAILED_TO_GET_DATA_PREAMBLE:
		case MNTB_ERR_FAILED_TO_GET_DATA_POSTAMBLE:
			nRet = IMPERR_FAILED_READ;
			break;
		case MNTB_ERR_FAILED_TO_GET_LENGTHAND_SET_INFO:
			nRet = IMPERR_MNTB_FAILED_TO_GET_LENGTHAND_SET_INFO;
			break;
		default:
			nRet = CER_UNKNOWN_ERROR;
		}
}
///---END HANDLE_ERR_MESSAGE_USE_DLL

///Cheney 2006-12-28 ADD_IMPORT_MODE
static BOOL _construct_tree_setting(StringArray& vsFileNames, TreeNode& trInfo)
{
	int nCount = vsFileNames.GetSize();
	string strFileName, strTag, strInfo;
	if ( trInfo )
		trInfo.RemoveChildrenWithPrefix();
	
	GETN_USE(trInfo)
	for ( int nIndex = 0; nIndex < nCount; nIndex++ )
	{
		strFileName = vsFileNames[nIndex];
		if ( !strFileName.IsFile() )
			return false;

		strTag.Format("file%d", nIndex+1);
		strInfo.Format("File Size: %s ", GetFileSize(strFileName));
		GETN_STR(strTag, GetFileName(strFileName, false), strInfo )
		GETN_READ_ONLY
	}
	return true;
}
///end ADD_IMPORT_MODE

///---Sim 11-20-2006 SUPPORT_DND_OPEN_DIALOG
static bool _file_name_event(TreeNode& trGetN, string& strErrMsg)
{
	string strFileName = trGetN.fname.strVal;

	// clean the trFiles on GUI
	//trGetN.trSetting.RemoveChildrenWithPrefix();
	///Cheney 2006-12-28 ADD_IMPORT_MODE
	TreeNode trNode = trGetN.trFiles;
	
	trNode.RemoveChildrenWithPrefix();
	///end ADD_IMPORT_MODE
	
	if ( !check_imported_file_name(strFileName, strErrMsg) )
		return false;
	
	///Cheney 2006-12-28 ADD_IMPORT_MODE
	StringArray vsFileNames;
	separate_multiline_files(strFileName, vsFileNames);
	if ( !_construct_tree_setting(vsFileNames, trNode) )
	{
		// clean the trFiles on GUI
		trNode.RemoveChildrenWithPrefix();
		strErrMsg = CER_INVALID_IMPORT_DATA_FILE;
		return false;
	}
	///end ADD_IMPORT_MODE
	
	//StringArray vsFileNames;
	//separate_multiline_files(strFileName, vsFileNames);
	//if ( !construct_tree_setting(vsFileNames, trGetN.trSetting) )
	//{
		//// clean the trFiles on GUI
		//trGetN.trSetting.RemoveChildrenWithPrefix();
		//strErrMsg = CER_INVALID_IMPORT_DATA_FILE;
		//return false;
	//}
	return true;
}
///---END SUPPORT_DND_OPEN_DIALOG


void impMNTB(const string& fname, const TreeNode& trFiles, const TreeNode& options, Range& orng, TreeNode& finfo)
{
	/// Hong 9/28/06 ADD_ERROR_MESSAGE_IF_FILE_INVALID
	if( fname == NULL)
		XF_THROW(CER_INVALID_IMPORT_DATA_FILE);
	/// END ADD_ERROR_MESSAGE_IF_FILE_INVALID
	
	///Cheney 2006-12-28 ADD_IMPORT_MODE
	//Worksheet wks;
	//int r1, r2, c1, c2;
	//orng.GetRange(0, r1, c1, r2, c2, wks); 
		//
	//int nRet = readminitab( fname, wks, finfo, c1);
		//
	//if( nRet < 0) // import failed
	/////---Sim 11-07-2006 HANDLE_ERR_MESSAGE_USE_DLL
		////XF_THROW(ERR_FAIL_IMPORT);
	//{
		//_shift_error_code(nRet);
		//XF_THROW_EX(nRet, GetFileName(fname));
	//}
	/////---END HANDLE_ERR_MESSAGE_USE_DLL
	Worksheet wks;	
	int c1,c2;
	/// Hong 03/28/07 v8.0591 CENTRALIZE_CHECK_CALID_RANGE
	//orng.GetRange(wks, c1, c2);
	WorksheetPage wpActive;
	if ( !GetRangeInfo(orng, wks, wpActive, c1, c2) )
		XF_THROW(XFERR_INVALID_RANGE);
	/// end CENTRALIZE_CHECK_CALID_RANGE
	if(!wks)
		XF_THROW(CER_INVALID_WKS);
	
	Tree trInfo;
	if( finfo )
		trInfo = finfo;
	
	///Cheney 2007-1-11 NOT_SUPPORT_MULTIFILES_IMPORT_MODE
	//int nListIndexToImportMode[] = {
		//ASCIMP_MODE_REPLACE_DATA,
		//ASCIMP_MODE_NEW_BOOKS,
		//ASCIMP_MODE_NEW_SHEETS
	//};
	//int nFileImportMode = ASCIMP_MODE_NEW_SHEETS;
	//if( 0 <= impmode && impmode < (sizeof(nListIndexToImportMode) / sizeof(int)) )
		//nFileImportMode = nListIndexToImportMode[impmode];
	///end NOT_SUPPORT_MULTIFILES_IMPORT_MODE
			
	//support default filter is empty
	TreeNode tnUsingFilter;
	double dDefault = 0.;
	/// Hong 06/07/05 v8.0635 ADD_OPTION_TREE_FOR_MAKE_FILTER
	//if ( fuGetDouble(trFilter, IDE_DISP_IMP_ORIGINVER, dDefault) )
	//	tnUsingFilter = trFilter;
	if ( fuGetDouble(options, IDE_DISP_IMP_ORIGINVER, dDefault) )
		tnUsingFilter = options;
	/// end ADD_OPTION_TREE_FOR_MAKE_FILTER	
		
	int nRet, nCols;
	StringArray vsFileNames;
	separate_multiline_files(fname, vsFileNames); 
	
	int nFileCount = vsFileNames.GetSize();
	if ( nFileCount <= 0 )
		XF_THROW(CER_INVALID_IMPORT_DATA_FILE);
	
	int nIndexLayer = wks.GetIndex();
	Layer lyOlder;
	bool bNewLayer, bEmptyLayer;
	set_active_layer(wks);
	
	waitCursor wc;
	///Cheney 2007-1-11 NOT_SUPPORT_MULTIFILES_IMPORT_MODE
	/// Hong 03/28/07 v8.0591 CENTRALIZE_CHECK_CALID_RANGE
	//WorksheetPage wpActive;
	//wks.GetParent(wpActive);
	/// end CENTRALIZE_CHECK_CALID_RANGE
	bool bEmptyPage = (wpActive && 1 == wpActive.Layers.Count() && is_sheet_empty(wpActive.Layers(0)));
	///end NOT_SUPPORT_MULTIFILES_IMPORT_MODE
	for ( int ii = 0; ii < nFileCount; ii++ )
	{
		WorksheetPage wp;	
		Worksheet wksTemp;
		///Cheney 2007-1-11 NOT_SUPPORT_MULTIFILES_IMPORT_MODE
		if(ii == 0 && bEmptyPage)
		{
			wp = wpActive;
			
		}
		else
		{
			wksTemp.Create();
			wks = wksTemp;
			wks.GetParent(wp);
		}
		//if(ii != 0)
		//{
			//wksTemp.Create(); //different file in different book, because exists project(MPJ)
			//wks = wksTemp;
		//}
		//else
		//{
			//wks.GetParent(wp);
			//lyOlder = wp.Layers();
			//wks = GetTargetLayer(wp, nIndexLayer, ii, tnUsingFilter, true, orng, nFileImportMode, c1);
			//bNewLayer = !is_same_layer(lyOlder, wks); 
		//}
		///end NOT_SUPPORT_MULTIFILES_IMPORT_MODE
	
		//Tree trFileInfo;
		/// Hong 05/30/07 ADD_DATARANGE_FOR_ORGANIZER
		//nRet = readminitab(vsFileNames[ii], wks, finfo);
		DataRange drImported;
		nRet = readminitab(vsFileNames[ii], wks, finfo, 0, drImported);
		/// end ADD_DATARANGE_FOR_ORGANIZER
		
		/// Hong 06/07/05 v8.0635 ADD_OPTION_TREE_FOR_MAKE_FILTER
		setPageAndLayerName(drImported, vsFileNames[ii], tnUsingFilter, 0);
		impinfo_UpdateExistingData(wp, drImported);
		/// end ADD_OPTION_TREE_FOR_MAKE_FILTER
		
		if(nRet < 0)
		{
			_shift_error_code(nRet);
			XF_THROW_EX(nRet, vsFileNames[ii]);
		}	
		
		bEmptyLayer = (1 == is_sheet_empty(wks)) ? true : false;
		if ( bNewLayer && bEmptyLayer )
		{
			wks.Destroy();
		}
		set_active_layer(wp.Layers()); 
		
		//trInfo = trFileInfo.Header;  // no header info
		/// Hong 05/30/07 ADD_DATARANGE_FOR_ORGANIZER
		//impinfo_AddFile(wks, vsFileNames[ii], trInfo, ASCIMP_MODE_NEW_SHEETS, FILTER_TYPE_XFUNC, trFilter);
		Tree trDataRange;
		getRangeInfo(trDataRange, drImported);
		/// Hong 06/07/05 v8.0635 ADD_OPTION_TREE_FOR_MAKE_FILTER
		//impinfo_AddFile(wks, vsFileNames[ii], trInfo, ASCIMP_MODE_NEW_SHEETS, FILTER_TYPE_XFUNC, trFilter, ii + 1, trDataRange);
		impinfo_AddFile(wks, vsFileNames[ii], trInfo, ASCIMP_MODE_NEW_SHEETS, FILTER_TYPE_XFUNC, tnUsingFilter, ii + 1, trDataRange);
		/// end 
		/// end ADD_DATARANGE_FOR_ORGANIZER
		//refresh_organizer_gui(wp); ///---Sim 06-25-2007 UPDATE_ORGANIZER
	} 
	///end ADD_IMPORT_MODE
	
}

//nEventID < 0 on event, like GETNE_ON_INIT, GETNE_ON_OK etc, >0 on change from control
//return 0 to do nothing, return PEVENT_GETN_RET_TO_CLOSE to close dialog
//dwEnables = bOKEnable, bBTN1Enable, bBTN2Enable, bBTN3Enable, , can set to false to disable OK/Apply buttons
//lpcszNodeName = the trGetN TreeNode tag name that generates the event, or is  if GETNE_ON_OK etc
//strAux = optional string for XF Wizard Bar, like DLG_NEED_CHANGE_GRID etc, it will be invalid if from internal node value change event
//strErrMsg = allowing messages to be shown
int impMNTB_event1(TreeNode& trGetN, int nRow, int nEventID, DWORD& dwEnables, LPCSTR lpcszNodeName, WndContainer& DynaCntrlContainer, string& strAux, string& strErrMsg)
{
	if( xf_is_extended_event(nEventID) )
		return impMNTB_event1_ex(trGetN, nRow, nEventID, dwEnables, lpcszNodeName, DynaCntrlContainer, strAux, strErrMsg);
	DECLARE_BUTTON_ENABLES
	
	OK_SURE(bOKEnable); ///---Sim 11-16-2006 RELIABLE_OK_ENABLE
		
	///support D&D show Dlg, if trFiles no child, should construct it
	if ( (GETNE_ON_INIT == nEventID && trGetN.trFiles.Children.Count() == 0) || GETNE_ON_THEME == nEventID )
	{
		s_bFileValid = _file_name_event(trGetN, strErrMsg);
		s_bRangeValid = !trGetN.orng.strVal.IsEmpty();
		if(!s_bRangeValid)
			strErrMsg = CER_INVALID_PAGE;
		
		OK_SURE(bOKEnable);	
		return true;
	}
	
	///Cheney 2006-12-28 ADD_IMPORT_MODE
	if ( 0 == lstrcmp(lpcszNodeName, "fname") )
	{
		s_bFileValid = _file_name_event(trGetN, strErrMsg);
		OK_SURE(bOKEnable);
		return true;
	}
	
	//check range if is invalid
	if( 0 == lstrcmp(lpcszNodeName, "orng") )
	{
		s_bRangeValid = !trGetN.orng.strVal.IsEmpty();
		if(!s_bRangeValid)
			strErrMsg = CER_INVALID_PAGE;
		
		OK_SURE(bOKEnable);
		return true;
	}
	//return bOKEnable;
	/////---Sim 11-20-2006 SUPPORT_DND_OPEN_DIALOG
	//if ( GETNE_ON_INIT == nEventID || GETNE_ON_THEME == nEventID )
	//{
		//s_bFileValid = file_name_event(trGetN, strErrMsg);
		//OK_SURE(bOKEnable);
		//return true;
	//}
	/////---END SUPPORT_DND_OPEN_DIALOG
	//
	/////---Sim 11-1-2006 CHECK_FILE_NAME
	//string strTagName = lpcszNodeName;
	//if(strTagName == "fname") // file name changed, either on start of later user changed
	//{
		/////---Sim 11-20-2006 SUPPORT_DND_OPEN_DIALOG
		//s_bFileValid = file_name_event(trGetN, strErrMsg);
		//OK_SURE(bOKEnable);
		//return true;
		///*
		//s_bFileValid = true; ///---Sim 11-16-2006 RELIABLE_OK_ENABLE
		//OK_SURE(bOKEnable); ///---Sim 11-16-2006 RELIABLE_OK_ENABLE
	//
		/////---Sim 10-30-2006 ERROR_MESSAGE
		//int nErrCode = CER_NO_ERROR;
		//int nInvalidFileIdx = 0;
	//
		//if ( trGetN.fname.strVal.IsEmpty() )
		//{
			//nErrCode = CER_EMPTY_FILENAME;
		//}
		//else if ( !is_valid_filename(trGetN.fname.strVal, nInvalidFileIdx) )
		//{
			//nErrCode = CER_INVALID_FILENAME_INDEX;
		//}
				//
		//if(CER_NO_ERROR != nErrCode)
		//{
			//strErrMsg = nErrCode;
			//
			//if ( CER_INVALID_FILENAME_INDEX == nErrCode )
			//{
				//strErrMsg += ":";
				//strErrMsg += nInvalidFileIdx;
			//}
			//
			////DynaCntrlContainer.PostMessage(WM_USER_MSG_ON_DLG, nErrCode, nInvalidFileIdx);    
			//s_bFileValid = false; ///---Sim 11-16-2006 RELIABLE_OK_ENABLE
			//OK_SURE(bOKEnable); ///---Sim 11-16-2006 RELIABLE_OK_ENABLE
			//
			////return true;
		//}
		/////---END ERROR_MESSAGE
		//
		//return true;
		//*/
		/////---END SUPPORT_DND_OPEN_DIALOG
	//}
	/////---END CHECK_FILE_NAME
	return false;
	///end ADD_IMPORT_MODE

}

int impMNTB_make_tree(TreeNode& tr, LPCSTR lpcszVarName)
{
	/// Hong 06/07/05 v8.0635 ADD_OPTION_TREE_FOR_MAKE_FILTER
	if ( 0 == strcmp(lpcszVarName, "options") )
	{
		constructOptionsForXF(tr, true, false, false, false, false, false);
		/// Hong QA80-9255 v8.0878 MINITAB_DEFAULT_KEEP_SHEET_NAME_FROM_FILE
		TreeNode	trRenameWks;
		trRenameWks = tree_get_node_by_id(tr, IDE_XFIMP_RENAMEWKS, true);
		if ( trRenameWks )
			trRenameWks.nVal = 0;
		/// end MINITAB_DEFAULT_KEEP_SHEET_NAME_FROM_FILE
		fuSetXFunctionName(tr, "impMNTB");
		return 0;
	}
	///---END ADD_OPTION_TREE_FOR_MAKE_FILTER
	return false;
}
//nGetNDialog = 0,1,2, corresponding to the XF GetN dropdown, 0 = dialog is not used
//you can change nRet to be one of XFEVT_PROCEED (defualt), XFEVT_ABORT, XFEVT_PROCEED_NO_DLG or XFEVT_PROCEED_WITH_DLG(when nGetNDialog = 0)
//nGetNDialog = -1 when Ok on GetN dialog to allow handler to preocess <auto> etc variables
//dwCntrl is combination of bits
//LTXF_FROM_GUI_MENU, LTXF_FROM_GUI_PROMPT, LTXF_FROM_AUTO_UPDATE, LTXF_FROM_FUNCTION, LTXF_THEME_USED, LTXF_CHANGE_PARAM
void impMNTB_before_execute(TreeNode& trGetN, int nGetNDialog, int& nRet, int dwCntrl)
{
	if(nGetNDialog > 0)
	{
		trGetN.finfo.Show = 0;			/// AW 08/15/06 NEW_DLG_OF_IMPORT 
		//trGetN.trFilter.Show = 0; // Hong 06/07/05 v8.0635 ADD_OPTION_TREE_FOR_MAKE_FILTER
	}
	/// Hong 06/07/05 v8.0635 ADD_OPTION_TREE_FOR_MAKE_FILTER
	/*
	///Cheney 2006-12-28 ADD_IMPORT_MODE
	if(nGetNDialog >= 0)
	{
		if ( LTXF_FROM_GUI_MENU == dwCntrl )
			trGetN.fname.strVal = "";
		TreeNode trFilter = trGetN.trFilter;
		if ( trFilter.IsValid() && trFilter.GetNodeCount()>0 )
		{
			int nImportMode = IML_NEW_SHT; // default new sheet
			switch ( fuGetImportMode(trFilter) )
			{
			case ASCIMP_MODE_REPLACE_DATA:
				nImportMode = IML_REPLACE;
				break;
			case ASCIMP_MODE_NEW_BOOKS:
				nImportMode = IML_NEW_BK;
				break;
			case ASCIMP_MODE_NEW_SHEETS:
				nImportMode = IML_NEW_SHT;
				break;
			default:
			}
			trGetN.impmode.nVal = nImportMode; 
		}
	}
	///end ADD_IMPORT_MODE
	*/
	/// end ADD_OPTION_TREE_FOR_MAKE_FILTER
	/// Hong 12/22/06 CHECK_FNAME_EMPTY_UNASSIGNED
	if(nGetNDialog > -1)
	{
		string strFileName = trGetN.fname.strVal;
		
		/// Hong 04/10/07 v8.0597b IGNORE_FNAME$_WHEN_FROM_MENU
		if ( LTXF_FROM_GUI_MENU & dwCntrl ) // if from menu, ignore default value fname$
			strFileName = "";
		/// end IGNORE_FNAME$_WHEN_FROM_MENU
		
		if(is_empty_or_unassigned(strFileName))
		{			
			/// Hong 05/31/07 v8.0630 MORE_ON_ACCESS_TO_FDLOG
			//int nFilesRet = get_open_box_by_file_group(strFileName, "MiniTab", "MiniTab", true);
			int nFilesRet;
			if ( 0 != nGetNDialog )
			{
				int nShowOptionsDlg = 1;
				/// Hong 09/26/07 8.0709 CLEAN_OPEN_SAVE_DIALOG_TITLE_TO_DEFAULT
				//nFilesRet = get_open_box_by_file_group(strFileName, "MiniTab", _L("MiniTab"),
				//	OPENBOX_FLAG_MULTIFILES, NULL, NULL, _L("Show Options Dialog"), &nShowOptionsDlg);
				nFilesRet = get_open_box_by_file_group(strFileName, "MiniTab", NULL,
					OPENBOX_FLAG_MULTIFILES, NULL, NULL, STR_SHOW_OPT_DLG, &nShowOptionsDlg);
				/// end CLEAN_OPEN_SAVE_DIALOG_TITLE_TO_DEFAULT
				nRet = (nShowOptionsDlg ? XFEVT_PROCEED : XFEVT_PROCEED_NO_DLG);
			}
			else
			{
				/// Hong 09/26/07 8.0709 CLEAN_OPEN_SAVE_DIALOG_TITLE_TO_DEFAULT
				//nFilesRet = get_open_box_by_file_group(strFileName, "MiniTab", _L("MiniTab"), true);
				nFilesRet = get_open_box_by_file_group(strFileName, "MiniTab", NULL, true);
				/// end CLEAN_OPEN_SAVE_DIALOG_TITLE_TO_DEFAULT
			}
			/// end MORE_ON_ACCESS_TO_FDLOG
			/// end THEME_FILENAME_WORKBOOK_AND_WORKSHEET
			if ( 0 == nFilesRet )
			{
				nRet = XFEVT_ABORT;
				//warning_msg_box(XFERR_UI_USER_CANCEL, false);
				return;
			}
			///---END HANDLE_USER_CANCEL_OPEN_FILE_BOX
			trGetN.fname.strVal = strFileName;
			string strErrMsg;
			if( !_file_name_event(trGetN, strErrMsg) )
			{
				/// Hong 03/21/07 v8.0586 FIX_FAIL_DUMP_CORRECT_ERROR_STRING
				//nRet = XFEVT_ABORT;
				//warning_msg_box(strErrMsg, false);
				int nErrMsg = atoi(strErrMsg);
				nRet = XFEVT_ABORT;
				warning_msg_box(nErrMsg, false, 'E'); // should pass an int ///---Sim 06-19-2007 IMPROVE_WARNING_MESSAGE_POST_FUNCTION
				/// end FIX_FAIL_DUMP_CORRECT_ERROR_STRING
				return;
			}
		}
	}
	/// end CHECK_FNAME_EMPTY_UNASSIGNED
}
//nEventID < 0 on event, like GETNE_ON_INIT, GETNE_ON_OK etc, >0 on change from control
//return 0 to do nothing, return PEVENT_GETN_RET_TO_CLOSE to close dialog
//dwEnables = bOKEnable, bBTN1Enable, bBTN2Enable, bBTN3Enable, , can set to false to disable OK/Apply buttons
//lpcszNodeName = the trGetN TreeNode tag name that generates the event, or is  if GETNE_ON_OK etc
//strAux = optional string for XF Wizard Bar, like DLG_NEED_CHANGE_GRID etc, it will be invalid if from internal node value change event
//strErrMsg = allowing messages to be shown
int impMNTB_event1_ex(TreeNode& trGetN, int nRow, int nEventID, DWORD& dwEnables, LPCSTR lpcszNodeName, WndContainer& DynaCntrlContainer, string& strAux, string& strErrMsg)
{
	return false;
}
