// ---------------------------------------------------------------------------- bool CGffRecord::IsParentOf( CSeq_feat::TData::ESubtype maybe_parent, CSeq_feat::TData::ESubtype maybe_child ) // ---------------------------------------------------------------------------- { switch ( maybe_parent ) { default: return false; case CSeq_feat::TData::eSubtype_10_signal: case CSeq_feat::TData::eSubtype_35_signal: case CSeq_feat::TData::eSubtype_3UTR: case CSeq_feat::TData::eSubtype_5UTR: return false; case CSeq_feat::TData::eSubtype_operon: switch ( maybe_child ) { case CSeq_feat::TData::eSubtype_gene: case CSeq_feat::TData::eSubtype_promoter: return true; default: return IsParentOf( CSeq_feat::TData::eSubtype_gene, maybe_child ) || IsParentOf( CSeq_feat::TData::eSubtype_promoter, maybe_child ); } case CSeq_feat::TData::eSubtype_gene: switch ( maybe_child ) { case CSeq_feat::TData::eSubtype_intron: case CSeq_feat::TData::eSubtype_mRNA: return true; default: return IsParentOf( CSeq_feat::TData::eSubtype_intron, maybe_child ) || IsParentOf( CSeq_feat::TData::eSubtype_mRNA, maybe_child ); } case CSeq_feat::TData::eSubtype_cdregion: switch ( maybe_child ) { case CSeq_feat::TData::eSubtype_exon: return true; default: return IsParentOf( CSeq_feat::TData::eSubtype_exon, maybe_child ); } } return false; }
CString CServerPath::GetSubdirsOf(const CServerPath &path) const { ASSERT(IsParentOf(path)); CServerPath subdirs=path; CString ret; while(IsParentOf(subdirs)) { CString tmp; tmp.Format(_T(" %d %s"), subdirs.GetLastSegment().GetLength(),(LPCTSTR)subdirs.GetLastSegment()); ret += tmp; subdirs = subdirs.GetParent(); } ret.TrimLeft( _T(" ") ); return ret; }
Uint32 cUIMenu::OnMessage( const cUIMessage * Msg ) { switch ( Msg->Msg() ) { case cUIMessage::MsgMouseUp: { if ( Msg->Sender()->Parent() == this && ( Msg->Flags() & EE_BUTTONS_LRM ) ) { cUIEvent ItemEvent( Msg->Sender(), cUIEvent::EventOnItemClicked ); SendEvent( &ItemEvent ); } return 1; } case cUIMessage::MsgFocusLoss: { cUIControl * FocusCtrl = cUIManager::instance()->FocusControl(); if ( this != FocusCtrl && !IsParentOf( FocusCtrl ) && !IsSubMenu( FocusCtrl ) ) { OnComplexControlFocusLoss(); } return 1; } } return 0; }
void Container::SetVisibility(bool fToValue) { // inherited Element::SetVisibility(fToValue); // remove focus from contained elements if (!fToValue) { Dialog *pDlg = GetDlg(); if (pDlg) { Control *pFocus = pDlg->GetFocus(); if (pFocus) { if (IsParentOf(pFocus)) { pDlg->SetFocus(NULL, false); } } } } }
// ---------------------------------------------------------------------------- bool CGffRecord::AssignAttributesCore( const CSeq_annot& annot, const CSeq_feat& feature ) // ---------------------------------------------------------------------------- { m_strAttributes = ""; // If feature ids are present then they are likely used to show parent/child // relationships, via corresponding xrefs. Thus, any feature ids override // gb ID tags (feature ids and ID tags should agree in the first place, but // if not, feature ids must trump ID tags). // bool bIdAssigned = false; if ( feature.CanGetId() ) { const CSeq_feat::TId& id = feature.GetId(); string value = CGffRecord::FeatIdString( id ); AddAttribute( "ID", value ); bIdAssigned = true; } if ( feature.CanGetXref() ) { const CSeq_feat::TXref& xref = feature.GetXref(); string value; for ( size_t i=0; i < xref.size(); ++i ) { // const CSeqFeatXref& ref = *xref[i]; if ( xref[i]->CanGetId() && xref[i]->CanGetData() ) { const CSeqFeatXref::TId& id = xref[i]->GetId(); CSeq_feat::TData::ESubtype other_type = GetSubtypeOf( annot, id ); if ( ! IsParentOf( other_type, feature.GetData().GetSubtype() ) ) { continue; } if ( ! value.empty() ) { value += ","; } value += CGffRecord::FeatIdString( id ); } } if ( ! value.empty() ) { AddAttribute( "Parent", value ); } } if ( feature.CanGetQual() ) { const vector< CRef< CGb_qual > >& quals = feature.GetQual(); vector< CRef< CGb_qual > >::const_iterator it = quals.begin(); while ( it != quals.end() ) { if ( (*it)->CanGetQual() && (*it)->CanGetVal() ) { if ( (*it)->GetQual() == "ID" ) { if ( ! bIdAssigned ) { AddAttribute( "ID", (*it)->GetVal() ); } } if ( (*it)->GetQual() == "Name" ) { AddAttribute( "Name", (*it)->GetVal() ); } if ( (*it)->GetQual() == "Var_type" ) { AddAttribute( "Var_type", (*it)->GetVal() ); } } ++it; } } return true; }