kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #26456
[PATCH] Unify window title formats, remove versions from titles
Hi,
Since we seem to have (mostly) agreed that the red bikeshed is okay,
here's a patch to fix up the window titles. I didn't just rip out
version numbers, I went through and rewrote them all to use mostly the
same format (as they're currently rather inconsistent). The new format
is "Application — file", with variants as necessary ("Application — file
[Read Only]", "Application — sheet [sheetpath] — file", etc).
There is one 'interesting' place: eeschema/backanno.cpp:236
https://github.com/KiCad/kicad-source-mirror/blob/master/eeschema/backanno.cpp#L236
I have no idea why we would want to put the .cmp file name in the
eeschema title bar in the first place, and furthermore couldn't actually
find a case where it wasn't immediately overwritten anyway. Not sure
why that's even there - I ripped it out. Let me know if anyone knows
what that's actually for...
--
Chris
>From d788d6f170add3c3862dcf536429ae2079b9548f Mon Sep 17 00:00:00 2001
From: Chris Pavlina <pavlina.chris@xxxxxxxxx>
Date: Mon, 26 Sep 2016 13:15:33 -0400
Subject: [PATCH] Unify window title formats
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Most window titles are now of the format "Application — file [info]",
with adaptations as necessary. Version information has been removed from
titles.
---
cvpcb/cvpcb_mainframe.cpp | 17 ++++----
eeschema/backanno.cpp | 3 --
eeschema/libedit.cpp | 20 +++------
eeschema/schframe.cpp | 5 +--
eeschema/viewlibs.cpp | 15 ++-----
gerbview/gerbview_frame.cpp | 82 ++++++++++++++++++-----------------
kicad/prjconfig.cpp | 2 +-
pagelayout_editor/pl_editor_frame.cpp | 6 ++-
pcbnew/moduleframe.cpp | 42 ++++++++----------
pcbnew/modview_frame.cpp | 30 +++++--------
pcbnew/pcbframe.cpp | 18 +++++---
11 files changed, 109 insertions(+), 131 deletions(-)
diff --git a/cvpcb/cvpcb_mainframe.cpp b/cvpcb/cvpcb_mainframe.cpp
index aa54eb6..e2bdb76 100644
--- a/cvpcb/cvpcb_mainframe.cpp
+++ b/cvpcb/cvpcb_mainframe.cpp
@@ -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 );
}
diff --git a/eeschema/backanno.cpp b/eeschema/backanno.cpp
index ad40412..2b23162 100644
--- a/eeschema/backanno.cpp
+++ b/eeschema/backanno.cpp
@@ -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" ) );
diff --git a/eeschema/libedit.cpp b/eeschema/libedit.cpp
index e911ded..99929d9 100644
--- a/eeschema/libedit.cpp
+++ b/eeschema/libedit.cpp
@@ -50,22 +50,12 @@
void LIB_EDIT_FRAME::DisplayLibInfos()
{
- wxString msg = _( "Part Library Editor: " );
- PART_LIB* lib = GetCurLib();
-
- if( lib )
- {
- msg += lib->GetFullFileName();
-
- if( lib->IsReadOnly() )
- msg += _( " [Read Only]" );
- }
- else
- {
- msg += _( "no library selected" );
- }
+ 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 ) );
- SetTitle( msg );
+ SetTitle( title );
}
diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp
index ad33525..bd89398 100644
--- a/eeschema/schframe.cpp
+++ b/eeschema/schframe.cpp
@@ -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() ) );
diff --git a/eeschema/viewlibs.cpp b/eeschema/viewlibs.cpp
index 520aa42..9053723 100644
--- a/eeschema/viewlibs.cpp
+++ b/eeschema/viewlibs.cpp
@@ -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 );
}
}
diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp
index 5492c9f..097f191 100644
--- a/gerbview/gerbview_frame.cpp
+++ b/gerbview/gerbview_frame.cpp
@@ -490,58 +490,62 @@ 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 );
+ SetTitle( "GerbView" );
+
SetStatusText( wxEmptyString, 0 );
- text.Printf( _( "Drawing layer %d not in use" ), getActiveLayer() + 1 );
- m_TextInfo->SetValue( text );
- if( EnsureTextCtrlWidth( m_TextInfo, &text ) ) // Resized
+ 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 );
-
- gerber->DisplayImageInfo( this );
-
- // Display Image Name and Layer Name (from the current gerber data):
- 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
- text.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" );
-
- m_TextInfo->SetValue( text );
-
- if( EnsureTextCtrlWidth( m_TextInfo, &text ) ) // Resized
- m_auimgr.Update();
+ 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):
+ wxString status;
+ status.Printf( _( "Image name: '%s' Layer name: '%s'" ),
+ GetChars( gerber->m_ImageName ),
+ GetChars( gerber->GetLayerParams().m_LayerName ) );
+ 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
+ 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 )
+ info << wxT(" ") << _( "X2 attr" );
+
+ m_TextInfo->SetValue( info );
+
+ if( EnsureTextCtrlWidth( m_TextInfo, &info ) ) // Resized
+ m_auimgr.Update();
+ }
}
@@ -874,4 +878,4 @@ void GERBVIEW_FRAME::unitsChangeRefresh()
{ // Called on units change (see EDA_DRAW_FRAME)
EDA_DRAW_FRAME::unitsChangeRefresh();
updateDCodeSelectBox();
-}
\ No newline at end of file
+}
diff --git a/kicad/prjconfig.cpp b/kicad/prjconfig.cpp
index 21aa23e..7f46d16 100644
--- a/kicad/prjconfig.cpp
+++ b/kicad/prjconfig.cpp
@@ -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]" );
diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp
index c305e79..d3d4811 100644
--- a/pagelayout_editor/pl_editor_frame.cpp
+++ b/pagelayout_editor/pl_editor_frame.cpp
@@ -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 );
}
diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp
index 5c4d6a0..25c80e3 100644
--- a/pcbnew/moduleframe.cpp
+++ b/pcbnew/moduleframe.cpp
@@ -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
- if( nickname.size() )
- {
- FP_LIB_TABLE* libtable = Prj().PcbFootprintLibs();
- const FP_LIB_TABLE::ROW* row = libtable->FindRow( nickname );
+ 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 ) << ")";
- }
+ 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 );
}
diff --git a/pcbnew/modview_frame.cpp b/pcbnew/modview_frame.cpp
index f00948a..c27843b 100644
--- a/pcbnew/modview_frame.cpp
+++ b/pcbnew/modview_frame.cpp
@@ -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 );
}
diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp
index 1824bb3..5c0175f 100644
--- a/pcbnew/pcbframe.cpp
+++ b/pcbnew/pcbframe.cpp
@@ -994,21 +994,25 @@ 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() ) );
+ wxFileName fileName = GetBoard()->GetFileName();
+ 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 );
}
--
2.10.0
Follow ups