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:
parent
b32439a694
commit
aa3aafc4ff
|
@ -742,15 +742,25 @@ wxString SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet()
|
||||||
wxString filename = fn.GetName();
|
wxString filename = fn.GetName();
|
||||||
wxString sheetFullName = m_CurrentSheet->PathHumanReadable();
|
wxString sheetFullName = m_CurrentSheet->PathHumanReadable();
|
||||||
|
|
||||||
// Remove the last '/' of the path human readable
|
if( sheetFullName == "<root sheet>" )
|
||||||
// (and for the root sheet, make sheetFullName empty):
|
{
|
||||||
sheetFullName.RemoveLast();
|
// For the root sheet, use root schematic file name.
|
||||||
|
sheetFullName.clear();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( filename.Last() != '-' || filename.Last() != '_' )
|
||||||
|
filename += '-';
|
||||||
|
|
||||||
sheetFullName.Trim( true );
|
// Remove the first and last '/' of the path human readable
|
||||||
sheetFullName.Trim( false );
|
sheetFullName.RemoveLast();
|
||||||
|
sheetFullName.Remove( 0, 1 );
|
||||||
|
sheetFullName.Trim( true );
|
||||||
|
sheetFullName.Trim( false );
|
||||||
|
|
||||||
// Convert path human readable separator to '-'
|
// Convert path human readable separator to '-'
|
||||||
sheetFullName.Replace( wxT( "/" ), wxT( "-" ) );
|
sheetFullName.Replace( "/", "-" );
|
||||||
|
}
|
||||||
|
|
||||||
if( ( filename.Len() + sheetFullName.Len() ) < FN_LEN_MAX )
|
if( ( filename.Len() + sheetFullName.Len() ) < FN_LEN_MAX )
|
||||||
filename += sheetFullName;
|
filename += sheetFullName;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* 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) 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
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* 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 ) );
|
aPlotter->SetColor( GetLayerColor( LAYER_SHEETNAME ) );
|
||||||
|
|
||||||
bool italic = false;
|
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,
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM,
|
||||||
thickness, italic, false );
|
thickness, italic, false );
|
||||||
|
|
||||||
|
@ -996,7 +996,7 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter )
|
||||||
|
|
||||||
aPlotter->SetColor( GetLayerColor( LAYER_SHEETFILENAME ) );
|
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,
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP,
|
||||||
thickness, italic, false );
|
thickness, italic, false );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue