本文整理汇总了C++中SCH_SHEET类的典型用法代码示例。如果您正苦于以下问题:C++ SCH_SHEET类的具体用法?C++ SCH_SHEET怎么用?C++ SCH_SHEET使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SCH_SHEET类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
bool SCH_SHEET::SearchHierarchy( const wxString& aFilename, SCH_SCREEN** aScreen )
{
if( m_screen )
{
EDA_ITEM* item = m_screen->GetDrawItems();
while( item )
{
if( item->Type() == SCH_SHEET_T )
{
SCH_SHEET* sheet = (SCH_SHEET*) item;
if( sheet->m_screen
&& sheet->m_screen->GetFileName().CmpNoCase( aFilename ) == 0 )
{
*aScreen = sheet->m_screen;
return true;
}
if( sheet->SearchHierarchy( aFilename, aScreen ) )
return true;
}
item = item->Next();
}
}
return false;
}
示例2: wxCHECK_RET
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();
}
}
示例3: AddScreenToList
void SCH_SCREENS::BuildScreenList( EDA_ITEM* aItem )
{
if( aItem && aItem->Type() == SCH_SHEET_T )
{
SCH_SHEET* ds = (SCH_SHEET*) aItem;
aItem = ds->GetScreen();
}
if( aItem && aItem->Type() == SCH_SCREEN_T )
{
SCH_SCREEN* screen = (SCH_SCREEN*) aItem;
// Ensure each component has its pointer to its part lib LIB_PART
// up to date (the cost is low if this is the case)
// We do this update here, because most of time this function is called
// to create a netlist, or an ERC, which need this update
screen->BuildSchCmpLinksToLibCmp();
AddScreenToList( screen );
EDA_ITEM* strct = screen->GetDrawItems();
while( strct )
{
if( strct->Type() == SCH_SHEET_T )
{
BuildScreenList( strct );
}
strct = strct->Next();
}
}
}
示例4: ComponentCount
int SCH_SHEET::ComponentCount()
{
int n = 0;
if( m_screen )
{
EDA_ITEM* bs;
for( bs = m_screen->GetDrawItems(); bs != NULL; bs = bs->Next() )
{
if( bs->Type() == SCH_COMPONENT_T )
{
SCH_COMPONENT* Cmp = (SCH_COMPONENT*) bs;
if( Cmp->GetField( VALUE )->GetText().GetChar( 0 ) != '#' )
n++;
}
if( bs->Type() == SCH_SHEET_T )
{
SCH_SHEET* sheet = (SCH_SHEET*) bs;
n += sheet->ComponentCount();
}
}
}
return n;
}
示例5: AddScreenToList
void SCH_SCREENS::BuildScreenList( EDA_ITEM* aItem )
{
if( aItem && aItem->Type() == SCH_SHEET_T )
{
SCH_SHEET* ds = (SCH_SHEET*) aItem;
aItem = ds->GetScreen();
}
if( aItem && aItem->Type() == SCH_SCREEN_T )
{
SCH_SCREEN* screen = (SCH_SCREEN*) aItem;
AddScreenToList( screen );
EDA_ITEM* strct = screen->GetDrawItems();
while( strct )
{
if( strct->Type() == SCH_SHEET_T )
{
BuildScreenList( strct );
}
strct = strct->Next();
}
}
}
示例6: wxCHECK_RET
void SCH_EDIT_FRAME::DeleteItem( SCH_ITEM* aItem )
{
wxCHECK_RET( aItem != NULL, wxT( "Cannot delete invalid item." ) );
// Here, aItem is not null.
SCH_SCREEN* screen = GetScreen();
if( aItem->Type() == SCH_SHEET_PIN_T )
{
// This iten is attached to a node, and is not accessible by the global list directly.
SCH_SHEET* sheet = (SCH_SHEET*) aItem->GetParent();
wxCHECK_RET( (sheet != NULL) && (sheet->Type() == SCH_SHEET_T),
wxT( "Sheet label has invalid parent item." ) );
SaveCopyInUndoList( (SCH_ITEM*) sheet, UR_CHANGED );
sheet->RemovePin( (SCH_SHEET_PIN*) aItem );
m_canvas->RefreshDrawingRect( sheet->GetBoundingBox() );
}
else
{
screen->Remove( aItem );
SaveCopyInUndoList( aItem, UR_DELETED );
m_canvas->RefreshDrawingRect( aItem->GetBoundingBox() );
}
}
示例7: Last
SCH_ITEM* SCH_SHEET_PATH::LastDrawList() const
{
SCH_SHEET* lastSheet = Last();
if( lastSheet && lastSheet->GetScreen() )
return lastSheet->GetScreen()->GetDrawItems();
return NULL;
}
示例8: GetParent
SCH_SHEET* SCH_SHEET::GetRootSheet()
{
SCH_SHEET* sheet = dynamic_cast< SCH_SHEET* >( GetParent() );
if( sheet == NULL )
return this;
// Recurse until a sheet is found with no parent which is the root sheet.
return sheet->GetRootSheet();
}
示例9: wxCHECK_RET
void SCH_EDIT_FRAME::DeleteItem( SCH_ITEM* aItem, bool aAppend )
{
wxCHECK_RET( aItem != NULL, wxT( "Cannot delete invalid item." ) );
wxCHECK_RET( !( aItem->GetFlags() & STRUCT_DELETED ),
wxT( "Cannot delete item that is already deleted." ) );
// Here, aItem is not null.
SCH_SCREEN* screen = GetScreen();
if( aItem->Type() == SCH_SHEET_PIN_T )
{
// This item is attached to a node, and is not accessible by the global list directly.
SCH_SHEET* sheet = (SCH_SHEET*) aItem->GetParent();
wxCHECK_RET( (sheet != NULL) && (sheet->Type() == SCH_SHEET_T),
wxT( "Sheet label has invalid parent item." ) );
SaveCopyInUndoList( (SCH_ITEM*) sheet, UR_CHANGED, aAppend );
sheet->RemovePin( (SCH_SHEET_PIN*) aItem );
m_canvas->RefreshDrawingRect( sheet->GetBoundingBox() );
}
else
{
PICKED_ITEMS_LIST itemsList;
ITEM_PICKER picker( aItem, UR_DELETED );
aItem->SetFlags( STRUCT_DELETED );
itemsList.PushItem( picker );
screen->Remove( aItem );
if( aItem->IsConnectable() && aItem->Type() != SCH_JUNCTION_T )
{
std::vector< wxPoint > pts;
aItem->GetConnectionPoints( pts );
for( auto point : pts )
{
SCH_ITEM* junction;
if( !screen->IsJunctionNeeded( point )
&& ( junction = screen->GetItem( point, 0, SCH_JUNCTION_T ) ) )
{
ITEM_PICKER picker_juction( junction, UR_DELETED );
junction->SetFlags( STRUCT_DELETED );
itemsList.PushItem( picker_juction );
screen->Remove( junction );
}
}
}
SaveCopyInUndoList( itemsList, UR_DELETED, aAppend );
m_canvas->RefreshDrawingRect( aItem->GetBoundingBox() );
}
}
示例10: DuplicateItemsInList
void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
const wxPoint& aMoveVector )
{
SCH_ITEM* newitem;
if( aItemsList.GetCount() == 0 )
return;
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
{
newitem = DuplicateStruct( (SCH_ITEM*) aItemsList.GetPickedItem( ii ) );
aItemsList.SetPickedItem( newitem, ii );
aItemsList.SetPickedItemStatus( UR_NEW, ii );
{
switch( newitem->Type() )
{
case SCH_JUNCTION_T:
case SCH_LINE_T:
case SCH_BUS_BUS_ENTRY_T:
case SCH_BUS_WIRE_ENTRY_T:
case SCH_TEXT_T:
case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T:
case SCH_HIERARCHICAL_LABEL_T:
case SCH_SHEET_PIN_T:
case SCH_MARKER_T:
case SCH_NO_CONNECT_T:
default:
break;
case SCH_SHEET_T:
{
SCH_SHEET* sheet = (SCH_SHEET*) newitem;
sheet->SetTimeStamp( GetNewTimeStamp() );
break;
}
case SCH_COMPONENT_T:
( (SCH_COMPONENT*) newitem )->SetTimeStamp( GetNewTimeStamp() );
( (SCH_COMPONENT*) newitem )->ClearAnnotation( NULL );
break;
}
SetSchItemParent( newitem, screen );
screen->Append( newitem );
}
}
MoveItemsInList( aItemsList, aMoveVector );
}
示例11: GetSheet
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;
}
示例12: GetSheetLabel
SCH_SHEET_PIN* SCH_SCREEN::GetSheetLabel( const wxPoint& aPosition )
{
SCH_SHEET_PIN* sheetPin = NULL;
for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
{
if( item->Type() != SCH_SHEET_T )
continue;
SCH_SHEET* sheet = (SCH_SHEET*) item;
sheetPin = sheet->GetPin( aPosition );
if( sheetPin )
break;
}
return sheetPin;
}
示例13: CountSheets
int SCH_SHEET::CountSheets()
{
int count = 1; //1 = this!!
if( m_screen )
{
EDA_ITEM* strct = m_screen->GetDrawItems();
for( ; strct; strct = strct->Next() )
{
if( strct->Type() == SCH_SHEET_T )
{
SCH_SHEET* subsheet = (SCH_SHEET*) strct;
count += subsheet->CountSheets();
}
}
}
return count;
}
示例14: wxCHECK_RET
void SCH_SCREEN::DeleteItem( SCH_ITEM* aItem )
{
wxCHECK_RET( aItem, wxT( "Cannot delete invalid item from screen." ) );
SetModify();
if( aItem->Type() == SCH_SHEET_PIN_T )
{
// This structure is attached to a sheet, get the parent sheet object.
SCH_SHEET_PIN* sheetPin = (SCH_SHEET_PIN*) aItem;
SCH_SHEET* sheet = sheetPin->GetParent();
wxCHECK_RET( sheet,
wxT( "Sheet label parent not properly set, bad programmer!" ) );
sheet->RemovePin( sheetPin );
return;
}
else
{
delete m_drawList.Remove( aItem );
}
}
示例15: SetRepeatItem
// Create hierarchy sheet.
SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
{
SetRepeatItem( NULL );
SCH_SHEET* sheet = new SCH_SHEET( GetCrossHairPosition() );
sheet->SetFlags( IS_NEW | IS_RESIZED );
sheet->SetTimeStamp( GetNewTimeStamp() );
sheet->SetParent( GetScreen() );
sheet->SetScreen( NULL );
// need to check if this is being added to the GetDrawItems().
// also need to update the hierarchy, if we are adding
// a sheet to a screen that already has multiple instances (!)
GetScreen()->SetCurItem( sheet );
m_canvas->SetMouseCapture( resizeSheetWithMouseCursor, ExitSheet );
m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
m_canvas->CrossHairOff( aDC );
SetCrossHairPosition( sheet->GetResizePosition() );
m_canvas->MoveCursorToCrossHair();
m_canvas->CrossHairOn( aDC );
return sheet;
}