From d6a4ab0eecb4c14c424411f28ab57110c059cdc2 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 3 Sep 2020 06:36:03 -0700 Subject: [PATCH] Shortening filenames in titlebar Fixes https://gitlab.com/kicad/code/kicad/-/issues/2096 --- eeschema/sch_edit_frame.cpp | 2 +- gerbview/gerbview_frame.cpp | 4 +++- pagelayout_editor/pl_editor_frame.cpp | 4 ++-- pcbnew/pcb_edit_frame.cpp | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index c036935023..d74b837da0 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -1116,7 +1116,7 @@ void SCH_EDIT_FRAME::UpdateTitle() append = _( "[no file] " ); title.Printf( wxT( "%s [%s] \u2014 %s %s\u2014 " ) + _( "Eeschema" ), - fn.GetFullName(), + fn.GetName(), GetCurrentSheet().PathHumanReadable(), fn.GetPath(), append ); diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 61b9f5919e..3c1c258ebb 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -714,8 +714,10 @@ void GERBVIEW_FRAME::UpdateTitleAndInfo() else { wxString title; + wxFileName filename( gerber->m_FileName ); + title.Printf( wxT( "%s%s \u2014 " ) + _( "GerbView" ), - gerber->m_FileName, + filename.GetFullName(), gerber->m_IsX2_file ? _( " (with X2 attributes)" ) : wxString( wxEmptyString ) ); SetTitle( title ); diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp index 3dc7e9f08e..cc93382b9f 100644 --- a/pagelayout_editor/pl_editor_frame.cpp +++ b/pagelayout_editor/pl_editor_frame.cpp @@ -529,10 +529,10 @@ void PL_EDITOR_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg ) void PL_EDITOR_FRAME::UpdateTitleAndInfo() { wxString title; - wxString file = GetCurrentFileName(); + wxFileName file( GetCurrentFileName() ); title.Printf( wxT( "%s \u2014 " ) + _( "Page Layout Editor" ), - file.Length() ? file : _( "no file selected" ) ); + file.IsOk() ? file.GetName() : _( "no file selected" ) ); SetTitle( title ); } diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 6d7ccbba1d..71e70e2179 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -1155,7 +1155,7 @@ void PCB_EDIT_FRAME::UpdateTitle() fileinfo = _( " [Unsaved]" ); SetTitle( wxString::Format( wxT( "%s%s \u2014 " ) + _( "Pcbnew" ), - fileName.GetFullPath(), + fileName.GetName(), fileinfo ) ); }