From 4011ed4e31c77d9ee885cc9262d0f0f89cad4fc6 Mon Sep 17 00:00:00 2001 From: Chris Pavlina Date: Fri, 24 Mar 2017 21:18:16 -0400 Subject: [PATCH] Convert UTF8 to/from wxString correctly around LIB_ID Fixes: lp:1675942 * https://bugs.launchpad.net/kicad/+bug/1675942 --- common/footprint_info.cpp | 8 +++--- common/fp_lib_table.cpp | 11 ++++---- common/lib_id.cpp | 12 ++++----- cvpcb/class_DisplayFootprintsFrame.cpp | 2 +- cvpcb/readwrite_dlgs.cpp | 14 +++++----- eeschema/class_library.cpp | 4 +-- .../dialog_edit_component_in_schematic.cpp | 6 ++--- eeschema/dialogs/dialog_edit_one_field.cpp | 5 ++-- eeschema/dialogs/dialog_rescue_each.cpp | 2 +- eeschema/edit_component_in_schematic.cpp | 5 ++-- eeschema/getpart.cpp | 2 +- eeschema/libarch.cpp | 4 +-- .../netlist_exporter_generic.cpp | 4 +-- eeschema/project_rescue.cpp | 17 ++++++------ eeschema/project_rescue.h | 3 +-- eeschema/sch_component.cpp | 18 +++++++------ eeschema/sch_legacy_plugin.cpp | 2 +- eeschema/symbol_lib_table.cpp | 10 +++---- pcbnew/board_netlist_updater.cpp | 26 +++++++++---------- pcbnew/class_board.cpp | 16 ++++++------ .../dialog_edit_module_for_Modedit.cpp | 4 +-- pcbnew/dialogs/dialog_exchange_modules.cpp | 4 +-- pcbnew/exporters/gen_modules_placefile.cpp | 8 +++--- pcbnew/kicad_netlist_reader.cpp | 4 +-- pcbnew/kicad_plugin.cpp | 2 +- pcbnew/legacy_netlist_reader.cpp | 4 +-- pcbnew/legacy_plugin.cpp | 6 ++--- pcbnew/librairi.cpp | 8 +++--- pcbnew/loadcmp.cpp | 10 +++---- pcbnew/modview_frame.cpp | 18 ++++++------- pcbnew/netlist.cpp | 10 +++---- pcbnew/netlist_reader.cpp | 4 +-- pcbnew/pcb_parser.cpp | 4 +-- 33 files changed, 130 insertions(+), 127 deletions(-) diff --git a/common/footprint_info.cpp b/common/footprint_info.cpp index 8ec1163a0a..c08667c22b 100644 --- a/common/footprint_info.cpp +++ b/common/footprint_info.cpp @@ -59,12 +59,12 @@ FOOTPRINT_INFO* FOOTPRINT_LIST::GetModuleInfo( const wxString& aFootprintName ) { LIB_ID fpid; - wxCHECK_MSG( fpid.Parse( aFootprintName ) < 0, NULL, + wxCHECK_MSG( fpid.Parse( TO_UTF8( aFootprintName ) ) < 0, NULL, 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 footprintName = fpid.GetLibItemName(); + wxString libNickname = FROM_UTF8( fpid.GetLibNickname() ); + wxString footprintName = FROM_UTF8( fpid.GetLibItemName() ); if( libNickname == fp->GetNickname() && footprintName == fp->GetFootprintName() ) return &*fp; diff --git a/common/fp_lib_table.cpp b/common/fp_lib_table.cpp index 504496024d..e7eab28af7 100644 --- a/common/fp_lib_table.cpp +++ b/common/fp_lib_table.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -255,12 +256,12 @@ MODULE* FP_LIB_TABLE::FootprintLoad( const wxString& aNickname, const wxString& LIB_ID& fpid = (LIB_ID&) ret->GetFPID(); // 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 wxASSERT( !fpid.GetLibNickname().size() ); - fpid.SetLibNickname( row->GetNickName() ); + fpid.SetLibNickname( TO_UTF8( row->GetNickName() ) ); } 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 // protection, which is atypical, not the default. - wxString fpname = aFootprint->GetFPID().GetLibItemName(); + wxString fpname = FROM_UTF8( aFootprint->GetFPID().GetLibItemName() ); std::unique_ptr footprint( row->plugin->FootprintLoad( row->GetFullURI( true ), fpname, row->GetProperties() ) ); @@ -329,8 +330,8 @@ void FP_LIB_TABLE::FootprintLibCreate( const wxString& aNickname ) MODULE* FP_LIB_TABLE::FootprintLoadWithOptionalNickname( const LIB_ID& aFootprintId ) throw( IO_ERROR, PARSE_ERROR, boost::interprocess::lock_exception ) { - wxString nickname = aFootprintId.GetLibNickname(); - wxString fpname = aFootprintId.GetLibItemName(); + wxString nickname = FROM_UTF8( aFootprintId.GetLibNickname() ); + wxString fpname = FROM_UTF8( aFootprintId.GetLibItemName() ); if( nickname.size() ) { diff --git a/common/lib_id.cpp b/common/lib_id.cpp index 859bff288d..7eae9d02f7 100644 --- a/common/lib_id.cpp +++ b/common/lib_id.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2012-2016 Wayne Stambaugh - * 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 * 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. std::string fpname = aId.substr( partNdx, revNdx-partNdx ); ReplaceIllegalFileNameChars( &fpname, '_' ); - SetLibItemName( UTF8( fpname ) ); + SetLibItemName( fpname ); 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 ) { - UTF8 id = aId; + UTF8 id = TO_UTF8( aId ); 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, const wxString& aRevision ) : - nickname( aLibName ), - item_name( aLibItemName ), - revision( aRevision ) + nickname( TO_UTF8( aLibName ) ), + item_name( TO_UTF8( aLibItemName ) ), + revision( TO_UTF8( aRevision ) ) { } diff --git a/cvpcb/class_DisplayFootprintsFrame.cpp b/cvpcb/class_DisplayFootprintsFrame.cpp index 5a484b3b65..a9562f0371 100644 --- a/cvpcb/class_DisplayFootprintsFrame.cpp +++ b/cvpcb/class_DisplayFootprintsFrame.cpp @@ -446,7 +446,7 @@ MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName ) { 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." ), GetChars( aFootprintName ) ) ); diff --git a/cvpcb/readwrite_dlgs.cpp b/cvpcb/readwrite_dlgs.cpp index 137b891215..c8ec152d25 100644 --- a/cvpcb/readwrite_dlgs.cpp +++ b/cvpcb/readwrite_dlgs.cpp @@ -77,7 +77,7 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName ) 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." ), GetChars( aFootprintName ) ) ); } @@ -124,7 +124,7 @@ static int guessNickname( FP_LIB_TABLE* aTbl, LIB_ID* aFootprintId ) return 0; wxString nick; - wxString fpname = aFootprintId->GetLibItemName(); + wxString fpname = FROM_UTF8( aFootprintId->GetLibItemName() ); std::vector nicks = aTbl->GetLogicalLibs(); @@ -147,7 +147,7 @@ static int guessNickname( FP_LIB_TABLE* aTbl, LIB_ID* aFootprintId ) if( nick.size() ) { - aFootprintId->SetLibNickname( nick ); + aFootprintId->SetLibNickname( TO_UTF8( nick ) ); return 0; } @@ -227,7 +227,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles( const std::string& aNetlist ) msg += wxString::Format( _( "Component '%s' footprint '%s' was not found in any library.\n" ), GetChars( component->GetReference() ), - GetChars( component->GetFPID().GetLibItemName() ) + GetChars( FROM_UTF8( component->GetFPID().GetLibItemName() ) ) ); break; @@ -235,7 +235,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles( const std::string& aNetlist ) msg += wxString::Format( _( "Component '%s' footprint '%s' was found in multiple libraries.\n" ), GetChars( component->GetReference() ), - GetChars( component->GetFPID().GetLibItemName() ) + GetChars( FROM_UTF8( component->GetFPID().GetLibItemName() ) ) ); break; } @@ -316,8 +316,8 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles( const std::string& aNetlist ) { COMPONENT* component = m_netlist.GetComponent( m_indexes[ii] ); - wxString cmpfpid = component->GetFPID().Format(); - wxString schfpid = component->GetAltFPID().Format(); + wxString cmpfpid = FROM_UTF8( component->GetFPID().Format() ); + wxString schfpid = FROM_UTF8( component->GetAltFPID().Format() ); dlg.Add( component->GetReference(), schfpid, cmpfpid ); } diff --git a/eeschema/class_library.cpp b/eeschema/class_library.cpp index 230b4be680..bf314f0c3e 100644 --- a/eeschema/class_library.cpp +++ b/eeschema/class_library.cpp @@ -396,7 +396,7 @@ LIB_PART* PART_LIBS::FindLibPart( const LIB_ID& aLibId, const wxString& aLibrary if( !aLibraryName.IsEmpty() && lib.GetName() != aLibraryName ) continue; - part = lib.FindPart( aLibId.GetLibItemName() ); + part = lib.FindPart( FROM_UTF8( aLibId.GetLibItemName() ) ); if( part ) break; @@ -415,7 +415,7 @@ LIB_ALIAS* PART_LIBS::FindLibraryAlias( const LIB_ID& aLibId, const wxString& aL if( !aLibraryName.IsEmpty() && lib.GetName() != aLibraryName ) continue; - entry = lib.FindAlias( aLibId.GetLibItemName() ); + entry = lib.FindAlias( FROM_UTF8( aLibId.GetLibItemName() ) ); if( entry ) break; diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp index 381640da5a..46edca3b99 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp @@ -340,7 +340,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions() 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 STATUS_FLAGS flags = m_cmp->GetFlags(); @@ -356,7 +356,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions() if( libs->FindLibraryAlias( id ) == NULL ) { wxString msg = wxString::Format( _( "Component '%s' not found!" ), - GetChars( id.Format() ) ); + GetChars( FROM_UTF8( id.Format() ) ) ); DisplayError( this, msg ); } else // Change component from lib! @@ -1080,7 +1080,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel() convertCheckBox->Enable( false ); // 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. m_textCtrlTimeStamp->SetValue( wxString::Format( wxT( "%8.8lX" ), diff --git a/eeschema/dialogs/dialog_edit_one_field.cpp b/eeschema/dialogs/dialog_edit_one_field.cpp index d65f997cda..fc06782962 100644 --- a/eeschema/dialogs/dialog_edit_one_field.cpp +++ b/eeschema/dialogs/dialog_edit_one_field.cpp @@ -8,7 +8,7 @@ * * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.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 * 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() ); 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(); diff --git a/eeschema/dialogs/dialog_rescue_each.cpp b/eeschema/dialogs/dialog_rescue_each.cpp index 8b2dc9da91..2bd99b8079 100644 --- a/eeschema/dialogs/dialog_rescue_each.cpp +++ b/eeschema/dialogs/dialog_rescue_each.cpp @@ -153,7 +153,7 @@ void DIALOG_RESCUE_EACH::PopulateInstanceList() int count = 0; 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; SCH_FIELD* valueField = each_component->GetField( 1 ); diff --git a/eeschema/edit_component_in_schematic.cpp b/eeschema/edit_component_in_schematic.cpp index 9ea4798164..ad0511bbb6 100644 --- a/eeschema/edit_component_in_schematic.cpp +++ b/eeschema/edit_component_in_schematic.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2008-2017 Wayne Stambaugh - * 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 * 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() ); 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. if( aField->GetFlags() == 0 ) diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp index 42f1962cca..0057582495 100644 --- a/eeschema/getpart.cpp +++ b/eeschema/getpart.cpp @@ -237,7 +237,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( // alias exists because its root component was found LIB_ID libId; - libId.SetLibItemName( sel.Name, false ); + libId.SetLibItemName( TO_UTF8( sel.Name ), false ); component->SetLibId( libId ); // Be sure the link to the corresponding LIB_PART is OK: diff --git a/eeschema/libarch.cpp b/eeschema/libarch.cpp index 274f066e9b..21317a93bc 100644 --- a/eeschema/libarch.cpp +++ b/eeschema/libarch.cpp @@ -85,7 +85,7 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName ) SCH_COMPONENT* component = (SCH_COMPONENT*) item; - if( !cacheLib->FindAlias( component->GetLibId().GetLibItemName() ) ) + if( !cacheLib->FindAlias( FROM_UTF8( component->GetLibId().GetLibItemName() ) ) ) { LIB_PART* part = NULL; @@ -102,7 +102,7 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName ) catch( ... /* IO_ERROR ioe */ ) { 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 ); return false; } diff --git a/eeschema/netlist_exporters/netlist_exporter_generic.cpp b/eeschema/netlist_exporters/netlist_exporter_generic.cpp index 5d38b07f2f..a19118bfb4 100644 --- a/eeschema/netlist_exporters/netlist_exporter_generic.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_generic.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 1992-2013 jp.charras at wanadoo.fr * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck - * 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 * 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() ); // 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; diff --git a/eeschema/project_rescue.cpp b/eeschema/project_rescue.cpp index 5e74871dc7..f1951a14cf 100644 --- a/eeschema/project_rescue.cpp +++ b/eeschema/project_rescue.cpp @@ -1,8 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2015 Chris Pavlina - * Copyright (C) 2015-2017 KiCad Developers, see change_log.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 * modify it under the terms of the GNU General Public License @@ -264,7 +263,7 @@ public: 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 ) { @@ -327,12 +326,12 @@ public: { 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; LIB_ID libId; - libId.SetLibItemName( m_new_name, false ); + libId.SetLibItemName( TO_UTF8( m_new_name ), false ); each_component->SetLibId( libId ); each_component->ClearFlags(); aRescuer->LogRescue( each_component, m_requested_name, m_new_name ); @@ -373,7 +372,7 @@ public: 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 ) { @@ -462,12 +461,12 @@ public: 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; LIB_ID libId; - libId.SetLibItemName( m_new_name, false ); + libId.SetLibItemName( TO_UTF8( m_new_name ), false ); each_component->SetLibId( libId ); each_component->ClearFlags(); aRescuer->LogRescue( each_component, m_requested_name, m_new_name ); @@ -543,7 +542,7 @@ void RESCUER::UndoRescues() { 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->ClearFlags(); } diff --git a/eeschema/project_rescue.h b/eeschema/project_rescue.h index 4ba538f3df..1acaed5381 100644 --- a/eeschema/project_rescue.h +++ b/eeschema/project_rescue.h @@ -1,8 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2015 Chris Pavlina - * Copyright (C) 2015 KiCad Developers, see change_log.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 * modify it under the terms of the GNU General Public License diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index 0182a3cb9e..1174fa3d2f 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -131,7 +131,7 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET_PATH* sheet, int unit, m_unit = unit; m_convert = convert; - m_lib_id.SetLibItemName( aPart.GetName(), false ); + m_lib_id.SetLibItemName( TO_UTF8( aPart.GetName() ), false ); m_part = aPart.SharedPtr(); m_currentSheetPath = NULL; m_fieldsAutoplaced = AUTOPLACED_NO; @@ -191,7 +191,7 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET_PATH* sheet, int unit, SetRef( sheet, msg ); // 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() ); } - wxString part_name = GetLibId().GetLibItemName(); + wxString part_name = FROM_UTF8( GetLibId().GetLibItemName() ); if( part_name.size() ) { @@ -1250,7 +1250,7 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg ) if( partname != NULL_STRING ) { - m_lib_id.SetLibItemName( partname, false ); + m_lib_id.SetLibItemName( TO_UTF8( partname ), false ); if( !newfmt ) 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 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 ) return; @@ -1594,7 +1594,8 @@ void SCH_COMPONENT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) aList.push_back( MSG_PANEL_ITEM( msg, GetField( VALUE )->GetShownText(), DARKCYAN ) ); // 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() ) 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, 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; tmp.Printf( _( "Component %s, %s" ), - GetChars( GetLibId().GetLibItemName() ), + FROM_UTF8( GetLibId().GetLibItemName() ), GetChars( GetField( REFERENCE )->GetShownText() ) ); return tmp; } diff --git a/eeschema/sch_legacy_plugin.cpp b/eeschema/sch_legacy_plugin.cpp index 2d4eaf8e29..12df024556 100644 --- a/eeschema/sch_legacy_plugin.cpp +++ b/eeschema/sch_legacy_plugin.cpp @@ -1668,7 +1668,7 @@ void SCH_LEGACY_PLUGIN::saveComponent( SCH_COMPONENT* aComponent ) name1 = toUTFTildaText( aComponent->GetField( REFERENCE )->GetText() ); } - wxString part_name = aComponent->GetLibId().GetLibItemName(); + wxString part_name = FROM_UTF8( aComponent->GetLibId().GetLibItemName() ); if( part_name.size() ) { diff --git a/eeschema/symbol_lib_table.cpp b/eeschema/symbol_lib_table.cpp index 1d71216b2e..603bd46a6f 100644 --- a/eeschema/symbol_lib_table.cpp +++ b/eeschema/symbol_lib_table.cpp @@ -249,12 +249,12 @@ LIB_ALIAS* SYMBOL_LIB_TABLE::LoadSymbol( const wxString& aNickname, const wxStri LIB_ID& id = (LIB_ID&) ret->GetPart()->GetLibId(); // 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 wxASSERT( !id.GetLibNickname().size() ); - id.SetLibNickname( row->GetNickName() ); + id.SetLibNickname( TO_UTF8( row->GetNickName() ) ); } 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 // 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 ), name, @@ -333,8 +333,8 @@ void SYMBOL_LIB_TABLE::CreateSymbolLib( const wxString& aNickname ) LIB_ALIAS* SYMBOL_LIB_TABLE::LoadSymbolWithOptionalNickname( const LIB_ID& aLibId ) throw( IO_ERROR, PARSE_ERROR, boost::interprocess::lock_exception ) { - wxString nickname = aLibId.GetLibNickname(); - wxString name = aLibId.GetLibItemName(); + wxString nickname = FROM_UTF8( aLibId.GetLibNickname() ); + wxString name = FROM_UTF8( aLibId.GetLibItemName() ); if( nickname.size() ) { diff --git a/pcbnew/board_netlist_updater.cpp b/pcbnew/board_netlist_updater.cpp index d531b05d99..61700d0f59 100644 --- a/pcbnew/board_netlist_updater.cpp +++ b/pcbnew/board_netlist_updater.cpp @@ -11,7 +11,7 @@ * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2011 Wayne Stambaugh * - * 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 * 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" ), GetChars( aComponent->GetReference() ), GetChars( aComponent->GetTimeStamp() ), - GetChars( aComponent->GetFPID().Format() ) ); + GetChars( FROM_UTF8( aComponent->GetFPID().Format() ) ) ); m_reporter->Report( msg, REPORTER::RPT_INFO ); msg.Printf( _( "Add component %s, footprint: %s.\n" ), GetChars( aComponent->GetReference() ), - GetChars( aComponent->GetFPID().Format() ) ); + GetChars( FROM_UTF8( aComponent->GetFPID().Format() ) ) ); 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" ), GetChars( aComponent->GetReference() ), - GetChars( aComponent->GetFPID().Format() ) ); + GetChars( FROM_UTF8( aComponent->GetFPID().Format() ) ) ); m_reporter->Report( msg, REPORTER::RPT_ERROR ); @@ -144,7 +144,7 @@ MODULE* BOARD_NETLIST_UPDATER::addNewComponent( COMPONENT* aComponent ) "footprint \"%s\".\n" ), GetChars( aComponent->GetReference() ), GetChars( aComponent->GetTimeStamp() ), - GetChars( aComponent->GetFPID().Format() ) ); + GetChars( FROM_UTF8( aComponent->GetFPID().Format() ) ) ); m_reporter->Report( msg, REPORTER::RPT_INFO ); ++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"), GetChars( aPcbComponent->GetReference() ), - GetChars( aPcbComponent->GetFPID().Format() ), - GetChars( aNewComponent->GetFPID().Format() ) ); + GetChars( FROM_UTF8( aPcbComponent->GetFPID().Format() ) ), + GetChars( FROM_UTF8( aNewComponent->GetFPID().Format() ) ) ); m_reporter->Report( msg, REPORTER::RPT_ACTION ); @@ -178,8 +178,8 @@ MODULE* BOARD_NETLIST_UPDATER::replaceComponent( NETLIST& aNetlist, MODULE* aPcb "\"%s\".\n" ), GetChars( aPcbComponent->GetReference() ), GetChars( aPcbComponent->GetPath() ), - GetChars( aPcbComponent->GetFPID().Format() ), - GetChars( aNewComponent->GetFPID().Format() ) ); + GetChars( FROM_UTF8( aPcbComponent->GetFPID().Format() ) ), + GetChars( FROM_UTF8( aNewComponent->GetFPID().Format() ) ) ); 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 " "footprint %s.\n" ), GetChars( aPcbComponent->GetReference() ), - GetChars( aNewComponent->GetFPID().Format() ) ); + GetChars( FROM_UTF8( aNewComponent->GetFPID().Format() ) ) ); m_reporter->Report( msg, REPORTER::RPT_ERROR ); @@ -215,7 +215,7 @@ MODULE* BOARD_NETLIST_UPDATER::replaceComponent( NETLIST& aNetlist, MODULE* aPcb "footprint \"%s\".\n" ), GetChars( aPcbComponent->GetReference() ), GetChars( aPcbComponent->GetPath() ), - GetChars( aNewComponent->GetFPID().Format() ) ); + GetChars( FROM_UTF8( aNewComponent->GetFPID().Format() ) ) ); 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" ), GetChars( component->GetReference() ), GetChars( padname ), - GetChars( footprint->GetFPID().Format() ) ); + GetChars( FROM_UTF8( footprint->GetFPID().Format() ) ) ); m_reporter->Report( msg, REPORTER::RPT_ERROR ); ++m_errorCount; } @@ -630,7 +630,7 @@ bool BOARD_NETLIST_UPDATER::UpdateNetlist( NETLIST& aNetlist ) msg.Printf( _( "Processing component \"%s:%s:%s\".\n" ), GetChars( component->GetReference() ), GetChars( component->GetTimeStamp() ), - GetChars( component->GetFPID().Format() ) ); + GetChars( FROM_UTF8( component->GetFPID().Format() ) ) ); m_reporter->Report( msg, REPORTER::RPT_INFO ); if( aNetlist.IsFindByTimeStamp() ) diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 31b2737f62..6ab17a1fe7 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -10,7 +10,7 @@ * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2011 Wayne Stambaugh * - * 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 * 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" ), GetChars( component->GetReference() ), GetChars( component->GetTimeStamp() ), - GetChars( component->GetFPID().Format() ) ); + GetChars( FROM_UTF8( component->GetFPID().Format() ) ) ); 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" ), GetChars( component->GetReference() ), GetChars( component->GetTimeStamp() ), - GetChars( component->GetFPID().Format() ) ); + GetChars( FROM_UTF8( component->GetFPID().Format() ) ) ); aReporter->Report( msg, REPORTER::RPT_ACTION ); } @@ -2485,7 +2485,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets, "footprint \"%s\".\n" ), GetChars( component->GetReference() ), GetChars( component->GetTimeStamp() ), - GetChars( component->GetFPID().Format() ) ); + GetChars( FROM_UTF8( component->GetFPID().Format() ) ) ); aReporter->Report( msg, REPORTER::RPT_ERROR ); } @@ -2518,8 +2518,8 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets, "\"%s\".\n" ), GetChars( footprint->GetReference() ), GetChars( footprint->GetPath() ), - GetChars( footprint->GetFPID().Format() ), - GetChars( component->GetFPID().Format() ) ); + GetChars( FROM_UTF8( footprint->GetFPID().Format() ) ), + GetChars( FROM_UTF8( component->GetFPID().Format() ) ) ); aReporter->Report( msg, REPORTER::RPT_ACTION ); } @@ -2529,7 +2529,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets, "footprint \"%s\".\n" ), GetChars( footprint->GetReference() ), GetChars( footprint->GetPath() ), - GetChars( component->GetFPID().Format() ) ); + GetChars( FROM_UTF8( component->GetFPID().Format() ) ) ); 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" ), GetChars( component->GetReference() ), GetChars( padname ), - GetChars( footprint->GetFPID().Format() ) ); + GetChars( FROM_UTF8( footprint->GetFPID().Format() ) ) ); aReporter->Report( msg, REPORTER::RPT_ERROR ); } } diff --git a/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp b/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp index 5b55cb9a53..51569cbd37 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp @@ -10,7 +10,7 @@ * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 Dick Hollenbeck, dick@softplc.com * Copyright (C) 2008-2016 Wayne Stambaugh - * 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 * 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_ReferenceCtrl->SetValue( m_referenceCopy->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( 1, diff --git a/pcbnew/dialogs/dialog_exchange_modules.cpp b/pcbnew/dialogs/dialog_exchange_modules.cpp index 8004e72e96..c761df9aba 100644 --- a/pcbnew/dialogs/dialog_exchange_modules.cpp +++ b/pcbnew/dialogs/dialog_exchange_modules.cpp @@ -311,8 +311,8 @@ bool DIALOG_EXCHANGE_MODULE::change_1_Module( MODULE* aModule, // Load module. line.Printf( _( "Change footprint '%s' (from '%s') to '%s'" ), GetChars( aModule->GetReference() ), - oldFootprintFPID.Format().c_str(), - aNewFootprintFPID.Format().c_str() ); + FROM_UTF8( oldFootprintFPID.Format() ), + FROM_UTF8( aNewFootprintFPID.Format() ) ); m_WinMessages->AppendText( line ); newModule = m_parent->LoadFootprint( aNewFootprintFPID ); diff --git a/pcbnew/exporters/gen_modules_placefile.cpp b/pcbnew/exporters/gen_modules_placefile.cpp index 5bbfd0370c..b146989475 100644 --- a/pcbnew/exporters/gen_modules_placefile.cpp +++ b/pcbnew/exporters/gen_modules_placefile.cpp @@ -4,7 +4,7 @@ /* * 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 * 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()) ); 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() ) @@ -524,7 +524,7 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName, line << csv_sep; line << list[ii].m_Value; line << csv_sep; - line << wxString( list[ii].m_Module->GetFPID().GetLibItemName() ); + line << FROM_UTF8( list[ii].m_Module->GetFPID().GetLibItemName() ); line << csv_sep; 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& 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", lenRefText, TO_UTF8( ref ), diff --git a/pcbnew/kicad_netlist_reader.cpp b/pcbnew/kicad_netlist_reader.cpp index 1573c9bda0..c3794863bb 100644 --- a/pcbnew/kicad_netlist_reader.cpp +++ b/pcbnew/kicad_netlist_reader.cpp @@ -5,7 +5,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * 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 * 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; error.Printf( _( "invalid footprint ID in\nfile: <%s>\nline: %d\noffset: %d" ), diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index c073b3e8f5..538a973599 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -1899,7 +1899,7 @@ void PCB_IO::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootpri MODULE_MAP& mods = m_cache->GetModules(); // 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 ); if( !fn.IsOk() ) diff --git a/pcbnew/legacy_netlist_reader.cpp b/pcbnew/legacy_netlist_reader.cpp index 691adde951..3d342d0a9a 100644 --- a/pcbnew/legacy_netlist_reader.cpp +++ b/pcbnew/legacy_netlist_reader.cpp @@ -7,7 +7,7 @@ * * Copyright (C) 1992-2011 Jean-Pierre Charras. * Copyright (C) 2013-2016 Wayne Stambaugh . - * 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 * 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; if( !footprintName.IsEmpty() ) - fpid.SetLibItemName( footprintName ); + fpid.SetLibItemName( TO_UTF8( footprintName ) ); COMPONENT* component = new COMPONENT( fpid, reference, value, timeStamp ); component->SetName( name ); diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index 722100a6eb..279440dd11 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -1373,7 +1373,7 @@ void LEGACY_PLUGIN::loadMODULE( MODULE* aModule ) wxString msg = wxString::Format( wxT( "Missing '$EndMODULE' for MODULE '%s'" ), - GetChars( aModule->GetFPID().GetLibItemName() ) ); + FROM_UTF8( aModule->GetFPID().GetLibItemName() ) ); THROW_IO_ERROR( msg ); } @@ -1428,7 +1428,7 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule ) padchar, padchar, m_reader->LineNumber(), - GetChars( aModule->GetFPID().GetLibItemName() ) + FROM_UTF8( aModule->GetFPID().GetLibItemName() ) ); THROW_IO_ERROR( m_error ); } @@ -1634,7 +1634,7 @@ void LEGACY_PLUGIN::loadMODULE_EDGE( MODULE* aModule ) (unsigned char) line[1], (unsigned char) line[1], m_reader->LineNumber(), - GetChars( aModule->GetFPID().GetLibItemName() ) + FROM_UTF8( aModule->GetFPID().GetLibItemName() ) ); THROW_IO_ERROR( m_error ); } diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index 9549d36826..42df647ab6 100644 --- a/pcbnew/librairi.cpp +++ b/pcbnew/librairi.cpp @@ -1,7 +1,7 @@ /* * 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 * 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 ) return; - fn.SetName( aModule->GetFPID().GetLibItemName() ); + fn.SetName( FROM_UTF8( aModule->GetFPID().GetLibItemName() ) ); wxString wildcard = wxGetTranslation( KiCadFootprintLibFileWildcard ); @@ -535,7 +535,7 @@ bool FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary() return false; LIB_ID fpid( fpid_txt ); - wxString fpname = fpid.GetLibItemName(); + wxString fpname = FROM_UTF8( fpid.GetLibItemName() ); // Confirmation 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 - wxString footprintName = aModule->GetFPID().GetLibItemName(); + wxString footprintName = FROM_UTF8( aModule->GetFPID().GetLibItemName() ); if( aDisplayDialog ) { diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp index f1955c2960..67ed805b05 100644 --- a/pcbnew/loadcmp.cpp +++ b/pcbnew/loadcmp.cpp @@ -226,7 +226,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary, 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'." ), GetChars( moduleName ) ) ); @@ -237,7 +237,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary, catch( const IO_ERROR& ioe ) { 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 @@ -256,7 +256,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary, } 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'." ), GetChars( moduleName ) ) ); @@ -267,7 +267,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary, catch( const IO_ERROR& ioe ) { 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 ) { 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; diff --git a/pcbnew/modview_frame.cpp b/pcbnew/modview_frame.cpp index 3dee456ae8..f8da882ccc 100644 --- a/pcbnew/modview_frame.cpp +++ b/pcbnew/modview_frame.cpp @@ -211,8 +211,8 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent { LIB_ID id; - id.SetLibNickname( getCurNickname() ); - id.SetLibItemName( getCurFootprintName() ); + id.SetLibNickname( TO_UTF8( getCurNickname() ) ); + id.SetLibItemName( TO_UTF8( getCurFootprintName() ) ); GetBoard()->Add( loadFootprint( id ) ); } @@ -456,8 +456,8 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event ) GetBoard()->m_Modules.DeleteAll(); LIB_ID id; - id.SetLibNickname( getCurNickname() ); - id.SetLibItemName( getCurFootprintName() ); + id.SetLibNickname( TO_UTF8( getCurNickname() ) ); + id.SetLibItemName( TO_UTF8( getCurFootprintName() ) ); try { @@ -519,10 +519,10 @@ void FOOTPRINT_VIEWER_FRAME::ExportSelectedFootprint( wxCommandEvent& event ) LIB_ID fpid; - fpid.SetLibNickname( getCurNickname() ); - fpid.SetLibItemName( fp_name ); + fpid.SetLibNickname( TO_UTF8( getCurNickname() ) ); + fpid.SetLibItemName( TO_UTF8( fp_name ) ); - DismissModal( true, fpid.Format() ); + DismissModal( true, FROM_UTF8( fpid.Format() ) ); } else { @@ -779,9 +779,9 @@ void FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint( wxCommandEvent& event ) 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() ) { diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index c0a836abee..7443cb0cba 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -7,7 +7,7 @@ * Copyright (C) 1992-2013 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2013-2016 Wayne Stambaugh - * 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 * 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" ), GetChars( component->GetReference() ), - GetChars( fpOnBoard->GetFPID().Format() ), - GetChars( component->GetFPID().Format() ) ); + GetChars( FROM_UTF8( fpOnBoard->GetFPID().Format() ) ), + GetChars( FROM_UTF8( component->GetFPID().Format() ) ) ); 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 " "valid.\n" ), GetChars( component->GetReference() ), - GetChars( component->GetFPID().Format() ) ); + GetChars( FROM_UTF8( component->GetFPID().Format() ) ) ); 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 " "any libraries in the footprint library table.\n" ), GetChars( component->GetReference() ), - GetChars( component->GetFPID().GetLibItemName() ) ); + FROM_UTF8( component->GetFPID().GetLibItemName() ) ); aReporter->Report( msg, REPORTER::RPT_ERROR ); } diff --git a/pcbnew/netlist_reader.cpp b/pcbnew/netlist_reader.cpp index f0e42e9468..06569a8d03 100644 --- a/pcbnew/netlist_reader.cpp +++ b/pcbnew/netlist_reader.cpp @@ -6,7 +6,7 @@ * * Copyright (C) 1992-2011 Jean-Pierre Charras. * Copyright (C) 2013-2016 Wayne Stambaugh . - * 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 * 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; - if( !footprint.IsEmpty() && fpid.Parse( footprint ) >= 0 ) + if( !footprint.IsEmpty() && fpid.Parse( TO_UTF8( footprint ) ) >= 0 ) { wxString error; error.Printf( _( "invalid footprint ID in\nfile: <%s>\nline: %d" ), diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index 4ef8fc53eb..3a6814c6ba 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * 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 * modify it under the terms of the GNU General Public License @@ -1753,7 +1753,7 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments ) name = FromUTF8(); - if( !name.IsEmpty() && fpid.Parse( FromUTF8() ) >= 0 ) + if( !name.IsEmpty() && fpid.Parse( TO_UTF8( FromUTF8() ) ) >= 0 ) { wxString error; error.Printf( _( "invalid footprint ID in\nfile: <%s>\nline: %d\noffset: %d" ),