diff --git a/common/wildcards_and_files_ext.cpp b/common/wildcards_and_files_ext.cpp index 9149ae229c..fe2c86e223 100644 --- a/common/wildcards_and_files_ext.cpp +++ b/common/wildcards_and_files_ext.cpp @@ -72,7 +72,7 @@ const wxString NetlistFileWildcard( _( "KiCad netlist files (*.net)|*.net" ) ); const wxString GerberFileWildcard( _( "Gerber files (*.pho)|*.pho" ) ); const wxString LegacyPcbFileWildcard( _( "KiCad printed circuit board files (*.brd)|*.brd" ) ); const wxString EaglePcbFileWildcard( _( "Eagle ver. 6.x XML PCB files (*.brd)|*.brd" ) ); -const wxString PCadPcbFileWildcard( _( "P-Cad 2002/2004 ASCII PCB files (*.pcb)|*.pcb" ) ); +const wxString PCadPcbFileWildcard( _( "P-Cad 200x ASCII PCB files (*.pcb)|*.pcb" ) ); const wxString PcbFileWildcard( _( "KiCad s-expr printed circuit board files (*.kicad_pcb)|*.kicad_pcb" ) ); const wxString KiCadFootprintLibFileWildcard( _( "KiCad footprint s-expre library file (*.kicad_mod)|*.kicad_mod" ) ); const wxString KiCadFootprintLibPathWildcard( _( "KiCad footprint s-expre library path (*.pretty)|*.pretty" ) ); diff --git a/eeschema/component_references_lister.cpp b/eeschema/component_references_lister.cpp index 1b02e2573c..df0f97effe 100644 --- a/eeschema/component_references_lister.cpp +++ b/eeschema/component_references_lister.cpp @@ -713,14 +713,14 @@ int SCH_REFERENCE_LIST::CheckAnnotation( wxArrayString* aMessageList ) && ( componentFlatList[ii].m_Unit < 0x7FFFFFFF ) ) { msg.Printf( _( "Item not annotated: %s%s (unit %d)\n" ), - GetChars( componentFlatList[ii].GetRef() ), + GetChars( componentFlatList[ii].GetRef() ), GetChars( tmp ), componentFlatList[ii].m_Unit ); } else { msg.Printf( _( "Item not annotated: %s%s\n" ), - GetChars( componentFlatList[ii].GetRef() ), + GetChars( componentFlatList[ii].GetRef() ), GetChars( tmp ) ); } @@ -782,15 +782,15 @@ int SCH_REFERENCE_LIST::CheckAnnotation( wxArrayString* aMessageList ) if( ( componentFlatList[ii].m_Unit > 0 ) && ( componentFlatList[ii].m_Unit < 0x7FFFFFFF ) ) { - msg.Printf( _( "Multiple item %s%s (unit %d)\n" ), - GetChars( componentFlatList[ii].GetRef() ), + msg.Printf( _( "Multiple item %s%s (unit %d)\n" ), + GetChars( componentFlatList[ii].GetRef() ), GetChars( tmp ), componentFlatList[ii].m_Unit ); } else { msg.Printf( _( "Multiple item %s%s\n" ), - GetChars( componentFlatList[ii].GetRef() ), + GetChars( componentFlatList[ii].GetRef() ), GetChars( tmp ) ); } @@ -814,15 +814,15 @@ int SCH_REFERENCE_LIST::CheckAnnotation( wxArrayString* aMessageList ) if( ( componentFlatList[ii].m_Unit > 0 ) && ( componentFlatList[ii].m_Unit < 0x7FFFFFFF ) ) { - msg.Printf( _( "Multiple item %s%s (unit %d)\n" ), - GetChars( componentFlatList[ii].GetRef() ), + msg.Printf( _( "Multiple item %s%s (unit %d)\n" ), + GetChars( componentFlatList[ii].GetRef() ), GetChars( tmp ), componentFlatList[ii].m_Unit ); } else { msg.Printf( _( "Multiple item %s%s\n" ), - GetChars( componentFlatList[ii].GetRef() ), + GetChars( componentFlatList[ii].GetRef() ), GetChars( tmp ) ); } @@ -837,27 +837,17 @@ int SCH_REFERENCE_LIST::CheckAnnotation( wxArrayString* aMessageList ) if( componentFlatList[ii].CompareValue( componentFlatList[next] ) != 0 ) { -#if defined(KICAD_GOST) - msg.Printf( _( "Different values for %s%d.%d (%s) and %s%d.%d (%s)" ), + msg.Printf( _( "Different values for %s%d%s (%s) and %s%d%s (%s)" ), GetChars( componentFlatList[ii].GetRef() ), componentFlatList[ii].m_NumRef, - componentFlatList[ii].m_Unit, + GetChars( LIB_COMPONENT::ReturnSubReference( + componentFlatList[ii].m_Unit ) ), GetChars( componentFlatList[ii].m_Value->GetText() ), GetChars( componentFlatList[next].GetRef() ), componentFlatList[next].m_NumRef, - componentFlatList[next].m_Unit, - componentFlatList[next].m_Value->GetText().GetData() ); -#else - msg.Printf( _( "Different values for %s%d%c (%s) and %s%d%c (%s)" ), - GetChars( componentFlatList[ii].GetRef() ), - componentFlatList[ii].m_NumRef, - componentFlatList[ii].m_Unit + 'A' - 1, - GetChars( componentFlatList[ii].m_Value->GetText() ), - GetChars( componentFlatList[next].GetRef() ), - componentFlatList[next].m_NumRef, - componentFlatList[next].m_Unit + 'A' - 1, + GetChars( LIB_COMPONENT::ReturnSubReference( + componentFlatList[next].m_Unit ) ), GetChars( componentFlatList[next].m_Value->GetText() ) ); -#endif if( aMessageList ) aMessageList->Add( msg + wxT( "\n" )); diff --git a/include/xnode.h b/include/xnode.h index f5eb6f1e5b..692f2085d6 100644 --- a/include/xnode.h +++ b/include/xnode.h @@ -106,15 +106,19 @@ public: wxString GetAttribute( const wxString& attrName, const wxString& defaultVal ) const { - return GetPropVal(attrName, defaultVal); + return GetPropVal( attrName, defaultVal ); } bool GetAttribute( const wxString& attrName, wxString *value ) const { - return GetPropVal(attrName, value); + return GetPropVal( attrName, value ); } void AddAttribute( const wxString& attrName, const wxString& value ) { - AddProperty(attrName, value); + AddProperty( attrName, value ); + } + bool DeleteAttribute( const wxString& attrName ) + { + DeleteProperty( attrName ); } wxXmlProperty* GetAttributes() const { diff --git a/pcbnew/pcad2kicadpcb_plugin/pcad2kicad_common.cpp b/pcbnew/pcad2kicadpcb_plugin/pcad2kicad_common.cpp index d178888446..bf4861586e 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcad2kicad_common.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcad2kicad_common.cpp @@ -131,7 +131,8 @@ double StrToDoublePrecisionUnits( wxString aStr, char aAxe, wxString aActualConv { ls.ToDouble( &i ); #ifdef PCAD2KICAD_SCALE_SCH_TO_INCH_GRID - if( aActualConversion == wxT( "SCH" ) ) + if( aActualConversion == wxT( "SCH" ) + || aActualConversion == wxT( "SCHLIB" ) ) i = i * (0.0254 / 0.025); #endif i = Millimeter2iu( i ); diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_text.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_text.cpp index 297cbbb621..a760d0b01d 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_text.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_text.cpp @@ -76,10 +76,7 @@ void PCB_TEXT::Parse( XNODE* aNode, m_rotation = StrToInt1Units( str ); } - lNode = FindNode( aNode, wxT( "value" ) ); - - if( lNode ) - m_name.text = lNode->GetNodeContent(); + aNode->GetAttribute( wxT( "Name" ), &m_name.text ); str = FindNodeGetContent( aNode, wxT( "isFlipped" ) ); diff --git a/pcbnew/pcad2kicadpcb_plugin/s_expr_loader.cpp b/pcbnew/pcad2kicadpcb_plugin/s_expr_loader.cpp index 6bd2392968..d90dd48cb9 100644 --- a/pcbnew/pcad2kicadpcb_plugin/s_expr_loader.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/s_expr_loader.cpp @@ -39,9 +39,7 @@ void LoadInputFile( wxString aFileName, wxXmlDocument* aXmlDoc ) { int tok; XNODE* iNode = NULL, *cNode = NULL; - wxString str; - bool growing = false; - bool attr = false; + wxString str, propValue, content; wxCSConv conv( wxT( "windows-1251" ) ); FILE* fp = wxFopen( aFileName, wxT( "rt" ) ); @@ -56,21 +54,6 @@ void LoadInputFile( wxString aFileName, wxXmlDocument* aXmlDoc ) while( ( tok = lexer.NextTok() ) != DSN_EOF ) { - if( growing && ( tok == DSN_LEFT || tok == DSN_RIGHT ) ) - { - if( attr ) - { - cNode->AddAttribute( wxT( "Name" ), str.Trim( false ) ); - } - else if( str != wxEmptyString ) - { - cNode->AddChild( new XNODE( wxXML_TEXT_NODE, wxEmptyString, str ) ); - } - - growing = false; - attr = false; - } - if( tok == DSN_RIGHT ) { iNode = iNode->GetParent(); @@ -82,14 +65,33 @@ void LoadInputFile( wxString aFileName, wxXmlDocument* aXmlDoc ) cNode = new XNODE( wxXML_ELEMENT_NODE, wxString( lexer.CurText(), conv ) ); iNode->AddChild( cNode ); iNode = cNode; - growing = true; } - else + else if( cNode ) { - str += wxT( ' ' ); - str += wxString( lexer.CurText(), conv ); + str = wxString( lexer.CurText(), conv ); if( tok == DSN_STRING ) - attr = true; + { + // update attribute + if( iNode->GetAttribute( wxT( "Name" ), &propValue ) ) + { + iNode->DeleteAttribute( wxT( "Name" ) ); + iNode->AddAttribute( wxT( "Name" ), propValue + wxT( ' ' ) + str ); + } + else + iNode->AddAttribute( wxT( "Name" ), str ); + } + else if( str != wxEmptyString ) + { + // update node content + content = cNode->GetNodeContent() + wxT( ' ' ) + str; + + if( cNode->GetChildren() ) + cNode->GetChildren()->SetContent( content ); + else + cNode->AddChild( new wxXmlNode( wxXML_TEXT_NODE, + wxEmptyString, + content ) ); + } } }