Unify window title formats

Most window titles are now of the format "Application — file [info]",
with adaptations as necessary. Version information has been removed from
titles.
This commit is contained in:
Chris Pavlina 2016-09-26 13:15:33 -04:00
parent 41735b6563
commit 52aa4ecdf4
11 changed files with 110 additions and 132 deletions

View File

@ -748,21 +748,22 @@ bool CVPCB_MAINFRAME::LoadFootprintFiles()
void CVPCB_MAINFRAME::UpdateTitle() void CVPCB_MAINFRAME::UpdateTitle()
{ {
wxString title = wxString::Format( wxT( "Cvpcb %s " ), GetChars( GetBuildVersion() ) ); wxString title;
PROJECT& prj = Prj(); PROJECT& prj = Prj();
wxFileName fn = prj.GetProjectFullName(); wxFileName fn = prj.GetProjectFullName();
if( fn.IsOk() && !prj.GetProjectFullName().IsEmpty() && fn.FileExists() ) if( fn.IsOk() && !prj.GetProjectFullName().IsEmpty() && fn.FileExists() )
{ {
title += wxString::Format( _("Project: '%s'"), title.Printf( L"Cvpcb \u2014 %s%s",
GetChars( fn.GetFullPath() ) fn.GetFullPath(),
); fn.IsFileWritable()
? wxString( wxEmptyString )
if( !fn.IsFileWritable() ) : _( " [Read Only]" ) );
title += _( " [Read Only]" );
} }
else else
title += _( "[no project]" ); {
title = "Cvpcb";
}
SetTitle( title ); SetTitle( title );
} }

View File

@ -231,9 +231,6 @@ bool SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile()
return false; return false;
wxString filename = dlg.GetPath(); wxString filename = dlg.GetPath();
wxString title = wxT( "Eeschema " ) + GetBuildVersion() + wxT( ' ' ) + filename;
SetTitle( title );
wxArrayString choices; wxArrayString choices;
choices.Add( _( "Keep existing footprint field visibility" ) ); choices.Add( _( "Keep existing footprint field visibility" ) );

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2016 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -50,22 +50,12 @@
void LIB_EDIT_FRAME::DisplayLibInfos() void LIB_EDIT_FRAME::DisplayLibInfos()
{ {
wxString msg = _( "Part Library Editor: " ); PART_LIB* lib = GetCurLib();
PART_LIB* lib = GetCurLib(); wxString title = wxString::Format( L"Part Library Editor \u2014 %s%s",
lib ? lib->GetFullFileName() : _( "no library selected" ),
lib && lib->IsReadOnly() ? _( " [Read Only] ") : wxString( wxEmptyString ) );
if( lib ) SetTitle( title );
{
msg += lib->GetFullFileName();
if( lib->IsReadOnly() )
msg += _( " [Read Only]" );
}
else
{
msg += _( "no library selected" );
}
SetTitle( msg );
} }

View File

@ -1358,15 +1358,14 @@ void SCH_EDIT_FRAME::UpdateTitle()
if( GetScreen()->GetFileName() == m_DefaultSchematicFileName ) if( GetScreen()->GetFileName() == m_DefaultSchematicFileName )
{ {
title.Printf( wxT( "Eeschema %s [%s]" ), GetChars( GetBuildVersion() ), title.Printf( L"Eeschema \u2014 %s", GetChars( GetScreen()->GetFileName() ) );
GetChars( GetScreen()->GetFileName() ) );
} }
else else
{ {
wxString fileName = Prj().AbsolutePath( GetScreen()->GetFileName() ); wxString fileName = Prj().AbsolutePath( GetScreen()->GetFileName() );
wxFileName fn = fileName; wxFileName fn = fileName;
title.Printf( wxT( "[ %s %s] (%s)" ), title.Printf( L"Eeschema \u2014 %s [%s] \u2014 %s",
GetChars( fn.GetName() ), GetChars( fn.GetName() ),
GetChars( m_CurrentSheet->PathHumanReadable() ), GetChars( m_CurrentSheet->PathHumanReadable() ),
GetChars( fn.GetPath() ) ); GetChars( fn.GetPath() ) );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 KiCad Developers, see CHANGELOG.TXT for contributors. * Copyright (C) 2015-2016 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -131,18 +131,9 @@ void LIB_VIEW_FRAME::DisplayLibInfos()
{ {
PART_LIB* lib = libs->FindLibrary( m_libraryName ); PART_LIB* lib = libs->FindLibrary( m_libraryName );
wxString msg = _( "Library Browser" ); wxString title = wxString::Format( L"Library Browser \u2014 %s",
lib ? lib->GetFullFileName() : "no library selected" );
msg += wxT( " [" ); SetTitle( title );
if( lib )
msg += lib->GetFullFileName();
else
msg += _( "no library selected" );
msg += wxT( "]" );
SetTitle( msg );
} }
} }

View File

@ -490,58 +490,62 @@ void GERBVIEW_FRAME::Liste_D_Codes()
} }
void GERBVIEW_FRAME::UpdateTitleAndInfo() void GERBVIEW_FRAME::UpdateTitleAndInfo()
{ {
GERBER_FILE_IMAGE* gerber = GetGbrImage( getActiveLayer() ); GERBER_FILE_IMAGE* gerber = GetGbrImage( getActiveLayer() );
wxString text;
// Display the gerber filename // Display the gerber filename
if( gerber == NULL ) if( gerber == NULL )
{ {
text.Printf( wxT( "GerbView %s" ), GetChars( GetBuildVersion() ) ); SetTitle( "GerbView" );
SetTitle( text );
SetStatusText( wxEmptyString, 0 );
text.Printf( _( "Drawing layer %d not in use" ), getActiveLayer() + 1 );
m_TextInfo->SetValue( text );
if( EnsureTextCtrlWidth( m_TextInfo, &text ) ) // Resized SetStatusText( wxEmptyString, 0 );
wxString info;
info.Printf( _( "Drawing layer %d not in use" ), getActiveLayer() + 1 );
m_TextInfo->SetValue( info );
if( EnsureTextCtrlWidth( m_TextInfo, &info ) ) // Resized
m_auimgr.Update(); m_auimgr.Update();
ClearMsgPanel(); ClearMsgPanel();
return; return;
} }
else
{
wxString title;
title.Printf( L"GerbView \u2014 %s%s",
gerber->m_FileName,
gerber->m_IsX2_file
? " " + _( "(with X2 attributes)" )
: wxString( wxEmptyString ) );
SetTitle( title );
text = _( "File:" ); gerber->DisplayImageInfo( this );
text << wxT( " " ) << gerber->m_FileName;
if( gerber->m_IsX2_file ) // Display Image Name and Layer Name (from the current gerber data):
text << wxT( " " ) << _( "(with X2 Attributes)" ); wxString status;
status.Printf( _( "Image name: '%s' Layer name: '%s'" ),
GetChars( gerber->m_ImageName ),
GetChars( gerber->GetLayerParams().m_LayerName ) );
SetStatusText( status, 0 );
SetTitle( text ); // Display data format like fmt in X3.4Y3.4 no LZ or fmt mm X2.3 Y3.5 no TZ in main toolbar
wxString info;
info.Printf( wxT( "fmt: %s X%d.%d Y%d.%d no %cZ" ),
gerber->m_GerbMetric ? wxT( "mm" ) : wxT( "in" ),
gerber->m_FmtLen.x - gerber->m_FmtScale.x, gerber->m_FmtScale.x,
gerber->m_FmtLen.y - gerber->m_FmtScale.y, gerber->m_FmtScale.y,
gerber->m_NoTrailingZeros ? 'T' : 'L' );
gerber->DisplayImageInfo( this ); if( gerber->m_IsX2_file )
info << wxT(" ") << _( "X2 attr" );
// Display Image Name and Layer Name (from the current gerber data): m_TextInfo->SetValue( info );
text.Printf( _( "Image name: '%s' Layer name: '%s'" ),
GetChars( gerber->m_ImageName ),
GetChars( gerber->GetLayerParams().m_LayerName ) );
SetStatusText( text, 0 );
// Display data format like fmt in X3.4Y3.4 no LZ or fmt mm X2.3 Y3.5 no TZ in main toolbar if( EnsureTextCtrlWidth( m_TextInfo, &info ) ) // Resized
text.Printf( wxT( "fmt: %s X%d.%d Y%d.%d no %cZ" ), m_auimgr.Update();
gerber->m_GerbMetric ? wxT( "mm" ) : wxT( "in" ), }
gerber->m_FmtLen.x - gerber->m_FmtScale.x, gerber->m_FmtScale.x,
gerber->m_FmtLen.y - gerber->m_FmtScale.y, gerber->m_FmtScale.y,
gerber->m_NoTrailingZeros ? 'T' : 'L' );
if( gerber->m_IsX2_file )
text << wxT(" ") << _( "X2 attr" );
m_TextInfo->SetValue( text );
if( EnsureTextCtrlWidth( m_TextInfo, &text ) ) // Resized
m_auimgr.Update();
} }
@ -874,4 +878,4 @@ void GERBVIEW_FRAME::unitsChangeRefresh()
{ // Called on units change (see EDA_DRAW_FRAME) { // Called on units change (see EDA_DRAW_FRAME)
EDA_DRAW_FRAME::unitsChangeRefresh(); EDA_DRAW_FRAME::unitsChangeRefresh();
updateDCodeSelectBox(); updateDCodeSelectBox();
} }

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004-2015 Jean-Pierre Charras * Copyright (C) 2004-2015 Jean-Pierre Charras
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2016 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -328,7 +328,7 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event )
Prj().ConfigLoad( PgmTop().SysSearch(), GeneralGroupName, s_KicadManagerParams ); Prj().ConfigLoad( PgmTop().SysSearch(), GeneralGroupName, s_KicadManagerParams );
title = wxT( "KiCad " ) + GetBuildVersion() + wxT( ' ' ) + prj_filename; title = L"KiCad \u2014 " + prj_filename;
if( !wxFileName( prj_filename ).IsDirWritable() ) if( !wxFileName( prj_filename ).IsDirWritable() )
title += _( " [Read Only]" ); title += _( " [Read Only]" );

View File

@ -339,8 +339,10 @@ void PL_EDITOR_FRAME::SaveSettings( wxConfigBase* aCfg )
void PL_EDITOR_FRAME::UpdateTitleAndInfo() void PL_EDITOR_FRAME::UpdateTitleAndInfo()
{ {
wxString title; wxString title;
title.Printf( wxT( "Pl_Editor %s [%s]" ), GetChars( GetBuildVersion() ), wxString file = GetCurrFileName();
GetChars( GetCurrFileName() ) );
title.Printf( _( "Page Layout Editor" ) + L" \u2014 %s",
!!file ? file : _( "no file selected" ) );
SetTitle( title ); SetTitle( title );
} }

View File

@ -755,46 +755,42 @@ void FOOTPRINT_EDIT_FRAME::OnModify()
void FOOTPRINT_EDIT_FRAME::updateTitle() void FOOTPRINT_EDIT_FRAME::updateTitle()
{ {
wxString title = _( "Footprint Editor " );
wxString nickname = GetCurrentLib(); wxString nickname = GetCurrentLib();
wxString nickname_display = _( "no active library" );
bool writable = true;
if( !nickname ) if( !!nickname )
{
L_none:
title += _( "(no active library)" );
}
else
{ {
try try
{ {
bool writable = Prj().PcbFootprintLibs()->IsFootprintLibWritable( nickname ); writable = Prj().PcbFootprintLibs()->IsFootprintLibWritable( nickname );
// no exception was thrown, this means libPath is valid, but it may be read only. nickname_display = nickname;
title = _( "Footprint Editor (active library: " ) + nickname + wxT( ")" );
if( !writable )
title += _( " [Read Only]" );
} }
catch( const IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {
// user may be bewildered as to why after selecting a library it is not showing up // user may be bewildered as to why after selecting a library it is not showing up
// in the title, we could show an error message, but that should have been done at time // in the title, we could show an error message, but that should have been done at time
// of libary selection UI. // of libary selection UI.
goto L_none;
}
// Now, add the full path, for info
if( nickname.size() )
{
FP_LIB_TABLE* libtable = Prj().PcbFootprintLibs();
const FP_LIB_TABLE::ROW* row = libtable->FindRow( nickname );
if( row )
title << " (" << row->GetFullURI( true ) << ")";
} }
} }
wxString path_display;
if( nickname.size() )
{
FP_LIB_TABLE* libtable = Prj().PcbFootprintLibs();
const FP_LIB_TABLE::ROW* row = libtable->FindRow( nickname );
if( row )
path_display = L" \u2014 " + row->GetFullURI( true );
}
wxString title;
title.Printf( _( "Footprint Editor" ) + L" \u2014 %s%s%s",
nickname_display,
writable ? wxString( wxEmptyString ) : _( " [Read Only]" ),
path_display );
SetTitle( title ); SetTitle( title );
} }

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2012-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2012-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2016 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -660,11 +660,11 @@ void FOOTPRINT_VIEWER_FRAME::Update3D_Frame( bool aForceReloadFootprint )
if( draw3DFrame == NULL ) if( draw3DFrame == NULL )
return; return;
wxString frm3Dtitle = wxString::Format( wxString title = wxString::Format(
_( "ModView: 3D Viewer [%s]" ), _( "3D Viewer" ) + L" \u2014 %s",
GetChars( getCurFootprintName() ) ); getCurFootprintName() );
draw3DFrame->SetTitle( frm3Dtitle ); draw3DFrame->SetTitle( title );
if( aForceReloadFootprint ) if( aForceReloadFootprint )
{ {
@ -715,19 +715,13 @@ bool FOOTPRINT_VIEWER_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopM
void FOOTPRINT_VIEWER_FRAME::UpdateTitle() void FOOTPRINT_VIEWER_FRAME::UpdateTitle()
{ {
wxString msg; wxString title;
wxString path;
msg = _( "Library Browser" ); title.Printf( _( "Library Browser" ) + L" \u2014 %s",
msg << wxT( " [" ); getCurNickname().size()
? getCurNickname()
if( getCurNickname().size() ) : _( "no library selected" ) );
{
msg << getCurNickname();
}
else
msg += _( "no library selected" );
msg << wxT( "]" );
// Now, add the full path, for info // Now, add the full path, for info
if( getCurNickname().size() ) if( getCurNickname().size() )
@ -736,10 +730,10 @@ void FOOTPRINT_VIEWER_FRAME::UpdateTitle()
const FP_LIB_TABLE::ROW* row = libtable->FindRow( getCurNickname() ); const FP_LIB_TABLE::ROW* row = libtable->FindRow( getCurNickname() );
if( row ) if( row )
msg << " (" << row->GetFullURI( true ) << ")"; title << L" \u2014 " << row->GetFullURI( true );
} }
SetTitle( msg ); SetTitle( title );
} }

View File

@ -994,21 +994,25 @@ void PCB_EDIT_FRAME::SVG_Print( wxCommandEvent& event )
void PCB_EDIT_FRAME::UpdateTitle() void PCB_EDIT_FRAME::UpdateTitle()
{ {
wxFileName fileName = GetBoard()->GetFileName(); wxFileName fileName = GetBoard()->GetFileName();
wxString title = wxString::Format( wxT( "Pcbnew %s " ), GetChars( GetBuildVersion() ) ); wxString fileinfo;
if( fileName.IsOk() && fileName.FileExists() ) if( fileName.IsOk() && fileName.FileExists() )
{ {
title << fileName.GetFullPath(); fileinfo = fileName.IsFileWritable()
? wxString( wxEmptyString )
if( !fileName.IsFileWritable() ) : _( " [Read Only]" );
title << _( " [Read Only]" );
} }
else else
{ {
title << _( " [new file]" ) << wxT(" ") << fileName.GetFullPath(); fileinfo = _( " [new file]" );
} }
wxString title;
title.Printf( L"Pcbnew \u2014 %s%s",
fileName.GetFullPath(),
fileinfo );
SetTitle( title ); SetTitle( title );
} }