Пример #1
0
void HIERARCHY_NAVIG_DLG::buildHierarchyTree( SCH_SHEET_PATH* aList, wxTreeItemId* aPreviousmenu )
{
    wxCHECK_RET( m_nbsheets < NB_MAX_SHEET, "Maximum number of sheets exceeded." );

    SCH_ITEM* schitem = aList->LastDrawList();

    while( schitem && m_nbsheets < NB_MAX_SHEET )
    {
        if( schitem->Type() == SCH_SHEET_T )
        {
            SCH_SHEET* sheet = (SCH_SHEET*) schitem;
            m_nbsheets++;
            wxTreeItemId menu;
            menu = m_Tree->AppendItem( *aPreviousmenu, sheet->GetName(), 0, 1 );
            aList->push_back( sheet );
            m_Tree->SetItemData( menu, new TreeItemData( *aList ) );

            if( *aList == m_currSheet )
            {
                m_Tree->EnsureVisible( menu );
                m_Tree->SelectItem( menu );
            }

            buildHierarchyTree( aList, &menu );

            aList->pop_back();
        }

        schitem = schitem->Next();
    }
}
Пример #2
0
SCH_SHEET* SCH_SCREEN::GetSheet( const wxString& aName )
{
    for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
    {
        if( item->Type() != SCH_SHEET_T )
            continue;

        SCH_SHEET* sheet = (SCH_SHEET*) item;

        if( aName.CmpNoCase( sheet->GetName() ) == 0 )
            return sheet;
    }

    return NULL;
}