Eeschema: fix sheet plotting bug.

Prefix the sheet name with "Sheet: " and the sheet file name with "File: "
when plotting so that it matches the display sheet rendering.

Improve the root sheet plot file name.

Fixes lp:1832081

https://bugs.launchpad.net/kicad/+bug/1832081
(cherry picked from commit 7235da0979)
This commit is contained in:
Wayne Stambaugh 2019-06-17 17:01:05 -04:00
parent b32439a694
commit aa3aafc4ff
2 changed files with 20 additions and 10 deletions

View File

@ -742,15 +742,25 @@ wxString SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet()
wxString filename = fn.GetName();
wxString sheetFullName = m_CurrentSheet->PathHumanReadable();
// Remove the last '/' of the path human readable
// (and for the root sheet, make sheetFullName empty):
sheetFullName.RemoveLast();
if( sheetFullName == "<root sheet>" )
{
// For the root sheet, use root schematic file name.
sheetFullName.clear();
}
else
{
if( filename.Last() != '-' || filename.Last() != '_' )
filename += '-';
sheetFullName.Trim( true );
sheetFullName.Trim( false );
// Remove the first and last '/' of the path human readable
sheetFullName.RemoveLast();
sheetFullName.Remove( 0, 1 );
sheetFullName.Trim( true );
sheetFullName.Trim( false );
// Convert path human readable separator to '-'
sheetFullName.Replace( wxT( "/" ), wxT( "-" ) );
// Convert path human readable separator to '-'
sheetFullName.Replace( "/", "-" );
}
if( ( filename.Len() + sheetFullName.Len() ) < FN_LEN_MAX )
filename += sheetFullName;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2017 Kicad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2019 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
@ -984,7 +984,7 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter )
aPlotter->SetColor( GetLayerColor( LAYER_SHEETNAME ) );
bool italic = false;
aPlotter->Text( pos_sheetname, txtcolor, Text, name_orientation, size,
aPlotter->Text( pos_sheetname, txtcolor, wxT( "Sheet: " ) + Text, name_orientation, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM,
thickness, italic, false );
@ -996,7 +996,7 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter )
aPlotter->SetColor( GetLayerColor( LAYER_SHEETFILENAME ) );
aPlotter->Text( pos_filename, txtcolor, Text, name_orientation, size,
aPlotter->Text( pos_filename, txtcolor, wxT( "File: " ) + Text, name_orientation, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP,
thickness, italic, false );