/*------------------------------------------------------------------------------*
 * File Name: ColMatValues.h													*
 * Creation:																	*
 * Purpose:												 						*
 * Copyright (c) OriginLab Corp.	2005										*
 * All Rights Reserved															*
 * 																				*
 * Modification Log:															*
 *	Kyle 12/08/2008 CHECK_IF_RANGE_SELECTED_DIFFERENT_FROM_FORMULA_RANGE		*
 *	Kyle 12/17/2008 QA80-12790-P1 v8.0988 CENTRALIZE_CODE_ABOUT_FUNCTIONS_LIST_TO_FUNCTIONS_MENU
 *	YuI 02/04/09 QA70-12831 COLUMN_FORMULA_TO_REMEMBER_THE_RANGE				*
 *	Jasmine 03/04/09 DEFINE_LT_VAR_BUTTON										*
 *	Kenny 04/27/2009 QA80-13519-P1 SET_COL_VAL_DLG_SHOULD_BE_MODAL_IF_CHANGE_PARAMETER
 *	Kenny 04/27/2009 QA80-13519-P2 SET_COL_VAL_DLG_COL_MENU_IS_TOO_SHORT		*
 *	Kyle 04/30/2009 SUPPORT_DEFINING_VARIABLES_IN_SET_VALUES_DIALOG				*
 *	Sim 06-02-2009 QA80-4584 EXTRACT_WKS_SUPPORT_AUTO_UPDATE					*
 *	Kyle 06/25/2009 ADD_TWO_BUTTONS_TO_DEF_VAR_AND_RESTORE_MENU					*
 *	Kyle 07/14/2009 QA80-13746 SHOWING_BOTH_LN_AND_SN_WITH_STANDARD_NOTATION_IN_THE_MENU_OF_SET_COLUMN_VALUE_DLG
 *	CPY 7/18/09 QA80-13746 SCV_COL_FX_MENU_SHOW_SN_LN_CLEANUP					*
 *	Kyle 07/27/2009 QA80-13746-P5 CONSIDER_MAT_IN_COL_MAT_MENU					*
 *	Kyle 08/20/2009 UPDATE_THE_DIALOG_MENU_ONLY_ON_SELECTED_PAGE_CHANGED		*
 *	Kyle 08/26/2009 INSERT_MULTIPLE_TIMES_FOR_SCV								*
 *	Kenny 09/01/2009 QA81-14241 DEFINE_VARIABLE_MENU_WANTED						*
 *	Kyle 09/14/2009 QA80-12308 NO_NEED_TO_SWITCH_SUB_MENU_TITLES_SINCE_IT_IS_LOADED_FROM_DIFF_RESOURCE
 *	Sophy 11/6/2009 QA80-14584 MORE_WORK_ON_SCV_FUTTING_FUNCTIONS_MENU			*
 *------------------------------------------------------------------------------*/


#ifndef _COL_MAT_VALUES_H_
#define _COL_MAT_VALUES_H_

//#define STR_DLG_NAME 					_L("ColMatSetValuesDlg") //_L("Properties")
//#define STR_COL_SET_VALUE				_L("Set Values")
//#define STR_SET_VALUES_TITLE			_L("Set Values")
#define STR_DLG_NAME					_L("Set Values")
///---Sim 06-02-2009 QA80-4584 EXTRACT_WKS_SUPPORT_AUTO_UPDATE
// move to OC_const.h
//#define STR_AUTO_UPDATE					"AutoUpdate"
///---END QA80-4584 EXTRACT_WKS_SUPPORT_AUTO_UPDATE
/*
#define ERRMSG_RENAME_FAIL(_ColName)	_L("Column name ")+_ColName+_L(" has already been used by another column, Please choose another name.")
#define ERRMSG_ENUMERATE_NAME_FAIL 		_L("One of enumerate name has been used by another column.")
#define ERRMSG_ERROR_FORMULA			_L("Unmatched parethesis are found in column formula.")

#define PROMPT_MSG_APPLY_CHANGE			_L("Would you like to apply the change now?\nClick 'No' the change will lose.")

#define ROW_COL_NAME				0
#define ROW_COL_FORMAT				4
#define ROW_COL_NUMERIC_DISPLAY		6
#define ROW_COL_NUMERIC_INPUT		ROW_COL_NUMERIC_DISPLAY+1
#define ROW_COL_WIDTH				m_treeEditCntrl.GetRows()-2

#define	COLUMN_TYPE_SEL_TEXT_NUMERIC		6
#define COLUMN_INTERNAL_DATA_SEL_COMPLEX	4

enum {COL_TAB_PROPERTIES, COL_TAB_SET_VALUES};

enum {COL_NAME_SET_SUCCESS, COL_NAME_ALREADY_EXIST, COL_NAME_ENUMERATE_FAIL};
enum {COL_UPDATE_FINISHED, COL_READ_DETAIL };
*/

///DG 7/21/05
///Kenny 04/27/2009 QA80-13519-P2 SET_COL_VAL_DLG_COL_MENU_IS_TOO_SHORT
//#define MAX_COL_NUM_IN_MENU						9	//we only have 10 id, so this number must less than 10
#define MAX_COL_NUM_IN_MENU						((IDC_SET_VALUE_COL_LIST_END - IDC_SET_VALUE_COL_LIST_BEGIN) / 2 - 1)
///End QA80-13519-P2 SET_COL_VAL_DLG_COL_MENU_IS_TOO_SHORT
#define STR_FAVORITE_LIST_SETTING_FILE			okutil_get_origin_path(ORIGIN_PATH_USER) + STR_ORIGIN_INI_FILE_NAME
/// Iris 01/04/2009 v8.0993c MAT_WKS_SHOULD_HOLD_DIFF_FAVORITE_LIST
//#define STR_FAVORITE_SECTIONS					"User Favorites"
#define STR_WKS_FAVORITE_SECTIONS				"Wks User Favorites"
#define STR_MAT_FAVORITE_SECTIONS				"Mat User Favorites"
///end MAT_WKS_SHOULD_HOLD_DIFF_FAVORITE_LIST
#define STR_FAVORITE_FUNCTIONS_PREFIX			"Func"
///Jasmine 05/12/06 ADD_FORMULA_LIST5/12/06 FORMULA_SAVE_TO_SEPARATE_FILE
//----- CPY 5/12/06 FORMULA_SAVED_TO_SEPARATE_FILE
#define STR_FORMULA_SECTIONS					"SetColVal Formula"
///Jasmine 08/28/06 SHARE_DLG_WITH_MAT
#define STR_MFORMULA_SECTIONS					"SetMatVal Formula"
#define MIN_MAIN_DLG_WIDTH 						400			///Kyle 07/14/08 QA80-11830 LIMIT_THE_MIN_WIDTH_OF_SET_COLUMN_VALUES_DLG
#define STR_FORMULA_PREFIX						"Formula"
//#define IDC_FORMULA							50000
//#define STR_FAVORITE_FORMULA_FILE_SYS			okutil_get_origin_path(ORIGIN_PATH_SYSTEM)+"formula.txt"	//CPY 5/17/06, can use same filename, just location difference, so system is sample
#define STR_FAVORITE_FORMULA_FILE				"formula.txt"//okutil_get_origin_path(ORIGIN_PATH_USER)+"formula.txt"
#define STR_FAVORITE_MFORMULA_FILE				"mformula.txt"
///End Jasmine 08/28/06 SHARE_DLG_WITH_MAT
//for now, number of samples is no more than 15
#define IDC_LOAD_FORMULA_SAMPLE					IDC_FILE_OPEN //IDC_FORMULA_BEGIN //CPY 5/17/06 40960 is the starting ID for internal menu, so better use smaller IDs
#define IDC_LOAD_FORMULA						(IDC_LOAD_FORMULA_SAMPLE+15)// cannot use 50000 as it will be in conflict with global menuids
#define MAX_FORMULA_IN_MENU						50 //CPY 5/17/06, this should be enough
#define	IDC_LOAD_FORMULA_END					(IDC_LOAD_FORMULA + MAX_FORMULA_IN_MENU) 
#define IDC_RECENT_FILE_LIST_BEGIN2				IDC_XFM_RECENT_FILE_LIST_BEGIN
//-----
///End ADD_FORMULA_LIST
//---Jasmine 11/26/08 v8.0980 find ID conflic with IDC_SET_VALUE_EMPTY15
//#define IDC_BROWSE_COLUMNS_SEPARATOR  			IDC_XFM_SEPARATOR	///Jasmine 04/25/06 MODIFICATION_UPDATE_COLUMN_LIST
#define IDC_BROWSE_COLUMNS_SEPARATOR  			(IDC_XFM_SEPARATOR+1000)
//---

//#define USE_RICH_EDIT_DIRECTLY_IN_BOTTOM_PANE	//------Folger 07/20/07 USE_RICH_EDIT_DIRECTLY_IN_BOTTOM_PANE

/// Iris 01/04/2009 v8.0993c RECONSTRUCT_FUNCTION_MENU_SWITCH_MAT_AND_WKS
enum {
	MENU_NOT_INIT = 0,
	MENU_REINIT,
	MENU_INIT
};
///end RECONSTRUCT_FUNCTION_MENU_SWITCH_MAT_AND_WKS

class SetValuesMenu : public Menu
{
public:
	SetValuesMenu(HMENU &hMenu);
	~SetValuesMenu();
	
	BOOL Load(HMENU hMenu);					///Kyle 08/20/2009 UPDATE_THE_DIALOG_MENU_ONLY_ON_SELECTED_PAGE_CHANGED
	
	///Jasmine 08/28/06 SHARE_DLG_WITH_MAT
	/// Iris 01/04/2009 v8.0993c RECONSTRUCT_FUNCTION_MENU_SWITCH_MAT_AND_WKS
	//void ConstructDlgMenu(const vector<string>& vsColNames, bool bUpdateFunc, bool bSwitch, int nType);///Jasmine 04/25/06 MODIFICATION_UPDATE_COLUMN_LIST 
	///Kyle 07/14/2009 QA80-13746 SHOWING_BOTH_LN_AND_SN_WITH_STANDARD_NOTATION_IN_THE_MENU_OF_SET_COLUMN_VALUE_DLG
	//void ConstructDlgMenu(const vector<string>& vsColNames, int nFuncMenuInitMode, bool bSwitch, int nType);
	void ConstructDlgMenu(const vector<string>& vsColSNames, const vector<string>& vsColLNames, int nFuncMenuInitMode, bool bSwitch, int nType);
	///Kyle 07/27/2009 QA80-13746-P5 CONSIDER_MAT_IN_COL_MAT_MENU
	//string GetColumnString(int uCmdID, Worksheet* pwks);//----- CPY 7/18/09 QA80-13746 SCV_COL_FX_MENU_SHOW_SN_LN_CLEANUP, added wks
	string GetColumnString(int uCmdID, Datasheet* pDs);//----- CPY 7/18/09 QA80-13746 SCV_COL_FX_MENU_SHOW_SN_LN_CLEANUP, added wks
	///End CONSIDER_MAT_IN_COL_MAT_MENU
	///End SHOWING_BOTH_LN_AND_SN_WITH_STANDARD_NOTATION_IN_THE_MENU_OF_SET_COLUMN_VALUE_DLG
	///end RECONSTRUCT_FUNCTION_MENU_SWITCH_MAT_AND_WKS

	///Kyle 12/17/2008 QA80-12790-P1 v8.0988 CENTRALIZE_CODE_ABOUT_FUNCTIONS_LIST_TO_FUNCTIONS_MENU
	//void UpdateFuncHistoryList(const string& strNew);
	///End CENTRALIZE_CODE_ABOUT_FUNCTIONS_LIST_TO_FUNCTIONS_MENU
	void UpdateFormulaHistoryList(const string& strNew);
	string GetMenuString(int uCmdID);
	void AddToFormulaList(LPCSTR lpcsz, int nNum = 0, bool bUser = true);///Jasmine 05/12/06 ADD_FORMULA_LIST

	FunctionsMenu*	GetFunctionsMenu(){ return m_pFuncMenu; } ///Sophy 11/6/2009 QA80-14584 MORE_WORK_ON_SCV_FUTTING_FUNCTIONS_MENU
private:
	void addToFavoritesList(const vector<string>& vsList, bool bFunc = true);
	void loadFavorite();
	void saveFavorite();
	void clearFavoriteList();
	//void update_submenu_titles(BOOL bMatrix);		///Kyle 09/14/2009 QA80-12308 NO_NEED_TO_SWITCH_SUB_MENU_TITLES_SINCE_IT_IS_LOADED_FROM_DIFF_RESOURCE
	
private:
	///Kyle 12/17/2008 QA80-12790-P1 v8.0988 CENTRALIZE_CODE_ABOUT_FUNCTIONS_LIST_TO_FUNCTIONS_MENU
	//vector<string>			m_vsRecFunc;			// moved to class FunctionsMenu
	///End CENTRALIZE_CODE_ABOUT_FUNCTIONS_LIST_TO_FUNCTIONS_MENU
	vector<string>			m_vsRecFormula;
	int 					m_nCols;	///Jasmine 04/25/06 MODIFICATION_UPDATE_COLUMN_LIST
	int						m_nSample;
	int						m_nFormula;
	int						m_nRecFormula;
	string					m_strSection;
	string					m_strFile;
	//BOOL					m_bMatrixTags;		///Kyle 09/14/2009 QA80-12308 NO_NEED_TO_SWITCH_SUB_MENU_TITLES_SINCE_IT_IS_LOADED_FROM_DIFF_RESOURCE
	FunctionsMenu*			m_pFuncMenu;		///Sophy 11/6/2009 QA80-14584 MORE_WORK_ON_SCV_FUTTING_FUNCTIONS_MENU
	///End SHARE_DLG_WITH_MAT
};


class ColValuesDlg : public MultiPaneDlg//ResizeDialog///Jasmine 04/30/06 MULTI_FOR_PREVIOUS_SCRIPT
{
public:
	///Kenny 04/27/2009 QA80-13519-P1 SET_COL_VAL_DLG_SHOULD_BE_MODAL_IF_CHANGE_PARAMETER
	//ColValuesDlg() : MultiPaneDlg(IDD_SET_VALUES, "ODlg8")//ResizeDialog(IDD_SET_VALUES, "ODlg8")
	ColValuesDlg(BOOL bAllowChangeCol = TRUE, BOOL bDeleteOnDestroy = FALSE) : MultiPaneDlg(IDD_SET_VALUES, "ODlg8")//ResizeDialog(IDD_SET_VALUES, "ODlg8")
	///End QA80-13519-P1 SET_COL_VAL_DLG_SHOULD_BE_MODAL_IF_CHANGE_PARAMETER
	{
		//vector<uint> vnBtns = {IDOK, IDCANCEL, IDC_APPLY_BTN, IDC_UNDO_BTN, 0}; ///DG 8/19/05 : undo not powerful, cause confusing
		vector<uint> vnBtns = {IDOK, IDCANCEL, IDC_APPLY_BTN, 0};
		m_vnBtns = vnBtns;
		///Kenny 04/28/2009 QA80-13519-P1 SET_COL_VAL_DLG_SHOULD_BE_MODAL_IF_CHANGE_PARAMETER
		m_bAllowChangeCol = bAllowChangeCol;
		m_bDeleteOnDestroy = bDeleteOnDestroy;
		///End QA80-13519-P1 SET_COL_VAL_DLG_SHOULD_BE_MODAL_IF_CHANGE_PARAMETER
	}
	~ColValuesDlg() {;}
	
	
	int Create(HWND hWndParent = NULL)
	{
		InitMsgMap();
		DWORD dwDlgOptions = 0;//DLG_NO_DEFAULT_REPOSITION; CPY 6/22/2006 MODELESS_DLG_NOT_REMEMBER_SIZE_POS
		int nRet = Create(hWndParent, dwDlgOptions);
		Visible = true;
		return nRet;
	}
	
	
	//--- CPY 7/25/05 COL_SET_VALUES_MODAL
	int DoModalEx(HWND hWndParent = NULL)
	{
		InitMsgMap();
		DWORD dwDlgOptions = DLG_NO_DEFAULT_REPOSITION;
		int nRet = DoModal(hWndParent, dwDlgOptions);
		return nRet;
	}
	//---

protected:
EVENTS_BEGIN
	ON_INIT(OnInitDialog) 
	ON_DESTROY(OnDestroy)
	ON_READY(OnReady)
		
	ON_SYSCOMMAND(OnSystemCommand)
	
	ON_SIZE(OnDlgResize)
	ON_GETMINMAXINFO(OnMinMaxInfo) //---- CPY 5/14/06 BETTER_DIALOG_POS_SIZE
	//ON_KEY(IDC_SET_VAL_EXPRESSIONS, OnOCEditorKey)	///DG 7/28/05	///Jasmine 01/15/07 REMOVE_FUNCTION_BROWSER, we do not plan to accomplish Function Brower in 8.0
	
	ON_OK(OnClickOK)
	ON_CANCEL(OnClickCancel)
	
	ON_MENU_CMD_RANGE(IDC_SET_VALUE_COL_LIST_BEGIN, IDC_SET_VALUE_COL_LIST_END, OnSelCols)
	///Kyle 12/17/2008 QA80-12790-P1 v8.0988 CENTRALIZE_CODE_ABOUT_FUNCTIONS_LIST_TO_FUNCTIONS_MENU
	//ON_MENU_CMD_RANGE(IDC_RECENT_FILE_LIST_BEGIN, IDC_RECENT_FILE_LIST_END, OnSelFromHistory)
	///End CENTRALIZE_CODE_ABOUT_FUNCTIONS_LIST_TO_FUNCTIONS_MENU
	ON_MENU_CMD_RANGE(IDC_BASIC_FUNCTIONS_BEGIN, IDC_BASIC_FUNCTIONS_END, OnSelFunction)
	ON_MENU_CMD(IDC_BROWSE_COLUMNS, OnOpenBrowser)
	ON_MENU_CMD(IDC_BROWSE_COLUMNS2, OnOpenBrowser2)
	//ON_MENU_CMD(IDC_FUNCTION_BROWSER, OnOpenFB)	///Jasmine 01/15/07 REMOVE_FUNCTION_BROWSER
	ON_MENU_CMD_RANGE(IDC_RECENT_FILE_LIST_BEGIN2, IDC_RECENT_FILE_LIST_BEGIN2 + MAX_COL_NUM_IN_MENU, OnSelFromLastUse)
	ON_MENU_CMD_RANGE(IDC_LOAD_FORMULA_SAMPLE, IDC_LOAD_FORMULA - 1, OnLoadSample)
	///Jasmine 05/12/06 ADD_FORMULA_LIST
	ON_MENU_CMD_RANGE(IDC_LOAD_FORMULA, IDC_LOAD_FORMULA_END, OnLoadFormula)
	ON_MENU_CMD(IDC_SAVE_FORMULA, OnSaveFormula)
	ON_MENU_CMD(IDC_SAVE_FORMULA_AS, OnSaveFormulaAs)
	///End ADD_FORMULA_LIST
	ON_MENU_CMD(IDC_INSERT_RANGE_VARIABLE, InsertRangeVariable)
	ON_MENU_CMD(IDC_INSERT_INFO_VARIABLE, InsertInfoVariable)
	ON_MENU_CMD(IDC_INSERT_COL_LABEL_CELL, InsertColLabelVariable)
#ifdef SET_VALUES_SET_FONTS_FOR_RICH_EDIT	//---CPY 10/2/2007 REMOVE_FORMAT_FONT_FROM_SET_VALUES
	/// TD 09-13-2007 QA80-10375 SUPPORT_USER_FONTS_IN_MULTILINE_DDK_RICHEDITS
	ON_MENU_CMD(IDC_UPDATE_FONT, OnUpdateFont)
	/// end SUPPORT_USER_FONTS_IN_MULTILINE_DDK_RICHEDITS
#endif
	ON_HELPINFO(OnHelp) //--- CPY 10/10/2007 SEP_HELP_ID_FOR_COL_MAT_DLG
	
	ON_BN_CLICKED(IDC_APPLY_BTN, OnApply)
	ON_BN_CLICKED(IDC_UNDO_BTN, OnUndo)
	ON_BN_CLICKED(IDC_PREVIOUS_BTN, OnClickPrevious)
	ON_BN_CLICKED(IDC_NEXT_BTN, OnClickNext)
	//----Jake 04/18/07
	ON_BN_CLICKED(IDC_LAST_BTN, OnClickLast)
	ON_BN_CLICKED(IDC_FIRST_BTN, OnClickFirst)
	//----
	///Jasmine 03/04/09 DEFINE_LT_VAR_BUTTON
#ifdef SET_VALUES_SUPPORT_DEFINE_VARIBLE
	///Kyle 06/25/2009 ADD_TWO_BUTTONS_TO_DEF_VAR_AND_RESTORE_MENU
	//ON_BN_CLICKED(IDC_DEFINE_BTN, OnDefineVar)
	ON_BN_CLICKED(IDC_DEFINE_RANGE_BTN, OnDefRngVar)
	ON_BN_CLICKED(IDC_DEFINE_PAGE_INFO_BTN, OnDefPageInfoVar)
	///End ADD_TWO_BUTTONS_TO_DEF_VAR_AND_RESTORE_MENU
#endif //SET_VALUES_SUPPORT_DEFINE_VARIBLE
	///End DEFINE_LT_VAR_BUTTON
	///Jasmine 04/24/06 SET_COL_VAL_DLG_MODELESS
	ON_CHANGE_LAYER( OnActiveLayerChange )
	ON_CHANGE_PAGE( OnActivePageChange )
	ON_CHANGE_SELECTION( OnSelectionChange )
	ON_CHANGE_DATASET(OnChangeDataset )	///Jasmine 10/23/06 UPDATE_IF_MATOBJ_CHANGE
	///End
	ON_EN_CHANGE(IDC_SET_VAL_EXPRESSIONS, OnExpressionChange)
	ON_EN_CHANGE(IDC_SET_VAL_PRE_SCRIPTS, OnExpressionChange)
	ON_EN_CHANGE(IDC_SET_VAL_ROW_FROM_ED, OnRowRangeChange)
	ON_EN_CHANGE(IDC_SET_VAL_ROW_TO_ED, OnRowRangeChange)
	//------- CPY 07/26/06 QA70-8847 COLUMN_FORMULA_FROM_ORIGIN_C_REVAMP
	//ON_BN_CLICKED(IDC_SET_VAL_AUTO_CHK, OnCheckAutoUpdate)
	ON_CBN_SELCHANGE(IDC_SET_VAL_AUTO_CHK, OnChangeAutoUpdate)
	//-------
	ON_BN_CLICKED(IDC_SHOW_BOTTOM, OnShowBottomPane)///Jasmine 04/30/06 MULTI_FOR_PREVIOUS_SCRIPT

	ON_USER_MSG(WM_USER_APPLY_FINISHED, OnFinishApply)///Sophy 5/12/2008 v8.0860 QA80-11031-P1 FIX_LOADING_SAMPLE_FORMULA_INFINITE_LOOP_ON_CLICK_APPLY

	ON_USER_MSG(WM_USER_VARIABLE_CLICK_INSERT, OnInsertVars)	///Kyle 08/26/2009 INSERT_MULTIPLE_TIMES_FOR_SCV
	///Kyle 11/04/2009 QA80-14584 SCV_ADD_FITTING_FUNCTIONS
#ifdef _ADD_FITTING_FUNCTIONS_TO_SCV
	ON_CMD_UI_UPDATE_RANGE(IDC_FITTING_FUNC_CATEGORY_BEGIN, IDC_FITTING_FUNC_CATEGORY_BEGIN + FITTING_FUNC_CATEGORY_NUM, OnUIUpdateFittingFunc)
#endif // _ADD_FITTING_FUNCTIONS_TO_SCV
	///End SCV_ADD_FITTING_FUNCTIONS
EVENTS_END

	BOOL OnInitDialog();
	BOOL OnReady();
	BOOL OnDestroy();
	BOOL OnDlgResize(int nType, int cx, int cy);

	int	GetTotalWidth(bool bMin = false);	///Kyle 07/14/08 QA80-11830 LIMIT_THE_MIN_WIDTH_OF_SET_COLUMN_VALUES_DLG

	//BOOL OnOCEditorKey(Control oCntrl, UINT msg, UINT wParam, UINT lParam);	///Jasmine 01/15/07 REMOVE_FUNCTION_BROWSER
	BOOL OnClickOK();
	BOOL OnClickCancel();
	
	BOOL OnHelp(int &nHelpID, int nIdCtrlFocus);//--- CPY 10/10/2007 SEP_HELP_ID_FOR_COL_MAT_DLG

	BOOL OnSelCols(int nID);
	///Kyle 12/17/2008 QA80-12790-P1 v8.0988 CENTRALIZE_CODE_ABOUT_FUNCTIONS_LIST_TO_FUNCTIONS_MENU
	//BOOL OnSelFromHistory(int nID);
	///End CENTRALIZE_CODE_ABOUT_FUNCTIONS_LIST_TO_FUNCTIONS_MENU
	BOOL OnSelFunction(int nID);
	BOOL OnOpenBrowser(){return openBrowser();} //Short Name
	BOOL OnOpenBrowser2(){return openBrowser(false);}//Index
	//BOOL OnOpenFB();	///Jasmine 01/15/07 REMOVE_FUNCTION_BROWSER
	BOOL OnSelFromLastUse(int nID);
	BOOL OnLoadSample(int nID);
	///Jasmine 05/12/06 ADD_FORMULA_LIST
	BOOL OnLoadFormula(int nID);
	BOOL OnSaveFormula();
	BOOL OnSaveFormulaAs();
	///End ADD_FORMULA_LIST
#ifdef SET_VALUES_SET_FONTS_FOR_RICH_EDIT	//---CPY 10/2/2007 REMOVE_FORMAT_FONT_FROM_SET_VALUES
	/// TD 09-13-2007 QA80-10375 SUPPORT_USER_FONTS_IN_MULTILINE_DDK_RICHEDITS
	BOOL OnUpdateFont();
	/// end SUPPORT_USER_FONTS_IN_MULTILINE_DDK_RICHEDITS
#endif	
	BOOL OnApply(Control ctrl);
	BOOL OnUndo(Control ctrl);
	BOOL OnClickPrevious(Control ctrl);
	BOOL OnClickNext(Control ctrl);
	//----Jake 04/18/07
	BOOL OnClickLast(Control ctrl);
	BOOL OnClickFirst(Control ctrl);
	//----Jake
	///Jasmine 03/04/09 DEFINE_LT_VAR_BUTTON
#ifdef SET_VALUES_SUPPORT_DEFINE_VARIBLE
	///Kyle 06/25/2009 ADD_TWO_BUTTONS_TO_DEF_VAR_AND_RESTORE_MENU
	//BOOL OnDefineVar(Control ctrl);
	BOOL OnDefRngVar(Control ctrl);
	BOOL OnDefPageInfoVar(Control ctrl);
	///End ADD_TWO_BUTTONS_TO_DEF_VAR_AND_RESTORE_MENU
	/// Kenny 09/01/2009 QA81-14241 DEFINE_VARIABLE_MENU_WANTED
	BOOL InsertRangeVariable();
	BOOL InsertInfoVariable();
	BOOL InsertColLabelVariable();
	BOOL OpenInsertInfoDlg(bool bSwitchToLabelTab = false);
	/// End QA81-14241 DEFINE_VARIABLE_MENU_WANTED
#endif //SET_VALUES_SUPPORT_DEFINE_VARIBLE
	///End DEFINE_LT_VAR_BUTTON
	///Jasmine 04/24/06 SET_COL_VAL_DLG_MODELESS
	BOOL OnActiveLayerChange();
	BOOL OnActivePageChange();
	BOOL OnSelectionChange();
	BOOL OnChangeDataset();	///Jasmine 10/23/06 UPDATE_IF_MATOBJ_CHANGE
	
	BOOL OnExpressionChange(Control ctrl);
	BOOL OnRowRangeChange(Control ctrl);
	BOOL OnChangeAutoUpdate(Control ctrl);
	BOOL OnFinishApply(DWORD wParam, DWORD lParam);	///Sophy 5/12/2008 v8.0860 QA80-11031-P1 FIX_LOADING_SAMPLE_FORMULA_INFINITE_LOOP_ON_CLICK_APPLY
//------Folger 07/20/07 USE_RICH_EDIT_DIRECTLY_IN_BOTTOM_PANE	
#ifdef USE_RICH_EDIT_DIRECTLY_IN_BOTTOM_PANE
	BOOL OnShowBottomPane(Control ctrl);
#endif
//------End USE_RICH_EDIT_DIRECTLY_IN_BOTTOM_PANE
	BOOL OnInsertVars(uint wParam, uint lParam);					///Kyle 08/26/2009 INSERT_MULTIPLE_TIMES_FOR_SCV

	///Kyle 11/04/2009 QA80-14584 SCV_ADD_FITTING_FUNCTIONS
#ifdef _ADD_FITTING_FUNCTIONS_TO_SCV
	BOOL OnUIUpdateFittingFunc(CmdUI cmd);
#endif // _ADD_FITTING_FUNCTIONS_TO_SCV
	///End SCV_ADD_FITTING_FUNCTIONS
protected:
	bool GetActiveLayer();
	int GetBottomPaneSubControls(vector<uint>& vnCntrls);//---CPY 5/9/06 BEFORE_SCRIPT_IN_TAB
	
private:
	///Kyle 11/04/2009 QA80-14584 SCV_ADD_FITTING_FUNCTIONS 
#ifdef _ADD_FITTING_FUNCTIONS_TO_SCV
	bool	openSimulateCurveDlg(string& strFormula, const FunctionInfo* pFuncInfo);
#endif // _ADD_FITTING_FUNCTIONS_TO_SCV
	///End SCV_ADD_FITTING_FUNCTIONS

	///Kyle 06/25/2009 ADD_TWO_BUTTONS_TO_DEF_VAR_AND_RESTORE_MENU
#ifdef SET_VALUES_SUPPORT_DEFINE_VARIBLE
	void insertDefVarScript(LPCSTR lpcszType, LPCSTR lpcszName, LPCSTR lpcszValue);
#endif //SET_VALUES_SUPPORT_DEFINE_VARIBLE
	///End ADD_TWO_BUTTONS_TO_DEF_VAR_AND_RESTORE_MENU
	
	void insertVars(const vector<string>& vsVals, const vector<uint>& vnDataTypes);			///Kyle 08/26/2009 INSERT_MULTIPLE_TIMES_FOR_SCV

	bool isRangeChanged(const vector<int>& vnRows, const vector<int>& vnCols, int nColSelWay);		///Kyle 12/08/2008 CHECK_IF_RANGE_SELECTED_DIFFERENT_FROM_FORMULA_RANGE
	/// Iris 01/04/2009 v8.0993c RECONSTRUCT_FUNCTION_MENU_SWITCH_MAT_AND_WKS
	//void initCtrlValue(bool bInit = false);///Jasmine 04/25/06 MODIFICATION_UPDATE_COLUMN_LIST 
	//void initFunctionsList();
	//void updateColumnList(bool bInit = false);///Jasmine 04/25/06 MODIFICATION_UPDATE_COLUMN_LIST 
	void initCtrlValue(int nFuncMenuInitMode = MENU_INIT);
	void updateColumnList(int nFuncMenuInitMode);
	///end RECONSTRUCT_FUNCTION_MENU_SWITCH_MAT_AND_WKS
	
	bool loadFormula(int nID, LPCSTR lpcszFile);
	HMENU getDlgMenu();
	bool createDataObject();
	void updateDialogCtrl();
	
	
	void updateMatrixRange(vector<string>& vs);//---- CPY 5/13/09 QA70-12554-P1 MAT_SET_VALUES_RANGE_SUPPORT_ONLY_IF_NO_RECALC

	///Joe 8/24/2006 ADD_FORMATNAME_TO_TITLE
	//void updateDialogTitle(string strLabel);
	void updateDialogTitle();
	///End ADD_FORMATNAME_TO_TITLE
	string openFunctionBrowser();
	
	bool isChanged();
	void onBeforeFormulaChange();
	void onAfterChange();
	void insertStrToFormula(LPCSTR lpcsz, bool bFunctionStr=false);
	bool isCursorInPrescript();					///Jasmine 12/15/08 v8.0986c QA80-12779 DETECT_FOCUS_POSITION_TO_ADD_STRING

	void beforeApplyFormula();
	void afterApplyFormula();
	int getRangeIndex(string strVal, bool bBegin);
	
	void onActiveObjectChange();
	int getPageType();
	bool openBrowser(bool bShortName = true);
	//----- CPY 05/01/06 MULTI_FOR_PREVIOUS_SCRIPT
	string dlgToformula();
	/// YuI 02/04/09 QA70-12831 COLUMN_FORMULA_TO_REMEMBER_THE_RANGE
	//	bool formulaToDlg(LPCSTR lpcsz);
	bool formulaToDlg(LPCSTR lpcsz, BOOL bUpdateRange = TRUE);
	/// end COLUMN_FORMULA_TO_REMEMBER_THE_RANGE
	//-----
	//---- CPY 5/14/06 BETTER_DIALOG_POS_SIZE
	//virtual
	int GetMinTopPaneHeight() {return 180;}//40;} ///Jasmine 10/30/06 ENLARGE_UPPER_PANE, 40 is not enough now
	//virtual 
	int GetMinBottomPaneHeight() { return 30;}
	//----
	
	int getMenuResourceID(); ///Iris 2/13/2009 QA80-12790-P2 MAT_SHOULD_NOT_INCLUDE_DATATIME_AND_DATA_GENERATION_CATEGORYS
	//------Folger 07/20/07 USE_RICH_EDIT_DIRECTLY_IN_BOTTOM_PANE	
#ifdef USE_RICH_EDIT_DIRECTLY_IN_BOTTOM_PANE
	void repositionBottomPaneControl();
#endif
	//------End USE_RICH_EDIT_DIRECTLY_IN_BOTTOM_PANE	
private:
	DataObjectManager*		m_pDataOB;
	SetValuesMenu*			m_pDlgMenu;
	
	vector<uint>			m_vnBtns;
	
	Control					m_textCol;
	Edit					m_edRowsFrom;
	Edit					m_edRowsTo;
	Edit					m_edColsFrom, m_edColsTo;//---- CPY 5/11/09 QA70-12554 MAT_SET_VALUES_NEED_RANGE_SUPPORT
	Button					m_btnPrevious;
	Button					m_btnNext;
	Button					m_btnLast;
	Button					m_btnFirst;
	
	Button					m_btnUndo;
	//------- CPY 07/26/06 QA70-8847 COLUMN_FORMULA_FROM_ORIGIN_C_REVAMP
	//Button					m_btnAutoUpdate;
	ComboBox				m_comboAutoUpdate;
	//-------
	Button					m_btnApply;
	//---CPY 6/20/06 I had changed these two from RichEdit to simpley Edit as user might paste in rich text
	// but since Edit control lack some functions like GetSelText, we will still use RichEdit in code even though res is Edit
	//----- CPY 1/31/2008 QA70-11031 USE_EDIT_INSTEAD_OF_RICH_EDIT
	//RichEdit				m_edExpression;
	//RichEdit				m_edPrescripts; //CPY 05/01/06 MULTI_FOR_PREVIOUS_SCRIPT
	Edit m_edExpression;
	Edit m_edPrescripts;
	//----- end USE_EDIT_INSTEAD_OF_RICH_EDIT
	//---
	Layer					m_layActive;
	
	string					m_strUndo;
	bool					m_bLayerChanged;///Jasmine 04/24/06 SET_COL_VAL_DLG_MODELESS
	string					m_strCurFormulaName;
	///Jasmine 08/28/06 SHARE_DLG_WITH_MAT
	string					m_strSection;
	string					m_strFile;
	int						m_nPageType;
	bool					m_bSwitch;
	///End SHARE_DLG_WITH_MAT
	bool					m_bOnDoingApply;	///Sophy 5/12/2008 v8.0860 QA80-11031-P1 FIX_LOADING_SAMPLE_FORMULA_INFINITE_LOOP_ON_CLICK_APPLY

	BOOL					m_bAllowChangeCol;	///Kenny 04/27/2009 QA80-13519-P1 SET_COL_VAL_DLG_SHOULD_BE_MODAL_IF_CHANGE_PARAMETER
	BOOL					m_bDeleteOnDestroy;	///Kenny 04/28/2009 QA80-13519-P1 SET_COL_VAL_DLG_SHOULD_BE_MODAL_IF_CHANGE_PARAMETER
};
///end
#endif //_COL_MAT_VALUES_H_
