Shortening filenames in titlebar

Fixes https://gitlab.com/kicad/code/kicad/-/issues/2096
This commit is contained in:
Seth Hillbrand 2020-09-03 06:36:03 -07:00
parent de03d3d427
commit d6a4ab0eec
4 changed files with 7 additions and 5 deletions

View File

@ -1116,7 +1116,7 @@ void SCH_EDIT_FRAME::UpdateTitle()
append = _( "[no file] " ); append = _( "[no file] " );
title.Printf( wxT( "%s [%s] \u2014 %s %s\u2014 " ) + _( "Eeschema" ), title.Printf( wxT( "%s [%s] \u2014 %s %s\u2014 " ) + _( "Eeschema" ),
fn.GetFullName(), fn.GetName(),
GetCurrentSheet().PathHumanReadable(), GetCurrentSheet().PathHumanReadable(),
fn.GetPath(), fn.GetPath(),
append ); append );

View File

@ -714,8 +714,10 @@ void GERBVIEW_FRAME::UpdateTitleAndInfo()
else else
{ {
wxString title; wxString title;
wxFileName filename( gerber->m_FileName );
title.Printf( wxT( "%s%s \u2014 " ) + _( "GerbView" ), title.Printf( wxT( "%s%s \u2014 " ) + _( "GerbView" ),
gerber->m_FileName, filename.GetFullName(),
gerber->m_IsX2_file ? _( " (with X2 attributes)" ) gerber->m_IsX2_file ? _( " (with X2 attributes)" )
: wxString( wxEmptyString ) ); : wxString( wxEmptyString ) );
SetTitle( title ); SetTitle( title );

View File

@ -529,10 +529,10 @@ void PL_EDITOR_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
void PL_EDITOR_FRAME::UpdateTitleAndInfo() void PL_EDITOR_FRAME::UpdateTitleAndInfo()
{ {
wxString title; wxString title;
wxString file = GetCurrentFileName(); wxFileName file( GetCurrentFileName() );
title.Printf( wxT( "%s \u2014 " ) + _( "Page Layout Editor" ), title.Printf( wxT( "%s \u2014 " ) + _( "Page Layout Editor" ),
file.Length() ? file : _( "no file selected" ) ); file.IsOk() ? file.GetName() : _( "no file selected" ) );
SetTitle( title ); SetTitle( title );
} }

View File

@ -1155,7 +1155,7 @@ void PCB_EDIT_FRAME::UpdateTitle()
fileinfo = _( " [Unsaved]" ); fileinfo = _( " [Unsaved]" );
SetTitle( wxString::Format( wxT( "%s%s \u2014 " ) + _( "Pcbnew" ), SetTitle( wxString::Format( wxT( "%s%s \u2014 " ) + _( "Pcbnew" ),
fileName.GetFullPath(), fileName.GetName(),
fileinfo ) ); fileinfo ) );
} }