From 3af606a0201608aea872f003ad0118eaac194216 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 5 Feb 2022 19:31:22 +0000 Subject: [PATCH] Wide string decls for gerbview. --- gerbview/am_param.cpp | 6 +- .../dialogs/dialog_layers_select_to_pcb.cpp | 178 +++++++++--------- gerbview/excellon_read_drill_file.cpp | 10 +- gerbview/files.cpp | 8 +- gerbview/gerber_draw_item.cpp | 6 +- gerbview/gerber_file_image.cpp | 4 +- gerbview/gerber_file_image_list.cpp | 10 +- gerbview/gerbview.cpp | 22 +-- gerbview/gerbview_frame.cpp | 56 +++--- gerbview/gerbview_painter.cpp | 6 +- gerbview/gerbview_settings.cpp | 8 +- gerbview/job_file_reader.cpp | 2 +- gerbview/menubar.cpp | 2 +- gerbview/readgerb.cpp | 4 +- gerbview/rs274x.cpp | 13 +- gerbview/toolbars_gerber.cpp | 12 +- gerbview/tools/gerbview_actions.cpp | 14 +- gerbview/tools/gerbview_inspection_tool.cpp | 8 +- gerbview/widgets/layer_widget.cpp | 6 +- .../cadstar/cadstar_pcb_archive_loader.cpp | 5 +- 20 files changed, 191 insertions(+), 189 deletions(-) diff --git a/gerbview/am_param.cpp b/gerbview/am_param.cpp index 7e83b20512..a92235eb5c 100644 --- a/gerbview/am_param.cpp +++ b/gerbview/am_param.cpp @@ -119,7 +119,7 @@ double AM_PARAM::GetValue( const D_CODE* aDcode ) const } else { - wxFAIL_MSG( "AM_PARAM::GetValue(): NULL param aDcode" ); + wxFAIL_MSG( wxT( "AM_PARAM::GetValue(): NULL param aDcode" ) ); } ops.push_back( AM_PARAM_EVAL( curr_value ) ); @@ -131,8 +131,8 @@ double AM_PARAM::GetValue( const D_CODE* aDcode ) const break; default: - wxFAIL_MSG( wxString::Format( "AM_PARAM::GetValue(): dcode %d prm %d/%d: " - "unexpected type %d", + wxFAIL_MSG( wxString::Format( wxT( "AM_PARAM::GetValue(): dcode %d prm %d/%d: " + "unexpected type %d" ), aDcode ? aDcode->m_Num_Dcode : -1, ii, m_paramStack.size(), item.GetType() ) ); break; diff --git a/gerbview/dialogs/dialog_layers_select_to_pcb.cpp b/gerbview/dialogs/dialog_layers_select_to_pcb.cpp index a4513e895a..7642a16183 100644 --- a/gerbview/dialogs/dialog_layers_select_to_pcb.cpp +++ b/gerbview/dialogs/dialog_layers_select_to_pcb.cpp @@ -369,7 +369,7 @@ void LAYERS_MAP_DIALOG::OnSelectLayer( wxCommandEvent& event ) wxFileName fn( m_Parent->GetGerberLayout()->GetImagesList()->GetGbrImage( ii )->m_FileName ); // Surround it with quotes to make it stand out on the dialog title bar - wxString layerName = "\"" + fn.GetFullName() + "\""; + wxString layerName = wxT( "\"" ) + fn.GetFullName() + wxT( "\"" ); // Display dialog to let user select a layer for the Gerber jj = m_Parent->SelectPCBLayer( jj, m_exportBoardCopperLayersCount, layerName ); @@ -432,8 +432,8 @@ bool LAYERS_MAP_DIALOG::TransferDataFromWindow() // internal copper layers = m_exportBoardCopperLayersCount-2 if( inner_layer_max > m_exportBoardCopperLayersCount-2 ) { - wxMessageBox( _("Exported board does not have enough copper layers to handle selected " - "inner layers") ); + wxMessageBox( _( "Exported board does not have enough copper layers to handle selected " + "inner layers" ) ); return false; } @@ -470,47 +470,47 @@ int LAYERS_MAP_DIALOG::findNumAltiumGerbersLoaded( std::vector& aGerber2Kic // This map contains the known Altium file extensions for Gerbers that we care about, // along with their corresponding KiCad layer std::map altiumExt{ - { "GTL", F_Cu }, // Top copper - { "G1", In1_Cu }, // Inner layers 1 - 30 - { "G2", In2_Cu }, - { "G3", In3_Cu }, - { "G4", In4_Cu }, - { "G5", In5_Cu }, - { "G6", In6_Cu }, - { "G7", In7_Cu }, - { "G8", In8_Cu }, - { "G9", In9_Cu }, - { "G10", In10_Cu }, - { "G11", In11_Cu }, - { "G12", In12_Cu }, - { "G13", In13_Cu }, - { "G14", In14_Cu }, - { "G15", In15_Cu }, - { "G16", In16_Cu }, - { "G17", In17_Cu }, - { "G18", In18_Cu }, - { "G19", In19_Cu }, - { "G20", In20_Cu }, - { "G21", In21_Cu }, - { "G22", In22_Cu }, - { "G23", In23_Cu }, - { "G24", In24_Cu }, - { "G25", In25_Cu }, - { "G26", In26_Cu }, - { "G27", In27_Cu }, - { "G28", In28_Cu }, - { "G29", In29_Cu }, - { "G30", In30_Cu }, - { "GBL", B_Cu }, // Bottom copper - { "GTP", F_Paste }, // Paste top - { "GBP", B_Paste }, // Paste bottom - { "GTO", F_SilkS }, // Silkscreen top - { "GBO", B_SilkS }, // Silkscreen bottom - { "GTS", F_Mask }, // Soldermask top - { "GBS", B_Mask }, // Soldermask bottom - { "GM1", Eco1_User }, // Altium mechanical layer 1 - { "GM2", Eco2_User }, // Altium mechanical layer 2 - { "GKO", Edge_Cuts } // PCB Outline + { wxT( "GTL" ), F_Cu }, // Top copper + { wxT( "G1" ), In1_Cu }, // Inner layers 1 - 30 + { wxT( "G2" ), In2_Cu }, + { wxT( "G3" ), In3_Cu }, + { wxT( "G4" ), In4_Cu }, + { wxT( "G5" ), In5_Cu }, + { wxT( "G6" ), In6_Cu }, + { wxT( "G7" ), In7_Cu }, + { wxT( "G8" ), In8_Cu }, + { wxT( "G9" ), In9_Cu }, + { wxT( "G10" ), In10_Cu }, + { wxT( "G11" ), In11_Cu }, + { wxT( "G12" ), In12_Cu }, + { wxT( "G13" ), In13_Cu }, + { wxT( "G14" ), In14_Cu }, + { wxT( "G15" ), In15_Cu }, + { wxT( "G16" ), In16_Cu }, + { wxT( "G17" ), In17_Cu }, + { wxT( "G18" ), In18_Cu }, + { wxT( "G19" ), In19_Cu }, + { wxT( "G20" ), In20_Cu }, + { wxT( "G21" ), In21_Cu }, + { wxT( "G22" ), In22_Cu }, + { wxT( "G23" ), In23_Cu }, + { wxT( "G24" ), In24_Cu }, + { wxT( "G25" ), In25_Cu }, + { wxT( "G26" ), In26_Cu }, + { wxT( "G27" ), In27_Cu }, + { wxT( "G28" ), In28_Cu }, + { wxT( "G29" ), In29_Cu }, + { wxT( "G30" ), In30_Cu }, + { wxT( "GBL" ), B_Cu }, // Bottom copper + { wxT( "GTP" ), F_Paste }, // Paste top + { wxT( "GBP" ), B_Paste }, // Paste bottom + { wxT( "GTO" ), F_SilkS }, // Silkscreen top + { wxT( "GBO" ), B_SilkS }, // Silkscreen bottom + { wxT( "GTS" ), F_Mask }, // Soldermask top + { wxT( "GBS" ), B_Mask }, // Soldermask bottom + { wxT( "GM1" ), Eco1_User }, // Altium mechanical layer 1 + { wxT( "GM2" ), Eco2_User }, // Altium mechanical layer 2 + { wxT( "GKO" ), Edge_Cuts } // PCB Outline }; // clang-format on @@ -700,51 +700,51 @@ int LAYERS_MAP_DIALOG::findNumX2GerbersLoaded( std::vector& aGerber2KicadMa // care about, along with their corresponding KiCad layer std::map kicadLayers { - { "Top", F_Cu }, - { "L2", In1_Cu }, - { "L3", In2_Cu }, - { "L4", In3_Cu }, - { "L5", In4_Cu }, - { "L6", In5_Cu }, - { "L7", In6_Cu }, - { "L8", In7_Cu }, - { "L9", In8_Cu }, - { "L10", In9_Cu }, - { "L11", In10_Cu }, - { "L12", In11_Cu }, - { "L13", In12_Cu }, - { "L14", In13_Cu }, - { "L15", In14_Cu }, - { "L16", In15_Cu }, - { "L17", In16_Cu }, - { "L18", In17_Cu }, - { "L19", In18_Cu }, - { "L20", In19_Cu }, - { "L21", In20_Cu }, - { "L22", In21_Cu }, - { "L23", In22_Cu }, - { "L24", In23_Cu }, - { "L25", In24_Cu }, - { "L26", In25_Cu }, - { "L27", In26_Cu }, - { "L28", In27_Cu }, - { "L29", In28_Cu }, - { "L30", In29_Cu }, - { "Bot", B_Cu }, - { "BotGlue", B_Adhes }, - { "TopGlue", F_Adhes }, - { "BotPaste", B_Paste }, - { "TopPaste", F_Paste }, - { "BotLegend", B_SilkS }, - { "TopLegend", F_SilkS }, - { "BotSoldermask", B_Mask }, - { "TopSoldermask", F_Mask }, - { "FabricationDrawing", Dwgs_User }, - { "OtherDrawing", Cmts_User }, - { "TopAssemblyDrawing", Eco1_User }, - { "BotAssemblyDrawing", Eco2_User }, - { "PProfile", Edge_Cuts }, // Plated PCB outline - { "NPProfile", Edge_Cuts } // Non-plated PCB outline + { wxT( "Top" ), F_Cu }, + { wxT( "L2" ), In1_Cu }, + { wxT( "L3" ), In2_Cu }, + { wxT( "L4" ), In3_Cu }, + { wxT( "L5" ), In4_Cu }, + { wxT( "L6" ), In5_Cu }, + { wxT( "L7" ), In6_Cu }, + { wxT( "L8" ), In7_Cu }, + { wxT( "L9" ), In8_Cu }, + { wxT( "L10" ), In9_Cu }, + { wxT( "L11" ), In10_Cu }, + { wxT( "L12" ), In11_Cu }, + { wxT( "L13" ), In12_Cu }, + { wxT( "L14" ), In13_Cu }, + { wxT( "L15" ), In14_Cu }, + { wxT( "L16" ), In15_Cu }, + { wxT( "L17" ), In16_Cu }, + { wxT( "L18" ), In17_Cu }, + { wxT( "L19" ), In18_Cu }, + { wxT( "L20" ), In19_Cu }, + { wxT( "L21" ), In20_Cu }, + { wxT( "L22" ), In21_Cu }, + { wxT( "L23" ), In22_Cu }, + { wxT( "L24" ), In23_Cu }, + { wxT( "L25" ), In24_Cu }, + { wxT( "L26" ), In25_Cu }, + { wxT( "L27" ), In26_Cu }, + { wxT( "L28" ), In27_Cu }, + { wxT( "L29" ), In28_Cu }, + { wxT( "L30" ), In29_Cu }, + { wxT( "Bot" ), B_Cu }, + { wxT( "BotGlue" ), B_Adhes }, + { wxT( "TopGlue" ), F_Adhes }, + { wxT( "BotPaste" ), B_Paste }, + { wxT( "TopPaste" ), F_Paste }, + { wxT( "BotLegend" ), B_SilkS }, + { wxT( "TopLegend" ), F_SilkS }, + { wxT( "BotSoldermask" ), B_Mask }, + { wxT( "TopSoldermask" ), F_Mask }, + { wxT( "FabricationDrawing" ), Dwgs_User }, + { wxT( "OtherDrawing" ), Cmts_User }, + { wxT( "TopAssemblyDrawing" ), Eco1_User }, + { wxT( "BotAssemblyDrawing" ), Eco2_User }, + { wxT( "PProfile" ), Edge_Cuts }, // Plated PCB outline + { wxT( "NPProfile" ), Edge_Cuts } // Non-plated PCB outline }; // clang-format on diff --git a/gerbview/excellon_read_drill_file.cpp b/gerbview/excellon_read_drill_file.cpp index 5d7c190d55..8ab18523ba 100644 --- a/gerbview/excellon_read_drill_file.cpp +++ b/gerbview/excellon_read_drill_file.cpp @@ -327,7 +327,7 @@ bool EXCELLON_IMAGE::LoadFile( const wxString & aFullFileName, EXCELLON_DEFAULTS ResetDefaultValues(); ClearMessageList(); - m_Current_File = wxFopen( aFullFileName, "rt" ); + m_Current_File = wxFopen( aFullFileName, wxT( "rt" ) ); if( m_Current_File == nullptr ) return false; @@ -398,7 +398,7 @@ bool EXCELLON_IMAGE::LoadFile( const wxString & aFullFileName, EXCELLON_DEFAULTS break; default: - msg.Printf( "Unexpected symbol 0x%2.2X <%c>", *text, *text ); + msg.Printf( wxT( "Unexpected symbol 0x%2.2X <%c>" ), *text, *text ); AddMessageToList( msg ); break; } // End switch @@ -532,7 +532,7 @@ bool EXCELLON_IMAGE::Execute_HEADER_And_M_Command( char*& text ) case DRILL_INCREMENTALHEADER: if( *text != ',' ) { - AddMessageToList( "ICI command has no parameter" ); + AddMessageToList( wxT( "ICI command has no parameter" ) ); break; } text++; // skip separator @@ -542,7 +542,7 @@ bool EXCELLON_IMAGE::Execute_HEADER_And_M_Command( char*& text ) else if( strncasecmp( text, "ON", 2 ) == 0 ) m_Relative = true; else - AddMessageToList( "ICI command has incorrect parameter" ); + AddMessageToList( wxT( "ICI command has incorrect parameter" ) ); break; case DRILL_TOOL_CHANGE_STOP: @@ -993,7 +993,7 @@ void EXCELLON_IMAGE::FinishRouteCommand() if( !tool ) { - AddMessageToList( wxString::Format( "Unknown tool code %d", m_Current_Tool ) ); + AddMessageToList( wxString::Format( wxT( "Unknown tool code %d" ), m_Current_Tool ) ); return; } diff --git a/gerbview/files.cpp b/gerbview/files.cpp index 5652dcfd6a..77f71963a9 100644 --- a/gerbview/files.cpp +++ b/gerbview/files.cpp @@ -238,8 +238,8 @@ bool GERBVIEW_FRAME::LoadListOfGerberAndDrillFiles( const wxString& aPath, if( !filename.FileExists() ) { wxString warning; - warning << "" << _( "File not found:" ) << "
" - << filename.GetFullPath() << "
"; + warning << wxT( "" ) << _( "File not found:" ) << wxT( "
" ) + << filename.GetFullPath() << wxT( "
" ); reporter.Report( warning, RPT_SEVERITY_WARNING ); success = false; continue; @@ -518,7 +518,7 @@ bool GERBVIEW_FRAME::unarchiveFiles( const wxString& aFullFileName, REPORTER* aR // drill files do not have a well defined ext // It is .drl in kicad, but .txt in Altium for instance // Allows only .drl for drill files. - if( curr_ext[0] != 'g' && curr_ext != "pho" && curr_ext != "drl" ) + if( curr_ext[0] != 'g' && curr_ext != wxT( "pho" ) && curr_ext != wxT( "drl" ) ) { if( aReporter ) { @@ -584,7 +584,7 @@ bool GERBVIEW_FRAME::unarchiveFiles( const wxString& aFullFileName, REPORTER* aR bool read_ok = true; - if( curr_ext[0] == 'g' || curr_ext == "pho" ) + if( curr_ext[0] == 'g' || curr_ext == wxT( "pho" ) ) { // Read gerber files: each file is loaded on a new GerbView layer read_ok = Read_GERBER_File( unzipped_tempfile ); diff --git a/gerbview/gerber_draw_item.cpp b/gerbview/gerber_draw_item.cpp index c7795a496b..fbbad47e7e 100644 --- a/gerbview/gerber_draw_item.cpp +++ b/gerbview/gerber_draw_item.cpp @@ -749,10 +749,10 @@ void GERBER_DRAW_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector"; + net_msg << wxT( "" ); else net_msg << UnescapeString( m_netAttributes.m_Netname ); } @@ -773,7 +773,7 @@ void GERBER_DRAW_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector maxlen ) { - wxString shortenedfn = filename.Left(2) + "..." + filename.Right(maxlen-5); + wxString shortenedfn = filename.Left(2) + wxT( "..." ) + filename.Right(maxlen-5); filename = shortenedfn; } @@ -154,7 +154,7 @@ const wxString GERBER_FILE_IMAGE_LIST::GetDisplayName( int aIdx, bool aNameOnly, { if( gerber->m_FileFunction->IsCopper() ) { - name.Printf( "%s (%s, %s, %s)", + name.Printf( wxT( "%s (%s, %s, %s)" ), filename.GetData(), gerber->m_FileFunction->GetFileType(), gerber->m_FileFunction->GetBrdLayerId(), @@ -162,7 +162,7 @@ const wxString GERBER_FILE_IMAGE_LIST::GetDisplayName( int aIdx, bool aNameOnly, } if( gerber->m_FileFunction->IsDrillFile() ) { - name.Printf( "%s (%s,%s,%s,%s)", + name.Printf( wxT( "%s (%s,%s,%s,%s)" ), filename.GetData(), gerber->m_FileFunction->GetFileType(), gerber->m_FileFunction->GetDrillLayerPair(), @@ -171,7 +171,7 @@ const wxString GERBER_FILE_IMAGE_LIST::GetDisplayName( int aIdx, bool aNameOnly, } else { - name.Printf( "%s (%s, %s)", + name.Printf( wxT( "%s (%s, %s)" ), filename.GetData(), gerber->m_FileFunction->GetFileType(), gerber->m_FileFunction->GetBrdLayerId() ); @@ -187,7 +187,7 @@ const wxString GERBER_FILE_IMAGE_LIST::GetDisplayName( int aIdx, bool aNameOnly, wxString fullname; - fullname.Printf( "%d ", aIdx + 1 ); + fullname.Printf( wxT( "%d " ), aIdx + 1 ); fullname << name; return fullname; } diff --git a/gerbview/gerbview.cpp b/gerbview/gerbview.cpp index dc8c08afa0..e5154e84ff 100644 --- a/gerbview/gerbview.cpp +++ b/gerbview/gerbview.cpp @@ -165,7 +165,7 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProje destFile.SetPath( destPath ); } - if( ext == "gbr" || IsProtelExtension( ext ) ) + if( ext == wxT( "gbr" ) || IsProtelExtension( ext ) ) { wxString destFileName = destFile.GetName(); @@ -177,10 +177,10 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProje KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors ); } - else if( ext == "gbrjob" ) + else if( ext == wxT( "gbrjob" ) ) { - if( destFile.GetName() == aProjectName + "-job" ) - destFile.SetName( aNewProjectName + "-job" ); + if( destFile.GetName() == aProjectName + wxT( "-job" ) ) + destFile.SetName( aNewProjectName + wxT( "-job" ) ); FILE_LINE_READER jobfileReader( aSrcFilePath ); @@ -191,7 +191,7 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProje data << line << '\n'; // detect the file format: old (deprecated) gerber format or official JSON format - if( !data.Contains( "{" ) ) + if( !data.Contains( wxT( "{" ) ) ) { KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors ); return; @@ -208,14 +208,14 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProje { wxString path = wxString( entry["Path"].get() ); - if( path.StartsWith( aProjectName + "-" ) ) + if( path.StartsWith( aProjectName + wxT( "-" ) ) ) { path.Replace( aProjectName, aNewProjectName, false ); entry["Path"] = path.ToStdString(); } } - wxFFile destJobFile( destFile.GetFullPath(), "wb" ); + wxFFile destJobFile( destFile.GetFullPath(), wxT( "wb" ) ); if( destJobFile.IsOpened() ) success = destJobFile.Write( js.dump( 0 ) ); @@ -232,19 +232,19 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProje wxString msg; if( !aErrors.empty() ) - aErrors += "\n"; + aErrors += wxT( "\n" ); msg.Printf( _( "Cannot copy file '%s'." ), destFile.GetFullPath() ); aErrors += msg; } } - else if( ext == "drl" ) + else if( ext == wxT( "drl" ) ) { wxString destFileName = destFile.GetName(); if( destFileName == aProjectName ) destFileName = aNewProjectName; - else if( destFileName.StartsWith( aProjectName + "-" ) ) + else if( destFileName.StartsWith( aProjectName + wxT( "-" ) ) ) destFileName.Replace( aProjectName, aNewProjectName, false ); destFile.SetName( destFileName ); @@ -253,7 +253,7 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProje } else { - wxFAIL_MSG( "Unexpected filetype for GerbView::SaveFileAs()" ); + wxFAIL_MSG( wxT( "Unexpected filetype for GerbView::SaveFileAs()" ) ); } } diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 5eb27bd2df..960b45a347 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -277,7 +277,7 @@ bool GERBVIEW_FRAME::OpenProjectFiles( const std::vector& aFileSet, in wxString ext = fn.GetExt(); if( ext == DrillFileExtension || // our Excellon format - ext == "nc" || ext == "xnc" ) // alternate ext for Excellon format + ext == wxT( "nc" ) || ext == wxT( "xnc" ) ) // alternate ext for Excellon format LoadExcellonFiles( aFileSet[i] ); else if( ext == GerberJobFileExtension ) LoadGerberJobFile( aFileSet[i] ); @@ -298,28 +298,28 @@ void GERBVIEW_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg ) if( aCfg->m_Window.grid.sizes.empty() ) { - aCfg->m_Window.grid.sizes = { "100 mil", - "50 mil", - "25 mil", - "20 mil", - "10 mil", - "5 mil", - "2.5 mil", - "2 mil", - "1 mil", - "0.5 mil", - "0.2 mil", - "0.1 mil", - "5.0 mm", - "2.5 mm", - "1.0 mm", - "0.5 mm", - "0.25 mm", - "0.2 mm", - "0.1 mm", - "0.05 mm", - "0.025 mm", - "0.01 mm" }; + aCfg->m_Window.grid.sizes = { wxT( "100 mil" ), + wxT( "50 mil" ), + wxT( "25 mil" ), + wxT( "20 mil" ), + wxT( "10 mil" ), + wxT( "5 mil" ), + wxT( "2.5 mil" ), + wxT( "2 mil" ), + wxT( "1 mil" ), + wxT( "0.5 mil" ), + wxT( "0.2 mil" ), + wxT( "0.1 mil" ), + wxT( "5.0 mm" ), + wxT( "2.5 mm" ), + wxT( "1.0 mm" ), + wxT( "0.5 mm" ), + wxT( "0.25 mm" ), + wxT( "0.2 mm" ), + wxT( "0.1 mm" ), + wxT( "0.05 mm" ), + wxT( "0.025 mm" ), + wxT( "0.01 mm" ) }; } if( aCfg->m_Window.zoom_factors.empty() ) @@ -433,7 +433,7 @@ void GERBVIEW_FRAME::SetElementVisibility( int aLayerID, bool aNewState ) break; default: - wxFAIL_MSG( wxString::Format( "GERBVIEW_FRAME::SetElementVisibility(): bad arg %d", + wxFAIL_MSG( wxString::Format( wxT( "GERBVIEW_FRAME::SetElementVisibility(): bad arg %d" ), aLayerID ) ); } @@ -714,7 +714,7 @@ bool GERBVIEW_FRAME::IsElementVisible( int aLayerID ) const case LAYER_GERBVIEW_BACKGROUND: return true; default: - wxFAIL_MSG( wxString::Format( "GERBVIEW_FRAME::IsElementVisible(): bad arg %d", + wxFAIL_MSG( wxString::Format( wxT( "GERBVIEW_FRAME::IsElementVisible(): bad arg %d" ), aLayerID ) ); } @@ -777,7 +777,7 @@ COLOR4D GERBVIEW_FRAME::GetVisibleElementColor( int aLayerID ) break; default: - wxFAIL_MSG( wxString::Format( "GERBVIEW_FRAME::GetVisibleElementColor(): bad arg %d", + wxFAIL_MSG( wxString::Format( wxT( "GERBVIEW_FRAME::GetVisibleElementColor(): bad arg %d" ), aLayerID ) ); } @@ -823,7 +823,7 @@ void GERBVIEW_FRAME::SetVisibleElementColor( int aLayerID, const COLOR4D& aColor break; default: - wxFAIL_MSG( wxString::Format( "GERBVIEW_FRAME::SetVisibleElementColor(): bad arg %d", + wxFAIL_MSG( wxString::Format( wxT( "GERBVIEW_FRAME::SetVisibleElementColor(): bad arg %d" ), aLayerID ) ); } } @@ -945,7 +945,7 @@ void GERBVIEW_FRAME::DisplayGridMsg() VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize(); wxString line; - line.Printf( "grid X %s Y %s", + line.Printf( wxT( "grid X %s Y %s" ), MessageTextFromValue( m_userUnits, gridSize.x, false ), MessageTextFromValue( m_userUnits, gridSize.y, false ) ); diff --git a/gerbview/gerbview_painter.cpp b/gerbview/gerbview_painter.cpp index 33f509ea18..ae2d20f49f 100644 --- a/gerbview/gerbview_painter.cpp +++ b/gerbview/gerbview_painter.cpp @@ -230,7 +230,7 @@ void GERBVIEW_PAINTER::draw( /*const*/ GERBER_DRAW_ITEM* aItem, int aLayer ) return; color = m_gerbviewSettings.GetColor( aItem, aLayer ); - codeText.Printf( "D%d", aItem->m_DCode ); + codeText.Printf( wxT( "D%d" ), aItem->m_DCode ); m_gal->SetIsStroke( true ); m_gal->SetIsFill( false ); @@ -420,7 +420,7 @@ void GERBVIEW_PAINTER::draw( /*const*/ GERBER_DRAW_ITEM* aItem, int aLayer ) } default: - wxASSERT_MSG( false, "GERBER_DRAW_ITEM shape is unknown!" ); + wxASSERT_MSG( false, wxT( "GERBER_DRAW_ITEM shape is unknown!" ) ); break; } m_gal->SetNegativeDrawMode( false ); @@ -470,7 +470,7 @@ void GERBVIEW_PAINTER::drawFlashedShape( GERBER_DRAW_ITEM* aItem, bool aFilled ) { D_CODE* code = aItem->GetDcodeDescr(); - wxASSERT_MSG( code, "drawFlashedShape: Item has no D_CODE!" ); + wxASSERT_MSG( code, wxT( "drawFlashedShape: Item has no D_CODE!" ) ); if( !code ) return; diff --git a/gerbview/gerbview_settings.cpp b/gerbview/gerbview_settings.cpp index f7e798f2d7..66eadd9fbb 100644 --- a/gerbview/gerbview_settings.cpp +++ b/gerbview/gerbview_settings.cpp @@ -109,14 +109,14 @@ bool GERBVIEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg ) for( int i = 0; i < max_history_size; i++ ) { - key.Printf( "file%d", i ); + key.Printf( wxT( "file%d" ), i ); file = aCfg->Read( key, wxEmptyString ); if( !file.IsEmpty() ) js.emplace_back( file.ToStdString() ); } - aCfg->SetPath( ".." ); + aCfg->SetPath( wxT( ".." ) ); Set( aDest, js ); }; @@ -133,7 +133,7 @@ bool GERBVIEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg ) for( int i = 0; i < GERBER_DRAWLAYERS_COUNT; i++ ) { - key.Printf( "GbrLyr%dToPcb", i ); + key.Printf( wxT( "GbrLyr%dToPcb" ), i ); aCfg->Read( key, &value, UNSELECTED_LAYER ); At( "gerber_to_pcb_layers" ).emplace_back( value ); } @@ -159,7 +159,7 @@ bool GERBVIEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg ) for( int i = 0, id = GERBVIEW_LAYER_ID_START; id < GERBER_DRAWLAYERS_COUNT + GERBVIEW_LAYER_ID_START; ++i, ++id ) { - key.Printf( "ColorLayer%dEx", i ); + key.Printf( wxT( "ColorLayer%dEx" ), i ); migrateLegacyColor( key.ToStdString(), id ); } diff --git a/gerbview/job_file_reader.cpp b/gerbview/job_file_reader.cpp index 2c2baafb0d..9c77f97bdf 100644 --- a/gerbview/job_file_reader.cpp +++ b/gerbview/job_file_reader.cpp @@ -128,7 +128,7 @@ bool GERBER_JOBFILE_READER::ReadGerberJobFile() data = line; - if( data.Contains( "{" ) ) + if( data.Contains( wxT( "{" ) ) ) json_format = true; if( json_format ) diff --git a/gerbview/menubar.cpp b/gerbview/menubar.cpp index 2c1386cced..c1985ccfc0 100644 --- a/gerbview/menubar.cpp +++ b/gerbview/menubar.cpp @@ -209,7 +209,7 @@ void GERBVIEW_FRAME::ReCreateMenuBar() // We can't use ACTIONS::showPreferences yet because wxWidgets moves this on // Mac, and it needs the wxID_PREFERENCES id to find it. - preferencesMenu->Add( _( "Preferences..." ) + "\tCtrl+,", + preferencesMenu->Add( _( "Preferences..." ) + wxT( "\tCtrl+," ), _( "Show preferences for all open tools" ), wxID_PREFERENCES, BITMAPS::preference ); diff --git a/gerbview/readgerb.cpp b/gerbview/readgerb.cpp index 0763227e2c..bfef8e1caa 100644 --- a/gerbview/readgerb.cpp +++ b/gerbview/readgerb.cpp @@ -205,14 +205,14 @@ bool GERBER_FILE_IMAGE::LoadGerberFile( const wxString& aFullFileName ) } else //Error { - AddMessageToList( "Expected RS274X Command" ); + AddMessageToList( wxT( "Expected RS274X Command" ) ); m_CommandState = CMD_IDLE; text++; } break; default: - msg.Printf( "Unexpected char 0x%2.2X <%c<", *text, *text ); + msg.Printf( wxT( "Unexpected char 0x%2.2X <%c<" ), *text, *text ); AddMessageToList( msg ); text++; break; diff --git a/gerbview/rs274x.cpp b/gerbview/rs274x.cpp index dc47923c6e..27b5d15e49 100644 --- a/gerbview/rs274x.cpp +++ b/gerbview/rs274x.cpp @@ -413,13 +413,13 @@ bool GERBER_FILE_IMAGE::ExecuteRS274XCommand( int aCommand, char* aBuff, X2_ATTRIBUTE dummy; dummy.ParseAttribCmd( m_Current_File, aBuff, aBuffSize, aText, m_LineNum ); - if( dummy.GetAttribute() == ".AperFunction" ) + if( dummy.GetAttribute() == wxT( ".AperFunction" ) ) { m_AperFunction = dummy.GetPrm( 1 ); // A few function values can have other parameters. Add them for( int ii = 2; ii < dummy.GetPrmCount(); ii++ ) - m_AperFunction << "," << dummy.GetPrm( ii ); + m_AperFunction << wxT( "," ) << dummy.GetPrm( ii ); } } break; @@ -430,17 +430,17 @@ bool GERBER_FILE_IMAGE::ExecuteRS274XCommand( int aCommand, char* aBuff, dummy.ParseAttribCmd( m_Current_File, aBuff, aBuffSize, aText, m_LineNum ); - if( dummy.GetAttribute() == ".N" ) + if( dummy.GetAttribute() == wxT( ".N" ) ) { m_NetAttributeDict.m_NetAttribType |= GBR_NETLIST_METADATA::GBR_NETINFO_NET; m_NetAttributeDict.m_Netname = FormatStringFromGerber( dummy.GetPrm( 1 ) ); } - else if( dummy.GetAttribute() == ".C" ) + else if( dummy.GetAttribute() == wxT( ".C" ) ) { m_NetAttributeDict.m_NetAttribType |= GBR_NETLIST_METADATA::GBR_NETINFO_CMP; m_NetAttributeDict.m_Cmpref = FormatStringFromGerber( dummy.GetPrm( 1 ) ); } - else if( dummy.GetAttribute() == ".P" ) + else if( dummy.GetAttribute() == wxT( ".P" ) ) { m_NetAttributeDict.m_NetAttribType |= GBR_NETLIST_METADATA::GBR_NETINFO_PAD; m_NetAttributeDict.m_Cmpref = FormatStringFromGerber( dummy.GetPrm( 1 ) ); @@ -1107,7 +1107,8 @@ bool GERBER_FILE_IMAGE::ReadApertureMacro( char *aBuff, unsigned int aBuffSize, if( ii < paramCount ) { // maybe some day we can throw an exception and track a line number - msg.Printf( "RS274X: read macro descr type %d: read %d parameters, insufficient parameters\n", + msg.Printf( wxT( "RS274X: read macro descr type %d: read %d parameters, insufficient " + "parameters\n" ), prim.primitive_id, ii ); AddMessageToList( msg ); } diff --git a/gerbview/toolbars_gerber.cpp b/gerbview/toolbars_gerber.cpp index 3dc43f0b32..c0d13e36fc 100644 --- a/gerbview/toolbars_gerber.cpp +++ b/gerbview/toolbars_gerber.cpp @@ -312,21 +312,21 @@ void GERBVIEW_FRAME::updateDCodeSelectBox() { case EDA_UNITS::MILLIMETRES: scale = IU_PER_MM; - units = "mm"; + units = wxT( "mm" ); break; case EDA_UNITS::INCHES: scale = IU_PER_MILS * 1000; - units = "in"; + units = wxT( "in" ); break; case EDA_UNITS::MILS: scale = IU_PER_MILS; - units = "mil"; + units = wxT( "mil" ); break; default: - wxASSERT_MSG( false, "Invalid units" ); + wxASSERT_MSG( false, wxT( "Invalid units" ) ); } for( int ii = 0; ii < TOOLS_MAX_COUNT; ii++ ) @@ -339,14 +339,14 @@ void GERBVIEW_FRAME::updateDCodeSelectBox() if( !dcode->m_InUse && !dcode->m_Defined ) continue; - msg.Printf( "tool %d [%.3fx%.3f %s] %s", + msg.Printf( wxT( "tool %d [%.3fx%.3f %s] %s" ), dcode->m_Num_Dcode, dcode->m_Size.x / scale, dcode->m_Size.y / scale, units, D_CODE::ShowApertureType( dcode->m_Shape ) ); if( !dcode->m_AperFunction.IsEmpty() ) - msg << ", " << dcode->m_AperFunction; + msg << wxT( ", " ) << dcode->m_AperFunction; dcode_list.Add( msg ); } diff --git a/gerbview/tools/gerbview_actions.cpp b/gerbview/tools/gerbview_actions.cpp index 623e0d1d42..606e20e830 100644 --- a/gerbview/tools/gerbview_actions.cpp +++ b/gerbview/tools/gerbview_actions.cpp @@ -105,38 +105,38 @@ TOOL_ACTION GERBVIEW_ACTIONS::layerChanged( "gerbview.Control.layerChanged", TOOL_ACTION GERBVIEW_ACTIONS::highlightClear( "gerbview.Control.highlightClear", AS_GLOBAL, 0, "", - _( "Clear Highlight" ), "", + _( "Clear Highlight" ), _( "Clear Highlight" ), BITMAPS::cancel ); TOOL_ACTION GERBVIEW_ACTIONS::highlightNet( "gerbview.Control.highlightNet", AS_GLOBAL, 0, "", - _( "Highlight Net" ), "", + _( "Highlight Net" ), _( "Highlight Net" ), BITMAPS::general_ratsnest ); TOOL_ACTION GERBVIEW_ACTIONS::highlightComponent( "gerbview.Control.highlightComponent", AS_GLOBAL, 0, "", - _( "Highlight Component" ), "", + _( "Highlight Component" ), _( "Highlight Component" ), BITMAPS::module ); TOOL_ACTION GERBVIEW_ACTIONS::highlightAttribute( "gerbview.Control.highlightAttribute", AS_GLOBAL, 0, "", - _( "Highlight Attribute" ), "", + _( "Highlight Attribute" ), _( "Highlight Attribute" ), BITMAPS::flag ); TOOL_ACTION GERBVIEW_ACTIONS::highlightDCode( "gerbview.Control.highlightDCode", AS_GLOBAL, 0, "", - _( "Highlight DCode" ), "", + _( "Highlight DCode" ), _( "Highlight DCode" ), BITMAPS::show_dcodenumber ); TOOL_ACTION GERBVIEW_ACTIONS::layerNext( "gerbview.Control.layerNext", AS_GLOBAL, '+', LEGACY_HK_NAME( "Switch to Next Layer" ), - _( "Next Layer" ), "" ); + _( "Next Layer" ), _( "Next Layer" ) ); TOOL_ACTION GERBVIEW_ACTIONS::layerPrev( "gerbview.Control.layerPrev", AS_GLOBAL, '-', LEGACY_HK_NAME( "Switch to Previous Layer" ), - _( "Previous Layer" ), "" ); + _( "Previous Layer" ), _( "Previous Layer" ) ); TOOL_ACTION GERBVIEW_ACTIONS::linesDisplayOutlines( "gerbview.Control.linesDisplayOutlines", AS_GLOBAL, diff --git a/gerbview/tools/gerbview_inspection_tool.cpp b/gerbview/tools/gerbview_inspection_tool.cpp index c6eb577c01..f8d2520560 100644 --- a/gerbview/tools/gerbview_inspection_tool.cpp +++ b/gerbview/tools/gerbview_inspection_tool.cpp @@ -80,21 +80,21 @@ int GERBVIEW_INSPECTION_TOOL::ShowDCodes( const TOOL_EVENT& aEvent ) { case EDA_UNITS::MILLIMETRES: scale = IU_PER_MM; - units = "mm"; + units = wxT( "mm" ); break; case EDA_UNITS::INCHES: scale = IU_PER_MILS * 1000; - units = "in"; + units = wxT( "in" ); break; case EDA_UNITS::MILS: scale = IU_PER_MILS; - units = "mil"; + units = wxT( "mil" ); break; default: - wxASSERT_MSG( false, "Invalid units" ); + wxASSERT_MSG( false, wxT( "Invalid units" ) ); } for( unsigned int layer = 0; layer < m_frame->ImagesMaxCount(); ++layer ) diff --git a/gerbview/widgets/layer_widget.cpp b/gerbview/widgets/layer_widget.cpp index 1b515a093c..f069554e34 100644 --- a/gerbview/widgets/layer_widget.cpp +++ b/gerbview/widgets/layer_widget.cpp @@ -340,8 +340,8 @@ void LAYER_WIDGET::insertLayerRow( int aRow, const ROW& aSpec ) getBackgroundLayerColor(), aSpec.defaultColor, SWATCH_SMALL ); bmb->Bind( wxEVT_LEFT_DOWN, &LAYER_WIDGET::OnLeftDownLayers, this ); bmb->Bind( COLOR_SWATCH_CHANGED, &LAYER_WIDGET::OnLayerSwatchChanged, this ); - bmb->SetToolTip( _("Left double click or middle click for color change, right click for " - "menu" ) ); + bmb->SetToolTip( _( "Left double click or middle click for color change, right click for " + "menu" ) ); m_LayersFlexGridSizer->wxSizer::Insert( index+col, bmb, 0, flags ); // column 2 (COLUMN_COLOR_LYR_CB) @@ -490,7 +490,7 @@ void LAYER_WIDGET::passOnFocus() LAYER_WIDGET::LAYER_WIDGET( wxWindow* aParent, wxWindow* aFocusOwner, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( aParent, id, pos, size, style ), - m_smallestLayerString( "M...M" ) + m_smallestLayerString( wxT( "M...M" ) ) { int indicatorSize = ConvertDialogToPixels( wxSize( 6, 6 ) ).x; m_IconProvider = new ROW_ICON_PROVIDER( indicatorSize ); diff --git a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp index e82a4b69b5..ea99f7baca 100644 --- a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp +++ b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp @@ -1255,8 +1255,9 @@ PAD*& CADSTAR_PCB_ARCHIVE_LOADER::getPadReference( FOOTPRINT* aFootprint, if( !( index < aFootprint->Pads().size() ) ) { - THROW_IO_ERROR( _( "Unable to find pad index '%d' in footprint '%s'.", (long) aCadstarPadID, - aFootprint->GetReference() ) ); + THROW_IO_ERROR( wxString::Format( _( "Unable to find pad index '%d' in footprint '%s'." ), + (long) aCadstarPadID, + aFootprint->GetReference() ) ); } return aFootprint->Pads().at( index );