Fix missing initialization of colors settings of a board, when created by a python script.
A pointer was not initialized, therefore plots from a python script sometimes crash. Fixes: lp:1721166 https://bugs.launchpad.net/kicad/+bug/1721166
This commit is contained in:
parent
d6c0d320db
commit
246f8cae24
|
@ -61,10 +61,10 @@ static const EDA_COLOR_T default_layer_color[] = {
|
||||||
LIGHTGRAY, BLUE, GREEN, YELLOW, // Dwgs_User, Cmts_User, Eco1_User, Eco2_User
|
LIGHTGRAY, BLUE, GREEN, YELLOW, // Dwgs_User, Cmts_User, Eco1_User, Eco2_User
|
||||||
|
|
||||||
// Special layers
|
// Special layers
|
||||||
YELLOW, // Edge_Cuts
|
YELLOW, // Edge_Cuts
|
||||||
LIGHTMAGENTA, // Margin
|
LIGHTMAGENTA, // Margin
|
||||||
DARKGRAY, LIGHTGRAY, // B_CrtYd, F_CrtYd,
|
DARKGRAY, LIGHTGRAY, // B_CrtYd, F_CrtYd,
|
||||||
BLUE, DARKGRAY // B_Fab, F_Fab
|
BLUE, DARKGRAY // B_Fab, F_Fab
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,12 @@
|
||||||
*/
|
*/
|
||||||
wxPoint BOARD_ITEM::ZeroOffset( 0, 0 );
|
wxPoint BOARD_ITEM::ZeroOffset( 0, 0 );
|
||||||
|
|
||||||
|
// this is a dummy colors settings (defined colors are the vdefulat values)
|
||||||
|
// used to initialize the board.
|
||||||
|
// these settings will be overriden later, depending on the draw frame that displays the board.
|
||||||
|
// However, when a board is created by a python script, outside a frame, the colors must be set
|
||||||
|
// so dummyColorsSettings provide this default initialization
|
||||||
|
static COLORS_DESIGN_SETTINGS dummyColorsSettings( FRAME_PCB );
|
||||||
|
|
||||||
BOARD::BOARD() :
|
BOARD::BOARD() :
|
||||||
BOARD_ITEM_CONTAINER( (BOARD_ITEM*) NULL, PCB_T ),
|
BOARD_ITEM_CONTAINER( (BOARD_ITEM*) NULL, PCB_T ),
|
||||||
|
@ -74,6 +80,7 @@ BOARD::BOARD() :
|
||||||
// we have not loaded a board yet, assume latest until then.
|
// we have not loaded a board yet, assume latest until then.
|
||||||
m_fileFormatVersionAtLoad = LEGACY_BOARD_FILE_VERSION;
|
m_fileFormatVersionAtLoad = LEGACY_BOARD_FILE_VERSION;
|
||||||
|
|
||||||
|
m_colorsSettings = &dummyColorsSettings;
|
||||||
m_Status_Pcb = 0; // Status word: bit 1 = calculate.
|
m_Status_Pcb = 0; // Status word: bit 1 = calculate.
|
||||||
m_CurrentZoneContour = NULL; // This ZONE_CONTAINER handle the
|
m_CurrentZoneContour = NULL; // This ZONE_CONTAINER handle the
|
||||||
// zone contour currently in progress
|
// zone contour currently in progress
|
||||||
|
|
|
@ -57,8 +57,12 @@
|
||||||
COLOR4D BRDITEMS_PLOTTER::getColor( LAYER_NUM aLayer )
|
COLOR4D BRDITEMS_PLOTTER::getColor( LAYER_NUM aLayer )
|
||||||
{
|
{
|
||||||
COLOR4D color = m_board->Colors().GetLayerColor( ToLAYER_ID( aLayer ) );
|
COLOR4D color = m_board->Colors().GetLayerColor( ToLAYER_ID( aLayer ) );
|
||||||
|
|
||||||
|
// A hack to avoid plotting ahite itmen in white color, expecting the paper
|
||||||
|
// is also white: use a non white color:
|
||||||
if( color == COLOR4D::WHITE )
|
if( color == COLOR4D::WHITE )
|
||||||
color = COLOR4D( LIGHTGRAY );
|
color = COLOR4D( LIGHTGRAY );
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue