7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-20 08:31:40 +00:00

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 );

Some files were not shown because too many files have changed in this diff Show More