Pcbnew: Fix an other compatibility issue in kicad nanometers.

This commit is contained in:
jean-pierre charras 2012-06-17 20:29:11 +02:00
parent 0028c05484
commit 1f50b2c767
3 changed files with 6 additions and 30 deletions

View File

@ -489,9 +489,6 @@ bool ZONE_CONTAINER::HitTest( const wxPoint& aPosition )
// we must have a default distance between the test point
// and a corner or a zone edge:
#define MIN_DIST_IN_MILS 10
// if we know the scaling factor, a dist in pixel can be used:
#define HIT_TEST_USE_PIXELS 1 // Set to 0 to used only a fixed default distance
#define MIN_DIST_IN_PIXELS 10
bool ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos )
{
@ -500,15 +497,6 @@ bool ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos )
// distance (in internal units) to detect a corner in a zone outline.
int min_dist = MIN_DIST_IN_MILS*IU_PER_MILS;
#if HIT_TEST_USE_PIXELS
// If possible, use a fixed number of pixels.
if( GetBoard() && GetBoard()->GetParent() )
{
double scale = ((PCB_BASE_FRAME*)GetBoard()->GetParent())->GetScreen()->GetScalingFactor();
min_dist = KiROUND( MIN_DIST_IN_PIXELS / scale);
}
#endif
wxPoint delta;
unsigned lim = m_Poly->corner.size();
@ -540,15 +528,6 @@ bool ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos )
// distance (in internal units) to detect a zone outline
int min_dist = MIN_DIST_IN_MILS*IU_PER_MILS;
#if HIT_TEST_USE_PIXELS
// If possible, use a fixed number of pixels.
if( GetBoard() && GetBoard()->GetParent() )
{
double scale = ((PCB_BASE_FRAME*)GetBoard()->GetParent())->GetScreen()->GetScalingFactor();
min_dist = KiROUND( MIN_DIST_IN_PIXELS / scale);
}
#endif
unsigned first_corner_pos = 0;
for( unsigned item_pos = 0; item_pos < lim; item_pos++ )

View File

@ -511,12 +511,9 @@ public:
void SetCornerRadius( unsigned int aRadius )
{
if( aRadius > MAX_ZONE_CORNER_RADIUS )
cornerRadius = MAX_ZONE_CORNER_RADIUS;
else if( aRadius < 0 )
cornerRadius = 0;
else
cornerRadius = aRadius;
cornerRadius = aRadius;
if( cornerRadius > (unsigned int) Mils2iu( MAX_ZONE_CORNER_RADIUS_MILS ) )
cornerRadius = Mils2iu( MAX_ZONE_CORNER_RADIUS_MILS );
};
unsigned int GetCornerRadius() const { return cornerRadius; };

View File

@ -12,7 +12,7 @@
class ZONE_CONTAINER;
#define MAX_ZONE_CORNER_RADIUS 4000
#define MAX_ZONE_CORNER_RADIUS_MILS 400
/**
@ -83,8 +83,8 @@ public:
void SetCornerRadius( int aRadius )
{
if( aRadius > MAX_ZONE_CORNER_RADIUS )
cornerRadius = MAX_ZONE_CORNER_RADIUS;
if( aRadius > Mils2iu( MAX_ZONE_CORNER_RADIUS_MILS ) )
cornerRadius = Mils2iu( MAX_ZONE_CORNER_RADIUS_MILS );
else if( aRadius < 0 )
cornerRadius = 0;
else