Update kicad manager strings to wide

This commit is contained in:
Seth Hillbrand 2022-02-08 15:52:24 -08:00
parent a444addd89
commit b447d55900
15 changed files with 124 additions and 124 deletions

View File

@ -210,7 +210,7 @@ void DIALOG_TEMPLATE_SELECTOR::buildPageContent( const wxString& aPath, int aPag
if( dir.Open( aPath ) )
{
if( dir.HasSubDirs( "meta" ) )
if( dir.HasSubDirs( wxT( "meta" ) ) )
{
AddTemplate( aPage, new PROJECT_TEMPLATE( aPath ) );
}

View File

@ -115,7 +115,7 @@ void KICAD_MANAGER_FRAME::ImportNonKiCadProject( const wxString& aWindowTitle,
while( pro.DirExists() )
{
pro.RemoveLastDir();
wxString suffix = wxString::Format( "_%d", ++attempt );
wxString suffix = wxString::Format( wxT( "_%d" ), ++attempt );
pro.AppendDir( newDir + suffix );
}

View File

@ -132,7 +132,7 @@ bool PGM_KICAD::OnPgmInit()
}
// The KICAD6_TEMPLATE_DIR takes precedence over the search stack template path.
ENV_VAR_MAP_CITER it = GetLocalEnvVariables().find( "KICAD6_TEMPLATE_DIR" );
ENV_VAR_MAP_CITER it = GetLocalEnvVariables().find( wxT( "KICAD6_TEMPLATE_DIR" ) );
if( it != GetLocalEnvVariables().end() && it->second.GetValue() != wxEmptyString )
m_bm.m_search.Insert( it->second.GetValue(), 0 );
@ -142,7 +142,7 @@ bool PGM_KICAD::OnPgmInit()
m_bm.m_search.Insert( PATHS::GetUserTemplatesPath(), 0 );
// ...but the user can override that default with the KICAD_USER_TEMPLATE_DIR env var
it = GetLocalEnvVariables().find( "KICAD_USER_TEMPLATE_DIR" );
it = GetLocalEnvVariables().find( wxT( "KICAD_USER_TEMPLATE_DIR" ) );
if( it != GetLocalEnvVariables().end() && it->second.GetValue() != wxEmptyString )
m_bm.m_search.Insert( it->second.GetValue(), 0 );
@ -342,7 +342,7 @@ struct APP_KICAD : public wxApp
if( keyEvent )
{
wxLogTrace( kicadTraceKeyEvent, "APP_KICAD::ProcessEvent %s", dump( *keyEvent ) );
wxLogTrace( kicadTraceKeyEvent, wxT( "APP_KICAD::ProcessEvent %s" ), dump( *keyEvent ) );
}
}
@ -365,7 +365,7 @@ struct APP_KICAD : public wxApp
}
catch( const std::exception& e )
{
wxLogError( "Unhandled exception class: %s what: %s",
wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
FROM_UTF8( typeid(e).name() ),
FROM_UTF8( e.what() ) );
}
@ -375,7 +375,7 @@ struct APP_KICAD : public wxApp
}
catch(...)
{
wxLogError( "Unhandled exception of unknown type" );
wxLogError( wxT( "Unhandled exception of unknown type" ) );
}
return false; // continue on. Return false to abort program

View File

@ -113,7 +113,7 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& titl
{
m_active_project = false;
m_leftWinWidth = 250; // Default value
m_aboutTitle = "KiCad";
m_aboutTitle = wxT( "KiCad" );
#ifdef PCM
// JPC: A very ugly hack to fix an issue on Linux: if the wxbase315u_xml_gcc_custom.so is
@ -158,7 +158,7 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& titl
m_auimgr.SetManagedWindow( this );
m_auimgr.SetFlags( wxAUI_MGR_LIVE_RESIZE );
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Left()
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( wxT( "MainToolbar" ) ).Left()
.Layer( 2 ) );
// BestSize() does not always set the actual pane size of m_leftWin to the required value.
@ -166,11 +166,11 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& titl
// (Well, BestSize() sets the best size... not the window size)
// A trick is to use MinSize() to set the required pane width,
// and after give a reasonable MinSize value
m_auimgr.AddPane( m_leftWin, EDA_PANE().Palette().Name( "ProjectTree" ).Left().Layer( 1 )
m_auimgr.AddPane( m_leftWin, EDA_PANE().Palette().Name( wxT( "ProjectTree" ) ).Left().Layer( 1 )
.Caption( _( "Project Files" ) ).PaneBorder( false )
.MinSize( m_leftWinWidth, -1 ).BestSize( m_leftWinWidth, -1 ) );
m_auimgr.AddPane( m_launcher, EDA_PANE().Canvas().Name( "Launcher" ).Center()
m_auimgr.AddPane( m_launcher, EDA_PANE().Canvas().Name( wxT( "Launcher" ) ).Center()
.Caption( _( "Editors" ) ).PaneBorder( false )
.MinSize( m_launcher->GetBestSize() ) );
@ -188,7 +188,7 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& titl
if( ADVANCED_CFG::GetCfg().m_HideVersionFromTitle )
SetTitle( wxT( "KiCad" ) );
else
SetTitle( wxString( "KiCad " ) + GetMajorMinorVersion() );
SetTitle( wxString( wxT( "KiCad " ) ) + GetMajorMinorVersion() );
// Do not let the messages window have initial focus
m_leftWin->SetFocus();
@ -429,7 +429,7 @@ bool KICAD_MANAGER_FRAME::CloseProject( bool aSave )
mgr.UnloadProject( &Prj() );
}
SetStatusText( "" );
SetStatusText( wxT( "" ) );
m_leftWin->EmptyTreePrj();
@ -480,7 +480,7 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxFileName& aProjectFileName,
bool aCreateStubFiles )
{
wxCHECK_RET( aProjectFileName.DirExists() && aProjectFileName.IsDirWritable(),
"Project folder must exist and be writable to create a new project." );
wxT( "Project folder must exist and be writable to create a new project." ) );
// If the project is legacy, convert it
if( !aProjectFileName.FileExists() )
@ -498,7 +498,7 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxFileName& aProjectFileName,
else
{
// Copy template project file from template folder.
wxString srcFileName = sys_search().FindValidPath( "kicad.kicad_pro" );
wxString srcFileName = sys_search().FindValidPath( wxT( "kicad.kicad_pro" ) );
wxFileName destFileName( aProjectFileName );
destFileName.SetExt( ProjectFileExtension );
@ -507,7 +507,7 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxFileName& aProjectFileName,
if( !wxFileName::FileExists( srcFileName )
|| !wxCopyFile( srcFileName, destFileName.GetFullPath() ) )
{
wxFFile file( destFileName.GetFullPath(), "wb" );
wxFFile file( destFileName.GetFullPath(), wxT( "wb" ) );
if( file.IsOpened() )
file.Write( wxT( "{\n}\n") );
@ -529,12 +529,12 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxFileName& aProjectFileName,
// file ).
if( !fn.FileExists() )
{
wxFFile file( fn.GetFullPath(), "wb" );
wxFFile file( fn.GetFullPath(), wxT( "wb" ) );
if( file.IsOpened() )
file.Write( wxString::Format( "(kicad_sch (version %d) (generator eeschema)\n"
file.Write( wxString::Format( wxT( "(kicad_sch (version %d) (generator eeschema)\n"
" (paper \"A4\")\n (lib_symbols)\n"
" (symbol_instances)\n)\n",
" (symbol_instances)\n)\n" ),
SEXPR_SCHEMATIC_FILE_VERSION ) );
// wxFFile dtor will close the file
@ -548,11 +548,11 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxFileName& aProjectFileName,
if( !fn.FileExists() && !leg_fn.FileExists() )
{
wxFFile file( fn.GetFullPath(), "wb" );
wxFFile file( fn.GetFullPath(), wxT( "wb" ) );
if( file.IsOpened() )
// Create a small dummy file as a stub for pcbnew:
file.Write( wxString::Format( "(kicad_pcb (version %d) (generator pcbnew)\n)",
file.Write( wxString::Format( wxT( "(kicad_pcb (version %d) (generator pcbnew)\n)" ),
SEXPR_BOARD_FILE_VERSION ) );
// wxFFile dtor will close the file

View File

@ -123,7 +123,7 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
BITMAPS::unzip );
fileMenu->AppendSeparator();
fileMenu->AddQuitOrClose( nullptr, "KiCad" );
fileMenu->AddQuitOrClose( nullptr, wxT( "KiCad" ) );
//-- View menu -----------------------------------------------------------
//

View File

@ -109,7 +109,7 @@ void DIALOG_MANAGE_REPOSITORIES::OnAddButtonClicked( wxCommandEvent& event )
int increment = 1;
while( find_row( 0, name ) >= 0 )
name = wxString::Format( "%s (%d)", repository.name, increment++ );
name = wxString::Format( wxT( "%s (%d)" ), repository.name, increment++ );
m_grid->Freeze();

View File

@ -250,7 +250,7 @@ void DIALOG_PCM::OnRefreshClicked( wxCommandEvent& event )
void DIALOG_PCM::OnInstallFromFileClicked( wxCommandEvent& event )
{
wxFileDialog open_file_dialog( this, _( "Choose package file" ), wxEmptyString, wxEmptyString,
"Zip files (*.zip)|*.zip", wxFD_OPEN | wxFD_FILE_MUST_EXIST );
wxT( "Zip files (*.zip)|*.zip" ), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( open_file_dialog.ShowModal() == wxID_CANCEL )
return;

View File

@ -60,8 +60,8 @@ void PANEL_PACKAGE::OnSize( wxSizeEvent& event )
{
Layout();
int nameLineHeight = m_name->GetTextExtent( "X" ).GetHeight();
double descLineHeight = m_desc->GetTextExtent( "X" ).GetHeight() * 1.2 /* leading */;
int nameLineHeight = m_name->GetTextExtent( wxT( "X" ) ).GetHeight();
double descLineHeight = m_desc->GetTextExtent( wxT( "X" ) ).GetHeight() * 1.2 /* leading */;
m_desc->SetLabel( m_data.package.description );
m_desc->Wrap( m_desc->GetClientSize().GetWidth() - 10 );

View File

@ -40,11 +40,11 @@
std::unordered_map<PCM_PACKAGE_VERSION_STATUS, wxString> PANEL_PACKAGES_VIEW::STATUS_ENUM_TO_STR = {
{ PVS_INVALID, "invalid" },
{ PVS_STABLE, "stable" },
{ PVS_TESTING, "testing" },
{ PVS_DEVELOPMENT, "development" },
{ PVS_DEPRECATED, "deprecated" }
{ PVS_INVALID, wxT( "invalid" ) },
{ PVS_STABLE, wxT( "stable" ) },
{ PVS_TESTING, wxT( "testing" ) },
{ PVS_DEVELOPMENT, wxT( "development" ) },
{ PVS_DEPRECATED, wxT( "deprecated" ) }
};
@ -161,7 +161,7 @@ void PANEL_PACKAGES_VIEW::setPackageDetails( const PACKAGE_VIEW_DATA& aPackageDa
// Details
wxString details;
details << "<h5>" + package.name + "</h5>";
details << wxT( "<h5>" ) + package.name + wxT( "</h5>" );
auto format_desc =
[]( const wxString& text ) -> wxString
@ -178,7 +178,7 @@ void PANEL_PACKAGES_VIEW::setPackageDetails( const PACKAGE_VIEW_DATA& aPackageDa
{
if( c == ' ' )
{
result += wxString::Format( "<a href='%s'>%s</a>", url, url );
result += wxString::Format( wxT( "<a href='%s'>%s</a>" ), url, url );
inURL = false;
result += c;
@ -188,14 +188,14 @@ void PANEL_PACKAGES_VIEW::setPackageDetails( const PACKAGE_VIEW_DATA& aPackageDa
url += c;
}
}
else if( text.Mid( i, 5 ) == "http:" || text.Mid( i, 6 ) == "https:" )
else if( text.Mid( i, 5 ) == wxT( "http:" ) || text.Mid( i, 6 ) == wxT( "https:" ) )
{
url = c;
inURL = true;
}
else if( c == '\n' )
{
result += "</p><p>";
result += wxT( "</p><p>" );
}
else
{
@ -207,12 +207,12 @@ void PANEL_PACKAGES_VIEW::setPackageDetails( const PACKAGE_VIEW_DATA& aPackageDa
};
wxString desc = package.description_full;
details << "<p>" + format_desc( desc ) + "</p>";
details << wxT( "<p>" ) + format_desc( desc ) + wxT( "</p>" );
details << "<p><b>" + _( "Metadata" ) + "</b></p>";
details << "<ul>";
details << "<li>" + _( "Package identifier: " ) + package.identifier + "</li>";
details << "<li>" + _( "License: " ) + package.license + "</li>";
details << wxT( "<p><b>" ) + _( "MetadatawxT( " ) + " )</b></p>";
details << wxT( "<ul>" );
details << wxT( "<li>" ) + _( "Package identifier: wxT( " ) + package.identifier + " )</li>";
details << wxT( "<li>" ) + _( "License: wxT( " ) + package.license + " )</li>";
if( package.tags.size() > 0 )
{
@ -221,12 +221,12 @@ void PANEL_PACKAGES_VIEW::setPackageDetails( const PACKAGE_VIEW_DATA& aPackageDa
for( const std::string& tag : package.tags )
{
if( !tags_str.IsEmpty() )
tags_str += ", ";
tags_str += wxT( ", " );
tags_str += tag;
}
details << "<li>" + _( "Tags: " ) + tags_str + "</li>";
details << wxT( "<li>" ) + _( "Tags: wxT( " ) + tags_str + " )</li>";
}
auto format_entry =
@ -235,10 +235,10 @@ void PANEL_PACKAGES_VIEW::setPackageDetails( const PACKAGE_VIEW_DATA& aPackageDa
wxString name = entry.first;
wxString url = EscapeHTML( entry.second );
if( name == "email" )
return wxString::Format( "<a href='mailto:%s'>%s</a>", url, url );
else if( url.StartsWith( "http:" ) || url.StartsWith( "https:" ) )
return wxString::Format( "<a href='%s'>%s</a>", url, url );
if( name == wxT( "email" ) )
return wxString::Format( wxT( "<a href='mailto:%s'>%s</a>" ), url, url );
else if( url.StartsWith( wxT( "http:" ) ) || url.StartsWith( wxT( "https:" ) ) )
return wxString::Format( wxT( "<a href='%s'>%s</a>" ), url, url );
else
return entry.second;
};
@ -246,12 +246,12 @@ void PANEL_PACKAGES_VIEW::setPackageDetails( const PACKAGE_VIEW_DATA& aPackageDa
auto write_contact =
[&]( const wxString& type, const PCM_CONTACT& contact )
{
details << "<li>" + type + ": " + contact.name + "<ul>";
details << wxT( "<li>" ) + type + wxT( ": " ) + contact.name + wxT( "<ul>" );
for( const std::pair<const std::string, wxString>& entry : contact.contact )
details << "<li>" + entry.first + ": " + format_entry( entry ) + "</li>";
details << wxT( "<li>" ) + entry.first + wxT( ": " ) + format_entry( entry ) + wxT( "</li>" );
details << "</ul>";
details << wxT( "</ul>" );
};
write_contact( _( "Author" ), package.author );
@ -261,15 +261,15 @@ void PANEL_PACKAGES_VIEW::setPackageDetails( const PACKAGE_VIEW_DATA& aPackageDa
if( package.resources.size() > 0 )
{
details << "<li>" + _( "Resources" ) + "<ul>";
details << wxT( "<li>" ) + _( "Resources" ) + "<ul>";
for( const std::pair<const std::string, wxString>& entry : package.resources )
details << "<li>" + entry.first + wxS( ": " ) + format_entry( entry ) + "</li>";
details << wxT( "<li>" ) + entry.first + wxS( ": " ) + format_entry( entry ) + "</li>";
details << "</ul>";
details << wxT( "</ul>" );
}
details << "</ul>";
details << wxT( "</ul>" );
m_infoText->SetPage( details );
@ -382,17 +382,17 @@ void PANEL_PACKAGES_VIEW::unsetPackageDetails()
wxString PANEL_PACKAGES_VIEW::toHumanReadableSize( const boost::optional<uint64_t> size ) const
{
if( !size )
return "-";
return wxT( "-" );
uint64_t b = size.get();
if( b >= 1024 * 1024 )
return wxString::Format( "%.1f Mb", b / 1024.0 / 1024.0 );
return wxString::Format( wxT( "%.1f Mb" ), b / 1024.0 / 1024.0 );
if( b >= 1024 )
return wxString::Format( "%lld Kb", b / 1024 );
return wxString::Format( wxT( "%lld Kb" ), b / 1024 );
return wxString::Format( "%lld b", b );
return wxString::Format( wxT( "%lld b" ), b );
}
@ -468,7 +468,7 @@ void PANEL_PACKAGES_VIEW::OnDownloadVersionClicked( wxCommandEvent& event )
return ver.version == version;
} );
wxASSERT_MSG( ver_it != package.versions.end(), "Could not find package version" );
wxASSERT_MSG( ver_it != package.versions.end(), wxT( "Could not find package version" ) );
if( !ver_it->download_url )
{
@ -483,8 +483,8 @@ void PANEL_PACKAGES_VIEW::OnDownloadVersionClicked( wxCommandEvent& event )
KICAD_SETTINGS* app_settings = mgr.GetAppSettings<KICAD_SETTINGS>();
wxFileDialog dialog( this, _( "Save package" ), app_settings->m_PcmLastDownloadDir,
wxString::Format( "%s_v%s.zip", package.identifier, version ),
"ZIP files (*.zip)|*.zip", wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
wxString::Format( wxT( "%s_v%s.zip" ), package.identifier, version ),
wxT( "ZIP files (*.zip)|*.zip" ), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dialog.ShowModal() == wxID_CANCEL )
return;
@ -552,7 +552,7 @@ void PANEL_PACKAGES_VIEW::OnInstallVersionClicked( wxCommandEvent& event )
return ver.version == version;
} );
wxASSERT_MSG( ver_it != package.versions.end(), "Could not find package version" );
wxASSERT_MSG( ver_it != package.versions.end(), wxT( "Could not find package version" ) );
if( !ver_it->compatible
&& wxMessageBox( _( "This package version is incompatible with your kicad version or "

View File

@ -64,7 +64,7 @@ PLUGIN_CONTENT_MANAGER::PLUGIN_CONTENT_MANAGER( wxWindow* aParent ) : m_dialog(
{
// Get 3rd party path
const ENV_VAR_MAP& env = Pgm().GetLocalEnvVariables();
auto it = env.find( "KICAD6_3RD_PARTY" );
auto it = env.find( wxT( "KICAD6_3RD_PARTY" ) );
if( it != env.end() && !it->second.GetValue().IsEmpty() )
m_3rdparty_path = it->second.GetValue();
@ -72,9 +72,9 @@ PLUGIN_CONTENT_MANAGER::PLUGIN_CONTENT_MANAGER( wxWindow* aParent ) : m_dialog(
m_3rdparty_path = PATHS::GetDefault3rdPartyPath();
// Read and store pcm schema
wxFileName schema_file( PATHS::GetStockDataPath( true ), "pcm.v1.schema.json" );
wxFileName schema_file( PATHS::GetStockDataPath( true ), wxT( "pcm.v1.schema.json" ) );
schema_file.Normalize();
schema_file.AppendDir( "schemas" );
schema_file.AppendDir( wxT( "schemas" ) );
std::ifstream schema_stream( schema_file.GetFullPath().ToUTF8() );
nlohmann::json schema;
@ -94,7 +94,7 @@ PLUGIN_CONTENT_MANAGER::PLUGIN_CONTENT_MANAGER( wxWindow* aParent ) : m_dialog(
}
// Load currently installed packages
wxFileName f( SETTINGS_MANAGER::GetUserSettingsPath(), "installed_packages.json" );
wxFileName f( SETTINGS_MANAGER::GetUserSettingsPath(), wxT( "installed_packages.json" ) );
if( f.FileExists() )
{
@ -154,14 +154,14 @@ PLUGIN_CONTENT_MANAGER::PLUGIN_CONTENT_MANAGER( wxWindow* aParent ) : m_dialog(
entry.package.name = subdir;
entry.package.identifier = actual_package_id;
entry.current_version = "0.0";
entry.current_version = wxT( "0.0" );
entry.repository_name = wxT( "<unknown>" );
if( stat_code == 0 )
entry.install_timestamp = stat.st_mtime;
PACKAGE_VERSION version;
version.version = "0.0";
version.version = wxT( "0.0" );
version.status = PVS_STABLE;
version.kicad_version = KICAD_MAJOR_MINOR_VERSION;
@ -336,7 +336,7 @@ const PCM_REPOSITORY&
PLUGIN_CONTENT_MANAGER::getCachedRepository( const wxString& aRepositoryId ) const
{
wxASSERT_MSG( m_repository_cache.find( aRepositoryId ) != m_repository_cache.end(),
"Repository is not cached." );
wxT( "Repository is not cached." ) );
return m_repository_cache.at( aRepositoryId );
}
@ -371,10 +371,10 @@ const bool PLUGIN_CONTENT_MANAGER::CacheRepository( const wxString& aRepositoryI
bool packages_cache_exists = false;
// First load repository data from local filesystem if available.
wxFileName repo_cache = wxFileName( m_3rdparty_path, "repository.json" );
repo_cache.AppendDir( "cache" );
wxFileName repo_cache = wxFileName( m_3rdparty_path, wxT( "repository.json" ) );
repo_cache.AppendDir( wxT( "cache" ) );
repo_cache.AppendDir( aRepositoryId );
wxFileName packages_cache( repo_cache.GetPath(), "packages.json" );
wxFileName packages_cache( repo_cache.GetPath(), wxT( "packages.json" ) );
if( repo_cache.FileExists() && packages_cache.FileExists() )
{
@ -438,7 +438,7 @@ const bool PLUGIN_CONTENT_MANAGER::CacheRepository( const wxString& aRepositoryI
// Check resources file date, redownload if needed
PCM_RESOURCE_REFERENCE& resources = current_repo.resources.get();
wxFileName resource_file( repo_cache.GetPath(), "resources.zip" );
wxFileName resource_file( repo_cache.GetPath(), wxT( "resources.zip" ) );
time_t mtime = 0;
@ -495,7 +495,7 @@ void PLUGIN_CONTENT_MANAGER::preparePackage( PCM_PACKAGE& aPackage )
if( ver.version_epoch )
epoch = ver.version_epoch.get();
wxStringTokenizer version_tokenizer( ver.version, "." );
wxStringTokenizer version_tokenizer( ver.version, wxT( "." ) );
major = wxAtoi( version_tokenizer.GetNextToken() );
@ -512,7 +512,7 @@ void PLUGIN_CONTENT_MANAGER::preparePackage( PCM_PACKAGE& aPackage )
auto parse_major_minor = []( const wxString& version )
{
wxStringTokenizer tokenizer( version, "." );
wxStringTokenizer tokenizer( version, wxT( "." ) );
int ver_major = wxAtoi( tokenizer.GetNextToken() );
int ver_minor = wxAtoi( tokenizer.GetNextToken() );
return std::tuple<int, int>( ver_major, ver_minor );
@ -594,7 +594,7 @@ void PLUGIN_CONTENT_MANAGER::DiscardRepositoryCache( const wxString& aRepository
m_repository_cache.erase( aRepositoryId );
wxFileName repo_cache( m_3rdparty_path, "" );
repo_cache.AppendDir( "cache" );
repo_cache.AppendDir( wxT( "cache" ) );
repo_cache.AppendDir( aRepositoryId );
if( repo_cache.DirExists() )
@ -684,7 +684,7 @@ PLUGIN_CONTENT_MANAGER::~PLUGIN_CONTENT_MANAGER()
js["packages"].emplace_back( entry.second );
}
wxFileName f( SETTINGS_MANAGER::GetUserSettingsPath(), "installed_packages.json" );
wxFileName f( SETTINGS_MANAGER::GetUserSettingsPath(), wxT( "installed_packages.json" ) );
std::ofstream stream( f.GetFullPath().ToUTF8() );
stream << std::setw( 4 ) << js << std::endl;
@ -714,7 +714,7 @@ const wxString&
PLUGIN_CONTENT_MANAGER::GetInstalledPackageVersion( const wxString& aPackageId ) const
{
wxASSERT_MSG( m_installed.find( aPackageId ) != m_installed.end(),
"Installed package not found." );
wxT( "Installed package not found." ) );
return m_installed.at( aPackageId ).current_version;
}
@ -723,7 +723,7 @@ PLUGIN_CONTENT_MANAGER::GetInstalledPackageVersion( const wxString& aPackageId )
int PLUGIN_CONTENT_MANAGER::GetPackageSearchRank( const PCM_PACKAGE& aPackage,
const wxString& aSearchTerm )
{
wxArrayString terms = wxStringTokenize( aSearchTerm.Lower(), " ", wxTOKEN_STRTOK );
wxArrayString terms = wxStringTokenize( aSearchTerm.Lower(), wxT( " " ), wxTOKEN_STRTOK );
int rank = 0;
const auto find_term_matches = [&]( const wxString& str )
@ -782,8 +782,8 @@ PLUGIN_CONTENT_MANAGER::GetRepositoryPackageBitmaps( const wxString& aRepository
{
std::unordered_map<wxString, wxBitmap> bitmaps;
wxFileName resources_file = wxFileName( m_3rdparty_path, "resources.zip" );
resources_file.AppendDir( "cache" );
wxFileName resources_file = wxFileName( m_3rdparty_path, wxT( "resources.zip" ) );
resources_file.AppendDir( wxT( "cache" ) );
resources_file.AppendDir( aRepositoryId );
if( !resources_file.FileExists() )
@ -800,7 +800,7 @@ PLUGIN_CONTENT_MANAGER::GetRepositoryPackageBitmaps( const wxString& aRepository
wxArrayString path_parts =
wxSplit( entry->GetName(), wxFileName::GetPathSeparator(), (wxChar) 0 );
if( path_parts.size() != 2 || path_parts[1] != "icon.png" )
if( path_parts.size() != 2 || path_parts[1] != wxT( "icon.png" ) )
continue;
try
@ -812,7 +812,7 @@ PLUGIN_CONTENT_MANAGER::GetRepositoryPackageBitmaps( const wxString& aRepository
catch( ... )
{
// Log and ignore
wxLogTrace( "Error loading png bitmap for entry %s from %s", entry->GetName(),
wxLogTrace( wxT( "Error loading png bitmap for entry %s from %s" ), entry->GetName(),
resources_file.GetFullPath() );
}
}
@ -825,19 +825,19 @@ std::unordered_map<wxString, wxBitmap> PLUGIN_CONTENT_MANAGER::GetInstalledPacka
{
std::unordered_map<wxString, wxBitmap> bitmaps;
wxFileName resources_dir_fn( m_3rdparty_path, "" );
resources_dir_fn.AppendDir( "resources" );
wxFileName resources_dir_fn( m_3rdparty_path, wxT( "" ) );
resources_dir_fn.AppendDir( wxT( "resources" ) );
wxDir resources_dir( resources_dir_fn.GetPath() );
if( !resources_dir.IsOpened() )
return bitmaps;
wxString subdir;
bool more = resources_dir.GetFirst( &subdir, "", wxDIR_DIRS | wxDIR_HIDDEN );
bool more = resources_dir.GetFirst( &subdir, wxT( "" ), wxDIR_DIRS | wxDIR_HIDDEN );
while( more )
{
wxFileName icon( resources_dir_fn.GetPath(), "icon.png" );
wxFileName icon( resources_dir_fn.GetPath(), wxT( "icon.png" ) );
icon.AppendDir( subdir );
if( icon.FileExists() )
@ -853,7 +853,7 @@ std::unordered_map<wxString, wxBitmap> PLUGIN_CONTENT_MANAGER::GetInstalledPacka
catch( ... )
{
// Log and ignore
wxLogTrace( "Error loading png bitmap from %s", icon.GetFullPath() );
wxLogTrace( wxT( "Error loading png bitmap from %s" ), icon.GetFullPath() );
}
}

View File

@ -36,12 +36,12 @@
///< Contains list of all valid directories that get extracted from a package archive
const std::unordered_set<wxString> PCM_PACKAGE_DIRECTORIES( {
"plugins",
"footprints",
"3dmodels",
"symbols",
"resources",
"colors",
wxT( "plugins" ),
wxT( "footprints" ),
wxT( "3dmodels" ),
wxT( "symbols" ),
wxT( "resources" ),
wxT( "colors" ),
} );

View File

@ -43,8 +43,8 @@ void PCM_TASK_MANAGER::DownloadAndInstall( const PCM_PACKAGE& aPackage, const wx
PCM_TASK download_task = [aPackage, aVersion, aRepositoryId, this]()
{
wxFileName file_path( m_pcm->Get3rdPartyPath(), "" );
file_path.AppendDir( "cache" );
file_path.SetFullName( wxString::Format( "%s_v%s.zip", aPackage.identifier, aVersion ) );
file_path.AppendDir( wxT( "cache" ) );
file_path.SetFullName( wxString::Format( wxT( "%s_v%s.zip" ), aPackage.identifier, aVersion ) );
auto find_pkgver = std::find_if( aPackage.versions.begin(), aPackage.versions.end(),
[&aVersion]( const PACKAGE_VERSION& pv )
@ -52,7 +52,7 @@ void PCM_TASK_MANAGER::DownloadAndInstall( const PCM_PACKAGE& aPackage, const wx
return pv.version == aVersion;
} );
wxASSERT_MSG( find_pkgver != aPackage.versions.end(), "Package version not found" );
wxASSERT_MSG( find_pkgver != aPackage.versions.end(), wxT( "Package version not found" ) );
if( !wxDirExists( file_path.GetPath() )
&& !wxFileName::Mkdir( file_path.GetPath(), wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ) )
@ -281,7 +281,7 @@ void PCM_TASK_MANAGER::InstallFromFile( wxWindow* aParent, const wxString& aFile
for( wxArchiveEntry* entry = zip.GetNextEntry(); entry != nullptr; entry = zip.GetNextEntry() )
{
// Find and load metadata.json
if( entry->GetName() != "metadata.json" )
if( entry->GetName() != wxT( "metadata.json" ) )
continue;
wxStringOutputStream strStream;

View File

@ -202,11 +202,11 @@ bool PROJECT_TEMPLATE::CreateProject( wxFileName& aNewProjectPath, wxString* aEr
{
// Skip these; they're often shared
}
if( destFile.GetName().EndsWith( "-cache" ) || destFile.GetName().EndsWith( "-rescue" ) )
if( destFile.GetName().EndsWith( wxT( "-cache" ) ) || destFile.GetName().EndsWith( wxT( "-rescue" ) ) )
{
currname.Replace( basename, aNewProjectPath.GetName() );
}
else if( destFile.GetExt() == "dcm" || destFile.GetExt() == "lib" )
else if( destFile.GetExt() == wxT( "dcm" ) || destFile.GetExt() == wxT( "lib" ) )
{
// Don't rename project-specific symbol libraries. This will break the symbol library
// table which will cause broken symbol library links in the schematic.
@ -231,7 +231,7 @@ bool PROJECT_TEMPLATE::CreateProject( wxFileName& aNewProjectPath, wxString* aEr
if( aErrorMsg )
{
if( !aErrorMsg->empty() )
*aErrorMsg += "\n";
*aErrorMsg += wxT( "\n" );
wxString msg;
@ -250,7 +250,7 @@ bool PROJECT_TEMPLATE::CreateProject( wxFileName& aNewProjectPath, wxString* aEr
if( aErrorMsg )
{
if( !aErrorMsg->empty() )
*aErrorMsg += "\n";
*aErrorMsg += wxT( "\n" );
wxString msg;

View File

@ -111,7 +111,7 @@ static const wxChar* s_allowedExtensionsToList[] = {
*/
// Gerber file extension wildcard.
const wxString GerberFileExtensionWildCard( ".((gbr|gbrjob|(gb|gt)[alops])|pho)" );
const wxString GerberFileExtensionWildCard( wxT( ".((gbr|gbrjob|(gb|gt)[alops])|pho)" ) );
/**
@ -273,8 +273,8 @@ wxString PROJECT_TREE_PANE::GetFileExt( TREE_FILE_TYPE type )
case TREE_FILE_TYPE::REPORT: return ReportFileExtension;
case TREE_FILE_TYPE::FP_PLACE: return FootprintPlaceFileExtension;
case TREE_FILE_TYPE::DRILL: return DrillFileExtension;
case TREE_FILE_TYPE::DRILL_NC: return "nc";
case TREE_FILE_TYPE::DRILL_XNC: return "xnc";
case TREE_FILE_TYPE::DRILL_NC: return wxT( "nc" );
case TREE_FILE_TYPE::DRILL_XNC: return wxT( "xnc" );
case TREE_FILE_TYPE::SVG: return SVGFileExtension;
case TREE_FILE_TYPE::DRAWING_SHEET: return DrawingSheetFileExtension;
case TREE_FILE_TYPE::FOOTPRINT_FILE: return KiCadFootprintFileExtension;
@ -332,7 +332,7 @@ wxTreeItemId PROJECT_TREE_PANE::addItemToProjectTree( const wxString& aName,
for( const wxString& m_filter : m_filters )
{
wxCHECK2_MSG( reg.Compile( m_filter, wxRE_ICASE ), continue,
wxString::Format( "Regex %s failed to compile.", m_filter ) );
wxString::Format( wxT( "Regex %s failed to compile." ), m_filter ) );
if( reg.Matches( aName ) )
{
@ -354,7 +354,7 @@ wxTreeItemId PROJECT_TREE_PANE::addItemToProjectTree( const wxString& aName,
// For gerber files, the official ext is gbr
if( i == static_cast<int>( TREE_FILE_TYPE::GERBER ) )
ext = "gbr";
ext = wxT( "gbr" );
reg.Compile( wxString::FromAscii( "^.*\\." ) + ext + wxString::FromAscii( "$" ),
wxRE_ICASE );
@ -473,7 +473,7 @@ wxTreeItemId PROJECT_TREE_PANE::addItemToProjectTree( const wxString& aName,
// Mark root files (files which have the same aName as the project)
wxString fileName = currfile.GetName().Lower();
wxString projName = project.GetName().Lower();
data->SetRootFile( fileName == projName || fileName.StartsWith( projName + "-" ) );
data->SetRootFile( fileName == projName || fileName.StartsWith( projName + wxT( "-" ) ) );
#ifndef __WINDOWS__
bool subdir_populated = false;
@ -799,7 +799,7 @@ void PROJECT_TREE_PANE::onOpenSelectedFileWithTextEditor( wxCommandEvent& event
wxString fullFileName = item_data->GetFileName();
if( !files.IsEmpty() )
files += " ";
files += wxT( " " );
files += fullFileName;
}
@ -1222,7 +1222,7 @@ void PROJECT_TREE_PANE::FileWatcherReset()
// we can see wxString under a debugger, not a wxFileName
const wxString& path = itemData->GetFileName();
wxLogTrace( tracePathsAndFiles, "%s: add '%s'\n", __func__, TO_UTF8( path ) );
wxLogTrace( tracePathsAndFiles, wxT( "%s: add '%s'\n" ), __func__, TO_UTF8( path ) );
if( wxFileName::IsDirReadable( path ) ) // linux whines about watching protected dir
{
@ -1242,10 +1242,10 @@ void PROJECT_TREE_PANE::FileWatcherReset()
#if defined(DEBUG) && 1
wxArrayString paths;
m_watcher->GetWatchedPaths( &paths );
wxLogTrace( tracePathsAndFiles, "%s: watched paths:", __func__ );
wxLogTrace( tracePathsAndFiles, wxT( "%s: watched paths:" ), __func__ );
for( unsigned ii = 0; ii < paths.GetCount(); ii++ )
wxLogTrace( tracePathsAndFiles, " %s\n", TO_UTF8( paths[ii] ) );
wxLogTrace( tracePathsAndFiles, wxT( " %s\n" ), TO_UTF8( paths[ii] ) );
#endif
}

View File

@ -156,7 +156,7 @@ int KICAD_MANAGER_CONTROL::NewFromTemplate( const TOOL_EVENT& aEvent )
wxString envStr;
// KiCad system template path.
ENV_VAR_MAP_CITER it = Pgm().GetLocalEnvVariables().find( "KICAD6_TEMPLATE_DIR" );
ENV_VAR_MAP_CITER it = Pgm().GetLocalEnvVariables().find( wxT( "KICAD6_TEMPLATE_DIR" ) );
if( it != Pgm().GetLocalEnvVariables().end() && it->second.GetValue() != wxEmptyString )
{
@ -165,7 +165,7 @@ int KICAD_MANAGER_CONTROL::NewFromTemplate( const TOOL_EVENT& aEvent )
}
// User template path.
it = Pgm().GetLocalEnvVariables().find( "KICAD_USER_TEMPLATE_DIR" );
it = Pgm().GetLocalEnvVariables().find( wxT( "KICAD_USER_TEMPLATE_DIR" ) );
if( it != Pgm().GetLocalEnvVariables().end() && it->second.GetValue() != wxEmptyString )
{
@ -257,7 +257,7 @@ int KICAD_MANAGER_CONTROL::NewFromTemplate( const TOOL_EVENT& aEvent )
wxString extendedMsg = _( "Overwriting files:" ) + "\n";
for( const auto& file : overwrittenFiles )
extendedMsg += "\n" + file.GetFullName();
extendedMsg += wxT( "\n" ) + file.GetFullName();
KIDIALOG msgDlg( m_frame, _( "Similar files already exist in the destination folder." ),
_( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
@ -297,8 +297,8 @@ int KICAD_MANAGER_CONTROL::NewFromTemplate( const TOOL_EVENT& aEvent )
int KICAD_MANAGER_CONTROL::openProject( const wxString& aDefaultDir )
{
wxString wildcard = AllProjectFilesWildcard()
+ "|" + ProjectFileWildcard()
+ "|" + LegacyProjectFileWildcard();
+ wxT( "|" ) + ProjectFileWildcard()
+ wxT( "|" ) + LegacyProjectFileWildcard();
wxFileDialog dlg( m_frame, _( "Open Existing Project" ), aDefaultDir, wxEmptyString, wildcard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
@ -412,7 +412,7 @@ public:
|| ext == LegacySymbolDocumentFileExtension
|| ext == KiCadSymbolLibFileExtension
|| ext == NetlistFileExtension
|| destFile.GetName() == "sym-lib-table" )
|| destFile.GetName() == wxT( "sym-lib-table" ) )
{
KIFACE* eeschema = m_frame->Kiway().KiFACE( KIWAY::FACE_SCH );
eeschema->SaveFileAs( m_projectDirPath, m_projectName, m_newProjectDirPath,
@ -424,7 +424,7 @@ public:
|| ext == KiCadFootprintFileExtension
|| ext == LegacyFootprintLibPathExtension
|| ext == FootprintAssignmentFileExtension
|| destFile.GetName() == "fp-lib-table" )
|| destFile.GetName() == wxT( "fp-lib-table" ) )
{
KIFACE* pcbnew = m_frame->Kiway().KiFACE( KIWAY::FACE_PCB );
pcbnew->SaveFileAs( m_projectDirPath, m_projectName, m_newProjectDirPath,
@ -452,8 +452,8 @@ public:
wxString destName = destFile.GetName();
wxUniChar pathSep = wxFileName::GetPathSeparator();
wxString srcProjectFootprintLib = pathSep + m_projectName + ".pretty" + pathSep;
wxString newProjectFootprintLib = pathSep + m_newProjectName + ".pretty" + pathSep;
wxString srcProjectFootprintLib = pathSep + m_projectName + wxT( ".pretty" ) + pathSep;
wxString newProjectFootprintLib = pathSep + m_newProjectName + wxT( ".pretty" ) + pathSep;
if( destPath.StartsWith( m_projectDirPath ) )
{
@ -492,12 +492,12 @@ public:
if( destDir.GetName() == m_projectName )
{
if( destDir.GetExt() == "pretty" )
if( destDir.GetExt() == wxT( "pretty" ) )
destDir.SetName( m_newProjectName );
#if 0
// WAYNE STAMBAUGH TODO:
// If we end up with a symbol equivalent to ".pretty" we'll want to handle it here....
else if( destDir.GetExt() == "sym_lib_dir_extension" )
else if( destDir.GetExt() == wxT( "sym_lib_dir_extension" ) )
destDir.SetName( m_newProjectName );
#endif
}
@ -507,7 +507,7 @@ public:
wxString msg;
if( !m_errors.empty() )
m_errors += "\n";
m_errors += wxT( "\n" );
msg.Printf( _( "Cannot copy folder '%s'." ), destDir.GetFullPath() );
m_errors += msg;
@ -782,7 +782,7 @@ int KICAD_MANAGER_CONTROL::Execute( const TOOL_EVENT& aEvent )
else if( aEvent.IsAction( &KICAD_MANAGER_ACTIONS::editOtherPCB ) )
execFile = PCBNEW_EXE;
else
wxFAIL_MSG( "Execute(): unexpected request" );
wxFAIL_MSG( wxT( "Execute(): unexpected request" ) );
if( execFile.IsEmpty() )
return 0;