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()
{
wxString title = wxString::Format( wxT( "Cvpcb %s " ), GetChars( GetBuildVersion() ) );
wxString title;
PROJECT& prj = Prj();
wxFileName fn = prj.GetProjectFullName();
if( fn.IsOk() && !prj.GetProjectFullName().IsEmpty() && fn.FileExists() )
{
title += wxString::Format( _("Project: '%s'"),
GetChars( fn.GetFullPath() )
);
if( !fn.IsFileWritable() )
title += _( " [Read Only]" );
title.Printf( L"Cvpcb \u2014 %s%s",
fn.GetFullPath(),
fn.IsFileWritable()
? wxString( wxEmptyString )
: _( " [Read Only]" ) );
}
else
title += _( "[no project]" );
{
title = "Cvpcb";
}
SetTitle( title );
}

View File

@ -231,9 +231,6 @@ bool SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile()
return false;
wxString filename = dlg.GetPath();
wxString title = wxT( "Eeschema " ) + GetBuildVersion() + wxT( ' ' ) + filename;
SetTitle( title );
wxArrayString choices;
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) 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
* modify it under the terms of the GNU General Public License
@ -50,22 +50,12 @@
void LIB_EDIT_FRAME::DisplayLibInfos()
{
wxString msg = _( "Part Library Editor: " );
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 )
{
msg += lib->GetFullFileName();
if( lib->IsReadOnly() )
msg += _( " [Read Only]" );
}
else
{
msg += _( "no library selected" );
}
SetTitle( msg );
SetTitle( title );
}

View File

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

View File

@ -2,7 +2,7 @@
* 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 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
* 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 );
wxString msg = _( "Library Browser" );
msg += wxT( " [" );
if( lib )
msg += lib->GetFullFileName();
else
msg += _( "no library selected" );
msg += wxT( "]" );
SetTitle( msg );
wxString title = wxString::Format( L"Library Browser \u2014 %s",
lib ? lib->GetFullFileName() : "no library selected" );
SetTitle( title );
}
}

View File

@ -490,59 +490,63 @@ void GERBVIEW_FRAME::Liste_D_Codes()
}
void GERBVIEW_FRAME::UpdateTitleAndInfo()
{
GERBER_FILE_IMAGE* gerber = GetGbrImage( getActiveLayer() );
wxString text;
// Display the gerber filename
if( gerber == NULL )
{
text.Printf( wxT( "GerbView %s" ), GetChars( GetBuildVersion() ) );
SetTitle( text );
SetStatusText( wxEmptyString, 0 );
text.Printf( _( "Drawing layer %d not in use" ), getActiveLayer() + 1 );
m_TextInfo->SetValue( text );
SetTitle( "GerbView" );
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();
ClearMsgPanel();
return;
}
text = _( "File:" );
text << wxT( " " ) << gerber->m_FileName;
if( gerber->m_IsX2_file )
text << wxT( " " ) << _( "(with X2 Attributes)" );
SetTitle( text );
else
{
wxString title;
title.Printf( L"GerbView \u2014 %s%s",
gerber->m_FileName,
gerber->m_IsX2_file
? " " + _( "(with X2 attributes)" )
: wxString( wxEmptyString ) );
SetTitle( title );
gerber->DisplayImageInfo( this );
// Display Image Name and Layer Name (from the current gerber data):
text.Printf( _( "Image name: '%s' Layer name: '%s'" ),
wxString status;
status.Printf( _( "Image name: '%s' Layer name: '%s'" ),
GetChars( gerber->m_ImageName ),
GetChars( gerber->GetLayerParams().m_LayerName ) );
SetStatusText( text, 0 );
SetStatusText( status, 0 );
// Display data format like fmt in X3.4Y3.4 no LZ or fmt mm X2.3 Y3.5 no TZ in main toolbar
text.Printf( wxT( "fmt: %s X%d.%d Y%d.%d no %cZ" ),
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' );
if( gerber->m_IsX2_file )
text << wxT(" ") << _( "X2 attr" );
info << wxT(" ") << _( "X2 attr" );
m_TextInfo->SetValue( text );
m_TextInfo->SetValue( info );
if( EnsureTextCtrlWidth( m_TextInfo, &text ) ) // Resized
if( EnsureTextCtrlWidth( m_TextInfo, &info ) ) // Resized
m_auimgr.Update();
}
}
bool GERBVIEW_FRAME::IsElementVisible( GERBER_VISIBLE_ID aItemIdVisible ) const

View File

@ -2,7 +2,7 @@
* 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 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
* 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 );
title = wxT( "KiCad " ) + GetBuildVersion() + wxT( ' ' ) + prj_filename;
title = L"KiCad \u2014 " + prj_filename;
if( !wxFileName( prj_filename ).IsDirWritable() )
title += _( " [Read Only]" );

View File

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

View File

@ -755,46 +755,42 @@ void FOOTPRINT_EDIT_FRAME::OnModify()
void FOOTPRINT_EDIT_FRAME::updateTitle()
{
wxString title = _( "Footprint Editor " );
wxString nickname = GetCurrentLib();
wxString nickname_display = _( "no active library" );
bool writable = true;
if( !nickname )
{
L_none:
title += _( "(no active library)" );
}
else
if( !!nickname )
{
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.
title = _( "Footprint Editor (active library: " ) + nickname + wxT( ")" );
if( !writable )
title += _( " [Read Only]" );
nickname_display = nickname;
}
catch( const IO_ERROR& ioe )
{
// 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
// of libary selection UI.
goto L_none;
}
}
// Now, add the full path, for info
wxString path_display;
if( nickname.size() )
{
FP_LIB_TABLE* libtable = Prj().PcbFootprintLibs();
const FP_LIB_TABLE::ROW* row = libtable->FindRow( nickname );
if( row )
title << " (" << row->GetFullURI( true ) << ")";
}
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 );
}

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2012-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* 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
* 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 )
return;
wxString frm3Dtitle = wxString::Format(
_( "ModView: 3D Viewer [%s]" ),
GetChars( getCurFootprintName() ) );
wxString title = wxString::Format(
_( "3D Viewer" ) + L" \u2014 %s",
getCurFootprintName() );
draw3DFrame->SetTitle( frm3Dtitle );
draw3DFrame->SetTitle( title );
if( aForceReloadFootprint )
{
@ -715,19 +715,13 @@ bool FOOTPRINT_VIEWER_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopM
void FOOTPRINT_VIEWER_FRAME::UpdateTitle()
{
wxString msg;
wxString title;
wxString path;
msg = _( "Library Browser" );
msg << wxT( " [" );
if( getCurNickname().size() )
{
msg << getCurNickname();
}
else
msg += _( "no library selected" );
msg << wxT( "]" );
title.Printf( _( "Library Browser" ) + L" \u2014 %s",
getCurNickname().size()
? getCurNickname()
: _( "no library selected" ) );
// Now, add the full path, for info
if( getCurNickname().size() )
@ -736,10 +730,10 @@ void FOOTPRINT_VIEWER_FRAME::UpdateTitle()
const FP_LIB_TABLE::ROW* row = libtable->FindRow( getCurNickname() );
if( row )
msg << " (" << row->GetFullURI( true ) << ")";
title << L" \u2014 " << row->GetFullURI( true );
}
SetTitle( msg );
SetTitle( title );
}

View File

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