From 4e3109a6332ac01b68264c8d258e23841910ec96 Mon Sep 17 00:00:00 2001 From: Jeff Young <jeff@rokeby.ie> 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 | 4 +- 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 | 59 +++--- 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 +- 19 files changed, 188 insertions(+), 186 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 7999f2e211..f7753e58ca 100644 --- a/gerbview/dialogs/dialog_layers_select_to_pcb.cpp +++ b/gerbview/dialogs/dialog_layers_select_to_pcb.cpp @@ -361,7 +361,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 ); @@ -424,8 +424,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; } @@ -462,47 +462,47 @@ int LAYERS_MAP_DIALOG::findNumAltiumGerbersLoaded( std::vector<int>& aGerber2Kic // This map contains the known Altium file extensions for Gerbers that we care about, // along with their corresponding KiCad layer std::map<wxString, PCB_LAYER_ID> 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 @@ -692,51 +692,51 @@ int LAYERS_MAP_DIALOG::findNumX2GerbersLoaded( std::vector<int>& aGerber2KicadMa // care about, along with their corresponding KiCad layer std::map<wxString, PCB_LAYER_ID> 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 b1bd969345..fd7976bc77 100644 --- a/gerbview/excellon_read_drill_file.cpp +++ b/gerbview/excellon_read_drill_file.cpp @@ -458,7 +458,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; @@ -529,7 +529,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 @@ -663,7 +663,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 @@ -673,7 +673,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: @@ -1124,7 +1124,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 a75a4c619a..aa692b4ed6 100644 --- a/gerbview/files.cpp +++ b/gerbview/files.cpp @@ -273,8 +273,8 @@ bool GERBVIEW_FRAME::LoadListOfGerberAndDrillFiles( const wxString& aPath, if( !filename.FileExists() ) { wxString warning; - warning << "<b>" << _( "File not found:" ) << "</b><br>" - << filename.GetFullPath() << "<br>"; + warning << wxT( "<b>" ) << _( "File not found:" ) << wxT( "</b><br>" ) + << filename.GetFullPath() << wxT( "<br>" ); reporter.Report( warning, RPT_SEVERITY_WARNING ); success = false; continue; diff --git a/gerbview/gerber_draw_item.cpp b/gerbview/gerber_draw_item.cpp index 1726dad003..e8aef49a47 100644 --- a/gerbview/gerber_draw_item.cpp +++ b/gerbview/gerber_draw_item.cpp @@ -729,10 +729,10 @@ void GERBER_DRAW_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_ if( ( m_netAttributes.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_NET ) ) { net_msg = _( "Net:" ); - net_msg << " "; + net_msg << wxS( " " ); if( m_netAttributes.m_Netname.IsEmpty() ) - net_msg << "<no net>"; + net_msg << wxT( "<no net>" ); else net_msg << UnescapeString( m_netAttributes.m_Netname ); } @@ -757,7 +757,7 @@ void GERBER_DRAW_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_ else if( ( m_netAttributes.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_CMP ) ) { cmp_pad_msg = _( "Cmp:" ); - cmp_pad_msg << " " << m_netAttributes.m_Cmpref; + cmp_pad_msg << wxS( " " ) << m_netAttributes.m_Cmpref; } aList.emplace_back( net_msg, cmp_pad_msg ); diff --git a/gerbview/gerber_file_image.cpp b/gerbview/gerber_file_image.cpp index 0bb60c4d76..508a4929bf 100644 --- a/gerbview/gerber_file_image.cpp +++ b/gerbview/gerber_file_image.cpp @@ -375,7 +375,7 @@ void GERBER_FILE_IMAGE::DisplayImageInfo( GERBVIEW_FRAME* aMainFrame ) break; default: - wxASSERT_MSG( false, "Invalid unit" ); + wxASSERT_MSG( false, wxT( "Invalid unit" ) ); } @@ -395,7 +395,7 @@ void GERBER_FILE_IMAGE::RemoveAttribute( X2_ATTRIBUTE& aAttribute ) wxString cmd = aAttribute.GetPrm( 0 ); m_NetAttributeDict.ClearAttribute( &cmd ); - if( cmd.IsEmpty() || cmd == ".AperFunction" ) + if( cmd.IsEmpty() || cmd == wxT( ".AperFunction" ) ) m_AperFunction.Clear(); } diff --git a/gerbview/gerber_file_image_list.cpp b/gerbview/gerber_file_image_list.cpp index 2734133fc9..90ba05dd94 100644 --- a/gerbview/gerber_file_image_list.cpp +++ b/gerbview/gerber_file_image_list.cpp @@ -146,7 +146,7 @@ const wxString GERBER_FILE_IMAGE_LIST::GetDisplayName( int aIdx, bool aNameOnly, if( !aFullName && filename.Length() > 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 1369e6542a..ac0a76738a 100644 --- a/gerbview/gerbview.cpp +++ b/gerbview/gerbview.cpp @@ -169,7 +169,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(); @@ -181,10 +181,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 ); @@ -195,7 +195,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; @@ -212,14 +212,14 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProje { wxString path = wxString( entry["Path"].get<std::string>() ); - 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 ) ); @@ -236,19 +236,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 ); @@ -257,7 +257,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 733d4516f4..7833be546e 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -258,9 +258,9 @@ bool GERBVIEW_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in { wxString ext = wxFileName( aFileSet[i] ).GetExt().Lower(); - if( ext == "zip" ) + if( ext == wxT( "zip" ) ) LoadZipArchiveFile( aFileSet[i] ); - else if( ext == "gbrprj" ) + else if( ext == wxT( "gbrprj" ) ) LoadGerberJobFile( aFileSet[i] ); else { @@ -303,28 +303,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() ) @@ -442,7 +442,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 ) ); } @@ -649,7 +649,8 @@ bool GERBVIEW_FRAME::IsElementVisible( int aLayerID ) const case LAYER_GERBVIEW_BACKGROUND: return true; default: - wxFAIL_MSG( wxString::Format( "GERBVIEW_FRAME::IsElementVisible bad arg %d", aLayerID ) ); + wxFAIL_MSG( wxString::Format( wxT( "GERBVIEW_FRAME::IsElementVisible(): bad arg %d" ), + aLayerID ) ); } return true; @@ -711,7 +712,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 ) ); } @@ -757,7 +758,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 ) ); } } @@ -879,7 +880,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 211c700e98..9492f8bf9d 100644 --- a/gerbview/gerbview_painter.cpp +++ b/gerbview/gerbview_painter.cpp @@ -213,7 +213,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 ); @@ -399,7 +399,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 ); @@ -447,7 +447,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 9575bf79cf..03629ee6f9 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 b0dd608053..a43fa405ff 100644 --- a/gerbview/menubar.cpp +++ b/gerbview/menubar.cpp @@ -210,7 +210,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 7d452d511c..122b687524 100644 --- a/gerbview/readgerb.cpp +++ b/gerbview/readgerb.cpp @@ -321,14 +321,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", *text ); + msg.Printf( wxT( "Unexpected char 0x%2.2X" ), *text ); AddMessageToList( msg ); text++; break; diff --git a/gerbview/rs274x.cpp b/gerbview/rs274x.cpp index 808416f45e..fd50991b0e 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 0431bf4b18..6b8490641d 100644 --- a/gerbview/toolbars_gerber.cpp +++ b/gerbview/toolbars_gerber.cpp @@ -317,21 +317,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++ ) @@ -344,14 +344,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 a657a4ea8f..aa16b6a0f7 100644 --- a/gerbview/tools/gerbview_actions.cpp +++ b/gerbview/tools/gerbview_actions.cpp @@ -111,38 +111,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 21bbb4ead3..f36d743bcd 100644 --- a/gerbview/widgets/layer_widget.cpp +++ b/gerbview/widgets/layer_widget.cpp @@ -337,8 +337,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) @@ -487,7 +487,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 );