本文整理汇总了C++中SCH_SHEET_LIST类的典型用法代码示例。如果您正苦于以下问题:C++ SCH_SHEET_LIST类的具体用法?C++ SCH_SHEET_LIST怎么用?C++ SCH_SHEET_LIST使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SCH_SHEET_LIST类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prepareForNetlist
bool SCH_EDIT_FRAME::prepareForNetlist()
{
SCH_SHEET_LIST sheets;
sheets.AnnotatePowerSymbols( Prj().SchLibs() );
// Performs some controls:
if( CheckAnnotate( NULL, 0 ) )
{
// Schematic must be annotated: call Annotate dialog and tell
// the user why that is.
InvokeDialogAnnotate( this, _( "Exporting the netlist requires a "
"completely\nannotated schematic." ) );
if( CheckAnnotate( NULL, 0 ) )
return false;
}
// Test duplicate sheet names:
if( TestDuplicateSheetNames( false ) > 0 )
{
if( !IsOK( NULL, _( "Error: duplicate sheet names. Continue?" ) ) )
return false;
}
// Cleanup the entire hierarchy
SCH_SCREENS screens;
screens.SchematicCleanUp();
return true;
}
示例2: DisplayERC_MarkersList
void DIALOG_ERC::DisplayERC_MarkersList()
{
SCH_SHEET_LIST sheetList;
m_MarkersList->ClearList();
SCH_SHEET_PATH* sheet = sheetList.GetFirst();
for( ; sheet != NULL; sheet = sheetList.GetNext() )
{
SCH_ITEM* item = sheet->LastDrawList();
for( ; item != NULL; item = item->Next() )
{
if( item->Type() != SCH_MARKER_T )
continue;
SCH_MARKER* marker = (SCH_MARKER*) item;
if( marker->GetMarkerType() != MARKER_BASE::MARKER_ERC )
continue;
m_MarkersList->AppendToList( marker );
}
}
m_MarkersList->DisplayList();
}
示例3: DisplayERC_MarkersList
void DIALOG_ERC::DisplayERC_MarkersList()
{
SCH_SHEET_LIST sheetList;
m_MarkersList->ClearList();
SCH_SHEET_PATH* sheet = sheetList.GetFirst();
for( ; sheet != NULL; sheet = sheetList.GetNext() )
{
SCH_ITEM* item = sheet->LastDrawList();
for( ; item != NULL; item = item->Next() )
{
if( item->Type() != SCH_MARKER_T )
continue;
SCH_MARKER* Marker = (SCH_MARKER*) item;
if( Marker->GetMarkerType() != MARKER_BASE::MARKER_ERC )
continue;
// Add marker without refresh the displayed list:
m_MarkersList->AppendToList( Marker, false );
}
}
m_MarkersList->Refresh();
}
示例4: GetScreen
void SCH_EDIT_FRAME::SetSheetNumberAndCount()
{
SCH_SCREEN* screen = GetScreen();
SCH_SCREENS s_list;
/* Set the sheet count, and the sheet number (1 for root sheet)
*/
int sheet_count = g_RootSheet->CountSheets();
int SheetNumber = 1;
wxString current_sheetpath = m_CurrentSheet->Path();
SCH_SHEET_LIST SheetList;
// Examine all sheets path to find the current sheets path,
// and count them from root to the current sheet path:
SCH_SHEET_PATH* sheet;
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
{
wxString sheetpath = sheet->Path();
if( sheetpath == current_sheetpath ) // Current sheet path found
break;
SheetNumber++; /* Not found, increment sheet
* number before this current
* path */
}
for( screen = s_list.GetFirst(); screen != NULL; screen = s_list.GetNext() )
{
screen->m_NumberOfScreens = sheet_count;
}
GetScreen()->m_ScreenNumber = SheetNumber;
}
示例5: GetComponents
void SCH_SHEET_PATH::GetComponents( PART_LIBS* aLibs, SCH_REFERENCE_LIST& aReferences, bool aIncludePowerSymbols )
{
// Search to sheet path number:
int sheetnumber = 1; // 1 = root
SCH_SHEET_LIST sheetList;
for( SCH_SHEET_PATH* path = sheetList.GetFirst(); path; path = sheetList.GetNext(), sheetnumber++ )
{
if( Cmp( *path ) == 0 )
break;
}
for( SCH_ITEM* item = LastDrawList(); item; item = item->Next() )
{
if( item->Type() == SCH_COMPONENT_T )
{
SCH_COMPONENT* component = (SCH_COMPONENT*) item;
// Skip pseudo components, which have a reference starting with #. This mainly
// affects power symbols.
if( !aIncludePowerSymbols && component->GetRef( this )[0] == wxT( '#' ) )
continue;
LIB_PART* part = aLibs->FindLibPart( component->GetPartName() );
if( part )
{
SCH_REFERENCE reference = SCH_REFERENCE( component, part, *this );
reference.SetSheetNumber( sheetnumber );
aReferences.AddItem( reference );
}
}
}
}
示例6: WriteDiagnosticERC
bool WriteDiagnosticERC( const wxString& aFullFileName )
{
wxString msg;
wxFFile file( aFullFileName, wxT( "wt" ) );
if( !file.IsOpened() )
return false;
msg = _( "ERC report" );
msg << wxT(" (") << DateAndTime() << wxT( ", " )
<< _( "Encoding UTF8" ) << wxT( " )\n" );
int err_count = 0;
int warn_count = 0;
int total_count = 0;
SCH_SHEET_LIST sheetList;
SCH_SHEET_PATH* sheet;
for( sheet = sheetList.GetFirst(); sheet != NULL; sheet = sheetList.GetNext() )
{
msg << wxString::Format( _( "\n***** Sheet %s\n" ),
GetChars( sheet->PathHumanReadable() ) );
for( SCH_ITEM* item = sheet->LastDrawList(); item != NULL; item = item->Next() )
{
if( item->Type() != SCH_MARKER_T )
continue;
SCH_MARKER* marker = (SCH_MARKER*) item;
if( marker->GetMarkerType() != MARKER_BASE::MARKER_ERC )
continue;
total_count++;
if( marker->GetErrorLevel() == MARKER_BASE::MARKER_SEVERITY_ERROR )
err_count++;
if( marker->GetErrorLevel() == MARKER_BASE::MARKER_SEVERITY_WARNING )
warn_count++;
msg << marker->GetReporter().ShowReport();
}
}
msg << wxString::Format( _( "\n ** ERC messages: %d Errors %d Warnings %d\n" ),
total_count, err_count, warn_count );
// Currently: write report unsing UTF8 (as usual in Kicad).
// TODO: see if we can use the current encoding page (mainly for Windows users),
// Or other format (HTML?)
file.Write( msg );
// wxFFile dtor will close the file.
return true;
}
示例7: OnLeftClickMarkersList
void DIALOG_ERC::OnLeftClickMarkersList( wxHtmlLinkEvent& event )
{
wxString link = event.GetLinkInfo().GetHref();
m_lastMarkerFound = NULL;
long index;
if( !link.ToLong( &index ) )
return;
const SCH_MARKER* marker = m_MarkersList->GetItem( index );
if( marker == NULL )
return;
// Search for the selected marker
SCH_SHEET_PATH* sheet;
SCH_SHEET_LIST SheetList;
bool notFound = true;
for( sheet = SheetList.GetFirst(); sheet; sheet = SheetList.GetNext() )
{
SCH_ITEM* item = (SCH_ITEM*) sheet->LastDrawList();
for( ; item; item = item->Next() )
{
if( item == marker )
{
notFound = false;
break;
}
}
if( notFound == false )
break;
}
if( notFound ) // Error
{
wxMessageBox( _( "Marker not found" ) );
// The marker was deleted, so rebuild marker list
DisplayERC_MarkersList();
return;
}
if( *sheet != m_parent->GetCurrentSheet() )
{
sheet->LastScreen()->SetZoom( m_parent->GetScreen()->GetZoom() );
m_parent->SetCurrentSheet( *sheet );
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
}
m_lastMarkerFound = marker;
m_parent->SetCrossHairPosition( marker->m_Pos );
m_parent->RedrawScreen( marker->m_Pos, false);
}
示例8: OnFindDrcMarker
void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event )
{
static SCH_MARKER* lastMarker = NULL;
wxString msg;
SCH_SHEET_LIST schematic;
SCH_SHEET_PATH* sheetFoundIn = NULL;
bool wrap = ( event.GetFlags() & FR_SEARCH_WRAP ) != 0;
wxRect clientRect( wxPoint( 0, 0 ), GetClientSize() );
bool warpCursor = ( ( event.GetId() == wxEVT_COMMAND_FIND_CLOSE ) ||
!( event.GetFlags() & FR_NO_WARP_CURSOR ) );
if( event.GetFlags() & FR_CURRENT_SHEET_ONLY )
{
sheetFoundIn = m_CurrentSheet;
lastMarker = (SCH_MARKER*) m_CurrentSheet->FindNextItem( SCH_MARKER_T, lastMarker, wrap );
}
else
{
lastMarker = (SCH_MARKER*) schematic.FindNextItem( SCH_MARKER_T, &sheetFoundIn,
lastMarker, wrap );
}
if( lastMarker != NULL )
{
if( *sheetFoundIn != *m_CurrentSheet )
{
sheetFoundIn->LastScreen()->SetZoom( GetScreen()->GetZoom() );
*m_CurrentSheet = *sheetFoundIn;
m_CurrentSheet->UpdateAllScreenReferences();
}
sheetFoundIn->LastScreen()->SetCrossHairPosition( lastMarker->GetPosition() );
RedrawScreen( lastMarker->GetPosition(), warpCursor );
wxString path = sheetFoundIn->Path();
wxString units = GetAbbreviatedUnitsLabel();
double x = To_User_Unit( g_UserUnit, (double) lastMarker->GetPosition().x,
m_internalUnits );
double y = To_User_Unit( g_UserUnit, (double) lastMarker->GetPosition().y,
m_internalUnits );
msg.Printf( _( "Design rule check marker found in sheet %s at %0.3f%s, %0.3f%s" ),
GetChars( path ), x, GetChars( units ), y, GetChars( units) );
SetStatusText( msg );
}
else
{
SetStatusText( _( "No more markers were found." ) );
}
}
示例9: CheckAnnotate
int SCH_EDIT_FRAME::CheckAnnotate( wxArrayString* aMessageList, bool aOneSheetOnly )
{
// build the screen list
SCH_SHEET_LIST SheetList;
SCH_REFERENCE_LIST ComponentsList;
// Build the list of components
if( !aOneSheetOnly )
SheetList.GetComponents( Prj().SchLibs(), ComponentsList );
else
m_CurrentSheet->GetComponents( Prj().SchLibs(), ComponentsList );
return ComponentsList.CheckAnnotation( aMessageList );
}
示例10: WriteDiagnosticERC
bool WriteDiagnosticERC( const wxString& aFullFileName )
{
SCH_ITEM* item;
SCH_MARKER* marker;
static FILE* file;
SCH_SHEET_PATH* sheet;
wxString msg;
int count = 0;
if( ( file = wxFopen( aFullFileName, wxT( "wt" ) ) ) == NULL )
return false;
msg = _( "ERC report" );
fprintf( file, "%s (%s)\n", TO_UTF8( msg ), TO_UTF8( DateAndTime() ) );
SCH_SHEET_LIST sheetList;
for( sheet = sheetList.GetFirst(); sheet != NULL; sheet = sheetList.GetNext() )
{
msg.Printf( _( "\n***** Sheet %s\n" ), GetChars( sheet->PathHumanReadable() ) );
fprintf( file, "%s", TO_UTF8( msg ) );
for( item = sheet->LastDrawList(); item != NULL; item = item->Next() )
{
if( item->Type() != SCH_MARKER_T )
continue;
marker = (SCH_MARKER*) item;
if( marker->GetMarkerType() != MARK_ERC )
continue;
if( marker->GetMarkerType() == ERR )
count++;
msg = marker->GetReporter().ShowReport();
fprintf( file, "%s", TO_UTF8( msg ) );
}
}
msg.Printf( _( "\n >> Errors ERC: %d\n" ), count );
fprintf( file, "%s", TO_UTF8( msg ) );
fclose( file );
return true;
}
示例11: findAllInstancesOfComponent
void NETLIST_EXPORTER::findAllInstancesOfComponent( SCH_COMPONENT* aComponent,
LIB_PART* aEntry,
SCH_SHEET_PATH* aSheetPath )
{
wxString ref = aComponent->GetRef( aSheetPath );
wxString ref2;
SCH_SHEET_LIST sheetList;
for( SCH_SHEET_PATH* sheet = sheetList.GetFirst(); sheet; sheet = sheetList.GetNext() )
{
for( EDA_ITEM* item = sheet->LastDrawList(); item; item = item->Next() )
{
if( item->Type() != SCH_COMPONENT_T )
continue;
SCH_COMPONENT* comp2 = (SCH_COMPONENT*) item;
ref2 = comp2->GetRef( sheet );
if( ref2.CmpNoCase( ref ) != 0 )
continue;
int unit2 = comp2->GetUnitSelection( sheet ); // slow
for( LIB_PIN* pin = aEntry->GetNextPin(); pin; pin = aEntry->GetNextPin( pin ) )
{
wxASSERT( pin->Type() == LIB_PIN_T );
if( pin->GetUnit() && pin->GetUnit() != unit2 )
continue;
if( pin->GetConvert() && pin->GetConvert() != comp2->GetConvert() )
continue;
// A suitable pin is found: add it to the current list
addPinToComponentPinList( comp2, sheet, pin );
}
}
}
}
示例12: Empty
void SCH_FIND_COLLECTOR::Collect( SCH_FIND_REPLACE_DATA& aFindReplaceData,
SCH_SHEET_PATH* aSheetPath )
{
if( !IsSearchRequired( aFindReplaceData ) && !m_List.empty() && !m_forceSearch )
return;
m_findReplaceData = aFindReplaceData;
Empty(); // empty the collection just in case
m_data.clear();
m_foundIndex = 0;
SetForceSearch( false );
if( aSheetPath )
{
m_sheetPath = aSheetPath;
EDA_ITEM::IterateForward( aSheetPath->LastDrawList(), this, NULL, m_ScanTypes );
}
else
{
SCH_SHEET_LIST schematic;
m_sheetPath = schematic.GetFirst();
while( m_sheetPath != NULL )
{
EDA_ITEM::IterateForward( m_sheetPath->LastDrawList(), this, NULL, m_ScanTypes );
m_sheetPath = schematic.GetNext();
}
}
#if defined(DEBUG)
dump();
#endif
if( m_List.size() != m_data.size() )
{
wxFAIL_MSG( wxT( "List size mismatch." ) );
m_List.clear();
m_data.clear();
}
}
示例13: GetMultiUnitComponents
void SCH_SHEET_PATH::GetMultiUnitComponents( PART_LIBS* aLibs, SCH_MULTI_UNIT_REFERENCE_MAP &aRefList,
bool aIncludePowerSymbols )
{
// Find sheet path number
int sheetnumber = 1; // 1 = root
SCH_SHEET_LIST sheetList;
for( SCH_SHEET_PATH* path = sheetList.GetFirst(); path; path = sheetList.GetNext(), sheetnumber++ )
{
if( Cmp( *path ) == 0 )
break;
}
for( SCH_ITEM* item = LastDrawList(); item; item = item->Next() )
{
if( item->Type() != SCH_COMPONENT_T ) continue;
SCH_COMPONENT* component = (SCH_COMPONENT*) item;
// Skip pseudo components, which have a reference starting with #. This mainly
// affects power symbols.
if( !aIncludePowerSymbols && component->GetRef( this )[0] == wxT( '#' ) )
continue;
LIB_PART* part = aLibs->FindLibPart( component->GetPartName() );
if( part && part->GetUnitCount() > 1 )
{
SCH_REFERENCE reference = SCH_REFERENCE( component, part, *this );
reference.SetSheetNumber( sheetnumber );
wxString reference_str = reference.GetRef();
// Never lock unassigned references
if( reference_str[reference_str.Len() - 1] == '?' ) continue;
aRefList[reference_str].AddItem( reference );
}
}
}
示例14: CreateNetlist
/* Function CreateNetlist
* > test for some issues (missing or duplicate references and sheet names)
* > build netlist info
* > create the netlist file
* param aFormat = netlist format (NET_TYPE_PCBNEW ...)
* param aFullFileName = full netlist file name
* param aNetlistOptions = netlist options using OR'ed bits (see WriteNetListFile).
* return true if success.
*/
bool SCH_EDIT_FRAME::CreateNetlist( int aFormat, const wxString& aFullFileName,
unsigned aNetlistOptions )
{
SCH_SHEET_LIST sheets;
sheets.AnnotatePowerSymbols();
// Performs some controls:
if( CheckAnnotate( NULL, 0 ) )
{
if( !IsOK( NULL, _( "Some items are not annotated\n\
Do you want to annotate schematic?" ) ) )
return false;
// Schematic must be annotated: call Annotate dialog:
wxCommandEvent event;
OnAnnotate( event );
if( CheckAnnotate( NULL, 0 ) )
return false;
}
// Test duplicate sheet names:
if( TestDuplicateSheetNames( false ) > 0 )
{
if( !IsOK( NULL, _( "Error: duplicate sheet names. Continue?" ) ) )
return false;
}
/* Cleanup the entire hierarchy */
SCH_SCREENS screens;
screens.SchematicCleanUp();
BuildNetListBase();
bool success = WriteNetListFile( aFormat, aFullFileName, aNetlistOptions );
return success;
}
示例15: TestErc
void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
{
wxFileName fn;
m_writeErcFile = m_WriteResultOpt->GetValue();
m_TestSimilarLabels = m_cbTestSimilarLabels->GetValue();
m_tstUniqueGlobalLabels = m_cbTestUniqueGlbLabels->GetValue();
// Build the whole sheet list in hierarchy (sheet, not screen)
SCH_SHEET_LIST sheets;
sheets.AnnotatePowerSymbols( Prj().SchLibs() );
if( m_parent->CheckAnnotate( aMessagesList, false ) )
{
if( aMessagesList )
{
wxString msg = _( "Annotation required!" );
msg += wxT( "\n" );
aMessagesList->Add( msg );
}
return;
}
SCH_SCREENS screens;
// Erase all previous DRC markers.
screens.DeleteAllMarkers( MARKER_BASE::MARKER_ERC );
for( SCH_SCREEN* screen = screens.GetFirst(); screen != NULL; screen = screens.GetNext() )
{
/* Ff wire list has changed, delete Undo Redo list to avoid pointers on deleted
* data problems.
*/
if( screen->SchematicCleanUp( NULL ) )
screen->ClearUndoRedoList();
}
/* Test duplicate sheet names inside a given sheet, one cannot have sheets with
* duplicate names (file names can be duplicated).
*/
TestDuplicateSheetNames( true );
std::auto_ptr<NETLIST_OBJECT_LIST> objectsConnectedList( m_parent->BuildNetListBase() );
// Reset the connection type indicator
objectsConnectedList->ResetConnectionsType();
unsigned lastNet;
unsigned nextNet = lastNet = 0;
int MinConn = NOC;
for( unsigned net = 0; net < objectsConnectedList->size(); net++ )
{
if( objectsConnectedList->GetItemNet( lastNet ) !=
objectsConnectedList->GetItemNet( net ) )
{
// New net found:
MinConn = NOC;
nextNet = net;
}
switch( objectsConnectedList->GetItemType( net ) )
{
// These items do not create erc problems
case NET_ITEM_UNSPECIFIED:
case NET_SEGMENT:
case NET_BUS:
case NET_JUNCTION:
case NET_LABEL:
case NET_BUSLABELMEMBER:
case NET_PINLABEL:
case NET_GLOBBUSLABELMEMBER:
break;
case NET_HIERLABEL:
case NET_HIERBUSLABELMEMBER:
case NET_SHEETLABEL:
case NET_SHEETBUSLABELMEMBER:
// ERC problems when pin sheets do not match hierarchical labels.
// Each pin sheet must match a hierarchical label
// Each hierarchical label must match a pin sheet
objectsConnectedList->TestforNonOrphanLabel( net, nextNet );
break;
case NET_GLOBLABEL:
if( m_tstUniqueGlobalLabels )
objectsConnectedList->TestforNonOrphanLabel( net, nextNet );
break;
case NET_NOCONNECT:
// ERC problems when a noconnect symbol is connected to more than one pin.
MinConn = NET_NC;
if( objectsConnectedList->CountPinsInNet( nextNet ) > 1 )
Diagnose( objectsConnectedList->GetItem( net ), NULL, MinConn, UNC );
break;
case NET_PIN:
//.........这里部分代码省略.........