Commit 5208bf99 authored by Dick Hollenbeck's avatar Dick Hollenbeck

* 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.
parents 82735251 9e2eb0c8
......@@ -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,7 +664,7 @@ 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
{
......@@ -752,8 +753,8 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
// 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
int dx = (aPad.GetSize().x / 2) + aThermalGap; // Cutout radius x
int dy = (aPad.GetSize().y / 2) + aThermalGap; // Cutout radius y
wxPoint shape_offset;
......@@ -907,8 +908,8 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
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
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
......@@ -926,10 +927,14 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
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
// 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.m_Size / 2; // Rounding vector + Pad corner offset
corner_position -= aPad.GetSize() / 2; // Rounding vector + Pad corner offset
corners_buffer.push_back( wxPoint( corner_position.x, corner_position.y ) );
}
......@@ -976,7 +981,10 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
angle -= 3600;
}
break;
}
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;
newangle -= m_Orient; // = Change in rotation
double angleChange = newangle - m_Orient; // change in rotation
wxPoint pt;
m_Orient += newangle;
NORMALIZE_ANGLE_POS( 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->SetOrientation( pad->GetOrientation() + angleChange );
pad->m_Orient += newangle; // change m_Orientation
NORMALIZE_ANGLE_POS( pad->m_Orient );
RotatePoint( &pt, m_Orient );
RotatePoint( &px, &py, m_Orient );
pad->m_Pos.x = m_Pos.x + px;
pad->m_Pos.y = m_Pos.y + py;
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_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
D_PAD::~D_PAD()
{
m_boundingRadius = -1;
}
/* 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" );
......
This diff is collapsed.
......@@ -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() );
}
......
This diff is collapsed.
......@@ -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();
TRACK* track = pcb->m_Track->GetStartNetCode( net_code );
wxPoint pos = aPad->GetPosition();
pos = PtPad->m_Pos;
LayerMask = PtPad->m_layerMask;
int layerMask = aPad->GetLayerMask();
for( ; Track; Track = Track->Next() )
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() ) )
......
This diff is collapsed.
......@@ -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 );
}
This diff is collapsed.
This diff is collapsed.
......@@ -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" );
......
This diff is collapsed.
......@@ -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 );
if( pad->GetShape() == PAD_ROUND && pad->GetSize().x != pad->GetSize().y )
pad->SetShape( PAD_OVAL );
m_Pads.PushBack( Pad );
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;
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -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,7 +1141,7 @@ void KICAD_PLUGIN::loadPAD( MODULE* aModule )
// e.g. "At SMD N 00888000"
// sscanf( PtLine, "%s %s %X", BufLine, BufCar, &m_layerMask );
int attribute;
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();
RotatePoint( &padpos, aModule->GetOrientation() );
pad->m_Pos += aModule->GetPosition();
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;
}
}
......
This diff is collapsed.
......@@ -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
*/
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -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 );
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -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 )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment