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
unsaved = true;
title.Printf( wxT( "%s%s [%s] %s%s\u2014 " ) + _( "Schematic Editor" ),
IsContentModified() ? "*" : "",
fn.GetName(),
GetCurrentSheet().PathHumanReadable( false ),
readOnly ? _( "[Read Only]" ) + wxS( " " ) : "",
unsaved ? _( "[Unsaved]" ) + wxS( " " ) : "" );
title = ( IsContentModified() ? "*" : "" )
+ fn.GetName() + " [" + GetCurrentSheet().PathHumanReadable( false ) + "] "
+ ( readOnly ? _( "[Read Only]" ) + wxS( " " ) : wxS( "" ) )
+ ( unsaved ? _( "[Unsaved]" ) + wxS( " " ) : wxS( "" ) )
+ wxT( "\u2014 " ) + _( "Schematic Editor" );
}
SetTitle( title );

View File

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

View File

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

View File

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