Add wire and bus popups for PDF export.

Fixes https://gitlab.com/kicad/code/kicad/issues/12157
This commit is contained in:
Jeff Young 2022-09-06 00:21:19 +01:00
parent 8afc1db7a6
commit 59dc6c8e45
2 changed files with 44 additions and 2 deletions

View File

@ -838,6 +838,43 @@ void SCH_LINE::Plot( PLOTTER* aPlotter, bool aBackground ) const
aPlotter->FinishTo( m_end );
aPlotter->SetDash( penWidth, PLOT_DASH_TYPE::SOLID );
if( SCHEMATIC* schematic = Schematic() )
{
std::vector<wxString> properties;
BOX2I bbox = GetBoundingBox();
bbox.Inflate( GetPenWidth() * 3 );
if( GetLayer() == LAYER_WIRE )
{
if( SCH_CONNECTION* connection = Connection() )
{
auto& netSettings = schematic->Prj().GetProjectFile().m_NetSettings;
wxString netName = connection->Name();
wxString className = netSettings->GetEffectiveNetClass( netName )->GetName();
properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
_( "Net" ),
UnescapeString( netName ) ) );
properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
_( "Net class" ),
UnescapeString( className ) ) );
}
}
else if( GetLayer() == LAYER_BUS )
{
if( SCH_CONNECTION* connection = Connection() )
{
for( std::shared_ptr<SCH_CONNECTION>& member : connection->Members() )
properties.emplace_back( wxT( "!" ) + UnescapeString( member->Name() ) );
}
}
if( !properties.empty() )
aPlotter->HyperlinkMenu( bbox, properties );
}
}

View File

@ -2015,8 +2015,13 @@ void SCH_SYMBOL::Plot( PLOTTER* aPlotter, bool aBackground ) const
field.GetShownText() ) );
}
properties.emplace_back( _( "!Description = " ) + m_part->GetDescription() );
properties.emplace_back( _( "!Keywords = " ) + m_part->GetKeyWords() );
properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
_( "Description" ),
m_part->GetDescription() ) );
properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
_( "Keywords" ),
m_part->GetKeyWords() ) );
aPlotter->HyperlinkMenu( GetBoundingBox(), properties );