From ec40a98fe291ceb5c37e274df458f2ea23907e80 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 8 Jun 2022 18:16:11 +0100 Subject: [PATCH] wxT --- .../sch_plugins/eagle/sch_eagle_plugin.cpp | 248 +++++++++--------- 1 file changed, 125 insertions(+), 123 deletions(-) diff --git a/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp b/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp index 3b8bbe0695..e98cd74e05 100644 --- a/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp +++ b/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp @@ -70,15 +70,15 @@ using namespace std; * Map of EAGLE pin type values to KiCad pin type values */ static const std::map pinDirectionsMap = { - { "sup", ELECTRICAL_PINTYPE::PT_POWER_IN }, - { "pas", ELECTRICAL_PINTYPE::PT_PASSIVE }, - { "out", ELECTRICAL_PINTYPE::PT_OUTPUT }, - { "in", ELECTRICAL_PINTYPE::PT_INPUT }, - { "nc", ELECTRICAL_PINTYPE::PT_NC }, - { "io", ELECTRICAL_PINTYPE::PT_BIDI }, - { "oc", ELECTRICAL_PINTYPE::PT_OPENCOLLECTOR }, - { "hiz", ELECTRICAL_PINTYPE::PT_TRISTATE }, - { "pwr", ELECTRICAL_PINTYPE::PT_POWER_IN }, + { wxT( "sup" ), ELECTRICAL_PINTYPE::PT_POWER_IN }, + { wxT( "pas" ), ELECTRICAL_PINTYPE::PT_PASSIVE }, + { wxT( "out" ), ELECTRICAL_PINTYPE::PT_OUTPUT }, + { wxT( "in" ), ELECTRICAL_PINTYPE::PT_INPUT }, + { wxT( "nc" ), ELECTRICAL_PINTYPE::PT_NC }, + { wxT( "io" ), ELECTRICAL_PINTYPE::PT_BIDI }, + { wxT( "oc" ), ELECTRICAL_PINTYPE::PT_OPENCOLLECTOR }, + { wxT( "hiz" ), ELECTRICAL_PINTYPE::PT_TRISTATE }, + { wxT( "pwr" ), ELECTRICAL_PINTYPE::PT_POWER_IN }, }; @@ -143,9 +143,9 @@ wxString SCH_EAGLE_PLUGIN::getLibName() } if( m_libName.IsEmpty() ) - m_libName = "noname"; + m_libName = wxT( "noname" ); - m_libName += "-eagle-import"; + m_libName += wxT( "-eagle-import" ); m_libName = LIB_ID::FixIllegalChars( m_libName, true ); } @@ -196,15 +196,15 @@ void SCH_EAGLE_PLUGIN::loadLayerDefs( wxXmlNode* aLayers ) * */ - if( elayer.name == "Nets" ) + if( elayer.name == wxT( "Nets" ) ) { m_layerMap[elayer.number] = LAYER_WIRE; } - else if( elayer.name == "Info" || elayer.name == "Guide" ) + else if( elayer.name == wxT( "Info" ) || elayer.name == wxT( "Guide" ) ) { m_layerMap[elayer.number] = LAYER_NOTES; } - else if( elayer.name == "Busses" ) + else if( elayer.name == wxT( "Busses" ) ) { m_layerMap[elayer.number] = LAYER_BUS; } @@ -227,7 +227,7 @@ static SYMBOL_ORIENTATION_T kiCadComponentRotation( float eagleDegrees ) switch( roti ) { default: - wxASSERT_MSG( false, wxString::Format( "Unhandled orientation (%d degrees)", roti ) ); + wxASSERT_MSG( false, wxString::Format( wxT( "Unhandled orientation (%d degrees)" ), roti ) ); KI_FALLTHROUGH; case 0: @@ -371,19 +371,19 @@ SCH_EAGLE_PLUGIN::~SCH_EAGLE_PLUGIN() const wxString SCH_EAGLE_PLUGIN::GetName() const { - return "EAGLE"; + return wxT( "EAGLE" ); } const wxString SCH_EAGLE_PLUGIN::GetFileExtension() const { - return "sch"; + return wxT( "sch" ); } const wxString SCH_EAGLE_PLUGIN::GetLibraryFileExtension() const { - return "lbr"; + return wxT( "lbr" ); } @@ -448,7 +448,9 @@ SCH_SHEET* SCH_EAGLE_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchema if( aAppendToMe ) { - wxCHECK_MSG( aSchematic->IsValid(), nullptr, "Can't append to a schematic with no root!" ); + wxCHECK_MSG( aSchematic->IsValid(), nullptr, + wxT( "Can't append to a schematic with no root!" ) ); + m_rootSheet = &aSchematic->Root(); } else @@ -467,7 +469,7 @@ SCH_SHEET* SCH_EAGLE_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchema SYMBOL_LIB_TABLE* libTable = m_schematic->Prj().SchSymbolLibTable(); - wxCHECK_MSG( libTable, nullptr, "Could not load symbol lib table." ); + wxCHECK_MSG( libTable, nullptr, wxT( "Could not load symbol lib table." ) ); m_pi.set( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) ); m_properties = std::make_unique(); @@ -479,11 +481,10 @@ SCH_SHEET* SCH_EAGLE_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchema { // Create a new empty symbol library. m_pi->CreateSymbolLib( getLibFileName().GetFullPath() ); - wxString libTableUri = "${KIPRJMOD}/" + getLibFileName().GetFullName(); + wxString libTableUri = wxT( "${KIPRJMOD}/" ) + getLibFileName().GetFullName(); // Add the new library to the project symbol library table. - libTable->InsertRow( - new SYMBOL_LIB_TABLE_ROW( getLibName(), libTableUri, wxString( "KiCad" ) ) ); + libTable->InsertRow( new SYMBOL_LIB_TABLE_ROW( getLibName(), libTableUri, wxT( "KiCad" ) ) ); // Save project symbol library table. wxFileName fn( m_schematic->Prj().GetProjectPath(), @@ -505,7 +506,7 @@ SCH_SHEET* SCH_EAGLE_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchema // If the attribute is found, store the Eagle version; // otherwise, store the dummy "0.0" version. - m_version = currentNode->GetAttribute( "version", "0.0" ); + m_version = currentNode->GetAttribute( wxT( "version" ), wxT( "0.0" ) ); // Map all children into a readable dictionary NODE_MAP children = MapChildren( currentNode ); @@ -555,7 +556,7 @@ void SCH_EAGLE_PLUGIN::countNets( wxXmlNode* aSchematicNode ) NODE_MAP schematicChildren = MapChildren( aSchematicNode ); // Loop through all the sheets - wxXmlNode* sheetNode = getChildrenNodes( schematicChildren, "sheets" ); + wxXmlNode* sheetNode = getChildrenNodes( schematicChildren, wxT( "sheets" ) ); while( sheetNode ) { @@ -563,11 +564,11 @@ void SCH_EAGLE_PLUGIN::countNets( wxXmlNode* aSchematicNode ) // Loop through all nets // From the DTD: "Net is an electrical connection in a schematic." - wxXmlNode* netNode = getChildrenNodes( sheetChildren, "nets" ); + wxXmlNode* netNode = getChildrenNodes( sheetChildren, wxT( "nets" ) ); while( netNode ) { - wxString netName = netNode->GetAttribute( "name" ); + wxString netName = netNode->GetAttribute( wxT( "name" ) ); if( m_netCounts.count( netName ) ) m_netCounts[netName] = m_netCounts[netName] + 1; @@ -587,9 +588,9 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode ) { // Map all children into a readable dictionary NODE_MAP schematicChildren = MapChildren( aSchematicNode ); - wxXmlNode* partNode = getChildrenNodes( schematicChildren, "parts" ); - wxXmlNode* libraryNode = getChildrenNodes( schematicChildren, "libraries" ); - wxXmlNode* sheetNode = getChildrenNodes( schematicChildren, "sheets" ); + wxXmlNode* partNode = getChildrenNodes( schematicChildren, wxT( "parts" ) ); + wxXmlNode* libraryNode = getChildrenNodes( schematicChildren, wxT( "libraries" ) ); + wxXmlNode* sheetNode = getChildrenNodes( schematicChildren, wxT( "sheets" ) ); if( !sheetNode ) return; @@ -618,13 +619,13 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode ) while( libraryNode ) { NODE_MAP libraryChildren = MapChildren( libraryNode ); - wxXmlNode* devicesetNode = getChildrenNodes( libraryChildren, "devicesets" ); + wxXmlNode* devicesetNode = getChildrenNodes( libraryChildren, wxT( "devicesets" ) ); while( devicesetNode ) { NODE_MAP deviceSetChildren = MapChildren( devicesetNode ); - wxXmlNode* deviceNode = getChildrenNodes( deviceSetChildren, "devices" ); - wxXmlNode* gateNode = getChildrenNodes( deviceSetChildren, "gates" ); + wxXmlNode* deviceNode = getChildrenNodes( deviceSetChildren, wxT( "devices" ) ); + wxXmlNode* gateNode = getChildrenNodes( deviceSetChildren, wxT( "gates" ) ); m_totalCount += count_nodes( deviceNode ) * count_nodes( gateNode ); @@ -635,22 +636,22 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode ) } // Rewind - libraryNode = getChildrenNodes( schematicChildren, "libraries" ); + libraryNode = getChildrenNodes( schematicChildren, wxT( "libraries" ) ); while( sheetNode ) { NODE_MAP sheetChildren = MapChildren( sheetNode ); - m_totalCount += count_nodes( getChildrenNodes( sheetChildren, "instances" ) ); - m_totalCount += count_nodes( getChildrenNodes( sheetChildren, "busses" ) ); - m_totalCount += count_nodes( getChildrenNodes( sheetChildren, "nets" ) ); - m_totalCount += count_nodes( getChildrenNodes( sheetChildren, "plain" ) ); + m_totalCount += count_nodes( getChildrenNodes( sheetChildren, wxT( "instances" ) ) ); + m_totalCount += count_nodes( getChildrenNodes( sheetChildren, wxT( "busses" ) ) ); + m_totalCount += count_nodes( getChildrenNodes( sheetChildren, wxT( "nets" ) ) ); + m_totalCount += count_nodes( getChildrenNodes( sheetChildren, wxT( "plain" ) ) ); sheetNode = sheetNode->GetNext(); } // Rewind - sheetNode = getChildrenNodes( schematicChildren, "sheets" ); + sheetNode = getChildrenNodes( schematicChildren, wxT( "sheets" ) ); } while( partNode ) @@ -669,7 +670,7 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode ) while( libraryNode ) { // Read the library name - wxString libName = libraryNode->GetAttribute( "name" ); + wxString libName = libraryNode->GetAttribute( wxT( "name" ) ); EAGLE_LIBRARY* elib = &m_eagleLibs[libName]; elib->name = libName; @@ -686,7 +687,7 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode ) countNets( aSchematicNode ); // Loop through all the sheets - int sheet_count = countChildren( sheetNode->GetParent(), "sheet" ); + int sheet_count = countChildren( sheetNode->GetParent(), wxT( "sheet" ) ); // If eagle schematic has multiple sheets then create corresponding subsheets on the root sheet if( sheet_count > 1 ) @@ -699,14 +700,14 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode ) SCH_SHEET_PATH rootsheetpath; rootsheetpath.push_back( m_rootSheet ); m_rootSheet->AddInstance( rootsheetpath ); - m_rootSheet->SetPageNumber( rootsheetpath, "1" ); + m_rootSheet->SetPageNumber( rootsheetpath, wxT( "1" ) ); while( sheetNode ) { VECTOR2I pos = VECTOR2I( x * Mils2iu( 1000 ), y * Mils2iu( 1000 ) ); std::unique_ptr sheet = std::make_unique( m_rootSheet, pos ); SCH_SCREEN* screen = new SCH_SCREEN( m_schematic ); - wxString pageNo = wxString::Format( "%d", i ); + wxString pageNo = wxString::Format( wxT( "%d" ), i ); sheet->SetScreen( screen ); sheet->GetScreen()->SetFileName( sheet->GetFileName() ); @@ -807,7 +808,7 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex ) NODE_MAP sheetChildren = MapChildren( aSheetNode ); // Get description node - wxXmlNode* descriptionNode = getChildrenNodes( sheetChildren, "description" ); + wxXmlNode* descriptionNode = getChildrenNodes( sheetChildren, wxT( "description" ) ); wxString des; std::string filename; @@ -817,13 +818,13 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex ) if( descriptionNode ) { des = descriptionNode->GetContent(); - des.Replace( "\n", "_", true ); + des.Replace( wxT( "\n" ), wxT( "_" ), true ); sheetNameField.SetText( des ); filename = des.ToStdString(); } else { - filename = wxString::Format( "%s_%d", m_filename.GetName(), aSheetIndex ); + filename = wxString::Format( wxT( "%s_%d" ), m_filename.GetName(), aSheetIndex ); sheetNameField.SetText( filename ); } @@ -840,7 +841,7 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex ) // Loop through all of the symbol instances. - wxXmlNode* instanceNode = getChildrenNodes( sheetChildren, "instances" ); + wxXmlNode* instanceNode = getChildrenNodes( sheetChildren, wxT( "instances" ) ); while( instanceNode ) { @@ -854,14 +855,14 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex ) // From the DTD: "Buses receive names which determine which signals they include. // A bus is a drawing object. It does not create any electrical connections. // These are always created by means of the nets and their names." - wxXmlNode* busNode = getChildrenNodes( sheetChildren, "busses" ); + wxXmlNode* busNode = getChildrenNodes( sheetChildren, wxT( "busses" ) ); while( busNode ) { checkpoint(); // Get the bus name - wxString busName = translateEagleBusName( busNode->GetAttribute( "name" ) ); + wxString busName = translateEagleBusName( busNode->GetAttribute( wxT( "name" ) ) ); // Load segments of this bus loadSegments( busNode, busName, wxString() ); @@ -872,15 +873,15 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex ) // Loop through all nets // From the DTD: "Net is an electrical connection in a schematic." - wxXmlNode* netNode = getChildrenNodes( sheetChildren, "nets" ); + wxXmlNode* netNode = getChildrenNodes( sheetChildren, wxT( "nets" ) ); while( netNode ) { checkpoint(); // Get the net name and class - wxString netName = netNode->GetAttribute( "name" ); - wxString netClass = netNode->GetAttribute( "class" ); + wxString netName = netNode->GetAttribute( wxT( "name" ) ); + wxString netClass = netNode->GetAttribute( wxT( "class" ) ); // Load segments of this net loadSegments( netNode, netName, netClass ); @@ -904,7 +905,7 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex ) * } */ - wxXmlNode* plainNode = getChildrenNodes( sheetChildren, "plain" ); + wxXmlNode* plainNode = getChildrenNodes( sheetChildren, wxT( "plain" ) ); while( plainNode ) { @@ -912,15 +913,15 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex ) wxString nodeName = plainNode->GetName(); - if( nodeName == "text" ) + if( nodeName == wxT( "text" ) ) { m_currentSheet->GetScreen()->Append( loadPlainText( plainNode ) ); } - else if( nodeName == "wire" ) + else if( nodeName == wxT( "wire" ) ) { m_currentSheet->GetScreen()->Append( loadWire( plainNode ) ); } - else if( nodeName == "frame" ) + else if( nodeName == wxT( "frame" ) ) { std::vector lines; @@ -1028,7 +1029,7 @@ void SCH_EAGLE_PLUGIN::loadSegments( wxXmlNode* aSegmentsNode, const wxString& n wxXmlNode* currentSegment = aSegmentsNode->GetChildren(); SCH_SCREEN* screen = m_currentSheet->GetScreen(); - int segmentCount = countChildren( aSegmentsNode, "segment" ); + int segmentCount = countChildren( aSegmentsNode, wxT( "segment" ) ); // wxCHECK( screen, [>void<] ); while( currentSegment ) @@ -1044,7 +1045,7 @@ void SCH_EAGLE_PLUGIN::loadSegments( wxXmlNode* aSegmentsNode, const wxString& n while( segmentAttribute ) { - if( segmentAttribute->GetName() == "wire" ) + if( segmentAttribute->GetName() == wxT( "wire" ) ) { SCH_LINE* wire = loadWire( segmentAttribute ); @@ -1081,11 +1082,11 @@ void SCH_EAGLE_PLUGIN::loadSegments( wxXmlNode* aSegmentsNode, const wxString& n { wxString nodeName = segmentAttribute->GetName(); - if( nodeName == "junction" ) + if( nodeName == wxT( "junction" ) ) { screen->Append( loadJunction( segmentAttribute ) ); } - else if( nodeName == "label" ) + else if( nodeName == wxT( "label" ) ) { SCH_TEXT* label = loadLabel( segmentAttribute, netName ); screen->Append( label ); @@ -1094,13 +1095,13 @@ void SCH_EAGLE_PLUGIN::loadSegments( wxXmlNode* aSegmentsNode, const wxString& n segDesc.labels.push_back( label ); labelled = true; } - else if( nodeName == "pinref" ) + else if( nodeName == wxT( "pinref" ) ) { - segmentAttribute->GetAttribute( "gate" ); // REQUIRED - wxString part = segmentAttribute->GetAttribute( "part" ); // REQUIRED - wxString pin = segmentAttribute->GetAttribute( "pin" ); // REQUIRED + segmentAttribute->GetAttribute( wxT( "gate" ) ); // REQUIRED + wxString part = segmentAttribute->GetAttribute( wxT( "part" ) ); // REQUIRED + wxString pin = segmentAttribute->GetAttribute( wxT( "pin" ) ); // REQUIRED - auto powerPort = m_powerPorts.find( "#" + part ); + auto powerPort = m_powerPorts.find( wxT( "#" ) + part ); if( powerPort != m_powerPorts.end() && powerPort->second == EscapeString( pin, CTX_NETNAME ) ) @@ -1108,7 +1109,7 @@ void SCH_EAGLE_PLUGIN::loadSegments( wxXmlNode* aSegmentsNode, const wxString& n labelled = true; } } - else if( nodeName == "wire" ) + else if( nodeName == wxT( "wire" ) ) { // already handled; } @@ -1302,7 +1303,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode ) wxString libraryname = epart->library; wxString gatename = epart->deviceset + epart->device + einstance.gate; wxString symbolname = wxString( epart->deviceset + epart->device ); - symbolname.Replace( "*", "" ); + symbolname.Replace( wxT( "*" ), wxEmptyString ); wxString kisymbolname = EscapeString( symbolname, CTX_LIBID ); int unit = m_eagleLibs[libraryname].GateUnit[gatename]; @@ -1358,19 +1359,19 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode ) wxString reference = package.IsEmpty() ? '#' + einstance.part : einstance.part; // reference must end with a number but EAGLE does not enforce this - if( reference.find_last_not_of( "0123456789" ) == (reference.Length()-1) ) - reference.Append( "0" ); + if( reference.find_last_not_of( wxT( "0123456789" ) ) == (reference.Length()-1) ) + reference.Append( wxT( "0" ) ); // EAGLE allows references to be single digits. This breaks KiCad netlisting, which requires // parts to have non-digit + digit annotation. If the reference begins with a number, // we prepend 'UNK' (unknown) for the symbol designator - if( reference.find_first_not_of( "0123456789" ) != 0 ) - reference.Prepend( "UNK" ); + if( reference.find_first_not_of( wxT( "0123456789" ) ) != 0 ) + reference.Prepend( wxT( "UNK" ) ); // EAGLE allows designator to start with # but that is used in KiCad // for symbols which do not have a footprint - if( einstance.part.find_first_not_of( "#" ) != 0 ) - reference.Prepend( "UNK" ); + if( einstance.part.find_first_not_of( wxT( "#" ) ) != 0 ) + reference.Prepend( wxT( "UNK" ) ); SCH_SHEET_PATH sheetpath; m_rootSheet->LocatePathOfScreen( screen, &sheetpath ); @@ -1400,7 +1401,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode ) for( const auto& a : epart->variant ) { SCH_FIELD* field = symbol->AddField( *symbol->GetField( VALUE_FIELD ) ); - field->SetName( "VARIANT_" + a.first ); + field->SetName( wxT( "VARIANT_" ) + a.first ); field->SetText( a.second ); field->SetVisible( false ); } @@ -1413,17 +1414,17 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode ) // Parse attributes for the instance while( attributeNode ) { - if( attributeNode->GetName() == "attribute" ) + if( attributeNode->GetName() == wxT( "attribute" ) ) { EATTR attr = EATTR( attributeNode ); SCH_FIELD* field = nullptr; - if( attr.name.Lower() == "name" ) + if( attr.name.Lower() == wxT( "name" ) ) { field = symbol->GetField( REFERENCE_FIELD ); nameAttributeFound = true; } - else if( attr.name.Lower() == "value" ) + else if( attr.name.Lower() == wxT( "value" ) ) { field = symbol->GetField( VALUE_FIELD ); valueAttributeFound = true; @@ -1460,15 +1461,15 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode ) absdegrees ); } } - else if( attributeNode->GetName() == "variant" ) + else if( attributeNode->GetName() == wxT( "variant" ) ) { wxString variant, value; - if( attributeNode->GetAttribute( "name", &variant ) - && attributeNode->GetAttribute( "value", &value ) ) + if( attributeNode->GetAttribute( wxT( "name" ), &variant ) + && attributeNode->GetAttribute( wxT( "value" ), &value ) ) { SCH_FIELD* field = symbol->AddField( *symbol->GetField( VALUE_FIELD ) ); - field->SetName( "VARIANT_" + variant ); + field->SetName( wxT( "VARIANT_" ) + variant ); field->SetText( value ); field->SetVisible( false ); } @@ -1515,27 +1516,27 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode, NODE_MAP libraryChildren = MapChildren( aLibraryNode ); // Loop through the symbols and load each of them - wxXmlNode* symbolNode = getChildrenNodes( libraryChildren, "symbols" ); + wxXmlNode* symbolNode = getChildrenNodes( libraryChildren, wxT( "symbols" ) ); while( symbolNode ) { - wxString symbolName = symbolNode->GetAttribute( "name" ); + wxString symbolName = symbolNode->GetAttribute( wxT( "name" ) ); aEagleLibrary->SymbolNodes[symbolName] = symbolNode; symbolNode = symbolNode->GetNext(); } // Loop through the device sets and load each of them - wxXmlNode* devicesetNode = getChildrenNodes( libraryChildren, "devicesets" ); + wxXmlNode* devicesetNode = getChildrenNodes( libraryChildren, wxT( "devicesets" ) ); while( devicesetNode ) { // Get Device set information EDEVICE_SET edeviceset = EDEVICE_SET( devicesetNode ); - wxString prefix = edeviceset.prefix ? edeviceset.prefix.Get() : ""; + wxString prefix = edeviceset.prefix ? edeviceset.prefix.Get() : wxT( "" ); NODE_MAP deviceSetChildren = MapChildren( devicesetNode ); - wxXmlNode* deviceNode = getChildrenNodes( deviceSetChildren, "devices" ); + wxXmlNode* deviceNode = getChildrenNodes( deviceSetChildren, wxT( "devices" ) ); // For each device in the device set: while( deviceNode ) @@ -1545,7 +1546,7 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode, // Create symbol name from deviceset and device names. wxString symbolName = edeviceset.name + edevice.name; - symbolName.Replace( "*", "" ); + symbolName.Replace( wxT( "*" ), wxEmptyString ); wxASSERT( !symbolName.IsEmpty() ); symbolName = EscapeString( symbolName, CTX_LIBID ); @@ -1556,8 +1557,8 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode, std::unique_ptr libSymbol = std::make_unique( symbolName ); // Process each gate in the deviceset for this device. - wxXmlNode* gateNode = getChildrenNodes( deviceSetChildren, "gates" ); - int gates_count = countChildren( deviceSetChildren["gates"], "gate" ); + wxXmlNode* gateNode = getChildrenNodes( deviceSetChildren, wxT( "gates" ) ); + int gates_count = countChildren( deviceSetChildren["gates"], wxT( "gate" ) ); libSymbol->SetUnitCount( gates_count ); libSymbol->LockUnits( true ); @@ -1619,7 +1620,7 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode, bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr& aSymbol, EDEVICE* aDevice, int aGateNumber, const wxString& aGateName ) { - wxString symbolName = aSymbolNode->GetAttribute( "name" ); + wxString symbolName = aSymbolNode->GetAttribute( wxT( "name" ) ); std::vector items; wxXmlNode* currentNode = aSymbolNode->GetChildren(); @@ -1633,11 +1634,11 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptrGetName(); - if( nodeName == "circle" ) + if( nodeName == wxT( "circle" ) ) { aSymbol->AddDrawItem( loadSymbolCircle( aSymbol, currentNode, aGateNumber ) ); } - else if( nodeName == "pin" ) + else if( nodeName == wxT( "pin" ) ) { EPIN ePin = EPIN( currentNode ); std::unique_ptr pin( loadPin( aSymbol, currentNode, &ePin, aGateNumber ) ); @@ -1653,7 +1654,7 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptrSetType( pinDir.second ); - if( pinDir.first == "sup" ) // power supply symbol + if( pinDir.first == wxT( "sup" ) ) // power supply symbol ispower = true; break; @@ -1693,30 +1694,30 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptrSetUnit( aGateNumber ); - pin->SetNumber( wxString::Format( "%i", pincount ) ); + pin->SetNumber( wxString::Format( wxT( "%i" ), pincount ) ); aSymbol->AddDrawItem( pin.release() ); } } - else if( nodeName == "polygon" ) + else if( nodeName == wxT( "polygon" ) ) { aSymbol->AddDrawItem( loadSymbolPolyLine( aSymbol, currentNode, aGateNumber ) ); } - else if( nodeName == "rectangle" ) + else if( nodeName == wxT( "rectangle" ) ) { aSymbol->AddDrawItem( loadSymbolRectangle( aSymbol, currentNode, aGateNumber ) ); } - else if( nodeName == "text" ) + else if( nodeName == wxT( "text" ) ) { std::unique_ptr libtext( loadSymbolText( aSymbol, currentNode, aGateNumber ) ); - if( libtext->GetText().Upper() == ">NAME" ) + if( libtext->GetText().Upper() == wxT( ">NAME" ) ) { LIB_FIELD* field = aSymbol->GetFieldById( REFERENCE_FIELD ); loadFieldAttributes( field, libtext.get() ); foundName = true; } - else if( libtext->GetText().Upper() == ">VALUE" ) + else if( libtext->GetText().Upper() == wxT( ">VALUE" ) ) { LIB_FIELD* field = aSymbol->GetFieldById( VALUE_FIELD ); loadFieldAttributes( field, libtext.get() ); @@ -1727,11 +1728,11 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptrAddDrawItem( libtext.release() ); } } - else if( nodeName == "wire" ) + else if( nodeName == wxT( "wire" ) ) { aSymbol->AddDrawItem( loadSymbolWire( aSymbol, currentNode, aGateNumber ) ); } - else if( nodeName == "frame" ) + else if( nodeName == wxT( "frame" ) ) { std::vector frameItems; @@ -1894,7 +1895,7 @@ LIB_SHAPE* SCH_EAGLE_PLUGIN::loadSymbolPolyLine( std::unique_ptr& aS while( vertex ) { - if( vertex->GetName() == "vertex" ) // skip node + if( vertex->GetName() == wxT( "vertex" ) ) // skip node { EVERTEX evertex( vertex ); pt = VECTOR2I( evertex.x.ToSchUnits(), evertex.y.ToSchUnits() ); @@ -1927,7 +1928,7 @@ LIB_PIN* SCH_EAGLE_PLUGIN::loadPin( std::unique_ptr& aSymbol, wxXmlN case 90: pin->SetOrientation( 'U' ); break; case 180: pin->SetOrientation( 'L' ); break; case 270: pin->SetOrientation( 'D' ); break; - default: wxFAIL_MSG( wxString::Format( "Unhandled orientation (%d degrees).", roti ) ); + default: wxFAIL_MSG( wxString::Format( wxT( "Unhandled orientation (%d degrees)." ), roti ) ); } pin->SetLength( Mils2iu( 300 ) ); // Default pin length when not defined. @@ -1936,13 +1937,13 @@ LIB_PIN* SCH_EAGLE_PLUGIN::loadPin( std::unique_ptr& aSymbol, wxXmlN { wxString length = aEPin->length.Get(); - if( length == "short" ) + if( length == wxT( "short" ) ) pin->SetLength( Mils2iu( 100 ) ); - else if( length == "middle" ) + else if( length == wxT( "middle" ) ) pin->SetLength( Mils2iu( 200 ) ); - else if( length == "long" ) + else if( length == wxT( "long" ) ) pin->SetLength( Mils2iu( 300 ) ); - else if( length == "point" ) + else if( length == wxT( "point" ) ) pin->SetLength( Mils2iu( 0 ) ); } @@ -1951,22 +1952,22 @@ LIB_PIN* SCH_EAGLE_PLUGIN::loadPin( std::unique_ptr& aSymbol, wxXmlN { wxString visible = aEPin->visible.Get(); - if( visible == "off" ) + if( visible == wxT( "off" ) ) { pin->SetNameTextSize( 0 ); pin->SetNumberTextSize( 0 ); } - else if( visible == "pad" ) + else if( visible == wxT( "pad" ) ) { pin->SetNameTextSize( 0 ); } - else if( visible == "pin" ) + else if( visible == wxT( "pin" ) ) { pin->SetNumberTextSize( 0 ); } /* - * else if( visible == "both" ) + * else if( visible == wxT( "both" ) ) * { * } */ @@ -1976,11 +1977,11 @@ LIB_PIN* SCH_EAGLE_PLUGIN::loadPin( std::unique_ptr& aSymbol, wxXmlN { wxString function = aEPin->function.Get(); - if( function == "dot" ) + if( function == wxT( "dot" ) ) pin->SetShape( GRAPHIC_PINSHAPE::INVERTED ); - else if( function == "clk" ) + else if( function == wxT( "clk" ) ) pin->SetShape( GRAPHIC_PINSHAPE::CLOCK ); - else if( function == "dotclk" ) + else if( function == wxT( "dotclk" ) ) pin->SetShape( GRAPHIC_PINSHAPE::INVERTED_CLOCK ); } @@ -2006,7 +2007,7 @@ LIB_TEXT* SCH_EAGLE_PLUGIN::loadSymbolText( std::unique_ptr& aSymbol std::replace( text.begin(), text.end(), '\n', '_' ); std::replace( text.begin(), text.end(), '\r', '_' ); - libtext->SetText( text.IsEmpty() ? "~" : text ); + libtext->SetText( text.IsEmpty() ? wxT( "~" ) : text ); loadTextAttributes( libtext.get(), etext ); return libtext.release(); @@ -2213,7 +2214,7 @@ SCH_TEXT* SCH_EAGLE_PLUGIN::loadPlainText( wxXmlNode* aSchText ) adjustedText += tmp; } - schtext->SetText( adjustedText.IsEmpty() ? "\" \"" : escapeName( adjustedText ) ); + schtext->SetText( adjustedText.IsEmpty() ? wxT( "\" \"" ) : escapeName( adjustedText ) ); schtext->SetPosition( VECTOR2I( etext.x.ToSchUnits(), -etext.y.ToSchUnits() ) ); loadTextAttributes( schtext.get(), etext ); schtext->SetItalic( false ); @@ -2345,8 +2346,9 @@ bool SCH_EAGLE_PLUGIN::CheckHeader( const wxString& aFileName ) wxString thirdline = tempFile.GetNextLine(); tempFile.Close(); - return firstline.StartsWith( " 0 ) - member << "!"; + member << wxT( "!" ); - ret << member << " "; + ret << member << wxS( " " ); } ret.Trim( true ); - ret << "}"; + ret << wxT( "}" ); return ret; }