Expunge default symbol instance from schematic file format.
Now that importing hierarchical sheets "properly" imports instance data, the default symbol instance setting doesn't have any meaning.
This commit is contained in:
parent
6ed3618ce5
commit
a11c40197f
|
@ -381,18 +381,6 @@ bool DIALOG_SHEET_PROPERTIES::TransferDataFromWindow()
|
|||
if( m_sheet->IsNew() )
|
||||
{
|
||||
m_sheet->AddInstance( instance );
|
||||
|
||||
if( filename_changed )
|
||||
{
|
||||
// Set the symbol instance data to the default for all new sheets and sub-sheets.
|
||||
SCH_SHEET_LIST newInstances( m_sheet );
|
||||
|
||||
for( SCH_SHEET_PATH& newInstance : newInstances )
|
||||
{
|
||||
instance = m_frame->GetCurrentSheet() + newInstance;
|
||||
instance.SetSymbolInstancesToDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_sheet->SetPageNumber( instance, m_pageNumberTextCtrl->GetValue() );
|
||||
|
|
|
@ -797,18 +797,6 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
|
|||
}
|
||||
}
|
||||
|
||||
if( m_cbMakeDefaultInstance->IsChecked() )
|
||||
{
|
||||
SYMBOL_INSTANCE_REFERENCE defaultInstance;
|
||||
|
||||
defaultInstance.m_Unit = unit_selection;
|
||||
defaultInstance.m_Reference = m_fields->at( REFERENCE_FIELD ).GetText();
|
||||
defaultInstance.m_Value = m_fields->at( VALUE_FIELD ).GetText();
|
||||
defaultInstance.m_Footprint = m_fields->at( FOOTPRINT_FIELD ).GetText();
|
||||
|
||||
m_symbol->SetDefaultInstance( defaultInstance );
|
||||
}
|
||||
|
||||
currentScreen->Append( m_symbol );
|
||||
GetParent()->TestDanglingEnds();
|
||||
GetParent()->UpdateItem( m_symbol, false, true );
|
||||
|
|
|
@ -143,11 +143,6 @@ DIALOG_SYMBOL_PROPERTIES_BASE::DIALOG_SYMBOL_PROPERTIES_BASE( wxWindow* parent,
|
|||
|
||||
gbSizer1->Add( m_cbAlternateSymbol, wxGBPosition( 1, 0 ), wxGBSpan( 1, 2 ), wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
|
||||
m_cbMakeDefaultInstance = new wxCheckBox( sbGeneralProps->GetStaticBox(), wxID_ANY, _("Default for all sheet instances"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_cbMakeDefaultInstance->SetToolTip( _("Check to make the unit and reference, value, and\nfootprint fields the default for all sheet instances\nof this symbol") );
|
||||
|
||||
gbSizer1->Add( m_cbMakeDefaultInstance, wxGBPosition( 2, 0 ), wxGBSpan( 1, 2 ), wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_orientationLabel = new wxStaticText( sbGeneralProps->GetStaticBox(), wxID_ANY, _("Angle:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_orientationLabel->Wrap( -1 );
|
||||
gbSizer1->Add( m_orientationLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
|
||||
|
|
|
@ -848,73 +848,6 @@
|
|||
<event name="OnCheckBox">OnCheckBox</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="gbsizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="colspan">2</property>
|
||||
<property name="column">0</property>
|
||||
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
|
||||
<property name="row">2</property>
|
||||
<property name="rowspan">1</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="checked">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Default for all sheet instances</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_cbMakeDefaultInstance</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip">Check to make the unit and reference, value, and
footprint fields the default for all sheet instances
of this symbol</property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="gbsizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="colspan">1</property>
|
||||
|
|
|
@ -56,7 +56,6 @@ class DIALOG_SYMBOL_PROPERTIES_BASE : public DIALOG_SHIM
|
|||
wxStaticText* m_unitLabel;
|
||||
wxChoice* m_unitChoice;
|
||||
wxCheckBox* m_cbAlternateSymbol;
|
||||
wxCheckBox* m_cbMakeDefaultInstance;
|
||||
wxStaticText* m_orientationLabel;
|
||||
wxChoice* m_orientationCtrl;
|
||||
wxStaticText* m_mirrorLabel;
|
||||
|
|
|
@ -452,15 +452,6 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||
sheetList.UpdateSymbolInstances( Schematic().RootScreen()->GetSymbolInstances() );
|
||||
|
||||
sheetList.UpdateSheetInstances( Schematic().RootScreen()->GetSheetInstances() );
|
||||
|
||||
for( SCH_SCREEN* screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
|
||||
{
|
||||
if( screen->GetFileFormatVersionAtLoad() <= 20220622 )
|
||||
{
|
||||
if( screen->AllSymbolDefaultInstancesNotSet() )
|
||||
screen->SetAllSymbolDefaultInstances();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Schematic().ConnectionGraph()->Reset();
|
||||
|
|
|
@ -89,4 +89,5 @@
|
|||
//#define SEXPR_SCHEMATIC_FILE_VERSION 20220904 // Do not autoplace field option
|
||||
//#define SEXPR_SCHEMATIC_FILE_VERSION 20220914 // Add support for DNP
|
||||
//#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 20221002 // Move instance data back into symbol definition.
|
||||
#define SEXPR_SCHEMATIC_FILE_VERSION 20221004 // Move instance data back into symbol definition.
|
||||
|
|
|
@ -2678,7 +2678,6 @@ SCH_SYMBOL* SCH_SEXPR_PARSER::parseSchematicSymbol()
|
|||
}
|
||||
}
|
||||
|
||||
symbol->SetDefaultInstance( defaultInstance );
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -653,6 +653,9 @@ void SCH_SEXPR_PLUGIN::saveSymbol( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aSheetPa
|
|||
{
|
||||
wxCHECK_RET( aSymbol != nullptr && m_out != nullptr, "" );
|
||||
|
||||
// Sort symbol instance data to minimize file churn.
|
||||
aSymbol->SortInstances( SortSymbolInstancesByProjectUuid );
|
||||
|
||||
std::string libName;
|
||||
|
||||
wxString symbol_name = aSymbol->GetLibId().Format();
|
||||
|
@ -732,24 +735,6 @@ void SCH_SEXPR_PLUGIN::saveSymbol( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aSheetPa
|
|||
|
||||
m_out->Print( aNestLevel + 1, "(uuid %s)\n", TO_UTF8( aSymbol->m_Uuid.AsString() ) );
|
||||
|
||||
// On the first save, if the default instance is not set, use the first instance data as
|
||||
// the default.
|
||||
if( aSymbol->GetDefaultInstance().m_Reference == wxEmptyString &&
|
||||
aSymbol->GetDefaultInstance().m_Unit == -1 &&
|
||||
aSymbol->GetDefaultInstance().m_Value == wxEmptyString &&
|
||||
aSymbol->GetDefaultInstance().m_Footprint == wxEmptyString )
|
||||
{
|
||||
if( !aSymbol->GetInstanceReferences().empty() )
|
||||
aSymbol->SetDefaultInstance( aSymbol->GetInstanceReferences()[0] );
|
||||
}
|
||||
|
||||
m_out->Print( aNestLevel + 1,
|
||||
"(default_instance (reference %s) (unit %d) (value %s) (footprint %s))\n",
|
||||
m_out->Quotew( aSymbol->GetDefaultInstance().m_Reference ).c_str(),
|
||||
aSymbol->GetDefaultInstance().m_Unit,
|
||||
m_out->Quotew( aSymbol->GetDefaultInstance().m_Value ).c_str(),
|
||||
m_out->Quotew( aSymbol->GetDefaultInstance().m_Footprint ).c_str() );
|
||||
|
||||
m_nextFreeFieldId = MANDATORY_FIELDS;
|
||||
|
||||
for( SCH_FIELD& field : aSymbol->GetFields() )
|
||||
|
@ -757,21 +742,21 @@ void SCH_SEXPR_PLUGIN::saveSymbol( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aSheetPa
|
|||
int id = field.GetId();
|
||||
wxString value = field.GetText();
|
||||
|
||||
if( !aForClipboard )
|
||||
if( !aForClipboard && aSymbol->GetInstanceReferences().size() )
|
||||
{
|
||||
// The instance fields are always set to the default instance regardless of the
|
||||
// sheet instance to prevent file churn.
|
||||
if( id == REFERENCE_FIELD )
|
||||
{
|
||||
field.SetText( aSymbol->GetDefaultInstance().m_Reference );
|
||||
field.SetText( aSymbol->GetInstanceReferences()[0].m_Reference );
|
||||
}
|
||||
else if( id == VALUE_FIELD )
|
||||
{
|
||||
field.SetText( aSymbol->GetDefaultInstance().m_Value );
|
||||
field.SetText( aSymbol->GetInstanceReferences()[0].m_Value );
|
||||
}
|
||||
else if( id == FOOTPRINT_FIELD )
|
||||
{
|
||||
field.SetText( aSymbol->GetDefaultInstance().m_Footprint );
|
||||
field.SetText( aSymbol->GetInstanceReferences()[0].m_Footprint );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -811,14 +796,10 @@ void SCH_SEXPR_PLUGIN::saveSymbol( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aSheetPa
|
|||
|
||||
m_out->Print( aNestLevel + 1, "(instances\n" );
|
||||
|
||||
// Sort symbol instance data to minimize file churn.
|
||||
std::vector< SYMBOL_INSTANCE_REFERENCE > sortedInstances( aSymbol->GetInstanceReferences() );
|
||||
std::sort( sortedInstances.begin(), sortedInstances.end(), SortSymbolInstancesByProjectUuid );
|
||||
|
||||
KIID lastProjectUuid;
|
||||
SCH_SHEET_LIST fullHierarchy = m_schematic->GetSheets();
|
||||
|
||||
for( size_t i = 0; i < sortedInstances.size(); i++ )
|
||||
for( size_t i = 0; i < aSymbol->GetInstanceReferences().size(); i++ )
|
||||
{
|
||||
// If the instance data is part of this design but no longer has an associated sheet
|
||||
// path, don't save it. This prevents large amounts of orphaned instance data for the
|
||||
|
@ -826,42 +807,42 @@ void SCH_SEXPR_PLUGIN::saveSymbol( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aSheetPa
|
|||
//
|
||||
// Keep all instance data when copying to the clipboard. It may be needed on paste.
|
||||
if( !aForClipboard
|
||||
&& ( sortedInstances[i].m_Path[0] == m_schematic->RootScreen()->GetUuid() )
|
||||
&& !fullHierarchy.GetSheetPathByKIIDPath( sortedInstances[i].m_Path ) )
|
||||
&& ( aSymbol->GetInstanceReferences()[i].m_Path[0] == m_schematic->RootScreen()->GetUuid() )
|
||||
&& !fullHierarchy.GetSheetPathByKIIDPath( aSymbol->GetInstanceReferences()[i].m_Path ) )
|
||||
{
|
||||
if( ( i + 1 == sortedInstances.size() )
|
||||
|| lastProjectUuid != sortedInstances[i+1].m_Path[0] )
|
||||
if( ( i + 1 == aSymbol->GetInstanceReferences().size() )
|
||||
|| lastProjectUuid != aSymbol->GetInstanceReferences()[i+1].m_Path[0] )
|
||||
m_out->Print( aNestLevel + 2, ")\n" ); // Closes `project`.
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if( lastProjectUuid != sortedInstances[i].m_Path[0] )
|
||||
if( lastProjectUuid != aSymbol->GetInstanceReferences()[i].m_Path[0] )
|
||||
{
|
||||
wxString projectName;
|
||||
|
||||
if( sortedInstances[i].m_Path[0] == m_schematic->RootScreen()->GetUuid() )
|
||||
if( aSymbol->GetInstanceReferences()[i].m_Path[0] == m_schematic->RootScreen()->GetUuid() )
|
||||
projectName = m_schematic->Prj().GetProjectName();
|
||||
else
|
||||
projectName = sortedInstances[i].m_ProjectName;
|
||||
projectName = aSymbol->GetInstanceReferences()[i].m_ProjectName;
|
||||
|
||||
lastProjectUuid = sortedInstances[i].m_Path[0];
|
||||
lastProjectUuid = aSymbol->GetInstanceReferences()[i].m_Path[0];
|
||||
m_out->Print( aNestLevel + 2, "(project %s\n", m_out->Quotew( projectName ).c_str() );
|
||||
}
|
||||
|
||||
wxString path = sortedInstances[i].m_Path.AsString();
|
||||
wxString path = aSymbol->GetInstanceReferences()[i].m_Path.AsString();
|
||||
|
||||
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->Quotew( sortedInstances[i].m_Reference ).c_str(),
|
||||
sortedInstances[i].m_Unit,
|
||||
m_out->Quotew( sortedInstances[i].m_Value ).c_str(),
|
||||
m_out->Quotew( sortedInstances[i].m_Footprint ).c_str() );
|
||||
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() );
|
||||
m_out->Print( aNestLevel + 3, ")\n" );
|
||||
|
||||
if( ( i + 1 == sortedInstances.size() )
|
||||
|| lastProjectUuid != sortedInstances[i+1].m_Path[0] )
|
||||
if( ( i + 1 == aSymbol->GetInstanceReferences().size() )
|
||||
|| lastProjectUuid != aSymbol->GetInstanceReferences()[i+1].m_Path[0] )
|
||||
m_out->Print( aNestLevel + 2, ")\n" ); // Closes `project`.
|
||||
}
|
||||
|
||||
|
|
|
@ -1441,46 +1441,6 @@ void SCH_SCREEN::SetLegacySymbolInstanceData()
|
|||
}
|
||||
|
||||
|
||||
bool SCH_SCREEN::AllSymbolDefaultInstancesNotSet()
|
||||
{
|
||||
for( SCH_ITEM* item : Items().OfType( SCH_SYMBOL_T ) )
|
||||
{
|
||||
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
|
||||
|
||||
wxCHECK2( symbol, continue );
|
||||
|
||||
SYMBOL_INSTANCE_REFERENCE symbolDefaultReference = symbol->GetDefaultInstance();
|
||||
|
||||
const std::unique_ptr<LIB_SYMBOL>& libSymbol = symbol->GetLibSymbolRef();
|
||||
|
||||
if( !libSymbol )
|
||||
continue;
|
||||
|
||||
if( symbolDefaultReference.m_Unit != 1 ||
|
||||
symbolDefaultReference.m_Reference != symbol->GetPrefix() ||
|
||||
symbolDefaultReference.m_Value != libSymbol->GetValueField().GetText() ||
|
||||
symbolDefaultReference.m_Footprint != libSymbol->GetFootprintField().GetText() )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void SCH_SCREEN::SetAllSymbolDefaultInstances()
|
||||
{
|
||||
for( SCH_ITEM* item : Items().OfType( SCH_SYMBOL_T ) )
|
||||
{
|
||||
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
|
||||
|
||||
wxCHECK2( symbol, continue );
|
||||
|
||||
if( !symbol->GetInstanceReferences().empty() )
|
||||
symbol->SetDefaultInstance( symbol->GetInstanceReferences()[0] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
void SCH_SCREEN::Show( int nestLevel, std::ostream& os ) const
|
||||
{
|
||||
|
@ -1864,7 +1824,7 @@ void SCH_SCREENS::BuildClientSheetPathList()
|
|||
{
|
||||
SCH_SCREEN* used_screen = sheetpath.LastScreen();
|
||||
|
||||
// SEarch for the used_screen in list and add this unique sheet path:
|
||||
// Search for the used_screen in list and add this unique sheet path:
|
||||
for( SCH_SCREEN* curr_screen = GetFirst(); curr_screen; curr_screen = GetNext() )
|
||||
{
|
||||
if( used_screen == curr_screen )
|
||||
|
@ -1879,20 +1839,6 @@ void SCH_SCREENS::BuildClientSheetPathList()
|
|||
|
||||
void SCH_SCREENS::SetLegacySymbolInstanceData()
|
||||
{
|
||||
|
||||
for( SCH_SCREEN* screen = GetFirst(); screen; screen = GetNext() )
|
||||
screen->SetLegacySymbolInstanceData();
|
||||
}
|
||||
|
||||
|
||||
void SCH_SCREENS::SetAllSymbolDefaultInstances()
|
||||
{
|
||||
for( SCH_SCREEN* screen = GetFirst(); screen; screen = GetNext() )
|
||||
{
|
||||
if( screen->GetFileFormatVersionAtLoad() <= 20220622 )
|
||||
{
|
||||
if( screen->AllSymbolDefaultInstancesNotSet() )
|
||||
screen->SetAllSymbolDefaultInstances();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -509,13 +509,6 @@ public:
|
|||
*/
|
||||
bool AllSymbolDefaultInstancesNotSet();
|
||||
|
||||
/**
|
||||
* Set symbol default instances to the first instance in the instance list.
|
||||
*
|
||||
* @warning The schematic symbol instance data must be loaded before this method is called.
|
||||
*/
|
||||
void SetAllSymbolDefaultInstances();
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const override;
|
||||
#endif
|
||||
|
@ -739,13 +732,6 @@ public:
|
|||
*/
|
||||
void SetLegacySymbolInstanceData();
|
||||
|
||||
/**
|
||||
* Set symbol default instances to the first instance in the instance list.
|
||||
*
|
||||
* @warning The schematic symbol instance data must be loaded before this method is called.
|
||||
*/
|
||||
void SetAllSymbolDefaultInstances();
|
||||
|
||||
private:
|
||||
void addScreenToList( SCH_SCREEN* aScreen, SCH_SHEET* aSheet );
|
||||
void buildScreenList( SCH_SHEET* aSheet);
|
||||
|
|
|
@ -414,19 +414,6 @@ void SCH_SHEET_PATH::AppendMultiUnitSymbol( SCH_MULTI_UNIT_REFERENCE_MAP& aRefLi
|
|||
}
|
||||
|
||||
|
||||
void SCH_SHEET_PATH::SetSymbolInstancesToDefault()
|
||||
{
|
||||
for( SCH_ITEM* item : LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
||||
{
|
||||
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
|
||||
|
||||
wxCHECK2( symbol, continue );
|
||||
|
||||
symbol->SetInstanceToDefault( *this );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool SCH_SHEET_PATH::operator==( const SCH_SHEET_PATH& d1 ) const
|
||||
{
|
||||
return m_current_hash == d1.GetCurrentHash();
|
||||
|
|
|
@ -339,11 +339,6 @@ public:
|
|||
void GetMultiUnitSymbols( SCH_MULTI_UNIT_REFERENCE_MAP &aRefList,
|
||||
bool aIncludePowerSymbols = true ) const;
|
||||
|
||||
/**
|
||||
* Set all of the symbol instances in this sheet instance to the default symbol instance data.
|
||||
*/
|
||||
void SetSymbolInstancesToDefault();
|
||||
|
||||
/**
|
||||
* Test the SCH_SHEET_PATH file names to check adding the sheet stored in the file
|
||||
* \a aSrcFileName to the sheet stored in file \a aDestFileName will cause a sheet
|
||||
|
|
|
@ -132,9 +132,6 @@ SCH_SYMBOL::SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId,
|
|||
|
||||
m_prefix = UTIL::GetRefDesPrefix( m_part->GetReferenceField().GetText() );
|
||||
|
||||
// Set initial default symbol instance data from library symbol and initial unit.
|
||||
m_defaultInstance.m_Unit = -1;
|
||||
|
||||
if( aSheet )
|
||||
{
|
||||
SetRef( aSheet, UTIL::GetRefDesUnannotated( m_prefix ) );
|
||||
|
@ -199,7 +196,6 @@ SCH_SYMBOL::SCH_SYMBOL( const SCH_SYMBOL& aSymbol ) :
|
|||
|
||||
m_fieldsAutoplaced = aSymbol.m_fieldsAutoplaced;
|
||||
m_schLibSymbolName = aSymbol.m_schLibSymbolName;
|
||||
m_defaultInstance = aSymbol.m_defaultInstance;
|
||||
}
|
||||
|
||||
|
||||
|
@ -522,6 +518,13 @@ void SCH_SYMBOL::RemoveInstance( const SCH_SHEET_PATH& aInstancePath )
|
|||
}
|
||||
|
||||
|
||||
void SCH_SYMBOL::SortInstances( bool (*aSortFunction)( const SYMBOL_INSTANCE_REFERENCE& aLhs,
|
||||
const SYMBOL_INSTANCE_REFERENCE& aRhs ) )
|
||||
{
|
||||
std::sort( m_instanceReferences.begin(), m_instanceReferences.end(), aSortFunction );
|
||||
}
|
||||
|
||||
|
||||
void SCH_SYMBOL::AddHierarchicalReference( const KIID_PATH& aPath, const wxString& aRef,
|
||||
int aUnit, const wxString& aValue,
|
||||
const wxString& aFootprint )
|
||||
|
@ -1144,7 +1147,6 @@ void SCH_SYMBOL::SwapData( SCH_ITEM* aItem )
|
|||
|
||||
std::swap( m_instanceReferences, symbol->m_instanceReferences );
|
||||
std::swap( m_schLibSymbolName, symbol->m_schLibSymbolName );
|
||||
std::swap( m_defaultInstance, symbol->m_defaultInstance );
|
||||
}
|
||||
|
||||
|
||||
|
@ -2042,7 +2044,6 @@ SCH_SYMBOL& SCH_SYMBOL::operator=( const SCH_ITEM& aItem )
|
|||
m_transform = c->m_transform;
|
||||
|
||||
m_instanceReferences = c->m_instanceReferences;
|
||||
m_defaultInstance = c->m_defaultInstance;
|
||||
|
||||
m_fields = c->m_fields; // std::vector's assignment operator
|
||||
|
||||
|
@ -2255,25 +2256,3 @@ bool SCH_SYMBOL::IsPointClickableAnchor( const VECTOR2I& aPos ) const
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void SCH_SYMBOL::SetInstanceToDefault( const SCH_SHEET_PATH& aInstance )
|
||||
{
|
||||
KIID_PATH path = aInstance.Path();
|
||||
|
||||
for( SYMBOL_INSTANCE_REFERENCE& instance: m_instanceReferences )
|
||||
{
|
||||
if( instance.m_Path == path )
|
||||
{
|
||||
instance.m_Reference = m_defaultInstance.m_Reference;
|
||||
instance.m_Unit = m_defaultInstance.m_Unit;
|
||||
instance.m_Value = m_defaultInstance.m_Value;
|
||||
instance.m_Footprint = m_defaultInstance.m_Footprint;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// It's a new instance so add it.
|
||||
AddHierarchicalReference( path, m_defaultInstance.m_Reference, m_defaultInstance.m_Unit,
|
||||
m_defaultInstance.m_Value, m_defaultInstance.m_Footprint );
|
||||
}
|
||||
|
|
|
@ -144,16 +144,10 @@ public:
|
|||
bool GetInstance( SYMBOL_INSTANCE_REFERENCE& aInstance,
|
||||
const KIID_PATH& aSheetPath ) const;
|
||||
|
||||
void SetDefaultInstance( const SYMBOL_INSTANCE_REFERENCE& aInstance )
|
||||
{
|
||||
m_defaultInstance = aInstance;
|
||||
}
|
||||
|
||||
void RemoveInstance( const SCH_SHEET_PATH& aInstancePath );
|
||||
|
||||
const SYMBOL_INSTANCE_REFERENCE& GetDefaultInstance() const { return m_defaultInstance; }
|
||||
|
||||
void SetInstanceToDefault( const SCH_SHEET_PATH& aInstance );
|
||||
void SortInstances( bool ( *aSortFunction )( const SYMBOL_INSTANCE_REFERENCE& aLhs,
|
||||
const SYMBOL_INSTANCE_REFERENCE& aRhs ) );
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
|
@ -802,16 +796,6 @@ private:
|
|||
// Defines the hierarchical path and reference of the symbol. This allows support
|
||||
// for multiple references to a single sub-sheet.
|
||||
std::vector<SYMBOL_INSTANCE_REFERENCE> m_instanceReferences;
|
||||
|
||||
/**
|
||||
* The default instance data for this symbol.
|
||||
*
|
||||
* This allows for setting the default data across all instances of this symbol. This
|
||||
* means that any reuse of the symbol in the current schematic will initially use the
|
||||
* default instance data. @see SYMBOL_INSTANCE_REFERENCE definition for the allowable
|
||||
* instance settings.
|
||||
*/
|
||||
SYMBOL_INSTANCE_REFERENCE m_defaultInstance;
|
||||
};
|
||||
|
||||
#endif /* __SYMBOL_H__ */
|
||||
|
|
|
@ -493,12 +493,6 @@ bool SCH_EDIT_FRAME::LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHier
|
|||
// instances.
|
||||
sheetHierarchy.UpdateSymbolInstances( newScreen->GetSymbolInstances() );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otherwise, fall back to the default instance data which still exists in this
|
||||
// schematic file version.
|
||||
newScreens.SetAllSymbolDefaultInstances();
|
||||
}
|
||||
}
|
||||
|
||||
// Attempt to create new symbol instances using the instance data loaded above.
|
||||
|
|
Loading…
Reference in New Issue