Make sure Gerber print options have a color settings.

We probably don't need it, but some code attempts to dereference
it so safer to have one then to start checking everywhere for
dereferences.

Fixes https://gitlab.com/kicad/code/kicad/issues/5353
This commit is contained in:
Jeff Young 2020-08-25 14:07:18 +01:00
parent d02ce77bee
commit d1371e513d
4 changed files with 12 additions and 8 deletions

View File

@ -66,7 +66,8 @@ void BOARD_PRINTOUT_SETTINGS::Save( APP_SETTINGS_BASE* aConfig )
BOARD_PRINTOUT::BOARD_PRINTOUT( const BOARD_PRINTOUT_SETTINGS& aParams, BOARD_PRINTOUT::BOARD_PRINTOUT( const BOARD_PRINTOUT_SETTINGS& aParams,
const KIGFX::VIEW* aView, const wxString& aTitle ) : const KIGFX::VIEW* aView, const wxString& aTitle ) :
wxPrintout( aTitle ), m_settings( aParams ) wxPrintout( aTitle ),
m_settings( aParams )
{ {
m_view = aView; m_view = aView;
} }

View File

@ -28,7 +28,9 @@ static constexpr double MIN_SCALE = 0.01;
static constexpr double MAX_SCALE = 100.0; static constexpr double MAX_SCALE = 100.0;
DIALOG_PRINT_GENERIC::DIALOG_PRINT_GENERIC( EDA_DRAW_FRAME* aParent, PRINTOUT_SETTINGS* aSettings ) DIALOG_PRINT_GENERIC::DIALOG_PRINT_GENERIC( EDA_DRAW_FRAME* aParent, PRINTOUT_SETTINGS* aSettings )
: DIALOG_PRINT_GENERIC_BASE( aParent ), m_config( nullptr ), m_settings( aSettings ) : DIALOG_PRINT_GENERIC_BASE( aParent ),
m_config( nullptr ),
m_settings( aSettings )
{ {
// Note: for the validator, min value is 0.0, to allow typing values like 0.5 // Note: for the validator, min value is 0.0, to allow typing values like 0.5
// that start by 0 // that start by 0

View File

@ -102,8 +102,10 @@ private:
}; };
DIALOG_PRINT_GERBVIEW::DIALOG_PRINT_GERBVIEW( GERBVIEW_FRAME* aParent, BOARD_PRINTOUT_SETTINGS* aSettings ) : DIALOG_PRINT_GERBVIEW::DIALOG_PRINT_GERBVIEW( GERBVIEW_FRAME* aParent,
DIALOG_PRINT_GENERIC( aParent, aSettings ), m_parent( aParent ) BOARD_PRINTOUT_SETTINGS* aSettings ) :
DIALOG_PRINT_GENERIC( aParent, aSettings ),
m_parent( aParent )
{ {
m_config = Kiface().KifaceSettings(); m_config = Kiface().KifaceSettings();
@ -307,6 +309,7 @@ int GERBVIEW_CONTROL::Print( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( GERBVIEW_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( GERBVIEW_ACTIONS::selectionClear, true );
BOARD_PRINTOUT_SETTINGS settings( m_frame->GetPageSettings() ); BOARD_PRINTOUT_SETTINGS settings( m_frame->GetPageSettings() );
settings.m_colorSettings = m_frame->GetColorSettings();
DIALOG_PRINT_GERBVIEW dlg( m_frame, &settings ); DIALOG_PRINT_GERBVIEW dlg( m_frame, &settings );
dlg.ForcePrintBorder( false ); dlg.ForcePrintBorder( false );
dlg.ShowModal(); dlg.ShowModal();

View File

@ -23,7 +23,6 @@
*/ */
#include <fctsys.h> #include <fctsys.h>
#include <pgm_base.h>
#include <gr_basic.h> #include <gr_basic.h>
#include <base_units.h> #include <base_units.h>
#include <base_screen.h> #include <base_screen.h>
@ -31,7 +30,6 @@
#include <gerber_file_image.h> #include <gerber_file_image.h>
#include <gerber_file_image_list.h> #include <gerber_file_image_list.h>
#include "gerbview_printout.h" #include "gerbview_printout.h"
#include <gal/gal_print.h>
#include <view/view.h> #include <view/view.h>
#include <gerbview_painter.h> #include <gerbview_painter.h>
#include <math/util.h> // for KiROUND #include <math/util.h> // for KiROUND