From 8bd21edd8a15439d996bad36f2fe6718e5a97fee Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 6 May 2023 23:49:10 +0100 Subject: [PATCH] Fix capitalization of text vars for Eagle importer. Also fixes the test gold files to expect the correct variable references. --- common/plugins/eagle/eagle_parser.cpp | 36 ++++++++++--------- .../MLOEX_GNSS_MOLDED.kicad_mod | 4 +-- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/common/plugins/eagle/eagle_parser.cpp b/common/plugins/eagle/eagle_parser.cpp index 0cac1b773b..f4cd57b3eb 100644 --- a/common/plugins/eagle/eagle_parser.cpp +++ b/common/plugins/eagle/eagle_parser.cpp @@ -49,7 +49,7 @@ wxString escapeName( const wxString& aNetName ) wxString interpretText( const wxString& aText ) { - wxString token = aText.Upper(); + wxString token = aText; if( substituteVariable( &token ) ) return token; @@ -118,22 +118,24 @@ bool substituteVariable( wxString* aText ) { if( aText->StartsWith( '>' ) && aText->AfterFirst( ' ' ).IsEmpty() ) { - if ( *aText == wxT( ">NAME" ) ) *aText = wxT( "${REFERENCE}" ); - else if( *aText == wxT( ">VALUE" ) ) *aText = wxT( "${VALUE}" ); - else if( *aText == wxT( ">PART" ) ) *aText = wxT( "${REFERENCE}" ); - else if( *aText == wxT( ">GATE" ) ) *aText = wxT( "${UNIT}" ); - else if( *aText == wxT( ">MODULE" ) ) *aText = wxT( "${FOOTPRINT_NAME}" ); - else if( *aText == wxT( ">SHEETNR" ) ) *aText = wxT( "${#}" ); - else if( *aText == wxT( ">SHEETS" ) ) *aText = wxT( "${##}" ); - else if( *aText == wxT( ">SHEET" ) ) *aText = wxT( "${#}/${##}" ); - else if( *aText == wxT( ">SHEETNR_TOTAL" ) ) *aText = wxT( "${#}" ); - else if( *aText == wxT( ">SHEETS_TOTAL" ) ) *aText = wxT( "${##}" ); - else if( *aText == wxT( ">SHEET_TOTAL" ) ) *aText = wxT( "${#}/${##}" ); - else if( *aText == wxT( ">SHEET_HEADLINE" ) ) *aText = wxT( "${SHEETNAME}" ); - else if( *aText == wxT( ">ASSEMBLY_VARIANT" ) ) *aText = wxT( "${ASSEMBLY_VARIANT}" ); - else if( *aText == wxT( ">DRAWING_NAME" ) ) *aText = wxT( "${PROJECTNAME}" ); - else if( *aText == wxT( ">LAST_DATE_TIME" ) ) *aText = wxT( "${CURRENT_DATE}" ); - else if( *aText == wxT( ">PLOT_DATE_TIME" ) ) *aText = wxT( "${CURRENT_DATE}" ); + wxString token = aText->Upper(); + + if ( token == wxT( ">NAME" ) ) *aText = wxT( "${REFERENCE}" ); + else if( token == wxT( ">VALUE" ) ) *aText = wxT( "${VALUE}" ); + else if( token == wxT( ">PART" ) ) *aText = wxT( "${REFERENCE}" ); + else if( token == wxT( ">GATE" ) ) *aText = wxT( "${UNIT}" ); + else if( token == wxT( ">MODULE" ) ) *aText = wxT( "${FOOTPRINT_NAME}" ); + else if( token == wxT( ">SHEETNR" ) ) *aText = wxT( "${#}" ); + else if( token == wxT( ">SHEETS" ) ) *aText = wxT( "${##}" ); + else if( token == wxT( ">SHEET" ) ) *aText = wxT( "${#}/${##}" ); + else if( token == wxT( ">SHEETNR_TOTAL" ) ) *aText = wxT( "${#}" ); + else if( token == wxT( ">SHEETS_TOTAL" ) ) *aText = wxT( "${##}" ); + else if( token == wxT( ">SHEET_TOTAL" ) ) *aText = wxT( "${#}/${##}" ); + else if( token == wxT( ">SHEET_HEADLINE" ) ) *aText = wxT( "${SHEETNAME}" ); + else if( token == wxT( ">ASSEMBLY_VARIANT" ) ) *aText = wxT( "${ASSEMBLY_VARIANT}" ); + else if( token == wxT( ">DRAWING_NAME" ) ) *aText = wxT( "${PROJECTNAME}" ); + else if( token == wxT( ">LAST_DATE_TIME" ) ) *aText = wxT( "${CURRENT_DATE}" ); + else if( token == wxT( ">PLOT_DATE_TIME" ) ) *aText = wxT( "${CURRENT_DATE}" ); else *aText = wxString::Format( wxS( "${%s}" ), aText->Mid( 1 ).Trim() ); return true; diff --git a/qa/data/pcbnew/plugins/eagle/lbr/SparkFun-GPS.pretty/MLOEX_GNSS_MOLDED.kicad_mod b/qa/data/pcbnew/plugins/eagle/lbr/SparkFun-GPS.pretty/MLOEX_GNSS_MOLDED.kicad_mod index 0cf0817145..33be890444 100644 --- a/qa/data/pcbnew/plugins/eagle/lbr/SparkFun-GPS.pretty/MLOEX_GNSS_MOLDED.kicad_mod +++ b/qa/data/pcbnew/plugins/eagle/lbr/SparkFun-GPS.pretty/MLOEX_GNSS_MOLDED.kicad_mod @@ -8,11 +8,11 @@ (effects (font (size 0.184 0.184) (thickness 0.016))) (tstamp 09737abe-d1bb-440e-953b-7612025ab13d) ) - (fp_text user ">tName" (at -1.27 1.27) (layer "F.SilkS") + (fp_text user "${tName}" (at -1.27 1.27) (layer "F.SilkS") (effects (font (size 0.184 0.184) (thickness 0.016))) (tstamp 057cb804-7c98-4ec3-a7d5-e64114b95abe) ) - (fp_text user ">tValue" (at -1.27 1.651) (layer "F.Fab") + (fp_text user "${tValue}" (at -1.27 1.651) (layer "F.Fab") (effects (font (size 0.184 0.184) (thickness 0.016))) (tstamp eec82342-98a4-48d0-9a4e-c46398ef4b2d) )