From 1f50b2c7674e53e74dbd8595dac124785db2089b Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 17 Jun 2012 20:29:11 +0200 Subject: [PATCH] Pcbnew: Fix an other compatibility issue in kicad nanometers. --- pcbnew/class_zone.cpp | 21 --------------------- pcbnew/class_zone.h | 9 +++------ pcbnew/class_zone_settings.h | 6 +++--- 3 files changed, 6 insertions(+), 30 deletions(-) diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index be7c1f2a5f..d23a58cce2 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -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++ ) diff --git a/pcbnew/class_zone.h b/pcbnew/class_zone.h index 0e78d20895..b4d3f6aefa 100644 --- a/pcbnew/class_zone.h +++ b/pcbnew/class_zone.h @@ -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; }; diff --git a/pcbnew/class_zone_settings.h b/pcbnew/class_zone_settings.h index 2d6985d8be..2b2760d462 100644 --- a/pcbnew/class_zone_settings.h +++ b/pcbnew/class_zone_settings.h @@ -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