7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-07 21:05:15 +00:00

Unwrap the FROM_UTF8 macro in favor of direct function

The extern just gets annoying to try to export the func later. We also yeet TO_UTF8 to string_utils.h for parity.
This commit is contained in:
Marek Roszko 2023-09-09 00:10:57 -04:00
parent bd3aca2887
commit 11de95778b
90 changed files with 266 additions and 248 deletions
3d-viewer
common
cvpcb
eeschema
gerbview
include
kicad
libs/sexpr
pagelayout_editor/tools
pcb_calculator
pcbnew
qa/qa_utils
scripting
thirdparty/markdown2html
utils/idftools

View File

@ -227,10 +227,10 @@ bool EDA_3D_CANVAS::initializeOpenGL()
else
{
wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::initializeOpenGL Using GLEW version %s" ),
FROM_UTF8( (char*) glewGetString( GLEW_VERSION ) ) );
From_UTF8( (char*) glewGetString( GLEW_VERSION ) ) );
}
wxString version = FROM_UTF8( (char *) glGetString( GL_VERSION ) );
wxString version = From_UTF8( (char *) glGetString( GL_VERSION ) );
wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::%s OpenGL version string %s." ),
__WXFUNCTION__, version );

View File

@ -197,7 +197,7 @@ void EDA_3D_MODEL_VIEWER::ogl_initialize()
else
{
wxLogTrace( m_logTrace, wxT( "EDA_3D_MODEL_VIEWER::ogl_initialize Using GLEW version %s" ),
FROM_UTF8( (char*) glewGetString( GLEW_VERSION ) ) );
From_UTF8( (char*) glewGetString( GLEW_VERSION ) ) );
}
glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );

View File

@ -37,6 +37,7 @@
#include <wildcards_and_files_ext.h>
#include <drawing_sheet/ds_data_model.h>
#include <drawing_sheet/ds_painter.h>
#include <string_utils.h>
#include <widgets/std_bitmap_button.h>
#include <wx/valgen.h>
#include <wx/tokenzr.h>

View File

@ -30,7 +30,7 @@
#include <widgets/wx_grid.h>
#include <widgets/std_bitmap_button.h>
#include <bitmaps.h>
#include <macros.h>
#include <string_utils.h>
#define INITIAL_HELP \
@ -67,7 +67,7 @@ DIALOG_PLUGIN_OPTIONS::DIALOG_PLUGIN_OPTIONS( wxWindow* aParent,
for( STRING_UTF8_MAP::const_iterator it = m_choices.begin(); it != m_choices.end();
++it, ++row )
{
wxString item = FROM_UTF8( it->first.c_str() );
wxString item = From_UTF8( it->first.c_str() );
m_listbox->InsertItems( 1, &item, row );
}
@ -113,7 +113,7 @@ bool DIALOG_PLUGIN_OPTIONS::TransferDataToWindow()
for( STRING_UTF8_MAP::const_iterator it = props->begin(); it != props->end();
++it, ++row )
{
m_grid->SetCellValue( row, 0, FROM_UTF8( it->first.c_str() ) );
m_grid->SetCellValue( row, 0, From_UTF8( it->first.c_str() ) );
m_grid->SetCellValue( row, 1, it->second );
}

View File

@ -19,7 +19,7 @@
#include <algorithm>
#include <bitmaps.h>
#include <macros.h>
#include <string_utils.h>
#include <dialogs/eda_reorderable_list_dialog.h>

View File

@ -26,7 +26,6 @@
#include <string_utils.h>
#include <locale_io.h>
#include <macros.h>
#include <math/vector2d.h>
#include <drawing_sheet/ds_painter.h>
#include <drawing_sheet/ds_data_item.h>
@ -34,6 +33,7 @@
#include <drawing_sheet/drawing_sheet_lexer.h>
#include <drawing_sheet/ds_file_versions.h>
#include <font/font.h>
#include <string_utils.h>
#include <wx/base64.h>
#include <wx/msgdlg.h>
@ -125,7 +125,7 @@ public:
~DS_DATA_MODEL_STRINGIO()
{
*m_output = FROM_UTF8( m_writer->GetString().c_str() );
*m_output = From_UTF8( m_writer->GetString().c_str() );
delete m_writer;
}

View File

@ -26,7 +26,7 @@
#include <drawing_sheet/ds_data_model.h>
#include <view/view.h>
#include <eda_draw_frame.h>
#include <macros.h>
#include <string_utils.h>
using namespace KIGFX;

View File

@ -137,7 +137,7 @@ std::string FONTCONFIG::getFamilyStringByLang( FONTCONFIG_PAT& aPat, const wxStr
for( auto const& [key, val] : famStrings )
{
if( isLanguageMatch( aDesiredLang, FROM_UTF8( key.c_str() ) ) )
if( isLanguageMatch( aDesiredLang, From_UTF8( key.c_str() ) ) )
{
return val;
}
@ -297,7 +297,7 @@ void FONTCONFIG::ListFonts( std::vector<std::string>& aFonts, const std::string&
FONTCONFIG_PAT patHolder{ font };
std::string theFamily =
getFamilyStringByLang( patHolder, FROM_UTF8( aDesiredLang.c_str() ) );
getFamilyStringByLang( patHolder, From_UTF8( aDesiredLang.c_str() ) );
#ifdef __WXMAC__
// On Mac (at least) some of the font names are in their own language. If

View File

@ -316,8 +316,8 @@ void DXF_IMPORT_PLUGIN::addLayer( const DL_LayerData& aData )
void DXF_IMPORT_PLUGIN::addLinetype( const DL_LinetypeData& data )
{
#if 0
wxString name = FROM_UTF8( data.name.c_str() );
wxString description = FROM_UTF8( data.description.c_str() );
wxString name = From_UTF8( data.name.c_str() );
wxString description = From_UTF8( data.description.c_str() );
#endif
}

View File

@ -21,7 +21,7 @@
#include <markup_parser.h>
#include <sstream>
#include "macros.h"
#include <string_utils.h>
using namespace MARKUP;
@ -65,7 +65,7 @@ std::string NODE::typeString() const
wxString NODE::asWxString() const
{
return FROM_UTF8( string().c_str() );
return From_UTF8( string().c_str() );
}

View File

@ -64,6 +64,7 @@
#include <python_scripting.h>
#include <settings/common_settings.h>
#include <settings/settings_manager.h>
#include <string_utils.h>
#include <systemdirsappend.h>
#include <core/thread_pool.h>
#include <trace_helpers.h>
@ -945,7 +946,7 @@ void PGM_BASE::HandleException( std::exception_ptr aPtr )
#endif
wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
FROM_UTF8( typeid( e ).name() ), FROM_UTF8( e.what() ) );
From_UTF8( typeid( e ).name() ), From_UTF8( e.what() ) );
}
catch( ... )
{

View File

@ -30,6 +30,7 @@
#include <convert_basic_shapes_to_polygon.h>
#include <macros.h>
#include <math/util.h> // for KiROUND
#include <string_utils.h>
#include <trigo.h>
#include <plotters/plotters_pslike.h>

View File

@ -27,6 +27,7 @@
#include <macros.h>
#include <reporter.h>
#include <string_utils.h>
#include <widgets/wx_infobar.h>
#include <widgets/wx_html_report_panel.h>
#include <wx/crt.h>
@ -36,7 +37,7 @@
REPORTER& REPORTER::Report( const char* aText, SEVERITY aSeverity )
{
Report( FROM_UTF8( aText ) );
Report( From_UTF8( aText ) );
return *this;
}

View File

@ -109,7 +109,7 @@ std::string StrPrintf( const char* format, ... )
wxString SafeReadFile( const wxString& aFilePath, const wxString& aReadType )
{
auto FROM_UTF8_WINE =
auto From_UTF8_WINE =
[]( const char* cstring )
{
wxString line = wxString::FromUTF8( cstring );
@ -142,7 +142,7 @@ wxString SafeReadFile( const wxString& aFilePath, const wxString& aReadType )
wxString contents;
while( fileReader.ReadLine() )
contents += FROM_UTF8_WINE( fileReader.Line() );
contents += From_UTF8_WINE( fileReader.Line() );
return contents;
}

View File

@ -22,8 +22,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <macros.h>
#include <search_stack.h>
#include <string_utils.h>
#include <trace_helpers.h>
#include <wx/tokenzr.h>
#include <wx/log.h>

View File

@ -412,7 +412,7 @@ int ReadDelimitedText( wxString* aDest, const char* aSource )
}
}
*aDest = FROM_UTF8( utf8.c_str() );
*aDest = From_UTF8( utf8.c_str() );
return aSource - start;
}
@ -1016,7 +1016,7 @@ int GetTrailingInt( const wxString& aStr )
wxString GetIllegalFileNameWxChars()
{
return FROM_UTF8( illegalFileNameChars );
return From_UTF8( illegalFileNameChars );
}

View File

@ -28,7 +28,7 @@
*/
#include <Python.h> // must be first to avoid wx/python typedef conflicts on msvc
#include <macros.h>
#include <string_utils.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/arrstr.h>
@ -87,7 +87,7 @@ wxString Py2wxString( PyObject* src )
size_t len = PyUnicode_GET_LENGTH( uni_str );
if( len )
result = FROM_UTF8( PyUnicode_AsUTF8( uni_str ) );
result = From_UTF8( PyUnicode_AsUTF8( uni_str ) );
if( must_unref_str )
{

View File

@ -24,9 +24,9 @@
#include <mutex>
#include <macros.h>
#include <template_fieldnames.h>
#include <pgm_base.h>
#include <string_utils.h>
using namespace TFIELD_T;
@ -95,7 +95,7 @@ void TEMPLATE_FIELDNAME::Parse( TEMPLATE_FIELDNAMES_LEXER* in )
in->NeedSYMBOLorNUMBER();
m_Name = FROM_UTF8( in->CurText() );
m_Name = From_UTF8( in->CurText() );
in->NeedRIGHT(); // end (name ...)

View File

@ -24,7 +24,7 @@
#include <xnode.h>
#include <macros.h>
#include <string_utils.h>
typedef wxXmlAttribute XATTR;

View File

@ -141,7 +141,7 @@ int CVPCB_MAINFRAME::buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList,
if( *line == 0 )
continue;
wxString wtext = FROM_UTF8( line );
wxString wtext = From_UTF8( line );
wxString value = GetQuotedText( wtext );
if( value.IsEmpty() )

View File

@ -705,7 +705,7 @@ void CVPCB_MAINFRAME::refreshAfterSymbolSearch( COMPONENT* aSymbol )
// selected footprint.
if( FindFocus() == m_symbolsListBox || FindFocus() == m_librariesListBox )
{
wxString footprintName = FROM_UTF8( aSymbol->GetFPID().Format().c_str() );
wxString footprintName = From_UTF8( aSymbol->GetFPID().Format().c_str() );
m_footprintListBox->SetSelection( m_footprintListBox->GetSelection(), false );

View File

@ -409,8 +409,8 @@ FOOTPRINT* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintNam
return nullptr;
}
wxString libNickname = FROM_UTF8( fpid.GetLibNickname().c_str() );
wxString fpName = FROM_UTF8( fpid.GetLibItemName().c_str() );
wxString libNickname = From_UTF8( fpid.GetLibNickname().c_str() );
wxString fpName = From_UTF8( fpid.GetLibItemName().c_str() );
FP_LIB_TABLE* fpTable = Prj().PcbFootprintLibs();
wxASSERT( fpTable );

View File

@ -28,7 +28,7 @@
#include <dialogs/html_message_box.h>
#include <kiway.h>
#include <lib_id.h>
#include <macros.h>
#include <string_utils.h>
#include <cvpcb_mainframe.h>
#include <fp_conflict_assignment_selector.h>
@ -268,7 +268,7 @@ bool CVPCB_MAINFRAME::readNetListAndFpFiles( const std::string& aNetlist )
msg = formatSymbolDesc( m_symbolsListBox->GetCount() + 1,
component->GetReference(),
component->GetValue(),
FROM_UTF8( component->GetFPID().Format().c_str() ) );
From_UTF8( component->GetFPID().Format().c_str() ) );
m_symbolsListBox->AppendLine( msg );

View File

@ -218,7 +218,7 @@ void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
if( !crossProbingSettings.auto_highlight )
return;
wxString netName = FROM_UTF8( text );
wxString netName = From_UTF8( text );
if( auto sg = Schematic().ConnectionGraph()->FindFirstSubgraphByName( netName ) )
m_highlightedConn = sg->GetDriverConnection()->Name();
@ -245,7 +245,7 @@ void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
if( strcmp( idcmd, "$PART:" ) != 0 )
return;
wxString part_ref = FROM_UTF8( text );
wxString part_ref = From_UTF8( text );
/* look for a complement */
idcmd = strtok( nullptr, " \n\r" );
@ -262,7 +262,7 @@ void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
if( text == nullptr )
return;
wxString msg = FROM_UTF8( text );
wxString msg = From_UTF8( text );
if( strcmp( idcmd, "$REF:" ) == 0 )
{

View File

@ -29,7 +29,7 @@
#include <template_fieldnames.h>
#include <grid_tricks.h>
#include <bitmaps.h>
#include <macros.h>
#include <string_utils.h>
#include <panel_template_fieldnames.h>
PANEL_TEMPLATE_FIELDNAMES::PANEL_TEMPLATE_FIELDNAMES( wxWindow* aWindow,
@ -200,7 +200,7 @@ bool PANEL_TEMPLATE_FIELDNAMES::TransferDataFromWindow()
STRING_FORMATTER sf;
m_templateMgr->Format( &sf, 0, true );
wxString record = FROM_UTF8( sf.GetString().c_str() );
wxString record = From_UTF8( sf.GetString().c_str() );
record.Replace( wxT("\n"), wxT(""), true ); // strip all newlines
record.Replace( wxT(" "), wxT(" "), true ); // double space to single

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