CShadowTree* CShadowTree::FindLeaf(CString partialRefName) { if(IsLeaf()) { if(m_csRefName.GetLength() > partialRefName.GetLength()) return NULL; if(partialRefName.Right(m_csRefName.GetLength()) == m_csRefName) { //Match of leaf name. Try match on total name. CString totalRefName = GetRefName(); if(totalRefName.Right(partialRefName.GetLength()) == partialRefName) return this; //Also match. Found. } } else { //Not a leaf. Search all nodes. for(TShadowTreeMap::iterator itShadowTree = m_ShadowTree.begin(); itShadowTree != m_ShadowTree.end(); ++itShadowTree) { CShadowTree* pSubtree = itShadowTree->second.FindLeaf(partialRefName); if(pSubtree != NULL) return pSubtree; //Found } } return NULL;//Not found }
// This is the heart of the reference tracker. It gets called by the // NotifyMgr when it recieves a message via NotifyRefChanged(). It passes // all the parameter here (plus the additional pData). RefResult ProcessRefMessage(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, DWORD_PTR pData) { RefWatch* rc = reinterpret_cast<RefWatch *>(pData); if (message == REFMSG_TARGET_DELETED) { // The item we monitor has been deleted -- we're done... DestroyWindow(rc->hMain); } else { LRESULT checkstate = SendMessage(GetDlgItem(rc->hMain, IDC_PARTID),BM_GETCHECK,0,0); DisplayRefInfo(rc, rc->hMain, GetRefName(message, partID, (BST_CHECKED==checkstate))); } return REF_SUCCEED; }
int GetTabRef (RefFileInfo *refnames, Hdr *phdr, char *keyword, RefTab *table, int *calswitch) { extern int status; int GetRefName (RefFileInfo *, Hdr *, char *, char *); int TabPedigree (RefTab *); /* Get the reference table name. */ if (GetRefName (refnames, phdr, keyword, table->name)) return (status); /* TabPedigree opens the table to verify that it exists, and if so, gets filetype, pedigree & descrip. */ if (TabPedigree (table)) return (status); if (table->exists == EXISTS_YES) { if (table->goodPedigree != GOOD_PEDIGREE) *calswitch = DUMMY; } return (status); }
int GetImageRef (RefFileInfo *refnames, Hdr *phdr, char *keyword, RefImage *image, int *calswitch) { extern int status; int GetRefName (RefFileInfo *, Hdr *, char *, char *); int ImgPedigree (RefImage *); /* Get the reference image name. */ if (GetRefName (refnames, phdr, keyword, image->name)) return (status); /* ImgPedigree opens the image to verify that it exists, and if so, gets filetype, pedigree & descrip. */ if (ImgPedigree (image)) return (status); if (image->exists == EXISTS_YES) { if (image->goodPedigree != GOOD_PEDIGREE) *calswitch = DUMMY; } return (status); }