Always include unit number when copying to clipboard
Fixes https://gitlab.com/kicad/code/kicad/issues/5898 (A)
This commit is contained in:
parent
4619d5e112
commit
4bcd56b1f6
|
@ -636,7 +636,7 @@ void SCH_SEXPR_PLUGIN::Format( SCH_SHEET* aSheet )
|
||||||
{
|
{
|
||||||
case SCH_COMPONENT_T:
|
case SCH_COMPONENT_T:
|
||||||
m_out->Print( 0, "\n" );
|
m_out->Print( 0, "\n" );
|
||||||
saveSymbol( static_cast<SCH_COMPONENT*>( item ), 1 );
|
saveSymbol( static_cast<SCH_COMPONENT*>( item ), nullptr, 1 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCH_BITMAP_T:
|
case SCH_BITMAP_T:
|
||||||
|
@ -776,7 +776,8 @@ void SCH_SEXPR_PLUGIN::Format( SCH_SHEET* aSheet )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SEXPR_PLUGIN::Format( EE_SELECTION* aSelection, OUTPUTFORMATTER* aFormatter )
|
void SCH_SEXPR_PLUGIN::Format( EE_SELECTION* aSelection, SCH_SHEET_PATH* aSheetPath,
|
||||||
|
OUTPUTFORMATTER* aFormatter )
|
||||||
{
|
{
|
||||||
wxCHECK( aSelection && aFormatter, /* void */ );
|
wxCHECK( aSelection && aFormatter, /* void */ );
|
||||||
|
|
||||||
|
@ -830,7 +831,7 @@ void SCH_SEXPR_PLUGIN::Format( EE_SELECTION* aSelection, OUTPUTFORMATTER* aForma
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
case SCH_COMPONENT_T:
|
case SCH_COMPONENT_T:
|
||||||
saveSymbol( static_cast< SCH_COMPONENT* >( item ), 0 );
|
saveSymbol( static_cast<SCH_COMPONENT*>( item ), aSheetPath, 0 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCH_BITMAP_T:
|
case SCH_BITMAP_T:
|
||||||
|
@ -872,7 +873,8 @@ void SCH_SEXPR_PLUGIN::Format( EE_SELECTION* aSelection, OUTPUTFORMATTER* aForma
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SEXPR_PLUGIN::saveSymbol( SCH_COMPONENT* aSymbol, int aNestLevel )
|
void SCH_SEXPR_PLUGIN::saveSymbol( SCH_COMPONENT* aSymbol, SCH_SHEET_PATH* aSheetPath,
|
||||||
|
int aNestLevel )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( aSymbol != nullptr && m_out != nullptr, "" );
|
wxCHECK_RET( aSymbol != nullptr && m_out != nullptr, "" );
|
||||||
|
|
||||||
|
@ -934,8 +936,14 @@ void SCH_SEXPR_PLUGIN::saveSymbol( SCH_COMPONENT* aSymbol, int aNestLevel )
|
||||||
m_out->Print( 0, ")" );
|
m_out->Print( 0, ")" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int unit = -1;
|
||||||
|
|
||||||
if( !( aSymbol->GetInstanceReferences().size() > 1 ) )
|
if( !( aSymbol->GetInstanceReferences().size() > 1 ) )
|
||||||
m_out->Print( 0, " (unit %d)", aSymbol->GetUnit() );
|
unit = aSymbol->GetUnit();
|
||||||
|
else if( aSheetPath != nullptr )
|
||||||
|
unit = aSymbol->GetUnitSelection( aSheetPath );
|
||||||
|
if ( unit >= 0 )
|
||||||
|
m_out->Print( 0, " (unit %d)", unit );
|
||||||
|
|
||||||
if( aSymbol->GetConvert() == LIB_ITEM::LIB_CONVERT::DEMORGAN )
|
if( aSymbol->GetConvert() == LIB_ITEM::LIB_CONVERT::DEMORGAN )
|
||||||
m_out->Print( 0, " (convert %d)", aSymbol->GetConvert() );
|
m_out->Print( 0, " (convert %d)", aSymbol->GetConvert() );
|
||||||
|
|
|
@ -96,7 +96,8 @@ public:
|
||||||
|
|
||||||
void Format( SCH_SHEET* aSheet );
|
void Format( SCH_SHEET* aSheet );
|
||||||
|
|
||||||
void Format( EE_SELECTION* aSelection, OUTPUTFORMATTER* aFormatter );
|
void Format( EE_SELECTION* aSelection, SCH_SHEET_PATH* aSheetPath,
|
||||||
|
OUTPUTFORMATTER* aFormatter );
|
||||||
|
|
||||||
void EnumerateSymbolLib( wxArrayString& aSymbolNameList,
|
void EnumerateSymbolLib( wxArrayString& aSymbolNameList,
|
||||||
const wxString& aLibraryPath,
|
const wxString& aLibraryPath,
|
||||||
|
@ -130,7 +131,7 @@ private:
|
||||||
void loadHierarchy( SCH_SHEET* aSheet );
|
void loadHierarchy( SCH_SHEET* aSheet );
|
||||||
void loadFile( const wxString& aFileName, SCH_SHEET* aSheet );
|
void loadFile( const wxString& aFileName, SCH_SHEET* aSheet );
|
||||||
|
|
||||||
void saveSymbol( SCH_COMPONENT* aComponent, int aNestLevel );
|
void saveSymbol( SCH_COMPONENT* aComponent, SCH_SHEET_PATH* aSheetPath, int aNestLevel );
|
||||||
void saveField( SCH_FIELD* aField, int aNestLevel );
|
void saveField( SCH_FIELD* aField, int aNestLevel );
|
||||||
void saveBitmap( SCH_BITMAP* aBitmap, int aNestLevel );
|
void saveBitmap( SCH_BITMAP* aBitmap, int aNestLevel );
|
||||||
void saveSheet( SCH_SHEET* aSheet, int aNestLevel );
|
void saveSheet( SCH_SHEET* aSheet, int aNestLevel );
|
||||||
|
|
|
@ -1238,7 +1238,7 @@ bool SCH_EDITOR_CONTROL::doCopy()
|
||||||
STRING_FORMATTER formatter;
|
STRING_FORMATTER formatter;
|
||||||
SCH_SEXPR_PLUGIN plugin;
|
SCH_SEXPR_PLUGIN plugin;
|
||||||
|
|
||||||
plugin.Format( &selection, &formatter );
|
plugin.Format( &selection, &m_frame->GetCurrentSheet(), &formatter );
|
||||||
|
|
||||||
return m_toolMgr->SaveClipboard( formatter.GetString() );
|
return m_toolMgr->SaveClipboard( formatter.GetString() );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue