From cb1709b4cac73469d2224bd6a3148a1fbfbdbe27 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 27 Oct 2021 13:48:49 +0100 Subject: [PATCH] Improve Eagle importer's label positioning. Fixes https://gitlab.com/kicad/code/kicad/issues/9466 --- eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp b/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp index ea00e7d612..267ff52d18 100644 --- a/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp +++ b/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp @@ -1120,7 +1120,12 @@ void SCH_EAGLE_PLUGIN::loadSegments( wxXmlNode* aSegmentsNode, const wxString& n label->SetPosition( firstWire->GetStartPoint() ); label->SetText( escapeName( netName ) ); label->SetTextSize( wxSize( Mils2iu( 40 ), Mils2iu( 40 ) ) ); - label->SetLabelSpinStyle( LABEL_SPIN_STYLE::LEFT ); + + if( firstWire->GetEndPoint().x > firstWire->GetStartPoint().x ) + label->SetLabelSpinStyle( LABEL_SPIN_STYLE::LEFT ); + else + label->SetLabelSpinStyle( LABEL_SPIN_STYLE::RIGHT ); + screen->Append( label.release() ); } } @@ -2926,7 +2931,15 @@ void SCH_EAGLE_PLUGIN::addImplicitConnections( SCH_SYMBOL* aSymbol, SCH_SCREEN* netLabel->SetPosition( aSymbol->GetPinPhysicalPosition( pin ) ); netLabel->SetText( extractNetName( pin->GetName() ) ); netLabel->SetTextSize( wxSize( Mils2iu( 40 ), Mils2iu( 40 ) ) ); - netLabel->SetLabelSpinStyle( LABEL_SPIN_STYLE::LEFT ); + + switch( pin->GetOrientation() ) + { + case PIN_LEFT: netLabel->SetLabelSpinStyle( LABEL_SPIN_STYLE::RIGHT ); break; + case PIN_RIGHT: netLabel->SetLabelSpinStyle( LABEL_SPIN_STYLE::LEFT ); break; + case PIN_UP: netLabel->SetLabelSpinStyle( LABEL_SPIN_STYLE::UP ); break; + case PIN_DOWN: netLabel->SetLabelSpinStyle( LABEL_SPIN_STYLE::BOTTOM ); break; + } + aScreen->Append( netLabel ); } }