diff --git a/eeschema/annotate.cpp b/eeschema/annotate.cpp index d0bae72a91..34f59047e5 100644 --- a/eeschema/annotate.cpp +++ b/eeschema/annotate.cpp @@ -50,7 +50,7 @@ void SCH_EDIT_FRAME::DeleteAnnotation( bool aCurrentSheetOnly ) } // Update the references for the sheet that is currently being displayed. - m_CurrentSheet->UpdateAllScreenReferences(); + m_CurrentSheet->Last()->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->UpdateAllScreenReferences(); + m_CurrentSheet->Last()->UpdateAllScreenReferences(); SetSheetNumberAndCount(); m_canvas->Refresh( true ); diff --git a/eeschema/class_netlist_object.cpp b/eeschema/class_netlist_object.cpp index 5d7ca6b41d..1f53224fc9 100644 --- a/eeschema/class_netlist_object.cpp +++ b/eeschema/class_netlist_object.cpp @@ -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 ); + netName << link->GetRef( m_netNameCandidate->m_SheetPath.Last() ); netName << wxT("-Pad") << LIB_PIN::PinStringNum( m_netNameCandidate->m_PinNum ) << wxT(")"); diff --git a/eeschema/component_references_lister.cpp b/eeschema/component_references_lister.cpp index 93ce5ab35e..f927d88cdd 100644 --- a/eeschema/component_references_lister.cpp +++ b/eeschema/component_references_lister.cpp @@ -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 - * Copyright (C) 1992-2011 Wayne Stambaugh - * Copyright (C) 1992-2011 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 1992-2015 Wayne Stambaugh + * Copyright (C) 1992-2015 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 ); + m_Unit = aComponent->GetUnitSelection( aSheetPath.Last() ); 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 ).IsEmpty() ) + if( aComponent->GetRef( aSheetPath.Last() ).IsEmpty() ) aComponent->SetRef( aSheetPath.Last(), wxT( "DefRef?" ) ); - SetRef( aComponent->GetRef( &aSheetPath ) ); + SetRef( aComponent->GetRef( aSheetPath.Last() ) ); m_NumRef = -1; diff --git a/eeschema/controle.cpp b/eeschema/controle.cpp index cfd7c6e8d9..99bd9ee755 100644 --- a/eeschema/controle.cpp +++ b/eeschema/controle.cpp @@ -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 ), + items.push_back( MSG_PANEL_ITEM( LibItem->GetRef( m_CurrentSheet->Last() ), LibItem->GetField( VALUE )->GetShownText(), DARKCYAN ) ); SetMsgPanel( items ); diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp index 6aaf17a358..25bd214d43 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp @@ -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() ) ); + m_FieldsBuf[REFERENCE].SetText( m_cmp->GetRef( m_parent->GetCurrentSheet().Last() ) ); for( unsigned i = 0; iLastScreen()->SetZoom( m_parent->GetScreen()->GetZoom() ); m_parent->SetCurrentSheet( *sheet ); - m_parent->GetCurrentSheet().UpdateAllScreenReferences(); + m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences(); } m_lastMarkerFound = marker; diff --git a/eeschema/dialogs/dialog_print_using_printer.cpp b/eeschema/dialogs/dialog_print_using_printer.cpp index 09257bda8c..c21b5bb152 100644 --- a/eeschema/dialogs/dialog_print_using_printer.cpp +++ b/eeschema/dialogs/dialog_print_using_printer.cpp @@ -327,7 +327,7 @@ bool SCH_PRINTOUT::OnPrintPage( int page ) if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) ) { m_parent->SetCurrentSheet( list ); - m_parent->GetCurrentSheet().UpdateAllScreenReferences(); + m_parent->GetCurrentSheet().Last()->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().UpdateAllScreenReferences(); + m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences(); m_parent->SetSheetNumberAndCount(); return true; diff --git a/eeschema/dialogs/dialog_rescue_each.cpp b/eeschema/dialogs/dialog_rescue_each.cpp index ac804ba2ea..fcc7f489fa 100644 --- a/eeschema/dialogs/dialog_rescue_each.cpp +++ b/eeschema/dialogs/dialog_rescue_each.cpp @@ -34,6 +34,8 @@ #include #include #include +#include + class DIALOG_RESCUE_EACH: public DIALOG_RESCUE_EACH_BASE { @@ -156,7 +158,7 @@ void DIALOG_RESCUE_EACH::PopulateInstanceList() SCH_FIELD* valueField = each_component->GetField( 1 ); data.clear(); - data.push_back( each_component->GetRef( & m_Parent->GetCurrentSheet() ) ); + data.push_back( each_component->GetRef( m_Parent->GetCurrentSheet().Last() ) ); data.push_back( valueField ? valueField->GetText() : wxT( "" ) ); m_ListOfInstances->AppendItem( data ); diff --git a/eeschema/erc.cpp b/eeschema/erc.cpp index 1105566086..750c012185 100644 --- a/eeschema/erc.cpp +++ b/eeschema/erc.cpp @@ -290,7 +290,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 ); + cmp_ref = aNetItemRef->GetComponentParent()->GetRef( aNetItemRef->m_SheetPath.Last() ); if( aNetItemTst == NULL ) { @@ -311,7 +311,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 ); + aNetItemRef->m_SheetPath.Last() ); msg.Printf( _( "Pin %s (%s) of component %s is not driven (Net %d)." ), GetChars( string_pinnum ), @@ -353,7 +353,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 ); + alt_cmp = aNetItemTst->GetComponentParent()->GetRef( aNetItemTst->m_SheetPath.Last() ); msg.Printf( _( "Pin %s (%s) of component %s is connected to " ), GetChars( string_pinnum ), @@ -426,9 +426,9 @@ void TestOthersItems( NETLIST_OBJECT_LIST* aList, continue; if( ( (SCH_COMPONENT*) aList->GetItem( aNetItemRef )-> - m_Link )->GetRef( &aList->GetItem( aNetItemRef )-> m_SheetPath ) != + m_Link )->GetRef( aList->GetItem( aNetItemRef )->m_SheetPath.Last() ) != ( (SCH_COMPONENT*) aList->GetItem( duplicate )->m_Link ) - ->GetRef( &aList->GetItem( duplicate )->m_SheetPath ) ) + ->GetRef( aList->GetItem( duplicate )->m_SheetPath.Last() ) ) continue; // Same component and same pin. Do dot create error for this pin diff --git a/eeschema/find.cpp b/eeschema/find.cpp index d3a29e7c81..f239ad5727 100644 --- a/eeschema/find.cpp +++ b/eeschema/find.cpp @@ -85,7 +85,7 @@ void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event ) { sheetFoundIn->LastScreen()->SetZoom( GetScreen()->GetZoom() ); *m_CurrentSheet = *sheetFoundIn; - m_CurrentSheet->UpdateAllScreenReferences(); + m_CurrentSheet->Last()->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 ) ) == 0 ) + if( aReference.CmpNoCase( pSch->GetRef( sheet->Last() ) ) == 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->UpdateAllScreenReferences(); + m_CurrentSheet->Last()->UpdateAllScreenReferences(); centerAndRedraw = true; } @@ -489,7 +489,7 @@ void SCH_EDIT_FRAME::updateFindReplaceView( wxFindDialogEvent& aEvent ) { sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() ); *m_CurrentSheet = *sheet; - m_CurrentSheet->UpdateAllScreenReferences(); + m_CurrentSheet->Last()->UpdateAllScreenReferences(); SetScreen( sheet->LastScreen() ); } diff --git a/eeschema/hierarch.cpp b/eeschema/hierarch.cpp index 578274b173..adbf2332c7 100644 --- a/eeschema/hierarch.cpp +++ b/eeschema/hierarch.cpp @@ -285,7 +285,7 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet() GetScreen()->SetGrid( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ); // update the References - m_CurrentSheet->UpdateAllScreenReferences(); + m_CurrentSheet->Last()->UpdateAllScreenReferences(); SetSheetNumberAndCount(); m_canvas->SetCanStartBlock( -1 ); diff --git a/eeschema/netlist_exporters/netlist_exporter.cpp b/eeschema/netlist_exporters/netlist_exporter.cpp index 62e39ccca8..4a7ebf4a32 100644 --- a/eeschema/netlist_exporters/netlist_exporter.cpp +++ b/eeschema/netlist_exporters/netlist_exporter.cpp @@ -115,7 +115,8 @@ 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 ); + ref = comp->GetRef( aSheetPath->Last() ); + if( ref[0] == wxChar( '#' ) ) continue; @@ -173,7 +174,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 ); + ref = comp->GetRef( aSheetPath->Last() ); if( ref[0] == wxChar( '#' ) ) continue; @@ -206,7 +207,7 @@ SCH_COMPONENT* NETLIST_EXPORTER::findNextComponentAndCreatePinList( EDA_ITEM* { LIB_PINS pins; // constructed once here - part->GetPins( pins, comp->GetUnitSelection( aSheetPath ), comp->GetConvert() ); + part->GetPins( pins, comp->GetUnitSelection( aSheetPath->Last() ), comp->GetConvert() ); for( size_t i = 0; i < pins.size(); i++ ) { @@ -322,10 +323,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 ); + wxString ref = aComponent->GetRef( aSheetPath->Last() ); wxString ref2; SCH_SHEET_LIST sheetList; @@ -339,11 +340,11 @@ void NETLIST_EXPORTER::findAllInstancesOfComponent( SCH_COMPONENT* aComponent, SCH_COMPONENT* comp2 = (SCH_COMPONENT*) item; - ref2 = comp2->GetRef( sheet ); + ref2 = comp2->GetRef( sheet->Last() ); if( ref2.CmpNoCase( ref ) != 0 ) continue; - int unit2 = comp2->GetUnitSelection( sheet ); // slow + int unit2 = comp2->GetUnitSelection( sheet->Last() ); // slow for( LIB_PIN* pin = aEntry->GetNextPin(); pin; pin = aEntry->GetNextPin( pin ) ) { diff --git a/eeschema/netlist_exporters/netlist_exporter_cadstar.cpp b/eeschema/netlist_exporters/netlist_exporter_cadstar.cpp index 2b5b7fbf45..9c94c7d394 100644 --- a/eeschema/netlist_exporters/netlist_exporter_cadstar.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_cadstar.cpp @@ -93,7 +93,7 @@ bool NETLIST_EXPORTER_CADSTAR::WriteNetlist( const wxString& aOutFileName, unsig footprint = wxT( "$noname" ); */ - msg = component->GetRef( sheet ); + msg = component->GetRef( sheet->Last() ); ret |= fprintf( f, "%s ", TO_UTF8( StartCmpDesc ) ); ret |= fprintf( f, "%s", TO_UTF8( msg ) ); @@ -159,7 +159,8 @@ bool NETLIST_EXPORTER_CADSTAR::writeListOfNets( FILE* f ) continue; Cmp = nitem->GetComponentParent(); - wxString refstr = Cmp->GetRef( &nitem->m_SheetPath ); + wxString refstr = Cmp->GetRef( nitem->m_SheetPath.Last() ); + if( refstr[0] == '#' ) continue; // Power supply symbols. diff --git a/eeschema/netlist_exporters/netlist_exporter_generic.cpp b/eeschema/netlist_exporters/netlist_exporter_generic.cpp index 921e0fc1e4..df55edcef6 100644 --- a/eeschema/netlist_exporters/netlist_exporter_generic.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_generic.cpp @@ -131,7 +131,7 @@ XNODE* NETLIST_EXPORTER_GENERIC::makeComponents() // an element. xcomps->AddChild( xcomp = node( sComponent ) ); - xcomp->AddAttribute( sRef, comp->GetRef( path ) ); + xcomp->AddAttribute( sRef, comp->GetRef( path->Last() ) ); xcomp->AddChild( node( sValue, comp->GetField( VALUE )->GetText() ) ); @@ -467,7 +467,8 @@ 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 ); + ref = comp->GetRef( nitem->m_SheetPath.Last() ); + if( ref[0] == wxChar( '#' ) ) continue; @@ -529,7 +530,8 @@ 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 ); + ref = comp->GetRef( nitem->m_SheetPath.Last() ); + if( ref[0] == wxChar( '#' ) ) continue; // Pseudo component (Like Power symbol) diff --git a/eeschema/netlist_exporters/netlist_exporter_orcadpcb2.cpp b/eeschema/netlist_exporters/netlist_exporter_orcadpcb2.cpp index b0c8f6a286..b5f481b3ba 100644 --- a/eeschema/netlist_exporters/netlist_exporter_orcadpcb2.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_orcadpcb2.cpp @@ -99,7 +99,7 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName, uns else footprint = wxT( "$noname" ); - field = comp->GetRef( path ); + field = comp->GetRef( path->Last() ); ret |= fprintf( f, " ( %s %s", TO_UTF8( comp->GetPath( path->Last() ) ), diff --git a/eeschema/netlist_exporters/netlist_exporter_pspice.cpp b/eeschema/netlist_exporters/netlist_exporter_pspice.cpp index 7158bd4d5e..90746556b0 100644 --- a/eeschema/netlist_exporters/netlist_exporter_pspice.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_pspice.cpp @@ -235,7 +235,7 @@ bool NETLIST_EXPORTER_PSPICE::WriteNetlist( const wxString& aOutFileName, unsign } //Get Standard Reference Designator: - wxString RefName = comp->GetRef( sheet ); + wxString RefName = comp->GetRef( sheet->Last() ); //Conditionally add Prefix only for devices that begin with U or IC: if( aUsePrefix ) diff --git a/eeschema/plot_schematic_DXF.cpp b/eeschema/plot_schematic_DXF.cpp index a571c73baa..887aa36886 100644 --- a/eeschema/plot_schematic_DXF.cpp +++ b/eeschema/plot_schematic_DXF.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -67,7 +68,7 @@ void DIALOG_PLOT_SCHEMATIC::CreateDXFFile( bool aPlotAll, bool aPlotFrameRef ) if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) ) { schframe->SetCurrentSheet( list ); - schframe->GetCurrentSheet().UpdateAllScreenReferences(); + schframe->GetCurrentSheet().Last()->UpdateAllScreenReferences(); schframe->SetSheetNumberAndCount(); screen = schframe->GetCurrentSheet().LastScreen(); } @@ -105,7 +106,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().UpdateAllScreenReferences(); + schframe->GetCurrentSheet().Last()->UpdateAllScreenReferences(); schframe->SetSheetNumberAndCount(); return; } @@ -116,7 +117,7 @@ void DIALOG_PLOT_SCHEMATIC::CreateDXFFile( bool aPlotAll, bool aPlotFrameRef ) } schframe->SetCurrentSheet( oldsheetpath ); - schframe->GetCurrentSheet().UpdateAllScreenReferences(); + schframe->GetCurrentSheet().Last()->UpdateAllScreenReferences(); schframe->SetSheetNumberAndCount(); } @@ -125,7 +126,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(); diff --git a/eeschema/plot_schematic_HPGL.cpp b/eeschema/plot_schematic_HPGL.cpp index 9b64ab021f..ca69560e85 100644 --- a/eeschema/plot_schematic_HPGL.cpp +++ b/eeschema/plot_schematic_HPGL.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -140,7 +141,7 @@ void DIALOG_PLOT_SCHEMATIC::createHPGLFile( bool aPlotAll, bool aPlotFrameRef ) if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) ) { m_parent->SetCurrentSheet( list ); - m_parent->GetCurrentSheet().UpdateAllScreenReferences(); + m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences(); m_parent->SetSheetNumberAndCount(); screen = m_parent->GetCurrentSheet().LastScreen(); @@ -208,7 +209,7 @@ void DIALOG_PLOT_SCHEMATIC::createHPGLFile( bool aPlotAll, bool aPlotFrameRef ) } m_parent->SetCurrentSheet( oldsheetpath ); - m_parent->GetCurrentSheet().UpdateAllScreenReferences(); + m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences(); m_parent->SetSheetNumberAndCount(); } diff --git a/eeschema/plot_schematic_PDF.cpp b/eeschema/plot_schematic_PDF.cpp index 900e1fb625..a72c7d3355 100644 --- a/eeschema/plot_schematic_PDF.cpp +++ b/eeschema/plot_schematic_PDF.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -77,7 +78,7 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef ) if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) ) { m_parent->SetCurrentSheet( list ); - m_parent->GetCurrentSheet().UpdateAllScreenReferences(); + m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences(); m_parent->SetSheetNumberAndCount(); screen = m_parent->GetCurrentSheet().LastScreen(); } @@ -154,7 +155,7 @@ void DIALOG_PLOT_SCHEMATIC::restoreEnvironment( PDF_PLOTTER* aPlotter, // Restore the previous sheet m_parent->SetCurrentSheet( aOldsheetpath ); - m_parent->GetCurrentSheet().UpdateAllScreenReferences(); + m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences(); m_parent->SetSheetNumberAndCount(); } diff --git a/eeschema/plot_schematic_PS.cpp b/eeschema/plot_schematic_PS.cpp index 0c42e53b91..fc1dac9d5e 100644 --- a/eeschema/plot_schematic_PS.cpp +++ b/eeschema/plot_schematic_PS.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -67,7 +68,7 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef ) if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) ) { m_parent->SetCurrentSheet( list ); - m_parent->GetCurrentSheet().UpdateAllScreenReferences(); + m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences(); m_parent->SetSheetNumberAndCount(); screen = m_parent->GetCurrentSheet().LastScreen(); } @@ -141,7 +142,7 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef ) } m_parent->SetCurrentSheet( oldsheetpath ); - m_parent->GetCurrentSheet().UpdateAllScreenReferences(); + m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences(); m_parent->SetSheetNumberAndCount(); } diff --git a/eeschema/plot_schematic_SVG.cpp b/eeschema/plot_schematic_SVG.cpp index 0cc81ed854..6213d34e09 100644 --- a/eeschema/plot_schematic_SVG.cpp +++ b/eeschema/plot_schematic_SVG.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -67,7 +68,7 @@ void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef ) if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) ) { m_parent->SetCurrentSheet( list ); - m_parent->GetCurrentSheet().UpdateAllScreenReferences(); + m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences(); m_parent->SetSheetNumberAndCount(); screen = m_parent->GetCurrentSheet().LastScreen(); } @@ -109,14 +110,14 @@ void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef ) reporter.Report( msg, REPORTER::RPT_ERROR ); m_parent->SetCurrentSheet( oldsheetpath ); - m_parent->GetCurrentSheet().UpdateAllScreenReferences(); + m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences(); m_parent->SetSheetNumberAndCount(); return; } } m_parent->SetCurrentSheet( oldsheetpath ); - m_parent->GetCurrentSheet().UpdateAllScreenReferences(); + m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences(); m_parent->SetSheetNumberAndCount(); } else // Print current sheet diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index 4dec42ad63..6d49c68530 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -442,9 +442,9 @@ wxString SCH_COMPONENT::GetPath( const SCH_SHEET* aSheet ) const } -const wxString SCH_COMPONENT::GetRef( const SCH_SHEET_PATH* sheet ) +const wxString SCH_COMPONENT::GetRef( const SCH_SHEET* aSheet ) { - wxString path = GetPath( sheet->Last() ); + wxString path = GetPath( aSheet ); wxString h_path, h_ref; wxStringTokenizer tokenizer; wxString separators( wxT( " " ) ); @@ -471,7 +471,7 @@ const wxString SCH_COMPONENT::GetRef( const SCH_SHEET_PATH* sheet ) // all have the same component references, but perhaps this is best. if( !GetField( REFERENCE )->GetText().IsEmpty() ) { - SetRef( sheet->Last(), GetField( REFERENCE )->GetText() ); + SetRef( aSheet, GetField( REFERENCE )->GetText() ); return GetField( REFERENCE )->GetText(); } @@ -479,12 +479,6 @@ const wxString SCH_COMPONENT::GetRef( const SCH_SHEET_PATH* sheet ) } -/* 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; @@ -582,9 +576,9 @@ void SCH_COMPONENT::SetTimeStamp( time_t aNewTimeStamp ) } -int SCH_COMPONENT::GetUnitSelection( SCH_SHEET_PATH* aSheet ) +int SCH_COMPONENT::GetUnitSelection( SCH_SHEET* aSheet ) { - wxString path = GetPath( aSheet->Last() ); + wxString path = GetPath( aSheet ); wxString h_path, h_multi; wxStringTokenizer tokenizer; wxString separators( wxT( " " ) ); @@ -1534,7 +1528,7 @@ void SCH_COMPONENT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) if( m_currentSheetPath ) aList.push_back( MSG_PANEL_ITEM( _( "Reference" ), - GetRef( m_currentSheetPath ), + GetRef( m_currentSheetPath->Last() ), DARKCYAN ) ); wxString msg = part->IsPower() ? _( "Power symbol" ) : _( "Value" ); @@ -1884,7 +1878,7 @@ void SCH_COMPONENT::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems, { wxASSERT( pin->Type() == LIB_PIN_T ); - if( pin->GetUnit() && ( pin->GetUnit() != GetUnitSelection( aSheetPath ) ) ) + if( pin->GetUnit() && ( pin->GetUnit() != GetUnitSelection( aSheetPath->Last() ) ) ) continue; if( pin->GetConvert() && ( pin->GetConvert() != GetConvert() ) ) diff --git a/eeschema/sch_component.h b/eeschema/sch_component.h index faa9f46535..4c780402ba 100644 --- a/eeschema/sch_component.h +++ b/eeschema/sch_component.h @@ -413,7 +413,7 @@ public: * Function GetRef * returns the reference, for the given sheet path. */ - const wxString GetRef( const SCH_SHEET_PATH* sheet ); + const wxString GetRef( const SCH_SHEET* 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_PATH* aSheet ); + int GetUnitSelection( SCH_SHEET* aSheet ); // Set the unit selection, for the given sheet path. void SetUnitSelection( SCH_SHEET_PATH* aSheet, int aUnitSelection ); diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index 550d91de9c..63f5bbd6e6 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -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 ); + text = component->GetRef( ((SCH_SHEET_PATH*) aAuxData)->Last() ); 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 ); + text = component->GetRef( ((SCH_SHEET_PATH*) aAuxData)->Last() ); // if( component->GetUnitCount() > 1 ) // text << LIB_PART::SubReference( component->GetUnit() ); diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index 95f9d94010..1a24d4a24e 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -1116,7 +1116,7 @@ bool SCH_SCREEN::SetComponentFootprint( SCH_SHEET_PATH* aSheetPath, const wxStri component = (SCH_COMPONENT*) item; - if( aReference.CmpNoCase( component->GetRef( aSheetPath ) ) == 0 ) + if( aReference.CmpNoCase( component->GetRef( aSheetPath->Last() ) ) == 0 ) { // Found: Init Footprint Field diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index e60adf26fe..b593882b82 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -1332,6 +1332,24 @@ 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." ) ); diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h index 30114adb31..2787f12f95 100644 --- a/eeschema/sch_sheet.h +++ b/eeschema/sch_sheet.h @@ -668,6 +668,17 @@ 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 diff --git a/eeschema/sch_sheet_path.cpp b/eeschema/sch_sheet_path.cpp index e829924152..a731ca4b88 100644 --- a/eeschema/sch_sheet_path.cpp +++ b/eeschema/sch_sheet_path.cpp @@ -227,24 +227,6 @@ 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: @@ -266,7 +248,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( this )[0] == wxT( '#' ) ) + if( !aIncludePowerSymbols && component->GetRef( Last() )[0] == wxT( '#' ) ) continue; LIB_PART* part = aLibs->FindLibPart( component->GetPartName() ); @@ -301,7 +283,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( this )[0] == wxT( '#' ) ) + if( !aIncludePowerSymbols && component->GetRef( Last() )[0] == wxT( '#' ) ) continue; LIB_PART* part = aLibs->FindLibPart( component->GetPartName() ); diff --git a/eeschema/sch_sheet_path.h b/eeschema/sch_sheet_path.h index 0c542086b3..e535b307aa 100644 --- a/eeschema/sch_sheet_path.h +++ b/eeschema/sch_sheet_path.h @@ -215,17 +215,6 @@ 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.