eeschema: set title of plotted pdf to sheet title

Fixes: lp:1656956
https://bugs.launchpad.net/kicad/+bug/1656956
This commit is contained in:
Robbert Lagerweij 2017-01-20 22:00:20 +01:00 committed by Chris Pavlina
parent 2de913797a
commit 550a1ea4d6
3 changed files with 17 additions and 2 deletions

View File

@ -7,7 +7,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) 1992-2012 Lorenzo Marcantonio, l.marcantonio@logossrl.com * Copyright (C) 1992-2012 Lorenzo Marcantonio, l.marcantonio@logossrl.com
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2017 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
@ -692,6 +692,14 @@ bool PDF_PLOTTER::EndPlot()
time_t ltime = time( NULL ); time_t ltime = time( NULL );
strftime( date_buf, 250, "D:%Y%m%d%H%M%S", strftime( date_buf, 250, "D:%Y%m%d%H%M%S",
localtime( &ltime ) ); localtime( &ltime ) );
if( title.IsEmpty() )
{
// Windows uses '\' and other platforms ue '/' as sepatator
title = filename.AfterLast('\\');
title = title.AfterLast('/');
}
fprintf( outputFile, fprintf( outputFile,
"<<\n" "<<\n"
"/Producer (KiCAD PDF)\n" "/Producer (KiCAD PDF)\n"
@ -701,7 +709,7 @@ bool PDF_PLOTTER::EndPlot()
"/Trapped false\n", "/Trapped false\n",
date_buf, date_buf,
TO_UTF8( creator ), TO_UTF8( creator ),
TO_UTF8( filename ) ); TO_UTF8( title ) );
fputs( ">>\n", outputFile ); fputs( ">>\n", outputFile );
closePdfObject(); closePdfObject();

View File

@ -62,6 +62,7 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef )
plotter->SetDefaultLineWidth( GetDefaultLineThickness() ); plotter->SetDefaultLineWidth( GetDefaultLineThickness() );
plotter->SetColorMode( getModeColor() ); plotter->SetColorMode( getModeColor() );
plotter->SetCreator( wxT( "Eeschema-PDF" ) ); plotter->SetCreator( wxT( "Eeschema-PDF" ) );
plotter->SetTitle( m_parent->GetTitleBlock().GetTitle() );
wxString msg; wxString msg;
wxFileName plotFileName; wxFileName plotFileName;

View File

@ -153,6 +153,11 @@ public:
creator = aCreator; creator = aCreator;
} }
virtual void SetTitle( const wxString& aTitle )
{
title = aTitle;
}
/** /**
* Function AddLineToHeader * Function AddLineToHeader
* Add a line to the list of free lines to print at the beginning of the file * Add a line to the list of free lines to print at the beginning of the file
@ -539,6 +544,7 @@ protected: // variables used in most of plotters:
wxPoint penLastpos; wxPoint penLastpos;
wxString creator; wxString creator;
wxString filename; wxString filename;
wxString title;
PAGE_INFO pageInfo; PAGE_INFO pageInfo;
/// Paper size in IU - not in mils /// Paper size in IU - not in mils
wxSize paperSize; wxSize paperSize;