Convert UTF8 to/from wxString correctly around LIB_ID

Fixes: lp:1675942
* https://bugs.launchpad.net/kicad/+bug/1675942
This commit is contained in:
Chris Pavlina 2017-03-24 21:18:16 -04:00
parent 68853c988e
commit 4011ed4e31
33 changed files with 130 additions and 127 deletions

View File

@ -59,12 +59,12 @@ FOOTPRINT_INFO* FOOTPRINT_LIST::GetModuleInfo( const wxString& aFootprintName )
{ {
LIB_ID fpid; LIB_ID fpid;
wxCHECK_MSG( fpid.Parse( aFootprintName ) < 0, NULL, wxCHECK_MSG( fpid.Parse( TO_UTF8( aFootprintName ) ) < 0, NULL,
wxString::Format( wxString::Format(
wxT( "'%s' is not a valid LIB_ID." ), GetChars( aFootprintName ) ) ); "'%s' is not a valid LIB_ID.", aFootprintName ) );
wxString libNickname = fpid.GetLibNickname(); wxString libNickname = FROM_UTF8( fpid.GetLibNickname() );
wxString footprintName = fpid.GetLibItemName(); wxString footprintName = FROM_UTF8( fpid.GetLibItemName() );
if( libNickname == fp->GetNickname() && footprintName == fp->GetFootprintName() ) if( libNickname == fp->GetNickname() && footprintName == fp->GetFootprintName() )
return &*fp; return &*fp;

View File

@ -26,6 +26,7 @@
#include <fctsys.h> #include <fctsys.h>
#include <common.h> #include <common.h>
#include <macros.h>
#include <kiface_i.h> #include <kiface_i.h>
#include <footprint_info.h> #include <footprint_info.h>
#include <lib_id.h> #include <lib_id.h>
@ -255,12 +256,12 @@ MODULE* FP_LIB_TABLE::FootprintLoad( const wxString& aNickname, const wxString&
LIB_ID& fpid = (LIB_ID&) ret->GetFPID(); LIB_ID& fpid = (LIB_ID&) ret->GetFPID();
// Catch any misbehaving plugin, which should be setting internal footprint name properly: // Catch any misbehaving plugin, which should be setting internal footprint name properly:
wxASSERT( aFootprintName == (wxString) fpid.GetLibItemName() ); wxASSERT( aFootprintName == FROM_UTF8( fpid.GetLibItemName() ) );
// and clearing nickname // and clearing nickname
wxASSERT( !fpid.GetLibNickname().size() ); wxASSERT( !fpid.GetLibNickname().size() );
fpid.SetLibNickname( row->GetNickName() ); fpid.SetLibNickname( TO_UTF8( row->GetNickName() ) );
} }
return ret; return ret;
@ -278,7 +279,7 @@ FP_LIB_TABLE::SAVE_T FP_LIB_TABLE::FootprintSave( const wxString& aNickname,
// Try loading the footprint to see if it already exists, caller wants overwrite // Try loading the footprint to see if it already exists, caller wants overwrite
// protection, which is atypical, not the default. // protection, which is atypical, not the default.
wxString fpname = aFootprint->GetFPID().GetLibItemName(); wxString fpname = FROM_UTF8( aFootprint->GetFPID().GetLibItemName() );
std::unique_ptr<MODULE> footprint( row->plugin->FootprintLoad( row->GetFullURI( true ), std::unique_ptr<MODULE> footprint( row->plugin->FootprintLoad( row->GetFullURI( true ),
fpname, row->GetProperties() ) ); fpname, row->GetProperties() ) );
@ -329,8 +330,8 @@ void FP_LIB_TABLE::FootprintLibCreate( const wxString& aNickname )
MODULE* FP_LIB_TABLE::FootprintLoadWithOptionalNickname( const LIB_ID& aFootprintId ) MODULE* FP_LIB_TABLE::FootprintLoadWithOptionalNickname( const LIB_ID& aFootprintId )
throw( IO_ERROR, PARSE_ERROR, boost::interprocess::lock_exception ) throw( IO_ERROR, PARSE_ERROR, boost::interprocess::lock_exception )
{ {
wxString nickname = aFootprintId.GetLibNickname(); wxString nickname = FROM_UTF8( aFootprintId.GetLibNickname() );
wxString fpname = aFootprintId.GetLibItemName(); wxString fpname = FROM_UTF8( aFootprintId.GetLibItemName() );
if( nickname.size() ) if( nickname.size() )
{ {

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012-2016 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2012-2016 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2010-2016 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2010-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -169,7 +169,7 @@ int LIB_ID::Parse( const UTF8& aId )
// Some chars can be found in legacy files converted files from an other EDA tools. // Some chars can be found in legacy files converted files from an other EDA tools.
std::string fpname = aId.substr( partNdx, revNdx-partNdx ); std::string fpname = aId.substr( partNdx, revNdx-partNdx );
ReplaceIllegalFileNameChars( &fpname, '_' ); ReplaceIllegalFileNameChars( &fpname, '_' );
SetLibItemName( UTF8( fpname ) ); SetLibItemName( fpname );
return -1; return -1;
} }
@ -192,7 +192,7 @@ LIB_ID::LIB_ID( const std::string& aId ) throw( PARSE_ERROR )
LIB_ID::LIB_ID( const wxString& aId ) throw( PARSE_ERROR ) LIB_ID::LIB_ID( const wxString& aId ) throw( PARSE_ERROR )
{ {
UTF8 id = aId; UTF8 id = TO_UTF8( aId );
int offset = Parse( id ); int offset = Parse( id );
@ -209,9 +209,9 @@ LIB_ID::LIB_ID( const wxString& aId ) throw( PARSE_ERROR )
LIB_ID::LIB_ID( const wxString& aLibName, const wxString& aLibItemName, LIB_ID::LIB_ID( const wxString& aLibName, const wxString& aLibItemName,
const wxString& aRevision ) : const wxString& aRevision ) :
nickname( aLibName ), nickname( TO_UTF8( aLibName ) ),
item_name( aLibItemName ), item_name( TO_UTF8( aLibItemName ) ),
revision( aRevision ) revision( TO_UTF8( aRevision ) )
{ {
} }

View File

@ -446,7 +446,7 @@ MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName )
{ {
LIB_ID fpid; LIB_ID fpid;
if( fpid.Parse( aFootprintName ) >= 0 ) if( fpid.Parse( TO_UTF8( aFootprintName ) ) >= 0 )
{ {
DisplayInfoMessage( this, wxString::Format( wxT( "Footprint ID <%s> is not valid." ), DisplayInfoMessage( this, wxString::Format( wxT( "Footprint ID <%s> is not valid." ),
GetChars( aFootprintName ) ) ); GetChars( aFootprintName ) ) );

View File

@ -77,7 +77,7 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
if( !aFootprintName.IsEmpty() ) if( !aFootprintName.IsEmpty() )
{ {
wxCHECK_RET( fpid.Parse( aFootprintName ) < 0, wxCHECK_RET( fpid.Parse( TO_UTF8( aFootprintName ) ) < 0,
wxString::Format( wxT( "<%s> is not a valid LIB_ID." ), wxString::Format( wxT( "<%s> is not a valid LIB_ID." ),
GetChars( aFootprintName ) ) ); GetChars( aFootprintName ) ) );
} }
@ -124,7 +124,7 @@ static int guessNickname( FP_LIB_TABLE* aTbl, LIB_ID* aFootprintId )
return 0; return 0;
wxString nick; wxString nick;
wxString fpname = aFootprintId->GetLibItemName(); wxString fpname = FROM_UTF8( aFootprintId->GetLibItemName() );
std::vector<wxString> nicks = aTbl->GetLogicalLibs(); std::vector<wxString> nicks = aTbl->GetLogicalLibs();
@ -147,7 +147,7 @@ static int guessNickname( FP_LIB_TABLE* aTbl, LIB_ID* aFootprintId )
if( nick.size() ) if( nick.size() )
{ {
aFootprintId->SetLibNickname( nick ); aFootprintId->SetLibNickname( TO_UTF8( nick ) );
return 0; return 0;
} }
@ -227,7 +227,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles( const std::string& aNetlist )
msg += wxString::Format( _( msg += wxString::Format( _(
"Component '%s' footprint '%s' was <b>not found</b> in any library.\n" ), "Component '%s' footprint '%s' was <b>not found</b> in any library.\n" ),
GetChars( component->GetReference() ), GetChars( component->GetReference() ),
GetChars( component->GetFPID().GetLibItemName() ) GetChars( FROM_UTF8( component->GetFPID().GetLibItemName() ) )
); );
break; break;
@ -235,7 +235,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles( const std::string& aNetlist )
msg += wxString::Format( _( msg += wxString::Format( _(
"Component '%s' footprint '%s' was found in <b>multiple</b> libraries.\n" ), "Component '%s' footprint '%s' was found in <b>multiple</b> libraries.\n" ),
GetChars( component->GetReference() ), GetChars( component->GetReference() ),
GetChars( component->GetFPID().GetLibItemName() ) GetChars( FROM_UTF8( component->GetFPID().GetLibItemName() ) )
); );
break; break;
} }
@ -316,8 +316,8 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles( const std::string& aNetlist )
{ {
COMPONENT* component = m_netlist.GetComponent( m_indexes[ii] ); COMPONENT* component = m_netlist.GetComponent( m_indexes[ii] );
wxString cmpfpid = component->GetFPID().Format(); wxString cmpfpid = FROM_UTF8( component->GetFPID().Format() );
wxString schfpid = component->GetAltFPID().Format(); wxString schfpid = FROM_UTF8( component->GetAltFPID().Format() );
dlg.Add( component->GetReference(), schfpid, cmpfpid ); dlg.Add( component->GetReference(), schfpid, cmpfpid );
} }

View File

@ -396,7 +396,7 @@ LIB_PART* PART_LIBS::FindLibPart( const LIB_ID& aLibId, const wxString& aLibrary
if( !aLibraryName.IsEmpty() && lib.GetName() != aLibraryName ) if( !aLibraryName.IsEmpty() && lib.GetName() != aLibraryName )
continue; continue;
part = lib.FindPart( aLibId.GetLibItemName() ); part = lib.FindPart( FROM_UTF8( aLibId.GetLibItemName() ) );
if( part ) if( part )
break; break;
@ -415,7 +415,7 @@ LIB_ALIAS* PART_LIBS::FindLibraryAlias( const LIB_ID& aLibId, const wxString& aL
if( !aLibraryName.IsEmpty() && lib.GetName() != aLibraryName ) if( !aLibraryName.IsEmpty() && lib.GetName() != aLibraryName )
continue; continue;
entry = lib.FindAlias( aLibId.GetLibItemName() ); entry = lib.FindAlias( FROM_UTF8( aLibId.GetLibItemName() ) );
if( entry ) if( entry )
break; break;

View File

@ -340,7 +340,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions()
tmp.Replace( wxT( " " ), wxT( "_" ) ); tmp.Replace( wxT( " " ), wxT( "_" ) );
id.SetLibItemName( tmp, false ); id.SetLibItemName( TO_UTF8( tmp ), false );
// Save current flags which could be modified by next change settings // Save current flags which could be modified by next change settings
STATUS_FLAGS flags = m_cmp->GetFlags(); STATUS_FLAGS flags = m_cmp->GetFlags();
@ -356,7 +356,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions()
if( libs->FindLibraryAlias( id ) == NULL ) if( libs->FindLibraryAlias( id ) == NULL )
{ {
wxString msg = wxString::Format( _( "Component '%s' not found!" ), wxString msg = wxString::Format( _( "Component '%s' not found!" ),
GetChars( id.Format() ) ); GetChars( FROM_UTF8( id.Format() ) ) );
DisplayError( this, msg ); DisplayError( this, msg );
} }
else // Change component from lib! else // Change component from lib!
@ -1080,7 +1080,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
convertCheckBox->Enable( false ); convertCheckBox->Enable( false );
// Set the component's library name. // Set the component's library name.
chipnameTextCtrl->SetValue( m_cmp->GetLibId().Format() ); chipnameTextCtrl->SetValue( FROM_UTF8( m_cmp->GetLibId().Format() ) );
// Set the component's unique ID time stamp. // Set the component's unique ID time stamp.
m_textCtrlTimeStamp->SetValue( wxString::Format( wxT( "%8.8lX" ), m_textCtrlTimeStamp->SetValue( wxString::Format( wxT( "%8.8lX" ),

View File

@ -8,7 +8,7 @@
* *
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2016 Wayne Stambaugh, stambaughw@gmail.com * Copyright (C) 2016 Wayne Stambaugh, stambaughw@gmail.com
* Copyright (C) 2004-2016 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -280,7 +280,8 @@ DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent,
const LIB_PART* part = GetParent()->Prj().SchLibs()->FindLibPart( component->GetLibId() ); const LIB_PART* part = GetParent()->Prj().SchLibs()->FindLibPart( component->GetLibId() );
wxASSERT_MSG( part, wxT( "Library part for component <" ) + wxASSERT_MSG( part, wxT( "Library part for component <" ) +
component->GetLibId().Format() + wxT( "> could not be found." ) ); FROM_UTF8( component->GetLibId().Format() ) +
wxT( "> could not be found." ) );
m_isPower = part->IsPower(); m_isPower = part->IsPower();

View File

@ -153,7 +153,7 @@ void DIALOG_RESCUE_EACH::PopulateInstanceList()
int count = 0; int count = 0;
for( SCH_COMPONENT* each_component : *m_Rescuer->GetComponents() ) for( SCH_COMPONENT* each_component : *m_Rescuer->GetComponents() )
{ {
if( each_component->GetLibId().Format() != UTF8( selected_part.GetRequestedName() ) ) if( each_component->GetLibId().Format() != TO_UTF8( selected_part.GetRequestedName() ) )
continue; continue;
SCH_FIELD* valueField = each_component->GetField( 1 ); SCH_FIELD* valueField = each_component->GetField( 1 );

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2017 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008-2017 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2017 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -55,7 +55,8 @@ void SCH_EDIT_FRAME::EditComponentFieldText( SCH_FIELD* aField )
LIB_PART* part = Prj().SchLibs()->FindLibPart( component->GetLibId() ); LIB_PART* part = Prj().SchLibs()->FindLibPart( component->GetLibId() );
wxCHECK_RET( part, wxT( "Library part for component <" ) + wxCHECK_RET( part, wxT( "Library part for component <" ) +
component->GetLibId().GetLibItemName() + wxT( "> could not be found." ) ); FROM_UTF8( component->GetLibId().GetLibItemName() ) +
wxT( "> could not be found." ) );
// Save old component in undo list if not already in edit, or moving. // Save old component in undo list if not already in edit, or moving.
if( aField->GetFlags() == 0 ) if( aField->GetFlags() == 0 )

View File

@ -237,7 +237,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component(
// alias exists because its root component was found // alias exists because its root component was found
LIB_ID libId; LIB_ID libId;
libId.SetLibItemName( sel.Name, false ); libId.SetLibItemName( TO_UTF8( sel.Name ), false );
component->SetLibId( libId ); component->SetLibId( libId );
// Be sure the link to the corresponding LIB_PART is OK: // Be sure the link to the corresponding LIB_PART is OK:

View File

@ -85,7 +85,7 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName )
SCH_COMPONENT* component = (SCH_COMPONENT*) item; SCH_COMPONENT* component = (SCH_COMPONENT*) item;
if( !cacheLib->FindAlias( component->GetLibId().GetLibItemName() ) ) if( !cacheLib->FindAlias( FROM_UTF8( component->GetLibId().GetLibItemName() ) ) )
{ {
LIB_PART* part = NULL; LIB_PART* part = NULL;
@ -102,7 +102,7 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName )
catch( ... /* IO_ERROR ioe */ ) catch( ... /* IO_ERROR ioe */ )
{ {
msg.Printf( _( "Failed to add symbol %s to library file '%s'" ), msg.Printf( _( "Failed to add symbol %s to library file '%s'" ),
wxString( component->GetLibId().GetLibItemName() ), aFileName ); FROM_UTF8( component->GetLibId().GetLibItemName() ), aFileName );
DisplayError( this, msg ); DisplayError( this, msg );
return false; return false;
} }

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 1992-2013 jp.charras at wanadoo.fr * Copyright (C) 1992-2013 jp.charras at wanadoo.fr
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.TXT for contributors. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -174,7 +174,7 @@ XNODE* NETLIST_EXPORTER_GENERIC::makeComponents()
xlibsource->AddAttribute( sLib, part->GetLib()->GetLogicalName() ); xlibsource->AddAttribute( sLib, part->GetLib()->GetLogicalName() );
// We only want the symbol name, not the full LIB_ID. // We only want the symbol name, not the full LIB_ID.
xlibsource->AddAttribute( sPart, comp->GetLibId().GetLibItemName() ); xlibsource->AddAttribute( sPart, FROM_UTF8( comp->GetLibId().GetLibItemName() ) );
XNODE* xsheetpath; XNODE* xsheetpath;

View File

@ -1,8 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015 Chris Pavlina <pavlina.chris@gmail.com> * Copyright (C) 2015-2017 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2015-2017 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -264,7 +263,7 @@ public:
for( SCH_COMPONENT* each_component : *( aRescuer.GetComponents() ) ) for( SCH_COMPONENT* each_component : *( aRescuer.GetComponents() ) )
{ {
wxString part_name( each_component->GetLibId().GetLibItemName() ); wxString part_name( FROM_UTF8( each_component->GetLibId().GetLibItemName() ) );
if( last_part_name != part_name ) if( last_part_name != part_name )
{ {
@ -327,12 +326,12 @@ public:
{ {
for( SCH_COMPONENT* each_component : *aRescuer->GetComponents() ) for( SCH_COMPONENT* each_component : *aRescuer->GetComponents() )
{ {
if( each_component->GetLibId().GetLibItemName() != UTF8( m_requested_name ) ) if( each_component->GetLibId().GetLibItemName() != TO_UTF8( m_requested_name ) )
continue; continue;
LIB_ID libId; LIB_ID libId;
libId.SetLibItemName( m_new_name, false ); libId.SetLibItemName( TO_UTF8( m_new_name ), false );
each_component->SetLibId( libId ); each_component->SetLibId( libId );
each_component->ClearFlags(); each_component->ClearFlags();
aRescuer->LogRescue( each_component, m_requested_name, m_new_name ); aRescuer->LogRescue( each_component, m_requested_name, m_new_name );
@ -373,7 +372,7 @@ public:
for( SCH_COMPONENT* each_component : *( aRescuer.GetComponents() ) ) for( SCH_COMPONENT* each_component : *( aRescuer.GetComponents() ) )
{ {
wxString part_name( each_component->GetLibId().GetLibItemName() ); wxString part_name( FROM_UTF8( each_component->GetLibId().GetLibItemName() ) );
if( old_part_name != part_name ) if( old_part_name != part_name )
{ {
@ -462,12 +461,12 @@ public:
for( SCH_COMPONENT* each_component : *aRescuer->GetComponents() ) for( SCH_COMPONENT* each_component : *aRescuer->GetComponents() )
{ {
if( each_component->GetLibId().GetLibItemName() != UTF8( m_requested_name ) ) if( each_component->GetLibId().GetLibItemName() != TO_UTF8( m_requested_name ) )
continue; continue;
LIB_ID libId; LIB_ID libId;
libId.SetLibItemName( m_new_name, false ); libId.SetLibItemName( TO_UTF8( m_new_name ), false );
each_component->SetLibId( libId ); each_component->SetLibId( libId );
each_component->ClearFlags(); each_component->ClearFlags();
aRescuer->LogRescue( each_component, m_requested_name, m_new_name ); aRescuer->LogRescue( each_component, m_requested_name, m_new_name );
@ -543,7 +542,7 @@ void RESCUER::UndoRescues()
{ {
LIB_ID libId; LIB_ID libId;
libId.SetLibItemName( each_logitem.old_name, false ); libId.SetLibItemName( TO_UTF8( each_logitem.old_name ), false );
each_logitem.component->SetLibId( libId ); each_logitem.component->SetLibId( libId );
each_logitem.component->ClearFlags(); each_logitem.component->ClearFlags();
} }

View File

@ -1,8 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015 Chris Pavlina <pavlina.chris@gmail.com> * Copyright (C) 2015-2017 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2015 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -131,7 +131,7 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET_PATH* sheet, int unit,
m_unit = unit; m_unit = unit;
m_convert = convert; m_convert = convert;
m_lib_id.SetLibItemName( aPart.GetName(), false ); m_lib_id.SetLibItemName( TO_UTF8( aPart.GetName() ), false );
m_part = aPart.SharedPtr(); m_part = aPart.SharedPtr();
m_currentSheetPath = NULL; m_currentSheetPath = NULL;
m_fieldsAutoplaced = AUTOPLACED_NO; m_fieldsAutoplaced = AUTOPLACED_NO;
@ -191,7 +191,7 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET_PATH* sheet, int unit,
SetRef( sheet, msg ); SetRef( sheet, msg );
// Use the schematic component name instead of the library value field name. // Use the schematic component name instead of the library value field name.
GetField( VALUE )->SetText( GetLibId().GetLibItemName() ); GetField( VALUE )->SetText( FROM_UTF8( GetLibId().GetLibItemName() ) );
} }
@ -1105,7 +1105,7 @@ bool SCH_COMPONENT::Save( FILE* f ) const
name1 = toUTFTildaText( GetField( REFERENCE )->GetText() ); name1 = toUTFTildaText( GetField( REFERENCE )->GetText() );
} }
wxString part_name = GetLibId().GetLibItemName(); wxString part_name = FROM_UTF8( GetLibId().GetLibItemName() );
if( part_name.size() ) if( part_name.size() )
{ {
@ -1250,7 +1250,7 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
if( partname != NULL_STRING ) if( partname != NULL_STRING )
{ {
m_lib_id.SetLibItemName( partname, false ); m_lib_id.SetLibItemName( TO_UTF8( partname ), false );
if( !newfmt ) if( !newfmt )
GetField( VALUE )->SetText( partname ); GetField( VALUE )->SetText( partname );
@ -1579,7 +1579,7 @@ void SCH_COMPONENT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
// part and alias can differ if alias is not the root // part and alias can differ if alias is not the root
if( PART_SPTR part = m_part.lock() ) if( PART_SPTR part = m_part.lock() )
{ {
LIB_ALIAS* alias = part->GetAlias( GetLibId().GetLibItemName() ); LIB_ALIAS* alias = part->GetAlias( FROM_UTF8( GetLibId().GetLibItemName() ) );
if( !alias ) if( !alias )
return; return;
@ -1594,7 +1594,8 @@ void SCH_COMPONENT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
aList.push_back( MSG_PANEL_ITEM( msg, GetField( VALUE )->GetShownText(), DARKCYAN ) ); aList.push_back( MSG_PANEL_ITEM( msg, GetField( VALUE )->GetShownText(), DARKCYAN ) );
// Display component reference in library and library // Display component reference in library and library
aList.push_back( MSG_PANEL_ITEM( _( "Component" ), GetLibId().GetLibItemName(), BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Component" ), FROM_UTF8( GetLibId().GetLibItemName() ),
BROWN ) );
if( alias->GetName() != part->GetName() ) if( alias->GetName() != part->GetName() )
aList.push_back( MSG_PANEL_ITEM( _( "Alias of" ), part->GetName(), BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Alias of" ), part->GetName(), BROWN ) );
@ -1839,7 +1840,8 @@ void SCH_COMPONENT::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
{ {
wxCHECK_RET( 0, wxCHECK_RET( 0,
wxT( "Cannot add connection points to list. Cannot find component <" ) + wxT( "Cannot add connection points to list. Cannot find component <" ) +
GetLibId().GetLibItemName() + wxT( "> in any of the loaded libraries." ) ); FROM_UTF8( GetLibId().GetLibItemName() ) +
wxT( "> in any of the loaded libraries." ) );
} }
} }
@ -1862,7 +1864,7 @@ wxString SCH_COMPONENT::GetSelectMenuText() const
{ {
wxString tmp; wxString tmp;
tmp.Printf( _( "Component %s, %s" ), tmp.Printf( _( "Component %s, %s" ),
GetChars( GetLibId().GetLibItemName() ), FROM_UTF8( GetLibId().GetLibItemName() ),
GetChars( GetField( REFERENCE )->GetShownText() ) ); GetChars( GetField( REFERENCE )->GetShownText() ) );
return tmp; return tmp;
} }

View File

@ -1668,7 +1668,7 @@ void SCH_LEGACY_PLUGIN::saveComponent( SCH_COMPONENT* aComponent )
name1 = toUTFTildaText( aComponent->GetField( REFERENCE )->GetText() ); name1 = toUTFTildaText( aComponent->GetField( REFERENCE )->GetText() );
} }
wxString part_name = aComponent->GetLibId().GetLibItemName(); wxString part_name = FROM_UTF8( aComponent->GetLibId().GetLibItemName() );
if( part_name.size() ) if( part_name.size() )
{ {

View File

@ -249,12 +249,12 @@ LIB_ALIAS* SYMBOL_LIB_TABLE::LoadSymbol( const wxString& aNickname, const wxStri
LIB_ID& id = (LIB_ID&) ret->GetPart()->GetLibId(); LIB_ID& id = (LIB_ID&) ret->GetPart()->GetLibId();
// Catch any misbehaving plugin, which should be setting internal alias name properly: // Catch any misbehaving plugin, which should be setting internal alias name properly:
wxASSERT( aAliasName == (wxString) id.GetLibItemName() ); wxASSERT( aAliasName == FROM_UTF8( id.GetLibItemName() ) );
// and clearing nickname // and clearing nickname
wxASSERT( !id.GetLibNickname().size() ); wxASSERT( !id.GetLibNickname().size() );
id.SetLibNickname( row->GetNickName() ); id.SetLibNickname( TO_UTF8( row->GetNickName() ) );
} }
return ret; return ret;
@ -272,7 +272,7 @@ SYMBOL_LIB_TABLE::SAVE_T SYMBOL_LIB_TABLE::SaveSymbol( const wxString& aNickname
// Try loading the footprint to see if it already exists, caller wants overwrite // Try loading the footprint to see if it already exists, caller wants overwrite
// protection, which is atypical, not the default. // protection, which is atypical, not the default.
wxString name = aSymbol->GetLibId().GetLibItemName(); wxString name = FROM_UTF8( aSymbol->GetLibId().GetLibItemName() );
std::unique_ptr< LIB_ALIAS > symbol( row->plugin->LoadSymbol( row->GetFullURI( true ), std::unique_ptr< LIB_ALIAS > symbol( row->plugin->LoadSymbol( row->GetFullURI( true ),
name, name,
@ -333,8 +333,8 @@ void SYMBOL_LIB_TABLE::CreateSymbolLib( const wxString& aNickname )
LIB_ALIAS* SYMBOL_LIB_TABLE::LoadSymbolWithOptionalNickname( const LIB_ID& aLibId ) LIB_ALIAS* SYMBOL_LIB_TABLE::LoadSymbolWithOptionalNickname( const LIB_ID& aLibId )
throw( IO_ERROR, PARSE_ERROR, boost::interprocess::lock_exception ) throw( IO_ERROR, PARSE_ERROR, boost::interprocess::lock_exception )
{ {
wxString nickname = aLibId.GetLibNickname(); wxString nickname = FROM_UTF8( aLibId.GetLibNickname() );
wxString name = aLibId.GetLibItemName(); wxString name = FROM_UTF8( aLibId.GetLibItemName() );
if( nickname.size() ) if( nickname.size() )
{ {

View File

@ -11,7 +11,7 @@
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* *
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -109,12 +109,12 @@ MODULE* BOARD_NETLIST_UPDATER::addNewComponent( COMPONENT* aComponent )
msg.Printf( _( "Adding new component \"%s:%s\" footprint \"%s\".\n" ), msg.Printf( _( "Adding new component \"%s:%s\" footprint \"%s\".\n" ),
GetChars( aComponent->GetReference() ), GetChars( aComponent->GetReference() ),
GetChars( aComponent->GetTimeStamp() ), GetChars( aComponent->GetTimeStamp() ),
GetChars( aComponent->GetFPID().Format() ) ); GetChars( FROM_UTF8( aComponent->GetFPID().Format() ) ) );
m_reporter->Report( msg, REPORTER::RPT_INFO ); m_reporter->Report( msg, REPORTER::RPT_INFO );
msg.Printf( _( "Add component %s, footprint: %s.\n" ), msg.Printf( _( "Add component %s, footprint: %s.\n" ),
GetChars( aComponent->GetReference() ), GetChars( aComponent->GetReference() ),
GetChars( aComponent->GetFPID().Format() ) ); GetChars( FROM_UTF8( aComponent->GetFPID().Format() ) ) );
m_reporter->Report( msg, REPORTER::RPT_ACTION ); m_reporter->Report( msg, REPORTER::RPT_ACTION );
@ -136,7 +136,7 @@ MODULE* BOARD_NETLIST_UPDATER::addNewComponent( COMPONENT* aComponent )
{ {
msg.Printf( _( "Cannot add component %s due to missing footprint %s.\n" ), msg.Printf( _( "Cannot add component %s due to missing footprint %s.\n" ),
GetChars( aComponent->GetReference() ), GetChars( aComponent->GetReference() ),
GetChars( aComponent->GetFPID().Format() ) ); GetChars( FROM_UTF8( aComponent->GetFPID().Format() ) ) );
m_reporter->Report( msg, REPORTER::RPT_ERROR ); m_reporter->Report( msg, REPORTER::RPT_ERROR );
@ -144,7 +144,7 @@ MODULE* BOARD_NETLIST_UPDATER::addNewComponent( COMPONENT* aComponent )
"footprint \"%s\".\n" ), "footprint \"%s\".\n" ),
GetChars( aComponent->GetReference() ), GetChars( aComponent->GetReference() ),
GetChars( aComponent->GetTimeStamp() ), GetChars( aComponent->GetTimeStamp() ),
GetChars( aComponent->GetFPID().Format() ) ); GetChars( FROM_UTF8( aComponent->GetFPID().Format() ) ) );
m_reporter->Report( msg, REPORTER::RPT_INFO ); m_reporter->Report( msg, REPORTER::RPT_INFO );
++m_errorCount; ++m_errorCount;
@ -169,8 +169,8 @@ MODULE* BOARD_NETLIST_UPDATER::replaceComponent( NETLIST& aNetlist, MODULE* aPcb
{ {
msg.Printf( _( "Change component %s footprint from %s to %s.\n"), msg.Printf( _( "Change component %s footprint from %s to %s.\n"),
GetChars( aPcbComponent->GetReference() ), GetChars( aPcbComponent->GetReference() ),
GetChars( aPcbComponent->GetFPID().Format() ), GetChars( FROM_UTF8( aPcbComponent->GetFPID().Format() ) ),
GetChars( aNewComponent->GetFPID().Format() ) ); GetChars( FROM_UTF8( aNewComponent->GetFPID().Format() ) ) );
m_reporter->Report( msg, REPORTER::RPT_ACTION ); m_reporter->Report( msg, REPORTER::RPT_ACTION );
@ -178,8 +178,8 @@ MODULE* BOARD_NETLIST_UPDATER::replaceComponent( NETLIST& aNetlist, MODULE* aPcb
"\"%s\".\n" ), "\"%s\".\n" ),
GetChars( aPcbComponent->GetReference() ), GetChars( aPcbComponent->GetReference() ),
GetChars( aPcbComponent->GetPath() ), GetChars( aPcbComponent->GetPath() ),
GetChars( aPcbComponent->GetFPID().Format() ), GetChars( FROM_UTF8( aPcbComponent->GetFPID().Format() ) ),
GetChars( aNewComponent->GetFPID().Format() ) ); GetChars( FROM_UTF8( aNewComponent->GetFPID().Format() ) ) );
m_reporter->Report( msg, REPORTER::RPT_INFO ); m_reporter->Report( msg, REPORTER::RPT_INFO );
@ -207,7 +207,7 @@ MODULE* BOARD_NETLIST_UPDATER::replaceComponent( NETLIST& aNetlist, MODULE* aPcb
msg.Printf( _( "Cannot change component %s footprint due to missing " msg.Printf( _( "Cannot change component %s footprint due to missing "
"footprint %s.\n" ), "footprint %s.\n" ),
GetChars( aPcbComponent->GetReference() ), GetChars( aPcbComponent->GetReference() ),
GetChars( aNewComponent->GetFPID().Format() ) ); GetChars( FROM_UTF8( aNewComponent->GetFPID().Format() ) ) );
m_reporter->Report( msg, REPORTER::RPT_ERROR ); m_reporter->Report( msg, REPORTER::RPT_ERROR );
@ -215,7 +215,7 @@ MODULE* BOARD_NETLIST_UPDATER::replaceComponent( NETLIST& aNetlist, MODULE* aPcb
"footprint \"%s\".\n" ), "footprint \"%s\".\n" ),
GetChars( aPcbComponent->GetReference() ), GetChars( aPcbComponent->GetReference() ),
GetChars( aPcbComponent->GetPath() ), GetChars( aPcbComponent->GetPath() ),
GetChars( aNewComponent->GetFPID().Format() ) ); GetChars( FROM_UTF8( aNewComponent->GetFPID().Format() ) ) );
m_reporter->Report( msg, REPORTER::RPT_INFO ); m_reporter->Report( msg, REPORTER::RPT_INFO );
@ -582,7 +582,7 @@ bool BOARD_NETLIST_UPDATER::testConnectivity( NETLIST& aNetlist )
msg.Printf( _( "Component %s pad %s not found in footprint %s\n" ), msg.Printf( _( "Component %s pad %s not found in footprint %s\n" ),
GetChars( component->GetReference() ), GetChars( component->GetReference() ),
GetChars( padname ), GetChars( padname ),
GetChars( footprint->GetFPID().Format() ) ); GetChars( FROM_UTF8( footprint->GetFPID().Format() ) ) );
m_reporter->Report( msg, REPORTER::RPT_ERROR ); m_reporter->Report( msg, REPORTER::RPT_ERROR );
++m_errorCount; ++m_errorCount;
} }
@ -630,7 +630,7 @@ bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist )
msg.Printf( _( "Processing component \"%s:%s:%s\".\n" ), msg.Printf( _( "Processing component \"%s:%s:%s\".\n" ),
GetChars( component->GetReference() ), GetChars( component->GetReference() ),
GetChars( component->GetTimeStamp() ), GetChars( component->GetTimeStamp() ),
GetChars( component->GetFPID().Format() ) ); GetChars( FROM_UTF8( component->GetFPID().Format() ) ) );
m_reporter->Report( msg, REPORTER::RPT_INFO ); m_reporter->Report( msg, REPORTER::RPT_INFO );
if( aNetlist.IsFindByTimeStamp() ) if( aNetlist.IsFindByTimeStamp() )

View File

@ -10,7 +10,7 @@
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* *
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -2457,7 +2457,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
msg.Printf( _( "Checking netlist component footprint \"%s:%s:%s\".\n" ), msg.Printf( _( "Checking netlist component footprint \"%s:%s:%s\".\n" ),
GetChars( component->GetReference() ), GetChars( component->GetReference() ),
GetChars( component->GetTimeStamp() ), GetChars( component->GetTimeStamp() ),
GetChars( component->GetFPID().Format() ) ); GetChars( FROM_UTF8( component->GetFPID().Format() ) ) );
aReporter->Report( msg, REPORTER::RPT_INFO ); aReporter->Report( msg, REPORTER::RPT_INFO );
} }
@ -2475,7 +2475,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
msg.Printf( _( "Adding new component \"%s:%s\" footprint \"%s\".\n" ), msg.Printf( _( "Adding new component \"%s:%s\" footprint \"%s\".\n" ),
GetChars( component->GetReference() ), GetChars( component->GetReference() ),
GetChars( component->GetTimeStamp() ), GetChars( component->GetTimeStamp() ),
GetChars( component->GetFPID().Format() ) ); GetChars( FROM_UTF8( component->GetFPID().Format() ) ) );
aReporter->Report( msg, REPORTER::RPT_ACTION ); aReporter->Report( msg, REPORTER::RPT_ACTION );
} }
@ -2485,7 +2485,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
"footprint \"%s\".\n" ), "footprint \"%s\".\n" ),
GetChars( component->GetReference() ), GetChars( component->GetReference() ),
GetChars( component->GetTimeStamp() ), GetChars( component->GetTimeStamp() ),
GetChars( component->GetFPID().Format() ) ); GetChars( FROM_UTF8( component->GetFPID().Format() ) ) );
aReporter->Report( msg, REPORTER::RPT_ERROR ); aReporter->Report( msg, REPORTER::RPT_ERROR );
} }
@ -2518,8 +2518,8 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
"\"%s\".\n" ), "\"%s\".\n" ),
GetChars( footprint->GetReference() ), GetChars( footprint->GetReference() ),
GetChars( footprint->GetPath() ), GetChars( footprint->GetPath() ),
GetChars( footprint->GetFPID().Format() ), GetChars( FROM_UTF8( footprint->GetFPID().Format() ) ),
GetChars( component->GetFPID().Format() ) ); GetChars( FROM_UTF8( component->GetFPID().Format() ) ) );
aReporter->Report( msg, REPORTER::RPT_ACTION ); aReporter->Report( msg, REPORTER::RPT_ACTION );
} }
@ -2529,7 +2529,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
"footprint \"%s\".\n" ), "footprint \"%s\".\n" ),
GetChars( footprint->GetReference() ), GetChars( footprint->GetReference() ),
GetChars( footprint->GetPath() ), GetChars( footprint->GetPath() ),
GetChars( component->GetFPID().Format() ) ); GetChars( FROM_UTF8( component->GetFPID().Format() ) ) );
aReporter->Report( msg, REPORTER::RPT_ERROR ); aReporter->Report( msg, REPORTER::RPT_ERROR );
} }
@ -2814,7 +2814,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
msg.Printf( _( "Component '%s' pad '%s' not found in footprint '%s'\n" ), msg.Printf( _( "Component '%s' pad '%s' not found in footprint '%s'\n" ),
GetChars( component->GetReference() ), GetChars( component->GetReference() ),
GetChars( padname ), GetChars( padname ),
GetChars( footprint->GetFPID().Format() ) ); GetChars( FROM_UTF8( footprint->GetFPID().Format() ) ) );
aReporter->Report( msg, REPORTER::RPT_ERROR ); aReporter->Report( msg, REPORTER::RPT_ERROR );
} }
} }

View File

@ -10,7 +10,7 @@
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 Dick Hollenbeck, dick@softplc.com * Copyright (C) 2015 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2008-2016 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008-2016 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -172,7 +172,7 @@ void DIALOG_MODULE_MODULE_EDITOR::initModeditProperties()
m_valueCopy->SetParent( m_currentModule ); m_valueCopy->SetParent( m_currentModule );
m_ReferenceCtrl->SetValue( m_referenceCopy->GetText() ); m_ReferenceCtrl->SetValue( m_referenceCopy->GetText() );
m_ValueCtrl->SetValue( m_valueCopy->GetText() ); m_ValueCtrl->SetValue( m_valueCopy->GetText() );
m_FootprintNameCtrl->SetValue( m_currentModule->GetFPID().Format() ); m_FootprintNameCtrl->SetValue( FROM_UTF8( m_currentModule->GetFPID().Format() ) );
m_AttributsCtrl->SetItemToolTip( 0, _( "Use this attribute for most non SMD components" ) ); m_AttributsCtrl->SetItemToolTip( 0, _( "Use this attribute for most non SMD components" ) );
m_AttributsCtrl->SetItemToolTip( 1, m_AttributsCtrl->SetItemToolTip( 1,

View File

@ -311,8 +311,8 @@ bool DIALOG_EXCHANGE_MODULE::change_1_Module( MODULE* aModule,
// Load module. // Load module.
line.Printf( _( "Change footprint '%s' (from '%s') to '%s'" ), line.Printf( _( "Change footprint '%s' (from '%s') to '%s'" ),
GetChars( aModule->GetReference() ), GetChars( aModule->GetReference() ),
oldFootprintFPID.Format().c_str(), FROM_UTF8( oldFootprintFPID.Format() ),
aNewFootprintFPID.Format().c_str() ); FROM_UTF8( aNewFootprintFPID.Format() ) );
m_WinMessages->AppendText( line ); m_WinMessages->AppendText( line );
newModule = m_parent->LoadFootprint( aNewFootprintFPID ); newModule = m_parent->LoadFootprint( aNewFootprintFPID );

View File

@ -4,7 +4,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2016 KiCad Developers, see CHANGELOG.TXT for contributors. * Copyright (C) 2015-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -487,7 +487,7 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName,
lenRefText = std::max( lenRefText, int(item.m_Reference.length()) ); lenRefText = std::max( lenRefText, int(item.m_Reference.length()) );
lenValText = std::max( lenValText, int(item.m_Value.length()) ); lenValText = std::max( lenValText, int(item.m_Value.length()) );
lenPkgText = std::max( lenPkgText, int(item.m_Module->GetFPID().GetLibItemName().length()) ); lenPkgText = std::max( lenPkgText, int(FROM_UTF8( item.m_Module->GetFPID().GetLibItemName() ).length()) );
} }
if( aFullFileName.IsEmpty() ) if( aFullFileName.IsEmpty() )
@ -524,7 +524,7 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName,
line << csv_sep; line << csv_sep;
line << list[ii].m_Value; line << list[ii].m_Value;
line << csv_sep; line << csv_sep;
line << wxString( list[ii].m_Module->GetFPID().GetLibItemName() ); line << FROM_UTF8( list[ii].m_Module->GetFPID().GetLibItemName() );
line << csv_sep; line << csv_sep;
line << wxString::Format( "%f%c%f%c%f", line << wxString::Format( "%f%c%f%c%f",
@ -579,7 +579,7 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName,
const wxString& ref = list[ii].m_Reference; const wxString& ref = list[ii].m_Reference;
const wxString& val = list[ii].m_Value; const wxString& val = list[ii].m_Value;
const wxString& pkg = list[ii].m_Module->GetFPID().GetLibItemName(); const wxString pkg = FROM_UTF8( list[ii].m_Module->GetFPID().GetLibItemName() );
fprintf(file, "%-*s %-*s %-*s %9.4f %9.4f %8.4f %s\n", fprintf(file, "%-*s %-*s %-*s %9.4f %9.4f %8.4f %s\n",
lenRefText, TO_UTF8( ref ), lenRefText, TO_UTF8( ref ),

View File

@ -5,7 +5,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 1992-2011 Jean-Pierre Charras. * Copyright (C) 1992-2011 Jean-Pierre Charras.
* Copyright (C) 1992-2016 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -363,7 +363,7 @@ void KICAD_NETLIST_PARSER::parseComponent() throw( IO_ERROR, PARSE_ERROR, boost:
} }
} }
if( !footprint.IsEmpty() && fpid.Parse( footprint ) >= 0 ) if( !footprint.IsEmpty() && fpid.Parse( TO_UTF8( footprint ) ) >= 0 )
{ {
wxString error; wxString error;
error.Printf( _( "invalid footprint ID in\nfile: <%s>\nline: %d\noffset: %d" ), error.Printf( _( "invalid footprint ID in\nfile: <%s>\nline: %d\noffset: %d" ),

View File

@ -1899,7 +1899,7 @@ void PCB_IO::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootpri
MODULE_MAP& mods = m_cache->GetModules(); MODULE_MAP& mods = m_cache->GetModules();
// Quietly overwrite module and delete module file from path for any by same name. // Quietly overwrite module and delete module file from path for any by same name.
wxFileName fn( aLibraryPath, aFootprint->GetFPID().GetLibItemName(), wxFileName fn( aLibraryPath, FROM_UTF8( aFootprint->GetFPID().GetLibItemName() ),
KiCadFootprintFileExtension ); KiCadFootprintFileExtension );
if( !fn.IsOk() ) if( !fn.IsOk() )

View File

@ -7,7 +7,7 @@
* *
* Copyright (C) 1992-2011 Jean-Pierre Charras. * Copyright (C) 1992-2011 Jean-Pierre Charras.
* Copyright (C) 2013-2016 Wayne Stambaugh <stambaughw@verizon.net>. * Copyright (C) 2013-2016 Wayne Stambaugh <stambaughw@verizon.net>.
* Copyright (C) 1992-2016 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -169,7 +169,7 @@ COMPONENT* LEGACY_NETLIST_READER::loadComponent( char* aText )
LIB_ID fpid; LIB_ID fpid;
if( !footprintName.IsEmpty() ) if( !footprintName.IsEmpty() )
fpid.SetLibItemName( footprintName ); fpid.SetLibItemName( TO_UTF8( footprintName ) );
COMPONENT* component = new COMPONENT( fpid, reference, value, timeStamp ); COMPONENT* component = new COMPONENT( fpid, reference, value, timeStamp );
component->SetName( name ); component->SetName( name );

View File

@ -1373,7 +1373,7 @@ void LEGACY_PLUGIN::loadMODULE( MODULE* aModule )
wxString msg = wxString::Format( wxString msg = wxString::Format(
wxT( "Missing '$EndMODULE' for MODULE '%s'" ), wxT( "Missing '$EndMODULE' for MODULE '%s'" ),
GetChars( aModule->GetFPID().GetLibItemName() ) ); FROM_UTF8( aModule->GetFPID().GetLibItemName() ) );
THROW_IO_ERROR( msg ); THROW_IO_ERROR( msg );
} }
@ -1428,7 +1428,7 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule )
padchar, padchar,
padchar, padchar,
m_reader->LineNumber(), m_reader->LineNumber(),
GetChars( aModule->GetFPID().GetLibItemName() ) FROM_UTF8( aModule->GetFPID().GetLibItemName() )
); );
THROW_IO_ERROR( m_error ); THROW_IO_ERROR( m_error );
} }
@ -1634,7 +1634,7 @@ void LEGACY_PLUGIN::loadMODULE_EDGE( MODULE* aModule )
(unsigned char) line[1], (unsigned char) line[1],
(unsigned char) line[1], (unsigned char) line[1],
m_reader->LineNumber(), m_reader->LineNumber(),
GetChars( aModule->GetFPID().GetLibItemName() ) FROM_UTF8( aModule->GetFPID().GetLibItemName() )
); );
THROW_IO_ERROR( m_error ); THROW_IO_ERROR( m_error );
} }

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -339,7 +339,7 @@ void FOOTPRINT_EDIT_FRAME::Export_Module( MODULE* aModule )
if( !aModule ) if( !aModule )
return; return;
fn.SetName( aModule->GetFPID().GetLibItemName() ); fn.SetName( FROM_UTF8( aModule->GetFPID().GetLibItemName() ) );
wxString wildcard = wxGetTranslation( KiCadFootprintLibFileWildcard ); wxString wildcard = wxGetTranslation( KiCadFootprintLibFileWildcard );
@ -535,7 +535,7 @@ bool FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary()
return false; return false;
LIB_ID fpid( fpid_txt ); LIB_ID fpid( fpid_txt );
wxString fpname = fpid.GetLibItemName(); wxString fpname = FROM_UTF8( fpid.GetLibItemName() );
// Confirmation // Confirmation
wxString msg = wxString::Format( FMT_OK_DELETE, fpname.GetData(), nickname.GetData() ); wxString msg = wxString::Format( FMT_OK_DELETE, fpname.GetData(), nickname.GetData() );
@ -649,7 +649,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary( const wxString& aLibrary,
} }
// Ask what to use as the footprint name in the library // Ask what to use as the footprint name in the library
wxString footprintName = aModule->GetFPID().GetLibItemName(); wxString footprintName = FROM_UTF8( aModule->GetFPID().GetLibItemName() );
if( aDisplayDialog ) if( aDisplayDialog )
{ {

View File

@ -226,7 +226,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary,
LIB_ID fpid; LIB_ID fpid;
wxCHECK_MSG( fpid.Parse( moduleName ) < 0, NULL, wxCHECK_MSG( fpid.Parse( TO_UTF8( moduleName ) ) < 0, NULL,
wxString::Format( wxT( "Could not parse LIB_ID string '%s'." ), wxString::Format( wxT( "Could not parse LIB_ID string '%s'." ),
GetChars( moduleName ) ) ); GetChars( moduleName ) ) );
@ -237,7 +237,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary,
catch( const IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {
wxLogDebug( wxT( "An error occurred attemping to load footprint '%s'.\n\nError: %s" ), wxLogDebug( wxT( "An error occurred attemping to load footprint '%s'.\n\nError: %s" ),
fpid.Format().c_str(), GetChars( ioe.What() ) ); FROM_UTF8( fpid.Format() ), GetChars( ioe.What() ) );
} }
if( !module && allowWildSeach ) // Search with wild card if( !module && allowWildSeach ) // Search with wild card
@ -256,7 +256,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary,
} }
else else
{ {
wxCHECK_MSG( fpid.Parse( moduleName ) < 0, NULL, wxCHECK_MSG( fpid.Parse( TO_UTF8( moduleName ) ) < 0, NULL,
wxString::Format( wxT( "Could not parse LIB_ID string '%s'." ), wxString::Format( wxT( "Could not parse LIB_ID string '%s'." ),
GetChars( moduleName ) ) ); GetChars( moduleName ) ) );
@ -267,7 +267,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary,
catch( const IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {
wxLogDebug( wxT( "An error occurred attemping to load footprint '%s'.\n\nError: %s" ), wxLogDebug( wxT( "An error occurred attemping to load footprint '%s'.\n\nError: %s" ),
fpid.Format().c_str(), GetChars( ioe.What() ) ); FROM_UTF8( fpid.Format() ), GetChars( ioe.What() ) );
} }
} }
} }
@ -324,7 +324,7 @@ MODULE* PCB_BASE_FRAME::LoadFootprint( const LIB_ID& aFootprintId )
catch( const IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {
wxLogDebug( wxT( "An error occurred attemping to load footprint '%s'.\n\nError: %s" ), wxLogDebug( wxT( "An error occurred attemping to load footprint '%s'.\n\nError: %s" ),
aFootprintId.Format().c_str(), GetChars( ioe.What() ) ); FROM_UTF8( aFootprintId.Format() ), GetChars( ioe.What() ) );
} }
return module; return module;

View File

@ -211,8 +211,8 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
{ {
LIB_ID id; LIB_ID id;
id.SetLibNickname( getCurNickname() ); id.SetLibNickname( TO_UTF8( getCurNickname() ) );
id.SetLibItemName( getCurFootprintName() ); id.SetLibItemName( TO_UTF8( getCurFootprintName() ) );
GetBoard()->Add( loadFootprint( id ) ); GetBoard()->Add( loadFootprint( id ) );
} }
@ -456,8 +456,8 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event )
GetBoard()->m_Modules.DeleteAll(); GetBoard()->m_Modules.DeleteAll();
LIB_ID id; LIB_ID id;
id.SetLibNickname( getCurNickname() ); id.SetLibNickname( TO_UTF8( getCurNickname() ) );
id.SetLibItemName( getCurFootprintName() ); id.SetLibItemName( TO_UTF8( getCurFootprintName() ) );
try try
{ {
@ -519,10 +519,10 @@ void FOOTPRINT_VIEWER_FRAME::ExportSelectedFootprint( wxCommandEvent& event )
LIB_ID fpid; LIB_ID fpid;
fpid.SetLibNickname( getCurNickname() ); fpid.SetLibNickname( TO_UTF8( getCurNickname() ) );
fpid.SetLibItemName( fp_name ); fpid.SetLibItemName( TO_UTF8( fp_name ) );
DismissModal( true, fpid.Format() ); DismissModal( true, FROM_UTF8( fpid.Format() ) );
} }
else else
{ {
@ -779,9 +779,9 @@ void FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint( wxCommandEvent& event )
delete oldmodule; delete oldmodule;
} }
setCurFootprintName( module->GetFPID().GetLibItemName() ); setCurFootprintName( FROM_UTF8( module->GetFPID().GetLibItemName() ) );
wxString nickname = module->GetFPID().GetLibNickname(); wxString nickname = FROM_UTF8( module->GetFPID().GetLibNickname() );
if( !getCurNickname() && nickname.size() ) if( !getCurNickname() && nickname.size() )
{ {

View File

@ -7,7 +7,7 @@
* Copyright (C) 1992-2013 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 1992-2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2013-2016 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2013-2016 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2016 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -275,8 +275,8 @@ void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER* aReporter )
{ {
msg.Printf( _( "Footprint of component '%s' changed: board footprint '%s', netlist footprint '%s'\n" ), msg.Printf( _( "Footprint of component '%s' changed: board footprint '%s', netlist footprint '%s'\n" ),
GetChars( component->GetReference() ), GetChars( component->GetReference() ),
GetChars( fpOnBoard->GetFPID().Format() ), GetChars( FROM_UTF8( fpOnBoard->GetFPID().Format() ) ),
GetChars( component->GetFPID().Format() ) ); GetChars( FROM_UTF8( component->GetFPID().Format() ) ) );
aReporter->Report( msg, REPORTER::RPT_WARNING ); aReporter->Report( msg, REPORTER::RPT_WARNING );
} }
@ -305,7 +305,7 @@ void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER* aReporter )
msg.Printf( _( "Component '%s' footprint ID '%s' is not " msg.Printf( _( "Component '%s' footprint ID '%s' is not "
"valid.\n" ), "valid.\n" ),
GetChars( component->GetReference() ), GetChars( component->GetReference() ),
GetChars( component->GetFPID().Format() ) ); GetChars( FROM_UTF8( component->GetFPID().Format() ) ) );
aReporter->Report( msg, REPORTER::RPT_ERROR ); aReporter->Report( msg, REPORTER::RPT_ERROR );
} }
@ -326,7 +326,7 @@ void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER* aReporter )
msg.Printf( _( "Component '%s' footprint '%s' was not found in " msg.Printf( _( "Component '%s' footprint '%s' was not found in "
"any libraries in the footprint library table.\n" ), "any libraries in the footprint library table.\n" ),
GetChars( component->GetReference() ), GetChars( component->GetReference() ),
GetChars( component->GetFPID().GetLibItemName() ) ); FROM_UTF8( component->GetFPID().GetLibItemName() ) );
aReporter->Report( msg, REPORTER::RPT_ERROR ); aReporter->Report( msg, REPORTER::RPT_ERROR );
} }

View File

@ -6,7 +6,7 @@
* *
* Copyright (C) 1992-2011 Jean-Pierre Charras. * Copyright (C) 1992-2011 Jean-Pierre Charras.
* Copyright (C) 2013-2016 Wayne Stambaugh <stambaughw@verizon.net>. * Copyright (C) 2013-2016 Wayne Stambaugh <stambaughw@verizon.net>.
* Copyright (C) 1992-2016 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -176,7 +176,7 @@ bool CMP_READER::Load( NETLIST* aNetlist ) throw( IO_ERROR, PARSE_ERROR )
{ {
LIB_ID fpid; LIB_ID fpid;
if( !footprint.IsEmpty() && fpid.Parse( footprint ) >= 0 ) if( !footprint.IsEmpty() && fpid.Parse( TO_UTF8( footprint ) ) >= 0 )
{ {
wxString error; wxString error;
error.Printf( _( "invalid footprint ID in\nfile: <%s>\nline: %d" ), error.Printf( _( "invalid footprint ID in\nfile: <%s>\nline: %d" ),

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2012 CERN * Copyright (C) 2012 CERN
* Copyright (C) 2012-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2012-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -1753,7 +1753,7 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments )
name = FromUTF8(); name = FromUTF8();
if( !name.IsEmpty() && fpid.Parse( FromUTF8() ) >= 0 ) if( !name.IsEmpty() && fpid.Parse( TO_UTF8( FromUTF8() ) ) >= 0 )
{ {
wxString error; wxString error;
error.Printf( _( "invalid footprint ID in\nfile: <%s>\nline: %d\noffset: %d" ), error.Printf( _( "invalid footprint ID in\nfile: <%s>\nline: %d\noffset: %d" ),