Remove schematic symbol value and footprint field instance data.
https://gitlab.com/kicad/code/kicad/-/issues/12933
This commit is contained in:
parent
7d207c5d2f
commit
0a62c17040
|
@ -376,7 +376,7 @@ void SCH_EDIT_FRAME::AnnotateSymbols( ANNOTATE_SCOPE_T aAnnotateScope,
|
|||
if( symbol->GetUnitCount() > 1 )
|
||||
{
|
||||
msg.Printf( _( "Updated %s (unit %s) from %s to %s." ),
|
||||
symbol->GetValue( sheet, true ),
|
||||
symbol->GetValueFieldText( true ),
|
||||
LIB_SYMBOL::SubReference( symbol->GetUnit(), false ),
|
||||
prevRef,
|
||||
newRef );
|
||||
|
@ -384,7 +384,7 @@ void SCH_EDIT_FRAME::AnnotateSymbols( ANNOTATE_SCOPE_T aAnnotateScope,
|
|||
else
|
||||
{
|
||||
msg.Printf( _( "Updated %s from %s to %s." ),
|
||||
symbol->GetValue( sheet, true ),
|
||||
symbol->GetValueFieldText( true ),
|
||||
prevRef,
|
||||
newRef );
|
||||
}
|
||||
|
@ -394,14 +394,14 @@ void SCH_EDIT_FRAME::AnnotateSymbols( ANNOTATE_SCOPE_T aAnnotateScope,
|
|||
if( symbol->GetUnitCount() > 1 )
|
||||
{
|
||||
msg.Printf( _( "Annotated %s (unit %s) as %s." ),
|
||||
symbol->GetValue( sheet, true ),
|
||||
symbol->GetValueFieldText( true ),
|
||||
LIB_SYMBOL::SubReference( symbol->GetUnit(), false ),
|
||||
newRef );
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.Printf( _( "Annotated %s as %s." ),
|
||||
symbol->GetValue( sheet, true ),
|
||||
symbol->GetValueFieldText( true ),
|
||||
newRef );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -316,8 +316,6 @@ std::vector<SYMBOL_INSTANCE_REFERENCE> SCH_REFERENCE_LIST::GetSymbolInstances()
|
|||
instance.m_Path = ref.GetSheetPath().Path();
|
||||
instance.m_Reference = ref.GetRef();
|
||||
instance.m_Unit = ref.GetUnit();
|
||||
instance.m_Value = ref.GetValue();
|
||||
instance.m_Footprint = ref.GetFootprint();
|
||||
|
||||
retval.push_back( instance );
|
||||
}
|
||||
|
@ -818,7 +816,7 @@ SCH_REFERENCE::SCH_REFERENCE( SCH_SYMBOL* aSymbol, LIB_SYMBOL* aLibSymbol,
|
|||
m_libPart = aLibSymbol; // Warning: can be nullptr for orphan symbols
|
||||
// (i.e. with a symbol library not found)
|
||||
m_unit = aSymbol->GetUnitSelection( &aSheetPath );
|
||||
m_footprint = aSymbol->GetFootprint( &aSheetPath, true );
|
||||
m_footprint = aSymbol->GetFootprintFieldText( true );
|
||||
m_sheetPath = aSheetPath;
|
||||
m_isNew = false;
|
||||
m_flag = 0;
|
||||
|
@ -834,10 +832,10 @@ SCH_REFERENCE::SCH_REFERENCE( SCH_SYMBOL* aSymbol, LIB_SYMBOL* aLibSymbol,
|
|||
|
||||
m_numRef = -1;
|
||||
|
||||
if( aSymbol->GetValue( &aSheetPath, false ).IsEmpty() )
|
||||
aSymbol->SetValue( &aSheetPath, wxT( "~" ) );
|
||||
if( aSymbol->GetValueFieldText( false ).IsEmpty() )
|
||||
aSymbol->SetValueFieldText( wxT( "~" ) );
|
||||
|
||||
m_value = aSymbol->GetValue( &aSheetPath, false );
|
||||
m_value = aSymbol->GetValueFieldText( false );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS( SCH_EDIT_FRAME* aParent, SCH_SYMBO
|
|||
|
||||
m_newId->ChangeValue( UnescapeString( m_symbol->GetLibId().Format() ) );
|
||||
m_specifiedReference->ChangeValue( m_symbol->GetRef( currentSheet ) );
|
||||
m_specifiedValue->ChangeValue( m_symbol->GetValue( currentSheet, false ) );
|
||||
m_specifiedValue->ChangeValue( m_symbol->GetValueFieldText( false ) );
|
||||
m_specifiedId->ChangeValue( UnescapeString( m_symbol->GetLibId().Format() ) );
|
||||
}
|
||||
else
|
||||
|
@ -433,7 +433,7 @@ bool DIALOG_CHANGE_SYMBOLS::isMatch( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aInsta
|
|||
else if( m_matchByValue->GetValue() )
|
||||
{
|
||||
return WildCompareString( m_specifiedValue->GetValue(),
|
||||
aSymbol->GetValue( aInstance, false ), false );
|
||||
aSymbol->GetValueFieldText( false ), false );
|
||||
}
|
||||
else if( m_matchById )
|
||||
{
|
||||
|
@ -624,9 +624,9 @@ bool DIALOG_CHANGE_SYMBOLS::processSymbol( SCH_SYMBOL* aSymbol, const SCH_SHEET_
|
|||
if( i == REFERENCE_FIELD )
|
||||
aSymbol->SetRef( aInstance, UTIL::GetRefDesUnannotated( libField->GetText() ) );
|
||||
else if( i == VALUE_FIELD )
|
||||
aSymbol->SetValue( aInstance, UnescapeString( libField->GetText() ) );
|
||||
aSymbol->SetValueFieldText( UnescapeString( libField->GetText() ) );
|
||||
else if( i == FOOTPRINT_FIELD )
|
||||
aSymbol->SetFootprint( aInstance, libField->GetText() );
|
||||
aSymbol->SetFootprintFieldText( libField->GetText() );
|
||||
else
|
||||
field.SetText( libField->GetText() );
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright 2017 Jean-Pierre Charras, jp.charras@wanadoo.fr
|
||||
* Copyright 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright 1992-2022 KiCad Developers, see AUTHORS.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
|
||||
|
@ -762,7 +762,7 @@ bool DIALOG_EDIT_SYMBOLS_LIBID::TransferDataFromWindow()
|
|||
|
||||
// If value is a proxy for the itemName then make sure it gets updated
|
||||
if( getName( candidate.m_Symbol->GetLibId() ) == value->GetText() )
|
||||
candidate.m_Symbol->SetValue( getName( id ) );
|
||||
candidate.m_Symbol->SetValueFieldText( getName( id ) );
|
||||
|
||||
candidate.m_Symbol->SetLibId( id );
|
||||
candidate.m_Symbol->SetLibSymbol( symbol->Flatten().release() );
|
||||
|
|
|
@ -663,9 +663,9 @@ void DIALOG_SCH_FIELD_PROPERTIES::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH
|
|||
if( fieldType == REFERENCE_FIELD )
|
||||
symbol->SetRef( aSheetPath, m_text );
|
||||
else if( fieldType == VALUE_FIELD )
|
||||
symbol->SetValue( aSheetPath, m_text );
|
||||
symbol->SetValueFieldText( m_text );
|
||||
else if( fieldType == FOOTPRINT_FIELD )
|
||||
symbol->SetFootprint( aSheetPath, m_text );
|
||||
symbol->SetFootprintFieldText( m_text );
|
||||
}
|
||||
else if( parent && parent->Type() == SCH_GLOBAL_LABEL_T )
|
||||
{
|
||||
|
@ -746,9 +746,9 @@ void DIALOG_SCH_FIELD_PROPERTIES::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH
|
|||
appendUndo );
|
||||
|
||||
if( fieldType == VALUE_FIELD )
|
||||
otherUnit->SetValue( m_text );
|
||||
otherUnit->SetValueFieldText( m_text );
|
||||
else if( fieldType == FOOTPRINT_FIELD )
|
||||
otherUnit->SetFootprint( m_text );
|
||||
otherUnit->SetFootprintFieldText( m_text );
|
||||
else
|
||||
otherUnit->GetField( DATASHEET_FIELD )->SetText( m_text );
|
||||
|
||||
|
|
|
@ -220,9 +220,9 @@ public:
|
|||
wxString val = symbol->GetFieldText( aFieldName );
|
||||
|
||||
if( aFieldName == wxT( "Value" ) )
|
||||
val = symbol->GetInstanceReferences()[0].m_Value;
|
||||
val = symbol->GetValueFieldText( true );
|
||||
else if( aFieldName == wxT( "Footprint" ) )
|
||||
val = symbol->GetInstanceReferences()[0].m_Footprint;
|
||||
val = symbol->GetFootprintFieldText( true );
|
||||
|
||||
m_dataStore[ symbol->m_Uuid ][ aFieldName ] = val;
|
||||
}
|
||||
|
@ -694,11 +694,11 @@ public:
|
|||
{
|
||||
// Value field cannot be empty
|
||||
if( !srcValue.IsEmpty() )
|
||||
symbol.SetValue( srcValue );
|
||||
symbol.SetValueFieldText( srcValue );
|
||||
}
|
||||
else if( destField->GetId() == FOOTPRINT_FIELD )
|
||||
{
|
||||
symbol.SetFootprint( srcValue );
|
||||
symbol.SetFootprintFieldText( srcValue );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -707,9 +707,8 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
|
|||
|
||||
// Similar for Value and Footprint, except that the GUI behaviour is that they are kept
|
||||
// in sync between multiple instances.
|
||||
m_symbol->SetValue( &GetParent()->GetCurrentSheet(), m_fields->at( VALUE_FIELD ).GetText() );
|
||||
m_symbol->SetFootprint( &GetParent()->GetCurrentSheet(),
|
||||
m_fields->at( FOOTPRINT_FIELD ).GetText() );
|
||||
m_symbol->SetValueFieldText( m_fields->at( VALUE_FIELD ).GetText() );
|
||||
m_symbol->SetFootprintFieldText( m_fields->at( FOOTPRINT_FIELD ).GetText() );
|
||||
|
||||
m_symbol->SetIncludeInBom( !m_cbExcludeFromBom->IsChecked() );
|
||||
m_symbol->SetIncludeOnBoard( !m_cbExcludeFromBoard->IsChecked() );
|
||||
|
@ -748,8 +747,8 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
|
|||
{
|
||||
GetParent()->SaveCopyInUndoList( screen, otherUnit, UNDO_REDO::CHANGED,
|
||||
appendUndo );
|
||||
otherUnit->SetValue( m_fields->at( VALUE_FIELD ).GetText() );
|
||||
otherUnit->SetFootprint( m_fields->at( FOOTPRINT_FIELD ).GetText() );
|
||||
otherUnit->SetValueFieldText( m_fields->at( VALUE_FIELD ).GetText() );
|
||||
otherUnit->SetFootprintFieldText( m_fields->at( FOOTPRINT_FIELD ).GetText() );
|
||||
|
||||
for( size_t ii = DATASHEET_FIELD; ii < m_fields->size(); ++ii )
|
||||
{
|
||||
|
|
|
@ -71,9 +71,9 @@ static wxString netList( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH& aSheetPath )
|
|||
*/
|
||||
wxString netlist;
|
||||
|
||||
netlist << EscapeString( aSymbol->GetFootprint( &aSheetPath, true ), CTX_LINE ) << wxS( "\r" );
|
||||
netlist << EscapeString( aSymbol->GetFootprintFieldText( true ), CTX_LINE ) << wxS( "\r" );
|
||||
netlist << EscapeString( aSymbol->GetRef( &aSheetPath ), CTX_LINE ) << wxS( "\r" );
|
||||
netlist << EscapeString( aSymbol->GetValue( &aSheetPath, true ), CTX_LINE );
|
||||
netlist << EscapeString( aSymbol->GetValueFieldText( true ), CTX_LINE );
|
||||
|
||||
for( SCH_PIN* pin : aSymbol->GetPins( &aSheetPath ) )
|
||||
{
|
||||
|
|
|
@ -76,7 +76,7 @@ bool NETLIST_EXPORTER_CADSTAR::WriteNetlist( const wxString& aOutFileName,
|
|||
if( !symbol )
|
||||
continue;
|
||||
|
||||
footprint = symbol->GetFootprint( &sheetList[i], true );
|
||||
footprint = symbol->GetFootprintFieldText( true );
|
||||
|
||||
if( footprint.IsEmpty() )
|
||||
footprint = "$noname";
|
||||
|
@ -85,7 +85,7 @@ bool NETLIST_EXPORTER_CADSTAR::WriteNetlist( const wxString& aOutFileName,
|
|||
ret |= fprintf( f, "%s ", TO_UTF8( StartCmpDesc ) );
|
||||
ret |= fprintf( f, "%s", TO_UTF8( msg ) );
|
||||
|
||||
msg = symbol->GetValue( &sheetList[i], true );
|
||||
msg = symbol->GetValueFieldText( true );
|
||||
msg.Replace( wxT( " " ), wxT( "_" ) );
|
||||
ret |= fprintf( f, " \"%s\"", TO_UTF8( msg ) );
|
||||
ret |= fprintf( f, " \"%s\"", TO_UTF8( footprint ) );
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 1992-2018 jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.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
|
||||
|
@ -81,10 +81,11 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName,
|
|||
if( symbol->GetLibSymbolRef()
|
||||
&& symbol->GetLibSymbolRef()->GetFPFilters().GetCount() != 0 )
|
||||
{
|
||||
cmpList.push_back( SCH_REFERENCE( symbol, symbol->GetLibSymbolRef().get(), sheet ) );
|
||||
cmpList.push_back( SCH_REFERENCE( symbol, symbol->GetLibSymbolRef().get(),
|
||||
sheet ) );
|
||||
}
|
||||
|
||||
footprint = symbol->GetFootprint( &sheet, true );
|
||||
footprint = symbol->GetFootprintFieldText( true );
|
||||
footprint.Replace( wxT( " " ), wxT( "_" ) );
|
||||
|
||||
if( footprint.IsEmpty() )
|
||||
|
@ -98,7 +99,7 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName,
|
|||
|
||||
ret |= fprintf( f, " %s", TO_UTF8( field ) );
|
||||
|
||||
field = symbol->GetValue( &sheet, true );
|
||||
field = symbol->GetValueFieldText( true );
|
||||
field.Replace( wxT( " " ), wxT( "_" ) );
|
||||
|
||||
ret |= fprintf( f, " %s", TO_UTF8( field ) );
|
||||
|
|
|
@ -135,12 +135,12 @@ void NETLIST_EXPORTER_XML::addSymbolFields( XNODE* aNode, SCH_SYMBOL* aSymbol,
|
|||
int unit = symbol2->GetUnitSelection( aSheet );
|
||||
|
||||
// The lowest unit number wins. User should only set fields in any one unit.
|
||||
candidate = symbol2->GetValue( &sheetList[i], m_resolveTextVars );
|
||||
candidate = symbol2->GetValueFieldText( m_resolveTextVars );
|
||||
|
||||
if( !candidate.IsEmpty() && ( unit < minUnit || value.IsEmpty() ) )
|
||||
value = candidate;
|
||||
|
||||
candidate = symbol2->GetFootprint( &sheetList[i], m_resolveTextVars );
|
||||
candidate = symbol2->GetFootprintFieldText( m_resolveTextVars );
|
||||
|
||||
if( !candidate.IsEmpty() && ( unit < minUnit || footprint.IsEmpty() ) )
|
||||
footprint = candidate;
|
||||
|
@ -171,8 +171,8 @@ void NETLIST_EXPORTER_XML::addSymbolFields( XNODE* aNode, SCH_SYMBOL* aSymbol,
|
|||
}
|
||||
else
|
||||
{
|
||||
value = aSymbol->GetValue( aSheet, m_resolveTextVars );
|
||||
footprint = aSymbol->GetFootprint( aSheet, m_resolveTextVars );
|
||||
value = aSymbol->GetValueFieldText( m_resolveTextVars );
|
||||
footprint = aSymbol->GetFootprintFieldText( m_resolveTextVars );
|
||||
|
||||
if( m_resolveTextVars )
|
||||
datasheet = aSymbol->GetField( DATASHEET_FIELD )->GetShownText();
|
||||
|
|
|
@ -1012,7 +1012,7 @@ void SCH_EDIT_FRAME::ShowFindReplaceDialog( bool aReplace )
|
|||
switch( front->Type() )
|
||||
{
|
||||
case SCH_SYMBOL_T:
|
||||
findString = static_cast<SCH_SYMBOL*>( front )->GetValue( &GetCurrentSheet(), true );
|
||||
findString = static_cast<SCH_SYMBOL*>( front )->GetValueFieldText( true );
|
||||
break;
|
||||
|
||||
case SCH_FIELD_T:
|
||||
|
|
|
@ -691,22 +691,22 @@ bool SCH_FIELD::Replace( const EDA_SEARCH_DATA& aSearchData, void* aAuxData )
|
|||
case VALUE_FIELD:
|
||||
wxCHECK_MSG( aAuxData, false, wxT( "Need sheetpath to replace in value field." ) );
|
||||
|
||||
text = parentSymbol->GetValue((SCH_SHEET_PATH*) aAuxData, resolve );
|
||||
text = parentSymbol->GetValueFieldText( resolve );
|
||||
isReplaced = EDA_ITEM::Replace( aSearchData, text );
|
||||
|
||||
if( isReplaced )
|
||||
parentSymbol->SetValue( (SCH_SHEET_PATH*) aAuxData, text );
|
||||
parentSymbol->SetValueFieldText( text );
|
||||
|
||||
break;
|
||||
|
||||
case FOOTPRINT_FIELD:
|
||||
wxCHECK_MSG( aAuxData, false, wxT( "Need sheetpath to replace in footprint field." ) );
|
||||
|
||||
text = parentSymbol->GetFootprint((SCH_SHEET_PATH*) aAuxData, resolve );
|
||||
text = parentSymbol->GetFootprintFieldText( resolve );
|
||||
isReplaced = EDA_ITEM::Replace( aSearchData, text );
|
||||
|
||||
if( isReplaced )
|
||||
parentSymbol->SetFootprint( (SCH_SHEET_PATH*) aAuxData, text );
|
||||
parentSymbol->SetFootprintFieldText( text );
|
||||
|
||||
break;
|
||||
|
||||
|
|
|
@ -91,4 +91,5 @@
|
|||
//#define SEXPR_SCHEMATIC_FILE_VERSION 20220929 // Don't save property ID
|
||||
//#define SEXPR_SCHEMATIC_FILE_VERSION 20221002 // Move instance data back into symbol definition.
|
||||
//#define SEXPR_SCHEMATIC_FILE_VERSION 20221004 // Move instance data back into symbol definition.
|
||||
#define SEXPR_SCHEMATIC_FILE_VERSION 20221110 // Move sheet instance data to sheet definition.
|
||||
//#define SEXPR_SCHEMATIC_FILE_VERSION 20221110 // Move sheet instance data to sheet definition.
|
||||
#define SEXPR_SCHEMATIC_FILE_VERSION 20221126 // Remove value and footprint from instance data.
|
||||
|
|
|
@ -230,7 +230,7 @@ void SCH_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITE
|
|||
SCH_SHEET_PATH* currentSheet = schframe ? &schframe->GetCurrentSheet() : nullptr;
|
||||
SCH_SYMBOL* symbol = GetParentSymbol();
|
||||
|
||||
aList.emplace_back( symbol->GetRef( currentSheet ), symbol->GetValue( currentSheet, true ) );
|
||||
aList.emplace_back( symbol->GetRef( currentSheet ), symbol->GetValueFieldText( true ) );
|
||||
|
||||
#if defined(DEBUG)
|
||||
if( !IsConnectivityDirty() && dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) )
|
||||
|
|
|
@ -2331,7 +2331,7 @@ void SCH_ALTIUM_PLUGIN::ParsePowerPort( const std::map<wxString, wxString>& aPro
|
|||
// each symbol has its own powerSymbolIt for now
|
||||
SCH_SYMBOL* symbol = new SCH_SYMBOL();
|
||||
symbol->SetRef( &m_sheetPath, "#PWR?" );
|
||||
symbol->SetValue( &m_sheetPath, elem.text );
|
||||
symbol->SetValueFieldText( elem.text );
|
||||
symbol->SetLibId( libId );
|
||||
symbol->SetLibSymbol( new LIB_SYMBOL( *libSymbol ) );
|
||||
|
||||
|
@ -3042,6 +3042,6 @@ void SCH_ALTIUM_PLUGIN::ParseImplementation( const std::map<wxString, wxString>&
|
|||
|
||||
SCH_SYMBOL* symbol = m_symbols.at( libSymbolIt->first );
|
||||
|
||||
symbol->SetFootprint( fpLibId.Format() );
|
||||
symbol->SetFootprintFieldText( fpLibId.Format() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1513,7 +1513,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
|
|||
symbol->GetField( REFERENCE_FIELD )->SetVisible( false );
|
||||
}
|
||||
|
||||
symbol->AddHierarchicalReference( m_sheetPath.Path(), reference, unit, value, footprint );
|
||||
symbol->AddHierarchicalReference( m_sheetPath.Path(), reference, unit );
|
||||
|
||||
// Save the pin positions
|
||||
SYMBOL_LIB_TABLE& schLibTable = *m_schematic->Prj().SchSymbolLibTable();
|
||||
|
|
|
@ -2719,13 +2719,13 @@ SCH_SYMBOL* SCH_SEXPR_PARSER::parseSchematicSymbol()
|
|||
|
||||
case T_value:
|
||||
NeedSYMBOL();
|
||||
defaultInstance.m_Value = FromUTF8();
|
||||
symbol->SetValueFieldText( FromUTF8() );
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
case T_footprint:
|
||||
NeedSYMBOL();
|
||||
defaultInstance.m_Footprint = FromUTF8();
|
||||
symbol->SetFootprintFieldText( FromUTF8() );
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
|
@ -2792,13 +2792,13 @@ SCH_SYMBOL* SCH_SEXPR_PARSER::parseSchematicSymbol()
|
|||
|
||||
case T_value:
|
||||
NeedSYMBOL();
|
||||
instance.m_Value = FromUTF8();
|
||||
symbol->SetValueFieldText( FromUTF8() );
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
case T_footprint:
|
||||
NeedSYMBOL();
|
||||
instance.m_Footprint = FromUTF8();
|
||||
symbol->SetFootprintFieldText( FromUTF8() );
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
|
|
|
@ -736,11 +736,11 @@ void SCH_SEXPR_PLUGIN::saveSymbol( SCH_SYMBOL* aSymbol, const SCHEMATIC& aSchema
|
|||
}
|
||||
else if( id == VALUE_FIELD )
|
||||
{
|
||||
field.SetText( aSymbol->GetInstanceReferences()[0].m_Value );
|
||||
field.SetText( aSymbol->GetValueFieldText( false ) );
|
||||
}
|
||||
else if( id == FOOTPRINT_FIELD )
|
||||
{
|
||||
field.SetText( aSymbol->GetInstanceReferences()[0].m_Footprint );
|
||||
field.SetText( aSymbol->GetFootprintFieldText( false ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -827,11 +827,9 @@ void SCH_SEXPR_PLUGIN::saveSymbol( SCH_SYMBOL* aSymbol, const SCHEMATIC& aSchema
|
|||
|
||||
m_out->Print( aNestLevel + 3, "(path %s\n",
|
||||
m_out->Quotew( path ).c_str() );
|
||||
m_out->Print( aNestLevel + 4, "(reference %s) (unit %d) (value %s) (footprint %s)\n",
|
||||
m_out->Print( aNestLevel + 4, "(reference %s) (unit %d)\n",
|
||||
m_out->Quotew( aSymbol->GetInstanceReferences()[i].m_Reference ).c_str(),
|
||||
aSymbol->GetInstanceReferences()[i].m_Unit,
|
||||
m_out->Quotew( aSymbol->GetInstanceReferences()[i].m_Value ).c_str(),
|
||||
m_out->Quotew( aSymbol->GetInstanceReferences()[i].m_Footprint ).c_str() );
|
||||
aSymbol->GetInstanceReferences()[i].m_Unit );
|
||||
m_out->Print( aNestLevel + 3, ")\n" );
|
||||
|
||||
if( project_open && ( ( i + 1 == aSymbol->GetInstanceReferences().size() )
|
||||
|
|
|
@ -1357,8 +1357,6 @@ SCH_SYMBOL* SCH_LEGACY_PLUGIN::loadSymbol( LINE_READER& aReader )
|
|||
instance.m_Path = path;
|
||||
instance.m_Reference = symbol->GetField( REFERENCE_FIELD )->GetText();
|
||||
instance.m_Unit = symbol->GetUnit();
|
||||
instance.m_Value = symbol->GetField( VALUE_FIELD )->GetText();
|
||||
instance.m_Footprint = symbol->GetField( FOOTPRINT_FIELD )->GetText();
|
||||
symbol->AddHierarchicalReference( instance );
|
||||
}
|
||||
else
|
||||
|
@ -1366,8 +1364,6 @@ SCH_SYMBOL* SCH_LEGACY_PLUGIN::loadSymbol( LINE_READER& aReader )
|
|||
for( const SYMBOL_INSTANCE_REFERENCE& instance : symbol->GetInstanceReferences() )
|
||||
{
|
||||
SYMBOL_INSTANCE_REFERENCE tmpInstance = instance;
|
||||
tmpInstance.m_Value = symbol->GetField( VALUE_FIELD )->GetText();
|
||||
tmpInstance.m_Footprint = symbol->GetField( FOOTPRINT_FIELD )->GetText();
|
||||
symbol->AddHierarchicalReference( tmpInstance );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1433,9 +1433,7 @@ void SCH_SCREEN::SetLegacySymbolInstanceData()
|
|||
for( const SYMBOL_INSTANCE_REFERENCE& instance : symbol->GetInstanceReferences() )
|
||||
{
|
||||
symbol->AddHierarchicalReference( instance.m_Path, instance.m_Reference,
|
||||
instance.m_Unit,
|
||||
symbol->GetField( VALUE_FIELD )->GetText(),
|
||||
symbol->GetField( FOOTPRINT_FIELD )->GetText() );
|
||||
instance.m_Unit );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -337,8 +337,6 @@ void SCH_SHEET_PATH::UpdateAllScreenReferences() const
|
|||
{
|
||||
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
|
||||
symbol->GetField( REFERENCE_FIELD )->SetText( symbol->GetRef( this ) );
|
||||
symbol->GetField( VALUE_FIELD )->SetText( symbol->GetValue( this, false ) );
|
||||
symbol->GetField( FOOTPRINT_FIELD )->SetText( symbol->GetFootprint( this, false ) );
|
||||
symbol->UpdateUnit( symbol->GetUnitSelection( this ) );
|
||||
LastScreen()->Update( item );
|
||||
}
|
||||
|
@ -570,8 +568,6 @@ void SCH_SHEET_PATH::AddNewSymbolInstances( const SCH_SHEET_PATH& aPrefixSheetPa
|
|||
newSymbolInstance.m_Reference = symbol->GetLibSymbolRef()->GetReferenceField().GetText();
|
||||
newSymbolInstance.m_Reference += wxT( "?" );
|
||||
newSymbolInstance.m_Unit = 1;
|
||||
newSymbolInstance.m_Value = symbol->GetLibSymbolRef()->GetValueField().GetText();
|
||||
newSymbolInstance.m_Footprint = symbol->GetLibSymbolRef()->GetFootprintField().GetText();
|
||||
symbol->AddHierarchicalReference( newSymbolInstance );
|
||||
}
|
||||
else
|
||||
|
@ -1113,10 +1109,10 @@ void SCH_SHEET_LIST::UpdateSymbolInstances(
|
|||
|
||||
// Symbol instance paths are stored and looked up in memory with the root path so use
|
||||
// the full path here.
|
||||
symbol->AddHierarchicalReference( sheetPath.Path(),
|
||||
it->m_Reference, it->m_Unit, it->m_Value,
|
||||
it->m_Footprint );
|
||||
symbol->AddHierarchicalReference( sheetPath.Path(), it->m_Reference, it->m_Unit );
|
||||
symbol->GetField( REFERENCE_FIELD )->SetText( it->m_Reference );
|
||||
symbol->SetValueFieldText( it->m_Value );
|
||||
symbol->SetFootprintFieldText( it->m_Footprint );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1298,7 +1294,7 @@ void SCH_SHEET_LIST::migrateSimModel( SCH_SYMBOL& aSymbol, unsigned aSheetIndex
|
|||
}
|
||||
|
||||
wxString ref = aSymbol.GetRef( &at( aSheetIndex ), true );
|
||||
wxString value = aSymbol.GetValue( &at( aSheetIndex ), true );
|
||||
wxString value = aSymbol.GetValueFieldText( true );
|
||||
|
||||
wxString spiceType;
|
||||
wxString spiceModel;
|
||||
|
|
|
@ -48,7 +48,8 @@ struct SYMBOL_INSTANCE_REFERENCE
|
|||
wxString m_Reference;
|
||||
int m_Unit = 1;
|
||||
|
||||
// Things that can be back-annotated:
|
||||
// Do not use. This is left over from the dubious decision to instantiate symbol value
|
||||
// and footprint fields.
|
||||
wxString m_Value;
|
||||
wxString m_Footprint;
|
||||
|
||||
|
|
|
@ -135,12 +135,6 @@ SCH_SYMBOL::SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId,
|
|||
if( aSheet )
|
||||
{
|
||||
SetRef( aSheet, UTIL::GetRefDesUnannotated( m_prefix ) );
|
||||
|
||||
// Value and footprint name are stored in the SCH_SHEET_PATH path manager,
|
||||
// if aSheet != nullptr, not in the symbol itself.
|
||||
// Copy them to the currently displayed field texts
|
||||
SetValue( GetValue( aSheet, false ) );
|
||||
SetFootprint( GetFootprint( aSheet, false ) );
|
||||
}
|
||||
|
||||
// Inherit the include in bill of materials and board netlist settings from library symbol.
|
||||
|
@ -161,10 +155,6 @@ SCH_SYMBOL::SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const SCH_SHEET_PATH* aSheet,
|
|||
{
|
||||
if( i.first == REFERENCE_FIELD )
|
||||
SetRef( aSheet, i.second );
|
||||
else if( i.first == VALUE_FIELD )
|
||||
SetValue( aSheet, i.second );
|
||||
else if( i.first == FOOTPRINT_FIELD )
|
||||
SetFootprint( aSheet, i.second );
|
||||
else if( SCH_FIELD* field = GetFieldById( i.first ) )
|
||||
field->SetText( i.second );
|
||||
}
|
||||
|
@ -529,9 +519,7 @@ void SCH_SYMBOL::SortInstances( bool (*aSortFunction)( const SYMBOL_INSTANCE_REF
|
|||
}
|
||||
|
||||
|
||||
void SCH_SYMBOL::AddHierarchicalReference( const KIID_PATH& aPath, const wxString& aRef,
|
||||
int aUnit, const wxString& aValue,
|
||||
const wxString& aFootprint )
|
||||
void SCH_SYMBOL::AddHierarchicalReference( const KIID_PATH& aPath, const wxString& aRef, int aUnit )
|
||||
{
|
||||
// Search for an existing path and remove it if found (should not occur)
|
||||
for( unsigned ii = 0; ii < m_instanceReferences.size(); ii++ )
|
||||
|
@ -555,22 +543,16 @@ void SCH_SYMBOL::AddHierarchicalReference( const KIID_PATH& aPath, const wxStrin
|
|||
instance.m_Path = aPath;
|
||||
instance.m_Reference = aRef;
|
||||
instance.m_Unit = aUnit;
|
||||
instance.m_Value = aValue;
|
||||
instance.m_Footprint = aFootprint;
|
||||
|
||||
wxLogTrace( traceSchSheetPaths,
|
||||
"Adding symbol '%s' instance:\n"
|
||||
" sheet path '%s'\n"
|
||||
" reference '%s'\n"
|
||||
" unit %d\n"
|
||||
" value '%s'\n"
|
||||
" footprint '%s'",
|
||||
" unit %d\n",
|
||||
m_Uuid.AsString(),
|
||||
aPath.AsString(),
|
||||
aRef,
|
||||
aUnit,
|
||||
aValue,
|
||||
aFootprint );
|
||||
aUnit );
|
||||
|
||||
m_instanceReferences.push_back( instance );
|
||||
|
||||
|
@ -579,9 +561,7 @@ void SCH_SYMBOL::AddHierarchicalReference( const KIID_PATH& aPath, const wxStrin
|
|||
if( m_instanceReferences.size() == 1 )
|
||||
{
|
||||
m_fields[ REFERENCE_FIELD ].SetText( aRef );
|
||||
m_fields[ VALUE_FIELD ].SetText( aValue );
|
||||
m_unit = aUnit;
|
||||
m_fields[ FOOTPRINT_FIELD ].SetText( aFootprint );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -623,15 +603,11 @@ void SCH_SYMBOL::AddHierarchicalReference( const SYMBOL_INSTANCE_REFERENCE& aIns
|
|||
"Adding symbol '%s' instance:\n"
|
||||
" sheet path '%s'\n"
|
||||
" reference '%s'\n"
|
||||
" unit %d\n"
|
||||
" value '%s'\n"
|
||||
" footprint '%s'",
|
||||
" unit %d\n",
|
||||
m_Uuid.AsString(),
|
||||
instance.m_Path.AsString(),
|
||||
instance.m_Reference,
|
||||
instance.m_Unit,
|
||||
instance.m_Value,
|
||||
instance.m_Footprint );
|
||||
instance.m_Unit );
|
||||
|
||||
m_instanceReferences.push_back( instance );
|
||||
|
||||
|
@ -640,9 +616,7 @@ void SCH_SYMBOL::AddHierarchicalReference( const SYMBOL_INSTANCE_REFERENCE& aIns
|
|||
if( m_instanceReferences.size() == 1 )
|
||||
{
|
||||
m_fields[ REFERENCE_FIELD ].SetText( instance.m_Reference );
|
||||
m_fields[ VALUE_FIELD ].SetText( instance.m_Value );
|
||||
m_unit = instance.m_Unit;
|
||||
m_fields[ FOOTPRINT_FIELD ].SetText( instance.m_Footprint );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -706,8 +680,7 @@ void SCH_SYMBOL::SetRef( const SCH_SHEET_PATH* sheet, const wxString& ref )
|
|||
}
|
||||
|
||||
if( !found )
|
||||
AddHierarchicalReference( path, ref, m_unit, GetField( VALUE_FIELD )->GetText(),
|
||||
GetField( FOOTPRINT_FIELD )->GetText() );
|
||||
AddHierarchicalReference( path, ref, m_unit );
|
||||
|
||||
for( std::unique_ptr<SCH_PIN>& pin : m_pins )
|
||||
pin->ClearDefaultNetName( sheet );
|
||||
|
@ -782,128 +755,33 @@ void SCH_SYMBOL::SetUnitSelection( int aUnitSelection )
|
|||
}
|
||||
|
||||
|
||||
const wxString SCH_SYMBOL::GetValue( const SCH_SHEET_PATH* sheet, bool aResolve ) const
|
||||
const wxString SCH_SYMBOL::GetValueFieldText( bool aResolve ) const
|
||||
{
|
||||
KIID_PATH path = sheet->Path();
|
||||
if( aResolve )
|
||||
return GetField( VALUE_FIELD )->GetShownText();
|
||||
|
||||
for( const SYMBOL_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
{
|
||||
if( instance.m_Path == path && !instance.m_Value.IsEmpty() )
|
||||
{
|
||||
// This can only be overridden by a new value but if we are resolving,
|
||||
// make sure that the symbol returns the fully resolved text
|
||||
if( aResolve )
|
||||
{
|
||||
SCH_SYMBOL new_sym( *this );
|
||||
new_sym.GetField( VALUE_FIELD )->SetText( instance.m_Value );
|
||||
return new_sym.GetField( VALUE_FIELD )->GetShownText();
|
||||
}
|
||||
|
||||
return instance.m_Value;
|
||||
}
|
||||
}
|
||||
|
||||
if( !aResolve )
|
||||
return GetField( VALUE_FIELD )->GetText();
|
||||
|
||||
return GetField( VALUE_FIELD )->GetShownText();
|
||||
return GetField( VALUE_FIELD )->GetText();
|
||||
}
|
||||
|
||||
|
||||
void SCH_SYMBOL::SetValue( const SCH_SHEET_PATH* sheet, const wxString& aValue )
|
||||
void SCH_SYMBOL::SetValueFieldText( const wxString& aValue )
|
||||
{
|
||||
if( sheet == nullptr )
|
||||
{
|
||||
// Set all instances to the updated value
|
||||
for( SYMBOL_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
instance.m_Value = aValue;
|
||||
|
||||
m_fields[ VALUE_FIELD ].SetText( aValue );
|
||||
return;
|
||||
}
|
||||
|
||||
KIID_PATH path = sheet->Path();
|
||||
bool found = false;
|
||||
|
||||
// check to see if it is already there before inserting it
|
||||
for( SYMBOL_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
{
|
||||
if( instance.m_Path == path )
|
||||
{
|
||||
found = true;
|
||||
instance.m_Value = aValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// didn't find it; better add it
|
||||
if( !found )
|
||||
{
|
||||
AddHierarchicalReference( path, UTIL::GetRefDesUnannotated( m_prefix ), m_unit, aValue,
|
||||
wxEmptyString );
|
||||
}
|
||||
|
||||
if( Schematic() && *sheet == Schematic()->CurrentSheet() )
|
||||
m_fields[ VALUE_FIELD ].SetText( aValue );
|
||||
m_fields[ VALUE_FIELD ].SetText( aValue );
|
||||
}
|
||||
|
||||
|
||||
const wxString SCH_SYMBOL::GetFootprint( const SCH_SHEET_PATH* sheet, bool aResolve ) const
|
||||
const wxString SCH_SYMBOL::GetFootprintFieldText( bool aResolve ) const
|
||||
{
|
||||
KIID_PATH path = sheet->Path();
|
||||
if( aResolve )
|
||||
return GetField( FOOTPRINT_FIELD )->GetShownText();
|
||||
|
||||
for( const SYMBOL_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
{
|
||||
if( instance.m_Path == path && !instance.m_Footprint.IsEmpty() )
|
||||
{
|
||||
// This can only be an override from an Update Schematic from PCB, and therefore
|
||||
// will always be fully resolved.
|
||||
return instance.m_Footprint;
|
||||
}
|
||||
}
|
||||
|
||||
if( !aResolve )
|
||||
return GetField( FOOTPRINT_FIELD )->GetText();
|
||||
|
||||
return GetField( FOOTPRINT_FIELD )->GetShownText();
|
||||
return GetField( FOOTPRINT_FIELD )->GetText();
|
||||
}
|
||||
|
||||
|
||||
void SCH_SYMBOL::SetFootprint( const SCH_SHEET_PATH* sheet, const wxString& aFootprint )
|
||||
void SCH_SYMBOL::SetFootprintFieldText( const wxString& aFootprint )
|
||||
{
|
||||
if( sheet == nullptr )
|
||||
{
|
||||
// Set all instances to new footprint value
|
||||
for( SYMBOL_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
instance.m_Footprint = aFootprint;
|
||||
|
||||
m_fields[ FOOTPRINT_FIELD ].SetText( aFootprint );
|
||||
return;
|
||||
}
|
||||
|
||||
KIID_PATH path = sheet->Path();
|
||||
bool found = false;
|
||||
|
||||
// check to see if it is already there before inserting it
|
||||
for( SYMBOL_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
{
|
||||
if( instance.m_Path == path )
|
||||
{
|
||||
found = true;
|
||||
instance.m_Footprint = aFootprint;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// didn't find it; better add it
|
||||
if( !found )
|
||||
{
|
||||
AddHierarchicalReference( path, UTIL::GetRefDesUnannotated( m_prefix ), m_unit,
|
||||
wxEmptyString, aFootprint );
|
||||
}
|
||||
|
||||
if( Schematic() && *sheet == Schematic()->CurrentSheet() )
|
||||
m_fields[ FOOTPRINT_FIELD ].SetText( aFootprint );
|
||||
m_fields[ FOOTPRINT_FIELD ].SetText( aFootprint );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1039,12 +917,12 @@ void SCH_SYMBOL::UpdateFields( const SCH_SHEET_PATH* aPath, bool aUpdateStyle, b
|
|||
}
|
||||
else if( id == VALUE_FIELD )
|
||||
{
|
||||
SetValue( aPath, UnescapeString( libField->GetText() ) );
|
||||
SetValueFieldText( UnescapeString( libField->GetText() ) );
|
||||
}
|
||||
else if( id == FOOTPRINT_FIELD )
|
||||
{
|
||||
if( aResetOtherFields || aUpdateOtherFields )
|
||||
SetFootprint( aPath, libField->GetText() );
|
||||
SetFootprintFieldText( libField->GetText() );
|
||||
}
|
||||
else if( id == DATASHEET_FIELD )
|
||||
{
|
||||
|
@ -1206,9 +1084,9 @@ bool SCH_SYMBOL::ResolveTextVar( wxString* token, int aDepth ) const
|
|||
if( i == REFERENCE_FIELD )
|
||||
*token = GetRef( &schematic->CurrentSheet(), true );
|
||||
else if( i == VALUE_FIELD )
|
||||
*token = GetValue( &schematic->CurrentSheet(), true );
|
||||
*token = GetValueFieldText( true );
|
||||
else if( i == FOOTPRINT_FIELD )
|
||||
*token = GetFootprint( &schematic->CurrentSheet(), true );
|
||||
*token = GetFootprintFieldText( true );
|
||||
else
|
||||
*token = m_fields[ i ].GetShownText( aDepth + 1 );
|
||||
|
||||
|
@ -1243,7 +1121,7 @@ bool SCH_SYMBOL::ResolveTextVar( wxString* token, int aDepth ) const
|
|||
{
|
||||
wxString footprint;
|
||||
|
||||
footprint = GetFootprint( &schematic->CurrentSheet(), true );
|
||||
footprint = GetFootprintFieldText( true );
|
||||
|
||||
wxArrayString parts = wxSplit( footprint, ':' );
|
||||
|
||||
|
@ -1254,7 +1132,7 @@ bool SCH_SYMBOL::ResolveTextVar( wxString* token, int aDepth ) const
|
|||
{
|
||||
wxString footprint;
|
||||
|
||||
footprint = GetFootprint( &schematic->CurrentSheet(), true );
|
||||
footprint = GetFootprintFieldText( true );
|
||||
|
||||
wxArrayString parts = wxSplit( footprint, ':' );
|
||||
|
||||
|
@ -1673,12 +1551,12 @@ void SCH_SYMBOL::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_
|
|||
{
|
||||
if( m_part->IsPower() )
|
||||
{
|
||||
aList.emplace_back( _( "Power symbol" ), GetValue( currentSheet, true ) );
|
||||
aList.emplace_back( _( "Power symbol" ), GetValueFieldText( true ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
aList.emplace_back( _( "Reference" ), GetRef( currentSheet ) );
|
||||
aList.emplace_back( _( "Value" ), GetValue( currentSheet, true ) );
|
||||
aList.emplace_back( _( "Value" ), GetValueFieldText( true ) );
|
||||
aList.emplace_back( _( "Name" ), UnescapeString( GetLibId().GetLibItemName() ) );
|
||||
}
|
||||
|
||||
|
@ -1707,7 +1585,7 @@ void SCH_SYMBOL::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_
|
|||
}
|
||||
|
||||
// Display the current associated footprint, if exists.
|
||||
msg = GetFootprint( currentSheet, true );
|
||||
msg = GetFootprintFieldText( true );
|
||||
|
||||
if( msg.IsEmpty() )
|
||||
msg = _( "<Unknown>" );
|
||||
|
@ -1723,7 +1601,7 @@ void SCH_SYMBOL::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_
|
|||
{
|
||||
aList.emplace_back( _( "Reference" ), GetRef( currentSheet ) );
|
||||
|
||||
aList.emplace_back( _( "Value" ), GetValue( currentSheet, true ) );
|
||||
aList.emplace_back( _( "Value" ), GetValueFieldText( true ) );
|
||||
aList.emplace_back( _( "Name" ), GetLibId().GetLibItemName() );
|
||||
|
||||
wxString libNickname = GetLibId().GetLibNickname();
|
||||
|
|
|
@ -453,6 +453,12 @@ public:
|
|||
m_fields = aFields; // vector copying, length is changed possibly
|
||||
}
|
||||
|
||||
const wxString GetValueFieldText( bool aResolve ) const;
|
||||
void SetValueFieldText( const wxString& aValue );
|
||||
|
||||
const wxString GetFootprintFieldText( bool aResolve ) const;
|
||||
void SetFootprintFieldText( const wxString& aFootprint );
|
||||
|
||||
/**
|
||||
* Restore fields to the original library values.
|
||||
*
|
||||
|
@ -591,9 +597,7 @@ public:
|
|||
*/
|
||||
void AddHierarchicalReference( const KIID_PATH& aPath,
|
||||
const wxString& aRef,
|
||||
int aUnit,
|
||||
const wxString& aValue = wxEmptyString,
|
||||
const wxString& aFootprint = wxEmptyString );
|
||||
int aUnit );
|
||||
|
||||
void AddHierarchicalReference( const SYMBOL_INSTANCE_REFERENCE& aInstance );
|
||||
|
||||
|
@ -606,26 +610,6 @@ public:
|
|||
/// Set the selected unit of this symbol for all sheets.
|
||||
void SetUnitSelection( int aUnitSelection );
|
||||
|
||||
/// Return the instance-specific value for the given sheet path.
|
||||
const wxString GetValue( const SCH_SHEET_PATH* sheet, bool aResolve ) const;
|
||||
void SetValue( const SCH_SHEET_PATH* sheet, const wxString& aValue );
|
||||
|
||||
/// Set the value for all instances (the default GUI behavior).
|
||||
void SetValue( const wxString& aValue )
|
||||
{
|
||||
SetValue( nullptr, aValue );
|
||||
}
|
||||
|
||||
/// Return the instance-specific footprint assignment for the given sheet path.
|
||||
const wxString GetFootprint( const SCH_SHEET_PATH* sheet, bool aResolve ) const;
|
||||
void SetFootprint( const SCH_SHEET_PATH* sheet, const wxString& aFootprint );
|
||||
|
||||
/// Set the value for all instances (the default GUI behavior).
|
||||
void SetFootprint( const wxString& aFootprint )
|
||||
{
|
||||
SetFootprint( nullptr, aFootprint );
|
||||
}
|
||||
|
||||
// Geometric transforms (used in block operations):
|
||||
|
||||
void Move( const VECTOR2I& aMoveVector ) override
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2004-2021 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2004-2022 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
|
||||
|
@ -337,16 +337,6 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
|
|||
symbol->SetRef( m_schematic->GetSheets().FindSheetForScreen( screen ),
|
||||
field->GetText() );
|
||||
}
|
||||
else if( field->GetId() == VALUE_FIELD )
|
||||
{
|
||||
symbol->SetValue( m_schematic->GetSheets().FindSheetForScreen( screen ),
|
||||
field->GetText() );
|
||||
}
|
||||
else if( field->GetId() == FOOTPRINT_FIELD )
|
||||
{
|
||||
symbol->SetFootprint( m_schematic->GetSheets().FindSheetForScreen( screen ),
|
||||
field->GetText() );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.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
|
||||
|
@ -88,7 +88,6 @@ void SCH_EDITOR_CONTROL::AssignFootprints( const std::string& aChangedSetOfRefer
|
|||
|
||||
// For backwards-compatibility CvPcb currently updates all instances of a
|
||||
// symbol (even though it lists these instances separately).
|
||||
SCH_SHEET_PATH* sheetPath = nullptr; // &refs[ii].GetSheetPath();
|
||||
wxString oldfp = refs[ii].GetFootprint();
|
||||
|
||||
if( oldfp.IsEmpty() && symbol->GetField( FOOTPRINT_FIELD )->IsVisible() )
|
||||
|
@ -103,7 +102,7 @@ void SCH_EDITOR_CONTROL::AssignFootprints( const std::string& aChangedSetOfRefer
|
|||
appendToUndoList, false );
|
||||
appendToUndoList = true;
|
||||
|
||||
symbol->SetFootprint( sheetPath, footprint );
|
||||
symbol->SetFootprintFieldText( footprint );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -192,10 +191,9 @@ bool SCH_EDITOR_CONTROL::processCmpToFootprintLinkFile( const wxString& aFullFil
|
|||
// We have found a candidate.
|
||||
// Note: it can be not unique (multiple units per part)
|
||||
// So we *do not* stop the search here
|
||||
SCH_SYMBOL* symbol = referencesList[ ii ].GetSymbol();
|
||||
SCH_SHEET_PATH* sheetPath = &referencesList[ii].GetSheetPath();
|
||||
SCH_SYMBOL* symbol = referencesList[ ii ].GetSymbol();
|
||||
|
||||
symbol->SetFootprint( sheetPath, footprint );
|
||||
symbol->SetFootprintFieldText( footprint );
|
||||
|
||||
if( aForceVisibilityState )
|
||||
symbol->GetField( FOOTPRINT_FIELD )->SetVisible( aVisibilityState );
|
||||
|
|
|
@ -352,7 +352,7 @@ void BACK_ANNOTATE::applyChangelist()
|
|||
{
|
||||
m_frame->SaveCopyInUndoList( screen, symbol, UNDO_REDO::CHANGED, m_appendUndo );
|
||||
m_appendUndo = true;
|
||||
symbol->SetFootprint( &ref.GetSheetPath(), fpData.m_footprint );
|
||||
symbol->SetFootprintFieldText( fpData.m_footprint );
|
||||
}
|
||||
|
||||
m_reporter.ReportHead( msg, RPT_SEVERITY_ACTION );
|
||||
|
@ -370,7 +370,7 @@ void BACK_ANNOTATE::applyChangelist()
|
|||
{
|
||||
m_frame->SaveCopyInUndoList( screen, symbol, UNDO_REDO::CHANGED, m_appendUndo );
|
||||
m_appendUndo = true;
|
||||
symbol->SetValue( &ref.GetSheetPath(), fpData.m_value );
|
||||
symbol->SetValueFieldText( fpData.m_value );
|
||||
}
|
||||
|
||||
m_reporter.ReportHead( msg, RPT_SEVERITY_ACTION );
|
||||
|
|
|
@ -1668,8 +1668,6 @@ void SCH_EDITOR_CONTROL::updatePastedSymbol( SCH_SYMBOL* aSymbol, SCH_SCREEN* aP
|
|||
|
||||
unit = instance.m_Unit;
|
||||
reference = instance.m_Reference;
|
||||
value = instance.m_Value;
|
||||
footprint = instance.m_Footprint;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1691,12 +1689,9 @@ void SCH_EDITOR_CONTROL::updatePastedSymbol( SCH_SYMBOL* aSymbol, SCH_SCREEN* aP
|
|||
else
|
||||
aSymbol->ClearAnnotation( &aPastePath, false );
|
||||
|
||||
// We might clear annotations but always leave the original unit number, value and footprint
|
||||
// from the paste
|
||||
// We might clear annotations but always leave the original unit number from the paste.
|
||||
aSymbol->SetUnitSelection( &aPastePath, unit );
|
||||
aSymbol->SetUnit( unit );
|
||||
aSymbol->SetValue( &aPastePath, value );
|
||||
aSymbol->SetFootprint( &aPastePath, footprint );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue