Undo commit -r 6428.

This commit is contained in:
Wayne Stambaugh 2016-02-15 15:17:51 -05:00
parent 1866b61a56
commit 4007317606
29 changed files with 101 additions and 106 deletions

View File

@ -50,7 +50,7 @@ void SCH_EDIT_FRAME::DeleteAnnotation( bool aCurrentSheetOnly )
}
// Update the references for the sheet that is currently being displayed.
m_CurrentSheet->Last()->UpdateAllScreenReferences();
m_CurrentSheet->UpdateAllScreenReferences();
GetCanvas()->Refresh();
OnModify();
}
@ -176,7 +176,7 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic,
OnModify();
// Update on screen references, that can be modified by previous calculations:
m_CurrentSheet->Last()->UpdateAllScreenReferences();
m_CurrentSheet->UpdateAllScreenReferences();
SetSheetNumberAndCount();
m_canvas->Refresh( true );

View File

@ -357,7 +357,7 @@ wxString NETLIST_OBJECT::GetShortNetName() const
if( link ) // Should be always true
{
netName = wxT("Net-(");
netName << link->GetRef( m_netNameCandidate->m_SheetPath.Last() );
netName << link->GetRef( &m_netNameCandidate->m_SheetPath );
netName << wxT("-Pad")
<< LIB_PIN::PinStringNum( m_netNameCandidate->m_PinNum )
<< wxT(")");

View File

@ -7,8 +7,8 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2011 jean-pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
* Copyright (C) 1992-2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 1992-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -701,7 +701,7 @@ SCH_REFERENCE::SCH_REFERENCE( SCH_COMPONENT* aComponent, LIB_PART* aLibComponent
m_RootCmp = aComponent;
m_Entry = aLibComponent;
m_Unit = aComponent->GetUnitSelection( aSheetPath.Last() );
m_Unit = aComponent->GetUnitSelection( &aSheetPath );
m_SheetPath = aSheetPath;
m_IsNew = false;
m_Flag = 0;
@ -709,10 +709,10 @@ SCH_REFERENCE::SCH_REFERENCE( SCH_COMPONENT* aComponent, LIB_PART* aLibComponent
m_CmpPos = aComponent->GetPosition();
m_SheetNum = 0;
if( aComponent->GetRef( aSheetPath.Last() ).IsEmpty() )
if( aComponent->GetRef( &aSheetPath ).IsEmpty() )
aComponent->SetRef( aSheetPath.Last(), wxT( "DefRef?" ) );
SetRef( aComponent->GetRef( aSheetPath.Last() ) );
SetRef( aComponent->GetRef( &aSheetPath ) );
m_NumRef = -1;

View File

@ -108,7 +108,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, const KIC
Pin->GetMsgPanelInfo( items );
if( LibItem )
items.push_back( MSG_PANEL_ITEM( LibItem->GetRef( m_CurrentSheet->Last() ),
items.push_back( MSG_PANEL_ITEM( LibItem->GetRef( m_CurrentSheet ),
LibItem->GetField( VALUE )->GetShownText(), DARKCYAN ) );
SetMsgPanel( items );

View File

@ -727,7 +727,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent
}
#endif
m_FieldsBuf[REFERENCE].SetText( m_cmp->GetRef( m_parent->GetCurrentSheet().Last() ) );
m_FieldsBuf[REFERENCE].SetText( m_cmp->GetRef( &m_parent->GetCurrentSheet() ) );
for( unsigned i = 0; i<m_FieldsBuf.size(); ++i )
{

View File

@ -235,7 +235,7 @@ void DIALOG_ERC::OnLeftClickMarkersList( wxHtmlLinkEvent& event )
{
sheet->LastScreen()->SetZoom( m_parent->GetScreen()->GetZoom() );
m_parent->SetCurrentSheet( *sheet );
m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences();
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
}
m_lastMarkerFound = marker;

View File

@ -327,7 +327,7 @@ bool SCH_PRINTOUT::OnPrintPage( int page )
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{
m_parent->SetCurrentSheet( list );
m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences();
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
screen = m_parent->GetCurrentSheet().LastScreen();
}
@ -341,7 +341,7 @@ bool SCH_PRINTOUT::OnPrintPage( int page )
DrawPage( screen );
m_parent->SetCurrentSheet( oldsheetpath );
m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences();
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
return true;

View File

@ -34,8 +34,6 @@
#include <boost/foreach.hpp>
#include <project_rescue.h>
#include <eeschema_config.h>
#include <sch_sheet_path.h>
class DIALOG_RESCUE_EACH: public DIALOG_RESCUE_EACH_BASE
{
@ -158,7 +156,7 @@ void DIALOG_RESCUE_EACH::PopulateInstanceList()
SCH_FIELD* valueField = each_component->GetField( 1 );
data.clear();
data.push_back( each_component->GetRef( m_Parent->GetCurrentSheet().Last() ) );
data.push_back( each_component->GetRef( & m_Parent->GetCurrentSheet() ) );
data.push_back( valueField ? valueField->GetText() : wxT( "" ) );
m_ListOfInstances->AppendItem( data );

View File

@ -289,7 +289,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
cmp_ref = wxT( "?" );
if( aNetItemRef->m_Type == NET_PIN && aNetItemRef->m_Link )
cmp_ref = aNetItemRef->GetComponentParent()->GetRef( aNetItemRef->m_SheetPath.Last() );
cmp_ref = aNetItemRef->GetComponentParent()->GetRef( &aNetItemRef->m_SheetPath );
if( aNetItemTst == NULL )
{
@ -310,7 +310,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
{
if( aNetItemRef->m_Type == NET_PIN && aNetItemRef->m_Link )
cmp_ref = aNetItemRef->GetComponentParent()->GetRef(
aNetItemRef->m_SheetPath.Last() );
&aNetItemRef->m_SheetPath );
msg.Printf( _( "Pin %s (%s) of component %s is not driven (Net %d)." ),
GetChars( string_pinnum ),
@ -352,7 +352,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
alt_cmp = wxT( "?" );
if( aNetItemTst->m_Type == NET_PIN && aNetItemTst->m_Link )
alt_cmp = aNetItemTst->GetComponentParent()->GetRef( aNetItemTst->m_SheetPath.Last() );
alt_cmp = aNetItemTst->GetComponentParent()->GetRef( &aNetItemTst->m_SheetPath );
msg.Printf( _( "Pin %s (%s) of component %s is connected to " ),
GetChars( string_pinnum ),
@ -425,9 +425,9 @@ void TestOthersItems( NETLIST_OBJECT_LIST* aList,
continue;
if( ( (SCH_COMPONENT*) aList->GetItem( aNetItemRef )->
m_Link )->GetRef( aList->GetItem( aNetItemRef )->m_SheetPath.Last() ) !=
m_Link )->GetRef( &aList->GetItem( aNetItemRef )-> m_SheetPath ) !=
( (SCH_COMPONENT*) aList->GetItem( duplicate )->m_Link )
->GetRef( aList->GetItem( duplicate )->m_SheetPath.Last() ) )
->GetRef( &aList->GetItem( duplicate )->m_SheetPath ) )
continue;
// Same component and same pin. Do dot create error for this pin

View File

@ -85,7 +85,7 @@ void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event )
{
sheetFoundIn->LastScreen()->SetZoom( GetScreen()->GetZoom() );
*m_CurrentSheet = *sheetFoundIn;
m_CurrentSheet->Last()->UpdateAllScreenReferences();
m_CurrentSheet->UpdateAllScreenReferences();
}
SetCrossHairPosition( lastMarker->GetPosition() );
@ -139,7 +139,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference,
SCH_COMPONENT* pSch = (SCH_COMPONENT*) item;
if( aReference.CmpNoCase( pSch->GetRef( sheet->Last() ) ) == 0 )
if( aReference.CmpNoCase( pSch->GetRef( sheet ) ) == 0 )
{
Component = pSch;
sheetWithComponentFound = sheet;
@ -193,7 +193,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference,
{
sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
*m_CurrentSheet = *sheet;
m_CurrentSheet->Last()->UpdateAllScreenReferences();
m_CurrentSheet->UpdateAllScreenReferences();
centerAndRedraw = true;
}
@ -489,7 +489,7 @@ void SCH_EDIT_FRAME::updateFindReplaceView( wxFindDialogEvent& aEvent )
{
sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
*m_CurrentSheet = *sheet;
m_CurrentSheet->Last()->UpdateAllScreenReferences();
m_CurrentSheet->UpdateAllScreenReferences();
SetScreen( sheet->LastScreen() );
}

View File

@ -285,7 +285,7 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet()
GetScreen()->SetGrid( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 );
// update the References
m_CurrentSheet->Last()->UpdateAllScreenReferences();
m_CurrentSheet->UpdateAllScreenReferences();
SetSheetNumberAndCount();
m_canvas->SetCanStartBlock( -1 );

View File

@ -115,8 +115,7 @@ SCH_COMPONENT* NETLIST_EXPORTER::findNextComponent( EDA_ITEM* aItem, SCH_SHEET_P
// Power symbols and other components which have the reference starting
// with "#" are not included in netlist (pseudo or virtual components)
ref = comp->GetRef( aSheetPath->Last() );
ref = comp->GetRef( aSheetPath );
if( ref[0] == wxChar( '#' ) )
continue;
@ -174,7 +173,7 @@ SCH_COMPONENT* NETLIST_EXPORTER::findNextComponentAndCreatePinList( EDA_ITEM*
// Power symbols and other components which have the reference starting
// with "#" are not included in netlist (pseudo or virtual components)
ref = comp->GetRef( aSheetPath->Last() );
ref = comp->GetRef( aSheetPath );
if( ref[0] == wxChar( '#' ) )
continue;
@ -207,7 +206,7 @@ SCH_COMPONENT* NETLIST_EXPORTER::findNextComponentAndCreatePinList( EDA_ITEM*
{
LIB_PINS pins; // constructed once here
part->GetPins( pins, comp->GetUnitSelection( aSheetPath->Last() ), comp->GetConvert() );
part->GetPins( pins, comp->GetUnitSelection( aSheetPath ), comp->GetConvert() );
for( size_t i = 0; i < pins.size(); i++ )
{
@ -323,10 +322,10 @@ void NETLIST_EXPORTER::eraseDuplicatePins()
void NETLIST_EXPORTER::findAllInstancesOfComponent( SCH_COMPONENT* aComponent,
LIB_PART* aEntry,
SCH_SHEET_PATH* aSheetPath )
LIB_PART* aEntry,
SCH_SHEET_PATH* aSheetPath )
{
wxString ref = aComponent->GetRef( aSheetPath->Last() );
wxString ref = aComponent->GetRef( aSheetPath );
wxString ref2;
SCH_SHEET_LIST sheetList;
@ -340,11 +339,11 @@ void NETLIST_EXPORTER::findAllInstancesOfComponent( SCH_COMPONENT* aComponent,
SCH_COMPONENT* comp2 = (SCH_COMPONENT*) item;
ref2 = comp2->GetRef( sheet->Last() );
ref2 = comp2->GetRef( sheet );
if( ref2.CmpNoCase( ref ) != 0 )
continue;
int unit2 = comp2->GetUnitSelection( sheet->Last() ); // slow
int unit2 = comp2->GetUnitSelection( sheet ); // slow
for( LIB_PIN* pin = aEntry->GetNextPin(); pin; pin = aEntry->GetNextPin( pin ) )
{

View File

@ -93,7 +93,7 @@ bool NETLIST_EXPORTER_CADSTAR::WriteNetlist( const wxString& aOutFileName, unsig
footprint = wxT( "$noname" );
*/
msg = component->GetRef( sheet->Last() );
msg = component->GetRef( sheet );
ret |= fprintf( f, "%s ", TO_UTF8( StartCmpDesc ) );
ret |= fprintf( f, "%s", TO_UTF8( msg ) );
@ -159,8 +159,7 @@ bool NETLIST_EXPORTER_CADSTAR::writeListOfNets( FILE* f )
continue;
Cmp = nitem->GetComponentParent();
wxString refstr = Cmp->GetRef( nitem->m_SheetPath.Last() );
wxString refstr = Cmp->GetRef( &nitem->m_SheetPath );
if( refstr[0] == '#' )
continue; // Power supply symbols.

View File

@ -131,7 +131,7 @@ XNODE* NETLIST_EXPORTER_GENERIC::makeComponents()
// an element.
xcomps->AddChild( xcomp = node( sComponent ) );
xcomp->AddAttribute( sRef, comp->GetRef( path->Last() ) );
xcomp->AddAttribute( sRef, comp->GetRef( path ) );
xcomp->AddChild( node( sValue, comp->GetField( VALUE )->GetText() ) );
@ -467,8 +467,7 @@ XNODE* NETLIST_EXPORTER_GENERIC::makeListOfNets()
comp = nitem->GetComponentParent();
// Get the reference for the net name and the main parent component
ref = comp->GetRef( nitem->m_SheetPath.Last() );
ref = comp->GetRef( &nitem->m_SheetPath );
if( ref[0] == wxChar( '#' ) )
continue;
@ -530,8 +529,7 @@ bool NETLIST_EXPORTER_GENERIC::writeListOfNets( FILE* f, NETLIST_OBJECT_LIST& aO
comp = nitem->GetComponentParent();
// Get the reference for the net name and the main parent component
ref = comp->GetRef( nitem->m_SheetPath.Last() );
ref = comp->GetRef( &nitem->m_SheetPath );
if( ref[0] == wxChar( '#' ) )
continue; // Pseudo component (Like Power symbol)

View File

@ -99,7 +99,7 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName, uns
else
footprint = wxT( "$noname" );
field = comp->GetRef( path->Last() );
field = comp->GetRef( path );
ret |= fprintf( f, " ( %s %s",
TO_UTF8( comp->GetPath( path->Last() ) ),

View File

@ -235,7 +235,7 @@ bool NETLIST_EXPORTER_PSPICE::WriteNetlist( const wxString& aOutFileName, unsign
}
//Get Standard Reference Designator:
wxString RefName = comp->GetRef( sheet->Last() );
wxString RefName = comp->GetRef( sheet );
//Conditionally add Prefix only for devices that begin with U or IC:
if( aUsePrefix )

View File

@ -30,7 +30,6 @@
#include <class_sch_screen.h>
#include <schframe.h>
#include <sch_sheet_path.h>
#include <sch_sheet.h>
#include <project.h>
#include <dialog_plot_schematic.h>
@ -68,7 +67,7 @@ void DIALOG_PLOT_SCHEMATIC::CreateDXFFile( bool aPlotAll, bool aPlotFrameRef )
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{
schframe->SetCurrentSheet( list );
schframe->GetCurrentSheet().Last()->UpdateAllScreenReferences();
schframe->GetCurrentSheet().UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount();
screen = schframe->GetCurrentSheet().LastScreen();
}
@ -106,7 +105,7 @@ void DIALOG_PLOT_SCHEMATIC::CreateDXFFile( bool aPlotAll, bool aPlotFrameRef )
msg.Printf( wxT( "DXF Plotter exception: %s"), GetChars( e.errorText ) );
reporter.Report( msg, REPORTER::RPT_ERROR );
schframe->SetCurrentSheet( oldsheetpath );
schframe->GetCurrentSheet().Last()->UpdateAllScreenReferences();
schframe->GetCurrentSheet().UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount();
return;
}
@ -117,7 +116,7 @@ void DIALOG_PLOT_SCHEMATIC::CreateDXFFile( bool aPlotAll, bool aPlotFrameRef )
}
schframe->SetCurrentSheet( oldsheetpath );
schframe->GetCurrentSheet().Last()->UpdateAllScreenReferences();
schframe->GetCurrentSheet().UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount();
}
@ -126,7 +125,7 @@ bool DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF( const wxString& aFileName,
SCH_SCREEN* aScreen,
wxPoint aPlotOffset,
double aScale,
bool aPlotFrameRef )
bool aPlotFrameRef )
{
DXF_PLOTTER* plotter = new DXF_PLOTTER();

View File

@ -30,7 +30,6 @@
#include <class_sch_screen.h>
#include <schframe.h>
#include <base_units.h>
#include <sch_sheet.h>
#include <sch_sheet_path.h>
#include <project.h>
@ -141,7 +140,7 @@ void DIALOG_PLOT_SCHEMATIC::createHPGLFile( bool aPlotAll, bool aPlotFrameRef )
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{
m_parent->SetCurrentSheet( list );
m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences();
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
screen = m_parent->GetCurrentSheet().LastScreen();
@ -209,7 +208,7 @@ void DIALOG_PLOT_SCHEMATIC::createHPGLFile( bool aPlotAll, bool aPlotFrameRef )
}
m_parent->SetCurrentSheet( oldsheetpath );
m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences();
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
}

View File

@ -28,7 +28,6 @@
#include <fctsys.h>
#include <plot_common.h>
#include <class_sch_screen.h>
#include <sch_sheet.h>
#include <schframe.h>
#include <base_units.h>
#include <sch_sheet_path.h>
@ -78,7 +77,7 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef )
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{
m_parent->SetCurrentSheet( list );
m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences();
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
screen = m_parent->GetCurrentSheet().LastScreen();
}
@ -155,7 +154,7 @@ void DIALOG_PLOT_SCHEMATIC::restoreEnvironment( PDF_PLOTTER* aPlotter,
// Restore the previous sheet
m_parent->SetCurrentSheet( aOldsheetpath );
m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences();
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
}

View File

@ -29,7 +29,6 @@
#include <class_sch_screen.h>
#include <schframe.h>
#include <base_units.h>
#include <sch_sheet.h>
#include <sch_sheet_path.h>
#include <project.h>
#include <reporter.h>
@ -68,7 +67,7 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef )
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{
m_parent->SetCurrentSheet( list );
m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences();
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
screen = m_parent->GetCurrentSheet().LastScreen();
}
@ -142,7 +141,7 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef )
}
m_parent->SetCurrentSheet( oldsheetpath );
m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences();
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
}

View File

@ -34,7 +34,6 @@
#include <schframe.h>
#include <base_units.h>
#include <libeditframe.h>
#include <sch_sheet.h>
#include <sch_sheet_path.h>
#include <project.h>
#include <reporter.h>
@ -68,7 +67,7 @@ void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef )
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{
m_parent->SetCurrentSheet( list );
m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences();
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
screen = m_parent->GetCurrentSheet().LastScreen();
}
@ -110,14 +109,14 @@ void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef )
reporter.Report( msg, REPORTER::RPT_ERROR );
m_parent->SetCurrentSheet( oldsheetpath );
m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences();
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
return;
}
}
m_parent->SetCurrentSheet( oldsheetpath );
m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences();
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
}
else // Print current sheet

View File

@ -444,9 +444,9 @@ wxString SCH_COMPONENT::GetPath( const SCH_SHEET* aSheet ) const
}
const wxString SCH_COMPONENT::GetRef( const SCH_SHEET* aSheet )
const wxString SCH_COMPONENT::GetRef( const SCH_SHEET_PATH* sheet )
{
wxString path = GetPath( aSheet );
wxString path = GetPath( sheet->Last() );
wxString h_path, h_ref;
wxStringTokenizer tokenizer;
wxString separators( wxT( " " ) );
@ -473,7 +473,7 @@ const wxString SCH_COMPONENT::GetRef( const SCH_SHEET* aSheet )
// all have the same component references, but perhaps this is best.
if( !GetField( REFERENCE )->GetText().IsEmpty() )
{
SetRef( aSheet, GetField( REFERENCE )->GetText() );
SetRef( sheet->Last(), GetField( REFERENCE )->GetText() );
return GetField( REFERENCE )->GetText();
}
@ -481,6 +481,12 @@ const wxString SCH_COMPONENT::GetRef( const SCH_SHEET* aSheet )
}
/* Function IsReferenceStringValid (static function)
* Tests for an acceptable reference string
* An acceptable reference string must support unannotation
* i.e starts by letter
* returns true if OK
*/
bool SCH_COMPONENT::IsReferenceStringValid( const wxString& aReferenceString )
{
wxString text = aReferenceString;
@ -578,9 +584,9 @@ void SCH_COMPONENT::SetTimeStamp( time_t aNewTimeStamp )
}
int SCH_COMPONENT::GetUnitSelection( SCH_SHEET* aSheet )
int SCH_COMPONENT::GetUnitSelection( SCH_SHEET_PATH* aSheet )
{
wxString path = GetPath( aSheet );
wxString path = GetPath( aSheet->Last() );
wxString h_path, h_multi;
wxStringTokenizer tokenizer;
wxString separators( wxT( " " ) );
@ -1530,7 +1536,7 @@ void SCH_COMPONENT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
if( m_currentSheetPath )
aList.push_back( MSG_PANEL_ITEM( _( "Reference" ),
GetRef( m_currentSheetPath->Last() ),
GetRef( m_currentSheetPath ),
DARKCYAN ) );
wxString msg = part->IsPower() ? _( "Power symbol" ) : _( "Value" );
@ -1880,7 +1886,7 @@ void SCH_COMPONENT::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
{
wxASSERT( pin->Type() == LIB_PIN_T );
if( pin->GetUnit() && ( pin->GetUnit() != GetUnitSelection( aSheetPath->Last() ) ) )
if( pin->GetUnit() && ( pin->GetUnit() != GetUnitSelection( aSheetPath ) ) )
continue;
if( pin->GetConvert() && ( pin->GetConvert() != GetConvert() ) )

View File

@ -413,7 +413,7 @@ public:
* Function GetRef
* returns the reference, for the given sheet path.
*/
const wxString GetRef( const SCH_SHEET* sheet );
const wxString GetRef( const SCH_SHEET_PATH* sheet );
/**
* Set the reference, for the given sheet path.
@ -433,7 +433,7 @@ public:
int aMulti );
// returns the unit selection, for the given sheet path.
int GetUnitSelection( SCH_SHEET* aSheet );
int GetUnitSelection( SCH_SHEET_PATH* aSheet );
// Set the unit selection, for the given sheet path.
void SetUnitSelection( SCH_SHEET_PATH* aSheet, int aUnitSelection );

View File

@ -402,7 +402,7 @@ bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint
wxCHECK_MSG( component != NULL, false,
wxT( "No component associated with field" ) + text );
text = component->GetRef( ((SCH_SHEET_PATH*) aAuxData)->Last() );
text = component->GetRef( (SCH_SHEET_PATH*) aAuxData );
if( component->GetUnitCount() > 1 )
text << LIB_PART::SubReference( component->GetUnit() );
@ -440,7 +440,7 @@ bool SCH_FIELD::Replace( wxFindReplaceData& aSearchData, void* aAuxData )
wxCHECK_MSG( component != NULL, false,
wxT( "No component associated with field" ) + text );
text = component->GetRef( ((SCH_SHEET_PATH*) aAuxData)->Last() );
text = component->GetRef( (SCH_SHEET_PATH*) aAuxData );
// if( component->GetUnitCount() > 1 )
// text << LIB_PART::SubReference( component->GetUnit() );

View File

@ -1116,7 +1116,7 @@ bool SCH_SCREEN::SetComponentFootprint( SCH_SHEET_PATH* aSheetPath, const wxStri
component = (SCH_COMPONENT*) item;
if( aReference.CmpNoCase( component->GetRef( aSheetPath->Last() ) ) == 0 )
if( aReference.CmpNoCase( component->GetRef( aSheetPath ) ) == 0 )
{
// Found: Init Footprint Field

View File

@ -1332,24 +1332,6 @@ void SCH_SHEET::AnnotatePowerSymbols( PART_LIBS* aLibs, int* aReference )
}
void SCH_SHEET::UpdateAllScreenReferences()
{
EDA_ITEM* t = m_screen->GetDrawItems();
while( t )
{
if( t->Type() == SCH_COMPONENT_T )
{
SCH_COMPONENT* component = (SCH_COMPONENT*) t;
component->GetField( REFERENCE )->SetText( component->GetRef( this ) );
component->UpdateUnit( component->GetUnitSelection( this ) );
}
t = t->Next();
}
}
SCH_ITEM& SCH_SHEET::operator=( const SCH_ITEM& aItem )
{
wxLogDebug( wxT( "Sheet assignment operator." ) );

View File

@ -668,17 +668,6 @@ public:
*/
void AnnotatePowerSymbols( PART_LIBS* aLibs, int* aReference );
/**
* Function UpdateAllScreenReferences
* updates the reference and the m_Multi parameter (part selection) for all
* components on a screen depending on the actual sheet.
* Mandatory in complex hierarchies because sheets use the same screen
* (basic schematic)
* but with different references and part selections according to the
* displayed sheet
*/
void UpdateAllScreenReferences();
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // override
#endif

View File

@ -227,6 +227,24 @@ wxString SCH_SHEET_PATH::PathHumanReadable() const
}
void SCH_SHEET_PATH::UpdateAllScreenReferences()
{
EDA_ITEM* t = LastDrawList();
while( t )
{
if( t->Type() == SCH_COMPONENT_T )
{
SCH_COMPONENT* component = (SCH_COMPONENT*) t;
component->GetField( REFERENCE )->SetText( component->GetRef( this ) );
component->UpdateUnit( component->GetUnitSelection( this ) );
}
t = t->Next();
}
}
void SCH_SHEET_PATH::GetComponents( PART_LIBS* aLibs, SCH_REFERENCE_LIST& aReferences, bool aIncludePowerSymbols )
{
// Search to sheet path number:
@ -248,7 +266,7 @@ void SCH_SHEET_PATH::GetComponents( PART_LIBS* aLibs, SCH_REFERENCE_LIST& aRefer
// Skip pseudo components, which have a reference starting with #. This mainly
// affects power symbols.
if( !aIncludePowerSymbols && component->GetRef( Last() )[0] == wxT( '#' ) )
if( !aIncludePowerSymbols && component->GetRef( this )[0] == wxT( '#' ) )
continue;
LIB_PART* part = aLibs->FindLibPart( component->GetPartName() );
@ -283,7 +301,7 @@ void SCH_SHEET_PATH::GetMultiUnitComponents( PART_LIBS* aLibs, SCH_MULTI_UNIT_RE
// Skip pseudo components, which have a reference starting with #. This mainly
// affects power symbols.
if( !aIncludePowerSymbols && component->GetRef( Last() )[0] == wxT( '#' ) )
if( !aIncludePowerSymbols && component->GetRef( this )[0] == wxT( '#' ) )
continue;
LIB_PART* part = aLibs->FindLibPart( component->GetPartName() );

View File

@ -215,6 +215,17 @@ public:
*/
bool BuildSheetPathInfoFromSheetPathValue( const wxString& aPath, bool aFound = false );
/**
* Function UpdateAllScreenReferences
* updates the reference and the m_Multi parameter (part selection) for all
* components on a screen depending on the actual sheet path.
* Mandatory in complex hierarchies because sheets use the same screen
* (basic schematic)
* but with different references and part selections according to the
* displayed sheet
*/
void UpdateAllScreenReferences();
/**
* Function GetComponents
* adds a SCH_REFERENCE() object to \a aReferences for each component in the sheet.