Eeschema, Plot dialog: add Plot directory selection. The patch from [email protected] was widely used.
This commit is contained in:
committed by
jean-pierre charras
parent
fa96780798
commit
ad645abac4
@@ -60,7 +60,8 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef )
|
||||
plotter->SetCreator( wxT( "Eeschema-PDF" ) );
|
||||
|
||||
wxString msg;
|
||||
wxString plotFileName;
|
||||
wxFileName plotFileName;
|
||||
WX_TEXT_CTRL_REPORTER reporter(m_MessagesBox);
|
||||
|
||||
// First page handling is different
|
||||
bool first_page = true;
|
||||
@@ -86,24 +87,37 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef )
|
||||
|
||||
if( first_page )
|
||||
{
|
||||
plotFileName = m_parent->GetUniqueFilenameForCurrentSheet() + wxT( "." )
|
||||
+ PDF_PLOTTER::GetDefaultFileExtension();
|
||||
|
||||
plotFileName = Prj().AbsolutePath( plotFileName );
|
||||
|
||||
if( !plotter->OpenFile( plotFileName ) )
|
||||
try
|
||||
{
|
||||
msg.Printf( _( "Unable to create <%s>\n" ), GetChars( plotFileName ) );
|
||||
m_MessagesBox->AppendText( msg );
|
||||
delete plotter;
|
||||
wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
|
||||
wxString ext = PDF_PLOTTER::GetDefaultFileExtension();
|
||||
plotFileName = createPlotFileName( m_outputDirectoryName,
|
||||
fname, ext, &reporter );
|
||||
|
||||
if( !plotter->OpenFile( plotFileName.GetFullPath() ) )
|
||||
{
|
||||
msg.Printf( _( "Unable to create '%s'\n" ), GetChars( plotFileName.GetFullPath() ) );
|
||||
m_MessagesBox->AppendText( msg );
|
||||
delete plotter;
|
||||
return;
|
||||
}
|
||||
|
||||
// Open the plotter and do the first page
|
||||
SetLocaleTo_C_standard();
|
||||
setupPlotPagePDF( plotter, screen );
|
||||
plotter->StartPlot();
|
||||
first_page = false;
|
||||
|
||||
}
|
||||
catch (const IO_ERROR& e)
|
||||
{
|
||||
// Cannot plot PDF file
|
||||
msg.Printf( _( "PDF Plotter Exception : <%s>"), wxString(e.errorText ) );
|
||||
restoreEnvironment(plotter, oldsheetpath, msg);
|
||||
return;
|
||||
}
|
||||
|
||||
// Open the plotter and do the first page
|
||||
SetLocaleTo_C_standard();
|
||||
setupPlotPagePDF( plotter, screen );
|
||||
plotter->StartPlot();
|
||||
first_page = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -118,17 +132,25 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef )
|
||||
} while( aPlotAll && sheetpath );
|
||||
|
||||
// Everything done, close the plot and restore the environment
|
||||
plotter->EndPlot();
|
||||
delete plotter;
|
||||
msg.Printf( _( "Plot: <%s> OK\n" ), GetChars( plotFileName.GetFullPath() ) );
|
||||
restoreEnvironment(plotter, oldsheetpath, msg);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PLOT_SCHEMATIC::restoreEnvironment( PDF_PLOTTER* aPlotter,
|
||||
SCH_SHEET_PATH aOldsheetpath, const wxString& aMsg )
|
||||
{
|
||||
aPlotter->EndPlot();
|
||||
delete aPlotter;
|
||||
SetLocaleTo_Default();
|
||||
|
||||
// Restore the previous sheet
|
||||
m_parent->SetCurrentSheet( oldsheetpath );
|
||||
m_parent->SetCurrentSheet( aOldsheetpath );
|
||||
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
|
||||
m_parent->SetSheetNumberAndCount();
|
||||
|
||||
msg.Printf( _( "Plot: <%s> OK\n" ), GetChars( plotFileName ) );
|
||||
m_MessagesBox->AppendText( msg );
|
||||
m_MessagesBox->AppendText( aMsg );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user