diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 24b01a64c3..be21b28fdc 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -602,15 +602,25 @@ wxString SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet() wxString filename = fn.GetName(); wxString sheetFullName = g_CurrentSheet->PathHumanReadable(); - // Remove the last '/' of the path human readable - // (and for the root sheet, make sheetFullName empty): - sheetFullName.RemoveLast(); + if( sheetFullName == "" ) + { + // 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; diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index e1704b6527..c6bfe3283d 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -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 @@ -927,7 +927,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 ); @@ -939,7 +939,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 );