* remove global g_Pad_Master global and put it into BOARD_DESIGN_SETTINGS
which is in turn already within BOARD. * encapsulate class D_PAD with accessors, making data private. * make D_PAD::GetBoundingRadius() do its longer calculation lazily, based on m_boundingRadius == -1.
This commit is contained in:
commit
5208bf9976
|
@ -4,6 +4,16 @@ KiCad ChangeLog 2012
|
|||
Please add newer entries at the top, list the date and your name with
|
||||
email address.
|
||||
|
||||
2012-Feb-19 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||
================================================================================
|
||||
++pcbnew
|
||||
* remove global g_Pad_Master global and put it into BOARD_DESIGN_SETTINGS
|
||||
which is in turn already within BOARD.
|
||||
* encapsulate class D_PAD with accessors, making data private.
|
||||
* make D_PAD::GetBoundingRadius() do its longer calculation lazily, based on
|
||||
m_boundingRadius == -1.
|
||||
|
||||
|
||||
2012-Feb-5 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||
================================================================================
|
||||
++pcbnew
|
||||
|
|
|
@ -108,4 +108,3 @@ int g_PadCMPColor = RED;
|
|||
*/
|
||||
DLIST<TRACK> g_CurrentTrackList;
|
||||
|
||||
D_PAD g_Pad_Master( (MODULE*) NULL );
|
||||
|
|
|
@ -273,19 +273,6 @@ void RotatePoint( int* pX, int* pY, int cx, int cy, double angle )
|
|||
}
|
||||
|
||||
|
||||
void RotatePoint( wxPoint* point, double angle )
|
||||
{
|
||||
int ox, oy;
|
||||
|
||||
ox = point->x;
|
||||
oy = point->y;
|
||||
|
||||
RotatePoint( &ox, &oy, angle );
|
||||
point->x = ox;
|
||||
point->y = oy;
|
||||
}
|
||||
|
||||
|
||||
void RotatePoint( wxPoint* point, const wxPoint& centre, double angle )
|
||||
{
|
||||
int ox, oy;
|
||||
|
|
|
@ -6,8 +6,14 @@
|
|||
#define BOARD_DESIGN_SETTINGS_H_
|
||||
|
||||
#include <pcbstruct.h> // NB_COLORS
|
||||
#include <class_pad.h>
|
||||
#include <param_config.h>
|
||||
|
||||
// Class for handle current printed board design settings
|
||||
|
||||
/**
|
||||
* Class BOARD_DESIGN_SETTINGS
|
||||
* contains design settings for a BOARD object.
|
||||
*/
|
||||
class BOARD_DESIGN_SETTINGS
|
||||
{
|
||||
public:
|
||||
|
@ -38,6 +44,8 @@ public:
|
|||
int m_ModuleTextWidth;
|
||||
int m_ModuleSegmentWidth;
|
||||
|
||||
D_PAD m_Pad_Master;
|
||||
|
||||
public:
|
||||
BOARD_DESIGN_SETTINGS();
|
||||
|
||||
|
@ -172,6 +180,13 @@ public:
|
|||
*/
|
||||
void SetCopperLayerCount( int aNewLayerCount );
|
||||
|
||||
/**
|
||||
* Function AppendConfigs
|
||||
* appends to @a aResult the configuration setting accessors which will later
|
||||
* allow reading or writing of configuration file information directly into
|
||||
* this object.
|
||||
*/
|
||||
void AppendConfigs( PARAM_CFG_ARRAY* aResult );
|
||||
|
||||
private:
|
||||
int m_CopperLayerCount; ///< Number of copper layers for this design
|
||||
|
|
|
@ -5,25 +5,36 @@
|
|||
#ifndef PAD_SHAPES_H_
|
||||
#define PAD_SHAPES_H_
|
||||
|
||||
/* Pad shape id : ( .m_PadShape member) */
|
||||
#define PAD_NONE 0
|
||||
#define PAD_CIRCLE 1
|
||||
#define PAD_ROUND PAD_CIRCLE
|
||||
#define PAD_RECT 2
|
||||
#define PAD_OVAL 3
|
||||
#define PAD_TRAPEZOID 4 // trapezoid
|
||||
#define PAD_RRECT 5
|
||||
#define PAD_OCTAGON 6
|
||||
#define PAD_SQUARE 7
|
||||
/**
|
||||
* Enum PAD_SHAPE_T
|
||||
* is the set of pad shapes, used with D_PAD::{Set,Get}Shape()
|
||||
*/
|
||||
enum PAD_SHAPE_T
|
||||
{
|
||||
PAD_NONE,
|
||||
PAD_CIRCLE,
|
||||
PAD_ROUND = PAD_CIRCLE,
|
||||
PAD_RECT,
|
||||
PAD_OVAL,
|
||||
PAD_TRAPEZOID,
|
||||
PAD_RRECT,
|
||||
PAD_OCTAGON,
|
||||
PAD_SQUARE,
|
||||
};
|
||||
|
||||
|
||||
/* PADS attributes */
|
||||
#define PAD_STANDARD 0 // Usual pad
|
||||
#define PAD_SMD 1 // Smd pad, appears on the solder paste layer (default)
|
||||
#define PAD_CONN 2 // Like smd, does not appear on the solder paste layer (default)
|
||||
#define PAD_HOLE_NOT_PLATED 3 // like PAD_STANDARD, but not plated
|
||||
// mechanical used only
|
||||
// no connection allowed
|
||||
/**
|
||||
* Enum PAD_ATTR_T
|
||||
* is the set of pad shapes, used with D_PAD::{Set,Get}Attribute()
|
||||
*/
|
||||
enum PAD_ATTR_T
|
||||
{
|
||||
PAD_STANDARD, ///< Usual pad
|
||||
PAD_SMD, ///< Smd pad, appears on the solder paste layer (default)
|
||||
PAD_CONN, ///< Like smd, does not appear on the solder paste layer (default)
|
||||
PAD_HOLE_NOT_PLATED, ///< like PAD_STANDARD, but not plated
|
||||
///< mechanical use only, no connection allowed
|
||||
};
|
||||
|
||||
|
||||
#endif /* #ifndef PAD_SHAPES_H_ */
|
||||
#endif // PAD_SHAPES_H_
|
||||
|
|
|
@ -52,8 +52,5 @@ extern DLIST<TRACK> g_CurrentTrackList;
|
|||
|
||||
#define g_FirstTrackSegment g_CurrentTrackList.GetFirst() ///< first segment created
|
||||
|
||||
/// Pad editing
|
||||
extern D_PAD g_Pad_Master;
|
||||
|
||||
|
||||
#endif // PCBCOMMON_H_
|
||||
|
|
|
@ -22,7 +22,10 @@ void RotatePoint( int *pX, int *pY, int cx, int cy, double angle );
|
|||
* Calculates the new coord point point
|
||||
* for a rotation angle in (1 / 10 degree)
|
||||
*/
|
||||
void RotatePoint( wxPoint* point, double angle );
|
||||
static inline void RotatePoint( wxPoint* point, double angle )
|
||||
{
|
||||
RotatePoint( &point->x, &point->y, angle );
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculates the new coord point point
|
||||
|
|
|
@ -666,7 +666,7 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
|
|||
|
||||
for( Pad = aModule->m_Pads; Pad != NULL; Pad = Pad->Next() )
|
||||
{
|
||||
if( ( Pad->m_layerMask & otherLayerMask ) == 0 )
|
||||
if( ( Pad->GetLayerMask() & otherLayerMask ) == 0 )
|
||||
continue;
|
||||
|
||||
TstOtherSide = true;
|
||||
|
|
|
@ -443,7 +443,7 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
|
|||
continue;
|
||||
|
||||
pad->SetPosition( pad->GetPosition() + offset );
|
||||
pad->m_Pos0 += offset;
|
||||
pad->SetPos0( pad->GetPos0() + offset );
|
||||
}
|
||||
|
||||
item = module->m_Drawings;
|
||||
|
@ -526,29 +526,38 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
|
|||
{
|
||||
#define SETMIRROR( z ) (z) -= offset.x; (z) = -(z); (z) += offset.x;
|
||||
wxPoint tmp;
|
||||
wxSize tmpz;
|
||||
|
||||
if( module == NULL )
|
||||
return;
|
||||
|
||||
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
|
||||
{
|
||||
if( pad->IsSelected() )
|
||||
// @JP why allow some pads to stay behind? Do not understand
|
||||
// why this test is here.
|
||||
if( !pad->IsSelected() )
|
||||
continue;
|
||||
|
||||
tmp = pad->GetPosition();
|
||||
SETMIRROR( tmp.x );
|
||||
pad->SetPosition( tmp );
|
||||
|
||||
pad->m_Pos0.x = pad->GetPosition().x;
|
||||
NEGATE( pad->m_Offset.x );
|
||||
NEGATE( pad->m_DeltaSize.x );
|
||||
pad->m_Orient = 1800 - pad->m_Orient;
|
||||
NORMALIZE_ANGLE_POS( pad->m_Orient );
|
||||
pad->SetX0( pad->GetPosition().x );
|
||||
|
||||
tmp = pad->GetOffset();
|
||||
NEGATE( tmp.x );
|
||||
pad->SetOffset( tmp );
|
||||
|
||||
tmpz = pad->GetDelta();
|
||||
NEGATE( tmpz.x );
|
||||
pad->SetDelta( tmpz );
|
||||
|
||||
pad->SetOrientation( 1800 - pad->GetOrientation() );
|
||||
}
|
||||
|
||||
for( EDA_ITEM* item = module->m_Drawings; item; item = item->Next() )
|
||||
{
|
||||
if( !item->IsSelected() )
|
||||
if( !item->IsSelected() ) // @JP why allow some graphics to stay behind?
|
||||
continue;
|
||||
|
||||
switch( item->Type() )
|
||||
|
@ -609,9 +618,8 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
|
|||
ROTATE( pos );
|
||||
pad->SetPosition( pos );
|
||||
|
||||
pad->m_Pos0 = pad->GetPosition();
|
||||
pad->m_Orient += 900;
|
||||
NORMALIZE_ANGLE_POS( pad->m_Orient );
|
||||
pad->SetPos0( pad->GetPosition() );
|
||||
pad->SetOrientation( pad->GetOrientation() + 900 );
|
||||
}
|
||||
|
||||
for( EDA_ITEM* item = module->m_Drawings; item; item = item->Next() )
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <class_zone.h>
|
||||
|
||||
|
||||
/* Exported functions */
|
||||
// Exported functions
|
||||
|
||||
/**
|
||||
* Function TransformRoundedEndsSegmentToPolygon
|
||||
|
@ -640,8 +640,9 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
|||
wxPoint PadShapePos = aPad.ReturnShapePos(); /* Note: for pad having a shape offset,
|
||||
* the pad position is NOT the shape position */
|
||||
wxSize copper_thickness;
|
||||
int dx = aPad.m_Size.x / 2;
|
||||
int dy = aPad.m_Size.y / 2;
|
||||
|
||||
int dx = aPad.GetSize().x / 2;
|
||||
int dy = aPad.GetSize().y / 2;
|
||||
|
||||
int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree
|
||||
|
||||
|
@ -663,320 +664,327 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
|
|||
copper_thickness.x = min( dx, aCopperThickness );
|
||||
copper_thickness.y = min( dy, aCopperThickness );
|
||||
|
||||
switch( aPad.m_PadShape )
|
||||
switch( aPad.GetShape() )
|
||||
{
|
||||
case PAD_CIRCLE: // Add 4 similar holes
|
||||
{
|
||||
/* we create 4 copper holes and put them in position 1, 2, 3 and 4
|
||||
* here is the area of the rectangular pad + its thermal gap
|
||||
* the 4 copper holes remove the copper in order to create the thermal gap
|
||||
* 4 ------ 1
|
||||
* | |
|
||||
* | |
|
||||
* | |
|
||||
* | |
|
||||
* 3 ------ 2
|
||||
* holes 2, 3, 4 are the same as hole 1, rotated 90, 180, 270 deg
|
||||
*/
|
||||
|
||||
// Build the hole pattern, for the hole in the X >0, Y > 0 plane:
|
||||
// The pattern roughtly is a 90 deg arc pie
|
||||
std::vector <wxPoint> corners_buffer;
|
||||
|
||||
// Radius of outer arcs of the shape corrected for arc approximation by lines
|
||||
int outer_radius = (int) ( (dx + aThermalGap) * aCorrectionFactor );
|
||||
|
||||
// Crosspoint of thermal spoke sides, the first point of polygon buffer
|
||||
corners_buffer.push_back( wxPoint( copper_thickness.x / 2, copper_thickness.y / 2 ) );
|
||||
|
||||
// Add an intermediate point on spoke sides, to allow a > 90 deg angle between side
|
||||
// and first seg of arc approx
|
||||
corner.x = copper_thickness.x / 2;
|
||||
int y = outer_radius - (aThermalGap / 4);
|
||||
corner.y = (int) sqrt( ( ( (double) y * y ) - (double) corner.x * corner.x ) );
|
||||
|
||||
if( aThermalRot != 0 )
|
||||
corners_buffer.push_back( corner );
|
||||
|
||||
// calculate the starting point of the outter arc
|
||||
corner.x = copper_thickness.x / 2;
|
||||
|
||||
double dtmp = sqrt( ( (double) outer_radius * outer_radius ) -
|
||||
( (double) corner.x * corner.x ) );
|
||||
corner.y = (int) dtmp;
|
||||
RotatePoint( &corner, 90 );
|
||||
|
||||
// calculate the ending point of the outter arc
|
||||
corner_end.x = corner.y;
|
||||
corner_end.y = corner.x;
|
||||
|
||||
// calculate intermediate points (y coordinate from corner.y to corner_end.y
|
||||
while( (corner.y > corner_end.y) && (corner.x < corner_end.x) )
|
||||
{
|
||||
corners_buffer.push_back( corner );
|
||||
RotatePoint( &corner, delta );
|
||||
}
|
||||
/* we create 4 copper holes and put them in position 1, 2, 3 and 4
|
||||
* here is the area of the rectangular pad + its thermal gap
|
||||
* the 4 copper holes remove the copper in order to create the thermal gap
|
||||
* 4 ------ 1
|
||||
* | |
|
||||
* | |
|
||||
* | |
|
||||
* | |
|
||||
* 3 ------ 2
|
||||
* holes 2, 3, 4 are the same as hole 1, rotated 90, 180, 270 deg
|
||||
*/
|
||||
|
||||
corners_buffer.push_back( corner_end );
|
||||
// Build the hole pattern, for the hole in the X >0, Y > 0 plane:
|
||||
// The pattern roughtly is a 90 deg arc pie
|
||||
std::vector <wxPoint> corners_buffer;
|
||||
|
||||
/* add an intermediate point, to avoid angles < 90 deg between last arc approx line
|
||||
* and radius line
|
||||
*/
|
||||
corner.x = corners_buffer[1].y;
|
||||
corner.y = corners_buffer[1].x;
|
||||
corners_buffer.push_back( corner );
|
||||
// Radius of outer arcs of the shape corrected for arc approximation by lines
|
||||
int outer_radius = (int) ( (dx + aThermalGap) * aCorrectionFactor );
|
||||
|
||||
// Now, add the 4 holes ( each is the pattern, rotated by 0, 90, 180 and 270 deg
|
||||
// aThermalRot = 450 (45.0 degrees orientation) work fine.
|
||||
int angle_pad = aPad.GetOrientation(); // Pad orientation
|
||||
int th_angle = aThermalRot;
|
||||
// Crosspoint of thermal spoke sides, the first point of polygon buffer
|
||||
corners_buffer.push_back( wxPoint( copper_thickness.x / 2, copper_thickness.y / 2 ) );
|
||||
|
||||
for( unsigned ihole = 0; ihole < 4; ihole++ )
|
||||
{
|
||||
for( unsigned ii = 0; ii < corners_buffer.size(); ii++ )
|
||||
// Add an intermediate point on spoke sides, to allow a > 90 deg angle between side
|
||||
// and first seg of arc approx
|
||||
corner.x = copper_thickness.x / 2;
|
||||
int y = outer_radius - (aThermalGap / 4);
|
||||
corner.y = (int) sqrt( ( ( (double) y * y ) - (double) corner.x * corner.x ) );
|
||||
|
||||
if( aThermalRot != 0 )
|
||||
corners_buffer.push_back( corner );
|
||||
|
||||
// calculate the starting point of the outter arc
|
||||
corner.x = copper_thickness.x / 2;
|
||||
|
||||
double dtmp = sqrt( ( (double) outer_radius * outer_radius ) -
|
||||
( (double) corner.x * corner.x ) );
|
||||
corner.y = (int) dtmp;
|
||||
RotatePoint( &corner, 90 );
|
||||
|
||||
// calculate the ending point of the outter arc
|
||||
corner_end.x = corner.y;
|
||||
corner_end.y = corner.x;
|
||||
|
||||
// calculate intermediate points (y coordinate from corner.y to corner_end.y
|
||||
while( (corner.y > corner_end.y) && (corner.x < corner_end.x) )
|
||||
{
|
||||
corner = corners_buffer[ii];
|
||||
RotatePoint( &corner, th_angle + angle_pad ); // Rotate by segment angle and pad orientation
|
||||
corner += PadShapePos;
|
||||
aCornerBuffer.push_back( CPolyPt( corner.x, corner.y ) );
|
||||
corners_buffer.push_back( corner );
|
||||
RotatePoint( &corner, delta );
|
||||
}
|
||||
|
||||
aCornerBuffer.back().end_contour = true;
|
||||
th_angle += 900; // Note: th_angle in in 0.1 deg.
|
||||
corners_buffer.push_back( corner_end );
|
||||
|
||||
/* add an intermediate point, to avoid angles < 90 deg between last arc approx line
|
||||
* and radius line
|
||||
*/
|
||||
corner.x = corners_buffer[1].y;
|
||||
corner.y = corners_buffer[1].x;
|
||||
corners_buffer.push_back( corner );
|
||||
|
||||
// Now, add the 4 holes ( each is the pattern, rotated by 0, 90, 180 and 270 deg
|
||||
// aThermalRot = 450 (45.0 degrees orientation) work fine.
|
||||
int angle_pad = aPad.GetOrientation(); // Pad orientation
|
||||
int th_angle = aThermalRot;
|
||||
|
||||
for( unsigned ihole = 0; ihole < 4; ihole++ )
|
||||
{
|
||||
for( unsigned ii = 0; ii < corners_buffer.size(); ii++ )
|
||||
{
|
||||
corner = corners_buffer[ii];
|
||||
RotatePoint( &corner, th_angle + angle_pad ); // Rotate by segment angle and pad orientation
|
||||
corner += PadShapePos;
|
||||
aCornerBuffer.push_back( CPolyPt( corner.x, corner.y ) );
|
||||
}
|
||||
|
||||
aCornerBuffer.back().end_contour = true;
|
||||
th_angle += 900; // Note: th_angle in in 0.1 deg.
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case PAD_OVAL:
|
||||
{
|
||||
// Oval pad support along the lines of round and rectangular pads
|
||||
std::vector <wxPoint> corners_buffer; // Polygon buffer as vector
|
||||
|
||||
int dx = (aPad.m_Size.x / 2) + aThermalGap; // Cutout radius x
|
||||
int dy = (aPad.m_Size.y / 2) + aThermalGap; // Cutout radius y
|
||||
|
||||
wxPoint shape_offset;
|
||||
|
||||
// We want to calculate an oval shape with dx > dy.
|
||||
// if this is not the case, exchange dx and dy, and rotate the shape 90 deg.
|
||||
int supp_angle = 0;
|
||||
|
||||
if( dx < dy )
|
||||
{
|
||||
EXCHG( dx, dy );
|
||||
supp_angle = 900;
|
||||
EXCHG( copper_thickness.x, copper_thickness.y );
|
||||
}
|
||||
// Oval pad support along the lines of round and rectangular pads
|
||||
std::vector <wxPoint> corners_buffer; // Polygon buffer as vector
|
||||
|
||||
int deltasize = dx - dy; // = distance between shape position and the 2 demi-circle ends centre
|
||||
// here we have dx > dy
|
||||
// Radius of outer arcs of the shape:
|
||||
int outer_radius = dy; // The radius of the outer arc is radius end + aThermalGap
|
||||
int dx = (aPad.GetSize().x / 2) + aThermalGap; // Cutout radius x
|
||||
int dy = (aPad.GetSize().y / 2) + aThermalGap; // Cutout radius y
|
||||
|
||||
// Some coordinate fiddling, depending on the shape offset direction
|
||||
shape_offset = wxPoint( deltasize, 0 );
|
||||
wxPoint shape_offset;
|
||||
|
||||
// Crosspoint of thermal spoke sides, the first point of polygon buffer
|
||||
corners_buffer.push_back( wxPoint( copper_thickness.x / 2, copper_thickness.y / 2 ) );
|
||||
// We want to calculate an oval shape with dx > dy.
|
||||
// if this is not the case, exchange dx and dy, and rotate the shape 90 deg.
|
||||
int supp_angle = 0;
|
||||
|
||||
// Arc start point calculation, the intersecting point of cutout arc and thermal spoke edge
|
||||
if( copper_thickness.x > deltasize ) // If copper thickness is more than shape offset, we need to calculate arc intercept point.
|
||||
{
|
||||
corner.x = copper_thickness.x / 2;
|
||||
corner.y = (int) sqrt( ( (double) outer_radius * outer_radius ) -
|
||||
( (double) ( corner.x - delta ) * ( corner.x - deltasize ) ) );
|
||||
corner.x -= deltasize;
|
||||
if( dx < dy )
|
||||
{
|
||||
EXCHG( dx, dy );
|
||||
supp_angle = 900;
|
||||
EXCHG( copper_thickness.x, copper_thickness.y );
|
||||
}
|
||||
|
||||
/* creates an intermediate point, to have a > 90 deg angle
|
||||
* between the side and the first segment of arc approximation
|
||||
int deltasize = dx - dy; // = distance between shape position and the 2 demi-circle ends centre
|
||||
// here we have dx > dy
|
||||
// Radius of outer arcs of the shape:
|
||||
int outer_radius = dy; // The radius of the outer arc is radius end + aThermalGap
|
||||
|
||||
// Some coordinate fiddling, depending on the shape offset direction
|
||||
shape_offset = wxPoint( deltasize, 0 );
|
||||
|
||||
// Crosspoint of thermal spoke sides, the first point of polygon buffer
|
||||
corners_buffer.push_back( wxPoint( copper_thickness.x / 2, copper_thickness.y / 2 ) );
|
||||
|
||||
// Arc start point calculation, the intersecting point of cutout arc and thermal spoke edge
|
||||
if( copper_thickness.x > deltasize ) // If copper thickness is more than shape offset, we need to calculate arc intercept point.
|
||||
{
|
||||
corner.x = copper_thickness.x / 2;
|
||||
corner.y = (int) sqrt( ( (double) outer_radius * outer_radius ) -
|
||||
( (double) ( corner.x - delta ) * ( corner.x - deltasize ) ) );
|
||||
corner.x -= deltasize;
|
||||
|
||||
/* creates an intermediate point, to have a > 90 deg angle
|
||||
* between the side and the first segment of arc approximation
|
||||
*/
|
||||
wxPoint intpoint = corner;
|
||||
intpoint.y -= aThermalGap / 4;
|
||||
corners_buffer.push_back( intpoint + shape_offset );
|
||||
RotatePoint( &corner, 90 );
|
||||
}
|
||||
else
|
||||
{
|
||||
corner.x = copper_thickness.x / 2;
|
||||
corner.y = outer_radius;
|
||||
corners_buffer.push_back( corner );
|
||||
corner.x = ( deltasize - copper_thickness.x ) / 2;
|
||||
}
|
||||
|
||||
// Add an intermediate point on spoke sides, to allow a > 90 deg angle between side
|
||||
// and first seg of arc approx
|
||||
wxPoint last_corner;
|
||||
last_corner.y = copper_thickness.y / 2;
|
||||
int px = outer_radius - (aThermalGap / 4);
|
||||
last_corner.x =
|
||||
(int) sqrt( ( ( (double) px * px ) - (double) last_corner.y * last_corner.y ) );
|
||||
|
||||
// Arc stop point calculation, the intersecting point of cutout arc and thermal spoke edge
|
||||
corner_end.y = copper_thickness.y / 2;
|
||||
corner_end.x =
|
||||
(int) sqrt( ( (double) outer_radius *
|
||||
outer_radius ) - ( (double) corner_end.y * corner_end.y ) );
|
||||
RotatePoint( &corner_end, -90 );
|
||||
|
||||
// calculate intermediate arc points till limit is reached
|
||||
while( (corner.y > corner_end.y) && (corner.x < corner_end.x) )
|
||||
{
|
||||
corners_buffer.push_back( corner + shape_offset );
|
||||
RotatePoint( &corner, delta );
|
||||
}
|
||||
|
||||
//corners_buffer.push_back(corner + shape_offset); // TODO: about one mil geometry error forms somewhere.
|
||||
corners_buffer.push_back( corner_end + shape_offset );
|
||||
corners_buffer.push_back( last_corner + shape_offset ); // Enabling the line above shows intersection point.
|
||||
|
||||
/* Create 2 holes, rotated by pad rotation.
|
||||
*/
|
||||
wxPoint intpoint = corner;
|
||||
intpoint.y -= aThermalGap / 4;
|
||||
corners_buffer.push_back( intpoint + shape_offset );
|
||||
RotatePoint( &corner, 90 );
|
||||
}
|
||||
else
|
||||
{
|
||||
corner.x = copper_thickness.x / 2;
|
||||
corner.y = outer_radius;
|
||||
corners_buffer.push_back( corner );
|
||||
corner.x = ( deltasize - copper_thickness.x ) / 2;
|
||||
}
|
||||
int angle = aPad.GetOrientation() + supp_angle;
|
||||
|
||||
// Add an intermediate point on spoke sides, to allow a > 90 deg angle between side
|
||||
// and first seg of arc approx
|
||||
wxPoint last_corner;
|
||||
last_corner.y = copper_thickness.y / 2;
|
||||
int px = outer_radius - (aThermalGap / 4);
|
||||
last_corner.x =
|
||||
(int) sqrt( ( ( (double) px * px ) - (double) last_corner.y * last_corner.y ) );
|
||||
|
||||
// Arc stop point calculation, the intersecting point of cutout arc and thermal spoke edge
|
||||
corner_end.y = copper_thickness.y / 2;
|
||||
corner_end.x =
|
||||
(int) sqrt( ( (double) outer_radius *
|
||||
outer_radius ) - ( (double) corner_end.y * corner_end.y ) );
|
||||
RotatePoint( &corner_end, -90 );
|
||||
|
||||
// calculate intermediate arc points till limit is reached
|
||||
while( (corner.y > corner_end.y) && (corner.x < corner_end.x) )
|
||||
{
|
||||
corners_buffer.push_back( corner + shape_offset );
|
||||
RotatePoint( &corner, delta );
|
||||
}
|
||||
|
||||
//corners_buffer.push_back(corner + shape_offset); // TODO: about one mil geometry error forms somewhere.
|
||||
corners_buffer.push_back( corner_end + shape_offset );
|
||||
corners_buffer.push_back( last_corner + shape_offset ); // Enabling the line above shows intersection point.
|
||||
|
||||
/* Create 2 holes, rotated by pad rotation.
|
||||
*/
|
||||
int angle = aPad.GetOrientation() + supp_angle;
|
||||
|
||||
for( int irect = 0; irect < 2; irect++ )
|
||||
{
|
||||
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
|
||||
for( int irect = 0; irect < 2; irect++ )
|
||||
{
|
||||
wxPoint cpos = corners_buffer[ic];
|
||||
RotatePoint( &cpos, angle );
|
||||
cpos += PadShapePos;
|
||||
aCornerBuffer.push_back( CPolyPt( cpos.x, cpos.y ) );
|
||||
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
|
||||
{
|
||||
wxPoint cpos = corners_buffer[ic];
|
||||
RotatePoint( &cpos, angle );
|
||||
cpos += PadShapePos;
|
||||
aCornerBuffer.push_back( CPolyPt( cpos.x, cpos.y ) );
|
||||
}
|
||||
|
||||
aCornerBuffer.back().end_contour = true;
|
||||
angle += 1800; // this is calculate hole 3
|
||||
|
||||
if( angle >= 3600 )
|
||||
angle -= 3600;
|
||||
}
|
||||
|
||||
aCornerBuffer.back().end_contour = true;
|
||||
angle += 1800; // this is calculate hole 3
|
||||
|
||||
if( angle >= 3600 )
|
||||
angle -= 3600;
|
||||
}
|
||||
|
||||
// Create holes, that are the mirrored from the previous holes
|
||||
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
|
||||
{
|
||||
wxPoint swap = corners_buffer[ic];
|
||||
swap.x = -swap.x;
|
||||
corners_buffer[ic] = swap;
|
||||
}
|
||||
|
||||
// Now add corner 4 and 2 (2 is the corner 4 rotated by 180 deg
|
||||
angle = aPad.GetOrientation() + supp_angle;
|
||||
|
||||
for( int irect = 0; irect < 2; irect++ )
|
||||
{
|
||||
// Create holes, that are the mirrored from the previous holes
|
||||
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
|
||||
{
|
||||
wxPoint cpos = corners_buffer[ic];
|
||||
RotatePoint( &cpos, angle );
|
||||
cpos += PadShapePos;
|
||||
aCornerBuffer.push_back( CPolyPt( cpos.x, cpos.y ) );
|
||||
wxPoint swap = corners_buffer[ic];
|
||||
swap.x = -swap.x;
|
||||
corners_buffer[ic] = swap;
|
||||
}
|
||||
|
||||
aCornerBuffer.back().end_contour = true;
|
||||
angle += 1800;
|
||||
// Now add corner 4 and 2 (2 is the corner 4 rotated by 180 deg
|
||||
angle = aPad.GetOrientation() + supp_angle;
|
||||
|
||||
if( angle >= 3600 )
|
||||
angle -= 3600;
|
||||
for( int irect = 0; irect < 2; irect++ )
|
||||
{
|
||||
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
|
||||
{
|
||||
wxPoint cpos = corners_buffer[ic];
|
||||
RotatePoint( &cpos, angle );
|
||||
cpos += PadShapePos;
|
||||
aCornerBuffer.push_back( CPolyPt( cpos.x, cpos.y ) );
|
||||
}
|
||||
|
||||
aCornerBuffer.back().end_contour = true;
|
||||
angle += 1800;
|
||||
|
||||
if( angle >= 3600 )
|
||||
angle -= 3600;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case PAD_RECT: // draw 4 Holes
|
||||
{
|
||||
/* we create 4 copper holes and put them in position 1, 2, 3 and 4
|
||||
* here is the area of the rectangular pad + its thermal gap
|
||||
* the 4 copper holes remove the copper in order to create the thermal gap
|
||||
* 4 ------ 1
|
||||
* | |
|
||||
* | |
|
||||
* | |
|
||||
* | |
|
||||
* 3 ------ 2
|
||||
* hole 3 is the same as hole 1, rotated 180 deg
|
||||
* hole 4 is the same as hole 2, rotated 180 deg and is the same as hole 1, mirrored
|
||||
*/
|
||||
|
||||
// First, create a rectangular hole for position 1 :
|
||||
// 2 ------- 3
|
||||
// | |
|
||||
// | |
|
||||
// | |
|
||||
// 1 -------4
|
||||
|
||||
// Modified rectangles with one corner rounded. TODO: merging with oval thermals
|
||||
// and possibly round too.
|
||||
|
||||
std::vector <wxPoint> corners_buffer; // Polygon buffer as vector
|
||||
|
||||
int dx = (aPad.m_Size.x / 2) + aThermalGap; // Cutout radius x
|
||||
int dy = (aPad.m_Size.y / 2) + aThermalGap; // Cutout radius y
|
||||
|
||||
// The first point of polygon buffer is left lower corner, second the crosspoint of
|
||||
// thermal spoke sides, the third is upper right corner and the rest are rounding
|
||||
// vertices going anticlockwise. Note the inveted Y-axis in CG.
|
||||
corners_buffer.push_back( wxPoint( -dx, -(aThermalGap / 4 + copper_thickness.y / 2) ) ); // Adds small miters to zone
|
||||
corners_buffer.push_back( wxPoint( -(dx - aThermalGap / 4), -copper_thickness.y / 2 ) ); // fill and spoke corner
|
||||
corners_buffer.push_back( wxPoint( -copper_thickness.x / 2, -copper_thickness.y / 2 ) );
|
||||
corners_buffer.push_back( wxPoint( -copper_thickness.x / 2, -(dy - aThermalGap / 4) ) );
|
||||
corners_buffer.push_back( wxPoint( -(aThermalGap / 4 + copper_thickness.x / 2), -dy ) );
|
||||
|
||||
int angle = aPad.GetOrientation();
|
||||
int rounding_radius = (int) ( aThermalGap * aCorrectionFactor ); // Corner rounding radius
|
||||
int angle_pg; // Polygon increment angle
|
||||
|
||||
for( int i = 0; i < aCircleToSegmentsCount / 4 + 1; i++ )
|
||||
{
|
||||
wxPoint corner_position = wxPoint( 0, -rounding_radius );
|
||||
RotatePoint( &corner_position, 1800 / aCircleToSegmentsCount ); // Start at half increment offset
|
||||
angle_pg = i * delta;
|
||||
RotatePoint( &corner_position, angle_pg ); // Rounding vector rotation
|
||||
corner_position -= aPad.m_Size / 2; // Rounding vector + Pad corner offset
|
||||
corners_buffer.push_back( wxPoint( corner_position.x, corner_position.y ) );
|
||||
}
|
||||
/* we create 4 copper holes and put them in position 1, 2, 3 and 4
|
||||
* here is the area of the rectangular pad + its thermal gap
|
||||
* the 4 copper holes remove the copper in order to create the thermal gap
|
||||
* 4 ------ 1
|
||||
* | |
|
||||
* | |
|
||||
* | |
|
||||
* | |
|
||||
* 3 ------ 2
|
||||
* hole 3 is the same as hole 1, rotated 180 deg
|
||||
* hole 4 is the same as hole 2, rotated 180 deg and is the same as hole 1, mirrored
|
||||
*/
|
||||
|
||||
for( int irect = 0; irect < 2; irect++ )
|
||||
{
|
||||
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
|
||||
// First, create a rectangular hole for position 1 :
|
||||
// 2 ------- 3
|
||||
// | |
|
||||
// | |
|
||||
// | |
|
||||
// 1 -------4
|
||||
|
||||
// Modified rectangles with one corner rounded. TODO: merging with oval thermals
|
||||
// and possibly round too.
|
||||
|
||||
std::vector <wxPoint> corners_buffer; // Polygon buffer as vector
|
||||
|
||||
int dx = (aPad.GetSize().x / 2) + aThermalGap; // Cutout radius x
|
||||
int dy = (aPad.GetSize().y / 2) + aThermalGap; // Cutout radius y
|
||||
|
||||
// The first point of polygon buffer is left lower corner, second the crosspoint of
|
||||
// thermal spoke sides, the third is upper right corner and the rest are rounding
|
||||
// vertices going anticlockwise. Note the inveted Y-axis in CG.
|
||||
corners_buffer.push_back( wxPoint( -dx, -(aThermalGap / 4 + copper_thickness.y / 2) ) ); // Adds small miters to zone
|
||||
corners_buffer.push_back( wxPoint( -(dx - aThermalGap / 4), -copper_thickness.y / 2 ) ); // fill and spoke corner
|
||||
corners_buffer.push_back( wxPoint( -copper_thickness.x / 2, -copper_thickness.y / 2 ) );
|
||||
corners_buffer.push_back( wxPoint( -copper_thickness.x / 2, -(dy - aThermalGap / 4) ) );
|
||||
corners_buffer.push_back( wxPoint( -(aThermalGap / 4 + copper_thickness.x / 2), -dy ) );
|
||||
|
||||
int angle = aPad.GetOrientation();
|
||||
int rounding_radius = (int) ( aThermalGap * aCorrectionFactor ); // Corner rounding radius
|
||||
int angle_pg; // Polygon increment angle
|
||||
|
||||
for( int i = 0; i < aCircleToSegmentsCount / 4 + 1; i++ )
|
||||
{
|
||||
wxPoint cpos = corners_buffer[ic];
|
||||
RotatePoint( &cpos, angle ); // Rotate according to module orientation
|
||||
cpos += PadShapePos; // Shift origin to position
|
||||
aCornerBuffer.push_back( CPolyPt( cpos.x, cpos.y ) );
|
||||
wxPoint corner_position = wxPoint( 0, -rounding_radius );
|
||||
|
||||
// Start at half increment offset
|
||||
RotatePoint( &corner_position, 1800 / aCircleToSegmentsCount );
|
||||
angle_pg = i * delta;
|
||||
|
||||
RotatePoint( &corner_position, angle_pg ); // Rounding vector rotation
|
||||
corner_position -= aPad.GetSize() / 2; // Rounding vector + Pad corner offset
|
||||
|
||||
corners_buffer.push_back( wxPoint( corner_position.x, corner_position.y ) );
|
||||
}
|
||||
|
||||
aCornerBuffer.back().end_contour = true;
|
||||
angle += 1800; // this is calculate hole 3
|
||||
|
||||
if( angle >= 3600 )
|
||||
angle -= 3600;
|
||||
}
|
||||
|
||||
// Create holes, that are the mirrored from the previous holes
|
||||
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
|
||||
{
|
||||
wxPoint swap = corners_buffer[ic];
|
||||
swap.x = -swap.x;
|
||||
corners_buffer[ic] = swap;
|
||||
}
|
||||
|
||||
// Now add corner 4 and 2 (2 is the corner 4 rotated by 180 deg
|
||||
for( int irect = 0; irect < 2; irect++ )
|
||||
{
|
||||
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
|
||||
for( int irect = 0; irect < 2; irect++ )
|
||||
{
|
||||
wxPoint cpos = corners_buffer[ic];
|
||||
RotatePoint( &cpos, angle );
|
||||
cpos += PadShapePos;
|
||||
aCornerBuffer.push_back( CPolyPt( cpos.x, cpos.y ) );
|
||||
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
|
||||
{
|
||||
wxPoint cpos = corners_buffer[ic];
|
||||
RotatePoint( &cpos, angle ); // Rotate according to module orientation
|
||||
cpos += PadShapePos; // Shift origin to position
|
||||
aCornerBuffer.push_back( CPolyPt( cpos.x, cpos.y ) );
|
||||
}
|
||||
|
||||
aCornerBuffer.back().end_contour = true;
|
||||
angle += 1800; // this is calculate hole 3
|
||||
|
||||
if( angle >= 3600 )
|
||||
angle -= 3600;
|
||||
}
|
||||
|
||||
aCornerBuffer.back().end_contour = true;
|
||||
angle += 1800;
|
||||
// Create holes, that are the mirrored from the previous holes
|
||||
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
|
||||
{
|
||||
wxPoint swap = corners_buffer[ic];
|
||||
swap.x = -swap.x;
|
||||
corners_buffer[ic] = swap;
|
||||
}
|
||||
|
||||
// Now add corner 4 and 2 (2 is the corner 4 rotated by 180 deg
|
||||
for( int irect = 0; irect < 2; irect++ )
|
||||
{
|
||||
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
|
||||
{
|
||||
wxPoint cpos = corners_buffer[ic];
|
||||
RotatePoint( &cpos, angle );
|
||||
cpos += PadShapePos;
|
||||
aCornerBuffer.push_back( CPolyPt( cpos.x, cpos.y ) );
|
||||
}
|
||||
|
||||
aCornerBuffer.back().end_contour = true;
|
||||
angle += 1800;
|
||||
|
||||
if( angle >= 3600 )
|
||||
angle -= 3600;
|
||||
}
|
||||
|
||||
if( angle >= 3600 )
|
||||
angle -= 3600;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1181,7 +1181,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
|
|||
* D_PAD* pad = (D_PAD*) item;
|
||||
* if( pad->HitTest( refPos ) )
|
||||
* {
|
||||
* if( layer_mask & pad->m_layerMask )
|
||||
* if( layer_mask & pad->GetLayerMask() )
|
||||
* {
|
||||
* found = item;
|
||||
* return SEARCH_QUIT;
|
||||
|
@ -1572,11 +1572,11 @@ D_PAD* BOARD::GetPadFast( const wxPoint& aPosition, int aLayerMask )
|
|||
{
|
||||
D_PAD* pad = m_NetInfo.GetPad(i);
|
||||
|
||||
if( pad->m_Pos != aPosition )
|
||||
if( pad->GetPosition() != aPosition )
|
||||
continue;
|
||||
|
||||
/* Pad found, it must be on the correct layer */
|
||||
if( pad->m_layerMask & aLayerMask )
|
||||
if( pad->GetLayerMask() & aLayerMask )
|
||||
return pad;
|
||||
}
|
||||
|
||||
|
@ -1603,10 +1603,10 @@ D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, i
|
|||
|
||||
D_PAD* pad = aPadList[idx];
|
||||
|
||||
if( pad->m_Pos == aPosition ) // candidate found
|
||||
if( pad->GetPosition() == aPosition ) // candidate found
|
||||
{
|
||||
// The pad must match the layer mask:
|
||||
if( (aLayerMask & pad->m_layerMask) != 0 )
|
||||
if( (aLayerMask & pad->GetLayerMask()) != 0 )
|
||||
return pad;
|
||||
|
||||
// More than one pad can be at aPosition
|
||||
|
@ -1616,18 +1616,18 @@ D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, i
|
|||
for( int ii = idx+1; ii <= idxmax; ii++ )
|
||||
{
|
||||
pad = aPadList[ii];
|
||||
if( pad->m_Pos != aPosition )
|
||||
if( pad->GetPosition() != aPosition )
|
||||
break;
|
||||
if( (aLayerMask & pad->m_layerMask) != 0 )
|
||||
if( (aLayerMask & pad->GetLayerMask()) != 0 )
|
||||
return pad;
|
||||
}
|
||||
// search previous
|
||||
for( int ii = idx-1 ;ii >=0; ii-- )
|
||||
{
|
||||
pad = aPadList[ii];
|
||||
if( pad->m_Pos != aPosition )
|
||||
if( pad->GetPosition() != aPosition )
|
||||
break;
|
||||
if( (aLayerMask & pad->m_layerMask) != 0 )
|
||||
if( (aLayerMask & pad->GetLayerMask()) != 0 )
|
||||
return pad;
|
||||
}
|
||||
|
||||
|
@ -1635,9 +1635,9 @@ D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, i
|
|||
return 0;
|
||||
}
|
||||
|
||||
if( pad->m_Pos.x == aPosition.x ) // Must search considering Y coordinate
|
||||
if( pad->GetPosition().x == aPosition.x ) // Must search considering Y coordinate
|
||||
{
|
||||
if(pad->m_Pos.y < aPosition.y) // Must search after this item
|
||||
if(pad->GetPosition().y < aPosition.y) // Must search after this item
|
||||
{
|
||||
idx += delta;
|
||||
if( idx > idxmax )
|
||||
|
@ -1650,7 +1650,7 @@ D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, i
|
|||
idx = 0;
|
||||
}
|
||||
}
|
||||
else if( pad->m_Pos.x < aPosition.x ) // Must search after this item
|
||||
else if( pad->GetPosition().x < aPosition.x ) // Must search after this item
|
||||
{
|
||||
idx += delta;
|
||||
if( idx > idxmax )
|
||||
|
@ -1674,9 +1674,9 @@ D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, i
|
|||
*/
|
||||
static bool sortPadsByXthenYCoord( D_PAD* const & ref, D_PAD* const & comp )
|
||||
{
|
||||
if( ref->m_Pos.x == comp->m_Pos.x )
|
||||
return ref->m_Pos.y < comp->m_Pos.y;
|
||||
return ref->m_Pos.x < comp->m_Pos.x;
|
||||
if( ref->GetPosition().x == comp->GetPosition().x )
|
||||
return ref->GetPosition().y < comp->GetPosition().y;
|
||||
return ref->GetPosition().x < comp->GetPosition().x;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1919,13 +1919,13 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace,
|
|||
if( track->GetState( BEGIN_ONPAD ) )
|
||||
{
|
||||
D_PAD * pad = (D_PAD *) track->start;
|
||||
lenDie += (double) pad->m_LengthDie;
|
||||
lenDie += (double) pad->GetDieLength();
|
||||
}
|
||||
|
||||
if( track->GetState( END_ONPAD ) )
|
||||
{
|
||||
D_PAD * pad = (D_PAD *) track->end;
|
||||
lenDie += (double) pad->m_LengthDie;
|
||||
lenDie += (double) pad->GetDieLength();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1949,13 +1949,13 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace,
|
|||
if( track->GetState( BEGIN_ONPAD ) )
|
||||
{
|
||||
D_PAD * pad = (D_PAD *) track->start;
|
||||
lenDie += (double) pad->m_LengthDie;
|
||||
lenDie += (double) pad->GetDieLength();
|
||||
}
|
||||
|
||||
if( track->GetState( END_ONPAD ) )
|
||||
{
|
||||
D_PAD * pad = (D_PAD *) track->end;
|
||||
lenDie += (double) pad->m_LengthDie;
|
||||
lenDie += (double) pad->GetDieLength();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
#include <class_track.h>
|
||||
|
||||
|
||||
BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS()
|
||||
BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
|
||||
m_Pad_Master( 0 )
|
||||
{
|
||||
m_EnabledLayers = ALL_LAYERS; // All layers enabled at first.
|
||||
// SetCopperLayerCount() will adjust this.
|
||||
|
@ -59,6 +60,48 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS()
|
|||
}
|
||||
|
||||
|
||||
void BOARD_DESIGN_SETTINGS::AppendConfigs( PARAM_CFG_ARRAY* aResult )
|
||||
{
|
||||
m_Pad_Master.AppendConfigs( aResult );
|
||||
|
||||
aResult->push_back( new PARAM_CFG_INT( wxT( "BoardThickness" ),
|
||||
&m_BoardThickness,
|
||||
630, 0, 0xFFFF ) );
|
||||
|
||||
aResult->push_back( new PARAM_CFG_INT( wxT( "TxtPcbV" ),
|
||||
&m_PcbTextSize.y,
|
||||
600, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) );
|
||||
|
||||
aResult->push_back( new PARAM_CFG_INT( wxT( "TxtPcbH" ),
|
||||
&m_PcbTextSize.x,
|
||||
600, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) );
|
||||
|
||||
aResult->push_back( new PARAM_CFG_INT( wxT( "TxtModV" ), &m_ModuleTextSize.y,
|
||||
500, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) );
|
||||
aResult->push_back( new PARAM_CFG_INT( wxT( "TxtModH" ), &m_ModuleTextSize.x,
|
||||
500, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) );
|
||||
aResult->push_back( new PARAM_CFG_INT( wxT( "TxtModW" ), &m_ModuleTextWidth,
|
||||
100, 1, TEXTS_MAX_WIDTH ) );
|
||||
|
||||
aResult->push_back( new PARAM_CFG_INT( wxT( "VEgarde" ),
|
||||
&m_SolderMaskMargin,
|
||||
100, 0, 10000 ) );
|
||||
|
||||
aResult->push_back( new PARAM_CFG_INT( wxT( "DrawLar" ),
|
||||
&m_DrawSegmentWidth,
|
||||
120, 0, 0xFFFF ) );
|
||||
|
||||
aResult->push_back( new PARAM_CFG_INT( wxT( "EdgeLar" ),
|
||||
&m_EdgeSegmentWidth,
|
||||
120, 0, 0xFFFF ) );
|
||||
aResult->push_back( new PARAM_CFG_INT( wxT( "TxtLar" ),
|
||||
&m_PcbTextWidth,
|
||||
120, 0, 0xFFFF ) );
|
||||
aResult->push_back( new PARAM_CFG_INT( wxT( "MSegLar" ), &m_ModuleSegmentWidth,
|
||||
120, 0, 0xFFFF ) );
|
||||
}
|
||||
|
||||
|
||||
// see pcbstruct.h
|
||||
int BOARD_DESIGN_SETTINGS::GetVisibleLayers() const
|
||||
{
|
||||
|
@ -123,11 +166,6 @@ void BOARD_DESIGN_SETTINGS::SetCopperLayerCount( int aNewLayerCount )
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function SetEnabledLayers
|
||||
* changes the bit-mask of enabled layers
|
||||
* @param aMask = The new bit-mask of enabled layers
|
||||
*/
|
||||
void BOARD_DESIGN_SETTINGS::SetEnabledLayers( int aMask )
|
||||
{
|
||||
// Back and front layers are always enabled.
|
||||
|
|
|
@ -102,13 +102,13 @@ MODULE::MODULE( const MODULE& aModule ) :
|
|||
m_LocalSolderPasteMargin = aModule.m_LocalSolderPasteMargin;
|
||||
m_LocalSolderPasteMarginRatio = aModule.m_LocalSolderPasteMarginRatio;
|
||||
|
||||
/* Copy reference and value. */
|
||||
// Copy reference and value.
|
||||
m_Reference = new TEXTE_MODULE( *aModule.m_Reference );
|
||||
m_Reference->SetParent( this );
|
||||
m_Value = new TEXTE_MODULE( *aModule.m_Value );
|
||||
m_Value->SetParent( this );
|
||||
|
||||
/* Copy auxiliary data: Pads */
|
||||
// Copy auxiliary data: Pads
|
||||
m_Pads.DeleteAll();
|
||||
|
||||
for( D_PAD* pad = aModule.m_Pads; pad; pad = pad->Next() )
|
||||
|
@ -118,7 +118,7 @@ MODULE::MODULE( const MODULE& aModule ) :
|
|||
m_Pads.PushBack( newpad );
|
||||
}
|
||||
|
||||
/* Copy auxiliary data: Drawings */
|
||||
// Copy auxiliary data: Drawings
|
||||
m_Drawings.DeleteAll();
|
||||
|
||||
for( BOARD_ITEM* item = aModule.m_Drawings; item; item = item->Next() )
|
||||
|
@ -138,7 +138,7 @@ MODULE::MODULE( const MODULE& aModule ) :
|
|||
}
|
||||
}
|
||||
|
||||
/* Copy auxiliary data: 3D_Drawings info */
|
||||
// Copy auxiliary data: 3D_Drawings info
|
||||
m_3D_Drawings.DeleteAll();
|
||||
|
||||
for( S3D_MASTER* item = aModule.m_3D_Drawings; item; item = item->Next() )
|
||||
|
@ -217,11 +217,11 @@ void MODULE::Copy( MODULE* aModule )
|
|||
m_LocalSolderPasteMargin = aModule->m_LocalSolderPasteMargin;
|
||||
m_LocalSolderPasteMarginRatio = aModule->m_LocalSolderPasteMarginRatio;
|
||||
|
||||
/* Copy reference and value. */
|
||||
// Copy reference and value.
|
||||
m_Reference->Copy( aModule->m_Reference );
|
||||
m_Value->Copy( aModule->m_Value );
|
||||
|
||||
/* Copy auxiliary data: Pads */
|
||||
// Copy auxiliary data: Pads
|
||||
m_Pads.DeleteAll();
|
||||
|
||||
for( D_PAD* pad = aModule->m_Pads; pad; pad = pad->Next() )
|
||||
|
@ -231,7 +231,7 @@ void MODULE::Copy( MODULE* aModule )
|
|||
m_Pads.PushBack( newpad );
|
||||
}
|
||||
|
||||
/* Copy auxiliary data: Drawings */
|
||||
// Copy auxiliary data: Drawings
|
||||
m_Drawings.DeleteAll();
|
||||
|
||||
for( BOARD_ITEM* item = aModule->m_Drawings; item; item = item->Next() )
|
||||
|
@ -258,7 +258,7 @@ void MODULE::Copy( MODULE* aModule )
|
|||
}
|
||||
}
|
||||
|
||||
/* Copy auxiliary data: 3D_Drawings info */
|
||||
// Copy auxiliary data: 3D_Drawings info
|
||||
m_3D_Drawings.DeleteAll();
|
||||
|
||||
// Ensure there is one (or more) item in m_3D_Drawings
|
||||
|
@ -314,7 +314,7 @@ void MODULE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoi
|
|||
// Draws footprint anchor
|
||||
DrawAncre( aPanel, aDC, aOffset, DIM_ANCRE_MODULE, aDrawMode );
|
||||
|
||||
/* Draw graphic items */
|
||||
// Draw graphic items
|
||||
if( brd->IsElementVisible( MOD_REFERENCES_VISIBLE ) )
|
||||
{
|
||||
if( !(m_Reference->IsMoving()) )
|
||||
|
@ -549,8 +549,8 @@ D_PAD* MODULE::GetPad( const wxPoint& aPosition, int aLayerMask )
|
|||
{
|
||||
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
|
||||
{
|
||||
/* ... and on the correct layer. */
|
||||
if( ( pad->m_layerMask & aLayerMask ) == 0 )
|
||||
// ... and on the correct layer.
|
||||
if( ( pad->GetLayerMask() & aLayerMask ) == 0 )
|
||||
continue;
|
||||
|
||||
if( pad->HitTest( aPosition ) )
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef _MODULE_H_
|
||||
#define _MODULE_H_
|
||||
#ifndef MODULE_H_
|
||||
#define MODULE_H_
|
||||
|
||||
|
||||
#include <dlist.h>
|
||||
|
@ -420,4 +420,4 @@ private:
|
|||
};
|
||||
|
||||
|
||||
#endif // _MODULE_H_
|
||||
#endif // MODULE_H_
|
||||
|
|
|
@ -161,22 +161,9 @@ void MODULE::Flip( const wxPoint& aCentre )
|
|||
NEGATE( m_Orient );
|
||||
NORMALIZE_ANGLE_POS( m_Orient );
|
||||
|
||||
// Mirror inversion layers pads.
|
||||
// Mirror pads to other side of board about the x axis, i.e. vertically.
|
||||
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
|
||||
{
|
||||
pad->m_Pos.y -= m_Pos.y;
|
||||
pad->m_Pos.y = -pad->m_Pos.y;
|
||||
pad->m_Pos.y += m_Pos.y;
|
||||
|
||||
NEGATE( pad->m_Pos0.y );
|
||||
NEGATE( pad->m_Offset.y );
|
||||
NEGATE( pad->m_DeltaSize.y );
|
||||
|
||||
NEGATE_AND_NORMALIZE_ANGLE_POS( pad->m_Orient );
|
||||
|
||||
// flip pads layers
|
||||
pad->m_layerMask = ChangeSideMaskLayer( pad->m_layerMask );
|
||||
}
|
||||
pad->Flip( m_Pos.y );
|
||||
|
||||
// Mirror reference.
|
||||
pt_texte = m_Reference;
|
||||
|
@ -301,7 +288,7 @@ void MODULE::SetPosition( const wxPoint& newpos )
|
|||
|
||||
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
|
||||
{
|
||||
pad->m_Pos += delta;
|
||||
pad->SetPosition( pad->GetPosition() + delta );
|
||||
}
|
||||
|
||||
for( EDA_ITEM* item = m_Drawings; item; item = item->Next() )
|
||||
|
@ -334,25 +321,22 @@ void MODULE::SetPosition( const wxPoint& newpos )
|
|||
|
||||
void MODULE::SetOrientation( double newangle )
|
||||
{
|
||||
int px, py;
|
||||
double angleChange = newangle - m_Orient; // change in rotation
|
||||
wxPoint pt;
|
||||
|
||||
newangle -= m_Orient; // = Change in rotation
|
||||
NORMALIZE_ANGLE_POS( newangle );
|
||||
|
||||
m_Orient += newangle;
|
||||
|
||||
NORMALIZE_ANGLE_POS( m_Orient );
|
||||
m_Orient = newangle;
|
||||
|
||||
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
|
||||
{
|
||||
px = pad->m_Pos0.x;
|
||||
py = pad->m_Pos0.y;
|
||||
pt = pad->GetPos0();
|
||||
|
||||
pad->m_Orient += newangle; // change m_Orientation
|
||||
NORMALIZE_ANGLE_POS( pad->m_Orient );
|
||||
pad->SetOrientation( pad->GetOrientation() + angleChange );
|
||||
|
||||
RotatePoint( &px, &py, m_Orient );
|
||||
pad->m_Pos.x = m_Pos.x + px;
|
||||
pad->m_Pos.y = m_Pos.y + py;
|
||||
RotatePoint( &pt, m_Orient );
|
||||
|
||||
pad->SetPosition( GetPosition() + pt );
|
||||
}
|
||||
|
||||
// Update of the reference and value.
|
||||
|
|
|
@ -100,7 +100,7 @@ void NETINFO_ITEM::DisplayInfo( EDA_DRAW_FRAME* frame )
|
|||
if( pad->GetNet() == GetNet() )
|
||||
{
|
||||
count++;
|
||||
lengthdie += pad->m_LengthDie;
|
||||
lengthdie += pad->GetDieLength();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -172,6 +172,7 @@ void RATSNEST_ITEM::Draw( EDA_DRAW_PANEL* panel,
|
|||
|
||||
int color = g_ColorsSettings.GetItemColor(RATSNEST_VISIBLE);
|
||||
|
||||
GRLine( panel->GetClipBox(), DC, m_PadStart->m_Pos - aOffset,
|
||||
m_PadEnd->m_Pos - aOffset, 0, color );
|
||||
GRLine( panel->GetClipBox(), DC,
|
||||
m_PadStart->GetPosition() - aOffset,
|
||||
m_PadEnd->GetPosition() - aOffset, 0, color );
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <confirm.h>
|
||||
#include <kicad_string.h>
|
||||
#include <trigo.h>
|
||||
#include <protos.h>
|
||||
#include <richio.h>
|
||||
#include <wxstruct.h>
|
||||
#include <macros.h>
|
||||
|
@ -47,7 +48,8 @@
|
|||
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, PCB_PAD_T )
|
||||
D_PAD::D_PAD( MODULE* parent ) :
|
||||
BOARD_CONNECTED_ITEM( parent, PCB_PAD_T )
|
||||
{
|
||||
m_NumPadName = 0;
|
||||
|
||||
|
@ -55,40 +57,35 @@ D_PAD::D_PAD( MODULE* parent ) : BOARD_CONNECTED_ITEM( parent, PCB_PAD_T )
|
|||
m_Orient = 0; // Pad rotation in 1/10 degrees
|
||||
m_LengthDie = 0;
|
||||
|
||||
if( m_Parent && (m_Parent->Type() == PCB_MODULE_T) )
|
||||
if( m_Parent && m_Parent->Type() == PCB_MODULE_T )
|
||||
{
|
||||
m_Pos = ( (MODULE*) m_Parent )->GetPosition();
|
||||
m_Pos = GetParent()->GetPosition();
|
||||
}
|
||||
|
||||
m_PadShape = PAD_CIRCLE; // Shape: PAD_CIRCLE, PAD_RECT PAD_OVAL
|
||||
// PAD_TRAPEZOID
|
||||
m_Attribut = PAD_STANDARD; // Type: NORMAL, PAD_SMD, PAD_CONN
|
||||
m_DrillShape = PAD_CIRCLE; // Drill shape = circle
|
||||
m_PadShape = PAD_CIRCLE; // Shape: PAD_CIRCLE, PAD_RECT PAD_OVAL
|
||||
// PAD_TRAPEZOID
|
||||
m_Attribute = PAD_STANDARD; // Type: NORMAL, PAD_SMD, PAD_CONN
|
||||
m_DrillShape = PAD_CIRCLE; // Drill shape = circle
|
||||
m_LocalClearance = 0;
|
||||
m_LocalSolderMaskMargin = 0;
|
||||
m_LocalSolderPasteMargin = 0;
|
||||
m_LocalSolderPasteMarginRatio = 0.0;
|
||||
m_layerMask = PAD_STANDARD_DEFAULT_LAYERS; // set layers mask to
|
||||
// default for a standard pad
|
||||
|
||||
SetSubRatsnest( 0 ); // used in ratsnest calculations
|
||||
ComputeShapeMaxRadius();
|
||||
// set layers mask to default for a standard pad
|
||||
m_layerMask = PAD_STANDARD_DEFAULT_LAYERS;
|
||||
|
||||
SetSubRatsnest( 0 ); // used in ratsnest calculations
|
||||
|
||||
m_boundingRadius = -1;
|
||||
}
|
||||
|
||||
|
||||
D_PAD::~D_PAD()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/* Calculate the radius of the circle containing the pad.
|
||||
*/
|
||||
int D_PAD::GetMaxRadius() const
|
||||
int D_PAD::boundingRadius() const
|
||||
{
|
||||
int x, y;
|
||||
int radius;
|
||||
|
||||
switch( m_PadShape & 0x7F )
|
||||
switch( GetShape() )
|
||||
{
|
||||
case PAD_CIRCLE:
|
||||
radius = m_Size.x / 2;
|
||||
|
@ -110,30 +107,19 @@ int D_PAD::GetMaxRadius() const
|
|||
break;
|
||||
|
||||
default:
|
||||
radius = 0; // quiet compiler
|
||||
radius = 0;
|
||||
}
|
||||
|
||||
return radius;
|
||||
}
|
||||
|
||||
|
||||
/* Calculate the radius of the circle containing the pad.
|
||||
*/
|
||||
void D_PAD::ComputeShapeMaxRadius()
|
||||
{
|
||||
m_ShapeMaxRadius = GetMaxRadius();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function GetBoundingBox
|
||||
* returns the bounding box of this pad
|
||||
* Mainly used to redraw the screen area occupied by the pad
|
||||
*/
|
||||
EDA_RECT D_PAD::GetBoundingBox() const
|
||||
{
|
||||
EDA_RECT area;
|
||||
int radius = GetMaxRadius(); // Calculate the radius of the area, considered as a circle
|
||||
|
||||
// radius of pad area, enclosed in minimum sized circle
|
||||
int radius = boundingRadius();
|
||||
|
||||
area.SetOrigin( m_Pos );
|
||||
area.Inflate( radius );
|
||||
|
@ -142,6 +128,49 @@ EDA_RECT D_PAD::GetBoundingBox() const
|
|||
}
|
||||
|
||||
|
||||
void D_PAD::SetOrientation( double aAngle )
|
||||
{
|
||||
NORMALIZE_ANGLE_POS( aAngle );
|
||||
m_Orient = aAngle;
|
||||
}
|
||||
|
||||
|
||||
void D_PAD::Flip( int aTranslationY )
|
||||
{
|
||||
int y = GetPosition().y - aTranslationY;
|
||||
|
||||
y = -y; // invert about x axis.
|
||||
|
||||
y += aTranslationY;
|
||||
|
||||
SetY( y );
|
||||
|
||||
NEGATE( m_Pos0.y );
|
||||
NEGATE( m_Offset.y );
|
||||
NEGATE( m_DeltaSize.y );
|
||||
|
||||
SetOrientation( -GetOrientation() );
|
||||
|
||||
// flip pads layers
|
||||
SetLayerMask( ChangeSideMaskLayer( m_layerMask ) );
|
||||
|
||||
// m_boundingRadius = -1; the shape has not been changed
|
||||
}
|
||||
|
||||
|
||||
void D_PAD::AppendConfigs( PARAM_CFG_ARRAY* aResult )
|
||||
{
|
||||
aResult->push_back( new PARAM_CFG_INT( wxT( "PadDrlX" ), &m_Drill.x,
|
||||
320, 0, 0x7FFF ) );
|
||||
|
||||
aResult->push_back( new PARAM_CFG_INT( wxT( "PadDimH" ), &m_Size.x,
|
||||
550, 0, 0x7FFF ) );
|
||||
|
||||
aResult->push_back( new PARAM_CFG_INT( wxT( "PadDimV" ), &m_Size.y,
|
||||
550, 0, 0x7FFF ) );
|
||||
}
|
||||
|
||||
|
||||
// Returns the position of the pad.
|
||||
const wxPoint D_PAD::ReturnShapePos()
|
||||
{
|
||||
|
@ -265,9 +294,9 @@ void D_PAD::Copy( D_PAD* source )
|
|||
m_Size = source->m_Size;
|
||||
m_DeltaSize = source->m_DeltaSize;
|
||||
m_Pos0 = source->m_Pos0;
|
||||
m_ShapeMaxRadius = source->m_ShapeMaxRadius;
|
||||
m_boundingRadius = source->m_boundingRadius;
|
||||
m_PadShape = source->m_PadShape;
|
||||
m_Attribut = source->m_Attribut;
|
||||
m_Attribute = source->m_Attribute;
|
||||
m_Orient = source->m_Orient;
|
||||
m_LengthDie = source->m_LengthDie;
|
||||
m_LocalClearance = source->m_LocalClearance;
|
||||
|
@ -581,9 +610,9 @@ void D_PAD::DisplayInfo( EDA_DRAW_FRAME* frame )
|
|||
valeur_param( m_Pos.y, Line );
|
||||
frame->AppendMsgPanel( _( "Y pos" ), Line, LIGHTBLUE );
|
||||
|
||||
if( m_LengthDie )
|
||||
if( GetDieLength() )
|
||||
{
|
||||
valeur_param( m_LengthDie, Line );
|
||||
valeur_param( GetDieLength(), Line );
|
||||
frame->AppendMsgPanel( _( "Length on die" ), Line, CYAN );
|
||||
}
|
||||
}
|
||||
|
@ -596,12 +625,6 @@ bool D_PAD::IsOnLayer( int aLayer ) const
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function HitTest
|
||||
* tests if the given wxPoint is within the bounds of this object.
|
||||
* @param refPos A wxPoint to test
|
||||
* @return bool - true if a hit, else false
|
||||
*/
|
||||
bool D_PAD::HitTest( const wxPoint& refPos )
|
||||
{
|
||||
int dx, dy;
|
||||
|
@ -611,8 +634,10 @@ bool D_PAD::HitTest( const wxPoint& refPos )
|
|||
|
||||
wxPoint delta = refPos - shape_pos;
|
||||
|
||||
/* Quick test: a test point must be inside the circle. */
|
||||
if( ( abs( delta.x ) > m_ShapeMaxRadius ) || ( abs( delta.y ) > m_ShapeMaxRadius ) )
|
||||
// first test: a test point must be inside a minimum sized bounding circle.
|
||||
int radius = GetBoundingRadius();
|
||||
|
||||
if( ( abs( delta.x ) > radius ) || ( abs( delta.y ) > radius ) )
|
||||
return false;
|
||||
|
||||
dx = m_Size.x >> 1; // dx also is the radius for rounded pads
|
||||
|
@ -716,7 +741,7 @@ wxString D_PAD::ShowPadShape() const
|
|||
|
||||
wxString D_PAD::ShowPadAttr() const
|
||||
{
|
||||
switch( m_Attribut & 0x0F )
|
||||
switch( GetAttribute() )
|
||||
{
|
||||
case PAD_STANDARD:
|
||||
return _( "Std" );
|
||||
|
|
|
@ -27,14 +27,15 @@
|
|||
* @brief Pad object description
|
||||
*/
|
||||
|
||||
#ifndef _PAD_H_
|
||||
#define _PAD_H_
|
||||
#ifndef PAD_H_
|
||||
#define PAD_H_
|
||||
|
||||
|
||||
#include <class_board_item.h>
|
||||
#include <class_board_connected_item.h>
|
||||
#include <pad_shapes.h>
|
||||
#include <PolyLine.h>
|
||||
#include <param_config.h> // PARAM_CFG_ARRAY
|
||||
|
||||
|
||||
class LINE_READER;
|
||||
|
@ -91,86 +92,20 @@ public:
|
|||
|
||||
class D_PAD : public BOARD_CONNECTED_ITEM
|
||||
{
|
||||
private:
|
||||
wxString m_Netname; // Full net name like /mysheet/mysubsheet/vout used by Eeschema
|
||||
wxString m_ShortNetname; // short net name, like vout from /mysheet/mysubsheet/vout
|
||||
|
||||
/// Pad name (4 char) or a long identifier (used in pad name
|
||||
/// comparisons because this is faster than string comparison)
|
||||
union
|
||||
{
|
||||
#define PADNAMEZ 4
|
||||
char m_Padname[PADNAMEZ]; // zero padded at end to full size
|
||||
wxUint32 m_NumPadName; // same number of bytes as m_Padname[]
|
||||
};
|
||||
|
||||
int m_SubRatsnest; // variable used in rats nest computations
|
||||
// handle subnet (block) number in ratsnest connection
|
||||
|
||||
public:
|
||||
wxPoint m_Pos; // pad Position on board
|
||||
|
||||
int m_layerMask; // Bitwise layer :1= copper layer, 15= cmp,
|
||||
// 2..14 = internal layers
|
||||
// 16 .. 31 = technical layers
|
||||
|
||||
int m_PadShape; // Shape: PAD_CIRCLE, PAD_RECT, PAD_OVAL, PAD_TRAPEZOID
|
||||
int m_DrillShape; // Shape PAD_CIRCLE, PAD_OVAL
|
||||
|
||||
wxSize m_Drill; // Drill diam (drill shape = PAD_CIRCLE) or drill size
|
||||
// (shape = OVAL) for drill shape = PAD_CIRCLE, drill
|
||||
// diam = m_Drill.x
|
||||
|
||||
wxSize m_Offset; /* This parameter is useful only for oblong pads (it can be used for other
|
||||
* shapes, but without any interest).
|
||||
* this is the offset between the pad hole and the pad shape (you must
|
||||
* understand here pad shape = copper area around the hole)
|
||||
* Most of cases, the hole is the center of the shape (m_Offset = 0).
|
||||
* But some board designers use oblong pads with a hole moved to one of the
|
||||
* oblong pad shape ends.
|
||||
* In all cases the pad position is the pad hole.
|
||||
* The physical shape position (used to draw it for instance) is pad
|
||||
* position (m_Pos) + m_Offset.
|
||||
* D_PAD::ReturnShapePos() returns the physical shape position according to
|
||||
* the offset and the pad rotation.*/
|
||||
|
||||
wxSize m_Size; // X and Y size ( relative to orient 0)
|
||||
|
||||
wxSize m_DeltaSize; // delta on rectangular shapes
|
||||
|
||||
wxPoint m_Pos0; // Initial Pad position (i.e. pad position relative to the
|
||||
// module anchor, orientation 0
|
||||
|
||||
int m_ShapeMaxRadius; // radius of the circle containing the pad shape
|
||||
int m_Attribut; // NORMAL, PAD_SMD, PAD_CONN, PAD_HOLE_NOT_PLATED
|
||||
double m_Orient; // in 1/10 degrees
|
||||
|
||||
static int m_PadSketchModePenSize; // Pen size used to draw pads in sketch mode
|
||||
// (mode used to print pads on silkscreen layer)
|
||||
|
||||
int m_LengthDie; // Length net from pad to die on chip
|
||||
|
||||
// Local clearance. When null, the module default value is used.
|
||||
// when the module default value is null, the netclass value is used
|
||||
// Usually the local clearance is null
|
||||
int m_LocalClearance;
|
||||
|
||||
// Local mask margins: when NULL, the parent footprint design values are used
|
||||
int m_LocalSolderMaskMargin; // Local solder mask margin
|
||||
int m_LocalSolderPasteMargin; // Local solder paste margin absolute value
|
||||
double m_LocalSolderPasteMarginRatio; // Local solder mask margin ratio value of pad size
|
||||
// The final margin is the sum of these 2 values
|
||||
static int m_PadSketchModePenSize; ///< Pen size used to draw pads in sketch mode
|
||||
///< (mode used to print pads on silkscreen layer)
|
||||
|
||||
public:
|
||||
D_PAD( MODULE* parent );
|
||||
|
||||
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
||||
|
||||
~D_PAD();
|
||||
|
||||
void Copy( D_PAD* source );
|
||||
|
||||
D_PAD* Next() { return (D_PAD*) Pnext; }
|
||||
D_PAD* Next() const { return (D_PAD*) Pnext; }
|
||||
|
||||
MODULE* GetParent() const { return (MODULE*) m_Parent; }
|
||||
|
||||
void SetPadName( const wxString& name ); // Change pad name
|
||||
const wxString GetPadName() const;
|
||||
|
@ -202,36 +137,50 @@ public:
|
|||
* Function GetShape
|
||||
* @return the shape of this pad.
|
||||
*/
|
||||
int GetShape() const { return m_PadShape & 0xFF; }
|
||||
void SetShape( int aShape ) { m_PadShape = aShape; }
|
||||
PAD_SHAPE_T GetShape() const { return m_PadShape; }
|
||||
void SetShape( PAD_SHAPE_T aShape ) { m_PadShape = aShape; m_boundingRadius = -1; }
|
||||
|
||||
void SetPosition( const wxPoint& aPos ) { m_Pos = aPos; } // overload
|
||||
const wxPoint GetPosition() const // overload
|
||||
{
|
||||
return m_Pos;
|
||||
}
|
||||
const wxPoint GetPosition() const { return m_Pos; } // overload
|
||||
|
||||
void SetY( int y ) { m_Pos.y = y; }
|
||||
void SetX( int x ) { m_Pos.x = x; }
|
||||
|
||||
void SetPos0( const wxPoint& aPos ) { m_Pos0 = aPos; }
|
||||
const wxPoint& GetPos0() const { return m_Pos0; }
|
||||
|
||||
void SetSize( const wxSize& aSize ) { m_Size = aSize; }
|
||||
void SetY0( int y ) { m_Pos0.y = y; }
|
||||
void SetX0( int x ) { m_Pos0.x = x; }
|
||||
|
||||
void SetSize( const wxSize& aSize ) { m_Size = aSize; m_boundingRadius = -1; }
|
||||
const wxSize& GetSize() const { return m_Size; }
|
||||
|
||||
void SetDelta( const wxSize& aSize ) { m_DeltaSize = aSize; }
|
||||
void SetDelta( const wxSize& aSize ) { m_DeltaSize = aSize; m_boundingRadius = -1; }
|
||||
const wxSize& GetDelta() const { return m_DeltaSize; }
|
||||
|
||||
void SetDrillSize( const wxSize& aSize ) { m_Drill = aSize; }
|
||||
const wxSize& GetDrillSize() const { return m_Drill; }
|
||||
|
||||
void SetOffset( const wxSize& aOffset ) { m_Offset = aOffset; }
|
||||
const wxSize& GetOffset() const { return m_Offset; }
|
||||
void SetOffset( const wxPoint& aOffset ) { m_Offset = aOffset; }
|
||||
const wxPoint& GetOffset() const { return m_Offset; }
|
||||
|
||||
/**
|
||||
* Function Flip
|
||||
* flips this pad to the other outter most copper layer, back to front or
|
||||
* vice versa, and does this vertically, so the x coordinate is not affected.
|
||||
*
|
||||
* @param aTranslationY is the contribution of my 'y' position provided by
|
||||
* my parent module.
|
||||
*/
|
||||
void Flip( int aTranslationY );
|
||||
|
||||
/**
|
||||
* Function SetOrientation
|
||||
* sets the rotation angle of the pad.
|
||||
* @param aAngle is tenths of degrees, but will soon be degrees.
|
||||
* @param aAngle is tenths of degrees, but will soon be degrees. If it is
|
||||
* outside of 0 - 3600, then it will be normalized before being saved.
|
||||
*/
|
||||
void SetOrientation( double aAngle ) { m_Orient = aAngle; } // manage migration to degrees
|
||||
void SetOrientation( double aAngle );
|
||||
|
||||
/**
|
||||
* Function GetOrientation
|
||||
|
@ -239,25 +188,25 @@ public:
|
|||
*/
|
||||
double GetOrientation() const { return m_Orient; }
|
||||
|
||||
void SetDrillShape( int aDrillShape ) { m_DrillShape = aDrillShape; }
|
||||
int GetDrillShape() const { return m_DrillShape; }
|
||||
void SetDrillShape( PAD_SHAPE_T aDrillShape ) { m_DrillShape = aDrillShape; }
|
||||
PAD_SHAPE_T GetDrillShape() const { return m_DrillShape; }
|
||||
|
||||
void SetLayerMask( int aLayerMask ) { m_layerMask = aLayerMask; }
|
||||
int GetLayerMask() const { return m_layerMask; }
|
||||
|
||||
void SetAttribute( int aAttribute ) { m_Attribut = aAttribute; }
|
||||
int GetAttribute() const { return m_Attribut; }
|
||||
void SetAttribute( PAD_ATTR_T aAttribute ) { m_Attribute = aAttribute; }
|
||||
PAD_ATTR_T GetAttribute() const { return m_Attribute; }
|
||||
|
||||
void SetDieLength( int aLength ) { m_LengthDie = aLength; }
|
||||
int GetDieLength() const { return m_LengthDie; }
|
||||
|
||||
int GetLocalSolderMaskMargin() const { return m_LocalSolderMaskMargin; }
|
||||
int GetLocalSolderMaskMargin() const { return m_LocalSolderMaskMargin; }
|
||||
void SetLocalSolderMaskMargin( int aMargin ) { m_LocalSolderMaskMargin = aMargin; }
|
||||
|
||||
int GetLocalClearance() const { return m_LocalClearance; }
|
||||
void SetLocalClearance( int aClearance ) { m_LocalClearance = aClearance; }
|
||||
int GetLocalClearance() const { return m_LocalClearance; }
|
||||
void SetLocalClearance( int aClearance ) { m_LocalClearance = aClearance; }
|
||||
|
||||
int GetLocalSolderPasteMargin() const { return m_LocalSolderPasteMargin; }
|
||||
int GetLocalSolderPasteMargin() const { return m_LocalSolderPasteMargin; }
|
||||
void SetLocalSolderPasteMargin( int aMargin ) { m_LocalSolderPasteMargin = aMargin; }
|
||||
|
||||
double GetLocalSolderPasteMarginRatio() const { return m_LocalSolderPasteMarginRatio; }
|
||||
|
@ -382,18 +331,29 @@ public:
|
|||
|
||||
void ReturnStringPadName( wxString& text ) const; // Return pad name as string in a buffer
|
||||
|
||||
void ComputeShapeMaxRadius(); // compute radius
|
||||
|
||||
int GetMaxRadius() const;
|
||||
/**
|
||||
* Function GetBoundingRadius
|
||||
* returns the radius of a minimum sized circle which fully encloses this pad.
|
||||
*/
|
||||
int GetBoundingRadius()
|
||||
{
|
||||
// Any member function which would affect this calculation should set
|
||||
// m_boundingRadius to -1 to re-trigger the calculation from here.
|
||||
// Currently that is only m_Size, m_DeltaSize, and m_PadShape accessors.
|
||||
if( m_boundingRadius == -1 )
|
||||
{
|
||||
m_boundingRadius = boundingRadius();
|
||||
}
|
||||
return m_boundingRadius;
|
||||
}
|
||||
|
||||
const wxPoint ReturnShapePos();
|
||||
|
||||
/**
|
||||
* Function GetNet
|
||||
* Function GetSubRatsnest
|
||||
* @return int - the netcode
|
||||
*/
|
||||
int GetSubRatsnest() const { return m_SubRatsnest; }
|
||||
|
||||
void SetSubRatsnest( int aSubRatsnest ) { m_SubRatsnest = aSubRatsnest; }
|
||||
|
||||
|
||||
|
@ -475,13 +435,101 @@ public:
|
|||
*/
|
||||
wxString ShowPadAttr() const;
|
||||
|
||||
/**
|
||||
* Function AppendConfigs
|
||||
* appends to @a aResult the configuration setting accessors which will later
|
||||
* allow reading or writing of configuration file information directly into
|
||||
* this object.
|
||||
*/
|
||||
void AppendConfigs( PARAM_CFG_ARRAY* aResult );
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const; // overload
|
||||
#endif
|
||||
|
||||
|
||||
private:
|
||||
virtual EDA_ITEM* doClone() const;
|
||||
|
||||
/**
|
||||
* Function boundingRadius
|
||||
* returns a calculated radius of a bounding circle for this pad.
|
||||
*/
|
||||
int boundingRadius() const;
|
||||
|
||||
int m_boundingRadius; ///< radius of the circle containing the pad shape
|
||||
|
||||
|
||||
wxString m_Netname; ///< Full net name like /mysheet/mysubsheet/vout used by Eeschema
|
||||
wxString m_ShortNetname; ///< short net name, like vout from /mysheet/mysubsheet/vout
|
||||
|
||||
/// Pad name (4 char) or a long identifier (used in pad name
|
||||
/// comparisons because this is faster than string comparison)
|
||||
union
|
||||
{
|
||||
#define PADNAMEZ 4
|
||||
char m_Padname[PADNAMEZ]; // zero padded at end to full size
|
||||
wxUint32 m_NumPadName; // same number of bytes as m_Padname[]
|
||||
};
|
||||
|
||||
wxPoint m_Pos; ///< pad Position on board
|
||||
|
||||
PAD_SHAPE_T m_PadShape; ///< Shape: PAD_CIRCLE, PAD_RECT, PAD_OVAL, PAD_TRAPEZOID
|
||||
|
||||
|
||||
int m_SubRatsnest; ///< variable used in rats nest computations
|
||||
///< handle subnet (block) number in ratsnest connection
|
||||
|
||||
wxSize m_Drill; ///< Drill diam (drill shape = PAD_CIRCLE) or drill size
|
||||
///< (shape = OVAL) for drill shape = PAD_CIRCLE, drill
|
||||
///< diam = m_Drill.x
|
||||
|
||||
wxSize m_Size; ///< X and Y size ( relative to orient 0)
|
||||
|
||||
PAD_SHAPE_T m_DrillShape; ///< Shape PAD_CIRCLE, PAD_OVAL
|
||||
|
||||
/**
|
||||
* m_Offset is useful only for oblong pads (it can be used for other
|
||||
* shapes, but without any interest).
|
||||
* this is the offset between the pad hole and the pad shape (you must
|
||||
* understand here pad shape = copper area around the hole)
|
||||
* Most of cases, the hole is the center of the shape (m_Offset = 0).
|
||||
* But some board designers use oblong pads with a hole moved to one of the
|
||||
* oblong pad shape ends.
|
||||
* In all cases the pad position is the pad hole.
|
||||
* The physical shape position (used to draw it for instance) is pad
|
||||
* position (m_Pos) + m_Offset.
|
||||
* D_PAD::ReturnShapePos() returns the physical shape position according to
|
||||
* the offset and the pad rotation.
|
||||
*/
|
||||
wxPoint m_Offset;
|
||||
|
||||
int m_layerMask; ///< Bitwise layer :1= copper layer, 15= cmp,
|
||||
///< 2..14 = internal layers
|
||||
///< 16 .. 31 = technical layers
|
||||
|
||||
wxSize m_DeltaSize; ///< delta on rectangular shapes
|
||||
|
||||
wxPoint m_Pos0; ///< Initial Pad position (i.e. pad position relative to the
|
||||
///< module anchor, orientation 0)
|
||||
|
||||
PAD_ATTR_T m_Attribute; ///< NORMAL, PAD_SMD, PAD_CONN, PAD_HOLE_NOT_PLATED
|
||||
double m_Orient; ///< in 1/10 degrees
|
||||
|
||||
int m_LengthDie; ///< Length net from pad to die on chip
|
||||
|
||||
/// Local clearance. When null, the module default value is used.
|
||||
/// when the module default value is null, the netclass value is used
|
||||
/// Usually the local clearance is null
|
||||
int m_LocalClearance;
|
||||
|
||||
// Local mask margins: when 0, the parent footprint design values are used
|
||||
|
||||
int m_LocalSolderMaskMargin; ///< Local solder mask margin
|
||||
int m_LocalSolderPasteMargin; ///< Local solder paste margin absolute value
|
||||
|
||||
double m_LocalSolderPasteMarginRatio; ///< Local solder mask margin ratio value of pad size
|
||||
///< The final margin is the sum of these 2 values
|
||||
};
|
||||
|
||||
|
||||
#endif // _PAD_H_
|
||||
#endif // PAD_H_
|
||||
|
|
|
@ -234,7 +234,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDraw_mode, const wxPoi
|
|||
}
|
||||
|
||||
// if PAD_SMD pad and high contrast mode
|
||||
if( ( m_Attribut == PAD_SMD || m_Attribut == PAD_CONN ) && DisplayOpt.ContrastModeDisplay )
|
||||
if( ( GetAttribute() == PAD_SMD || GetAttribute() == PAD_CONN ) && DisplayOpt.ContrastModeDisplay )
|
||||
{
|
||||
// when routing tracks
|
||||
if( frame && frame->GetToolId() == ID_TRACK_BUTT )
|
||||
|
@ -346,7 +346,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDraw_mode, const wxPoi
|
|||
if( ( m_layerMask & ALL_CU_LAYERS ) == 0 )
|
||||
DisplayIsol = false;
|
||||
|
||||
if( m_Attribut == PAD_HOLE_NOT_PLATED )
|
||||
if( GetAttribute() == PAD_HOLE_NOT_PLATED )
|
||||
drawInfo.m_ShowNotPlatedHole = true;
|
||||
|
||||
drawInfo.m_DrawMode = aDraw_mode;
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include <class_board.h>
|
||||
#include <class_track.h>
|
||||
|
||||
/* local functions : */
|
||||
// local functions :
|
||||
static void clean_segments( PCB_EDIT_FRAME* aFrame );
|
||||
static void clean_vias( BOARD* aPcb );
|
||||
static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* aFrame );
|
||||
|
@ -93,7 +93,7 @@ void CleanupTracks( PCB_EDIT_FRAME* aFrame,
|
|||
aFrame->GetScreen()->ClearUndoRedoList();
|
||||
aFrame->SetCurItem( NULL );
|
||||
|
||||
/* Rebuild the pad infos (pad list and netcodes) to ensure an up to date info */
|
||||
// Rebuild the pad infos (pad list and netcodes) to ensure an up to date info
|
||||
aFrame->GetBoard()->m_Status_Pcb = 0;
|
||||
aFrame->GetBoard()->BuildListOfNets();
|
||||
|
||||
|
@ -110,22 +110,22 @@ void CleanupTracks( PCB_EDIT_FRAME* aFrame,
|
|||
{
|
||||
aFrame->SetStatusText( _( "Reconnect pads" ) );
|
||||
|
||||
/* Create missing segments when a track end covers a pad, but is not on the pad center */
|
||||
// Create missing segments when a track end covers a pad, but is not on the pad center
|
||||
ConnectDanglingEndToPad( aFrame );
|
||||
|
||||
/* Create missing segments when a track end covers a via, but is not on the via center */
|
||||
// Create missing segments when a track end covers a via, but is not on the via center
|
||||
ConnectDanglingEndToVia( aFrame->GetBoard() );
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Remove null segments and intermediate points on aligned segments */
|
||||
// Remove null segments and intermediate points on aligned segments
|
||||
if( aMergeSegments )
|
||||
{
|
||||
aFrame->SetStatusText( _( "Merge track segments" ) );
|
||||
clean_segments( aFrame );
|
||||
}
|
||||
|
||||
/* Delete dangling tracks */
|
||||
// Delete dangling tracks
|
||||
if( aDeleteUnconnectedSegm )
|
||||
{
|
||||
aFrame->SetStatusText( _( "Delete unconnected tracks" ) );
|
||||
|
@ -163,13 +163,13 @@ void clean_vias( BOARD * aPcb )
|
|||
if( alt_track->m_Start != track->m_Start )
|
||||
continue;
|
||||
|
||||
/* delete via */
|
||||
// delete via
|
||||
alt_track->UnLink();
|
||||
delete alt_track;
|
||||
}
|
||||
}
|
||||
|
||||
/* Delete Via on pads at same location */
|
||||
// Delete Via on pads at same location
|
||||
for( track = aPcb->m_Track; track != NULL; track = next_track )
|
||||
{
|
||||
next_track = track->Next();
|
||||
|
@ -179,9 +179,9 @@ void clean_vias( BOARD * aPcb )
|
|||
|
||||
D_PAD* pad = aPcb->GetPadFast( track->m_Start, ALL_CU_LAYERS );
|
||||
|
||||
if( pad && (pad->m_layerMask & EXTERNAL_LAYERS) == EXTERNAL_LAYERS ) // redundant Via
|
||||
if( pad && (pad->GetLayerMask() & EXTERNAL_LAYERS) == EXTERNAL_LAYERS ) // redundant Via
|
||||
{
|
||||
/* delete via */
|
||||
// delete via
|
||||
track->UnLink();
|
||||
delete track;
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* aFrame )
|
|||
flag_erase = 0; //Not connected indicator
|
||||
type_end = 0;
|
||||
|
||||
/* Is a pad found on a track end ? */
|
||||
// Is a pad found on a track end ?
|
||||
|
||||
masklayer = segment->ReturnMaskLayer();
|
||||
|
||||
|
@ -403,7 +403,7 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* aFrame )
|
|||
}
|
||||
|
||||
|
||||
/* Delete null length segments, and intermediate points .. */
|
||||
// Delete null length segments, and intermediate points ..
|
||||
static void clean_segments( PCB_EDIT_FRAME* aFrame )
|
||||
{
|
||||
TRACK* segment, * nextsegment;
|
||||
|
@ -422,11 +422,11 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
|
|||
if( !segment->IsNull() )
|
||||
continue;
|
||||
|
||||
/* Length segment = 0; delete it */
|
||||
// Length segment = 0; delete it
|
||||
segment->DeleteStructure();
|
||||
}
|
||||
|
||||
/* Delete redundant segments */
|
||||
// Delete redundant segments
|
||||
for( segment = aFrame->GetBoard()->m_Track, ii = 0; segment; segment = segment->Next(), ii++ )
|
||||
{
|
||||
for( other = segment->Next(); other; other = nextsegment )
|
||||
|
@ -455,7 +455,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
|
|||
erase = 1;
|
||||
}
|
||||
|
||||
/* Delete redundant point */
|
||||
// Delete redundant point
|
||||
if( erase )
|
||||
{
|
||||
ii--;
|
||||
|
@ -464,7 +464,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
|
|||
}
|
||||
}
|
||||
|
||||
/* delete intermediate points */
|
||||
// delete intermediate points
|
||||
ii = 0;
|
||||
|
||||
for( segment = aFrame->GetBoard()->m_Track; segment; segment = nextsegment )
|
||||
|
@ -498,13 +498,13 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
|
|||
if( segStart->Type() != PCB_TRACE_T )
|
||||
break;
|
||||
|
||||
/* We must have only one segment connected */
|
||||
// We must have only one segment connected
|
||||
segStart->SetState( BUSY, ON );
|
||||
other = segment->GetTrace( aFrame->GetBoard()->m_Track, NULL, START );
|
||||
segStart->SetState( BUSY, OFF );
|
||||
|
||||
if( other == NULL )
|
||||
flag = 1; /* OK */
|
||||
flag = 1; // OK
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -523,7 +523,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
|
|||
}
|
||||
}
|
||||
|
||||
/* search for a possible point that connects on the END point of the segment: */
|
||||
// search for a possible point that connects on the END point of the segment:
|
||||
for( segEnd = segment->Next(); ; )
|
||||
{
|
||||
segEnd = segment->GetTrace( segEnd, NULL, END );
|
||||
|
@ -536,13 +536,13 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
|
|||
if( segEnd->Type() != PCB_TRACE_T )
|
||||
break;
|
||||
|
||||
/* We must have only one segment connected */
|
||||
// We must have only one segment connected
|
||||
segEnd->SetState( BUSY, ON );
|
||||
other = segment->GetTrace( aFrame->GetBoard()->m_Track, NULL, END );
|
||||
segEnd->SetState( BUSY, OFF );
|
||||
|
||||
if( other == NULL )
|
||||
flag |= 2; /* Ok */
|
||||
flag |= 2; // Ok
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -563,7 +563,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
|
|||
}
|
||||
}
|
||||
|
||||
if( no_inc ) /* The current segment was modified, retry to merge it */
|
||||
if( no_inc ) // The current segment was modified, retry to merge it
|
||||
nextsegment = segment->Next();
|
||||
}
|
||||
|
||||
|
@ -571,7 +571,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
|
|||
}
|
||||
|
||||
|
||||
/* Function used by clean_segments.
|
||||
/** Function used by clean_segments.
|
||||
* Test alignment of aTrackRef and aCandidate (which must have a common end).
|
||||
* and see if the common point is not on a pad (i.e. if this common point can be removed).
|
||||
* the ending point of pt_ref is the start point (aEndType == START)
|
||||
|
@ -876,15 +876,15 @@ void ConnectDanglingEndToPad( PCB_EDIT_FRAME* aFrame )
|
|||
if( pad )
|
||||
{
|
||||
// test if the track start point is not exactly starting on the pad
|
||||
if( segment->m_Start != pad->m_Pos )
|
||||
if( segment->m_Start != pad->GetPosition() )
|
||||
{
|
||||
if( segment->GetTrace( aFrame->GetBoard()->m_Track, NULL, START ) == NULL )
|
||||
{
|
||||
TRACK* newTrack = (TRACK*)segment->Clone();
|
||||
TRACK* newTrack = (TRACK*) segment->Clone();
|
||||
|
||||
aFrame->GetBoard()->m_Track.Insert( newTrack, segment->Next() );
|
||||
|
||||
newTrack->m_End = pad->m_Pos;
|
||||
newTrack->m_End = pad->GetPosition();
|
||||
newTrack->start = segment;
|
||||
newTrack->end = pad;
|
||||
|
||||
|
@ -898,7 +898,7 @@ void ConnectDanglingEndToPad( PCB_EDIT_FRAME* aFrame )
|
|||
if( pad )
|
||||
{
|
||||
// test if the track end point is not exactly on the pad
|
||||
if( segment->m_End != pad->m_Pos )
|
||||
if( segment->m_End != pad->GetPosition() )
|
||||
{
|
||||
if( segment->GetTrace( aFrame->GetBoard()->m_Track, NULL, END ) == NULL )
|
||||
{
|
||||
|
@ -906,7 +906,7 @@ void ConnectDanglingEndToPad( PCB_EDIT_FRAME* aFrame )
|
|||
|
||||
aFrame->GetBoard()->m_Track.Insert( newTrack, segment->Next() );
|
||||
|
||||
newTrack->m_Start = pad->m_Pos;
|
||||
newTrack->m_Start = pad->GetPosition();
|
||||
|
||||
newTrack->start = pad;
|
||||
newTrack->end = segment;
|
||||
|
|
|
@ -235,8 +235,8 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
|
|||
// for through pads: pads on Front or Back board sides must be seen
|
||||
pad = (D_PAD*) item;
|
||||
|
||||
if( (pad->m_Attribut != PAD_SMD) &&
|
||||
(pad->m_Attribut != PAD_CONN) ) // a hole is present, so multiple layers
|
||||
if( (pad->GetAttribute() != PAD_SMD) &&
|
||||
(pad->GetAttribute() != PAD_CONN) ) // a hole is present, so multiple layers
|
||||
{
|
||||
// proceed to the common tests below, but without the parent module test,
|
||||
// by leaving module==NULL, but having pad != null
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
extern void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb );
|
||||
extern void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode );
|
||||
|
||||
/* Local functions */
|
||||
// Local functions
|
||||
static void RebuildTrackChain( BOARD* pcb );
|
||||
|
||||
|
||||
|
@ -276,7 +276,9 @@ void CONNECTIONS::SearchConnectionsPadsToIntersectingPads()
|
|||
D_PAD * pad = m_sortedPads[ii];
|
||||
pad->m_PadsConnected.clear();
|
||||
candidates.clear();
|
||||
CollectItemsNearTo( candidates, pad->ReturnShapePos(), pad->m_ShapeMaxRadius );
|
||||
|
||||
CollectItemsNearTo( candidates, pad->ReturnShapePos(), pad->GetBoundingRadius() );
|
||||
|
||||
// add pads to pad.m_PadsConnected, if they are connected
|
||||
for( unsigned jj = 0; jj < candidates.size(); jj++ )
|
||||
{
|
||||
|
@ -285,7 +287,7 @@ void CONNECTIONS::SearchConnectionsPadsToIntersectingPads()
|
|||
if( pad == candidate_pad )
|
||||
continue;
|
||||
|
||||
if( (pad->m_layerMask & candidate_pad->m_layerMask) == 0 )
|
||||
if( (pad->GetLayerMask() & candidate_pad->GetLayerMask()) == 0 )
|
||||
continue;
|
||||
if( pad->HitTest( item->GetPoint() ) )
|
||||
{
|
||||
|
@ -311,14 +313,16 @@ void CONNECTIONS::SearchTracksConnectedToPads()
|
|||
pad->m_TracksConnected.clear();
|
||||
candidates.clear();
|
||||
|
||||
CollectItemsNearTo( candidates, pad->GetPosition(), pad->m_ShapeMaxRadius );
|
||||
CollectItemsNearTo( candidates, pad->GetPosition(), pad->GetBoundingRadius() );
|
||||
|
||||
// add this pad to track.m_PadsConnected, if it is connected
|
||||
for( unsigned jj = 0; jj < candidates.size(); jj++ )
|
||||
{
|
||||
CONNECTED_POINT * cp_item = candidates[jj];
|
||||
if( (pad->m_layerMask & cp_item->GetTrack()->ReturnMaskLayer()) == 0 )
|
||||
CONNECTED_POINT* cp_item = candidates[jj];
|
||||
|
||||
if( (pad->GetLayerMask() & cp_item->GetTrack()->ReturnMaskLayer()) == 0 )
|
||||
continue;
|
||||
|
||||
if( pad->HitTest( cp_item->GetPoint() ) )
|
||||
{
|
||||
cp_item->GetTrack()->m_PadsConnected.push_back( pad );
|
||||
|
@ -731,7 +735,7 @@ void CONNECTIONS::Propagate_SubNets()
|
|||
pad->SetSubNet( curr_pad->GetSubNet() );
|
||||
}
|
||||
}
|
||||
else /* the track segment is not attached to a cluster */
|
||||
else // the track segment is not attached to a cluster
|
||||
{
|
||||
if( pad->GetSubNet() > 0 )
|
||||
{
|
||||
|
@ -758,16 +762,16 @@ void CONNECTIONS::Propagate_SubNets()
|
|||
// Examine connections between trcaks and pads
|
||||
for( ; curr_track != NULL; curr_track = curr_track->Next() )
|
||||
{
|
||||
/* First: handling connections to pads */
|
||||
// First: handling connections to pads
|
||||
for( unsigned ii = 0; ii < curr_track->m_PadsConnected.size(); ii++ )
|
||||
{
|
||||
D_PAD * pad = curr_track->m_PadsConnected[ii];
|
||||
|
||||
if( curr_track->GetSubNet() ) /* the track segment is already a cluster member */
|
||||
if( curr_track->GetSubNet() ) // the track segment is already a cluster member
|
||||
{
|
||||
if( pad->GetSubNet() > 0 )
|
||||
{
|
||||
/* The pad is already a cluster member, so we can merge the 2 clusters */
|
||||
// The pad is already a cluster member, so we can merge the 2 clusters
|
||||
Merge_SubNets( pad->GetSubNet(), curr_track->GetSubNet() );
|
||||
}
|
||||
else
|
||||
|
@ -777,11 +781,11 @@ void CONNECTIONS::Propagate_SubNets()
|
|||
pad->SetSubNet( curr_track->GetSubNet() );
|
||||
}
|
||||
}
|
||||
else /* the track segment is not attached to a cluster */
|
||||
else // the track segment is not attached to a cluster
|
||||
{
|
||||
if( pad->GetSubNet() > 0 )
|
||||
{
|
||||
/* it is connected to a pad in a cluster, merge this track */
|
||||
// it is connected to a pad in a cluster, merge this track
|
||||
curr_track->SetSubNet( pad->GetSubNet() );
|
||||
}
|
||||
else
|
||||
|
@ -795,13 +799,13 @@ void CONNECTIONS::Propagate_SubNets()
|
|||
}
|
||||
}
|
||||
|
||||
/* Test connections between segments */
|
||||
// Test connections between segments
|
||||
for( unsigned ii = 0; ii < curr_track->m_TracksConnected.size(); ii++ )
|
||||
{
|
||||
BOARD_CONNECTED_ITEM* track = curr_track->m_TracksConnected[ii];
|
||||
if( curr_track->GetSubNet() ) // The current track is already a cluster member
|
||||
{
|
||||
/* The other track is already a cluster member, so we can merge the 2 clusters */
|
||||
// The other track is already a cluster member, so we can merge the 2 clusters
|
||||
if( track->GetSubNet() )
|
||||
{
|
||||
Merge_SubNets( track->GetSubNet(), curr_track->GetSubNet() );
|
||||
|
@ -920,7 +924,7 @@ void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode )
|
|||
|
||||
m_Pcb->Test_Connections_To_Copper_Areas( aNetCode );
|
||||
|
||||
/* Search for the first and the last segment relative to the given net code */
|
||||
// Search for the first and the last segment relative to the given net code
|
||||
if( m_Pcb->m_Track )
|
||||
{
|
||||
CONNECTIONS connections( m_Pcb );
|
||||
|
@ -939,12 +943,12 @@ void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode )
|
|||
|
||||
Merge_SubNets_Connected_By_CopperAreas( m_Pcb, aNetCode );
|
||||
|
||||
/* rebuild the active ratsnest for this net */
|
||||
// rebuild the active ratsnest for this net
|
||||
DrawGeneralRatsnest( aDC, aNetCode );
|
||||
TestForActiveLinksInRatsnest( aNetCode );
|
||||
DrawGeneralRatsnest( aDC, aNetCode );
|
||||
|
||||
/* Display results */
|
||||
// Display results
|
||||
int net_notconnected_count = 0;
|
||||
NETINFO_ITEM* net = m_Pcb->FindNet( aNetCode );
|
||||
if( net ) // Should not occur, but ...
|
||||
|
@ -1058,7 +1062,7 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
|
|||
}
|
||||
}
|
||||
|
||||
/* Sort the track list by net codes: */
|
||||
// Sort the track list by net codes:
|
||||
RebuildTrackChain( m_Pcb );
|
||||
}
|
||||
|
||||
|
|
|
@ -120,14 +120,14 @@ void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties()
|
|||
// These 2 parameters are usually < 0, so prepare entering a negative
|
||||
// value, if current is 0
|
||||
PutValueInLocalUnits( *m_SolderPasteMarginCtrl,
|
||||
m_CurrentModule->m_LocalSolderPasteMargin,
|
||||
m_CurrentModule->GetLocalSolderPasteMargin(),
|
||||
internalUnit );
|
||||
if( m_CurrentModule->m_LocalSolderPasteMargin == 0 )
|
||||
if( m_CurrentModule->GetLocalSolderPasteMargin() == 0 )
|
||||
m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) +
|
||||
m_SolderPasteMarginCtrl->GetValue() );
|
||||
msg.Printf( wxT( "%.1f" ),
|
||||
m_CurrentModule->m_LocalSolderPasteMarginRatio * 100.0 );
|
||||
if( m_CurrentModule->m_LocalSolderPasteMarginRatio == 0.0 &&
|
||||
m_CurrentModule->GetLocalSolderPasteMarginRatio() * 100.0 );
|
||||
if( m_CurrentModule->GetLocalSolderPasteMarginRatio() == 0.0 &&
|
||||
msg[0] == '0') // Sometimes Printf add a sign if the value is small
|
||||
m_SolderPasteMarginRatioCtrl->SetValue( wxT("-") + msg );
|
||||
else
|
||||
|
@ -462,12 +462,13 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
// Initialize masks clearances
|
||||
m_CurrentModule->m_LocalClearance =
|
||||
ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, m_Parent->GetInternalUnits() );
|
||||
m_CurrentModule->m_LocalSolderMaskMargin =
|
||||
ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->GetInternalUnits() );
|
||||
m_CurrentModule->m_LocalSolderPasteMargin =
|
||||
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->GetInternalUnits() );
|
||||
m_CurrentModule->SetLocalClearance(
|
||||
ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, m_Parent->GetInternalUnits() ) );
|
||||
m_CurrentModule->SetLocalSolderMaskMargin(
|
||||
ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->GetInternalUnits() ) );
|
||||
m_CurrentModule->SetLocalSolderPasteMargin(
|
||||
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->GetInternalUnits() ) );
|
||||
|
||||
double dtmp = 0.0;
|
||||
msg = m_SolderPasteMarginRatioCtrl->GetValue();
|
||||
msg.ToDouble( &dtmp );
|
||||
|
@ -479,7 +480,7 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
|
|||
if( dtmp > +100 )
|
||||
dtmp = +100;
|
||||
|
||||
m_CurrentModule->m_LocalSolderPasteMarginRatio = dtmp / 100;
|
||||
m_CurrentModule->SetLocalSolderPasteMarginRatio( dtmp / 100 );
|
||||
|
||||
// Set Module Position
|
||||
modpos.x = ReturnValueFromTextCtrl( *m_ModPositionX, PCB_INTERNAL_UNIT );
|
||||
|
|
|
@ -61,7 +61,7 @@ void DIALOG_MODULE_MODULE_EDITOR::InitModeditProperties()
|
|||
|
||||
m_LastSelected3DShapeIndex = -1;
|
||||
|
||||
/* Init 3D shape list */
|
||||
// Init 3D shape list
|
||||
S3D_MASTER* draw3D = m_CurrentModule->m_3D_Drawings;
|
||||
|
||||
while( draw3D )
|
||||
|
@ -97,7 +97,7 @@ void DIALOG_MODULE_MODULE_EDITOR::InitModeditProperties()
|
|||
"Use this attribute for \"virtual\" components drawn on board (like a old ISA PC bus connector)" ) );
|
||||
#endif
|
||||
|
||||
/* Controls on right side of the dialog */
|
||||
// Controls on right side of the dialog
|
||||
switch( m_CurrentModule->m_Attributs & 255 )
|
||||
{
|
||||
case 0:
|
||||
|
@ -154,13 +154,13 @@ void DIALOG_MODULE_MODULE_EDITOR::InitModeditProperties()
|
|||
m_CurrentModule->m_LocalSolderMaskMargin, internalUnit );
|
||||
// These 2 parameters are usually < 0, so prepare entering a negative value, if current is 0
|
||||
PutValueInLocalUnits( *m_SolderPasteMarginCtrl,
|
||||
m_CurrentModule->m_LocalSolderPasteMargin, internalUnit );
|
||||
if( m_CurrentModule->m_LocalSolderPasteMargin == 0 )
|
||||
m_CurrentModule->GetLocalSolderPasteMargin(), internalUnit );
|
||||
if( m_CurrentModule->GetLocalSolderPasteMargin() == 0 )
|
||||
m_SolderPasteMarginCtrl->SetValue( wxT("-") + m_SolderPasteMarginCtrl->GetValue() );
|
||||
if( m_CurrentModule->m_LocalSolderPasteMarginRatio == 0.0 )
|
||||
msg.Printf( wxT( "-%.1f" ), m_CurrentModule->m_LocalSolderPasteMarginRatio * 100.0 );
|
||||
if( m_CurrentModule->GetLocalSolderPasteMarginRatio() == 0.0 )
|
||||
msg.Printf( wxT( "-%.1f" ), m_CurrentModule->GetLocalSolderPasteMarginRatio() * 100.0 );
|
||||
else
|
||||
msg.Printf( wxT( "%.1f" ), m_CurrentModule->m_LocalSolderPasteMarginRatio * 100.0 );
|
||||
msg.Printf( wxT( "%.1f" ), m_CurrentModule->GetLocalSolderPasteMarginRatio() * 100.0 );
|
||||
m_SolderPasteMarginRatioCtrl->SetValue( msg );
|
||||
|
||||
// if m_3D_ShapeNameListBox is not empty, preselect first 3D shape
|
||||
|
@ -369,21 +369,26 @@ void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event )
|
|||
|
||||
// Initialize masks clearances
|
||||
int internalUnit = m_Parent->GetInternalUnits();
|
||||
m_CurrentModule->m_LocalClearance =
|
||||
ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, internalUnit );
|
||||
m_CurrentModule->m_LocalSolderMaskMargin =
|
||||
ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, internalUnit );
|
||||
m_CurrentModule->m_LocalSolderPasteMargin =
|
||||
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, internalUnit );
|
||||
|
||||
m_CurrentModule->SetLocalClearance(
|
||||
ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, internalUnit ) );
|
||||
|
||||
m_CurrentModule->SetLocalSolderMaskMargin(
|
||||
ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, internalUnit ) );
|
||||
|
||||
m_CurrentModule->SetLocalSolderPasteMargin(
|
||||
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, internalUnit ) );
|
||||
double dtmp;
|
||||
wxString msg = m_SolderPasteMarginRatioCtrl->GetValue();
|
||||
msg.ToDouble( &dtmp );
|
||||
|
||||
// A margin ratio de -50% means no paste on a pad, the ratio must be >= 50 %
|
||||
if( dtmp < -50 )
|
||||
dtmp = -50;
|
||||
m_CurrentModule->m_LocalSolderPasteMarginRatio = dtmp / 100;
|
||||
|
||||
/* Update 3D shape list */
|
||||
m_CurrentModule->SetLocalSolderPasteMarginRatio( dtmp / 100 );
|
||||
|
||||
// Update 3D shape list
|
||||
int ii = m_3D_ShapeNameListBox->GetSelection();
|
||||
if ( ii >= 0 )
|
||||
TransfertDisplayTo3DValues( ii );
|
||||
|
|
|
@ -174,8 +174,7 @@ void DIALOG_GENDRILL::InitDisplayParams( void )
|
|||
|
||||
m_MicroViaDrillValue->Enable( m_microViasCount );
|
||||
|
||||
/* Count plated pad holes and not plated pad holes:
|
||||
*/
|
||||
// Count plated pad holes and not plated pad holes:
|
||||
m_platedPadsHoleCount = 0;
|
||||
m_notplatedPadsHoleCount = 0;
|
||||
|
||||
|
@ -183,11 +182,11 @@ void DIALOG_GENDRILL::InitDisplayParams( void )
|
|||
{
|
||||
for( D_PAD* pad = module->m_Pads; pad != NULL; pad = pad->Next() )
|
||||
{
|
||||
if( pad->m_DrillShape == PAD_CIRCLE )
|
||||
if( pad->GetDrillShape() == PAD_CIRCLE )
|
||||
{
|
||||
if( pad->m_Drill.x != 0 )
|
||||
if( pad->GetDrillSize().x != 0 )
|
||||
{
|
||||
if( pad->m_Attribut == PAD_HOLE_NOT_PLATED )
|
||||
if( pad->GetAttribute() == PAD_HOLE_NOT_PLATED )
|
||||
m_notplatedPadsHoleCount++;
|
||||
else
|
||||
m_platedPadsHoleCount++;
|
||||
|
@ -195,9 +194,9 @@ void DIALOG_GENDRILL::InitDisplayParams( void )
|
|||
}
|
||||
else
|
||||
{
|
||||
if( min( pad->m_Drill.x, pad->m_Drill.y ) != 0 )
|
||||
if( min( pad->GetDrillSize().x, pad->GetDrillSize().y ) != 0 )
|
||||
{
|
||||
if( pad->m_Attribut == PAD_HOLE_NOT_PLATED )
|
||||
if( pad->GetAttribute() == PAD_HOLE_NOT_PLATED )
|
||||
m_notplatedPadsHoleCount++;
|
||||
else
|
||||
m_platedPadsHoleCount++;
|
||||
|
@ -229,7 +228,7 @@ void DIALOG_GENDRILL::InitDisplayParams( void )
|
|||
}
|
||||
|
||||
|
||||
/* Save drill options: */
|
||||
// Save drill options:
|
||||
void DIALOG_GENDRILL::UpdateConfig()
|
||||
{
|
||||
SetParams();
|
||||
|
@ -275,7 +274,7 @@ void DIALOG_GENDRILL::OnOkClick( wxCommandEvent& event )
|
|||
|
||||
void DIALOG_GENDRILL::OnCancelClick( wxCommandEvent& event )
|
||||
{
|
||||
UpdateConfig(); /* Save drill options: */
|
||||
UpdateConfig(); // Save drill options:
|
||||
EndModal( wxID_CANCEL ); // Process the default cancel event (close dialog)
|
||||
}
|
||||
|
||||
|
@ -294,13 +293,13 @@ void DIALOG_GENDRILL::UpdatePrecisionOptions()
|
|||
{
|
||||
if( m_Choice_Unit->GetSelection()== 1 ) // Units = inches
|
||||
{
|
||||
/* inch options */
|
||||
// inch options
|
||||
m_Choice_Precision->SetString( 0, precisionListForInches[0].GetPrecisionString() );
|
||||
m_Choice_Precision->SetString( 1, precisionListForInches[1].GetPrecisionString() );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* metric options */
|
||||
// metric options
|
||||
m_Choice_Precision->SetString( 0, precisionListForMetric[0].GetPrecisionString() );
|
||||
m_Choice_Precision->SetString( 1, precisionListForMetric[1].GetPrecisionString() );
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <pcbcommon.h>
|
||||
|
||||
#include <wx/dcbuffer.h>
|
||||
#include <protos.h>
|
||||
|
||||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
|
@ -22,16 +23,14 @@
|
|||
#include <dialog_pad_properties_base.h>
|
||||
|
||||
|
||||
#define NBSHAPES 4
|
||||
int CodeShape[NBSHAPES] = // list of pad shapes.
|
||||
{
|
||||
// list of pad shapes.
|
||||
static PAD_SHAPE_T CodeShape[] = {
|
||||
PAD_CIRCLE, PAD_OVAL, PAD_RECT, PAD_TRAPEZOID
|
||||
};
|
||||
|
||||
|
||||
#define NBTYPES 4
|
||||
int CodeType[NBTYPES] =
|
||||
{
|
||||
static PAD_ATTR_T CodeType[NBTYPES] = {
|
||||
PAD_STANDARD, PAD_SMD, PAD_CONN, PAD_HOLE_NOT_PLATED
|
||||
};
|
||||
|
||||
|
@ -52,34 +51,35 @@ static long Std_Pad_Layers[NBTYPES] =
|
|||
};
|
||||
|
||||
|
||||
extern int ChangeSideMaskLayer( int masque );
|
||||
|
||||
|
||||
/**
|
||||
* class DIALOG_PAD_PROPERTIES, derived from DIALOG_PAD_PROPERTIES_BASE,
|
||||
* created by wxFormBuilder
|
||||
*/
|
||||
class DIALOG_PAD_PROPERTIES : public DIALOG_PAD_PROPERTIES_BASE
|
||||
{
|
||||
private:
|
||||
PCB_BASE_FRAME* m_Parent;
|
||||
D_PAD* m_CurrentPad; // Pad currently edited
|
||||
D_PAD* m_dummyPad; // a working copy used to show changes
|
||||
BOARD* m_Board;
|
||||
bool m_isFlipped; /* true if the parent footprint (therefore pads) is flipped (mirrored)
|
||||
* in this case, some Y coordinates values must be negated
|
||||
*/
|
||||
bool m_canUpdate;
|
||||
|
||||
public:
|
||||
DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* parent, D_PAD* Pad );
|
||||
DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aPad );
|
||||
~DIALOG_PAD_PROPERTIES()
|
||||
{
|
||||
delete m_dummyPad;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
PCB_BASE_FRAME* m_Parent;
|
||||
|
||||
D_PAD* m_CurrentPad; // pad currently being edited
|
||||
|
||||
D_PAD* m_dummyPad; // a working copy used to show changes
|
||||
|
||||
BOARD* m_Board;
|
||||
|
||||
D_PAD& m_Pad_Master;
|
||||
|
||||
bool m_isFlipped; // true if the parent footprint (therefore pads) is flipped (mirrored)
|
||||
// in this case, some Y coordinates values must be negated
|
||||
|
||||
bool m_canUpdate;
|
||||
|
||||
void initValues();
|
||||
void OnPadShapeSelection( wxCommandEvent& event );
|
||||
void OnDrillShapeSelected( wxCommandEvent& event );
|
||||
|
@ -95,6 +95,30 @@ private:
|
|||
};
|
||||
|
||||
|
||||
DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aPad ) :
|
||||
DIALOG_PAD_PROPERTIES_BASE( aParent ),
|
||||
m_Pad_Master( aParent->GetBoard()->GetDesignSettings().m_Pad_Master )
|
||||
{
|
||||
m_canUpdate = false;
|
||||
m_Parent = aParent;
|
||||
m_CurrentPad = aPad;
|
||||
m_Board = m_Parent->GetBoard();
|
||||
m_dummyPad = new D_PAD( (MODULE*) NULL );
|
||||
|
||||
if( aPad )
|
||||
m_dummyPad->Copy( aPad );
|
||||
else
|
||||
m_dummyPad->Copy( &m_Pad_Master );
|
||||
|
||||
initValues();
|
||||
|
||||
m_sdbSizer1OK->SetDefault();
|
||||
GetSizer()->SetSizeHints( this );
|
||||
Center();
|
||||
m_canUpdate = true;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
|
||||
{
|
||||
wxPaintDC dc( m_panelShowPad );
|
||||
|
@ -102,12 +126,12 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
|
|||
|
||||
int color = 0;
|
||||
|
||||
if( m_dummyPad->m_layerMask & LAYER_FRONT )
|
||||
if( m_dummyPad->GetLayerMask() & LAYER_FRONT )
|
||||
{
|
||||
color = m_Board->GetVisibleElementColor( PAD_FR_VISIBLE );
|
||||
}
|
||||
|
||||
if( m_dummyPad->m_layerMask & LAYER_BACK )
|
||||
if( m_dummyPad->GetLayerMask() & LAYER_BACK )
|
||||
{
|
||||
color |= m_Board->GetVisibleElementColor( PAD_BK_VISIBLE );
|
||||
}
|
||||
|
@ -117,26 +141,30 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
|
|||
|
||||
drawInfo.m_Color = color;
|
||||
drawInfo.m_HoleColor = DARKGRAY;
|
||||
drawInfo.m_Offset = m_dummyPad->m_Pos;
|
||||
drawInfo.m_Offset = m_dummyPad->GetPosition();
|
||||
drawInfo.m_Display_padnum = true;
|
||||
drawInfo.m_Display_netname = true;
|
||||
if( m_dummyPad->m_Attribut == PAD_HOLE_NOT_PLATED )
|
||||
if( m_dummyPad->GetAttribute() == PAD_HOLE_NOT_PLATED )
|
||||
drawInfo.m_ShowNotPlatedHole = true;
|
||||
|
||||
// Shows the local pad clearance
|
||||
drawInfo.m_PadClearance = m_dummyPad->m_LocalClearance;
|
||||
drawInfo.m_PadClearance = m_dummyPad->GetLocalClearance();
|
||||
|
||||
wxSize dc_size = dc.GetSize();
|
||||
dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
|
||||
|
||||
// Calculate a suitable scale to fit the available draw area
|
||||
int dim = m_dummyPad->m_Size.x + ABS( m_dummyPad->m_DeltaSize.y);
|
||||
if( m_dummyPad->m_LocalClearance > 0 )
|
||||
dim += m_dummyPad->m_LocalClearance * 2;
|
||||
double scale = (double) dc_size.x / dim;
|
||||
dim = m_dummyPad->m_Size.y + ABS( m_dummyPad->m_DeltaSize.x);
|
||||
if( m_dummyPad->m_LocalClearance > 0 )
|
||||
dim += m_dummyPad->m_LocalClearance * 2;
|
||||
int dim = m_dummyPad->GetSize().x + ABS( m_dummyPad->GetDelta().y);
|
||||
|
||||
if( m_dummyPad->GetLocalClearance() > 0 )
|
||||
dim += m_dummyPad->GetLocalClearance() * 2;
|
||||
|
||||
double scale = (double) dc_size.x / dim;
|
||||
|
||||
dim = m_dummyPad->GetSize().y + ABS( m_dummyPad->GetDelta().x);
|
||||
if( m_dummyPad->GetLocalClearance() > 0 )
|
||||
dim += m_dummyPad->GetLocalClearance() * 2;
|
||||
|
||||
double altscale = (double) dc_size.y / dim;
|
||||
scale = MIN( scale, altscale );
|
||||
|
||||
|
@ -151,31 +179,6 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
|
|||
}
|
||||
|
||||
|
||||
/*******************************************************************************************/
|
||||
DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* parent, D_PAD* Pad ) :
|
||||
DIALOG_PAD_PROPERTIES_BASE( parent )
|
||||
/*******************************************************************************************/
|
||||
{
|
||||
m_canUpdate = false;
|
||||
m_Parent = parent;
|
||||
m_CurrentPad = Pad;
|
||||
m_Board = m_Parent->GetBoard();
|
||||
m_dummyPad = new D_PAD( (MODULE*) NULL );
|
||||
|
||||
if( m_CurrentPad )
|
||||
m_dummyPad->Copy( m_CurrentPad );
|
||||
else
|
||||
m_dummyPad->Copy( &g_Pad_Master );
|
||||
|
||||
initValues();
|
||||
|
||||
m_sdbSizer1OK->SetDefault();
|
||||
GetSizer()->SetSizeHints( this );
|
||||
Center();
|
||||
m_canUpdate = true;
|
||||
}
|
||||
|
||||
|
||||
void PCB_BASE_FRAME::InstallPadOptionsFrame( D_PAD* Pad )
|
||||
{
|
||||
DIALOG_PAD_PROPERTIES dlg( this, Pad );
|
||||
|
@ -188,30 +191,42 @@ void PCB_BASE_FRAME::InstallPadOptionsFrame( D_PAD* Pad )
|
|||
void DIALOG_PAD_PROPERTIES::initValues()
|
||||
/***************************************/
|
||||
{
|
||||
SetFocus(); // Required under wxGTK if we want to demiss the dialog with the ESC key
|
||||
SetFocus(); // Required under wxGTK if we want to dismiss the dialog with the ESC key
|
||||
|
||||
int internalUnits = m_Parent->GetInternalUnits();
|
||||
wxString msg;
|
||||
double angle;
|
||||
|
||||
int internalUnits = m_Parent->GetInternalUnits();
|
||||
wxString msg;
|
||||
m_isFlipped = false;
|
||||
|
||||
if( m_CurrentPad )
|
||||
{
|
||||
MODULE* Module = (MODULE*) m_CurrentPad->GetParent();
|
||||
if( Module->GetLayer() == LAYER_N_BACK )
|
||||
MODULE* module = m_CurrentPad->GetParent();
|
||||
|
||||
if( module->GetLayer() == LAYER_N_BACK )
|
||||
{
|
||||
m_isFlipped = true;
|
||||
m_staticModuleSideValue->SetLabel( _( "Back side (footprint is mirrored)" ) );
|
||||
}
|
||||
msg.Printf( wxT( "%.1f" ), (double) Module->m_Orient / 10 );
|
||||
|
||||
msg.Printf( wxT( "%.1f" ), (double) module->GetOrientation() / 10 );
|
||||
m_staticModuleRotValue->SetLabel( msg );
|
||||
}
|
||||
|
||||
if( m_isFlipped )
|
||||
{
|
||||
NEGATE( m_dummyPad->m_Offset.y );
|
||||
NEGATE( m_dummyPad->m_DeltaSize.y );
|
||||
/* flip pads layers*/
|
||||
m_dummyPad->m_layerMask = ChangeSideMaskLayer( m_dummyPad->m_layerMask );
|
||||
wxPoint pt = m_dummyPad->GetOffset();
|
||||
NEGATE( pt.y );
|
||||
m_dummyPad->SetOffset( pt );
|
||||
|
||||
wxSize sz = m_dummyPad->GetDelta();
|
||||
NEGATE( sz.y );
|
||||
m_dummyPad->SetDelta( sz );
|
||||
|
||||
// flip pad's layers
|
||||
m_dummyPad->SetLayerMask( ChangeSideMaskLayer( m_dummyPad->GetLayerMask() ) );
|
||||
}
|
||||
|
||||
m_staticTextWarningPadFlipped->Show(m_isFlipped);
|
||||
|
||||
m_PadNumCtrl->SetValue( m_dummyPad->GetPadName() );
|
||||
|
@ -236,70 +251,73 @@ void DIALOG_PAD_PROPERTIES::initValues()
|
|||
m_SolderPasteMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
|
||||
|
||||
// Display current pad parameters units:
|
||||
PutValueInLocalUnits( *m_PadPosition_X_Ctrl, m_dummyPad->m_Pos.x, internalUnits );
|
||||
PutValueInLocalUnits( *m_PadPosition_Y_Ctrl, m_dummyPad->m_Pos.y, internalUnits );
|
||||
PutValueInLocalUnits( *m_PadPosition_X_Ctrl, m_dummyPad->GetPosition().x, internalUnits );
|
||||
PutValueInLocalUnits( *m_PadPosition_Y_Ctrl, m_dummyPad->GetPosition().y, internalUnits );
|
||||
|
||||
PutValueInLocalUnits( *m_PadDrill_X_Ctrl, m_dummyPad->m_Drill.x, internalUnits );
|
||||
PutValueInLocalUnits( *m_PadDrill_Y_Ctrl, m_dummyPad->m_Drill.y, internalUnits );
|
||||
PutValueInLocalUnits( *m_PadDrill_X_Ctrl, m_dummyPad->GetDrillSize().x, internalUnits );
|
||||
PutValueInLocalUnits( *m_PadDrill_Y_Ctrl, m_dummyPad->GetDrillSize().y, internalUnits );
|
||||
|
||||
PutValueInLocalUnits( *m_ShapeSize_X_Ctrl, m_dummyPad->m_Size.x, internalUnits );
|
||||
PutValueInLocalUnits( *m_ShapeSize_Y_Ctrl, m_dummyPad->m_Size.y, internalUnits );
|
||||
PutValueInLocalUnits( *m_ShapeSize_X_Ctrl, m_dummyPad->GetSize().x, internalUnits );
|
||||
PutValueInLocalUnits( *m_ShapeSize_Y_Ctrl, m_dummyPad->GetSize().y, internalUnits );
|
||||
|
||||
PutValueInLocalUnits( *m_ShapeOffset_X_Ctrl, m_dummyPad->m_Offset.x, internalUnits );
|
||||
PutValueInLocalUnits( *m_ShapeOffset_Y_Ctrl, m_dummyPad->m_Offset.y, internalUnits );
|
||||
PutValueInLocalUnits( *m_ShapeOffset_X_Ctrl, m_dummyPad->GetOffset().x, internalUnits );
|
||||
PutValueInLocalUnits( *m_ShapeOffset_Y_Ctrl, m_dummyPad->GetOffset().y, internalUnits );
|
||||
|
||||
if( m_dummyPad->m_DeltaSize.x )
|
||||
if( m_dummyPad->GetDelta().x )
|
||||
{
|
||||
PutValueInLocalUnits( *m_ShapeDelta_Ctrl, m_dummyPad->m_DeltaSize.x, internalUnits );
|
||||
PutValueInLocalUnits( *m_ShapeDelta_Ctrl, m_dummyPad->GetDelta().x, internalUnits );
|
||||
m_radioBtnDeltaXdir->SetValue(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
PutValueInLocalUnits( *m_ShapeDelta_Ctrl, m_dummyPad->m_DeltaSize.y, internalUnits );
|
||||
PutValueInLocalUnits( *m_ShapeDelta_Ctrl, m_dummyPad->GetDelta().y, internalUnits );
|
||||
m_radioBtnDeltaYdir->SetValue(true);
|
||||
}
|
||||
|
||||
PutValueInLocalUnits( *m_LengthDieCtrl, m_dummyPad->m_LengthDie, internalUnits );
|
||||
PutValueInLocalUnits( *m_LengthDieCtrl, m_dummyPad->GetDieLength(), internalUnits );
|
||||
|
||||
PutValueInLocalUnits( *m_NetClearanceValueCtrl, m_dummyPad->m_LocalClearance, internalUnits );
|
||||
PutValueInLocalUnits( *m_NetClearanceValueCtrl, m_dummyPad->GetLocalClearance(), internalUnits );
|
||||
PutValueInLocalUnits( *m_SolderMaskMarginCtrl,
|
||||
m_dummyPad->m_LocalSolderMaskMargin,
|
||||
m_dummyPad->GetLocalSolderMaskMargin(),
|
||||
internalUnits );
|
||||
|
||||
// These 2 parameters are usually < 0, so prepare entering a negative value, if current is 0
|
||||
PutValueInLocalUnits( *m_SolderPasteMarginCtrl,
|
||||
m_dummyPad->m_LocalSolderPasteMargin,
|
||||
m_dummyPad->GetLocalSolderPasteMargin(),
|
||||
internalUnits );
|
||||
if( m_dummyPad->m_LocalSolderPasteMargin == 0 )
|
||||
m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) + m_SolderPasteMarginCtrl->GetValue() );
|
||||
msg.Printf( wxT( "%.1f" ), m_dummyPad->m_LocalSolderPasteMarginRatio * 100.0 );
|
||||
|
||||
if( m_dummyPad->m_LocalSolderPasteMarginRatio == 0.0
|
||||
&& msg[0] == '0' ) // Sometimes Printf add a sign if the value is small
|
||||
if( m_dummyPad->GetLocalSolderPasteMargin() == 0 )
|
||||
m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) + m_SolderPasteMarginCtrl->GetValue() );
|
||||
|
||||
msg.Printf( wxT( "%.1f" ), m_dummyPad->GetLocalSolderPasteMarginRatio() * 100.0 );
|
||||
|
||||
if( m_dummyPad->GetLocalSolderPasteMarginRatio() == 0.0 && msg[0] == '0' )
|
||||
// Sometimes Printf adds a sign if the value is small
|
||||
m_SolderPasteMarginRatioCtrl->SetValue( wxT( "-" ) + msg );
|
||||
else
|
||||
m_SolderPasteMarginRatioCtrl->SetValue( msg );
|
||||
|
||||
if( m_CurrentPad )
|
||||
{
|
||||
MODULE* Module = (MODULE*) m_CurrentPad->GetParent();
|
||||
m_dummyPad->m_Orient = m_CurrentPad->m_Orient - Module->m_Orient;
|
||||
MODULE* module = m_CurrentPad->GetParent();
|
||||
|
||||
angle = m_CurrentPad->GetOrientation() - module->GetOrientation();
|
||||
|
||||
if( m_isFlipped )
|
||||
NEGATE( m_dummyPad->m_Orient );
|
||||
NEGATE( angle );
|
||||
|
||||
m_dummyPad->SetOrientation( angle );
|
||||
}
|
||||
|
||||
// adjust rotation agngle to -1800 to 1800 in internal units (0.1 deg)
|
||||
NORMALIZE_ANGLE_180( m_dummyPad->m_Orient );
|
||||
angle = m_dummyPad->GetOrientation();
|
||||
|
||||
NORMALIZE_ANGLE_180( angle ); // ? normalizing is in D_PAD::SetOrientation()
|
||||
|
||||
// Set layers used by this pad: :
|
||||
SetPadLayersList( m_dummyPad->m_layerMask );
|
||||
|
||||
msg.Clear();
|
||||
msg << m_dummyPad->m_Orient;
|
||||
m_PadOrientCtrl->SetValue( msg );
|
||||
SetPadLayersList( m_dummyPad->GetLayerMask() );
|
||||
|
||||
// Pad Orient
|
||||
switch( int( m_dummyPad->GetOrientation() ) )
|
||||
switch( int( angle ) )
|
||||
{
|
||||
case 0:
|
||||
m_PadOrient->SetSelection( 0 );
|
||||
|
@ -323,7 +341,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
|
|||
break;
|
||||
}
|
||||
|
||||
switch( m_dummyPad->m_PadShape )
|
||||
switch( m_dummyPad->GetShape() )
|
||||
{
|
||||
default:
|
||||
case PAD_CIRCLE:
|
||||
|
@ -343,14 +361,15 @@ void DIALOG_PAD_PROPERTIES::initValues()
|
|||
break;
|
||||
}
|
||||
|
||||
msg.Printf( wxT( "%g" ), m_dummyPad->GetOrientation() );
|
||||
msg.Printf( wxT( "%g" ), angle );
|
||||
m_PadOrientCtrl->SetValue( msg );
|
||||
|
||||
// Type of pad selection
|
||||
m_PadType->SetSelection( 0 );
|
||||
|
||||
for( int ii = 0; ii < NBTYPES; ii++ )
|
||||
{
|
||||
if( CodeType[ii] == m_dummyPad->m_Attribut )
|
||||
if( CodeType[ii] == m_dummyPad->GetAttribute() )
|
||||
{
|
||||
m_PadType->SetSelection( ii );
|
||||
break;
|
||||
|
@ -359,12 +378,13 @@ void DIALOG_PAD_PROPERTIES::initValues()
|
|||
|
||||
// Enable/disable Pad name,and pad length die
|
||||
// (disable for NPTH pads (mechanical pads)
|
||||
bool enable = m_dummyPad->m_Attribut != PAD_HOLE_NOT_PLATED;
|
||||
bool enable = m_dummyPad->GetAttribute() != PAD_HOLE_NOT_PLATED;
|
||||
|
||||
m_PadNumCtrl->Enable( enable );
|
||||
m_PadNetNameCtrl->Enable( enable );
|
||||
m_LengthDieCtrl->Enable( enable );
|
||||
|
||||
if( m_dummyPad->m_DrillShape != PAD_OVAL )
|
||||
if( m_dummyPad->GetDrillShape() != PAD_OVAL )
|
||||
m_DrillShapeCtrl->SetSelection( 0 );
|
||||
else
|
||||
m_DrillShapeCtrl->SetSelection( 1 );
|
||||
|
@ -386,9 +406,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
|
|||
m_PadLayerECO2->SetLabel( m_Board->GetLayerName( ECO2_N ) );
|
||||
m_PadLayerDraft->SetLabel( m_Board->GetLayerName( DRAW_N ) );
|
||||
|
||||
/* All init are done,
|
||||
* Update some dialog widgets state (Enable/disable options):
|
||||
*/
|
||||
// Update some dialog widgets state (Enable/disable options):
|
||||
wxCommandEvent cmd_event;
|
||||
OnPadShapeSelection( cmd_event );
|
||||
OnDrillShapeSelected( cmd_event );
|
||||
|
@ -439,7 +457,7 @@ void DIALOG_PAD_PROPERTIES::OnPadShapeSelection( wxCommandEvent& event )
|
|||
void DIALOG_PAD_PROPERTIES::OnDrillShapeSelected( wxCommandEvent& event )
|
||||
/**********************************************************************/
|
||||
{
|
||||
if( (m_PadType->GetSelection() == 1) || (m_PadType->GetSelection() == 2) )
|
||||
if( m_PadType->GetSelection() == 1 || m_PadType->GetSelection() == 2 )
|
||||
{
|
||||
// pad type = SMD or CONN: no hole allowed
|
||||
m_PadDrill_X_Ctrl->Enable( false );
|
||||
|
@ -473,19 +491,19 @@ void DIALOG_PAD_PROPERTIES::PadOrientEvent( wxCommandEvent& event )
|
|||
switch( m_PadOrient->GetSelection() )
|
||||
{
|
||||
case 0:
|
||||
m_dummyPad->m_Orient = 0;
|
||||
m_dummyPad->SetOrientation( 0 );
|
||||
break;
|
||||
|
||||
case 1:
|
||||
m_dummyPad->m_Orient = 900;
|
||||
m_dummyPad->SetOrientation( 900 );
|
||||
break;
|
||||
|
||||
case 2:
|
||||
m_dummyPad->m_Orient = -900;
|
||||
m_dummyPad->SetOrientation( -900 );
|
||||
break;
|
||||
|
||||
case 3:
|
||||
m_dummyPad->m_Orient = 1800;
|
||||
m_dummyPad->SetOrientation( 1800 );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -590,13 +608,15 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
|
|||
if( !success ) // An error on parameters has occured
|
||||
return;
|
||||
|
||||
TransfertDataToPad( &g_Pad_Master, false );
|
||||
TransfertDataToPad( &m_Pad_Master, false );
|
||||
|
||||
if( m_CurrentPad ) // Set current Pad parameters
|
||||
{
|
||||
MODULE* Module = (MODULE*) m_CurrentPad->GetParent();
|
||||
m_Parent->SaveCopyInUndoList( Module, UR_CHANGED );
|
||||
Module->m_LastEdit_Time = time( NULL );
|
||||
wxSize size;
|
||||
MODULE* module = m_CurrentPad->GetParent();
|
||||
|
||||
m_Parent->SaveCopyInUndoList( module, UR_CHANGED );
|
||||
module->m_LastEdit_Time = time( NULL );
|
||||
|
||||
// redraw the area where the pad was, without pad (delete pad on screen)
|
||||
m_CurrentPad->SetFlags( DO_NOT_DRAW );
|
||||
|
@ -604,45 +624,54 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
|
|||
m_CurrentPad->ClearFlags( DO_NOT_DRAW );
|
||||
|
||||
// Update values
|
||||
m_CurrentPad->m_PadShape = g_Pad_Master.m_PadShape;
|
||||
m_CurrentPad->m_Attribut = g_Pad_Master.m_Attribut;
|
||||
m_CurrentPad->SetShape( m_Pad_Master.GetShape() );
|
||||
m_CurrentPad->SetAttribute( m_Pad_Master.GetAttribute() );
|
||||
|
||||
if( m_CurrentPad->m_Pos != g_Pad_Master.m_Pos )
|
||||
if( m_CurrentPad->GetPosition() != m_Pad_Master.GetPosition() )
|
||||
{
|
||||
m_CurrentPad->m_Pos = g_Pad_Master.m_Pos;
|
||||
rastnestIsChanged = true;
|
||||
m_CurrentPad->SetPosition( m_Pad_Master.GetPosition() );
|
||||
rastnestIsChanged = true;
|
||||
}
|
||||
|
||||
/* compute the pos 0 value, i.e. pad position for module orient = 0 i.e.
|
||||
* refer to module origin (module position) */
|
||||
m_CurrentPad->m_Pos0 = m_CurrentPad->m_Pos;
|
||||
m_CurrentPad->m_Pos0 -= Module->m_Pos;
|
||||
m_CurrentPad->m_Orient = (g_Pad_Master.m_Orient * isign) + Module->m_Orient;
|
||||
RotatePoint( &m_CurrentPad->m_Pos0.x, &m_CurrentPad->m_Pos0.y, -Module->m_Orient );
|
||||
// compute the pos 0 value, i.e. pad position for module with orientation = 0
|
||||
// i.e. relative to module origin (module position)
|
||||
wxPoint pt = m_CurrentPad->GetPosition() - module->GetPosition();
|
||||
|
||||
m_CurrentPad->m_Size = g_Pad_Master.m_Size;
|
||||
m_CurrentPad->m_DeltaSize = g_Pad_Master.m_DeltaSize;
|
||||
m_CurrentPad->m_DeltaSize.y *= isign;
|
||||
m_CurrentPad->m_Drill = g_Pad_Master.m_Drill;
|
||||
m_CurrentPad->m_DrillShape = g_Pad_Master.m_DrillShape;
|
||||
m_CurrentPad->m_Offset = g_Pad_Master.m_Offset;
|
||||
m_CurrentPad->m_Offset.y *= isign;
|
||||
RotatePoint( &pt, -module->GetOrientation() );
|
||||
|
||||
m_CurrentPad->m_LengthDie = g_Pad_Master.m_LengthDie;
|
||||
m_CurrentPad->SetPos0( pt );
|
||||
|
||||
if( m_CurrentPad->m_layerMask != g_Pad_Master.m_layerMask )
|
||||
m_CurrentPad->SetOrientation( m_Pad_Master.GetOrientation() * isign + module->GetOrientation() );
|
||||
|
||||
m_CurrentPad->SetSize( m_Pad_Master.GetSize() );
|
||||
|
||||
size = m_Pad_Master.GetDelta();
|
||||
size.y *= isign;
|
||||
m_CurrentPad->SetDelta( size );
|
||||
|
||||
m_CurrentPad->SetDrillSize( m_Pad_Master.GetDrillSize() );
|
||||
m_CurrentPad->SetDrillShape( m_Pad_Master.GetDrillShape() );
|
||||
|
||||
wxPoint offset = m_Pad_Master.GetOffset();
|
||||
offset.y *= isign;
|
||||
m_CurrentPad->SetOffset( offset );
|
||||
|
||||
m_CurrentPad->SetDieLength( m_Pad_Master.GetDieLength() );
|
||||
|
||||
if( m_CurrentPad->GetLayerMask() != m_Pad_Master.GetLayerMask() )
|
||||
{
|
||||
rastnestIsChanged = true;
|
||||
m_CurrentPad->m_layerMask = g_Pad_Master.m_layerMask;
|
||||
m_CurrentPad->SetLayerMask( m_Pad_Master.GetLayerMask() );
|
||||
}
|
||||
|
||||
if( m_isFlipped )
|
||||
m_CurrentPad->m_layerMask = ChangeSideMaskLayer( m_CurrentPad->m_layerMask );
|
||||
m_CurrentPad->SetLayerMask( ChangeSideMaskLayer( m_CurrentPad->GetLayerMask() ) );
|
||||
|
||||
m_CurrentPad->SetPadName( g_Pad_Master.GetPadName() );
|
||||
m_CurrentPad->SetPadName( m_Pad_Master.GetPadName() );
|
||||
|
||||
if( m_CurrentPad->GetNetname() != g_Pad_Master.GetNetname() )
|
||||
if( m_CurrentPad->GetNetname() != m_Pad_Master.GetNetname() )
|
||||
{
|
||||
if( g_Pad_Master.GetNetname().IsEmpty() )
|
||||
if( m_Pad_Master.GetNetname().IsEmpty() )
|
||||
{
|
||||
rastnestIsChanged = true;
|
||||
m_CurrentPad->SetNet( 0 );
|
||||
|
@ -650,11 +679,11 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
|
|||
}
|
||||
else
|
||||
{
|
||||
const NETINFO_ITEM* net = m_Parent->GetBoard()->FindNet( g_Pad_Master.GetNetname() );
|
||||
const NETINFO_ITEM* net = m_Parent->GetBoard()->FindNet( m_Pad_Master.GetNetname() );
|
||||
if( net )
|
||||
{
|
||||
rastnestIsChanged = true;
|
||||
m_CurrentPad->SetNetname( g_Pad_Master.GetNetname() );
|
||||
m_CurrentPad->SetNetname( m_Pad_Master.GetNetname() );
|
||||
m_CurrentPad->SetNet( net->GetNet() );
|
||||
}
|
||||
else
|
||||
|
@ -662,14 +691,12 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
|
|||
}
|
||||
}
|
||||
|
||||
m_CurrentPad->m_LocalClearance = g_Pad_Master.m_LocalClearance;
|
||||
m_CurrentPad->m_LocalSolderMaskMargin = g_Pad_Master.m_LocalSolderMaskMargin;
|
||||
m_CurrentPad->m_LocalSolderPasteMargin = g_Pad_Master.m_LocalSolderPasteMargin;
|
||||
m_CurrentPad->m_LocalSolderPasteMarginRatio = g_Pad_Master.m_LocalSolderPasteMarginRatio;
|
||||
m_CurrentPad->SetLocalClearance( m_Pad_Master.GetLocalClearance() );
|
||||
m_CurrentPad->SetLocalSolderMaskMargin( m_Pad_Master.GetLocalSolderMaskMargin() );
|
||||
m_CurrentPad->SetLocalSolderPasteMargin( m_Pad_Master.GetLocalSolderPasteMargin() );
|
||||
m_CurrentPad->SetLocalSolderPasteMarginRatio( m_Pad_Master.GetLocalSolderPasteMarginRatio() );
|
||||
|
||||
m_CurrentPad->ComputeShapeMaxRadius();
|
||||
|
||||
Module->CalculateBoundingBox();
|
||||
module->CalculateBoundingBox();
|
||||
m_CurrentPad->DisplayInfo( m_Parent );
|
||||
|
||||
// redraw the area where the pad was
|
||||
|
@ -688,92 +715,108 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
|
|||
// user will be prompted for an error
|
||||
bool DIALOG_PAD_PROPERTIES::TransfertDataToPad( D_PAD* aPad, bool aPromptOnError )
|
||||
{
|
||||
long PadLayerMask;
|
||||
int internalUnits = m_Parent->GetInternalUnits();
|
||||
wxString msg;
|
||||
long padLayerMask;
|
||||
int internalUnits = m_Parent->GetInternalUnits();
|
||||
wxString msg;
|
||||
int x, y;
|
||||
|
||||
aPad->m_Attribut = CodeType[m_PadType->GetSelection()];
|
||||
aPad->m_PadShape = CodeShape[m_PadShape->GetSelection()];
|
||||
aPad->SetAttribute( CodeType[m_PadType->GetSelection()] );
|
||||
aPad->SetShape( CodeShape[m_PadShape->GetSelection()] );
|
||||
|
||||
// Read pad clearances values:
|
||||
aPad->m_LocalClearance = ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl,
|
||||
internalUnits );
|
||||
aPad->m_LocalSolderMaskMargin = ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl,
|
||||
internalUnits );
|
||||
aPad->m_LocalSolderPasteMargin = ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl,
|
||||
internalUnits );
|
||||
aPad->SetLocalClearance( ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl,
|
||||
internalUnits ) );
|
||||
aPad->SetLocalSolderMaskMargin( ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl,
|
||||
internalUnits ) );
|
||||
aPad->SetLocalSolderPasteMargin( ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl,
|
||||
internalUnits ) );
|
||||
double dtmp = 0.0;
|
||||
msg = m_SolderPasteMarginRatioCtrl->GetValue();
|
||||
msg.ToDouble( &dtmp );
|
||||
|
||||
// A margin ratio de -50% means no paste on a pad, the ratio must be >= 50 %
|
||||
// A margin ratio of -50% means no paste on a pad, the ratio must be >= 50 %
|
||||
if( dtmp < -50 )
|
||||
dtmp = -50;
|
||||
if( dtmp > +100 )
|
||||
dtmp = +100;
|
||||
aPad->m_LocalSolderPasteMarginRatio = dtmp / 100;
|
||||
|
||||
aPad->SetLocalSolderPasteMarginRatio( dtmp / 100 );
|
||||
|
||||
// Read pad position:
|
||||
aPad->m_Pos.x = ReturnValueFromTextCtrl( *m_PadPosition_X_Ctrl, internalUnits );
|
||||
aPad->m_Pos.y = ReturnValueFromTextCtrl( *m_PadPosition_Y_Ctrl, internalUnits );
|
||||
aPad->m_Pos0 = aPad->m_Pos;
|
||||
x = ReturnValueFromTextCtrl( *m_PadPosition_X_Ctrl, internalUnits );
|
||||
y = ReturnValueFromTextCtrl( *m_PadPosition_Y_Ctrl, internalUnits );
|
||||
|
||||
aPad->SetPosition( wxPoint( x, y ) );
|
||||
aPad->SetPos0( wxPoint( x, y ) );
|
||||
|
||||
// Read pad drill:
|
||||
aPad->m_Drill.x = ReturnValueFromTextCtrl( *m_PadDrill_X_Ctrl, internalUnits );
|
||||
aPad->m_Drill.y = ReturnValueFromTextCtrl( *m_PadDrill_Y_Ctrl, internalUnits );
|
||||
x = ReturnValueFromTextCtrl( *m_PadDrill_X_Ctrl, internalUnits );
|
||||
y = ReturnValueFromTextCtrl( *m_PadDrill_Y_Ctrl, internalUnits );
|
||||
|
||||
if( m_DrillShapeCtrl->GetSelection() == 0 )
|
||||
{
|
||||
aPad->m_DrillShape = PAD_CIRCLE;
|
||||
aPad->m_Drill.y = aPad->m_Drill.x;
|
||||
aPad->SetDrillShape( PAD_CIRCLE );
|
||||
y = x;
|
||||
}
|
||||
else
|
||||
aPad->m_DrillShape = PAD_OVAL;
|
||||
aPad->SetDrillShape( PAD_OVAL );
|
||||
|
||||
aPad->SetDrillSize( wxSize( x, y ) );
|
||||
|
||||
// Read pad shape size:
|
||||
aPad->m_Size.x = ReturnValueFromTextCtrl( *m_ShapeSize_X_Ctrl, internalUnits );
|
||||
aPad->m_Size.y = ReturnValueFromTextCtrl( *m_ShapeSize_Y_Ctrl, internalUnits );
|
||||
if( aPad->m_PadShape == PAD_CIRCLE )
|
||||
aPad->m_Size.y = aPad->m_Size.x;
|
||||
x = ReturnValueFromTextCtrl( *m_ShapeSize_X_Ctrl, internalUnits );
|
||||
y = ReturnValueFromTextCtrl( *m_ShapeSize_Y_Ctrl, internalUnits );
|
||||
if( aPad->GetShape() == PAD_CIRCLE )
|
||||
y = x;
|
||||
|
||||
aPad->SetSize( wxSize( x, y ) );
|
||||
|
||||
// Read pad length die
|
||||
aPad->SetDieLength( ReturnValueFromTextCtrl( *m_LengthDieCtrl, internalUnits ) );
|
||||
|
||||
// Read pad shape delta size:
|
||||
// m_DeltaSize.x or m_DeltaSize.y must be NULL. for a trapezoid.
|
||||
wxSize delta;
|
||||
|
||||
if( m_radioBtnDeltaXdir->GetValue() )
|
||||
delta.x = ReturnValueFromTextCtrl( *m_ShapeDelta_Ctrl, internalUnits );
|
||||
else
|
||||
delta.y = ReturnValueFromTextCtrl( *m_ShapeDelta_Ctrl, internalUnits );
|
||||
aPad->m_DeltaSize = delta;
|
||||
|
||||
// Read pad lenght die
|
||||
aPad->m_LengthDie = ReturnValueFromTextCtrl( *m_LengthDieCtrl, internalUnits );
|
||||
|
||||
// Test bad values (be sure delta values are not to large)
|
||||
// Test bad values (be sure delta values are not too large)
|
||||
// remember DeltaSize.x is the Y size variation
|
||||
bool error = false;
|
||||
if( (aPad->m_DeltaSize.x < 0) && (aPad->m_DeltaSize.x <= -aPad->m_Size.y) )
|
||||
|
||||
if( delta.x < 0 && delta.x <= -aPad->GetSize().y )
|
||||
{
|
||||
aPad->m_DeltaSize.x = -aPad->m_Size.y + 2;
|
||||
error = true;
|
||||
}
|
||||
if( (aPad->m_DeltaSize.x > 0) && (aPad->m_DeltaSize.x >= aPad->m_Size.y) )
|
||||
{
|
||||
aPad->m_DeltaSize.x = aPad->m_Size.y - 2;
|
||||
error = true;
|
||||
}
|
||||
if( (aPad->m_DeltaSize.y < 0) && (aPad->m_DeltaSize.y <= -aPad->m_Size.x) )
|
||||
{
|
||||
aPad->m_DeltaSize.y = -aPad->m_Size.x + 2;
|
||||
error = true;
|
||||
}
|
||||
if( (aPad->m_DeltaSize.y > 0) && (aPad->m_DeltaSize.y >= aPad->m_Size.x) )
|
||||
{
|
||||
aPad->m_DeltaSize.y = aPad->m_Size.x - 2;
|
||||
delta.x = -aPad->GetSize().y + 2;
|
||||
error = true;
|
||||
}
|
||||
|
||||
if( delta.x > 0 && delta.x >= aPad->GetSize().y )
|
||||
{
|
||||
delta.x = aPad->GetSize().y - 2;
|
||||
error = true;
|
||||
}
|
||||
|
||||
if( delta.y < 0 && delta.y <= -aPad->GetSize().x )
|
||||
{
|
||||
delta.y = -aPad->GetSize().x + 2;
|
||||
error = true;
|
||||
}
|
||||
|
||||
if( delta.y > 0 && delta.y >= aPad->GetSize().x )
|
||||
{
|
||||
delta.y = aPad->GetSize().x - 2;
|
||||
error = true;
|
||||
}
|
||||
|
||||
aPad->SetDelta( delta );
|
||||
|
||||
// Read pad shape offset:
|
||||
aPad->m_Offset.x = ReturnValueFromTextCtrl( *m_ShapeOffset_X_Ctrl, internalUnits );
|
||||
aPad->m_Offset.y = ReturnValueFromTextCtrl( *m_ShapeOffset_Y_Ctrl, internalUnits );
|
||||
x = ReturnValueFromTextCtrl( *m_ShapeOffset_X_Ctrl, internalUnits );
|
||||
y = ReturnValueFromTextCtrl( *m_ShapeOffset_Y_Ctrl, internalUnits );
|
||||
aPad->SetOffset( wxPoint( x, y ) );
|
||||
|
||||
double orient_value = 0;
|
||||
msg = m_PadOrientCtrl->GetValue();
|
||||
|
@ -786,41 +829,45 @@ bool DIALOG_PAD_PROPERTIES::TransfertDataToPad( D_PAD* aPad, bool aPromptOnError
|
|||
aPad->SetNetname( m_PadNetNameCtrl->GetValue() );
|
||||
|
||||
// Clear some values, according to the pad type and shape
|
||||
switch( aPad->m_PadShape )
|
||||
switch( aPad->GetShape() )
|
||||
{
|
||||
case PAD_CIRCLE:
|
||||
aPad->m_Offset = wxSize( 0, 0 );
|
||||
aPad->m_DeltaSize = wxSize( 0, 0 );
|
||||
aPad->m_Size.y = aPad->m_Size.x;
|
||||
aPad->SetOffset( wxPoint( 0, 0 ) );
|
||||
aPad->SetDelta( wxSize( 0, 0 ) );
|
||||
x = aPad->GetSize().x;
|
||||
aPad->SetSize( wxSize( x, x ) );
|
||||
break;
|
||||
|
||||
case PAD_RECT:
|
||||
aPad->m_DeltaSize = wxSize( 0, 0 );
|
||||
aPad->SetDelta( wxSize( 0, 0 ) );
|
||||
break;
|
||||
|
||||
case PAD_OVAL:
|
||||
aPad->m_DeltaSize = wxSize( 0, 0 );
|
||||
aPad->SetDelta( wxSize( 0, 0 ) );
|
||||
break;
|
||||
|
||||
case PAD_TRAPEZOID:
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
switch( aPad->m_Attribut )
|
||||
switch( aPad->GetAttribute() )
|
||||
{
|
||||
case PAD_STANDARD:
|
||||
break;
|
||||
|
||||
case PAD_CONN:
|
||||
case PAD_SMD:
|
||||
aPad->m_Offset = wxSize( 0, 0 );
|
||||
aPad->m_Drill = wxSize( 0, 0 );
|
||||
aPad->SetOffset( wxPoint( 0, 0 ) );
|
||||
aPad->SetDrillSize( wxSize( 0, 0 ) );
|
||||
break;
|
||||
|
||||
case PAD_HOLE_NOT_PLATED:
|
||||
// Mechanical purpose only:
|
||||
// no offset, no net name, no pad name allowed
|
||||
aPad->m_Offset = wxSize( 0, 0 );
|
||||
aPad->SetOffset( wxPoint( 0, 0 ) );
|
||||
aPad->SetPadName( wxEmptyString );
|
||||
aPad->SetNetname( wxEmptyString );
|
||||
break;
|
||||
|
@ -830,67 +877,67 @@ bool DIALOG_PAD_PROPERTIES::TransfertDataToPad( D_PAD* aPad, bool aPromptOnError
|
|||
break;
|
||||
}
|
||||
|
||||
PadLayerMask = 0;
|
||||
padLayerMask = 0;
|
||||
|
||||
switch( m_rbCopperLayersSel->GetSelection() )
|
||||
{
|
||||
case 0:
|
||||
PadLayerMask |= LAYER_FRONT;
|
||||
break;
|
||||
case 0:
|
||||
padLayerMask |= LAYER_FRONT;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
PadLayerMask |= LAYER_BACK;
|
||||
break;
|
||||
case 1:
|
||||
padLayerMask |= LAYER_BACK;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
PadLayerMask |= ALL_CU_LAYERS;
|
||||
break;
|
||||
case 2:
|
||||
padLayerMask |= ALL_CU_LAYERS;
|
||||
break;
|
||||
|
||||
case 3: // No copper layers
|
||||
break;
|
||||
case 3: // No copper layers
|
||||
break;
|
||||
}
|
||||
|
||||
if( m_PadLayerAdhCmp->GetValue() )
|
||||
PadLayerMask |= ADHESIVE_LAYER_FRONT;
|
||||
padLayerMask |= ADHESIVE_LAYER_FRONT;
|
||||
if( m_PadLayerAdhCu->GetValue() )
|
||||
PadLayerMask |= ADHESIVE_LAYER_BACK;
|
||||
padLayerMask |= ADHESIVE_LAYER_BACK;
|
||||
if( m_PadLayerPateCmp->GetValue() )
|
||||
PadLayerMask |= SOLDERPASTE_LAYER_FRONT;
|
||||
padLayerMask |= SOLDERPASTE_LAYER_FRONT;
|
||||
if( m_PadLayerPateCu->GetValue() )
|
||||
PadLayerMask |= SOLDERPASTE_LAYER_BACK;
|
||||
padLayerMask |= SOLDERPASTE_LAYER_BACK;
|
||||
if( m_PadLayerSilkCmp->GetValue() )
|
||||
PadLayerMask |= SILKSCREEN_LAYER_FRONT;
|
||||
padLayerMask |= SILKSCREEN_LAYER_FRONT;
|
||||
if( m_PadLayerSilkCu->GetValue() )
|
||||
PadLayerMask |= SILKSCREEN_LAYER_BACK;
|
||||
padLayerMask |= SILKSCREEN_LAYER_BACK;
|
||||
if( m_PadLayerMaskCmp->GetValue() )
|
||||
PadLayerMask |= SOLDERMASK_LAYER_FRONT;
|
||||
padLayerMask |= SOLDERMASK_LAYER_FRONT;
|
||||
if( m_PadLayerMaskCu->GetValue() )
|
||||
PadLayerMask |= SOLDERMASK_LAYER_BACK;
|
||||
padLayerMask |= SOLDERMASK_LAYER_BACK;
|
||||
if( m_PadLayerECO1->GetValue() )
|
||||
PadLayerMask |= ECO1_LAYER;
|
||||
padLayerMask |= ECO1_LAYER;
|
||||
if( m_PadLayerECO2->GetValue() )
|
||||
PadLayerMask |= ECO2_LAYER;
|
||||
padLayerMask |= ECO2_LAYER;
|
||||
if( m_PadLayerDraft->GetValue() )
|
||||
PadLayerMask |= DRAW_LAYER;
|
||||
padLayerMask |= DRAW_LAYER;
|
||||
|
||||
aPad->m_layerMask = PadLayerMask;
|
||||
aPad->SetLayerMask( padLayerMask );
|
||||
|
||||
/* Test for incorrect values */
|
||||
// Test for incorrect values
|
||||
if( aPromptOnError )
|
||||
{
|
||||
if( (aPad->m_Size.x < aPad->m_Drill.x)
|
||||
|| (aPad->m_Size.y < aPad->m_Drill.y) )
|
||||
if( (aPad->GetSize().x < aPad->GetDrillSize().x) || (aPad->GetSize().y < aPad->GetDrillSize().y) )
|
||||
{
|
||||
DisplayError( NULL, _( "Incorrect value for pad drill: pad drill bigger than pad size" ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
int padlayers_mask = PadLayerMask & (LAYER_BACK | LAYER_FRONT);
|
||||
int padlayers_mask = padLayerMask & (LAYER_BACK | LAYER_FRONT);
|
||||
if( padlayers_mask == 0 )
|
||||
{
|
||||
if( aPad->m_Drill.x || aPad->m_Drill.y )
|
||||
if( aPad->GetDrillSize().x || aPad->GetDrillSize().y )
|
||||
{
|
||||
msg = _( "Error: pad is not on a copper layer and has a hole" );
|
||||
if( aPad->m_Attribut == PAD_HOLE_NOT_PLATED )
|
||||
if( aPad->GetAttribute() == PAD_HOLE_NOT_PLATED )
|
||||
{
|
||||
msg += wxT("\n");
|
||||
msg += _( "For NPTH pad, set pad drill value to pad size value,\n\
|
||||
|
@ -901,8 +948,8 @@ if you do not want this pad plotted in gerber files");
|
|||
}
|
||||
}
|
||||
|
||||
if( ( aPad->m_Size.x / 2 <= ABS( aPad->m_Offset.x ) )
|
||||
|| ( aPad->m_Size.y / 2 <= ABS( aPad->m_Offset.y ) ) )
|
||||
if( aPad->GetSize().x / 2 <= ABS( aPad->GetOffset().x ) ||
|
||||
aPad->GetSize().y / 2 <= ABS( aPad->GetOffset().y ) )
|
||||
{
|
||||
DisplayError( NULL, _( "Incorrect value for pad offset" ) );
|
||||
return false;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -35,36 +35,36 @@ DRAG_SEGM::DRAG_SEGM( TRACK* segm )
|
|||
/* Redraw the list of segments starting in g_DragSegmentList, while moving a footprint */
|
||||
void DrawSegmentWhileMovingFootprint( EDA_DRAW_PANEL* panel, wxDC* DC )
|
||||
{
|
||||
D_PAD* pt_pad;
|
||||
TRACK* Track;
|
||||
|
||||
if( g_DragSegmentList.size() == 0 )
|
||||
return;
|
||||
|
||||
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
||||
{
|
||||
wxPoint pos;
|
||||
Track = g_DragSegmentList[ii].m_Segm;
|
||||
|
||||
TRACK* track = g_DragSegmentList[ii].m_Segm;
|
||||
|
||||
#ifndef USE_WX_OVERLAY
|
||||
Track->Draw( panel, DC, GR_XOR ); // erase from screen at old position
|
||||
track->Draw( panel, DC, GR_XOR ); // erase from screen at old position
|
||||
#endif
|
||||
pt_pad = g_DragSegmentList[ii].m_Pad_Start;
|
||||
|
||||
if( pt_pad )
|
||||
D_PAD* pad = g_DragSegmentList[ii].m_Pad_Start;
|
||||
|
||||
if( pad )
|
||||
{
|
||||
pos = pt_pad->m_Pos - g_Offset_Module;
|
||||
Track->m_Start = pos;
|
||||
pos = pad->GetPosition() - g_Offset_Module;
|
||||
track->m_Start = pos;
|
||||
}
|
||||
|
||||
pt_pad = g_DragSegmentList[ii].m_Pad_End;
|
||||
pad = g_DragSegmentList[ii].m_Pad_End;
|
||||
|
||||
if( pt_pad )
|
||||
if( pad )
|
||||
{
|
||||
pos = pt_pad->m_Pos - g_Offset_Module;
|
||||
Track->m_End = pos;
|
||||
pos = pad->GetPosition() - g_Offset_Module;
|
||||
track->m_End = pos;
|
||||
}
|
||||
|
||||
Track->Draw( panel, DC, GR_XOR );
|
||||
track->Draw( panel, DC, GR_XOR );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,15 +74,11 @@ void DrawSegmentWhileMovingFootprint( EDA_DRAW_PANEL* panel, wxDC* DC )
|
|||
* For each selected track segment set the EDIT flag
|
||||
* and redraw them in EDIT mode (sketch mode)
|
||||
*/
|
||||
void Build_Drag_Liste( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module )
|
||||
void Build_Drag_Liste( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* aModule )
|
||||
{
|
||||
D_PAD* pt_pad;
|
||||
|
||||
pt_pad = Module->m_Pads;
|
||||
|
||||
for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Next() )
|
||||
for( D_PAD* pad = aModule->m_Pads; pad; pad = pad->Next() )
|
||||
{
|
||||
Build_1_Pad_SegmentsToDrag( panel, DC, pt_pad );
|
||||
Build_1_Pad_SegmentsToDrag( panel, DC, pad );
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -95,37 +91,36 @@ void Build_Drag_Liste( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module )
|
|||
* and redraw them in EDIT mode (sketch mode)
|
||||
* Net codes must be OK.
|
||||
*/
|
||||
void Build_1_Pad_SegmentsToDrag( EDA_DRAW_PANEL* panel, wxDC* DC, D_PAD* PtPad )
|
||||
void Build_1_Pad_SegmentsToDrag( EDA_DRAW_PANEL* panel, wxDC* DC, D_PAD* aPad )
|
||||
{
|
||||
TRACK* Track;
|
||||
int net_code = PtPad->GetNet();
|
||||
int LayerMask;
|
||||
wxPoint pos;
|
||||
BOARD* pcb = ( (PCB_BASE_FRAME*)( panel->GetParent() ) )->GetBoard();
|
||||
|
||||
Track = pcb->m_Track->GetStartNetCode( net_code );
|
||||
int net_code = aPad->GetNet();
|
||||
|
||||
pos = PtPad->m_Pos;
|
||||
LayerMask = PtPad->m_layerMask;
|
||||
TRACK* track = pcb->m_Track->GetStartNetCode( net_code );
|
||||
|
||||
for( ; Track; Track = Track->Next() )
|
||||
wxPoint pos = aPad->GetPosition();
|
||||
|
||||
int layerMask = aPad->GetLayerMask();
|
||||
|
||||
for( ; track; track = track->Next() )
|
||||
{
|
||||
if( Track->GetNet() != net_code )
|
||||
if( track->GetNet() != net_code )
|
||||
break;
|
||||
|
||||
if( ( LayerMask & Track->ReturnMaskLayer() ) == 0 )
|
||||
if( ( layerMask & track->ReturnMaskLayer() ) == 0 )
|
||||
continue;
|
||||
|
||||
if( pos == Track->m_Start )
|
||||
if( pos == track->m_Start )
|
||||
{
|
||||
AddSegmentToDragList( panel, DC, STARTPOINT, Track );
|
||||
g_DragSegmentList.back().m_Pad_Start = PtPad;
|
||||
AddSegmentToDragList( panel, DC, STARTPOINT, track );
|
||||
g_DragSegmentList.back().m_Pad_Start = aPad;
|
||||
}
|
||||
|
||||
if( pos == Track->m_End )
|
||||
if( pos == track->m_End )
|
||||
{
|
||||
AddSegmentToDragList( panel, DC, ENDPOINT, Track );
|
||||
g_DragSegmentList.back().m_Pad_End = PtPad;
|
||||
AddSegmentToDragList( panel, DC, ENDPOINT, track );
|
||||
g_DragSegmentList.back().m_Pad_End = aPad;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -422,9 +422,10 @@ void DRC::testPad2Pad()
|
|||
{
|
||||
D_PAD* pad = sortedPads[i];
|
||||
|
||||
// m_ShapeMaxRadius is the radius value of the circle containing the pad
|
||||
if( pad->m_ShapeMaxRadius > max_size )
|
||||
max_size = pad->m_ShapeMaxRadius;
|
||||
// GetBoundingRadius() is the radius of the minimum sized circle fully containing the pad
|
||||
int radius = pad->GetBoundingRadius();
|
||||
if( radius > max_size )
|
||||
max_size = radius;
|
||||
}
|
||||
|
||||
// Test the pads
|
||||
|
@ -435,7 +436,7 @@ void DRC::testPad2Pad()
|
|||
D_PAD* pad = sortedPads[i];
|
||||
|
||||
int x_limit = max_size + pad->GetClearance() +
|
||||
pad->m_ShapeMaxRadius + pad->GetPosition().x;
|
||||
pad->GetBoundingRadius() + pad->GetPosition().x;
|
||||
|
||||
if( !doPadToPadsDrc( pad, &sortedPads[i], listEnd, x_limit ) )
|
||||
{
|
||||
|
@ -559,7 +560,7 @@ void DRC::testZones()
|
|||
|
||||
bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_limit )
|
||||
{
|
||||
int layerMask = aRefPad->m_layerMask & ALL_CU_LAYERS;
|
||||
int layerMask = aRefPad->GetLayerMask() & ALL_CU_LAYERS;
|
||||
|
||||
/* used to test DRC pad to holes: this dummy pad has the size and shape of the hole
|
||||
* to test pad to pad hole DRC, using the pad to pad DRC test function.
|
||||
|
@ -569,12 +570,14 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li
|
|||
*/
|
||||
MODULE dummymodule( m_pcb ); // Creates a dummy parent
|
||||
D_PAD dummypad( &dummymodule );
|
||||
dummypad.m_layerMask |= ALL_CU_LAYERS; // Ensure the hole is on all copper layers
|
||||
dummypad.m_LocalClearance = 1; /* Use the minimal local clearance value for the dummy pad
|
||||
* the clearance of the active pad will be used
|
||||
* as minimum distance to a hole
|
||||
* (a value = 0 means use netclass value)
|
||||
*/
|
||||
|
||||
// Ensure the hole is on all copper layers
|
||||
dummypad.SetLayerMask( ALL_CU_LAYERS | dummypad.GetLayerMask() );
|
||||
|
||||
// Use the minimal local clearance value for the dummy pad.
|
||||
// The clearance of the active pad will be used as minimum distance to a hole
|
||||
// (a value = 0 means use netclass value)
|
||||
dummypad.SetLocalClearance( 1 );
|
||||
|
||||
for( D_PAD** pad_list = aStart; pad_list<aEnd; ++pad_list )
|
||||
{
|
||||
|
@ -583,43 +586,40 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li
|
|||
if( pad == aRefPad )
|
||||
continue;
|
||||
|
||||
// We can stop the test when pad->m_Pos.x > x_limit
|
||||
// We can stop the test when pad->GetPosition().x > x_limit
|
||||
// because the list is sorted by X values
|
||||
if( pad->m_Pos.x > x_limit )
|
||||
if( pad->GetPosition().x > x_limit )
|
||||
break;
|
||||
|
||||
// No problem if pads are on different copper layers,
|
||||
// but their hole (if any ) can create DRC error because they are on all
|
||||
// copper layers, so we test them
|
||||
if( ( pad->m_layerMask & layerMask ) == 0 )
|
||||
if( ( pad->GetLayerMask() & layerMask ) == 0 )
|
||||
{
|
||||
// if holes are in the same location and have the same size and shape,
|
||||
// this can be accepted
|
||||
if( pad->GetPosition() == aRefPad->GetPosition()
|
||||
&& pad->m_Drill == aRefPad->m_Drill
|
||||
&& pad->m_DrillShape == aRefPad->m_DrillShape )
|
||||
&& pad->GetDrillSize() == aRefPad->GetDrillSize()
|
||||
&& pad->GetDrillShape() == aRefPad->GetDrillShape() )
|
||||
{
|
||||
if( aRefPad->m_DrillShape == PAD_CIRCLE )
|
||||
if( aRefPad->GetDrillShape() == PAD_CIRCLE )
|
||||
continue;
|
||||
|
||||
// for oval holes: must also have the same orientation
|
||||
if( pad->m_Orient == aRefPad->m_Orient )
|
||||
if( pad->GetOrientation() == aRefPad->GetOrientation() )
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Here, we must test clearance between holes and pads
|
||||
* dummy pad size and shape is adjusted to pad drill size and shape
|
||||
*/
|
||||
if( pad->m_Drill.x )
|
||||
if( pad->GetDrillSize().x )
|
||||
{
|
||||
// pad under testing has a hole, test this hole against pad reference
|
||||
dummypad.SetPosition( pad->GetPosition() );
|
||||
dummypad.m_Size = pad->m_Drill;
|
||||
dummypad.m_PadShape = (pad->m_DrillShape == PAD_OVAL) ? PAD_OVAL : PAD_CIRCLE;
|
||||
dummypad.m_Orient = pad->m_Orient;
|
||||
|
||||
// compute the radius of the circle containing this pad
|
||||
dummypad.ComputeShapeMaxRadius();
|
||||
dummypad.SetSize( pad->GetDrillSize() );
|
||||
dummypad.SetShape( pad->GetDrillShape() == PAD_OVAL ? PAD_OVAL : PAD_CIRCLE );
|
||||
dummypad.SetOrientation( pad->GetOrientation() );
|
||||
|
||||
if( !checkClearancePadToPad( aRefPad, &dummypad ) )
|
||||
{
|
||||
|
@ -630,15 +630,12 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li
|
|||
}
|
||||
}
|
||||
|
||||
if( aRefPad->m_Drill.x ) // pad reference has a hole
|
||||
if( aRefPad->GetDrillSize().x ) // pad reference has a hole
|
||||
{
|
||||
dummypad.SetPosition( aRefPad->GetPosition() );
|
||||
dummypad.m_Size = aRefPad->m_Drill;
|
||||
dummypad.m_PadShape = (aRefPad->m_DrillShape == PAD_OVAL) ? PAD_OVAL : PAD_CIRCLE;
|
||||
dummypad.m_Orient = aRefPad->m_Orient;
|
||||
|
||||
// compute the radius of the circle containing this pad
|
||||
dummypad.ComputeShapeMaxRadius();
|
||||
dummypad.SetSize( aRefPad->GetDrillSize() );
|
||||
dummypad.SetShape( aRefPad->GetDrillShape() == PAD_OVAL ? PAD_OVAL : PAD_CIRCLE );
|
||||
dummypad.SetOrientation( aRefPad->GetOrientation() );
|
||||
|
||||
if( !checkClearancePadToPad( pad, &dummypad ) )
|
||||
{
|
||||
|
@ -652,7 +649,6 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li
|
|||
continue;
|
||||
}
|
||||
|
||||
|
||||
// The pad must be in a net (i.e pt_pad->GetNet() != 0 ),
|
||||
// But no problem if pads have the same netcode (same net)
|
||||
if( pad->GetNet() && ( aRefPad->GetNet() == pad->GetNet() ) )
|
||||
|
|
|
@ -271,7 +271,8 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
|
|||
*/
|
||||
MODULE dummymodule( m_pcb ); // Creates a dummy parent
|
||||
D_PAD dummypad( &dummymodule );
|
||||
dummypad.m_layerMask = ALL_CU_LAYERS; // Ensure the hole is on all layers
|
||||
|
||||
dummypad.SetLayerMask( ALL_CU_LAYERS ); // Ensure the hole is on all layers
|
||||
|
||||
// Compute the min distance to pads
|
||||
if( testPads )
|
||||
|
@ -284,20 +285,20 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
|
|||
* But if a drill hole exists (a pad on a single layer can have a hole!)
|
||||
* we must test the hole
|
||||
*/
|
||||
if( (pad->m_layerMask & layerMask ) == 0 )
|
||||
if( (pad->GetLayerMask() & layerMask ) == 0 )
|
||||
{
|
||||
/* We must test the pad hole. In order to use the function
|
||||
* checkClearanceSegmToPad(),a pseudo pad is used, with a shape and a
|
||||
* size like the hole
|
||||
*/
|
||||
if( pad->m_Drill.x == 0 )
|
||||
if( pad->GetDrillSize().x == 0 )
|
||||
continue;
|
||||
|
||||
dummypad.m_Size = pad->m_Drill;
|
||||
dummypad.SetSize( pad->GetDrillSize() );
|
||||
dummypad.SetPosition( pad->GetPosition() );
|
||||
dummypad.m_PadShape = pad->m_DrillShape;
|
||||
dummypad.m_Orient = pad->m_Orient;
|
||||
dummypad.ComputeShapeMaxRadius(); // compute the radius of the circle containing this pad
|
||||
dummypad.SetShape( pad->GetDrillShape() );
|
||||
dummypad.SetOrientation( pad->GetOrientation() );
|
||||
|
||||
m_padToTestPos = dummypad.GetPosition() - origin;
|
||||
|
||||
if( !checkClearanceSegmToPad( &dummypad, aRefSeg->m_Width,
|
||||
|
@ -311,9 +312,8 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
|
|||
continue;
|
||||
}
|
||||
|
||||
/* The pad must be in a net (i.e pt_pad->GetNet() != 0 )
|
||||
* but no problem if the pad netcode is the current netcode (same net)
|
||||
*/
|
||||
// The pad must be in a net (i.e pt_pad->GetNet() != 0 )
|
||||
// but no problem if the pad netcode is the current netcode (same net)
|
||||
if( pad->GetNet() // the pad must be connected
|
||||
&& net_code_ref == pad->GetNet() ) // the pad net is the same as current net -> Ok
|
||||
continue;
|
||||
|
@ -587,7 +587,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
|
|||
dist = (int) hypot( relativePadPos.x, relativePadPos.y );
|
||||
|
||||
// Quick test: Clearance is OK if the bounding circles are further away than "dist_min"
|
||||
if( (dist - aRefPad->m_ShapeMaxRadius - aPad->m_ShapeMaxRadius) >= dist_min )
|
||||
if( (dist - aRefPad->GetBoundingRadius() - aPad->GetBoundingRadius()) >= dist_min )
|
||||
return true;
|
||||
|
||||
/* Here, pads are near and DRC depend on the pad shapes
|
||||
|
@ -600,11 +600,11 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
|
|||
bool swap_pads;
|
||||
swap_pads = false;
|
||||
|
||||
if( (aRefPad->m_PadShape != PAD_CIRCLE) && (aPad->m_PadShape == PAD_CIRCLE) )
|
||||
if( aRefPad->GetShape() != PAD_CIRCLE && aPad->GetShape() == PAD_CIRCLE )
|
||||
swap_pads = true;
|
||||
else if( (aRefPad->m_PadShape != PAD_OVAL) && (aPad->m_PadShape == PAD_OVAL) )
|
||||
else if( aRefPad->GetShape() != PAD_OVAL && aPad->GetShape() == PAD_OVAL )
|
||||
swap_pads = true;
|
||||
else if( (aRefPad->m_PadShape != PAD_RECT) && (aPad->m_PadShape == PAD_RECT) )
|
||||
else if( aRefPad->GetShape() != PAD_RECT && aPad->GetShape() == PAD_RECT )
|
||||
swap_pads = true;
|
||||
|
||||
if( swap_pads )
|
||||
|
@ -620,12 +620,12 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
|
|||
*/
|
||||
bool diag = true;
|
||||
|
||||
switch( aRefPad->m_PadShape )
|
||||
switch( aRefPad->GetShape() )
|
||||
{
|
||||
case PAD_CIRCLE:
|
||||
|
||||
/* One can use checkClearanceSegmToPad to test clearance
|
||||
* aRefPad is like a track segment with a null length and a witdth = m_Size.x
|
||||
* aRefPad is like a track segment with a null length and a witdth = GetSize().x
|
||||
*/
|
||||
m_segmLength = 0;
|
||||
m_segmAngle = 0;
|
||||
|
@ -633,25 +633,25 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
|
|||
m_segmEnd.x = m_segmEnd.y = 0;
|
||||
|
||||
m_padToTestPos = relativePadPos;
|
||||
diag = checkClearanceSegmToPad( aPad, aRefPad->m_Size.x, dist_min );
|
||||
diag = checkClearanceSegmToPad( aPad, aRefPad->GetSize().x, dist_min );
|
||||
break;
|
||||
|
||||
case PAD_RECT:
|
||||
|
||||
// pad_angle = pad orient relative to the aRefPad orient
|
||||
pad_angle = aRefPad->m_Orient + aPad->m_Orient;
|
||||
pad_angle = aRefPad->GetOrientation() + aPad->GetOrientation();
|
||||
NORMALIZE_ANGLE_POS( pad_angle );
|
||||
|
||||
if( aPad->m_PadShape == PAD_RECT )
|
||||
if( aPad->GetShape() == PAD_RECT )
|
||||
{
|
||||
wxSize size = aPad->m_Size;
|
||||
wxSize size = aPad->GetSize();
|
||||
|
||||
// The trivial case is if both rects are rotated by multiple of 90 deg
|
||||
// Most of time this is the case, and the test is fast
|
||||
if( ( (aRefPad->m_Orient == 0) || (aRefPad->m_Orient == 900)
|
||||
|| (aRefPad->m_Orient == 1800) || (aRefPad->m_Orient == 2700) )
|
||||
&& ( (aPad->m_Orient == 0) || (aPad->m_Orient == 900) || (aPad->m_Orient == 1800)
|
||||
|| (aPad->m_Orient == 2700) ) )
|
||||
if( ( (aRefPad->GetOrientation() == 0) || (aRefPad->GetOrientation() == 900)
|
||||
|| (aRefPad->GetOrientation() == 1800) || (aRefPad->GetOrientation() == 2700) )
|
||||
&& ( (aPad->GetOrientation() == 0) || (aPad->GetOrientation() == 900) || (aPad->GetOrientation() == 1800)
|
||||
|| (aPad->GetOrientation() == 2700) ) )
|
||||
{
|
||||
if( (pad_angle == 900) || (pad_angle == 2700) )
|
||||
{
|
||||
|
@ -660,22 +660,22 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
|
|||
|
||||
// Test DRC:
|
||||
diag = false;
|
||||
RotatePoint( &relativePadPos, aRefPad->m_Orient );
|
||||
RotatePoint( &relativePadPos, aRefPad->GetOrientation() );
|
||||
relativePadPos.x = ABS( relativePadPos.x );
|
||||
relativePadPos.y = ABS( relativePadPos.y );
|
||||
|
||||
if( ( relativePadPos.x - ( (size.x + aRefPad->m_Size.x) / 2 ) ) >= dist_min )
|
||||
if( ( relativePadPos.x - ( (size.x + aRefPad->GetSize().x) / 2 ) ) >= dist_min )
|
||||
diag = true;
|
||||
|
||||
if( ( relativePadPos.y - ( (size.y + aRefPad->m_Size.y) / 2 ) ) >= dist_min )
|
||||
if( ( relativePadPos.y - ( (size.y + aRefPad->GetSize().y) / 2 ) ) >= dist_min )
|
||||
diag = true;
|
||||
}
|
||||
else // at least one pad has any other orient. Test is more tricky
|
||||
{ // Use the trapezoid2trapezoidDRC which also compare 2 rectangles with any orientation
|
||||
wxPoint polyref[4]; // Shape of aRefPad
|
||||
wxPoint polycompare[4]; // Shape of aPad
|
||||
aRefPad->BuildPadPolygon( polyref, wxSize( 0, 0 ), aRefPad->m_Orient );
|
||||
aPad->BuildPadPolygon( polycompare, wxSize( 0, 0 ), aPad->m_Orient );
|
||||
aRefPad->BuildPadPolygon( polyref, wxSize( 0, 0 ), aRefPad->GetOrientation() );
|
||||
aPad->BuildPadPolygon( polycompare, wxSize( 0, 0 ), aPad->GetOrientation() );
|
||||
|
||||
// Move aPad shape to relativePadPos
|
||||
for( int ii = 0; ii < 4; ii++ )
|
||||
|
@ -686,12 +686,12 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
|
|||
diag = false;
|
||||
}
|
||||
}
|
||||
else if( aPad->m_PadShape == PAD_TRAPEZOID )
|
||||
else if( aPad->GetShape() == PAD_TRAPEZOID )
|
||||
{
|
||||
wxPoint polyref[4]; // Shape of aRefPad
|
||||
wxPoint polycompare[4]; // Shape of aPad
|
||||
aRefPad->BuildPadPolygon( polyref, wxSize( 0, 0 ), aRefPad->m_Orient );
|
||||
aPad->BuildPadPolygon( polycompare, wxSize( 0, 0 ), aPad->m_Orient );
|
||||
aRefPad->BuildPadPolygon( polyref, wxSize( 0, 0 ), aRefPad->GetOrientation() );
|
||||
aPad->BuildPadPolygon( polycompare, wxSize( 0, 0 ), aPad->GetOrientation() );
|
||||
|
||||
// Move aPad shape to relativePadPos
|
||||
for( int ii = 0; ii < 4; ii++ )
|
||||
|
@ -715,17 +715,17 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
|
|||
* and use checkClearanceSegmToPad function to test aPad to aRefPad clearance
|
||||
*/
|
||||
int segm_width;
|
||||
m_segmAngle = aRefPad->m_Orient; // Segment orient.
|
||||
m_segmAngle = aRefPad->GetOrientation(); // Segment orient.
|
||||
|
||||
if( aRefPad->m_Size.y < aRefPad->m_Size.x ) // Build an horizontal equiv segment
|
||||
if( aRefPad->GetSize().y < aRefPad->GetSize().x ) // Build an horizontal equiv segment
|
||||
{
|
||||
segm_width = aRefPad->m_Size.y;
|
||||
m_segmLength = aRefPad->m_Size.x - aRefPad->m_Size.y;
|
||||
segm_width = aRefPad->GetSize().y;
|
||||
m_segmLength = aRefPad->GetSize().x - aRefPad->GetSize().y;
|
||||
}
|
||||
else // Vertical oval: build an horizontal equiv segment and rotate 90.0 deg
|
||||
{
|
||||
segm_width = aRefPad->m_Size.x;
|
||||
m_segmLength = aRefPad->m_Size.y - aRefPad->m_Size.x;
|
||||
segm_width = aRefPad->GetSize().x;
|
||||
m_segmLength = aRefPad->GetSize().y - aRefPad->GetSize().x;
|
||||
m_segmAngle += 900;
|
||||
}
|
||||
|
||||
|
@ -755,12 +755,12 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
|
|||
|
||||
// at this point, aPad is also a trapezoid, because all other shapes
|
||||
// have priority, and are already tested
|
||||
wxASSERT( aPad->m_PadShape == PAD_TRAPEZOID );
|
||||
wxASSERT( aPad->GetShape() == PAD_TRAPEZOID );
|
||||
{
|
||||
wxPoint polyref[4]; // Shape of aRefPad
|
||||
wxPoint polycompare[4]; // Shape of aPad
|
||||
aRefPad->BuildPadPolygon( polyref, wxSize( 0, 0 ), aRefPad->m_Orient );
|
||||
aPad->BuildPadPolygon( polycompare, wxSize( 0, 0 ), aPad->m_Orient );
|
||||
aRefPad->BuildPadPolygon( polyref, wxSize( 0, 0 ), aRefPad->GetOrientation() );
|
||||
aPad->BuildPadPolygon( polycompare, wxSize( 0, 0 ), aPad->GetOrientation() );
|
||||
|
||||
// Move aPad shape to relativePadPos
|
||||
for( int ii = 0; ii < 4; ii++ )
|
||||
|
@ -797,16 +797,16 @@ bool DRC::checkClearanceSegmToPad( const D_PAD* aPad, int aSegmentWidth, int aMi
|
|||
int segmHalfWidth = aSegmentWidth / 2;
|
||||
|
||||
seuil = segmHalfWidth + aMinDist;
|
||||
padHalfsize.x = aPad->m_Size.x >> 1;
|
||||
padHalfsize.y = aPad->m_Size.y >> 1;
|
||||
padHalfsize.x = aPad->GetSize().x >> 1;
|
||||
padHalfsize.y = aPad->GetSize().y >> 1;
|
||||
|
||||
if( aPad->m_PadShape == PAD_TRAPEZOID ) // The size is bigger, due to m_DeltaSize extra size
|
||||
if( aPad->GetShape() == PAD_TRAPEZOID ) // The size is bigger, due to GetDelta() extra size
|
||||
{
|
||||
padHalfsize.x += ABS(aPad->m_DeltaSize.y) / 2; // Remember: m_DeltaSize.y is the m_Size.x change
|
||||
padHalfsize.y += ABS(aPad->m_DeltaSize.x) / 2; // Remember: m_DeltaSize.x is the m_Size.y change
|
||||
padHalfsize.x += ABS(aPad->GetDelta().y) / 2; // Remember: GetDelta().y is the GetSize().x change
|
||||
padHalfsize.y += ABS(aPad->GetDelta().x) / 2; // Remember: GetDelta().x is the GetSize().y change
|
||||
}
|
||||
|
||||
if( aPad->m_PadShape == PAD_CIRCLE )
|
||||
if( aPad->GetShape() == PAD_CIRCLE )
|
||||
{
|
||||
/* Easy case: just test the distance between segment and pad centre
|
||||
* calculate pad coordinates in the X,Y axis with X axis = segment to test
|
||||
|
@ -828,7 +828,7 @@ bool DRC::checkClearanceSegmToPad( const D_PAD* aPad, int aSegmentWidth, int aMi
|
|||
startPoint.x = startPoint.y = 0;
|
||||
endPoint = m_segmEnd;
|
||||
|
||||
orient = aPad->m_Orient;
|
||||
orient = aPad->GetOrientation();
|
||||
|
||||
RotatePoint( &startPoint, m_padToTestPos, -orient );
|
||||
RotatePoint( &endPoint, m_padToTestPos, -orient );
|
||||
|
@ -839,7 +839,7 @@ bool DRC::checkClearanceSegmToPad( const D_PAD* aPad, int aSegmentWidth, int aMi
|
|||
/* segment intersects the bounding box. But there is not always a DRC error.
|
||||
* A fine analysis of the pad shape must be done.
|
||||
*/
|
||||
switch( aPad->m_PadShape )
|
||||
switch( aPad->GetShape() )
|
||||
{
|
||||
default:
|
||||
return false;
|
||||
|
|
|
@ -59,36 +59,30 @@ void PCB_EDIT_FRAME::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC )
|
|||
/*
|
||||
* Move the footprint anchor position to the current cursor position.
|
||||
*/
|
||||
void FOOTPRINT_EDIT_FRAME::Place_Ancre( MODULE* pt_mod )
|
||||
void FOOTPRINT_EDIT_FRAME::Place_Ancre( MODULE* aModule )
|
||||
{
|
||||
wxPoint moveVector;
|
||||
EDA_ITEM* item;
|
||||
D_PAD* pad;
|
||||
|
||||
if( pt_mod == NULL )
|
||||
if( aModule == NULL )
|
||||
return;
|
||||
|
||||
moveVector = pt_mod->m_Pos - GetScreen()->GetCrossHairPosition();
|
||||
moveVector = aModule->m_Pos - GetScreen()->GetCrossHairPosition();
|
||||
|
||||
pt_mod->m_Pos = GetScreen()->GetCrossHairPosition();
|
||||
aModule->m_Pos = GetScreen()->GetCrossHairPosition();
|
||||
|
||||
/* Update the relative coordinates:
|
||||
* The coordinates are relative to the anchor point.
|
||||
* Calculate deltaX and deltaY from the anchor. */
|
||||
RotatePoint( &moveVector, -pt_mod->m_Orient );
|
||||
RotatePoint( &moveVector, -aModule->m_Orient );
|
||||
|
||||
/* Update the pad coordinates. */
|
||||
pad = (D_PAD*) pt_mod->m_Pads;
|
||||
|
||||
for( ; pad != NULL; pad = pad->Next() )
|
||||
// Update the pad coordinates.
|
||||
for( D_PAD* pad = (D_PAD*) aModule->m_Pads; pad; pad = pad->Next() )
|
||||
{
|
||||
pad->m_Pos0 += moveVector;
|
||||
pad->SetPos0( pad->GetPos0() + moveVector );
|
||||
}
|
||||
|
||||
/* Update the draw element coordinates. */
|
||||
item = pt_mod->m_Drawings;
|
||||
|
||||
for( ; item != NULL; item = item->Next() )
|
||||
// Update the draw element coordinates.
|
||||
for( EDA_ITEM* item = aModule->m_Drawings; item; item = item->Next() )
|
||||
{
|
||||
switch( item->Type() )
|
||||
{
|
||||
|
@ -110,7 +104,7 @@ void FOOTPRINT_EDIT_FRAME::Place_Ancre( MODULE* pt_mod )
|
|||
}
|
||||
}
|
||||
|
||||
pt_mod->CalculateBoundingBox();
|
||||
aModule->CalculateBoundingBox();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ static void Abort_Create_Track( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
|||
|
||||
if( track && ( track->Type()==PCB_VIA_T || track->Type()==PCB_TRACE_T ) )
|
||||
{
|
||||
/* Erase the current drawing */
|
||||
// Erase the current drawing
|
||||
ShowNewTrackWhenMovingCursor( Panel, DC, wxDefaultPosition, false );
|
||||
|
||||
if( pcb->IsHighLightNetON() )
|
||||
|
@ -102,7 +102,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
|
|||
BOARD_CONNECTED_ITEM* LockPoint;
|
||||
wxPoint pos = GetScreen()->GetCrossHairPosition();
|
||||
|
||||
if( aTrack == NULL ) /* Starting a new track segment */
|
||||
if( aTrack == NULL ) // Starting a new track segment
|
||||
{
|
||||
m_canvas->SetMouseCapture( ShowNewTrackWhenMovingCursor, Abort_Create_Track );
|
||||
|
||||
|
@ -130,11 +130,11 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
|
|||
{
|
||||
pad = (D_PAD*) LockPoint;
|
||||
|
||||
/* A pad is found: put the starting point on pad center */
|
||||
pos = pad->m_Pos;
|
||||
// A pad is found: put the starting point on pad center
|
||||
pos = pad->GetPosition();
|
||||
GetBoard()->SetHighLightNet( pad->GetNet() );
|
||||
}
|
||||
else /* A track segment is found */
|
||||
else // A track segment is found
|
||||
{
|
||||
TrackOnStartPoint = (TRACK*) LockPoint;
|
||||
GetBoard()->SetHighLightNet( TrackOnStartPoint->GetNet() );
|
||||
|
@ -214,7 +214,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
|
|||
}
|
||||
else // Track in progress : segment coordinates are updated by ShowNewTrackWhenMovingCursor.
|
||||
{
|
||||
/* Test for a D.R.C. error: */
|
||||
// Test for a D.R.C. error:
|
||||
if( Drc_On )
|
||||
{
|
||||
if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) )
|
||||
|
@ -244,7 +244,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
|
|||
|
||||
if( CanCreateNewSegment )
|
||||
{
|
||||
/* Erase old track on screen */
|
||||
// Erase old track on screen
|
||||
D( g_CurrentTrackList.VerifyListIntegrity(); );
|
||||
|
||||
ShowNewTrackWhenMovingCursor( m_canvas, aDC, wxDefaultPosition, false );
|
||||
|
@ -283,7 +283,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
|
|||
|
||||
D( g_CurrentTrackList.VerifyListIntegrity(); );
|
||||
|
||||
/* Show the new position */
|
||||
// Show the new position
|
||||
ShowNewTrackWhenMovingCursor( m_canvas, aDC, wxDefaultPosition, false );
|
||||
}
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ bool PCB_EDIT_FRAME::Add45DegreeSegment( wxDC* aDC )
|
|||
int dx0, dy0, dx1, dy1;
|
||||
|
||||
if( g_CurrentTrackList.GetCount() < 2 )
|
||||
return false; /* There must be 2 segments. */
|
||||
return false; // There must be 2 segments.
|
||||
|
||||
TRACK* curTrack = g_CurrentTrackSegment;
|
||||
TRACK* prevTrack = curTrack->Back();
|
||||
|
@ -328,7 +328,7 @@ bool PCB_EDIT_FRAME::Add45DegreeSegment( wxDC* aDC )
|
|||
if( max( abs( dx1 ), abs( dy1 ) ) < ( segm_step_45 * 2 ) )
|
||||
return false;
|
||||
|
||||
/* Create a new segment and connect it with the previous 2 segments. */
|
||||
// Create a new segment and connect it with the previous 2 segments.
|
||||
TRACK* newTrack = (TRACK*)curTrack->Clone();
|
||||
|
||||
newTrack->m_Start = prevTrack->m_End;
|
||||
|
@ -418,7 +418,7 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC )
|
|||
if( Drc_On && BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) )
|
||||
return false;
|
||||
|
||||
/* Saving the coordinate of end point of the trace */
|
||||
// Saving the coordinate of end point of the trace
|
||||
wxPoint pos = g_CurrentTrackSegment->m_End;
|
||||
|
||||
D( g_CurrentTrackList.VerifyListIntegrity(); );
|
||||
|
@ -554,7 +554,7 @@ TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack, int aLayer, const wxPoi
|
|||
if( track->GetNet() == net )
|
||||
continue;
|
||||
|
||||
/* TRACK::HitTest */
|
||||
// TRACK::HitTest
|
||||
int dist = (width + track->m_Width) / 2 + aTrack->GetClearance( track );
|
||||
|
||||
wxPoint pos = aRef - track->m_Start;
|
||||
|
@ -565,7 +565,7 @@ TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack, int aLayer, const wxPoi
|
|||
|
||||
found = track;
|
||||
|
||||
/* prefer intrusions from the side, not the end */
|
||||
// prefer intrusions from the side, not the end
|
||||
double tmp = (double) pos.x * vec.x + (double) pos.y * vec.y;
|
||||
|
||||
if( tmp >= 0 && tmp <= (double) vec.x * vec.x + (double) vec.y * vec.y )
|
||||
|
@ -607,7 +607,7 @@ static void PushTrack( EDA_DRAW_PANEL* panel )
|
|||
|
||||
other = LocateIntrusion( pcb->m_Track, track, screen->m_Active_Layer, screen->RefPos( true ) );
|
||||
|
||||
/* are we currently pointing into a conflicting trace ? */
|
||||
// are we currently pointing into a conflicting trace ?
|
||||
if( !other )
|
||||
return;
|
||||
|
||||
|
@ -619,7 +619,7 @@ static void PushTrack( EDA_DRAW_PANEL* panel )
|
|||
|
||||
det = (double) cv.x * vec.y - (double) cv.y * vec.x;
|
||||
|
||||
/* cursor is right at the center of the old track */
|
||||
// cursor is right at the center of the old track
|
||||
if( !det )
|
||||
return;
|
||||
|
||||
|
@ -630,7 +630,7 @@ static void PushTrack( EDA_DRAW_PANEL* panel )
|
|||
* We may have a quantization error of 1/sqrt(2), so +1 again.
|
||||
*/
|
||||
|
||||
/* Vector "n" is perpendicular to "other", pointing towards the cursor. */
|
||||
// Vector "n" is perpendicular to "other", pointing towards the cursor.
|
||||
if( det > 0 )
|
||||
{
|
||||
n.x = vec.y;
|
||||
|
@ -674,7 +674,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
|
|||
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS;
|
||||
|
||||
#ifndef USE_WX_OVERLAY
|
||||
/* Erase old track */
|
||||
// Erase old track
|
||||
if( aErase )
|
||||
{
|
||||
DrawTraces( aPanel, aDC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_XOR );
|
||||
|
@ -740,12 +740,12 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
|
|||
&g_CurrentTrackSegment->m_End.y );
|
||||
}
|
||||
}
|
||||
else /* Here the angle is arbitrary */
|
||||
else // Here the angle is arbitrary
|
||||
{
|
||||
g_CurrentTrackSegment->m_End = screen->GetCrossHairPosition();
|
||||
}
|
||||
|
||||
/* Redraw the new track */
|
||||
// Redraw the new track
|
||||
D( g_CurrentTrackList.VerifyListIntegrity(); );
|
||||
DrawTraces( aPanel, aDC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_XOR );
|
||||
|
||||
|
@ -782,7 +782,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
|
|||
if( g_FirstTrackSegment->GetState( BEGIN_ONPAD ) )
|
||||
{
|
||||
D_PAD * pad = (D_PAD *) g_FirstTrackSegment->start;
|
||||
lenDie = (double) pad->m_LengthDie;
|
||||
lenDie = (double) pad->GetDieLength();
|
||||
}
|
||||
|
||||
// calculate track len on board:
|
||||
|
@ -853,7 +853,7 @@ void CalculateSegmentEndPoint( const wxPoint& aPosition, int ox, int oy, int* fx
|
|||
deltax = min( deltax, deltay );
|
||||
deltay = deltax;
|
||||
|
||||
/* Recalculate the signs for deltax and deltaY. */
|
||||
// Recalculate the signs for deltax and deltaY.
|
||||
if( ( aPosition.x - ox ) < 0 )
|
||||
deltax = -deltax;
|
||||
|
||||
|
@ -948,7 +948,7 @@ void ComputeBreakPoint( TRACK* track, int SegmentCount, wxPoint end )
|
|||
iDx = min( iDx, iDy );
|
||||
iDy = iDx;
|
||||
|
||||
/* Recalculate the signs for deltax and deltaY. */
|
||||
// Recalculate the signs for deltax and deltaY.
|
||||
if( ( end.x - track->m_Start.x ) < 0 )
|
||||
iDx = -iDx;
|
||||
|
||||
|
@ -1064,11 +1064,11 @@ void DeleteNullTrackSegments( BOARD* pcb, DLIST<TRACK>& aTrackList )
|
|||
* if no, create a new track segment if necessary
|
||||
* and move current (or new) end segment on pad
|
||||
*/
|
||||
void EnsureEndTrackOnPad( D_PAD* Pad )
|
||||
void EnsureEndTrackOnPad( D_PAD* aPad )
|
||||
{
|
||||
if( g_CurrentTrackSegment->m_End == Pad->m_Pos ) // Ok !
|
||||
if( g_CurrentTrackSegment->m_End == aPad->GetPosition() ) // Ok !
|
||||
{
|
||||
g_CurrentTrackSegment->end = Pad;
|
||||
g_CurrentTrackSegment->end = aPad;
|
||||
g_CurrentTrackSegment->SetState( END_ONPAD, ON );
|
||||
return;
|
||||
}
|
||||
|
@ -1077,15 +1077,15 @@ void EnsureEndTrackOnPad( D_PAD* Pad )
|
|||
|
||||
if( !g_CurrentTrackSegment->IsNull() )
|
||||
{
|
||||
/* Must create a new segment, from track end to pad center */
|
||||
// Must create a new segment, from track end to pad center
|
||||
g_CurrentTrackList.PushBack( (TRACK*)lasttrack->Clone() );
|
||||
|
||||
lasttrack->end = g_CurrentTrackSegment;
|
||||
}
|
||||
|
||||
g_CurrentTrackSegment->m_End = Pad->m_Pos;
|
||||
g_CurrentTrackSegment->m_End = aPad->GetPosition();
|
||||
g_CurrentTrackSegment->SetState( END_ONPAD, OFF );
|
||||
|
||||
g_CurrentTrackSegment->end = Pad;
|
||||
g_CurrentTrackSegment->end = aPad;
|
||||
g_CurrentTrackSegment->SetState( END_ONPAD, ON );
|
||||
}
|
||||
|
|
|
@ -317,30 +317,30 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb )
|
|||
fprintf( aFile, "PAD P%d", pad->GetSubRatsnest() );
|
||||
|
||||
padstacks.push_back( pad ); // Will have its own padstack later
|
||||
int dx = pad->m_Size.x / 2;
|
||||
int dy = pad->m_Size.y / 2;
|
||||
int dx = pad->GetSize().x / 2;
|
||||
int dy = pad->GetSize().y / 2;
|
||||
|
||||
switch( pad->m_PadShape )
|
||||
switch( pad->GetShape() )
|
||||
{
|
||||
default:
|
||||
case PAD_CIRCLE:
|
||||
fprintf( aFile, " ROUND %g\n",
|
||||
pad->m_Drill.x / SCALE_FACTOR );
|
||||
pad->GetDrillSize().x / SCALE_FACTOR );
|
||||
/* Circle is center, radius */
|
||||
fprintf( aFile, "CIRCLE %g %g %g\n",
|
||||
pad->m_Offset.x / SCALE_FACTOR,
|
||||
-pad->m_Offset.y / SCALE_FACTOR,
|
||||
pad->m_Size.x / (SCALE_FACTOR * 2) );
|
||||
pad->GetOffset().x / SCALE_FACTOR,
|
||||
-pad->GetOffset().y / SCALE_FACTOR,
|
||||
pad->GetSize().x / (SCALE_FACTOR * 2) );
|
||||
break;
|
||||
|
||||
case PAD_RECT:
|
||||
fprintf( aFile, " RECTANGULAR %g\n",
|
||||
pad->m_Drill.x / SCALE_FACTOR );
|
||||
pad->GetDrillSize().x / SCALE_FACTOR );
|
||||
|
||||
// Rectangle is begin, size *not* begin, end!
|
||||
fprintf( aFile, "RECTANGLE %g %g %g %g\n",
|
||||
(-dx + pad->m_Offset.x ) / SCALE_FACTOR,
|
||||
(-dy - pad->m_Offset.y ) / SCALE_FACTOR,
|
||||
(-dx + pad->GetOffset().x ) / SCALE_FACTOR,
|
||||
(-dy - pad->GetOffset().y ) / SCALE_FACTOR,
|
||||
dx / (SCALE_FACTOR / 2), dy / (SCALE_FACTOR / 2) );
|
||||
break;
|
||||
|
||||
|
@ -348,76 +348,76 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb )
|
|||
{
|
||||
// OrCAD Layout call them OVAL or OBLONG - GenCAD call them FINGERs
|
||||
fprintf( aFile, " FINGER %g\n",
|
||||
pad->m_Drill.x / SCALE_FACTOR );
|
||||
pad->GetDrillSize().x / SCALE_FACTOR );
|
||||
int dr = dx - dy;
|
||||
|
||||
if( dr >= 0 ) // Horizontal oval
|
||||
{
|
||||
int radius = dy;
|
||||
fprintf( aFile, "LINE %g %g %g %g\n",
|
||||
(-dr + pad->m_Offset.x) / SCALE_FACTOR,
|
||||
(-pad->m_Offset.y - radius) / SCALE_FACTOR,
|
||||
(dr + pad->m_Offset.x ) / SCALE_FACTOR,
|
||||
(-pad->m_Offset.y - radius) / SCALE_FACTOR );
|
||||
(-dr + pad->GetOffset().x) / SCALE_FACTOR,
|
||||
(-pad->GetOffset().y - radius) / SCALE_FACTOR,
|
||||
(dr + pad->GetOffset().x ) / SCALE_FACTOR,
|
||||
(-pad->GetOffset().y - radius) / SCALE_FACTOR );
|
||||
|
||||
// GenCAD arcs are (start, end, center)
|
||||
fprintf( aFile, "ARC %g %g %g %g %g %g\n",
|
||||
(dr + pad->m_Offset.x) / SCALE_FACTOR,
|
||||
(-pad->m_Offset.y - radius) / SCALE_FACTOR,
|
||||
(dr + pad->m_Offset.x) / SCALE_FACTOR,
|
||||
(-pad->m_Offset.y + radius) / SCALE_FACTOR,
|
||||
(dr + pad->m_Offset.x) / SCALE_FACTOR,
|
||||
-pad->m_Offset.y / SCALE_FACTOR );
|
||||
(dr + pad->GetOffset().x) / SCALE_FACTOR,
|
||||
(-pad->GetOffset().y - radius) / SCALE_FACTOR,
|
||||
(dr + pad->GetOffset().x) / SCALE_FACTOR,
|
||||
(-pad->GetOffset().y + radius) / SCALE_FACTOR,
|
||||
(dr + pad->GetOffset().x) / SCALE_FACTOR,
|
||||
-pad->GetOffset().y / SCALE_FACTOR );
|
||||
|
||||
fprintf( aFile, "LINE %g %g %g %g\n",
|
||||
(dr + pad->m_Offset.x) / SCALE_FACTOR,
|
||||
(-pad->m_Offset.y + radius) / SCALE_FACTOR,
|
||||
(-dr + pad->m_Offset.x) / SCALE_FACTOR,
|
||||
(-pad->m_Offset.y + radius) / SCALE_FACTOR );
|
||||
(dr + pad->GetOffset().x) / SCALE_FACTOR,
|
||||
(-pad->GetOffset().y + radius) / SCALE_FACTOR,
|
||||
(-dr + pad->GetOffset().x) / SCALE_FACTOR,
|
||||
(-pad->GetOffset().y + radius) / SCALE_FACTOR );
|
||||
fprintf( aFile, "ARC %g %g %g %g %g %g\n",
|
||||
(-dr + pad->m_Offset.x) / SCALE_FACTOR,
|
||||
(-pad->m_Offset.y + radius) / SCALE_FACTOR,
|
||||
(-dr + pad->m_Offset.x) / SCALE_FACTOR,
|
||||
(-pad->m_Offset.y - radius) / SCALE_FACTOR,
|
||||
(-dr + pad->m_Offset.x) / SCALE_FACTOR,
|
||||
-pad->m_Offset.y / SCALE_FACTOR );
|
||||
(-dr + pad->GetOffset().x) / SCALE_FACTOR,
|
||||
(-pad->GetOffset().y + radius) / SCALE_FACTOR,
|
||||
(-dr + pad->GetOffset().x) / SCALE_FACTOR,
|
||||
(-pad->GetOffset().y - radius) / SCALE_FACTOR,
|
||||
(-dr + pad->GetOffset().x) / SCALE_FACTOR,
|
||||
-pad->GetOffset().y / SCALE_FACTOR );
|
||||
}
|
||||
else // Vertical oval
|
||||
{
|
||||
dr = -dr;
|
||||
int radius = dx;
|
||||
fprintf( aFile, "LINE %g %g %g %g\n",
|
||||
(-radius + pad->m_Offset.x) / SCALE_FACTOR,
|
||||
(-pad->m_Offset.y - dr) / SCALE_FACTOR,
|
||||
(-radius + pad->m_Offset.x ) / SCALE_FACTOR,
|
||||
(-pad->m_Offset.y + dr) / SCALE_FACTOR );
|
||||
(-radius + pad->GetOffset().x) / SCALE_FACTOR,
|
||||
(-pad->GetOffset().y - dr) / SCALE_FACTOR,
|
||||
(-radius + pad->GetOffset().x ) / SCALE_FACTOR,
|
||||
(-pad->GetOffset().y + dr) / SCALE_FACTOR );
|
||||
fprintf( aFile, "ARC %g %g %g %g %g %g\n",
|
||||
(-radius + pad->m_Offset.x ) / SCALE_FACTOR,
|
||||
(-pad->m_Offset.y + dr) / SCALE_FACTOR,
|
||||
(radius + pad->m_Offset.x ) / SCALE_FACTOR,
|
||||
(-pad->m_Offset.y + dr) / SCALE_FACTOR,
|
||||
pad->m_Offset.x / SCALE_FACTOR,
|
||||
(-pad->m_Offset.y + dr) / SCALE_FACTOR );
|
||||
(-radius + pad->GetOffset().x ) / SCALE_FACTOR,
|
||||
(-pad->GetOffset().y + dr) / SCALE_FACTOR,
|
||||
(radius + pad->GetOffset().x ) / SCALE_FACTOR,
|
||||
(-pad->GetOffset().y + dr) / SCALE_FACTOR,
|
||||
pad->GetOffset().x / SCALE_FACTOR,
|
||||
(-pad->GetOffset().y + dr) / SCALE_FACTOR );
|
||||
|
||||
fprintf( aFile, "LINE %g %g %g %g\n",
|
||||
(radius + pad->m_Offset.x) / SCALE_FACTOR,
|
||||
(-pad->m_Offset.y + dr) / SCALE_FACTOR,
|
||||
(radius + pad->m_Offset.x) / SCALE_FACTOR,
|
||||
(-pad->m_Offset.y - dr) / SCALE_FACTOR );
|
||||
(radius + pad->GetOffset().x) / SCALE_FACTOR,
|
||||
(-pad->GetOffset().y + dr) / SCALE_FACTOR,
|
||||
(radius + pad->GetOffset().x) / SCALE_FACTOR,
|
||||
(-pad->GetOffset().y - dr) / SCALE_FACTOR );
|
||||
fprintf( aFile, "ARC %g %g %g %g %g %g\n",
|
||||
(radius + pad->m_Offset.x) / SCALE_FACTOR,
|
||||
(-pad->m_Offset.y - dr) / SCALE_FACTOR,
|
||||
(-radius + pad->m_Offset.x) / SCALE_FACTOR,
|
||||
(-pad->m_Offset.y - dr) / SCALE_FACTOR,
|
||||
pad->m_Offset.x / SCALE_FACTOR,
|
||||
(-pad->m_Offset.y - dr) / SCALE_FACTOR );
|
||||
(radius + pad->GetOffset().x) / SCALE_FACTOR,
|
||||
(-pad->GetOffset().y - dr) / SCALE_FACTOR,
|
||||
(-radius + pad->GetOffset().x) / SCALE_FACTOR,
|
||||
(-pad->GetOffset().y - dr) / SCALE_FACTOR,
|
||||
pad->GetOffset().x / SCALE_FACTOR,
|
||||
(-pad->GetOffset().y - dr) / SCALE_FACTOR );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case PAD_TRAPEZOID:
|
||||
fprintf( aFile, " POLYGON %g\n",
|
||||
pad->m_Drill.x / SCALE_FACTOR );
|
||||
pad->GetDrillSize().x / SCALE_FACTOR );
|
||||
|
||||
// XXX TO BE IMPLEMENTED! and I don't know if it could be actually imported by something
|
||||
break;
|
||||
|
@ -461,10 +461,10 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb )
|
|||
|
||||
// Straight padstack
|
||||
fprintf( aFile, "PADSTACK PAD%d %g\n", i,
|
||||
pad->m_Drill.x / SCALE_FACTOR );
|
||||
pad->GetDrillSize().x / SCALE_FACTOR );
|
||||
for( int layer = 0; layer < 32; layer++ )
|
||||
{
|
||||
if( pad->m_layerMask & (1 << layer) & master_layermask )
|
||||
if( pad->GetLayerMask() & (1 << layer) & master_layermask )
|
||||
{
|
||||
fprintf( aFile, "PAD P%d %s 0 0\n", i,
|
||||
TO_UTF8( GenCADLayerName[layer] ) );
|
||||
|
@ -473,10 +473,10 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb )
|
|||
|
||||
// Flipped padstack
|
||||
fprintf( aFile, "PADSTACK PAD%dF %g\n", i,
|
||||
pad->m_Drill.x / SCALE_FACTOR );
|
||||
pad->GetDrillSize().x / SCALE_FACTOR );
|
||||
for( int layer = 0; layer < 32; layer++ )
|
||||
{
|
||||
if( pad->m_layerMask & (1 << layer) & master_layermask )
|
||||
if( pad->GetLayerMask() & (1 << layer) & master_layermask )
|
||||
{
|
||||
fprintf( aFile, "PAD P%d %s 0 0\n", i,
|
||||
TO_UTF8( GenCADLayerNameFlipped[layer] ) );
|
||||
|
@ -516,11 +516,11 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb )
|
|||
* if the spec explicitly says it's not... */
|
||||
layer = "ALL";
|
||||
|
||||
if( ( pad->m_layerMask & ALL_CU_LAYERS ) == LAYER_BACK )
|
||||
if( ( pad->GetLayerMask() & ALL_CU_LAYERS ) == LAYER_BACK )
|
||||
{
|
||||
layer = ( module->flag ) ? "TOP" : "BOTTOM";
|
||||
}
|
||||
else if( ( pad->m_layerMask & ALL_CU_LAYERS ) == LAYER_FRONT )
|
||||
else if( ( pad->GetLayerMask() & ALL_CU_LAYERS ) == LAYER_FRONT )
|
||||
{
|
||||
layer = ( module->flag ) ? "BOTTOM" : "TOP";
|
||||
}
|
||||
|
@ -530,7 +530,7 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb )
|
|||
if( pinname.IsEmpty() )
|
||||
pinname = wxT( "none" );
|
||||
|
||||
orient = pad->m_Orient - module->m_Orient;
|
||||
orient = pad->GetOrientation() - module->GetOrientation();
|
||||
NORMALIZE_ANGLE_POS( orient );
|
||||
|
||||
// Bottom side modules use the flipped padstack
|
||||
|
@ -538,8 +538,8 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb )
|
|||
"PIN %s PAD%dF %g %g %s %g %s\n" :
|
||||
"PIN %s PAD%d %g %g %s %g %s\n",
|
||||
TO_UTF8( pinname ), pad->GetSubRatsnest(),
|
||||
pad->m_Pos0.x / SCALE_FACTOR,
|
||||
-pad->m_Pos0.y / SCALE_FACTOR,
|
||||
pad->GetPos0().x / SCALE_FACTOR,
|
||||
-pad->GetPos0().y / SCALE_FACTOR,
|
||||
layer, orient / 10.0, mirror );
|
||||
}
|
||||
}
|
||||
|
@ -562,7 +562,7 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb )
|
|||
TEXTE_MODULE* textmod;
|
||||
const char* mirror;
|
||||
const char* flip;
|
||||
int orient = module->m_Orient;
|
||||
int orient = module->GetOrientation();
|
||||
|
||||
if( module->flag )
|
||||
{
|
||||
|
@ -597,14 +597,14 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb )
|
|||
|
||||
for( int ii = 0; ii < 2; ii++ )
|
||||
{
|
||||
int orient = textmod->m_Orient;
|
||||
int orient = textmod->GetOrientation();
|
||||
wxString layer = GenCADLayerName[(module->flag) ?
|
||||
SILKSCREEN_N_BACK : SILKSCREEN_N_FRONT];
|
||||
|
||||
fprintf( aFile, "TEXT %g %g %g %g %s %s \"%s\"",
|
||||
textmod->GetPos0().x / SCALE_FACTOR,
|
||||
-textmod->GetPos0().y / SCALE_FACTOR,
|
||||
textmod->m_Size.x / SCALE_FACTOR,
|
||||
textmod->GetSize().x / SCALE_FACTOR,
|
||||
orient / 10.0,
|
||||
mirror,
|
||||
TO_UTF8( layer ),
|
||||
|
@ -612,9 +612,9 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb )
|
|||
|
||||
// Please note, the width is approx
|
||||
fprintf( aFile, " 0 0 %g %g\n",
|
||||
( textmod->m_Size.x * textmod->m_Text.Len() )
|
||||
( textmod->GetSize().x * textmod->m_Text.Len() )
|
||||
/ SCALE_FACTOR,
|
||||
textmod->m_Size.y / SCALE_FACTOR );
|
||||
textmod->GetSize().y / SCALE_FACTOR );
|
||||
|
||||
textmod = module->m_Value; // Dirty trick for the second iteration
|
||||
}
|
||||
|
|
|
@ -94,10 +94,10 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
/* I use this a lot... */
|
||||
// I use this a lot...
|
||||
static const double PI2 = M_PI / 2;
|
||||
|
||||
/* Absolutely not optimized triangle bag :D */
|
||||
// Absolutely not optimized triangle bag :D
|
||||
struct VRMLPt
|
||||
{
|
||||
double x, y, z;
|
||||
|
@ -122,7 +122,7 @@ struct Triangle
|
|||
};
|
||||
typedef std::vector<Triangle> TriangleBag;
|
||||
|
||||
/* A flat triangle fan */
|
||||
// A flat triangle fan
|
||||
struct FlatFan
|
||||
{
|
||||
FlatPt c;
|
||||
|
@ -134,7 +134,7 @@ struct FlatFan
|
|||
void bag( int layer, bool close = true );
|
||||
};
|
||||
|
||||
/* A flat quad ring */
|
||||
// A flat quad ring
|
||||
struct FlatRing
|
||||
{
|
||||
std::vector<FlatPt> inner;
|
||||
|
@ -152,7 +152,7 @@ struct FlatRing
|
|||
void bag( int layer, bool close = true );
|
||||
};
|
||||
|
||||
/* A vertical quad loop */
|
||||
// A vertical quad loop
|
||||
struct VLoop
|
||||
{
|
||||
std::vector<FlatPt> pts;
|
||||
|
@ -165,12 +165,12 @@ struct VLoop
|
|||
void bag( TriangleBag& triangles, bool close = true );
|
||||
};
|
||||
|
||||
/* The bags for all the layers */
|
||||
// The bags for all the layers
|
||||
static TriangleBag layer_triangles[LAYER_COUNT];
|
||||
static TriangleBag via_triangles[4];
|
||||
static double layer_z[LAYER_COUNT];
|
||||
|
||||
static void bag_flat_triangle( int layer, /*{{{*/
|
||||
static void bag_flat_triangle( int layer, //{{{
|
||||
double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x3, double y3 )
|
||||
|
@ -181,7 +181,7 @@ static void bag_flat_triangle( int layer, /*{{{*/
|
|||
}
|
||||
|
||||
|
||||
void FlatFan::bag( int layer, bool close ) /*{{{*/
|
||||
void FlatFan::bag( int layer, bool close ) //{{{
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
|
@ -193,7 +193,7 @@ void FlatFan::bag( int layer, bool close ) /*{{{*/
|
|||
}
|
||||
|
||||
|
||||
static void bag_flat_quad( int layer, /*{{{*/
|
||||
static void bag_flat_quad( int layer, //{{{
|
||||
double x1, double y1,
|
||||
double x2, double y2,
|
||||
double x3, double y3,
|
||||
|
@ -204,7 +204,7 @@ static void bag_flat_quad( int layer, /*{{{*/
|
|||
}
|
||||
|
||||
|
||||
void FlatRing::bag( int layer, bool close ) /*{{{*/
|
||||
void FlatRing::bag( int layer, bool close ) //{{{
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
|
@ -224,7 +224,7 @@ void FlatRing::bag( int layer, bool close ) /*{{{*/
|
|||
}
|
||||
|
||||
|
||||
static void bag_vquad( TriangleBag& triangles, /*{{{*/
|
||||
static void bag_vquad( TriangleBag& triangles, //{{{
|
||||
double x1, double y1, double x2, double y2,
|
||||
double z1, double z2 )
|
||||
{
|
||||
|
@ -237,7 +237,7 @@ static void bag_vquad( TriangleBag& triangles, /*{{{*/
|
|||
}
|
||||
|
||||
|
||||
void VLoop::bag( TriangleBag& triangles, bool close ) /*{{{*/
|
||||
void VLoop::bag( TriangleBag& triangles, bool close ) //{{{
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
|
@ -253,7 +253,7 @@ void VLoop::bag( TriangleBag& triangles, bool close ) /*{{{*/
|
|||
}
|
||||
|
||||
|
||||
static void write_triangle_bag( FILE* output_file, int color_index, /*{{{*/
|
||||
static void write_triangle_bag( FILE* output_file, int color_index, //{{{
|
||||
const TriangleBag& triangles )
|
||||
{
|
||||
/* A lot of nodes are not required, but blender sometimes chokes
|
||||
|
@ -270,7 +270,7 @@ static void write_triangle_bag( FILE* output_file, int color_index, /*{{{*/
|
|||
" Shape {\n",
|
||||
" appearance Appearance {\n",
|
||||
" material Material {\n",
|
||||
0, /* Material marker */
|
||||
0, // Material marker
|
||||
" ambientIntensity 0.8\n",
|
||||
" transparency 0.2\n",
|
||||
" shininess 0.2\n",
|
||||
|
@ -280,11 +280,11 @@ static void write_triangle_bag( FILE* output_file, int color_index, /*{{{*/
|
|||
" solid true\n",
|
||||
" coord Coordinate {\n",
|
||||
" point [\n",
|
||||
0, /* Coordinates marker */
|
||||
0, // Coordinates marker
|
||||
" ]\n",
|
||||
" }\n",
|
||||
" coordIndex [\n",
|
||||
0, /* Index marker */
|
||||
0, // Index marker
|
||||
" ]\n",
|
||||
" }\n",
|
||||
" }\n",
|
||||
|
@ -292,7 +292,7 @@ static void write_triangle_bag( FILE* output_file, int color_index, /*{{{*/
|
|||
" }\n",
|
||||
" ]\n",
|
||||
"}\n",
|
||||
0 /* End marker */
|
||||
0 // End marker
|
||||
};
|
||||
int marker_found = 0, lineno = 0;
|
||||
|
||||
|
@ -305,7 +305,7 @@ static void write_triangle_bag( FILE* output_file, int color_index, /*{{{*/
|
|||
marker_found++;
|
||||
switch( marker_found )
|
||||
{
|
||||
case 1: /* Material marker */
|
||||
case 1: // Material marker
|
||||
fprintf( output_file,
|
||||
" diffuseColor %g %g %g\n",
|
||||
(double) ColorRefs[color_index].m_Red / 255.0,
|
||||
|
@ -325,7 +325,7 @@ static void write_triangle_bag( FILE* output_file, int color_index, /*{{{*/
|
|||
|
||||
case 2:
|
||||
{
|
||||
/* Coordinates marker */
|
||||
// Coordinates marker
|
||||
for( TriangleBag::const_iterator i = triangles.begin();
|
||||
i != triangles.end();
|
||||
i++ )
|
||||
|
@ -342,8 +342,8 @@ static void write_triangle_bag( FILE* output_file, int color_index, /*{{{*/
|
|||
|
||||
case 3:
|
||||
{
|
||||
/* Index marker */
|
||||
/* OK, that's sick ... */
|
||||
// Index marker
|
||||
// OK, that's sick ...
|
||||
int j = 0;
|
||||
for( TriangleBag::const_iterator i = triangles.begin();
|
||||
i != triangles.end();
|
||||
|
@ -364,7 +364,7 @@ static void write_triangle_bag( FILE* output_file, int color_index, /*{{{*/
|
|||
}
|
||||
|
||||
|
||||
static void compute_layer_Zs( BOARD* pcb ) /*{{{*/
|
||||
static void compute_layer_Zs( BOARD* pcb ) //{{{
|
||||
{
|
||||
int copper_layers = pcb->GetCopperLayerCount( );
|
||||
|
||||
|
@ -372,18 +372,18 @@ static void compute_layer_Zs( BOARD* pcb ) /*{{{*/
|
|||
double board_thickness = pcb->GetDesignSettings().m_BoardThickness;
|
||||
double half_thickness = board_thickness / 2;
|
||||
|
||||
/* Compute each layer's Z value, more or less like the 3d view */
|
||||
// Compute each layer's Z value, more or less like the 3d view
|
||||
for( int i = 0; i <= LAYER_N_FRONT; i++ )
|
||||
{
|
||||
if( i < copper_layers )
|
||||
layer_z[i] = board_thickness * i / (copper_layers - 1) - half_thickness;
|
||||
else
|
||||
layer_z[i] = half_thickness; /* The component layer... */
|
||||
layer_z[i] = half_thickness; // The component layer...
|
||||
}
|
||||
|
||||
/* To avoid rounding interference, we apply an epsilon to each
|
||||
* successive layer */
|
||||
const double epsilon_z = 10; /* That's 1 mils, about 1/50 mm */
|
||||
const double epsilon_z = 10; // That's 1 mils, about 1/50 mm
|
||||
layer_z[SOLDERPASTE_N_BACK] = -half_thickness - epsilon_z * 4;
|
||||
layer_z[ADHESIVE_N_BACK] = -half_thickness - epsilon_z * 3;
|
||||
layer_z[SILKSCREEN_N_BACK] = -half_thickness - epsilon_z * 2;
|
||||
|
@ -400,7 +400,7 @@ static void compute_layer_Zs( BOARD* pcb ) /*{{{*/
|
|||
}
|
||||
|
||||
|
||||
static void export_vrml_line( int layer, double startx, double starty, /*{{{*/
|
||||
static void export_vrml_line( int layer, double startx, double starty, //{{{
|
||||
double endx, double endy, double width, int divisions )
|
||||
{
|
||||
double r = width / 2;
|
||||
|
@ -408,28 +408,28 @@ static void export_vrml_line( int layer, double startx, double starty, /*{{{*/
|
|||
double alpha;
|
||||
FlatFan fan;
|
||||
|
||||
/* Output the 'bone' as a triangle fan, this is the fan centre */
|
||||
// Output the 'bone' as a triangle fan, this is the fan centre
|
||||
fan.c.x = (startx + endx) / 2;
|
||||
fan.c.y = (starty + endy) / 2;
|
||||
|
||||
/* The 'end' side cap */
|
||||
// The 'end' side cap
|
||||
for( alpha = angle - PI2; alpha < angle + PI2; alpha += PI2 / divisions )
|
||||
fan.add( endx + r * cos( alpha ), endy + r * sin( alpha ) );
|
||||
|
||||
alpha = angle + PI2;
|
||||
fan.add( endx + r * cos( alpha ), endy + r * sin( alpha ) );
|
||||
/* The 'start' side cap */
|
||||
// The 'start' side cap
|
||||
for( alpha = angle + PI2; alpha < angle + 3 * PI2; alpha += PI2 / divisions )
|
||||
fan.add( startx + r * cos( alpha ), starty + r * sin( alpha ) );
|
||||
|
||||
alpha = angle + 3 * PI2;
|
||||
fan.add( startx + r * cos( alpha ), starty + r * sin( alpha ) );
|
||||
/* Export the fan */
|
||||
// Export the fan
|
||||
fan.bag( layer );
|
||||
}
|
||||
|
||||
|
||||
static void export_vrml_circle( int layer, double startx, double starty, /*{{{*/
|
||||
static void export_vrml_circle( int layer, double startx, double starty, //{{{
|
||||
double endx, double endy, double width, int divisions )
|
||||
{
|
||||
double hole, radius;
|
||||
|
@ -448,11 +448,11 @@ static void export_vrml_circle( int layer, double startx, double starty, /*{{{*/
|
|||
}
|
||||
|
||||
|
||||
static void export_vrml_slot( TriangleBag& triangles, /*{{{*/
|
||||
static void export_vrml_slot( TriangleBag& triangles, //{{{
|
||||
int top_layer, int bottom_layer, double xc, double yc,
|
||||
double dx, double dy, int orient, int divisions )
|
||||
{
|
||||
double capx, capy; /* Cap center */
|
||||
double capx, capy; // Cap center
|
||||
VLoop loop;
|
||||
|
||||
loop.z_top = layer_z[top_layer];
|
||||
|
@ -465,10 +465,10 @@ static void export_vrml_slot( TriangleBag& triangles, /*{{{*/
|
|||
angle += PI2;
|
||||
}
|
||||
|
||||
/* The exchange above means that cutter radius is alvays dy/2 */
|
||||
// The exchange above means that cutter radius is alvays dy/2
|
||||
double r = dy / 2;
|
||||
double alpha;
|
||||
/* The first side cap */
|
||||
// The first side cap
|
||||
capx = xc + cos( angle ) * dx / 2;
|
||||
capy = yc + sin( angle ) * dx / 2;
|
||||
|
||||
|
@ -478,7 +478,7 @@ static void export_vrml_slot( TriangleBag& triangles, /*{{{*/
|
|||
alpha = angle + PI2;
|
||||
loop.add( capx + r * cos( alpha ), capy + r * sin( alpha ) );
|
||||
|
||||
/* The other side cap */
|
||||
// The other side cap
|
||||
capx = xc - cos( angle ) * dx / 2;
|
||||
capy = yc - sin( angle ) * dx / 2;
|
||||
|
||||
|
@ -491,7 +491,7 @@ static void export_vrml_slot( TriangleBag& triangles, /*{{{*/
|
|||
}
|
||||
|
||||
|
||||
static void export_vrml_hole( TriangleBag& triangles, /*{{{*/
|
||||
static void export_vrml_hole( TriangleBag& triangles, //{{{
|
||||
int top_layer, int bottom_layer, double xc, double yc, double hole,
|
||||
int divisions )
|
||||
{
|
||||
|
@ -507,7 +507,7 @@ static void export_vrml_hole( TriangleBag& triangles, /*{{{*/
|
|||
}
|
||||
|
||||
|
||||
static void export_vrml_varc( TriangleBag& triangles, /*{{{*/
|
||||
static void export_vrml_varc( TriangleBag& triangles, //{{{
|
||||
int top_layer, int bottom_layer, double startx, double starty,
|
||||
double endx, double endy, int divisions )
|
||||
{
|
||||
|
@ -527,11 +527,11 @@ static void export_vrml_varc( TriangleBag& triangles, /*{{{*/
|
|||
}
|
||||
|
||||
|
||||
static void export_vrml_oval_pad( int layer, /*{{{*/
|
||||
static void export_vrml_oval_pad( int layer, //{{{
|
||||
double xc, double yc,
|
||||
double dx, double dy, int orient, int divisions )
|
||||
{
|
||||
double capx, capy; /* Cap center */
|
||||
double capx, capy; // Cap center
|
||||
FlatFan fan;
|
||||
|
||||
fan.c.x = xc;
|
||||
|
@ -544,11 +544,11 @@ static void export_vrml_oval_pad( int layer, /*{{{*/
|
|||
angle += PI2;
|
||||
}
|
||||
|
||||
/* The exchange above means that cutter radius is alvays dy/2 */
|
||||
// The exchange above means that cutter radius is alvays dy/2
|
||||
double r = dy / 2;
|
||||
double alpha;
|
||||
|
||||
/* The first side cap */
|
||||
// The first side cap
|
||||
capx = xc + cos( angle ) * dx / 2;
|
||||
capy = yc + sin( angle ) * dx / 2;
|
||||
|
||||
|
@ -557,7 +557,7 @@ static void export_vrml_oval_pad( int layer, /*{{{*/
|
|||
|
||||
alpha = angle + PI2;
|
||||
fan.add( capx + r * cos( alpha ), capy + r * sin( alpha ) );
|
||||
/* The other side cap */
|
||||
// The other side cap
|
||||
capx = xc - cos( angle ) * dx / 2;
|
||||
capy = yc - sin( angle ) * dx / 2;
|
||||
|
||||
|
@ -570,7 +570,7 @@ static void export_vrml_oval_pad( int layer, /*{{{*/
|
|||
}
|
||||
|
||||
|
||||
static void export_vrml_arc( int layer, double startx, double starty, /*{{{*/
|
||||
static void export_vrml_arc( int layer, double startx, double starty, //{{{
|
||||
double endx, double endy, double width, int divisions )
|
||||
{
|
||||
FlatRing ring;
|
||||
|
@ -590,7 +590,7 @@ static void export_vrml_arc( int layer, double startx, double starty, /*{{{*/
|
|||
}
|
||||
|
||||
|
||||
static void export_vrml_drawsegment( DRAWSEGMENT* drawseg ) /*{{{*/
|
||||
static void export_vrml_drawsegment( DRAWSEGMENT* drawseg ) //{{{
|
||||
{
|
||||
int layer = drawseg->GetLayer();
|
||||
double w = drawseg->GetWidth();
|
||||
|
@ -599,19 +599,19 @@ static void export_vrml_drawsegment( DRAWSEGMENT* drawseg ) /*{{{*/
|
|||
double xf = drawseg->GetEnd().x;
|
||||
double yf = drawseg->GetEnd().y;
|
||||
|
||||
/* Items on the edge layer are high, not thick */
|
||||
// Items on the edge layer are high, not thick
|
||||
if( layer == EDGE_N )
|
||||
{
|
||||
switch( drawseg->GetShape() )
|
||||
{
|
||||
/* There is a special 'varc' primitive for this */
|
||||
// There is a special 'varc' primitive for this
|
||||
case S_ARC:
|
||||
export_vrml_varc( layer_triangles[layer],
|
||||
FIRST_COPPER_LAYER, LAST_COPPER_LAYER,
|
||||
x, y, xf, yf, 4 );
|
||||
break;
|
||||
|
||||
/* Circles on edge are usually important holes */
|
||||
// Circles on edge are usually important holes
|
||||
case S_CIRCLE:
|
||||
export_vrml_hole( layer_triangles[layer],
|
||||
FIRST_COPPER_LAYER, LAST_COPPER_LAYER, x, y,
|
||||
|
@ -620,7 +620,7 @@ static void export_vrml_drawsegment( DRAWSEGMENT* drawseg ) /*{{{*/
|
|||
|
||||
default:
|
||||
{
|
||||
/* Simply a quad */
|
||||
// Simply a quad
|
||||
double z_top = layer_z[FIRST_COPPER_LAYER];
|
||||
double z_bottom = layer_z[LAST_COPPER_LAYER];
|
||||
bag_vquad( layer_triangles[layer], x, y, xf, yf, z_top, z_bottom );
|
||||
|
@ -661,7 +661,7 @@ static void vrml_text_callback( int x0, int y0, int xf, int yf )
|
|||
|
||||
static void export_vrml_pcbtext( TEXTE_PCB* text )
|
||||
{
|
||||
/* Coupling by globals! Ewwww... */
|
||||
// Coupling by globals! Ewwww...
|
||||
s_text_layer = text->GetLayer();
|
||||
s_text_width = text->m_Thickness;
|
||||
|
||||
|
@ -677,12 +677,12 @@ static void export_vrml_pcbtext( TEXTE_PCB* text )
|
|||
|
||||
offset.y = text->GetInterline();
|
||||
|
||||
RotatePoint( &offset, text->m_Orient );
|
||||
RotatePoint( &offset, text->GetOrientation() );
|
||||
for( unsigned i = 0; i<list->Count(); i++ )
|
||||
{
|
||||
wxString txt = list->Item( i );
|
||||
DrawGraphicText( NULL, NULL, pos, (EDA_Colors) 0,
|
||||
txt, text->m_Orient, size,
|
||||
txt, text->GetOrientation(), size,
|
||||
text->m_HJustify, text->m_VJustify,
|
||||
text->m_Thickness, text->m_Italic,
|
||||
true,
|
||||
|
@ -695,7 +695,7 @@ static void export_vrml_pcbtext( TEXTE_PCB* text )
|
|||
else
|
||||
{
|
||||
DrawGraphicText( NULL, NULL, text->m_Pos, (EDA_Colors) 0,
|
||||
text->m_Text, text->m_Orient, size,
|
||||
text->m_Text, text->GetOrientation(), size,
|
||||
text->m_HJustify, text->m_VJustify,
|
||||
text->m_Thickness, text->m_Italic,
|
||||
true,
|
||||
|
@ -704,9 +704,9 @@ static void export_vrml_pcbtext( TEXTE_PCB* text )
|
|||
}
|
||||
|
||||
|
||||
static void export_vrml_drawings( BOARD* pcb ) /*{{{*/
|
||||
static void export_vrml_drawings( BOARD* pcb ) //{{{
|
||||
{
|
||||
/* draw graphic items */
|
||||
// draw graphic items
|
||||
for( EDA_ITEM* drawing = pcb->m_Drawings; drawing != 0; drawing = drawing->Next() )
|
||||
{
|
||||
switch( drawing->Type() )
|
||||
|
@ -726,14 +726,14 @@ static void export_vrml_drawings( BOARD* pcb ) /*{{{*/
|
|||
}
|
||||
|
||||
|
||||
static void export_round_padstack( BOARD* pcb, double x, double y, double r, /*{{{*/
|
||||
static void export_round_padstack( BOARD* pcb, double x, double y, double r, //{{{
|
||||
int bottom_layer, int top_layer, int divisions )
|
||||
{
|
||||
int copper_layers = pcb->GetCopperLayerCount( );
|
||||
|
||||
for( int layer = bottom_layer; layer < copper_layers; layer++ )
|
||||
{
|
||||
/* The last layer is always the component one, unless it's single face */
|
||||
// The last layer is always the component one, unless it's single face
|
||||
if( (layer > FIRST_COPPER_LAYER) && (layer == copper_layers - 1) )
|
||||
layer = LAST_COPPER_LAYER;
|
||||
|
||||
|
@ -743,7 +743,7 @@ static void export_round_padstack( BOARD* pcb, double x, double y, double r, /*{
|
|||
}
|
||||
|
||||
|
||||
static void export_vrml_via( BOARD* pcb, SEGVIA* via ) /*{{{*/
|
||||
static void export_vrml_via( BOARD* pcb, SEGVIA* via ) //{{{
|
||||
{
|
||||
double x, y, r, hole;
|
||||
int top_layer, bottom_layer;
|
||||
|
@ -754,15 +754,15 @@ static void export_vrml_via( BOARD* pcb, SEGVIA* via ) /*{{{*/
|
|||
y = via->m_Start.y;
|
||||
via->ReturnLayerPair( &top_layer, &bottom_layer );
|
||||
|
||||
/* Export the via padstack */
|
||||
// Export the via padstack
|
||||
export_round_padstack( pcb, x, y, r, bottom_layer, top_layer, 8 );
|
||||
|
||||
/* Drill a rough hole */
|
||||
// Drill a rough hole
|
||||
export_vrml_hole( via_triangles[via->m_Shape], top_layer, bottom_layer, x, y, hole, 8 );
|
||||
}
|
||||
|
||||
|
||||
static void export_vrml_tracks( BOARD* pcb ) /*{{{*/
|
||||
static void export_vrml_tracks( BOARD* pcb ) //{{{
|
||||
{
|
||||
for( TRACK* track = pcb->m_Track; track != NULL; track = track->Next() )
|
||||
{
|
||||
|
@ -832,7 +832,7 @@ static void export_vrml_zones( BOARD* pcb )
|
|||
}
|
||||
*/
|
||||
|
||||
static void export_vrml_text_module( TEXTE_MODULE* module ) /*{{{*/
|
||||
static void export_vrml_text_module( TEXTE_MODULE* module ) //{{{
|
||||
{
|
||||
if( module->IsVisible() )
|
||||
{
|
||||
|
@ -853,7 +853,7 @@ static void export_vrml_text_module( TEXTE_MODULE* module ) /*{{{*/
|
|||
}
|
||||
|
||||
|
||||
static void export_vrml_edge_module( EDGE_MODULE* module ) /*{{{*/
|
||||
static void export_vrml_edge_module( EDGE_MODULE* module ) //{{{
|
||||
{
|
||||
int layer = module->GetLayer();
|
||||
double x = module->GetStart().x;
|
||||
|
@ -879,23 +879,23 @@ static void export_vrml_edge_module( EDGE_MODULE* module ) /*{{{*/
|
|||
}
|
||||
|
||||
|
||||
static void export_vrml_pad( BOARD* pcb, D_PAD* pad ) /*{{{*/
|
||||
static void export_vrml_pad( BOARD* pcb, D_PAD* aPad ) //{{{
|
||||
{
|
||||
double hole_drill_w = (double) pad->m_Drill.x / 2;
|
||||
double hole_drill_h = (double) pad->m_Drill.y / 2;
|
||||
double hole_drill_w = (double) aPad->GetDrillSize().x / 2;
|
||||
double hole_drill_h = (double) aPad->GetDrillSize().y / 2;
|
||||
double hole_drill = MIN( hole_drill_w, hole_drill_h );
|
||||
double hole_x = pad->m_Pos.x;
|
||||
double hole_y = pad->m_Pos.y;
|
||||
double hole_x = aPad->GetPosition().x;
|
||||
double hole_y = aPad->GetPosition().y;
|
||||
|
||||
/* Export the hole on the edge layer */
|
||||
// Export the hole on the edge layer
|
||||
if( hole_drill > 0 )
|
||||
{
|
||||
if( pad->m_DrillShape == PAD_OVAL )
|
||||
if( aPad->GetDrillShape() == PAD_OVAL )
|
||||
{
|
||||
/* Oblong hole (slot) */
|
||||
// Oblong hole (slot)
|
||||
export_vrml_slot( layer_triangles[EDGE_N],
|
||||
FIRST_COPPER_LAYER, LAST_COPPER_LAYER,
|
||||
hole_x, hole_y, hole_drill_w, hole_drill_h, pad->m_Orient, 6 );
|
||||
hole_x, hole_y, hole_drill_w, hole_drill_h, aPad->GetOrientation(), 6 );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -906,29 +906,32 @@ static void export_vrml_pad( BOARD* pcb, D_PAD* pad ) /*{{{*/
|
|||
}
|
||||
}
|
||||
|
||||
/* The pad proper, on the selected layers */
|
||||
unsigned long layer_mask = pad->m_layerMask;
|
||||
int copper_layers = pcb->GetCopperLayerCount( );
|
||||
/* The (maybe offseted) pad position */
|
||||
wxPoint pad_pos = pad->ReturnShapePos();
|
||||
double pad_x = pad_pos.x;
|
||||
double pad_y = pad_pos.y;
|
||||
wxSize pad_delta = pad->m_DeltaSize;
|
||||
double pad_dx = pad_delta.x / 2;
|
||||
double pad_dy = pad_delta.y / 2;
|
||||
double pad_w = pad->m_Size.x / 2;
|
||||
double pad_h = pad->m_Size.y / 2;
|
||||
// The pad proper, on the selected layers
|
||||
int layer_mask = aPad->GetLayerMask();
|
||||
int copper_layers = pcb->GetCopperLayerCount( );
|
||||
|
||||
// The (maybe offseted) pad position
|
||||
wxPoint pad_pos = aPad->ReturnShapePos();
|
||||
double pad_x = pad_pos.x;
|
||||
double pad_y = pad_pos.y;
|
||||
wxSize pad_delta = aPad->GetDelta();
|
||||
|
||||
double pad_dx = pad_delta.x / 2;
|
||||
double pad_dy = pad_delta.y / 2;
|
||||
|
||||
double pad_w = aPad->GetSize().x / 2;
|
||||
double pad_h = aPad->GetSize().y / 2;
|
||||
|
||||
for( int layer = FIRST_COPPER_LAYER; layer < copper_layers; layer++ )
|
||||
{
|
||||
/* The last layer is always the component one, unless it's single face */
|
||||
// The last layer is always the component one, unless it's single face
|
||||
if( (layer > FIRST_COPPER_LAYER) && (layer == copper_layers - 1) )
|
||||
layer = LAST_COPPER_LAYER;
|
||||
|
||||
if( layer_mask & (1 << layer) )
|
||||
{
|
||||
/* OK, the pad is on this layer, export it */
|
||||
switch( pad->m_PadShape & 0x7F ) /* What is the masking for? */
|
||||
// OK, the pad is on this layer, export it
|
||||
switch( aPad->GetShape() )
|
||||
{
|
||||
case PAD_CIRCLE:
|
||||
export_vrml_circle( layer, pad_x, pad_y,
|
||||
|
@ -938,44 +941,47 @@ static void export_vrml_pad( BOARD* pcb, D_PAD* pad ) /*{{{*/
|
|||
case PAD_OVAL:
|
||||
export_vrml_oval_pad( layer,
|
||||
pad_x, pad_y,
|
||||
pad_w * 2, pad_h * 2, pad->m_Orient, 4 );
|
||||
pad_w * 2, pad_h * 2, aPad->GetOrientation(), 4 );
|
||||
break;
|
||||
|
||||
case PAD_RECT:
|
||||
/* Just to be sure :D */
|
||||
// Just to be sure :D
|
||||
pad_dx = 0;
|
||||
pad_dy = 0;
|
||||
|
||||
case PAD_TRAPEZOID:
|
||||
{
|
||||
int coord[8] =
|
||||
{
|
||||
wxRound(-pad_w - pad_dy), wxRound(+pad_h + pad_dx),
|
||||
wxRound(-pad_w + pad_dy), wxRound(-pad_h - pad_dx),
|
||||
wxRound(+pad_w - pad_dy), wxRound(+pad_h - pad_dx),
|
||||
wxRound(+pad_w + pad_dy), wxRound(-pad_h + pad_dx),
|
||||
};
|
||||
int coord[8] =
|
||||
{
|
||||
wxRound(-pad_w - pad_dy), wxRound(+pad_h + pad_dx),
|
||||
wxRound(-pad_w + pad_dy), wxRound(-pad_h - pad_dx),
|
||||
wxRound(+pad_w - pad_dy), wxRound(+pad_h - pad_dx),
|
||||
wxRound(+pad_w + pad_dy), wxRound(-pad_h + pad_dx),
|
||||
};
|
||||
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{
|
||||
RotatePoint( &coord[i * 2], &coord[i * 2 + 1], pad->m_Orient );
|
||||
coord[i * 2] += wxRound( pad_x );
|
||||
coord[i * 2 + 1] += wxRound( pad_y );
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{
|
||||
RotatePoint( &coord[i * 2], &coord[i * 2 + 1], aPad->GetOrientation() );
|
||||
coord[i * 2] += wxRound( pad_x );
|
||||
coord[i * 2 + 1] += wxRound( pad_y );
|
||||
}
|
||||
|
||||
bag_flat_quad( layer, coord[0], coord[1],
|
||||
coord[2], coord[3],
|
||||
coord[4], coord[5],
|
||||
coord[6], coord[7] );
|
||||
}
|
||||
break;
|
||||
|
||||
bag_flat_quad( layer, coord[0], coord[1],
|
||||
coord[2], coord[3],
|
||||
coord[4], coord[5],
|
||||
coord[6], coord[7] );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* From axis/rot to quaternion */
|
||||
// From axis/rot to quaternion
|
||||
static void build_quat( double x, double y, double z, double a, double q[4] )
|
||||
{
|
||||
double sina = sin( a / 2 );
|
||||
|
@ -987,7 +993,7 @@ static void build_quat( double x, double y, double z, double a, double q[4] )
|
|||
}
|
||||
|
||||
|
||||
/* From quaternion to axis/rot */
|
||||
// From quaternion to axis/rot
|
||||
static void from_quat( double q[4], double rot[4] )
|
||||
{
|
||||
rot[3] = acos( q[3] ) * 2;
|
||||
|
@ -999,7 +1005,7 @@ static void from_quat( double q[4], double rot[4] )
|
|||
}
|
||||
|
||||
|
||||
/* Quaternion composition */
|
||||
// Quaternion composition
|
||||
static void compose_quat( double q1[4], double q2[4], double qr[4] )
|
||||
{
|
||||
double tmp[4];
|
||||
|
@ -1017,11 +1023,11 @@ static void export_vrml_module( BOARD* aPcb, MODULE* aModule,
|
|||
FILE* aOutputFile, double aScalingFactor,
|
||||
bool aExport3DFiles, const wxString & a3D_Subdir )
|
||||
{
|
||||
/* Reference and value */
|
||||
// Reference and value
|
||||
export_vrml_text_module( aModule->m_Reference );
|
||||
export_vrml_text_module( aModule->m_Value );
|
||||
|
||||
/* Export module edges */
|
||||
// Export module edges
|
||||
for( EDA_ITEM* item = aModule->m_Drawings; item != NULL; item = item->Next() )
|
||||
{
|
||||
switch( item->Type() )
|
||||
|
@ -1039,13 +1045,13 @@ static void export_vrml_module( BOARD* aPcb, MODULE* aModule,
|
|||
}
|
||||
}
|
||||
|
||||
/* Export pads */
|
||||
for( D_PAD* pad = aModule->m_Pads; pad != 0; pad = pad->Next() )
|
||||
// Export pads
|
||||
for( D_PAD* pad = aModule->m_Pads; pad; pad = pad->Next() )
|
||||
export_vrml_pad( aPcb, pad );
|
||||
|
||||
bool isFlipped = aModule->GetLayer() == LAYER_N_BACK;
|
||||
|
||||
/* Export the object VRML model(s) */
|
||||
// Export the object VRML model(s)
|
||||
for( S3D_MASTER* vrmlm = aModule->m_3D_Drawings; vrmlm != 0; vrmlm = vrmlm->Next() )
|
||||
{
|
||||
wxString fname = vrmlm->m_Shape3DName;
|
||||
|
@ -1090,21 +1096,21 @@ static void export_vrml_module( BOARD* aPcb, MODULE* aModule,
|
|||
NEGATE(rotz);
|
||||
}
|
||||
|
||||
/* Do some quaternion munching */
|
||||
// Do some quaternion munching
|
||||
double q1[4], q2[4], rot[4];
|
||||
build_quat( 1, 0, 0, rotx / 180.0 * M_PI, q1 );
|
||||
build_quat( 0, 1, 0, roty / 180.0 * M_PI, q2 );
|
||||
compose_quat( q1, q2, q1 );
|
||||
build_quat( 0, 0, 1, rotz / 180.0 * M_PI, q2 );
|
||||
compose_quat( q1, q2, q1 );
|
||||
// Note here aModule->m_Orient is in 0.1 degrees,
|
||||
// so module rotation is aModule->m_Orient / 1800.0
|
||||
build_quat( 0, 0, 1, aModule->m_Orient / 1800.0 * M_PI, q2 );
|
||||
// Note here aModule->GetOrientation() is in 0.1 degrees,
|
||||
// so module rotation is aModule->GetOrientation() / 1800.0
|
||||
build_quat( 0, 0, 1, aModule->GetOrientation() / 1800.0 * M_PI, q2 );
|
||||
compose_quat( q1, q2, q1 );
|
||||
from_quat( q1, rot );
|
||||
|
||||
fprintf( aOutputFile, "Transform {\n" );
|
||||
/* A null rotation would fail the acos! */
|
||||
// A null rotation would fail the acos!
|
||||
if( rot[3] != 0.0 )
|
||||
{
|
||||
fprintf( aOutputFile, " rotation %g %g %g %g\n", rot[0], rot[1], rot[2], rot[3] );
|
||||
|
@ -1115,7 +1121,7 @@ static void export_vrml_module( BOARD* aPcb, MODULE* aModule,
|
|||
vrmlm->m_MatScale.y * aScalingFactor,
|
||||
vrmlm->m_MatScale.z * aScalingFactor );
|
||||
|
||||
/* adjust 3D shape offset position (offset is given inch) */
|
||||
// adjust 3D shape offset position (offset is given inch)
|
||||
#define UNITS_3D_TO_PCB_UNITS PCB_INTERNAL_UNIT
|
||||
int offsetx = wxRound( vrmlm->m_MatPosition.x * UNITS_3D_TO_PCB_UNITS );
|
||||
int offsety = wxRound( vrmlm->m_MatPosition.y * UNITS_3D_TO_PCB_UNITS );
|
||||
|
@ -1126,7 +1132,7 @@ static void export_vrml_module( BOARD* aPcb, MODULE* aModule,
|
|||
else // In normal mode, Y axis is reversed in Pcbnew.
|
||||
NEGATE(offsety);
|
||||
|
||||
RotatePoint(&offsetx, &offsety, aModule->m_Orient);
|
||||
RotatePoint(&offsetx, &offsety, aModule->GetOrientation());
|
||||
|
||||
fprintf( aOutputFile, " translation %g %g %g\n",
|
||||
(double) (offsetx + aModule->m_Pos.x),
|
||||
|
@ -1220,7 +1226,7 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString & aFullFileName,
|
|||
// Switch the locale to standard C (needed to print floating point numbers like 1.3)
|
||||
SetLocaleTo_C_standard();
|
||||
|
||||
/* Begin with the usual VRML boilerplate */
|
||||
// Begin with the usual VRML boilerplate
|
||||
wxString name = aFullFileName;
|
||||
|
||||
name.Replace(wxT("\\"), wxT("/" ) );
|
||||
|
@ -1266,20 +1272,20 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString & aFullFileName,
|
|||
*/
|
||||
|
||||
double wrml_3D_models_scaling_factor = 0.1 / board_scaling_factor;
|
||||
/* Preliminary computation: the z value for each layer */
|
||||
// Preliminary computation: the z value for each layer
|
||||
compute_layer_Zs( pcb );
|
||||
|
||||
/* Drawing and text on the board, and edges which are special */
|
||||
// Drawing and text on the board, and edges which are special
|
||||
export_vrml_drawings( pcb );
|
||||
|
||||
/* Export vias and trackage */
|
||||
// Export vias and trackage
|
||||
export_vrml_tracks( pcb );
|
||||
|
||||
/* Export zone fills */
|
||||
// Export zone fills
|
||||
/* TODO export_vrml_zones(pcb);
|
||||
*/
|
||||
|
||||
/* Export footprints */
|
||||
// Export footprints
|
||||
for( MODULE* module = pcb->m_Modules; module != 0; module = module->Next() )
|
||||
export_vrml_module( pcb, module, output_file,
|
||||
wrml_3D_models_scaling_factor,
|
||||
|
@ -1292,13 +1298,13 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString & aFullFileName,
|
|||
layer_triangles[layer],
|
||||
pcb->GetLayerColor(layer) );
|
||||
|
||||
/* Same thing for the via layers */
|
||||
// Same thing for the via layers
|
||||
for( int i = 0; i < 4; i++ )
|
||||
write_and_empty_triangle_bag( output_file,
|
||||
via_triangles[i],
|
||||
pcb->GetVisibleElementColor( VIAS_VISIBLE + i ) );
|
||||
|
||||
/* Close the outer 'transform' node */
|
||||
// Close the outer 'transform' node
|
||||
fputs( "]\n}\n", output_file );
|
||||
|
||||
// End of work
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include <gendrill.h>
|
||||
|
||||
|
||||
/* Local Functions */
|
||||
// Local Functions
|
||||
|
||||
/* Compare function used for sorting holes by increasing diameter value
|
||||
* and X value
|
||||
|
@ -109,39 +109,35 @@ void Build_Holes_List( BOARD* aPcb,
|
|||
}
|
||||
}
|
||||
|
||||
/* build hole list for pads (assumed always through holes) */
|
||||
// build hole list for pads (assumed always through holes)
|
||||
if( !aExcludeThroughHoles || aGenerateNPTH_list )
|
||||
{
|
||||
MODULE* Module = aPcb->m_Modules;
|
||||
|
||||
for( ; Module != NULL; Module = Module->Next() )
|
||||
for( MODULE* module = aPcb->m_Modules; module; module->Next() )
|
||||
{
|
||||
/* Read and analyse pads */
|
||||
D_PAD* pad = Module->m_Pads;
|
||||
|
||||
for( ; pad != NULL; pad = pad->Next() )
|
||||
// Read and analyse pads
|
||||
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
|
||||
{
|
||||
if( ! aGenerateNPTH_list && pad->m_Attribut == PAD_HOLE_NOT_PLATED )
|
||||
if( ! aGenerateNPTH_list && pad->GetAttribute() == PAD_HOLE_NOT_PLATED )
|
||||
continue;
|
||||
|
||||
if( aGenerateNPTH_list && pad->m_Attribut != PAD_HOLE_NOT_PLATED )
|
||||
if( aGenerateNPTH_list && pad->GetAttribute() != PAD_HOLE_NOT_PLATED )
|
||||
continue;
|
||||
|
||||
if( pad->m_Drill.x == 0 )
|
||||
if( pad->GetDrillSize().x == 0 )
|
||||
continue;
|
||||
|
||||
new_hole.m_Hole_NotPlated = (pad->m_Attribut == PAD_HOLE_NOT_PLATED);
|
||||
new_hole.m_Hole_NotPlated = (pad->GetAttribute() == PAD_HOLE_NOT_PLATED);
|
||||
new_hole.m_Tool_Reference = -1; // Flag is: Not initialized
|
||||
new_hole.m_Hole_Orient = pad->m_Orient;
|
||||
new_hole.m_Hole_Orient = pad->GetOrientation();
|
||||
new_hole.m_Hole_Shape = 0; // hole shape: round
|
||||
new_hole.m_Hole_Diameter = min( pad->m_Drill.x, pad->m_Drill.y );
|
||||
new_hole.m_Hole_Diameter = min( pad->GetDrillSize().x, pad->GetDrillSize().y );
|
||||
new_hole.m_Hole_Size.x = new_hole.m_Hole_Size.y = new_hole.m_Hole_Diameter;
|
||||
|
||||
if( pad->m_DrillShape != PAD_CIRCLE )
|
||||
if( pad->GetDrillShape() != PAD_CIRCLE )
|
||||
new_hole.m_Hole_Shape = 1; // oval flag set
|
||||
|
||||
new_hole.m_Hole_Size = pad->m_Drill;
|
||||
new_hole.m_Hole_Pos = pad->m_Pos; // hole position
|
||||
new_hole.m_Hole_Size = pad->GetDrillSize();
|
||||
new_hole.m_Hole_Pos = pad->GetPosition(); // hole position
|
||||
new_hole.m_Hole_Bottom_Layer = LAYER_N_BACK;
|
||||
new_hole.m_Hole_Top_Layer = LAYER_N_FRONT;// pad holes are through holes
|
||||
aHoleListBuffer.push_back( new_hole );
|
||||
|
|
|
@ -312,7 +312,7 @@ static bool HasNonSMDPins( MODULE* aModule )
|
|||
|
||||
for( pad = aModule->m_Pads; pad; pad = pad->Next() )
|
||||
{
|
||||
if( pad->m_Attribut != PAD_SMD )
|
||||
if( pad->GetAttribute() != PAD_SMD )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -630,37 +630,42 @@ bool PCB_EDIT_FRAME::DoGenFootprintsReport( const wxString& aFullFilename, bool
|
|||
{
|
||||
fprintf( rptfile, "$PAD \"%s\"\n", TO_UTF8( pad->GetPadName() ) );
|
||||
sprintf( line, "position %9.6f %9.6f\n",
|
||||
pad->m_Pos0.x * conv_unit,
|
||||
pad->m_Pos0.y * conv_unit );
|
||||
pad->GetPos0().x * conv_unit,
|
||||
pad->GetPos0().y * conv_unit );
|
||||
fputs( line, rptfile );
|
||||
|
||||
sprintf( line, "size %9.6f %9.6f\n",
|
||||
pad->m_Size.x * conv_unit,
|
||||
pad->m_Size.y * conv_unit );
|
||||
pad->GetSize().x * conv_unit,
|
||||
pad->GetSize().y * conv_unit );
|
||||
fputs( line, rptfile );
|
||||
sprintf( line, "drill %9.6f\n", pad->m_Drill.x * conv_unit );
|
||||
|
||||
sprintf( line, "drill %9.6f\n", pad->GetDrillSize().x * conv_unit );
|
||||
fputs( line, rptfile );
|
||||
|
||||
sprintf( line, "shape_offset %9.6f %9.6f\n",
|
||||
pad->m_Offset.x * conv_unit,
|
||||
pad->m_Offset.y * conv_unit );
|
||||
pad->GetOffset().x * conv_unit,
|
||||
pad->GetOffset().y * conv_unit );
|
||||
fputs( line, rptfile );
|
||||
|
||||
sprintf( line, "orientation %.2f\n",
|
||||
double(pad->m_Orient - Module->m_Orient) / 10 );
|
||||
double(pad->GetOrientation() - Module->GetOrientation()) / 10 );
|
||||
fputs( line, rptfile );
|
||||
const char* shape_name[6] = { "??? ", "Circ", "Rect", "Oval", "trap", "spec" };
|
||||
sprintf( line, "Shape %s\n", shape_name[pad->m_PadShape] );
|
||||
|
||||
static const char* shape_name[6] = { "??? ", "Circ", "Rect", "Oval", "trap", "spec" };
|
||||
|
||||
sprintf( line, "Shape %s\n", shape_name[pad->GetShape()] );
|
||||
fputs( line, rptfile );
|
||||
|
||||
int layer = 0;
|
||||
|
||||
if( pad->m_layerMask & LAYER_BACK )
|
||||
if( pad->GetLayerMask() & LAYER_BACK )
|
||||
layer = 1;
|
||||
|
||||
if( pad->m_layerMask & LAYER_FRONT )
|
||||
if( pad->GetLayerMask() & LAYER_FRONT )
|
||||
layer |= 2;
|
||||
|
||||
const char* layer_name[4] = { "??? ", "copper", "component", "all" };
|
||||
static const char* layer_name[4] = { "??? ", "copper", "component", "all" };
|
||||
|
||||
sprintf( line, "Layer %s\n", layer_name[layer] );
|
||||
fputs( line, rptfile );
|
||||
fprintf( rptfile, "$EndPAD\n" );
|
||||
|
|
|
@ -33,8 +33,7 @@ public:
|
|||
static bool m_Pad_Orient_Filter;
|
||||
|
||||
public:
|
||||
DIALOG_GLOBAL_PADS_EDITION( PCB_BASE_FRAME* parent, D_PAD* Pad );
|
||||
~DIALOG_GLOBAL_PADS_EDITION() { }
|
||||
DIALOG_GLOBAL_PADS_EDITION( PCB_BASE_FRAME* aParent, D_PAD* aPad );
|
||||
|
||||
private:
|
||||
void InstallPadEditor( wxCommandEvent& event );
|
||||
|
@ -43,11 +42,11 @@ private:
|
|||
};
|
||||
|
||||
|
||||
DIALOG_GLOBAL_PADS_EDITION::DIALOG_GLOBAL_PADS_EDITION( PCB_BASE_FRAME* parent, D_PAD* Pad ) :
|
||||
DIALOG_GLOBAL_PADS_EDITION_BASE( parent )
|
||||
DIALOG_GLOBAL_PADS_EDITION::DIALOG_GLOBAL_PADS_EDITION( PCB_BASE_FRAME* aParent, D_PAD* aPad ) :
|
||||
DIALOG_GLOBAL_PADS_EDITION_BASE( aParent )
|
||||
{
|
||||
m_Parent = parent;
|
||||
m_CurrentPad = Pad;
|
||||
m_Parent = aParent;
|
||||
m_CurrentPad = aPad;
|
||||
|
||||
// Pad filter selection.
|
||||
m_Pad_Shape_Filter_CB->SetValue( m_Pad_Shape_Filter );
|
||||
|
@ -61,7 +60,7 @@ DIALOG_GLOBAL_PADS_EDITION::DIALOG_GLOBAL_PADS_EDITION( PCB_BASE_FRAME* parent,
|
|||
}
|
||||
|
||||
|
||||
/* Class DIALOG_GLOBAL_PADS_EDITION static variables */
|
||||
// Class DIALOG_GLOBAL_PADS_EDITION static variables
|
||||
bool DIALOG_GLOBAL_PADS_EDITION::m_Pad_Shape_Filter = true;
|
||||
bool DIALOG_GLOBAL_PADS_EDITION::m_Pad_Layer_Filter = true;
|
||||
bool DIALOG_GLOBAL_PADS_EDITION::m_Pad_Orient_Filter = true;
|
||||
|
@ -119,22 +118,23 @@ void PCB_EDIT_FRAME::DlgGlobalChange_PadSettings( D_PAD* aPad, bool aRedraw )
|
|||
int diag;
|
||||
|
||||
if( aPad == NULL )
|
||||
aPad = &g_Pad_Master;
|
||||
aPad = &GetDesignSettings().m_Pad_Master;
|
||||
|
||||
MODULE* Module = (MODULE*) aPad->GetParent();
|
||||
MODULE* module = aPad->GetParent();
|
||||
|
||||
if( Module == NULL )
|
||||
if( module == NULL )
|
||||
{
|
||||
DisplayError( this, wxT( "Global_Import_Pad_Settings() Error: NULL module" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
Module->DisplayInfo( this );
|
||||
module->DisplayInfo( this );
|
||||
|
||||
DIALOG_GLOBAL_PADS_EDITION* dlg = new DIALOG_GLOBAL_PADS_EDITION( this, aPad );
|
||||
{
|
||||
DIALOG_GLOBAL_PADS_EDITION dlg( this, aPad );
|
||||
|
||||
diag = dlg->ShowModal();
|
||||
dlg->Destroy();
|
||||
diag = dlg.ShowModal();
|
||||
}
|
||||
|
||||
if( diag == -1 )
|
||||
return;
|
||||
|
@ -162,23 +162,25 @@ void FOOTPRINT_EDIT_FRAME::DlgGlobalChange_PadSettings( D_PAD* aPad )
|
|||
int diag;
|
||||
|
||||
if( aPad == NULL )
|
||||
aPad = &g_Pad_Master;
|
||||
aPad = &GetDesignSettings().m_Pad_Master;
|
||||
|
||||
MODULE* Module = (MODULE*) aPad->GetParent();
|
||||
MODULE* module = aPad->GetParent();
|
||||
|
||||
if( Module == NULL )
|
||||
if( module == NULL )
|
||||
{
|
||||
DisplayError( this, wxT( "Global_Import_Pad_Settings() Error: NULL module" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
Module->DisplayInfo( this );
|
||||
module->DisplayInfo( this );
|
||||
|
||||
DIALOG_GLOBAL_PADS_EDITION* dlg = new DIALOG_GLOBAL_PADS_EDITION( this, aPad );
|
||||
dlg->m_buttonIdModules->Enable( false );
|
||||
{
|
||||
DIALOG_GLOBAL_PADS_EDITION dlg( this, aPad );
|
||||
|
||||
diag = dlg->ShowModal();
|
||||
dlg->Destroy();
|
||||
dlg.m_buttonIdModules->Enable( false );
|
||||
|
||||
diag = dlg.ShowModal();
|
||||
}
|
||||
|
||||
if( diag == -1 )
|
||||
return;
|
||||
|
@ -187,7 +189,7 @@ void FOOTPRINT_EDIT_FRAME::DlgGlobalChange_PadSettings( D_PAD* aPad )
|
|||
if( diag == 1 )
|
||||
edit_Same_Modules = true;
|
||||
|
||||
GlobalChange_PadSettings( aPad,edit_Same_Modules,
|
||||
GlobalChange_PadSettings( aPad, edit_Same_Modules,
|
||||
DIALOG_GLOBAL_PADS_EDITION::m_Pad_Shape_Filter,
|
||||
DIALOG_GLOBAL_PADS_EDITION::m_Pad_Orient_Filter,
|
||||
DIALOG_GLOBAL_PADS_EDITION::m_Pad_Layer_Filter,
|
||||
|
@ -215,48 +217,47 @@ void PCB_BASE_FRAME::GlobalChange_PadSettings( D_PAD* aPad,
|
|||
bool aRedraw, bool aSaveForUndo )
|
||||
{
|
||||
if( aPad == NULL )
|
||||
aPad = &g_Pad_Master;
|
||||
aPad = &GetDesignSettings().m_Pad_Master;
|
||||
|
||||
MODULE* Module = (MODULE*) aPad->GetParent();
|
||||
MODULE* module = aPad->GetParent();
|
||||
|
||||
if( Module == NULL )
|
||||
if( module == NULL )
|
||||
{
|
||||
DisplayError( this, wxT( "Global_Import_Pad_Settings() Error: NULL module" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
/* Search and copy the name of library reference. */
|
||||
MODULE* Module_Ref = Module;
|
||||
int pad_orient = aPad->m_Orient - Module_Ref->m_Orient;
|
||||
// Search and copy the name of library reference.
|
||||
MODULE* Module_Ref = module;
|
||||
int pad_orient = aPad->GetOrientation() - Module_Ref->GetOrientation();
|
||||
|
||||
// Prepare an undo list:
|
||||
if( aSaveForUndo )
|
||||
{
|
||||
PICKED_ITEMS_LIST itemsList;
|
||||
Module = (MODULE*) m_Pcb->m_Modules;
|
||||
for( ; Module != NULL; Module = Module->Next() )
|
||||
|
||||
for( module = m_Pcb->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
if( !aSameFootprints && (Module != Module_Ref) )
|
||||
if( !aSameFootprints && (module != Module_Ref) )
|
||||
continue;
|
||||
|
||||
if( Module->m_LibRef != Module_Ref->m_LibRef )
|
||||
if( module->m_LibRef != Module_Ref->m_LibRef )
|
||||
continue;
|
||||
|
||||
bool saveMe = false;
|
||||
D_PAD* pt_pad = (D_PAD*) Module->m_Pads;
|
||||
|
||||
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
|
||||
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
|
||||
{
|
||||
/* Filters changes prohibited. */
|
||||
if( aPadShapeFilter && ( pt_pad->m_PadShape != aPad->m_PadShape ) )
|
||||
// Filters changes prohibited.
|
||||
if( aPadShapeFilter && ( pad->GetShape() != aPad->GetShape() ) )
|
||||
continue;
|
||||
|
||||
int currpad_orient = pt_pad->m_Orient - Module->m_Orient;
|
||||
int currpad_orient = pad->GetOrientation() - module->GetOrientation();
|
||||
|
||||
if( aPadOrientFilter && ( currpad_orient != pad_orient ) )
|
||||
continue;
|
||||
|
||||
if( aPadLayerFilter
|
||||
&& ( pt_pad->m_layerMask != aPad->m_layerMask ) )
|
||||
if( aPadLayerFilter && pad->GetLayerMask() != aPad->GetLayerMask() )
|
||||
continue;
|
||||
|
||||
saveMe = true;
|
||||
|
@ -264,7 +265,8 @@ void PCB_BASE_FRAME::GlobalChange_PadSettings( D_PAD* aPad,
|
|||
|
||||
if( saveMe )
|
||||
{
|
||||
ITEM_PICKER itemWrapper( Module, UR_CHANGED );
|
||||
ITEM_PICKER itemWrapper( module, UR_CHANGED );
|
||||
|
||||
itemsList.PushItem( itemWrapper );
|
||||
}
|
||||
}
|
||||
|
@ -272,96 +274,86 @@ void PCB_BASE_FRAME::GlobalChange_PadSettings( D_PAD* aPad,
|
|||
SaveCopyInUndoList( itemsList, UR_CHANGED );
|
||||
}
|
||||
|
||||
/* Update the current module and same others modules if requested. */
|
||||
Module = m_Pcb->m_Modules;
|
||||
|
||||
for( ; Module != NULL; Module = Module->Next() )
|
||||
// Update the current module and same others modules if requested.
|
||||
for( module = m_Pcb->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
if( !aSameFootprints && (Module != Module_Ref) )
|
||||
if( !aSameFootprints && (module != Module_Ref) )
|
||||
continue;
|
||||
|
||||
if( Module->m_LibRef != Module_Ref->m_LibRef )
|
||||
if( module->m_LibRef != Module_Ref->m_LibRef )
|
||||
continue;
|
||||
|
||||
/* Erase module on screen */
|
||||
// Erase module on screen
|
||||
if( aRedraw )
|
||||
{
|
||||
Module->SetFlags( DO_NOT_DRAW );
|
||||
m_canvas->RefreshDrawingRect( Module->GetBoundingBox() );
|
||||
Module->ClearFlags( DO_NOT_DRAW );
|
||||
module->SetFlags( DO_NOT_DRAW );
|
||||
m_canvas->RefreshDrawingRect( module->GetBoundingBox() );
|
||||
module->ClearFlags( DO_NOT_DRAW );
|
||||
}
|
||||
|
||||
D_PAD* pt_pad = Module->m_Pads;
|
||||
|
||||
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
|
||||
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
|
||||
{
|
||||
// Filters changes prohibited.
|
||||
if( aPadShapeFilter && ( pt_pad->m_PadShape != aPad->m_PadShape ) )
|
||||
if( aPadShapeFilter && ( pad->GetShape() != aPad->GetShape() ) )
|
||||
continue;
|
||||
|
||||
if( aPadOrientFilter
|
||||
&& ( (pt_pad->m_Orient - Module->m_Orient) != pad_orient ) )
|
||||
if( aPadOrientFilter && (pad->GetOrientation() - module->GetOrientation()) != pad_orient )
|
||||
continue;
|
||||
|
||||
if( aPadLayerFilter )
|
||||
{
|
||||
if( pt_pad->m_layerMask != aPad->m_layerMask )
|
||||
if( pad->GetLayerMask() != aPad->GetLayerMask() )
|
||||
continue;
|
||||
else
|
||||
m_Pcb->m_Status_Pcb &= ~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK);
|
||||
}
|
||||
|
||||
// Change characteristics:
|
||||
pt_pad->m_Attribut = aPad->m_Attribut;
|
||||
pt_pad->m_PadShape = aPad->m_PadShape;
|
||||
pad->SetAttribute( aPad->GetAttribute() );
|
||||
pad->SetShape( aPad->GetShape() );
|
||||
|
||||
pt_pad->m_layerMask = aPad->m_layerMask;
|
||||
pad->SetLayerMask( aPad->GetLayerMask() );
|
||||
|
||||
pt_pad->m_Size = aPad->m_Size;
|
||||
pt_pad->m_DeltaSize = aPad->m_DeltaSize;
|
||||
pt_pad->m_Offset = aPad->m_Offset;
|
||||
pad->SetSize( aPad->GetSize() );
|
||||
pad->SetDelta( aPad->GetDelta() );
|
||||
pad->SetOffset( aPad->GetOffset() );
|
||||
|
||||
pt_pad->m_Drill = aPad->m_Drill;
|
||||
pt_pad->m_DrillShape = aPad->m_DrillShape;
|
||||
pad->SetDrillSize( aPad->GetDrillSize() );
|
||||
pad->SetDrillShape( aPad->GetDrillShape() );
|
||||
|
||||
pt_pad->m_Orient = pad_orient + Module->m_Orient;
|
||||
pad->SetOrientation( pad_orient + module->GetOrientation() );
|
||||
|
||||
// copy also local mask margins,
|
||||
// because these parameters usually depend on
|
||||
// pads sizes and layers
|
||||
pt_pad->m_LocalSolderMaskMargin = aPad->m_LocalSolderMaskMargin;
|
||||
pt_pad->m_LocalSolderPasteMargin = aPad->m_LocalSolderPasteMargin;
|
||||
pt_pad->m_LocalSolderPasteMarginRatio = aPad->m_LocalSolderPasteMarginRatio;
|
||||
// copy also local mask margins, because these parameters usually depend on
|
||||
// pad sizes and layers
|
||||
pad->SetLocalSolderMaskMargin( aPad->GetLocalSolderMaskMargin() );
|
||||
pad->SetLocalSolderPasteMargin( aPad->GetLocalSolderPasteMargin() );
|
||||
pad->SetLocalSolderPasteMarginRatio( aPad->GetLocalSolderPasteMarginRatio() );
|
||||
|
||||
|
||||
if( pt_pad->m_PadShape != PAD_TRAPEZOID )
|
||||
if( pad->GetShape() != PAD_TRAPEZOID )
|
||||
{
|
||||
pt_pad->m_DeltaSize.x = 0;
|
||||
pt_pad->m_DeltaSize.y = 0;
|
||||
pad->SetDelta( wxSize( 0, 0 ) );
|
||||
}
|
||||
if( pt_pad->m_PadShape == PAD_CIRCLE )
|
||||
pt_pad->m_Size.y = pt_pad->m_Size.x;
|
||||
|
||||
switch( pt_pad->m_Attribut & 0x7F )
|
||||
if( pad->GetShape() == PAD_CIRCLE )
|
||||
pad->SetY( pad->GetSize().x );
|
||||
|
||||
switch( pad->GetAttribute() )
|
||||
{
|
||||
case PAD_SMD:
|
||||
case PAD_CONN:
|
||||
pt_pad->m_Drill = wxSize( 0, 0 );
|
||||
pt_pad->m_Offset.x = 0;
|
||||
pt_pad->m_Offset.y = 0;
|
||||
pad->SetDrillSize( wxSize( 0, 0 ) );
|
||||
pad->SetOffset( wxPoint( 0, 0 ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
pt_pad->ComputeShapeMaxRadius();
|
||||
}
|
||||
|
||||
Module->CalculateBoundingBox();
|
||||
module->CalculateBoundingBox();
|
||||
|
||||
if( aRedraw )
|
||||
m_canvas->RefreshDrawingRect( Module->GetBoundingBox() );
|
||||
m_canvas->RefreshDrawingRect( module->GetBoundingBox() );
|
||||
}
|
||||
|
||||
OnModify();
|
||||
|
|
|
@ -167,7 +167,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
|||
char* line;
|
||||
long ibuf[100];
|
||||
EDGE_MODULE* drawSeg;
|
||||
D_PAD* Pad;
|
||||
D_PAD* pad;
|
||||
wxArrayString params;
|
||||
int iprmcnt, icnt_max, iflgidx;
|
||||
|
||||
|
@ -257,6 +257,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
|||
// real size is: default * ibuf[idx+3] / 100 (size in gpcb is given in percent of default size
|
||||
int tsize = ( ibuf[idx+3] * TEXT_DEFAULT_SIZE ) / 100;
|
||||
int thickness = m_Reference->m_Size.x / 6;
|
||||
|
||||
tsize = MAX( 40, tsize );
|
||||
m_Reference->SetSize( wxSize( tsize, tsize ) );
|
||||
m_Reference->m_Thickness = thickness;
|
||||
|
@ -369,16 +370,17 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
|||
}
|
||||
|
||||
if( params[0].CmpNoCase( wxT( "Pad" ) ) == 0 ) // Pad with no hole (smd pad)
|
||||
{ // format: Pad [x1 y1 x2 y2 thickness clearance mask "name" "pad_number" flags]
|
||||
Pad = new D_PAD( this );
|
||||
Pad->m_PadShape = PAD_RECT;
|
||||
Pad->m_layerMask = LAYER_FRONT | SOLDERMASK_LAYER_FRONT | SOLDERPASTE_LAYER_FRONT;
|
||||
{
|
||||
// format: Pad [x1 y1 x2 y2 thickness clearance mask "name" "pad_number" flags]
|
||||
pad = new D_PAD( this );
|
||||
pad->SetShape( PAD_RECT );
|
||||
pad->SetLayerMask( LAYER_FRONT | SOLDERMASK_LAYER_FRONT | SOLDERPASTE_LAYER_FRONT );
|
||||
|
||||
// Set shape from flags
|
||||
iflgidx = params.GetCount() - 2;
|
||||
|
||||
if( TestFlags( params[iflgidx], 0x0080, wxT( "onsolder" ) ) )
|
||||
Pad->m_layerMask = LAYER_BACK | SOLDERMASK_LAYER_BACK | SOLDERPASTE_LAYER_BACK;
|
||||
pad->SetLayerMask( LAYER_BACK | SOLDERMASK_LAYER_BACK | SOLDERPASTE_LAYER_BACK );
|
||||
|
||||
for( unsigned ii = 0; ii < 5; ii++ )
|
||||
{
|
||||
|
@ -401,11 +403,11 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
|||
// Read pad number:
|
||||
if( params[1] == wxT( "(" ) )
|
||||
{
|
||||
Pad->SetPadName( params[8] );
|
||||
pad->SetPadName( params[8] );
|
||||
}
|
||||
else
|
||||
{
|
||||
Pad->SetPadName( params[10] );
|
||||
pad->SetPadName( params[10] );
|
||||
}
|
||||
// Calculate the Pad parameters.
|
||||
// In Pcb the shape is a segment
|
||||
|
@ -418,43 +420,50 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
|||
wxPoint delta;
|
||||
delta.x = ibuf[2] - ibuf[0];
|
||||
delta.y = ibuf[3] - ibuf[1];
|
||||
|
||||
double angle = atan2( (double)delta.y, (double)delta.x );
|
||||
|
||||
// Negate angle (due to Y reversed axis) and convert it to internal units
|
||||
angle = - angle * 1800.0 / M_PI;
|
||||
Pad->SetOrientation( wxRound( angle ) );
|
||||
wxPoint padPos;
|
||||
padPos.x = (ibuf[0] + ibuf[2]) / 2;
|
||||
padPos.y = (ibuf[1] + ibuf[3]) / 2;
|
||||
Pad->m_Size.x = wxRound( hypot( (double)delta.x, (double)delta.y ) ) + ibuf[4];
|
||||
Pad->m_Size.y = ibuf[4];
|
||||
pad->SetOrientation( wxRound( angle ) );
|
||||
|
||||
wxPoint padPos( (ibuf[0] + ibuf[2]) / 2, (ibuf[1] + ibuf[3]) / 2 );
|
||||
|
||||
pad->SetSize( wxSize(
|
||||
wxRound( hypot( (double)delta.x, (double)delta.y ) ) + ibuf[4],
|
||||
ibuf[4] ) );
|
||||
|
||||
padPos += m_Pos;
|
||||
Pad->SetPos0( padPos );
|
||||
Pad->SetPosition( padPos );
|
||||
pad->SetPos0( padPos );
|
||||
pad->SetPosition( padPos );
|
||||
|
||||
if( !TestFlags( params[iflgidx], 0x0100, wxT( "square" ) ) )
|
||||
{
|
||||
if( Pad->m_Size.x == Pad->m_Size.y )
|
||||
Pad->m_PadShape = PAD_ROUND;
|
||||
if( pad->GetSize().x == pad->GetSize().y )
|
||||
pad->SetShape( PAD_ROUND );
|
||||
else
|
||||
Pad->m_PadShape = PAD_OVAL;
|
||||
pad->SetShape( PAD_OVAL );
|
||||
}
|
||||
|
||||
m_Pads.PushBack( Pad );
|
||||
m_Pads.PushBack( pad );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( params[0].CmpNoCase( wxT( "Pin" ) ) == 0 ) // Pad with hole (trough pad)
|
||||
{ // format: Pin[x y Thickness Clearance Mask DrillHole Name Number Flags]
|
||||
Pad = new D_PAD( this );
|
||||
Pad->m_PadShape = PAD_ROUND;
|
||||
Pad->m_layerMask = ALL_CU_LAYERS |
|
||||
{
|
||||
// format: Pin[x y Thickness Clearance Mask DrillHole Name Number Flags]
|
||||
pad = new D_PAD( this );
|
||||
pad->SetShape( PAD_ROUND );
|
||||
|
||||
pad->SetLayerMask( ALL_CU_LAYERS |
|
||||
SILKSCREEN_LAYER_FRONT |
|
||||
SOLDERMASK_LAYER_FRONT |
|
||||
SOLDERMASK_LAYER_BACK;
|
||||
SOLDERMASK_LAYER_BACK );
|
||||
|
||||
iflgidx = params.GetCount() - 2;
|
||||
|
||||
if( TestFlags( params[iflgidx], 0x0100, wxT( "square" ) ) )
|
||||
Pad->m_PadShape = PAD_RECT;
|
||||
pad->SetShape( PAD_RECT );
|
||||
|
||||
for( unsigned ii = 0; ii < 6; ii++ )
|
||||
{
|
||||
|
@ -476,25 +485,30 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
|||
// Read pad number:
|
||||
if( params[1] == wxT( "(" ) )
|
||||
{
|
||||
Pad->SetPadName( params[7] );
|
||||
pad->SetPadName( params[7] );
|
||||
}
|
||||
else
|
||||
{
|
||||
Pad->SetPadName( params[9] );
|
||||
pad->SetPadName( params[9] );
|
||||
}
|
||||
wxPoint padPos;
|
||||
padPos.x = ibuf[0];
|
||||
padPos.y = ibuf[1];
|
||||
Pad->m_Drill.x = Pad->m_Drill.y = ibuf[5];
|
||||
Pad->m_Size.x = Pad->m_Size.y = ibuf[3] + Pad->m_Drill.x;
|
||||
|
||||
wxPoint padPos( ibuf[0], ibuf[1] );
|
||||
|
||||
pad->SetDrillSize( wxSize( ibuf[5], ibuf[5] ) );
|
||||
|
||||
int sz = ibuf[3] + pad->GetDrillSize().x;
|
||||
|
||||
pad->SetSize( wxSize( sz, sz ) );
|
||||
|
||||
padPos += m_Pos;
|
||||
Pad->SetPos0( padPos );
|
||||
Pad->SetPosition( padPos );
|
||||
|
||||
if( (Pad->m_PadShape == PAD_ROUND) && (Pad->m_Size.x != Pad->m_Size.y) )
|
||||
Pad->m_PadShape = PAD_OVAL;
|
||||
pad->SetPos0( padPos );
|
||||
pad->SetPosition( padPos );
|
||||
|
||||
m_Pads.PushBack( Pad );
|
||||
if( pad->GetShape() == PAD_ROUND && pad->GetSize().x != pad->GetSize().y )
|
||||
pad->SetShape( PAD_OVAL );
|
||||
|
||||
m_Pads.PushBack( pad );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -508,7 +522,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
|||
m_Reference->m_Text = filename.GetName();
|
||||
}
|
||||
|
||||
/* Recalculate the bounding box */
|
||||
// Recalculate the bounding box
|
||||
CalculateBoundingBox();
|
||||
return success;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ static void DrawSegmentQcq( int ux0,
|
|||
int color,
|
||||
int op_logic );
|
||||
|
||||
static void TraceFilledCircle( BOARD* Pcb,
|
||||
static void TraceFilledCircle( BOARD* aPcb,
|
||||
int cx,
|
||||
int cy,
|
||||
int radius,
|
||||
|
@ -84,50 +84,49 @@ int ToMatrixCoordinate( int aPhysicalCoordinate )
|
|||
}
|
||||
|
||||
|
||||
void PlacePad( BOARD* Pcb, D_PAD* pt_pad, int color, int marge, int op_logic )
|
||||
void PlacePad( BOARD* aPcb, D_PAD* aPad, int color, int marge, int op_logic )
|
||||
{
|
||||
int dx, dy;
|
||||
wxPoint shape_pos = pt_pad->ReturnShapePos();
|
||||
wxPoint shape_pos = aPad->ReturnShapePos();
|
||||
|
||||
dx = pt_pad->m_Size.x / 2;
|
||||
dx = aPad->GetSize().x / 2;
|
||||
dx += marge;
|
||||
|
||||
if( pt_pad->m_PadShape == PAD_CIRCLE )
|
||||
if( aPad->GetShape() == PAD_CIRCLE )
|
||||
{
|
||||
TraceFilledCircle( Pcb, shape_pos.x, shape_pos.y, dx,
|
||||
pt_pad->m_layerMask, color, op_logic );
|
||||
TraceFilledCircle( aPcb, shape_pos.x, shape_pos.y, dx,
|
||||
aPad->GetLayerMask(), color, op_logic );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
dy = pt_pad->m_Size.y / 2;
|
||||
dy = aPad->GetSize().y / 2;
|
||||
dy += marge;
|
||||
|
||||
if( pt_pad->m_PadShape == PAD_TRAPEZOID )
|
||||
if( aPad->GetShape() == PAD_TRAPEZOID )
|
||||
{
|
||||
dx += abs( pt_pad->m_DeltaSize.y ) / 2;
|
||||
dy += abs( pt_pad->m_DeltaSize.x ) / 2;
|
||||
dx += abs( aPad->GetDelta().y ) / 2;
|
||||
dy += abs( aPad->GetDelta().x ) / 2;
|
||||
}
|
||||
|
||||
// The pad is a rectangle horizontally or vertically.
|
||||
if( int( pt_pad->GetOrientation() ) % 900 == 0 )
|
||||
if( int( aPad->GetOrientation() ) % 900 == 0 )
|
||||
{
|
||||
// Orientation turned 90 deg.
|
||||
if( ( pt_pad->m_Orient == 900 ) || ( pt_pad->m_Orient == 2700 ) )
|
||||
if( aPad->GetOrientation() == 900 || aPad->GetOrientation() == 2700 )
|
||||
{
|
||||
EXCHG( dx, dy );
|
||||
}
|
||||
|
||||
TraceFilledRectangle( Pcb, shape_pos.x - dx, shape_pos.y - dy,
|
||||
TraceFilledRectangle( aPcb, shape_pos.x - dx, shape_pos.y - dy,
|
||||
shape_pos.x + dx, shape_pos.y + dy,
|
||||
pt_pad->m_layerMask, color, op_logic );
|
||||
aPad->GetLayerMask(), color, op_logic );
|
||||
}
|
||||
else
|
||||
{
|
||||
TraceFilledRectangle( Pcb, shape_pos.x - dx, shape_pos.y - dy,
|
||||
TraceFilledRectangle( aPcb, shape_pos.x - dx, shape_pos.y - dy,
|
||||
shape_pos.x + dx, shape_pos.y + dy,
|
||||
(int) pt_pad->m_Orient,
|
||||
pt_pad->m_layerMask, color, op_logic );
|
||||
(int) aPad->GetOrientation(),
|
||||
aPad->GetLayerMask(), color, op_logic );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,7 +139,7 @@ void PlacePad( BOARD* Pcb, D_PAD* pt_pad, int color, int marge, int op_logic )
|
|||
* color: mask write in cells
|
||||
* op_logic: type of writing in the cell (WRITE, OR)
|
||||
*/
|
||||
void TraceFilledCircle( BOARD* Pcb,
|
||||
void TraceFilledCircle( BOARD* aPcb,
|
||||
int cx,
|
||||
int cy,
|
||||
int radius,
|
||||
|
@ -197,8 +196,8 @@ void TraceFilledCircle( BOARD* Pcb,
|
|||
break;
|
||||
}
|
||||
|
||||
cx -= Pcb->GetBoundingBox().GetX();
|
||||
cy -= Pcb->GetBoundingBox().GetY();
|
||||
cx -= aPcb->GetBoundingBox().GetX();
|
||||
cy -= aPcb->GetBoundingBox().GetY();
|
||||
|
||||
distmin = radius;
|
||||
|
||||
|
@ -290,7 +289,7 @@ void TraceFilledCircle( BOARD* Pcb,
|
|||
}
|
||||
|
||||
|
||||
void TraceSegmentPcb( BOARD* Pcb, TRACK* pt_segm, int color, int marge, int op_logic )
|
||||
void TraceSegmentPcb( BOARD* aPcb, TRACK* pt_segm, int color, int marge, int op_logic )
|
||||
{
|
||||
int half_width;
|
||||
int ux0, uy0, ux1, uy1;
|
||||
|
@ -298,10 +297,10 @@ void TraceSegmentPcb( BOARD* Pcb, TRACK* pt_segm, int color, int marge, int op_l
|
|||
half_width = ( pt_segm->m_Width / 2 ) + marge;
|
||||
|
||||
// Calculate the bounding rectangle of the segment (if H, V or Via)
|
||||
ux0 = pt_segm->m_Start.x - Pcb->GetBoundingBox().GetX();
|
||||
uy0 = pt_segm->m_Start.y - Pcb->GetBoundingBox().GetY();
|
||||
ux1 = pt_segm->m_End.x - Pcb->GetBoundingBox().GetX();
|
||||
uy1 = pt_segm->m_End.y - Pcb->GetBoundingBox().GetY();
|
||||
ux0 = pt_segm->m_Start.x - aPcb->GetBoundingBox().GetX();
|
||||
uy0 = pt_segm->m_Start.y - aPcb->GetBoundingBox().GetY();
|
||||
ux1 = pt_segm->m_End.x - aPcb->GetBoundingBox().GetX();
|
||||
uy1 = pt_segm->m_End.y - aPcb->GetBoundingBox().GetY();
|
||||
|
||||
// Test if VIA (filled circle was drawn)
|
||||
if( pt_segm->Type() == PCB_VIA_T )
|
||||
|
@ -323,7 +322,7 @@ void TraceSegmentPcb( BOARD* Pcb, TRACK* pt_segm, int color, int marge, int op_l
|
|||
mask_layer = -1;
|
||||
|
||||
if( mask_layer )
|
||||
TraceFilledCircle( Pcb, pt_segm->m_Start.x, pt_segm->m_Start.y,
|
||||
TraceFilledCircle( aPcb, pt_segm->m_Start.x, pt_segm->m_Start.y,
|
||||
half_width, mask_layer, color, op_logic );
|
||||
return;
|
||||
}
|
||||
|
@ -516,7 +515,7 @@ void TracePcbLine( int x0, int y0, int x1, int y1, int layer, int color, int op_
|
|||
}
|
||||
|
||||
|
||||
void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
|
||||
void TraceFilledRectangle( BOARD* aPcb, int ux0, int uy0, int ux1, int uy1,
|
||||
int aLayerMask, int color, int op_logic )
|
||||
{
|
||||
int row, col;
|
||||
|
@ -558,10 +557,10 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
|
|||
break;
|
||||
}
|
||||
|
||||
ux0 -= Pcb->GetBoundingBox().GetX();
|
||||
uy0 -= Pcb->GetBoundingBox().GetY();
|
||||
ux1 -= Pcb->GetBoundingBox().GetX();
|
||||
uy1 -= Pcb->GetBoundingBox().GetY();
|
||||
ux0 -= aPcb->GetBoundingBox().GetX();
|
||||
uy0 -= aPcb->GetBoundingBox().GetY();
|
||||
ux1 -= aPcb->GetBoundingBox().GetX();
|
||||
uy1 -= aPcb->GetBoundingBox().GetY();
|
||||
|
||||
// Calculating limits coord cells belonging to the rectangle.
|
||||
row_max = uy1 / Board.m_GridRouting;
|
||||
|
@ -602,7 +601,7 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
|
|||
}
|
||||
|
||||
|
||||
void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
|
||||
void TraceFilledRectangle( BOARD* aPcb, int ux0, int uy0, int ux1, int uy1,
|
||||
int angle, int aLayerMask, int color, int op_logic )
|
||||
{
|
||||
int row, col;
|
||||
|
@ -650,10 +649,10 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
|
|||
break;
|
||||
}
|
||||
|
||||
ux0 -= Pcb->GetBoundingBox().GetX();
|
||||
uy0 -= Pcb->GetBoundingBox().GetY();
|
||||
ux1 -= Pcb->GetBoundingBox().GetX();
|
||||
uy1 -= Pcb->GetBoundingBox().GetY();
|
||||
ux0 -= aPcb->GetBoundingBox().GetX();
|
||||
uy0 -= aPcb->GetBoundingBox().GetY();
|
||||
ux1 -= aPcb->GetBoundingBox().GetX();
|
||||
uy1 -= aPcb->GetBoundingBox().GetY();
|
||||
|
||||
cx = (ux0 + ux1) / 2;
|
||||
cy = (uy0 + uy1) / 2;
|
||||
|
|
|
@ -334,6 +334,7 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
|
|||
|
||||
NETCLASS* netclass_default = GetBoard()->m_NetClasses.GetDefault();
|
||||
ZONE_SETTINGS zoneInfo = GetBoard()->GetZoneSettings();
|
||||
BOARD_DESIGN_SETTINGS bds = GetBoard()->GetDesignSettings();
|
||||
|
||||
while( aReader->ReadLine() )
|
||||
{
|
||||
|
@ -456,7 +457,7 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
|
|||
|
||||
if( stricmp( line, "TrackMinWidth" ) == 0 )
|
||||
{
|
||||
GetBoard()->GetDesignSettings().m_TrackMinWidth = atoi( data );
|
||||
bds.m_TrackMinWidth = atoi( data );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -468,13 +469,13 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
|
|||
|
||||
if( stricmp( line, "DrawSegmWidth" ) == 0 )
|
||||
{
|
||||
GetBoard()->GetDesignSettings().m_DrawSegmentWidth = atoi( data );
|
||||
bds.m_DrawSegmentWidth = atoi( data );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( stricmp( line, "EdgeSegmWidth" ) == 0 )
|
||||
{
|
||||
GetBoard()->GetDesignSettings().m_EdgeSegmentWidth = atoi( data );
|
||||
bds.m_EdgeSegmentWidth = atoi( data );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -485,7 +486,7 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
|
|||
|
||||
if( stricmp( line, "ViaMinSize" ) == 0 )
|
||||
{
|
||||
GetBoard()->GetDesignSettings().m_ViasMinSize = atoi( data );
|
||||
bds.m_ViasMinSize = atoi( data );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -496,7 +497,7 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
|
|||
|
||||
if( stricmp( line, "MicroViaMinSize" ) == 0 )
|
||||
{
|
||||
GetBoard()->GetDesignSettings().m_MicroViasMinSize = atoi( data );
|
||||
bds.m_MicroViasMinSize = atoi( data );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -526,7 +527,7 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
|
|||
|
||||
if( stricmp( line, "ViaMinDrill" ) == 0 )
|
||||
{
|
||||
GetBoard()->GetDesignSettings().m_ViasMinDrill = atoi( data );
|
||||
bds.m_ViasMinDrill = atoi( data );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -540,80 +541,81 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
|
|||
if( stricmp( line, "MicroViaMinDrill" ) == 0 )
|
||||
{
|
||||
int diameter = atoi( data );
|
||||
GetBoard()->GetDesignSettings().m_MicroViasMinDrill = diameter;
|
||||
bds.m_MicroViasMinDrill = diameter;
|
||||
continue;
|
||||
}
|
||||
|
||||
if( stricmp( line, "MicroViasAllowed" ) == 0 )
|
||||
{
|
||||
GetBoard()->GetDesignSettings().m_MicroViasAllowed = atoi( data );
|
||||
bds.m_MicroViasAllowed = atoi( data );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( stricmp( line, "TextPcbWidth" ) == 0 )
|
||||
{
|
||||
GetBoard()->GetDesignSettings().m_PcbTextWidth = atoi( data );
|
||||
bds.m_PcbTextWidth = atoi( data );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( stricmp( line, "TextPcbSize" ) == 0 )
|
||||
{
|
||||
GetBoard()->GetDesignSettings().m_PcbTextSize.x = atoi( data );
|
||||
bds.m_PcbTextSize.x = atoi( data );
|
||||
data = strtok( NULL, delims );
|
||||
GetBoard()->GetDesignSettings().m_PcbTextSize.y = atoi( data );
|
||||
bds.m_PcbTextSize.y = atoi( data );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( stricmp( line, "EdgeModWidth" ) == 0 )
|
||||
{
|
||||
GetBoard()->GetDesignSettings().m_ModuleSegmentWidth = atoi( data );
|
||||
bds.m_ModuleSegmentWidth = atoi( data );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( stricmp( line, "TextModWidth" ) == 0 )
|
||||
{
|
||||
GetBoard()->GetDesignSettings().m_ModuleTextWidth = atoi( data );
|
||||
bds.m_ModuleTextWidth = atoi( data );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( stricmp( line, "TextModSize" ) == 0 )
|
||||
{
|
||||
GetBoard()->GetDesignSettings().m_ModuleTextSize.x = atoi( data );
|
||||
bds.m_ModuleTextSize.x = atoi( data );
|
||||
data = strtok( NULL, delims );
|
||||
GetBoard()->GetDesignSettings().m_ModuleTextSize.y = atoi( data );
|
||||
bds.m_ModuleTextSize.y = atoi( data );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( stricmp( line, "PadSize" ) == 0 )
|
||||
{
|
||||
g_Pad_Master.m_Size.x = atoi( data );
|
||||
int x = atoi( data );
|
||||
data = strtok( NULL, delims );
|
||||
g_Pad_Master.m_Size.y = atoi( data );
|
||||
int y = atoi( data );
|
||||
bds.m_Pad_Master.SetSize( wxSize( x, y ) );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( stricmp( line, "PadDrill" ) == 0 )
|
||||
{
|
||||
g_Pad_Master.m_Drill.x = atoi( data );
|
||||
g_Pad_Master.m_Drill.y = g_Pad_Master.m_Drill.x;
|
||||
int sz = atoi( data );
|
||||
bds.m_Pad_Master.SetSize( wxSize( sz, sz ) );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( stricmp( line, "Pad2MaskClearance" ) == 0 )
|
||||
{
|
||||
GetBoard()->GetDesignSettings().m_SolderMaskMargin = atoi( data );
|
||||
bds.m_SolderMaskMargin = atoi( data );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( stricmp( line, "Pad2PasteClearance" ) == 0 )
|
||||
{
|
||||
GetBoard()->GetDesignSettings().m_SolderPasteMargin = atoi( data );
|
||||
bds.m_SolderPasteMargin = atoi( data );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( stricmp( line, "Pad2PasteClearanceRatio" ) == 0 )
|
||||
{
|
||||
GetBoard()->GetDesignSettings().m_SolderPasteMarginRatio = atof( data );
|
||||
bds.m_SolderPasteMarginRatio = atof( data );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -670,6 +672,7 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
|
|||
|
||||
static int WriteSetup( FILE* aFile, PCB_EDIT_FRAME* aFrame, BOARD* aBoard )
|
||||
{
|
||||
const BOARD_DESIGN_SETTINGS& bds = aBoard->GetDesignSettings();
|
||||
NETCLASS* netclass_default = aBoard->m_NetClasses.GetDefault();
|
||||
char text[1024];
|
||||
|
||||
|
@ -701,16 +704,16 @@ static int WriteSetup( FILE* aFile, PCB_EDIT_FRAME* aFrame, BOARD* aBoard )
|
|||
|
||||
fprintf( aFile, "TrackClearence %d\n", netclass_default->GetClearance() );
|
||||
fprintf( aFile, "ZoneClearence %d\n", aBoard->GetZoneSettings().m_ZoneClearance );
|
||||
fprintf( aFile, "TrackMinWidth %d\n", aBoard->GetDesignSettings().m_TrackMinWidth );
|
||||
fprintf( aFile, "TrackMinWidth %d\n", bds.m_TrackMinWidth );
|
||||
|
||||
fprintf( aFile, "DrawSegmWidth %d\n", aBoard->GetDesignSettings().m_DrawSegmentWidth );
|
||||
fprintf( aFile, "EdgeSegmWidth %d\n", aBoard->GetDesignSettings().m_EdgeSegmentWidth );
|
||||
fprintf( aFile, "DrawSegmWidth %d\n", bds.m_DrawSegmentWidth );
|
||||
fprintf( aFile, "EdgeSegmWidth %d\n", bds.m_EdgeSegmentWidth );
|
||||
|
||||
// Save current default via size, for compatibility with older Pcbnew version;
|
||||
fprintf( aFile, "ViaSize %d\n", netclass_default->GetViaDiameter() );
|
||||
fprintf( aFile, "ViaDrill %d\n", netclass_default->GetViaDrill() );
|
||||
fprintf( aFile, "ViaMinSize %d\n", aBoard->GetDesignSettings().m_ViasMinSize );
|
||||
fprintf( aFile, "ViaMinDrill %d\n", aBoard->GetDesignSettings().m_ViasMinDrill );
|
||||
fprintf( aFile, "ViaMinSize %d\n", bds.m_ViasMinSize );
|
||||
fprintf( aFile, "ViaMinDrill %d\n", bds.m_ViasMinDrill );
|
||||
|
||||
// Save custom vias diameters list (the first is not saved here: this is
|
||||
// the netclass value
|
||||
|
@ -724,38 +727,41 @@ static int WriteSetup( FILE* aFile, PCB_EDIT_FRAME* aFrame, BOARD* aBoard )
|
|||
fprintf( aFile, "MicroViaDrill %d\n", netclass_default->GetuViaDrill() );
|
||||
fprintf( aFile,
|
||||
"MicroViasAllowed %d\n",
|
||||
aBoard->GetDesignSettings().m_MicroViasAllowed );
|
||||
bds.m_MicroViasAllowed );
|
||||
fprintf( aFile,
|
||||
"MicroViaMinSize %d\n",
|
||||
aBoard->GetDesignSettings().m_MicroViasMinSize );
|
||||
bds.m_MicroViasMinSize );
|
||||
fprintf( aFile,
|
||||
"MicroViaMinDrill %d\n",
|
||||
aBoard->GetDesignSettings().m_MicroViasMinDrill );
|
||||
bds.m_MicroViasMinDrill );
|
||||
|
||||
fprintf( aFile, "TextPcbWidth %d\n", aBoard->GetDesignSettings().m_PcbTextWidth );
|
||||
fprintf( aFile, "TextPcbWidth %d\n", bds.m_PcbTextWidth );
|
||||
fprintf( aFile,
|
||||
"TextPcbSize %d %d\n",
|
||||
aBoard->GetDesignSettings().m_PcbTextSize.x,
|
||||
aBoard->GetDesignSettings().m_PcbTextSize.y );
|
||||
bds.m_PcbTextSize.x,
|
||||
bds.m_PcbTextSize.y );
|
||||
|
||||
fprintf( aFile, "EdgeModWidth %d\n", aBoard->GetDesignSettings().m_ModuleSegmentWidth );
|
||||
fprintf( aFile, "TextModSize %d %d\n", aBoard->GetDesignSettings().m_ModuleTextSize.x, aBoard->GetDesignSettings().m_ModuleTextSize.y );
|
||||
fprintf( aFile, "TextModWidth %d\n", aBoard->GetDesignSettings().m_ModuleTextWidth );
|
||||
fprintf( aFile, "PadSize %d %d\n", g_Pad_Master.m_Size.x, g_Pad_Master.m_Size.y );
|
||||
fprintf( aFile, "PadDrill %d\n", g_Pad_Master.m_Drill.x );
|
||||
fprintf( aFile, "EdgeModWidth %d\n", bds.m_ModuleSegmentWidth );
|
||||
fprintf( aFile, "TextModSize %d %d\n", bds.m_ModuleTextSize.x, bds.m_ModuleTextSize.y );
|
||||
fprintf( aFile, "TextModWidth %d\n", bds.m_ModuleTextWidth );
|
||||
|
||||
fprintf( aFile, "PadSize %d %d\n", bds.m_Pad_Master.GetSize().x,
|
||||
bds.m_Pad_Master.GetSize().y );
|
||||
|
||||
fprintf( aFile, "PadDrill %d\n", bds.m_Pad_Master.GetDrillSize().x );
|
||||
fprintf( aFile,
|
||||
"Pad2MaskClearance %d\n",
|
||||
aBoard->GetDesignSettings().m_SolderMaskMargin );
|
||||
bds.m_SolderMaskMargin );
|
||||
|
||||
if( aBoard->GetDesignSettings().m_SolderPasteMargin != 0 )
|
||||
if( bds.m_SolderPasteMargin != 0 )
|
||||
fprintf( aFile,
|
||||
"Pad2PasteClearance %d\n",
|
||||
aBoard->GetDesignSettings().m_SolderPasteMargin );
|
||||
bds.m_SolderPasteMargin );
|
||||
|
||||
if( aBoard->GetDesignSettings().m_SolderPasteMarginRatio != 0 )
|
||||
if( bds.m_SolderPasteMarginRatio != 0 )
|
||||
fprintf( aFile,
|
||||
"Pad2PasteClearanceRatio %g\n",
|
||||
aBoard->GetDesignSettings().m_SolderPasteMarginRatio );
|
||||
bds.m_SolderPasteMarginRatio );
|
||||
|
||||
if ( aFrame->GetScreen()->m_GridOrigin != wxPoint( 0, 0 ) )
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include <pcbnew.h>
|
||||
#include <drawtxt.h>
|
||||
|
||||
#define MAX_WIDTH 10000 /* Thickness (in 1 / 10000 ") of maximum reasonable features, text... */
|
||||
#define MAX_WIDTH 10000 // Thickness (in 1 / 10000 ") of maximum reasonable features, text...
|
||||
|
||||
|
||||
#if 1 || !defined(USE_NEW_PCBNEW_SAVE)
|
||||
|
@ -678,7 +678,7 @@ bool D_PAD::Save( FILE* aFile ) const
|
|||
|
||||
fprintf( aFile, "\n" );
|
||||
|
||||
switch( m_Attribut )
|
||||
switch( GetAttribute() )
|
||||
{
|
||||
case PAD_STANDARD:
|
||||
texttype = "STD"; break;
|
||||
|
@ -704,20 +704,20 @@ bool D_PAD::Save( FILE* aFile ) const
|
|||
|
||||
fprintf( aFile, "Po %d %d\n", m_Pos0.x, m_Pos0.y );
|
||||
|
||||
if( m_LengthDie != 0 )
|
||||
fprintf( aFile, "Le %d\n", m_LengthDie );
|
||||
if( GetDieLength() != 0 )
|
||||
fprintf( aFile, "Le %d\n", GetDieLength() );
|
||||
|
||||
if( m_LocalSolderMaskMargin != 0 )
|
||||
fprintf( aFile, ".SolderMask %d\n", m_LocalSolderMaskMargin );
|
||||
if( GetLocalSolderMaskMargin() != 0 )
|
||||
fprintf( aFile, ".SolderMask %d\n", GetLocalSolderMaskMargin() );
|
||||
|
||||
if( m_LocalSolderPasteMargin != 0 )
|
||||
fprintf( aFile, ".SolderPaste %d\n", m_LocalSolderPasteMargin );
|
||||
if( GetLocalSolderPasteMargin() != 0 )
|
||||
fprintf( aFile, ".SolderPaste %d\n", GetLocalSolderPasteMargin() );
|
||||
|
||||
if( m_LocalSolderPasteMarginRatio != 0 )
|
||||
fprintf( aFile, ".SolderPasteRatio %g\n", m_LocalSolderPasteMarginRatio );
|
||||
if( GetLocalSolderPasteMarginRatio() != 0 )
|
||||
fprintf( aFile, ".SolderPasteRatio %g\n", GetLocalSolderPasteMarginRatio() );
|
||||
|
||||
if( m_LocalClearance != 0 )
|
||||
fprintf( aFile, ".LocalClearance %d\n", m_LocalClearance );
|
||||
if( GetLocalClearance() != 0 )
|
||||
fprintf( aFile, ".LocalClearance %d\n", GetLocalClearance() );
|
||||
|
||||
if( fprintf( aFile, "$EndPAD\n" ) != sizeof("$EndPAD\n") - 1 )
|
||||
return false;
|
||||
|
@ -767,17 +767,17 @@ bool MODULE::Save( FILE* aFile ) const
|
|||
fprintf( aFile, "AR %s\n", TO_UTF8( m_Path ) );
|
||||
fprintf( aFile, "Op %X %X 0\n", m_CntRot90, m_CntRot180 );
|
||||
|
||||
if( m_LocalSolderMaskMargin != 0 )
|
||||
fprintf( aFile, ".SolderMask %d\n", m_LocalSolderMaskMargin );
|
||||
if( GetLocalSolderMaskMargin() != 0 )
|
||||
fprintf( aFile, ".SolderMask %d\n", GetLocalSolderMaskMargin() );
|
||||
|
||||
if( m_LocalSolderPasteMargin != 0 )
|
||||
fprintf( aFile, ".SolderPaste %d\n", m_LocalSolderPasteMargin );
|
||||
fprintf( aFile, ".SolderPaste %d\n", GetLocalSolderPasteMargin() );
|
||||
|
||||
if( m_LocalSolderPasteMarginRatio != 0 )
|
||||
fprintf( aFile, ".SolderPasteRatio %g\n", m_LocalSolderPasteMarginRatio );
|
||||
if( GetLocalSolderPasteMarginRatio() != 0 )
|
||||
fprintf( aFile, ".SolderPasteRatio %g\n", GetLocalSolderPasteMarginRatio() );
|
||||
|
||||
if( m_LocalClearance != 0 )
|
||||
fprintf( aFile, ".LocalClearance %d\n", m_LocalClearance );
|
||||
fprintf( aFile, ".LocalClearance %d\n", GetLocalClearance() );
|
||||
|
||||
// attributes
|
||||
if( m_Attributs != MOD_DEFAULT )
|
||||
|
@ -892,10 +892,10 @@ int MODULE::Write_3D_Descr( FILE* File ) const
|
|||
*/
|
||||
int D_PAD::ReadDescr( LINE_READER* aReader )
|
||||
{
|
||||
char* Line;
|
||||
char BufLine[1024], BufCar[256];
|
||||
char* PtLine;
|
||||
int nn, ll, dx, dy;
|
||||
char* Line;
|
||||
char BufLine[1024], BufCar[256];
|
||||
char* PtLine;
|
||||
int nn, ll, dx, dy;
|
||||
|
||||
while( aReader->ReadLine() )
|
||||
{
|
||||
|
@ -911,7 +911,7 @@ int D_PAD::ReadDescr( LINE_READER* aReader )
|
|||
switch( Line[0] )
|
||||
{
|
||||
case 'S': // = Sh
|
||||
/* Read pad name */
|
||||
// Read pad name
|
||||
nn = 0;
|
||||
|
||||
while( (*PtLine != '"') && *PtLine )
|
||||
|
@ -944,25 +944,19 @@ int D_PAD::ReadDescr( LINE_READER* aReader )
|
|||
|
||||
ll = 0xFF & BufCar[0];
|
||||
|
||||
/* Read pad shape */
|
||||
m_PadShape = PAD_CIRCLE;
|
||||
// Read pad shape
|
||||
PAD_SHAPE_T shape;
|
||||
|
||||
switch( ll )
|
||||
{
|
||||
case 'C':
|
||||
m_PadShape = PAD_CIRCLE; break;
|
||||
|
||||
case 'R':
|
||||
m_PadShape = PAD_RECT; break;
|
||||
|
||||
case 'O':
|
||||
m_PadShape = PAD_OVAL; break;
|
||||
|
||||
case 'T':
|
||||
m_PadShape = PAD_TRAPEZOID; break;
|
||||
default:
|
||||
case 'C': shape = PAD_CIRCLE; break;
|
||||
case 'R': shape = PAD_RECT; break;
|
||||
case 'O': shape = PAD_OVAL; break;
|
||||
case 'T': shape = PAD_TRAPEZOID; break;
|
||||
}
|
||||
|
||||
ComputeShapeMaxRadius();
|
||||
SetShape( shape ); // sets m_boundingRadius = -1
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
|
@ -976,7 +970,9 @@ int D_PAD::ReadDescr( LINE_READER* aReader )
|
|||
{
|
||||
if( BufCar[0] == 'O' )
|
||||
{
|
||||
m_Drill.x = dx; m_Drill.y = dy;
|
||||
m_Drill.x = dx;
|
||||
m_Drill.y = dy;
|
||||
|
||||
m_DrillShape = PAD_OVAL;
|
||||
}
|
||||
}
|
||||
|
@ -987,25 +983,25 @@ int D_PAD::ReadDescr( LINE_READER* aReader )
|
|||
nn = sscanf( PtLine, "%s %s %X", BufLine, BufCar,
|
||||
&m_layerMask );
|
||||
|
||||
/* BufCar is not used now update attributes */
|
||||
m_Attribut = PAD_STANDARD;
|
||||
// BufCar is not used now update attributes
|
||||
SetAttribute( PAD_STANDARD );
|
||||
if( strncmp( BufLine, "SMD", 3 ) == 0 )
|
||||
m_Attribut = PAD_SMD;
|
||||
SetAttribute( PAD_SMD );
|
||||
|
||||
if( strncmp( BufLine, "CONN", 4 ) == 0 )
|
||||
m_Attribut = PAD_CONN;
|
||||
SetAttribute( PAD_CONN );
|
||||
|
||||
if( strncmp( BufLine, "HOLE", 4 ) == 0 )
|
||||
m_Attribut = PAD_HOLE_NOT_PLATED;
|
||||
SetAttribute( PAD_HOLE_NOT_PLATED );
|
||||
|
||||
break;
|
||||
|
||||
case 'N': /* Read Netname */
|
||||
case 'N': // Read Netname
|
||||
int netcode;
|
||||
nn = sscanf( PtLine, "%d", &netcode );
|
||||
SetNet( netcode );
|
||||
|
||||
/* read Netname */
|
||||
// read Netname
|
||||
ReadDelimitedText( BufLine, PtLine, sizeof(BufLine) );
|
||||
SetNetname( FROM_UTF8( StrPurge( BufLine ) ) );
|
||||
break;
|
||||
|
@ -1018,18 +1014,18 @@ int D_PAD::ReadDescr( LINE_READER* aReader )
|
|||
case 'L':
|
||||
int lengthdie;
|
||||
nn = sscanf( PtLine, "%d", &lengthdie );
|
||||
m_LengthDie = lengthdie;
|
||||
SetDieLength( lengthdie );
|
||||
break;
|
||||
|
||||
case '.': /* Read specific data */
|
||||
case '.': // Read specific data
|
||||
if( strnicmp( Line, ".SolderMask ", 12 ) == 0 )
|
||||
m_LocalSolderMaskMargin = atoi( Line + 12 );
|
||||
SetLocalSolderMaskMargin( atoi( Line + 12 ) );
|
||||
else if( strnicmp( Line, ".SolderPaste ", 13 ) == 0 )
|
||||
m_LocalSolderPasteMargin = atoi( Line + 13 );
|
||||
SetLocalSolderPasteMargin( atoi( Line + 13 ) );
|
||||
else if( strnicmp( Line, ".SolderPasteRatio ", 18 ) == 0 )
|
||||
m_LocalSolderPasteMarginRatio = atoi( Line + 18 );
|
||||
SetLocalSolderPasteMarginRatio( atoi( Line + 18 ) );
|
||||
else if( strnicmp( Line, ".LocalClearance ", 16 ) == 0 )
|
||||
m_LocalClearance = atoi( Line + 16 );
|
||||
SetLocalClearance( atoi( Line + 16 ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1038,7 +1034,7 @@ int D_PAD::ReadDescr( LINE_READER* aReader )
|
|||
}
|
||||
}
|
||||
|
||||
return 2; /* error : EOF */
|
||||
return 2; // error : EOF
|
||||
}
|
||||
|
||||
|
||||
|
@ -1133,10 +1129,14 @@ int MODULE::ReadDescr( LINE_READER* aReader )
|
|||
if( Line[1] == 'P' )
|
||||
{
|
||||
D_PAD* pad = new D_PAD( this );
|
||||
|
||||
pad->ReadDescr( aReader );
|
||||
RotatePoint( &pad->m_Pos, m_Orient );
|
||||
pad->m_Pos.x += m_Pos.x;
|
||||
pad->m_Pos.y += m_Pos.y;
|
||||
|
||||
wxPoint padpos = pad->GetPosition();
|
||||
|
||||
RotatePoint( &padpos, m_Orient );
|
||||
|
||||
pad->SetPosition( padpos + m_Pos );
|
||||
|
||||
m_Pads.PushBack( pad );
|
||||
continue;
|
||||
|
@ -1176,7 +1176,7 @@ int MODULE::ReadDescr( LINE_READER* aReader )
|
|||
|
||||
break;
|
||||
|
||||
case 'L': /* Li = read the library name of the footprint */
|
||||
case 'L': // Li = read the library name of the footprint
|
||||
*BufLine = 0;
|
||||
sscanf( PtLine, " %s", BufLine );
|
||||
m_LibRef = FROM_UTF8( BufLine );
|
||||
|
@ -1187,7 +1187,7 @@ int MODULE::ReadDescr( LINE_READER* aReader )
|
|||
break;
|
||||
|
||||
|
||||
case 'O': /* (Op)tions for auto placement */
|
||||
case 'O': // (Op)tions for auto placement
|
||||
itmp1 = itmp2 = 0;
|
||||
sscanf( PtLine, " %X %X", &itmp1, &itmp2 );
|
||||
|
||||
|
@ -1212,7 +1212,7 @@ int MODULE::ReadDescr( LINE_READER* aReader )
|
|||
case 'A':
|
||||
if( Line[1] == 't' )
|
||||
{
|
||||
/* At = (At)tributes of module */
|
||||
// At = (At)tributes of module
|
||||
if( strstr( PtLine, "SMD" ) )
|
||||
m_Attributs |= MOD_CMS;
|
||||
|
||||
|
@ -1238,7 +1238,7 @@ int MODULE::ReadDescr( LINE_READER* aReader )
|
|||
textm = m_Reference;
|
||||
else if( itmp1 == TEXT_is_VALUE )
|
||||
textm = m_Value;
|
||||
else /* text is a drawing */
|
||||
else // text is a drawing
|
||||
{
|
||||
textm = new TEXTE_MODULE( this );
|
||||
m_Drawings.PushBack( textm );
|
||||
|
@ -1246,7 +1246,7 @@ int MODULE::ReadDescr( LINE_READER* aReader )
|
|||
textm->ReadDescr( aReader );
|
||||
break;
|
||||
|
||||
case 'D': /* read a drawing item */
|
||||
case 'D': // read a drawing item
|
||||
EDGE_MODULE * edge;
|
||||
edge = new EDGE_MODULE( this );
|
||||
m_Drawings.PushBack( edge );
|
||||
|
@ -1254,23 +1254,23 @@ int MODULE::ReadDescr( LINE_READER* aReader )
|
|||
edge->SetDrawCoord();
|
||||
break;
|
||||
|
||||
case 'C': /* read documentation data */
|
||||
case 'C': // read documentation data
|
||||
m_Doc = FROM_UTF8( StrPurge( PtLine ) );
|
||||
break;
|
||||
|
||||
case 'K': /* Read key words */
|
||||
case 'K': // Read key words
|
||||
m_KeyWord = FROM_UTF8( StrPurge( PtLine ) );
|
||||
break;
|
||||
|
||||
case '.': /* Read specific data */
|
||||
case '.': // Read specific data
|
||||
if( strnicmp( Line, ".SolderMask ", 12 ) == 0 )
|
||||
m_LocalSolderMaskMargin = atoi( Line + 12 );
|
||||
SetLocalSolderMaskMargin( atoi( Line + 12 ) );
|
||||
else if( strnicmp( Line, ".SolderPaste ", 13 ) == 0 )
|
||||
m_LocalSolderPasteMargin = atoi( Line + 13 );
|
||||
SetLocalSolderPasteMargin( atoi( Line + 13 ) );
|
||||
else if( strnicmp( Line, ".SolderPasteRatio ", 18 ) == 0 )
|
||||
m_LocalSolderPasteMarginRatio = atof( Line + 18 );
|
||||
SetLocalSolderPasteMarginRatio( atof( Line + 18 ) );
|
||||
else if( strnicmp( Line, ".LocalClearance ", 16 ) == 0 )
|
||||
m_LocalClearance = atoi( Line + 16 );
|
||||
SetLocalClearance( atoi( Line + 16 ) );
|
||||
|
||||
break;
|
||||
|
||||
|
@ -1279,7 +1279,7 @@ int MODULE::ReadDescr( LINE_READER* aReader )
|
|||
}
|
||||
}
|
||||
|
||||
/* Recalculate the bounding box */
|
||||
// Recalculate the bounding box
|
||||
CalculateBoundingBox();
|
||||
return 0;
|
||||
}
|
||||
|
@ -1555,7 +1555,7 @@ bool DRAWSEGMENT::ReadDrawSegmentDescr( LINE_READER* aReader )
|
|||
Line = aReader->Line();
|
||||
|
||||
if( strnicmp( Line, "$End", 4 ) == 0 )
|
||||
return true; /* End of description */
|
||||
return true; // End of description
|
||||
|
||||
if( Line[0] == 'P' )
|
||||
{
|
||||
|
@ -1595,7 +1595,7 @@ bool DRAWSEGMENT::ReadDrawSegmentDescr( LINE_READER* aReader )
|
|||
case 4:
|
||||
sscanf( token,"%X",&status );
|
||||
break;
|
||||
/* Bezier Control Points*/
|
||||
// Bezier Control Points
|
||||
case 5:
|
||||
sscanf( token,"%d",&m_BezierC1.x );
|
||||
break;
|
||||
|
@ -1794,7 +1794,7 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
|
|||
break;
|
||||
}
|
||||
}
|
||||
/* Set hatch mode later, after reading outlines corners data */
|
||||
// Set hatch mode later, after reading outlines corners data
|
||||
}
|
||||
|
||||
else if( strnicmp( Line, "ZPriority", 9 ) == 0 )
|
||||
|
@ -1950,7 +1950,7 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
|
|||
SetNet( 0 );
|
||||
}
|
||||
|
||||
/* Set hatch here, when outlines corners are read */
|
||||
// Set hatch here, when outlines corners are read
|
||||
m_Poly->SetHatch( outline_hatch );
|
||||
|
||||
return error ? 0 : 1;
|
||||
|
@ -2065,13 +2065,13 @@ int TEXTE_PCB::ReadTextePcbDescr( LINE_READER* aReader )
|
|||
line = aReader->Line();
|
||||
if( strnicmp( line, "$EndTEXTPCB", 11 ) == 0 )
|
||||
return 0;
|
||||
if( strncmp( line, "Te", 2 ) == 0 ) /* Text line (first line for multi line texts */
|
||||
if( strncmp( line, "Te", 2 ) == 0 ) // Text line (first line for multi line texts
|
||||
{
|
||||
ReadDelimitedText( text, line + 2, sizeof(text) );
|
||||
m_Text = FROM_UTF8( text );
|
||||
continue;
|
||||
}
|
||||
if( strncmp( line, "nl", 2 ) == 0 ) /* next line of the current text */
|
||||
if( strncmp( line, "nl", 2 ) == 0 ) // next line of the current text
|
||||
{
|
||||
ReadDelimitedText( text, line + 2, sizeof(text) );
|
||||
m_Text.Append( '\n' );
|
||||
|
|
|
@ -755,18 +755,14 @@ void KICAD_PLUGIN::loadSETUP()
|
|||
{
|
||||
BIU x = biuParse( line + SZ( "PadSize" ), &data );
|
||||
BIU y = biuParse( data );
|
||||
/* @todo
|
||||
g_Pad_Master.m_Size = wxSize( x, y );
|
||||
*/
|
||||
|
||||
bds.m_Pad_Master.SetSize( wxSize( x, y ) );
|
||||
}
|
||||
|
||||
else if( TESTLINE( "PadDrill" ) )
|
||||
{
|
||||
BIU tmp = biuParse( line + SZ( "PadDrill" ) );
|
||||
/* @todo
|
||||
g_Pad_Master.m_Drill.x( tmp );
|
||||
g_Pad_Master.m_Drill.y( tmp );
|
||||
*/
|
||||
bds.m_Pad_Master.SetDrillSize( wxSize( tmp, tmp ) );
|
||||
}
|
||||
|
||||
else if( TESTLINE( "Pad2MaskClearance" ) )
|
||||
|
@ -1102,11 +1098,10 @@ void KICAD_PLUGIN::loadPAD( MODULE* aModule )
|
|||
// chances are both were ASCII, but why take chances?
|
||||
|
||||
pad->SetPadName( padname );
|
||||
pad->SetShape( padshape );
|
||||
pad->SetShape( PAD_SHAPE_T( padshape ) );
|
||||
pad->SetSize( wxSize( size_x, size_y ) );
|
||||
pad->SetDelta( wxSize( delta_x, delta_y ) );
|
||||
pad->SetOrientation( orient );
|
||||
pad->ComputeShapeMaxRadius();
|
||||
}
|
||||
|
||||
else if( TESTLINE( "Dr" ) ) // (Dr)ill
|
||||
|
@ -1118,7 +1113,8 @@ void KICAD_PLUGIN::loadPAD( MODULE* aModule )
|
|||
BIU drill_y = drill_x;
|
||||
BIU offs_x = biuParse( data, &data );
|
||||
BIU offs_y = biuParse( data, &data );
|
||||
int drShape = PAD_CIRCLE;
|
||||
|
||||
PAD_SHAPE_T drShape = PAD_CIRCLE;
|
||||
|
||||
data = strtok( (char*) data, delims );
|
||||
if( data ) // optional shape
|
||||
|
@ -1136,7 +1132,7 @@ void KICAD_PLUGIN::loadPAD( MODULE* aModule )
|
|||
}
|
||||
|
||||
pad->SetDrillShape( drShape );
|
||||
pad->SetOffset( wxSize( offs_x, offs_y ) );
|
||||
pad->SetOffset( wxPoint( offs_x, offs_y ) );
|
||||
pad->SetDrillSize( wxSize( drill_x, drill_y ) );
|
||||
}
|
||||
|
||||
|
@ -1145,8 +1141,8 @@ void KICAD_PLUGIN::loadPAD( MODULE* aModule )
|
|||
// e.g. "At SMD N 00888000"
|
||||
// sscanf( PtLine, "%s %s %X", BufLine, BufCar, &m_layerMask );
|
||||
|
||||
int attribute;
|
||||
int layer_mask;
|
||||
PAD_ATTR_T attribute;
|
||||
int layer_mask;
|
||||
|
||||
data = strtok( line + SZ( "At" ), delims );
|
||||
|
||||
|
@ -1226,9 +1222,11 @@ void KICAD_PLUGIN::loadPAD( MODULE* aModule )
|
|||
|
||||
else if( TESTLINE( "$EndPAD" ) )
|
||||
{
|
||||
RotatePoint( &pad->m_Pos, aModule->GetOrientation() );
|
||||
wxPoint padpos = pad->GetPosition();
|
||||
|
||||
pad->m_Pos += aModule->GetPosition();
|
||||
RotatePoint( &padpos, aModule->GetOrientation() );
|
||||
|
||||
pad->SetPosition( padpos + aModule->GetPosition() );
|
||||
|
||||
aModule->m_Pads.PushBack( pad.release() );
|
||||
return; // preferred exit
|
||||
|
@ -2849,10 +2847,8 @@ void KICAD_PLUGIN::saveSETUP() const
|
|||
fprintf( m_fp, "TextModSize %s\n", fmtBIUSize( bds.m_ModuleTextSize ).c_str() );
|
||||
fprintf( m_fp, "TextModWidth %s\n", fmtBIU( bds.m_ModuleTextWidth ).c_str() );
|
||||
|
||||
/* @todo
|
||||
fprintf( m_fp, "PadSize %d %d\n", g_Pad_Master.m_Size.x, g_Pad_Master.m_Size.y );
|
||||
fprintf( m_fp, "PadDrill %d\n", g_Pad_Master.m_Drill.x );
|
||||
*/
|
||||
fprintf( m_fp, "PadSize %s\n", fmtBIUSize( bds.m_Pad_Master.GetSize() ).c_str() );
|
||||
fprintf( m_fp, "PadDrill %s\n", fmtBIU( bds.m_Pad_Master.GetDrillSize().x ).c_str() );
|
||||
|
||||
fprintf( m_fp, "Pad2MaskClearance %s\n", fmtBIU( bds.m_SolderMaskMargin ).c_str() );
|
||||
|
||||
|
@ -3138,7 +3134,7 @@ void KICAD_PLUGIN::savePAD( const D_PAD* me ) const
|
|||
|
||||
fprintf( m_fp, "Dr %s %s",
|
||||
fmtBIU( me->GetDrillSize().x ).c_str(),
|
||||
fmtBIUSize( me->GetOffset() ).c_str() );
|
||||
fmtBIUPoint( me->GetOffset() ).c_str() );
|
||||
|
||||
if( me->GetDrillShape() == PAD_OVAL )
|
||||
{
|
||||
|
|
|
@ -165,7 +165,7 @@ bool Magnetize( BOARD* m_Pcb, PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize gr
|
|||
if( doCheckNet && currTrack && currTrack->GetNet() != pad->GetNet() )
|
||||
return false;
|
||||
|
||||
*curpos = pad->m_Pos;
|
||||
*curpos = pad->GetPosition();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -724,11 +724,13 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
|
||||
{
|
||||
D_PAD* pad = module->m_Pads;
|
||||
EDA_ITEM* item = module->m_Drawings;
|
||||
TEXTE_MODULE* textmod;
|
||||
EDGE_MODULE* edgemod;
|
||||
double angle = 900; // Necessary +- 900 (+- 90 degrees) )
|
||||
D_PAD* pad = module->m_Pads;
|
||||
EDA_ITEM* item = module->m_Drawings;
|
||||
TEXTE_MODULE* textmod;
|
||||
EDGE_MODULE* edgemod;
|
||||
wxPoint pt;
|
||||
wxSize size;
|
||||
double angle = 900; // Necessary +- 900 (+- 90 degrees) )
|
||||
|
||||
switch( transform )
|
||||
{
|
||||
|
@ -737,11 +739,20 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
|
|||
|
||||
for( ; pad; pad = pad->Next() )
|
||||
{
|
||||
pad->SetPos0( pad->m_Pos );
|
||||
pad->m_Orient -= angle;
|
||||
RotatePoint( &pad->m_Offset.x, &pad->m_Offset.y, angle );
|
||||
EXCHG( pad->m_Size.x, pad->m_Size.y );
|
||||
RotatePoint( &pad->m_DeltaSize.x, &pad->m_DeltaSize.y, -angle );
|
||||
pad->SetPos0( pad->GetPosition() );
|
||||
pad->SetOrientation( pad->GetOrientation() - angle );
|
||||
|
||||
pt = pad->GetOffset();
|
||||
RotatePoint( &pt, angle );
|
||||
pad->SetOffset( pt );
|
||||
|
||||
size = pad->GetSize();
|
||||
EXCHG( size.x, size.y );
|
||||
pad->SetSize( size );
|
||||
|
||||
size = pad->GetDelta();
|
||||
RotatePoint( &size.x, &size.y, -angle );
|
||||
pad->SetDelta( size );
|
||||
}
|
||||
|
||||
module->m_Reference->SetPos0( module->m_Reference->m_Pos );
|
||||
|
@ -778,13 +789,22 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
|
|||
case ID_MODEDIT_MODULE_MIRROR:
|
||||
for( ; pad; pad = pad->Next() )
|
||||
{
|
||||
NEGATE( pad->m_Pos.y );
|
||||
NEGATE( pad->m_Pos0.y );
|
||||
NEGATE( pad->m_Offset.y );
|
||||
NEGATE( pad->m_DeltaSize.y );
|
||||
pad->SetY( -pad->GetPosition().y );
|
||||
|
||||
if( pad->m_Orient )
|
||||
pad->m_Orient = 3600 - pad->m_Orient;
|
||||
pt = pad->GetPos0();
|
||||
NEGATE( pt.y );
|
||||
pad->SetPos0( pt );
|
||||
|
||||
pt = pad->GetOffset();
|
||||
NEGATE( pt.y );
|
||||
pad->SetOffset( pt );
|
||||
|
||||
size = pad->GetDelta();
|
||||
NEGATE( size.y );
|
||||
pad->SetDelta( size );
|
||||
|
||||
if( pad->GetOrientation() )
|
||||
pad->SetOrientation( 3600 - pad->GetOrientation() );
|
||||
}
|
||||
|
||||
// Reverse mirror of reference.
|
||||
|
|
|
@ -124,9 +124,9 @@ public:
|
|||
void ToPrinter( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Virtual function PrintPage
|
||||
* used to print a page
|
||||
* Print the page pointed by ActiveScreen, set by the calling print function
|
||||
* Function PrintPage
|
||||
* is used to print a page. Prints the page pointed by ActiveScreen,
|
||||
* set by the calling print function.
|
||||
* @param aDC = wxDC given by the calling print function
|
||||
* @param aPrintMaskLayer = not used here
|
||||
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
|
||||
|
@ -348,8 +348,8 @@ public:
|
|||
|
||||
/**
|
||||
* Function DlgGlobalChange_PadSettings
|
||||
* Function to change pad caracteristics for the given footprint
|
||||
* or all footprints which look like the given footprint
|
||||
* changes pad caracteristics for the given footprint
|
||||
* or all footprints which look like the given footprint.
|
||||
* Options are set by the opened dialog.
|
||||
* @param aPad is the pattern. The given footprint is the parent of this pad
|
||||
*/
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
|
||||
|
||||
/**
|
||||
* @file move-drag_pads.cpp
|
||||
* @brief Edit footprint pads.
|
||||
|
@ -39,10 +41,10 @@ static void Abort_Move_Pad( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
|||
|
||||
pad->Draw( Panel, DC, GR_XOR );
|
||||
pad->ClearFlags();
|
||||
pad->m_Pos = Pad_OldPos;
|
||||
pad->SetPosition( Pad_OldPos );
|
||||
pad->Draw( Panel, DC, GR_XOR );
|
||||
|
||||
/* Pad move in progress: the restore origin. */
|
||||
// Pad move in progress: the restore origin.
|
||||
if( g_Drag_Pistes_On )
|
||||
{
|
||||
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
||||
|
@ -76,7 +78,7 @@ static void Show_Pad_Move( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo
|
|||
if( aErase )
|
||||
pad->Draw( aPanel, aDC, GR_XOR );
|
||||
|
||||
pad->m_Pos = screen->GetCrossHairPosition();
|
||||
pad->SetPosition( screen->GetCrossHairPosition() );
|
||||
pad->Draw( aPanel, aDC, GR_XOR );
|
||||
|
||||
if( !g_Drag_Pistes_On )
|
||||
|
@ -91,12 +93,12 @@ static void Show_Pad_Move( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo
|
|||
|
||||
if( g_DragSegmentList[ii].m_Pad_Start )
|
||||
{
|
||||
Track->m_Start = pad->m_Pos;
|
||||
Track->m_Start = pad->GetPosition();
|
||||
}
|
||||
|
||||
if( g_DragSegmentList[ii].m_Pad_End )
|
||||
{
|
||||
Track->m_End = pad->m_Pos;
|
||||
Track->m_End = pad->GetPosition();
|
||||
}
|
||||
|
||||
Track->Draw( aPanel, aDC, GR_XOR );
|
||||
|
@ -106,29 +108,31 @@ static void Show_Pad_Move( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo
|
|||
|
||||
/* Load list of features for default pad selection.
|
||||
*/
|
||||
void PCB_BASE_FRAME::Export_Pad_Settings( D_PAD* pt_pad )
|
||||
void PCB_BASE_FRAME::Export_Pad_Settings( D_PAD* aPad )
|
||||
{
|
||||
if( pt_pad == NULL )
|
||||
if( aPad == NULL )
|
||||
return;
|
||||
|
||||
pt_pad->DisplayInfo( this );
|
||||
aPad->DisplayInfo( this );
|
||||
|
||||
g_Pad_Master.m_PadShape = pt_pad->m_PadShape;
|
||||
g_Pad_Master.m_Attribut = pt_pad->m_Attribut;
|
||||
g_Pad_Master.m_layerMask = pt_pad->m_layerMask;
|
||||
g_Pad_Master.m_Orient = pt_pad->m_Orient -
|
||||
( (MODULE*) pt_pad->GetParent() )->m_Orient;
|
||||
g_Pad_Master.m_Size = pt_pad->m_Size;
|
||||
g_Pad_Master.m_DeltaSize = pt_pad->m_DeltaSize;
|
||||
pt_pad->ComputeShapeMaxRadius();
|
||||
D_PAD& mp = GetDesignSettings().m_Pad_Master;
|
||||
|
||||
g_Pad_Master.m_Offset = pt_pad->m_Offset;
|
||||
g_Pad_Master.m_Drill = pt_pad->m_Drill;
|
||||
g_Pad_Master.m_DrillShape = pt_pad->m_DrillShape;
|
||||
mp.SetShape( aPad->GetShape() );
|
||||
mp.SetAttribute( aPad->GetAttribute() );
|
||||
mp.SetLayerMask( aPad->GetLayerMask() );
|
||||
|
||||
mp.SetOrientation( aPad->GetOrientation() - aPad->GetParent()->GetOrientation() );
|
||||
|
||||
mp.SetSize( aPad->GetSize() );
|
||||
mp.SetDelta( aPad->GetDelta() );
|
||||
|
||||
mp.SetOffset( aPad->GetOffset() );
|
||||
mp.SetDrillSize( aPad->GetDrillSize() );
|
||||
mp.SetDrillShape( aPad->GetDrillShape() );
|
||||
}
|
||||
|
||||
|
||||
/* Imports the new values of dimensions of the pad edge by pt_pad
|
||||
/* Imports the new values of dimensions of the pad edge by aPad
|
||||
* - Source: selected values of general characteristics
|
||||
* - Measurements are modified
|
||||
* - The position, names, and keys are not.
|
||||
|
@ -142,72 +146,77 @@ void PCB_BASE_FRAME::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
|
|||
aPad->ClearFlags( DO_NOT_DRAW );
|
||||
}
|
||||
|
||||
aPad->m_PadShape = g_Pad_Master.m_PadShape;
|
||||
aPad->m_layerMask = g_Pad_Master.m_layerMask;
|
||||
aPad->m_Attribut = g_Pad_Master.m_Attribut;
|
||||
aPad->m_Orient = g_Pad_Master.m_Orient + ( (MODULE*) aPad->GetParent() )->m_Orient;
|
||||
aPad->m_Size = g_Pad_Master.m_Size;
|
||||
aPad->m_DeltaSize = wxSize( 0, 0 );
|
||||
aPad->m_Offset = g_Pad_Master.m_Offset;
|
||||
aPad->m_Drill = g_Pad_Master.m_Drill;
|
||||
aPad->m_DrillShape = g_Pad_Master.m_DrillShape;
|
||||
D_PAD& mp = GetDesignSettings().m_Pad_Master;
|
||||
|
||||
switch( g_Pad_Master.m_PadShape )
|
||||
aPad->SetShape( mp.GetShape() );
|
||||
aPad->SetLayerMask( mp.GetLayerMask() );
|
||||
aPad->SetAttribute( mp.GetAttribute() );
|
||||
aPad->SetOrientation( mp.GetOrientation() + aPad->GetParent()->GetOrientation() );
|
||||
aPad->SetSize( mp.GetSize() );
|
||||
aPad->SetDelta( wxSize( 0, 0 ) );
|
||||
aPad->SetOffset( mp.GetOffset() );
|
||||
aPad->SetDrillSize( mp.GetDrillSize() );
|
||||
aPad->SetDrillShape( mp.GetDrillShape() );
|
||||
|
||||
switch( mp.GetShape() )
|
||||
{
|
||||
case PAD_TRAPEZOID:
|
||||
aPad->m_DeltaSize = g_Pad_Master.m_DeltaSize;
|
||||
aPad->SetDelta( mp.GetDelta() );
|
||||
break;
|
||||
|
||||
case PAD_CIRCLE:
|
||||
aPad->m_Size.y = aPad->m_Size.x;
|
||||
// set size.y to size.x
|
||||
aPad->SetSize( wxSize( aPad->GetSize().x, aPad->GetSize().x ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
switch( g_Pad_Master.m_Attribut & 0x7F )
|
||||
switch( mp.GetAttribute() )
|
||||
{
|
||||
case PAD_SMD:
|
||||
case PAD_CONN:
|
||||
aPad->m_Drill = wxSize( 0, 0 );
|
||||
aPad->m_Offset.x = 0;
|
||||
aPad->m_Offset.y = 0;
|
||||
aPad->SetDrillSize( wxSize( 0, 0 ) );
|
||||
aPad->SetOffset( wxPoint( 0, 0 ) );
|
||||
}
|
||||
|
||||
aPad->ComputeShapeMaxRadius();
|
||||
|
||||
if( aDraw )
|
||||
m_canvas->RefreshDrawingRect( aPad->GetBoundingBox() );
|
||||
|
||||
( (MODULE*) aPad->GetParent() )->m_LastEdit_Time = time( NULL );
|
||||
aPad->GetParent()->m_LastEdit_Time = time( NULL );
|
||||
}
|
||||
|
||||
|
||||
/* Add a pad on the selected module.
|
||||
*/
|
||||
void PCB_BASE_FRAME::AddPad( MODULE* Module, bool draw )
|
||||
void PCB_BASE_FRAME::AddPad( MODULE* aModule, bool draw )
|
||||
{
|
||||
wxString lastPadName; // Last used pad name (pad num)
|
||||
lastPadName = g_Pad_Master.GetPadName();
|
||||
// Last used pad name (pad num)
|
||||
wxString lastPadName = GetDesignSettings().m_Pad_Master.GetPadName();
|
||||
|
||||
m_Pcb->m_Status_Pcb = 0;
|
||||
Module->m_LastEdit_Time = time( NULL );
|
||||
aModule->m_LastEdit_Time = time( NULL );
|
||||
|
||||
D_PAD* Pad = new D_PAD( Module );
|
||||
D_PAD* pad = new D_PAD( aModule );
|
||||
|
||||
/* Add the new pad to end of the module pad list. */
|
||||
Module->m_Pads.PushBack( Pad );
|
||||
// Add the new pad to end of the module pad list.
|
||||
aModule->m_Pads.PushBack( pad );
|
||||
|
||||
/* Update the pad properties. */
|
||||
Import_Pad_Settings( Pad, false );
|
||||
Pad->SetNetname( wxEmptyString );
|
||||
// Update the pad properties.
|
||||
Import_Pad_Settings( pad, false );
|
||||
pad->SetNetname( wxEmptyString );
|
||||
|
||||
Pad->m_Pos = GetScreen()->GetCrossHairPosition();
|
||||
pad->SetPosition( GetScreen()->GetCrossHairPosition() );
|
||||
|
||||
// Set the relative pad position
|
||||
// ( pad position for module orient, 0, and relative to the module position)
|
||||
Pad->m_Pos0 = Pad->m_Pos - Module->m_Pos;
|
||||
RotatePoint( &Pad->m_Pos0, -Module->m_Orient );
|
||||
|
||||
/* Automatically increment the current pad number. */
|
||||
wxPoint pos0 = pad->GetPosition() - aModule->GetPosition();
|
||||
RotatePoint( &pos0, -aModule->GetOrientation() );
|
||||
pad->SetPos0( pos0 );
|
||||
|
||||
// Automatically increment the current pad number.
|
||||
long num = 0;
|
||||
int ponder = 1;
|
||||
|
||||
|
@ -220,14 +229,15 @@ void PCB_BASE_FRAME::AddPad( MODULE* Module, bool draw )
|
|||
|
||||
num++; // Use next number for the new pad
|
||||
lastPadName << num;
|
||||
Pad->SetPadName( lastPadName );
|
||||
g_Pad_Master.SetPadName(lastPadName);
|
||||
pad->SetPadName( lastPadName );
|
||||
|
||||
Module->CalculateBoundingBox();
|
||||
Pad->DisplayInfo( this );
|
||||
GetDesignSettings().m_Pad_Master.SetPadName(lastPadName);
|
||||
|
||||
aModule->CalculateBoundingBox();
|
||||
pad->DisplayInfo( this );
|
||||
|
||||
if( draw )
|
||||
m_canvas->RefreshDrawingRect( Module->GetBoundingBox() );
|
||||
m_canvas->RefreshDrawingRect( aModule->GetBoundingBox() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -241,20 +251,20 @@ void PCB_BASE_FRAME::AddPad( MODULE* Module, bool draw )
|
|||
*/
|
||||
void PCB_BASE_FRAME::DeletePad( D_PAD* aPad, bool aQuery )
|
||||
{
|
||||
MODULE* Module;
|
||||
MODULE* module;
|
||||
|
||||
if( aPad == NULL )
|
||||
return;
|
||||
|
||||
Module = (MODULE*) aPad->GetParent();
|
||||
Module->m_LastEdit_Time = time( NULL );
|
||||
module = (MODULE*) aPad->GetParent();
|
||||
module->m_LastEdit_Time = time( NULL );
|
||||
|
||||
if( aQuery )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Delete Pad (module %s %s) " ),
|
||||
GetChars( Module->m_Reference->m_Text ),
|
||||
GetChars( Module->m_Value->m_Text ) );
|
||||
GetChars( module->m_Reference->m_Text ),
|
||||
GetChars( module->m_Value->m_Text ) );
|
||||
|
||||
if( !IsOK( this, msg ) )
|
||||
return;
|
||||
|
@ -262,53 +272,54 @@ void PCB_BASE_FRAME::DeletePad( D_PAD* aPad, bool aQuery )
|
|||
|
||||
m_Pcb->m_Status_Pcb = 0;
|
||||
aPad->DeleteStructure();
|
||||
m_canvas->RefreshDrawingRect( Module->GetBoundingBox() );
|
||||
Module->CalculateBoundingBox();
|
||||
m_canvas->RefreshDrawingRect( module->GetBoundingBox() );
|
||||
module->CalculateBoundingBox();
|
||||
|
||||
OnModify();
|
||||
}
|
||||
|
||||
|
||||
/* Function to initialize the "move pad" command */
|
||||
void PCB_BASE_FRAME::StartMovePad( D_PAD* Pad, wxDC* DC )
|
||||
// Function to initialize the "move pad" command
|
||||
void PCB_BASE_FRAME::StartMovePad( D_PAD* aPad, wxDC* DC )
|
||||
{
|
||||
if( Pad == NULL )
|
||||
if( aPad == NULL )
|
||||
return;
|
||||
|
||||
s_CurrentSelectedPad = Pad;
|
||||
Pad_OldPos = Pad->m_Pos;
|
||||
Pad->DisplayInfo( this );
|
||||
s_CurrentSelectedPad = aPad;
|
||||
|
||||
Pad_OldPos = aPad->GetPosition();
|
||||
|
||||
aPad->DisplayInfo( this );
|
||||
m_canvas->SetMouseCapture( Show_Pad_Move, Abort_Move_Pad );
|
||||
|
||||
/* Draw the pad (SKETCH mode) */
|
||||
Pad->Draw( m_canvas, DC, GR_XOR );
|
||||
Pad->SetFlags( IS_MOVED );
|
||||
Pad->Draw( m_canvas, DC, GR_XOR );
|
||||
// Draw the pad (SKETCH mode)
|
||||
aPad->Draw( m_canvas, DC, GR_XOR );
|
||||
aPad->SetFlags( IS_MOVED );
|
||||
aPad->Draw( m_canvas, DC, GR_XOR );
|
||||
|
||||
/* Build the list of track segments to drag if the command is a drag pad*/
|
||||
// Build the list of track segments to drag if the command is a drag pad
|
||||
if( g_Drag_Pistes_On )
|
||||
Build_1_Pad_SegmentsToDrag( m_canvas, DC, Pad );
|
||||
Build_1_Pad_SegmentsToDrag( m_canvas, DC, aPad );
|
||||
else
|
||||
EraseDragList();
|
||||
}
|
||||
|
||||
|
||||
/* Routine to place a moved pad. */
|
||||
void PCB_BASE_FRAME::PlacePad( D_PAD* Pad, wxDC* DC )
|
||||
// Routine to place a moved pad.
|
||||
void PCB_BASE_FRAME::PlacePad( D_PAD* aPad, wxDC* DC )
|
||||
{
|
||||
int dX, dY;
|
||||
TRACK* Track;
|
||||
MODULE* Module;
|
||||
|
||||
if( Pad == NULL )
|
||||
if( aPad == NULL )
|
||||
return;
|
||||
|
||||
Module = (MODULE*) Pad->GetParent();
|
||||
MODULE* module = aPad->GetParent();
|
||||
|
||||
ITEM_PICKER picker( NULL, UR_CHANGED );
|
||||
PICKED_ITEMS_LIST pickList;
|
||||
|
||||
/* Save dragged track segments in undo list */
|
||||
// Save dragged track segments in undo list
|
||||
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
||||
{
|
||||
Track = g_DragSegmentList[ii].m_Segm;
|
||||
|
@ -324,34 +335,34 @@ void PCB_BASE_FRAME::PlacePad( D_PAD* Pad, wxDC* DC )
|
|||
pickList.PushItem( picker );
|
||||
}
|
||||
|
||||
/* Save old module and old items values */
|
||||
wxPoint pad_curr_position = Pad->m_Pos;
|
||||
// Save old module and old items values
|
||||
wxPoint pad_curr_position = aPad->GetPosition();
|
||||
|
||||
Pad->m_Pos = Pad_OldPos;
|
||||
aPad->SetPosition( Pad_OldPos );
|
||||
|
||||
if( g_DragSegmentList.size() == 0 )
|
||||
SaveCopyInUndoList( Module, UR_CHANGED );
|
||||
SaveCopyInUndoList( module, UR_CHANGED );
|
||||
else
|
||||
{
|
||||
picker.SetItem( Module );
|
||||
picker.SetItem( module );
|
||||
pickList.PushItem( picker );
|
||||
SaveCopyInUndoList( pickList, UR_CHANGED );
|
||||
}
|
||||
|
||||
Pad->m_Pos = pad_curr_position;
|
||||
Pad->Draw( m_canvas, DC, GR_XOR );
|
||||
aPad->SetPosition( pad_curr_position );
|
||||
aPad->Draw( m_canvas, DC, GR_XOR );
|
||||
|
||||
/* Redraw dragged track segments */
|
||||
// Redraw dragged track segments
|
||||
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
||||
{
|
||||
Track = g_DragSegmentList[ii].m_Segm;
|
||||
|
||||
// Set the new state
|
||||
if( g_DragSegmentList[ii].m_Pad_Start )
|
||||
Track->m_Start = Pad->m_Pos;
|
||||
Track->m_Start = aPad->GetPosition();
|
||||
|
||||
if( g_DragSegmentList[ii].m_Pad_End )
|
||||
Track->m_End = Pad->m_Pos;
|
||||
Track->m_End = aPad->GetPosition();
|
||||
|
||||
Track->SetState( IN_EDIT, OFF );
|
||||
|
||||
|
@ -359,21 +370,23 @@ void PCB_BASE_FRAME::PlacePad( D_PAD* Pad, wxDC* DC )
|
|||
Track->Draw( m_canvas, DC, GR_OR );
|
||||
}
|
||||
|
||||
/* Compute local coordinates (i.e refer to Module position and for Module orient = 0) */
|
||||
dX = Pad->m_Pos.x - Pad_OldPos.x;
|
||||
dY = Pad->m_Pos.y - Pad_OldPos.y;
|
||||
RotatePoint( &dX, &dY, -Module->m_Orient );
|
||||
// Compute local coordinates (i.e refer to module position and for module orient = 0)
|
||||
dX = aPad->GetPosition().x - Pad_OldPos.x;
|
||||
dY = aPad->GetPosition().y - Pad_OldPos.y;
|
||||
|
||||
Pad->m_Pos0.x += dX;
|
||||
s_CurrentSelectedPad->m_Pos0.y += dY;
|
||||
RotatePoint( &dX, &dY, -module->GetOrientation() );
|
||||
|
||||
Pad->ClearFlags();
|
||||
aPad->SetX0( dX + aPad->GetPos0().x );
|
||||
|
||||
s_CurrentSelectedPad->SetY0( dY + s_CurrentSelectedPad->GetPos0().y );
|
||||
|
||||
aPad->ClearFlags();
|
||||
|
||||
if( DC )
|
||||
Pad->Draw( m_canvas, DC, GR_OR );
|
||||
aPad->Draw( m_canvas, DC, GR_OR );
|
||||
|
||||
Module->CalculateBoundingBox();
|
||||
Module->m_LastEdit_Time = time( NULL );
|
||||
module->CalculateBoundingBox();
|
||||
module->m_LastEdit_Time = time( NULL );
|
||||
|
||||
EraseDragList();
|
||||
|
||||
|
@ -383,33 +396,43 @@ void PCB_BASE_FRAME::PlacePad( D_PAD* Pad, wxDC* DC )
|
|||
}
|
||||
|
||||
|
||||
/* Rotate selected pad 90 degrees.
|
||||
*/
|
||||
void PCB_BASE_FRAME::RotatePad( D_PAD* Pad, wxDC* DC )
|
||||
// Rotate selected pad 90 degrees.
|
||||
void PCB_BASE_FRAME::RotatePad( D_PAD* aPad, wxDC* DC )
|
||||
{
|
||||
MODULE* Module;
|
||||
|
||||
if( Pad == NULL )
|
||||
if( aPad == NULL )
|
||||
return;
|
||||
|
||||
Module = (MODULE*) Pad->GetParent();
|
||||
Module->m_LastEdit_Time = time( NULL );
|
||||
MODULE* module = aPad->GetParent();
|
||||
|
||||
module->m_LastEdit_Time = time( NULL );
|
||||
|
||||
OnModify();
|
||||
|
||||
if( DC )
|
||||
Module->Draw( m_canvas, DC, GR_XOR );
|
||||
module->Draw( m_canvas, DC, GR_XOR );
|
||||
|
||||
EXCHG( Pad->m_Size.x, Pad->m_Size.y );
|
||||
EXCHG( Pad->m_Drill.x, Pad->m_Drill.y );
|
||||
EXCHG( Pad->m_Offset.x, Pad->m_Offset.y );
|
||||
Pad->m_Offset.y = -Pad->m_Offset.y;
|
||||
wxSize sz = aPad->GetSize();
|
||||
EXCHG( sz.x, sz.y );
|
||||
aPad->SetSize( sz );
|
||||
|
||||
EXCHG( Pad->m_DeltaSize.x, Pad->m_DeltaSize.y );
|
||||
Pad->m_DeltaSize.x = -Pad->m_DeltaSize.x;
|
||||
Module->CalculateBoundingBox();
|
||||
Pad->DisplayInfo( this );
|
||||
sz = aPad->GetDrillSize();
|
||||
EXCHG( sz.x, sz.y );
|
||||
aPad->SetDrillSize( sz );
|
||||
|
||||
wxPoint pt = aPad->GetOffset();
|
||||
EXCHG( pt.x, pt.y );
|
||||
aPad->SetOffset( pt );
|
||||
|
||||
aPad->SetOffset( wxPoint( aPad->GetOffset().x, -aPad->GetOffset().y ) );
|
||||
|
||||
sz = aPad->GetDelta();
|
||||
EXCHG( sz.x, sz.y );
|
||||
sz.x = -sz.x;
|
||||
aPad->SetDelta( sz );
|
||||
|
||||
module->CalculateBoundingBox();
|
||||
aPad->DisplayInfo( this );
|
||||
|
||||
if( DC )
|
||||
Module->Draw( m_canvas, DC, GR_OR );
|
||||
module->Draw( m_canvas, DC, GR_OR );
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ void PCB_EDIT_FRAME::Begin_Self( wxDC* DC )
|
|||
|
||||
Self_On = 1;
|
||||
|
||||
/* Update the initial coordinates. */
|
||||
// Update the initial coordinates.
|
||||
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
|
||||
UpdateStatusBar();
|
||||
|
||||
|
@ -175,7 +175,7 @@ void PCB_EDIT_FRAME::Begin_Self( wxDC* DC )
|
|||
|
||||
MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
|
||||
{
|
||||
D_PAD* PtPad;
|
||||
D_PAD* pad;
|
||||
int ll;
|
||||
wxString msg;
|
||||
|
||||
|
@ -254,27 +254,28 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
|
|||
}
|
||||
|
||||
// Place a pad on each end of coil.
|
||||
PtPad = new D_PAD( module );
|
||||
pad = new D_PAD( module );
|
||||
|
||||
module->m_Pads.PushFront( PtPad );
|
||||
module->m_Pads.PushFront( pad );
|
||||
|
||||
PtPad->SetPadName( wxT( "1" ) );
|
||||
PtPad->m_Pos = Mself.m_End;
|
||||
PtPad->m_Pos0 = PtPad->m_Pos - module->m_Pos;
|
||||
PtPad->m_Size.x = PtPad->m_Size.y = Mself.m_Width;
|
||||
PtPad->m_layerMask = GetLayerMask( module->GetLayer() );
|
||||
PtPad->m_Attribut = PAD_SMD;
|
||||
PtPad->m_PadShape = PAD_CIRCLE;
|
||||
PtPad->ComputeShapeMaxRadius();
|
||||
pad->SetPadName( wxT( "1" ) );
|
||||
pad->SetPosition( Mself.m_End );
|
||||
pad->SetPos0( pad->GetPosition() - module->GetPosition() );
|
||||
|
||||
D_PAD* newpad = new D_PAD( *PtPad );
|
||||
pad->SetSize( wxSize( Mself.m_Width, Mself.m_Width ) );
|
||||
|
||||
module->m_Pads.Insert( newpad, PtPad->Next() );
|
||||
pad->SetLayerMask( GetLayerMask( module->GetLayer() ) );
|
||||
pad->SetAttribute( PAD_SMD );
|
||||
pad->SetShape( PAD_CIRCLE );
|
||||
|
||||
PtPad = newpad;
|
||||
PtPad->SetPadName( wxT( "2" ) );
|
||||
PtPad->m_Pos = Mself.m_Start;
|
||||
PtPad->m_Pos0 = PtPad->m_Pos - module->m_Pos;
|
||||
D_PAD* newpad = new D_PAD( *pad );
|
||||
|
||||
module->m_Pads.Insert( newpad, pad->Next() );
|
||||
|
||||
pad = newpad;
|
||||
pad->SetPadName( wxT( "2" ) );
|
||||
pad->SetPosition( Mself.m_Start );
|
||||
pad->SetPos0( pad->GetPosition() - module->GetPosition() );
|
||||
|
||||
// Modify text positions.
|
||||
module->DisplayInfo( this );
|
||||
|
@ -381,7 +382,7 @@ int BuildCornersList_S_Shape( std::vector <wxPoint>& aBuffer,
|
|||
*/
|
||||
wxSize size;
|
||||
|
||||
// This scale factor adjust the arc lenght to handle
|
||||
// This scale factor adjusts the arc length to handle
|
||||
// the arc to segment approximation.
|
||||
// because we use SEGM_COUNT_PER_360DEG segment to approximate a circle,
|
||||
// the trace len must be corrected when calculated using arcs
|
||||
|
@ -468,7 +469,7 @@ int BuildCornersList_S_Shape( std::vector <wxPoint>& aBuffer,
|
|||
aBuffer.push_back( pt );
|
||||
}
|
||||
|
||||
/* Create shape. */
|
||||
// Create shape.
|
||||
int ii;
|
||||
int sign = 1;
|
||||
segm_count += 1; // increase segm_count to create the last half_size segment
|
||||
|
@ -477,7 +478,7 @@ int BuildCornersList_S_Shape( std::vector <wxPoint>& aBuffer,
|
|||
{
|
||||
int arc_angle;
|
||||
|
||||
if( ii & 1 ) /* odd order arcs are greater than 0 */
|
||||
if( ii & 1 ) // odd order arcs are greater than 0
|
||||
sign = -1;
|
||||
else
|
||||
sign = 1;
|
||||
|
@ -548,21 +549,22 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveBasicShape( const wxString& name, int pad_c
|
|||
|
||||
module->m_Reference->m_Thickness = DEFAULT_SIZE / 4;
|
||||
|
||||
/* Create 2 pads used in gaps and stubs.
|
||||
* The gap is between these 2 pads
|
||||
* the stub is the pad 2
|
||||
*/
|
||||
// Create 2 pads used in gaps and stubs. The gap is between these 2 pads
|
||||
// the stub is the pad 2
|
||||
while( pad_count-- )
|
||||
{
|
||||
D_PAD* pad = new D_PAD( module );
|
||||
|
||||
module->m_Pads.PushFront( pad );
|
||||
|
||||
pad->m_Size.x = pad->m_Size.y = GetBoard()->GetCurrentTrackWidth();
|
||||
pad->m_Pos = module->m_Pos;
|
||||
pad->m_PadShape = PAD_RECT;
|
||||
pad->m_Attribut = PAD_SMD;
|
||||
pad->m_layerMask = LAYER_FRONT;
|
||||
int tw = GetBoard()->GetCurrentTrackWidth();
|
||||
pad->SetSize( wxSize( tw, tw ) );
|
||||
|
||||
pad->SetPosition( module->GetPosition() );
|
||||
pad->SetShape( PAD_RECT );
|
||||
pad->SetAttribute( PAD_SMD );
|
||||
pad->SetLayerMask( LAYER_FRONT );
|
||||
|
||||
Line.Printf( wxT( "%d" ), pad_num );
|
||||
pad->SetPadName( Line );
|
||||
pad_num++;
|
||||
|
@ -581,7 +583,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
|
|||
int pad_count = 2;
|
||||
int angle = 0;
|
||||
|
||||
/* Enter the size of the gap or stub*/
|
||||
// Enter the size of the gap or stub
|
||||
int gap_size = GetBoard()->GetCurrentTrackWidth();
|
||||
|
||||
switch( shape_type )
|
||||
|
@ -662,57 +664,61 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
|
|||
switch( shape_type )
|
||||
{
|
||||
case 0: //Gap :
|
||||
oX = pad->m_Pos0.x = -( gap_size + pad->m_Size.x ) / 2;
|
||||
pad->m_Pos.x += pad->m_Pos0.x;
|
||||
oX = -( gap_size + pad->GetSize().x ) / 2;
|
||||
pad->SetX0( oX );
|
||||
|
||||
pad->SetX( pad->GetPos0().x + pad->GetPosition().x );
|
||||
|
||||
pad = pad->Next();
|
||||
pad->m_Pos0.x = oX + gap_size + pad->m_Size.x;
|
||||
pad->m_Pos.x += pad->m_Pos0.x;
|
||||
|
||||
pad->SetX0( oX + gap_size + pad->GetSize().x );
|
||||
pad->SetX( pad->GetPos0().x + pad->GetPosition().x );
|
||||
break;
|
||||
|
||||
case 1: //Stub :
|
||||
pad->SetPadName( wxT( "1" ) );
|
||||
pad = pad->Next();
|
||||
pad->m_Pos0.y = -( gap_size + pad->m_Size.y ) / 2;
|
||||
pad->m_Size.y = gap_size;
|
||||
pad->m_Pos.y += pad->m_Pos0.y;
|
||||
pad->SetY0( -( gap_size + pad->GetSize().y ) / 2 );
|
||||
pad->SetSize( wxSize( pad->GetSize().x, gap_size ) );
|
||||
pad->SetY( pad->GetPos0().y + pad->GetPosition().y );
|
||||
break;
|
||||
|
||||
case 2: // Arc Stub created by a polygonal approach:
|
||||
{
|
||||
EDGE_MODULE* edge = new EDGE_MODULE( module );
|
||||
module->m_Drawings.PushFront( edge );
|
||||
|
||||
edge->SetShape( S_POLYGON );
|
||||
edge->SetLayer( LAYER_N_FRONT );
|
||||
|
||||
int numPoints = angle / 50 + 3; // Note: angles are in 0.1 degrees
|
||||
std::vector<wxPoint> polyPoints = edge->GetPolyPoints();
|
||||
polyPoints.reserve( numPoints );
|
||||
|
||||
edge->m_Start0.y = -pad->m_Size.y / 2;
|
||||
|
||||
polyPoints.push_back( wxPoint( 0, 0 ) );
|
||||
|
||||
int theta = -angle / 2;
|
||||
|
||||
for( int ii = 1; ii<numPoints - 1; ii++ )
|
||||
{
|
||||
wxPoint pt( 0, -gap_size );
|
||||
EDGE_MODULE* edge = new EDGE_MODULE( module );
|
||||
module->m_Drawings.PushFront( edge );
|
||||
|
||||
RotatePoint( &pt.x, &pt.y, theta );
|
||||
edge->SetShape( S_POLYGON );
|
||||
edge->SetLayer( LAYER_N_FRONT );
|
||||
|
||||
polyPoints.push_back( pt );
|
||||
int numPoints = angle / 50 + 3; // Note: angles are in 0.1 degrees
|
||||
std::vector<wxPoint> polyPoints = edge->GetPolyPoints();
|
||||
polyPoints.reserve( numPoints );
|
||||
|
||||
theta += 50;
|
||||
edge->m_Start0.y = -pad->GetSize().y / 2;
|
||||
|
||||
if( theta > angle / 2 )
|
||||
theta = angle / 2;
|
||||
polyPoints.push_back( wxPoint( 0, 0 ) );
|
||||
|
||||
int theta = -angle / 2;
|
||||
|
||||
for( int ii = 1; ii<numPoints - 1; ii++ )
|
||||
{
|
||||
wxPoint pt( 0, -gap_size );
|
||||
|
||||
RotatePoint( &pt.x, &pt.y, theta );
|
||||
|
||||
polyPoints.push_back( pt );
|
||||
|
||||
theta += 50;
|
||||
|
||||
if( theta > angle / 2 )
|
||||
theta = angle / 2;
|
||||
}
|
||||
|
||||
// Close the polygon:
|
||||
polyPoints.push_back( polyPoints[0] );
|
||||
}
|
||||
|
||||
// Close the polygon:
|
||||
polyPoints.push_back( polyPoints[0] );
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -873,7 +879,7 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event )
|
|||
|
||||
FILTER_READER reader( fileReader );
|
||||
|
||||
SetLocaleTo_C_standard();
|
||||
LOCALE_IO toggle;
|
||||
|
||||
while( reader.ReadLine() )
|
||||
{
|
||||
|
@ -920,8 +926,6 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event )
|
|||
}
|
||||
}
|
||||
|
||||
SetLocaleTo_Default(); // revert to the current locale
|
||||
|
||||
ShapeScaleX *= unitconv;
|
||||
ShapeScaleY *= unitconv;
|
||||
|
||||
|
@ -973,12 +977,12 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
|
|||
module = Create_MuWaveBasicShape( cmp_name, pad_count );
|
||||
pad1 = module->m_Pads;
|
||||
|
||||
pad1->m_Pos0.x = -ShapeSize.x / 2;
|
||||
pad1->m_Pos.x += pad1->m_Pos0.x;
|
||||
pad1->SetX0( -ShapeSize.x / 2 );
|
||||
pad1->SetX( pad1->GetPos0().x + pad1->GetPosition().x );
|
||||
|
||||
pad2 = (D_PAD*) pad1->Next();
|
||||
pad2->m_Pos0.x = pad1->m_Pos0.x + ShapeSize.x;
|
||||
pad2->m_Pos.x += pad2->m_Pos0.x;
|
||||
pad2->SetX0( pad1->GetPos0().x + ShapeSize.x );
|
||||
pad2->SetX( pad2->GetPos0().x + pad2->GetPosition().x );
|
||||
|
||||
edge = new EDGE_MODULE( module );
|
||||
|
||||
|
@ -991,13 +995,13 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
|
|||
polyPoints.reserve( 2 * PolyEdges.size() + 2 );
|
||||
|
||||
// Init start point coord:
|
||||
polyPoints.push_back( wxPoint( pad1->m_Pos0.x, 0 ) );
|
||||
polyPoints.push_back( wxPoint( pad1->GetPos0().x, 0 ) );
|
||||
|
||||
wxPoint first_coordinate, last_coordinate;
|
||||
|
||||
for( unsigned ii = 0; ii < PolyEdges.size(); ii++ ) // Copy points
|
||||
{
|
||||
last_coordinate.x = wxRound( PolyEdges[ii] * ShapeScaleX ) + pad1->m_Pos0.x;
|
||||
last_coordinate.x = wxRound( PolyEdges[ii] * ShapeScaleX ) + pad1->GetPos0().x;
|
||||
last_coordinate.y = -wxRound( PolyEdges[ii] * ShapeScaleY );
|
||||
polyPoints.push_back( last_coordinate );
|
||||
}
|
||||
|
@ -1008,16 +1012,19 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
|
|||
{
|
||||
case 0: // Single
|
||||
case 2: // Single mirrored
|
||||
|
||||
// Init end point coord:
|
||||
pad2->m_Pos0.x = last_coordinate.x;
|
||||
pad2->SetX0( last_coordinate.x );
|
||||
polyPoints.push_back( wxPoint( last_coordinate.x, 0 ) );
|
||||
|
||||
pad1->m_Size.x = pad1->m_Size.y = ABS( first_coordinate.y );
|
||||
pad2->m_Size.x = pad2->m_Size.y = ABS( last_coordinate.y );
|
||||
pad1->m_Pos0.y = first_coordinate.y / 2;
|
||||
pad2->m_Pos0.y = last_coordinate.y / 2;
|
||||
pad1->m_Pos.y = pad1->m_Pos0.y + module->m_Pos.y;
|
||||
pad2->m_Pos.y = pad2->m_Pos0.y + module->m_Pos.y;
|
||||
pad1->SetSize( wxSize( ABS( first_coordinate.y ), ABS( first_coordinate.y ) ) );
|
||||
pad2->SetSize( wxSize( ABS( last_coordinate.y ), ABS( last_coordinate.y ) ) );
|
||||
|
||||
pad1->SetY0( first_coordinate.y / 2 );
|
||||
pad2->SetY0( last_coordinate.y / 2 );
|
||||
|
||||
pad1->SetY( pad1->GetPos0().y + module->GetPosition().y );
|
||||
pad2->SetY( pad2->GetPos0().y + module->GetPosition().y );
|
||||
break;
|
||||
|
||||
case 1: // Symmetric
|
||||
|
@ -1030,8 +1037,8 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
|
|||
polyPoints.push_back( pt );
|
||||
}
|
||||
|
||||
pad1->m_Size.x = pad1->m_Size.y = 2 * ABS( first_coordinate.y );
|
||||
pad2->m_Size.x = pad2->m_Size.y = 2 * ABS( last_coordinate.y );
|
||||
pad1->SetSize( wxSize( 2 * ABS( first_coordinate.y ), 2 * ABS( first_coordinate.y ) ) );
|
||||
pad2->SetSize( wxSize( 2 * ABS( last_coordinate.y ), 2 * ABS( last_coordinate.y ) ) );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1043,22 +1050,22 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
|
|||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::Edit_Gap( wxDC* DC, MODULE* Module )
|
||||
void PCB_EDIT_FRAME::Edit_Gap( wxDC* DC, MODULE* aModule )
|
||||
{
|
||||
int gap_size, oX;
|
||||
D_PAD* pad, * next_pad;
|
||||
wxString msg;
|
||||
|
||||
if( Module == NULL )
|
||||
if( aModule == NULL )
|
||||
return;
|
||||
|
||||
/* Test if module is a gap type (name begins with GAP, and has 2 pads). */
|
||||
msg = Module->m_Reference->m_Text.Left( 3 );
|
||||
// Test if module is a gap type (name begins with GAP, and has 2 pads).
|
||||
msg = aModule->m_Reference->m_Text.Left( 3 );
|
||||
|
||||
if( msg != wxT( "GAP" ) )
|
||||
return;
|
||||
|
||||
pad = Module->m_Pads;
|
||||
pad = aModule->m_Pads;
|
||||
|
||||
if( pad == NULL )
|
||||
{
|
||||
|
@ -1074,12 +1081,12 @@ void PCB_EDIT_FRAME::Edit_Gap( wxDC* DC, MODULE* Module )
|
|||
return;
|
||||
}
|
||||
|
||||
Module->Draw( m_canvas, DC, GR_XOR );
|
||||
aModule->Draw( m_canvas, DC, GR_XOR );
|
||||
|
||||
/* Calculate the current dimension. */
|
||||
gap_size = next_pad->m_Pos0.x - pad->m_Pos0.x - pad->m_Size.x;
|
||||
// Calculate the current dimension.
|
||||
gap_size = next_pad->GetPos0().x - pad->GetPos0().x - pad->GetSize().x;
|
||||
|
||||
/* Entrer the desired length of the gap. */
|
||||
// Entrer the desired length of the gap.
|
||||
msg = ReturnStringFromValue( g_UserUnit, gap_size, GetScreen()->GetInternalUnits() );
|
||||
wxTextEntryDialog dlg( this, _( "Gap:" ), _( "Create Microwave Gap" ), msg );
|
||||
|
||||
|
@ -1089,22 +1096,33 @@ void PCB_EDIT_FRAME::Edit_Gap( wxDC* DC, MODULE* Module )
|
|||
msg = dlg.GetValue();
|
||||
gap_size = ReturnValueFromString( g_UserUnit, msg, GetScreen()->GetInternalUnits() );
|
||||
|
||||
/* Updating sizes of pads forming the gap. */
|
||||
pad->m_Size.x = pad->m_Size.y = GetBoard()->GetCurrentTrackWidth();
|
||||
pad->m_Pos0.y = 0;
|
||||
oX = pad->m_Pos0.x = -( (gap_size + pad->m_Size.x) / 2 );
|
||||
pad->m_Pos.x = pad->m_Pos0.x + Module->m_Pos.x;
|
||||
pad->m_Pos.y = pad->m_Pos0.y + Module->m_Pos.y;
|
||||
RotatePoint( &pad->m_Pos.x, &pad->m_Pos.y,
|
||||
Module->m_Pos.x, Module->m_Pos.y, Module->m_Orient );
|
||||
// Updating sizes of pads forming the gap.
|
||||
int tw = GetBoard()->GetCurrentTrackWidth();
|
||||
pad->SetSize( wxSize( tw, tw ) );
|
||||
|
||||
next_pad->m_Size.x = next_pad->m_Size.y = GetBoard()->GetCurrentTrackWidth();
|
||||
next_pad->m_Pos0.y = 0;
|
||||
next_pad->m_Pos0.x = oX + gap_size + next_pad->m_Size.x;
|
||||
next_pad->m_Pos.x = next_pad->m_Pos0.x + Module->m_Pos.x;
|
||||
next_pad->m_Pos.y = next_pad->m_Pos0.y + Module->m_Pos.y;
|
||||
RotatePoint( &next_pad->m_Pos.x, &next_pad->m_Pos.y,
|
||||
Module->m_Pos.x, Module->m_Pos.y, Module->m_Orient );
|
||||
pad->SetY0( 0 );
|
||||
oX = -( gap_size + pad->GetSize().x ) / 2;
|
||||
pad->SetX0( oX );
|
||||
|
||||
Module->Draw( m_canvas, DC, GR_OR );
|
||||
wxPoint padpos = pad->GetPos0() + aModule->GetPosition();
|
||||
|
||||
RotatePoint( &padpos.x, &padpos.y,
|
||||
aModule->m_Pos.x, aModule->m_Pos.y, aModule->GetOrientation() );
|
||||
|
||||
pad->SetPosition( padpos );
|
||||
|
||||
tw = GetBoard()->GetCurrentTrackWidth();
|
||||
next_pad->SetSize( wxSize( tw, tw ) );
|
||||
|
||||
next_pad->SetY0( 0 );
|
||||
next_pad->SetX0( oX + gap_size + next_pad->GetSize().x );
|
||||
|
||||
padpos = next_pad->GetPos0() + aModule->GetPosition();
|
||||
|
||||
RotatePoint( &padpos.x, &padpos.y,
|
||||
aModule->m_Pos.x, aModule->m_Pos.y, aModule->GetOrientation() );
|
||||
|
||||
next_pad->SetPosition( padpos );
|
||||
|
||||
aModule->Draw( m_canvas, DC, GR_OR );
|
||||
}
|
||||
|
|
|
@ -219,57 +219,18 @@ void PCB_EDIT_FRAME::SaveProjectSettings()
|
|||
PARAM_CFG_ARRAY PCB_EDIT_FRAME::GetProjectFileParameters()
|
||||
{
|
||||
PARAM_CFG_ARRAY pca;
|
||||
BOARD_DESIGN_SETTINGS& bds = GetBoard()->GetDesignSettings();
|
||||
|
||||
pca.push_back( new PARAM_CFG_FILENAME( wxT( "LibDir" ),&g_UserLibDirBuffer,
|
||||
GROUPLIB ) );
|
||||
pca.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ),
|
||||
&g_LibraryNames,
|
||||
GROUPLIB ) );
|
||||
pca.push_back( new PARAM_CFG_INT( wxT( "PadDrlX" ), &g_Pad_Master.m_Drill.x,
|
||||
320, 0, 0x7FFF ) );
|
||||
pca.push_back( new PARAM_CFG_INT( wxT( "PadDimH" ), &g_Pad_Master.m_Size.x,
|
||||
550, 0, 0x7FFF ) );
|
||||
pca.push_back( new PARAM_CFG_INT( wxT( "PadDimV" ), &g_Pad_Master.m_Size.y,
|
||||
550, 0, 0x7FFF ) );
|
||||
|
||||
pca.push_back( new PARAM_CFG_INT( wxT( "BoardThickness" ),
|
||||
&bds.m_BoardThickness,
|
||||
630, 0, 0xFFFF ) );
|
||||
|
||||
pca.push_back( new PARAM_CFG_INT( wxT( "TxtPcbV" ),
|
||||
&bds.m_PcbTextSize.y,
|
||||
600, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) );
|
||||
|
||||
pca.push_back( new PARAM_CFG_INT( wxT( "TxtPcbH" ),
|
||||
&bds.m_PcbTextSize.x,
|
||||
600, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) );
|
||||
|
||||
pca.push_back( new PARAM_CFG_INT( wxT( "TxtModV" ), &bds.m_ModuleTextSize.y,
|
||||
500, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) );
|
||||
pca.push_back( new PARAM_CFG_INT( wxT( "TxtModH" ), &bds.m_ModuleTextSize.x,
|
||||
500, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) );
|
||||
pca.push_back( new PARAM_CFG_INT( wxT( "TxtModW" ), &bds.m_ModuleTextWidth,
|
||||
100, 1, TEXTS_MAX_WIDTH ) );
|
||||
|
||||
pca.push_back( new PARAM_CFG_INT( wxT( "VEgarde" ),
|
||||
&bds.m_SolderMaskMargin,
|
||||
100, 0, 10000 ) );
|
||||
|
||||
pca.push_back( new PARAM_CFG_INT( wxT( "DrawLar" ),
|
||||
&bds.m_DrawSegmentWidth,
|
||||
120, 0, 0xFFFF ) );
|
||||
|
||||
pca.push_back( new PARAM_CFG_INT( wxT( "EdgeLar" ),
|
||||
&bds.m_EdgeSegmentWidth,
|
||||
120, 0, 0xFFFF ) );
|
||||
pca.push_back( new PARAM_CFG_INT( wxT( "TxtLar" ),
|
||||
&bds.m_PcbTextWidth,
|
||||
120, 0, 0xFFFF ) );
|
||||
pca.push_back( new PARAM_CFG_INT( wxT( "MSegLar" ), &bds.m_ModuleSegmentWidth,
|
||||
120, 0, 0xFFFF ) );
|
||||
pca.push_back( new PARAM_CFG_FILENAME( wxT( "LastNetListRead" ),
|
||||
&m_lastNetListRead ) );
|
||||
|
||||
GetBoard()->GetDesignSettings().AppendConfigs( &pca );
|
||||
|
||||
return pca;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,29 +3,29 @@
|
|||
* @brief Common plot routines.
|
||||
*/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "common.h"
|
||||
#include "plot_common.h"
|
||||
#include "base_struct.h"
|
||||
#include "drawtxt.h"
|
||||
#include "confirm.h"
|
||||
#include "trigo.h"
|
||||
#include "wxBasePcbFrame.h"
|
||||
#include "pcbcommon.h"
|
||||
#include "macros.h"
|
||||
#include <fctsys.h>
|
||||
#include <common.h>
|
||||
#include <plot_common.h>
|
||||
#include <base_struct.h>
|
||||
#include <drawtxt.h>
|
||||
#include <confirm.h>
|
||||
#include <trigo.h>
|
||||
#include <wxBasePcbFrame.h>
|
||||
#include <pcbcommon.h>
|
||||
#include <macros.h>
|
||||
|
||||
#include "class_board.h"
|
||||
#include "class_module.h"
|
||||
#include "class_track.h"
|
||||
#include "class_edge_mod.h"
|
||||
#include "class_pcb_text.h"
|
||||
#include "class_zone.h"
|
||||
#include "class_drawsegment.h"
|
||||
#include "class_mire.h"
|
||||
#include "class_dimension.h"
|
||||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
#include <class_track.h>
|
||||
#include <class_edge_mod.h>
|
||||
#include <class_pcb_text.h>
|
||||
#include <class_zone.h>
|
||||
#include <class_drawsegment.h>
|
||||
#include <class_mire.h>
|
||||
#include <class_dimension.h>
|
||||
|
||||
#include "pcbnew.h"
|
||||
#include "pcbplot.h"
|
||||
#include <pcbnew.h>
|
||||
#include <pcbplot.h>
|
||||
|
||||
static void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int aLayerMask,
|
||||
EDA_DRAW_MODE_T trace_mode );
|
||||
|
@ -45,28 +45,27 @@ void PCB_BASE_FRAME::PlotSilkScreen( PLOTTER* plotter, int aLayerMask, EDA_DRAW_
|
|||
{
|
||||
bool trace_val, trace_ref;
|
||||
TEXTE_MODULE* pt_texte;
|
||||
EDA_ITEM* PtStruct;
|
||||
|
||||
/* Plot edge layer and graphic items */
|
||||
// Plot edge layer and graphic items
|
||||
|
||||
for( PtStruct = m_Pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
||||
for( EDA_ITEM* item = m_Pcb->m_Drawings; item; item = item->Next() )
|
||||
{
|
||||
switch( PtStruct->Type() )
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_LINE_T:
|
||||
PlotDrawSegment( plotter, (DRAWSEGMENT*) PtStruct, aLayerMask, trace_mode );
|
||||
PlotDrawSegment( plotter, (DRAWSEGMENT*) item, aLayerMask, trace_mode );
|
||||
break;
|
||||
|
||||
case PCB_TEXT_T:
|
||||
PlotTextePcb( plotter, (TEXTE_PCB*) PtStruct, aLayerMask, trace_mode );
|
||||
PlotTextePcb( plotter, (TEXTE_PCB*) item, aLayerMask, trace_mode );
|
||||
break;
|
||||
|
||||
case PCB_DIMENSION_T:
|
||||
PlotDimension( plotter, (DIMENSION*) PtStruct, aLayerMask, trace_mode );
|
||||
PlotDimension( plotter, (DIMENSION*) item, aLayerMask, trace_mode );
|
||||
break;
|
||||
|
||||
case PCB_TARGET_T:
|
||||
PlotPcbTarget( plotter, (PCB_TARGET*) PtStruct, aLayerMask, trace_mode );
|
||||
PlotPcbTarget( plotter, (PCB_TARGET*) item, aLayerMask, trace_mode );
|
||||
break;
|
||||
|
||||
case PCB_MARKER_T:
|
||||
|
@ -78,10 +77,10 @@ void PCB_BASE_FRAME::PlotSilkScreen( PLOTTER* plotter, int aLayerMask, EDA_DRAW_
|
|||
}
|
||||
}
|
||||
|
||||
/* Plot footprint outlines : */
|
||||
// Plot footprint outlines :
|
||||
Plot_Edges_Modules( plotter, m_Pcb, aLayerMask, trace_mode );
|
||||
|
||||
/* Plot pads (creates pads outlines, for pads on silkscreen layers) */
|
||||
// Plot pads (creates pads outlines, for pads on silkscreen layers)
|
||||
int layersmask_plotpads = aLayerMask;
|
||||
// Calculate the mask layers of allowed layers for pads
|
||||
|
||||
|
@ -94,43 +93,43 @@ void PCB_BASE_FRAME::PlotSilkScreen( PLOTTER* plotter, int aLayerMask, EDA_DRAW_
|
|||
{
|
||||
for( D_PAD * pad = Module->m_Pads; pad != NULL; pad = pad->Next() )
|
||||
{
|
||||
/* See if the pad is on this layer */
|
||||
if( (pad->m_layerMask & layersmask_plotpads) == 0 )
|
||||
// See if the pad is on this layer
|
||||
if( (pad->GetLayerMask() & layersmask_plotpads) == 0 )
|
||||
continue;
|
||||
|
||||
wxPoint shape_pos = pad->ReturnShapePos();
|
||||
|
||||
switch( pad->m_PadShape & 0x7F )
|
||||
switch( pad->GetShape() )
|
||||
{
|
||||
case PAD_CIRCLE:
|
||||
plotter->flash_pad_circle( shape_pos, pad->m_Size.x, LINE );
|
||||
plotter->flash_pad_circle( shape_pos, pad->GetSize().x, LINE );
|
||||
break;
|
||||
|
||||
case PAD_OVAL:
|
||||
plotter->flash_pad_oval( shape_pos, pad->m_Size, pad->m_Orient, LINE );
|
||||
plotter->flash_pad_oval( shape_pos, pad->GetSize(), pad->GetOrientation(), LINE );
|
||||
break;
|
||||
|
||||
case PAD_TRAPEZOID:
|
||||
{
|
||||
wxPoint coord[4];
|
||||
pad->BuildPadPolygon( coord, wxSize(0,0), 0 );
|
||||
plotter->flash_pad_trapez( shape_pos, coord, pad->m_Orient, LINE );
|
||||
{
|
||||
wxPoint coord[4];
|
||||
pad->BuildPadPolygon( coord, wxSize(0,0), 0 );
|
||||
plotter->flash_pad_trapez( shape_pos, coord, pad->GetOrientation(), LINE );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case PAD_RECT:
|
||||
default:
|
||||
plotter->flash_pad_rect( shape_pos, pad->m_Size, pad->m_Orient, LINE );
|
||||
plotter->flash_pad_rect( shape_pos, pad->GetSize(), pad->GetOrientation(), LINE );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Plot footprints fields (ref, value ...) */
|
||||
// Plot footprints fields (ref, value ...)
|
||||
for( MODULE* Module = m_Pcb->m_Modules; Module; Module = Module->Next() )
|
||||
{
|
||||
/* see if we want to plot VALUE and REF fields */
|
||||
// see if we want to plot VALUE and REF fields
|
||||
trace_val = g_PcbPlotOptions.m_PlotValue;
|
||||
trace_ref = g_PcbPlotOptions.m_PlotReference;
|
||||
|
||||
|
@ -174,7 +173,7 @@ module\n %s's \"value\" text." ),
|
|||
if( !text->IsVisible() && !g_PcbPlotOptions.m_PlotInvisibleTexts )
|
||||
trace_val = false;
|
||||
|
||||
/* Plot text fields, if allowed */
|
||||
// Plot text fields, if allowed
|
||||
if( trace_ref )
|
||||
PlotTextModule( plotter, Module->m_Reference, trace_mode );
|
||||
|
||||
|
@ -215,7 +214,7 @@ for module\n %s's \"module text\" text of %s." ),
|
|||
}
|
||||
}
|
||||
|
||||
/* Plot filled areas */
|
||||
// Plot filled areas
|
||||
for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
|
||||
{
|
||||
ZONE_CONTAINER* edge_zone = m_Pcb->GetArea( ii );
|
||||
|
@ -244,7 +243,7 @@ static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte, EDA_DRAW_M
|
|||
wxPoint pos;
|
||||
int orient, thickness;
|
||||
|
||||
/* calculate some text parameters :*/
|
||||
// calculate some text parameters :
|
||||
size = pt_texte->m_Size;
|
||||
pos = pt_texte->m_Pos;
|
||||
|
||||
|
@ -360,7 +359,7 @@ void PlotPcbTarget( PLOTTER* plotter, PCB_TARGET* aMire, int aLayerMask,
|
|||
}
|
||||
|
||||
|
||||
/* Plot footprints graphic items (outlines) */
|
||||
// Plot footprints graphic items (outlines)
|
||||
void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int aLayerMask, EDA_DRAW_MODE_T trace_mode )
|
||||
{
|
||||
for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
|
||||
|
@ -381,7 +380,7 @@ void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int aLayerMask, EDA_DRAW_
|
|||
}
|
||||
|
||||
|
||||
/** Plot a graphic item (outline) relative to a footprint */
|
||||
//* Plot a graphic item (outline) relative to a footprint
|
||||
void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* aEdge, EDA_DRAW_MODE_T trace_mode, int masque_layer )
|
||||
{
|
||||
int type_trace; // Type of item to plot.
|
||||
|
@ -419,7 +418,7 @@ void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* aEdge, EDA_DRAW_MODE_T tr
|
|||
double endAngle = startAngle + aEdge->GetAngle();
|
||||
|
||||
if ( ( g_PcbPlotOptions.GetPlotFormat() == PLOT_FORMAT_DXF ) &&
|
||||
( masque_layer & ( SILKSCREEN_LAYER_BACK | DRAW_LAYER | COMMENT_LAYER ) ) )
|
||||
( masque_layer & ( SILKSCREEN_LAYER_BACK | DRAW_LAYER | COMMENT_LAYER ) ) )
|
||||
plotter->thick_arc( pos,
|
||||
-startAngle,
|
||||
-endAngle,
|
||||
|
@ -471,7 +470,7 @@ void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* aEdge, EDA_DRAW_MODE_T tr
|
|||
}
|
||||
|
||||
|
||||
/* Plot a PCB Text, i;e. a text found on a copper or technical layer */
|
||||
// Plot a PCB Text, i;e. a text found on a copper or technical layer
|
||||
void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int aLayerMask,
|
||||
EDA_DRAW_MODE_T trace_mode )
|
||||
{
|
||||
|
@ -791,7 +790,7 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter,
|
|||
}
|
||||
}
|
||||
|
||||
/* Draw footprint shapes without pads (pads will plotted later) */
|
||||
// Draw footprint shapes without pads (pads will plotted later)
|
||||
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
for( BOARD_ITEM* item = module->m_Drawings; item; item = item->Next() )
|
||||
|
@ -810,14 +809,14 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter,
|
|||
}
|
||||
}
|
||||
|
||||
/* Plot footprint pads */
|
||||
// Plot footprint pads
|
||||
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
|
||||
{
|
||||
wxPoint shape_pos;
|
||||
|
||||
if( (pad->m_layerMask & aLayerMask) == 0 )
|
||||
if( (pad->GetLayerMask() & aLayerMask) == 0 )
|
||||
continue;
|
||||
|
||||
shape_pos = pad->ReturnShapePos();
|
||||
|
@ -848,19 +847,19 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter,
|
|||
break;
|
||||
}
|
||||
|
||||
size.x = pad->m_Size.x + ( 2 * margin.x ) + width_adj;
|
||||
size.y = pad->m_Size.y + ( 2 * margin.y ) + width_adj;
|
||||
size.x = pad->GetSize().x + ( 2 * margin.x ) + width_adj;
|
||||
size.y = pad->GetSize().y + ( 2 * margin.y ) + width_adj;
|
||||
|
||||
/* Don't draw a null size item : */
|
||||
// Don't draw a null size item :
|
||||
if( size.x <= 0 || size.y <= 0 )
|
||||
continue;
|
||||
|
||||
switch( pad->m_PadShape )
|
||||
switch( pad->GetShape() )
|
||||
{
|
||||
case PAD_CIRCLE:
|
||||
if( aSkipNPTH_Pads &&
|
||||
(pad->m_Size == pad->m_Drill) &&
|
||||
(pad->m_Attribut == PAD_HOLE_NOT_PLATED) )
|
||||
(pad->GetSize() == pad->GetDrillSize()) &&
|
||||
(pad->GetAttribute() == PAD_HOLE_NOT_PLATED) )
|
||||
break;
|
||||
|
||||
aPlotter->flash_pad_circle( pos, size.x, aPlotMode );
|
||||
|
@ -868,30 +867,30 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter,
|
|||
|
||||
case PAD_OVAL:
|
||||
if( aSkipNPTH_Pads &&
|
||||
(pad->m_Size == pad->m_Drill) &&
|
||||
(pad->m_Attribut == PAD_HOLE_NOT_PLATED) )
|
||||
(pad->GetSize() == pad->GetDrillSize()) &&
|
||||
(pad->GetAttribute() == PAD_HOLE_NOT_PLATED) )
|
||||
break;
|
||||
|
||||
aPlotter->flash_pad_oval( pos, size, pad->m_Orient, aPlotMode );
|
||||
aPlotter->flash_pad_oval( pos, size, pad->GetOrientation(), aPlotMode );
|
||||
break;
|
||||
|
||||
case PAD_TRAPEZOID:
|
||||
{
|
||||
wxPoint coord[4];
|
||||
pad->BuildPadPolygon( coord, margin, 0 );
|
||||
aPlotter->flash_pad_trapez( pos, coord, pad->m_Orient, aPlotMode );
|
||||
aPlotter->flash_pad_trapez( pos, coord, pad->GetOrientation(), aPlotMode );
|
||||
}
|
||||
break;
|
||||
|
||||
case PAD_RECT:
|
||||
default:
|
||||
aPlotter->flash_pad_rect( pos, size, pad->m_Orient, aPlotMode );
|
||||
aPlotter->flash_pad_rect( pos, size, pad->GetOrientation(), aPlotMode );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Plot vias : */
|
||||
// Plot vias :
|
||||
if( aPlotVia )
|
||||
{
|
||||
for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() )
|
||||
|
@ -931,7 +930,7 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter,
|
|||
pos = Via->m_Start;
|
||||
size.x = size.y = Via->m_Width + 2 * via_margin + width_adj;
|
||||
|
||||
/* Don't draw a null size item : */
|
||||
// Don't draw a null size item :
|
||||
if( size.x <= 0 )
|
||||
continue;
|
||||
|
||||
|
@ -939,7 +938,7 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter,
|
|||
}
|
||||
}
|
||||
|
||||
/* Plot tracks (not vias) : */
|
||||
// Plot tracks (not vias) :
|
||||
for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() )
|
||||
{
|
||||
wxPoint end;
|
||||
|
@ -957,7 +956,7 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter,
|
|||
aPlotter->thick_segment( pos, end, size.x, aPlotMode );
|
||||
}
|
||||
|
||||
/* Plot zones (outdated, for old boards compatibility): */
|
||||
// Plot zones (outdated, for old boards compatibility):
|
||||
for( TRACK* track = m_Pcb->m_Zone; track; track = track->Next() )
|
||||
{
|
||||
wxPoint end;
|
||||
|
@ -972,7 +971,7 @@ void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter,
|
|||
aPlotter->thick_segment( pos, end, size.x, aPlotMode );
|
||||
}
|
||||
|
||||
/* Plot filled ares */
|
||||
// Plot filled ares
|
||||
for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
|
||||
{
|
||||
ZONE_CONTAINER* edge_zone = m_Pcb->GetArea( ii );
|
||||
|
@ -1003,7 +1002,7 @@ void PCB_BASE_FRAME::PlotDrillMark( PLOTTER* aPlotter,
|
|||
wxPoint pos;
|
||||
wxSize diam;
|
||||
MODULE* Module;
|
||||
D_PAD* PtPad;
|
||||
D_PAD* pad;
|
||||
TRACK* pts;
|
||||
|
||||
if( aTraceMode == FILLED )
|
||||
|
@ -1017,13 +1016,13 @@ void PCB_BASE_FRAME::PlotDrillMark( PLOTTER* aPlotter,
|
|||
continue;
|
||||
|
||||
pos = pts->m_Start;
|
||||
|
||||
|
||||
// It is quite possible that the real drill value is less then small drill value.
|
||||
if( g_PcbPlotOptions.m_DrillShapeOpt == PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE )
|
||||
diam.x = diam.y = MIN( SMALL_DRILL, pts->GetDrillValue() );
|
||||
else
|
||||
diam.x = diam.y = pts->GetDrillValue();
|
||||
|
||||
|
||||
diam.x -= aPlotter->get_plot_width_adj();
|
||||
diam.x = doIntValueFitToBand( diam.x, 1, pts->m_Width - 1 );
|
||||
aPlotter->flash_pad_circle( pos, diam.x, aTraceMode );
|
||||
|
@ -1031,29 +1030,29 @@ void PCB_BASE_FRAME::PlotDrillMark( PLOTTER* aPlotter,
|
|||
|
||||
for( Module = m_Pcb->m_Modules; Module != NULL; Module = Module->Next() )
|
||||
{
|
||||
for( PtPad = Module->m_Pads; PtPad != NULL; PtPad = PtPad->Next() )
|
||||
for( pad = Module->m_Pads; pad != NULL; pad = pad->Next() )
|
||||
{
|
||||
if( PtPad->m_Drill.x == 0 )
|
||||
if( pad->GetDrillSize().x == 0 )
|
||||
continue;
|
||||
|
||||
// Output hole shapes:
|
||||
pos = PtPad->m_Pos;
|
||||
pos = pad->GetPosition();
|
||||
|
||||
if( PtPad->m_DrillShape == PAD_OVAL )
|
||||
if( pad->GetDrillShape() == PAD_OVAL )
|
||||
{
|
||||
diam = PtPad->m_Drill;
|
||||
diam = pad->GetDrillSize();
|
||||
diam.x -= aPlotter->get_plot_width_adj();
|
||||
diam.x = doIntValueFitToBand( diam.x, 1, PtPad->m_Size.x - 1 );
|
||||
diam.x = doIntValueFitToBand( diam.x, 1, pad->GetSize().x - 1 );
|
||||
diam.y -= aPlotter->get_plot_width_adj();
|
||||
diam.y = doIntValueFitToBand( diam.y, 1, PtPad->m_Size.y - 1 );
|
||||
aPlotter->flash_pad_oval( pos, diam, PtPad->m_Orient, aTraceMode );
|
||||
diam.y = doIntValueFitToBand( diam.y, 1, pad->GetSize().y - 1 );
|
||||
aPlotter->flash_pad_oval( pos, diam, pad->GetOrientation(), aTraceMode );
|
||||
}
|
||||
else
|
||||
{
|
||||
// It is quite possible that the real pad drill value is less then small drill value.
|
||||
diam.x = aSmallDrillShape ? MIN( SMALL_DRILL, PtPad->m_Drill.x ) : PtPad->m_Drill.x;
|
||||
diam.x = aSmallDrillShape ? MIN( SMALL_DRILL, pad->GetDrillSize().x ) : pad->GetDrillSize().x;
|
||||
diam.x -= aPlotter->get_plot_width_adj();
|
||||
diam.x = doIntValueFitToBand( diam.x, 1, PtPad->m_Size.x - 1 );
|
||||
diam.x = doIntValueFitToBand( diam.x, 1, pad->GetSize().x - 1 );
|
||||
aPlotter->flash_pad_circle( pos, diam.x, aTraceMode );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -198,7 +198,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
|
|||
if( GetGRForceBlackPenState() == false )
|
||||
drawmode = GR_OR;
|
||||
|
||||
/* Print the pcb graphic items (texts, ...) */
|
||||
// Print the pcb graphic items (texts, ...)
|
||||
GRSetDrawMode( aDC, drawmode );
|
||||
|
||||
for( BOARD_ITEM* item = Pcb->m_Drawings; item; item = item->Next() )
|
||||
|
@ -221,7 +221,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
|
|||
}
|
||||
}
|
||||
|
||||
/* Print tracks */
|
||||
// Print tracks
|
||||
pt_trace = Pcb->m_Track;
|
||||
|
||||
for( ; pt_trace != NULL; pt_trace = pt_trace->Next() )
|
||||
|
@ -229,7 +229,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
|
|||
if( ( aPrintMaskLayer & pt_trace->ReturnMaskLayer() ) == 0 )
|
||||
continue;
|
||||
|
||||
if( pt_trace->Type() == PCB_VIA_T ) /* VIA encountered. */
|
||||
if( pt_trace->Type() == PCB_VIA_T ) // VIA encountered.
|
||||
{
|
||||
int radius = pt_trace->m_Width >> 1;
|
||||
int color = g_ColorsSettings.GetItemColor( VIAS_VISIBLE + pt_trace->m_Shape );
|
||||
|
@ -256,7 +256,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
|
|||
pt_trace->Draw( m_canvas, aDC, drawmode );
|
||||
}
|
||||
|
||||
/* Draw filled areas (i.e. zones) */
|
||||
// Draw filled areas (i.e. zones)
|
||||
for( int ii = 0; ii < Pcb->GetAreaCount(); ii++ )
|
||||
{
|
||||
ZONE_CONTAINER* zone = Pcb->GetArea( ii );
|
||||
|
@ -295,7 +295,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
|
|||
if( ( aPrintMaskLayer & pt_trace->ReturnMaskLayer() ) == 0 )
|
||||
continue;
|
||||
|
||||
if( pt_trace->Type() == PCB_VIA_T ) /* VIA encountered. */
|
||||
if( pt_trace->Type() == PCB_VIA_T ) // VIA encountered.
|
||||
{
|
||||
int diameter;
|
||||
|
||||
|
@ -332,43 +332,41 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule,
|
|||
int aDraw_mode, int aMasklayer,
|
||||
PRINT_PARAMETERS::DrillShapeOptT aDrillShapeOpt )
|
||||
{
|
||||
D_PAD* pt_pad;
|
||||
EDA_ITEM* PtStruct;
|
||||
TEXTE_MODULE* TextMod;
|
||||
int mlayer;
|
||||
|
||||
/* Print pads */
|
||||
pt_pad = aModule->m_Pads;
|
||||
|
||||
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
|
||||
// Print pads
|
||||
for( D_PAD* pad = aModule->m_Pads; pad; pad = pad->Next() )
|
||||
{
|
||||
if( (pt_pad->m_layerMask & aMasklayer ) == 0 )
|
||||
if( (pad->GetLayerMask() & aMasklayer ) == 0 )
|
||||
continue;
|
||||
|
||||
// Manage hole according to the print drill option
|
||||
wxSize drill_tmp = pt_pad->m_Drill;
|
||||
wxSize drill_tmp = pad->GetDrillSize();
|
||||
|
||||
switch ( aDrillShapeOpt )
|
||||
switch( aDrillShapeOpt )
|
||||
{
|
||||
case PRINT_PARAMETERS::NO_DRILL_SHAPE:
|
||||
pt_pad->m_Drill = wxSize(0,0);
|
||||
break;
|
||||
case PRINT_PARAMETERS::SMALL_DRILL_SHAPE:
|
||||
pt_pad->m_Drill.x = min(SMALL_DRILL,pt_pad->m_Drill.x);
|
||||
pt_pad->m_Drill.y = min(SMALL_DRILL,pt_pad->m_Drill.y);
|
||||
break;
|
||||
case PRINT_PARAMETERS::FULL_DRILL_SHAPE:
|
||||
// Do nothing
|
||||
break;
|
||||
case PRINT_PARAMETERS::NO_DRILL_SHAPE:
|
||||
pad->SetDrillSize( wxSize(0,0) );
|
||||
break;
|
||||
|
||||
case PRINT_PARAMETERS::SMALL_DRILL_SHAPE:
|
||||
{
|
||||
wxSize sz( min( SMALL_DRILL, pad->GetDrillSize().x ),
|
||||
min( SMALL_DRILL, pad->GetDrillSize().y ) );
|
||||
|
||||
pad->SetDrillSize( sz );
|
||||
}
|
||||
break;
|
||||
|
||||
case PRINT_PARAMETERS::FULL_DRILL_SHAPE:
|
||||
// Do nothing
|
||||
break;
|
||||
}
|
||||
|
||||
pt_pad->Draw( aPanel, aDC, aDraw_mode );
|
||||
pt_pad->m_Drill = drill_tmp;
|
||||
pad->Draw( aPanel, aDC, aDraw_mode );
|
||||
pad->SetDrillSize( drill_tmp );
|
||||
}
|
||||
|
||||
/* Print footprint graphic shapes */
|
||||
PtStruct = aModule->m_Drawings;
|
||||
mlayer = GetLayerMask( aModule->GetLayer() );
|
||||
// Print footprint graphic shapes
|
||||
int mlayer = GetLayerMask( aModule->GetLayer() );
|
||||
|
||||
if( aModule->GetLayer() == LAYER_N_BACK )
|
||||
mlayer = SILKSCREEN_LAYER_BACK;
|
||||
|
@ -384,28 +382,29 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule,
|
|||
aModule->m_Value->Draw( aPanel, aDC, aDraw_mode );
|
||||
}
|
||||
|
||||
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
||||
for( EDA_ITEM* item = aModule->m_Drawings; item; item = item->Next() )
|
||||
{
|
||||
switch( PtStruct->Type() )
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_MODULE_TEXT_T:
|
||||
if( ( mlayer & aMasklayer ) == 0 )
|
||||
break;
|
||||
|
||||
TextMod = (TEXTE_MODULE*) PtStruct;
|
||||
TextMod->Draw( aPanel, aDC, aDraw_mode );
|
||||
TEXTE_MODULE* textMod;
|
||||
textMod = (TEXTE_MODULE*) item;
|
||||
textMod->Draw( aPanel, aDC, aDraw_mode );
|
||||
break;
|
||||
|
||||
case PCB_MODULE_EDGE_T:
|
||||
{
|
||||
EDGE_MODULE* edge = (EDGE_MODULE*) PtStruct;
|
||||
{
|
||||
EDGE_MODULE* edge = (EDGE_MODULE*) item;
|
||||
|
||||
if( ( GetLayerMask( edge->GetLayer() ) & aMasklayer ) == 0 )
|
||||
break;
|
||||
if( ( GetLayerMask( edge->GetLayer() ) & aMasklayer ) == 0 )
|
||||
break;
|
||||
|
||||
edge->Draw( aPanel, aDC, aDraw_mode );
|
||||
edge->Draw( aPanel, aDC, aDraw_mode );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -55,7 +55,21 @@ void DrawTraces( EDA_DRAW_PANEL* panel,
|
|||
/*************/
|
||||
/* MODULES.C */
|
||||
/*************/
|
||||
|
||||
/**
|
||||
* Function ChangeSideMaskLayer
|
||||
* calculates the mask layer when flipping a footprint.
|
||||
* BACK and FRONT copper layers , mask, paste, solder layers are swapped.
|
||||
*/
|
||||
int ChangeSideMaskLayer( int aMask );
|
||||
|
||||
/**
|
||||
* Function ChangeSideNumLayer
|
||||
* calculates the layer number for changing cu / cmp layers for Cu / CMP.
|
||||
* (Copper, Mask, Paste, solder)
|
||||
*/
|
||||
int ChangeSideNumLayer( int oldlayer );
|
||||
|
||||
void DrawModuleOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* module );
|
||||
void MoveFootprint( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase );
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ void MIN_SPAN_TREE_PADS::AddTreeToRatsnest( std::vector<RATSNEST_ITEM> &aRatsnes
|
|||
// The first edge (i.e. rastnest) starts at index 1
|
||||
for( int ii = 1; ii < m_Size; ii++ )
|
||||
{
|
||||
/* Create the new ratsnest */
|
||||
// Create the new ratsnest
|
||||
RATSNEST_ITEM net;
|
||||
net.SetNet( netcode );
|
||||
net.m_Status = CH_ACTIF | CH_VISIBLE;
|
||||
|
@ -107,8 +107,8 @@ int MIN_SPAN_TREE_PADS::GetWeight( int aItem1, int aItem2 )
|
|||
|
||||
if( pad1 == pad2 )
|
||||
return 0;
|
||||
int weight = abs( pad2->m_Pos.x - pad1->m_Pos.x ) +
|
||||
abs( pad2->m_Pos.y - pad1->m_Pos.y );
|
||||
int weight = abs( pad2->GetPosition().x - pad1->GetPosition().x ) +
|
||||
abs( pad2->GetPosition().y - pad1->GetPosition().y );
|
||||
return weight + 1;
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ void PCB_BASE_FRAME::Build_Board_Ratsnest()
|
|||
if( m_Pcb->GetPadCount() == 0 )
|
||||
return;
|
||||
|
||||
/* Created pad list and the net_codes if needed */
|
||||
// Created pad list and the net_codes if needed
|
||||
if( (m_Pcb->m_Status_Pcb & NET_CODES_OK) == 0 )
|
||||
m_Pcb->BuildListOfNets();
|
||||
|
||||
|
@ -220,9 +220,9 @@ void PCB_BASE_FRAME::Build_Board_Ratsnest()
|
|||
}
|
||||
|
||||
if( m_Pcb->GetNodesCount() == 0 )
|
||||
return; /* No useful connections. */
|
||||
return; // No useful connections.
|
||||
|
||||
/* Ratsnest computation */
|
||||
// Ratsnest computation
|
||||
unsigned current_net_code = 1; // First net code is analyzed.
|
||||
// (net_code = 0 -> no connect)
|
||||
noconn = 0;
|
||||
|
@ -309,7 +309,7 @@ static int tst_links_between_blocks( NETINFO_ITEM* aNetinfo,
|
|||
int subratsnest_id, min_id;
|
||||
RATSNEST_ITEM* link, * best_link;
|
||||
|
||||
/* Search a link from a block to an other block */
|
||||
// Search a link from a block to an other block
|
||||
best_link = NULL;
|
||||
|
||||
for( unsigned ii = aNetinfo->m_RatsnestStartIdx; ii < aNetinfo->m_RatsnestEndIdx; ii++ )
|
||||
|
@ -544,11 +544,11 @@ void PCB_BASE_FRAME::build_ratsnest_module( MODULE* aModule )
|
|||
pads_module_count = localPadList.size();
|
||||
|
||||
if( pads_module_count == 0 )
|
||||
return; /* no connection! */
|
||||
return; // no connection!
|
||||
|
||||
sort( localPadList.begin(), localPadList.end(), sortByNetcode );
|
||||
|
||||
/* Build the list of pads linked to the current footprint pads */
|
||||
// Build the list of pads linked to the current footprint pads
|
||||
current_net_code = 0;
|
||||
|
||||
for( unsigned ii = 0; ii < pads_module_count; ii++ )
|
||||
|
@ -581,7 +581,7 @@ void PCB_BASE_FRAME::build_ratsnest_module( MODULE* aModule )
|
|||
}
|
||||
}
|
||||
|
||||
/* Sort the pad list by net_code */
|
||||
// Sort the pad list by net_code
|
||||
sort( localPadList.begin() + pads_module_count, localPadList.end(),
|
||||
sortByNetcode );
|
||||
|
||||
|
@ -596,7 +596,7 @@ void PCB_BASE_FRAME::build_ratsnest_module( MODULE* aModule )
|
|||
std::vector<D_PAD*> padsBuffer; // contains pads of only one net
|
||||
for( unsigned ii = 0; ii < pads_module_count; ii++ )
|
||||
{
|
||||
/* Search the end of pad list relative to the current net */
|
||||
// Search the end of pad list relative to the current net
|
||||
unsigned jj = ii + 1;
|
||||
|
||||
for( ; jj <= pads_module_count; jj++ )
|
||||
|
@ -656,7 +656,7 @@ void PCB_BASE_FRAME::build_ratsnest_module( MODULE* aModule )
|
|||
|
||||
if( pad_ref->GetNet() != current_net_code )
|
||||
{
|
||||
/* if needed, creates a new ratsnest for the old net */
|
||||
// if needed, creates a new ratsnest for the old net
|
||||
if( addRats )
|
||||
{
|
||||
m_Pcb->m_LocalRatsnest.push_back( local_rats );
|
||||
|
@ -667,22 +667,22 @@ void PCB_BASE_FRAME::build_ratsnest_module( MODULE* aModule )
|
|||
local_rats.m_Lenght = INT_MAX;
|
||||
}
|
||||
|
||||
pad_pos = pad_ref->m_Pos - g_Offset_Module;
|
||||
pad_pos = pad_ref->GetPosition() - g_Offset_Module;
|
||||
|
||||
// Search the nearest external pad of this current pad
|
||||
for( unsigned jj = pads_module_count; jj < localPadList.size(); jj++ )
|
||||
{
|
||||
pad_externe = localPadList[jj];
|
||||
|
||||
/* we search pads having the same net code */
|
||||
// we search pads having the same net code
|
||||
if( pad_externe->GetNet() < pad_ref->GetNet() )
|
||||
continue;
|
||||
|
||||
if( pad_externe->GetNet() > pad_ref->GetNet() ) // pads are sorted by net code
|
||||
break;
|
||||
|
||||
distance = abs( pad_externe->m_Pos.x - pad_pos.x ) +
|
||||
abs( pad_externe->m_Pos.y - pad_pos.y );
|
||||
distance = abs( pad_externe->GetPosition().x - pad_pos.x ) +
|
||||
abs( pad_externe->GetPosition().y - pad_pos.y );
|
||||
|
||||
if( distance < local_rats.m_Lenght )
|
||||
{
|
||||
|
@ -724,10 +724,13 @@ void PCB_BASE_FRAME::TraceModuleRatsNest( wxDC* DC )
|
|||
else
|
||||
{
|
||||
g_ColorsSettings.SetItemColor(RATSNEST_VISIBLE, tmpcolor);
|
||||
wxPoint tmp = rats->m_PadStart->m_Pos;
|
||||
rats->m_PadStart->m_Pos -= g_Offset_Module;
|
||||
|
||||
wxPoint tmp = rats->m_PadStart->GetPosition();
|
||||
|
||||
rats->m_PadStart->SetPosition( tmp - g_Offset_Module );
|
||||
rats->Draw( m_canvas, DC, GR_XOR, wxPoint( 0, 0 ) );
|
||||
rats->m_PadStart->m_Pos = tmp;
|
||||
|
||||
rats->m_PadStart->SetPosition( tmp );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -827,7 +830,7 @@ void PCB_BASE_FRAME::BuildAirWiresTargetsList( BOARD_CONNECTED_ITEM* aItemRef,
|
|||
continue;
|
||||
|
||||
if( !pad->GetSubNet() || (pad->GetSubNet() != subnet) )
|
||||
s_TargetsLocations.push_back( pad->m_Pos );
|
||||
s_TargetsLocations.push_back( pad->GetPosition() );
|
||||
}
|
||||
|
||||
// Create a list of tracks ends candidates, not already connected to the
|
||||
|
@ -851,10 +854,11 @@ void PCB_BASE_FRAME::BuildAirWiresTargetsList( BOARD_CONNECTED_ITEM* aItemRef,
|
|||
// Remove duplicate targets, using the C++ unique algorithm
|
||||
sort( s_TargetsLocations.begin(), s_TargetsLocations.end(), sort_by_point );
|
||||
std::vector< wxPoint >::iterator it = unique( s_TargetsLocations.begin(), s_TargetsLocations.end() );
|
||||
|
||||
// Using the C++ unique algorithm only moves the duplicate entries to the end of
|
||||
// of the array. This removes the duplicate entries from the array.
|
||||
s_TargetsLocations.resize( it - s_TargetsLocations.begin() );
|
||||
} /* end if Init */
|
||||
} // end if Init
|
||||
|
||||
// in all cases, sort by distances:
|
||||
sort( s_TargetsLocations.begin(), s_TargetsLocations.end(), sort_by_distance );
|
||||
|
|
|
@ -447,9 +447,11 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
|||
routeLayerMask = topLayerMask | bottomLayerMask;
|
||||
|
||||
pt_cur_ch = pt_rat;
|
||||
current_net_code = pt_rat->GetNet();
|
||||
padLayerMaskStart = pt_cur_ch->m_PadStart->m_layerMask;
|
||||
padLayerMaskEnd = pt_cur_ch->m_PadEnd->m_layerMask;
|
||||
|
||||
current_net_code = pt_rat->GetNet();
|
||||
padLayerMaskStart = pt_cur_ch->m_PadStart->GetLayerMask();
|
||||
|
||||
padLayerMaskEnd = pt_cur_ch->m_PadEnd->GetLayerMask();
|
||||
|
||||
|
||||
/* First Test if routing possible ie if the pads are accessible
|
||||
|
@ -469,12 +471,12 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
|||
+ pcbframe->GetBoard()->GetBoundingBox().GetX();
|
||||
int cY = ( Board.m_GridRouting * row_source )
|
||||
+ pcbframe->GetBoard()->GetBoundingBox().GetY();
|
||||
int dx = pt_cur_ch->m_PadStart->m_Size.x / 2;
|
||||
int dy = pt_cur_ch->m_PadStart->m_Size.y / 2;
|
||||
int dx = pt_cur_ch->m_PadStart->GetSize().x / 2;
|
||||
int dy = pt_cur_ch->m_PadStart->GetSize().y / 2;
|
||||
int px = pt_cur_ch->m_PadStart->GetPosition().x;
|
||||
int py = pt_cur_ch->m_PadStart->GetPosition().y;
|
||||
|
||||
if( ( ( int( pt_cur_ch->m_PadStart->m_Orient ) / 900 ) & 1 ) != 0 )
|
||||
if( ( ( int( pt_cur_ch->m_PadStart->GetOrientation() ) / 900 ) & 1 ) != 0 )
|
||||
EXCHG( dx, dy );
|
||||
|
||||
if( ( abs( cX - px ) > dx ) || ( abs( cY - py ) > dy ) )
|
||||
|
@ -484,12 +486,12 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
|||
+ pcbframe->GetBoard()->GetBoundingBox().GetX();
|
||||
cY = ( Board.m_GridRouting * row_target )
|
||||
+ pcbframe->GetBoard()->GetBoundingBox().GetY();
|
||||
dx = pt_cur_ch->m_PadEnd->m_Size.x / 2;
|
||||
dy = pt_cur_ch->m_PadEnd->m_Size.y / 2;
|
||||
dx = pt_cur_ch->m_PadEnd->GetSize().x / 2;
|
||||
dy = pt_cur_ch->m_PadEnd->GetSize().y / 2;
|
||||
px = pt_cur_ch->m_PadEnd->GetPosition().x;
|
||||
py = pt_cur_ch->m_PadEnd->GetPosition().y;
|
||||
|
||||
if( ( ( int( pt_cur_ch->m_PadEnd->m_Orient ) / 900) & 1 ) != 0 )
|
||||
if( ( ( int( pt_cur_ch->m_PadEnd->GetOrientation() ) / 900) & 1 ) != 0 )
|
||||
EXCHG( dx, dy );
|
||||
|
||||
if( ( abs( cX - px ) > dx ) || ( abs( cY - py ) > dy ) )
|
||||
|
|
|
@ -259,12 +259,12 @@ static DRAWSEGMENT* findPoint( const wxPoint& aPoint, TYPE_COLLECTOR* items )
|
|||
*/
|
||||
static bool isRoundKeepout( D_PAD* aPad )
|
||||
{
|
||||
if( aPad->m_PadShape==PAD_CIRCLE )
|
||||
if( aPad->GetShape()==PAD_CIRCLE )
|
||||
{
|
||||
if( aPad->m_Drill.x >= aPad->m_Size.x )
|
||||
if( aPad->GetDrillSize().x >= aPad->GetSize().x )
|
||||
return true;
|
||||
|
||||
if( (aPad->m_layerMask & ALL_CU_LAYERS) == 0 )
|
||||
if( (aPad->GetLayerMask() & ALL_CU_LAYERS) == 0 )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -302,7 +302,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
|
|||
|
||||
uniqifier = '[';
|
||||
|
||||
bool onAllCopperLayers = ( (aPad->m_layerMask & ALL_CU_LAYERS) == ALL_CU_LAYERS );
|
||||
bool onAllCopperLayers = ( (aPad->GetLayerMask() & ALL_CU_LAYERS) == ALL_CU_LAYERS );
|
||||
|
||||
if( onAllCopperLayers )
|
||||
uniqifier += 'A'; // A for all layers
|
||||
|
@ -332,11 +332,11 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
|
|||
|
||||
POINT dsnOffset;
|
||||
|
||||
if( aPad->m_Offset.x || aPad->m_Offset.y )
|
||||
if( aPad->GetOffset().x || aPad->GetOffset().y )
|
||||
{
|
||||
char offsetTxt[64];
|
||||
|
||||
wxPoint offset( aPad->m_Offset.x, aPad->m_Offset.y );
|
||||
wxPoint offset( aPad->GetOffset().x, aPad->GetOffset().y );
|
||||
|
||||
dsnOffset = mapPt( offset );
|
||||
|
||||
|
@ -347,12 +347,12 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
|
|||
uniqifier += offsetTxt;
|
||||
}
|
||||
|
||||
switch( aPad->m_PadShape )
|
||||
switch( aPad->GetShape() )
|
||||
{
|
||||
default:
|
||||
case PAD_CIRCLE:
|
||||
{
|
||||
double diameter = scale(aPad->m_Size.x);
|
||||
double diameter = scale(aPad->GetSize().x);
|
||||
|
||||
for( int ndx=0; ndx<reportedLayers; ++ndx )
|
||||
{
|
||||
|
@ -368,7 +368,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
|
|||
}
|
||||
|
||||
snprintf( name, sizeof(name), "Round%sPad_%.6g_mil",
|
||||
uniqifier.c_str(), scale(aPad->m_Size.x) );
|
||||
uniqifier.c_str(), scale(aPad->GetSize().x) );
|
||||
name[ sizeof(name)-1 ] = 0;
|
||||
|
||||
padstack->SetPadstackId( name );
|
||||
|
@ -377,8 +377,8 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
|
|||
|
||||
case PAD_RECT:
|
||||
{
|
||||
double dx = scale( aPad->m_Size.x ) / 2.0;
|
||||
double dy = scale( aPad->m_Size.y ) / 2.0;
|
||||
double dx = scale( aPad->GetSize().x ) / 2.0;
|
||||
double dy = scale( aPad->GetSize().y ) / 2.0;
|
||||
|
||||
POINT lowerLeft( -dx, -dy );
|
||||
POINT upperRight( dx, dy );
|
||||
|
@ -399,7 +399,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
|
|||
}
|
||||
|
||||
snprintf( name, sizeof(name), "Rect%sPad_%.6gx%.6g_mil",
|
||||
uniqifier.c_str(), scale(aPad->m_Size.x), scale(aPad->m_Size.y) );
|
||||
uniqifier.c_str(), scale(aPad->GetSize().x), scale(aPad->GetSize().y) );
|
||||
name[ sizeof(name)-1 ] = 0;
|
||||
|
||||
padstack->SetPadstackId( name );
|
||||
|
@ -408,8 +408,8 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
|
|||
|
||||
case PAD_OVAL:
|
||||
{
|
||||
double dx = scale( aPad->m_Size.x ) / 2.0;
|
||||
double dy = scale( aPad->m_Size.y ) / 2.0;
|
||||
double dx = scale( aPad->GetSize().x ) / 2.0;
|
||||
double dy = scale( aPad->GetSize().y ) / 2.0;
|
||||
double dr = dx - dy;
|
||||
double radius;
|
||||
POINT start;
|
||||
|
@ -447,7 +447,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
|
|||
}
|
||||
|
||||
snprintf( name, sizeof(name), "Oval%sPad_%.6gx%.6g_mil",
|
||||
uniqifier.c_str(), scale(aPad->m_Size.x), scale(aPad->m_Size.y) );
|
||||
uniqifier.c_str(), scale(aPad->GetSize().x), scale(aPad->GetSize().y) );
|
||||
name[ sizeof(name)-1 ] = 0;
|
||||
|
||||
padstack->SetPadstackId( name );
|
||||
|
@ -456,11 +456,11 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
|
|||
|
||||
case PAD_TRAPEZOID:
|
||||
{
|
||||
double dx = scale( aPad->m_Size.x ) / 2.0;
|
||||
double dy = scale( aPad->m_Size.y ) / 2.0;
|
||||
double dx = scale( aPad->GetSize().x ) / 2.0;
|
||||
double dy = scale( aPad->GetSize().y ) / 2.0;
|
||||
|
||||
double ddx = scale( aPad->m_DeltaSize.x ) / 2.0;
|
||||
double ddy = scale( aPad->m_DeltaSize.y ) / 2.0;
|
||||
double ddx = scale( aPad->GetDelta().x ) / 2.0;
|
||||
double ddy = scale( aPad->GetDelta().y ) / 2.0;
|
||||
|
||||
// see class_pad_draw_functions.cpp which draws the trapezoid pad
|
||||
POINT lowerLeft( -dx - ddy, -dy - ddx );
|
||||
|
@ -490,15 +490,15 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
|
|||
polygon->AppendPoint( lowerRight );
|
||||
}
|
||||
|
||||
D(printf( "m_DeltaSize: %d,%d\n", aPad->m_DeltaSize.x, aPad->m_DeltaSize.y );)
|
||||
D(printf( "m_DeltaSize: %d,%d\n", aPad->GetDelta().x, aPad->GetDelta().y );)
|
||||
|
||||
// this string _must_ be unique for a given physical shape
|
||||
snprintf( name, sizeof(name), "Trapz%sPad_%.6gx%.6g_%c%.6gx%c%.6g_mil",
|
||||
uniqifier.c_str(), scale(aPad->m_Size.x), scale(aPad->m_Size.y),
|
||||
aPad->m_DeltaSize.x < 0 ? 'n' : 'p',
|
||||
abs( scale( aPad->m_DeltaSize.x )),
|
||||
aPad->m_DeltaSize.y < 0 ? 'n' : 'p',
|
||||
abs( scale( aPad->m_DeltaSize.y ))
|
||||
uniqifier.c_str(), scale(aPad->GetSize().x), scale(aPad->GetSize().y),
|
||||
aPad->GetDelta().x < 0 ? 'n' : 'p',
|
||||
abs( scale( aPad->GetDelta().x )),
|
||||
aPad->GetDelta().y < 0 ? 'n' : 'p',
|
||||
abs( scale( aPad->GetDelta().y ))
|
||||
);
|
||||
name[ sizeof(name)-1 ] = 0;
|
||||
|
||||
|
@ -538,8 +538,8 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
|
|||
// see if this pad is a through hole with no copper on its perimeter
|
||||
if( isRoundKeepout( pad ) )
|
||||
{
|
||||
double diameter = scale( pad->m_Drill.x );
|
||||
POINT vertex = mapPt( pad->m_Pos0 );
|
||||
double diameter = scale( pad->GetDrillSize().x );
|
||||
POINT vertex = mapPt( pad->GetPos0() );
|
||||
|
||||
int layerCount = aBoard->GetCopperLayerCount();
|
||||
for( int layer=0; layer<layerCount; ++layer )
|
||||
|
@ -600,14 +600,14 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
|
|||
|
||||
pin->padstack_id = padstack->padstack_id;
|
||||
|
||||
int angle = pad->m_Orient - aModule->m_Orient; // tenths of degrees
|
||||
int angle = pad->GetOrientation() - aModule->GetOrientation(); // tenths of degrees
|
||||
if( angle )
|
||||
{
|
||||
NORMALIZE_ANGLE_POS(angle);
|
||||
pin->SetRotation( angle / 10.0 );
|
||||
}
|
||||
|
||||
wxPoint pos( pad->m_Pos0 );
|
||||
wxPoint pos( pad->GetPos0() );
|
||||
|
||||
pin->SetVertex( mapPt( pos ) );
|
||||
}
|
||||
|
@ -1255,7 +1255,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
|
|||
PLACE* place = new PLACE( comp );
|
||||
comp->places.push_back( place );
|
||||
|
||||
place->SetRotation( module->m_Orient/10.0 );
|
||||
place->SetRotation( module->GetOrientation()/10.0 );
|
||||
place->SetVertex( mapPt( module->m_Pos ) );
|
||||
place->component_id = componentId;
|
||||
place->part_number = TO_UTF8( module->GetValue() );
|
||||
|
@ -1263,7 +1263,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
|
|||
// module is flipped from bottom side, set side to T_back
|
||||
if( module->flag )
|
||||
{
|
||||
int angle = 1800 - module->m_Orient;
|
||||
int angle = 1800 - module->GetOrientation();
|
||||
NORMALIZE_ANGLE_POS(angle);
|
||||
place->SetRotation( angle/10.0 );
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
|
|||
wxASSERT( aNewTrack );
|
||||
|
||||
#if 0 && defined(DEBUG)
|
||||
TRACK* EndNewTrack; /* The last segment of the list chained to the track */
|
||||
TRACK* EndNewTrack; // The last segment of the list chained to the track
|
||||
|
||||
EndNewTrack = aNewTrack;
|
||||
|
||||
|
@ -99,7 +99,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
|
|||
TRACK* bufStart = m_Pcb->m_Track->GetStartNetCode( netcode ); // Beginning of tracks of the net
|
||||
TRACK* bufEnd = bufStart->GetEndNetCode( netcode ); // End of tracks of the net
|
||||
|
||||
/* Flags for cleaning the net. */
|
||||
// Flags for cleaning the net.
|
||||
for( pt_del = bufStart; pt_del; pt_del = pt_del->Next() )
|
||||
{
|
||||
// D( std::cout<<"track "<<pt_del<<" turning off BUSY | IN_EDIT | IS_LINKED"<<std::endl; )
|
||||
|
@ -118,15 +118,15 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
|
|||
start = StartTrack->m_Start;
|
||||
end = EndTrack->m_End;
|
||||
|
||||
/* The start and end points cannot be the same. */
|
||||
// The start and end points cannot be the same.
|
||||
if( start == end )
|
||||
return 0;
|
||||
|
||||
/* Determine layers interconnected these points. */
|
||||
// Determine layers interconnected these points.
|
||||
startmasklayer = StartTrack->ReturnMaskLayer();
|
||||
endmasklayer = EndTrack->ReturnMaskLayer();
|
||||
|
||||
/* There may be a via or a pad on the end points. */
|
||||
// There may be a via or a pad on the end points.
|
||||
pt_segm = m_Pcb->m_Track->GetVia( NULL, start, startmasklayer );
|
||||
|
||||
if( pt_segm )
|
||||
|
@ -134,9 +134,9 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
|
|||
|
||||
if( StartTrack->start && ( StartTrack->start->Type() == PCB_PAD_T ) )
|
||||
{
|
||||
/* Start on pad. */
|
||||
D_PAD* pt_pad = (D_PAD*)(StartTrack->start);
|
||||
startmasklayer |= pt_pad->m_layerMask;
|
||||
// Start on pad.
|
||||
D_PAD* pad = (D_PAD*) StartTrack->start;
|
||||
startmasklayer |= pad->GetLayerMask();
|
||||
}
|
||||
|
||||
pt_segm = m_Pcb->m_Track->GetVia( NULL, end, endmasklayer );
|
||||
|
@ -146,8 +146,8 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
|
|||
|
||||
if( EndTrack->end && ( EndTrack->end->Type() == PCB_PAD_T ) )
|
||||
{
|
||||
D_PAD* pt_pad = (D_PAD*)(EndTrack->end);
|
||||
endmasklayer |= pt_pad->m_layerMask;
|
||||
D_PAD* pad = (D_PAD*) EndTrack->end;
|
||||
endmasklayer |= pad->GetLayerMask();
|
||||
}
|
||||
|
||||
// Mark as deleted a new track (which is not involved in the search for other connections)
|
||||
|
@ -158,9 +158,9 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
|
|||
*/
|
||||
pt_segm = GetTrace( bufStart, bufEnd, start, startmasklayer );
|
||||
|
||||
if( pt_segm == NULL ) /* Not connected to the track starting point. */
|
||||
if( pt_segm == NULL ) // Not connected to the track starting point.
|
||||
{
|
||||
/* Clear the delete flag. */
|
||||
// Clear the delete flag.
|
||||
ListSetState( aNewTrack, aNewTrackSegmentsCount, IS_DELETED, OFF );
|
||||
return 0;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
|
|||
|
||||
if( nbconnect == 0 )
|
||||
{
|
||||
/* Clear used flags */
|
||||
// Clear used flags
|
||||
for( pt_del = bufStart; pt_del; pt_del = pt_del->Next() )
|
||||
{
|
||||
pt_del->SetState( BUSY | IS_DELETED | IN_EDIT | IS_LINKED, OFF );
|
||||
|
@ -209,7 +209,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
|
|||
ListSetState( aNewTrack, aNewTrackSegmentsCount, IS_DELETED, OFF );
|
||||
ListSetState( aNewTrack, aNewTrackSegmentsCount, IN_EDIT, ON );
|
||||
|
||||
/* Test all marked segments. */
|
||||
// Test all marked segments.
|
||||
while( nbconnect )
|
||||
{
|
||||
for( pt_del = bufStart; pt_del; pt_del = pt_del->Next() )
|
||||
|
@ -239,7 +239,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
|
|||
|
||||
if( pt_segm->m_Start == start || pt_segm->m_End == start )
|
||||
{
|
||||
/* Marked track can be erased. */
|
||||
// Marked track can be erased.
|
||||
TRACK* NextS;
|
||||
|
||||
DrawTraces( m_canvas, aDC, pt_del, nb_segm, GR_XOR | GR_HIGHLIGHT );
|
||||
|
@ -262,7 +262,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
|
|||
}
|
||||
}
|
||||
|
||||
/* Clean up flags. */
|
||||
// Clean up flags.
|
||||
for( pt_del = m_Pcb->m_Track; pt_del != NULL; pt_del = pt_del->Next() )
|
||||
{
|
||||
if( pt_del->GetState( IN_EDIT ) )
|
||||
|
@ -284,7 +284,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
|
|||
ListSetState( pt_del, nb_segm, BUSY, OFF );
|
||||
}
|
||||
|
||||
/* Clear used flags */
|
||||
// Clear used flags
|
||||
for( pt_del = m_Pcb->m_Track; pt_del; pt_del = pt_del->Next() )
|
||||
{
|
||||
pt_del->SetState( BUSY | IS_DELETED | IN_EDIT | IS_LINKED, OFF );
|
||||
|
|
|
@ -71,7 +71,7 @@ void FOOTPRINT_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
m_canvas->DrawBackGround( DC );
|
||||
TraceWorkSheet( DC, screen, 0 );
|
||||
|
||||
/* Redraw the footprints */
|
||||
// Redraw the footprints
|
||||
for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
module->Draw( m_canvas, DC, GR_OR );
|
||||
|
@ -89,7 +89,7 @@ void FOOTPRINT_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
if( m_canvas->IsMouseCaptured() )
|
||||
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
|
||||
|
||||
/* Redraw the cursor */
|
||||
// Redraw the cursor
|
||||
m_canvas->DrawCrossHair( DC );
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ void PCB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|||
}
|
||||
|
||||
|
||||
/* Redraw the BOARD items but not cursors, axis or grid */
|
||||
// Redraw the BOARD items but not cursors, axis or grid
|
||||
void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, int aDrawMode, const wxPoint& offset )
|
||||
{
|
||||
/* The order of drawing is flexible on some systems and not on others. For
|
||||
|
@ -178,7 +178,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, int aDrawMode, const wxPoint
|
|||
}
|
||||
}
|
||||
|
||||
/* Draw areas (i.e. zones) */
|
||||
// Draw areas (i.e. zones)
|
||||
for( int ii = 0; ii < GetAreaCount(); ii++ )
|
||||
{
|
||||
ZONE_CONTAINER* zone = GetArea(ii);
|
||||
|
@ -280,21 +280,19 @@ void BOARD::DrawHighLight( EDA_DRAW_PANEL* am_canvas, wxDC* DC, int aNetCode )
|
|||
* and we want to see pad through.
|
||||
* The pads must appear on the layers selected in LayerMask
|
||||
*/
|
||||
void Trace_Pads_Only( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module,
|
||||
int ox, int oy, int LayerMask, int draw_mode )
|
||||
void Trace_Pads_Only( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* aModule,
|
||||
int ox, int oy, int aLayerMask, int draw_mode )
|
||||
{
|
||||
int tmp;
|
||||
PCB_BASE_FRAME* frame;
|
||||
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent();
|
||||
|
||||
frame = (PCB_BASE_FRAME*) panel->GetParent();
|
||||
int tmp = frame->m_DisplayPadFill;
|
||||
|
||||
tmp = frame->m_DisplayPadFill;
|
||||
frame->m_DisplayPadFill = false;
|
||||
|
||||
/* Draw pads. */
|
||||
for( D_PAD* pad = Module->m_Pads; pad; pad = pad->Next() )
|
||||
// Draw pads.
|
||||
for( D_PAD* pad = aModule->m_Pads; pad; pad = pad->Next() )
|
||||
{
|
||||
if( (pad->m_layerMask & LayerMask) == 0 )
|
||||
if( (pad->GetLayerMask() & aLayerMask) == 0 )
|
||||
continue;
|
||||
|
||||
pad->Draw( panel, DC, draw_mode, wxPoint( ox, oy ) );
|
||||
|
|
|
@ -71,7 +71,7 @@ static int CopyPolygonsFromFilledPolysListTotKPolygonList( ZONE_CONTAINER* aZon
|
|||
// Local Variables:
|
||||
static int s_thermalRot = 450; // angle of stubs in thermal reliefs for round pads
|
||||
|
||||
/* how many segments are used to create a polygon from a circle: */
|
||||
// how many segments are used to create a polygon from a circle:
|
||||
static int s_CircleToSegmentsCount = ARC_APPROX_SEGMENTS_COUNT_LOW_DEF; /* default value. the real value will be changed to
|
||||
* ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF
|
||||
* if m_ArcToSegmentsCount == ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF
|
||||
|
@ -201,15 +201,16 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
|||
* inside the board (in fact inside the hole. Some photo diodes and Leds are
|
||||
* like this)
|
||||
*/
|
||||
if( (pad->m_Drill.x == 0) && (pad->m_Drill.y == 0) )
|
||||
if( pad->GetDrillSize().x == 0 && pad->GetDrillSize().y == 0 )
|
||||
continue;
|
||||
|
||||
// Use a dummy pad to calculate a hole shape that have the same dimension as
|
||||
// the pad hole
|
||||
dummypad.m_Size = pad->m_Drill;
|
||||
dummypad.m_Orient = pad->m_Orient;
|
||||
dummypad.m_PadShape = pad->m_DrillShape;
|
||||
dummypad.m_Pos = pad->m_Pos;
|
||||
dummypad.SetSize( pad->GetDrillSize() );
|
||||
dummypad.SetOrientation( pad->GetOrientation() );
|
||||
dummypad.SetShape( pad->GetDrillShape() );
|
||||
dummypad.SetPosition( pad->GetPosition() );
|
||||
|
||||
pad = &dummypad;
|
||||
}
|
||||
|
||||
|
@ -233,7 +234,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
|||
int gap = zone_clearance;
|
||||
|
||||
if( (m_PadOption == PAD_NOT_IN_ZONE)
|
||||
|| (GetNet() == 0) || pad->m_PadShape == PAD_TRAPEZOID )
|
||||
|| (GetNet() == 0) || pad->GetShape() == PAD_TRAPEZOID )
|
||||
|
||||
// PAD_TRAPEZOID shapes are not in zones because they are used in microwave apps
|
||||
// and i think it is good that shapes are not changed by thermal pads or others
|
||||
|
@ -407,18 +408,19 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
|||
if( m_PadOption == THERMAL_PAD )
|
||||
{
|
||||
cornerBufferPolysToSubstract.clear();
|
||||
|
||||
// Test thermal stubs connections and add polygons to remove unconnected stubs.
|
||||
BuildUnconnectedThermalStubsPolygonList( cornerBufferPolysToSubstract, aPcb, this,
|
||||
s_Correction, s_thermalRot );
|
||||
|
||||
/* remove copper areas */
|
||||
// remove copper areas
|
||||
if( cornerBufferPolysToSubstract.size() )
|
||||
{
|
||||
KPolygonSet polyset_holes;
|
||||
AddPolygonCornersToKPolygonList( cornerBufferPolysToSubstract, polyset_holes );
|
||||
polyset_zone_solid_areas -= polyset_holes;
|
||||
|
||||
/* put these areas in m_FilledPolysList */
|
||||
// put these areas in m_FilledPolysList
|
||||
m_FilledPolysList.clear();
|
||||
CopyPolygonsFromKPolygonListToFilledPolysList( this, polyset_zone_solid_areas );
|
||||
|
||||
|
|
|
@ -68,21 +68,21 @@ void BuildUnconnectedThermalStubsPolygonList( std::vector<CPolyPt>& aCornerBuffe
|
|||
// Thermal bridges are like a segment from a starting point inside the pad
|
||||
// to an ending point outside the pad
|
||||
wxPoint startpoint, endpoint;
|
||||
endpoint.x = ( pad->m_Size.x / 2 ) + aZone->m_ThermalReliefGap;
|
||||
endpoint.y = ( pad->m_Size.y / 2 ) + aZone->m_ThermalReliefGap;
|
||||
endpoint.x = ( pad->GetSize().x / 2 ) + aZone->m_ThermalReliefGap;
|
||||
endpoint.y = ( pad->GetSize().y / 2 ) + aZone->m_ThermalReliefGap;
|
||||
|
||||
int copperThickness = aZone->m_ThermalReliefCopperBridge - aZone->m_ZoneMinThickness;
|
||||
if( copperThickness < 0 )
|
||||
copperThickness = 0;
|
||||
|
||||
startpoint.x = min( pad->m_Size.x, copperThickness );
|
||||
startpoint.y = min( pad->m_Size.y, copperThickness );
|
||||
startpoint.x = min( pad->GetSize().x, copperThickness );
|
||||
startpoint.y = min( pad->GetSize().y, copperThickness );
|
||||
startpoint.x /= 2;
|
||||
startpoint.y /= 2;
|
||||
|
||||
// This is CIRCLE pad tweak (for circle pads the thermal stubs are at 45 deg)
|
||||
int fAngle = pad->m_Orient;
|
||||
if( pad->m_PadShape == PAD_CIRCLE )
|
||||
int fAngle = pad->GetOrientation();
|
||||
if( pad->GetShape() == PAD_CIRCLE )
|
||||
{
|
||||
endpoint.x = (int) ( endpoint.x * aArcCorrection );
|
||||
endpoint.y = endpoint.x;
|
||||
|
|
|
@ -28,7 +28,7 @@ void ZONE_CONTAINER::Test_For_Copper_Island_And_Remove_Insulated_Islands( BOARD
|
|||
|
||||
// Build a list of points connected to the net:
|
||||
// list of coordinates of pads and vias on this layer and on this net.
|
||||
std::vector <wxPoint> ListPointsCandidates;
|
||||
std::vector <wxPoint> listPointsCandidates;
|
||||
|
||||
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ void ZONE_CONTAINER::Test_For_Copper_Island_And_Remove_Insulated_Islands( BOARD
|
|||
if( pad->GetNet() != GetNet() )
|
||||
continue;
|
||||
|
||||
ListPointsCandidates.push_back( pad->m_Pos );
|
||||
listPointsCandidates.push_back( pad->GetPosition() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,10 +52,10 @@ void ZONE_CONTAINER::Test_For_Copper_Island_And_Remove_Insulated_Islands( BOARD
|
|||
if( track->GetNet() != GetNet() )
|
||||
continue;
|
||||
|
||||
ListPointsCandidates.push_back( track->m_Start );
|
||||
listPointsCandidates.push_back( track->m_Start );
|
||||
|
||||
if( track->Type() != PCB_VIA_T )
|
||||
ListPointsCandidates.push_back( track->m_End );
|
||||
listPointsCandidates.push_back( track->m_End );
|
||||
}
|
||||
|
||||
// test if a point is inside
|
||||
|
@ -68,10 +68,10 @@ void ZONE_CONTAINER::Test_For_Copper_Island_And_Remove_Insulated_Islands( BOARD
|
|||
{
|
||||
EDA_RECT bbox = CalculateSubAreaBoundaryBox( indexstart, indexend );
|
||||
|
||||
for( unsigned ic = 0; ic < ListPointsCandidates.size(); ic++ )
|
||||
for( unsigned ic = 0; ic < listPointsCandidates.size(); ic++ )
|
||||
{
|
||||
// test if this area is connected to a board item:
|
||||
wxPoint pos = ListPointsCandidates[ic];
|
||||
wxPoint pos = listPointsCandidates[ic];
|
||||
|
||||
if( !bbox.Contains( pos ) )
|
||||
continue;
|
||||
|
|
|
@ -142,7 +142,7 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode )
|
|||
|
||||
if( item->Type() == PCB_PAD_T )
|
||||
{
|
||||
pos1 = pos2 = ( (D_PAD*) item )->m_Pos;
|
||||
pos1 = pos2 = ( (D_PAD*) item )->GetPosition();
|
||||
}
|
||||
else if( item->Type() == PCB_VIA_T )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue