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

View File

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

View File

@ -38,7 +38,8 @@
#include <wx_html_report_panel.h> #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_EDIT_FRAME* schframe = m_parent;
SCH_SCREEN* screen = schframe->GetScreen(); SCH_SCREEN* screen = schframe->GetScreen();
@ -75,8 +76,8 @@ void DIALOG_PLOT_SCHEMATIC::CreateDXFFile( bool aPlotAll, bool aPlotFrameRef )
wxString ext = DXF_PLOTTER::GetDefaultFileExtension(); wxString ext = DXF_PLOTTER::GetDefaultFileExtension();
wxFileName plotFileName = createPlotFileName( fname, ext, &reporter ); wxFileName plotFileName = createPlotFileName( fname, ext, &reporter );
if( PlotOneSheetDXF( plotFileName.GetFullPath(), screen, plot_offset, 1.0, if( PlotOneSheetDXF( plotFileName.GetFullPath(), screen, aRenderSettings,
aPlotFrameRef ) ) plot_offset, 1.0, aPlotFrameRef ) )
{ {
msg.Printf( _( "Plot: \"%s\" OK.\n" ), plotFileName.GetFullPath() ); msg.Printf( _( "Plot: \"%s\" OK.\n" ), plotFileName.GetFullPath() );
reporter.Report( msg, RPT_SEVERITY_ACTION ); reporter.Report( msg, RPT_SEVERITY_ACTION );
@ -104,20 +105,20 @@ void DIALOG_PLOT_SCHEMATIC::CreateDXFFile( bool aPlotAll, bool aPlotFrameRef )
} }
bool DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF( const wxString& aFileName, bool DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF( const wxString& aFileName,
SCH_SCREEN* aScreen, SCH_SCREEN* aScreen,
wxPoint aPlotOffset, RENDER_SETTINGS* aRenderSettings,
double aScale, wxPoint aPlotOffset,
bool aPlotFrameRef ) double aScale,
bool aPlotFrameRef )
{ {
KIGFX::SCH_RENDER_SETTINGS renderSettings; aRenderSettings->LoadColors( getColorSettings() );
renderSettings.LoadColors( getColorSettings() ); aRenderSettings->SetDefaultPenWidth( 0 );
renderSettings.SetDefaultPenWidth( 0 );
const PAGE_INFO& pageInfo = aScreen->GetPageSettings(); const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
DXF_PLOTTER* plotter = new DXF_PLOTTER(); DXF_PLOTTER* plotter = new DXF_PLOTTER();
plotter->SetRenderSettings( &renderSettings ); plotter->SetRenderSettings( aRenderSettings );
plotter->SetPageSettings( pageInfo ); plotter->SetPageSettings( pageInfo );
plotter->SetColorMode( getModeColor() ); plotter->SetColorMode( getModeColor() );
// Currently, plot units are in decimil // 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_SCREEN* screen = m_parent->GetScreen();
SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet(); SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet();
@ -147,8 +148,8 @@ void DIALOG_PLOT_SCHEMATIC::createHPGLFile( bool aPlotAll, bool aPlotFrameRef )
LOCALE_IO toggle; LOCALE_IO toggle;
if( Plot_1_Page_HPGL( plotFileName.GetFullPath(), screen, plotPage, plotOffset, if( Plot_1_Page_HPGL( plotFileName.GetFullPath(), screen, plotPage, aRenderSettings,
plot_scale, aPlotFrameRef ) ) plotOffset, plot_scale, aPlotFrameRef ) )
{ {
msg.Printf( _( "Plot: \"%s\" OK.\n" ), plotFileName.GetFullPath() ); msg.Printf( _( "Plot: \"%s\" OK.\n" ), plotFileName.GetFullPath() );
reporter.Report( msg, RPT_SEVERITY_ACTION ); 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, bool DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL( const wxString& aFileName,
SCH_SCREEN* aScreen, SCH_SCREEN* aScreen,
const PAGE_INFO& aPageInfo, const PAGE_INFO& aPageInfo,
RENDER_SETTINGS* aRenderSettings,
wxPoint aPlot0ffset, wxPoint aPlot0ffset,
double aScale, double aScale,
bool aPlotFrameRef ) bool aPlotFrameRef )
@ -184,6 +186,7 @@ bool DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL( const wxString& aFileName,
// Currently, plot units are in decimil // Currently, plot units are in decimil
plotter->SetPageSettings( aPageInfo ); plotter->SetPageSettings( aPageInfo );
plotter->SetRenderSettings( aRenderSettings );
plotter->RenderSettings()->LoadColors( getColorSettings() ); plotter->RenderSettings()->LoadColors( getColorSettings() );
plotter->SetColorMode( getModeColor() ); plotter->SetColorMode( getModeColor() );
plotter->SetViewport( aPlot0ffset, IU_PER_MILS/10, aScale, false ); plotter->SetViewport( aPlot0ffset, IU_PER_MILS/10, aScale, false );