Remove GetChars(), a wxWidgets 2.9 compatibility hack

This commit is contained in:
Marek Roszko 2020-10-15 20:39:55 -04:00
parent b9f1601418
commit a1c75748a0
62 changed files with 188 additions and 244 deletions

View File

@ -517,8 +517,7 @@ bool DIALOG_PAGES_SETTINGS::SavePageSettings()
if( !fullFileName.IsEmpty() && !wxFileExists( fullFileName ) )
{
wxString msg;
msg.Printf( _( "Page layout description file \"%s\" not found." ),
GetChars( fullFileName ) );
msg.Printf( _( "Page layout description file \"%s\" not found." ), fullFileName );
wxMessageBox( msg );
return false;
}
@ -902,7 +901,7 @@ void DIALOG_PAGES_SETTINGS::OnWksFileSelection( wxCommandEvent& event )
"Do you want to use the relative path:\n"
"\"%s\"\n"
"instead of\n"
"\"%s\"?" ), GetChars( shortFileName ), GetChars( fileName ) );
"\"%s\"?" ), shortFileName, fileName );
if( !IsOK( this, msg ) )
shortFileName = fileName;

View File

@ -321,7 +321,7 @@ bool DSNLEXER::IsSymbol( int aTok )
void DSNLEXER::Expecting( int aTok )
{
wxString errText = wxString::Format(
_( "Expecting %s" ), GetChars( GetTokenString( aTok ) ) );
_( "Expecting %s" ), GetTokenString( aTok ) );
THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
}
@ -329,7 +329,7 @@ void DSNLEXER::Expecting( int aTok )
void DSNLEXER::Expecting( const char* text )
{
wxString errText = wxString::Format(
_( "Expecting '%s'" ), GetChars( wxString::FromUTF8( text ) ) );
_( "Expecting '%s'" ), wxString::FromUTF8( text ) );
THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
}
@ -337,7 +337,7 @@ void DSNLEXER::Expecting( const char* text )
void DSNLEXER::Unexpected( int aTok )
{
wxString errText = wxString::Format(
_( "Unexpected %s" ), GetChars( GetTokenString( aTok ) ) );
_( "Unexpected %s" ), GetTokenString( aTok ) );
THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
}
@ -353,7 +353,7 @@ void DSNLEXER::Duplicate( int aTok )
void DSNLEXER::Unexpected( const char* text )
{
wxString errText = wxString::Format(
_( "Unexpected '%s'" ), GetChars( wxString::FromUTF8( text ) ) );
_( "Unexpected '%s'" ), wxString::FromUTF8( text ) );
THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
}

View File

@ -820,17 +820,17 @@ bool EDA_BASE_FRAME::IsWritable( const wxFileName& aFileName )
if( fn.IsDir() && !fn.IsDirWritable() )
{
msg.Printf( _( "You do not have write permissions to folder \"%s\"." ),
GetChars( fn.GetPath() ) );
fn.GetPath() );
}
else if( !fn.FileExists() && !fn.IsDirWritable() )
{
msg.Printf( _( "You do not have write permissions to save file \"%s\" to folder \"%s\"." ),
GetChars( fn.GetFullName() ), GetChars( fn.GetPath() ) );
fn.GetFullName(), fn.GetPath() );
}
else if( fn.FileExists() && !fn.IsFileWritable() )
{
msg.Printf( _( "You do not have write permissions to save file \"%s\"." ),
GetChars( fn.GetFullPath() ) );
fn.GetFullPath() );
}
if( !msg.IsEmpty() )
@ -863,7 +863,7 @@ void EDA_BASE_FRAME::CheckForAutoSaveFile( const wxFileName& aFileName )
"It appears that the last time you were editing the file\n"
"\"%s\"\n"
"it was not saved properly. Do you wish to restore the last saved edits you made?" ),
GetChars( aFileName.GetFullName() )
aFileName.GetFullName()
);
int response = wxMessageBox( msg, Pgm().App().GetAppName(), wxYES_NO | wxICON_QUESTION, this );

View File

@ -153,7 +153,7 @@ bool GetAssociatedDocument( wxWindow* aParent, const wxString& aDocName, PROJECT
if( !wxFileExists( fullfilename ) )
{
msg.Printf( _( "Doc File \"%s\" not found" ), GetChars( docname ) );
msg.Printf( _( "Doc File \"%s\" not found" ), docname );
DisplayError( aParent, msg );
return false;
}
@ -196,7 +196,7 @@ bool GetAssociatedDocument( wxWindow* aParent, const wxString& aDocName, PROJECT
if( !success )
{
msg.Printf( _( "Unknown MIME type for doc file \"%s\"" ), GetChars( fullfilename ) );
msg.Printf( _( "Unknown MIME type for doc file \"%s\"" ), fullfilename );
DisplayError( aParent, msg );
}

View File

@ -180,8 +180,7 @@ bool EDA_ITEM::Replace( wxFindReplaceData& aSearchData, wxString& aText )
suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
GetChars( aText ), GetChars( prefix ), GetChars( aSearchData.GetReplaceString() ),
GetChars( suffix ) );
aText, prefix, aSearchData.GetReplaceString(), suffix );
aText = prefix + aSearchData.GetReplaceString() + suffix;
@ -192,7 +191,7 @@ bool EDA_ITEM::Replace( wxFindReplaceData& aSearchData, wxString& aText )
bool EDA_ITEM::operator<( const EDA_ITEM& aItem ) const
{
wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
GetChars( GetClass() ) ) );
GetClass() ) );
return false;
}

View File

@ -184,7 +184,7 @@ int ExecuteFile( wxWindow* frame, const wxString& ExecFile, const wxString& para
#endif
wxString msg;
msg.Printf( _( "Command \"%s\" could not found" ), GetChars( fullFileName ) );
msg.Printf( _( "Command \"%s\" could not found" ), fullFileName );
DisplayError( frame, msg, 20 );
return -1;
}

View File

@ -107,7 +107,7 @@ void HTML_MESSAGE_BOX::ListSet( const wxArrayString& aList )
void HTML_MESSAGE_BOX::MessageSet( const wxString& message )
{
wxString message_value = wxString::Format(
wxT( "<b>%s</b><br>" ), GetChars( message ) );
wxT( "<b>%s</b><br>" ), message );
m_htmlWindow->AppendToPage( message_value );
}

View File

@ -142,7 +142,7 @@ wxString UOP::Format() const
else if( m_value->GetType() == VT_NUMERIC )
str = wxString::Format( "PUSH NUM [%.10f]", m_value->AsDouble() );
else
str = wxString::Format( "PUSH STR [%ls]", GetChars( m_value->AsString() ) );
str = wxString::Format( "PUSH STR [%ls]", m_value->AsString() );
}
break;

View File

@ -211,10 +211,8 @@ bool PGM_BASE::InitPgm()
if( m_pgm_checker->IsAnotherRunning() )
{
wxString quiz = wxString::Format(
_( "%s is already running. Continue?" ),
GetChars( pgm_name.GetName() )
);
wxString quiz =
wxString::Format( _( "%s is already running. Continue?" ), pgm_name.GetName() );
if( !IsOK( NULL, quiz ) )
return false;

View File

@ -172,12 +172,11 @@ struct APP_SINGLE_TOP : public wxApp
catch( const std::exception& e )
{
wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
GetChars( FROM_UTF8( typeid(e).name() )),
GetChars( FROM_UTF8( e.what() ) ) );
FROM_UTF8( typeid( e ).name() ), FROM_UTF8( e.what() ) );
}
catch( const IO_ERROR& ioe )
{
wxLogError( GetChars( ioe.What() ) );
wxLogError( ioe.What() );
}
catch(...)
{
@ -209,12 +208,11 @@ struct APP_SINGLE_TOP : public wxApp
catch( const std::exception& e )
{
wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
GetChars( FROM_UTF8( typeid(e).name() )),
GetChars( FROM_UTF8( e.what() ) ) );
FROM_UTF8( typeid( e ).name() ), FROM_UTF8( e.what() ) );
}
catch( const IO_ERROR& ioe )
{
wxLogError( GetChars( ioe.What() ) );
wxLogError( ioe.What() );
}
catch(...)
{

View File

@ -103,7 +103,7 @@ int CVPCB_MAINFRAME::buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList, wx
{
error_msg.Printf( _( "Equivalence file \"%s\" could not be found in the "
"default search paths." ),
GetChars( fn.GetFullName() ) );
fn.GetFullName() );
if( ! aErrorMessages->IsEmpty() )
*aErrorMessages << wxT("\n\n");
@ -122,7 +122,7 @@ int CVPCB_MAINFRAME::buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList, wx
if( aErrorMessages )
{
error_msg.Printf( _( "Error opening equivalence file \"%s\"." ), GetChars( tmp ) );
error_msg.Printf( _( "Error opening equivalence file \"%s\"." ), tmp );
if( ! aErrorMessages->IsEmpty() )
*aErrorMessages << wxT("\n\n");
@ -258,8 +258,7 @@ void CVPCB_MAINFRAME::AutomaticFootprintMatching()
{
msg.Printf( _( "Component %s: footprint %s not found in any of the project "
"footprint libraries." ),
GetChars( component->GetReference() ),
GetChars( equivItem.m_FootprintFPID ) );
component->GetReference(), equivItem.m_FootprintFPID );
if( ! error_msg.IsEmpty() )
error_msg << wxT("\n\n");

View File

@ -721,7 +721,7 @@ void CVPCB_MAINFRAME::DisplayStatus()
if( filters.IsEmpty() )
msg = _( "No filtering" );
else
msg.Printf( _( "Filtered by %s" ), GetChars( filters ) );
msg.Printf( _( "Filtered by %s" ), filters );
msg << wxT( ": " ) << m_footprintListBox->GetCount();

View File

@ -45,9 +45,8 @@ DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES( CVPCB_MAINFRAME* aParent ) :
{
m_Parent = aParent;
PROJECT& prj = Prj();
SetTitle( wxString::Format( _( "Project file: \"%s\"" ),
GetChars( prj.GetProjectFullName() ) ) );
PROJECT& prj = Prj();
SetTitle( wxString::Format( _( "Project file: \"%s\"" ), prj.GetProjectFullName() ) );
Init( );
@ -270,9 +269,8 @@ void DIALOG_CONFIG_EQUFILES::OnAddFiles( wxCommandEvent& event )
if( fn.MakeRelativeTo( libpath ) )
{
equFilename.Printf( wxT( "${%s}%c%s" ),
GetChars( m_gridEnvVars->GetCellValue( wxGridCellCoords( row, 0 ) ) ),
fn.GetPathSeparator(),
GetChars( fn.GetFullPath() ) );
m_gridEnvVars->GetCellValue( wxGridCellCoords( row, 0 ) ),
fn.GetPathSeparator(), fn.GetFullPath() );
break;
}
}

View File

@ -145,16 +145,16 @@ bool CVPCB_MAINFRAME::ReadNetListAndFpFiles( const std::string& aNetlist )
case 1:
msg += wxString::Format( _(
"Component \"%s\" footprint \"%s\" was <b>not found</b> in any library.\n" ),
GetChars( component->GetReference() ),
GetChars( component->GetFPID().GetLibItemName() )
component->GetReference(),
component->GetFPID().GetLibItemName().wx_str()
);
break;
case 2:
msg += wxString::Format( _(
"Component \"%s\" footprint \"%s\" was found in <b>multiple</b> libraries.\n" ),
GetChars( component->GetReference() ),
GetChars( component->GetFPID().GetLibItemName() )
component->GetReference(),
component->GetFPID().GetLibItemName().wx_str()
);
break;
}
@ -263,9 +263,9 @@ bool CVPCB_MAINFRAME::ReadNetListAndFpFiles( const std::string& aNetlist )
COMPONENT* component = m_netlist.GetComponent( i );
msg.Printf( CMP_FORMAT, m_compListBox->GetCount() + 1,
GetChars( component->GetReference() ),
GetChars( component->GetValue() ),
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
component->GetReference(),
component->GetValue(),
FROM_UTF8( component->GetFPID().Format().c_str() ) );
m_compListBox->AppendLine( msg );
}

View File

@ -554,7 +554,7 @@ void PART_LIBS::LoadAllLibraries( PROJECT* aProject, bool aShowProgress )
{
wxString msg;
msg.Printf( _( "Symbol library \"%s\" failed to load. Error:\n %s" ),
GetChars( filename ), GetChars( ioe.What() ) );
filename, ioe.What() );
wxLogError( msg );
}
@ -576,11 +576,9 @@ void PART_LIBS::LoadAllLibraries( PROJECT* aProject, bool aShowProgress )
}
catch( const IO_ERROR& ioe )
{
wxString msg = wxString::Format( _(
"Symbol library \"%s\" failed to load.\nError: %s" ),
GetChars( cache_name ),
GetChars( ioe.What() )
);
wxString msg =
wxString::Format( _( "Symbol library \"%s\" failed to load.\nError: %s" ),
cache_name, ioe.What() );
THROW_IO_ERROR( msg );
}

View File

@ -163,7 +163,7 @@ void DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked( wxCommandEvent& even
// Test if making the path relative is possible before asking the user if they want to do it
if( relPathTest.MakeRelativeTo( defaultPath ) )
{
msg.Printf( _( "Do you want to use a path relative to\n\"%s\"" ), GetChars( defaultPath ) );
msg.Printf( _( "Do you want to use a path relative to\n\"%s\"" ), defaultPath );
wxMessageDialog dialog( this, msg, _( "Plot Output Directory" ),
wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );

View File

@ -490,7 +490,7 @@ void LIB_EDIT_FRAME::RebuildSymbolUnitsList()
for( int i = 0; i < m_my_part->GetUnitCount(); i++ )
{
wxString sub = LIB_PART::SubReference( i+1, false );
wxString unit = wxString::Format( _( "Unit %s" ), GetChars( sub ) );
wxString unit = wxString::Format( _( "Unit %s" ), sub );
m_unitSelectBox->Append( unit );
}
}

View File

@ -677,7 +677,7 @@ void LIB_EDIT_FRAME::DuplicatePart( bool aFromClipboard )
}
catch( IO_ERROR& e )
{
wxLogMessage( "Can not paste: %s", GetChars( e.Problem() ) );
wxLogMessage( "Can not paste: %s", e.Problem() );
return;
}
}

View File

@ -45,8 +45,7 @@ bool NETLIST_EXPORTER_CADSTAR::WriteNetlist( const wxString& aOutFileName, unsig
if( ( f = wxFopen( aOutFileName, wxT( "wt" ) ) ) == NULL )
{
wxString msg;
msg.Printf( _( "Failed to create file \"%s\"" ),
GetChars( aOutFileName ) );
msg.Printf( _( "Failed to create file \"%s\"" ), aOutFileName );
DisplayError( NULL, msg );
return false;
}
@ -181,12 +180,9 @@ bool NETLIST_EXPORTER_CADSTAR::writeListOfNets( FILE* f )
switch( print_ter )
{
case 0:
{
InitNetDescLine.Printf( wxT( "\n%s %s %.4s %s" ),
GetChars( InitNetDesc ),
GetChars( refText ),
GetChars( pinText ),
GetChars( netName ) );
{
InitNetDescLine.Printf(
wxT( "\n%s %s %.4s %s" ), InitNetDesc, refText, pinText, netName );
}
print_ter++;
break;

View File

@ -50,8 +50,7 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName,
if( ( f = wxFopen( aOutFileName, wxT( "wt" ) ) ) == NULL )
{
wxString msg;
msg.Printf( _( "Failed to create file \"%s\"" ),
GetChars( aOutFileName ) );
msg.Printf( _( "Failed to create file \"%s\"" ), aOutFileName );
DisplayError( NULL, msg );
return false;
}

View File

@ -93,8 +93,8 @@ EDA_ITEM* SCH_BITMAP::Clone() const
void SCH_BITMAP::SwapData( SCH_ITEM* aItem )
{
wxCHECK_RET( aItem->Type() == SCH_BITMAP_T,
wxString::Format( wxT( "SCH_BITMAP object cannot swap data with %s object." ),
GetChars( aItem->GetClass() ) ) );
wxString::Format( wxT( "SCH_BITMAP object cannot swap data with %s object." ),
aItem->GetClass() ) );
SCH_BITMAP* item = (SCH_BITMAP*) aItem;
std::swap( m_pos, item->m_pos );

View File

@ -1488,7 +1488,7 @@ void SCH_SEXPR_PARSER::parsePAGE_INFO( PAGE_INFO& aPageInfo )
if( !aPageInfo.SetType( pageType ) )
{
wxString err;
err.Printf( _( "Page type \"%s\" is not valid " ), GetChars( FromUTF8() ) );
err.Printf( _( "Page type \"%s\" is not valid " ), FromUTF8() );
THROW_PARSE_ERROR( err, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
}
@ -2101,7 +2101,7 @@ SCH_COMPONENT* SCH_SEXPR_PARSER::parseSchematicSymbol()
{
error.Printf( _( "Invalid symbol library ID in\nfile: \"%s\"\nline: %d\n"
"offset: %d" ),
GetChars( CurSource() ), CurLineNumber(), CurOffset() );
CurSource(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
}

View File

@ -806,8 +806,8 @@ void SCH_LEGACY_PLUGIN::loadHeader( LINE_READER& aReader, SCH_SCREEN* aScreen )
if( !line || !strCompare( "Eeschema Schematic File Version", line, &line ) )
{
m_error.Printf( _( "\"%s\" does not appear to be an Eeschema file" ),
GetChars( aScreen->GetFileName() ) );
m_error.Printf(
_( "\"%s\" does not appear to be an Eeschema file" ), aScreen->GetFileName() );
THROW_IO_ERROR( m_error );
}

View File

@ -250,8 +250,8 @@ bool SCH_SHEET::UsesDefaultStroke() const
void SCH_SHEET::SwapData( SCH_ITEM* aItem )
{
wxCHECK_RET( aItem->Type() == SCH_SHEET_T,
wxString::Format( wxT( "SCH_SHEET object cannot swap data with %s object." ),
GetChars( aItem->GetClass() ) ) );
wxString::Format( wxT( "SCH_SHEET object cannot swap data with %s object." ),
aItem->GetClass() ) );
SCH_SHEET* sheet = ( SCH_SHEET* ) aItem;

View File

@ -74,8 +74,8 @@ void SCH_SHEET_PIN::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
void SCH_SHEET_PIN::SwapData( SCH_ITEM* aItem )
{
wxCHECK_RET( aItem->Type() == SCH_SHEET_PIN_T,
wxString::Format( wxT( "SCH_SHEET_PIN object cannot swap data with %s object." ),
GetChars( aItem->GetClass() ) ) );
wxString::Format( wxT( "SCH_SHEET_PIN object cannot swap data with %s object." ),
aItem->GetClass() ) );
SCH_SHEET_PIN* pin = ( SCH_SHEET_PIN* ) aItem;
SCH_TEXT::SwapData( (SCH_TEXT*) pin );

View File

@ -547,7 +547,7 @@ wxString SCH_TEXT::GetShownText( int aDepth ) const
wxString SCH_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const
{
return wxString::Format( _( "Graphic Text '%s'" ), GetChars( ShortenedShownText() ) );
return wxString::Format( _( "Graphic Text '%s'" ), ShortenedShownText() );
}

View File

@ -227,7 +227,7 @@ void SYMBOL_LIB_TABLE::Parse( LIB_TABLE_LEXER* in )
wxString msg = wxString::Format(
_( "Duplicate library nickname \"%s\" found in symbol library "
"table file line %d" ), GetChars( nickname ), lineNum );
"table file line %d" ), nickname, lineNum );
if( !errMsg.IsEmpty() )
errMsg << '\n';
@ -492,8 +492,8 @@ bool SYMBOL_LIB_TABLE::LoadGlobalTable( SYMBOL_LIB_TABLE& aTable )
if( !fn.DirExists() && !fn.Mkdir( 0x777, wxPATH_MKDIR_FULL ) )
{
THROW_IO_ERROR( wxString::Format( _( "Cannot create global library table path \"%s\"." ),
GetChars( fn.GetPath() ) ) );
THROW_IO_ERROR( wxString::Format(
_( "Cannot create global library table path \"%s\"." ), fn.GetPath() ) );
}
// Attempt to copy the default global file table from the KiCad

View File

@ -525,7 +525,7 @@ bool GERBVIEW_FRAME::unarchiveFiles( const wxString& aFullFileName, REPORTER* aR
reported_no_more_layer = true;
// Report the name of not loaded files:
msg.Printf( MSG_NOT_LOADED, GetChars( entry->GetName() ) );
msg.Printf( MSG_NOT_LOADED, entry->GetName() );
aReporter->Report( msg, RPT_SEVERITY_ERROR );
}

View File

@ -151,25 +151,25 @@ const wxString GERBER_FILE_IMAGE_LIST::GetDisplayName( int aIdx, bool aNameOnly
{
name.Printf( "%s (%s, %s, %s)",
filename.GetData(),
GetChars( gerber->m_FileFunction->GetFileType() ),
GetChars( gerber->m_FileFunction->GetBrdLayerId() ),
GetChars( gerber->m_FileFunction->GetBrdLayerSide() ) );
gerber->m_FileFunction->GetFileType(),
gerber->m_FileFunction->GetBrdLayerId(),
gerber->m_FileFunction->GetBrdLayerSide() );
}
if( gerber->m_FileFunction->IsDrillFile() )
{
name.Printf( "%s (%s,%s,%s,%s)",
filename.GetData(),
GetChars( gerber->m_FileFunction->GetFileType() ),
GetChars( gerber->m_FileFunction->GetDrillLayerPair() ),
GetChars( gerber->m_FileFunction->GetLPType() ),
GetChars( gerber->m_FileFunction->GetRouteType() ) );
gerber->m_FileFunction->GetFileType(),
gerber->m_FileFunction->GetDrillLayerPair(),
gerber->m_FileFunction->GetLPType(),
gerber->m_FileFunction->GetRouteType() );
}
else
{
name.Printf( "%s (%s, %s)",
filename.GetData(),
GetChars( gerber->m_FileFunction->GetFileType() ),
GetChars( gerber->m_FileFunction->GetBrdLayerId() ) );
gerber->m_FileFunction->GetFileType(),
gerber->m_FileFunction->GetBrdLayerId() );
}
}
else

View File

@ -1014,7 +1014,7 @@ bool GERBER_FILE_IMAGE::ReadApertureMacro( char *aBuff, unsigned int aBuffSize,
else if( !isdigit(*aText) ) // Ill. symbol
{
msg.Printf( wxT( "RS274X: Aperture Macro \"%s\": ill. symbol, line: \"%s\"" ),
GetChars( am.name ), GetChars( FROM_UTF8( aBuff ) ) );
am.name, FROM_UTF8( aBuff ) );
AddMessageToList( msg );
primitive_type = AMP_COMMENT;
}
@ -1072,7 +1072,7 @@ bool GERBER_FILE_IMAGE::ReadApertureMacro( char *aBuff, unsigned int aBuffSize,
default:
msg.Printf( wxT( "RS274X: Aperture Macro \"%s\": Invalid primitive id code %d, line %d: \"%s\"" ),
GetChars( am.name ), primitive_type, m_LineNum, GetChars( FROM_UTF8( aBuff ) ) );
am.name, primitive_type, m_LineNum, FROM_UTF8( aBuff ) );
AddMessageToList( msg );
return false;
}

View File

@ -127,7 +127,7 @@ int GERBVIEW_INSPECTION_TOOL::ShowDCodes( const TOOL_EVENT& aEvent )
pt_D_code->m_Size.y / scale, units,
pt_D_code->m_Size.x / scale, units,
D_CODE::ShowApertureType( pt_D_code->m_Shape ),
pt_D_code->m_AperFunction.IsEmpty()? wxT( "none" ) : GetChars( pt_D_code->m_AperFunction )
pt_D_code->m_AperFunction.IsEmpty()? wxT( "none" ) : pt_D_code->m_AperFunction
);
if( !pt_D_code->m_Defined )
@ -169,8 +169,7 @@ int GERBVIEW_INSPECTION_TOOL::ShowSource( const TOOL_EVENT& aEvent )
if( !fn.FileExists() )
{
wxString msg;
msg.Printf( _( "Source file \"%s\" is not available" ),
GetChars( fn.GetFullPath() ) );
msg.Printf( _( "Source file \"%s\" is not available" ), fn.GetFullPath() );
wxMessageBox( msg );
}
else

View File

@ -71,8 +71,8 @@ private:
( net_attr.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_CMP ) )
{
auto menuEntry = Add( GERBVIEW_ACTIONS::highlightComponent );
menuEntry->SetItemLabel( wxString::Format( _( "Highlight Items of Component \"%s\"" ),
GetChars( net_attr.m_Cmpref ) ) );
menuEntry->SetItemLabel( wxString::Format(
_( "Highlight Items of Component \"%s\"" ), net_attr.m_Cmpref ) );
addSeparator = true;
}
@ -89,8 +89,8 @@ private:
if( apertDescr && !apertDescr->m_AperFunction.IsEmpty() )
{
auto menuEntry = Add( GERBVIEW_ACTIONS::highlightAttribute );
menuEntry->SetItemLabel( wxString::Format( _( "Highlight Aperture Type \"%s\"" ),
GetChars( apertDescr->m_AperFunction ) ) );
menuEntry->SetItemLabel( wxString::Format(
_( "Highlight Aperture Type \"%s\"" ), apertDescr->m_AperFunction ) );
addSeparator = true;
}
}

View File

@ -122,30 +122,6 @@ static inline wxString FROM_UTF8( const char* cstring )
return line;
}
/**
* Function GetChars
* returns a wxChar* to the actual wxChar* data within a wxString, and is
* helpful for passing strings to wxString::Printf() and wxString::Format().
* It can also be passed a UTF8 parameter which will be converted to wxString
* by the compiler.
* <p>
* Example: wxString::Format( wxT( "%s" ), GetChars( UTF( "some text" ) ) );
* <p>
* When wxWidgets is properly built for KiCad, a const wxChar* points to either:
* <ul>
* <li> 32 bit unicode characters on linux/OSX or </li>
* <li> 16 bit UTF16 characters on windows. </li>
* </ul>
* Note that you cannot pass 8 bit strings to wxString::Format() or Printf() so this
* is a useful conversion function to wxChar*, which is needed by wxString::Format().
*
* @return const wxChar* - a pointer to the UNICODE or UTF16 (on windows) text.
*/
static inline const wxChar* GetChars( const wxString& s )
{
return (const wxChar*) s.c_str();
}
/// # of elements in an array. This implements type-safe compile time checking
template <typename T, std::size_t N>
constexpr std::size_t arrayDim(T const (&)[N]) noexcept

View File

@ -292,12 +292,11 @@ struct APP_KICAD : public wxApp
catch( const std::exception& e )
{
wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
GetChars( FROM_UTF8( typeid(e).name() )),
GetChars( FROM_UTF8( e.what() ) ) );
FROM_UTF8( typeid( e ).name() ), FROM_UTF8( e.what() ) );
}
catch( const IO_ERROR& ioe )
{
wxLogError( GetChars( ioe.What() ) );
wxLogError( ioe.What() );
}
catch(...)
{

View File

@ -651,8 +651,7 @@ void KICAD_MANAGER_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
void KICAD_MANAGER_FRAME::PrintPrjInfo()
{
wxString msg = wxString::Format( _( "Project name:\n%s\n" ),
GetChars( GetProjectFileName() ) );
wxString msg = wxString::Format( _( "Project name:\n%s\n" ), GetProjectFileName() );
PrintMsg( msg );
}

View File

@ -248,8 +248,7 @@ void TREE_PROJECT_FRAME::OnCreateNewDirectory( wxCommandEvent& event )
curr_dir += wxFileName::GetPathSeparator();
}
wxString msg =
wxString::Format( _( "Current project directory:\n%s" ), GetChars( prj_dir ) );
wxString msg = wxString::Format( _( "Current project directory:\n%s" ), prj_dir );
wxString subdir = wxGetTextFromUser( msg, _( "Create New Directory" ), curr_dir );
if( subdir.IsEmpty() )

View File

@ -67,7 +67,7 @@ void PL_EDITOR_FRAME::OnFileHistory( wxCommandEvent& event )
if( LoadPageLayoutDescrFile( filename ) )
{
wxString msg;
msg.Printf( _( "File \"%s\" loaded"), GetChars( filename ) );
msg.Printf( _( "File \"%s\" loaded"), filename );
SetStatusText( msg );
}
@ -125,14 +125,14 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
if( ! InsertPageLayoutDescrFile( filename ) )
{
msg.Printf( _( "Unable to load %s file" ), GetChars( filename ) );
msg.Printf( _( "Unable to load %s file" ), filename );
wxMessageBox( msg );
}
else
{
GetScreen()->SetModify();
HardRedraw();
msg.Printf( _( "File \"%s\" inserted" ), GetChars( filename ) );
msg.Printf( _( "File \"%s\" inserted" ), filename );
SetStatusText( msg );
}
}
@ -150,13 +150,13 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
if( ! LoadPageLayoutDescrFile( filename ) )
{
msg.Printf( _( "Unable to load %s file" ), GetChars( filename ) );
msg.Printf( _( "Unable to load %s file" ), filename );
wxMessageBox( msg );
}
else
{
OnNewPageLayout();
msg.Printf( _( "File \"%s\" loaded" ), GetChars( filename ) );
msg.Printf( _( "File \"%s\" loaded" ), filename );
SetStatusText( msg );
}
}
@ -165,12 +165,12 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
case wxID_SAVE:
if( !SavePageLayoutDescrFile( filename ) )
{
msg.Printf( _( "Unable to write \"%s\"" ), GetChars( filename ) );
msg.Printf( _( "Unable to write \"%s\"" ), filename );
wxMessageBox( msg );
}
else
{
msg.Printf( _("File \"%s\" written"), GetChars( filename ) );
msg.Printf( _("File \"%s\" written"), filename );
SetStatusText( msg );
}
break;
@ -195,13 +195,13 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
if( !SavePageLayoutDescrFile( filename ) )
{
msg.Printf( _("Unable to create \"%s\""), GetChars( filename ) );
msg.Printf( _("Unable to create \"%s\""), filename );
wxMessageBox( msg );
}
else
{
msg.Printf( _("File \"%s\" written"), GetChars( filename ) );
msg.Printf( _("File \"%s\" written"), filename );
SetStatusText( msg );
if( GetCurrentFileName().IsEmpty() )

View File

@ -98,7 +98,7 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
if( fp_bom == NULL )
{
msg.Printf( _( "Unable to create file \"%s\"" ), GetChars( fn.GetFullPath() ) );
msg.Printf( _( "Unable to create file \"%s\"" ), fn.GetFullPath() );
DisplayError( this, msg );
return;
}

View File

@ -776,8 +776,7 @@ void MODULE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM
msg.Printf( "%.2f", GetOrientationDegrees() );
aList.emplace_back( _( "Rotation" ), msg, BROWN );
msg.Printf( _( "Footprint: %s" ),
GetChars( m_fpid.Format().c_str() ) );
msg.Printf( _( "Footprint: %s" ), m_fpid.Format().c_str() );
msg2.Printf( _( "3D-Shape: %s" ),
m_3D_Drawings.empty() ? _( "none" ) : m_3D_Drawings.front().m_Filename );
aList.emplace_back( msg, msg2, BLUE );
@ -1721,9 +1720,8 @@ bool MODULE::BuildPolyCourtyard()
if( !error_msg.IsEmpty() )
{
wxLogMessage( wxString::Format( _( "Processing courtyard of \"%s\": %s" ),
GetChars( GetFPID().Format() ),
error_msg) );
wxLogMessage( wxString::Format(
_( "Processing courtyard of \"%s\": %s" ), GetFPID().Format().wx_str(), error_msg ) );
}
return success;

View File

@ -292,7 +292,7 @@ void DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
wxFileName fn( Prj().AbsolutePath( m_board->GetFileName() ) );
wxString defaultPath = fn.GetPathWithSep();
wxString msg;
msg.Printf( _( "Do you want to use a path relative to\n\"%s\"" ), GetChars( defaultPath ) );
msg.Printf( _( "Do you want to use a path relative to\n\"%s\"" ), defaultPath );
wxMessageDialog dialog( this, msg, _( "Plot Output Directory" ),
wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
@ -371,7 +371,7 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles( bool aGenDrill, bool aGenMap )
{
wxString msg;
msg.Printf( _( "Could not write drill and/or map files to folder \"%s\"." ),
GetChars( outputDir.GetPath() ) );
outputDir.GetPath() );
DisplayError( this, msg );
return;
}
@ -445,12 +445,12 @@ void DIALOG_GENDRILL::OnGenReportFile( wxCommandEvent& event )
if( ! success )
{
msg.Printf( _( "** Unable to create %s **\n" ), GetChars( dlg.GetPath() ) );
msg.Printf( _( "** Unable to create %s **\n" ), dlg.GetPath() );
m_messagesBox->AppendText( msg );
}
else
{
msg.Printf( _( "Report file %s created\n" ), GetChars( dlg.GetPath() ) );
msg.Printf( _( "Report file %s created\n" ), dlg.GetPath() );
m_messagesBox->AppendText( msg );
}
}

View File

@ -236,7 +236,7 @@ void DIALOG_NETLIST::loadNetlist( bool aDryRun )
wxBusyCursor busy;
wxString msg;
msg.Printf( _( "Reading netlist file \"%s\".\n" ), GetChars( netlistFileName ) );
msg.Printf( _( "Reading netlist file \"%s\".\n" ), netlistFileName );
reporter.ReportHead( msg, RPT_SEVERITY_INFO );
if( m_matchByTimestamp->GetSelection() == 1 )

View File

@ -387,8 +387,7 @@ void DIALOG_PLOT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
// Test if making the path relative is possible before asking the user if they want to do it
if( relPathTest.MakeRelativeTo( defaultPath ) )
{
msg.Printf( _( "Do you want to use a path relative to\n\"%s\"" ),
GetChars( defaultPath ) );
msg.Printf( _( "Do you want to use a path relative to\n\"%s\"" ), defaultPath );
wxMessageDialog dialog( this, msg, _( "Plot Output Directory" ),
wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
@ -804,8 +803,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
if( !EnsureFileDirectoryExists( &outputDir, boardFilename, &reporter ) )
{
wxString msg;
msg.Printf( _( "Could not write plot files to folder \"%s\"." ),
GetChars( outputDir.GetPath() ) );
msg.Printf( _( "Could not write plot files to folder \"%s\"." ), outputDir.GetPath() );
DisplayError( this, msg );
return;
}

View File

@ -345,8 +345,7 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles()
if( !EnsureFileDirectoryExists( &outputDir, boardFilename, m_reporter ) )
{
msg.Printf( _( "Could not write plot files to folder \"%s\"." ),
GetChars( outputDir.GetPath() ) );
msg.Printf( _( "Could not write plot files to folder \"%s\"." ), outputDir.GetPath() );
DisplayError( this, msg );
return false;
}

View File

@ -116,7 +116,7 @@ void EXCELLON_WRITER::CreateDrillandMapFilesSet( const wxString& aPlotDirectory,
{
if( aReporter )
{
msg.Printf( _( "** Unable to create %s **\n" ), GetChars( fullFilename ) );
msg.Printf( _( "** Unable to create %s **\n" ), fullFilename );
aReporter->Report( msg );
}
break;
@ -125,7 +125,7 @@ void EXCELLON_WRITER::CreateDrillandMapFilesSet( const wxString& aPlotDirectory,
{
if( aReporter )
{
msg.Printf( _( "Create file %s\n" ), GetChars( fullFilename ) );
msg.Printf( _( "Create file %s\n" ), fullFilename );
aReporter->Report( msg );
}
}

View File

@ -331,7 +331,7 @@ void GENDRILL_WRITER_BASE::CreateMapFilesSet( const wxString& aPlotDirectory,
{
if( aReporter )
{
msg.Printf( _( "** Unable to create %s **\n" ), GetChars( fullfilename ) );
msg.Printf( _( "** Unable to create %s **\n" ), fullfilename );
aReporter->Report( msg );
}
@ -341,7 +341,7 @@ void GENDRILL_WRITER_BASE::CreateMapFilesSet( const wxString& aPlotDirectory,
{
if( aReporter )
{
msg.Printf( _( "Create file %s\n" ), GetChars( fullfilename ) );
msg.Printf( _( "Create file %s\n" ), fullfilename );
aReporter->Report( msg );
}
}

View File

@ -973,7 +973,7 @@ bool FOOTPRINT_EDIT_FRAME::RevertFootprint()
if( GetScreen()->IsModify() && m_revertModule )
{
wxString msg = wxString::Format( _( "Revert \"%s\" to last version saved?" ),
GetChars( GetLoadedFPID().GetLibItemName() ) );
GetLoadedFPID().GetLibItemName().wx_str() );
if( ConfirmRevertDialog( this, msg ) )
{

View File

@ -572,7 +572,7 @@ void FOOTPRINT_WIZARD_FRAME::OnActivate( wxActivateEvent& event )
void FOOTPRINT_WIZARD_FRAME::Update3DView( bool aForceReload, const wxString* aTitle )
{
wxString frm3Dtitle;
frm3Dtitle.Printf( _( "ModView: 3D Viewer [%s]" ), GetChars( m_wizardName ) );
frm3Dtitle.Printf( _( "ModView: 3D Viewer [%s]" ), m_wizardName );
PCB_BASE_FRAME::Update3DView( aForceReload, &frm3Dtitle );
}

View File

@ -102,7 +102,7 @@ bool GITHUB_GETLIBLIST::GetFootprintLibraryList( wxArrayString& aList )
if( !repoURL2listURL( m_repoURL, &fullURLCommand, itemCountMax, page ) )
{
wxString msg = wxString::Format( _( "malformed URL:\n\"%s\"" ), GetChars( m_repoURL ) );
wxString msg = wxString::Format( _( "malformed URL:\n\"%s\"" ), m_repoURL );
wxMessageBox( msg );
return false;
}

View File

@ -295,8 +295,8 @@ void GITHUB_PLUGIN::FootprintDelete( const wxString& aLibraryPath, const wxStrin
{
wxString msg = wxString::Format(
_( "Footprint\n\"%s\"\nis not in the writable portion of this Github library\n\"%s\"" ),
GetChars( aFootprintName ),
GetChars( aLibraryPath )
aFootprintName,
aLibraryPath
);
THROW_IO_ERROR( msg );
@ -400,8 +400,8 @@ void GITHUB_PLUGIN::cacheLib( const wxString& aLibraryPath, const PROPERTIES* aP
{
wxString msg = wxString::Format(
_( "option \"%s\" for Github library \"%s\" must point to a writable directory ending with '.pretty'." ),
GetChars( FROM_UTF8( PRETTY_DIR ) ),
GetChars( aLibraryPath )
FROM_UTF8( PRETTY_DIR ),
aLibraryPath
);
THROW_IO_ERROR( msg );
@ -553,7 +553,7 @@ void GITHUB_PLUGIN::remoteGetZip( const wxString& aRepoURL )
if( !repoURL_zipURL( aRepoURL, &zip_url ) )
{
wxString msg = wxString::Format( _( "Unable to parse URL:\n\"%s\"" ), GetChars( aRepoURL ) );
wxString msg = wxString::Format( _( "Unable to parse URL:\n\"%s\"" ), aRepoURL );
THROW_IO_ERROR( msg );
}

View File

@ -244,7 +244,7 @@ void LEGACY_NETLIST_READER::loadFootprintFilters()
{
wxString msg;
msg.Printf( _( "Cannot find symbol \"%s\" in footprint filter section "
"of netlist." ), GetChars( cmpRef ) );
"of netlist." ), cmpRef );
THROW_PARSE_ERROR( msg, m_lineReader->GetSource(), line, m_lineReader->LineNumber(),
m_lineReader->Length() );
}

View File

@ -63,7 +63,7 @@ bool PCB_EDIT_FRAME::ReadNetlistFromFile( const wxString &aFilename, NETLIST& aN
if( !netlistReader.get() )
{
msg.Printf( _( "Cannot open netlist file \"%s\"." ), GetChars( aFilename ) );
msg.Printf( _( "Cannot open netlist file \"%s\"." ), aFilename );
wxMessageBox( msg, _( "Netlist Load Error." ), wxOK | wxICON_ERROR, this );
return false;
}
@ -169,8 +169,8 @@ void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter )
{
msg.Printf( _( "Footprint of %s changed: board footprint \"%s\", netlist footprint \"%s\"." ),
component->GetReference(),
GetChars( fpOnBoard->GetFPID().Format() ),
GetChars( component->GetFPID().Format() ) );
fpOnBoard->GetFPID().Format().wx_str(),
component->GetFPID().Format().wx_str() );
aReporter.Report( msg, RPT_SEVERITY_WARNING );
continue;
@ -192,7 +192,7 @@ void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter )
{
msg.Printf( _( "%s footprint ID \"%s\" is not valid." ),
component->GetReference(),
GetChars( component->GetFPID().Format() ) );
component->GetFPID().Format().wx_str() );
aReporter.Report( msg, RPT_SEVERITY_ERROR );
continue;
@ -209,7 +209,7 @@ void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter )
{
msg.Printf( _( "%s footprint \"%s\" not found in any libraries in the footprint library table.\n" ),
component->GetReference(),
GetChars( component->GetFPID().GetLibItemName() ) );
component->GetFPID().GetLibItemName().wx_str() );
aReporter.Report( msg, RPT_SEVERITY_ERROR );
continue;

View File

@ -198,7 +198,7 @@ const wxString GetGerberFileFunctionAttribute( const BOARD *aBoard, LAYER_NUM aL
#endif
wxString fileFct;
fileFct.Printf( "%%TF.FileFunction,%s*%%", GetChars( attrib ) );
fileFct.Printf( "%%TF.FileFunction,%s*%%", attrib );
return fileFct;
}
@ -318,7 +318,7 @@ void AddGerberX2Header( PLOTTER * aPlotter,
if( rev.IsEmpty() )
rev = wxT( "rev?" );
text.Printf( wxT( "%%TF.ProjectId,%s,%s,%s*%%" ), msg.ToAscii(), GetChars( guid ), rev.ToAscii() );
text.Printf( wxT( "%%TF.ProjectId,%s,%s,%s*%%" ), msg.ToAscii(), guid, rev.ToAscii() );
aPlotter->AddLineToHeader( makeStringCompatX1( text, aUseX1CompatibilityMode ) );
// Add the TF.SameCoordinates, that specify all gerber files uses the same

View File

@ -1102,7 +1102,7 @@ void ALTIUM_PCB::ParseModelsData( const CFB::CompoundFileReader& aReader,
{
wxLogError( wxString::Format(
_( "Cannot create directory \"%s\" -> no 3D-models will be imported." ),
GetChars( altiumModelsPath.GetFullPath() ) ) );
altiumModelsPath.GetFullPath() ) );
return;
}
}
@ -1127,7 +1127,7 @@ void ALTIUM_PCB::ParseModelsData( const CFB::CompoundFileReader& aReader,
{
wxLogError(
wxString::Format( _( "You do not have write permissions to save file \"%s\"." ),
GetChars( storagePath.GetFullPath() ) ) );
storagePath.GetFullPath() ) );
continue;
}

View File

@ -949,10 +949,7 @@ void EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLib, const wxString* aLibName )
const wxString& pkg = pack_ref;
wxString emsg = wxString::Format(
_( "<package> name: \"%s\" duplicated in eagle <library>: \"%s\"" ),
GetChars( pkg ),
GetChars( lib )
);
_( "<package> name: \"%s\" duplicated in eagle <library>: \"%s\"" ), pkg, lib );
THROW_IO_ERROR( emsg );
}
@ -1027,8 +1024,7 @@ void EAGLE_PLUGIN::loadElements( wxXmlNode* aElements )
if( mi == m_templates.end() )
{
wxString emsg = wxString::Format( _( "No \"%s\" package in library \"%s\"" ),
GetChars( FROM_UTF8( e.package.c_str() ) ),
GetChars( FROM_UTF8( e.library.c_str() ) ) );
FROM_UTF8( e.package.c_str() ), FROM_UTF8( e.library.c_str() ) );
THROW_IO_ERROR( emsg );
}

View File

@ -344,7 +344,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader )
if( parameters[0].CmpNoCase( wxT( "Element" ) ) != 0 )
{
msg.Printf( _( "unknown token \"%s\"" ), GetChars( parameters[0] ) );
msg.Printf( _( "unknown token \"%s\"" ), parameters[0] );
THROW_PARSE_ERROR( msg, aLineReader->GetSource(), (const char *)aLineReader,
aLineReader->LineNumber(), 0 );
}
@ -449,8 +449,8 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader )
conv_unit = NEW_GPCB_UNIT_CONV;
}
wxLogTrace( traceGedaPcbPlugin, wxT( "%s parameter count = %d." ),
GetChars( parameters[0] ), paramCnt );
wxLogTrace(
traceGedaPcbPlugin, wxT( "%s parameter count = %d." ), parameters[0], paramCnt );
// Parse a line with format: ElementLine [X1 Y1 X2 Y2 Thickness]
if( parameters[0].CmpNoCase( wxT( "ElementLine" ) ) == 0 )

View File

@ -185,7 +185,7 @@ void FP_CACHE::Save( MODULE* aModule )
// renaming the file.
{
wxLogTrace( traceKicadPcbPlugin, wxT( "Creating temporary library file %s" ),
GetChars( tempFileName ) );
tempFileName );
FILE_OUTPUTFORMATTER formatter( tempFileName );
@ -204,9 +204,7 @@ void FP_CACHE::Save( MODULE* aModule )
{
wxString msg = wxString::Format(
_( "Cannot rename temporary file \"%s\" to footprint library file \"%s\"" ),
GetChars( tempFileName ),
GetChars( fn.GetFullPath() )
);
tempFileName, fn.GetFullPath() );
THROW_IO_ERROR( msg );
}
#endif
@ -2233,8 +2231,8 @@ void PCB_IO::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootpri
if( !m_cache->Exists() )
{
const wxString msg = wxString::Format( _( "Library \"%s\" does not exist.\n"
"Would you like to create it?"),
GetChars( aLibraryPath ) );
"Would you like to create it?"),
aLibraryPath );
if( wxMessageBox( msg, _( "Library Not Found"), wxYES_NO | wxICON_QUESTION ) != wxYES )
return;

View File

@ -148,7 +148,7 @@ double PCB_PARSER::parseDouble()
{
wxString error;
error.Printf( _( "Invalid floating point number in\nfile: \"%s\"\nline: %d\noffset: %d" ),
GetChars( CurSource() ), CurLineNumber(), CurOffset() );
CurSource(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
}
@ -157,7 +157,7 @@ double PCB_PARSER::parseDouble()
{
wxString error;
error.Printf( _( "Missing floating point number in\nfile: \"%s\"\nline: %d\noffset: %d" ),
GetChars( CurSource() ), CurLineNumber(), CurOffset() );
CurSource(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
}
@ -513,7 +513,7 @@ BOARD_ITEM* PCB_PARSER::Parse()
default:
wxString err;
err.Printf( _( "Unknown token \"%s\"" ), GetChars( FromUTF8() ) );
err.Printf( _( "Unknown token \"%s\"" ), FromUTF8() );
THROW_PARSE_ERROR( err, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
}
@ -638,7 +638,7 @@ BOARD* PCB_PARSER::parseBOARD_unchecked()
default:
wxString err;
err.Printf( _( "Unknown token \"%s\"" ), GetChars( FromUTF8() ) );
err.Printf( _( "Unknown token \"%s\"" ), FromUTF8() );
THROW_PARSE_ERROR( err, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
}
}
@ -889,7 +889,7 @@ void PCB_PARSER::parsePAGE_INFO()
if( !pageInfo.SetType( pageType ) )
{
wxString err;
err.Printf( _( "Page type \"%s\" is not valid " ), GetChars( FromUTF8() ) );
err.Printf( _( "Page type \"%s\" is not valid " ), FromUTF8() );
THROW_PARSE_ERROR( err, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
}
@ -1421,8 +1421,8 @@ void PCB_PARSER::parseLayers()
{
wxString error = wxString::Format(
_( "Layer \"%s\" in file \"%s\" at line %d, is not in fixed layer hash" ),
GetChars( layer.m_name ),
GetChars( CurSource() ),
layer.m_name,
CurSource(),
CurLineNumber(),
CurOffset()
);
@ -2801,7 +2801,7 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments )
{
wxString error;
error.Printf( _( "Invalid footprint ID in\nfile: \"%s\"\nline: %d\noffset: %d" ),
GetChars( CurSource() ), CurLineNumber(), CurOffset() );
CurSource(), CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error );
}
@ -3103,7 +3103,7 @@ FP_TEXT* PCB_PARSER::parseFP_TEXT()
{
wxCHECK_MSG( CurTok() == T_fp_text, NULL,
wxString::Format( wxT( "Cannot parse %s as FP_TEXT at line %d, offset %d." ),
GetChars( GetTokenString( CurTok() ) ),
GetTokenString( CurTok() ),
CurLineNumber(), CurOffset() ) );
T token = NextTok();
@ -3124,8 +3124,8 @@ FP_TEXT* PCB_PARSER::parseFP_TEXT()
break; // Default type is user text.
default:
THROW_IO_ERROR( wxString::Format( _( "Cannot handle footprint text type %s" ),
GetChars( FromUTF8() ) ) );
THROW_IO_ERROR(
wxString::Format( _( "Cannot handle footprint text type %s" ), FromUTF8() ) );
}
NeedSYMBOLorNUMBER();
@ -4055,8 +4055,8 @@ ARC* PCB_PARSER::parseARC()
case T_net:
if( !arc->SetNetCode( getNetCode( parseInt( "net number" ) ), /* aNoAssert */ true ) )
THROW_IO_ERROR( wxString::Format(
_( "Invalid net ID in\nfile: \"%s\"\nline: %d\noffset: %d" ),
GetChars( CurSource() ), CurLineNumber(), CurOffset() ) );
_( "Invalid net ID in\nfile: \"%s\"\nline: %d\noffset: %d" ), CurSource(),
CurLineNumber(), CurOffset() ) );
break;
case T_tstamp:
@ -4124,11 +4124,10 @@ TRACK* PCB_PARSER::parseTRACK()
break;
case T_net:
if( ! track->SetNetCode( getNetCode( parseInt( "net number" ) ), /* aNoAssert */ true ) )
THROW_IO_ERROR(
wxString::Format( _( "Invalid net ID in\nfile: \"%s\"\nline: %d\noffset: %d" ),
GetChars( CurSource() ), CurLineNumber(), CurOffset() )
);
if( !track->SetNetCode( getNetCode( parseInt( "net number" ) ), /* aNoAssert */ true ) )
THROW_IO_ERROR( wxString::Format(
_( "Invalid net ID in\nfile: \"%s\"\nline: %d\noffset: %d" ), CurSource(),
CurLineNumber(), CurOffset() ) );
break;
case T_tstamp:
@ -4215,7 +4214,7 @@ VIA* PCB_PARSER::parseVIA()
if(! via->SetNetCode( getNetCode( parseInt( "net number" ) ), /* aNoAssert */ true))
THROW_IO_ERROR(
wxString::Format( _( "Invalid net ID in\nfile: \"%s\"\nline: %d\noffset: %d" ),
GetChars( CurSource() ), CurLineNumber(), CurOffset() )
CurSource(), CurLineNumber(), CurOffset() )
);
NeedRIGHT();
break;
@ -4301,11 +4300,10 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent )
if( tmp < 0 )
tmp = 0;
if( ! zone->SetNetCode( tmp, /* aNoAssert */ true ) )
THROW_IO_ERROR(
wxString::Format( _( "Invalid net ID in\nfile: \"%s\"\nline: %d\noffset: %d" ),
GetChars( CurSource() ), CurLineNumber(), CurOffset() )
);
if( !zone->SetNetCode( tmp, /* aNoAssert */ true ) )
THROW_IO_ERROR( wxString::Format(
_( "Invalid net ID in\nfile: \"%s\"\nline: %d\noffset: %d" ), CurSource(),
CurLineNumber(), CurOffset() ) );
NeedRIGHT();
break;

View File

@ -1393,8 +1393,7 @@ void LEGACY_PLUGIN::loadMODULE( MODULE* aModule )
}
wxString msg = wxString::Format(
_( "Missing '$EndMODULE' for MODULE \"%s\"" ),
GetChars( aModule->GetFPID().GetLibItemName() ) );
_( "Missing '$EndMODULE' for MODULE \"%s\"" ), aModule->GetFPID().GetLibItemName().wx_str() );
THROW_IO_ERROR( msg );
}
@ -1448,7 +1447,7 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule )
padchar,
padchar,
m_reader->LineNumber(),
GetChars( aModule->GetFPID().GetLibItemName() )
aModule->GetFPID().GetLibItemName().wx_str()
);
THROW_IO_ERROR( m_error );
}
@ -1651,7 +1650,7 @@ void LEGACY_PLUGIN::loadMODULE_EDGE( MODULE* aModule )
(unsigned char) line[1],
(unsigned char) line[1],
m_reader->LineNumber(),
GetChars( aModule->GetFPID().GetLibItemName() )
aModule->GetFPID().GetLibItemName().wx_str()
);
THROW_IO_ERROR( m_error );
}

View File

@ -907,16 +907,18 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard )
if( module->GetReference() == wxEmptyString )
{
THROW_IO_ERROR( wxString::Format( _( "Symbol with value of \"%s\" has empty reference id." ),
GetChars( module->GetValue() ) ) );
THROW_IO_ERROR( wxString::Format(
_( "Symbol with value of \"%s\" has empty reference id." ),
module->GetValue() ) );
}
// if we cannot insert OK, that means the reference has been seen before.
STRINGSET_PAIR refpair = refs.insert( TO_UTF8( module->GetReference() ) );
if( !refpair.second ) // insert failed
{
THROW_IO_ERROR( wxString::Format( _( "Multiple symbols have identical reference IDs of \"%s\"." ),
GetChars( module->GetReference() ) ) );
THROW_IO_ERROR( wxString::Format(
_( "Multiple symbols have identical reference IDs of \"%s\"." ),
module->GetReference() ) );
}
}
}

View File

@ -163,8 +163,8 @@ TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode )
if( layerNdx == -1 )
{
wxString layerName = FROM_UTF8( aPath->layer_id.c_str() );
THROW_IO_ERROR( wxString::Format( _("Session file uses invalid layer id \"%s\""),
GetChars( layerName ) ) );
THROW_IO_ERROR(
wxString::Format( _( "Session file uses invalid layer id \"%s\"" ), layerName ) );
}
TRACK* track = new TRACK( sessionBoard );
@ -222,8 +222,8 @@ TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode )
shape = (SHAPE*) (*aPadstack)[0];
DSN_T type = shape->shape->Type();
if( type != T_circle )
THROW_IO_ERROR( wxString::Format( _( "Unsupported via shape: %s"),
GetChars( GetTokenString( type ) ) ) );
THROW_IO_ERROR(
wxString::Format( _( "Unsupported via shape: %s" ), GetTokenString( type ) ) );
CIRCLE* circle = (CIRCLE*) shape->shape;
int viaDiam = scale( circle->diameter, routeResolution );
@ -240,8 +240,8 @@ TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode )
shape = (SHAPE*) (*aPadstack)[0];
DSN_T type = shape->shape->Type();
if( type != T_circle )
THROW_IO_ERROR( wxString::Format( _( "Unsupported via shape: %s"),
GetChars( GetTokenString( type ) ) ) );
THROW_IO_ERROR(
wxString::Format( _( "Unsupported via shape: %s" ), GetTokenString( type ) ) );
CIRCLE* circle = (CIRCLE*) shape->shape;
int viaDiam = scale( circle->diameter, routeResolution );
@ -265,8 +265,8 @@ TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode )
shape = (SHAPE*) (*aPadstack)[i];
DSN_T type = shape->shape->Type();
if( type != T_circle )
THROW_IO_ERROR( wxString::Format( _( "Unsupported via shape: %s"),
GetChars( GetTokenString( type ) ) ) );
THROW_IO_ERROR( wxString::Format(
_( "Unsupported via shape: %s" ), GetTokenString( type ) ) );
CIRCLE* circle = (CIRCLE*) shape->shape;
@ -274,8 +274,8 @@ TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode )
if( layerNdx == -1 )
{
wxString layerName = FROM_UTF8( circle->layer_id.c_str() );
THROW_IO_ERROR( wxString::Format( _("Session file uses invalid layer id \"%s\""),
GetChars( layerName ) ) );
THROW_IO_ERROR( wxString::Format(
_( "Session file uses invalid layer id \"%s\"" ), layerName ) );
}
if( layerNdx > topLayerNdx )
@ -493,8 +493,8 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard )
// wire_via to text and put that text into the exception.
wxString psid( FROM_UTF8( wire_via->GetPadstackId().c_str() ) );
THROW_IO_ERROR( wxString::Format( _("A wire_via references a missing padstack \"%s\""),
GetChars( psid ) ) );
THROW_IO_ERROR( wxString::Format(
_( "A wire_via references a missing padstack \"%s\"" ), psid ) );
}
NETCLASSPTR netclass = aBoard->GetDesignSettings().GetNetClasses().GetDefault();

View File

@ -956,7 +956,7 @@ int PCBNEW_CONTROL::AppendBoard( PLUGIN& pi, wxString& fileName )
}
catch( const IO_ERROR& ioe )
{
wxString msg = wxString::Format( _( "Error loading board.\n%s" ), GetChars( ioe.What() ));
wxString msg = wxString::Format( _( "Error loading board.\n%s" ), ioe.What() );
DisplayError( editFrame, msg );
return 0;

View File

@ -182,12 +182,12 @@ struct APP_TEST : public wxApp
catch( const std::exception& e )
{
wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
GetChars( FROM_UTF8( typeid(e).name() )),
GetChars( FROM_UTF8( e.what() ) ) );
FROM_UTF8( typeid(e).name() ),
FROM_UTF8( e.what() ) );
}
catch( const IO_ERROR& ioe )
{
wxLogError( GetChars( ioe.What() ) );
wxLogError( ioe.What() );
}
catch(...)
{
@ -218,12 +218,12 @@ struct APP_TEST : public wxApp
catch( const std::exception& e )
{
wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
GetChars( FROM_UTF8( typeid(e).name() )),
GetChars( FROM_UTF8( e.what() ) ) );
FROM_UTF8( typeid(e).name() ),
FROM_UTF8( e.what() ) );
}
catch( const IO_ERROR& ioe )
{
wxLogError( GetChars( ioe.What() ) );
wxLogError( ioe.What() );
}
catch(...)
{