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 ...@@ -4,6 +4,16 @@ KiCad ChangeLog 2012
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. 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> 2012-Feb-5 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
++pcbnew ++pcbnew
......
...@@ -108,4 +108,3 @@ int g_PadCMPColor = RED; ...@@ -108,4 +108,3 @@ int g_PadCMPColor = RED;
*/ */
DLIST<TRACK> g_CurrentTrackList; 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 ) ...@@ -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 ) void RotatePoint( wxPoint* point, const wxPoint& centre, double angle )
{ {
int ox, oy; int ox, oy;
......
...@@ -6,8 +6,14 @@ ...@@ -6,8 +6,14 @@
#define BOARD_DESIGN_SETTINGS_H_ #define BOARD_DESIGN_SETTINGS_H_
#include <pcbstruct.h> // NB_COLORS #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 class BOARD_DESIGN_SETTINGS
{ {
public: public:
...@@ -38,6 +44,8 @@ public: ...@@ -38,6 +44,8 @@ public:
int m_ModuleTextWidth; int m_ModuleTextWidth;
int m_ModuleSegmentWidth; int m_ModuleSegmentWidth;
D_PAD m_Pad_Master;
public: public:
BOARD_DESIGN_SETTINGS(); BOARD_DESIGN_SETTINGS();
...@@ -172,6 +180,13 @@ public: ...@@ -172,6 +180,13 @@ public:
*/ */
void SetCopperLayerCount( int aNewLayerCount ); 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: private:
int m_CopperLayerCount; ///< Number of copper layers for this design int m_CopperLayerCount; ///< Number of copper layers for this design
......
...@@ -5,25 +5,36 @@ ...@@ -5,25 +5,36 @@
#ifndef PAD_SHAPES_H_ #ifndef PAD_SHAPES_H_
#define PAD_SHAPES_H_ #define PAD_SHAPES_H_
/* Pad shape id : ( .m_PadShape member) */ /**
#define PAD_NONE 0 * Enum PAD_SHAPE_T
#define PAD_CIRCLE 1 * is the set of pad shapes, used with D_PAD::{Set,Get}Shape()
#define PAD_ROUND PAD_CIRCLE */
#define PAD_RECT 2 enum PAD_SHAPE_T
#define PAD_OVAL 3 {
#define PAD_TRAPEZOID 4 // trapezoid PAD_NONE,
#define PAD_RRECT 5 PAD_CIRCLE,
#define PAD_OCTAGON 6 PAD_ROUND = PAD_CIRCLE,
#define PAD_SQUARE 7 PAD_RECT,
PAD_OVAL,
PAD_TRAPEZOID,
PAD_RRECT,
PAD_OCTAGON,
PAD_SQUARE,
};
/* PADS attributes */ /**
#define PAD_STANDARD 0 // Usual pad * Enum PAD_ATTR_T
#define PAD_SMD 1 // Smd pad, appears on the solder paste layer (default) * is the set of pad shapes, used with D_PAD::{Set,Get}Attribute()
#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 enum PAD_ATTR_T
// mechanical used only {
// no connection allowed 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; ...@@ -52,8 +52,5 @@ extern DLIST<TRACK> g_CurrentTrackList;
#define g_FirstTrackSegment g_CurrentTrackList.GetFirst() ///< first segment created #define g_FirstTrackSegment g_CurrentTrackList.GetFirst() ///< first segment created
/// Pad editing
extern D_PAD g_Pad_Master;
#endif // PCBCOMMON_H_ #endif // PCBCOMMON_H_
...@@ -22,7 +22,10 @@ void RotatePoint( int *pX, int *pY, int cx, int cy, double angle ); ...@@ -22,7 +22,10 @@ void RotatePoint( int *pX, int *pY, int cx, int cy, double angle );
* Calculates the new coord point point * Calculates the new coord point point
* for a rotation angle in (1 / 10 degree) * 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 * Calculates the new coord point point
......
...@@ -666,7 +666,7 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC ) ...@@ -666,7 +666,7 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
for( Pad = aModule->m_Pads; Pad != NULL; Pad = Pad->Next() ) for( Pad = aModule->m_Pads; Pad != NULL; Pad = Pad->Next() )
{ {
if( ( Pad->m_layerMask & otherLayerMask ) == 0 ) if( ( Pad->GetLayerMask() & otherLayerMask ) == 0 )
continue; continue;
TstOtherSide = true; TstOtherSide = true;
......
...@@ -443,7 +443,7 @@ void MoveMarkedItems( MODULE* module, wxPoint offset ) ...@@ -443,7 +443,7 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
continue; continue;
pad->SetPosition( pad->GetPosition() + offset ); pad->SetPosition( pad->GetPosition() + offset );
pad->m_Pos0 += offset; pad->SetPos0( pad->GetPos0() + offset );
} }
item = module->m_Drawings; item = module->m_Drawings;
...@@ -526,29 +526,38 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset ) ...@@ -526,29 +526,38 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
{ {
#define SETMIRROR( z ) (z) -= offset.x; (z) = -(z); (z) += offset.x; #define SETMIRROR( z ) (z) -= offset.x; (z) = -(z); (z) += offset.x;
wxPoint tmp; wxPoint tmp;
wxSize tmpz;
if( module == NULL ) if( module == NULL )
return; return;
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() ) 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; continue;
tmp = pad->GetPosition(); tmp = pad->GetPosition();
SETMIRROR( tmp.x ); SETMIRROR( tmp.x );
pad->SetPosition( tmp ); pad->SetPosition( tmp );
pad->m_Pos0.x = pad->GetPosition().x; pad->SetX0( pad->GetPosition().x );
NEGATE( pad->m_Offset.x );
NEGATE( pad->m_DeltaSize.x ); tmp = pad->GetOffset();
pad->m_Orient = 1800 - pad->m_Orient; NEGATE( tmp.x );
NORMALIZE_ANGLE_POS( pad->m_Orient ); 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() ) 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; continue;
switch( item->Type() ) switch( item->Type() )
...@@ -609,9 +618,8 @@ void RotateMarkedItems( MODULE* module, wxPoint offset ) ...@@ -609,9 +618,8 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
ROTATE( pos ); ROTATE( pos );
pad->SetPosition( pos ); pad->SetPosition( pos );
pad->m_Pos0 = pad->GetPosition(); pad->SetPos0( pad->GetPosition() );
pad->m_Orient += 900; pad->SetOrientation( pad->GetOrientation() + 900 );
NORMALIZE_ANGLE_POS( pad->m_Orient );
} }
for( EDA_ITEM* item = module->m_Drawings; item; item = item->Next() ) for( EDA_ITEM* item = module->m_Drawings; item; item = item->Next() )
......
...@@ -1181,7 +1181,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData, ...@@ -1181,7 +1181,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
* D_PAD* pad = (D_PAD*) item; * D_PAD* pad = (D_PAD*) item;
* if( pad->HitTest( refPos ) ) * if( pad->HitTest( refPos ) )
* { * {
* if( layer_mask & pad->m_layerMask ) * if( layer_mask & pad->GetLayerMask() )
* { * {
* found = item; * found = item;
* return SEARCH_QUIT; * return SEARCH_QUIT;
...@@ -1572,11 +1572,11 @@ D_PAD* BOARD::GetPadFast( const wxPoint& aPosition, int aLayerMask ) ...@@ -1572,11 +1572,11 @@ D_PAD* BOARD::GetPadFast( const wxPoint& aPosition, int aLayerMask )
{ {
D_PAD* pad = m_NetInfo.GetPad(i); D_PAD* pad = m_NetInfo.GetPad(i);
if( pad->m_Pos != aPosition ) if( pad->GetPosition() != aPosition )
continue; continue;
/* Pad found, it must be on the correct layer */ /* Pad found, it must be on the correct layer */
if( pad->m_layerMask & aLayerMask ) if( pad->GetLayerMask() & aLayerMask )
return pad; return pad;
} }
...@@ -1603,10 +1603,10 @@ D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, i ...@@ -1603,10 +1603,10 @@ D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, i
D_PAD* pad = aPadList[idx]; 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: // The pad must match the layer mask:
if( (aLayerMask & pad->m_layerMask) != 0 ) if( (aLayerMask & pad->GetLayerMask()) != 0 )
return pad; return pad;
// More than one pad can be at aPosition // 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 ...@@ -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++ ) for( int ii = idx+1; ii <= idxmax; ii++ )
{ {
pad = aPadList[ii]; pad = aPadList[ii];
if( pad->m_Pos != aPosition ) if( pad->GetPosition() != aPosition )
break; break;
if( (aLayerMask & pad->m_layerMask) != 0 ) if( (aLayerMask & pad->GetLayerMask()) != 0 )
return pad; return pad;
} }
// search previous // search previous
for( int ii = idx-1 ;ii >=0; ii-- ) for( int ii = idx-1 ;ii >=0; ii-- )
{ {
pad = aPadList[ii]; pad = aPadList[ii];
if( pad->m_Pos != aPosition ) if( pad->GetPosition() != aPosition )
break; break;
if( (aLayerMask & pad->m_layerMask) != 0 ) if( (aLayerMask & pad->GetLayerMask()) != 0 )
return pad; return pad;
} }
...@@ -1635,9 +1635,9 @@ D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, i ...@@ -1635,9 +1635,9 @@ D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, i
return 0; 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; idx += delta;
if( idx > idxmax ) if( idx > idxmax )
...@@ -1650,7 +1650,7 @@ D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, i ...@@ -1650,7 +1650,7 @@ D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, i
idx = 0; 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; idx += delta;
if( idx > idxmax ) if( idx > idxmax )
...@@ -1674,9 +1674,9 @@ D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, i ...@@ -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 ) static bool sortPadsByXthenYCoord( D_PAD* const & ref, D_PAD* const & comp )
{ {
if( ref->m_Pos.x == comp->m_Pos.x ) if( ref->GetPosition().x == comp->GetPosition().x )
return ref->m_Pos.y < comp->m_Pos.y; return ref->GetPosition().y < comp->GetPosition().y;
return ref->m_Pos.x < comp->m_Pos.x; return ref->GetPosition().x < comp->GetPosition().x;
} }
...@@ -1919,13 +1919,13 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, ...@@ -1919,13 +1919,13 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace,
if( track->GetState( BEGIN_ONPAD ) ) if( track->GetState( BEGIN_ONPAD ) )
{ {
D_PAD * pad = (D_PAD *) track->start; D_PAD * pad = (D_PAD *) track->start;
lenDie += (double) pad->m_LengthDie; lenDie += (double) pad->GetDieLength();
} }
if( track->GetState( END_ONPAD ) ) if( track->GetState( END_ONPAD ) )
{ {
D_PAD * pad = (D_PAD *) track->end; 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, ...@@ -1949,13 +1949,13 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace,
if( track->GetState( BEGIN_ONPAD ) ) if( track->GetState( BEGIN_ONPAD ) )
{ {
D_PAD * pad = (D_PAD *) track->start; D_PAD * pad = (D_PAD *) track->start;
lenDie += (double) pad->m_LengthDie; lenDie += (double) pad->GetDieLength();
} }
if( track->GetState( END_ONPAD ) ) if( track->GetState( END_ONPAD ) )
{ {
D_PAD * pad = (D_PAD *) track->end; D_PAD * pad = (D_PAD *) track->end;
lenDie += (double) pad->m_LengthDie; lenDie += (double) pad->GetDieLength();
} }
} }
} }
......
...@@ -13,7 +13,8 @@ ...@@ -13,7 +13,8 @@
#include <class_track.h> #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. m_EnabledLayers = ALL_LAYERS; // All layers enabled at first.
// SetCopperLayerCount() will adjust this. // SetCopperLayerCount() will adjust this.
...@@ -59,6 +60,48 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() ...@@ -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 // see pcbstruct.h
int BOARD_DESIGN_SETTINGS::GetVisibleLayers() const int BOARD_DESIGN_SETTINGS::GetVisibleLayers() const
{ {
...@@ -123,11 +166,6 @@ void BOARD_DESIGN_SETTINGS::SetCopperLayerCount( int aNewLayerCount ) ...@@ -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 ) void BOARD_DESIGN_SETTINGS::SetEnabledLayers( int aMask )
{ {
// Back and front layers are always enabled. // Back and front layers are always enabled.
......
...@@ -102,13 +102,13 @@ MODULE::MODULE( const MODULE& aModule ) : ...@@ -102,13 +102,13 @@ MODULE::MODULE( const MODULE& aModule ) :
m_LocalSolderPasteMargin = aModule.m_LocalSolderPasteMargin; m_LocalSolderPasteMargin = aModule.m_LocalSolderPasteMargin;
m_LocalSolderPasteMarginRatio = aModule.m_LocalSolderPasteMarginRatio; m_LocalSolderPasteMarginRatio = aModule.m_LocalSolderPasteMarginRatio;
/* Copy reference and value. */ // Copy reference and value.
m_Reference = new TEXTE_MODULE( *aModule.m_Reference ); m_Reference = new TEXTE_MODULE( *aModule.m_Reference );
m_Reference->SetParent( this ); m_Reference->SetParent( this );
m_Value = new TEXTE_MODULE( *aModule.m_Value ); m_Value = new TEXTE_MODULE( *aModule.m_Value );
m_Value->SetParent( this ); m_Value->SetParent( this );
/* Copy auxiliary data: Pads */ // Copy auxiliary data: Pads
m_Pads.DeleteAll(); m_Pads.DeleteAll();
for( D_PAD* pad = aModule.m_Pads; pad; pad = pad->Next() ) for( D_PAD* pad = aModule.m_Pads; pad; pad = pad->Next() )
...@@ -118,7 +118,7 @@ MODULE::MODULE( const MODULE& aModule ) : ...@@ -118,7 +118,7 @@ MODULE::MODULE( const MODULE& aModule ) :
m_Pads.PushBack( newpad ); m_Pads.PushBack( newpad );
} }
/* Copy auxiliary data: Drawings */ // Copy auxiliary data: Drawings
m_Drawings.DeleteAll(); m_Drawings.DeleteAll();
for( BOARD_ITEM* item = aModule.m_Drawings; item; item = item->Next() ) for( BOARD_ITEM* item = aModule.m_Drawings; item; item = item->Next() )
...@@ -138,7 +138,7 @@ MODULE::MODULE( const MODULE& aModule ) : ...@@ -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(); m_3D_Drawings.DeleteAll();
for( S3D_MASTER* item = aModule.m_3D_Drawings; item; item = item->Next() ) for( S3D_MASTER* item = aModule.m_3D_Drawings; item; item = item->Next() )
...@@ -217,11 +217,11 @@ void MODULE::Copy( MODULE* aModule ) ...@@ -217,11 +217,11 @@ void MODULE::Copy( MODULE* aModule )
m_LocalSolderPasteMargin = aModule->m_LocalSolderPasteMargin; m_LocalSolderPasteMargin = aModule->m_LocalSolderPasteMargin;
m_LocalSolderPasteMarginRatio = aModule->m_LocalSolderPasteMarginRatio; m_LocalSolderPasteMarginRatio = aModule->m_LocalSolderPasteMarginRatio;
/* Copy reference and value. */ // Copy reference and value.
m_Reference->Copy( aModule->m_Reference ); m_Reference->Copy( aModule->m_Reference );
m_Value->Copy( aModule->m_Value ); m_Value->Copy( aModule->m_Value );
/* Copy auxiliary data: Pads */ // Copy auxiliary data: Pads
m_Pads.DeleteAll(); m_Pads.DeleteAll();
for( D_PAD* pad = aModule->m_Pads; pad; pad = pad->Next() ) for( D_PAD* pad = aModule->m_Pads; pad; pad = pad->Next() )
...@@ -231,7 +231,7 @@ void MODULE::Copy( MODULE* aModule ) ...@@ -231,7 +231,7 @@ void MODULE::Copy( MODULE* aModule )
m_Pads.PushBack( newpad ); m_Pads.PushBack( newpad );
} }
/* Copy auxiliary data: Drawings */ // Copy auxiliary data: Drawings
m_Drawings.DeleteAll(); m_Drawings.DeleteAll();
for( BOARD_ITEM* item = aModule->m_Drawings; item; item = item->Next() ) for( BOARD_ITEM* item = aModule->m_Drawings; item; item = item->Next() )
...@@ -258,7 +258,7 @@ void MODULE::Copy( MODULE* aModule ) ...@@ -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(); m_3D_Drawings.DeleteAll();
// Ensure there is one (or more) item in m_3D_Drawings // 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 ...@@ -314,7 +314,7 @@ void MODULE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoi
// Draws footprint anchor // Draws footprint anchor
DrawAncre( aPanel, aDC, aOffset, DIM_ANCRE_MODULE, aDrawMode ); DrawAncre( aPanel, aDC, aOffset, DIM_ANCRE_MODULE, aDrawMode );
/* Draw graphic items */ // Draw graphic items
if( brd->IsElementVisible( MOD_REFERENCES_VISIBLE ) ) if( brd->IsElementVisible( MOD_REFERENCES_VISIBLE ) )
{ {
if( !(m_Reference->IsMoving()) ) if( !(m_Reference->IsMoving()) )
...@@ -549,8 +549,8 @@ D_PAD* MODULE::GetPad( const wxPoint& aPosition, int aLayerMask ) ...@@ -549,8 +549,8 @@ D_PAD* MODULE::GetPad( const wxPoint& aPosition, int aLayerMask )
{ {
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() ) for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
{ {
/* ... and on the correct layer. */ // ... and on the correct layer.
if( ( pad->m_layerMask & aLayerMask ) == 0 ) if( ( pad->GetLayerMask() & aLayerMask ) == 0 )
continue; continue;
if( pad->HitTest( aPosition ) ) if( pad->HitTest( aPosition ) )
......
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
*/ */
#ifndef _MODULE_H_ #ifndef MODULE_H_
#define _MODULE_H_ #define MODULE_H_
#include <dlist.h> #include <dlist.h>
...@@ -420,4 +420,4 @@ private: ...@@ -420,4 +420,4 @@ private:
}; };
#endif // _MODULE_H_ #endif // MODULE_H_
...@@ -161,22 +161,9 @@ void MODULE::Flip( const wxPoint& aCentre ) ...@@ -161,22 +161,9 @@ void MODULE::Flip( const wxPoint& aCentre )
NEGATE( m_Orient ); NEGATE( m_Orient );
NORMALIZE_ANGLE_POS( 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() ) for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
{ pad->Flip( m_Pos.y );
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 );
}
// Mirror reference. // Mirror reference.
pt_texte = m_Reference; pt_texte = m_Reference;
...@@ -301,7 +288,7 @@ void MODULE::SetPosition( const wxPoint& newpos ) ...@@ -301,7 +288,7 @@ void MODULE::SetPosition( const wxPoint& newpos )
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() ) 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() ) for( EDA_ITEM* item = m_Drawings; item; item = item->Next() )
...@@ -334,25 +321,22 @@ void MODULE::SetPosition( const wxPoint& newpos ) ...@@ -334,25 +321,22 @@ void MODULE::SetPosition( const wxPoint& newpos )
void MODULE::SetOrientation( double newangle ) void MODULE::SetOrientation( double newangle )
{ {
int px, py; double angleChange = newangle - m_Orient; // change in rotation
wxPoint pt;
newangle -= m_Orient; // = Change in rotation
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() ) for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
{ {
px = pad->m_Pos0.x; pt = pad->GetPos0();
py = pad->m_Pos0.y;
pad->SetOrientation( pad->GetOrientation() + angleChange );
pad->m_Orient += newangle; // change m_Orientation RotatePoint( &pt, m_Orient );
NORMALIZE_ANGLE_POS( pad->m_Orient );
RotatePoint( &px, &py, m_Orient ); pad->SetPosition( GetPosition() + pt );
pad->m_Pos.x = m_Pos.x + px;
pad->m_Pos.y = m_Pos.y + py;
} }
// Update of the reference and value. // Update of the reference and value.
......
...@@ -100,7 +100,7 @@ void NETINFO_ITEM::DisplayInfo( EDA_DRAW_FRAME* frame ) ...@@ -100,7 +100,7 @@ void NETINFO_ITEM::DisplayInfo( EDA_DRAW_FRAME* frame )
if( pad->GetNet() == GetNet() ) if( pad->GetNet() == GetNet() )
{ {
count++; count++;
lengthdie += pad->m_LengthDie; lengthdie += pad->GetDieLength();
} }
} }
} }
...@@ -172,6 +172,7 @@ void RATSNEST_ITEM::Draw( EDA_DRAW_PANEL* panel, ...@@ -172,6 +172,7 @@ void RATSNEST_ITEM::Draw( EDA_DRAW_PANEL* panel,
int color = g_ColorsSettings.GetItemColor(RATSNEST_VISIBLE); int color = g_ColorsSettings.GetItemColor(RATSNEST_VISIBLE);
GRLine( panel->GetClipBox(), DC, m_PadStart->m_Pos - aOffset, GRLine( panel->GetClipBox(), DC,
m_PadEnd->m_Pos - aOffset, 0, color ); m_PadStart->GetPosition() - aOffset,
m_PadEnd->GetPosition() - aOffset, 0, color );
} }
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <confirm.h> #include <confirm.h>
#include <kicad_string.h> #include <kicad_string.h>
#include <trigo.h> #include <trigo.h>
#include <protos.h>
#include <richio.h> #include <richio.h>
#include <wxstruct.h> #include <wxstruct.h>
#include <macros.h> #include <macros.h>
...@@ -47,7 +48,8 @@ ...@@ -47,7 +48,8 @@
int D_PAD::m_PadSketchModePenSize = 0; // Pen size used to draw pads in sketch mode 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; m_NumPadName = 0;
...@@ -55,40 +57,35 @@ D_PAD::D_PAD( MODULE* parent ) : BOARD_CONNECTED_ITEM( parent, PCB_PAD_T ) ...@@ -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_Orient = 0; // Pad rotation in 1/10 degrees
m_LengthDie = 0; 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 m_PadShape = PAD_CIRCLE; // Shape: PAD_CIRCLE, PAD_RECT PAD_OVAL
// PAD_TRAPEZOID // 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_DrillShape = PAD_CIRCLE; // Drill shape = circle
m_LocalClearance = 0; m_LocalClearance = 0;
m_LocalSolderMaskMargin = 0; m_LocalSolderMaskMargin = 0;
m_LocalSolderPasteMargin = 0; m_LocalSolderPasteMargin = 0;
m_LocalSolderPasteMarginRatio = 0.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 // set layers mask to default for a standard pad
ComputeShapeMaxRadius(); 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::boundingRadius() const
*/
int D_PAD::GetMaxRadius() const
{ {
int x, y; int x, y;
int radius; int radius;
switch( m_PadShape & 0x7F ) switch( GetShape() )
{ {
case PAD_CIRCLE: case PAD_CIRCLE:
radius = m_Size.x / 2; radius = m_Size.x / 2;
...@@ -110,30 +107,19 @@ int D_PAD::GetMaxRadius() const ...@@ -110,30 +107,19 @@ int D_PAD::GetMaxRadius() const
break; break;
default: default:
radius = 0; // quiet compiler radius = 0;
} }
return radius; 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 D_PAD::GetBoundingBox() const
{ {
EDA_RECT area; 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.SetOrigin( m_Pos );
area.Inflate( radius ); area.Inflate( radius );
...@@ -142,6 +128,49 @@ EDA_RECT D_PAD::GetBoundingBox() const ...@@ -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. // Returns the position of the pad.
const wxPoint D_PAD::ReturnShapePos() const wxPoint D_PAD::ReturnShapePos()
{ {
...@@ -265,9 +294,9 @@ void D_PAD::Copy( D_PAD* source ) ...@@ -265,9 +294,9 @@ void D_PAD::Copy( D_PAD* source )
m_Size = source->m_Size; m_Size = source->m_Size;
m_DeltaSize = source->m_DeltaSize; m_DeltaSize = source->m_DeltaSize;
m_Pos0 = source->m_Pos0; m_Pos0 = source->m_Pos0;
m_ShapeMaxRadius = source->m_ShapeMaxRadius; m_boundingRadius = source->m_boundingRadius;
m_PadShape = source->m_PadShape; m_PadShape = source->m_PadShape;
m_Attribut = source->m_Attribut; m_Attribute = source->m_Attribute;
m_Orient = source->m_Orient; m_Orient = source->m_Orient;
m_LengthDie = source->m_LengthDie; m_LengthDie = source->m_LengthDie;
m_LocalClearance = source->m_LocalClearance; m_LocalClearance = source->m_LocalClearance;
...@@ -581,9 +610,9 @@ void D_PAD::DisplayInfo( EDA_DRAW_FRAME* frame ) ...@@ -581,9 +610,9 @@ void D_PAD::DisplayInfo( EDA_DRAW_FRAME* frame )
valeur_param( m_Pos.y, Line ); valeur_param( m_Pos.y, Line );
frame->AppendMsgPanel( _( "Y pos" ), Line, LIGHTBLUE ); 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 ); frame->AppendMsgPanel( _( "Length on die" ), Line, CYAN );
} }
} }
...@@ -596,12 +625,6 @@ bool D_PAD::IsOnLayer( int aLayer ) const ...@@ -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 ) bool D_PAD::HitTest( const wxPoint& refPos )
{ {
int dx, dy; int dx, dy;
...@@ -611,8 +634,10 @@ bool D_PAD::HitTest( const wxPoint& refPos ) ...@@ -611,8 +634,10 @@ bool D_PAD::HitTest( const wxPoint& refPos )
wxPoint delta = refPos - shape_pos; wxPoint delta = refPos - shape_pos;
/* Quick test: a test point must be inside the circle. */ // first test: a test point must be inside a minimum sized bounding circle.
if( ( abs( delta.x ) > m_ShapeMaxRadius ) || ( abs( delta.y ) > m_ShapeMaxRadius ) ) int radius = GetBoundingRadius();
if( ( abs( delta.x ) > radius ) || ( abs( delta.y ) > radius ) )
return false; return false;
dx = m_Size.x >> 1; // dx also is the radius for rounded pads dx = m_Size.x >> 1; // dx also is the radius for rounded pads
...@@ -716,7 +741,7 @@ wxString D_PAD::ShowPadShape() const ...@@ -716,7 +741,7 @@ wxString D_PAD::ShowPadShape() const
wxString D_PAD::ShowPadAttr() const wxString D_PAD::ShowPadAttr() const
{ {
switch( m_Attribut & 0x0F ) switch( GetAttribute() )
{ {
case PAD_STANDARD: case PAD_STANDARD:
return _( "Std" ); 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 ...@@ -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 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 // when routing tracks
if( frame && frame->GetToolId() == ID_TRACK_BUTT ) 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 ...@@ -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 ) if( ( m_layerMask & ALL_CU_LAYERS ) == 0 )
DisplayIsol = false; DisplayIsol = false;
if( m_Attribut == PAD_HOLE_NOT_PLATED ) if( GetAttribute() == PAD_HOLE_NOT_PLATED )
drawInfo.m_ShowNotPlatedHole = true; drawInfo.m_ShowNotPlatedHole = true;
drawInfo.m_DrawMode = aDraw_mode; drawInfo.m_DrawMode = aDraw_mode;
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#include <class_board.h> #include <class_board.h>
#include <class_track.h> #include <class_track.h>
/* local functions : */ // local functions :
static void clean_segments( PCB_EDIT_FRAME* aFrame ); static void clean_segments( PCB_EDIT_FRAME* aFrame );
static void clean_vias( BOARD* aPcb ); static void clean_vias( BOARD* aPcb );
static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* aFrame ); static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* aFrame );
...@@ -93,7 +93,7 @@ void CleanupTracks( PCB_EDIT_FRAME* aFrame, ...@@ -93,7 +93,7 @@ void CleanupTracks( PCB_EDIT_FRAME* aFrame,
aFrame->GetScreen()->ClearUndoRedoList(); aFrame->GetScreen()->ClearUndoRedoList();
aFrame->SetCurItem( NULL ); 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()->m_Status_Pcb = 0;
aFrame->GetBoard()->BuildListOfNets(); aFrame->GetBoard()->BuildListOfNets();
...@@ -110,22 +110,22 @@ void CleanupTracks( PCB_EDIT_FRAME* aFrame, ...@@ -110,22 +110,22 @@ void CleanupTracks( PCB_EDIT_FRAME* aFrame,
{ {
aFrame->SetStatusText( _( "Reconnect pads" ) ); 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 ); 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() ); ConnectDanglingEndToVia( aFrame->GetBoard() );
} }
#endif #endif
/* Remove null segments and intermediate points on aligned segments */ // Remove null segments and intermediate points on aligned segments
if( aMergeSegments ) if( aMergeSegments )
{ {
aFrame->SetStatusText( _( "Merge track segments" ) ); aFrame->SetStatusText( _( "Merge track segments" ) );
clean_segments( aFrame ); clean_segments( aFrame );
} }
/* Delete dangling tracks */ // Delete dangling tracks
if( aDeleteUnconnectedSegm ) if( aDeleteUnconnectedSegm )
{ {
aFrame->SetStatusText( _( "Delete unconnected tracks" ) ); aFrame->SetStatusText( _( "Delete unconnected tracks" ) );
...@@ -163,13 +163,13 @@ void clean_vias( BOARD * aPcb ) ...@@ -163,13 +163,13 @@ void clean_vias( BOARD * aPcb )
if( alt_track->m_Start != track->m_Start ) if( alt_track->m_Start != track->m_Start )
continue; continue;
/* delete via */ // delete via
alt_track->UnLink(); alt_track->UnLink();
delete alt_track; 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 ) for( track = aPcb->m_Track; track != NULL; track = next_track )
{ {
next_track = track->Next(); next_track = track->Next();
...@@ -179,9 +179,9 @@ void clean_vias( BOARD * aPcb ) ...@@ -179,9 +179,9 @@ void clean_vias( BOARD * aPcb )
D_PAD* pad = aPcb->GetPadFast( track->m_Start, ALL_CU_LAYERS ); 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(); track->UnLink();
delete track; delete track;
} }
...@@ -243,7 +243,7 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* aFrame ) ...@@ -243,7 +243,7 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* aFrame )
flag_erase = 0; //Not connected indicator flag_erase = 0; //Not connected indicator
type_end = 0; type_end = 0;
/* Is a pad found on a track end ? */ // Is a pad found on a track end ?
masklayer = segment->ReturnMaskLayer(); masklayer = segment->ReturnMaskLayer();
...@@ -403,7 +403,7 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* aFrame ) ...@@ -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 ) static void clean_segments( PCB_EDIT_FRAME* aFrame )
{ {
TRACK* segment, * nextsegment; TRACK* segment, * nextsegment;
...@@ -422,11 +422,11 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame ) ...@@ -422,11 +422,11 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
if( !segment->IsNull() ) if( !segment->IsNull() )
continue; continue;
/* Length segment = 0; delete it */ // Length segment = 0; delete it
segment->DeleteStructure(); segment->DeleteStructure();
} }
/* Delete redundant segments */ // Delete redundant segments
for( segment = aFrame->GetBoard()->m_Track, ii = 0; segment; segment = segment->Next(), ii++ ) for( segment = aFrame->GetBoard()->m_Track, ii = 0; segment; segment = segment->Next(), ii++ )
{ {
for( other = segment->Next(); other; other = nextsegment ) for( other = segment->Next(); other; other = nextsegment )
...@@ -455,7 +455,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame ) ...@@ -455,7 +455,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
erase = 1; erase = 1;
} }
/* Delete redundant point */ // Delete redundant point
if( erase ) if( erase )
{ {
ii--; ii--;
...@@ -464,7 +464,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame ) ...@@ -464,7 +464,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
} }
} }
/* delete intermediate points */ // delete intermediate points
ii = 0; ii = 0;
for( segment = aFrame->GetBoard()->m_Track; segment; segment = nextsegment ) for( segment = aFrame->GetBoard()->m_Track; segment; segment = nextsegment )
...@@ -498,13 +498,13 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame ) ...@@ -498,13 +498,13 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
if( segStart->Type() != PCB_TRACE_T ) if( segStart->Type() != PCB_TRACE_T )
break; break;
/* We must have only one segment connected */ // We must have only one segment connected
segStart->SetState( BUSY, ON ); segStart->SetState( BUSY, ON );
other = segment->GetTrace( aFrame->GetBoard()->m_Track, NULL, START ); other = segment->GetTrace( aFrame->GetBoard()->m_Track, NULL, START );
segStart->SetState( BUSY, OFF ); segStart->SetState( BUSY, OFF );
if( other == NULL ) if( other == NULL )
flag = 1; /* OK */ flag = 1; // OK
break; break;
} }
...@@ -523,7 +523,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame ) ...@@ -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(); ; ) for( segEnd = segment->Next(); ; )
{ {
segEnd = segment->GetTrace( segEnd, NULL, END ); segEnd = segment->GetTrace( segEnd, NULL, END );
...@@ -536,13 +536,13 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame ) ...@@ -536,13 +536,13 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
if( segEnd->Type() != PCB_TRACE_T ) if( segEnd->Type() != PCB_TRACE_T )
break; break;
/* We must have only one segment connected */ // We must have only one segment connected
segEnd->SetState( BUSY, ON ); segEnd->SetState( BUSY, ON );
other = segment->GetTrace( aFrame->GetBoard()->m_Track, NULL, END ); other = segment->GetTrace( aFrame->GetBoard()->m_Track, NULL, END );
segEnd->SetState( BUSY, OFF ); segEnd->SetState( BUSY, OFF );
if( other == NULL ) if( other == NULL )
flag |= 2; /* Ok */ flag |= 2; // Ok
break; break;
} }
...@@ -563,7 +563,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame ) ...@@ -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(); nextsegment = segment->Next();
} }
...@@ -571,7 +571,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame ) ...@@ -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). * 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). * 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) * the ending point of pt_ref is the start point (aEndType == START)
...@@ -876,15 +876,15 @@ void ConnectDanglingEndToPad( PCB_EDIT_FRAME* aFrame ) ...@@ -876,15 +876,15 @@ void ConnectDanglingEndToPad( PCB_EDIT_FRAME* aFrame )
if( pad ) if( pad )
{ {
// test if the track start point is not exactly starting on the 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 ) 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() ); aFrame->GetBoard()->m_Track.Insert( newTrack, segment->Next() );
newTrack->m_End = pad->m_Pos; newTrack->m_End = pad->GetPosition();
newTrack->start = segment; newTrack->start = segment;
newTrack->end = pad; newTrack->end = pad;
...@@ -898,7 +898,7 @@ void ConnectDanglingEndToPad( PCB_EDIT_FRAME* aFrame ) ...@@ -898,7 +898,7 @@ void ConnectDanglingEndToPad( PCB_EDIT_FRAME* aFrame )
if( pad ) if( pad )
{ {
// test if the track end point is not exactly on the 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 ) if( segment->GetTrace( aFrame->GetBoard()->m_Track, NULL, END ) == NULL )
{ {
...@@ -906,7 +906,7 @@ void ConnectDanglingEndToPad( PCB_EDIT_FRAME* aFrame ) ...@@ -906,7 +906,7 @@ void ConnectDanglingEndToPad( PCB_EDIT_FRAME* aFrame )
aFrame->GetBoard()->m_Track.Insert( newTrack, segment->Next() ); aFrame->GetBoard()->m_Track.Insert( newTrack, segment->Next() );
newTrack->m_Start = pad->m_Pos; newTrack->m_Start = pad->GetPosition();
newTrack->start = pad; newTrack->start = pad;
newTrack->end = segment; newTrack->end = segment;
......
...@@ -235,8 +235,8 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa ...@@ -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 // for through pads: pads on Front or Back board sides must be seen
pad = (D_PAD*) item; pad = (D_PAD*) item;
if( (pad->m_Attribut != PAD_SMD) && if( (pad->GetAttribute() != PAD_SMD) &&
(pad->m_Attribut != PAD_CONN) ) // a hole is present, so multiple layers (pad->GetAttribute() != PAD_CONN) ) // a hole is present, so multiple layers
{ {
// proceed to the common tests below, but without the parent module test, // proceed to the common tests below, but without the parent module test,
// by leaving module==NULL, but having pad != null // by leaving module==NULL, but having pad != null
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
extern void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb ); extern void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb );
extern void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode ); extern void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode );
/* Local functions */ // Local functions
static void RebuildTrackChain( BOARD* pcb ); static void RebuildTrackChain( BOARD* pcb );
...@@ -276,7 +276,9 @@ void CONNECTIONS::SearchConnectionsPadsToIntersectingPads() ...@@ -276,7 +276,9 @@ void CONNECTIONS::SearchConnectionsPadsToIntersectingPads()
D_PAD * pad = m_sortedPads[ii]; D_PAD * pad = m_sortedPads[ii];
pad->m_PadsConnected.clear(); pad->m_PadsConnected.clear();
candidates.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 // add pads to pad.m_PadsConnected, if they are connected
for( unsigned jj = 0; jj < candidates.size(); jj++ ) for( unsigned jj = 0; jj < candidates.size(); jj++ )
{ {
...@@ -285,7 +287,7 @@ void CONNECTIONS::SearchConnectionsPadsToIntersectingPads() ...@@ -285,7 +287,7 @@ void CONNECTIONS::SearchConnectionsPadsToIntersectingPads()
if( pad == candidate_pad ) if( pad == candidate_pad )
continue; continue;
if( (pad->m_layerMask & candidate_pad->m_layerMask) == 0 ) if( (pad->GetLayerMask() & candidate_pad->GetLayerMask()) == 0 )
continue; continue;
if( pad->HitTest( item->GetPoint() ) ) if( pad->HitTest( item->GetPoint() ) )
{ {
...@@ -311,14 +313,16 @@ void CONNECTIONS::SearchTracksConnectedToPads() ...@@ -311,14 +313,16 @@ void CONNECTIONS::SearchTracksConnectedToPads()
pad->m_TracksConnected.clear(); pad->m_TracksConnected.clear();
candidates.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 // add this pad to track.m_PadsConnected, if it is connected
for( unsigned jj = 0; jj < candidates.size(); jj++ ) for( unsigned jj = 0; jj < candidates.size(); jj++ )
{ {
CONNECTED_POINT * cp_item = candidates[jj]; CONNECTED_POINT* cp_item = candidates[jj];
if( (pad->m_layerMask & cp_item->GetTrack()->ReturnMaskLayer()) == 0 )
if( (pad->GetLayerMask() & cp_item->GetTrack()->ReturnMaskLayer()) == 0 )
continue; continue;
if( pad->HitTest( cp_item->GetPoint() ) ) if( pad->HitTest( cp_item->GetPoint() ) )
{ {
cp_item->GetTrack()->m_PadsConnected.push_back( pad ); cp_item->GetTrack()->m_PadsConnected.push_back( pad );
...@@ -731,7 +735,7 @@ void CONNECTIONS::Propagate_SubNets() ...@@ -731,7 +735,7 @@ void CONNECTIONS::Propagate_SubNets()
pad->SetSubNet( curr_pad->GetSubNet() ); 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 ) if( pad->GetSubNet() > 0 )
{ {
...@@ -758,16 +762,16 @@ void CONNECTIONS::Propagate_SubNets() ...@@ -758,16 +762,16 @@ void CONNECTIONS::Propagate_SubNets()
// Examine connections between trcaks and pads // Examine connections between trcaks and pads
for( ; curr_track != NULL; curr_track = curr_track->Next() ) 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++ ) for( unsigned ii = 0; ii < curr_track->m_PadsConnected.size(); ii++ )
{ {
D_PAD * pad = curr_track->m_PadsConnected[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 ) 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() ); Merge_SubNets( pad->GetSubNet(), curr_track->GetSubNet() );
} }
else else
...@@ -777,11 +781,11 @@ void CONNECTIONS::Propagate_SubNets() ...@@ -777,11 +781,11 @@ void CONNECTIONS::Propagate_SubNets()
pad->SetSubNet( curr_track->GetSubNet() ); 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 ) 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() ); curr_track->SetSubNet( pad->GetSubNet() );
} }
else else
...@@ -795,13 +799,13 @@ void CONNECTIONS::Propagate_SubNets() ...@@ -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++ ) for( unsigned ii = 0; ii < curr_track->m_TracksConnected.size(); ii++ )
{ {
BOARD_CONNECTED_ITEM* track = curr_track->m_TracksConnected[ii]; BOARD_CONNECTED_ITEM* track = curr_track->m_TracksConnected[ii];
if( curr_track->GetSubNet() ) // The current track is already a cluster member 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() ) if( track->GetSubNet() )
{ {
Merge_SubNets( track->GetSubNet(), curr_track->GetSubNet() ); Merge_SubNets( track->GetSubNet(), curr_track->GetSubNet() );
...@@ -920,7 +924,7 @@ void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode ) ...@@ -920,7 +924,7 @@ void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode )
m_Pcb->Test_Connections_To_Copper_Areas( 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 ) if( m_Pcb->m_Track )
{ {
CONNECTIONS connections( m_Pcb ); CONNECTIONS connections( m_Pcb );
...@@ -939,12 +943,12 @@ void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode ) ...@@ -939,12 +943,12 @@ void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode )
Merge_SubNets_Connected_By_CopperAreas( m_Pcb, 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 ); DrawGeneralRatsnest( aDC, aNetCode );
TestForActiveLinksInRatsnest( aNetCode ); TestForActiveLinksInRatsnest( aNetCode );
DrawGeneralRatsnest( aDC, aNetCode ); DrawGeneralRatsnest( aDC, aNetCode );
/* Display results */ // Display results
int net_notconnected_count = 0; int net_notconnected_count = 0;
NETINFO_ITEM* net = m_Pcb->FindNet( aNetCode ); NETINFO_ITEM* net = m_Pcb->FindNet( aNetCode );
if( net ) // Should not occur, but ... if( net ) // Should not occur, but ...
...@@ -1058,7 +1062,7 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode() ...@@ -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 ); RebuildTrackChain( m_Pcb );
} }
......
...@@ -120,14 +120,14 @@ void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties() ...@@ -120,14 +120,14 @@ void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties()
// These 2 parameters are usually < 0, so prepare entering a negative // These 2 parameters are usually < 0, so prepare entering a negative
// value, if current is 0 // value, if current is 0
PutValueInLocalUnits( *m_SolderPasteMarginCtrl, PutValueInLocalUnits( *m_SolderPasteMarginCtrl,
m_CurrentModule->m_LocalSolderPasteMargin, m_CurrentModule->GetLocalSolderPasteMargin(),
internalUnit ); internalUnit );
if( m_CurrentModule->m_LocalSolderPasteMargin == 0 ) if( m_CurrentModule->GetLocalSolderPasteMargin() == 0 )
m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) + m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) +
m_SolderPasteMarginCtrl->GetValue() ); m_SolderPasteMarginCtrl->GetValue() );
msg.Printf( wxT( "%.1f" ), msg.Printf( wxT( "%.1f" ),
m_CurrentModule->m_LocalSolderPasteMarginRatio * 100.0 ); m_CurrentModule->GetLocalSolderPasteMarginRatio() * 100.0 );
if( m_CurrentModule->m_LocalSolderPasteMarginRatio == 0.0 && if( m_CurrentModule->GetLocalSolderPasteMarginRatio() == 0.0 &&
msg[0] == '0') // Sometimes Printf add a sign if the value is small msg[0] == '0') // Sometimes Printf add a sign if the value is small
m_SolderPasteMarginRatioCtrl->SetValue( wxT("-") + msg ); m_SolderPasteMarginRatioCtrl->SetValue( wxT("-") + msg );
else else
...@@ -462,12 +462,13 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event ) ...@@ -462,12 +462,13 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
} }
// Initialize masks clearances // Initialize masks clearances
m_CurrentModule->m_LocalClearance = m_CurrentModule->SetLocalClearance(
ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, m_Parent->GetInternalUnits() ); ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, m_Parent->GetInternalUnits() ) );
m_CurrentModule->m_LocalSolderMaskMargin = m_CurrentModule->SetLocalSolderMaskMargin(
ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->GetInternalUnits() ); ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->GetInternalUnits() ) );
m_CurrentModule->m_LocalSolderPasteMargin = m_CurrentModule->SetLocalSolderPasteMargin(
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->GetInternalUnits() ); ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->GetInternalUnits() ) );
double dtmp = 0.0; double dtmp = 0.0;
msg = m_SolderPasteMarginRatioCtrl->GetValue(); msg = m_SolderPasteMarginRatioCtrl->GetValue();
msg.ToDouble( &dtmp ); msg.ToDouble( &dtmp );
...@@ -479,7 +480,7 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event ) ...@@ -479,7 +480,7 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
if( dtmp > +100 ) if( dtmp > +100 )
dtmp = +100; dtmp = +100;
m_CurrentModule->m_LocalSolderPasteMarginRatio = dtmp / 100; m_CurrentModule->SetLocalSolderPasteMarginRatio( dtmp / 100 );
// Set Module Position // Set Module Position
modpos.x = ReturnValueFromTextCtrl( *m_ModPositionX, PCB_INTERNAL_UNIT ); modpos.x = ReturnValueFromTextCtrl( *m_ModPositionX, PCB_INTERNAL_UNIT );
......
...@@ -61,7 +61,7 @@ void DIALOG_MODULE_MODULE_EDITOR::InitModeditProperties() ...@@ -61,7 +61,7 @@ void DIALOG_MODULE_MODULE_EDITOR::InitModeditProperties()
m_LastSelected3DShapeIndex = -1; m_LastSelected3DShapeIndex = -1;
/* Init 3D shape list */ // Init 3D shape list
S3D_MASTER* draw3D = m_CurrentModule->m_3D_Drawings; S3D_MASTER* draw3D = m_CurrentModule->m_3D_Drawings;
while( draw3D ) while( draw3D )
...@@ -97,7 +97,7 @@ void DIALOG_MODULE_MODULE_EDITOR::InitModeditProperties() ...@@ -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)" ) ); "Use this attribute for \"virtual\" components drawn on board (like a old ISA PC bus connector)" ) );
#endif #endif
/* Controls on right side of the dialog */ // Controls on right side of the dialog
switch( m_CurrentModule->m_Attributs & 255 ) switch( m_CurrentModule->m_Attributs & 255 )
{ {
case 0: case 0:
...@@ -154,13 +154,13 @@ void DIALOG_MODULE_MODULE_EDITOR::InitModeditProperties() ...@@ -154,13 +154,13 @@ void DIALOG_MODULE_MODULE_EDITOR::InitModeditProperties()
m_CurrentModule->m_LocalSolderMaskMargin, internalUnit ); m_CurrentModule->m_LocalSolderMaskMargin, internalUnit );
// These 2 parameters are usually < 0, so prepare entering a negative value, if current is 0 // These 2 parameters are usually < 0, so prepare entering a negative value, if current is 0
PutValueInLocalUnits( *m_SolderPasteMarginCtrl, PutValueInLocalUnits( *m_SolderPasteMarginCtrl,
m_CurrentModule->m_LocalSolderPasteMargin, internalUnit ); m_CurrentModule->GetLocalSolderPasteMargin(), internalUnit );
if( m_CurrentModule->m_LocalSolderPasteMargin == 0 ) if( m_CurrentModule->GetLocalSolderPasteMargin() == 0 )
m_SolderPasteMarginCtrl->SetValue( wxT("-") + m_SolderPasteMarginCtrl->GetValue() ); m_SolderPasteMarginCtrl->SetValue( wxT("-") + m_SolderPasteMarginCtrl->GetValue() );
if( m_CurrentModule->m_LocalSolderPasteMarginRatio == 0.0 ) if( m_CurrentModule->GetLocalSolderPasteMarginRatio() == 0.0 )
msg.Printf( wxT( "-%.1f" ), m_CurrentModule->m_LocalSolderPasteMarginRatio * 100.0 ); msg.Printf( wxT( "-%.1f" ), m_CurrentModule->GetLocalSolderPasteMarginRatio() * 100.0 );
else else
msg.Printf( wxT( "%.1f" ), m_CurrentModule->m_LocalSolderPasteMarginRatio * 100.0 ); msg.Printf( wxT( "%.1f" ), m_CurrentModule->GetLocalSolderPasteMarginRatio() * 100.0 );
m_SolderPasteMarginRatioCtrl->SetValue( msg ); m_SolderPasteMarginRatioCtrl->SetValue( msg );
// if m_3D_ShapeNameListBox is not empty, preselect first 3D shape // if m_3D_ShapeNameListBox is not empty, preselect first 3D shape
...@@ -369,21 +369,26 @@ void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event ) ...@@ -369,21 +369,26 @@ void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event )
// Initialize masks clearances // Initialize masks clearances
int internalUnit = m_Parent->GetInternalUnits(); int internalUnit = m_Parent->GetInternalUnits();
m_CurrentModule->m_LocalClearance =
ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, internalUnit ); m_CurrentModule->SetLocalClearance(
m_CurrentModule->m_LocalSolderMaskMargin = ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, internalUnit ) );
ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, internalUnit );
m_CurrentModule->m_LocalSolderPasteMargin = m_CurrentModule->SetLocalSolderMaskMargin(
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, internalUnit ); ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, internalUnit ) );
m_CurrentModule->SetLocalSolderPasteMargin(
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, internalUnit ) );
double dtmp; double dtmp;
wxString msg = m_SolderPasteMarginRatioCtrl->GetValue(); wxString msg = m_SolderPasteMarginRatioCtrl->GetValue();
msg.ToDouble( &dtmp ); msg.ToDouble( &dtmp );
// A margin ratio de -50% means no paste on a pad, the ratio must be >= 50 % // A margin ratio de -50% means no paste on a pad, the ratio must be >= 50 %
if( dtmp < -50 ) if( dtmp < -50 )
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(); int ii = m_3D_ShapeNameListBox->GetSelection();
if ( ii >= 0 ) if ( ii >= 0 )
TransfertDisplayTo3DValues( ii ); TransfertDisplayTo3DValues( ii );
......
...@@ -174,8 +174,7 @@ void DIALOG_GENDRILL::InitDisplayParams( void ) ...@@ -174,8 +174,7 @@ void DIALOG_GENDRILL::InitDisplayParams( void )
m_MicroViaDrillValue->Enable( m_microViasCount ); 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_platedPadsHoleCount = 0;
m_notplatedPadsHoleCount = 0; m_notplatedPadsHoleCount = 0;
...@@ -183,11 +182,11 @@ void DIALOG_GENDRILL::InitDisplayParams( void ) ...@@ -183,11 +182,11 @@ void DIALOG_GENDRILL::InitDisplayParams( void )
{ {
for( D_PAD* pad = module->m_Pads; pad != NULL; pad = pad->Next() ) 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++; m_notplatedPadsHoleCount++;
else else
m_platedPadsHoleCount++; m_platedPadsHoleCount++;
...@@ -195,9 +194,9 @@ void DIALOG_GENDRILL::InitDisplayParams( void ) ...@@ -195,9 +194,9 @@ void DIALOG_GENDRILL::InitDisplayParams( void )
} }
else 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++; m_notplatedPadsHoleCount++;
else else
m_platedPadsHoleCount++; m_platedPadsHoleCount++;
...@@ -229,7 +228,7 @@ void DIALOG_GENDRILL::InitDisplayParams( void ) ...@@ -229,7 +228,7 @@ void DIALOG_GENDRILL::InitDisplayParams( void )
} }
/* Save drill options: */ // Save drill options:
void DIALOG_GENDRILL::UpdateConfig() void DIALOG_GENDRILL::UpdateConfig()
{ {
SetParams(); SetParams();
...@@ -275,7 +274,7 @@ void DIALOG_GENDRILL::OnOkClick( wxCommandEvent& event ) ...@@ -275,7 +274,7 @@ void DIALOG_GENDRILL::OnOkClick( wxCommandEvent& event )
void DIALOG_GENDRILL::OnCancelClick( 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) EndModal( wxID_CANCEL ); // Process the default cancel event (close dialog)
} }
...@@ -294,13 +293,13 @@ void DIALOG_GENDRILL::UpdatePrecisionOptions() ...@@ -294,13 +293,13 @@ void DIALOG_GENDRILL::UpdatePrecisionOptions()
{ {
if( m_Choice_Unit->GetSelection()== 1 ) // Units = inches if( m_Choice_Unit->GetSelection()== 1 ) // Units = inches
{ {
/* inch options */ // inch options
m_Choice_Precision->SetString( 0, precisionListForInches[0].GetPrecisionString() ); m_Choice_Precision->SetString( 0, precisionListForInches[0].GetPrecisionString() );
m_Choice_Precision->SetString( 1, precisionListForInches[1].GetPrecisionString() ); m_Choice_Precision->SetString( 1, precisionListForInches[1].GetPrecisionString() );
} }
else else
{ {
/* metric options */ // metric options
m_Choice_Precision->SetString( 0, precisionListForMetric[0].GetPrecisionString() ); m_Choice_Precision->SetString( 0, precisionListForMetric[0].GetPrecisionString() );
m_Choice_Precision->SetString( 1, precisionListForMetric[1].GetPrecisionString() ); m_Choice_Precision->SetString( 1, precisionListForMetric[1].GetPrecisionString() );
} }
......
This diff is collapsed.
...@@ -35,36 +35,36 @@ DRAG_SEGM::DRAG_SEGM( TRACK* segm ) ...@@ -35,36 +35,36 @@ DRAG_SEGM::DRAG_SEGM( TRACK* segm )
/* Redraw the list of segments starting in g_DragSegmentList, while moving a footprint */ /* Redraw the list of segments starting in g_DragSegmentList, while moving a footprint */
void DrawSegmentWhileMovingFootprint( EDA_DRAW_PANEL* panel, wxDC* DC ) void DrawSegmentWhileMovingFootprint( EDA_DRAW_PANEL* panel, wxDC* DC )
{ {
D_PAD* pt_pad;
TRACK* Track;
if( g_DragSegmentList.size() == 0 ) if( g_DragSegmentList.size() == 0 )
return; return;
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ ) for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
{ {
wxPoint pos; wxPoint pos;
Track = g_DragSegmentList[ii].m_Segm;
TRACK* track = g_DragSegmentList[ii].m_Segm;
#ifndef USE_WX_OVERLAY #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 #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; pos = pad->GetPosition() - g_Offset_Module;
Track->m_Start = pos; 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; pos = pad->GetPosition() - g_Offset_Module;
Track->m_End = pos; 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 ) ...@@ -74,15 +74,11 @@ void DrawSegmentWhileMovingFootprint( EDA_DRAW_PANEL* panel, wxDC* DC )
* For each selected track segment set the EDIT flag * For each selected track segment set the EDIT flag
* and redraw them in EDIT mode (sketch mode) * 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; for( D_PAD* pad = aModule->m_Pads; pad; pad = pad->Next() )
pt_pad = Module->m_Pads;
for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Next() )
{ {
Build_1_Pad_SegmentsToDrag( panel, DC, pt_pad ); Build_1_Pad_SegmentsToDrag( panel, DC, pad );
} }
return; return;
...@@ -95,37 +91,36 @@ void Build_Drag_Liste( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module ) ...@@ -95,37 +91,36 @@ void Build_Drag_Liste( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module )
* and redraw them in EDIT mode (sketch mode) * and redraw them in EDIT mode (sketch mode)
* Net codes must be OK. * 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(); 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 );
pos = PtPad->m_Pos; wxPoint pos = aPad->GetPosition();
LayerMask = PtPad->m_layerMask;
for( ; Track; Track = Track->Next() ) int layerMask = aPad->GetLayerMask();
for( ; track; track = track->Next() )
{ {
if( Track->GetNet() != net_code ) if( track->GetNet() != net_code )
break; break;
if( ( LayerMask & Track->ReturnMaskLayer() ) == 0 ) if( ( layerMask & track->ReturnMaskLayer() ) == 0 )
continue; continue;
if( pos == Track->m_Start ) if( pos == track->m_Start )
{ {
AddSegmentToDragList( panel, DC, STARTPOINT, Track ); AddSegmentToDragList( panel, DC, STARTPOINT, track );
g_DragSegmentList.back().m_Pad_Start = PtPad; g_DragSegmentList.back().m_Pad_Start = aPad;
} }
if( pos == Track->m_End ) if( pos == track->m_End )
{ {
AddSegmentToDragList( panel, DC, ENDPOINT, Track ); AddSegmentToDragList( panel, DC, ENDPOINT, track );
g_DragSegmentList.back().m_Pad_End = PtPad; g_DragSegmentList.back().m_Pad_End = aPad;
} }
} }
} }
......
...@@ -422,9 +422,10 @@ void DRC::testPad2Pad() ...@@ -422,9 +422,10 @@ void DRC::testPad2Pad()
{ {
D_PAD* pad = sortedPads[i]; D_PAD* pad = sortedPads[i];
// m_ShapeMaxRadius is the radius value of the circle containing the pad // GetBoundingRadius() is the radius of the minimum sized circle fully containing the pad
if( pad->m_ShapeMaxRadius > max_size ) int radius = pad->GetBoundingRadius();
max_size = pad->m_ShapeMaxRadius; if( radius > max_size )
max_size = radius;
} }
// Test the pads // Test the pads
...@@ -435,7 +436,7 @@ void DRC::testPad2Pad() ...@@ -435,7 +436,7 @@ void DRC::testPad2Pad()
D_PAD* pad = sortedPads[i]; D_PAD* pad = sortedPads[i];
int x_limit = max_size + pad->GetClearance() + 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 ) ) if( !doPadToPadsDrc( pad, &sortedPads[i], listEnd, x_limit ) )
{ {
...@@ -559,7 +560,7 @@ void DRC::testZones() ...@@ -559,7 +560,7 @@ void DRC::testZones()
bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_limit ) 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 /* 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. * 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 ...@@ -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 MODULE dummymodule( m_pcb ); // Creates a dummy parent
D_PAD dummypad( &dummymodule ); 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 // Ensure the hole is on all copper layers
* the clearance of the active pad will be used dummypad.SetLayerMask( ALL_CU_LAYERS | dummypad.GetLayerMask() );
* as minimum distance to a hole
* (a value = 0 means use netclass value) // 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 ) 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 ...@@ -583,43 +586,40 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li
if( pad == aRefPad ) if( pad == aRefPad )
continue; 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 // because the list is sorted by X values
if( pad->m_Pos.x > x_limit ) if( pad->GetPosition().x > x_limit )
break; break;
// No problem if pads are on different copper layers, // No problem if pads are on different copper layers,
// but their hole (if any ) can create DRC error because they are on all // but their hole (if any ) can create DRC error because they are on all
// copper layers, so we test them // 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, // if holes are in the same location and have the same size and shape,
// this can be accepted // this can be accepted
if( pad->GetPosition() == aRefPad->GetPosition() if( pad->GetPosition() == aRefPad->GetPosition()
&& pad->m_Drill == aRefPad->m_Drill && pad->GetDrillSize() == aRefPad->GetDrillSize()
&& pad->m_DrillShape == aRefPad->m_DrillShape ) && pad->GetDrillShape() == aRefPad->GetDrillShape() )
{ {
if( aRefPad->m_DrillShape == PAD_CIRCLE ) if( aRefPad->GetDrillShape() == PAD_CIRCLE )
continue; continue;
// for oval holes: must also have the same orientation // for oval holes: must also have the same orientation
if( pad->m_Orient == aRefPad->m_Orient ) if( pad->GetOrientation() == aRefPad->GetOrientation() )
continue; continue;
} }
/* Here, we must test clearance between holes and pads /* Here, we must test clearance between holes and pads
* dummy pad size and shape is adjusted to pad drill size and shape * 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 // pad under testing has a hole, test this hole against pad reference
dummypad.SetPosition( pad->GetPosition() ); dummypad.SetPosition( pad->GetPosition() );
dummypad.m_Size = pad->m_Drill; dummypad.SetSize( pad->GetDrillSize() );
dummypad.m_PadShape = (pad->m_DrillShape == PAD_OVAL) ? PAD_OVAL : PAD_CIRCLE; dummypad.SetShape( pad->GetDrillShape() == PAD_OVAL ? PAD_OVAL : PAD_CIRCLE );
dummypad.m_Orient = pad->m_Orient; dummypad.SetOrientation( pad->GetOrientation() );
// compute the radius of the circle containing this pad
dummypad.ComputeShapeMaxRadius();
if( !checkClearancePadToPad( aRefPad, &dummypad ) ) if( !checkClearancePadToPad( aRefPad, &dummypad ) )
{ {
...@@ -630,15 +630,12 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li ...@@ -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.SetPosition( aRefPad->GetPosition() );
dummypad.m_Size = aRefPad->m_Drill; dummypad.SetSize( aRefPad->GetDrillSize() );
dummypad.m_PadShape = (aRefPad->m_DrillShape == PAD_OVAL) ? PAD_OVAL : PAD_CIRCLE; dummypad.SetShape( aRefPad->GetDrillShape() == PAD_OVAL ? PAD_OVAL : PAD_CIRCLE );
dummypad.m_Orient = aRefPad->m_Orient; dummypad.SetOrientation( aRefPad->GetOrientation() );
// compute the radius of the circle containing this pad
dummypad.ComputeShapeMaxRadius();
if( !checkClearancePadToPad( pad, &dummypad ) ) if( !checkClearancePadToPad( pad, &dummypad ) )
{ {
...@@ -652,7 +649,6 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li ...@@ -652,7 +649,6 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li
continue; continue;
} }
// The pad must be in a net (i.e pt_pad->GetNet() != 0 ), // The pad must be in a net (i.e pt_pad->GetNet() != 0 ),
// But no problem if pads have the same netcode (same net) // But no problem if pads have the same netcode (same net)
if( pad->GetNet() && ( aRefPad->GetNet() == pad->GetNet() ) ) if( pad->GetNet() && ( aRefPad->GetNet() == pad->GetNet() ) )
......
This diff is collapsed.
...@@ -59,36 +59,30 @@ void PCB_EDIT_FRAME::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC ) ...@@ -59,36 +59,30 @@ void PCB_EDIT_FRAME::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC )
/* /*
* Move the footprint anchor position to the current cursor position. * 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; wxPoint moveVector;
EDA_ITEM* item;
D_PAD* pad;
if( pt_mod == NULL ) if( aModule == NULL )
return; 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: /* Update the relative coordinates:
* The coordinates are relative to the anchor point. * The coordinates are relative to the anchor point.
* Calculate deltaX and deltaY from the anchor. */ * Calculate deltaX and deltaY from the anchor. */
RotatePoint( &moveVector, -pt_mod->m_Orient ); RotatePoint( &moveVector, -aModule->m_Orient );
/* Update the pad coordinates. */ // Update the pad coordinates.
pad = (D_PAD*) pt_mod->m_Pads; for( D_PAD* pad = (D_PAD*) aModule->m_Pads; pad; pad = pad->Next() )
for( ; pad != NULL; pad = pad->Next() )
{ {
pad->m_Pos0 += moveVector; pad->SetPos0( pad->GetPos0() + moveVector );
} }
/* Update the draw element coordinates. */ // Update the draw element coordinates.
item = pt_mod->m_Drawings; for( EDA_ITEM* item = aModule->m_Drawings; item; item = item->Next() )
for( ; item != NULL; item = item->Next() )
{ {
switch( item->Type() ) switch( item->Type() )
{ {
...@@ -110,7 +104,7 @@ void FOOTPRINT_EDIT_FRAME::Place_Ancre( MODULE* pt_mod ) ...@@ -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 ) ...@@ -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 ) ) 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 ); ShowNewTrackWhenMovingCursor( Panel, DC, wxDefaultPosition, false );
if( pcb->IsHighLightNetON() ) if( pcb->IsHighLightNetON() )
...@@ -102,7 +102,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) ...@@ -102,7 +102,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
BOARD_CONNECTED_ITEM* LockPoint; BOARD_CONNECTED_ITEM* LockPoint;
wxPoint pos = GetScreen()->GetCrossHairPosition(); 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 ); m_canvas->SetMouseCapture( ShowNewTrackWhenMovingCursor, Abort_Create_Track );
...@@ -130,11 +130,11 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) ...@@ -130,11 +130,11 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
{ {
pad = (D_PAD*) LockPoint; pad = (D_PAD*) LockPoint;
/* A pad is found: put the starting point on pad center */ // A pad is found: put the starting point on pad center
pos = pad->m_Pos; pos = pad->GetPosition();
GetBoard()->SetHighLightNet( pad->GetNet() ); GetBoard()->SetHighLightNet( pad->GetNet() );
} }
else /* A track segment is found */ else // A track segment is found
{ {
TrackOnStartPoint = (TRACK*) LockPoint; TrackOnStartPoint = (TRACK*) LockPoint;
GetBoard()->SetHighLightNet( TrackOnStartPoint->GetNet() ); GetBoard()->SetHighLightNet( TrackOnStartPoint->GetNet() );
...@@ -214,7 +214,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) ...@@ -214,7 +214,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
} }
else // Track in progress : segment coordinates are updated by ShowNewTrackWhenMovingCursor. 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( Drc_On )
{ {
if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) ) 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 ) ...@@ -244,7 +244,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
if( CanCreateNewSegment ) if( CanCreateNewSegment )
{ {
/* Erase old track on screen */ // Erase old track on screen
D( g_CurrentTrackList.VerifyListIntegrity(); ); D( g_CurrentTrackList.VerifyListIntegrity(); );
ShowNewTrackWhenMovingCursor( m_canvas, aDC, wxDefaultPosition, false ); ShowNewTrackWhenMovingCursor( m_canvas, aDC, wxDefaultPosition, false );
...@@ -283,7 +283,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) ...@@ -283,7 +283,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
D( g_CurrentTrackList.VerifyListIntegrity(); ); D( g_CurrentTrackList.VerifyListIntegrity(); );
/* Show the new position */ // Show the new position
ShowNewTrackWhenMovingCursor( m_canvas, aDC, wxDefaultPosition, false ); ShowNewTrackWhenMovingCursor( m_canvas, aDC, wxDefaultPosition, false );
} }
} }
...@@ -298,7 +298,7 @@ bool PCB_EDIT_FRAME::Add45DegreeSegment( wxDC* aDC ) ...@@ -298,7 +298,7 @@ bool PCB_EDIT_FRAME::Add45DegreeSegment( wxDC* aDC )
int dx0, dy0, dx1, dy1; int dx0, dy0, dx1, dy1;
if( g_CurrentTrackList.GetCount() < 2 ) if( g_CurrentTrackList.GetCount() < 2 )
return false; /* There must be 2 segments. */ return false; // There must be 2 segments.
TRACK* curTrack = g_CurrentTrackSegment; TRACK* curTrack = g_CurrentTrackSegment;
TRACK* prevTrack = curTrack->Back(); TRACK* prevTrack = curTrack->Back();
...@@ -328,7 +328,7 @@ bool PCB_EDIT_FRAME::Add45DegreeSegment( wxDC* aDC ) ...@@ -328,7 +328,7 @@ bool PCB_EDIT_FRAME::Add45DegreeSegment( wxDC* aDC )
if( max( abs( dx1 ), abs( dy1 ) ) < ( segm_step_45 * 2 ) ) if( max( abs( dx1 ), abs( dy1 ) ) < ( segm_step_45 * 2 ) )
return false; 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(); TRACK* newTrack = (TRACK*)curTrack->Clone();
newTrack->m_Start = prevTrack->m_End; newTrack->m_Start = prevTrack->m_End;
...@@ -418,7 +418,7 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC ) ...@@ -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 ) ) if( Drc_On && BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) )
return false; 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; wxPoint pos = g_CurrentTrackSegment->m_End;
D( g_CurrentTrackList.VerifyListIntegrity(); ); D( g_CurrentTrackList.VerifyListIntegrity(); );
...@@ -554,7 +554,7 @@ TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack, int aLayer, const wxPoi ...@@ -554,7 +554,7 @@ TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack, int aLayer, const wxPoi
if( track->GetNet() == net ) if( track->GetNet() == net )
continue; continue;
/* TRACK::HitTest */ // TRACK::HitTest
int dist = (width + track->m_Width) / 2 + aTrack->GetClearance( track ); int dist = (width + track->m_Width) / 2 + aTrack->GetClearance( track );
wxPoint pos = aRef - track->m_Start; wxPoint pos = aRef - track->m_Start;
...@@ -565,7 +565,7 @@ TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack, int aLayer, const wxPoi ...@@ -565,7 +565,7 @@ TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack, int aLayer, const wxPoi
found = track; 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; 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 ) 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 ) ...@@ -607,7 +607,7 @@ static void PushTrack( EDA_DRAW_PANEL* panel )
other = LocateIntrusion( pcb->m_Track, track, screen->m_Active_Layer, screen->RefPos( true ) ); 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 ) if( !other )
return; return;
...@@ -619,7 +619,7 @@ static void PushTrack( EDA_DRAW_PANEL* panel ) ...@@ -619,7 +619,7 @@ static void PushTrack( EDA_DRAW_PANEL* panel )
det = (double) cv.x * vec.y - (double) cv.y * vec.x; 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 ) if( !det )
return; return;
...@@ -630,7 +630,7 @@ static void PushTrack( EDA_DRAW_PANEL* panel ) ...@@ -630,7 +630,7 @@ static void PushTrack( EDA_DRAW_PANEL* panel )
* We may have a quantization error of 1/sqrt(2), so +1 again. * 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 ) if( det > 0 )
{ {
n.x = vec.y; n.x = vec.y;
...@@ -674,7 +674,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo ...@@ -674,7 +674,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS; DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS;
#ifndef USE_WX_OVERLAY #ifndef USE_WX_OVERLAY
/* Erase old track */ // Erase old track
if( aErase ) if( aErase )
{ {
DrawTraces( aPanel, aDC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_XOR ); DrawTraces( aPanel, aDC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_XOR );
...@@ -740,12 +740,12 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo ...@@ -740,12 +740,12 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
&g_CurrentTrackSegment->m_End.y ); &g_CurrentTrackSegment->m_End.y );
} }
} }
else /* Here the angle is arbitrary */ else // Here the angle is arbitrary
{ {
g_CurrentTrackSegment->m_End = screen->GetCrossHairPosition(); g_CurrentTrackSegment->m_End = screen->GetCrossHairPosition();
} }
/* Redraw the new track */ // Redraw the new track
D( g_CurrentTrackList.VerifyListIntegrity(); ); D( g_CurrentTrackList.VerifyListIntegrity(); );
DrawTraces( aPanel, aDC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_XOR ); DrawTraces( aPanel, aDC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_XOR );
...@@ -782,7 +782,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo ...@@ -782,7 +782,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
if( g_FirstTrackSegment->GetState( BEGIN_ONPAD ) ) if( g_FirstTrackSegment->GetState( BEGIN_ONPAD ) )
{ {
D_PAD * pad = (D_PAD *) g_FirstTrackSegment->start; D_PAD * pad = (D_PAD *) g_FirstTrackSegment->start;
lenDie = (double) pad->m_LengthDie; lenDie = (double) pad->GetDieLength();
} }
// calculate track len on board: // calculate track len on board:
...@@ -853,7 +853,7 @@ void CalculateSegmentEndPoint( const wxPoint& aPosition, int ox, int oy, int* fx ...@@ -853,7 +853,7 @@ void CalculateSegmentEndPoint( const wxPoint& aPosition, int ox, int oy, int* fx
deltax = min( deltax, deltay ); deltax = min( deltax, deltay );
deltay = deltax; deltay = deltax;
/* Recalculate the signs for deltax and deltaY. */ // Recalculate the signs for deltax and deltaY.
if( ( aPosition.x - ox ) < 0 ) if( ( aPosition.x - ox ) < 0 )
deltax = -deltax; deltax = -deltax;
...@@ -948,7 +948,7 @@ void ComputeBreakPoint( TRACK* track, int SegmentCount, wxPoint end ) ...@@ -948,7 +948,7 @@ void ComputeBreakPoint( TRACK* track, int SegmentCount, wxPoint end )
iDx = min( iDx, iDy ); iDx = min( iDx, iDy );
iDy = iDx; iDy = iDx;
/* Recalculate the signs for deltax and deltaY. */ // Recalculate the signs for deltax and deltaY.
if( ( end.x - track->m_Start.x ) < 0 ) if( ( end.x - track->m_Start.x ) < 0 )
iDx = -iDx; iDx = -iDx;
...@@ -1064,11 +1064,11 @@ void DeleteNullTrackSegments( BOARD* pcb, DLIST<TRACK>& aTrackList ) ...@@ -1064,11 +1064,11 @@ void DeleteNullTrackSegments( BOARD* pcb, DLIST<TRACK>& aTrackList )
* if no, create a new track segment if necessary * if no, create a new track segment if necessary
* and move current (or new) end segment on pad * 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 ); g_CurrentTrackSegment->SetState( END_ONPAD, ON );
return; return;
} }
...@@ -1077,15 +1077,15 @@ void EnsureEndTrackOnPad( D_PAD* Pad ) ...@@ -1077,15 +1077,15 @@ void EnsureEndTrackOnPad( D_PAD* Pad )
if( !g_CurrentTrackSegment->IsNull() ) 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() ); g_CurrentTrackList.PushBack( (TRACK*)lasttrack->Clone() );
lasttrack->end = g_CurrentTrackSegment; 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->SetState( END_ONPAD, OFF );
g_CurrentTrackSegment->end = Pad; g_CurrentTrackSegment->end = aPad;
g_CurrentTrackSegment->SetState( END_ONPAD, ON ); g_CurrentTrackSegment->SetState( END_ONPAD, ON );
} }
This diff is collapsed.
This diff is collapsed.
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <gendrill.h> #include <gendrill.h>
/* Local Functions */ // Local Functions
/* Compare function used for sorting holes by increasing diameter value /* Compare function used for sorting holes by increasing diameter value
* and X value * and X value
...@@ -109,39 +109,35 @@ void Build_Holes_List( BOARD* aPcb, ...@@ -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 ) if( !aExcludeThroughHoles || aGenerateNPTH_list )
{ {
MODULE* Module = aPcb->m_Modules; for( MODULE* module = aPcb->m_Modules; module; module->Next() )
for( ; Module != NULL; Module = Module->Next() )
{ {
/* Read and analyse pads */ // Read and analyse pads
D_PAD* pad = Module->m_Pads; for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
for( ; pad != NULL; pad = pad->Next() )
{ {
if( ! aGenerateNPTH_list && pad->m_Attribut == PAD_HOLE_NOT_PLATED ) if( ! aGenerateNPTH_list && pad->GetAttribute() == PAD_HOLE_NOT_PLATED )
continue; continue;
if( aGenerateNPTH_list && pad->m_Attribut != PAD_HOLE_NOT_PLATED ) if( aGenerateNPTH_list && pad->GetAttribute() != PAD_HOLE_NOT_PLATED )
continue; continue;
if( pad->m_Drill.x == 0 ) if( pad->GetDrillSize().x == 0 )
continue; 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_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_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; 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_Shape = 1; // oval flag set
new_hole.m_Hole_Size = pad->m_Drill; new_hole.m_Hole_Size = pad->GetDrillSize();
new_hole.m_Hole_Pos = pad->m_Pos; // hole position new_hole.m_Hole_Pos = pad->GetPosition(); // hole position
new_hole.m_Hole_Bottom_Layer = LAYER_N_BACK; new_hole.m_Hole_Bottom_Layer = LAYER_N_BACK;
new_hole.m_Hole_Top_Layer = LAYER_N_FRONT;// pad holes are through holes new_hole.m_Hole_Top_Layer = LAYER_N_FRONT;// pad holes are through holes
aHoleListBuffer.push_back( new_hole ); aHoleListBuffer.push_back( new_hole );
......
...@@ -312,7 +312,7 @@ static bool HasNonSMDPins( MODULE* aModule ) ...@@ -312,7 +312,7 @@ static bool HasNonSMDPins( MODULE* aModule )
for( pad = aModule->m_Pads; pad; pad = pad->Next() ) for( pad = aModule->m_Pads; pad; pad = pad->Next() )
{ {
if( pad->m_Attribut != PAD_SMD ) if( pad->GetAttribute() != PAD_SMD )
return true; return true;
} }
...@@ -630,37 +630,42 @@ bool PCB_EDIT_FRAME::DoGenFootprintsReport( const wxString& aFullFilename, bool ...@@ -630,37 +630,42 @@ bool PCB_EDIT_FRAME::DoGenFootprintsReport( const wxString& aFullFilename, bool
{ {
fprintf( rptfile, "$PAD \"%s\"\n", TO_UTF8( pad->GetPadName() ) ); fprintf( rptfile, "$PAD \"%s\"\n", TO_UTF8( pad->GetPadName() ) );
sprintf( line, "position %9.6f %9.6f\n", sprintf( line, "position %9.6f %9.6f\n",
pad->m_Pos0.x * conv_unit, pad->GetPos0().x * conv_unit,
pad->m_Pos0.y * conv_unit ); pad->GetPos0().y * conv_unit );
fputs( line, rptfile ); fputs( line, rptfile );
sprintf( line, "size %9.6f %9.6f\n", sprintf( line, "size %9.6f %9.6f\n",
pad->m_Size.x * conv_unit, pad->GetSize().x * conv_unit,
pad->m_Size.y * conv_unit ); pad->GetSize().y * conv_unit );
fputs( line, rptfile ); 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 ); fputs( line, rptfile );
sprintf( line, "shape_offset %9.6f %9.6f\n", sprintf( line, "shape_offset %9.6f %9.6f\n",
pad->m_Offset.x * conv_unit, pad->GetOffset().x * conv_unit,
pad->m_Offset.y * conv_unit ); pad->GetOffset().y * conv_unit );
fputs( line, rptfile ); fputs( line, rptfile );
sprintf( line, "orientation %.2f\n", sprintf( line, "orientation %.2f\n",
double(pad->m_Orient - Module->m_Orient) / 10 ); double(pad->GetOrientation() - Module->GetOrientation()) / 10 );
fputs( line, rptfile ); 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 ); fputs( line, rptfile );
int layer = 0; int layer = 0;
if( pad->m_layerMask & LAYER_BACK ) if( pad->GetLayerMask() & LAYER_BACK )
layer = 1; layer = 1;
if( pad->m_layerMask & LAYER_FRONT ) if( pad->GetLayerMask() & LAYER_FRONT )
layer |= 2; 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] ); sprintf( line, "Layer %s\n", layer_name[layer] );
fputs( line, rptfile ); fputs( line, rptfile );
fprintf( rptfile, "$EndPAD\n" ); fprintf( rptfile, "$EndPAD\n" );
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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