HTREEITEM EXTreeCtrl::FindItemInSubTree( HTREEITEM hSubTreeRoot , IXTreeItem *pITreeItem ) { TRACE("searching subtree {%s} for data {%s}\n" , h2p(hSubTreeRoot)->GetLabel() , pITreeItem->GetLabel() ); ASSERT( hSubTreeRoot!=NULL ); HTREEITEM h=hSubTreeRoot; if( h != NULL ) { if( h2p(h)==pITreeItem ) //root itself? { Select( h , TVGN_CARET ); EnsureVisible( h ); } else { h = GetChildItem(h); //first child while( h!=NULL ) { HTREEITEM q = FindItemInSubTree( h , pITreeItem ); if( q!=NULL ) { h = q; break; } h = GetNextSiblingItem(h); } } } return h; }
int ag_db_delrec(unsigned dbh) { return db_delrec(h2p(dbh)); }
int ag_db_newrec(unsigned dbh, char *key, long size) { return db_newrec(h2p(dbh),key,size); }
int ag_db_release(unsigned dbh) { return db_release(h2p(dbh)); }
int ag_db_write(unsigned dbh) { return db_write(h2p(dbh)); }
int ag_db_read(unsigned dbh, char *key, int lock) { return db_read(h2p(dbh),key,lock); }
int ag_db_unlock(unsigned dbh) { return db_unlock(h2p(dbh)); }
int ag_drop(unsigned dbh, int attr, int val) { return delete(h2p(dbh),attr,val); }
int ag_db_rewind(unsigned dbh) { return db_rewind(h2p(dbh)); }
int ag_db_close(unsigned dbh) { int rc=db_close(h2p(dbh)); phtable[dbh]=NULL; return rc; }
int ag_db_stat(unsigned dbh, int attr, int val) { return db_stat(h2p(dbh),attr,val); }
int ag_insert(unsigned dbh, int attr, int val, char *buf) { return insert(h2p(dbh),attr,val,buf); }
int ag_replace(unsigned dbh, int attr, int val, char *buf) { return replace(h2p(dbh),attr,val,buf); }
int ag_extract(unsigned dbh, int attr, int val, char *buf, int maxsz) { return extract(h2p(dbh),attr,val,buf,maxsz); }
int ag_db_delete(unsigned dbh) { return db_delete(h2p(dbh)); }
void EXTreeCtrl::SelectDataItem(IXTreeItem *pITreeItem) { if( pITreeItem==GetSelectedTreeItem() ) //dont select the same again! { return; } //-------------- // Create Parent list std::list<IXTreeItem *> lParents; std::list<IXTreeItem *>::iterator It, ItLast; if(pITreeItem == NULL) { SelectItem(NULL); return; } TRACE("parent-stack:\n"); pITreeItem->GetParentList(lParents); TRACE("Found %i generations of parents to selected item\n",lParents.size()); HTREEITEM hItem = GetRootItem(); HTREEITEM hLastItem = hItem; It = lParents.begin(); if( h2p(hItem)!=(*It) ) //root at top of parent stack! { SelectItem(0); } else { while( It!=lParents.end() ) { // // current h must be the p in the parent list. if this is not the case, the // p reported a parent, that didn't list p as a child when expanding! // ASSERT( (*It) == h2p(hItem) ); //make sure parent lists all it's children! // // expand the node // TRACE( "expanding parent {%s}\n" , h2p(hItem)->GetLabel() ); Expand(hItem,TVE_EXPAND); if( (*It)==pITreeItem ) { break; } // // find the h of the child // It++; //next generation... if( It!=lParents.end() ) { IXTreeItem* pChild = *It; hItem = GetChildItem(hItem); //search for the item that contains next ITreeItem while( hItem!=NULL ) { if( h2p(hItem)==pChild ) { break; //break search and continue treating this child as the next parent } hItem = GetNextSiblingItem(hItem); } } } if(hItem) { EnsureVisible(hItem); SelectItem(hItem); } } }
char * ag_readnext(unsigned dbh, int foo) { return readnext(h2p(dbh),foo); }