From 52aa4ecdf4da756f96d578074ac4fa7c5fff83aa Mon Sep 17 00:00:00 2001 From: Chris Pavlina 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 | 22 +++----- eeschema/schframe.cpp | 5 +- eeschema/viewlibs.cpp | 17 ++----- gerbview/gerbview_frame.cpp | 72 ++++++++++++++------------- kicad/prjconfig.cpp | 4 +- pagelayout_editor/pl_editor_frame.cpp | 6 ++- pcbnew/moduleframe.cpp | 46 ++++++++--------- pcbnew/modview_frame.cpp | 32 +++++------- pcbnew/pcbframe.cpp | 18 ++++--- 11 files changed, 110 insertions(+), 132 deletions(-) diff --git a/cvpcb/cvpcb_mainframe.cpp b/cvpcb/cvpcb_mainframe.cpp index aa54eb6719..e2bdb76433 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 ad40412c66..2b23162b44 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 e911ded91b..f65cbbb993 100644 --- a/eeschema/libedit.cpp +++ b/eeschema/libedit.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2008-2013 Wayne Stambaugh - * 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(); + 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 ); } diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index ad33525205..bd89398d65 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 520aa422ce..7491975b5f 100644 --- a/eeschema/viewlibs.cpp +++ b/eeschema/viewlibs.cpp @@ -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 ); } } diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 5492c9fa96..097f191625 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 ); - 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; } + 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:" ); - text << wxT( " " ) << gerber->m_FileName; + gerber->DisplayImageInfo( this ); - if( gerber->m_IsX2_file ) - text << wxT( " " ) << _( "(with X2 Attributes)" ); + // 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 ); - 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): - text.Printf( _( "Image name: '%s' Layer name: '%s'" ), - GetChars( gerber->m_ImageName ), - GetChars( gerber->GetLayerParams().m_LayerName ) ); - SetStatusText( text, 0 ); + m_TextInfo->SetValue( info ); - // 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(); + 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 21aa23ebf0..a74f1df7d5 100644 --- a/kicad/prjconfig.cpp +++ b/kicad/prjconfig.cpp @@ -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]" ); diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp index c305e7948a..58d83b5ce6 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 5c4d6a0aa2..25c80e356e 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 ); - - 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 ); } diff --git a/pcbnew/modview_frame.cpp b/pcbnew/modview_frame.cpp index f00948accf..6688dd3ea5 100644 --- a/pcbnew/modview_frame.cpp +++ b/pcbnew/modview_frame.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2012-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2008-2015 Wayne Stambaugh - * 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 ); } diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 1824bb3351..5c0175f41c 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 ); }