BOOL CCalculator::CompareDocs(CMCPforNTDoc* pDoc1,CMCPforNTDoc* pDoc2) { BOOL EQUAL = TRUE; CString TheObject1[100]; CString TheObject2[100]; USHORT Channels1[100]; USHORT Channels2[100]; USHORT i,j; POSITION pos; if(!pDoc1->ActionObjList.IsEmpty()) { i=0; ActionObject* pActionObj = (ActionObject*)pDoc1->ActionObjList.GetHead(); pos = pDoc1->ActionObjList.GetHeadPosition(); do { pActionObj = (ActionObject*)pDoc1->ActionObjList.GetNext(pos); if (pActionObj!=NULL) { TheObject1[i] = pActionObj->GetName(); Channels1[i] = pActionObj->pTrack->Channels; i++; } } while (pos!=NULL); } if(!pDoc2->ActionObjList.IsEmpty()) { i=0; ActionObject* pActionObj = (ActionObject*)pDoc2->ActionObjList.GetHead(); pos = pDoc2->ActionObjList.GetHeadPosition(); do { pActionObj = (ActionObject*)pDoc2->ActionObjList.GetNext(pos); if (pActionObj!=NULL) { TheObject2[i] = pActionObj->GetName(); Channels2[i] = pActionObj->pTrack->Channels; i++; } } while (pos!=NULL); } for(j=0;j<i;j++) { if((TheObject2[j]!=TheObject1[j])|| (Channels2[j]!=Channels1[j])) EQUAL = FALSE; } return EQUAL; }
void CCalculator::UpdateTree(CMCPforNTDoc* pDocument) { int Image; int Position = 0; CString TheObject; int Track=0; char TheString[50]; POSITION pos; m_templview.DeleteAllItems(); if(!pDocument->ActionObjList.IsEmpty()) { ActionObject* pActionObj = (ActionObject*)pDocument->ActionObjList.GetHead(); pos = pDocument->ActionObjList.GetHeadPosition(); do { pActionObj = (ActionObject*)pDocument->ActionObjList.GetNext(pos); if (pActionObj!=NULL) { if (pActionObj->GetName().Find(_TrackObj)!=-1) { ++Track; m_templview.InsertItem(LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM,Position,pActionObj->GetName(),0,0,2,(LPARAM)pActionObj); m_templview.SetItem(Position,1,LVIF_TEXT, pActionObj->GetInfo(),0,0,0,NULL); } else { if (pActionObj->TestHardware()) Image=0; else Image = 1; strcpy(TheString,(LPCSTR)TheObject); m_templview.InsertItem(LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM,Position,pActionObj->GetName(),0,0,Image,(LPARAM)pActionObj); m_templview.SetItem(Position,1,LVIF_TEXT, pActionObj->GetInfo(),0,0,0,NULL); } } Position++; } while (pos!=NULL); } }
double _scal( double x,... ) { POSITION pos; CString TheObject; double data = 0; BOOL FOUND = FALSE; double Track; CString TrackStr; va_list arg_ptr; va_start(arg_ptr,x); Track = va_arg(arg_ptr,double); if(!pDocument->ActionObjList.IsEmpty()) { ActionObject* pActionObj = (ActionObject*)pDocument->ActionObjList.GetHead(); pos = pDocument->ActionObjList.GetHeadPosition(); do { pActionObj = (ActionObject*)pDocument->ActionObjList.GetNext(pos); if (pActionObj!=NULL) { TheObject = pActionObj->GetName(); if (TheObject.Find(__PM_SpectrumObj)!=-1) { PM_SpectrumObj* pScalerObj = (PM_SpectrumObj*)pActionObj; if ((pScalerObj->SubRegNo==(int)x)&& (pScalerObj->pTrack->MyPosition==(int)Track)) { if(!EVALUATENEXT)data = pScalerObj->y[index]; else data = pScalerObj->y[index]*(TheScan)/(TheScan-1); FOUND = TRUE; } } } } while ((pos!=NULL)&&(!FOUND)); } return(data); }