/////comment by Sandy at latest 2005-12-30
////////////////////////////////////////////////////////////////////////////////////////////////////
////----How to assign every node DataID?
////In Principle:
////1.Baselines, PeakFinding are two big objects to be prescribed at present.
////2.Special feature node's ID about baselines' feature will locate at lower bits than 0x00001000
////3.The common attribute node ID(such as 0x0F000000) should add to its master object ID.
////
////----How to find the data node by DataID?
////For Example:  
////After loading the current function list about Baseline, 
////we want to find the node to store the selected Function's information. 
////
////	TreeNode& test(Tree trGetN, int nSelFuncIndex)
////	{
////		nSelFuncID = IDE_PFM_BASELINES_FUNCTIONS + (nSelFuncIndex << 16);
////		TreeNode& trSubFunc = tree_find_node_by_dataID(trGetN, nSelFuncID);
////      return trSubFunc;
////  }
////
////----Easy to manage the Parameters' ID.
////For Example: 
////ID 0x0F031602 = IDE_PFM_BASELINES +  IDE_PFM_FUNC_INDEX_BITS + (3 << 16) + IDE_PFM_BASELINES_FUNCTIONS + 2
////where it's 3 means the using function's Index in the current NLSF List
////
////we can access the parent node of parameters by "(ID & IDE_PFM_BASELINES_PARAM_MASK)", 
////since the last number only assign for each parameter, it equals to the index of the parameter.
////
////////////////////////////////////////////////////////////////////////////////////////////////////////
//
////baseline type ID   
////enum {
	////ID_TOUGAARD = 1,   
	////ID_SHIRLEY,    
	////ID_CHEBYSHEV,  
	////ID_POLYNOMIAL, 
	////ID_BSPLINE,    
	////ID_FUNCTIONS,  
	////ID_EXISTDATA,  
	//////ID_ARBITRARY,
	////ID_AUTOMATIC = 9,
////};
////
//////smooth methods ID
////enum {
	////ID_ADJAVG = 1,   
	////ID_SAVTKGLY,    
	////ID_MEDIAN,  
	////ID_PARAB_LOWPASS, 
	////ID_LOWPASS,    
	////ID_THRESHOLD,  
////};
////
////-----------------------------------------------------------------------------//
////                        O8 baseline peak tool                                //
////-----------------------------------------------------------------------------//
////#define IDE_O8_MODULE	  							0xFFFFFFFF
//#define IDE_O8_ORIGINAL_PLOT						0xFFFFFFF0
//
//#define IDE_O8_BASELINES							0x00001000  
//#define IDE_O8_BASELINE 							0x00002000 
//#define IDE_O8_PEAKS								0x00003000
//#define IDE_O8_AREA   								0x00004000
//
////////////////////////Baselines Offset Bits///////////////////////////////////////////////////////
//#define IDE_O8_PARAMETERS_BITS                      0x01000000
//#define IDE_O8_POINTS_SETTING_BITS                  0x02000000
//#define IDE_O8_METHODS_BITS                         0x03000000
//#define IDE_O8_SELF_DEFINE1_BITS					0x04000000
//#define IDE_O8_SELF_DEFINE2_BITS					0x05000000
//
//
//////////////////////////////////////////////////////////////////////////////////////
/////                                   Baselines                                  ///
//////////////////////////////////////////////////////////////////////////////////////
//#define IDE_O8_BASELINES_PARENT_PLOT					(IDE_O8_BASELINES + 10)
//#define IDE_O8_BASELINES_BASELINE_PLOT					(IDE_O8_BASELINES + 15)
//#define IDE_O8_SPECTRUM_NAME							(IDE_O8_BASELINES + 20)
//#define IDE_O8_BASELINE_NAME							(IDE_O8_BASELINES + 25)
//#define IDE_O8_BASELINES_USE							(IDE_O8_BASELINES + 30)
//#define IDE_O8_BASELINES_USED							(IDE_O8_BASELINES + 35)
//#define IDE_O8_SAMEAS_INPUTX							(IDE_O8_BASELINES + 40)
//#define IDE_O8_NUM_BASELINE								(IDE_O8_BASELINES + 45) 
//
//#define IDE_O8_BASELINES_ORIGINAL_PLOT					(IDE_O8_BASELINES + 47)	//----CPY 10/22/06 I found baselinepeakdlg.h not compilable, so added this				
//
/////////////////////////////automatic////////////////////////////////////////////////
//#define IDE_O8_BASELINES_AUTOMATIC					IDE_O8_BASELINES | 0x900
//#define IDE_O8_BASELINES_AUTOMATIC_SELMETHOD        IDE_O8_BASELINES_AUTOMATIC | IDE_O8_SELF_DEFINE1_BITS
//#define IDE_O8_BASELINES_AUTOMATIC_POINTS           IDE_O8_BASELINES_AUTOMATIC | IDE_O8_POINTS_SETTING_BITS
//#define IDE_O8_BASELINES_AUTOMATIC_METHODS          IDE_O8_BASELINES_AUTOMATIC | IDE_O8_METHODS_BITS
//
////////////////////////////User Define///////////////////////////////////////////////
////#define IDE_O8_BASELINES_USERDEFINE					IDE_O8_BASELINES | 0xA00
//
////////////////////////////Exist Data////////////////////////////////////////////////
//#define IDE_O8_BASELINES_EXISTDATA					IDE_O8_BASELINES | 0x700
//
/////////////////////////////////////////////////////////////////////////////////////
/////                                   Peaks                                     ///
/////////////////////////////////////////////////////////////////////////////////////
////#define IDE_O8_PEAKS_INFO_BOOK 						(IDE_O8_PEAKS + 5 )
//#define IDE_O8_PEAK_FINDING_PEAK_CENTER_WSK			(IDE_O8_PEAKS + 5 )
//#define IDE_O8_PEAKS_PROPERTIES 					(IDE_O8_PEAKS + 10 )
//#define IDE_O8_PEAKS_SIZE_OPTION 					(IDE_O8_PEAKS + 15 )
//#define IDE_O8_PEAKS_DIRECTION 						(IDE_O8_PEAKS + 25 )
//#define IDE_O8_PEAKS_DISPLAY   						(IDE_O8_PEAKS + 30 )
//#define IDE_O8_PEAKS_PICKING_NUM 					(IDE_O8_PEAKS + 35 )
//#define IDE_O8_PEAKS_SMOOTH_OPTION					(IDE_O8_PEAKS + 40 )
//#define IDE_O8_PEAKS_FINDING_THE_PEAK               (IDE_O8_PEAKS + 45 )
//#define IDE_O8_PEAKS_INFO_BOOK      				(IDE_O8_PEAKS + 50 )
//
//#define IDE_O8_PEAKS_MIN_HEIGHT                     (IDE_O8_PEAKS_PROPERTIES + 2)
//#define IDE_O8_PEAKS_MIN_WIDTH 						(IDE_O8_PEAKS_PROPERTIES + 4)
//#define IDE_O8_PEAKS_MAX_WIDTH 						(IDE_O8_PEAKS_PROPERTIES + 6)
//#define IDE_O8_PEAKS_TOTAL_HEIGHT 					(IDE_O8_PEAKS_PROPERTIES + 8)	
//#define IDE_O8_PEAKS_TOTAL_WIDTH					(IDE_O8_PEAKS_PROPERTIES + 9)
//
//#define IDE_O8_PEAKS_DISPLAY_LABEL 					(IDE_O8_PEAKS_DISPLAY + 2 )
//#define IDE_O8_PEAKS_DISPLAY_FEET 					(IDE_O8_PEAKS_DISPLAY + 4 )
//#define IDE_O8_PEAKS_DISPLAY_CENTERS 				(IDE_O8_PEAKS_DISPLAY + 6 )
//
              //
//
/////////////////////////////////////////////////////////////////////////////////////
/////                                   Area                                      ///
/////////////////////////////////////////////////////////////////////////////////////
//#define IDE_O8_AREA_INTEGRAL_MODE 					(IDE_O8_AREA +10)
//#define IDE_O8_AREA_INTEGRAL_CURVE 					(IDE_O8_AREA +15)
//#define IDE_O8_AREA_INTEGRATE  						(IDE_O8_AREA +20)
//
//
////-----------------------------------------------------------------------------//
////                                PFM                                          //
////-----------------------------------------------------------------------------//
/////Joseph	12/07/06	ADD_PFM_MODULE
//#define IDE_PFM_MODULE	  								0xFFFFFF00
//#define IDE_PFM_ORIGINAL_PLOT							0xFFFFF000
//
/////End	ADD_PFM_MODULE
//
//#define IDE_PFM_BASELINES								IDE_O8_BASELINES
//#define IDE_PFM_BASELINE								IDE_O8_BASELINE
//#define IDE_PFM_PEAKS								    IDE_O8_PEAKS
////#define IDE_PFM_SMOOTH									(IDE_PFM_PEAKS + 0x00004000)
//
//
////////////////////////Offset Bits///////////////////////////////////////////////////////
//#define IDE_PFM_PARAMETERS_BITS                                 IDE_O8_PARAMETERS_BITS
//#define IDE_PFM_POINTS_SETTING_BITS                             IDE_O8_POINTS_SETTING_BITS
//#define IDE_PFM_METHODS_BITS									IDE_O8_METHODS_BITS
//
//
//#define IDE_PFM_SELF_DEFINE1_BITS								IDE_O8_SELF_DEFINE1_BITS
//#define IDE_PFM_SELF_DEFINE2_BITS								IDE_O8_SELF_DEFINE2_BITS
//
//#define IDE_PFM_ORDERS_SETTING_BITS                             (IDE_PFM_SELF_DEFINE2_BITS + 0x01000000)
//#define IDE_PFM_FUNC_INDEX_BITS         						(IDE_PFM_SELF_DEFINE2_BITS + 0x02000000)
//#define IDE_PFM_OPTION_BITS                                     (IDE_PFM_SELF_DEFINE2_BITS + 0x03000000)
//#define IDE_PFM_PEAKS_GROUP_BITS								(IDE_PFM_SELF_DEFINE2_BITS + 0x04000000)
//
/////////////////////////////////////////////////////////////////////////////////////////																
/////////////				      Baseline									///////////////
/////////////////////////////////////////////////////////////////////////////////////////
//
//
//#define IDE_PFM_BASELINES_PARENT_PLOT					IDE_O8_BASELINES_PARENT_PLOT
//#define IDE_PFM_BASELINES_BASELINE_PLOT					IDE_O8_BASELINES_BASELINE_PLOT
//#define IDE_PFM_PEAK_FIT_NAME							IDE_O8_SPECTRUM_NAME
//#define IDE_PFM_BASELINE_NAME							IDE_O8_BASELINE_NAME
//#define IDE_PFM_BASELINES_USED							IDE_O8_BASELINES_USED
//#define IDE_PFM_SAMEAS_INPUTX							IDE_O8_SAMEAS_INPUTX
//#define IDE_PFM_NUM_BASELINE							IDE_O8_NUM_BASELINE 
///////////////////////Baselines Bits Mask//////////////////////////////////////////////
//#define IDE_PFM_BASELINES_PARAM_MASK                            0xFFFFFFF0
//#define IDE_PFM_BASELINES_FUNC_INDEX_MASK                       0x00FF0000
//
//////////////////////////////////Tougaard/////////////////////////////////////////////////
//#define IDE_PFM_BASELINES_TOUGAARD                      (IDE_PFM_BASELINES | 0x100)
//#define IDE_PFM_TOUGAARD_PARAMETER						(IDE_PFM_BASELINES_TOUGAARD | IDE_PFM_PARAMETERS_BITS)
//#define IDE_PFM_TOUGAARD_PARAMETER_BASELINE_HEIGHT		(IDE_PFM_BASELINES_TOUGAARD | IDE_PFM_PARAMETERS_BITS+2)
//#define IDE_PFM_TOUGAARD_PARAMETER_BASE_TYPE			(IDE_PFM_BASELINES_TOUGAARD | IDE_PFM_PARAMETERS_BITS+1)
//
//
//////////////////////////////////Shirley//////////////////////////////////////////////////
//#define IDE_PFM_BASELINES_SHIRLEY                       (IDE_PFM_BASELINES | 0x200)
//#define IDE_PFM_SHIRLEY_PARAMETER						(IDE_PFM_BASELINES_SHIRLEY | IDE_PFM_PARAMETERS_BITS)
//#define IDE_PFM_SHIRLEY_PARAMETER_BASELINE_HEIGHT		(IDE_PFM_BASELINES_SHIRLEY | IDE_PFM_PARAMETERS_BITS + 1)
//
//////////////////////////////////Chebyshev////////////////////////////////////////////////
//#define IDE_PFM_BASELINES_CHEBYSHEV                     (IDE_PFM_BASELINES | 0x300)
//
//////////////////////////////////Polynomial///////////////////////////////////////////////
//#define IDE_PFM_BASELINES_POLYNOMIAL                    (IDE_PFM_BASELINES | 0x400)
//#define IDE_PFM_POLYNOMIAL_PARAMETER    				(IDE_PFM_BASELINES_POLYNOMIAL | IDE_PFM_PARAMETERS_BITS)
//#define IDE_PFM_POLYNOMIAL_POINTS						(IDE_PFM_BASELINES_POLYNOMIAL | IDE_PFM_POINTS_SETTING_BITS)
//#define IDE_PFM_POLYNOMIAL_ORDERS						(IDE_PFM_BASELINES_POLYNOMIAL | IDE_PFM_ORDERS_SETTING_BITS)
//
//
//////////////////////////////////BSpline//////////////////////////////////////////////////
//#define IDE_PFM_BASELINES_BSPLINE                       (IDE_PFM_BASELINES | 0x500)
//#define IDE_PFM_BSPLINE_POINTS							(IDE_PFM_BASELINES_BSPLINE | IDE_PFM_POINTS_SETTING_BITS)
//#define IDE_PFM_BSPLINE_INIT							(IDE_PFM_BASELINES_BSPLINE | IDE_PFM_SELF_DEFINE1_BITS)
//////////////////////////////////Functions////////////////////////////////////////////////
//#define IDE_PFM_BASELINES_FUNCTIONS                     (IDE_PFM_BASELINES | 0x600)
//#define IDE_PFM_FUNCTIONS_SEL_FUNC_INDEXT               (IDE_PFM_BASELINES_FUNCTIONS | IDE_PFM_SELF_DEFINE1_BITS)
//#define IDE_PFM_FUNCTIONS_POINTS				        (IDE_PFM_BASELINES_FUNCTIONS | IDE_PFM_POINTS_SETTING_BITS)
//#define IDE_PFM_FUNCTIONS_PARAMETER					    (IDE_PFM_BASELINES_FUNCTIONS | IDE_PFM_PARAMETERS_BITS)
//
//////////////////////////////////ExistingDataset//////////////////////////////////////////
//#define IDE_PFM_BASELINES_EXISTDATA                     (IDE_PFM_BASELINES | 0x700)
//#define IDE_PFM_EXISTINGDATASET_DATASET					(IDE_PFM_BASELINES_EXISTDATA | IDE_PFM_SELF_DEFINE1_BITS)
//
//////////////////////////////////Arbitrary//////////////////////////////////////////
////#define IDE_PFM_BASELINES_ARBITRARY                     (IDE_PFM_BASELINES | 0x800)
////#define IDE_PFM_ARBITARY_POINTS							(IDE_PFM_BASELINES_ARBITRARY | IDE_PFM_POINTS_SETTING_BITS)
////#define IDE_PFM_ARBITARY_CUSTOM_DATA_X  				(IDE_PFM_BASELINES_ARBITRARY | IDE_PFM_SELF_DEFINE1_BITS)
////#define IDE_PFM_ARBITARY_CUSTOM_DATA_Y  				(IDE_PFM_BASELINES_ARBITRARY | IDE_PFM_SELF_DEFINE2_BITS)
//
/////////////////////////////////////////////////////////////////////////////////////////																
/////////////				      Smooth									///////////////
/////////////////////////////////////////////////////////////////////////////////////////
//#define IDE_PFM_SMOOTH_PREVIEW 							(IDE_PFM_SMOOTH + 0x10)
//#define IDE_PFM_SMOOTH_USED 							(IDE_PFM_SMOOTH + 0x30)
	//
//////////////////////Adjacent Averaging/////////////////////////////////////////////////
//#define IDE_PFM_SMOOTH_ADJAVG 							(IDE_PFM_SMOOTH | 0x100)
//#define IDE_PFM_ADJAVG_POINTS 							(IDE_PFM_SMOOTH_ADJAVG | IDE_PFM_POINTS_SETTING_BITS)
//#define IDE_PFM_ADJAVG_OPTION 							(IDE_PFM_SMOOTH_ADJAVG | IDE_PFM_OPTION_BITS)
//
//////////////////////savitsky golay/////////////////////////////////////////////////////
//#define IDE_PFM_SMOOTH_SAVTKGLY							(IDE_PFM_SMOOTH | 0x200)
//#define IDE_PFM_SAVTKGLY_POINTS 						(IDE_PFM_SMOOTH_SAVTKGLY | IDE_PFM_POINTS_SETTING_BITS)
//#define IDE_PFM_SAVTKGLY_POLYORD 						(IDE_PFM_SMOOTH_SAVTKGLY | IDE_PFM_SELF_DEFINE1_BITS)
//#define IDE_PFM_SAVTKGLY_OPTION 						(IDE_PFM_SMOOTH_SAVTKGLY | IDE_PFM_OPTION_BITS)
	//
//////////////////////median filter//////////////////////////////////////////////////////
//#define IDE_PFM_SMOOTH_MEDIAN 							(IDE_PFM_SMOOTH | 0x300)
//#define IDE_PFM_MEDIAN_POINTS 							(IDE_PFM_SMOOTH_MEDIAN | IDE_PFM_POINTS_SETTING_BITS)
//#define IDE_PFM_MEDIAN_PERCENT 							(IDE_PFM_SMOOTH_MEDIAN | IDE_PFM_SELF_DEFINE1_BITS)
//#define IDE_PFM_MEDIAN_AVG 								(IDE_PFM_SMOOTH_MEDIAN | IDE_PFM_SELF_DEFINE2_BITS)
//#define IDE_PFM_MEDIAN_OPTION 							(IDE_PFM_SMOOTH_MEDIAN | IDE_PFM_OPTION_BITS)
//
//////////////////////Parabolic lower-pass filter////////////////////////////////////////
//#define IDE_PFM_SMOOTH_PARAB_LOWPASS 					(IDE_PFM_SMOOTH | 0x400)
//#define IDE_PFM_PARAB_LOWPASS_POINTS 					(IDE_PFM_SMOOTH_PARAB_LOWPASS | IDE_PFM_POINTS_SETTING_BITS)
//
//////////////////////Low-pass filter////////////////////////////////////////////////////
//#define IDE_PFM_SMOOTH_LOWPASS 							(IDE_PFM_SMOOTH | 0x500)
//#define IDE_PFM_LOWPASS_CUTOFF 							(IDE_PFM_SMOOTH_LOWPASS | IDE_PFM_SELF_DEFINE1_BITS)
//
//////////////////////Threshold////////////////////////////////////////////////////
//#define IDE_PFM_SMOOTH_THRESHOLD 						(IDE_PFM_SMOOTH | 0x600)
//#define IDE_PFM_THRESHOLD_VALUE 						(IDE_PFM_SMOOTH_THRESHOLD | IDE_PFM_SELF_DEFINE1_BITS)
	//
	//
/////////////////////////////////////////////////////////////////////////////////////////
/////////														                   ////////
/////////						Peak Finding					                   ////////
/////////														                   ////////
/////////////////////////////////////////////////////////////////////////////////////////
//
////#define IDE_PFM_PEAK_FINDING_PEAK_TYPE								(IDE_PFM_PEAK_FINDING + 5)
//
////#define IDE_PFM_PEAK_FINDING_THRESHOLD								(IDE_PFM_PEAK_FINDING + 5)
////#define IDE_PFM_PEAK_FINDING_PEAK_NUM								(IDE_PFM_PEAK_FINDING + 5)
////#define IDE_PFM_PEAK_FINDING_RESPONSE_CURVE							(IDE_PFM_PEAK_FINDING + 5)
//#define IDE_PFM_PEAK_FINDING_METHOD									(IDE_PFM_PEAKS | IDE_PFM_METHODS_BITS)
//
//#define IDE_PFM_PEAK_FINDING_USE_AIC								(IDE_PFM_PEAKS | IDE_PFM_OPTION_BITS + 2)
//#define IDE_PFM_PEAK_FINDING_DIRECTION								IDE_O8_PEAKS_DIRECTION
//#define IDE_PFM_PEAK_FINDING_PLOT_RESIDUAL							(IDE_PFM_PEAKS | IDE_PFM_OPTION_BITS + 6)
//#define IDE_PFM_PEAK_FINDING_PLOT_SECOND_DERIVATION					(IDE_PFM_PEAKS | IDE_PFM_OPTION_BITS + 8)
//#define IDE_PFM_PEAK_FINDING_PLOT_INDIVIDUAL						(IDE_PFM_PEAKS | IDE_PFM_OPTION_BITS + 10)
//#define IDE_PFM_PEAK_FINDING_VARY_WIDTH								(IDE_PFM_PEAKS | IDE_PFM_OPTION_BITS + 12)
//#define IDE_PFM_PEAK_FINDING_PLOT_CUMULATIVE						(IDE_PFM_PEAKS | IDE_PFM_OPTION_BITS + 14)
//#define IDE_PFM_PEAK_CURR_PEAK										(IDE_PFM_PEAKS | IDE_PFM_OPTION_BITS + 15)
//
//
//#define IDE_PFM_PEAK_FINDING_PEAK_NUM								(IDE_PFM_PEAKS | IDE_PFM_POINTS_SETTING_BITS)
//
//#define IDE_PFM_PEAK_FINDING_CUM_PLOT								(IDE_PFM_PEAKS | IDE_PFM_SELF_DEFINE1_BITS)
//#define IDE_PFM_PEAK_FINDING_OFFSET								    (IDE_PFM_PEAKS | IDE_PFM_SELF_DEFINE2_BITS)
//
//
//#define IDE_PFM_PEAK_FINDING_FUNCTIONS								(IDE_PFM_PEAKS | IDE_PFM_OPTION_BITS + 16)
//#define IDE_PFM_PEAK_FINDING_MIN_POINT_IN_PEAK						(IDE_PFM_PEAKS | IDE_PFM_OPTION_BITS + 18)
//#define IDE_PFM_PEAK_FINDING_PEAK_MIN_HEIGHT						(IDE_PFM_PEAKS | IDE_PFM_OPTION_BITS + 20)
//
//#define IDE_PFM_PEAKS_PLOT											(IDE_PFM_PEAKS | IDE_PFM_OPTION_BITS + 50)
//#define IDE_PFM_PEAKS_LABEL_PLOT									(IDE_PFM_PEAKS | IDE_PFM_OPTION_BITS + 52)
//#define IDE_PFM_PEAKS_CENTER_PLOT									(IDE_PFM_PEAKS | IDE_PFM_OPTION_BITS + 54)
//#define IDE_PFM_PEAKS_L_MARKER_PLOT									(IDE_PFM_PEAKS | IDE_PFM_OPTION_BITS + 58)
//#define IDE_PFM_PEAKS_R_MARKER_PLOT									(IDE_PFM_PEAKS | IDE_PFM_OPTION_BITS + 60)
//#define IDE_PFM_PEAKS_CUM_PLOT										(IDE_PFM_PEAKS | IDE_PFM_OPTION_BITS + 62)
//
//#define IDE_PFM_PEAK_FINDING_PEAK_CENTER_WSK						IDE_O8_PEAK_FINDING_PEAK_CENTER_WSK//(IDE_PFM_PEAKS | IDE_PFM_OPTION_BITS + 22)
//#define IDE_PEAK_FINDING_FUNCTIONS_SEL_ID							(IDE_PFM_PEAK_FINDING_FUNCTIONS | IDE_PFM_FUNC_INDEX_BITS)
//#define IDE_PEAK_FINDING_FUNCTIONS_PARAMETER					    (IDE_PFM_PEAK_FINDING_FUNCTIONS | IDE_PFM_PARAMETERS_BITS)
//
//#define IDE_PFM_PEAKS_FINDING_THE_PEAK								(IDE_PFM_PEAKS | IDE_PFM_PEAKS_GROUP_BITS)
//#define IDE_PFM_THE_PEAK_PARAMETERS						    		(IDE_PFM_PEAKS_FINDING_THE_PEAK | IDE_PFM_PARAMETERS_BITS)
//