Application title bar: app name after filename

Fixes https://gitlab.com/kicad/code/kicad/issues/2096
This commit is contained in:
Michael Kavanagh 2020-04-13 21:02:35 +01:00 committed by Seth Hillbrand
parent 04ba129881
commit de03d3d427
9 changed files with 35 additions and 31 deletions

View File

@ -894,7 +894,7 @@ void LIB_VIEW_FRAME::DisplayLibInfos()
{ {
const SYMBOL_LIB_TABLE_ROW* row = Prj().SchSymbolLibTable()->FindRow( m_libraryName ); const SYMBOL_LIB_TABLE_ROW* row = Prj().SchSymbolLibTable()->FindRow( m_libraryName );
wxString title = wxString::Format( _( "Symbol Library Browser -- %s" ), wxString title = wxString::Format( wxT( "%s \u2014 " ) + _( "Symbol Library Browser" ),
row ? row->GetFullURI() : _( "no library selected" ) ); row ? row->GetFullURI() : _( "no library selected" ) );
SetTitle( title ); SetTitle( title );
} }

View File

@ -49,22 +49,23 @@
void LIB_EDIT_FRAME::updateTitle() void LIB_EDIT_FRAME::updateTitle()
{ {
wxString lib = GetCurLib(); wxString lib = GetCurLib();
wxString title = _( "Symbol Editor" ); wxString title;
if( IsSymbolFromSchematic() ) if( IsSymbolFromSchematic() )
{ {
title += wxT( " \u2014 " );
title += wxString::Format( _( "%s from schematic" ), m_reference ); title += wxString::Format( _( "%s from schematic" ), m_reference );
title += wxT( " \u2014 " );
} }
else else
{ {
if( GetCurPart() ) if( GetCurPart() )
title += wxT( " \u2014 " ) + GetCurPart()->GetLibId().Format(); title += GetCurPart()->GetLibId().Format() + wxT( " \u2014 " ) ;
if( GetCurPart() && m_libMgr && m_libMgr->IsLibraryReadOnly( GetCurLib() ) ) if( GetCurPart() && m_libMgr && m_libMgr->IsLibraryReadOnly( GetCurLib() ) )
title += wxT( " \u2014 " ) + _( "[Read Only Library]" ); title += _( "[Read Only Library]" ) + wxT( " \u2014 " );
} }
title += _( "Symbol Editor" );
SetTitle( title ); SetTitle( title );
} }

View File

@ -1099,25 +1099,27 @@ void SCH_EDIT_FRAME::UpdateTitle()
if( GetScreen()->GetFileName().IsEmpty() ) if( GetScreen()->GetFileName().IsEmpty() )
{ {
title.Printf( _( "Eeschema" ) + wxT( " \u2014" ) + _( " [no file]" ) ); title.Printf( _( "[no file]" ) + wxT( " \u2014 " ) + _( "Eeschema" ) );
} }
else else
{ {
wxString fileName = Prj().AbsolutePath( GetScreen()->GetFileName() ); wxString fileName = Prj().AbsolutePath( GetScreen()->GetFileName() );
wxFileName fn = fileName; wxFileName fn = fileName;
wxString append;
title.Printf( _( "Eeschema" ) + wxT( " \u2014 %s [%s] \u2014 %s" ),
fn.GetFullName(),
GetCurrentSheet().PathHumanReadable(),
fn.GetPath() );
if( fn.FileExists() ) if( fn.FileExists() )
{ {
if( !fn.IsFileWritable() ) if( !fn.IsFileWritable() )
title += _( " [Read Only]" ); append = _( "[Read Only] " );
} }
else else
title += _( " [no file]" ); append = _( "[no file] " );
title.Printf( wxT( "%s [%s] \u2014 %s %s\u2014 " ) + _( "Eeschema" ),
fn.GetFullName(),
GetCurrentSheet().PathHumanReadable(),
fn.GetPath(),
append );
} }
SetTitle( title ); SetTitle( title );

View File

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

View File

@ -592,24 +592,24 @@ void KICAD_MANAGER_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTex
void KICAD_MANAGER_FRAME::ProjectChanged() void KICAD_MANAGER_FRAME::ProjectChanged()
{ {
wxString title = wxS( "KiCad " ) + GetBuildVersion(); wxString app = wxS( "KiCad " ) + GetMajorMinorVersion();
wxString file = GetProjectFileName(); wxString file = GetProjectFileName();
wxString title;
if( !file.IsEmpty() ) if( !file.IsEmpty() )
{ {
// Ensure file name is absolute
wxFileName fn( file ); wxFileName fn( file );
if( !fn.IsAbsolute() ) title += fn.GetName();
fn.MakeAbsolute();
title += " ";
title += fn.GetFullPath();
if( !fn.IsDirWritable() ) if( !fn.IsDirWritable() )
title += _( " [Read Only]" ); title += _( " [Read Only]" );
title += wxS(" \u2014 ");
} }
title += app;
SetTitle( title ); SetTitle( title );
} }

View File

@ -531,7 +531,7 @@ void PL_EDITOR_FRAME::UpdateTitleAndInfo()
wxString title; wxString title;
wxString file = GetCurrentFileName(); wxString file = GetCurrentFileName();
title.Printf( _( "Page Layout Editor" ) + wxT( " \u2014 %s" ), title.Printf( wxT( "%s \u2014 " ) + _( "Page Layout Editor" ),
file.Length() ? file : _( "no file selected" ) ); file.Length() ? file : _( "no file selected" ) );
SetTitle( title ); SetTitle( title );
} }

View File

@ -696,13 +696,13 @@ void FOOTPRINT_EDIT_FRAME::OnModify()
void FOOTPRINT_EDIT_FRAME::updateTitle() void FOOTPRINT_EDIT_FRAME::updateTitle()
{ {
wxString title = _( "Footprint Editor" ); wxString title;
LIB_ID fpid = GetLoadedFPID(); LIB_ID fpid = GetLoadedFPID();
bool writable = true; bool writable = true;
if( IsCurrentFPFromBoard() ) if( IsCurrentFPFromBoard() )
{ {
title += wxString::Format( wxT( " \u2014 %s [from %s.%s]" ), title += wxString::Format( _( "%s [from %s.%s]" ) + wxT( " \u2014 " ),
GetBoard()->GetFirstModule()->GetReference(), Prj().GetProjectName(), GetBoard()->GetFirstModule()->GetReference(), Prj().GetProjectName(),
PcbFileExtension ); PcbFileExtension );
} }
@ -718,18 +718,20 @@ 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( " \u2014 %s %s" ), title += wxString::Format( wxT( "%s %s \u2014 " ),
FROM_UTF8( GetBoard()->GetFirstModule()->GetFPID().Format().c_str() ), FROM_UTF8( GetBoard()->GetFirstModule()->GetFPID().Format().c_str() ),
writable ? wxString( wxEmptyString ) : _( "[Read Only]" ) ); writable ? wxString( wxEmptyString ) : _( "[Read Only]" ) );
} }
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( " \u2014 %s %s" ), title += wxString::Format( wxT( "%s %s \u2014 " ),
FROM_UTF8( GetBoard()->GetFirstModule()->GetFPID().GetLibItemName().c_str() ), FROM_UTF8( GetBoard()->GetFirstModule()->GetFPID().GetLibItemName().c_str() ),
_( "[Unsaved]" ) ); _( "[Unsaved]" ) );
} }
title += _( "Footprint Editor" );
SetTitle( title ); SetTitle( title );
} }
@ -1073,5 +1075,3 @@ void FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng( wxCommandEvent& event )
wxYield(); wxYield();
SaveCanvasImageToFile( this, dlg.GetPath() ); SaveCanvasImageToFile( this, dlg.GetPath() );
} }

View File

@ -977,8 +977,7 @@ void FOOTPRINT_VIEWER_FRAME::UpdateTitle()
wxString title; wxString title;
wxString path; wxString path;
title.Printf( _( "Footprint Library Browser" ) + L" \u2014 %s", title.Printf( getCurNickname().IsEmpty() ? _( "no library selected" ) : getCurNickname() );
getCurNickname().IsEmpty() ? _( "no library selected" ) : getCurNickname() );
// Now, add the full path, for info // Now, add the full path, for info
if( !getCurNickname().IsEmpty() ) if( !getCurNickname().IsEmpty() )
@ -990,6 +989,8 @@ void FOOTPRINT_VIEWER_FRAME::UpdateTitle()
title << L" \u2014 " << row->GetFullURI( true ); title << L" \u2014 " << row->GetFullURI( true );
} }
title += wxT( " \u2014 " ) + _( "Footprint Library Browser" );
SetTitle( title ); SetTitle( title );
} }

View File

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