Commit 79a10860 authored by Garth Corral's avatar Garth Corral

Merge trunk @ 5288

parents c3a3ac9d 1dc51780
...@@ -192,7 +192,7 @@ int VRML1_MODEL_PARSER::readMaterial() ...@@ -192,7 +192,7 @@ int VRML1_MODEL_PARSER::readMaterial()
continue; continue;
} }
if( ( *text == '}' ) ) if( *text == '}' )
{ {
return 0; return 0;
} }
...@@ -240,7 +240,7 @@ int VRML1_MODEL_PARSER::readCoordinate3() ...@@ -240,7 +240,7 @@ int VRML1_MODEL_PARSER::readCoordinate3()
continue; continue;
} }
if( ( *text == '}' ) ) if( *text == '}' )
{ {
return 0; return 0;
} }
...@@ -268,7 +268,7 @@ int VRML1_MODEL_PARSER::readIndexedFaceSet() ...@@ -268,7 +268,7 @@ int VRML1_MODEL_PARSER::readIndexedFaceSet()
continue; continue;
} }
if( ( *text == '}' ) ) if( *text == '}' )
{ {
return 0; return 0;
} }
......
...@@ -145,7 +145,7 @@ int VRML2_MODEL_PARSER::read_Transform() ...@@ -145,7 +145,7 @@ int VRML2_MODEL_PARSER::read_Transform()
continue; continue;
} }
if( ( *text == '}' ) ) if( *text == '}' )
{ {
// DBG( printf( " } Exit Transform\n" ) ); // DBG( printf( " } Exit Transform\n" ) );
break; break;
...@@ -265,7 +265,7 @@ int VRML2_MODEL_PARSER::read_DEF() ...@@ -265,7 +265,7 @@ int VRML2_MODEL_PARSER::read_DEF()
continue; continue;
} }
if( ( *text == '}' ) ) if( *text == '}' )
{ {
// DBG( printf( " } Exit DEF\n") ); // DBG( printf( " } Exit DEF\n") );
return 0; return 0;
...@@ -321,7 +321,7 @@ int VRML2_MODEL_PARSER::read_Shape() ...@@ -321,7 +321,7 @@ int VRML2_MODEL_PARSER::read_Shape()
continue; continue;
} }
if( ( *text == '}' ) ) if( *text == '}' )
{ {
// DBG( printf( " } Exit Shape\n") ); // DBG( printf( " } Exit Shape\n") );
return 0; return 0;
...@@ -368,7 +368,7 @@ int VRML2_MODEL_PARSER::read_Appearance() ...@@ -368,7 +368,7 @@ int VRML2_MODEL_PARSER::read_Appearance()
continue; continue;
} }
if( ( *text == '}' ) ) if( *text == '}' )
{ {
return 0; return 0;
} }
...@@ -473,7 +473,7 @@ int VRML2_MODEL_PARSER::read_Material() ...@@ -473,7 +473,7 @@ int VRML2_MODEL_PARSER::read_Material()
continue; continue;
} }
if( ( *text == '}' ) ) if( *text == '}' )
{ {
return 0; return 0;
} }
...@@ -566,7 +566,7 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet() ...@@ -566,7 +566,7 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet()
continue; continue;
} }
if( ( *text == '}' ) ) if( *text == '}' )
{ {
// DBG( printf( " } Exit IndexedFaceSet\n") ); // DBG( printf( " } Exit IndexedFaceSet\n") );
return 0; return 0;
...@@ -749,7 +749,7 @@ int VRML2_MODEL_PARSER::read_Color() ...@@ -749,7 +749,7 @@ int VRML2_MODEL_PARSER::read_Color()
continue; continue;
} }
if( ( *text == '}' ) ) if( *text == '}' )
{ {
// DBG( printf( " m_DiffuseColor.size: %ld\n", m_model->m_Materials->m_DiffuseColor.size() ) ); // DBG( printf( " m_DiffuseColor.size: %ld\n", m_model->m_Materials->m_DiffuseColor.size() ) );
return 0; return 0;
...@@ -779,7 +779,7 @@ int VRML2_MODEL_PARSER::read_Normal() ...@@ -779,7 +779,7 @@ int VRML2_MODEL_PARSER::read_Normal()
continue; continue;
} }
if( ( *text == '}' ) ) if( *text == '}' )
{ {
// DBG( printf( " m_PerFaceNormalsNormalized.size: %lu\n", m_model->m_PerFaceNormalsNormalized.size() ) ); // DBG( printf( " m_PerFaceNormalsNormalized.size: %lu\n", m_model->m_PerFaceNormalsNormalized.size() ) );
return 0; return 0;
...@@ -817,7 +817,7 @@ int VRML2_MODEL_PARSER::read_Coordinate() ...@@ -817,7 +817,7 @@ int VRML2_MODEL_PARSER::read_Coordinate()
continue; continue;
} }
if( ( *text == '}' ) ) if( *text == '}' )
{ {
// DBG( printf( " m_Point.size: %lu\n", m_model->m_Point.size() ) ); // DBG( printf( " m_Point.size: %lu\n", m_model->m_Point.size() ) );
return 0; return 0;
......
...@@ -384,7 +384,9 @@ bool X3D_MODEL_PARSER::parseDoubleTriplet( const wxString& aData, ...@@ -384,7 +384,9 @@ bool X3D_MODEL_PARSER::parseDoubleTriplet( const wxString& aData,
{ {
wxStringTokenizer tokens( aData ); wxStringTokenizer tokens( aData );
double x, y, z; double x = 0;
double y = 0;
double z = 0;
bool ret = tokens.GetNextToken().ToDouble( &x ) bool ret = tokens.GetNextToken().ToDouble( &x )
&& tokens.GetNextToken().ToDouble( &y ) && tokens.GetNextToken().ToDouble( &y )
......
...@@ -98,7 +98,8 @@ bool STROKE_FONT::LoadNewStrokeFont( const char* const aNewStrokeFont[], int aNe ...@@ -98,7 +98,8 @@ bool STROKE_FONT::LoadNewStrokeFont( const char* const aNewStrokeFont[], int aNe
// Every coordinate description of the Hershey format has an offset, // Every coordinate description of the Hershey format has an offset,
// it has to be subtracted // it has to be subtracted
point.x = (double) ( coordinate[0] - 'R' ) * HERSHEY_SCALE - glyphStartX; point.x = (double) ( coordinate[0] - 'R' ) * HERSHEY_SCALE - glyphStartX;
point.y = (double) ( coordinate[1] - 'R' ) * HERSHEY_SCALE; // -10 is here to keep GAL rendering consistent with the legacy gfx stuff
point.y = (double) ( coordinate[1] - 'R' - 10) * HERSHEY_SCALE;
pointList.push_back( point ); pointList.push_back( point );
} }
...@@ -160,26 +161,42 @@ void STROKE_FONT::Draw( const UTF8& aText, const VECTOR2D& aPosition, double aRo ...@@ -160,26 +161,42 @@ void STROKE_FONT::Draw( const UTF8& aText, const VECTOR2D& aPosition, double aRo
m_gal->Rotate( -aRotationAngle ); m_gal->Rotate( -aRotationAngle );
// Single line height // Single line height
int lineHeight = getInterline(); int lineHeight = getInterline( );
int lineCount = linesCount( aText );
// The overall height of all lines of text
double textBlockHeight = lineHeight * ( linesCount( aText ) - 1 );
// align the 1st line of text
switch( m_verticalJustify ) switch( m_verticalJustify )
{ {
case GR_TEXT_VJUSTIFY_TOP:
m_gal->Translate( VECTOR2D( 0, m_glyphSize.y ) );
break;
case GR_TEXT_VJUSTIFY_CENTER: case GR_TEXT_VJUSTIFY_CENTER:
m_gal->Translate( VECTOR2D( 0, -textBlockHeight / 2.0 ) ); m_gal->Translate( VECTOR2D( 0, m_glyphSize.y / 2.0 ) );
break; break;
case GR_TEXT_VJUSTIFY_BOTTOM: case GR_TEXT_VJUSTIFY_BOTTOM:
m_gal->Translate( VECTOR2D( 0, -textBlockHeight ) );
break; break;
default:
break;
}
if( lineCount > 1 )
{
switch( m_verticalJustify )
{
case GR_TEXT_VJUSTIFY_TOP: case GR_TEXT_VJUSTIFY_TOP:
break; break;
default: case GR_TEXT_VJUSTIFY_CENTER:
m_gal->Translate( VECTOR2D(0, -( lineCount - 1 ) * lineHeight / 2) );
break; break;
case GR_TEXT_VJUSTIFY_BOTTOM:
m_gal->Translate( VECTOR2D(0, -( lineCount - 1 ) * lineHeight ) );
break;
}
} }
m_gal->SetIsStroke( true ); m_gal->SetIsStroke( true );
......
...@@ -175,7 +175,7 @@ static inline bool Collide( const SHAPE_CIRCLE& aA, const SHAPE_SEGMENT& aSeg, i ...@@ -175,7 +175,7 @@ static inline bool Collide( const SHAPE_CIRCLE& aA, const SHAPE_SEGMENT& aSeg, i
if( col && aNeedMTV ) if( col && aNeedMTV )
{ {
aMTV = pushoutForce( aA, aSeg.GetSeg(), aClearance + aSeg.GetWidth() / 2); aMTV = -pushoutForce( aA, aSeg.GetSeg(), aClearance + aSeg.GetWidth() / 2);
} }
return col; return col;
} }
...@@ -231,14 +231,26 @@ static inline bool Collide( const SHAPE_LINE_CHAIN& aA, const SHAPE_SEGMENT& aB, ...@@ -231,14 +231,26 @@ static inline bool Collide( const SHAPE_LINE_CHAIN& aA, const SHAPE_SEGMENT& aB,
} }
template<class ShapeAType, class ShapeBType> bool template<class ShapeAType, class ShapeBType>
CollCase( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV ) inline bool CollCase( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV )
{ {
return Collide (*static_cast<const ShapeAType*>( aA ), return Collide (*static_cast<const ShapeAType*>( aA ),
*static_cast<const ShapeBType*>( aB ), *static_cast<const ShapeBType*>( aB ),
aClearance, aNeedMTV, aMTV); aClearance, aNeedMTV, aMTV);
} }
template<class ShapeAType, class ShapeBType>
inline bool CollCaseReversed ( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV )
{
bool rv = Collide (*static_cast<const ShapeBType*>( aB ),
*static_cast<const ShapeAType*>( aA ),
aClearance, aNeedMTV, aMTV);
if(rv && aNeedMTV)
aMTV = -aMTV;
return rv;
}
bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV ) bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV )
{ {
switch( aA->Type() ) switch( aA->Type() )
...@@ -263,7 +275,7 @@ bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeed ...@@ -263,7 +275,7 @@ bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeed
switch( aB->Type() ) switch( aB->Type() )
{ {
case SH_RECT: case SH_RECT:
return CollCase<SHAPE_RECT, SHAPE_CIRCLE>( aB, aA, aClearance, aNeedMTV, aMTV ); return CollCaseReversed<SHAPE_CIRCLE, SHAPE_RECT>( aA, aB, aClearance, aNeedMTV, aMTV );
case SH_CIRCLE: case SH_CIRCLE:
return CollCase<SHAPE_CIRCLE, SHAPE_CIRCLE>( aA, aB, aClearance, aNeedMTV, aMTV ); return CollCase<SHAPE_CIRCLE, SHAPE_CIRCLE>( aA, aB, aClearance, aNeedMTV, aMTV );
...@@ -273,6 +285,7 @@ bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeed ...@@ -273,6 +285,7 @@ bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeed
case SH_SEGMENT: case SH_SEGMENT:
return CollCase<SHAPE_CIRCLE, SHAPE_SEGMENT>( aA, aB, aClearance, aNeedMTV, aMTV ); return CollCase<SHAPE_CIRCLE, SHAPE_SEGMENT>( aA, aB, aClearance, aNeedMTV, aMTV );
default: default:
break; break;
} }
...@@ -303,7 +316,7 @@ bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeed ...@@ -303,7 +316,7 @@ bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeed
return CollCase<SHAPE_RECT, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV ); return CollCase<SHAPE_RECT, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV );
case SH_CIRCLE: case SH_CIRCLE:
return CollCase<SHAPE_CIRCLE, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV ); return CollCaseReversed<SHAPE_SEGMENT, SHAPE_CIRCLE>( aA, aB, aClearance, aNeedMTV, aMTV );
case SH_LINE_CHAIN: case SH_LINE_CHAIN:
return CollCase<SHAPE_LINE_CHAIN, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV ); return CollCase<SHAPE_LINE_CHAIN, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV );
......
...@@ -29,16 +29,15 @@ using boost::optional; ...@@ -29,16 +29,15 @@ using boost::optional;
bool SHAPE_LINE_CHAIN::Collide( const VECTOR2I& aP, int aClearance ) const bool SHAPE_LINE_CHAIN::Collide( const VECTOR2I& aP, int aClearance ) const
{ {
assert( false ); // fixme: ugly!
SEG s( aP, aP );
return false; return this->Collide( s, aClearance );
} }
bool SHAPE_LINE_CHAIN::Collide( const BOX2I& aBox, int aClearance ) const bool SHAPE_LINE_CHAIN::Collide( const BOX2I& aBox, int aClearance ) const
{ {
assert( false ); assert( false );
return false; return false;
} }
...@@ -150,10 +149,7 @@ int SHAPE_LINE_CHAIN::Split( const VECTOR2I& aP ) ...@@ -150,10 +149,7 @@ int SHAPE_LINE_CHAIN::Split( const VECTOR2I& aP )
int ii = -1; int ii = -1;
int min_dist = 2; int min_dist = 2;
ii = Find( aP ); int found_index = Find( aP );
if( ii >= 0 )
return ii;
for( int s = 0; s < SegmentCount(); s++ ) for( int s = 0; s < SegmentCount(); s++ )
{ {
...@@ -165,10 +161,16 @@ int SHAPE_LINE_CHAIN::Split( const VECTOR2I& aP ) ...@@ -165,10 +161,16 @@ int SHAPE_LINE_CHAIN::Split( const VECTOR2I& aP )
if( dist < min_dist && seg.A != aP && seg.B != aP ) if( dist < min_dist && seg.A != aP && seg.B != aP )
{ {
min_dist = dist; min_dist = dist;
if( found_index < 0 )
ii = s;
else if( s < found_index )
ii = s; ii = s;
} }
} }
if( ii < 0 )
ii = found_index;
if( ii >= 0 ) if( ii >= 0 )
{ {
m_points.insert( m_points.begin() + ii + 1, aP ); m_points.insert( m_points.begin() + ii + 1, aP );
...@@ -519,25 +521,27 @@ const std::string SHAPE_LINE_CHAIN::Format() const ...@@ -519,25 +521,27 @@ const std::string SHAPE_LINE_CHAIN::Format() const
bool SHAPE_LINE_CHAIN::CompareGeometry ( const SHAPE_LINE_CHAIN & aOther ) const bool SHAPE_LINE_CHAIN::CompareGeometry ( const SHAPE_LINE_CHAIN & aOther ) const
{ {
SHAPE_LINE_CHAIN a(*this), b(aOther); SHAPE_LINE_CHAIN a(*this), b( aOther );
a.Simplify(); a.Simplify();
b.Simplify(); b.Simplify();
if(a.m_points.size() != b.m_points.size()) if( a.m_points.size() != b.m_points.size() )
return false; return false;
for(int i = 0; i < a.PointCount(); i++) for( int i = 0; i < a.PointCount(); i++)
if(a.CPoint(i) != b.CPoint(i)) if( a.CPoint( i ) != b.CPoint( i ) )
return false; return false;
return true; return true;
} }
bool SHAPE_LINE_CHAIN::Intersects( const SHAPE_LINE_CHAIN& aChain ) const bool SHAPE_LINE_CHAIN::Intersects( const SHAPE_LINE_CHAIN& aChain ) const
{ {
INTERSECTIONS dummy; INTERSECTIONS dummy;
return Intersect(aChain, dummy) != 0; return Intersect( aChain, dummy ) != 0;
} }
SHAPE* SHAPE_LINE_CHAIN::Clone() const SHAPE* SHAPE_LINE_CHAIN::Clone() const
{ {
return new SHAPE_LINE_CHAIN( *this ); return new SHAPE_LINE_CHAIN( *this );
......
...@@ -557,12 +557,12 @@ void LIB_ARC::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -557,12 +557,12 @@ void LIB_ARC::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
msg = StringFromValue( g_UserUnit, m_Width, true ); msg = StringFromValue( g_UserUnit, m_Width, true );
aList.push_back( MSG_PANEL_ITEM( _( "Line width" ), msg, BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x, msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x,
bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y ); bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y );
aList.push_back( MSG_PANEL_ITEM( _( "Bounding box" ), msg, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Bounding Box" ), msg, BROWN ) );
} }
......
...@@ -413,10 +413,10 @@ void LIB_BEZIER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -413,10 +413,10 @@ void LIB_BEZIER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
msg = StringFromValue( g_UserUnit, m_Width, true ); msg = StringFromValue( g_UserUnit, m_Width, true );
aList.push_back( MSG_PANEL_ITEM( _( "Line width" ), msg, BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x, msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x,
bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y ); bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y );
aList.push_back( MSG_PANEL_ITEM( _( "Bounding box" ), msg, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Bounding Box" ), msg, BROWN ) );
} }
...@@ -272,7 +272,7 @@ void LIB_CIRCLE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) ...@@ -272,7 +272,7 @@ void LIB_CIRCLE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
msg = StringFromValue( g_UserUnit, m_Width, true ); msg = StringFromValue( g_UserUnit, m_Width, true );
aList.push_back( MSG_PANEL_ITEM( _( "Line width" ), msg, BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
msg = StringFromValue( g_UserUnit, m_Radius, true ); msg = StringFromValue( g_UserUnit, m_Radius, true );
aList.push_back( MSG_PANEL_ITEM( _( "Radius" ), msg, RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "Radius" ), msg, RED ) );
...@@ -280,7 +280,7 @@ void LIB_CIRCLE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) ...@@ -280,7 +280,7 @@ void LIB_CIRCLE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x, msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x,
bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y ); bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y );
aList.push_back( MSG_PANEL_ITEM( _( "Bounding box" ), msg, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Bounding Box" ), msg, BROWN ) );
} }
......
...@@ -753,10 +753,10 @@ void LIB_FIELD::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) ...@@ -753,10 +753,10 @@ void LIB_FIELD::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Style" ), msg, MAGENTA ) ); aList.push_back( MSG_PANEL_ITEM( _( "Style" ), msg, MAGENTA ) );
msg = StringFromValue( g_UserUnit, m_Size.x, true ); msg = StringFromValue( g_UserUnit, m_Size.x, true );
aList.push_back( MSG_PANEL_ITEM( _( "Size X" ), msg, BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, BLUE ) );
msg = StringFromValue( g_UserUnit, m_Size.y, true ); msg = StringFromValue( g_UserUnit, m_Size.y, true );
aList.push_back( MSG_PANEL_ITEM( _( "Size Y" ), msg, BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, BLUE ) );
// Display field name (ref, value ...) // Display field name (ref, value ...)
msg = GetName(); msg = GetName();
......
...@@ -402,12 +402,12 @@ void LIB_POLYLINE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) ...@@ -402,12 +402,12 @@ void LIB_POLYLINE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
msg = StringFromValue( g_UserUnit, m_Width, true ); msg = StringFromValue( g_UserUnit, m_Width, true );
aList.push_back( MSG_PANEL_ITEM( _( "Line width" ), msg, BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x, msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x,
bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y ); bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y );
aList.push_back( MSG_PANEL_ITEM( _( "Bounding box" ), msg, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Bounding Box" ), msg, BROWN ) );
} }
......
...@@ -252,7 +252,7 @@ void LIB_RECTANGLE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) ...@@ -252,7 +252,7 @@ void LIB_RECTANGLE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
msg = StringFromValue( g_UserUnit, m_Width, true ); msg = StringFromValue( g_UserUnit, m_Width, true );
aList.push_back( MSG_PANEL_ITEM( _( "Line width" ), msg, BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
} }
......
...@@ -420,7 +420,7 @@ void LIB_TEXT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) ...@@ -420,7 +420,7 @@ void LIB_TEXT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
msg = StringFromValue( g_UserUnit, m_Thickness, true ); msg = StringFromValue( g_UserUnit, m_Thickness, true );
aList.push_back( MSG_PANEL_ITEM( _( "Line width" ), msg, BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
} }
......
...@@ -1516,7 +1516,7 @@ void SCH_COMPONENT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) ...@@ -1516,7 +1516,7 @@ void SCH_COMPONENT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
// Display description of the component, and keywords found in lib // Display description of the component, and keywords found in lib
aList.push_back( MSG_PANEL_ITEM( _( "Description" ), alias->GetDescription(), DARKCYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Description" ), alias->GetDescription(), DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Key words" ), alias->GetKeyWords(), DARKCYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Key Words" ), alias->GetKeyWords(), DARKCYAN ) );
} }
} }
......
...@@ -161,7 +161,7 @@ void SCH_MARKER::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) ...@@ -161,7 +161,7 @@ void SCH_MARKER::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
{ {
wxString msg; wxString msg;
aList.push_back( MSG_PANEL_ITEM( _( "Electronics rule check error" ), aList.push_back( MSG_PANEL_ITEM( _( "Electronics Rule Check Error" ),
GetReporter().GetErrorText(), DARKRED ) ); GetReporter().GetErrorText(), DARKRED ) );
} }
......
...@@ -825,8 +825,8 @@ wxString SCH_SHEET::GetFileName( void ) const ...@@ -825,8 +825,8 @@ wxString SCH_SHEET::GetFileName( void ) const
void SCH_SHEET::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) void SCH_SHEET::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
{ {
aList.push_back( MSG_PANEL_ITEM( _( "Sheet name" ), m_name, CYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Sheet Name" ), m_name, CYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "File name" ), m_fileName, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "File Name" ), m_fileName, BROWN ) );
#if 0 // Set to 1 to display the sheet time stamp (mainly for test) #if 0 // Set to 1 to display the sheet time stamp (mainly for test)
wxString msg; wxString msg;
......
...@@ -708,7 +708,7 @@ void SCH_TEXT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) ...@@ -708,7 +708,7 @@ void SCH_TEXT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
switch( Type() ) switch( Type() )
{ {
case SCH_TEXT_T: case SCH_TEXT_T:
msg = _( "Graphic text" ); msg = _( "Graphic Text" );
break; break;
case SCH_LABEL_T: case SCH_LABEL_T:
...@@ -716,11 +716,11 @@ void SCH_TEXT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) ...@@ -716,11 +716,11 @@ void SCH_TEXT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
break; break;
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
msg = _( "Global label" ); msg = _( "Global Label" );
break; break;
case SCH_HIERARCHICAL_LABEL_T: case SCH_HIERARCHICAL_LABEL_T:
msg = _( "Hierarchical label" ); msg = _( "Hierarchical Label" );
break; break;
case SCH_SHEET_PIN_T: case SCH_SHEET_PIN_T:
...@@ -767,7 +767,7 @@ void SCH_TEXT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) ...@@ -767,7 +767,7 @@ void SCH_TEXT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
if( m_Bold ) if( m_Bold )
style += 2; style += 2;
aList.push_back( MSG_PANEL_ITEM( _("Style"), textStyle[style], BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Style" ), textStyle[style], BROWN ) );
// Display electricat type if it is relevant // Display electricat type if it is relevant
......
...@@ -553,7 +553,7 @@ void GERBER_DRAW_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -553,7 +553,7 @@ void GERBER_DRAW_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
// Display graphic layer number // Display graphic layer number
msg.Printf( wxT( "%d" ), GetLayer() + 1 ); msg.Printf( wxT( "%d" ), GetLayer() + 1 );
aList.push_back( MSG_PANEL_ITEM( _( "Graphic layer" ), msg, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Graphic Layer" ), msg, BROWN ) );
// Display item rotation // Display item rotation
// The full rotation is Image rotation + m_lyrRotation // The full rotation is Image rotation + m_lyrRotation
......
...@@ -84,7 +84,7 @@ public: ...@@ -84,7 +84,7 @@ public:
* @param aB reference to the end point in the parent shape * @param aB reference to the end point in the parent shape
* @param aIndex index of the segment within the parent shape * @param aIndex index of the segment within the parent shape
*/ */
SEG ( const VECTOR2I& aA, const VECTOR2I& aB, int aIndex ) : A( aA ), B( aB ) SEG( const VECTOR2I& aA, const VECTOR2I& aB, int aIndex ) : A( aA ), B( aB )
{ {
m_index = aIndex; m_index = aIndex;
} }
...@@ -92,7 +92,7 @@ public: ...@@ -92,7 +92,7 @@ public:
/** /**
* Copy constructor * Copy constructor
*/ */
SEG ( const SEG& aSeg ) : A( aSeg.A ), B( aSeg.B ), m_index ( aSeg.m_index ) SEG( const SEG& aSeg ) : A( aSeg.A ), B( aSeg.B ), m_index( aSeg.m_index )
{ {
} }
...@@ -215,14 +215,35 @@ public: ...@@ -215,14 +215,35 @@ public:
*/ */
bool Collinear( const SEG& aSeg ) const bool Collinear( const SEG& aSeg ) const
{ {
ecoord qa1 = A.y - B.y; ecoord qa = A.y - B.y;
ecoord qb1 = B.x - A.x; ecoord qb = B.x - A.x;
ecoord qc1 = -qa1 * A.x - qb1 * A.y; ecoord qc = -qa * A.x - qb * A.y;
ecoord qa2 = aSeg.A.y - aSeg.B.y;
ecoord qb2 = aSeg.B.x - aSeg.A.x; ecoord d1 = std::abs( aSeg.A.x * qa + aSeg.A.y * qb + qc );
ecoord qc2 = -qa2 * aSeg.A.x - qb2 * aSeg.A.y; ecoord d2 = std::abs( aSeg.B.x * qa + aSeg.B.y * qb + qc );
return ( qa1 == qa2 ) && ( qb1 == qb2 ) && ( qc1 == qc2 ); return ( d1 <= 1 && d2 <= 1 );
}
bool Overlaps( const SEG& aSeg ) const
{
if( aSeg.A == aSeg.B ) // single point corner case
{
if( A == aSeg.A || B == aSeg.A )
return false;
return Contains( aSeg.A );
}
if( !Collinear( aSeg ) )
return false;
if( Contains( aSeg.A ) || Contains( aSeg.B ) )
return true;
if( aSeg.Contains( A ) || aSeg.Contains( B ) )
return true;
return false;
} }
/** /**
......
...@@ -40,7 +40,10 @@ enum SHAPE_TYPE ...@@ -40,7 +40,10 @@ enum SHAPE_TYPE
SH_RECT = 0, ///> axis-aligned rectangle SH_RECT = 0, ///> axis-aligned rectangle
SH_SEGMENT, ///> line segment SH_SEGMENT, ///> line segment
SH_LINE_CHAIN, ///> line chain (polyline) SH_LINE_CHAIN, ///> line chain (polyline)
SH_CIRCLE ///> circle SH_CIRCLE, ///> circle
SH_CONVEX, ///> convex polygon
SH_POLYGON, ///> any polygon (with holes, etc.)
SH_COMPOUND ///> compound shape, consisting of multiple simple shapes
}; };
/** /**
...@@ -60,7 +63,7 @@ public: ...@@ -60,7 +63,7 @@ public:
* Creates an empty shape of type aType * Creates an empty shape of type aType
*/ */
SHAPE ( SHAPE_TYPE aType ) : m_type( aType ) SHAPE( SHAPE_TYPE aType ) : m_type( aType )
{} {}
// Destructor // Destructor
...@@ -146,7 +149,11 @@ public: ...@@ -146,7 +149,11 @@ public:
return BBox( 0 ).Centre(); // if nothing better is available.... return BBox( 0 ).Centre(); // if nothing better is available....
} }
private: virtual void Move ( const VECTOR2I& aVector ) = 0;
virtual bool IsSolid() const = 0;
protected:
///> type of our shape ///> type of our shape
SHAPE_TYPE m_type; SHAPE_TYPE m_type;
}; };
......
...@@ -38,7 +38,7 @@ public: ...@@ -38,7 +38,7 @@ public:
SHAPE( SH_CIRCLE ), m_radius( aRadius ), m_center( aCenter ) SHAPE( SH_CIRCLE ), m_radius( aRadius ), m_center( aCenter )
{} {}
SHAPE_CIRCLE ( const SHAPE_CIRCLE& aOther ) : SHAPE_CIRCLE( const SHAPE_CIRCLE& aOther ) :
SHAPE( SH_CIRCLE ), SHAPE( SH_CIRCLE ),
m_radius( aOther.m_radius ), m_radius( aOther.m_radius ),
m_center( aOther.m_center ) m_center( aOther.m_center )
...@@ -86,6 +86,15 @@ public: ...@@ -86,6 +86,15 @@ public:
return m_center; return m_center;
} }
void Move( const VECTOR2I& aVector )
{
m_center += aVector;
}
bool IsSolid() const
{
return true;
}
private: private:
int m_radius; int m_radius;
VECTOR2I m_center; VECTOR2I m_center;
......
...@@ -103,7 +103,18 @@ public: ...@@ -103,7 +103,18 @@ public:
m_points[2] = aC; m_points[2] = aC;
} }
SHAPE_LINE_CHAIN(const VECTOR2I* aV, int aCount ) : SHAPE_LINE_CHAIN( const VECTOR2I& aA, const VECTOR2I& aB, const VECTOR2I& aC, const VECTOR2I& aD ) :
SHAPE( SH_LINE_CHAIN ), m_closed( false )
{
m_points.resize( 4 );
m_points[0] = aA;
m_points[1] = aB;
m_points[2] = aC;
m_points[3] = aD;
}
SHAPE_LINE_CHAIN( const VECTOR2I* aV, int aCount ) :
SHAPE( SH_LINE_CHAIN ), SHAPE( SH_LINE_CHAIN ),
m_closed( false ) m_closed( false )
{ {
...@@ -553,6 +564,16 @@ public: ...@@ -553,6 +564,16 @@ public:
bool CompareGeometry( const SHAPE_LINE_CHAIN & aOther ) const; bool CompareGeometry( const SHAPE_LINE_CHAIN & aOther ) const;
void Move( const VECTOR2I& aVector )
{
for( std::vector<VECTOR2I>::iterator i = m_points.begin(); i != m_points.end(); ++i )
(*i) += aVector;
}
bool IsSolid() const
{
return false;
}
private: private:
/// array of vertices /// array of vertices
std::vector<VECTOR2I> m_points; std::vector<VECTOR2I> m_points;
......
...@@ -57,7 +57,7 @@ public: ...@@ -57,7 +57,7 @@ public:
SHAPE( SH_RECT ), m_p0( aP0 ), m_w( aW ), m_h( aH ) SHAPE( SH_RECT ), m_p0( aP0 ), m_w( aW ), m_h( aH )
{} {}
SHAPE_RECT ( const SHAPE_RECT& aOther ) : SHAPE_RECT( const SHAPE_RECT& aOther ) :
SHAPE( SH_RECT ), SHAPE( SH_RECT ),
m_p0( aOther.m_p0 ), m_p0( aOther.m_p0 ),
m_w( aOther.m_w ), m_w( aOther.m_w ),
...@@ -159,6 +159,16 @@ public: ...@@ -159,6 +159,16 @@ public:
return m_h; return m_h;
} }
void Move( const VECTOR2I& aVector )
{
m_p0 += aVector;
}
bool IsSolid() const
{
return true;
}
private: private:
///> Top-left corner ///> Top-left corner
VECTOR2I m_p0; VECTOR2I m_p0;
......
...@@ -62,17 +62,17 @@ public: ...@@ -62,17 +62,17 @@ public:
return m_seg.Distance( aP ) <= m_width / 2 + aClearance; return m_seg.Distance( aP ) <= m_width / 2 + aClearance;
} }
void SetSeg ( const SEG& aSeg ) void SetSeg( const SEG& aSeg )
{ {
m_seg = aSeg; m_seg = aSeg;
} }
const SEG& GetSeg () const const SEG& GetSeg() const
{ {
return m_seg; return m_seg;
} }
void SetWidth ( int aWidth ) void SetWidth( int aWidth )
{ {
m_width = aWidth; m_width = aWidth;
} }
...@@ -82,6 +82,17 @@ public: ...@@ -82,6 +82,17 @@ public:
return m_width; return m_width;
} }
bool IsSolid() const
{
return true;
}
void Move( const VECTOR2I& aVector )
{
m_seg.A += aVector;
m_seg.B += aVector;
}
private: private:
SEG m_seg; SEG m_seg;
int m_width; int m_width;
......
...@@ -250,7 +250,7 @@ struct KIFACE ...@@ -250,7 +250,7 @@ struct KIFACE
*/ */
class KIWAY : public wxEvtHandler class KIWAY : public wxEvtHandler
{ {
friend class PGM_SINGLE_TOP; // can use set_kiface() friend struct PGM_SINGLE_TOP; // can use set_kiface()
public: public:
/// Known KIFACE implementations /// Known KIFACE implementations
......
...@@ -75,7 +75,7 @@ namespace PCB { struct IFACE; } // KIFACE_I is in pcbnew.cpp ...@@ -75,7 +75,7 @@ namespace PCB { struct IFACE; } // KIFACE_I is in pcbnew.cpp
*/ */
class PCB_EDIT_FRAME : public PCB_BASE_EDIT_FRAME class PCB_EDIT_FRAME : public PCB_BASE_EDIT_FRAME
{ {
friend class PCB::IFACE; friend struct PCB::IFACE;
friend class PCB_LAYER_WIDGET; friend class PCB_LAYER_WIDGET;
void updateTraceWidthSelectBox(); void updateTraceWidthSelectBox();
......
...@@ -920,7 +920,7 @@ void BOARD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -920,7 +920,7 @@ void BOARD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Vias" ), txt, DARKGREEN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Vias" ), txt, DARKGREEN ) );
txt.Printf( wxT( "%d" ), trackSegmentsCount ); txt.Printf( wxT( "%d" ), trackSegmentsCount );
aList.push_back( MSG_PANEL_ITEM( _( "trackSegm" ), txt, DARKGREEN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Track Segments" ), txt, DARKGREEN ) );
txt.Printf( wxT( "%d" ), GetNodesCount() ); txt.Printf( wxT( "%d" ), GetNodesCount() );
aList.push_back( MSG_PANEL_ITEM( _( "Nodes" ), txt, DARKCYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Nodes" ), txt, DARKCYAN ) );
...@@ -937,7 +937,7 @@ void BOARD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -937,7 +937,7 @@ void BOARD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Links" ), txt, DARKGREEN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Links" ), txt, DARKGREEN ) );
txt.Printf( wxT( "%d" ), GetRatsnestsCount() - GetUnconnectedNetCount() ); txt.Printf( wxT( "%d" ), GetRatsnestsCount() - GetUnconnectedNetCount() );
aList.push_back( MSG_PANEL_ITEM( _( "Connect" ), txt, DARKGREEN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Connections" ), txt, DARKGREEN ) );
txt.Printf( wxT( "%d" ), GetUnconnectedNetCount() ); txt.Printf( wxT( "%d" ), GetUnconnectedNetCount() );
aList.push_back( MSG_PANEL_ITEM( _( "Unconnected" ), txt, BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Unconnected" ), txt, BLUE ) );
......
...@@ -247,8 +247,9 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, ...@@ -247,8 +247,9 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
} }
if( mode == LINE ) if( mode == LINE )
{
GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius, color ); GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, radius, color );
}
else if( mode == SKETCH ) else if( mode == SKETCH )
{ {
GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle, GRArc( panel->GetClipBox(), DC, ux0, uy0, StAngle, EndAngle,
...@@ -264,14 +265,17 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, ...@@ -264,14 +265,17 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
break; break;
case S_CURVE: case S_CURVE:
m_BezierPoints = Bezier2Poly(m_Start, m_BezierC1, m_BezierC2, m_End); m_BezierPoints = Bezier2Poly( m_Start, m_BezierC1, m_BezierC2, m_End );
for (unsigned int i=1; i < m_BezierPoints.size(); i++) { for( unsigned int i=1; i < m_BezierPoints.size(); i++ )
{
if( mode == LINE ) if( mode == LINE )
{
GRLine( panel->GetClipBox(), DC, GRLine( panel->GetClipBox(), DC,
m_BezierPoints[i].x, m_BezierPoints[i].y, m_BezierPoints[i].x, m_BezierPoints[i].y,
m_BezierPoints[i-1].x, m_BezierPoints[i-1].y, 0, m_BezierPoints[i-1].x, m_BezierPoints[i-1].y, 0,
color ); color );
}
else if( mode == SKETCH ) else if( mode == SKETCH )
{ {
GRCSegm( panel->GetClipBox(), DC, GRCSegm( panel->GetClipBox(), DC,
...@@ -317,7 +321,7 @@ void DRAWSEGMENT::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -317,7 +321,7 @@ void DRAWSEGMENT::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
wxASSERT( m_Parent ); wxASSERT( m_Parent );
msg = wxT( "DRAWING" ); msg = _( "Drawing" );
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) );
...@@ -332,7 +336,7 @@ void DRAWSEGMENT::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -332,7 +336,7 @@ void DRAWSEGMENT::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
case S_ARC: case S_ARC:
aList.push_back( MSG_PANEL_ITEM( shape, _( "Arc" ), RED ) ); aList.push_back( MSG_PANEL_ITEM( shape, _( "Arc" ), RED ) );
msg.Printf( wxT( "%.1f" ), m_Angle / 10.0 ); msg.Printf( wxT( "%.1f" ), m_Angle / 10.0 );
aList.push_back( MSG_PANEL_ITEM( _("Angle"), msg, RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, RED ) );
break; break;
case S_CURVE: case S_CURVE:
...@@ -340,7 +344,18 @@ void DRAWSEGMENT::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -340,7 +344,18 @@ void DRAWSEGMENT::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
break; break;
default: default:
{
aList.push_back( MSG_PANEL_ITEM( shape, _( "Segment" ), RED ) ); aList.push_back( MSG_PANEL_ITEM( shape, _( "Segment" ), RED ) );
msg = ::CoordinateToString( GetLineLength( m_Start, m_End ) );
aList.push_back( MSG_PANEL_ITEM( _( "Length" ), msg, DARKGREEN ) );
// angle counter-clockwise from 3'o-clock
const double deg = RAD2DEG( atan2( m_Start.y - m_End.y,
m_End.x - m_Start.x ) );
msg.Printf( wxT( "%.1f" ), deg );
aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, DARKGREEN ) );
}
} }
wxString start; wxString start;
...@@ -538,6 +553,7 @@ bool DRAWSEGMENT::HitTest( const wxPoint& aPosition ) const ...@@ -538,6 +553,7 @@ bool DRAWSEGMENT::HitTest( const wxPoint& aPosition ) const
wxASSERT( 0 ); wxASSERT( 0 );
break; break;
} }
return false; return false;
} }
......
...@@ -280,17 +280,15 @@ void EDGE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -280,17 +280,15 @@ void EDGE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
if( !board ) if( !board )
return; return;
aList.push_back( MSG_PANEL_ITEM( _( "Graphic Item" ), wxEmptyString, DARKCYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), module->GetReference(), DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Module" ), module->GetReference(), DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Value" ), module->GetValue(), BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Value" ), module->GetValue(), BLUE ) );
msg.Printf( wxT( "%8.8lX" ), module->GetTimeStamp() ); msg.Printf( wxT( "%8.8lX" ), module->GetTimeStamp() );
aList.push_back( MSG_PANEL_ITEM( _( "TimeStamp" ), msg, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "TimeStamp" ), msg, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Mod Layer" ), aList.push_back( MSG_PANEL_ITEM( _( "Footprint Layer" ),
module->GetLayerName(), RED ) ); module->GetLayerName(), RED ) );
aList.push_back( MSG_PANEL_ITEM( _( "Seg Layer" ),
GetLayerName(), RED ) ); // append the features shared with the base class
msg = ::CoordinateToString( m_Width ); DRAWSEGMENT::GetMsgPanelInfo( aList );
aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, BLUE ) );
} }
...@@ -313,8 +311,7 @@ EDA_ITEM* EDGE_MODULE::Clone() const ...@@ -313,8 +311,7 @@ EDA_ITEM* EDGE_MODULE::Clone() const
} }
void EDGE_MODULE::Flip( const wxPoint& aCentre )
void EDGE_MODULE::Flip(const wxPoint& aCentre )
{ {
wxPoint pt; wxPoint pt;
......
...@@ -552,7 +552,7 @@ void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -552,7 +552,7 @@ void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Last Change" ), msg, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Last Change" ), msg, BROWN ) );
// display schematic path // display schematic path
aList.push_back( MSG_PANEL_ITEM( _( "Netlist path" ), m_Path, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Netlist Path" ), m_Path, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), RED ) );
...@@ -576,32 +576,32 @@ void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -576,32 +576,32 @@ void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
if( m_ModuleStatus & MODULE_is_PLACED ) if( m_ModuleStatus & MODULE_is_PLACED )
msg[1] = 'P'; msg[1] = 'P';
aList.push_back( MSG_PANEL_ITEM( _( "Stat" ), msg, MAGENTA ) ); aList.push_back( MSG_PANEL_ITEM( _( "Status" ), msg, MAGENTA ) );
msg.Printf( wxT( "%.1f" ), m_Orient / 10.0 ); msg.Printf( wxT( "%.1f" ), m_Orient / 10.0 );
aList.push_back( MSG_PANEL_ITEM( _( "Orient" ), msg, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, BROWN ) );
// Controls on right side of the dialog // Controls on right side of the dialog
switch( m_Attributs & 255 ) switch( m_Attributs & 255 )
{ {
case 0: case 0:
msg = _("Normal"); msg = _( "Normal" );
break; break;
case MOD_CMS: case MOD_CMS:
msg = _("Insert"); msg = _( "Insert" );
break; break;
case MOD_VIRTUAL: case MOD_VIRTUAL:
msg = _("Virtual"); msg = _( "Virtual" );
break; break;
default: default:
msg = wxT("???"); msg = wxT( "???" );
break; break;
} }
aList.push_back( MSG_PANEL_ITEM( _( "Attrib" ), msg, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Attributes" ), msg, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), FROM_UTF8( m_fpid.Format().c_str() ), BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), FROM_UTF8( m_fpid.Format().c_str() ), BLUE ) );
msg = _( "No 3D shape" ); msg = _( "No 3D shape" );
...@@ -619,7 +619,7 @@ void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -619,7 +619,7 @@ void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
wxString doc, keyword; wxString doc, keyword;
doc.Printf( _( "Doc: %s" ), GetChars( m_Doc ) ); doc.Printf( _( "Doc: %s" ), GetChars( m_Doc ) );
keyword.Printf( _( "KeyW: %s" ), GetChars( m_KeyWord ) ); keyword.Printf( _( "Key Words: %s" ), GetChars( m_KeyWord ) );
aList.push_back( MSG_PANEL_ITEM( doc, keyword, BLACK ) ); aList.push_back( MSG_PANEL_ITEM( doc, keyword, BLACK ) );
} }
...@@ -1103,7 +1103,6 @@ void MODULE::SetOrientation( double newangle ) ...@@ -1103,7 +1103,6 @@ void MODULE::SetOrientation( double newangle )
{ {
static_cast<EDGE_MODULE*>( item )->SetDrawCoord(); static_cast<EDGE_MODULE*>( item )->SetDrawCoord();
} }
else if( item->Type() == PCB_MODULE_TEXT_T ) else if( item->Type() == PCB_MODULE_TEXT_T )
{ {
static_cast<TEXTE_MODULE*>( item )->SetDrawCoord(); static_cast<TEXTE_MODULE*>( item )->SetDrawCoord();
......
...@@ -132,7 +132,7 @@ void NETINFO_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -132,7 +132,7 @@ void NETINFO_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
// Displays the full net length (tracks on pcb + internal ICs connections ): // Displays the full net length (tracks on pcb + internal ICs connections ):
txt = ::LengthDoubleToString( lengthnet + lengthPadToDie ); txt = ::LengthDoubleToString( lengthnet + lengthPadToDie );
aList.push_back( MSG_PANEL_ITEM( _( "Net Length:" ), txt, RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "Net Length" ), txt, RED ) );
// Displays the net length of tracks only: // Displays the net length of tracks only:
txt = ::LengthDoubleToString( lengthnet ); txt = ::LengthDoubleToString( lengthnet );
......
...@@ -607,7 +607,7 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList ) ...@@ -607,7 +607,7 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList )
if( module ) if( module )
{ {
wxString msg = module->GetReference(); wxString msg = module->GetReference();
aList.push_back( MSG_PANEL_ITEM( _( "Module" ), msg, DARKCYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), msg, DARKCYAN ) );
StringPadName( Line ); StringPadName( Line );
aList.push_back( MSG_PANEL_ITEM( _( "Pad" ), Line, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Pad" ), Line, BROWN ) );
} }
...@@ -629,10 +629,10 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList ) ...@@ -629,10 +629,10 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList )
aList.push_back( MSG_PANEL_ITEM( ShowPadShape(), ShowPadAttr(), DARKGREEN ) ); aList.push_back( MSG_PANEL_ITEM( ShowPadShape(), ShowPadAttr(), DARKGREEN ) );
Line = ::CoordinateToString( m_Size.x ); Line = ::CoordinateToString( m_Size.x );
aList.push_back( MSG_PANEL_ITEM( _( "H Size" ), Line, RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "Width" ), Line, RED ) );
Line = ::CoordinateToString( m_Size.y ); Line = ::CoordinateToString( m_Size.y );
aList.push_back( MSG_PANEL_ITEM( _( "V Size" ), Line, RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "Height" ), Line, RED ) );
Line = ::CoordinateToString( (unsigned) m_Drill.x ); Line = ::CoordinateToString( (unsigned) m_Drill.x );
...@@ -658,13 +658,10 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList ) ...@@ -658,13 +658,10 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList )
else else
Line.Printf( wxT( "%3.1f" ), m_Orient / 10.0 ); Line.Printf( wxT( "%3.1f" ), m_Orient / 10.0 );
aList.push_back( MSG_PANEL_ITEM( _( "Orient" ), Line, LIGHTBLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), Line, LIGHTBLUE ) );
Line = ::CoordinateToString( m_Pos.x ); Line = ::CoordinateToString( m_Pos.x ) + wxT( ", " ) + ::CoordinateToString( m_Pos.y );
aList.push_back( MSG_PANEL_ITEM( _( "X Pos" ), Line, LIGHTBLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Position" ), Line, LIGHTBLUE ) );
Line = ::CoordinateToString( m_Pos.y );
aList.push_back( MSG_PANEL_ITEM( _( "Y pos" ), Line, LIGHTBLUE ) );
if( GetPadToDieLength() ) if( GetPadToDieLength() )
{ {
......
...@@ -143,16 +143,16 @@ void TEXTE_PCB::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -143,16 +143,16 @@ void TEXTE_PCB::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), _( "Yes" ), DARKGREEN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), _( "Yes" ), DARKGREEN ) );
msg.Printf( wxT( "%.1f" ), m_Orient / 10.0 ); msg.Printf( wxT( "%.1f" ), m_Orient / 10.0 );
aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), msg, DARKGREEN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, DARKGREEN ) );
msg = ::CoordinateToString( m_Thickness ); msg = ::CoordinateToString( m_Thickness );
aList.push_back( MSG_PANEL_ITEM( _( "Thickness" ), msg, MAGENTA ) ); aList.push_back( MSG_PANEL_ITEM( _( "Thickness" ), msg, MAGENTA ) );
msg = ::CoordinateToString( m_Size.x ); msg = ::CoordinateToString( m_Size.x );
aList.push_back( MSG_PANEL_ITEM( _( "Size X" ), msg, RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, RED ) );
msg = ::CoordinateToString( m_Size.y ); msg = ::CoordinateToString( m_Size.y );
aList.push_back( MSG_PANEL_ITEM( _( "Size Y" ), msg, RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, RED ) );
} }
const EDA_RECT TEXTE_PCB::GetBoundingBox() const const EDA_RECT TEXTE_PCB::GetBoundingBox() const
......
...@@ -408,16 +408,16 @@ void TEXTE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -408,16 +408,16 @@ void TEXTE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), msg, DARKGREEN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), msg, DARKGREEN ) );
msg.Printf( wxT( "%.1f" ), m_Orient / 10.0 ); msg.Printf( wxT( "%.1f" ), m_Orient / 10.0 );
aList.push_back( MSG_PANEL_ITEM( _( "Orient" ), msg, DARKGREEN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, DARKGREEN ) );
msg = ::CoordinateToString( m_Thickness ); msg = ::CoordinateToString( m_Thickness );
aList.push_back( MSG_PANEL_ITEM( _( "Thickness" ), msg, DARKGREEN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Thickness" ), msg, DARKGREEN ) );
msg = ::CoordinateToString( m_Size.x ); msg = ::CoordinateToString( m_Size.x );
aList.push_back( MSG_PANEL_ITEM( _( "H Size" ), msg, RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, RED ) );
msg = ::CoordinateToString( m_Size.y ); msg = ::CoordinateToString( m_Size.y );
aList.push_back( MSG_PANEL_ITEM( _( "V Size" ), msg, RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, RED ) );
} }
......
...@@ -1023,15 +1023,15 @@ void TRACK::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -1023,15 +1023,15 @@ void TRACK::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
double lenPadToDie = 0; double lenPadToDie = 0;
board->MarkTrace( this, NULL, &trackLen, &lenPadToDie, false ); board->MarkTrace( this, NULL, &trackLen, &lenPadToDie, false );
msg = ::LengthDoubleToString( trackLen ); msg = ::LengthDoubleToString( trackLen );
aList.push_back( MSG_PANEL_ITEM( _( "Track Len" ), msg, DARKCYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Length" ), msg, DARKCYAN ) );
if( lenPadToDie != 0 ) if( lenPadToDie != 0 )
{ {
msg = ::LengthDoubleToString( trackLen + lenPadToDie ); msg = ::LengthDoubleToString( trackLen + lenPadToDie );
aList.push_back( MSG_PANEL_ITEM( _( "Full Len" ), msg, DARKCYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Full Length" ), msg, DARKCYAN ) );
msg = ::LengthDoubleToString( lenPadToDie ); msg = ::LengthDoubleToString( lenPadToDie );
aList.push_back( MSG_PANEL_ITEM( _( "In Package" ), msg, DARKCYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Pad To Die Length" ), msg, DARKCYAN ) );
} }
} }
...@@ -1155,7 +1155,7 @@ void SEGZONE::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -1155,7 +1155,7 @@ void SEGZONE::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
if( board ) if( board )
msg = board->GetLayerName( m_Layer ); msg = board->GetLayerName( m_Layer );
else else
msg.Printf(wxT("%d"), m_Layer ); msg.Printf( wxT( "%d" ), m_Layer );
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), msg, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), msg, BROWN ) );
...@@ -1209,7 +1209,7 @@ void VIA::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -1209,7 +1209,7 @@ void VIA::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
msg = board->GetLayerName( top_layer ) + wxT( "/" ) msg = board->GetLayerName( top_layer ) + wxT( "/" )
+ board->GetLayerName( bottom_layer ); + board->GetLayerName( bottom_layer );
else else
msg.Printf(wxT("%d/%d"), top_layer, bottom_layer ); msg.Printf( wxT( "%d/%d" ), top_layer, bottom_layer );
aList.push_back( MSG_PANEL_ITEM( _( "Layers" ), msg, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Layers" ), msg, BROWN ) );
...@@ -1217,7 +1217,7 @@ void VIA::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -1217,7 +1217,7 @@ void VIA::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
msg = ::CoordinateToString( (unsigned) m_Width ); msg = ::CoordinateToString( (unsigned) m_Width );
// Display diameter value: // Display diameter value:
aList.push_back( MSG_PANEL_ITEM( _( "Diam" ), msg, DARKCYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Diameter" ), msg, DARKCYAN ) );
// Display drill value // Display drill value
int drill_value = GetDrillValue(); int drill_value = GetDrillValue();
......
...@@ -608,7 +608,7 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -608,7 +608,7 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
msg.Empty(); msg.Empty();
if( GetDoNotAllowVias() ) if( GetDoNotAllowVias() )
AccumulateDescription( msg, _("No via") ); AccumulateDescription( msg, _( "No via" ) );
if( GetDoNotAllowTracks() ) if( GetDoNotAllowTracks() )
AccumulateDescription( msg, _("No track") ); AccumulateDescription( msg, _("No track") );
...@@ -663,16 +663,16 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -663,16 +663,16 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
else else
msg = _( "Polygons" ); msg = _( "Polygons" );
aList.push_back( MSG_PANEL_ITEM( _( "Fill mode" ), msg, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Fill Mode" ), msg, BROWN ) );
// Useful for statistics : // Useful for statistics :
msg.Printf( wxT( "%d" ), (int) m_Poly->m_HatchLines.size() ); msg.Printf( wxT( "%d" ), (int) m_Poly->m_HatchLines.size() );
aList.push_back( MSG_PANEL_ITEM( _( "Hatch lines" ), msg, BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Hatch Lines" ), msg, BLUE ) );
if( m_FilledPolysList.GetCornersCount() ) if( m_FilledPolysList.GetCornersCount() )
{ {
msg.Printf( wxT( "%d" ), (int) m_FilledPolysList.GetCornersCount() ); msg.Printf( wxT( "%d" ), (int) m_FilledPolysList.GetCornersCount() );
aList.push_back( MSG_PANEL_ITEM( _( "Corners in DrawList" ), msg, BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Corner Count" ), msg, BLUE ) );
} }
} }
......
...@@ -23,22 +23,22 @@ ...@@ -23,22 +23,22 @@
*/ */
#include "dialog_track_via_size.h" #include "dialog_track_via_size.h"
#include <router/pns_routing_settings.h>
#include <base_units.h> #include <base_units.h>
#include <confirm.h> #include <confirm.h>
#include <boost/optional.hpp> #include <boost/optional.hpp>
DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, PNS_ROUTING_SETTINGS& aSettings ) : #include "class_board_design_settings.h"
DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, BOARD_DESIGN_SETTINGS& aSettings ) :
DIALOG_TRACK_VIA_SIZE_BASE( aParent ), DIALOG_TRACK_VIA_SIZE_BASE( aParent ),
m_settings( aSettings ) m_settings( aSettings )
{ {
// Load router settings to dialog fields // Load router settings to dialog fields
m_trackWidth->SetValue( To_User_Unit( m_trackWidth->GetUnits(), m_settings.GetTrackWidth() ) ); m_trackWidth->SetValue( To_User_Unit( m_trackWidth->GetUnits(), m_settings.GetCustomTrackWidth() ) );
m_viaDiameter->SetValue( To_User_Unit( m_viaDiameter->GetUnits(), m_settings.GetViaDiameter() ) ); m_viaDiameter->SetValue( To_User_Unit( m_viaDiameter->GetUnits(), m_settings.GetCustomViaSize() ) );
m_viaDrill->SetValue( To_User_Unit( m_viaDrill->GetUnits(), m_settings.GetViaDrill() ) ); m_viaDrill->SetValue( To_User_Unit( m_viaDrill->GetUnits(), m_settings.GetCustomViaDrill() ) );
m_trackWidth->SetFocus(); m_trackWidth->SetFocus();
GetSizer()->SetSizeHints( this );
// Pressing ENTER when any of the text input fields is active applies changes // Pressing ENTER when any of the text input fields is active applies changes
#if wxCHECK_VERSION( 3, 0, 0 ) #if wxCHECK_VERSION( 3, 0, 0 )
...@@ -46,6 +46,8 @@ DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, PNS_ROUTING_SET ...@@ -46,6 +46,8 @@ DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, PNS_ROUTING_SET
#else #else
Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE::onOkClick ), NULL, this ); Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE::onOkClick ), NULL, this );
#endif #endif
Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_TRACK_VIA_SIZE::onClose ) );
} }
...@@ -56,7 +58,7 @@ bool DIALOG_TRACK_VIA_SIZE::check() ...@@ -56,7 +58,7 @@ bool DIALOG_TRACK_VIA_SIZE::check()
return false; return false;
// Via drill should be smaller than via diameter // Via drill should be smaller than via diameter
if( *m_viaDrill->GetValue() >= m_viaDiameter->GetValue() ) if( m_viaDrill->GetValue() >= m_viaDiameter->GetValue() )
return false; return false;
return true; return true;
...@@ -74,9 +76,9 @@ void DIALOG_TRACK_VIA_SIZE::onOkClick( wxCommandEvent& aEvent ) ...@@ -74,9 +76,9 @@ void DIALOG_TRACK_VIA_SIZE::onOkClick( wxCommandEvent& aEvent )
if( check() ) if( check() )
{ {
// Store dialog values to the router settings // Store dialog values to the router settings
m_settings.SetTrackWidth( From_User_Unit( m_trackWidth->GetUnits(), *m_trackWidth->GetValue() ) ); m_settings.SetCustomTrackWidth( From_User_Unit( m_trackWidth->GetUnits(), *m_trackWidth->GetValue() ) );
m_settings.SetViaDiameter( From_User_Unit( m_viaDiameter->GetUnits(), *m_viaDiameter->GetValue() ) ); m_settings.SetCustomViaSize( From_User_Unit( m_viaDiameter->GetUnits(), *m_viaDiameter->GetValue() ) );
m_settings.SetViaDrill( From_User_Unit( m_viaDrill->GetUnits(), *m_viaDrill->GetValue() ) ); m_settings.SetCustomViaDrill( From_User_Unit( m_viaDrill->GetUnits(), *m_viaDrill->GetValue() ) );
EndModal( 1 ); EndModal( 1 );
} }
else else
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
*/ */
/** /**
* Push and Shove router track width and via size dialog. * Custom track width and via size dialog.
*/ */
#ifndef __dialog_track_via_size__ #ifndef __dialog_track_via_size__
...@@ -27,18 +27,18 @@ ...@@ -27,18 +27,18 @@
#include "dialog_track_via_size_base.h" #include "dialog_track_via_size_base.h"
class PNS_ROUTING_SETTINGS; class BOARD_DESIGN_SETTINGS;
/** Implementing DIALOG_TRACK_VIA_SIZE_BASE */ /** Implementing DIALOG_TRACK_VIA_SIZE_BASE */
class DIALOG_TRACK_VIA_SIZE : public DIALOG_TRACK_VIA_SIZE_BASE class DIALOG_TRACK_VIA_SIZE : public DIALOG_TRACK_VIA_SIZE_BASE
{ {
public: public:
/** Constructor */ /** Constructor */
DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, PNS_ROUTING_SETTINGS& aSettings ); DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, BOARD_DESIGN_SETTINGS& aSettings );
protected: protected:
// Routings settings that are modified by the dialog. // Routings settings that are modified by the dialog.
PNS_ROUTING_SETTINGS& m_settings; BOARD_DESIGN_SETTINGS& m_settings;
///> Checks if values given in the dialog are sensible. ///> Checks if values given in the dialog are sensible.
bool check(); bool check();
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 6 2013) // C++ code generated with wxFormBuilder (version Jun 6 2014)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#include "dialog_shim.h"
#include "dialog_track_via_size_base.h" #include "dialog_track_via_size_base.h"
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
DIALOG_TRACK_VIA_SIZE_BASE::DIALOG_TRACK_VIA_SIZE_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) DIALOG_TRACK_VIA_SIZE_BASE::DIALOG_TRACK_VIA_SIZE_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{ {
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); this->SetSizeHints( wxSize( 280,240 ), wxDefaultSize );
wxBoxSizer* bSizes; wxBoxSizer* bSizes;
bSizes = new wxBoxSizer( wxVERTICAL ); bSizes = new wxBoxSizer( wxVERTICAL );
m_trackWidth = new WX_UNIT_TEXT( this, _("Track width:") ); m_trackWidth = new WX_UNIT_TEXT( this, _("Track width:") );
bSizes->Add( m_trackWidth, 0, wxALL, 5 ); bSizes->Add( m_trackWidth, 0, wxALL|wxEXPAND, 5 );
m_viaDiameter = new WX_UNIT_TEXT( this, _("Via diameter:") ); m_viaDiameter = new WX_UNIT_TEXT( this, _("Via diameter:") );
bSizes->Add( m_viaDiameter, 0, wxALL, 5 ); bSizes->Add( m_viaDiameter, 0, wxALL|wxEXPAND, 5 );
m_viaDrill = new WX_UNIT_TEXT( this, _("Via drill:") ); m_viaDrill = new WX_UNIT_TEXT( this, _("Via drill:") );
bSizes->Add( m_viaDrill, 0, wxALL, 5 ); bSizes->Add( m_viaDrill, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* bButtons;
bButtons = new wxBoxSizer( wxHORIZONTAL );
m_ok = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
bButtons->Add( m_ok, 1, wxALL, 5 );
m_cancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
bButtons->Add( m_cancel, 1, wxALL, 5 );
m_stdButtons = new wxStdDialogButtonSizer();
m_stdButtonsOK = new wxButton( this, wxID_OK );
m_stdButtons->AddButton( m_stdButtonsOK );
m_stdButtonsCancel = new wxButton( this, wxID_CANCEL );
m_stdButtons->AddButton( m_stdButtonsCancel );
m_stdButtons->Realize();
bSizes->Add( bButtons, 0, wxEXPAND, 5 ); bSizes->Add( m_stdButtons, 0, wxEXPAND|wxALL, 5 );
this->SetSizer( bSizes ); this->SetSizer( bSizes );
this->Layout(); this->Layout();
bSizes->Fit( this );
this->Centre( wxBOTH ); this->Centre( wxBOTH );
// Connect Events // Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onClose ) ); this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onClose ) );
m_ok->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onOkClick ), NULL, this ); m_stdButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onCancelClick ), NULL, this );
m_cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onCancelClick ), NULL, this ); m_stdButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onOkClick ), NULL, this );
} }
DIALOG_TRACK_VIA_SIZE_BASE::~DIALOG_TRACK_VIA_SIZE_BASE() DIALOG_TRACK_VIA_SIZE_BASE::~DIALOG_TRACK_VIA_SIZE_BASE()
{ {
// Disconnect Events // Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onClose ) ); this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onClose ) );
m_ok->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onOkClick ), NULL, this ); m_stdButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onCancelClick ), NULL, this );
m_cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onCancelClick ), NULL, this ); m_stdButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onOkClick ), NULL, this );
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 6 2013) // C++ code generated with wxFormBuilder (version Jun 6 2014)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -11,16 +11,14 @@ ...@@ -11,16 +11,14 @@
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
class DIALOG_SHIM;
#include <wxunittext.h> #include <wxunittext.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/font.h> #include <wx/font.h>
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/button.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/button.h>
#include <wx/dialog.h> #include <wx/dialog.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
...@@ -37,18 +35,19 @@ class DIALOG_TRACK_VIA_SIZE_BASE : public wxDialog ...@@ -37,18 +35,19 @@ class DIALOG_TRACK_VIA_SIZE_BASE : public wxDialog
WX_UNIT_TEXT* m_trackWidth; WX_UNIT_TEXT* m_trackWidth;
WX_UNIT_TEXT* m_viaDiameter; WX_UNIT_TEXT* m_viaDiameter;
WX_UNIT_TEXT* m_viaDrill; WX_UNIT_TEXT* m_viaDrill;
wxButton* m_ok; wxStdDialogButtonSizer* m_stdButtons;
wxButton* m_cancel; wxButton* m_stdButtonsOK;
wxButton* m_stdButtonsCancel;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void onClose( wxCloseEvent& event ) { event.Skip(); } virtual void onClose( wxCloseEvent& event ) { event.Skip(); }
virtual void onOkClick( wxCommandEvent& event ) { event.Skip(); }
virtual void onCancelClick( wxCommandEvent& event ) { event.Skip(); } virtual void onCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void onOkClick( wxCommandEvent& event ) { event.Skip(); }
public: public:
DIALOG_TRACK_VIA_SIZE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Track width and via size"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 388,162 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_TRACK_VIA_SIZE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Track width and via size"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
~DIALOG_TRACK_VIA_SIZE_BASE(); ~DIALOG_TRACK_VIA_SIZE_BASE();
}; };
......
...@@ -387,7 +387,6 @@ void PCB_PAINTER::draw( const VIA* aVia, int aLayer ) ...@@ -387,7 +387,6 @@ void PCB_PAINTER::draw( const VIA* aVia, int aLayer )
else else
{ {
double width = ( aVia->GetWidth() - aVia->GetDrillValue() ) / 2.0; double width = ( aVia->GetWidth() - aVia->GetDrillValue() ) / 2.0;
radius -= width / 2.0;
m_gal->SetLineWidth( width ); m_gal->SetLineWidth( width );
m_gal->SetIsFill( true ); m_gal->SetIsFill( true );
......
...@@ -24,6 +24,7 @@ set( PCBNEW_PNS_SRCS ...@@ -24,6 +24,7 @@ set( PCBNEW_PNS_SRCS
pns_router.cpp pns_router.cpp
pns_routing_settings.cpp pns_routing_settings.cpp
pns_shove.cpp pns_shove.cpp
pns_sizes_settings.cpp
pns_solid.cpp pns_solid.cpp
pns_utils.cpp pns_utils.cpp
pns_via.cpp pns_via.cpp
......
...@@ -65,7 +65,7 @@ public: ...@@ -65,7 +65,7 @@ public:
ANG_UNDEFINED = 0x20 ANG_UNDEFINED = 0x20
}; };
DIRECTION_45( Directions aDir = UNDEFINED ) : m_dir( aDir ) {}; DIRECTION_45( Directions aDir = UNDEFINED ) : m_dir( aDir ) {}
/** /**
* Constructor * Constructor
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "pns_router.h" #include "pns_router.h"
PNS_DRAGGER::PNS_DRAGGER( PNS_ROUTER* aRouter ) : PNS_DRAGGER::PNS_DRAGGER( PNS_ROUTER* aRouter ) :
PNS_ALGO_BASE ( aRouter ) PNS_ALGO_BASE( aRouter )
{ {
m_world = NULL; m_world = NULL;
m_shove = NULL; m_shove = NULL;
...@@ -39,7 +39,7 @@ PNS_DRAGGER::~PNS_DRAGGER() ...@@ -39,7 +39,7 @@ PNS_DRAGGER::~PNS_DRAGGER()
} }
void PNS_DRAGGER::SetWorld ( PNS_NODE* aWorld ) void PNS_DRAGGER::SetWorld( PNS_NODE* aWorld )
{ {
m_world = aWorld; m_world = aWorld;
} }
...@@ -49,7 +49,7 @@ bool PNS_DRAGGER::startDragSegment( const VECTOR2D& aP, PNS_SEGMENT* aSeg ) ...@@ -49,7 +49,7 @@ bool PNS_DRAGGER::startDragSegment( const VECTOR2D& aP, PNS_SEGMENT* aSeg )
{ {
int w2 = aSeg->Width() / 2; int w2 = aSeg->Width() / 2;
m_draggedLine = m_world->AssembleLine ( aSeg, &m_draggedSegmentIndex ); m_draggedLine = m_world->AssembleLine( aSeg, &m_draggedSegmentIndex );
m_shove->SetInitialLine( m_draggedLine ); m_shove->SetInitialLine( m_draggedLine );
m_lastValidDraggedLine = *m_draggedLine; m_lastValidDraggedLine = *m_draggedLine;
m_lastValidDraggedLine.ClearSegmentLinks(); m_lastValidDraggedLine.ClearSegmentLinks();
...@@ -58,7 +58,7 @@ bool PNS_DRAGGER::startDragSegment( const VECTOR2D& aP, PNS_SEGMENT* aSeg ) ...@@ -58,7 +58,7 @@ bool PNS_DRAGGER::startDragSegment( const VECTOR2D& aP, PNS_SEGMENT* aSeg )
m_mode = CORNER; m_mode = CORNER;
else if( ( aP - aSeg->Seg().B ).EuclideanNorm() <= w2 ) else if( ( aP - aSeg->Seg().B ).EuclideanNorm() <= w2 )
{ {
m_draggedSegmentIndex ++; m_draggedSegmentIndex++;
m_mode = CORNER; m_mode = CORNER;
} else } else
m_mode = SEGMENT; m_mode = SEGMENT;
...@@ -74,14 +74,14 @@ bool PNS_DRAGGER::startDragVia( const VECTOR2D& aP, PNS_VIA* aVia ) ...@@ -74,14 +74,14 @@ bool PNS_DRAGGER::startDragVia( const VECTOR2D& aP, PNS_VIA* aVia )
m_mode = VIA; m_mode = VIA;
VECTOR2I p0( aVia->Pos() ); VECTOR2I p0( aVia->Pos() );
PNS_JOINT *jt = m_world->FindJoint( p0, aVia->Layers().Start(), aVia->Net() ); PNS_JOINT* jt = m_world->FindJoint( p0, aVia->Layers().Start(), aVia->Net() );
BOOST_FOREACH(PNS_ITEM *item, jt->LinkList() ) BOOST_FOREACH( PNS_ITEM* item, jt->LinkList() )
{ {
if( item->OfKind( PNS_ITEM::SEGMENT ) ) if( item->OfKind( PNS_ITEM::SEGMENT ) )
{ {
int segIndex; int segIndex;
PNS_SEGMENT* seg = (PNS_SEGMENT*) item; PNS_SEGMENT* seg = ( PNS_SEGMENT*) item;
std::auto_ptr<PNS_LINE> l( m_world->AssembleLine( seg, &segIndex ) ); std::auto_ptr<PNS_LINE> l( m_world->AssembleLine( seg, &segIndex ) );
if( segIndex != 0 ) if( segIndex != 0 )
...@@ -107,10 +107,10 @@ bool PNS_DRAGGER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem ) ...@@ -107,10 +107,10 @@ bool PNS_DRAGGER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
switch( aStartItem->Kind() ) switch( aStartItem->Kind() )
{ {
case PNS_ITEM::SEGMENT: case PNS_ITEM::SEGMENT:
return startDragSegment ( aP, static_cast<PNS_SEGMENT *>( aStartItem ) ); return startDragSegment( aP, static_cast<PNS_SEGMENT*>( aStartItem ) );
case PNS_ITEM::VIA: case PNS_ITEM::VIA:
return startDragVia ( aP, static_cast<PNS_VIA *> (aStartItem) ); return startDragVia( aP, static_cast<PNS_VIA*>( aStartItem ) );
default: default:
return false; return false;
...@@ -135,9 +135,9 @@ bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP ) ...@@ -135,9 +135,9 @@ bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP )
PNS_LINE tmp( *m_draggedLine ); PNS_LINE tmp( *m_draggedLine );
if( m_mode == SEGMENT ) if( m_mode == SEGMENT )
tmp.DragSegment ( aP, m_draggedSegmentIndex, thresh ); tmp.DragSegment( aP, m_draggedSegmentIndex, thresh );
else else
tmp.DragCorner ( aP, m_draggedSegmentIndex, thresh ); tmp.DragCorner( aP, m_draggedSegmentIndex, thresh );
m_lastNode = m_shove->CurrentNode()->Branch(); m_lastNode = m_shove->CurrentNode()->Branch();
...@@ -145,8 +145,8 @@ bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP ) ...@@ -145,8 +145,8 @@ bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP )
m_lastValidDraggedLine.ClearSegmentLinks(); m_lastValidDraggedLine.ClearSegmentLinks();
m_lastValidDraggedLine.Unmark(); m_lastValidDraggedLine.Unmark();
m_lastNode->Add ( &m_lastValidDraggedLine ); m_lastNode->Add( &m_lastValidDraggedLine );
m_draggedItems = PNS_ITEMSET ( &m_lastValidDraggedLine ); m_draggedItems = PNS_ITEMSET( &m_lastValidDraggedLine );
break; break;
} }
...@@ -154,7 +154,7 @@ bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP ) ...@@ -154,7 +154,7 @@ bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP )
case VIA: // fixme... case VIA: // fixme...
{ {
m_lastNode = m_shove->CurrentNode()->Branch(); m_lastNode = m_shove->CurrentNode()->Branch();
dumbDragVia ( m_initialVia, m_lastNode, aP ); dumbDragVia( m_initialVia, m_lastNode, aP );
break; break;
} }
...@@ -182,13 +182,13 @@ void PNS_DRAGGER::dumbDragVia( PNS_VIA* aVia, PNS_NODE* aNode, const VECTOR2I& a ...@@ -182,13 +182,13 @@ void PNS_DRAGGER::dumbDragVia( PNS_VIA* aVia, PNS_NODE* aNode, const VECTOR2I& a
BOOST_FOREACH( PNS_LINE &l, m_origViaConnections ) BOOST_FOREACH( PNS_LINE &l, m_origViaConnections )
{ {
PNS_LINE origLine (l); PNS_LINE origLine( l );
PNS_LINE* draggedLine = l.Clone(); PNS_LINE* draggedLine = l.Clone();
draggedLine->DragCorner( aP, 0 ); draggedLine->DragCorner( aP, 0 );
draggedLine->ClearSegmentLinks(); draggedLine->ClearSegmentLinks();
m_draggedItems.AddOwned( draggedLine ); m_draggedItems.Add( draggedLine ); // FIXME: mem leak
m_lastNode->Remove( &origLine ); m_lastNode->Remove( &origLine );
m_lastNode->Add( draggedLine ); m_lastNode->Add( draggedLine );
...@@ -244,7 +244,7 @@ bool PNS_DRAGGER::dragShove( const VECTOR2I& aP ) ...@@ -244,7 +244,7 @@ bool PNS_DRAGGER::dragShove( const VECTOR2I& aP )
case VIA: case VIA:
{ {
PNS_VIA *newVia; PNS_VIA* newVia;
PNS_SHOVE::SHOVE_STATUS st = m_shove->ShoveDraggingVia( m_draggedVia, aP, &newVia ); PNS_SHOVE::SHOVE_STATUS st = m_shove->ShoveDraggingVia( m_draggedVia, aP, &newVia );
if( st == PNS_SHOVE::SH_OK || st == PNS_SHOVE::SH_HEAD_MODIFIED ) if( st == PNS_SHOVE::SH_OK || st == PNS_SHOVE::SH_HEAD_MODIFIED )
...@@ -298,7 +298,7 @@ bool PNS_DRAGGER::Drag( const VECTOR2I& aP ) ...@@ -298,7 +298,7 @@ bool PNS_DRAGGER::Drag( const VECTOR2I& aP )
} }
PNS_NODE *PNS_DRAGGER::CurrentNode() const PNS_NODE* PNS_DRAGGER::CurrentNode() const
{ {
return m_lastNode; return m_lastNode;
} }
......
...@@ -24,32 +24,13 @@ ...@@ -24,32 +24,13 @@
PNS_ITEMSET::PNS_ITEMSET( PNS_ITEM* aInitialItem ) PNS_ITEMSET::PNS_ITEMSET( PNS_ITEM* aInitialItem )
{ {
if(aInitialItem) if( aInitialItem )
m_items.push_back(aInitialItem); m_items.push_back( aInitialItem );
} }
PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd, bool aInvert )
PNS_ITEMSET::~PNS_ITEMSET()
{
Clear();
}
void PNS_ITEMSET::Clear()
{
BOOST_FOREACH(PNS_ITEM* item, m_ownedItems)
{
delete item;
}
m_items.clear();
m_ownedItems.clear();
}
PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd )
{ {
ITEM_VECTOR newItems; ITEMS newItems;
PNS_LAYERSET l; PNS_LAYERSET l;
if( aEnd < 0 ) if( aEnd < 0 )
...@@ -59,7 +40,7 @@ PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd ) ...@@ -59,7 +40,7 @@ PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd )
BOOST_FOREACH( PNS_ITEM* item, m_items ) BOOST_FOREACH( PNS_ITEM* item, m_items )
if( item->Layers().Overlaps( l ) ) if( item->Layers().Overlaps( l ) ^ aInvert )
newItems.push_back( item ); newItems.push_back( item );
m_items = newItems; m_items = newItems;
...@@ -68,13 +49,13 @@ PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd ) ...@@ -68,13 +49,13 @@ PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd )
} }
PNS_ITEMSET& PNS_ITEMSET::FilterKinds( int aKindMask ) PNS_ITEMSET& PNS_ITEMSET::FilterKinds( int aKindMask, bool aInvert )
{ {
ITEM_VECTOR newItems; ITEMS newItems;
BOOST_FOREACH( PNS_ITEM* item, m_items ) BOOST_FOREACH( PNS_ITEM* item, m_items )
{ {
if( item->OfKind ( aKindMask ) ) if( item->OfKind( aKindMask ) ^ aInvert )
newItems.push_back( item ); newItems.push_back( item );
} }
...@@ -84,13 +65,28 @@ PNS_ITEMSET& PNS_ITEMSET::FilterKinds( int aKindMask ) ...@@ -84,13 +65,28 @@ PNS_ITEMSET& PNS_ITEMSET::FilterKinds( int aKindMask )
} }
PNS_ITEMSET& PNS_ITEMSET::FilterNet( int aNet ) PNS_ITEMSET& PNS_ITEMSET::FilterNet( int aNet, bool aInvert )
{
ITEMS newItems;
BOOST_FOREACH( PNS_ITEM* item, m_items )
{
if( ( item->Net() == aNet ) ^ aInvert )
newItems.push_back( item );
}
m_items = newItems;
return *this;
}
PNS_ITEMSET& PNS_ITEMSET::ExcludeItem( const PNS_ITEM* aItem )
{ {
ITEM_VECTOR newItems; ITEMS newItems;
BOOST_FOREACH( PNS_ITEM* item, m_items ) BOOST_FOREACH( PNS_ITEM* item, m_items )
{ {
if( item->Net() == aNet ) if( item != aItem )
newItems.push_back( item ); newItems.push_back( item );
} }
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#define __PNS_ITEMSET_H #define __PNS_ITEMSET_H
#include <vector> #include <vector>
#include <boost/foreach.hpp>
#include "pns_item.h" #include "pns_item.h"
...@@ -35,53 +36,96 @@ ...@@ -35,53 +36,96 @@
class PNS_ITEMSET class PNS_ITEMSET
{ {
public: public:
typedef std::vector<PNS_ITEM*> ITEM_VECTOR; typedef std::vector<PNS_ITEM*> ITEMS;
PNS_ITEMSET( PNS_ITEM* aInitialItem = NULL ); PNS_ITEMSET( PNS_ITEM* aInitialItem = NULL );
PNS_ITEMSET( const PNS_ITEMSET& aOther ) PNS_ITEMSET( const PNS_ITEMSET& aOther )
{ {
m_items = aOther.m_items; m_items = aOther.m_items;
m_ownedItems = ITEM_VECTOR();
} }
const PNS_ITEMSET& operator=( const PNS_ITEMSET& aOther ) const PNS_ITEMSET& operator=( const PNS_ITEMSET& aOther )
{ {
m_items = aOther.m_items; m_items = aOther.m_items;
m_ownedItems = ITEM_VECTOR();
return *this; return *this;
} }
~PNS_ITEMSET(); int Count( int aKindMask = -1 ) const
{
int n = 0;
BOOST_FOREACH( PNS_ITEM* item, m_items )
{
if( item->Kind() & aKindMask )
n++;
}
return n;
}
ITEM_VECTOR& Items() { return m_items; } ITEMS& Items() { return m_items; }
const ITEM_VECTOR& CItems() const { return m_items; } const ITEMS& CItems() const { return m_items; }
PNS_ITEMSET& FilterLayers( int aStart, int aEnd = -1 ); PNS_ITEMSET& FilterLayers( int aStart, int aEnd = -1, bool aInvert = false );
PNS_ITEMSET& FilterKinds( int aKindMask ); PNS_ITEMSET& FilterKinds( int aKindMask, bool aInvert = false );
PNS_ITEMSET& FilterNet( int aNet ); PNS_ITEMSET& FilterNet( int aNet, bool aInvert = false );
int Size() { return m_items.size(); } PNS_ITEMSET& ExcludeLayers( int aStart, int aEnd = -1 )
{
return FilterLayers( aStart, aEnd, true );
}
PNS_ITEMSET& ExcludeKinds( int aKindMask )
{
return FilterKinds( aKindMask, true );
}
PNS_ITEMSET& ExcludeNet( int aNet )
{
return FilterNet( aNet, true );
}
PNS_ITEMSET& ExcludeItem( const PNS_ITEM* aItem );
int Size() const
{
return m_items.size();
}
void Add( PNS_ITEM* aItem ) void Add( PNS_ITEM* aItem )
{ {
m_items.push_back( aItem ); m_items.push_back( aItem );
} }
PNS_ITEM* Get( int index ) const { return m_items[index]; } PNS_ITEM* Get( int index ) const
{
return m_items[index];
}
void Clear(); PNS_ITEM* operator[] ( int index ) const
{
return m_items[index];
}
void AddOwned( PNS_ITEM *aItem ) void Clear()
{ {
m_items.push_back( aItem ); m_items.clear();
m_ownedItems.push_back( aItem ); }
bool Contains( const PNS_ITEM* aItem ) const
{
return std::find( m_items.begin(), m_items.end(), aItem ) != m_items.end();
}
void Erase( const PNS_ITEM* aItem )
{
ITEMS::iterator f = std::find( m_items.begin(), m_items.end(), aItem );
if( f != m_items.end() )
m_items.erase( f );
} }
private: private:
ITEM_VECTOR m_items; ITEMS m_items;
ITEM_VECTOR m_ownedItems;
}; };
#endif #endif
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "pns_item.h" #include "pns_item.h"
#include "pns_segment.h" #include "pns_segment.h"
#include "pns_itemset.h"
/** /**
* Class PNS_JOINT * Class PNS_JOINT
...@@ -71,7 +72,7 @@ public: ...@@ -71,7 +72,7 @@ public:
m_layers = aB.m_layers; m_layers = aB.m_layers;
} }
PNS_ITEM* Clone ( ) const PNS_ITEM* Clone( ) const
{ {
assert( false ); assert( false );
return NULL; return NULL;
...@@ -81,7 +82,7 @@ public: ...@@ -81,7 +82,7 @@ public:
/// segments of the same net, on the same layer. /// segments of the same net, on the same layer.
bool IsLineCorner() const bool IsLineCorner() const
{ {
if( m_linkedItems.size() != 2 ) if( m_linkedItems.Size() != 2 )
return false; return false;
if( m_linkedItems[0]->Kind() != SEGMENT || m_linkedItems[1]->Kind() != SEGMENT ) if( m_linkedItems[0]->Kind() != SEGMENT || m_linkedItems[1]->Kind() != SEGMENT )
...@@ -97,24 +98,18 @@ public: ...@@ -97,24 +98,18 @@ public:
///> Links the joint to a given board item (when it's added to the PNS_NODE) ///> Links the joint to a given board item (when it's added to the PNS_NODE)
void Link( PNS_ITEM* aItem ) void Link( PNS_ITEM* aItem )
{ {
LINKED_ITEMS::iterator f = std::find( m_linkedItems.begin(), m_linkedItems.end(), aItem ); if( m_linkedItems.Contains( aItem ) )
if( f != m_linkedItems.end() )
return; return;
m_linkedItems.push_back( aItem ); m_linkedItems.Add( aItem );
} }
///> Unlinks a given board item from the joint (upon its removal from a PNS_NODE) ///> Unlinks a given board item from the joint (upon its removal from a PNS_NODE)
///> Returns true if the joint became dangling after unlinking. ///> Returns true if the joint became dangling after unlinking.
bool Unlink( PNS_ITEM* aItem ) bool Unlink( PNS_ITEM* aItem )
{ {
LINKED_ITEMS::iterator f = std::find( m_linkedItems.begin(), m_linkedItems.end(), aItem ); m_linkedItems.Erase( aItem );
return m_linkedItems.Size() == 0;
if( f != m_linkedItems.end() )
f = m_linkedItems.erase( f );
return m_linkedItems.size() == 0;
} }
///> For trivial joints, returns the segment adjacent to (aCurrent). For non-trival ones, returns ///> For trivial joints, returns the segment adjacent to (aCurrent). For non-trival ones, returns
...@@ -127,16 +122,6 @@ public: ...@@ -127,16 +122,6 @@ public:
return static_cast<PNS_SEGMENT*>( m_linkedItems[m_linkedItems[0] == aCurrent ? 1 : 0] ); return static_cast<PNS_SEGMENT*>( m_linkedItems[m_linkedItems[0] == aCurrent ? 1 : 0] );
} }
PNS_VIA* Via()
{
for( LINKED_ITEMS::iterator i = m_linkedItems.begin(); i != m_linkedItems.end(); ++i )
{
if( (*i)->Kind() == PNS_ITEM::VIA )
return (PNS_VIA*)( *i );
}
return NULL;
}
/// trivial accessors /// trivial accessors
const HASH_TAG& Tag() const const HASH_TAG& Tag() const
...@@ -154,24 +139,24 @@ public: ...@@ -154,24 +139,24 @@ public:
return m_tag.net; return m_tag.net;
} }
LINKED_ITEMS& LinkList() const LINKED_ITEMS& LinkList() const
{ {
return m_linkedItems; return m_linkedItems.CItems();
} }
///> Returns the number of linked items of types listed in aMask. const PNS_ITEMSET& CLinks() const
int LinkCount( int aMask = -1 ) const
{ {
int n = 0; return m_linkedItems;
}
for( LINKED_ITEMS::const_iterator i = m_linkedItems.begin(); PNS_ITEMSET Links() const
i != m_linkedItems.end(); ++i )
{ {
if( (*i)->Kind() & aMask ) return m_linkedItems;
n++;
} }
return n; int LinkCount( int aMask = -1 ) const
{
return m_linkedItems.Count( aMask );
} }
void Dump() const; void Dump() const;
...@@ -188,11 +173,9 @@ public: ...@@ -188,11 +173,9 @@ public:
m_layers.Merge( aJoint.m_layers ); m_layers.Merge( aJoint.m_layers );
// fixme: duplicate links (?) BOOST_FOREACH( PNS_ITEM* item, aJoint.LinkList() )
for( LINKED_ITEMS::const_iterator i = aJoint.m_linkedItems.begin();
i != aJoint.m_linkedItems.end(); ++i )
{ {
m_linkedItems.push_back( *i ); m_linkedItems.Add( item );
} }
} }
...@@ -207,7 +190,7 @@ private: ...@@ -207,7 +190,7 @@ private:
HASH_TAG m_tag; HASH_TAG m_tag;
///> list of items linked to this joint ///> list of items linked to this joint
LINKED_ITEMS m_linkedItems; PNS_ITEMSET m_linkedItems;
}; };
......
...@@ -108,7 +108,7 @@ public: ...@@ -108,7 +108,7 @@ public:
///> Shortcut for comparisons/overlap tests ///> Shortcut for comparisons/overlap tests
static PNS_LAYERSET All() static PNS_LAYERSET All()
{ {
return PNS_LAYERSET( 0, 64 ); return PNS_LAYERSET( 0, 256 ); // fixme: use layer IDs header
} }
private: private:
......
...@@ -123,7 +123,7 @@ int PNS_LINE::Marker()const ...@@ -123,7 +123,7 @@ int PNS_LINE::Marker()const
} }
void PNS_LINE::copyLinks( const PNS_LINE *aParent ) void PNS_LINE::copyLinks( const PNS_LINE* aParent )
{ {
if( aParent->m_segmentRefs == NULL ) if( aParent->m_segmentRefs == NULL )
{ {
...@@ -190,6 +190,9 @@ bool PNS_LINE::Walkaround( SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN& aPre, ...@@ -190,6 +190,9 @@ bool PNS_LINE::Walkaround( SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN& aPre,
line.Intersect( aObstacle, ips ); line.Intersect( aObstacle, ips );
aWalk.Clear();
aPost.Clear();
int nearest_dist = INT_MAX; int nearest_dist = INT_MAX;
int farthest_dist = 0; int farthest_dist = 0;
...@@ -410,7 +413,7 @@ void PNS_LINE::DragCorner ( const VECTOR2I& aP, int aIndex, int aSnappingThresho ...@@ -410,7 +413,7 @@ void PNS_LINE::DragCorner ( const VECTOR2I& aP, int aIndex, int aSnappingThresho
if( aIndex == 0 ) if( aIndex == 0 )
path = dragCornerInternal( m_line.Reverse(), snapped ).Reverse(); path = dragCornerInternal( m_line.Reverse(), snapped ).Reverse();
else if ( aIndex == m_line.SegmentCount() ) else if( aIndex == m_line.SegmentCount() )
path = dragCornerInternal( m_line, snapped ); path = dragCornerInternal( m_line, snapped );
else else
{ {
......
This diff is collapsed.
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <geometry/shape.h> #include <geometry/shape.h>
#include <geometry/shape_line_chain.h> #include <geometry/shape_line_chain.h>
#include "pns_sizes_settings.h"
#include "pns_node.h" #include "pns_node.h"
#include "pns_via.h" #include "pns_via.h"
#include "pns_line.h" #include "pns_line.h"
...@@ -35,6 +36,9 @@ class PNS_ROUTER; ...@@ -35,6 +36,9 @@ class PNS_ROUTER;
class PNS_SHOVE; class PNS_SHOVE;
class PNS_OPTIMIZER; class PNS_OPTIMIZER;
class PNS_ROUTER_BASE; class PNS_ROUTER_BASE;
class PNS_VIA;
class PNS_SIZES_SETTINGS;
/** /**
* Class PNS_LINE_PLACER * Class PNS_LINE_PLACER
...@@ -78,29 +82,19 @@ public: ...@@ -78,29 +82,19 @@ public:
bool FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ); bool FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem );
/** /**
* Function AddVia() * Function ToggleVia()
* *
* Enables/disables a via at the end of currently routed trace. * Enables/disables a via at the end of currently routed trace.
* @param aEnabled if true, a via is attached during placement
* @param aDiameter diameter of the via
* @param aDrill drill of the via
* @param aType Type of the via
*/ */
void AddVia( bool aEnabled, int aDiameter, int aDrill, VIATYPE_T aType ); void ToggleVia( bool aEnabled );
/** /**
* Function SetLayer() * Function SetLayer()
* *
* Sets the current routing layer. * Sets the current routing layer.
*/ */
void SetLayer( int aLayer ); bool SetLayer( int aLayer );
/**
* Function SetWidth()
*
* Sets the current track width.
*/
void SetWidth( int aWidth );
/** /**
* Function Head() * Function Head()
...@@ -184,8 +178,9 @@ public: ...@@ -184,8 +178,9 @@ public:
* a settings class. Used to dynamically change these parameters as * a settings class. Used to dynamically change these parameters as
* the track is routed. * the track is routed.
*/ */
void UpdateSizes( const PNS_ROUTING_SETTINGS& aSettings ); void UpdateSizes( const PNS_SIZES_SETTINGS& aSizes );
bool IsPlacingVia() const { return m_placingVia; }
private: private:
/** /**
* Function route() * Function route()
...@@ -220,7 +215,7 @@ private: ...@@ -220,7 +215,7 @@ private:
* *
* Initializes placement of a new line with given parameters. * Initializes placement of a new line with given parameters.
*/ */
void startPlacement( const VECTOR2I& aStart, int aNet, int aWidth, int aLayer ); void initPlacement( bool aSplitSeg = false );
/** /**
* Function setInitialDirection() * Function setInitialDirection()
...@@ -253,7 +248,7 @@ private: ...@@ -253,7 +248,7 @@ private:
* and redundant vertexes. If a simplification bhas been found, replaces the * and redundant vertexes. If a simplification bhas been found, replaces the
* old line with the simplified one in aNode. * old line with the simplified one in aNode.
*/ */
void simplifyNewLine( PNS_NODE *aNode, PNS_SEGMENT *aLatest ); void simplifyNewLine( PNS_NODE* aNode, PNS_SEGMENT* aLatest );
/** /**
* Function handleViaPlacement() * Function handleViaPlacement()
...@@ -347,6 +342,8 @@ private: ...@@ -347,6 +342,8 @@ private:
///> route step, mark obstacles mode ///> route step, mark obstacles mode
bool rhMarkObstacles( const VECTOR2I& aP, PNS_LINE& aNewHead ); bool rhMarkObstacles( const VECTOR2I& aP, PNS_LINE& aNewHead );
const PNS_VIA makeVia ( const VECTOR2I& aP );
///> current routing direction ///> current routing direction
DIRECTION_45 m_direction; DIRECTION_45 m_direction;
...@@ -378,6 +375,8 @@ private: ...@@ -378,6 +375,8 @@ private:
///> Postprocessed world state (including marked collisions & removed loops) ///> Postprocessed world state (including marked collisions & removed loops)
PNS_NODE* m_lastNode; PNS_NODE* m_lastNode;
PNS_SIZES_SETTINGS m_sizes;
///> Are we placing a via? ///> Are we placing a via?
bool m_placingVia; bool m_placingVia;
...@@ -387,9 +386,6 @@ private: ...@@ -387,9 +386,6 @@ private:
///> current via drill ///> current via drill
int m_viaDrill; int m_viaDrill;
///> current via type
VIATYPE_T m_viaType;
///> current track width ///> current track width
int m_currentWidth; int m_currentWidth;
...@@ -398,10 +394,15 @@ private: ...@@ -398,10 +394,15 @@ private:
bool m_startsOnVia; bool m_startsOnVia;
VECTOR2I m_originalStart, m_currentEnd, m_currentStart; VECTOR2I m_currentEnd, m_currentStart;
PNS_LINE m_currentTrace; PNS_LINE m_currentTrace;
PNS_MODE m_currentMode; PNS_MODE m_currentMode;
PNS_ITEM* m_startItem;
bool m_idle;
bool m_chainedPlacement;
bool m_splitSeg;
}; };
#endif // __PNS_LINE_PLACER_H #endif // __PNS_LINE_PLACER_H
...@@ -121,7 +121,6 @@ PNS_ITEM* PNS_ROUTER::syncPad( D_PAD* aPad ) ...@@ -121,7 +121,6 @@ PNS_ITEM* PNS_ROUTER::syncPad( D_PAD* aPad )
switch( aPad->GetAttribute() ) switch( aPad->GetAttribute() )
{ {
case PAD_STANDARD: case PAD_STANDARD:
layers = PNS_LAYERSET( 0, MAX_CU_LAYERS - 1 ); // TODO necessary? it is already initialized
break; break;
case PAD_SMD: case PAD_SMD:
...@@ -249,31 +248,6 @@ void PNS_ROUTER::SetBoard( BOARD* aBoard ) ...@@ -249,31 +248,6 @@ void PNS_ROUTER::SetBoard( BOARD* aBoard )
TRACE( 1, "m_board = %p\n", m_board ); TRACE( 1, "m_board = %p\n", m_board );
} }
int PNS_ROUTER::NextCopperLayer( bool aUp )
{
LSET mask = m_board->GetEnabledLayers() & m_board->GetVisibleLayers();
LAYER_NUM l = m_currentLayer;
do
{
l += ( aUp ? 1 : -1 );
if( l >= MAX_CU_LAYERS )
l = 0;
if( l < 0 )
l = MAX_CU_LAYERS - 1;
if( mask[l] )
return l;
}
while( l != m_currentLayer );
return l;
}
void PNS_ROUTER::SyncWorld() void PNS_ROUTER::SyncWorld()
{ {
if( !m_board ) if( !m_board )
...@@ -324,10 +298,6 @@ PNS_ROUTER::PNS_ROUTER() ...@@ -324,10 +298,6 @@ PNS_ROUTER::PNS_ROUTER()
m_clearanceFunc = NULL; m_clearanceFunc = NULL;
m_currentLayer = 1;
m_placingVia = false;
m_startsOnVia = false;
m_currentNet = -1;
m_state = IDLE; m_state = IDLE;
m_world = NULL; m_world = NULL;
m_placer = NULL; m_placer = NULL;
...@@ -483,51 +453,21 @@ bool PNS_ROUTER::StartDragging( const VECTOR2I& aP, PNS_ITEM* aStartItem ) ...@@ -483,51 +453,21 @@ bool PNS_ROUTER::StartDragging( const VECTOR2I& aP, PNS_ITEM* aStartItem )
return true; return true;
} }
bool PNS_ROUTER::StartRouting( const VECTOR2I& aP, PNS_ITEM* aStartItem, int aLayer )
bool PNS_ROUTER::StartRouting( const VECTOR2I& aP, PNS_ITEM* aStartItem )
{ {
m_state = ROUTE_TRACK;
m_placer = new PNS_LINE_PLACER( this ); m_placer = new PNS_LINE_PLACER( this );
m_placer->SetLayer( m_currentLayer );
const BOARD_DESIGN_SETTINGS& dsnSettings = m_board->GetDesignSettings(); m_placer->UpdateSizes ( m_sizes );
m_placer->SetLayer( aLayer );
if( dsnSettings.UseNetClassTrack() && aStartItem != NULL ) // netclass value
{
m_settings.SetTrackWidth( aStartItem->Parent()->GetNetClass()->GetTrackWidth() );
}
else
{
m_settings.SetTrackWidth( dsnSettings.GetCurrentTrackWidth() );
}
if( dsnSettings.UseNetClassVia() && aStartItem != NULL ) // netclass value
{
m_settings.SetViaDiameter( aStartItem->Parent()->GetNetClass()->GetViaDiameter() );
m_settings.SetViaDrill( aStartItem->Parent()->GetNetClass()->GetViaDrill() );
}
else
{
m_settings.SetViaDiameter( dsnSettings.GetCurrentViaSize() );
m_settings.SetViaDrill( dsnSettings.GetCurrentViaDrill() );
}
m_placer->UpdateSizes( m_settings );
m_placer->Start( aP, aStartItem ); m_placer->Start( aP, aStartItem );
m_currentEnd = aP; m_currentEnd = aP;
m_currentEndItem = NULL; m_currentEndItem = NULL;
m_state = ROUTE_TRACK;
return true; return true;
} }
const VECTOR2I PNS_ROUTER::CurrentEnd() const
{
return m_currentEnd;
}
void PNS_ROUTER::eraseView() void PNS_ROUTER::eraseView()
{ {
BOOST_FOREACH( BOARD_ITEM* item, m_hiddenItems ) BOOST_FOREACH( BOARD_ITEM* item, m_hiddenItems )
...@@ -564,7 +504,7 @@ void PNS_ROUTER::DisplayItem( const PNS_ITEM* aItem, int aColor, int aClearance ...@@ -564,7 +504,7 @@ void PNS_ROUTER::DisplayItem( const PNS_ITEM* aItem, int aColor, int aClearance
void PNS_ROUTER::DisplayItems( const PNS_ITEMSET& aItems ) void PNS_ROUTER::DisplayItems( const PNS_ITEMSET& aItems )
{ {
BOOST_FOREACH( const PNS_ITEM *item, aItems.CItems() ) BOOST_FOREACH( const PNS_ITEM* item, aItems.CItems() )
DisplayItem( item ); DisplayItem( item );
} }
...@@ -664,7 +604,7 @@ void PNS_ROUTER::updateView( PNS_NODE* aNode, PNS_ITEMSET& aCurrent ) ...@@ -664,7 +604,7 @@ void PNS_ROUTER::updateView( PNS_NODE* aNode, PNS_ITEMSET& aCurrent )
return; return;
if( Settings().Mode() == RM_MarkObstacles ) if( Settings().Mode() == RM_MarkObstacles )
markViolations(aNode, aCurrent, removed); markViolations( aNode, aCurrent, removed );
aNode->GetUpdatedItems( removed, added ); aNode->GetUpdatedItems( removed, added );
...@@ -689,13 +629,14 @@ void PNS_ROUTER::updateView( PNS_NODE* aNode, PNS_ITEMSET& aCurrent ) ...@@ -689,13 +629,14 @@ void PNS_ROUTER::updateView( PNS_NODE* aNode, PNS_ITEMSET& aCurrent )
} }
void PNS_ROUTER::ApplySettings() void PNS_ROUTER::UpdateSizes ( const PNS_SIZES_SETTINGS& aSizes )
{ {
m_sizes = aSizes;
// Change track/via size settings // Change track/via size settings
if( m_state == ROUTE_TRACK) if( m_state == ROUTE_TRACK)
{ {
m_placer->UpdateSizes( m_settings ); m_placer->UpdateSizes( m_sizes );
m_placer->Move( m_currentEnd, m_currentEndItem );
movePlacing( m_currentEnd, m_currentEndItem ); movePlacing( m_currentEnd, m_currentEndItem );
} }
} }
...@@ -791,26 +732,6 @@ void PNS_ROUTER::CommitRouting( PNS_NODE* aNode ) ...@@ -791,26 +732,6 @@ void PNS_ROUTER::CommitRouting( PNS_NODE* aNode )
} }
PNS_VIA* PNS_ROUTER::checkLoneVia( PNS_JOINT* aJoint ) const
{
PNS_VIA* theVia = NULL;
PNS_LAYERSET l;
BOOST_FOREACH( PNS_ITEM* item, aJoint->LinkList() )
{
if( item->Kind() == PNS_ITEM::VIA )
theVia = static_cast<PNS_VIA*>( item );
l.Merge( item->Layers() );
}
if( l.Start() == l.End() )
return theVia;
return NULL;
}
bool PNS_ROUTER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) bool PNS_ROUTER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
{ {
bool rv = false; bool rv = false;
...@@ -819,8 +740,6 @@ bool PNS_ROUTER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) ...@@ -819,8 +740,6 @@ bool PNS_ROUTER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
{ {
case ROUTE_TRACK: case ROUTE_TRACK:
rv = m_placer->FixRoute( aP, aEndItem ); rv = m_placer->FixRoute( aP, aEndItem );
m_startsOnVia = m_placingVia;
m_placingVia = false;
break; break;
case DRAG_SEGMENT: case DRAG_SEGMENT:
...@@ -841,7 +760,17 @@ bool PNS_ROUTER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) ...@@ -841,7 +760,17 @@ bool PNS_ROUTER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
void PNS_ROUTER::StopRouting() void PNS_ROUTER::StopRouting()
{ {
// Update the ratsnest with new changes // Update the ratsnest with new changes
m_board->GetRatsnest()->Recalculate( m_currentNet ); if( m_placer )
{
int n = m_placer->CurrentNet();
if( n >= 0)
{
// Update the ratsnest with new changes
m_board->GetRatsnest()->Recalculate( n );
}
}
if( !RoutingInProgress() ) if( !RoutingInProgress() )
return; return;
...@@ -868,7 +797,7 @@ void PNS_ROUTER::FlipPosture() ...@@ -868,7 +797,7 @@ void PNS_ROUTER::FlipPosture()
if( m_state == ROUTE_TRACK ) if( m_state == ROUTE_TRACK )
{ {
m_placer->FlipPosture(); m_placer->FlipPosture();
m_placer->Move( m_currentEnd, m_currentEndItem ); movePlacing ( m_currentEnd, m_currentEndItem );
} }
} }
...@@ -877,77 +806,38 @@ void PNS_ROUTER::SwitchLayer( int aLayer ) ...@@ -877,77 +806,38 @@ void PNS_ROUTER::SwitchLayer( int aLayer )
{ {
switch( m_state ) switch( m_state )
{ {
case IDLE:
m_currentLayer = aLayer;
break;
case ROUTE_TRACK: case ROUTE_TRACK:
if( m_startsOnVia )
{
m_currentLayer = aLayer;
m_placer->SetLayer( aLayer ); m_placer->SetLayer( aLayer );
}
break; break;
default: default:
break; break;
} }
} }
void PNS_ROUTER::ToggleViaPlacement(VIATYPE_T type) void PNS_ROUTER::ToggleViaPlacement()
{ {
const int layercount = m_board->GetDesignSettings().GetCopperLayerCount();
// Cannot place microvias or blind vias if not allowed (obvious)
if( ( type == VIA_BLIND_BURIED ) && ( !m_board->GetDesignSettings().m_BlindBuriedViaAllowed ) )
return;
if( ( type == VIA_MICROVIA ) && ( !m_board->GetDesignSettings().m_MicroViasAllowed ) )
return;
//Can only place through vias on 2-layer boards
if( ( type != VIA_THROUGH ) && ( layercount <= 2 ) )
return;
//Can only place microvias if we're on an outer layer, or directly adjacent to one
if( ( type == VIA_MICROVIA ) && ( m_currentLayer > In1_Cu ) && ( m_currentLayer < layercount-2 ) )
return;
//Cannot place blind vias with front/back as the layer pair, this doesn't make sense
if( ( type == VIA_BLIND_BURIED ) && ( Settings().GetLayerTop() == F_Cu ) && ( Settings().GetLayerBottom() == B_Cu ) )
return;
if( m_state == ROUTE_TRACK ) if( m_state == ROUTE_TRACK )
{ {
m_placingVia = !m_placingVia; bool toggle = !m_placer->IsPlacingVia();
m_placer->AddVia( m_placingVia, m_settings.GetViaDiameter(), m_settings.GetViaDrill(), type ); m_placer->ToggleVia( toggle );
} }
} }
int PNS_ROUTER::GetCurrentNet() const int PNS_ROUTER::GetCurrentNet() const
{ {
switch( m_state ) if( m_placer )
{
case ROUTE_TRACK:
return m_placer->CurrentNet(); return m_placer->CurrentNet();
return -1;
default:
return m_currentNet;
}
} }
int PNS_ROUTER::GetCurrentLayer() const int PNS_ROUTER::GetCurrentLayer() const
{ {
switch( m_state ) if( m_placer )
{
case ROUTE_TRACK:
return m_placer->CurrentLayer(); return m_placer->CurrentLayer();
return -1;
default:
return m_currentLayer;
}
} }
...@@ -968,3 +858,11 @@ void PNS_ROUTER::DumpLog() ...@@ -968,3 +858,11 @@ void PNS_ROUTER::DumpLog()
if( logger ) if( logger )
logger->Save( "/tmp/shove.log" ); logger->Save( "/tmp/shove.log" );
} }
bool PNS_ROUTER::IsPlacingVia() const
{
if(!m_placer)
return NULL;
return m_placer->IsPlacingVia();
}
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <class_undoredo_container.h> #include <class_undoredo_container.h>
#include "pns_routing_settings.h" #include "pns_routing_settings.h"
#include "pns_sizes_settings.h"
#include "pns_item.h" #include "pns_item.h"
#include "pns_itemset.h" #include "pns_itemset.h"
#include "pns_node.h" #include "pns_node.h"
...@@ -86,13 +87,12 @@ public: ...@@ -86,13 +87,12 @@ public:
void SetView( KIGFX::VIEW* aView ); void SetView( KIGFX::VIEW* aView );
bool RoutingInProgress() const; bool RoutingInProgress() const;
bool StartRouting( const VECTOR2I& aP, PNS_ITEM* aItem ); bool StartRouting( const VECTOR2I& aP, PNS_ITEM* aItem, int aLayer );
void Move( const VECTOR2I& aP, PNS_ITEM* aItem ); void Move( const VECTOR2I& aP, PNS_ITEM* aItem );
bool FixRoute( const VECTOR2I& aP, PNS_ITEM* aItem ); bool FixRoute( const VECTOR2I& aP, PNS_ITEM* aItem );
void StopRouting(); void StopRouting();
const VECTOR2I CurrentEnd() const;
int GetClearance( const PNS_ITEM* aA, const PNS_ITEM* aB ) const; int GetClearance( const PNS_ITEM* aA, const PNS_ITEM* aB ) const;
...@@ -112,7 +112,7 @@ public: ...@@ -112,7 +112,7 @@ public:
void SwitchLayer( int layer ); void SwitchLayer( int layer );
void ToggleViaPlacement( VIATYPE_T type = VIA_NOT_DEFINED ); void ToggleViaPlacement();
int GetCurrentLayer() const; int GetCurrentLayer() const;
int GetCurrentNet() const; int GetCurrentNet() const;
...@@ -123,15 +123,7 @@ public: ...@@ -123,15 +123,7 @@ public:
{ {
return m_clearanceFunc; return m_clearanceFunc;
} }
bool IsPlacingVia() const;
bool IsPlacingVia() const
{
return m_placingVia;
}
int NextCopperLayer( bool aUp );
// typedef boost::optional<hoverItem> optHoverItem;
const PNS_ITEMSET QueryHoverItems( const VECTOR2I& aP ); const PNS_ITEMSET QueryHoverItems( const VECTOR2I& aP );
const VECTOR2I SnapToItem( PNS_ITEM* aItem, VECTOR2I aP, bool& aSplitsSegment ); const VECTOR2I SnapToItem( PNS_ITEM* aItem, VECTOR2I aP, bool& aSplitsSegment );
...@@ -175,7 +167,7 @@ public: ...@@ -175,7 +167,7 @@ public:
* Applies stored settings. * Applies stored settings.
* @see Settings() * @see Settings()
*/ */
void ApplySettings(); void UpdateSizes( const PNS_SIZES_SETTINGS& aSizes );
/** /**
* Changes routing settings to ones passed in the parameter. * Changes routing settings to ones passed in the parameter.
...@@ -184,8 +176,6 @@ public: ...@@ -184,8 +176,6 @@ public:
void LoadSettings( const PNS_ROUTING_SETTINGS& aSettings ) void LoadSettings( const PNS_ROUTING_SETTINGS& aSettings )
{ {
m_settings = aSettings; m_settings = aSettings;
ApplySettings();
} }
void EnableSnapping( bool aEnable ) void EnableSnapping( bool aEnable )
...@@ -198,6 +188,11 @@ public: ...@@ -198,6 +188,11 @@ public:
return m_snappingEnabled; return m_snappingEnabled;
} }
PNS_SIZES_SETTINGS& Sizes()
{
return m_sizes;
}
private: private:
void movePlacing( const VECTOR2I& aP, PNS_ITEM* aItem ); void movePlacing( const VECTOR2I& aP, PNS_ITEM* aItem );
void moveDragging( const VECTOR2I& aP, PNS_ITEM* aItem ); void moveDragging( const VECTOR2I& aP, PNS_ITEM* aItem );
...@@ -211,7 +206,6 @@ private: ...@@ -211,7 +206,6 @@ private:
PNS_ITEM* pickSingleItem( PNS_ITEMSET& aItems ) const; PNS_ITEM* pickSingleItem( PNS_ITEMSET& aItems ) const;
void splitAdjacentSegments( PNS_NODE* aNode, PNS_ITEM* aSeg, const VECTOR2I& aP ); void splitAdjacentSegments( PNS_NODE* aNode, PNS_ITEM* aSeg, const VECTOR2I& aP );
PNS_VIA* checkLoneVia( PNS_JOINT* aJoint ) const;
PNS_ITEM* syncPad( D_PAD* aPad ); PNS_ITEM* syncPad( D_PAD* aPad );
PNS_ITEM* syncTrack( TRACK* aTrack ); PNS_ITEM* syncTrack( TRACK* aTrack );
...@@ -225,9 +219,7 @@ private: ...@@ -225,9 +219,7 @@ private:
void markViolations( PNS_NODE* aNode, PNS_ITEMSET& aCurrent, PNS_NODE::ITEM_VECTOR& aRemoved ); void markViolations( PNS_NODE* aNode, PNS_ITEMSET& aCurrent, PNS_NODE::ITEM_VECTOR& aRemoved );
int m_currentLayer; VECTOR2I m_currentEnd;
int m_currentNet;
RouterState m_state; RouterState m_state;
BOARD* m_board; BOARD* m_board;
...@@ -235,9 +227,7 @@ private: ...@@ -235,9 +227,7 @@ private:
PNS_NODE* m_lastNode; PNS_NODE* m_lastNode;
PNS_LINE_PLACER* m_placer; PNS_LINE_PLACER* m_placer;
PNS_DRAGGER* m_dragger; PNS_DRAGGER* m_dragger;
PNS_LINE* m_draggedLine;
PNS_SHOVE* m_shove; PNS_SHOVE* m_shove;
int m_draggedSegmentIndex;
int m_iterLimit; int m_iterLimit;
bool m_showInterSteps; bool m_showInterSteps;
int m_snapshotIter; int m_snapshotIter;
...@@ -247,11 +237,6 @@ private: ...@@ -247,11 +237,6 @@ private:
PNS_ITEM* m_currentEndItem; PNS_ITEM* m_currentEndItem;
VECTOR2I m_currentEnd;
VECTOR2I m_currentStart;
VECTOR2I m_originalStart;
bool m_placingVia;
bool m_startsOnVia;
bool m_snappingEnabled; bool m_snappingEnabled;
bool m_violation; bool m_violation;
...@@ -264,6 +249,7 @@ private: ...@@ -264,6 +249,7 @@ private:
///> Stores list of modified items in the current operation ///> Stores list of modified items in the current operation
PICKED_ITEMS_LIST m_undoBuffer; PICKED_ITEMS_LIST m_undoBuffer;
PNS_SIZES_SETTINGS m_sizes;
}; };
#endif #endif
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#ifndef __PNS_ROUTING_SETTINGS #ifndef __PNS_ROUTING_SETTINGS
#define __PNS_ROUTING_SETTINGS #define __PNS_ROUTING_SETTINGS
#include <cstdio>
#include "time_limit.h" #include "time_limit.h"
class DIRECTION_45; class DIRECTION_45;
...@@ -107,18 +109,11 @@ public: ...@@ -107,18 +109,11 @@ public:
///> Enables/disables jumping over unmovable obstacles. ///> Enables/disables jumping over unmovable obstacles.
void SetJumpOverObstacles( bool aJumpOverObstacles ) { m_jumpOverObstacles = aJumpOverObstacles; } void SetJumpOverObstacles( bool aJumpOverObstacles ) { m_jumpOverObstacles = aJumpOverObstacles; }
void SetStartDiagonal(bool aStartDiagonal) { m_startDiagonal = aStartDiagonal; } void SetStartDiagonal( bool aStartDiagonal ) { m_startDiagonal = aStartDiagonal; }
bool CanViolateDRC() const { return m_canViolateDRC; } bool CanViolateDRC() const { return m_canViolateDRC; }
void SetCanViolateDRC( bool aViolate ) { m_canViolateDRC = aViolate; } void SetCanViolateDRC( bool aViolate ) { m_canViolateDRC = aViolate; }
void SetTrackWidth( int aWidth ) { m_trackWidth = aWidth; }
int GetTrackWidth() const { return m_trackWidth; }
void SetViaDiameter( int aDiameter ) { m_viaDiameter = aDiameter; }
int GetViaDiameter() const { return m_viaDiameter; }
void SetViaDrill( int aDrill ) { m_viaDrill = aDrill; }
int GetViaDrill() const { return m_viaDrill; }
const DIRECTION_45 InitialDirection() const; const DIRECTION_45 InitialDirection() const;
int ShoveIterationLimit() const; int ShoveIterationLimit() const;
...@@ -127,22 +122,6 @@ public: ...@@ -127,22 +122,6 @@ public:
int WalkaroundIterationLimit() const { return m_walkaroundIterationLimit; }; int WalkaroundIterationLimit() const { return m_walkaroundIterationLimit; };
TIME_LIMIT WalkaroundTimeLimit() const; TIME_LIMIT WalkaroundTimeLimit() const;
void SetLayerPair( int aLayer1, int aLayer2 )
{
if( aLayer1 < aLayer2 )
{
m_layerTop = aLayer1;
m_layerBottom = aLayer2;
}
else
{
m_layerBottom = aLayer1;
m_layerTop = aLayer2;
}
}
int GetLayerTop() const { return m_layerTop; }
int GetLayerBottom() const { return m_layerBottom; }
private: private:
bool m_shoveVias; bool m_shoveVias;
...@@ -158,19 +137,11 @@ private: ...@@ -158,19 +137,11 @@ private:
PNS_MODE m_routingMode; PNS_MODE m_routingMode;
PNS_OPTIMIZATION_EFFORT m_optimizerEffort; PNS_OPTIMIZATION_EFFORT m_optimizerEffort;
int m_trackWidth;
int m_viaDiameter;
int m_viaDrill;
int m_preferredLayer;
int m_walkaroundIterationLimit; int m_walkaroundIterationLimit;
int m_shoveIterationLimit; int m_shoveIterationLimit;
TIME_LIMIT m_shoveTimeLimit; TIME_LIMIT m_shoveTimeLimit;
TIME_LIMIT m_walkaroundTimeLimit; TIME_LIMIT m_walkaroundTimeLimit;
// Routing layers pair
int m_layerTop;
int m_layerBottom;
}; };
#endif #endif
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#include <profile.h> #include <profile.h>
static void sanityCheck( PNS_LINE *aOld, PNS_LINE *aNew ) static void sanityCheck( PNS_LINE* aOld, PNS_LINE* aNew )
{ {
assert( aOld->CPoint( 0 ) == aNew->CPoint( 0 ) ); assert( aOld->CPoint( 0 ) == aNew->CPoint( 0 ) );
assert( aOld->CPoint( -1 ) == aNew->CPoint( -1 ) ); assert( aOld->CPoint( -1 ) == aNew->CPoint( -1 ) );
...@@ -58,26 +58,26 @@ PNS_SHOVE::PNS_SHOVE( PNS_NODE* aWorld, PNS_ROUTER* aRouter ) : ...@@ -58,26 +58,26 @@ PNS_SHOVE::PNS_SHOVE( PNS_NODE* aWorld, PNS_ROUTER* aRouter ) :
PNS_SHOVE::~PNS_SHOVE() PNS_SHOVE::~PNS_SHOVE()
{ {
// free all the stuff we've created during routing/dragging operation. // free all the stuff we've created during routing/dragging operation.
BOOST_FOREACH( PNS_ITEM *item, m_gcItems ) BOOST_FOREACH( PNS_ITEM* item, m_gcItems )
delete item; delete item;
} }
// garbage-collected line assembling // garbage-collected line assembling
PNS_LINE* PNS_SHOVE::assembleLine( const PNS_SEGMENT *aSeg, int *aIndex ) PNS_LINE* PNS_SHOVE::assembleLine( const PNS_SEGMENT* aSeg, int* aIndex )
{ {
PNS_LINE* l = m_currentNode->AssembleLine( const_cast<PNS_SEGMENT*>( aSeg ), aIndex ); PNS_LINE* l = m_currentNode->AssembleLine( const_cast<PNS_SEGMENT*>( aSeg ), aIndex );
m_gcItems.push_back(l); m_gcItems.push_back( l );
return l; return l;
} }
// garbage-collected line cloning // garbage-collected line cloning
PNS_LINE *PNS_SHOVE::cloneLine ( const PNS_LINE *aLine ) PNS_LINE* PNS_SHOVE::cloneLine ( const PNS_LINE* aLine )
{ {
PNS_LINE *l = aLine->Clone(); PNS_LINE* l = aLine->Clone();
m_gcItems.push_back( l ); m_gcItems.push_back( l );
return l; return l;
...@@ -88,7 +88,7 @@ PNS_LINE *PNS_SHOVE::cloneLine ( const PNS_LINE *aLine ) ...@@ -88,7 +88,7 @@ PNS_LINE *PNS_SHOVE::cloneLine ( const PNS_LINE *aLine )
// visually "outwards" of the line/via applying pressure on it. Unfortunately there's no // visually "outwards" of the line/via applying pressure on it. Unfortunately there's no
// mathematical concept of orientation of an open curve, so we use some primitive heuristics: // mathematical concept of orientation of an open curve, so we use some primitive heuristics:
// if the shoved line wraps around the start of the "pusher", it's likely shoved in wrong direction. // if the shoved line wraps around the start of the "pusher", it's likely shoved in wrong direction.
bool PNS_SHOVE::checkBumpDirection( PNS_LINE *aCurrent, PNS_LINE *aShoved ) const bool PNS_SHOVE::checkBumpDirection( PNS_LINE* aCurrent, PNS_LINE* aShoved ) const
{ {
const SEG ss = aCurrent->CSegment( 0 ); const SEG ss = aCurrent->CSegment( 0 );
...@@ -299,7 +299,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSegment( PNS_LINE* aCurrent, PNS_S ...@@ -299,7 +299,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSegment( PNS_LINE* aCurrent, PNS_S
if( rv == SH_OK ) if( rv == SH_OK )
{ {
if ( shovedLine->Marker() & MK_HEAD ) if( shovedLine->Marker() & MK_HEAD )
m_newHead = *shovedLine; m_newHead = *shovedLine;
sanityCheck( obstacleLine, shovedLine ); sanityCheck( obstacleLine, shovedLine );
...@@ -313,18 +313,18 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSegment( PNS_LINE* aCurrent, PNS_S ...@@ -313,18 +313,18 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSegment( PNS_LINE* aCurrent, PNS_S
} }
#ifdef DEBUG #ifdef DEBUG
m_logger.NewGroup ("on-colliding-segment", m_iter); m_logger.NewGroup( "on-colliding-segment", m_iter );
m_logger.Log ( aObstacleSeg, 0, "obstacle-segment"); m_logger.Log( aObstacleSeg, 0, "obstacle-segment" );
m_logger.Log ( aCurrent, 1, "current-line"); m_logger.Log( aCurrent, 1, "current-line" );
m_logger.Log ( obstacleLine, 2, "obstacle-line"); m_logger.Log( obstacleLine, 2, "obstacle-line" );
m_logger.Log ( shovedLine, 3, "shoved-line"); m_logger.Log( shovedLine, 3, "shoved-line" );
#endif #endif
return rv; return rv;
} }
PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingLine( PNS_LINE *aCurrent, PNS_LINE *aObstacle ) PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingLine( PNS_LINE* aCurrent, PNS_LINE* aObstacle )
{ {
PNS_LINE* shovedLine = cloneLine( aObstacle ); PNS_LINE* shovedLine = cloneLine( aObstacle );
...@@ -332,7 +332,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingLine( PNS_LINE *aCurrent, PNS_LINE ...@@ -332,7 +332,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingLine( PNS_LINE *aCurrent, PNS_LINE
if( rv == SH_OK ) if( rv == SH_OK )
{ {
if ( shovedLine->Marker() & MK_HEAD ) if( shovedLine->Marker() & MK_HEAD )
m_newHead = *shovedLine; m_newHead = *shovedLine;
sanityCheck( aObstacle, shovedLine ); sanityCheck( aObstacle, shovedLine );
...@@ -365,7 +365,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE* aCurrent, PNS_SOL ...@@ -365,7 +365,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE* aCurrent, PNS_SOL
{ {
PNS_VIA vh = aCurrent->Via(); PNS_VIA vh = aCurrent->Via();
PNS_VIA* via = NULL; PNS_VIA* via = NULL;
PNS_JOINT* jtStart = m_currentNode->FindJoint ( vh.Pos(), aCurrent ); PNS_JOINT* jtStart = m_currentNode->FindJoint( vh.Pos(), aCurrent );
if( !jtStart ) if( !jtStart )
return SH_INCOMPLETE; return SH_INCOMPLETE;
...@@ -417,7 +417,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE* aCurrent, PNS_SOL ...@@ -417,7 +417,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingSolid( PNS_LINE* aCurrent, PNS_SOL
} }
m_currentNode->Replace( aCurrent, walkaroundLine ); m_currentNode->Replace( aCurrent, walkaroundLine );
walkaroundLine->SetRank ( nextRank ); walkaroundLine->SetRank( nextRank );
#ifdef DEBUG #ifdef DEBUG
m_logger.NewGroup( "on-colliding-solid", m_iter ); m_logger.NewGroup( "on-colliding-solid", m_iter );
...@@ -523,8 +523,8 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc ...@@ -523,8 +523,8 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc
pushedVia->SetRank( aCurrentRank - 1 ); pushedVia->SetRank( aCurrentRank - 1 );
#ifdef DEBUG #ifdef DEBUG
m_logger.Log ( aVia, 0, "obstacle-via"); m_logger.Log( aVia, 0, "obstacle-via" );
m_logger.Log ( pushedVia, 1, "pushed-via"); m_logger.Log( pushedVia, 1, "pushed-via" );
#endif #endif
BOOST_FOREACH( LINE_PAIR lp, draggedLines ) BOOST_FOREACH( LINE_PAIR lp, draggedLines )
...@@ -535,7 +535,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc ...@@ -535,7 +535,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc
m_newHead = *lp.second; m_newHead = *lp.second;
} }
unwindStack(lp.first); unwindStack( lp.first );
if( lp.second->SegmentCount() ) if( lp.second->SegmentCount() )
{ {
...@@ -556,12 +556,12 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc ...@@ -556,12 +556,12 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc
} }
PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingVia (PNS_ITEM* aCurrent, PNS_VIA* aObstacleVia ) PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingVia( PNS_ITEM* aCurrent, PNS_VIA* aObstacleVia )
{ {
int clearance = m_currentNode->GetClearance( aCurrent, aObstacleVia ) ; int clearance = m_currentNode->GetClearance( aCurrent, aObstacleVia ) ;
LINE_PAIR_VEC draggedLines; LINE_PAIR_VEC draggedLines;
bool colLine = false, colVia = false; bool colLine = false, colVia = false;
PNS_LINE *currentLine = NULL; PNS_LINE* currentLine = NULL;
VECTOR2I mtvLine, mtvVia, mtv, mtvSolid; VECTOR2I mtvLine, mtvVia, mtv, mtvSolid;
int rank = -1; int rank = -1;
...@@ -593,11 +593,11 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingVia (PNS_ITEM* aCurrent, PNS_VIA* ...@@ -593,11 +593,11 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onCollidingVia (PNS_ITEM* aCurrent, PNS_VIA*
rank = currentLine->Rank(); rank = currentLine->Rank();
} }
else if (aCurrent->OfKind(PNS_ITEM::SOLID)) else if( aCurrent->OfKind( PNS_ITEM::SOLID ) )
{ {
CollideShapes( aObstacleVia->Shape(), aCurrent->Shape(), CollideShapes( aObstacleVia->Shape(), aCurrent->Shape(),
clearance + PNS_HULL_MARGIN, true, mtvSolid ); clearance + PNS_HULL_MARGIN, true, mtvSolid );
mtv = mtvSolid; mtv = -mtvSolid;
rank = aCurrent->Rank() + 10000; rank = aCurrent->Rank() + 10000;
} }
...@@ -617,7 +617,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE* aCurrent, PN ...@@ -617,7 +617,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE* aCurrent, PN
shoved->ClearSegmentLinks(); shoved->ClearSegmentLinks();
cur->RemoveVia(); cur->RemoveVia();
unwindStack(aCurrent); unwindStack( aCurrent );
BOOST_FOREACH( PNS_ITEM* item, jt->LinkList() ) BOOST_FOREACH( PNS_ITEM* item, jt->LinkList() )
{ {
...@@ -628,7 +628,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE* aCurrent, PN ...@@ -628,7 +628,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE* aCurrent, PN
head->AppendVia( *aObstacleVia ); head->AppendVia( *aObstacleVia );
SHOVE_STATUS st = processSingleLine ( head, cur, shoved ); SHOVE_STATUS st = processSingleLine( head, cur, shoved );
if( st != SH_OK ) if( st != SH_OK )
{ {
...@@ -665,7 +665,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE* aCurrent, PN ...@@ -665,7 +665,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE* aCurrent, PN
if( st != SH_OK ) if( st != SH_OK )
return st; return st;
cur->SetShape ( shoved->CLine() ); cur->SetShape( shoved->CLine() );
} }
if( aCurrent->EndsWithVia() ) if( aCurrent->EndsWithVia() )
...@@ -678,7 +678,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE* aCurrent, PN ...@@ -678,7 +678,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::onReverseCollidingVia( PNS_LINE* aCurrent, PN
m_logger.Log( shoved, 3, "shoved-line" ); m_logger.Log( shoved, 3, "shoved-line" );
#endif #endif
int currentRank = aCurrent->Rank(); int currentRank = aCurrent->Rank();
m_currentNode->Replace ( aCurrent, shoved ); m_currentNode->Replace( aCurrent, shoved );
pushLine( shoved ); pushLine( shoved );
shoved->SetRank( currentRank ); shoved->SetRank( currentRank );
...@@ -691,7 +691,7 @@ void PNS_SHOVE::unwindStack( PNS_SEGMENT *aSeg ) ...@@ -691,7 +691,7 @@ void PNS_SHOVE::unwindStack( PNS_SEGMENT *aSeg )
{ {
for( std::vector<PNS_LINE*>::iterator i = m_lineStack.begin(); i != m_lineStack.end(); ) for( std::vector<PNS_LINE*>::iterator i = m_lineStack.begin(); i != m_lineStack.end(); )
{ {
if( (*i)->ContainsSegment ( aSeg ) ) if( (*i)->ContainsSegment( aSeg ) )
i = m_lineStack.erase( i ); i = m_lineStack.erase( i );
else else
i++; i++;
...@@ -715,7 +715,7 @@ void PNS_SHOVE::unwindStack( PNS_ITEM* aItem ) ...@@ -715,7 +715,7 @@ void PNS_SHOVE::unwindStack( PNS_ITEM* aItem )
{ {
PNS_LINE* l = static_cast<PNS_LINE*>( aItem ); PNS_LINE* l = static_cast<PNS_LINE*>( aItem );
if ( !l->LinkedSegments() ) if( !l->LinkedSegments() )
return; return;
BOOST_FOREACH( PNS_SEGMENT* seg, *l->LinkedSegments() ) BOOST_FOREACH( PNS_SEGMENT* seg, *l->LinkedSegments() )
...@@ -756,7 +756,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter ) ...@@ -756,7 +756,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter )
{ {
PNS_LINE* currentLine = m_lineStack.back(); PNS_LINE* currentLine = m_lineStack.back();
PNS_NODE::OPT_OBSTACLE nearest; PNS_NODE::OPT_OBSTACLE nearest;
SHOVE_STATUS st; SHOVE_STATUS st = SH_NULL;
PNS_ITEM::PnsKind search_order[] = { PNS_ITEM::SOLID, PNS_ITEM::VIA, PNS_ITEM::SEGMENT }; PNS_ITEM::PnsKind search_order[] = { PNS_ITEM::SOLID, PNS_ITEM::VIA, PNS_ITEM::SEGMENT };
...@@ -924,7 +924,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead ) ...@@ -924,7 +924,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead )
if( m_newHead && st == SH_OK ) if( m_newHead && st == SH_OK )
{ {
st = SH_HEAD_MODIFIED; st = SH_HEAD_MODIFIED;
Router()->DisplayDebugLine( m_newHead->CLine(), 3, 20000 ); //Router()->DisplayDebugLine( m_newHead->CLine(), 3, 20000 );
} }
m_currentNode->RemoveByMarker( MK_HEAD ); m_currentNode->RemoveByMarker( MK_HEAD );
...@@ -1028,7 +1028,7 @@ void PNS_SHOVE::runOptimizer( PNS_NODE* aNode, PNS_LINE* aHead ) ...@@ -1028,7 +1028,7 @@ void PNS_SHOVE::runOptimizer( PNS_NODE* aNode, PNS_LINE* aHead )
std::reverse( m_optimizerQueue.begin(), m_optimizerQueue.end() ); std::reverse( m_optimizerQueue.begin(), m_optimizerQueue.end() );
for( std::vector<PNS_LINE*>::iterator i = m_optimizerQueue.begin(); for( std::vector<PNS_LINE*>::iterator i = m_optimizerQueue.begin();
i != m_optimizerQueue.end(); ++i) i != m_optimizerQueue.end(); ++i )
{ {
PNS_LINE* line = *i; PNS_LINE* line = *i;
...@@ -1057,12 +1057,10 @@ void PNS_SHOVE::runOptimizer( PNS_NODE* aNode, PNS_LINE* aHead ) ...@@ -1057,12 +1057,10 @@ void PNS_SHOVE::runOptimizer( PNS_NODE* aNode, PNS_LINE* aHead )
} }
} }
} }
} }
const RANGE<int> PNS_SHOVE::findShovedVertexRange( PNS_LINE *aL ) const RANGE<int> PNS_SHOVE::findShovedVertexRange( PNS_LINE* aL )
{ {
RANGE<int> r; RANGE<int> r;
...@@ -1116,8 +1114,9 @@ const PNS_LINE PNS_SHOVE::NewHead() const ...@@ -1116,8 +1114,9 @@ const PNS_LINE PNS_SHOVE::NewHead() const
return *m_newHead; return *m_newHead;
} }
void PNS_SHOVE::SetInitialLine( PNS_LINE* aInitial ) void PNS_SHOVE::SetInitialLine( PNS_LINE* aInitial )
{ {
m_root = m_root->Branch(); m_root = m_root->Branch();
m_root->Remove ( aInitial ); m_root->Remove( aInitial );
} }
...@@ -104,14 +104,14 @@ private: ...@@ -104,14 +104,14 @@ private:
SHOVE_STATUS pushVia( PNS_VIA* aVia, const VECTOR2I& aForce, int aCurrentRank ); SHOVE_STATUS pushVia( PNS_VIA* aVia, const VECTOR2I& aForce, int aCurrentRank );
void unwindStack( PNS_SEGMENT* aSeg ); void unwindStack( PNS_SEGMENT* aSeg );
void unwindStack( PNS_ITEM *aItem ); void unwindStack( PNS_ITEM* aItem );
void runOptimizer( PNS_NODE* aNode, PNS_LINE* aHead ); void runOptimizer( PNS_NODE* aNode, PNS_LINE* aHead );
void pushLine( PNS_LINE *aL ); void pushLine( PNS_LINE* aL );
void popLine(); void popLine();
const RANGE<int> findShovedVertexRange( PNS_LINE *aL ); const RANGE<int> findShovedVertexRange( PNS_LINE* aL );
PNS_LINE* assembleLine( const PNS_SEGMENT* aSeg, int* aIndex = NULL ); PNS_LINE* assembleLine( const PNS_SEGMENT* aSeg, int* aIndex = NULL );
PNS_LINE* cloneLine( const PNS_LINE* aLine ); PNS_LINE* cloneLine( const PNS_LINE* aLine );
......
/*
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2014 CERN
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <class_board.h>
#include "pns_item.h"
#include "pns_via.h"
#include "pns_solid.h"
#include "pns_node.h"
#include "pns_sizes_settings.h"
int PNS_SIZES_SETTINGS::inheritTrackWidth( PNS_ITEM* aItem )
{
VECTOR2I p;
assert( aItem->Owner() != NULL );
switch( aItem->Kind() )
{
case PNS_ITEM::VIA:
p = static_cast<PNS_VIA*>( aItem )->Pos();
break;
case PNS_ITEM::SOLID:
p = static_cast<PNS_SOLID*>( aItem )->Pos();
break;
case PNS_ITEM::SEGMENT:
return static_cast<PNS_SEGMENT*>( aItem )->Width();
default:
return 0;
}
PNS_JOINT* jt = aItem->Owner()->FindJoint( p, aItem );
assert( jt != NULL );
int mval = INT_MAX;
PNS_ITEMSET linkedSegs = jt->Links().ExcludeItem( aItem ).FilterKinds( PNS_ITEM::SEGMENT );
BOOST_FOREACH( PNS_ITEM* item, linkedSegs.Items() )
{
int w = static_cast<PNS_SEGMENT*>( item )->Width();
mval = std::min( w, mval );
}
return ( mval == INT_MAX ? 0 : mval );
}
void PNS_SIZES_SETTINGS::Init( BOARD* aBoard, PNS_ITEM* aStartItem, int aNet )
{
BOARD_DESIGN_SETTINGS &bds = aBoard->GetDesignSettings();
NETCLASSPTR netClass;
int net = aNet;
if( aStartItem )
net = aStartItem->Net();
if( net >= 0 )
{
NETINFO_ITEM* ni = aBoard->FindNet( net );
if( ni )
{
wxString netClassName = ni->GetClassName();
netClass = bds.m_NetClasses.Find( netClassName );
}
}
if( !netClass )
netClass = bds.GetDefault();
m_trackWidth = 0;
if( bds.m_UseConnectedTrackWidth && aStartItem != NULL )
{
m_trackWidth = inheritTrackWidth( aStartItem );
}
if( !m_trackWidth && ( bds.UseNetClassTrack() && netClass != NULL ) ) // netclass value
{
m_trackWidth = netClass->GetTrackWidth();
}
if( !m_trackWidth )
{
m_trackWidth = bds.GetCurrentTrackWidth();
}
if( bds.UseNetClassVia() && netClass != NULL ) // netclass value
{
m_viaDiameter = netClass->GetViaDiameter();
m_viaDrill = netClass->GetViaDrill();
}
else
{
m_viaDiameter = bds.GetCurrentViaSize();
m_viaDrill = bds.GetCurrentViaDrill();
}
m_layerPairs.clear();
}
void PNS_SIZES_SETTINGS::ClearLayerPairs()
{
m_layerPairs.clear();
}
void PNS_SIZES_SETTINGS::AddLayerPair( int aL1, int aL2 )
{
int top = std::min( aL1, aL2 );
int bottom = std::max( aL1, aL2 );
m_layerPairs[bottom] = top;
m_layerPairs[top] = bottom;
}
void PNS_SIZES_SETTINGS::ImportCurrent( BOARD_DESIGN_SETTINGS& aSettings )
{
m_trackWidth = aSettings.GetCurrentTrackWidth();
m_viaDiameter = aSettings.GetCurrentViaSize();
m_viaDrill = aSettings.GetCurrentViaDrill();
}
int PNS_SIZES_SETTINGS::GetLayerTop() const
{
if( m_layerPairs.empty() )
return F_Cu;
else
return m_layerPairs.begin()->first;
}
int PNS_SIZES_SETTINGS::GetLayerBottom() const
{
if( m_layerPairs.empty() )
return B_Cu;
else
return m_layerPairs.begin()->second;
}
/*
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2014 CERN
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __PNS_SIZES_SETTINGS_H
#define __PNS_SIZES_SETTINGS_H
#include <map>
#include <boost/optional.hpp>
#include "../class_track.h" // for VIATYPE_T
class BOARD;
class BOARD_DESIGN_SETTINGS;
class PNS_ITEM;
class PNS_SIZES_SETTINGS {
public:
PNS_SIZES_SETTINGS() :
m_trackWidth( 100000 ),
m_diffPairWidth( 100000 ),
m_diffPairGap( 125000 ),
m_viaDiameter( 500000 ),
m_viaDrill( 200000 ),
m_viaType( VIA_THROUGH )
{};
~PNS_SIZES_SETTINGS() {};
void Init( BOARD* aBoard, PNS_ITEM* aStartItem = NULL, int aNet = -1 );
void ImportCurrent ( BOARD_DESIGN_SETTINGS& aSettings );
void ClearLayerPairs();
void AddLayerPair( int aL1, int aL2 );
int TrackWidth() const { return m_trackWidth; }
void SetTrackWidth( int aWidth ) { m_trackWidth = aWidth; }
int DiffPairWidth() const { return m_diffPairWidth; }
int DiffPairGap() const { return m_diffPairGap; }
int ViaDiameter() const { return m_viaDiameter; }
void SetViaDiameter( int aDiameter) { m_viaDiameter = aDiameter; }
int ViaDrill() const { return m_viaDrill; }
void SetViaDrill( int aDrill ) { m_viaDrill = aDrill; }
boost::optional<int> PairedLayer ( int aLayerId )
{
if( m_layerPairs.find(aLayerId) == m_layerPairs.end() )
return boost::optional<int>();
return m_layerPairs [ aLayerId ];
}
int GetLayerTop() const;
int GetLayerBottom() const;
void SetViaType( VIATYPE_T aViaType ) { m_viaType = aViaType; }
VIATYPE_T ViaType() const { return m_viaType; }
private:
int inheritTrackWidth( PNS_ITEM* aItem );
int m_trackWidth;
int m_diffPairWidth;
int m_diffPairGap;
int m_viaDiameter;
int m_viaDrill;
VIATYPE_T m_viaType;
std::map<int, int> m_layerPairs;
};
#endif // __PNS_SIZES_SETTINGS_H
...@@ -53,7 +53,7 @@ public: ...@@ -53,7 +53,7 @@ public:
if( aViaType == VIA_THROUGH ) if( aViaType == VIA_THROUGH )
{ {
PNS_LAYERSET allLayers( 0, MAX_CU_LAYERS - 1 ); PNS_LAYERSET allLayers( 0, MAX_CU_LAYERS - 1 );
SetLayers( allLayers); SetLayers( allLayers );
} }
} }
......
...@@ -57,7 +57,7 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::singleStep( PNS_LINE& aPath, ...@@ -57,7 +57,7 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::singleStep( PNS_LINE& aPath,
VECTOR2I last = aPath.CPoint( -1 ); VECTOR2I last = aPath.CPoint( -1 );
if( ( current_obs->m_hull ).PointInside( last ) ) if( ( current_obs->m_hull ).PointInside( last ) || ( current_obs->m_hull ).PointOnEdge( last ) )
{ {
m_recursiveBlockageCount++; m_recursiveBlockageCount++;
...@@ -99,6 +99,9 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::singleStep( PNS_LINE& aPath, ...@@ -99,6 +99,9 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::singleStep( PNS_LINE& aPath,
pnew.Append( path_walk[1] ); pnew.Append( path_walk[1] );
pnew.Append( path_post[1] ); pnew.Append( path_post[1] );
if(!path_post[1].PointCount() || !path_walk[1].PointCount())
current_obs = nearestObstacle( PNS_LINE( aPath, path_pre[1] ) );
else
current_obs = nearestObstacle( PNS_LINE( aPath, path_post[1] ) ); current_obs = nearestObstacle( PNS_LINE( aPath, path_post[1] ) );
prev_recursive = false; prev_recursive = false;
} }
...@@ -108,6 +111,9 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::singleStep( PNS_LINE& aPath, ...@@ -108,6 +111,9 @@ PNS_WALKAROUND::WALKAROUND_STATUS PNS_WALKAROUND::singleStep( PNS_LINE& aPath,
pnew.Append( path_walk[0] ); pnew.Append( path_walk[0] );
pnew.Append( path_post[0] ); pnew.Append( path_post[0] );
if(!path_post[0].PointCount() || !path_walk[0].PointCount())
current_obs = nearestObstacle( PNS_LINE( aPath, path_pre[0] ) );
else
current_obs = nearestObstacle( PNS_LINE( aPath, path_walk[0] ) ); current_obs = nearestObstacle( PNS_LINE( aPath, path_walk[0] ) );
if( !current_obs ) if( !current_obs )
......
...@@ -81,6 +81,7 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS_ITEM* aItem ) ...@@ -81,6 +81,7 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS_ITEM* aItem )
} }
case PNS_ITEM::VIA: case PNS_ITEM::VIA:
m_originLayer = m_layer = ITEM_GAL_LAYER( VIAS_VISIBLE );
m_type = PR_SHAPE; m_type = PR_SHAPE;
m_width = 0; m_width = 0;
m_color = COLOR4D( 0.7, 0.7, 0.7, 0.8 ); m_color = COLOR4D( 0.7, 0.7, 0.7, 0.8 );
......
This diff is collapsed.
...@@ -57,9 +57,12 @@ private: ...@@ -57,9 +57,12 @@ private:
void updateEndItem( TOOL_EVENT& aEvent ); void updateEndItem( TOOL_EVENT& aEvent );
void getNetclassDimensions( int aNetCode, int& aWidth, int& aViaDiameter, int& aViaDrill ); void getNetclassDimensions( int aNetCode, int& aWidth, int& aViaDiameter, int& aViaDrill );
void handleCommonEvents( TOOL_EVENT& evt ); void handleCommonEvents( TOOL_EVENT& evt );
int getStartLayer( const PNS_ITEM* aItem );
void switchLayerOnViaPlacement();
bool onViaCommand( VIATYPE_T aType );
MSG_PANEL_ITEMS m_panelItems; MSG_PANEL_ITEMS m_panelItems;
PNS_ROUTER* m_router; PNS_ROUTER* m_router;
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <boost/function.hpp> #include <boost/function.hpp>
#include <core/typeinfo.h> #include <core/typeinfo.h>
class SELECTION; struct SELECTION;
///> Functor type that checks a specific condition for selected items. ///> Functor type that checks a specific condition for selected items.
typedef boost::function<bool (const SELECTION&)> SELECTION_CONDITION; typedef boost::function<bool (const SELECTION&)> SELECTION_CONDITION;
......
[Desktop Entry] [Desktop Entry]
Categories=Development;Electronics Categories=Development;Electronics;
Comment=Design a printed circuit board Comment=Create a component from a bitmap for use with KiCad
Exec=bitmap2component Exec=bitmap2component
GenericName=EDA Suite GenericName=EDA Suite
Icon=bitmap2component Icon=bitmap2component
MimeType=application/x-bitmap2component-project; MimeType=application/x-bitmap2component-project;
Name=bitmap2component Name=Bitmap to Component Converter
Type=Application Type=Application
Name[en_US]=bitmap2component Name[en_US]=Bitmap to Component Converter
[Desktop Entry] [Desktop Entry]
Categories=Development;Electronics Categories=Development;Electronics;
Comment=Design a printed circuit board Comment=Assign footprints to symbols (part of KiCad)
Exec=cvpcb Exec=cvpcb
GenericName=EDA Suite GenericName=EDA Suite
Icon=cvpcb Icon=cvpcb
MimeType=application/x-cvpcb-project; MimeType=application/x-cvpcb-project;
Name=cvpcb Name=CvPcb
Type=Application Type=Application
Name[en_US]=cvpcb Name[en_US]=CvPcb
[Desktop Entry] [Desktop Entry]
Categories=Development;Electronics Categories=Development;Electronics;
Comment=Design an electronic schematic Comment=Design an electronic schematic
Comment[fr]=Dessiner des schémas électroniques Comment[fr]=Dessiner des schémas électroniques
Exec=eeschema %f Exec=eeschema %f
......
[Desktop Entry] [Desktop Entry]
Categories=Development;Electronics Categories=Development;Electronics;
Comment=Design a printed circuit board Comment=View gerber files
Exec=gerbview Exec=gerbview
GenericName=EDA Suite GenericName=EDA Suite
Icon=gerbview Icon=gerbview
MimeType=application/x-gerbview-project; MimeType=application/x-gerbview-project;
Name=gerbview Name=GerbView
Type=Application Type=Application
Name[en_US]=gerbview Name[en_US]=GerbView
[Desktop Entry] [Desktop Entry]
Categories=Development;Electronics Categories=Development;Electronics;
Comment=Design a printed circuit board Comment=Design a printed circuit board
Comment[fr]=Concevoir un circuit imprimé Comment[fr]=Concevoir un circuit imprimé
Exec=kicad %f Exec=kicad %f
......
[Desktop Entry] [Desktop Entry]
Categories=Development;Electronics Categories=Development;Electronics;
Comment=Design a printed circuit board Comment=Calculator for various electronics related computations
Exec=pcb_calculator Exec=pcb_calculator
GenericName=EDA Suite GenericName=EDA Suite
Icon=pcbcalculator Icon=pcbcalculator
MimeType=application/x-pcbcalculator-project; MimeType=application/x-pcbcalculator-project;
Name=pcbcalculator Name=Pcb Calculator
Type=Application Type=Application
Name[en_US]=pcbcalculator Name[en_US]=Pcb Calculator
[Desktop Entry] [Desktop Entry]
Categories=Development;Electronics Categories=Development;Electronics;
Comment=Design a printed circuit board Comment=Layout a printed circuit board
Exec=pcbnew %f Exec=pcbnew %f
GenericName=EDA Suite GenericName=EDA Suite
Icon=pcbnew Icon=pcbnew
MimeType=application/x-pcbnew-pcb; MimeType=application/x-pcbnew-pcb;
Name=pcbnew Name=Pcbnew
Type=Application Type=Application
Name[en_US]=pcbnew Name[en_US]=Pcbnew
...@@ -848,7 +848,7 @@ bool VRML_LAYER::Tesselate( VRML_LAYER* holes, bool aHolesOnly ) ...@@ -848,7 +848,7 @@ bool VRML_LAYER::Tesselate( VRML_LAYER* holes, bool aHolesOnly )
std::ostringstream ostr; std::ostringstream ostr;
ostr << "Tesselate():FAILED: " << holes->GetError(); ostr << "Tesselate():FAILED: " << holes->GetError();
error = ostr.str(); error = ostr.str();
return NULL; return false;
} }
if( Fault ) if( Fault )
......
...@@ -62,7 +62,6 @@ ...@@ -62,7 +62,6 @@
#define M_PI4 ( M_PI / 4.0 ) #define M_PI4 ( M_PI / 4.0 )
#endif #endif
struct GLUtesselator;
struct VERTEX_3D struct VERTEX_3D
{ {
......
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