Gerbview: Avoid too long filenames in layer manager: the filename length is clamped to 30 chars.

This commit is contained in:
jean-pierre charras 2016-05-23 20:30:23 +02:00
parent dbb78db7ef
commit ac734ab54b
1 changed files with 12 additions and 2 deletions

View File

@ -467,13 +467,23 @@ const wxString GERBER_IMAGE_LIST::GetDisplayName( int aIdx )
if( gerber && IsUsed(aIdx ) )
{
wxFileName fn( gerber->m_FileName );
wxString filename = fn.GetFullName();
// if the filename is too long, display a shortened name:
const int maxlen = 30;
if( filename.Length() > maxlen )
{
wxString shortenedfn = filename.Left(2) + "..." + filename.Right(maxlen-5);
filename = shortenedfn;
}
if( gerber->m_FileFunction )
{
if( gerber->m_FileFunction->IsCopper() )
{
name.Printf( "%d %s (%s, %s, %s)", aIdx + 1,
fn.GetFullName().GetData(),
filename.GetData(),
GetChars( gerber->m_FileFunction->GetFileType() ),
GetChars( gerber->m_FileFunction->GetBrdLayerId() ),
GetChars( gerber->m_FileFunction->GetBrdLayerSide() ) );
@ -481,7 +491,7 @@ const wxString GERBER_IMAGE_LIST::GetDisplayName( int aIdx )
else
{
name.Printf( "%d %s (%s, %s)", aIdx + 1,
fn.GetFullName().GetData(),
filename.GetData(),
GetChars( gerber->m_FileFunction->GetFileType() ),
GetChars( gerber->m_FileFunction->GetBrdLayerId() ) );
}