Pcbnew: fix bug in D_PAD ctor: m_LengthDie not initialized. Disable m_LengthDie read from .brd files,

because this bug breaks compatibility with older version of Pcbnew , and the stored value as most of time no sense.
To enable m_LengthDie reading, see class_pad.cpp
This commit is contained in:
jean-pierre charras 2011-07-07 12:22:46 +02:00
parent c50efb48d1
commit a32b974fcb
1 changed files with 10 additions and 2 deletions

View File

@ -10,11 +10,16 @@
#include "pcbnew.h"
#include "trigo.h"
#include "pcbnew_id.h" // ID_TRACK_BUTT
#include "pcbnew_id.h" // ID_TRACK_BUTT
#include "class_board_design_settings.h"
#include "richio.h"
int D_PAD::m_PadSketchModePenSize = 0; // Pen size used to draw pads in sketch mode
// Due to a bug in previous versions ( m_LengthDie not initialized in D_PAD ctor)
// m_LengthDie is no more read from .brd files
// Uncomment this next line to read m_LengthDie from .brd files
// #define READ_PAD_LENGTH_DIE
int D_PAD::m_PadSketchModePenSize = 0; // Pen size used to draw pads in sketch mode
D_PAD::D_PAD( MODULE* parent ) : BOARD_CONNECTED_ITEM( parent, TYPE_PAD )
@ -23,6 +28,7 @@ D_PAD::D_PAD( MODULE* parent ) : BOARD_CONNECTED_ITEM( parent, TYPE_PAD )
m_Size.x = m_Size.y = 500; // give it a reasonable size
m_Orient = 0; // Pad rotation in 1/10 degrees
m_LengthDie = 0;
if( m_Parent && (m_Parent->Type() == TYPE_MODULE) )
{
@ -477,9 +483,11 @@ int D_PAD::ReadDescr( LINE_READER* aReader )
break;
case 'L':
#ifdef READ_PAD_LENGTH_DIE
int lengthdie;
nn = sscanf( PtLine, "%d", &lengthdie );
m_LengthDie = lengthdie;
#endif
break;
case '.': /* Read specific data */