Plot sheet background colors if present

Fixes https://gitlab.com/kicad/code/kicad/-/issues/4697
This commit is contained in:
Jon Evans 2020-06-21 20:43:47 -04:00
parent c0175c48af
commit 202b55f4d2
3 changed files with 31 additions and 10 deletions

View File

@ -262,23 +262,30 @@ void DIALOG_PLOT_SCHEMATIC::getPlotOptions( RENDER_SETTINGS* aSettings )
EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
wxASSERT( cfg );
COLOR_SETTINGS* colors = getColorSettings();
if( cfg )
{
cfg->m_PlotPanel.background_color = m_plotBackgroundColor->GetValue();
cfg->m_PlotPanel.color = getModeColor();
cfg->m_PlotPanel.color_theme = getColorSettings()->GetFilename();
cfg->m_PlotPanel.frame_reference = getPlotFrameRef();
cfg->m_PlotPanel.format = static_cast<int>( GetPlotFileFormat() );
cfg->m_PlotPanel.hpgl_origin = GetPlotOriginCenter();
cfg->m_PlotPanel.hpgl_paper_size = m_HPGLPaperSizeSelect;
cfg->m_PlotPanel.color = getModeColor();
cfg->m_PlotPanel.color_theme = colors->GetFilename();
cfg->m_PlotPanel.frame_reference = getPlotFrameRef();
cfg->m_PlotPanel.format = static_cast<int>( GetPlotFileFormat() );
cfg->m_PlotPanel.hpgl_origin = GetPlotOriginCenter();
cfg->m_PlotPanel.hpgl_paper_size = m_HPGLPaperSizeSelect;
// HPGL Pen Size is stored in mm in config
cfg->m_PlotPanel.hpgl_pen_size = m_HPGLPenSize / IU_PER_MM;
}
aSettings->LoadColors( getColorSettings() );
aSettings->LoadColors( colors );
aSettings->SetDefaultPenWidth( (int) m_defaultLineWidth.GetValue() );
if( m_plotBackgroundColor->GetValue() )
aSettings->SetBackgroundColor( colors->GetColor( LAYER_SCHEMATIC_BACKGROUND ) );
else
aSettings->SetBackgroundColor( COLOR4D::UNSPECIFIED );
// Plot directory
wxString path = m_outputDirectoryName->GetValue();
path.Replace( '\\', '/' );

View File

@ -151,7 +151,7 @@ void DIALOG_PLOT_SCHEMATIC::plotOneSheetPDF( PLOTTER* aPlotter,
{
if( m_plotBackgroundColor->GetValue() )
{
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
aPlotter->SetColor( aPlotter->RenderSettings()->GetBackgroundColor() );
wxPoint end( aPlotter->PageSettings().GetWidthIU(),
aPlotter->PageSettings().GetHeightIU() );
aPlotter->Rect( wxPoint( 0, 0 ), end, FILLED_SHAPE, 1.0 );

View File

@ -34,6 +34,7 @@
#include <sch_sheet.h>
#include <sch_sheet_path.h>
#include <sch_component.h>
#include <sch_painter.h>
#include <schematic.h>
#include <settings/color_settings.h>
#include <netlist_object.h>
@ -963,11 +964,24 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter )
wxString Text;
wxPoint pos;
COLOR4D borderColor = GetBorderColor();
bool override = false;
if( borderColor == COLOR4D::UNSPECIFIED )
if( KIGFX::SCH_RENDER_SETTINGS* settings =
dynamic_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() ) )
override = settings->m_OverrideItemColors;
COLOR4D borderColor = GetBorderColor();
COLOR4D backgroundColor = GetBackgroundColor();
if( override || borderColor == COLOR4D::UNSPECIFIED )
borderColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_SHEET );
if( override || backgroundColor == COLOR4D::UNSPECIFIED )
backgroundColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_SHEET_BACKGROUND );
aPlotter->SetColor( backgroundColor );
aPlotter->Rect( m_pos, m_pos + m_size, FILLED_SHAPE, 1.0 );
aPlotter->SetColor( borderColor );
int penWidth = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetDefaultPenWidth() );