Work around MacOS printf/format issues

MacOS wxWidgets implementation of wxPrintf/Format suffers from some
issues when mixing string types.  We avoid this by manually formatting
the string ourselves.

Fixes https://gitlab.com/kicad/code/kicad/issues/8404
This commit is contained in:
Seth Hillbrand 2021-06-16 11:52:51 -07:00
parent 0ff1f6f69c
commit 7953a5c62b
4 changed files with 31 additions and 31 deletions

View File

@ -1264,12 +1264,11 @@ void SCH_EDIT_FRAME::UpdateTitle()
else else
unsaved = true; unsaved = true;
title.Printf( wxT( "%s%s [%s] %s%s\u2014 " ) + _( "Schematic Editor" ), title = ( IsContentModified() ? "*" : "" )
IsContentModified() ? "*" : "", + fn.GetName() + " [" + GetCurrentSheet().PathHumanReadable( false ) + "] "
fn.GetName(), + ( readOnly ? _( "[Read Only]" ) + wxS( " " ) : wxS( "" ) )
GetCurrentSheet().PathHumanReadable( false ), + ( unsaved ? _( "[Unsaved]" ) + wxS( " " ) : wxS( "" ) )
readOnly ? _( "[Read Only]" ) + wxS( " " ) : "", + wxT( "\u2014 " ) + _( "Schematic Editor" );
unsaved ? _( "[Unsaved]" ) + wxS( " " ) : "" );
} }
SetTitle( title ); SetTitle( title );

View File

@ -139,9 +139,10 @@ void SYMBOL_EDIT_FRAME::updateTitle()
if( IsSymbolFromSchematic() ) if( IsSymbolFromSchematic() )
{ {
title = wxString::Format( _( "%s%s [from schematic]" ) + wxT( " \u2014 " ), title = ( GetScreen() && GetScreen()->IsContentModified() ? "*" : "" )
GetScreen() && GetScreen()->IsContentModified() ? "*" : "", + m_reference + " "
m_reference ); + _( "[from schematic]" )
+ wxT( " \u2014 " );
} }
else else
{ {
@ -149,10 +150,11 @@ void SYMBOL_EDIT_FRAME::updateTitle()
{ {
bool readOnly = m_libMgr && m_libMgr->IsLibraryReadOnly( GetCurLib() ); bool readOnly = m_libMgr && m_libMgr->IsLibraryReadOnly( GetCurLib() );
title = wxString::Format( wxT( "%s%s %s\u2014 " ), title = ( GetScreen() && GetScreen()->IsContentModified() ? "*" : "" )
GetScreen() && GetScreen()->IsContentModified() ? "*" : "", + FROM_UTF8( GetCurSymbol()->GetLibId().Format().c_str() )
GetCurSymbol()->GetLibId().Format().c_str(), + " "
readOnly ? _( "[Read Only Library]" ) + wxT( " " ) : "" ); + ( readOnly ? _( "[Read Only Library]" ) + wxT( " " ) : "" )
+ wxT( " \u2014 " );
} }
} }

View File

@ -756,11 +756,9 @@ void FOOTPRINT_EDIT_FRAME::UpdateTitle()
if( IsCurrentFPFromBoard() ) if( IsCurrentFPFromBoard() )
{ {
title = wxString::Format( _( "%s%s [from %s.%s]" ) + wxT( " \u2014 " ), title = ( IsContentModified() ? "*" : "" )
IsContentModified() ? "*" : "", + footprint->GetReference() + wxS( " [from " )
footprint->GetReference(), + Prj().GetProjectName() + "." + PcbFileExtension + wxS( "] \u2014 " );
Prj().GetProjectName(),
PcbFileExtension );
} }
else if( fpid.IsValid() ) else if( fpid.IsValid() )
{ {
@ -774,18 +772,16 @@ void FOOTPRINT_EDIT_FRAME::UpdateTitle()
} }
// Note: don't used GetLoadedFPID(); footprint name may have been edited // Note: don't used GetLoadedFPID(); footprint name may have been edited
title += wxString::Format( wxT( "%s%s %s\u2014 " ), title = ( IsContentModified() ? "*" : "" )
IsContentModified() ? "*" : "", + FROM_UTF8( footprint->GetFPID().Format().c_str() ) + " "
FROM_UTF8( footprint->GetFPID().Format().c_str() ), + ( writable ? wxS( "" ) : _( "[Read Only]" ) + wxS( " " ) ) + wxS( "\u2014 " );
writable ? "" : _( "[Read Only]" ) + wxS( " " ) );
} }
else if( !fpid.GetLibItemName().empty() ) else if( !fpid.GetLibItemName().empty() )
{ {
// Note: don't used GetLoadedFPID(); footprint name may have been edited // Note: don't used GetLoadedFPID(); footprint name may have been edited
title += wxString::Format( wxT( "%s%s %s \u2014 " ), title = ( IsContentModified() ? "*" : "" )
IsContentModified() ? "*" : "", + FROM_UTF8( footprint->GetFPID().GetLibItemName().c_str() ) + " "
FROM_UTF8( footprint->GetFPID().GetLibItemName().c_str() ), + _( "[Unsaved]" ) + wxS( " \u2014 " );
_( "[Unsaved]" ) );
} }
title += _( "Footprint Editor" ); title += _( "Footprint Editor" );

View File

@ -1243,11 +1243,14 @@ void PCB_EDIT_FRAME::UpdateTitle()
else else
unsaved = true; unsaved = true;
SetTitle( wxString::Format( wxT( "%s%s %s%s\u2014 " ) + _( "PCB Editor" ), wxString title;
IsContentModified() ? "*" : "",
fn.GetName(), title = ( IsContentModified() ? "*" : "" )
readOnly ? _( "[Read Only]" ) + wxS( " " ) : "", + fn.GetName() + " "
unsaved ? _( "[Unsaved]" ) + wxS( " " ) : "" ) ); + ( readOnly ? _( "[Read Only]" ) + wxS( " " ) : wxS( "" ) )
+ ( unsaved ? _( "[Unsaved]" ) + wxS( " " ) : wxS( "" ) )
+ wxT( "\u2014 " ) + _( "PCB Editor" );
SetTitle( title );
} }