Make sure all plotters have a RENDER_SETTINGS.

Fixes https://gitlab.com/kicad/code/kicad/issues/4556
This commit is contained in:
Jeff Young 2020-05-28 20:16:05 +01:00
parent 8d92a95cb8
commit 790b061b8b
4 changed files with 25 additions and 20 deletions

View File

@ -321,7 +321,7 @@ void DIALOG_PLOT_SCHEMATIC::PlotSchematic( bool aPlotAll )
createPSFile( aPlotAll, getPlotFrameRef(), &renderSettings );
break;
case PLOT_FORMAT::DXF:
CreateDXFFile( aPlotAll, getPlotFrameRef() );
CreateDXFFile( aPlotAll, getPlotFrameRef(), &renderSettings );
break;
case PLOT_FORMAT::PDF:
createPDFFile( aPlotAll, getPlotFrameRef(), &renderSettings );
@ -330,7 +330,7 @@ void DIALOG_PLOT_SCHEMATIC::PlotSchematic( bool aPlotAll )
createSVGFile( aPlotAll, getPlotFrameRef(), &renderSettings );
break;
case PLOT_FORMAT::HPGL:
createHPGLFile( aPlotAll, getPlotFrameRef() );
createHPGLFile( aPlotAll, getPlotFrameRef(), &renderSettings );
break;
}
}

View File

@ -106,8 +106,9 @@ private:
void restoreEnvironment( PDF_PLOTTER* aPlotter, SCH_SHEET_PATH& aOldsheetpath );
// DXF
void CreateDXFFile( bool aPlotAll, bool aPlotFrameRef );
void CreateDXFFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aRenderSettings );
bool PlotOneSheetDXF( const wxString& aFileName, SCH_SCREEN* aScreen,
RENDER_SETTINGS* aRenderSettings,
wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef );
// HPGL
@ -121,10 +122,10 @@ private:
m_plotOriginOpt->SetSelection( aCenter ? 1 : 0 );
}
void createHPGLFile( bool aPlotAll, bool aPlotFrameRef );
void createHPGLFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aRenderSettings );
void SetHPGLPenWidth();
bool Plot_1_Page_HPGL( const wxString& aFileName, SCH_SCREEN* aScreen,
const PAGE_INFO& aPageInfo,
const PAGE_INFO& aPageInfo, RENDER_SETTINGS* aRenderSettings,
wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef );
// PS

View File

@ -38,7 +38,8 @@
#include <wx_html_report_panel.h>
void DIALOG_PLOT_SCHEMATIC::CreateDXFFile( bool aPlotAll, bool aPlotFrameRef )
void DIALOG_PLOT_SCHEMATIC::CreateDXFFile( bool aPlotAll, bool aPlotFrameRef,
RENDER_SETTINGS* aRenderSettings )
{
SCH_EDIT_FRAME* schframe = m_parent;
SCH_SCREEN* screen = schframe->GetScreen();
@ -75,8 +76,8 @@ void DIALOG_PLOT_SCHEMATIC::CreateDXFFile( bool aPlotAll, bool aPlotFrameRef )
wxString ext = DXF_PLOTTER::GetDefaultFileExtension();
wxFileName plotFileName = createPlotFileName( fname, ext, &reporter );
if( PlotOneSheetDXF( plotFileName.GetFullPath(), screen, plot_offset, 1.0,
aPlotFrameRef ) )
if( PlotOneSheetDXF( plotFileName.GetFullPath(), screen, aRenderSettings,
plot_offset, 1.0, aPlotFrameRef ) )
{
msg.Printf( _( "Plot: \"%s\" OK.\n" ), plotFileName.GetFullPath() );
reporter.Report( msg, RPT_SEVERITY_ACTION );
@ -106,18 +107,18 @@ void DIALOG_PLOT_SCHEMATIC::CreateDXFFile( bool aPlotAll, bool aPlotFrameRef )
bool DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF( const wxString& aFileName,
SCH_SCREEN* aScreen,
RENDER_SETTINGS* aRenderSettings,
wxPoint aPlotOffset,
double aScale,
bool aPlotFrameRef )
{
KIGFX::SCH_RENDER_SETTINGS renderSettings;
renderSettings.LoadColors( getColorSettings() );
renderSettings.SetDefaultPenWidth( 0 );
aRenderSettings->LoadColors( getColorSettings() );
aRenderSettings->SetDefaultPenWidth( 0 );
const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
DXF_PLOTTER* plotter = new DXF_PLOTTER();
plotter->SetRenderSettings( &renderSettings );
plotter->SetRenderSettings( aRenderSettings );
plotter->SetPageSettings( pageInfo );
plotter->SetColorMode( getModeColor() );
// Currently, plot units are in decimil

View File

@ -85,7 +85,8 @@ void DIALOG_PLOT_SCHEMATIC::SetHPGLPenWidth()
}
void DIALOG_PLOT_SCHEMATIC::createHPGLFile( bool aPlotAll, bool aPlotFrameRef )
void DIALOG_PLOT_SCHEMATIC::createHPGLFile( bool aPlotAll, bool aPlotFrameRef,
RENDER_SETTINGS* aRenderSettings )
{
SCH_SCREEN* screen = m_parent->GetScreen();
SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet();
@ -147,8 +148,8 @@ void DIALOG_PLOT_SCHEMATIC::createHPGLFile( bool aPlotAll, bool aPlotFrameRef )
LOCALE_IO toggle;
if( Plot_1_Page_HPGL( plotFileName.GetFullPath(), screen, plotPage, plotOffset,
plot_scale, aPlotFrameRef ) )
if( Plot_1_Page_HPGL( plotFileName.GetFullPath(), screen, plotPage, aRenderSettings,
plotOffset, plot_scale, aPlotFrameRef ) )
{
msg.Printf( _( "Plot: \"%s\" OK.\n" ), plotFileName.GetFullPath() );
reporter.Report( msg, RPT_SEVERITY_ACTION );
@ -176,6 +177,7 @@ void DIALOG_PLOT_SCHEMATIC::createHPGLFile( bool aPlotAll, bool aPlotFrameRef )
bool DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL( const wxString& aFileName,
SCH_SCREEN* aScreen,
const PAGE_INFO& aPageInfo,
RENDER_SETTINGS* aRenderSettings,
wxPoint aPlot0ffset,
double aScale,
bool aPlotFrameRef )
@ -184,6 +186,7 @@ bool DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL( const wxString& aFileName,
// Currently, plot units are in decimil
plotter->SetPageSettings( aPageInfo );
plotter->SetRenderSettings( aRenderSettings );
plotter->RenderSettings()->LoadColors( getColorSettings() );
plotter->SetColorMode( getModeColor() );
plotter->SetViewport( aPlot0ffset, IU_PER_MILS/10, aScale, false );